Skip to content

Commit

Permalink
fixes for itemsyndrome and spawn scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
splintermind committed Jan 2, 2014
1 parent ae2899b commit d3329d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions Dwarf Fortress/hack/scripts/itemsyndrome.lua
Expand Up @@ -12,7 +12,7 @@ local function printItemSyndromeHelp()
print(" ")
print(' "contaminantson/contaminantsoff": toggles searching for contaminants.')
print(' Disabling speeds itemsyndrome up greatly.')
print(' "transformReEquipOn/TransformReEquipOff": toggles transformation auto-reequip.')
print(' "transformReEquipOn/TransformReEquipOff": toggles transformation auto-reequip.')
end

itemsyndromedebug=false
Expand Down Expand Up @@ -244,6 +244,7 @@ eventful.enableEvent(eventful.eventType.INVENTORY_CHANGE,5)

local function checkAndAddSyndrome(unit_id,new_equip,item_id)
local item = df.item.find(item_id)
if not item then return false end
local unit = df.unit.find(unit_id)
if unit.flags1.dead then return false end
if itemsyndromedebug then print("Checking unit #" .. unit_id) end
Expand All @@ -252,7 +253,7 @@ local function checkAndAddSyndrome(unit_id,new_equip,item_id)
local itemMaterial=getMaterial(item)
if itemMaterial then
for k,syndrome in ipairs(itemMaterial.syndrome) do
if itemsyndromedebug then print("item has a syndrome, checking if item is valid for application...") end
if itemsyndromedebug then print("item has a syndrome, checking if item is valid for application...") end
if syndromeIsTransformation(syndrome) then
unitInventory = rememberInventory(unit)
transformation = true
Expand Down
5 changes: 3 additions & 2 deletions Dwarf Fortress/hack/scripts/spawn.lua
Expand Up @@ -66,10 +66,11 @@ function CreateUnit(race_id,caste_id)
unit.caste=caste_id
unit.id=df.global.unit_next_id
df.global.unit_next_id=df.global.unit_next_id+1
unit.relations.old_year=df.global.cur_year-5 -- everybody will be 15 years old
if caste.misc.maxage_max==-1 then
unit.relations.old_year=-1
else
unit.relations.old_year=df.global.cur_year-15+math.random(caste.misc.maxage_min,caste.misc.maxage_max)
unit.relations.old_year=df.global.cur_year+math.random(caste.misc.maxage_min,caste.misc.maxage_max)
end
unit.sex=caste.gender
local body=unit.body
Expand Down Expand Up @@ -251,4 +252,4 @@ if #args>3 then
argPos.z=args[6]
end

PlaceUnit(args[1],args[2],args[3],argPos) --Creature (ID), caste (number), name, x,y,z for spawn.
PlaceUnit(args[1],args[2],args[3],argPos) --Creature (ID), caste (number), name, x,y,z for spawn.

0 comments on commit d3329d0

Please sign in to comment.