Page 1 of 1

Event.on_entity_collision

Posted: Sun Jan 14, 2018 10:25 pm
by Earendel
on_entity_collision

Called when a car or train collides with another entity

contains:

entity_a: LuaEntity the entity instigating the collision (a vehicle)
entity_b: LuaEntity the entity being hit (can be a vehicle or other sort of entity) or nil
tile_b: LuaTile the tile being hit or nil

Either entity_b or tile_b should be populated.

In a collision between two vehicles entity_a or entity_b could be either vehicle, entity_a is probably whichever one gets processed first.

Re: Event.on_entity_collision

Posted: Mon Jan 15, 2018 5:27 am
by darkfrei

Re: Event.on_entity_collision

Posted: Mon Jan 15, 2018 1:26 pm
by Earendel
Those won't do the same thing. When you collide with a tile (like a water tile) you take no damage. If you have 100% impact resistance you take no damage when you crash.
on_entity_collision would allow you to detect a collision without requiring that collision to deal damage (which is desirable with automated vehicles).