Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_SpawnPositionComponent.c
Go to the documentation of this file.
1
class
SCR_SpawnPositionComponentClass
:
ScriptComponentClass
2
{
3
[
Attribute
(defvalue:
"-0.4 0 -0.3"
,
category
:
"Position Boundaries"
)]
4
protected
vector
m_vMinBounds
;
5
6
[
Attribute
(defvalue:
"0.4 1.8 0.4"
,
category
:
"Position Boundaries"
)]
7
protected
vector
m_vMaxBounds
;
8
9
//------------------------------------------------------------------------------------------------
11
vector
GetMinBoundsVector
()
12
{
13
return
m_vMinBounds
;
14
}
15
16
//------------------------------------------------------------------------------------------------
18
vector
GetMaxBoundsVector
()
19
{
20
return
m_vMaxBounds
;
21
}
22
}
23
24
class
SCR_SpawnPositionComponent :
ScriptComponent
25
{
26
#ifdef WORKBENCH
27
protected
ref Shape m_DebugShape;
28
#endif
29
30
//------------------------------------------------------------------------------------------------
32
bool
IsFree
()
33
{
34
SCR_SpawnPositionComponentClass
prefabData =
SCR_SpawnPositionComponentClass
.Cast(
GetComponentData
(
GetOwner
()));
35
if
(!prefabData)
36
return
false
;
37
38
vector
transform[4];
39
GetOwner
().
GetTransform
(transform);
40
41
return
GetGame
().GetWorld().QueryEntitiesByOBB(prefabData.
GetMinBoundsVector
(), prefabData.
GetMaxBoundsVector
(), transform,
CheckEntity
,
FilterEntity
,
EQueryEntitiesFlags
.ALL |
EQueryEntitiesFlags
.WITH_OBJECT);
42
}
43
44
//------------------------------------------------------------------------------------------------
45
protected
bool
CheckEntity
(
IEntity
ent)
46
{
47
DamageManagerComponent
damageManager =
DamageManagerComponent
.Cast(ent.
FindComponent
(
DamageManagerComponent
));
48
if
(!damageManager || !damageManager.IsDestroyed())
49
return
false
;
50
51
return
true
;
52
}
53
54
//------------------------------------------------------------------------------------------------
55
protected
bool
FilterEntity
(
IEntity
ent)
56
{
57
return
ent.IsInherited(
ChimeraCharacter
);
58
}
59
60
//------------------------------------------------------------------------------------------------
61
override
void
EOnInit
(
IEntity
owner)
62
{
63
SCR_SpawnPositionComponentManager manager = SCR_SpawnPositionComponentManager.GetInstance();
64
if
(manager)
65
manager.AddSpawnPosition(
this
);
66
}
67
68
//------------------------------------------------------------------------------------------------
69
override
void
OnPostInit
(
IEntity
owner)
70
{
71
super.OnPostInit(owner);
72
SetEventMask
(owner,
EntityEvent
.INIT);
73
}
74
75
#ifdef WORKBENCH
76
//------------------------------------------------------------------------------------------------
77
protected
void
DrawDebugShape
()
78
{
79
SCR_SpawnPositionComponentClass prefabData = SCR_SpawnPositionComponentClass.Cast(
GetComponentData
(
GetOwner
()));
80
if
(!prefabData)
81
return
;
82
83
EntitySpawnParams
params
=
new
EntitySpawnParams
();
84
params
.TransformMode = ETransformMode.WORLD;
85
86
IEntity
owner =
GetOwner
();
87
owner.
GetTransform
(
params
.Transform);
88
89
int
shapeFlags =
ShapeFlags
.WIREFRAME;
90
m_DebugShape = Shape.Create(
ShapeType
.BBOX, Color.CYAN, shapeFlags, prefabData.
GetMinBoundsVector
(), prefabData.
GetMaxBoundsVector
());
91
92
m_DebugShape.SetMatrix(
params
.Transform);
93
}
94
95
//------------------------------------------------------------------------------------------------
96
override
int
_WB_GetAfterWorldUpdateSpecs
(
IEntity
owner, IEntitySource src)
97
{
98
return
EEntityFrameUpdateSpecs.CALL_WHEN_ENTITY_VISIBLE;
99
}
100
101
//------------------------------------------------------------------------------------------------
102
override
event
void
_WB_AfterWorldUpdate
(
IEntity
owner,
float
timeSlice)
103
{
104
if
(
GetGame
().InPlayMode())
105
return
;
106
107
if
(m_DebugShape)
108
{
109
vector transform[4];
110
owner.
GetTransform
(transform);
111
m_DebugShape.SetMatrix(transform);
112
}
113
else
114
{
115
DrawDebugShape
();
116
}
117
}
118
#endif
119
120
//------------------------------------------------------------------------------------------------
121
// destructor
122
void
~SCR_SpawnPositionComponent
()
123
{
124
SCR_SpawnPositionComponentManager manager = SCR_SpawnPositionComponentManager.GetInstance(
false
);
125
if
(manager)
126
manager.DeleteSpawnPosition(
this
);
127
}
128
}
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
FilterEntity
bool FilterEntity(IEntity ent)
Definition
SCR_CampaignFastTravelComponent.c:128
GetComponentData
SCR_CharacterSoundComponentClass GetComponentData()
Definition
SCR_CharacterSoundComponent.c:132
DrawDebugShape
void DrawDebugShape(bool draw)
Definition
SCR_ScenarioFrameworkLayerBase.c:1304
~SCR_SpawnPositionComponent
void ~SCR_SpawnPositionComponent()
Definition
SCR_SpawnPositionComponent.c:122
IsFree
SCR_SpawnPositionComponentClass ScriptComponentClass IsFree()
Returns true, if there is no living character inside of defined boundaries.
Definition
SCR_SpawnPositionComponent.c:32
CheckEntity
bool CheckEntity(IEntity ent)
Definition
SCR_SpawnPositionComponent.c:45
params
category params
Definition
SCR_SpherePointGeneratorPreviewComponent.c:21
category
params category
Definition
SCR_VehicleDamageManagerComponent.c:302
IEntity
enum EVehicleType IEntity
ChimeraCharacter
Definition
ChimeraCharacter.c:13
DamageManagerComponent
Definition
DamageManagerComponent.c:13
GenericComponent::_WB_GetAfterWorldUpdateSpecs
event int _WB_GetAfterWorldUpdateSpecs(IEntity owner, IEntitySource src)
Called after _WB_OnInit or also later when editor needs to know whether _WB_AfterWorldUpdate needs to...
GenericComponent::SetEventMask
proto external int SetEventMask(notnull IEntity owner, int mask)
GenericComponent::_WB_AfterWorldUpdate
event void _WB_AfterWorldUpdate(IEntity owner, float timeSlice)
Called after updating world in Workbench. The entity must be selected. You can use editor API here an...
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
IEntity::GetTransform
proto external void GetTransform(out vector mat[])
SCR_SpawnPositionComponentClass
Definition
SCR_SpawnPositionComponent.c:2
SCR_SpawnPositionComponentClass::m_vMinBounds
vector m_vMinBounds
Definition
SCR_SpawnPositionComponent.c:4
SCR_SpawnPositionComponentClass::m_vMaxBounds
vector m_vMaxBounds
Definition
SCR_SpawnPositionComponent.c:7
SCR_SpawnPositionComponentClass::GetMaxBoundsVector
vector GetMaxBoundsVector()
Definition
SCR_SpawnPositionComponent.c:18
SCR_SpawnPositionComponentClass::GetMinBoundsVector
vector GetMinBoundsVector()
Definition
SCR_SpawnPositionComponent.c:11
ScriptComponentClass
Definition
ScriptComponentClass.c:8
ScriptComponent
Definition
ScriptComponent.c:24
ScriptComponent::GetOwner
proto external GenericEntity GetOwner()
Get owner entity.
ScriptComponent::EOnInit
void EOnInit(IEntity owner)
vector
Definition
vector.c:13
EntitySpawnParams
void EntitySpawnParams()
Definition
gameLib.c:130
ShapeType
ShapeType
Definition
ShapeType.c:13
ShapeFlags
ShapeFlags
Definition
ShapeFlags.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
EntityEvent
EntityEvent
Various entity events.
Definition
EntityEvent.c:14
OnPostInit
@ OnPostInit
Definition
SndComponentCallbacks.c:15
EQueryEntitiesFlags
EQueryEntitiesFlags
Definition
EQueryEntitiesFlags.c:13
scripts
Game
GameMode
Respawn
SCR_SpawnPositionComponent.c
Generated by
1.17.0