Currently
defines.events.on_robot_mined_entity
defines.events.on_robot_built_entity
defines.events.on_robot_mined
are called (in that order), but not defines.events.on_robot_pre_mined
defines.events.on_robot_pre_mined to be called when robot upgrades an entity
-
- Inserter
- Posts: 24
- Joined: Mon Feb 11, 2019 12:37 pm
- Contact:
-
- Fast Inserter
- Posts: 189
- Joined: Fri Sep 09, 2022 4:33 pm
- Contact:
Re: defines.events.on_robot_pre_mined to be called when robot upgrades an entity
ping. still not working in [1.1.104]. unrelated note, why are on_robot_mined and on_robot_mined_entity two different things? is on_robot_mined_entity supposed to act like on_robot_pre_mined?
If you need to reach me, message me on discord.
I make qol mods. Check them out, maybe.
https://mods.factorio.com/user/protocol_1903
If you have a mod idea, I can look into it.
I make qol mods. Check them out, maybe.
https://mods.factorio.com/user/protocol_1903
If you have a mod idea, I can look into it.
Re: defines.events.on_robot_pre_mined to be called when robot upgrades an entity
That's explained in the Lua-API description. on_robot_mined triggers when an entity (as opposed to a tile) has been mined. Also, on_robot_mined_entity acts like on_robot_post_mined: the entity has already been mined, but it still exists, so mods can access it. This can be useful when you are dealing with compound entities, where you have one main (visible) entity that the player communicates with and one or more (possibly hidden) auxiliary entities that provide special functionality. In this case, you could physically remove the auxiliary entities and clean up your tables when the event is triggered for the main entity.protocol_1903 wrote: Sun Feb 18, 2024 8:35 am why are on_robot_mined and on_robot_mined_entity two different things? is on_robot_mined_entity supposed to act like on_robot_pre_mined?
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
-
- Fast Inserter
- Posts: 189
- Joined: Fri Sep 09, 2022 4:33 pm
- Contact:
Re: defines.events.on_robot_pre_mined to be called when robot upgrades an entity
You can do the exact same thing with on_robot_pre_mined. The entity is still accessible. The only difference is one has a buffer and one does not. It doesn't make sense, as both are redundant. Both only relate to entities. So why have both?Pi-C wrote: Sun Feb 18, 2024 9:21 am This can be useful when you are dealing with compound entities, where you have one main (visible) entity that the player communicates with and one or more (possibly hidden) auxiliary entities that provide special functionality. In this case, you could physically remove the auxiliary entities and clean up your tables when the event is triggered for the main entity.
If you need to reach me, message me on discord.
I make qol mods. Check them out, maybe.
https://mods.factorio.com/user/protocol_1903
If you have a mod idea, I can look into it.
I make qol mods. Check them out, maybe.
https://mods.factorio.com/user/protocol_1903
If you have a mod idea, I can look into it.
Re: defines.events.on_robot_pre_mined to be called when robot upgrades an entity
pre_mined will get called several times as construction robots empty out the entity. on_mined will get called once with the results of mining the entity in the buffer.
So they have functional differences depending on what you are trying to do.
So they have functional differences depending on what you are trying to do.
If you want to get ahold of me I'm almost always on Discord.
-
- Fast Inserter
- Posts: 189
- Joined: Fri Sep 09, 2022 4:33 pm
- Contact:
Re: defines.events.on_robot_pre_mined to be called when robot upgrades an entity
Then why is it not called when upgrading an entity?
If you need to reach me, message me on discord.
I make qol mods. Check them out, maybe.
https://mods.factorio.com/user/protocol_1903
If you have a mod idea, I can look into it.
I make qol mods. Check them out, maybe.
https://mods.factorio.com/user/protocol_1903
If you have a mod idea, I can look into it.
Re: defines.events.on_robot_pre_mined to be called when robot upgrades an entity
Because nobody added it when writing the upgrade entity logic.
If you want to get ahold of me I'm almost always on Discord.