MaximumNumberOf Number = 1 SortKey = Source.Planet.Happiness Condition = And [
Planet
InSystem id = Source.SystemID
OwnedBy empire = Source.Owner
Contains
Building name = "BLD_SHIPYARD_ORBITAL_DRYDOCK"
]
The intent here is to get the owned planet in the system with the highest happiness (and has a drydock).
I'm not sure on this, since SortKey is only passing a double.
I assume the "property_name" is gathered from the scripting context (I don't see any reference to property other than in comments)
Any content posted should be considered licensed GNU GPL 2.0 and/or CC-BY-SA 3.0 as appropriate.
This doesn't make sense. The source object will always be the same, so the sort key will always evaluate to the same result for every object being tested, so nothing will be sorted. You want / need to sort by objects that mach the sampling condition. What you probably want to do is refer to LocalCandiate.Happiness, since the sampling condition matches planets, the objects whose sort keys are calculated will be planets, and when evalulating the sort key on objects that have be matched by the sampling condition, each object can be referred to as the local candidate while the sort key is being evaluated on it.