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_SlotDisabler.c
Go to the documentation of this file.
1
[
EntityEditorProps
(
category
:
"GameScripted/Utility"
, description:
"Disables slots in certain radius."
)]
2
class
SCR_SlotDisablerEntityClass
: GenericEntityClass
3
{
4
};
5
6
class
SCR_SlotDisablerEntity :
GenericEntity
7
{
8
[
Attribute
(defvalue:
"10"
, uiwidget:
UIWidgets
.Slider,
desc
:
"Radius in which to disable slots."
,
"0 1000 1"
)]
9
protected
float
m_fRadius
;
10
11
private
ref array<SCR_SiteSlotEntity> m_aQueriedSlots;
12
13
#ifdef WORKBENCH
14
private
bool
m_bVisualize;
15
#endif
16
17
//------------------------------------------------------------------------------------------------
18
private
bool
QueryEntities(
IEntity
e)
19
{
20
SCR_SiteSlotEntity
slot =
SCR_SiteSlotEntity
.Cast(e);
21
22
if
(slot)
23
m_aQueriedSlots.Insert(slot);
24
25
return
true
;
26
}
27
28
//------------------------------------------------------------------------------------------------
29
private
void
GetSlots(
float
radius)
30
{
31
BaseWorld
world =
GetWorld
();
32
world.QueryEntitiesBySphere(
GetOrigin
(), radius,
QueryEntities
);
33
}
34
35
//------------------------------------------------------------------------------------------------
36
override
void
EOnInit(
IEntity
owner)
37
{
38
// capture slots around
39
m_aQueriedSlots = {};
40
GetSlots(
m_fRadius
);
41
42
// disable slots
43
foreach
(SCR_SiteSlotEntity slot : m_aQueriedSlots)
44
{
45
SCR_EditableEntityComponent comp = SCR_EditableEntityComponent.Cast(slot.FindComponent(SCR_EditableEntityComponent));
46
47
if
(comp)
48
comp.
SetVisible
(
false
);
49
}
50
51
// cleanup
52
m_aQueriedSlots.Clear();
53
m_aQueriedSlots = null;
54
55
// destroy self
56
delete
owner;
57
}
58
59
//------------------------------------------------------------------------------------------------
60
void
SCR_SlotDisablerEntity(IEntitySource src,
IEntity
parent)
61
{
62
if
(SCR_Global.IsEditMode(
this
))
63
return
;
64
65
SetEventMask
(
EntityEvent
.INIT);
66
}
67
68
//------------------------------------------------------------------------------------------------
69
void
~SCR_SlotDisablerEntity()
70
{
71
}
72
73
#ifdef WORKBENCH
74
75
private
void
_CaptureDoors()
76
{
77
m_aQueriedSlots = {};
78
GetSlots(
m_fRadius
);
79
}
80
81
override
bool
_WB_OnKeyChanged
(BaseContainer src,
string
key, BaseContainerList ownerContainers,
IEntity
parent)
82
{
83
_CaptureDoors();
84
return
super._WB_OnKeyChanged(src, key, ownerContainers, parent);
85
}
86
87
override
void
_WB_SetExtraVisualiser
(
EntityVisualizerType
type
, IEntitySource src)
88
{
89
m_bVisualize =
false
;
90
switch
(
type
)
91
{
92
case
EntityVisualizerType
.EVT_NONE:
93
return
;
94
95
case
EntityVisualizerType
.EVT_NORMAL:
96
return
;
97
}
98
99
m_bVisualize =
true
;
100
_CaptureDoors();
101
super._WB_SetExtraVisualiser(
type
, src);
102
}
103
104
override
int
_WB_GetAfterWorldUpdateSpecs
(IEntitySource src)
105
{
106
return
EEntityFrameUpdateSpecs.CALL_WHEN_ENTITY_VISIBLE;
107
}
108
109
override
void
_WB_AfterWorldUpdate
(
float
timeSlice)
110
{
111
if
(m_bVisualize)
112
{
113
auto
origin =
GetOrigin
();
114
auto
radiusShape = Shape.CreateSphere(
COLOR_YELLOW
,
ShapeFlags
.WIREFRAME |
ShapeFlags
.ONCE, origin,
m_fRadius
);
115
116
foreach
(SCR_SiteSlotEntity slot : m_aQueriedSlots)
117
{
118
auto
arrowShape = Shape.CreateArrow(origin, slot.GetOrigin(), 0.1,
COLOR_GREEN
,
ShapeFlags
.ONCE);
119
}
120
}
121
122
super._WB_AfterWorldUpdate(timeSlice);
123
}
124
125
#endif
126
127
};
EntityEditorProps
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
Definition
SCR_CompassComponent.c:10
type
EDamageType type
Definition
SCR_DestructibleTreeV2.c:32
QueryEntities
void QueryEntities(vector min, vector max, vector m_vMatrix[4])
Definition
SCR_RegionalDestructionManager.c:95
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition
SCR_RespawnBriefingComponent.c:17
category
params category
Definition
SCR_VehicleDamageManagerComponent.c:302
BaseWorld
Definition
BaseWorld.c:13
GenericEntity
Definition
GenericEntity.c:16
GenericEntity::_WB_AfterWorldUpdate
event void _WB_AfterWorldUpdate(float timeSlice)
Called after updating world in Workbench. The entity must be visible in frustum, selected or named....
GenericEntity::_WB_OnKeyChanged
event bool _WB_OnKeyChanged(BaseContainer src, string key, BaseContainerList ownerContainers, IEntity parent)
Any property value has been changed. You can use editor API here and do some additional edit actions ...
GenericEntity::_WB_GetAfterWorldUpdateSpecs
event int _WB_GetAfterWorldUpdateSpecs(IEntitySource src)
Called after _WB_OnInit or also later when editor needs to know whether _WB_AfterWorldUpdate needs to...
GenericEntity::_WB_SetExtraVisualiser
event void _WB_SetExtraVisualiser(EntityVisualizerType type, IEntitySource src)
If entity needs to have a special visualizer instead of default one, here is the place where you can ...
IEntity::IEntity
void IEntity(IEntitySource src, IEntity parent)
protected script Constructor
IEntity::SetEventMask
proto external EntityEvent SetEventMask(EntityEvent e)
IEntity::GetOrigin
proto external vector GetOrigin()
IEntity::GetWorld
proto external BaseWorld GetWorld()
SCR_EditableEntityComponent::SetVisible
void SetVisible(bool show)
Definition
SCR_EditableEntityComponent.c:1761
SCR_SiteSlotEntity
Definition
SCR_SiteSlotEntity.c:27
SCR_SlotDisablerEntityClass
Definition
SCR_SlotDisabler.c:3
SCR_SlotDisablerEntity::m_fRadius
float m_fRadius
Definition
SCR_SlotDisabler.c:9
UIWidgets
Definition
attributes.c:40
COLOR_GREEN
const int COLOR_GREEN
Definition
constants.c:22
COLOR_YELLOW
const int COLOR_YELLOW
Definition
constants.c:24
ShapeFlags
ShapeFlags
Definition
ShapeFlags.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
EntityEvent
EntityEvent
Various entity events.
Definition
EntityEvent.c:14
EntityVisualizerType
EntityVisualizerType
Game editor entity visualizer type.
Definition
EntityVisualizerType.c:14
scripts
Game
Campaign
SCR_SlotDisabler.c
Generated by
1.17.0