Jump to content

Wolfgang: bufferedaction set while in idle state after powerdown


myxal
  • Version: PC/MAC/Linux Pending

osx_steam, 379591. I think the world tested is Shipwrecked-compatible RoG, but this code is identical in all versions AFAIK.

With ActionQueue, I noticed what looks like a subtle bug in the game. Wolfgang's transformations (specifically powerdown) cause the stategraph to enter their respective states, and then unconditionally go into idle state - basically, Wolfgang stops whatever he's doing. However, wolfgang's buffered action doesn't get failed or cleared, so this action just hangs around until the player makes another SG transition that clears it (typically by moving).

    State{
        name = "powerdown",
        tags = {"busy"},
        onenter = function(inst)
            inst.Physics:Stop()
            inst.AnimState:PlayAnimation("powerdown")
            inst.components.health:SetInvincible(true)
        end,
        
        onexit = function(inst)
            inst.components.health:SetInvincible(false)
            
        end,
        
        events=
        {
            EventHandler("animover", function(inst) inst.sg:GoToState("idle") end),
        },
    },

Actionqueue merely fetches an action using PlayerController:GetClickActions() and submits it back using PlayerController:DoAction(). The latter checks if the action submitted is the same as the one in the bufferedaction field, and returns immediately if the activity (PICK, HARVEST, etc.) and target match.

function PlayerController:DoAction(buffaction)
    if buffaction then
    
        if self.inst.bufferedaction then
            if self.inst.bufferedaction.action == buffaction.action and self.inst.bufferedaction.target == buffaction.target then
                return;
            end
        end
        ...

So what happens is that AQ submits "the same" action (it picks the action for the closest target, so of course it submits the same action if the previous fails for some reason), DoAction returns without doing anything, and the cycle repeats.

684523392_Screenshot2020-05-08at12_42_43.thumb.png.811672fd660ca14374e919236217fa28.png

Of course, the effect (idle SG state with non-nil buffered action, character not doing anything) is observed without the mod as well, though it's extremely easy to miss as moving or clicking another actionable target rectifies the issue.

 

 


Steps to Reproduce
  1. c_spawn("grass",100)
  2. c_sethunger(0.36)
  3. c_select(GetPlayer(); hit backspace
  4. Keep clicking on the spawned grass (IME this always selects the same entity until that grass is harvested), eventually leading to a situation that powerdown event hits while you're in the dolongaction state.
  5. After the powerdown state, character is in the idle state, with buffered action set. 



User Feedback


There are no comments to display.


×
  • Create New...