Empeld
Empeld plugin documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
essentials.Systems.Structures.Network.Resources.ConstructedStructure Class Reference

Abstract class to for a structure that consumes resources in order to build itself More...

Inheritance diagram for essentials.Systems.Structures.Network.Resources.ConstructedStructure:
essentials.Systems.Structures.Network.NetworkedStructure essentials.Systems.Structures.Structure essentials.Systems.Structures.Network.INetworkedStructure pluginbase.Objects.Syncable.Entity.EntityBase essentials.Systems.Structures.IStructure pluginbase.Objects.Syncable.Entity.Controllers.IComponentizedEntity essentials.Systems.Structures.IStructure pluginbase.Objects.Syncable.SyncableObject pluginbase.Objects.Syncable.Entity.IMutableEntity pluginbase.Objects.Syncable.Entity.Controllers.IRpcEntity pluginbase.Objects.Syncable.Entity.IEntity pluginbase.Objects.Syncable.Entity.Controllers.ITaskedEntity pluginbase.Objects.Syncable.Entity.Controllers.IHookedEntity pluginbase.Objects.Syncable.Entity.IEntity pluginbase.Objects.Syncable.SyncableBase< T > pluginbase.Objects.Syncable.Entity.IEntity pluginbase.Objects.Syncable.INetSyncable pluginbase.Objects.Syncable.Entity.IEntity pluginbase.Objects.Syncable.Entity.Controllers.IEntityController pluginbase.Objects.Syncable.Entity.Controllers.IEntityController pluginbase.Objects.Syncable.Entity.Controllers.IEntityController pluginbase.Objects.Syncable.INetSyncable pluginbase.Objects.Syncable.INetWatcher pluginbase.Objects.Syncable.INetWatcher essentials.Systems.Structures.Network.Resources.PoweredStructure essentials.Systems.Structures.Network.Resources.ContainerStructure< T >

Protected Member Functions

 ConstructedStructure (Vector3i pos)
 
 ConstructedStructure ()
 
void BeginConstruction ()
 
virtual bool StructureBlockPlacementPredicate (PrefabBlock block)
 
virtual void BuildPlatform ()
 
virtual void OnBuildComplete ()
 Called when construction has completed More...
 
virtual void OnBuildInvalidated ()
 Called when something has detected an invalid (damaged) structure More...
 
virtual void OnBuildStarted ()
 Called when the structure has started building More...
 
virtual bool GetResourcesToBuild ()
 Returns true if the necessary resources to build another tick are statisfied More...
 
- Protected Member Functions inherited from essentials.Systems.Structures.Network.NetworkedStructure
 NetworkedStructure (Vector3i position)
 
 NetworkedStructure ()
 
bool IsConnectedTo (INetworkedStructure other, BlockTypeGroup blockTypes)
 Tests if this structure is connected a specific other structure More...
 
IEnumerable< IStructureConnectionGetConnectedTo (BlockTypeGroup blockTypes)
 Enumerates over all structures connected to this structure (even indirectly) More...
 
virtual void OnConnectionEstablished (IStructureConnection connection)
 Raises when a connection is established to another networked structure More...
 
virtual void OnConnectionInvalidated (IStructureConnection connection)
 Raises the connection to another network structure is invalidated More...
 
- Protected Member Functions inherited from essentials.Systems.Structures.Structure
 Structure (Vector3i position)
 
 Structure ()
 
abstract IReadonlyPrefab CreatePrefab ()
 
override void OnServerDestroy ()
 Raises the server destroy event. More...
 
sealed override bool ShouldSyncWith (IPositionableEntity user)
 Gets whether or not the entity shuold sync with another entity More...
 
- Protected Member Functions inherited from pluginbase.Objects.Syncable.Entity.EntityBase
void SetTransient (bool isTransient=true)
 Sets whether or not the entity will be persisted Transient entities will not be persisted More...
 
virtual void OnServerSpawn ()
 Raises the server spawn event. Will only be called once, even across reloads More...
 
void InvokeRemotely (string methodName, RpcTarget target, params object[] args)
 Invoke a remote method on a target More...
 
void InvokeRemotely< T > (string methodName, RpcTarget target, Action< RpcNetworkContext, T > returnCallback, params object[] args)
 Invoke a remote method on a target More...
 
void InvokeRemotely< T > (string methodName, RpcTarget target, Action< T > returnCallback, params object[] args)
 Invoke a remote method on a target More...
 
void InvokeDirect (string methodName, params object[] args)
 Invoke a remote method on the opposite-owner eg. if this is the server, than on the client owner, otherwise on the server More...
 
void InvokeDirect< T > (string methodName, Action< RpcNetworkContext, T > returnCallback, params object[] args)
 Invoke a remote method on the opposite-owner eg. if this is the server, than on the client owner, otherwise on the server More...
 
void InvokeDirect< T > (string methodName, Action< T > returnCallback, params object[] args)
 Invoke a remote method on the opposite-owner eg. if this is the server, than on the client owner, otherwise on the server More...
 
void InvokeDirect (Expression< Action > thisExpression)
 Invokes a method on the opposite-owner. Action must act upon this More...
 
void InvokeDirect< TRet > (Expression< Func< TRet >> thisExpression, Action< TRet > returnCallback)
 Invokes a method on the opposite-owner. Action must act upon this More...
 
- Protected Member Functions inherited from pluginbase.Objects.Syncable.SyncableObject
sealed override void ResetWatch ()
 Reset variables watched status More...
 
sealed override void TouchRecurse ()
 Touch self, including all children of this syncable object More...
 
sealed override void EncodeTo (BinaryWriter writer, EncodeContext context)
 Encode changes to binary data More...
 
sealed override void DecodeFrom (BinaryReader reader, DecodeContext context)
 Decode changes from binary data More...
 
sealed override void Persist (IPersistObject obj)
 Build up a persistant object for this syncable, including all sync children and persist objects More...
 
sealed override void Load (IReadPersistObject obj)
 Load a given persistent object back into this instance More...
 
- Protected Member Functions inherited from pluginbase.Objects.Syncable.SyncableBase< T >
void Touch ()
 Touch the instance, notifying something has changed More...
 
virtual void OnChanged ()
 Raises the changed event. More...
 

Properties

bool IsConstructed [get]
 
virtual TimeSpan BuildDelay [get]
 Gets the amount of time between each build tick More...
 
- Properties inherited from essentials.Systems.Structures.Network.NetworkedStructure
int NetworkConnections [get]
 
- Properties inherited from essentials.Systems.Structures.Structure
Vector3i Position [get]
 The world-position of the structure More...
 
abstract string Name [get]
 
PrefabInstance PrefabInstance [get]
 The prefab instance of the structure More...
 
- Properties inherited from pluginbase.Objects.Syncable.Entity.EntityBase
bool Spawned [get]
 Gets a value indicating whether this entity has been spawned More...
 
uint ObjectId [get]
 Gets or sets the object identifier. More...
 
ushort OwnerId [get]
 The ident of the owner of the obejct More...
 
sealed override ushort NetOwnerId [get]
 Who owns me?! (Net ID) This is how we pass information down to SyncableObject More...
 
bool IsServer [get]
 Is the current object instantiated on the server More...
 
ushort ObjectTypeId [get]
 The type ID of the object, as defined by the entity attribute More...
 
- Properties inherited from pluginbase.Objects.Syncable.SyncableObject
virtual ushort NetOwnerId [get]
 Gets the network owner of this object (user id) More...
 
- Properties inherited from pluginbase.Objects.Syncable.INetSyncable
INetWatcher Watcher [get, set]
 Who is watching (who to inform of a change) More...
 
bool Modified [get]
 Gets a value indicating whether this pluginbase.Objects.Syncable.INetSyncable is modified. More...
 
- Properties inherited from pluginbase.Objects.Syncable.Entity.IEntity
uint ObjectId [get]
 Gets the object identifier. More...
 
ushort OwnerId [get]
 Gets the owner identifier. (Net Ident) More...
 
ushort ObjectTypeId [get]
 Gets the object type identifier, as defined by the attribute More...
 
bool DestroyFlag [get]
 Gets a value indicating whether this pluginbase.Objects.Syncable.Entity.IEntity is destroyable. More...
 
bool Spawned [get]
 Gets a value indicating whether this entity has been spawned More...
 
bool Transient [get]
 Gets a value indicating whether this entity is transient (Won't be saved) More...
 
- Properties inherited from essentials.Systems.Structures.IStructure
string Name [get]
 Name of the structure More...
 
Vector3i Position [get]
 The world-position of the structure More...
 
PrefabInstance PrefabInstance [get]
 The prefab instance of the structure More...
 
- Properties inherited from essentials.Systems.Structures.Network.INetworkedStructure
int NetworkConnections [get]
 Gets the total number of outgoing network connections More...
 

Additional Inherited Members

- Public Member Functions inherited from essentials.Systems.Structures.Structure
virtual void Unbuild ()
 Destroy and erase the prefab from the world More...
 
virtual void Build ()
 Construct the prefab instantly More...
 
- Public Member Functions inherited from pluginbase.Objects.Syncable.Entity.EntityBase
void Destroy ()
 Marks the entity for destruction More...
 
override string ToString ()
 Gets a human-readable string representing an entity More...
 
- Public Member Functions inherited from pluginbase.Objects.Syncable.SyncableObject
 SyncableObject ()
 Initializes a new instance of the pluginbase.Objects.Syncable.SyncableObject class. More...
 
- Public Member Functions inherited from essentials.Systems.Structures.IStructure
void Destroy ()
 Destroy the structure More...
 
- Protected Attributes inherited from essentials.Systems.Structures.Network.NetworkedStructure
int MaxScanRange = 128
 Max range to scan for a connected structure More...
 
- Events inherited from pluginbase.Objects.Syncable.SyncableBase< T >
Action< T > Changed
 Event triggered when any change occurs on this object, either locally or over the network More...
 
Action< T > NetUpdate
 Event triggered when a change occurs resulting from a change over the network More...
 
Action< T > Touched
 Event occurs only when an object is first touched. Usually the first instance of a local-change More...
 

Detailed Description

Abstract class to for a structure that consumes resources in order to build itself

Constructor & Destructor Documentation

essentials.Systems.Structures.Network.Resources.ConstructedStructure.ConstructedStructure ( Vector3i  pos)
protected
40  :base(pos)
41  {
42  this.InjectDependencies();
43  }
essentials.Systems.Structures.Network.Resources.ConstructedStructure.ConstructedStructure ( )
protected
46  {
47  this.InjectDependencies();
48  }

Member Function Documentation

void essentials.Systems.Structures.Network.Resources.ConstructedStructure.BeginConstruction ( )
protected
51  {
52  if (!this.PrefabInstance.IsComplete(this.StructureBlockPlacementPredicate) && _constructor == null)
53  {
54  this.BuildPlatform();
55  _constructor = this.PrefabInstance.CreateConstructor(this.StructureBlockPlacementPredicate);
56  _scheduler.ScheduleRecurringTask(BuildStep, this.BuildDelay);
57  this.OnBuildStarted();
58  }
59  }
virtual void OnBuildStarted()
Called when the structure has started building
Definition: ConstructedStructure.cs:141
virtual TimeSpan BuildDelay
Gets the amount of time between each build tick
Definition: ConstructedStructure.cs:159
An object that represents an in-world instance of a prefab
Definition: PrefabInstance.cs:14
virtual bool StructureBlockPlacementPredicate(PrefabBlock block)
Definition: ConstructedStructure.cs:109
virtual void BuildPlatform()
Definition: ConstructedStructure.cs:114
virtual void essentials.Systems.Structures.Network.Resources.ConstructedStructure.BuildPlatform ( )
protectedvirtual
115  {
116  if (!this.IsServer)
117  throw new InvalidOperationException("Build must happen on server");
118  var constructor = this.PrefabInstance.CreateConstructor(x => x.RelPos.Z == 0 && x.Block.Id != 0);
119  constructor.Construct();
120  }
bool IsServer
Is the current object instantiated on the server
Definition: EntityBase.cs:130
An object that represents an in-world instance of a prefab
Definition: PrefabInstance.cs:14
virtual bool essentials.Systems.Structures.Network.Resources.ConstructedStructure.GetResourcesToBuild ( )
protectedvirtual

Returns true if the necessary resources to build another tick are statisfied

Returns
true, if resources to build was gotten, false otherwise.
151  {
152  return true;
153  }
virtual void essentials.Systems.Structures.Network.Resources.ConstructedStructure.OnBuildComplete ( )
protectedvirtual

Called when construction has completed

126  {
127  _log.LogInfo("Construction of {0} completed", this);
128  }
void LogInfo(string msg, params object[] args)
virtual void essentials.Systems.Structures.Network.Resources.ConstructedStructure.OnBuildInvalidated ( )
protectedvirtual

Called when something has detected an invalid (damaged) structure

134  {
135  _log.LogInfo("Structure {0} has invalidated its building", this);
136  }
void LogInfo(string msg, params object[] args)
virtual void essentials.Systems.Structures.Network.Resources.ConstructedStructure.OnBuildStarted ( )
protectedvirtual

Called when the structure has started building

142  {
143  _log.LogInfo("Construction of {0} has started", this);
144  }
void LogInfo(string msg, params object[] args)
virtual bool essentials.Systems.Structures.Network.Resources.ConstructedStructure.StructureBlockPlacementPredicate ( PrefabBlock  block)
protectedvirtual
110  {
111  return PrefabInstance.PredicateDefault(block);
112  }
An object that represents an in-world instance of a prefab
Definition: PrefabInstance.cs:14
static readonly PrefabLookupDelegate PredicateDefault
Default lookup (PredicateNoEmpty)
Definition: PrefabInstance.cs:44

Property Documentation

virtual TimeSpan essentials.Systems.Structures.Network.Resources.ConstructedStructure.BuildDelay
getprotected

Gets the amount of time between each build tick

The build delay.

bool essentials.Systems.Structures.Network.Resources.ConstructedStructure.IsConstructed
get

The documentation for this class was generated from the following file: