IEntityScriptComponent

IEntityScriptComponentabstract

Lua Script component interface. More...

#include

Inherits IEntityComponent.

Public Member Functions

virtual void SetScriptUpdateRate (float fUpdateEveryNSeconds)=0
virtual IScriptTable * GetScriptTable ()=0
virtual void CallEvent (const char *sEvent)=0
virtual void CallEvent (const char *sEvent, float fValue)=0
virtual void CallEvent (const char *sEvent, bool bValue)=0
virtual void CallEvent (const char *sEvent, const char *sValue)=0
virtual void CallEvent (const char *sEvent, const Vec3 &vValue)=0
virtual void CallEvent (const char *sEvent, EntityId nEntityId)=0
virtual bool GotoState (const char *sStateName)=0
virtual bool GotoStateId (int nStateId)=0
virtual bool IsInState (const char *sStateName)=0
virtual const char * GetState ()=0
virtual int GetStateId ()=0
virtual void SendScriptEvent (int Event, IScriptTable *pParamters, bool *pRet=NULL)=0
virtual void SendScriptEvent (int Event, const char *str, bool *pRet=NULL)=0
virtual void SendScriptEvent (int Event, int nParam, bool *pRet=NULL)=0
virtual void ChangeScript (IEntityScript *pScript, SEntitySpawnParams *params)=0
virtual void SetPhysParams (int type, IScriptTable *params)=0
virtual void EnableScriptUpdate (bool bEnable)=0
- Public Member Functions inherited from IEntityComponent
virtual ICryFactory * GetFactory () const
ILINE IEntity * GetEntity () const
ILINE EntityId GetEntityId () const
IEntityComponent (IEntityComponent &&other)
IEntityComponent (const IEntityComponent &)=default
IEntityComponent & operator= (const IEntityComponent &)=default
IEntityComponent & operator= (IEntityComponent &&)=default
const CEntityComponentClassDesc & GetClassDesc () const
virtual uint64 GetEventMask () const
virtual ComponentEventPriority GetEventPriority () const
Determines the order in which this component will receive entity events (including update). Lower number indicates a higher priority.
virtual NetworkAspectType GetNetSerializeAspectMask () const
Network serialization. Override to provide a mask of active network aspects used by this component. Called once during binding to network. More...
virtual bool NetSerialize (TSerialize ser, EEntityAspects aspect, uint8 profile, int flags)
Network serialization. Will be called for each active aspect for both reading and writing. More...
virtual void NetReplicateSerialize (TSerialize ser)
virtual void NetMarkAspectsDirty (const NetworkAspectType aspects)
Call this to trigger aspect synchronization over the network. A shortcut. More...
virtual IEntityComponentPreviewer * GetPreviewer ()
Override this to return preview render interface for the component. Multiple component instances can usually share the same previewer class instance. More...
void SetComponentFlags (ComponentFlags flags)
END IEntityComponent virtual interface. More...
const ComponentFlags & GetComponentFlags () const
Return flags for this component.
ComponentFlags & GetComponentFlags ()
const CryGUID & GetGUID () const
IEntityComponent * GetParent () const
const CryTransform::CTransformPtr & GetTransform () const
Return Transformation of the entity component relative to the owning entity or parent component.
void SetTransformMatrix (const Matrix34 &transform)
Sets the transformation form a matrix. If the component doesn't have a transformation yet the function will add one.
void SetTransformMatrix (const CryTransform::CTransformPtr &transform)
Sets the transformation from another transformation. If the component doesn't have a transformation yet the function will add one.
Matrix34 GetWorldTransformMatrix () const
Return Transformation of the entity component relative to the world.
Matrix34 GetTransformMatrix () const
Return Calculated Transformation Matrix for current component transform.
const char * GetName () const
Get name of this individual component, usually only Schematyc components will have names.
void SetName (const char *szName)
int GetEntitySlotId () const
Return optional EntitySlot id used by this Component.
int GetOrMakeEntitySlotId ()
void SetEntitySlotId (int slotId)
Stores Entity slot id used by this component.
void FreeEntitySlot ()
Frees entity slot used by this component.
EEntitySimulationMode GetEntitySimulationMode () const
Return Current simulation mode of the host Entity.
void SendEvent (const SEntityEvent &event)
virtual void GetMemoryUsage (ICrySizer *pSizer) const
virtual void GameSerialize (TSerialize ser)
virtual bool NeedGameSerialize ()
virtual void LegacySerializeXML (XmlNodeRef &entityNode, XmlNodeRef &componentNode, bool bLoading)
virtual struct IEntityPropertyGroup * GetPropertyGroup ()
Only for backward compatibility to Release 5.3.0 for loading.
virtual EEntityProxy GetProxyType () const
Legacy, used for old entity proxies.

Additional Inherited Members

- Public Types inherited from IEntityComponent
typedef int ComponentEventPriority
typedef EEntityComponentFlags EFlags
typedef EntityComponentFlags ComponentFlags
- Static Public Attributes inherited from IEntityComponent
static constexpr int EmptySlotId = -1
- Protected Member Functions inherited from IEntityComponent
virtual void * QueryInterface (const CryInterfaceID &iid) const
virtual void * QueryComposite (const char *name) const
virtual void PreInit (const SInitParams &params)
virtual void Initialize ()
Called at the very first initialization of the component, at component creation time.
virtual void OnShutDown ()
Called on all Entity components right before all of the Entity Components are destructed.
virtual void OnTransformChanged ()
Called when the transformation of the component is changed.
virtual void ProcessEvent (const SEntityEvent &event)
- Protected Attributes inherited from IEntityComponent
friend IEntity
IEntity * m_pEntity = nullptr
ComponentFlags m_componentFlags
CryGUID m_guid
Unique GUID of the instance of this component.
string m_name
name of this component
CryTransform::CTransformPtr m_pTransform
Optional transformation setting for the component within the Entity object.
IEntityComponent * m_pParent = nullptr
Optional pointer to our parent component.
const CEntityComponentClassDesc * m_pClassDesc = nullptr
int m_entitySlotId = EmptySlotId
Optional Entity SlotId for storing component data like geometry of character.

Detailed Description

Lua Script component interface.

Member Function Documentation

◆ ChangeScript()

virtual void IEntityScriptComponent::ChangeScript ( IEntityScript * pScript,
SEntitySpawnParams * params
)
pure virtual

Change the Entity Script used by the Script Component. Caller is responsible for making sure new script is initialised and script bound as required

Parameters
pScriptan entity script object that has already been loaded with the new script.
paramsparameters used to set the properties table if required.

◆ EnableScriptUpdate()

virtual void IEntityScriptComponent::EnableScriptUpdate ( bool bEnable)
pure virtual

Determines whether or not the script should receive update callbacks Replaces IEntity::Activate for legacy projects

◆ GetState()

virtual const char* IEntityScriptComponent::GetState ( )
pure virtual

Retrieves name of the currently active entity script state.

Returns
Name of current state.

◆ GetStateId()

virtual int IEntityScriptComponent::GetStateId ( )
pure virtual

Retrieves the id of the currently active entity script state.

Returns
Index of current state.

◆ GotoState()

virtual bool IEntityScriptComponent::GotoState ( const char * sStateName)
pure virtual

Change current state of the entity script.

Returns
If state was successfully set.

◆ GotoStateId()

virtual bool IEntityScriptComponent::GotoStateId ( int nStateId)
pure virtual

Change current state of the entity script.

Returns
If state was successfully set.

◆ IsInState()

virtual bool IEntityScriptComponent::IsInState ( const char * sStateName)
pure virtual

Check if entity is in specified state.

Parameters
sStateNameName of state table within entity script (case sensitive).
Returns
If entity script is in specified state.

◆ SendScriptEvent()

virtual void IEntityScriptComponent::SendScriptEvent ( int Event,
IScriptTable * pParamters,
bool * pRet = NULL
)
pure virtual

Fires an event in the entity script. This will call OnEvent(id,param) Lua function in entity script, so that script can handle this event.

◆ SetPhysParams()

virtual void IEntityScriptComponent::SetPhysParams ( int type,
IScriptTable * params
)
pure virtual

Sets physics parameters from an existing script table

Parameters
type- one of PHYSICPARAM_... values
paramsscript table containing the values to set