HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. Read more...
2.6: can never get Settler-type units from huts
For comparison, found in... 2.6.0-beta1/data/default/default.lua: local settlers = find.role_unit_type('Cities', owner) 2.5.9/data/default/default.lua: local settlers = find.role_unit_type('Cities', owner) ~/.freeciv/2.x/radius/script.lua: if radius_vers < 260 then type = radius_hut_type( owner, tile, "Cities" ) else type = radius_hut_type( owner, tile, "CitiesStartUnit" ) end
#1 Updated by Marko Lindqvist almost 5 years ago
If this is a suggestion that default.lua should give CitiesStartUnit from huts instead of Cities, I disagree. The CitiesStartUnit flag should not be used for anything else than start unit selection. The ruleset may rely on the unit not being available otherwise (e.g. to give more powerful city founder unit initially to boost the game start)
#2 Updated by frank e almost 5 years ago
Marko Lindqvist wrote:
If this is a suggestion that default.lua should give CitiesStartUnit from huts instead of Cities, I disagree.
Actually I think that role Cities does not more exist, it was renamed. But I'm not sure what
find.role_unit_type( role, owner ) does.
#6 Updated by Marko Lindqvist over 4 years ago
- Tracker changed from Task to Feature
- Category changed from Rulesets to Documentation
frank e wrote:
Marko Lindqvist wrote:
Flags count as roles too.
... if it's documented somewhere close this issue, please.
So this ticket has turned to a documentation feature.
#9 Updated by Jacob Nevins about 4 years ago
- Tracker changed from Feature to Bug
(Coming back to this because of Akechi's report #763890, which makes a testable prediction about it.)
Flags count as roles too.
Unfortunately, for the purpose of Lua find.role_unit_type(), they do not.
While best_role_unit_for_player() and get_role_unit() would happily work for flags, the unit_role_id_by_name() that is called previously genuinely only works for roles, not flags.
#10 Updated by Jacob Nevins about 4 years ago
- civ1, civ2, civ2civ3, classic, experimental, multiplayer, sandbox, variant2: none (set of Cities unit types == CitiesStartUnit)
- alien: none, as there as no NoCities terrains on which you can find a Space Capsule. (If that weren't the case: Native Settlers and Water Engineer are Cities but not CitiesStartUnit, so you'd no longer get them from from a Space Capsule.)
(Also, on S3_0+, "Cities" is now a conventional name for a ruleset-defined flag, not a built-in flag.)
#11 Updated by Jacob Nevins about 4 years ago
- Subject changed from 260b1 _deflua_hut_get_city to 2.6: can never get Settler-type units from huts
- Category deleted (
But, as cazfi says, we split out the *StartUnit for a reason, so piling extra semantics on them doesn't seem like a good idea.
Alternatively, could we get away with making Lua find.role_unit_type() also look at flags in 2.6.0, by adding a call to unit_type_flag_id_by_name()? This is a behavioural change, but only one that makes code that could never have worked start working. Otherwise we have to leave this mess unresolved until 3.0.
#12 Updated by Jacob Nevins about 4 years ago
- File m-lua-unit-by-flag-1.patch m-lua-unit-by-flag-1.patch added
- File 30-26-lua-unit-by-flag-1.patch 30-26-lua-unit-by-flag-1.patch added
- File m-lua-unit-by-flag-2.patch m-lua-unit-by-flag-2.patch added
- File 30-26-lua-unit-by-flag-2.patch 30-26-lua-unit-by-flag-2.patch added
- Category set to Scripting API
- Status changed from New to In Progress
- Assignee set to Jacob Nevins
- Sprint/Milestone set to 2.6.0
I'm inclined to commit one of these for 2.6.0, and probably declare an RC2 before 2.6.0-final.
- Extend find.role_unit_type() semantics to also cover flags. Small patch, no change to scripts.
- Keep find.role_unit_type() unchanged, but add find.flag_unit_type(), and call that from the default hut code. Bigger patch, but has the advantage over 1 that anyone taking a custom ruleset back to RCs/betas at least has a hard failure rather than a silent one. Ruleset authors who've replaced the hut functionality will need to change their rulesets.
I favour option 2, unless someone finds some reason to object. I'll commit within a few days, unless someone objects.
(Neither of them gives access to the internal "action_roles" added by gna patch #5554 -- utype_can_do_action_role(), etc.)
#14 Updated by Marko Lindqvist about 4 years ago
I think I would prefer 1. That would make my earlier assumption true; flags to count as roles in this respect too (consistency, would be what I expect knowing behavior of the other functions).
But I might be the only one who ever has expected that behavior, or would expect it simply after reading best_role_unit_for_player() and get_role_unit() documentation (currently code comments). Tricky.