Show / Hide Table of Contents

Class CivicsUtils

Inheritance
System.Object
CivicsUtils
Namespace: Eco.Gameplay.Civics.Misc
Assembly: Eco.Gameplay.dll
Syntax
public static class CivicsUtils : Object

Fields

ProposableStateChangedEvent

Declaration
public static ThreadSafeAction<IProposable> ProposableStateChangedEvent
Field Value
Type Description
ThreadSafeAction<IProposable>

Properties

ArchiveAddendum

Declaration
public static LocString ArchiveAddendum { get; }
Property Value
Type Description
LocString

RevisionAddendum

Declaration
public static LocString RevisionAddendum { get; }
Property Value
Type Description
LocString

Methods

Active(IProposable)

Declaration
public static bool Active(this IProposable proposable)
Parameters
Type Name Description
IProposable proposable
Returns
Type Description
System.Boolean

All<T>(Settlement, Boolean)

Declaration
public static IEnumerable<T> All<T>(Settlement settlement, bool includeChildrenSettlement = false)
    where T : IProposable
Parameters
Type Name Description
Settlement settlement
System.Boolean includeChildrenSettlement
Returns
Type Description
System.Collections.Generic.IEnumerable<T>
Type Parameters
Name Description
T

AllActive<T>(Settlement, Boolean)

Declaration
public static IEnumerable<T> AllActive<T>(Settlement settlement, bool includeChildrenSettlement = false)
    where T : IProposable
Parameters
Type Name Description
Settlement settlement
System.Boolean includeChildrenSettlement
Returns
Type Description
System.Collections.Generic.IEnumerable<T>
Type Parameters
Name Description
T

AllActiveAndProposed<T>(Settlement, Boolean)

Declaration
public static IEnumerable<T> AllActiveAndProposed<T>(Settlement settlement, bool includeChildrenSettlement = false)
    where T : IProposable
Parameters
Type Name Description
Settlement settlement
System.Boolean includeChildrenSettlement
Returns
Type Description
System.Collections.Generic.IEnumerable<T>
Type Parameters
Name Description
T

AllActiveAndValid<T>(Settlement, Boolean)

Declaration
public static IEnumerable<T> AllActiveAndValid<T>(Settlement settlement, bool includeChildrenSettlement = false)
    where T : IProposable, ICachesValidity
Parameters
Type Name Description
Settlement settlement
System.Boolean includeChildrenSettlement
Returns
Type Description
System.Collections.Generic.IEnumerable<T>
Type Parameters
Name Description
T

AllActiveDraftAndProposed<T>(Settlement, Boolean)

Declaration
public static IEnumerable<T> AllActiveDraftAndProposed<T>(Settlement settlement, bool includeChildrenSettlement = false)
    where T : IProposable
Parameters
Type Name Description
Settlement settlement
System.Boolean includeChildrenSettlement
Returns
Type Description
System.Collections.Generic.IEnumerable<T>
Type Parameters
Name Description
T

AllApplicable<T>(Settlement, Boolean)

Return active and valid if settlement is founded (or null), also includes draft and proposed and ignores vailidity if not founded.

Declaration
public static IEnumerable<T> AllApplicable<T>(Settlement settlement, bool includeChildrenSettlement = false)
    where T : IProposable, ICachesValidity
Parameters
Type Name Description
Settlement settlement
System.Boolean includeChildrenSettlement
Returns
Type Description
System.Collections.Generic.IEnumerable<T>
Type Parameters
Name Description
T

AllDrafts<T>(Settlement, Boolean)

Declaration
public static IEnumerable<T> AllDrafts<T>(Settlement settlement, bool includeChildrenSettlement = false)
    where T : IProposable
Parameters
Type Name Description
Settlement settlement
System.Boolean includeChildrenSettlement
Returns
Type Description
System.Collections.Generic.IEnumerable<T>
Type Parameters
Name Description
T

AllInactive<T>(Settlement, Boolean)

Declaration
public static IEnumerable<T> AllInactive<T>(Settlement settlement, bool includeChildrenSettlement = false)
    where T : IProposable
Parameters
Type Name Description
Settlement settlement
System.Boolean includeChildrenSettlement
Returns
Type Description
System.Collections.Generic.IEnumerable<T>
Type Parameters
Name Description
T

AllInState<T>(ProposableState, Settlement, Boolean)

Declaration
public static IEnumerable<T> AllInState<T>(ProposableState state, Settlement settlement, bool includeChildrenSettlement = false)
    where T : IProposable
Parameters
Type Name Description
ProposableState state
Settlement settlement
System.Boolean includeChildrenSettlement
Returns
Type Description
System.Collections.Generic.IEnumerable<T>
Type Parameters
Name Description
T

AllOld<T>(Settlement, Boolean)

Declaration
public static IEnumerable<T> AllOld<T>(Settlement settlement, bool includeChildrenSettlement = false)
    where T : IProposable
Parameters
Type Name Description
Settlement settlement
System.Boolean includeChildrenSettlement
Returns
Type Description
System.Collections.Generic.IEnumerable<T>
Type Parameters
Name Description
T

AssociatedUsers(IHostedObject)

Returns the creator, owners, and accessors on the deed.

Declaration
public static IEnumerable<User> AssociatedUsers(this IHostedObject obj)
Parameters
Type Name Description
IHostedObject obj
Returns
Type Description
System.Collections.Generic.IEnumerable<User>

CanBeAssignedToContainer(IProposable, IOrphanAssignment)

This is used to check whether we can assign an orphan proposable to a container or not. Usually all classes that implement the IProposable interface have the same check that's why we just call this function when implementing IHostedObject.CanBeAssignedTo.

Declaration
public static bool CanBeAssignedToContainer(this IProposable prop, IOrphanAssignment container)
Parameters
Type Name Description
IProposable prop
IOrphanAssignment container
Returns
Type Description
System.Boolean

ConstitutionElectionDraft(Settlement)

Declaration
public static Election ConstitutionElectionDraft(Settlement settlement)
Parameters
Type Name Description
Settlement settlement
Returns
Type Description
Election

GetDistrictDescription(WorldPosition2i)

Declaration
public static LocString GetDistrictDescription(WorldPosition2i pos)
Parameters
Type Name Description
WorldPosition2i pos
Returns
Type Description
LocString

GetHostedProposables(IEnumerable<Type>, WorldObject)

Returns objects that are currently hosted on this world object.

Declaration
public static IEnumerable<IProposable> GetHostedProposables(IEnumerable<Type> types, WorldObject obj)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<System.Type> types
WorldObject obj
Returns
Type Description
System.Collections.Generic.IEnumerable<IProposable>

GetHostedProposables(Type, WorldObject)

Declaration
public static IEnumerable<IProposable> GetHostedProposables(Type type, WorldObject obj)
Parameters
Type Name Description
System.Type type
WorldObject obj
Returns
Type Description
System.Collections.Generic.IEnumerable<IProposable>

GetOrCreateActiveElement<T>(Func<T, Boolean>, Settlement)

Declaration
public static T GetOrCreateActiveElement<T>(Func<T, bool> test, Settlement settlement)
    where T : IProposable
Parameters
Type Name Description
System.Func<T, System.Boolean> test
Settlement settlement
Returns
Type Description
T
Type Parameters
Name Description
T

GetPropertyTables(IProposableContainer)

Declaration
public static LocString[, ] GetPropertyTables(this IProposableContainer container)
Parameters
Type Name Description
IProposableContainer container
Returns
Type Description
LocString[,]

Open(IProposable, Player)

Open for read-only viewing (No need for a specific access type, everybody should be able to view a proposable).

Declaration
public static void Open(this IProposable prop, Player player)
Parameters
Type Name Description
IProposable prop
Player player

RemoveInvalidProposables(IRegistrar)

Declaration
public static void RemoveInvalidProposables(IRegistrar reg)
Parameters
Type Name Description
IRegistrar reg

SendMessage(IHostedObject, LocString, NotificationStyle)

Send a message to all 'associated users', that is the creator, owners, and accessors on the deed.

Declaration
public static void SendMessage(this IHostedObject obj, LocString l, NotificationStyle style)
Parameters
Type Name Description
IHostedObject obj
LocString l
NotificationStyle style

SetProposedState(IProposable, ProposableState, Boolean, Boolean, CivicsUtils.StateChangeDetailFlags)

Declaration
public static bool SetProposedState(this IProposable proposable, ProposableState newState, bool doScan = true, bool notify = true, CivicsUtils.StateChangeDetailFlags flags)
Parameters
Type Name Description
IProposable proposable
ProposableState newState
System.Boolean doScan
System.Boolean notify
CivicsUtils.StateChangeDetailFlags flags
Returns
Type Description
System.Boolean

ShouldStopBasicElectionVoting(Type, String, LawSection)

Declaration
public static Result ShouldStopBasicElectionVoting(Type action, string propName, LawSection section)
Parameters
Type Name Description
System.Type action
System.String propName
LawSection section
Returns
Type Description
Result

ShouldStopCaptiolChangingAction(Type, String, LawSection)

Declaration
public static Result ShouldStopCaptiolChangingAction(Type action, string propName, LawSection section)
Parameters
Type Name Description
System.Type action
System.String propName
LawSection section
Returns
Type Description
Result

TryDestroyProposable(IProposable, Player)

Declaration
public static bool TryDestroyProposable(this IProposable proposable, Player player)
Parameters
Type Name Description
IProposable proposable
Player player
Returns
Type Description
System.Boolean

UpdateChildArticleStates(IEnumerable<CivicArticle>, IProposable, ProposableState)

Meant to be called when a SimpleProposable Object which contains a list of CivicArticles has changed it's state i.e. a Constitution. This function changes the states of those child CivicArticles as well as update the parent (if there is none) and HostObject. state may differ from proposable state in case if we call this function right before parent state change.

Declaration
public static void UpdateChildArticleStates(this IEnumerable<CivicArticle> list, IProposable proposable, ProposableState state)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<CivicArticle> list
IProposable proposable
ProposableState state

UpdateNameSuffix(IProposable, Boolean)

Declaration
public static void UpdateNameSuffix(this IProposable proposable, bool allowRename = false)
Parameters
Type Name Description
IProposable proposable
System.Boolean allowRename
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾