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_EditableDescriptorComponent.c
Go to the documentation of this file.
1
void
ScriptInvoker_EditableDescriptorLocationChangeMethod
(SCR_EditableCommentComponent
location
);
2
typedef
func
ScriptInvoker_EditableDescriptorLocationChangeMethod
;
3
typedef
ScriptInvokerBase<ScriptInvoker_EditableDescriptorLocationChangeMethod>
ScriptInvoker_EditableDescriptorLocationChange
;
4
5
[
ComponentEditorProps
(
category
:
"GameScripted/Editor (Editables)"
, description:
""
, icon:
"WBData/ComponentEditorProps/componentEditor.png"
)]
6
class
SCR_EditableDescriptorComponentClass
:
SCR_EditableSystemComponentClass
7
{
8
}
9
11
13
class
SCR_EditableDescriptorComponent
: SCR_EditableSystemComponent
14
{
15
[
Attribute
(
"300"
,
UIWidgets
.Slider,
"Detect locations within this radius."
,
params
:
"0 10000 1"
)]
16
protected
float
m_fMaxLocationSize;
17
18
protected
LocalizedString
m_sLocationName
;
19
protected
EntityID
m_NearestLocationID
;
20
protected
SCR_EditableEntityComponent
m_NearestLocation
;
21
protected
ref
SCR_EditableDescriptorUIInfo
m_UIInfoDescriptor
;
22
protected
ref
ScriptInvoker_EditableDescriptorLocationChange
m_OnChange
;
23
24
//------------------------------------------------------------------------------------------------
26
ScriptInvoker_EditableDescriptorLocationChange
GetOnChange
()
27
{
28
if
(!
m_OnChange
)
29
m_OnChange
=
new
ScriptInvoker_EditableDescriptorLocationChange
();
30
31
return
m_OnChange
;
32
}
33
34
//------------------------------------------------------------------------------------------------
38
bool
UpdateNearestLocation
(
vector
pos =
vector
.Zero)
39
{
40
SCR_EditableEntityCore
core =
SCR_EditableEntityCore
.Cast(
SCR_EditableEntityCore
.GetInstance(
SCR_EditableEntityCore
));
41
if
(!core)
42
return
false
;
43
44
//--- Find nearest location
45
if
(pos ==
vector
.Zero)
46
pos =
GetOwner
().
GetOrigin
();
47
48
EntityID
nearestLocationID;
49
SCR_EditableEntityComponent
nearestLocation = core.
FindNearestEntity
(pos,
EEditableEntityType
.COMMENT,
EEditableEntityFlag
.LOCAL);
50
if
(nearestLocation)
51
{
52
//--- Check if it's close enough
53
vector
locationPos;
54
if
(nearestLocation.
GetPos
(locationPos) &&
vector
.DistanceSqXZ(locationPos, pos) < m_fMaxLocationSize)
55
{
56
//--- Terminate if the location didn't change
57
nearestLocationID = nearestLocation.GetOwner().GetID();
58
if
(nearestLocationID ==
m_NearestLocationID
)
59
return
false
;
60
}
61
}
62
63
//--- Update
64
UpdateNearestLocationBroadcast
(nearestLocationID);
65
Rpc(
UpdateNearestLocationBroadcast
, nearestLocationID);
66
return
true
;
67
}
68
69
//------------------------------------------------------------------------------------------------
70
[
RplRpc
(
RplChannel
.Reliable,
RplRcver
.Broadcast)]
71
protected
void
UpdateNearestLocationBroadcast
(
EntityID
nearestLocationID)
72
{
73
m_NearestLocationID
= nearestLocationID;
74
75
IEntity
nearestLocationEntity =
GetGame
().
GetWorld
().FindEntityByID(
m_NearestLocationID
);
76
m_NearestLocation
=
SCR_EditableEntityComponent
.
GetEditableEntity
(nearestLocationEntity);
77
78
GetOnLocationChange
(
m_NearestLocation
);
79
if
(
m_OnChange
)
80
m_OnChange
.Invoke(SCR_EditableCommentComponent.Cast(
m_NearestLocation
));
81
}
82
83
//------------------------------------------------------------------------------------------------
84
protected
void
GetOnLocationChange
(SCR_EditableEntityComponent nearestLocation);
85
86
//------------------------------------------------------------------------------------------------
87
protected
void
UpdateInfo
(
SCR_UIDescription
from = null)
88
{
89
if
(!
m_UIInfoDescriptor
)
90
{
91
m_UIInfoDescriptor
=
new
SCR_EditableDescriptorUIInfo
();
92
m_UIInfoDescriptor
.CopyFrom(
GetInfo
());
93
SetInfoInstance(
m_UIInfoDescriptor
);
94
}
95
96
//--- Copy custom texts
97
if
(from)
98
m_UIInfoDescriptor
.CopyFrom(from);
99
100
if
(
m_NearestLocation
)
101
m_UIInfoDescriptor
.SetLocationName(
m_NearestLocation
.GetInfo().GetName());
102
else
103
m_UIInfoDescriptor
.SetLocationName(
GetOwner
().
GetOrigin
());
104
105
Event_OnUIRefresh
.Invoke();
106
}
107
108
//------------------------------------------------------------------------------------------------
109
override
bool
RplSave
(ScriptBitWriter writer)
110
{
111
if
(!super.RplSave(writer))
112
return
false
;
113
114
writer.WriteEntityId(
m_NearestLocationID
);
115
116
return
true
;
117
}
118
119
//------------------------------------------------------------------------------------------------
120
override
bool
RplLoad
(
ScriptBitReader
reader)
121
{
122
if
(!super.RplLoad(reader))
123
return
false
;
124
125
reader.ReadEntityId(
m_NearestLocationID
);
126
127
UpdateNearestLocationBroadcast
(
m_NearestLocationID
);
128
129
return
true
;
130
}
131
132
//------------------------------------------------------------------------------------------------
133
// constructor
137
void
SCR_EditableDescriptorComponent
(
IEntityComponentSource
src,
IEntity
ent,
IEntity
parent)
138
{
139
m_fMaxLocationSize *= m_fMaxLocationSize;
140
}
141
}
location
vector location
Definition
BlenderEndpoints.c:48
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
RplLoad
override bool RplLoad(ScriptBitReader reader)
Definition
SCR_AIGroupInfoComponent.c:149
ComponentEditorProps
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
Definition
SCR_AIGroupUtilityComponent.c:12
func
func
Definition
SCR_AIThreatSystem.c:6
GetOrigin
vector GetOrigin()
Definition
SCR_AIUtilityComponent.c:471
RplSave
override bool RplSave(ScriptBitWriter writer)
Definition
SCR_CampaignBuildingCompositionComponent.c:549
m_NearestLocationID
EntityID m_NearestLocationID
Definition
SCR_EditableDescriptorComponent.c:19
UpdateNearestLocationBroadcast
void UpdateNearestLocationBroadcast(EntityID nearestLocationID)
Definition
SCR_EditableDescriptorComponent.c:71
m_sLocationName
LocalizedString m_sLocationName
Definition
SCR_EditableDescriptorComponent.c:18
SCR_EditableDescriptorComponent
void SCR_EditableDescriptorComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition
SCR_EditableDescriptorComponent.c:137
m_NearestLocation
SCR_EditableEntityComponent m_NearestLocation
Definition
SCR_EditableDescriptorComponent.c:20
m_UIInfoDescriptor
ref SCR_EditableDescriptorUIInfo m_UIInfoDescriptor
Definition
SCR_EditableDescriptorComponent.c:21
ScriptInvoker_EditableDescriptorLocationChange
ScriptInvokerBase< ScriptInvoker_EditableDescriptorLocationChangeMethod > ScriptInvoker_EditableDescriptorLocationChange
Definition
SCR_EditableDescriptorComponent.c:3
GetOnChange
ScriptInvoker_EditableDescriptorLocationChange GetOnChange()
Definition
SCR_EditableDescriptorComponent.c:26
m_OnChange
ref ScriptInvoker_EditableDescriptorLocationChange m_OnChange
Definition
SCR_EditableDescriptorComponent.c:22
GetOnLocationChange
void GetOnLocationChange(SCR_EditableEntityComponent nearestLocation)
Definition
SCR_EditableSpawnPointComponent.c:24
UpdateNearestLocation
bool UpdateNearestLocation(vector pos=vector.Zero)
Definition
SCR_EditableDescriptorComponent.c:38
ScriptInvoker_EditableDescriptorLocationChangeMethod
func ScriptInvoker_EditableDescriptorLocationChangeMethod
Definition
SCR_EditableDescriptorComponent.c:2
UpdateInfo
void UpdateInfo(SCR_UIDescription from=null)
Definition
SCR_EditableDescriptorComponent.c:87
Event_OnUIRefresh
ref ScriptInvoker Event_OnUIRefresh
Definition
SCR_EditableGroupComponent.c:38
GetInfo
override SCR_UIInfo GetInfo()
Definition
SCR_EditorRespawnBriefingComponent.c:15
params
category params
Definition
SCR_SpherePointGeneratorPreviewComponent.c:21
category
params category
Definition
SCR_VehicleDamageManagerComponent.c:302
EntityID
Definition
EnEntity.c:7
IEntityComponentSource
Definition
IEntityComponentSource.c:13
IEntity
Definition
IEntity.c:13
IEntity::GetOrigin
proto external vector GetOrigin()
IEntity::GetWorld
proto external BaseWorld GetWorld()
LocalizedString
Definition
LocalizedString.c:22
SCR_EditableDescriptorComponentClass
Definition
SCR_EditableDescriptorComponent.c:7
SCR_EditableDescriptorUIInfo
Definition
SCR_EditableDescriptorUIInfo.c:3
SCR_EditableEntityComponent
Definition
SCR_EditableEntityComponent.c:14
SCR_EditableEntityComponent::GetEditableEntity
static SCR_EditableEntityComponent GetEditableEntity(IEntity owner)
Definition
SCR_EditableEntityComponent.c:919
SCR_EditableEntityComponent::GetPos
bool GetPos(out vector pos)
Definition
SCR_EditableEntityComponent.c:261
SCR_EditableEntityCore
Definition
SCR_EditableEntityCore.c:20
SCR_EditableEntityCore::FindNearestEntity
SCR_EditableEntityComponent FindNearestEntity(vector pos, EEditableEntityType type, EEditableEntityFlag flags=0, bool onlyDirect=true)
Definition
SCR_EditableEntityCore.c:350
SCR_EditableSystemComponentClass
Definition
SCR_EditableSystemComponent.c:3
SCR_UIDescription
Definition
SCR_UIDescription.c:6
ScriptBitReader
Definition
EnNetwork.c:199
UIWidgets
Definition
attributes.c:40
vector
Definition
vector.c:13
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition
SCR_FuelNode.c:128
EEditableEntityType
EEditableEntityType
Defines type of SCR_EditableEntityComponent. Assigned automatically based on IEntity inheritance.
Definition
EEditableEntityType.c:6
EEditableEntityFlag
EEditableEntityFlag
Unique flags of the entity.
Definition
EEditableEntityFlag.c:6
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
RplRpc
void RplRpc(RplChannel channel, RplRcver rcver, RplCondition condition=RplCondition.None, string customConditionName="")
Definition
EnNetwork.c:95
RplRcver
RplRcver
Definition
RplRcver.c:59
RplChannel
RplChannel
Communication channel. Reliable is guaranteed to be delivered. Unreliable not.
Definition
RplChannel.c:14
scripts
Game
Editor
Components
EditableEntity
SCR_EditableDescriptorComponent.c
Generated by
1.17.0