add 'entity.despawn' command
This commit is contained in:
@@ -11,6 +11,10 @@ function setup_variables()
|
||||
if pentity ~= 0 then
|
||||
console.set('entity.id', pentity)
|
||||
end
|
||||
local sentity = player.get_selected_entity(pid)
|
||||
if sentity ~= nil then
|
||||
console.set('entity.selected', sentity)
|
||||
end
|
||||
end
|
||||
|
||||
function on_history_up()
|
||||
|
||||
@@ -156,3 +156,16 @@ console.add_command(
|
||||
return "spawned new player entity #"..tostring(eid)
|
||||
end
|
||||
)
|
||||
|
||||
console.add_command(
|
||||
"entity.despawn entity:sel=$entity.selected",
|
||||
"Despawn entity",
|
||||
function (args, kwargs)
|
||||
local eid = args[1]
|
||||
local entity = entities.get(eid)
|
||||
if entity ~= nil then
|
||||
entity:despawn()
|
||||
return "despawned entity #"..tostring(eid)
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user