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_LightningContextAction.c
Go to the documentation of this file.
1
[
BaseContainerProps
(),
SCR_BaseContainerCustomTitleUIInfo
(
"m_Info"
)]
2
class
SCR_LightningContextAction
:
SCR_BaseContextAction
3
{
4
[
Attribute
(
"{A8FFCD3F3697D77F}Prefabs/Editor/Lightning/LightningStrike.et"
)]
5
protected
ResourceName
m_sLightningPrefab
;
6
7
//------------------------------------------------------------------------------------------------
8
override
int
GetParam
()
9
{
10
return
GetGame
().GetPlayerController().GetPlayerId();
11
}
12
13
//------------------------------------------------------------------------------------------------
14
override
bool
CanBeShown
(
SCR_EditableEntityComponent
hoveredEntity, notnull set<SCR_EditableEntityComponent> selectedEntities,
vector
cursorWorldPosition,
int
flags
)
15
{
16
if
(!
SCR_Global
.
IsPositionWithinTerrainBounds
(cursorWorldPosition))
17
return
false
;
18
19
ChimeraWorld
world =
GetGame
().GetWorld();
20
if
(world.IsGameTimePaused())
21
return
false
;
22
23
//~ Only allow lightning strike if entity has a position
24
vector
positionCheck;
25
return
!hoveredEntity || hoveredEntity.
GetPos
(positionCheck);
26
}
27
28
//------------------------------------------------------------------------------------------------
29
override
bool
CanBePerformed
(
SCR_EditableEntityComponent
hoveredEntity, notnull set<SCR_EditableEntityComponent> selectedEntities,
vector
cursorWorldPosition,
int
flags
)
30
{
31
return
CanBeShown
(hoveredEntity, selectedEntities, cursorWorldPosition,
flags
);
32
}
33
34
//------------------------------------------------------------------------------------------------
35
override
void
Perform
(
SCR_EditableEntityComponent
hoveredEntity, notnull set<SCR_EditableEntityComponent> selectedEntities,
vector
cursorWorldPosition,
int
flags
,
int
param = -1)
36
{
37
if
(hoveredEntity)
38
hoveredEntity.
GetPos
(cursorWorldPosition);
39
40
Resource
resource =
Resource
.Load(
m_sLightningPrefab
);
41
if
(!resource)
42
return
;
43
44
IEntitySource
entitySource =
SCR_BaseContainerTools
.FindEntitySource(resource);
45
if
(!entitySource)
46
return
;
47
48
//~ Spawn at ground or sea position
49
EntitySpawnParams
spawnParams =
new
EntitySpawnParams
;
50
spawnParams.Transform[3] = cursorWorldPosition;
51
52
SCR_TerrainHelper
.
SnapToTerrain
(spawnParams.Transform,
GetGame
().GetWorld(),
true
);
53
54
//~ Apply scale from prefab
55
float
scale
;
56
entitySource.Get(
"scale"
,
scale
);
57
if
(
scale
!= 1)
58
Math3D
.MatrixScale(spawnParams.Transform,
scale
);
59
60
//~ Random rotation
61
vector
angles
=
Math3D
.MatrixToAngles(spawnParams.Transform);
62
angles
[0] =
Math
.RandomFloat(0, 360);
63
Math3D
.AnglesToMatrix(
angles
, spawnParams.Transform);
64
65
IEntity
lightning =
GetGame
().SpawnEntityPrefab(resource,
GetGame
().GetWorld(), spawnParams);
66
if
(!lightning)
67
return
;
68
69
BaseTriggerComponent
trigger =
BaseTriggerComponent
.Cast(lightning.
FindComponent
(
BaseTriggerComponent
));
70
if
(!trigger)
71
return
;
72
73
//~ Add GM as instigator
74
trigger.SetInstigator(
Instigator
.CreateInstigatorGM(param));
75
}
76
}
flags
SCR_EAIThreatSectorFlags flags
Definition
AIControlComponentSerializer.c:16
scale
vector scale
Definition
BlenderEndpoints.c:50
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
angles
ref array< string > angles
Definition
PrefabImporter.c:22
BaseContainerProps
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Definition
SCR_AIAnimationWaypoint.c:14
SCR_BaseContainerCustomTitleUIInfo
class SCR_ArsenalGameModeUIDataHolder SCR_BaseContainerCustomTitleUIInfo("m_UIInfo")
Definition
SCR_ArsenalManagerComponent.c:1752
BaseTriggerComponent
Definition
BaseTriggerComponent.c:13
ChimeraWorld
Definition
ChimeraWorld.c:13
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
IEntitySource
Definition
IEntitySource.c:13
Instigator
Definition
Instigator.c:13
Math3D
Definition
Math3D.c:13
Math
Definition
Math.c:13
Resource
Object holding reference to resource. In destructor release the resource.
Definition
Resource.c:25
ResourceName
Definition
ResourceName.c:13
SCR_BaseContainerTools
Definition
SCR_BaseContainerTools.c:4
SCR_BaseContextAction
Definition
SCR_BaseContextAction.c:8
SCR_EditableEntityComponent
Definition
SCR_EditableEntityComponent.c:14
SCR_EditableEntityComponent::GetPos
bool GetPos(out vector pos)
Definition
SCR_EditableEntityComponent.c:261
SCR_Global
Definition
Functions.c:7
SCR_Global::IsPositionWithinTerrainBounds
static bool IsPositionWithinTerrainBounds(vector pos)
Definition
Functions.c:1981
SCR_LightningContextAction
Definition
SCR_LightningContextAction.c:3
SCR_LightningContextAction::CanBePerformed
override bool CanBePerformed(SCR_EditableEntityComponent hoveredEntity, notnull set< SCR_EditableEntityComponent > selectedEntities, vector cursorWorldPosition, int flags)
Definition
SCR_LightningContextAction.c:29
SCR_LightningContextAction::Perform
override void Perform(SCR_EditableEntityComponent hoveredEntity, notnull set< SCR_EditableEntityComponent > selectedEntities, vector cursorWorldPosition, int flags, int param=-1)
Definition
SCR_LightningContextAction.c:35
SCR_LightningContextAction::CanBeShown
override bool CanBeShown(SCR_EditableEntityComponent hoveredEntity, notnull set< SCR_EditableEntityComponent > selectedEntities, vector cursorWorldPosition, int flags)
Definition
SCR_LightningContextAction.c:14
SCR_LightningContextAction::m_sLightningPrefab
ResourceName m_sLightningPrefab
Definition
SCR_LightningContextAction.c:5
SCR_LightningContextAction::GetParam
override int GetParam()
Definition
SCR_LightningContextAction.c:8
SCR_TerrainHelper
Definition
SCR_TerrainHelper.c:2
SCR_TerrainHelper::SnapToTerrain
static bool SnapToTerrain(out vector transform[4], BaseWorld world=null, bool noUnderwater=false, TraceParam trace=null)
Definition
SCR_TerrainHelper.c:206
vector
Definition
vector.c:13
EntitySpawnParams
void EntitySpawnParams()
Definition
gameLib.c:130
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
scripts
Game
Editor
Containers
Actions
ContextActions
SCR_LightningContextAction.c
Generated by
1.17.0