mirror of
https://github.com/PHIDIAS0303/factorio-mod-PHI.git
synced 2025-12-27 11:05:22 +09:00
.
This commit is contained in:
@@ -42,6 +42,15 @@ script.on_configuration_changed(function()
|
|||||||
}
|
}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
local function event_reg(event_name, event_handler, event_filter)
|
||||||
|
if storage.phi_cl.event_handler[event_name] then
|
||||||
|
table.insert(storage.phi_cl.event_handler[event_name], {func = event_handler, filter = event_filter})
|
||||||
|
|
||||||
|
else
|
||||||
|
storage.phi_cl.event_handler[event_name] = {{func = event_handler, filter = event_filter}}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local function trash_entity_creation(event)
|
local function trash_entity_creation(event)
|
||||||
if event.entity.name == 'trash-chest' then
|
if event.entity.name == 'trash-chest' then
|
||||||
event.entity.remove_unfiltered_items = true
|
event.entity.remove_unfiltered_items = true
|
||||||
@@ -73,23 +82,14 @@ if settings.startup['PHI-CT'].value then
|
|||||||
if storage.phi_cl.event_handler then
|
if storage.phi_cl.event_handler then
|
||||||
filter = {{filter = 'type', type = 'infinity-container', mode = 'or'}, {filter = 'type', type = 'infinity-pipe', mode = 'or'}}
|
filter = {{filter = 'type', type = 'infinity-container', mode = 'or'}, {filter = 'type', type = 'infinity-pipe', mode = 'or'}}
|
||||||
|
|
||||||
for _, e in pairs({'on_built_entity', 'on_robot_built_entity', 'on_space_platform_built_entity', 'script_raised_built', 'script_raised_revive'}) do
|
for _, event_name in pairs({'on_built_entity', 'on_robot_built_entity', 'on_space_platform_built_entity', 'script_raised_built', 'script_raised_revive'}) do
|
||||||
if storage.phi_cl.event_handler[e] then
|
event_reg(event_name, trash_entity_creation, filter)
|
||||||
table.insert(storage.phi_cl.event_handler[e], {
|
|
||||||
func = trash_entity_creation,
|
|
||||||
filter = filter
|
|
||||||
})
|
|
||||||
|
|
||||||
else
|
|
||||||
storage.phi_cl.event_handler[e] = {{
|
|
||||||
func = trash_entity_creation,
|
|
||||||
filter = filter
|
|
||||||
}}
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
script.on_event({defines.events.on_player_cheat_mode_enabled, defines.events.on_player_cheat_mode_disabled}, hidden_recipe_enable)
|
for _, event_name in pairs({'on_player_cheat_mode_enabled', 'on_player_cheat_mode_disabled'}) do
|
||||||
|
event_reg(event_name, hidden_recipe_enable, nil)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if settings.startup['PHI-GM'].value and settings.startup['PHI-GM'].value ~= '-' then
|
if settings.startup['PHI-GM'].value and settings.startup['PHI-GM'].value ~= '-' then
|
||||||
|
|||||||
Reference in New Issue
Block a user