35typedef Param7<vector, vector, vector, vector, float, string, array<ref TriggerInsider>> DebugTriggerInfo;
48 string m_DebugAreaType;
124 return GetCollisionRadius();
138 for (
int n = 0; n <
m_insiders.Count(); ++n )
153 for (
int n = 0; n <
m_insiders.Count(); ++n )
255 obj.OnEnterTrigger(
this);
257 #ifdef TRIGGER_DEBUG_NORMAL
266 insider.
GetObject().OnLeaveTrigger(
this);
268 #ifdef TRIGGER_DEBUG_NORMAL
282 for (
int n = 0; n <
m_insiders.Count(); ++n )
299 #ifdef DIAG_DEVELOPER
300 DebugSendDmgTrigger();
311 for (
int n =
m_insiders.Count() - 1; n >= 0 ; --n)
319 #ifdef TRIGGER_DEBUG_BASIC
336 float currentTime =
g_Game.GetTickTime();
352 super.OnRPC(sender, rpc_type, ctx);
354 #ifdef DIAG_DEVELOPER
357 case ERPCs.DIAG_TRIGGER_DEBUG:
361 DebugDmgTrigger(data.param1, data.param2, data.param3, data.param4, data.param5, data.param6, data.param7);
368 void DebugSendDmgTrigger()
371 GetCollisionBox(minmax);
374 data.param1 = GetWorldPosition();
376 data.param3 = minmax[0];
377 data.param4 = minmax[1];
378 data.param5 = GetCollisionRadius();
379 data.param6 = m_DebugAreaType;
383 PluginDiagMenuServer.SendDataToSubscribersServer(
this, ESubscriberSystems.TRIGGERS,
ERPCs.DIAG_TRIGGER_DEBUG, data,
false);
384 else if (!
GetGame().IsMultiplayer() || m_Local)
385 DebugDmgTrigger(data.param1, data.param2, data.param3, data.param4, data.param5, data.param6, data.param7);
388 protected ref array<Shape> dbgTargets =
new array<Shape>();
390 void DebugDmgTrigger( vector pos, vector orientation, vector min, vector max,
float radius,
string dmgType, array<ref TriggerInsider> insiders)
394 bool enableDebug = DiagMenu.GetBool(
DiagMenuIDs.TRIGGER_DEBUG);
402 vector w_pos, w_pos_sphr, w_pos_lend;
411 m_DebugAreaType = dmgType;
414 switch ( m_DebugAreaType )
420 case "BarbedWireHit":
430 m_dbgInsiders = insiders;
432 if (m_dbgInsiders.Count() > 0)
437 for (
int i = 0; i < m_dbgInsiders.Count(); i++)
442 vector insiderPos = insider_EAI.GetWorldPosition() +
"0 0.1 0";
443 dbgTargets.Insert(
Debug.DrawArrow(w_pos, insiderPos));
450 protected Shape DrawDebugShape(vector pos, vector min, vector max,
float radius,
int color)
461 dbgShape.CreateMatrix(mat);
462 dbgShape.SetMatrix(mat);
475 dbgTargets.Insert(dbgShape);
482 foreach (
Shape shape : shapes)
484 Debug.RemoveShape(shape);
void CleanupDebugShapes(array< Shape > shapesArr)
DEPRECATED.
proto native void SetCollisionBox(vector mins, vector maxs)
Sets collision box for object.
proto native TriggerShape GetTriggerShape()
Get the current TriggerShape.
Super root of all classes in Enforce script.
static void TriggerLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
The class that will be instanced (moddable)
proto bool Read(void value_in)
override void OnLeave(Object obj)
override void OnEnter(Object obj)
TriggerInsider CreateInsider(Object obj)
Used for easily overriding TriggerInsider creation without rewriting AddInsider.
override void EOnInit(IEntity other, int extra)
Set the default extents of the Trigger only once it is properly initialized.
void RemoveInsider(TriggerInsider insider, int index=-1)
Removing of TriggerInsider.
void OnLeaveBeginEvent(TriggerInsider insider)
override void EOnEnter(IEntity other, int extra)
When an Object enters the trigger add it to Insiders.
override void EOnFrame(IEntity other, float timeSlice)
When an Object touches the Trigger, we want to register it being inside the Trigger -> Replaced by EO...
TriggerInsider GetInsiderForObject(Object object)
Gets the TriggerInsider for the Object if it exists.
bool ShouldRemoveInsider(TriggerInsider insider)
Condition whether a TriggerInsider should still be updated or not (checked in update loop and before ...
ref array< ref TriggerInsider > m_insiders
The objects and their metadata which are currently inside the Trigger.
void SetExtents(vector mins, vector maxs)
Set the size of the Trigger, avoid using SetCollisionBox directly.
void UpdateInsiders(int timeout)
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
bool CanAddObjectAsInsider(Object object)
Condition whether an Object can be added as TriggerInsider (checked before calling AddInsider)
void OnEnterBeginEvent(TriggerInsider insider)
void RemoveInsiderByObject(Object object)
Removing of TriggerInsider through Object.
void AddInsider(Object obj)
Adding of new TriggerInsider.
array< ref TriggerInsider > GetInsiders()
Get the current TriggerInsider array, left for backwards compatibility, moved down from ManTrigger.
float GetRadius(vector min, vector max)
Get the radius of the CollisionBox, simply left for backwards compatibility.
bool ShouldRemoveInsiderNoLeave(TriggerInsider insider)
Condition whether a TriggerInsider should still be updated or not, skips OnLeaveEvent (checked in upd...
int GetInsiderIndexForObject(Object object)
Gets the index in m_insiders for the Object.
override void EOnLeave(IEntity other, int extra)
When an Object exits the trigger remove it from Insiders.
const int TIMEOUT
DEPRECATED.
void Enter(TriggerInsider insider)
void Leave(TriggerInsider insider)
void StayStart(int nrOfInsiders)
void Stay(TriggerInsider insider, float deltaTime)
int timeStamp
Last time the object was seen in ms.
Object m_Object
Object that data belongs to.
float lastUpdated
Last time the object was updated in seconds, is used for calculating deltaTime.
float timeEntered
Time the object was first seen in seconds.
void TriggerInsider(Object obj)
The object which is in a trigger and its metadata.
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
override string GetDebugName()
Serializer ParamsReadContext
proto native CGame GetGame()
void Error(string err)
Messagebox with error message.
proto native void SetFlags(ShapeFlags flags)
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
EntityEvent
Entity events for event-mask, or throwing event from code.