Empeld
Empeld plugin documentation.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
essentials.action.Entities.Actor.AttachableActorBase Class Reference
Inheritance diagram for essentials.action.Entities.Actor.AttachableActorBase:
essentials.action.Entities.Actor.ActorBase essentials.action.Entities.Actor.IAttachableActor pluginbase.Objects.Syncable.Entity.EntityBase pluginbase.Objects.Syncable.Entity.IMutableActor pluginbase.Objects.Syncable.Entity.Controllers.IComponentizedEntity pluginbase.Objects.Syncable.Entity.IActor pluginbase.Objects.Syncable.Entity.Controllers.IModelEntity pluginbase.Objects.Syncable.Entity.Controllers.IHookedEntity pluginbase.Objects.Syncable.Entity.Controllers.ITaskedEntity pluginbase.Objects.Syncable.Entity.IMutableEntity pluginbase.Objects.Syncable.Entity.IActor pluginbase.Objects.Syncable.Entity.Controllers.IRpcEntity pluginbase.Objects.Syncable.Entity.IMutableEntity pluginbase.Objects.Syncable.SyncableObject essentials.action.Entities.Actor.NewtonianBase essentials.action.Entities.Actor.PathingEntityBase essentials.action.Entities.Actor.PlayableBase essentials.action.Entities.AI.AiEntityBase essentials.action.Entities.Basic.GuyEntity

Protected Member Functions

 AttachableActorBase ()
 
IActor GetAttachedActor ()
 
void AttachTo (uint actorId)
 
void AttachTo (IActor actor)
 
void Detach ()
 
- Protected Member Functions inherited from essentials.action.Entities.Actor.ActorBase
sealed override bool ShouldSyncWith (IPositionableEntity user)
 Gets whether or not the entity shuold sync with another entity More...
 
abstract IModelInstance CreateModel ()
 
- 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...
 
virtual void OnServerDestroy ()
 Raises the server destroy event. 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

sealed override Vector3d Position [get, protected set]
 
Vector3d RelativePosition [get, protected set]
 
sealed override Rotation2d Rotation [get, protected set]
 
bool IsAttached [get]
 
- Properties inherited from essentials.action.Entities.Actor.ActorBase
virtual Vector3d Position [get, protected set]
 
bool PositionFinishedInterpolating [get]
 
virtual Rotation2d Rotation [get, protected set]
 
bool IsPlayer [get]
 
bool IsMe [get]
 
string Name [get, protected set]
 
virtual string NamePlate [get]
 
virtual double NamePlateViewDistance [get]
 
virtual Vector3d NamePlateOffset [get]
 
virtual double SyncDistance [get]
 
virtual Vector3d UpVector [get]
 
IModelInstance Model [get]
 
virtual bool Visible [get]
 
virtual bool CastShadow [get]
 
- 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 pluginbase.Objects.Syncable.Entity.IMutableActor
bool IsPlayer [set]
 
bool IsMe [set]
 
- Properties inherited from pluginbase.Objects.Syncable.Entity.IActor
string Name [get]
 
- Properties inherited from pluginbase.Objects.Syncable.Entity.Controllers.IModelEntity
IModelInstance Model [get]
 The instance of the model used for the entity More...
 
string NamePlate [get]
 The name plate displayed for the entity, if any More...
 
double NamePlateViewDistance [get]
 The distance the name plate can be viewed from More...
 
Vector3d NamePlateOffset [get]
 The offset of the nameplate from the position of the entity More...
 
bool Visible [get]
 Gets a value indicating whether the entity is visible More...
 
bool CastShadow [get]
 Gets a value indiciating whether the entity casts a shadow More...
 
- Properties inherited from pluginbase.Objects.Syncable.Entity.IPositionableEntity
Vector3d Position [get]
 Gets the position. More...
 
Vector3d UpVector [get]
 Gets up vector. More...
 
Rotation2d Rotation [get]
 Gets the rotation. More...
 
- Properties inherited from essentials.action.Entities.Actor.IAttachableActor
bool IsAttached [get]
 Is attached to another entity More...
 

Additional Inherited Members

- Public Member Functions inherited from essentials.action.Entities.Actor.ActorBase
virtual void SetPosition (double x, double y, double z)
 Sets the position. More...
 
virtual void SetName (string name)
 
- 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...
 
- 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...
 

Constructor & Destructor Documentation

essentials.action.Entities.Actor.AttachableActorBase.AttachableActorBase ( )
protected
59  {
60  this.InjectDependencies();
61  }

Member Function Documentation

void essentials.action.Entities.Actor.AttachableActorBase.AttachTo ( uint  actorId)
protected
90  {
91  if (!this.Spawned)
92  {
93  _logger.LogWarn("Entity must be spawned before attaching");
94  return;
95  }
96 
97  _logger.LogInfo("Attaching {0} to {1}", this.ObjectId, actorId);
98 
99  if (this.IsServer)
100  {
101  IAttachableTarget target = _entities.GetKnownEntity(actorId) as IAttachableTarget;
102  if (target != null)
103  {
104  if (target.AllowAttach(this))
105  {
106  this.RelativePosition = target.GetAttachPosition(this);
107  this._attachedEntity.Value = target.ObjectId;
108  }
109  }
110  else
111  {
112  //Normal actor
113  var actor = _entities.GetKnownEntity(actorId) as IActor;
114  if (actor != null)
115  {
116  this.RelativePosition = Vector3d.Zero;
117  this._attachedEntity.Value = actorId;
118  }
119  }
120  }
121  else
122  {
123  _logger.LogWarn("Unable to attach entity on client");
124  }
125  }
IEntity GetKnownEntity(uint id)
Gets the entity object of a given entity 'id'
bool IsServer
Is the current object instantiated on the server
Definition: EntityBase.cs:130
Vector3d RelativePosition
Definition: AttachableActorBase.cs:35
void LogWarn(string msg, params object[] args)
void LogInfo(string msg, params object[] args)
uint ObjectId
Gets or sets the object identifier.
Definition: EntityBase.cs:100
bool Spawned
Gets a value indicating whether this entity has been spawned
Definition: EntityBase.cs:68
void essentials.action.Entities.Actor.AttachableActorBase.AttachTo ( IActor  actor)
protected
128  {
129  AttachTo(actor.ObjectId);
130  }
void AttachTo(uint actorId)
Definition: AttachableActorBase.cs:89
uint ObjectId
Gets the object identifier.
Definition: IEntity.cs:16
void essentials.action.Entities.Actor.AttachableActorBase.Detach ( )
protected
133  {
134  if (!_attachedEntity.Value.HasValue)
135  {
136  _logger.LogWarn("Unable to detach: entity is not attached to anything");
137  return;
138  }
139 
140  _logger.LogInfo("Detaching id {0} from base", this.ObjectId);
141 
142  if (this.IsServer)
143  {
144  var actor = _entities.GetKnownEntity(_attachedEntity.Value.Value) as IActor;
145  this.RelativePosition = actor.Position + this.RelativePosition;
146  _attachedEntity.Value = null;
147  }
148  else
149  {
150  _logger.LogWarn("Must detach on server");
151  }
152  }
IEntity GetKnownEntity(uint id)
Gets the entity object of a given entity 'id'
bool IsServer
Is the current object instantiated on the server
Definition: EntityBase.cs:130
Vector3d RelativePosition
Definition: AttachableActorBase.cs:35
void LogWarn(string msg, params object[] args)
void LogInfo(string msg, params object[] args)
uint ObjectId
Gets or sets the object identifier.
Definition: EntityBase.cs:100
IActor essentials.action.Entities.Actor.AttachableActorBase.GetAttachedActor ( )
protected
64  {
65  if (_attachedEntity.Value.HasValue)
66  {
67  uint actorId = _attachedEntity.Value.Value;
68  return _entities.GetKnownEntity(actorId) as IActor;
69  }
70  return null;
71  }
IEntity GetKnownEntity(uint id)
Gets the entity object of a given entity 'id'

Property Documentation

bool essentials.action.Entities.Actor.AttachableActorBase.IsAttached
get
sealed override Vector3d essentials.action.Entities.Actor.AttachableActorBase.Position
getprotected set
Vector3d essentials.action.Entities.Actor.AttachableActorBase.RelativePosition
getprotected set
sealed override Rotation2d essentials.action.Entities.Actor.AttachableActorBase.Rotation
getprotected set

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