Page 1 of 1

Searching For References

Posted: Sun Sep 06, 2020 10:57 am
by Suf
Hi all
I've been searching for references regarding adding a new type to the game;example: type = "mining-tool",but it seems there's no references for adding such thing or how to even do it.So if that's possible to do any reference or link of how to make a custom type that would be fantastic.
Second thing i was searching for of how to make a custom module effect for example:effect = { speed = {bonus = 0.5}<<<what i'm trying to do is create a new one that is not in vanilla,but again i couldn't find references of how to create a custom effect.So if that's is also possible to make any reference or link would helps in making such a custom effect would be appreciated.
Thanks in advance.

Re: Searching For References

Posted: Sun Sep 06, 2020 3:39 pm
by robot256
There is no such thing as a custom type in Factorio--it makes modding much simpler in the long run. There are many creative ways to reuse, repurpose, and combine existing types and use scripts to do new things.

For example, the Aircraft Realism mod uses type "car" with different collision masks and swaps the entities via script to simulate takeoff and landing.

Module mods add new combinations of the speed, productivity, and efficiency effects. Custom effects would have to be performed by your scripts based on the presence of your modules.

Your mod could use scripts to alter character modifiers in realtime (walking or mining speed) based on whatever criteria you choose, including the presence of dummy items that "cause" the effect. By default, mining speed is only altered by technology research.

Re: Searching For References

Posted: Sun Sep 06, 2020 4:40 pm
by Suf
robot256 wrote:
Sun Sep 06, 2020 3:39 pm
There is no such thing as a custom type in Factorio--it makes modding much simpler in the long run. There are many creative ways to reuse, repurpose, and combine existing types and use scripts to do new things.

For example, the Aircraft Realism mod uses type "car" with different collision masks and swaps the entities via script to simulate takeoff and landing.

Module mods add new combinations of the speed, productivity, and efficiency effects. Custom effects would have to be performed by your scripts based on the presence of your modules.

Your mod could use scripts to alter character modifiers in realtime (walking or mining speed) based on whatever criteria you choose, including the presence of dummy items that "cause" the effect. By default, mining speed is only altered by technology research.
Thanks for the information,but where can i find the "speed"script or any of other effects modules so i can use it as a reference to make my own custom effect? or it seems i can just use the API page and its sub pages as reference to do just that?

Re: Searching For References

Posted: Sun Sep 06, 2020 4:49 pm
by sparr
The three existing modules are not run by scripts. Their effects are applied by the game engine.

For a custom type the basic approach would be to create a new module with none of the standard bonuses, then in your mod you would check for the presence of the module and change the behavior of the entity the module is in.

Re: Searching For References

Posted: Sun Sep 06, 2020 5:42 pm
by Suf
sparr wrote:
Sun Sep 06, 2020 4:49 pm
The three existing modules are not run by scripts. Their effects are applied by the game engine.

For a custom type the basic approach would be to create a new module with none of the standard bonuses, then in your mod you would check for the presence of the module and change the behavior of the entity the module is in.
Thanks for elaborating on how those effects are made,now i have better understanding on how modules work from scripting perspective :)