wild animals disappear
Posted: Thu Dec 20, 2018 5:14 am
I'm playing with the new wild animal feature and found they all disappear pretty quickly after the game starts. Not what I want, and I expect most folks would agree they should stick around until they're killed, since, unlike human pirates and barbarians, animals can survive and reproduce in their native tiles. I'm dubious that this behavior was intended when the wild animal feature was introduced. It's possible new animals get generated once barbarians start appearing, if so, that's OK.
Figured out they are subject to the same "retirement" that happens to other barbarian units. Tech details - ".../share/freeciv/nation/animals.ruleset" has the line -
groups="Core", "Barbarian"
just like ".../share/freeciv/nation/barbarian.ruleset" and ".../share/freeciv/nation/pirate.ruleset". This behavior must be hard-coded, I can't find any way for ruleset files to configure it. Maybe there should be some way added to allow a ruleset to control barbarian behavior.
Meanwhile I have a work-around, adding code in the "script.lua" file to catch when an animal gets retired, and re-spawn a replacement
Only problem: have to set the "veteran_level" param to 0 (= "green") because there's no way to get a unit's veteran_level value. I would prefer to use, e.g. "edit.create_unit(loser, unit.tile, unit.utype, unit.veteran_level, unit.homecity, -1)" if I could. In addition to the missing "unit.veteran_level", there's also no corresponding "edit.unit_veteran_level".
Figured out they are subject to the same "retirement" that happens to other barbarian units. Tech details - ".../share/freeciv/nation/animals.ruleset" has the line -
groups="Core", "Barbarian"
just like ".../share/freeciv/nation/barbarian.ruleset" and ".../share/freeciv/nation/pirate.ruleset". This behavior must be hard-coded, I can't find any way for ruleset files to configure it. Maybe there should be some way added to allow a ruleset to control barbarian behavior.
Meanwhile I have a work-around, adding code in the "script.lua" file to catch when an animal gets retired, and re-spawn a replacement
Code: Select all
function unit_lost_callback(unit, loser, reason)
nation = loser.nation:name_translation()
if nation == "Animal Kingdom" and reason == "retired" then
edit.create_unit(loser, unit.tile, unit.utype, 0, unit.homecity, -1)
end
-- continue processing
return false
end
signal.connect("unit_lost", "unit_lost_callback")