This commit is contained in:
2026-06-30 03:43:06 +09:00
parent bc25863597
commit 0658f25455
3 changed files with 45 additions and 0 deletions
+6
View File
@@ -4,6 +4,7 @@ local infinity_container = require('control/infinity-container')
local inserter = require('control/inserter')
local pump = require('control/pump')
local rail_support = require('control/rail-support')
local shortcut = require('control/shortcut')
local trash = require('control/trash')
local function entity_build(event)
@@ -115,3 +116,8 @@ if settings.startup['PHI-MI'].value or (settings.startup['PHI-GM'].value and set
entity_build({entity=event.destination})
end)
end
if settings.startup['PHI-CT'].value then
script.on_event(defines.events.on_lua_shortcut, shortcut.toggle)
script.on_event(defines.events.on_player_toggled_map_editor, shortcut.after_toggle)
end
+27
View File
@@ -0,0 +1,27 @@
local main = {}
function main.toggle(event)
if event.prototype_name ~= 'phi-cl-toggle-editor' then
return
end
local player = game.players[event.player_index]
if player.permission_group and not player.permission_group.allows_action(defines.input_action.toggle_map_editor) then
return
end
if player.admin then
return
end
player.toggle_map_editor()
end
function main.after_toggle(event)
local player = game.players[event.player_index]
player.set_shortcut_toggled('phi-cl-toggle-editor', player.physical_controller_type == defines.controllers.editor)
game.tick_paused = false
end
return main
+12
View File
@@ -168,6 +168,18 @@ if data.raw['infinity-container'] and data.raw['infinity-container']['infinity-c
}})
end
-- CT A 1 BASE SHORTCUT
if data.raw['blueprint-book'] and data.raw['blueprint-book']['blueprint-book'] then
data:extend({{
type = 'shortcut',
name = 'phi-cl-toggle-editor',
action = 'lua',
toggleable = true,
icon = data.raw['blueprint-book']['blueprint-book'].icon,
icon_size = data.raw['blueprint-book']['blueprint-book'].icon_size
}})
end
-- CT A 1 BASE MAP_GEN_PRESET
if settings.startup['PHI-CT-TILE'].value then
data.raw['map-gen-presets']['default']['empty-world'] = {