|
|
@ -64,10 +64,18 @@ function processTrigger(command)
|
|
|
|
dfhack.run_command(table.unpack(command2))
|
|
|
|
dfhack.run_command(table.unpack(command2))
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getitemType(item)
|
|
|
|
|
|
|
|
if item:getSubtype() ~= -1 then
|
|
|
|
|
|
|
|
itemType = dfhack.items.getSubtypeDef(item:getType(),item:getSubtype()).id
|
|
|
|
|
|
|
|
else itemType = df.item_type[item:getType()]
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
return itemType
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function handler(table)
|
|
|
|
function handler(table)
|
|
|
|
local itemMat = dfhack.matinfo.decode(table.item)
|
|
|
|
local itemMat = dfhack.matinfo.decode(table.item)
|
|
|
|
local itemMatStr = itemMat:getToken()
|
|
|
|
local itemMatStr = itemMat:getToken()
|
|
|
|
local itemType = dfhack.items.getSubtypeDef(table.item:getType(),table.item:getSubtype()).id
|
|
|
|
local itemType = getitemType(table.item)
|
|
|
|
table.itemMat = itemMat
|
|
|
|
table.itemMat = itemMat
|
|
|
|
table.itemType = itemType
|
|
|
|
table.itemType = itemType
|
|
|
|
|
|
|
|
|
|
|
@ -177,6 +185,7 @@ arguments:
|
|
|
|
trigger the command for items of this type
|
|
|
|
trigger the command for items of this type
|
|
|
|
examples:
|
|
|
|
examples:
|
|
|
|
ITEM_WEAPON_PICK
|
|
|
|
ITEM_WEAPON_PICK
|
|
|
|
|
|
|
|
RING
|
|
|
|
-onStrike
|
|
|
|
-onStrike
|
|
|
|
trigger the command when someone strikes someone with an appropriate weapon
|
|
|
|
trigger the command when someone strikes someone with an appropriate weapon
|
|
|
|
-onEquip
|
|
|
|
-onEquip
|
|
|
@ -243,6 +252,7 @@ if not args.command then
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if args.itemType then
|
|
|
|
if args.itemType then
|
|
|
|
|
|
|
|
if dfhack.items.findType(args.itemType) == -1 then
|
|
|
|
local temp
|
|
|
|
local temp
|
|
|
|
for _,itemdef in ipairs(df.global.world.raws.itemdefs.all) do
|
|
|
|
for _,itemdef in ipairs(df.global.world.raws.itemdefs.all) do
|
|
|
|
if itemdef.id == args.itemType then
|
|
|
|
if itemdef.id == args.itemType then
|
|
|
@ -255,6 +265,7 @@ if args.itemType then
|
|
|
|
end
|
|
|
|
end
|
|
|
|
args.itemType = temp
|
|
|
|
args.itemType = temp
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local numConditions = (args.material and 1 or 0) + (args.itemType and 1 or 0) + (args.contaminant and 1 or 0)
|
|
|
|
local numConditions = (args.material and 1 or 0) + (args.itemType and 1 or 0) + (args.contaminant and 1 or 0)
|
|
|
|
if numConditions > 1 then
|
|
|
|
if numConditions > 1 then
|
|
|
|