Jump to content

Is it possible to become unaffected by the speed bonus of roads?


Recommended Posts

For the character I'm making (this is the last request, I swear!), to offset the speed bonus around trees, maybe being unaffected by the speed boost of roads (or maybe half the bonus?) would balance them out nicely. I found some variables like "self.fasteronroad" in components\locomotor.lua, but other than that I couldn't find a lot relating to the speed bonus. Any help  will be greatly appreciated!

Edited by Cherryzion
Link to comment
Share on other sites

@Romanful

For your custom player have this in the master_postinit:

local FasterOnRoad_old = inst.components.locomotor.FasterOnRoad
inst.components.locomotor.FasterOnRoad = function(self, ...)
    self.fasteronroad = false
    return FasterOnRoad_old(self, ...)
end

Reason why I'm setting it constantly here is because if the player's state changes from something else (ghost/other mod/etc) then it might revert your edits, and it's much easier just keeping it set to false than having to bother with mod integration.

 

I didn't quite test how this will affect client movement prediction when it's enabled, as I have it permanently disabled.

Link to comment
Share on other sites

6 minutes ago, Romanful said:

Like I think roads increase speed by 50%, would it be possible to make it 25%?

inst.components.locomotor.fastmultiplier = 0.5

 

I suppose this could also be a way to disable roads, by setting this to 1.0.

(Though by doing this would also disable mounts getting speed bonuses)

Edited by CarlZalph
Link to comment
Share on other sites

15 minutes ago, CarlZalph said:

inst.components.locomotor.fastmultiplier = 0.5

Would that only do it on roads, or for all fast multipliers (like the walking cane, or my custom tree speed bonus)? 

17 minutes ago, CarlZalph said:

(Though by doing this would also disable mounts getting speed

All speed bonus? Or just speed bonus for roads? Because it would be sort of canon if the character wasn't good at riding animals either.

Sorry for all the questions, just trying to be thorough!

Link to comment
Share on other sites

9 minutes ago, Romanful said:

Would that only do it on roads, or for all fast multipliers (like the walking cane, or my custom tree speed bonus)? 

All speed bonus? Or just speed bonus for roads? Because it would be sort of canon if the character wasn't good at riding animals either.

Sorry for all the questions, just trying to be thorough!

Should only affect road bonus movement.

Its only use is in the locomotor component itself:

        self.groundspeedmultiplier = self:FasterOnRoad() and (
                (RoadManager ~= nil and RoadManager:IsOnRoad(x, 0, z)) or
                ground.Map:GetTileAtPoint(x, 0, z) == GROUND.ROAD
            ) and self.fastmultiplier or 1

 

Link to comment
Share on other sites

5 minutes ago, CarlZalph said:

Should only affect road bonus movement.

okay awesome. 

and i wouldn't need any of this, right? 

local FasterOnRoad_old = inst.components.locomotor.FasterOnRoad
inst.components.locomotor.FasterOnRoad = function(self, ...)
    self.fasteronroad = false
    return FasterOnRoad_old(self, ...)
end

just inst.components.locomotor.fastmultiplier = 0.5 in master_postinit

This is the last question, I swear! Thank you for all the help!

Link to comment
Share on other sites

7 minutes ago, Romanful said:

okay awesome. 

and i wouldn't need any of this, right? 


local FasterOnRoad_old = inst.components.locomotor.FasterOnRoad
inst.components.locomotor.FasterOnRoad = function(self, ...)
    self.fasteronroad = false
    return FasterOnRoad_old(self, ...)
end

just inst.components.locomotor.fastmultiplier = 0.5 in master_postinit

This is the last question, I swear! Thank you for all the help!

Yeah, that's to disable the non-mount bonuses.

Just using the multiplier will affect both non-mount and mounted bonuses.

Link to comment
Share on other sites

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
 Share

×
  • Create New...