Version 2.6.1

This commit is contained in:
OTCv8
2021-01-18 00:46:05 +01:00
parent 8fa45f387d
commit b938520faf
100 changed files with 1812 additions and 4267 deletions

View File

@@ -0,0 +1,41 @@
-- Magic wall & Wild growth timer
-- config
local magicWallId = 2129
local magicWallTime = 20000
local wildGrowthId = 2130
local wildGrowthTime = 45000
-- script
local activeTimers = {}
onAddThing(function(tile, thing)
if not thing:isItem() then
return
end
local timer = 0
if thing:getId() == magicWallId then
timer = magicWallTime
elseif thing:getId() == wildGrowthId then
timer = wildGrowthTime
else
return
end
local pos = tile:getPosition().x .. "," .. tile:getPosition().y .. "," .. tile:getPosition().z
if not activeTimers[pos] or activeTimers[pos] < now then
activeTimers[pos] = now + timer
end
tile:setTimer(activeTimers[pos] - now)
end)
onRemoveThing(function(tile, thing)
if not thing:isItem() then
return
end
if (thing:getId() == magicWallId or thing:getId() == wildGrowthId) and tile:getGround() then
local pos = tile:getPosition().x .. "," .. tile:getPosition().y .. "," .. tile:getPosition().z
activeTimers[pos] = nil
tile:setTimer(0)
end
end)