To reproduce, start a new game, then run this on the command line:
Code: Select all
/c script.on_event(defines.events.on_entity_damaged, function(event)game.print(string.format("Damaged entity: %s (%s)", event.entity.name, event.entity.unit_number)) end)
script.on_event(defines.events.on_entity_color_changed, function(event)game.print(string.format("New color of %s (%s): %s", event.entity.name, event.entity.unit_number, serpent.line(event.entity.color))) end)
p = game.player; red = {r = 1, a = 1}; green = {g = 1, a = 1}
car = p.surface.create_entity{name = "car", position = {p.position.x+2, p.position.y}, force = p.force}
If you run
Code: Select all
/c car.damage(50, p.force, "physical", p.character)
Code: Select all
/c car.color = red
Code: Select all
/c car.color = green