Add a custom/scriptable TechnologyTrigger

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Subject314159
Burner Inserter
Burner Inserter
Posts: 14
Joined: Thu Oct 12, 2023 8:53 pm
Contact:

Add a custom/scriptable TechnologyTrigger

Post by Subject314159 »

For the mod that I am developing I want to unlock a technology on killing a certain enemy. Unfortunately there is no "on entity destroyed" trigger but I managed to implement this via scripting. However every technology requires either a trigger unlock or a cost, and both of them does not quite convey the essence of the trigger;
ImageImage

Now the road towards unlocking a technology might be different for other mods so implementing specific research triggers would not be efficient for you devs, so maybe it is a good idea to have a custom TechnologyTriggere, which might look like:

Code: Select all

{
   type = "custom" --or "script"
   localised_string = LocalisedString
}
Where the LocalisedString would replace the "Mine [Entity: X]" part.

Optionally it would be nice to have a script unlock trigger, e.g.;

Code: Select all

LuaTechnology.trigger_scripted_research()
Why this would be nice: In editor mode I mined oil before unlocking the technology, removed the oil pump, then research_recursive until oil-gathering. What happened is that oil-processing was also researched, which leads me to believe that the game retains a memory of the trigger unlocks. By calling this function we would set the in-game "memory" of the trigger so that it is automatically unlocked if the trigger occurred before the prerequisites have been met.
Post Reply

Return to “Modding interface requests”