This commit is contained in:
2026-07-03 16:00:48 +09:00
parent 5645a3121d
commit 8644fedd86
2 changed files with 32 additions and 12 deletions
+24 -8
View File
@@ -57,15 +57,23 @@ script.on_configuration_changed(function()
end
end)
script.on_event(defines.events.on_player_created, function(event)
if not event.player_index or not game.players[event.player_index] then
return
end
local player = game.players[event.player_index]
if (settings.startup['PHI-MI'].value and settings.startup['PHI-MI-GENERIC'].value) or (settings.startup['PHI-GM'].value and settings.startup['PHI-GM'].value ~= '') then
gui_create(player)
end
if settings.startup['PHI-CT'].value then
editor.available(player)
end
end)
if (settings.startup['PHI-MI'].value and settings.startup['PHI-MI-GENERIC'].value) or (settings.startup['PHI-GM'].value and settings.startup['PHI-GM'].value ~= '') then
script.on_event(defines.events.on_player_created, function(event)
if not event.player_index or not game.players[event.player_index] then
return
end
gui_create(game.players[event.player_index])
end)
script.on_event(defines.events.on_gui_opened, function(event)
if not event.player_index or not game.players[event.player_index] then
return
@@ -105,4 +113,12 @@ end
if settings.startup['PHI-CT'].value then
script.on_event(defines.events.on_lua_shortcut, editor.toggle)
script.on_event(defines.events.on_player_toggled_map_editor, editor.toggle_editor)
script.on_event({defines.events.on_player_promoted, defines.events.on_player_demoted}, function(event)
if not event.player_index or not game.players[event.player_index] then
return
end
editor.available(game.players[event.player_index])
end)
end
+8 -4
View File
@@ -5,13 +5,13 @@ function main.toggle(event)
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
if not event.player_index then
return
end
if not player.admin then
local player = game.players[event.player_index]
if not player then
return
end
@@ -24,4 +24,8 @@ function main.toggle_editor(event)
game.tick_paused = false
end
function main.available(player)
player.set_shortcut_available('phi-cl-toggle-editor', player.admin and player.permission_group and player.permission_group.allows_action(defines.input_action.toggle_map_editor))
end
return main