mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2025-12-27 03:25:23 +09:00
* Fix bugs in core and add default args to Gui defs * Refactor production Gui * Refactor landfill blueprint button * Fix more bugs in core * Consistent naming of new guis * Refactor module inserter gui * Refactor surveillance gui * Add shorthand for data from arguments * Make element names consistent * Add types * Change how table rows work * Refactor player stats gui * Refactor quick actions gui * Refactor research milestones gui * Refactor player bonus gui * Refactor science production gui * Refactor autofill gui * Cleanup use of aligned flow * Rename "Gui.element" to "Gui.define" * Rename Gui types * Rename property_from_arg * Add guide for making guis * Add full reference document * Add condensed reference * Apply style guide to refactored guis * Bug fixes
30 lines
1.1 KiB
Lua
30 lines
1.1 KiB
Lua
--[[-- Commands - Sudo
|
|
System command to execute a command as another player using their permissions (except for permissions group actions)
|
|
|
|
--- Run the example command as another player
|
|
-- As Cooldude2606: /repeat 5
|
|
/_system-sudo Cooldude2606 repeat 5
|
|
]]
|
|
|
|
local Commands = require("modules/exp_commands")
|
|
|
|
Commands.new("_sudo", { "exp-commands_sudo.description" })
|
|
:argument("player", { "exp-commands_sudo.arg-player" }, Commands.types.player)
|
|
:argument("command", { "exp-commands_sudo.arg-command" }, Commands.types.key_of(Commands.registered_commands))
|
|
:optional("arguments", { "exp-commands_sudo.arg-arguments" }, Commands.types.string)
|
|
:enable_auto_concatenation()
|
|
:add_flags{ "system_only" }
|
|
:register(function(_player, player, command, parameter)
|
|
--- @cast player LuaPlayer
|
|
--- @cast command ExpCommand
|
|
--- @cast parameter string
|
|
|
|
--- @diagnostic disable-next-line: invisible
|
|
return Commands._event_handler{
|
|
name = command.name,
|
|
tick = game.tick,
|
|
player_index = player.index,
|
|
parameter = parameter,
|
|
}
|
|
end)
|