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

This subforum contains all the issues which we already resolved.
Post Reply
azaghal
Burner Inserter
Burner Inserter
Posts: 18
Joined: Sat Jun 27, 2020 11:13 am
Contact:

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

Post by azaghal »

Description
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

    script.on_event(
        defines.events.on_equipment_inserted,
        function(data)
            game.print("Inserted equipment " .. data.equipment.name .. " @" .. data.tick)
        end
    )
    
    commands.add_command(
        "deliver_solar_panel",
        nil,
        function(command)
            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,
            }
    
        end
    )
    
  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

    /deliver_solar_panel
    
  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.

P.S.
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.

Tobias1595
Factorio Staff
Factorio Staff
Posts: 26
Joined: Sat Sep 29, 2018 5:28 pm
Contact:

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

Post by Tobias1595 »

Thanks for the report. The issue will be resolved in the next release.

Post Reply

Return to “Resolved Problems and Bugs”