Changing Speed Based Conditionally

Place to get help with not working mods / modding interface.
kiba
Filter Inserter
Filter Inserter
Posts: 344
Joined: Thu Jun 11, 2015 5:32 am
Contact:

Changing Speed Based Conditionally

Post 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.

Phenix0cs
Inserter
Inserter
Posts: 22
Joined: Mon Jan 11, 2016 1:30 am
Contact:

Re: Changing Speed Based Conditionally

Post 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.

Phenix0cs
Inserter
Inserter
Posts: 22
Joined: Mon Jan 11, 2016 1:30 am
Contact:

Re: Changing Speed Based Conditionally

Post 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.

kiba
Filter Inserter
Filter Inserter
Posts: 344
Joined: Thu Jun 11, 2015 5:32 am
Contact:

Re: Changing Speed Based Conditionally

Post 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.

Phenix0cs
Inserter
Inserter
Posts: 22
Joined: Mon Jan 11, 2016 1:30 am
Contact:

Re: Changing Speed Based Conditionally

Post 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

kiba
Filter Inserter
Filter Inserter
Posts: 344
Joined: Thu Jun 11, 2015 5:32 am
Contact:

Re: Changing Speed Based Conditionally

Post 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.

Supercheese
Filter Inserter
Filter Inserter
Posts: 841
Joined: Mon Sep 14, 2015 7:40 am
Contact:

Re: Changing Speed Based Conditionally

Post 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.

Phenix0cs
Inserter
Inserter
Posts: 22
Joined: Mon Jan 11, 2016 1:30 am
Contact:

Re: Changing Speed Based Conditionally

Post 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.

kiba
Filter Inserter
Filter Inserter
Posts: 344
Joined: Thu Jun 11, 2015 5:32 am
Contact:

Re: Changing Speed Based Conditionally

Post 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!

Post Reply

Return to “Modding help”