Class WorldObject
Inheritance
System.Object
WorldObject
Implements
System.ComponentModel.INotifyPropertyChanged
Assembly: Eco.Gameplay.dll
Syntax
[RequireComponent]
public abstract class WorldObject : Object, INetObjectPriority, INetObject, INetObjectPosition, IPositionAndBounds, IUsable, IStorage, ISerializable, IRPCAuthChecks, ILinkable, IHasPosition, INotifyPropertyChanged, IDeedOwned, IController, IViewController, IHasUniversalID, IPlayerUseTracking, INamed, IHasSerializableID, IThreadSafeSubscriptions, ISubscriptions<ThreadSafeSubscriptions>, ISubscriptions, IInteractionTargetPriority, IPermanentDestroyHandler
Constructors
WorldObject()
Declaration
Fields
AttachedTo
Declaration
public WorldObjectHandle AttachedTo
Field Value
CreationItem
Declaration
public IPlaceableItem CreationItem
Field Value
enabled
Declaration
Field Value
Type |
Description |
System.Boolean |
|
IsHUDElement
Declaration
Field Value
Type |
Description |
System.Boolean |
|
netEntity
Declaration
protected NetEntity netEntity
Field Value
operating
Declaration
Field Value
Type |
Description |
System.Boolean |
|
Properties
Active
Declaration
public bool Active { get; }
Property Value
Type |
Description |
System.Boolean |
|
AdminForceEnabled
Declaration
public bool AdminForceEnabled { get; }
Property Value
Type |
Description |
System.Boolean |
|
AllowResidentAccessIfCreator
Declaration
public virtual bool AllowResidentAccessIfCreator { get; }
Property Value
Type |
Description |
System.Boolean |
|
AnimatedStates
Declaration
public ControllerDictionary<string, object> AnimatedStates { get; }
Property Value
Auth
Declaration
public AuthComponent Auth { get; }
Property Value
Bounds
Declaration
public Rect Bounds { get; }
Property Value
CachedSettlementAtPos
Get the settlement associate with this world object. Defined as the lowest level settlement
that influences this position. This is cached data built from the influence map.
Declaration
public Settlement CachedSettlementAtPos { get; set; }
Property Value
CloseWhenDistant
Declaration
public virtual bool CloseWhenDistant { get; }
Property Value
Type |
Description |
System.Boolean |
|
Components
Declaration
[NewTooltipChildren]
public ThreadSafeList<WorldObjectComponent> Components { get; }
Property Value
ControllerID
Declaration
public ref int ControllerID { get; }
Property Value
Type |
Description |
System.Int32 |
|
CreatingItem
Declaration
public virtual IPlaceableItem CreatingItem { get; }
Property Value
Creator
Declaration
public User Creator { get; }
Property Value
Description
Declaration
public virtual string Description { get; }
Property Value
Type |
Description |
System.String |
|
DisplayDescription
Declaration
public virtual LocString DisplayDescription { get; }
Property Value
DisplayName
Declaration
public virtual LocString DisplayName { get; }
Property Value
Enabled
Declaration
public bool Enabled { get; }
Property Value
Type |
Description |
System.Boolean |
|
FriendlyName
Declaration
public virtual string FriendlyName { get; }
Property Value
Type |
Description |
System.String |
|
GivenName
Declaration
protected string GivenName { get; }
Property Value
Type |
Description |
System.String |
|
HasTier
Declaration
public virtual bool HasTier { get; }
Property Value
Type |
Description |
System.Boolean |
|
ID
Declaration
Property Value
Type |
Description |
System.Int32 |
|
Initialized
Declaration
public bool Initialized { get; }
Property Value
Type |
Description |
System.Boolean |
|
InteractDistance
Declaration
public virtual float InteractDistance { get; }
Property Value
Type |
Description |
System.Single |
|
IsDestroyed
Declaration
public bool IsDestroyed { get; }
Property Value
Type |
Description |
System.Boolean |
|
LastSyncedPosition
Declaration
public Vector3i LastSyncedPosition { get; }
Property Value
MarkedUpName
Declaration
public LocString MarkedUpName { get; }
Property Value
Name
Declaration
public string Name { get; set; }
Property Value
Type |
Description |
System.String |
|
NameOfCreator
Declaration
public string NameOfCreator { get; }
Property Value
Type |
Description |
System.String |
|
NetObjectCreationRealtime
Declaration
public double NetObjectCreationRealtime { get; set; }
Property Value
Type |
Description |
System.Double |
|
ObjectID
Declaration
public Guid ObjectID { get; }
Property Value
Type |
Description |
System.Guid |
|
Occupancy
Declaration
public List<BlockOccupancy> Occupancy { get; }
Property Value
OccupancyInfo
Declaration
public OccupancyInfo OccupancyInfo { get; }
Property Value
OnAnyNameChanged
Declaration
public static ThreadSafeAction<WorldObject> OnAnyNameChanged { get; }
Property Value
OnEnableChange
Declaration
public ThreadSafeAction OnEnableChange { get; }
Property Value
OnMovedEvent
Declaration
public ThreadSafeAction OnMovedEvent { get; }
Property Value
OnOperatingChange
Declaration
public ThreadSafeAction OnOperatingChange { get; }
Property Value
OnPositionChange
Declaration
public ThreadSafeAction OnPositionChange { get; }
Property Value
Operating
Declaration
public bool Operating { get; }
Property Value
Type |
Description |
System.Boolean |
|
Outside
Declaration
public bool Outside { get; }
Property Value
Type |
Description |
System.Boolean |
|
Owners
Declaration
public IAlias Owners { get; }
Property Value
OwnersMarkedUpName
Declaration
public LocString OwnersMarkedUpName { get; }
Property Value
PlacesBlocks
Declaration
public virtual bool PlacesBlocks { get; }
Property Value
Type |
Description |
System.Boolean |
|
PlotPos
Declaration
public PlotPos PlotPos { get; }
Property Value
Position
Declaration
public Vector3 Position { get; set; }
Property Value
Type |
Description |
System.Numerics.Vector3 |
|
Position3i
Declaration
public Vector3i Position3i { get; set; }
Property Value
Priority
Declaration
public virtual float Priority { get; }
Property Value
Type |
Description |
System.Single |
|
Room
Declaration
public Room Room { get; }
Property Value
Rotation
Declaration
public Quaternion Rotation { get; set; }
Property Value
StorageHandle
Declaration
public IPersistent StorageHandle { get; set; }
Property Value
Subscriptions
Declaration
public ref ThreadSafeSubscriptions Subscriptions { get; }
Property Value
TableTexture
Declaration
public virtual TableTextureMode TableTexture { get; }
Property Value
TargetPriority
Declaration
public virtual InteractionTargetPriority TargetPriority { get; }
Property Value
Tier
Declaration
public virtual int Tier { get; }
Property Value
Type |
Description |
System.Int32 |
|
Transient
Declaration
public virtual bool Transient { get; }
Property Value
Type |
Description |
System.Boolean |
|
UpdateChannel
Declaration
public NetworkChannel UpdateChannel { get; }
Property Value
Using
Declaration
public bool Using { get; }
Property Value
Type |
Description |
System.Boolean |
|
UsingPlayers
Declaration
public ThreadSafeList<WeakReference> UsingPlayers { get; set; }
Property Value
WorldObjectCreationTime
Declaration
public double WorldObjectCreationTime { get; }
Property Value
Type |
Description |
System.Double |
|
WorldOccupancy
Declaration
public List<Vector3i> WorldOccupancy { get; }
Property Value
Type |
Description |
System.Collections.Generic.List<Vector3i> |
|
WorldRange
Declaration
public WorldRange WorldRange { get; }
Property Value
Methods
AddOccupancy(Type, List<BlockOccupancy>)
Declaration
public static void AddOccupancy(Type t, List<BlockOccupancy> occupancyList)
Parameters
Type |
Name |
Description |
System.Type |
t |
|
System.Collections.Generic.List<BlockOccupancy> |
occupancyList |
|
AddOccupancy<T>(List<BlockOccupancy>)
Declaration
public static void AddOccupancy<T>(List<BlockOccupancy> occupancyList)
Parameters
Type |
Name |
Description |
System.Collections.Generic.List<BlockOccupancy> |
occupancyList |
|
Type Parameters
AddOccupancyList(Type, BlockOccupancy[])
Declaration
public static void AddOccupancyList(Type declaringType, params BlockOccupancy[] blockOccupancyList)
Parameters
Type |
Name |
Description |
System.Type |
declaringType |
|
BlockOccupancy[] |
blockOccupancyList |
|
AddOccupancyRule<T>(Func<WorldObject, OccupancyInfo>)
Adds a new dynamic predicate rule to the occupancy dictionary. Note that a predicate rule will be checked first before returning a normal occupancy.
Declaration
public static void AddOccupancyRule<T>(Func<WorldObject, OccupancyInfo> predicate)
where T : WorldObject
Parameters
Type Parameters
CloseUIForAll(Boolean)
Force all viewers of the world object UI to close it
Declaration
public void CloseUIForAll(bool forceUncache)
Parameters
Type |
Name |
Description |
System.Boolean |
forceUncache |
|
ComponentsInitialized()
Called after all components have been initialized.
Declaration
protected virtual void ComponentsInitialized()
CreateEntity()
Called when the net entity is created.
Declaration
protected virtual void CreateEntity()
Destroy()
Declaration
Returns
Type |
Description |
System.Boolean |
|
DestroyComponents()
Declaration
public void DestroyComponents()
DoInitializationSteps()
Perform the steps needed for initialization, which is called after OnCreate, and every server start.
Declaration
public void DoInitializationSteps()
FinishInitialize()
Declaration
public void FinishInitialize()
GetAnimatedState<T>(String)
Declaration
public T GetAnimatedState<T>(string name)
Parameters
Type |
Name |
Description |
System.String |
name |
|
Returns
Type Parameters
GetBounding(Type)
Declaration
public static Vector3i GetBounding(Type type)
Parameters
Type |
Name |
Description |
System.Type |
type |
|
Returns
GetComponent(String)
Declaration
public WorldObjectComponent GetComponent(string typeName)
Parameters
Type |
Name |
Description |
System.String |
typeName |
|
Returns
GetComponent(Type, String)
Declaration
public object GetComponent(Type componentType, string name = null)
Parameters
Type |
Name |
Description |
System.Type |
componentType |
|
System.String |
name |
|
Returns
Type |
Description |
System.Object |
|
GetComponent<T>(String)
Declaration
public T GetComponent<T>(string name = null)
Parameters
Type |
Name |
Description |
System.String |
name |
|
Returns
Type Parameters
GetComponents<T>()
Declaration
public IEnumerable<T> GetComponents<T>()
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<T> |
|
Type Parameters
GetDeed()
Declaration
Returns
GetIcon(Type)
Declaration
public static string GetIcon(Type type)
Parameters
Type |
Name |
Description |
System.Type |
type |
|
Returns
Type |
Description |
System.String |
|
GetOccupancy(Type)
Declaration
public static List<BlockOccupancy> GetOccupancy(Type type)
Parameters
Type |
Name |
Description |
System.Type |
type |
|
Returns
GetOccupancyInfo(Type)
Declaration
public static OccupancyInfo GetOccupancyInfo(Type type)
Parameters
Type |
Name |
Description |
System.Type |
type |
|
Returns
GetOccupancyRangeOrDefault(Type)
Returns a world range that encompasses the occupancy. This is an exclusive range.
Declaration
public static WorldRange GetOccupancyRangeOrDefault(Type type)
Parameters
Type |
Name |
Description |
System.Type |
type |
|
Returns
GetOccupancyRangeWorldPos()
Return a world range that encompasses the whole object in its current position and occupancy.
Declaration
public WorldRange GetOccupancyRangeWorldPos()
Returns
GetOccupancyType(BlockOccupancyType)
Declaration
public Ray GetOccupancyType(BlockOccupancyType type)
Parameters
Returns
GetOccupiedPropertyPositions(Type, Vector3, Quaternion)
Returns all plots intersecting with occupied block positions.
Declaration
public static IEnumerable<PlotPos> GetOccupiedPropertyPositions(Type type, Vector3 pos, Quaternion rot)
Parameters
Type |
Name |
Description |
System.Type |
type |
|
System.Numerics.Vector3 |
pos |
|
Quaternion |
rot |
|
Returns
Type |
Description |
System.Collections.Generic.IEnumerable<PlotPos> |
|
GetOrCreateComponent<T>(String)
Declaration
public T GetOrCreateComponent<T>(string name = null)
where T : WorldObjectComponent
Parameters
Type |
Name |
Description |
System.String |
name |
|
Returns
Type Parameters
HasComponent(Type, String)
Declaration
public bool HasComponent(Type componentType, string name = null)
Parameters
Type |
Name |
Description |
System.Type |
componentType |
|
System.String |
name |
|
Returns
Type |
Description |
System.Boolean |
|
HasComponent<T>()
Declaration
public bool HasComponent<T>()
Returns
Type |
Description |
System.Boolean |
|
Type Parameters
Initialize()
Initialize the object and components.
Declaration
protected virtual void Initialize()
InitializeComponents()
Declaration
public void InitializeComponents()
InteractOnComponent(Player, Type, String, InteractionTriggerInfo, InteractionTarget)
We create this RPC to allow calling an RPC on a component for which the client doesnt have a view, so it uses the world object + component type
Note: this should be removed once we have a more general system for calling RPCs on sub-components
Declaration
public void InteractOnComponent(Player player, Type componentType, string methodName, InteractionTriggerInfo triggerInfo, InteractionTarget target)
Parameters
IsAuthorized(User, AccessType)
Declaration
public bool IsAuthorized(User user, AccessType requiredAccess)
Parameters
Returns
Type |
Description |
System.Boolean |
|
IsNotRelevant(INetObjectViewer)
Declaration
public virtual bool IsNotRelevant(INetObjectViewer viewer)
Parameters
Returns
Type |
Description |
System.Boolean |
|
IsRelevant(INetObjectViewer)
Declaration
public virtual bool IsRelevant(INetObjectViewer viewer)
Parameters
Returns
Type |
Description |
System.Boolean |
|
IsUpdated(INetObjectViewer)
Declaration
public virtual bool IsUpdated(INetObjectViewer viewer)
Parameters
Returns
Type |
Description |
System.Boolean |
|
LateTick()
Declaration
public virtual void LateTick()
LateTickComponents()
Declaration
public void LateTickComponents()
MoveWorldObjectTo(Vector3i, Quaternion)
Moves world object by updating position, rotation, block occupancy and triggers moved events.
Declaration
public void MoveWorldObjectTo(Vector3i pos, Quaternion rot)
Parameters
OnAdd(User, WrappedWorldPosition3, Quaternion, Boolean, WorldObject)
Declaration
public Task OnAdd(User creator, WrappedWorldPosition3 position, Quaternion rotation, bool allowAsync = true, WorldObject attachedToWorldObject = null)
Parameters
Returns
Type |
Description |
System.Threading.Tasks.Task |
|
OnAuthChanged()
Declaration
public void OnAuthChanged()
OnAuthSet(Deed)
Declaration
public void OnAuthSet(Deed deed)
Parameters
Type |
Name |
Description |
Deed |
deed |
|
OnClick(Player)
Declaration
public void OnClick(Player clickingPlayer)
Parameters
Type |
Name |
Description |
Player |
clickingPlayer |
|
OnCreatePostInitialize()
Called upon creation, after all components have been initialized.
Declaration
protected virtual void OnCreatePostInitialize()
OnCreatePreInitialize()
Called before components are created at all.
Declaration
protected virtual void OnCreatePreInitialize()
OnDestroy()
Method called from Destroy() when world object destroys. May be overriden in inherited classes.
Declaration
protected virtual void OnDestroy()
OnLinkClicked(TooltipOrigin, TooltipClickContext, User)
Declaration
public void OnLinkClicked(TooltipOrigin origin, TooltipClickContext clickContext, User user)
Parameters
OnPermanentDestroy()
Declaration
public virtual void OnPermanentDestroy()
OnUsingPlayersChange()
Declaration
public void OnUsingPlayersChange()
OpenUI(Player)
Declaration
public void OpenUI(Player player)
Parameters
Type |
Name |
Description |
Player |
player |
|
PlaceWorldObjectBlocks(WorldObject)
Declaration
public void PlaceWorldObjectBlocks(WorldObject attachedToWorldObject)
Parameters
Type |
Name |
Description |
WorldObject |
attachedToWorldObject |
|
PostAdd()
Declaration
PostInitialize()
For when you have autogen and non-autogen halves of a class that both want to override Initialize. Currently Initalize always happens in the autogen file. Any initalization that happens in PostInitialize will override changes from Initalize.
Declaration
protected virtual void PostInitialize()
ReceiveInitialState(BSONObject)
Declaration
public virtual void ReceiveInitialState(BSONObject bsonObj)
Parameters
ReceiveUpdate(BSONObject)
Declaration
public virtual void ReceiveUpdate(BSONObject bsonObj)
Parameters
ReceiveUpdateComponents(BSONObject)
Declaration
public void ReceiveUpdateComponents(BSONObject bsonObj)
Parameters
ReleaseUIComponents()
Releases UI opened by the client. Usually it means to detach all UI components so they may release resources on client and stop receiving component updates. Some UIs may be opened without consumer access so we shouldn't ask any access for RPC to release it.
Declaration
public HashSet<int> ReleaseUIComponents()
Returns
Type |
Description |
System.Collections.Generic.HashSet<System.Int32> |
|
RoomUpdated()
Declaration
public virtual void RoomUpdated()
SendInitialState(BSONObject, INetObjectViewer)
Declaration
public virtual void SendInitialState(BSONObject bsonObj, INetObjectViewer viewer)
Parameters
SendInitialStateComponents(BSONObject, INetObjectViewer)
Declaration
public void SendInitialStateComponents(BSONObject bsonObj, INetObjectViewer viewer)
Parameters
SendUIComponents(Player)
Declaration
public void SendUIComponents(Player player)
Parameters
Type |
Name |
Description |
Player |
player |
|
SendUpdate(BSONObject, INetObjectViewer)
Declaration
public virtual void SendUpdate(BSONObject bsonObj, INetObjectViewer viewer)
Parameters
SendUpdateComponents(BSONObject, INetObjectViewer)
Declaration
public void SendUpdateComponents(BSONObject bsonObj, INetObjectViewer viewer)
Parameters
SetAdminForceEnabled(Boolean)
Can be called to force this to be enabled, regardless of component enabled sates.
Declaration
public void SetAdminForceEnabled(bool set)
Parameters
Type |
Name |
Description |
System.Boolean |
set |
|
SetAnimatedState(String, Boolean)
Declaration
public void SetAnimatedState(string name, bool val)
Parameters
Type |
Name |
Description |
System.String |
name |
|
System.Boolean |
val |
|
SetAnimatedState(String, Single)
Declaration
public void SetAnimatedState(string name, float val)
Parameters
Type |
Name |
Description |
System.String |
name |
|
System.Single |
val |
|
SetAnimatedState(String, String)
Declaration
public void SetAnimatedState(string name, string val)
Parameters
Type |
Name |
Description |
System.String |
name |
|
System.String |
val |
|
SetComponentsParent()
Declaration
public void SetComponentsParent()
SetDirty()
Declaration
SetName(Player, String)
Declaration
public virtual void SetName(Player player, string newName)
Parameters
Type |
Name |
Description |
Player |
player |
|
System.String |
newName |
|
SetName(String)
Declaration
public void SetName(string newName)
Parameters
Type |
Name |
Description |
System.String |
newName |
|
SyncPositionAndRotation()
Declaration
public void SyncPositionAndRotation()
Tick()
Declaration
public virtual void Tick()
TickComponents()
Declaration
public void TickComponents()
ToggleAnimatedState(Player, String)
Toggles the animated state with given name to its opposite state, assuming the calling player has at least consumer access.
Declaration
public void ToggleAnimatedState(Player player, string name)
Parameters
Type |
Name |
Description |
Player |
player |
|
System.String |
name |
|
ToString()
Declaration
public override string ToString()
Returns
Type |
Description |
System.String |
|
TriggerAnimatedEvent(String)
Declaration
public void TriggerAnimatedEvent(string name)
Parameters
Type |
Name |
Description |
System.String |
name |
|
TryGetComponent<T>(out T)
Declaration
public bool TryGetComponent<T>(out T component)
where T : WorldObjectComponent
Parameters
Type |
Name |
Description |
T |
component |
|
Returns
Type |
Description |
System.Boolean |
|
Type Parameters
UILink(Int32, Type, Boolean)
Declaration
public static LocString UILink(int num, Type worldObjectType, bool plural = false)
Parameters
Type |
Name |
Description |
System.Int32 |
num |
|
System.Type |
worldObjectType |
|
System.Boolean |
plural |
|
Returns
UILink(Type, Boolean)
Declaration
public static LocString UILink(Type worldObjectType, bool plural = false)
Parameters
Type |
Name |
Description |
System.Type |
worldObjectType |
|
System.Boolean |
plural |
|
Returns
UILink<T>(Boolean)
Declaration
public static LocString UILink<T>(bool plural = false)
where T : WorldObject
Parameters
Type |
Name |
Description |
System.Boolean |
plural |
|
Returns
Type Parameters
UILinkContent()
Declaration
public LocString UILinkContent()
Returns
UpdateEnabledAndOperating()
Declaration
public void UpdateEnabledAndOperating()
Use(Player, InteractionTarget, InteractionTriggerInfo, String)
Declaration
public virtual void Use(Player player, InteractionTarget target, InteractionTriggerInfo triggerInfo, string ui = "WorldObjectUI")
Parameters
Events
PropertyChanged
Declaration
public event PropertyChangedEventHandler PropertyChanged
Event Type
Type |
Description |
System.ComponentModel.PropertyChangedEventHandler |
|
SyncPositionEvent
Declaration
public event Action SyncPositionEvent
Event Type
Type |
Description |
System.Action |
|
Implements
System.ComponentModel.INotifyPropertyChanged
Extension Methods