Equivalent of hit_at_collision_position for beams

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Equivalent of hit_at_collision_position for beams

Post by Deadlock989 »

Projectiles have a property hit_at_collision_position, which determines whether any rendered action effects (like create-particle, create-entity etc.) are delivered at the location the projectile hit the collision box. For example, if a bullet strikes a biter nest at the top left corner, the "flash" explosion is rendered at that location and any particles emitted by that explosion are rendered as emanating from that location.

Beams don't have any such property. They do have the random_target_offset property, which means that beam emitters choose a random location within the target collision box to fire at - this gives a nice randomness to beam attacks and stops the beam from firing at folks' feet like it used to.

However, any create_particle effects etc. applied alongside the damage are still rendered from the central entity position. You don't have any leeway there - you can't render particles or explosions from the "tail" part of the beam definition, so you can only do it from the action delivery along with the damage. You can't do it nicely from the damage_effect_trigger property of entities - for example the blood emitted by biters doesn't come from the place the projectile or the beam targetted, it comes from the lower centre of the biter's body.

Would it be possible to have something that ties rendered trigger effects to the hit point of beams, the way you can with projectiles?

Use case: lasers that produce showers of sparks. If this was in damaged_trigger_effect instead - I don't know how you would get the location of the random beam target into that effect - you could have damage-specific showers of rubble from laser-struck walls, globs of meat from nests etc.
Attachments
Untitled.jpg
Untitled.jpg (457.42 KiB) Viewed 462 times
Image

Post Reply

Return to “Modding interface requests”