Tweak item-trigger.

develop
expwnent 2014-07-03 08:17:17 -04:00
parent e38b9c4d11
commit 91bb830127
1 changed files with 0 additions and 29 deletions

@ -5,7 +5,6 @@
local eventful = require 'plugins.eventful'
local utils = require 'utils'
local repeatUtil = require 'repeatUtil'
eventful.enableEvent(eventful.eventType.UNIT_ATTACK,1) -- this event type is cheap, so checking every tick is fine
--eventful.enableEvent(eventful.eventType.INVENTORY_CHANGE,1000) --this is expensive, but you'll still want to set it lower
eventful.enableEvent(eventful.eventType.INVENTORY_CHANGE,1) --this is temporary
@ -13,7 +12,6 @@ eventful.enableEvent(eventful.eventType.INVENTORY_CHANGE,1) --this is temporary
itemTriggers = itemTriggers or {}
materialTriggers = materialTriggers or {}
contaminantTriggers = contaminantTriggers or {}
--equipLog = equipLog or {}
function processTrigger(command)
local command2 = {}
@ -89,12 +87,6 @@ end
function equipHandler(unit, item, isEquip)
local mode = (isEquip and 'onEquip') or (not isEquip and 'onUnequip')
--equipLog[unit] = equipLog[unit] or {}
--if isEquip then
-- equipLog[unit][item] = true
--else
-- equipLog[unit][item] = nil
--end
local table = {}
table.mode = mode
@ -140,27 +132,6 @@ eventful.onUnitAttack.attackTrigger = function(attacker,defender,wound)
handler(table)
end
--[[repeatUtil.scheduleUnlessAlreadyScheduled('item-trigger-unit-scanner', 100, 'ticks', function()
print('scanning...')
for _,unit in ipairs(df.global.world.units.all) do
if not equipLog[unit.id] then
equipLog[unit.id] = {}
end
local foundItems = {}
for _,item in ipairs(unit.inventory) do
if not equipLog[unit.id][item.item.id] then
equipHandler(unit,item.item.id,true)
foundItems[item.item.id] = true
end
end
for item,_ in pairs(equipLog[unit.id]) do
if not foundItems[item] then
equipHandler(unit,item,false)
end
end
end
end)]]
validArgs = validArgs or utils.invert({
'clear',
'checkAttackEvery',