Way to detect damaged entities?

Place to get help with not working mods / modding interface.
credomane
Filter Inserter
Filter Inserter
Posts: 321
Joined: Tue Apr 12, 2016 6:21 pm
Contact:

Way to detect damaged entities?

Post by credomane »

It there anyway to detect when any entity is damaged?

The in-game audio alerts for when your stuff getting damaged is incredibly delayed. I often find myself with a chunk of my factory destroyed before the game decides to even play the alert-damaged sound effect let alone when something gets destroyed. If I'm watching for it the alert icons they appear but the sound effect doesn't always play or plays right as the icon disappears.

I've written a "personal" mod the tells me every time one for my units/structures dies. Now I'd like to know when one of my structured gets under 60% health.

Only way I can think of or find is by abusing on_tick to scan all entities hp values and trigger the alert as needed.
Rseding91
Factorio Staff
Factorio Staff
Posts: 15950
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Way to detect damaged entities?

Post by Rseding91 »

The sound plays when an entity is destroyed. That's just a fact since I'm looking at the code that does it now.
If you want to get ahold of me I'm almost always on Discord.
credomane
Filter Inserter
Filter Inserter
Posts: 321
Joined: Tue Apr 12, 2016 6:21 pm
Contact:

Re: Way to detect damaged entities?

Post by credomane »

Rseding91 wrote:The sound plays when an entity is destroyed. That's just a fact since I'm looking at the code that does it now.
What is that sound? So I can manually play it a few times to "learn" it. Does it play for every biter destroyed structure or with a cool down of some sort? I must not realize what it is to notice it then or think it is a sound for something else. I notice my "C&C Red Alert Structure Destroyed" instantly and check the map for biters.

[edit]
I figured out the sound. I thought it was triggered if I was under attack for a while.
Post Reply

Return to “Modding help”