Show / Hide Table of Contents

Class SettlementUtils

Inheritance
System.Object
SettlementUtils
Namespace: Eco.Gameplay.Settlements
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
Type Name Description
Settlement settlement
Deed deed
Returns
Type Description
Result

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
Type Name Description
Settlement settlement
IAlias alias
Returns
Type Description
Result

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
Type Name Description
Settlement settlement
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
Type Name Description
Settlement settlement
LocString msg

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
Type Name Description
Settlement settlement
LocString action
Returns
Type Description
Result

ChildrenRecurisve(Settlement)

All children settlements of the given settlement.

Declaration
public static IEnumerable<Settlement> ChildrenRecurisve(this Settlement settlement)
Parameters
Type Name Description
Settlement settlement
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
Type Name Description
Settlement settlement
LocString reason

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
Type Name Description
GameActionPack pack
User user
Vector3i worldPos
SettlementType type
Item settlementItem

ForAllTypes(Action<SettlementType>)

Perform an action on all types of settlements.

Declaration
public static void ForAllTypes(Action<SettlementType> a)
Parameters
Type Name Description
System.Action<SettlementType> a

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
Type Name Description
Settlement left
IAnnexable right
Returns
Type Description
Settlement

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
Type Name Description
Vector2i worldPos
Returns
Type Description
Settlement

GetLowestLevelSettlementAtPos(PlotPos)

Declaration
public static Settlement GetLowestLevelSettlementAtPos(PlotPos plotPos)
Parameters
Type Name Description
PlotPos plotPos
Returns
Type Description
Settlement

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
Type Name Description
User user
Vector2i pos
Returns
Type Description
Settlement

GetSettlementAtPos(SettlementType, Vector2i)

Return the settlement of the given type at the given position.

Declaration
public static Settlement GetSettlementAtPos(SettlementType type, Vector2i worldPos)
Parameters
Type Name Description
SettlementType type
Vector2i worldPos
Returns
Type Description
Settlement

GetSettlementAtPos(SettlementType, PlotPos)

Declaration
public static Settlement GetSettlementAtPos(SettlementType type, PlotPos plotPos)
Parameters
Type Name Description
SettlementType type
PlotPos plotPos
Returns
Type Description
Settlement

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
Type Name Description
WorldObject obj
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
Type Name Description
Settlement settlement
Settlement child
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
Type Name Description
SettlementType type
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
Type Name Description
Settlement settlement
Returns
Type Description
System.Collections.Generic.IEnumerable<User>

Notify(Settlement, LocString)

Declaration
public static void Notify(this Settlement settlement, LocString msg)
Parameters
Type Name Description
Settlement settlement
LocString msg

NotifyLoc(Settlement, FormattableString)

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
Type Name Description
SettlementClaimStakeObject stake
Settlement newSettlement
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
Type Name Description
Settlement settlement
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
Type Name Description
Settlement settlement
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
Type Name Description
Settlement settlement
SettlementType type
Returns
Type Description
Settlement

SettlementsOfType(SettlementType)

Iterates through all settlements in existance of the given type.

Declaration
public static IEnumerable<Settlement> SettlementsOfType(SettlementType type)
Parameters
Type Name Description
SettlementType type
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
Type Name Description
Settlement settlement
Returns
Type Description
Settlement

ToSettlementType(SettlementType_Hack)

Declaration
public static Nullable<SettlementType> ToSettlementType(this SettlementType_Hack hack)
Parameters
Type Name Description
SettlementType_Hack hack
Returns
Type Description
System.Nullable<SettlementType>

ToSettlementType(SettlementTypeIndicator_Hack)

Declaration
public static Nullable<SettlementType> ToSettlementType(this SettlementTypeIndicator_Hack hack)
Parameters
Type Name Description
SettlementTypeIndicator_Hack hack
Returns
Type Description
System.Nullable<SettlementType>
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾