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_ShedulePreloadEntity.c
Go to the documentation of this file.
1
[
EntityEditorProps
(
category
:
"GameScripted/Utility"
, description:
"Schedules a spherical region of the world for preload."
, color:
"100 255 255 255"
, style:
"sphere"
)]
2
class
SCR_ShedulePreloadEntityClass
: GenericEntityClass
3
{
4
}
5
6
sealed
class
SCR_ShedulePreloadEntity
:
GenericEntity
7
{
8
[
Attribute
(
"500"
,
UIWidgets
.Slider,
"The radius in metres from the center of this entity which should be scheduled to preload."
,
"0 1500 1"
)]
9
private
float
m_fPreloadRadius;
10
11
[
Attribute
(
"0"
,
UIWidgets
.CheckBox,
"Positions first used camera to this preload location."
)]
12
private
bool
m_bPositionCamera;
13
14
15
#ifdef WORKBENCH
16
override
int
_WB_GetAfterWorldUpdateSpecs
(
IEntitySource
src)
17
{
18
return
EEntityFrameUpdateSpecs.CALL_WHEN_ENTITY_VISIBLE;
19
}
20
21
override
void
_WB_AfterWorldUpdate
(
float
timeSlice)
22
{
23
ref
auto
pShape = Shape.CreateSphere(
ARGB
(100,0,255,0),
ShapeFlags
.ONCE |
ShapeFlags
.WIREFRAME,
GetOrigin
(), m_fPreloadRadius);
24
25
if
(m_bPositionCamera)
26
{
27
vector pos, rot;
28
GetDesiredCameraTransform
(pos, rot);
29
30
vector dir = rot.AnglesToVector();
31
int
color =
ARGB
(100,0,255,64);
32
ShapeFlags
flags
=
ShapeFlags
.ONCE |
ShapeFlags
.WIREFRAME;
33
Shape pCamShape = Shape.CreateSphere(color,
flags
, pos, 0.01);
34
Shape pCamArrow = Shape.CreateArrow(pos, pos + dir, 0.01, color,
flags
);
35
}
36
}
37
#endif
38
39
//------------------------------------------------------------------------------------------------
40
protected
void
GetDesiredCameraTransform
(out
vector
position
, out
vector
angles
)
41
{
42
vector
offset = 0.5 * m_fPreloadRadius *
vector
.Up;
43
position
=
GetOrigin
() + offset;
44
angles
=
"0 -90 0"
;
45
}
46
47
//------------------------------------------------------------------------------------------------
48
void
SCR_ShedulePreloadEntity
(
IEntitySource
src,
IEntity
parent)
49
{
50
ArmaReforgerScripted pGame =
GetGame
();
51
if
(!pGame)
52
return
;
53
54
BaseWorld
pWorld = pGame.GetWorld();
55
if
(!pWorld)
56
return
;
57
58
if
(m_bPositionCamera)
59
{
60
int
cameraId = pWorld.GetCurrentCameraId();
61
if
(cameraId >= 0)
62
{
63
vector
pos, rot;
64
GetDesiredCameraTransform
(pos, rot);
65
pWorld.SetCamera(cameraId, pos, rot);
66
}
67
}
68
69
pWorld.SchedulePreload(
GetOrigin
(), m_fPreloadRadius);
70
}
71
72
};
flags
SCR_EAIThreatSectorFlags flags
Definition
AIControlComponentSerializer.c:16
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
angles
ref array< string > angles
Definition
PrefabImporter.c:22
GetOrigin
vector GetOrigin()
Definition
SCR_AIUtilityComponent.c:471
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
position
vector position
Definition
SCR_DestructibleTreeV2.c:30
SCR_ShedulePreloadEntity
void SCR_ShedulePreloadEntity(IEntitySource src, IEntity parent)
Definition
SCR_ShedulePreloadEntity.c:48
GetDesiredCameraTransform
void GetDesiredCameraTransform(out vector position, out vector angles)
Definition
SCR_ShedulePreloadEntity.c:40
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_GetAfterWorldUpdateSpecs
event int _WB_GetAfterWorldUpdateSpecs(IEntitySource src)
Called after _WB_OnInit or also later when editor needs to know whether _WB_AfterWorldUpdate needs to...
IEntity
Definition
IEntity.c:13
IEntity::GetOrigin
proto external vector GetOrigin()
IEntitySource
Definition
IEntitySource.c:13
SCR_ShedulePreloadEntityClass
Definition
SCR_ShedulePreloadEntity.c:3
UIWidgets
Definition
attributes.c:40
vector
Definition
vector.c:13
ShapeFlags
ShapeFlags
Definition
ShapeFlags.c:13
Attribute
SCR_FieldOfViewSettings Attribute
Definition
SendGoalMessage.c:170
ARGB
proto int ARGB(int a, int r, int g, int b)
scripts
Game
Entities
SCR_ShedulePreloadEntity.c
Generated by
1.17.0