[raiguard][1.1.83] defines.events.on_entity_color_changed is not raised

This subforum contains all the issues which we already resolved.
Pi-C
Smart Inserter
Smart Inserter
Posts: 1738
Joined: Sun Oct 14, 2018 8:13 am
Contact:

[raiguard][1.1.83] defines.events.on_entity_color_changed is not raised

Post by Pi-C »

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:

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}
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

Code: Select all

/c car.damage(50, p.force, "physical", p.character)
you'll get the expected message that the car has been damaged. If you now try running

Code: Select all

/c car.color = red
you'll get no output. Now, just to make sure that the car's color wasn't "red" to begin with, try

Code: Select all

/c car.color = green
Again, there isn't any output.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 603
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

Re: [raiguard][1.1.83] defines.events.on_entity_color_changed is not raised

Post by raiguard »

Thanks for the report, this has been fixed for the next release.
Don't forget, you're here forever.
Pi-C
Smart Inserter
Smart Inserter
Posts: 1738
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: [raiguard][1.1.83] defines.events.on_entity_color_changed is not raised

Post by Pi-C »

Thank you very much for the quick fix! I've already updated the first of my mods which will use the event. :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!
Post Reply

Return to “Resolved Problems and Bugs”