1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-11-27 22:38:18 +02:00

Utils fix

This commit is contained in:
Gerkiz
2025-10-26 21:25:15 +01:00
parent d2d1f71d73
commit db98bf6db1
2 changed files with 12 additions and 6 deletions

View File

@@ -348,6 +348,14 @@ local function execute(event)
return reject('Inputted value is not of type boolean. Valid values are: true, false.') return reject('Inputted value is not of type boolean. Valid values are: true, false.')
end end
--[[ if command_data.command_activated and param == 'true' then
return handle_error(output.command_is_active, 'utility/cannot_build')
end
if not command_data.command_activated and param == 'false' then
return handle_error(output.command_is_inactive, 'utility/cannot_build')
end ]]
if param == 'true' then if param == 'true' then
param = true param = true
else else

View File

@@ -220,12 +220,11 @@ Commands.new('refresh', 'Reloads game script')
Commands.new('spaghetti', 'Toggle between disabling bots.') Commands.new('spaghetti', 'Toggle between disabling bots.')
:require_admin() :require_admin()
:require_validation() :require_validation()
:is_activated()
:add_parameter('true/false', true, 'boolean') :add_parameter('true/false', true, 'boolean')
:callback( :callback(
function (player, args) function (player, args)
local force = player.force local force = player.force
if args == 'true' then if args then
game.print('The world has been spaghettified!', { color = Color.success }) game.print('The world has been spaghettified!', { color = Color.success })
force.technologies['logistic-system'].enabled = false force.technologies['logistic-system'].enabled = false
force.technologies['construction-robotics'].enabled = false force.technologies['construction-robotics'].enabled = false
@@ -244,7 +243,7 @@ Commands.new('spaghetti', 'Toggle between disabling bots.')
force.technologies['worker-robots-speed-6'].enabled = false force.technologies['worker-robots-speed-6'].enabled = false
this.spaghetti_enabled = true this.spaghetti_enabled = true
return true return true
elseif args == 'false' then elseif not args then
game.print('The world is no longer spaghett!', { color = Color.yellow }) game.print('The world is no longer spaghett!', { color = Color.yellow })
force.technologies['logistic-system'].enabled = true force.technologies['logistic-system'].enabled = true
force.technologies['construction-robotics'].enabled = true force.technologies['construction-robotics'].enabled = true
@@ -401,11 +400,10 @@ Commands.new('creative', 'Enables creative_mode.')
:require_admin() :require_admin()
:add_parameter('true/false', false, 'boolean') :add_parameter('true/false', false, 'boolean')
:require_validation() :require_validation()
:is_activated()
:callback( :callback(
function (player, args) function (player, args)
local force = player.force local force = player.force
if args == 'true' then if args then
game.print('[CREATIVE] ' .. player.name .. ' has activated creative-mode!', { color = Color.warning }) game.print('[CREATIVE] ' .. player.name .. ' has activated creative-mode!', { color = Color.warning })
Server.to_discord_bold(table.concat { '[Creative] ' .. player.name .. ' has activated creative-mode!' }) Server.to_discord_bold(table.concat { '[Creative] ' .. player.name .. ' has activated creative-mode!' })
@@ -420,7 +418,7 @@ Commands.new('creative', 'Enables creative_mode.')
Public.insert_all_items(_player) Public.insert_all_items(_player)
end end
end end
elseif args == 'false' then elseif not args then
game.print('[CREATIVE] ' .. player.name .. ' has deactivated creative-mode!', { color = Color.warning }) game.print('[CREATIVE] ' .. player.name .. ' has deactivated creative-mode!', { color = Color.warning })
Server.to_discord_bold(table.concat { '[Creative] ' .. player.name .. ' has deactivated creative-mode!' }) Server.to_discord_bold(table.concat { '[Creative] ' .. player.name .. ' has deactivated creative-mode!' })