Jump to content

Recommended Posts

I believe locomotion is handled by the state event for locomote, it is not a very friendly event to modify but if you want to add your own locomotion states you'll probably need to modify this event's function and make yours attempt to run first if valid.

It can be found in the events table of sg_wilson

    EventHandler("locomote", function(inst, data)
        if inst.sg:HasStateTag("busy") then
            return
        end

        local is_moving = inst.sg:HasStateTag("moving")
        local should_move = inst.components.locomotor:WantsToMoveForward()
        
        if inst:HasTag("ingym") then
            inst.sg.statemem.dontleavegym = true
            local gym = inst.components.strongman.gym 
            if gym then
                gym.components.mightygym:CharacterExitGym(inst)
            end
        elseif inst.sg:HasStateTag("bedroll") or inst.sg:HasStateTag("tent") or inst.sg:HasStateTag("waking") then -- wakeup on locomote
            if inst.sleepingbag ~= nil and inst.sg:HasStateTag("sleeping") then
                inst.sleepingbag.components.sleepingbag:DoWakeUp()
                inst.sleepingbag = nil
            end
        elseif is_moving and not should_move then
            inst.sg:GoToState("run_stop")
        elseif not is_moving and should_move then
            inst.sg:GoToState("run_start")
        elseif data.force_idle_state and not (is_moving or should_move or inst.sg:HasStateTag("idle") or inst:HasTag("is_furling"))  then
            inst.sg:GoToState("idle")
        end
    end),

You should be able to edit this somehow using a postinit or maybe a global hook for the stategraph

  • GL Happy 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...