Tweak interaction-trigger.lua

develop
expwnent 2014-07-03 16:39:46 -04:00
parent e4c449c3c2
commit 84818eaa35
1 changed files with 28 additions and 7 deletions

@ -1,14 +1,21 @@
--modtools/interaction-trigger.lua
--scripts/modtools/interaction-trigger.lua
--author expwnent
--triggers scripts when a unit does a unit interaction on another
local eventful = require 'plugins.eventful'
local utils = require 'utils'
eventful.enableEvent(eventful.eventType.INTERACTION,1) --cheap, so every tick is fine
attackStrTriggers = attackStrTriggers or {}
defendStrTriggers = defendStrTriggers or {}
eventful.enableEvent(eventful.eventType.INTERACTION,1) --cheap, so every tick is fine
eventful.enableEvent(eventful.eventType.UNLOAD,1)
eventful.onUnload.interactionTrigger = function()
attackStrTriggers = {}
defendStrTriggers = {}
end
local function processTrigger(args)
local command = {}
for _,arg in ipairs(args.command) do
@ -95,16 +102,30 @@ validArgs = validArgs or utils.invert({
local args = utils.processArgs({...}, validArgs)
if args.help then
print([[scripts/modtools/interaction-trigger.lua
arguments:
-help
print this help message
-clear
unregisters all triggers
-onAttackStr str
trigger the command when the attack verb is "str"
-onDefendStr str
trigger the command when the defend verb is "str"
-suppressAttack
delete the attack announcement from the combat logs
-suppressDefend
delete the defend announcement from the combat logs
]])
return
end
if args.clear then
attackStrTriggers = {}
defendStrTriggers = {}
end
if args.help then
--print help string
return
end
if not args.command then
return
end