Page 1 of 1

Changing Speed Based Conditionally

Posted: Tue Feb 02, 2016 7:54 am
by kiba
Hi, I am working on a mod called MagneticFloor.

What I am trying to do is give the player bonus if he has a hoverboard in his inventory and that the tile he's working on is copper-floor.

Alas, there appears to be no way to modify the player's movement speed conditionally.

Re: Changing Speed Based Conditionally

Posted: Tue Feb 02, 2016 2:30 pm
by Phenix0cs
There is a few things you could try (I didnt try any):
- Modify data.raw.entity["overboard"].movement_bonus on the fly (is not an option if you want to support multiplayer)
- Insert a dummy equipment in armor, I dont if it work when armor is full, maybe if you can set size to 0 (probably wont work well)
- Modify game.player.character.friction_modifier or speed, probably limited to having overboard being a "car"

Hope it will help you find a solution.

Re: Changing Speed Based Conditionally

Posted: Tue Feb 02, 2016 4:43 pm
by Phenix0cs
Just got an idea while working on my mod.

Equipment has an energy field that is RW.

So i guess it would be possible to set it at 0 when not on copper-floor.

Re: Changing Speed Based Conditionally

Posted: Tue Feb 02, 2016 7:37 pm
by kiba
Phenix0cs wrote:There is a few things you could try (I didnt try any):
- Modify data.raw.entity["overboard"].movement_bonus on the fly (is not an option if you want to support multiplayer)
- Insert a dummy equipment in armor, I dont if it work when armor is full, maybe if you can set size to 0 (probably wont work well)
- Modify game.player.character.friction_modifier or speed, probably limited to having overboard being a "car"

Hope it will help you find a solution.
Thanks for the suggestion. I'll try them out.

On second thought, I was thinking of using teleport. Probably won't work too well.

Re: Changing Speed Based Conditionally

Posted: Tue Feb 02, 2016 7:47 pm
by Phenix0cs
I think the simplest approach is to make an equipment similar to exoskeleton.

You can copy the exosketon from your factorio folder and modify it in your mod.
/factorio/data/base/prototypes/equipment

Re: Changing Speed Based Conditionally

Posted: Tue Feb 02, 2016 10:14 pm
by kiba
Phenix0cs wrote:There is a few things you could try (I didnt try any):
- Modify data.raw.entity["overboard"].movement_bonus on the fly (is not an option if you want to support multiplayer)
Because it modify ALL movement bonus of every hoverboard?
- Modify game.player.character.friction_modifier or speed, probably limited to having overboard being a "car"
As long as players can do all the things in a car, I won't care too much.

Re: Changing Speed Based Conditionally

Posted: Tue Feb 02, 2016 10:17 pm
by Supercheese
kiba wrote:As long as players can do all the things in a car, I won't care too much.
I don't think players can use the right mouse button to remove structures while in a vehicle.

Re: Changing Speed Based Conditionally

Posted: Tue Feb 02, 2016 10:22 pm
by Phenix0cs
kiba wrote:Because it modify ALL movement bonus of every hoverboard?
yes
kiba wrote:As long as players can do all the things in a car, I won't care too much.
Actions are limited in a car, this is why i suggested the exoskeleton approach.

Re: Changing Speed Based Conditionally

Posted: Wed Feb 03, 2016 5:38 am
by kiba
Phenix0cs wrote:
kiba wrote:Because it modify ALL movement bonus of every hoverboard?
yes
kiba wrote:As long as players can do all the things in a car, I won't care too much.
Actions are limited in a car, this is why i suggested the exoskeleton approach.
Thanks!

Your lateral thinking saved my bacon!

I got my hoverboard to only work on copper surfaces.

This will be swell!