[raiguard][1.1.83] defines.events.on_entity_color_changed is not raised
Posted: Thu Jun 15, 2023 9:57 am
In Factorio 1.1.83, the event on_entity_color_changed has been added -- thanks for that! Unfortunately, it seems the event won't be raised.
To reproduce, start a new game, then run this on the command line:
This will create an event handler for the new event, and a handler for on_entity_damaged that we'll use for reference.
If you run
you'll get the expected message that the car has been damaged. If you now try running
you'll get no output. Now, just to make sure that the car's color wasn't "red" to begin with, try
Again, there isn't any output.
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