[Rseding] [1.1.36] speed_multiplier_when_out_of_energy=0 doesn't trigger any events or death anim for non-combat robots

Post Reply
User avatar
Silari
Filter Inserter
Filter Inserter
Posts: 490
Joined: Sat Jan 27, 2018 10:04 pm
Contact:

[Rseding] [1.1.36] speed_multiplier_when_out_of_energy=0 doesn't trigger any events or death anim for non-combat robots

Post by Silari »

What
Setting speed_multiplier_when_out_of_energy=0 on a logistic or construction robot doesn't fire any event when the robot dies, nor does the robots death animation fire. Instead, they just immediately disappear from the map. This is in contrast to combat robots, where they fire the on_combat_robot_expired event and play their normal death animation.
How to reproduce
Download the attached files, activate the mod and load the save game. Grab each of the robots off the quickbar and place them in world. The combat robot will float around and die, firing the on_combat_robot_expired event and it's death animation normally. The construction and logistic robot will float in place until their energy runs out, then immediately disappear, without any event firing or death animation playing.

The mod does 3 things. First, it sets speed_multiplier_when_out_of_energy=0 on both robots. Second, it increases their energy_per_tick to reduce the time it takes them to die. Third, in the control stage it registers events to print out a message when any of the following events occur: on_combat_robot_expired, on_entity_died, on_entity_damaged, on_entity_destroyed, and script_raised_destroy. Those are all the events that seem to possibly be related, but none of them are called when construction/logistic robots die, but combat robots properly trigger on_combat_robot_expired.
What's Expected
For dying robots to trigger an event when they die. Preferably the on_combat_robot_expired event, like other robots do when they run out of energy, the normal on_entity_died event, or maybe a new event for on_robot_expired if it's not desirable to include them with combat robots.

It's also expected their death animation triggers when they die, same as combat robots.



I don't think changing on_combat_robot_expired to fire for these would really affect many mods (both because I doubt this event gets used much and it only matters if someone changes logi/con robots - don't know of any mods so far that do), and the few it does affect could easily check for type=="combat-robot" (or filtering added to the event for that) to retain the exact same behavior it has now.

Including it with on_entity_died would be the least preferable, as that means extra LUA code to try and figure out what made the robot die - health or energy or something else, but at least it'd be possible, unlike now.
Attachments
RobotCrash_1.1.0.zip
Mod
(1.05 KiB) Downloaded 80 times
robottest.zip
Save
(1.32 MiB) Downloaded 76 times
factorio-current.log
(6.8 KiB) Downloaded 74 times

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [Rseding] [1.1.36] speed_multiplier_when_out_of_energy=0 doesn't trigger any events or death anim for non-combat rob

Post by Rseding91 »

Thanks for the report. This is one of those "grey" area reports where technically nothing is broken (not a bug) but it's still desired that some event happens. So, I'm moving this to modding interface requests and also I've implemented it for the next release.
If you want to get ahold of me I'm almost always on Discord.

Post Reply

Return to “Implemented mod requests”