DayZ 1.24
Loading...
Searching...
No Matches
Component Class Reference
Inheritance diagram for Component:
[legend]
Collaboration diagram for Component:
[legend]

Protected Member Functions

void Event_OnFrame (IEntity other, float timeSlice)
 
Shape DebugBBoxDraw ()
 
void DebugBBoxSetColor (int color)
 
void DebugBBoxDelete ()
 
Shape DebugDirectionDraw (float distance=1)
 
void DebugDirectionSetColor (int color)
 
void DebugDirectionDelete ()
 
void SetParentEntityAI (EntityAI e)
 
void Event_OnAwake ()
 
void Event_OnInit ()
 
void LogThis (string msg, string fnc_name="n/a")
 
void LogThisWarning (string msg, string fnc_name="n/a")
 
void LogThisError (string msg, string fnc_name="n/a")
 
string GetCompName ()
 
int GetCompType ()
 
void Event_OnItemAttached (EntityAI item, string slot_name)
 
void Event_OnItemDetached (EntityAI item, string slot_name)
 
override Shape DebugBBoxDraw ()
 
override void DebugBBoxSetColor (int color)
 
override void DebugBBoxDelete ()
 
override Shape DebugDirectionDraw (float distance=1)
 
override void DebugDirectionDelete ()
 
void OnDrawing ()
 

Static Protected Member Functions

static void Init ()
 
static string GetNameByType (int comp_type)
 
static bool IsTypeExist (int comp_type)
 
static void LogErrorBadCompType (int comp_type, string fnc_name)
 
static void LogWarningAlredyExist (int comp_type, string fnc_name)
 

Protected Attributes

EntityAI m_ThisEntityAI
 
Shape m_DebugShapeBBox
 
Shape m_DebugShapeDirection
 
float m_DebugShapeDirectionDist
 

Static Private Attributes

static string m_CompNames [COMP_TYPE_COUNT]
 

Detailed Description

Definition at line 15 of file Component.c.

Member Function Documentation

◆ DebugBBoxDelete() [1/2]

void Component::DebugBBoxDelete ( )
protected

◆ DebugBBoxDelete() [2/2]

override void Component::DebugBBoxDelete ( )
inlineprotected

Definition at line 40 of file ComponentEntityDebug.c.

41 {
42#ifndef DEVELOPER
43 return;
44#endif
45
47 {
48 m_DebugShapeBBox.Destroy();
50 }
51
53 GetGame().GetCallQueue(CALL_CATEGORY_GUI).Remove(OnDrawing);
54 }
Shape m_DebugShapeDirection
proto native CGame GetGame()
const int CALL_CATEGORY_GUI
Definition tools.c:9

References CALL_CATEGORY_GUI, and GetGame().

◆ DebugBBoxDraw() [1/2]

Shape Component::DebugBBoxDraw ( )
protected

◆ DebugBBoxDraw() [2/2]

override Shape Component::DebugBBoxDraw ( )
inlineprotected

Definition at line 9 of file ComponentEntityDebug.c.

10 {
11#ifndef DEVELOPER
12 return null;
13#endif
14
16 m_DebugShapeBBox.Destroy();
17
18 vector min_max[2];
19
20 if (!m_ThisEntityAI.GetCollisionBox(min_max))
21 return null;
22
24
25 GetGame().GetCallQueue(CALL_CATEGORY_GUI).CallLater(OnDrawing, 0, true);
26
27 m_ThisEntityAI.SetEventMask(EntityEvent.FRAME);
28
29 return null;
30 }
EntityAI m_ThisEntityAI
Definition Component.c:24
Definition Debug.c:14
static Shape DrawBox(vector pos1, vector pos2, int color=0x1fff7f7f)
Definition Debug.c:401
EntityEvent
Entity events for event-mask, or throwing event from code.
Definition EnEntity.c:44

References CALL_CATEGORY_GUI, Debug::DrawBox(), and GetGame().

◆ DebugBBoxSetColor() [1/2]

void Component::DebugBBoxSetColor ( int color)
protected

◆ DebugBBoxSetColor() [2/2]

override void Component::DebugBBoxSetColor ( int color)
inlineprotected

Definition at line 33 of file ComponentEntityDebug.c.

34 {
36 m_DebugShapeBBox.SetColor(color);
37 }

◆ DebugDirectionDelete() [1/2]

void Component::DebugDirectionDelete ( )
protected

◆ DebugDirectionDelete() [2/2]

override void Component::DebugDirectionDelete ( )
inlineprotected

Definition at line 78 of file ComponentEntityDebug.c.

79 {
80#ifndef DEVELOPER
81 return;
82#endif
83
85 {
86 m_DebugShapeDirection.Destroy();
88 }
89
91 GetGame().GetCallQueue(CALL_CATEGORY_GUI).Remove(OnDrawing);
92 }

References CALL_CATEGORY_GUI, and GetGame().

◆ DebugDirectionDraw() [1/2]

Shape Component::DebugDirectionDraw ( float distance = 1)
protected

◆ DebugDirectionDraw() [2/2]

override Shape Component::DebugDirectionDraw ( float distance = 1)
inlineprotected

Definition at line 57 of file ComponentEntityDebug.c.

58 {
59#ifndef DEVELOPER
60 return null;
61#endif
62
64 m_DebugShapeDirection.Destroy();
65
66 vector p1 = "0 0 0";
70
71 GetGame().GetCallQueue(CALL_CATEGORY_GUI).CallLater(OnDrawing, 0, true);
72
73 m_ThisEntityAI.SetEventMask(EntityEvent.FRAME);
74 return null;
75 }
float m_DebugShapeDirectionDist
static Shape DrawArrow(vector from, vector to, float size=0.5, int color=0xFFFFFFFF, int flags=0)
Definition Debug.c:511

References CALL_CATEGORY_GUI, Debug::DrawArrow(), and GetGame().

◆ DebugDirectionSetColor()

void Component::DebugDirectionSetColor ( int color)
protected

◆ Event_OnAwake()

void Component::Event_OnAwake ( )
inlineprotected

Definition at line 100 of file Component.c.

101 {
102
103 }

◆ Event_OnFrame()

void Component::Event_OnFrame ( IEntity other,
float timeSlice )
protected

◆ Event_OnInit()

void Component::Event_OnInit ( )
inlineprotected

Definition at line 108 of file Component.c.

109 {
110
111 }

◆ Event_OnItemAttached()

void Component::Event_OnItemAttached ( EntityAI item,
string slot_name )
inlineprotected

Definition at line 156 of file Component.c.

157 {
158 LogThis("" + item + " -> " + slot_name, "Event_OnItemAttached");
159 //Debug.Log("Component=>Event_OnItemAttached: " + item + " -> " + slot_name, );
160 }
void LogThis(string msg, string fnc_name="n/a")
Definition Component.c:116

References LogThis().

◆ Event_OnItemDetached()

void Component::Event_OnItemDetached ( EntityAI item,
string slot_name )
inlineprotected

Definition at line 165 of file Component.c.

166 {
167 LogThis("" + item + " <- " + slot_name, "Event_OnItemDetached");
168 //Log("Component=>Event_OnItemDetached: " + item + " <- " + slot_name );
169 }

References LogThis().

◆ GetCompName()

string Component::GetCompName ( )
inlineprotected

Definition at line 140 of file Component.c.

141 {
142 return Component.GetNameByType(this.GetCompType());
143 }
static string GetNameByType(int comp_type)
Definition Component.c:48
int GetCompType()
Definition Component.c:148

References GetCompType(), and GetNameByType().

Referenced by LogThisError(), and LogThisWarning().

◆ GetCompType()

int Component::GetCompType ( )
inlineprotected

Definition at line 148 of file Component.c.

149 {
150 return COMP_TYPE_UNDEFINED;
151 }
const int COMP_TYPE_UNDEFINED
Definition Component.c:7

References COMP_TYPE_UNDEFINED.

Referenced by GetCompName().

◆ GetNameByType()

static string Component::GetNameByType ( int comp_type)
inlinestaticprotected

Definition at line 48 of file Component.c.

49 {
50 if (IsTypeExist(comp_type) == false)
51 {
52 LogErrorBadCompType(comp_type, "Component->GetNameByType()");
53 return "None";
54 }
55
56 return m_CompNames[comp_type];
57 }
static void LogErrorBadCompType(int comp_type, string fnc_name)
Definition Component.c:74
static bool IsTypeExist(int comp_type)
Definition Component.c:62
static string m_CompNames[COMP_TYPE_COUNT]
Definition Component.c:20

References IsTypeExist(), LogErrorBadCompType(), and m_CompNames.

Referenced by ComponentsBank::CreateComponent(), GetCompName(), and LogWarningAlredyExist().

◆ Init()

static void Component::Init ( )
inlinestaticprotected

Definition at line 37 of file Component.c.

38 {
39 m_CompNames[COMP_TYPE_ETITY_DEBUG] = "ComponentEntityDebug";
40 m_CompNames[COMP_TYPE_ENERGY_MANAGER] = "ComponentEnergyManager";
41 m_CompNames[COMP_TYPE_BODY_STAGING] = "ComponentBodyStaging";
42 m_CompNames[COMP_TYPE_ANIMAL_BLEEDING] = "ComponentAnimalBleeding";
43 }
const int COMP_TYPE_ANIMAL_BLEEDING
Definition Component.c:11
const int COMP_TYPE_BODY_STAGING
Definition Component.c:10
const int COMP_TYPE_ENERGY_MANAGER
Definition Component.c:9
const int COMP_TYPE_ETITY_DEBUG
Definition Component.c:8

References COMP_TYPE_ANIMAL_BLEEDING, COMP_TYPE_BODY_STAGING, COMP_TYPE_ENERGY_MANAGER, COMP_TYPE_ETITY_DEBUG, and m_CompNames.

Referenced by CGame::DayZGame().

◆ IsTypeExist()

static bool Component::IsTypeExist ( int comp_type)
inlinestaticprotected

Definition at line 62 of file Component.c.

63 {
65 return false;
66
67 return true;
68 }
const int COMP_TYPE_COUNT
Definition Component.c:12

References COMP_TYPE_COUNT.

Referenced by ComponentsBank::CreateComponent(), ComponentsBank::GetComponent(), and GetNameByType().

◆ LogErrorBadCompType()

static void Component::LogErrorBadCompType ( int comp_type,
string fnc_name )
inlinestaticprotected

Definition at line 74 of file Component.c.

75 {
76 string msg = "Bad parameter comp_type='" + comp_type.ToString() + "'. Parameter must be 0-" + (COMP_TYPE_COUNT - 1).ToString() + ". Returning component name 'None'.";
77 Debug.LogError(msg, "Component", "n/a", fnc_name);
78 }
proto string ToString()
static void LogError(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message as error message.
Definition Debug.c:341

References COMP_TYPE_COUNT, Debug::LogError(), and ToString().

Referenced by ComponentsBank::CreateComponent(), ComponentsBank::GetComponent(), and GetNameByType().

◆ LogThis()

void Component::LogThis ( string msg,
string fnc_name = "n/a" )
inlineprotected

Definition at line 116 of file Component.c.

117 {
118 //Debug.Log(msg, GetCompName(), "n/a", fnc_name, m_ThisEntityAI.ToString());
119 }

Referenced by Event_OnItemAttached(), and Event_OnItemDetached().

◆ LogThisError()

void Component::LogThisError ( string msg,
string fnc_name = "n/a" )
inlineprotected

Definition at line 132 of file Component.c.

133 {
134 Debug.LogError(msg, GetCompName(), "n/a", fnc_name, m_ThisEntityAI.ToString());
135 }
string GetCompName()
Definition Component.c:140

References GetCompName(), Debug::LogError(), and m_ThisEntityAI.

◆ LogThisWarning()

void Component::LogThisWarning ( string msg,
string fnc_name = "n/a" )
inlineprotected

Definition at line 124 of file Component.c.

125 {
126 Debug.LogWarning(msg, GetCompName(), "n/a", fnc_name, m_ThisEntityAI.ToString());
127 }
static void LogWarning(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message as warning message.
Definition Debug.c:321

References GetCompName(), Debug::LogWarning(), and m_ThisEntityAI.

◆ LogWarningAlredyExist()

static void Component::LogWarningAlredyExist ( int comp_type,
string fnc_name )
inlinestaticprotected

Definition at line 83 of file Component.c.

84 {
85 string msg = "Component '" + Component.GetNameByType(comp_type) + "' already exists!";
86 Debug.LogError(msg, "Component", "n/a", fnc_name);
87 }

References GetNameByType(), and Debug::LogError().

Referenced by ComponentsBank::CreateComponent().

◆ OnDrawing()

void Component::OnDrawing ( )
inlineprotected

Definition at line 94 of file ComponentEntityDebug.c.

95 {
96#ifndef DEVELOPER
97 return;
98#endif
99
101 {
102 vector mat[4];
103 m_ThisEntityAI.GetTransform(mat);
104
106 m_DebugShapeBBox.SetMatrix(mat);
107
109 m_DebugShapeDirection.SetMatrix(mat);
110 }
111 }

◆ SetParentEntityAI()

void Component::SetParentEntityAI ( EntityAI e)
inlineprotected

Definition at line 92 of file Component.c.

93 {
95 }

References m_ThisEntityAI.

Member Data Documentation

◆ m_CompNames

string Component::m_CompNames[COMP_TYPE_COUNT]
staticprivate

Definition at line 20 of file Component.c.

Referenced by GetNameByType(), and Init().

◆ m_DebugShapeBBox

Shape Component::m_DebugShapeBBox
protected

Definition at line 4 of file ComponentEntityDebug.c.

◆ m_DebugShapeDirection

Shape Component::m_DebugShapeDirection
protected

Definition at line 5 of file ComponentEntityDebug.c.

◆ m_DebugShapeDirectionDist

float Component::m_DebugShapeDirectionDist
protected

Definition at line 6 of file ComponentEntityDebug.c.

◆ m_ThisEntityAI

EntityAI Component::m_ThisEntityAI
protected

Definition at line 24 of file Component.c.

Referenced by ComponentAnimalBleeding::Bleed(), ComponentEnergyManager::CanBePluggedInto(), ComponentEnergyManager::CanReceivePlugFrom(), ComponentEnergyManager::CanWork(), ComponentEnergyManager::CheckWetness(), ComponentEnergyManager::ConsumeEnergy(), ComponentEnergyManager::DebugUpdate(), ComponentEnergyManager::DeviceUpdate(), ComponentEnergyManager::Event_OnAwake(), ComponentEnergyManager::Event_OnInit(), ComponentEnergyManager::FindAndConsumeEnergy(), ComponentEnergyManager::GetEnergyMax(), ComponentEnergyManager::GetThisEntityAI(), ComponentAnimalBleeding::InflictWoundDamage(), LogThisError(), LogThisWarning(), ComponentEnergyManager::OnAttachmentAdded(), ComponentEnergyManager::OnDeviceDestroyed(), ComponentEnergyManager::OnEnergyAdded(), ComponentEnergyManager::OnEnergyConsumed(), ComponentEnergyManager::OnInteractBranch(), ComponentEnergyManager::OnIsPlugged(), ComponentEnergyManager::OnIsUnplugged(), ComponentEnergyManager::OnOwnSocketReleased(), ComponentEnergyManager::OnOwnSocketTaken(), ComponentEnergyManager::OnWork(), ComponentEnergyManager::PlugInDevice(), ComponentEnergyManager::PlugThisInto(), ComponentEnergyManager::ResetEnergyUsage(), ComponentEnergyManager::SetEnergy(), SetParentEntityAI(), ComponentEnergyManager::SwitchOff(), ComponentEnergyManager::SwitchOn(), ComponentEnergyManager::Synch(), ComponentBodyStaging::SynchSkinnedState(), ComponentEnergyManager::UnplugCordFromSocket(), ComponentEnergyManager::UnplugDevice(), ComponentEnergyManager::UnplugThis(), ComponentEnergyManager::UpdateCanWork(), ComponentEnergyManager::UpdatePlugState(), ComponentEnergyManager::UpdateSelections(), and ComponentEnergyManager::UpdateSocketSelections().


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