Page 1 of 1

[Tobias][1.1.76] on_equipment_inserted not triggered for locomotives with grid when using item request proxy/bots

Posted: Sun Mar 12, 2023 7:32 pm
by azaghal
Locomotives can be customised to have an equipment grid where player can insert supported equipment items. In addition to manual insertion of equipment by player, it is also possible to create an item request proxy entity targeting the locomotive entity that contains one or more pieces of equipment as modules. The construction bots will then proceed to deliver the item to item request proxy, and will insert the equipment into locomotive's equipment grid (if sufficient space is available).

However, when this happens, the on_equipment_inserted event is never fired.
Reproduction steps
  1. Install and enable mod Vehicle Grid (in order to add locomotive with equipment grid).
  2. Create a minimal mod with the following control.lua content (for reproducing the issue):

    Code: Select all

            game.print("Inserted equipment " .. .. " @" .. data.tick)
            local player = game.get_player(command.player_index)
            local surface = player.surface
            local locomotive = surface.find_entities_filtered{ name = "locomotive" }[1]
            local item_request_proxy = surface.create_entity{
                name = "item-request-proxy",
                target = locomotive,
                modules = { ["solar-panel-equipment"] = 1 },
                position = locomotive.position,
                force = locomotive.force,
  3. Start a new game, and place down entities (using editor or some form of creative mod):
    • Rails with a single locomotive on top.
    • Roboport within locomotive distance with a single construction bot in it.
    • Power source for the roboport.
    • Passive provider chest within roboport distance with a single portable solar panel in it.
  4. Run the console command that will create item request proxy and deliver/install the portable solar panel into the locomotive:

    Code: Select all

  5. Verify that the event handler has printed information about inserted equipment.
Expected results
  • In step (5), information is printed about inserted equipment.
Actual results
  • In step (5), no information is printed about inserted equipment. In other words - the event handler function is never invoked.
Additional details
Placing the equipment into locomotive equipment grid by opening the equipment grid tab does trigger the event and invokes the handler function. However... When inserting the equipment into locomotive equipment grid by holding the equipment in cursor and using Control + Left Click on the locomotive, the event is not triggered either, in spite of equipment being inserted into the equipment grid. This could possibly be a related bug/behaviour.

I hope this does not result in removing the possibility to insert equipment into the equipment grid in this manner, since I am currently working on a mod that would allow player to template equipment grid layour/configuration.

Re: [Tobias][1.1.76] on_equipment_inserted not triggered for locomotives with grid when using item request proxy/bots

Posted: Mon May 08, 2023 10:25 am
by Tobias1595
Thanks for the report. The issue will be resolved in the next release.