List Objects for Spawner

local _object = {}

local _objects = 0

function __O() _objects = _objects + 1 return _objects end

-- bush, house, rock, tree
-- grid, reference, desc, xyz offset

_object[__O()] = {34, "coin", "a Manticoin.", "(3,3,200)"}

_object[__O()] = {7, "companion", "An Aperture Science weighted companion cube.", "(3,3,200)"}

_object[__O()] = {45, "health1", "a bandage.", "(3,3,200)"}

_object[__O()] = {46, "health2", "a healthpack.", "(3,3,200)"}

_object[__O()] = {55, "house", "a simple house.", "(3,3,200)"}            -- NOT DONE!

_object[__O()] = {5, "plant1", "a simple bush.", "(3,3,200)"}

_object[__O()] = {6, "rock", "a simple rock.", "(3,3,200)"}

_object[__O()] = {1, "tree1", "a birch tree.", "(3,3,200)"}

_object[__O()] = {2, "tree2", "a bigger birch tree.", "(3,3,200)"}

_object[__O()] = {3, "tree3", "a small redwood tree.", "(3,3,200)"}

_object[__O()] = {4, "tree stump", "a large oak tree stump", "(3,3,200)"}

_object._count = _objects

--print("OB: ",_object[1][1])

function _object._getReferenceNameByGrid(id)
    local __grid    = nil
    local __ref        = "plant1" -- default (if no id found)
    for b = 1,_objects do
        __grid     = _object[b][1]
        if(id == __grid)then
            __ref = _object[b][2] 
            break
        end
    end
    return __ref
end

-- grid, reference, desc, xyz offset
function _object._getObjectList()
    local _list = tostring(_objects).." objects:\n"
    local __grid    = nil
    local __ref     = nil
    local __desc     = nil
    local __ofs     = nil
    for b = 1,_objects do
        __grid    = _object[b][1]
        __ref     = _object[b][2]
        __desc     = _object[b][3]
        __ofs     = _object[b][4]
        _list     = _list..tostring(__grid)..". "..__ref.." - "..__desc.."\n"
    end    
    
    --return "Count: "..tostring(_object._count) -- all tests work!
    --return _list.._test.." - ".._test.."\n"
    --return _cmd[2]
    return _list
end




return _object

Latest Posts