Class SettlementUtils
Inheritance
System.Object
SettlementUtils
Assembly: Eco.Gameplay.dll
Syntax
public static class SettlementUtils : Object
Methods
AllowDeedInteraction(Settlement, Deed)
Check whether this settlement can interact with the specified deed or not (like performing laws on it).
Declaration
public static Result AllowDeedInteraction(this Settlement settlement, Deed deed)
Parameters
Returns
AllowOwnership(Settlement, IAlias)
We check whether the specified alias is allowed to own some properties inside this settlement or not.
Declaration
public static Result AllowOwnership(this Settlement settlement, IAlias alias)
Parameters
Returns
AllParents(Settlement)
We get all the parents of the specified settlement (we don't return the settlement itself).
Declaration
public static IEnumerable<Settlement> AllParents(this Settlement settlement)
Parameters
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<Settlement> |
|
AllTypes()
Returns all the settlement types available.
Declaration
public static IEnumerable<SettlementType> AllTypes()
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<SettlementType> |
|
CanSecedeFromParents(Settlement, out Settlement)
We check whether this settlement can secede and become independant or not.
Declaration
public static bool CanSecedeFromParents(this Settlement settlement, out Settlement preventingSettlement)
Parameters
Type |
Name |
Description |
Settlement |
settlement |
|
Settlement |
preventingSettlement |
The lowest settlement that would prevent any seceding.
|
Returns
Type |
Description |
System.Boolean |
|
ChatToCitizensMailToLeaders(Settlement, LocString)
Sends a mail to leaders of a settlement, and a chat to all citizens.
Declaration
public static void ChatToCitizensMailToLeaders(this Settlement settlement, LocString msg)
Parameters
CheckAnnexationTimer(Settlement, LocString)
See if there's an active annexation clock on this settlement preventing stuff.s
Declaration
public static Result CheckAnnexationTimer(Settlement settlement, LocString action)
Parameters
Returns
ChildrenRecurisve(Settlement)
All children settlements of the given settlement.
Declaration
public static IEnumerable<Settlement> ChildrenRecurisve(this Settlement settlement)
Parameters
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<Settlement> |
|
DestroySettlement(Settlement, LocString)
Destroy the foundation object, returning all non-related items to creator and a foundation item, return all papers and claim stakes to their sources and then permanently Destroy object with all related papers and stakes in all inventories.
Declaration
public static void DestroySettlement(this Settlement settlement, LocString reason)
Parameters
DoClaimForSettlement(GameActionPack, User, Vector3i, SettlementType, Item)
Claim land in advance of placing a settlement foundation.
Declaration
public static void DoClaimForSettlement(GameActionPack pack, User user, Vector3i worldPos, SettlementType type, Item settlementItem)
Parameters
ForAllTypes(Action<SettlementType>)
Perform an action on all types of settlements.
Declaration
public static void ForAllTypes(Action<SettlementType> a)
Parameters
GetCommonAncestor(Settlement, IAnnexable)
Returns the lowest settlement that is a parent of both left and right (does not include left and right themselves).
Declaration
public static Settlement GetCommonAncestor(this Settlement left, IAnnexable right)
Parameters
Returns
GetLowestLevelSettlementAtPos(Vector2i)
Return the settlement of the lowest type (town before country before federation) at the given position.
Declaration
public static Settlement GetLowestLevelSettlementAtPos(Vector2i worldPos)
Parameters
Returns
GetLowestLevelSettlementAtPos(PlotPos)
Declaration
public static Settlement GetLowestLevelSettlementAtPos(PlotPos plotPos)
Parameters
Type |
Name |
Description |
PlotPos |
plotPos |
|
Returns
GetOrMakeTown(User, Vector2i)
Return the town influencing the given location, or make a new headless one that covers this location.
Declaration
public static Settlement GetOrMakeTown(User user, Vector2i pos)
Parameters
Returns
GetSettlementAtPos(SettlementType, Vector2i)
Return the settlement of the given type at the given position.
Declaration
public static Settlement GetSettlementAtPos(SettlementType type, Vector2i worldPos)
Parameters
Returns
GetSettlementAtPos(SettlementType, PlotPos)
Declaration
public static Settlement GetSettlementAtPos(SettlementType type, PlotPos plotPos)
Parameters
Returns
GetSettlementsAtPos(WorldObject)
Return the settlements currently influencing the given position, in order of the enum
Declaration
public static IEnumerable<Settlement> GetSettlementsAtPos(this WorldObject obj)
Parameters
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<Settlement> |
|
GetSettlementsAtPos(PlotPos)
Return the settlements currently influencing the given position, in order of the enum
Declaration
public static IEnumerable<Settlement> GetSettlementsAtPos(PlotPos plotPos)
Parameters
Type |
Name |
Description |
PlotPos |
plotPos |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<Settlement> |
|
GetSettlementsAtPos(Nullable<Vector3i>)
Return the settlements currently influencing the given position, in order of the enum
Declaration
public static IEnumerable<Settlement> GetSettlementsAtPos(Nullable<Vector3i> pos)
Parameters
Type |
Name |
Description |
System.Nullable<Vector3i> |
pos |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<Settlement> |
|
HasChildOrSelf(Settlement, Settlement)
Returns true if the given settlement is contained as a child settlement of this one, or if it is this one.
Declaration
public static bool HasChildOrSelf(this Settlement settlement, Settlement child)
Parameters
Returns
Type |
Description |
System.Boolean |
|
InfluencesAtLevel(SettlementType)
Iterators of the influence points at a given level of settlement..
Declaration
public static IEnumerable<Influence> InfluencesAtLevel(SettlementType type)
Parameters
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<Influence> |
|
Leaders(Settlement)
Returns the set of leaders in a settlement, which is composed of:
- Anyone holding an elected title
- Anyone who created an active law
- Anyone who has ownership access on the capital
Declaration
public static IEnumerable<User> Leaders(this Settlement settlement)
Parameters
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<User> |
|
Notify(Settlement, LocString)
Declaration
public static void Notify(this Settlement settlement, LocString msg)
Parameters
Send a message to all citizens.
Declaration
public static void NotifyLoc(this Settlement settlement, FormattableString msg)
Parameters
Type |
Name |
Description |
Settlement |
settlement |
|
System.FormattableString |
msg |
|
ReplaceClaimStake(SettlementClaimStakeObject, Settlement)
This will just change an already placed stake from a settlement to another (related deed will not change influencing settlement).
Declaration
public static bool ReplaceClaimStake(SettlementClaimStakeObject stake, Settlement newSettlement)
Parameters
Returns
Type |
Description |
System.Boolean |
Returns whether the claim stake was replaced or not.
|
SelfAndAllChildrenSettlementsRecursive(Settlement)
Iterate through all children, and their children, etc, as well as the passed settlement itself.
Declaration
public static IEnumerable<Settlement> SelfAndAllChildrenSettlementsRecursive(this Settlement settlement)
Parameters
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<Settlement> |
|
SelfAndParents(Settlement)
Return the passed settlement, then its parent, etc recursively.
Declaration
public static IEnumerable<Settlement> SelfAndParents(this Settlement settlement)
Parameters
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<Settlement> |
|
SelfOrParent(Settlement, SettlementType)
Return the settlement of the given type, examining parents if it's not our type.
Declaration
public static Settlement SelfOrParent(this Settlement settlement, SettlementType type)
Parameters
Returns
SettlementsOfType(SettlementType)
Iterates through all settlements in existance of the given type.
Declaration
public static IEnumerable<Settlement> SettlementsOfType(SettlementType type)
Parameters
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<Settlement> |
|
TopParent(Settlement)
We get the top parent of this settlement or else we return the settlement itself.
Declaration
public static Settlement TopParent(this Settlement settlement)
Parameters
Returns
ToSettlementType(SettlementType_Hack)
Declaration
public static Nullable<SettlementType> ToSettlementType(this SettlementType_Hack hack)
Parameters
Returns
ToSettlementType(SettlementTypeIndicator_Hack)
Declaration
public static Nullable<SettlementType> ToSettlementType(this SettlementTypeIndicator_Hack hack)
Parameters
Returns