|
|
@ -127,9 +127,28 @@ function collect_orders()
|
|
|
|
entry = entry,
|
|
|
|
entry = entry,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
|
-- It might be worth searching reaction_list for the name.
|
|
|
|
-- Todo: Search reaction_list for the name.
|
|
|
|
-- Then again, this should only happen in unusual situations.
|
|
|
|
-- This can happen when loading an old save in a new version.
|
|
|
|
print("Mismatched stockflow entry for stockpile #"..stockpile.stockpile_number..": "..entry.value.." ("..order_number..")")
|
|
|
|
-- It's even possible that the reaction has been removed.
|
|
|
|
|
|
|
|
local found = false
|
|
|
|
|
|
|
|
for number, reaction in ipairs(reaction_list) do
|
|
|
|
|
|
|
|
if reaction.name == entry.value then
|
|
|
|
|
|
|
|
print("Adjusting stockflow entry for stockpile #"..stockpile.stockpile_number..": "..entry.value.." ("..order_number.." => "..number..")")
|
|
|
|
|
|
|
|
entry.ints[entry_ints.order_number] = number
|
|
|
|
|
|
|
|
entry:save()
|
|
|
|
|
|
|
|
result[spid] = {
|
|
|
|
|
|
|
|
stockpile = stockpile,
|
|
|
|
|
|
|
|
entry = entry,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
found = true
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not found then
|
|
|
|
|
|
|
|
print("Unmatched stockflow entry for stockpile #"..stockpile.stockpile_number..": "..entry.value.." ("..order_number..")")
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
else
|
|
|
|
else
|
|
|
|
-- The stockpile no longer exists.
|
|
|
|
-- The stockpile no longer exists.
|
|
|
@ -399,6 +418,14 @@ function collect_reactions()
|
|
|
|
reaction_entry(result, job_types.CustomReaction, {reaction_name = reaction.code}, name)
|
|
|
|
reaction_entry(result, job_types.CustomReaction, {reaction_name = reaction.code}, name)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Reactions generated by the game.
|
|
|
|
|
|
|
|
for _, reaction in ipairs(df.global.world.raws.reactions) do
|
|
|
|
|
|
|
|
if reaction.source_enid == entity.id then
|
|
|
|
|
|
|
|
local name = string.gsub(reaction.name, "^.", string.upper)
|
|
|
|
|
|
|
|
reaction_entry(result, job_types.CustomReaction, {reaction_name = reaction.code}, name)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- Metal forging
|
|
|
|
-- Metal forging
|
|
|
|
local itemdefs = df.global.world.raws.itemdefs
|
|
|
|
local itemdefs = df.global.world.raws.itemdefs
|
|
|
|
for rock_id = 0, #rock_types - 1 do
|
|
|
|
for rock_id = 0, #rock_types - 1 do
|
|
|
@ -465,19 +492,10 @@ function collect_reactions()
|
|
|
|
clothing_reactions(result, mat_flags, metalclothing)
|
|
|
|
clothing_reactions(result, mat_flags, metalclothing)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if material.flags.ITEMS_HARD then
|
|
|
|
|
|
|
|
resource_reactions(result, job_types.MakeTool, mat_flags, entity.resources.tool_type, itemdefs.tools, {
|
|
|
|
resource_reactions(result, job_types.MakeTool, mat_flags, entity.resources.tool_type, itemdefs.tools, {
|
|
|
|
permissible = (function(itemdef) return itemdef.flags.HARD_MAT end),
|
|
|
|
permissible = (function(itemdef) return ((material.flags.ITEMS_HARD and itemdef.flags.HARD_MAT) or (material.flags.ITEMS_METAL and itemdef.flags.METAL_MAT)) and not itemdef.flags.NO_DEFAULT_JOB end),
|
|
|
|
capitalize = true,
|
|
|
|
capitalize = true,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if material.flags.ITEMS_METAL then
|
|
|
|
|
|
|
|
resource_reactions(result, job_types.MakeTool, mat_flags, entity.resources.tool_type, itemdefs.tools, {
|
|
|
|
|
|
|
|
permissible = (function(itemdef) return itemdef.flags.METAL_MAT end),
|
|
|
|
|
|
|
|
capitalize = true,
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if material.flags.ITEMS_HARD then
|
|
|
|
if material.flags.ITEMS_HARD then
|
|
|
|
material_reactions(result, {
|
|
|
|
material_reactions(result, {
|
|
|
@ -560,7 +578,8 @@ function collect_reactions()
|
|
|
|
}, materials.wood)
|
|
|
|
}, materials.wood)
|
|
|
|
|
|
|
|
|
|
|
|
resource_reactions(result, job_types.MakeTool, materials.wood, entity.resources.tool_type, itemdefs.tools, {
|
|
|
|
resource_reactions(result, job_types.MakeTool, materials.wood, entity.resources.tool_type, itemdefs.tools, {
|
|
|
|
-- permissible = (function(itemdef) return itemdef.flags.WOOD_MAT end),
|
|
|
|
-- permissible = (function(itemdef) return itemdef.flags.WOOD_MAT and not itemdef.flags.NO_DEFAULT_JOB end),
|
|
|
|
|
|
|
|
permissible = (function(itemdef) return not itemdef.flags.NO_DEFAULT_JOB end),
|
|
|
|
capitalize = true,
|
|
|
|
capitalize = true,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|