Had some time on a delayed flight and got some DF stuff done.
So I tested the new "Civilizations" scripts with this code by Urist Da Vinci
local function insertPet(entity,creature,caste)
local exists=false
for k,v in pairs(df.global.world.entities.all) do
--ENTITY TYPES
--Civilization 0
--SiteGovernment 1
--VesselCrew 2
--MigratingGroup 3
--NomadicGroup 4
--Religion 5
--MilitaryUnit 6
--Outcast 7
if v.type==0 and v.entity_raw.code==entity then --exclude bandits
--print(k)
--printall(v.resources.animals)
for kk,vv in pairs(v.resources.animals.minion_races) do
--print(kk,vv,v.resources.animals.minion_castes[kk])
local checkrace = df.creature_raw.find(vv)
local checkcaste = checkrace.caste[v.resources.animals.minion_castes[kk]]
--print(checkrace.creature_id, checkcaste.caste_id)
if checkrace.creature_id == creature and checkcaste.caste_id == caste then exists=true end
end
if exists==true then
print("ERROR- civilization ",entity," has creature ", creature, caste)
else
--the civ doesn't have the creature as a pet
--add the creature as a pet
local racenum=-1
local castenum=-1
for kk,vv in pairs(df.global.world.raws.creatures.all) do
--print(vv.creature_id)
if vv.creature_id==creature then
racenum=kk
--print(kk)
--printall(vv.caste)
for kkk,vvv in pairs(vv.caste) do
--print(vvv.caste_id)
if vvv.caste_id==caste then castenum=kkk end
end
break
end
end
if racenum > -1 and castenum > -1 then
--print("success!!")
--print(v)
v.resources.animals.minion_races:insert('#',racenum)
v.resources.animals.minion_castes:insert('#',castenum)
print("Inserted ", creature, caste, " in civ ",k, entity)
else
print(creature, caste, " not found in raws")
end
end
end
exists=false
end
end
And it does appear to work well, my test that I artificially leveled humans for had the animals correctly added (although I did not wait for an invasion or trader to come to see if they actually had the new creatures). The next step is modifying the above code for items and such, should be simple enough. They df-structures for entities has the following available to modify
<compound name='resources'>
<stl-vector name='digger_type' type-name='int16_t' ref-target='itemdef_weaponst'/>
<stl-vector name='weapon_type' type-name='int16_t' ref-target='itemdef_weaponst'/>
<stl-vector name='training_weapon_type' type-name='int16_t' ref-target='itemdef_weaponst'/>
<stl-vector name='armor_type' type-name='int16_t' ref-target='itemdef_armorst'/>
<stl-vector name='ammo_type' type-name='int16_t' ref-target='itemdef_ammost'/>
<stl-vector name='helm_type' type-name='int16_t' ref-target='itemdef_helmst'/>
<stl-vector name='gloves_type' type-name='int16_t' ref-target='itemdef_glovesst'/>
<stl-vector name='shoes_type' type-name='int16_t' ref-target='itemdef_shoesst'/>
<stl-vector name='pants_type' type-name='int16_t' ref-target='itemdef_pantsst'/>
<stl-vector name='shield_type' type-name='int16_t' ref-target='itemdef_shieldst'/>
<stl-vector name='trapcomp_type' type-name='int16_t' ref-target='itemdef_trapcompst'/>
<stl-vector name='toy_type' type-name='int16_t' ref-target='itemdef_toyst'/>
<stl-vector name='instrument_type' type-name='int16_t' ref-target='itemdef_instrumentst'/>
<stl-vector name='siegeammo_type' type-name='int16_t' ref-target='itemdef_siegeammost'/>
<stl-vector name='tool_type' type-name='int16_t' ref-target='itemdef_toolst'/>
<compound name='metal'>
<compound name='pick' type-name='material_vec_ref'/>
<compound name='weapon' type-name='material_vec_ref'/>
<compound name='ranged' type-name='material_vec_ref'/>
<compound name='ammo' type-name='material_vec_ref'/>
<compound name='ammo2' type-name='material_vec_ref' comment='maybe intended for siege ammo'/>
<compound name='armor' type-name='material_vec_ref' comment='also instruments, toys, and tools'/>
<compound name='anvil' type-name='material_vec_ref'/>
</compound>
<compound name='organic'>
<compound name='leather' type-name='material_vec_ref'/>
<compound name='fiber' type-name='material_vec_ref'/>
<compound name='silk' type-name='material_vec_ref'/>
<compound name='wool' type-name='material_vec_ref'/>
<compound name='wood' type-name='material_vec_ref'/>
</compound>
<stl-vector name='metals' type-name='int32_t' ref-target='inorganic_raw' comment='bars'/>
<stl-vector name='stones' type-name='int32_t' ref-target='inorganic_raw' comment='boulders and blocks'/>
<stl-vector name='gems' type-name='int32_t' ref-target='inorganic_raw' comment='small and large cut'/>
<compound name='refuse'>
<compound name='bone' type-name='material_vec_ref'/>
<compound name='shell' type-name='material_vec_ref'/>
<compound name='pearl' type-name='material_vec_ref'/>
<compound name='ivory' type-name='material_vec_ref'/>
<compound name='horn' type-name='material_vec_ref'/>
</compound>
<compound name='misc_mat'>
<compound name='others' type-name='material_vec_ref' comment='amber and coral'/>
<compound name='glass' type-name='material_vec_ref'/>
<compound name='sand' type-name='material_vec_ref'/>
<compound name='clay' type-name='material_vec_ref'/>
<compound name='crafts' type-name='material_vec_ref'/>
<compound name='glass_unused' type-name='material_vec_ref' comment='used for vial extracts on embark'/>
<compound name='barrels' type-name='material_vec_ref' comment='also buckets, splints, and crutches'/>
<compound name='flasks' type-name='material_vec_ref'/>
<compound name='quivers' type-name='material_vec_ref'/>
<compound name='backpacks' type-name='material_vec_ref'/>
<compound name='cages' type-name='material_vec_ref'/>
<compound name='wood2' type-name='material_vec_ref' comment='v0.34.01'/>
<compound name='rock_metal' type-name='material_vec_ref' comment='v0.34.01'/>
<compound name='booze' type-name='material_vec_ref'/>
<compound name='cheese' type-name='material_vec_ref'/>
<compound name='powders' type-name='material_vec_ref'/>
<compound name='extracts' type-name='material_vec_ref'/>
<compound name='meat' type-name='material_vec_ref'/>
</compound>
<stl-vector name='fish_races' type-name='int32_t' ref-target='creature_raw'/>
<stl-vector name='fish_castes' type-name='int16_t' ref-target='caste_raw' aux-value='$$._parent.fish_races[$._key]'/>
<stl-vector name='egg_races' type-name='int32_t' ref-target='creature_raw'/>
<stl-vector name='egg_castes' type-name='int16_t' ref-target='caste_raw' aux-value='$$._parent.egg_races[$._key]'/>
<compound name='plants' type-name='material_vec_ref'/>
<compound name='seeds' type-name='material_vec_ref'/>
<compound name='wood_products' comment='lye, charcoal, potash, pearlash, and coke'>
<stl-vector name='item_type'>
<enum base-type='int16_t' type-name='item_type'/>
</stl-vector>
<stl-vector type-name='int16_t' name='item_subtype'/>
<compound name='material' type-name='material_vec_ref'/>
</compound>
<compound name='animals'>
<stl-vector name='pet_races' type-name='int32_t' ref-target='creature_raw'/>
<stl-vector name='wagon_races' type-name='int32_t' ref-target='creature_raw'/>
<stl-vector name='pack_animal_races' type-name='int32_t' ref-target='creature_raw'/>
<stl-vector name='wagon_puller_races' type-name='int32_t' ref-target='creature_raw'/>
<stl-vector name='mount_races' type-name='int32_t' ref-target='creature_raw'/>
<stl-vector name='minion_races' type-name='int32_t' ref-target='creature_raw'/>
<stl-vector name='exotic_pet_races' type-name='int32_t' ref-target='creature_raw'/>
<stl-vector name='pet_castes' type-name='int16_t' ref-target='caste_raw' aux-value='$$._parent.pet_races[$._key]'/>
<stl-vector name='wagon_castes' type-name='int16_t' ref-target='caste_raw' aux-value='$$._parent.wagon_races[$._key]'/>
<stl-vector name='pack_animal_castes' type-name='int16_t' ref-target='caste_raw' aux-value='$$._parent.pack_animal_races[$._key]'/>
<stl-vector name='wagon_puller_castes' type-name='int16_t' ref-target='caste_raw' aux-value='$$._parent.wagon_puller_races[$._key]'/>
<stl-vector name='mount_castes' type-name='int16_t' ref-target='caste_raw' aux-value='$$._parent.mount_races[$._key]'/>
<stl-vector name='minion_castes' type-name='int16_t' ref-target='caste_raw' aux-value='$$._parent.minion_races[$._key]'/>
<stl-vector name='exotic_pet_castes' type-name='int16_t' ref-target='caste_raw' aux-value='$$._parent.unk728_races[$._key]'/>
</compound>
So I am pretty sure I will allow all of the above things to be modified in these scripts.
EDIT: Class system experience update is still a little bit away. I have been distracted by this Civilization system.