File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -761,6 +761,26 @@ local function register_tick_handlers()
761761 end
762762end
763763
764+ local register_custom_handlers = function ()
765+ -- Register handlers for custom events raised by other mods when inserter drop or pickup positions are changed
766+
767+ -- Smart_Inserters 2.0.0+
768+ if remote .interfaces [" Smart_Inserters" ] and remote .interfaces [" Smart_Inserters" ][" on_inserter_arm_changed" ] then
769+ script .on_event (remote .call (" Smart_Inserters" , " on_inserter_arm_changed" ), function (event )
770+ if not event .entity or not event .entity .valid then return end
771+ notify (event .entity .unit_number )
772+ end )
773+ end
774+
775+ -- Bob's Adjustable Inserters 0.18.0+
776+ if remote .interfaces [" bobinserters" ] and remote .interfaces [" bobinserters" ][" get_changed_position_event_id" ] then
777+ script .on_event (remote .call (" bobinserters" , " get_changed_position_event_id" ), function (event )
778+ if not event .entity or not event .entity .valid then return end
779+ notify (event .entity .unit_number )
780+ end )
781+ end
782+ end
783+
764784local library = {
765785 -- Event Handling
766786 on_init = function ()
@@ -825,8 +845,12 @@ local library = {
825845 storage .mourners = {}
826846
827847 register_tick_handlers ()
848+ register_custom_handlers ()
849+ end ,
850+ on_load = function ()
851+ register_tick_handlers ()
852+ register_custom_handlers ()
828853 end ,
829- on_load = register_tick_handlers ,
830854 --- @type table<defines.events , function>
831855 events = {
832856 [defines .events .on_surface_cleared ] = function (event )
You can’t perform that action at this time.
0 commit comments