Tweak invader-item-destroyer.lua.

develop
expwnent 2014-07-03 16:44:34 -04:00
parent 84818eaa35
commit 2b2d397056
1 changed files with 25 additions and 2 deletions

@ -1,4 +1,4 @@
--modtools/invader-item-destroyer.lua
--scripts/modtools/invader-item-destroyer.lua
--author expwnent
--configurably deletes invader items when they die
@ -12,6 +12,14 @@ items = items or {}
allEntities = allEntities or false
allItems = allitems or true
eventful.enableEvent(eventful.eventType.UNLOAD,1)
eventful.onUnload.invaderItemDestroyer = function()
entities = {}
items = {}
allEntities = false
allItems = true
end
eventful.enableEvent(eventful.eventType.UNIT_DEATH, 1) --requires iterating through all units
eventful.onUnitDeath.invaderItemDestroyer = function(unitId)
local unit = df.unit.find(unitId)
@ -103,7 +111,22 @@ if args.clear then
end
if args.help then
--TODO: print help string
print([[scripts/modtools/invader-item-destroyer.lua usage
arguments:
-allEntities [true/false]
set whether it should delete items from invaders from any civ
-allItems [true/false]
set whether it should delete all invader items regardless of type when an appropriate invader dies
-item itemdef
set a particular itemdef to be destroyed when an invader from an appropriate civ dies
examples:
ITEM_WEAPON_PICK
-entity entityName
set a particular entity up so that its invaders destroy their items shortly after death
examples:
MOUNTAIN
EVIL
]])
return
end