From 91bb830127ea63e57a4ebd3aaac83bbbecb65ee8 Mon Sep 17 00:00:00 2001 From: expwnent Date: Thu, 3 Jul 2014 08:17:17 -0400 Subject: [PATCH] Tweak item-trigger. --- scripts/modtools/item-trigger.lua | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/scripts/modtools/item-trigger.lua b/scripts/modtools/item-trigger.lua index 93b97e1e9..1d505e7eb 100644 --- a/scripts/modtools/item-trigger.lua +++ b/scripts/modtools/item-trigger.lua @@ -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',