Are you listening....? (to the script_raised_revive event)

Place to post guides, observations, things related to modding that are not mods themselves.
Post Reply
User avatar
ownlyme
Filter Inserter
Filter Inserter
Posts: 400
Joined: Thu Dec 21, 2017 8:02 am
Contact:

Are you listening....? (to the script_raised_revive event)

Post by ownlyme »

I recently discovered that basically all of my mods are incompatible with klonan's "construction drones"
https://mods.factorio.com/mod/Construct ... 000ddd66a4
mods.factorio.com/user/ownlyme
My requests: uiAbove||Grenade arc||Blueprint allies||Creeps forget command/ don't get removed||Player Modifiers||textbox::selection||Better Heat IF||Singleplayer RCON||tank bug w/ min_range >= projectile_creation_distance

User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5148
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: Are you listening....? (to the script_raised_revive event)

Post by Klonan »

So make your mods compatible by using the base game scripting feature designed for exactly the situation that construction drone uses it for.

Mods shouldn't be raising created events manually in this situation, it leads to many incompatibilities and problems,
The script_raised_revived is exactly the event that should be used when a mod is reviving a ghost

No mod will adjust if everybody keeps using the old inferior method, the status quo would be upheld
So it is a good position that I am obligated to take for the greater good, to use the new feature that is meant for the situation.

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Are you listening....? (to the script_raised_revive event)

Post by eradicator »

Code: Select all

{on_built_entity,on_robot_built_entity,script_raised_built}
Honestly all my build/remove handlers listen to "triplets" and at this point i ask myself why they're three seperate events at all (except for historical reasons), as i can't think of any common situation where a mod would want them seperate. Also a problem with script_raised_* in general is that it's not properly sanitized and can contain garbage like invalid entity wrappers (as far as i remember). In my own code i invented "event groups" for this very reason, so i just subscribe to "group_on_built", but people updating their old mods won't know of new 0.17 features if they don't get external hints.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3699
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: Are you listening....? (to the script_raised_revive event)

Post by DaveMcW »

In 0.17, you need to listen to 5 events to catch every entity.

on_built_entity
on_robot_built_entity
script_raised_built
script_raised_revive
on_entity_cloned

To make it more awkward, they use different parameters to store the entity.

on_built_entity - created_entity
on_robot_built_entity - created_entity
script_raised_built - entity
script_raised_revive - entity
on_entity_cloned - destination

Post Reply

Return to “Modding discussion”