Milestones

by Wiwiweb

Keep track of your progress in a fun way by finding out how fast you created key items. Look back on your factory's history, compare with your friends, or challenge yourself. Compatible out-of-the-box with most overhaul mods, and can be customized to work with any mod. Can be added to existing games.

Utilities
6 days ago
1.1 - 2.1
337K

b [Changed] On_milestone_reached_event never fires

Have hooked the external event in my mod, without modifications the external event never fires

in remote_interface.lua - get_on_milestone_reached_event() is not returning the event it of On_milestone_reached_event

On_milestone_reached_event is the event which gets raised in tracker.lua

Have tested changing to the correct event and it fires.

Would also be nice to get some documentation on what is actually being sent in the event data as i cant make heads or tales of it

6 days ago
(updated 6 days ago)

Turns out this was broken since 2023. Oops.
I changed the way the custom event works using the more modern API way to do custom events. You can use it like this now:

local milestones_event = prototypes.custom_event.milestones_on_milestone_reached
if milestones_event then
    script.on_event(milestones_event, function(event)
        game.print(serpent.block(event))
    end)
end

The event attributes are:

  • force_name (string): Which force achieved the milestone.
  • milestone_name (string): The name of the item/entity/technology that was the goal achieved.
  • quantity (int): The quantity that was required for the goal. For technologies, this is the technology level.
  • type (string): One of item,fluid,kill,technology,item_consumption,fluid_consumption
  • completion_tick (int)
  • completion_time (string): Equivalent to completion_tick but formatted as a normal time.
  • message (array): The full LocalisedString printed by Milestones in chat.

New response