User Tools

Site Tools


hpl3:game:scripting:entities

Link to this comparison view

Next revision
Previous revision
hpl3:game:scripting:entities [2015/09/11 10:30]
ian.thomas created
hpl3:game:scripting:entities [2017/05/03 14:44] (current)
alexkalopsia [Critter] Repetition of GiveDamage
Line 20: Line 20:
  
 When an entity no longer needs to be updated it should be put to sleep. This disables **OnUpdate**,​ **OnPostUpdate ** and **OnVariableUpdate ** from being called and saves performance. Entities that are asleep are still rendered and can be interacted with. An entity wakes up automatically if it is interacted with, collides with something, has an effect enabled (like Animation, MeshScale, BaseColorFade..) or if any of its bodies or attachments are woken up. When an entity no longer needs to be updated it should be put to sleep. This disables **OnUpdate**,​ **OnPostUpdate ** and **OnVariableUpdate ** from being called and saves performance. Entities that are asleep are still rendered and can be interacted with. An entity wakes up automatically if it is interacted with, collides with something, has an effect enabled (like Animation, MeshScale, BaseColorFade..) or if any of its bodies or attachments are woken up.
 +
 +**IMPORTANT** \\
 +Props with active physics are currently set to be asleep when you enter a level. This means you can't put an object in mid-air and expect it to '​fall'​ to the correct ground position on startup of the level; you need to put it in the right place to start with. This is because otherwise there'​s a big performance hit at level startup while all the physics are sorted out, and a collection of physics-triggered sounds.\\
 +\\
 +To override this behaviour for a specific object, call **Entity_WakeUp() ** on the entity.
 +
 ==== Auto Sleep ==== ==== Auto Sleep ====
  
Line 74: Line 80:
 **void OnPhysicsCollision(iPhysicsBody @apBody, iPhysicsBody @apCollideBody,​ cPhysicsContactData&​in apContactData)** \\ **void OnPhysicsCollision(iPhysicsBody @apBody, iPhysicsBody @apCollideBody,​ cPhysicsContactData&​in apContactData)** \\
 **float DrawDebugOutput(cGuiSet @apSet,​iFontData @apFont,​float afStartY)** \\ **float DrawDebugOutput(cGuiSet @apSet,​iFontData @apFont,​float afStartY)** \\
-**void OnAttachmentUpdate(const cMatrixf&​in a_mtxTransformAdd)** ​\\ +**void OnAttachmentUpdate(const cMatrixf&​in a_mtxTransformAdd)** 
-**void GiveDamage(float afAmount, int alStrength, const tString&​in asType, const tString&​in asSource)**+
 ==== Agent ==== ==== Agent ====
  
Line 105: Line 111:
 **float DrawDebugOutput(cGuiSet @apSet,​iFontData @apFont,​float afStartY)** \\ **float DrawDebugOutput(cGuiSet @apSet,​iFontData @apFont,​float afStartY)** \\
 **void SetupCharBody()** \\ **void SetupCharBody()** \\
-**void GiveDamage(float afAmount, int alStrength, const tString&​in asType, const tString&​in asSource)** \\ 
 **void HitByProp(float afAmount, float afMass, iPhysicsBody @apBody, cLuxProp @apProp)** **void HitByProp(float afAmount, float afMass, iPhysicsBody @apBody, cLuxProp @apProp)**
 +
 ==== Critter ==== ==== Critter ====
  
Line 128: Line 134:
 **void GiveDamage(float afAmount, int alStrength, const tString&​in asType, const tString&​in asSource)** \\ **void GiveDamage(float afAmount, int alStrength, const tString&​in asType, const tString&​in asSource)** \\
 **void OnUpdate(float afTimeStep)** \\ **void OnUpdate(float afTimeStep)** \\
-**void OnPostUpdate(float afTimeStep)\\ +**void OnPostUpdate(float afTimeStep)** \\ 
-****void OnVariableUpdate(float afDeltaTime)** \\+**void OnVariableUpdate(float afDeltaTime)** \\
 **void OnHealthChange()** \\ **void OnHealthChange()** \\
 **bool CanInteract(int alType, iPhysicsBody@ apBody)** \\ **bool CanInteract(int alType, iPhysicsBody@ apBody)** \\
 **bool OnInteract(int alType, iPhysicsBody@ apBody, const cVector3f &in avFocusPos, const tString&​in asData)** \\ **bool OnInteract(int alType, iPhysicsBody@ apBody, const cVector3f &in avFocusPos, const tString&​in asData)** \\
 **void OnConnectionStateChange(iLuxEntity@ apEntity,​int alState)** \\ **void OnConnectionStateChange(iLuxEntity@ apEntity,​int alState)** \\
-**float DrawDebugOutput(cGuiSet @apSet,​iFontData @apFont,​float afStartY)** ​\\ +**float DrawDebugOutput(cGuiSet @apSet,​iFontData @apFont,​float afStartY)** 
-**void GiveDamage(float afAmount, int alStrength, const tString&​in asType, const tString&​in asSource)**+
 ==== Area ==== ==== Area ====
  
Line 191: Line 197:
 **float DrawDebugOutput(cGuiSet @apSet,​iFontData @apFont,​float afStartY)** \\ **float DrawDebugOutput(cGuiSet @apSet,​iFontData @apFont,​float afStartY)** \\
 **void GiveDamage(float afAmount, int alStrength, const tString&​in asType, const tString&​in asSource)** **void GiveDamage(float afAmount, int alStrength, const tString&​in asType, const tString&​in asSource)**
-==== Reverb Area ==== 
- 
-=== Overview === 
  
-A special kind of area that is only used to set reverb properties for an area of the map. Does not allow variants to be created using script (like LiquidArea does). 
  
hpl3/game/scripting/entities.1441967442.txt.gz · Last modified: 2015/09/11 10:30 by ian.thomas