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

More porting for 2.0

This commit is contained in:
Gerkiz
2024-10-25 21:56:34 +02:00
parent 8942a5714a
commit 93cdb0fb54
33 changed files with 574 additions and 444 deletions

View File

@@ -498,6 +498,19 @@ function Public:add_parameter(name, optional, as_type)
return self
end
--- Adds an alias to the command.
---@param name string
---@return MetaCommand
function Public:add_alias(name)
if self.aliases[name] then
error('Alias: ' .. name .. ' already exists for command: ' .. self.name, 2)
end
self.aliases[name] = name
return self
end
--- Sets the command as default if marking paramaters as optional.
---@param defaults any
---@return MetaCommand
@@ -553,6 +566,7 @@ end
Public.new('get', 'Hover over an object to get its name.')
:require_admin()
:add_alias('entity')
:callback(
function (player)
local entity = player.selected