Code: Select all
function onTickEnd()
for ind,npc in pairs(NPC.get({60,62,64,66,104}, -1)) do
local isAlreadyWrapped = false
for _,wrapped in pairs(platformNPCs) do
if npc == wrapped then
isAlreadyWrapped = true
end
if not isAlreadyWrapped then
platformNPCs[#platformNPCs + 1] = pnpc.wrap(npc)
end
end
end
for ind,npc in pairs(platformNPCs) do
platformSensors[ind] = colliders.Point(npc.x + .5 * npc.width, npc.y + .5 * npc.height)
end
for _,v in pairs(platformSensors) do v:Draw(0x00ff00ff) end
end
Added after 15 hours 42 minutes:
I've done some debugging, and got it to work, mostly. It doesn't work with newly placed/spawned platforms or generators, but apparently everyone has had that problem.