This commit is contained in:
Jan Racek
2026-03-29 09:34:46 +02:00
commit 1fdb223f5d
113 changed files with 17499 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
-- ============================================================================
-- entity_scanner.lua - Scans all entities on interact (Entity.ForEach test)
-- ============================================================================
-- Tests: Entity.ForEach, Entity.GetPosition, Entity.IsActive, Entity.GetCount,
-- Entity.FindByIndex, onInteract
function onInteract(self)
setStatus("Scanning all entities...")
Debug.Log("=== Entity Scan ===")
Debug.Log("Total entities: " .. Entity.GetCount())
local activeCount = 0
local inactiveCount = 0
Entity.ForEach(function(obj)
local pos = Entity.GetPosition(obj)
local active = Entity.IsActive(obj)
if active then
activeCount = activeCount + 1
else
inactiveCount = inactiveCount + 1
end
end)
Debug.Log("Active: " .. activeCount .. " Inactive: " .. inactiveCount)
setStatus("Scan: " .. activeCount .. " active, " .. inactiveCount .. " inactive")
-- Test FindByIndex
local first = Entity.FindByIndex(0)
if first then
local pos = Entity.GetPosition(first)
Debug.Log("Entity 0 at " .. pos.x .. "," .. pos.y .. "," .. pos.z)
end
end