Change character modifiers to a table?

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
sparr
Smart Inserter
Smart Inserter
Posts: 1535
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Change character modifiers to a table?

Post by sparr »

Currently if two mods want to modify the player's running speed modifier dynamically at the same time, there's a problem.

Instead of having a single integer multiplier for speed, what if there was a table? Mods could read and write the table. Keys would be free-form; most mods would put in just one new key. Values would be either +X or *X and would all get applied in some deterministic order (first instinct is + first then *)
Last edited by sparr on Thu May 02, 2019 4:23 pm, edited 1 time in total.
User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2195
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: Change character speed modifiers to a table?

Post by Ranakastrasz »

http://fractalsoftworks.com/starfarer.a ... eStat.html

I would seriously approve of this.
Starsector makes use of this mechanic, and it is very useful.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16
sparr
Smart Inserter
Smart Inserter
Posts: 1535
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: Change character speed modifiers to a table?

Post by sparr »

Thanks for that amazing implementation example!
sparr
Smart Inserter
Smart Inserter
Posts: 1535
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: Change character modifiers to a table?

Post by sparr »

Editing the title of the post, and adding another use case:

If two mods both want to double the player's reach, it would be nice if they could both take effect, with their choice of +X or +X%.
User avatar
Narc
Filter Inserter
Filter Inserter
Posts: 284
Joined: Mon Feb 11, 2013 7:25 am
Contact:

Re: Change character modifiers to a table?

Post by Narc »

+1 this idea. We could also have all those modifiers shown in the effects window (maybe only in debug mode?).
sparr
Smart Inserter
Smart Inserter
Posts: 1535
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: Change character modifiers to a table?

Post by sparr »

further elaboration on ways to make this idea more flexible:

allow a priority level for a change, similar to data/date-updates/data-final-fixes in mod creation.

allow changes to associate themselves with textual tags, which other changes can reference (or other mods can just search for).

allow a change to specify whether it intends to change the base value or is operating as a temporary or permanent bonus to the base.

allow a change to specify whether it should not apply if the result exceeds some cap or floor.
sparr
Smart Inserter
Smart Inserter
Posts: 1535
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: Change character modifiers to a table?

Post by sparr »

https://lua-api.factorio.com/latest/pro ... otype.html

Stickers can be used to accomplish this for character and vehicle speed, with many mods each being able to stack and manage their own modifiers independently.
Post Reply

Return to “Modding interface requests”