spawner tweaks
This commit is contained in:
@@ -9,7 +9,7 @@ local turtle = _G.turtle
|
|||||||
|
|
||||||
local STARTUP_FILE = 'usr/autorun/spawner.lua'
|
local STARTUP_FILE = 'usr/autorun/spawner.lua'
|
||||||
|
|
||||||
local mobTypes = Util.transpose({ ... })
|
local mobTypes = { }
|
||||||
|
|
||||||
local function equip(side, item, rawName)
|
local function equip(side, item, rawName)
|
||||||
local equipped = Peripheral.lookup('side/' .. side)
|
local equipped = Peripheral.lookup('side/' .. side)
|
||||||
@@ -127,6 +127,12 @@ end
|
|||||||
while true do
|
while true do
|
||||||
local blocks = sensor.sense()
|
local blocks = sensor.sense()
|
||||||
local mobs = Util.filterInplace(blocks, function(b)
|
local mobs = Util.filterInplace(blocks, function(b)
|
||||||
|
if mobTypes[b.name] == nil then
|
||||||
|
local mob = sensor.getMetaByID(b.id)
|
||||||
|
mobTypes[b.name] = mob and (not not mob.isAlive) -- health
|
||||||
|
print(b.name .. ' ' .. tostring(mobTypes[b.name]))
|
||||||
|
end
|
||||||
|
|
||||||
if mobTypes[b.name] then
|
if mobTypes[b.name] then
|
||||||
return normalize(b)
|
return normalize(b)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user