Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
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" )]
2class SCR_ShedulePreloadEntityClass: GenericEntityClass
3{
4}
5
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
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;
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 //------------------------------------------------------------------------------------------------
41 {
42 vector offset = 0.5 * m_fPreloadRadius * vector.Up;
43 position = GetOrigin() + offset;
44 angles = "0 -90 0";
45 }
46
47 //------------------------------------------------------------------------------------------------
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;
65 pWorld.SetCamera(cameraId, pos, rot);
66 }
67 }
68
69 pWorld.SchedulePreload(GetOrigin(), m_fPreloadRadius);
70 }
71
72};
SCR_EAIThreatSectorFlags flags
ArmaReforgerScripted GetGame()
Definition game.c:1398
ref array< string > angles
vector GetOrigin()
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
vector position
void SCR_ShedulePreloadEntity(IEntitySource src, IEntity parent)
void GetDesiredCameraTransform(out vector position, out vector angles)
event void _WB_AfterWorldUpdate(float timeSlice)
Called after updating world in Workbench. The entity must be visible in frustum, selected or named....
event int _WB_GetAfterWorldUpdateSpecs(IEntitySource src)
Called after _WB_OnInit or also later when editor needs to know whether _WB_AfterWorldUpdate needs to...
proto external vector GetOrigin()
ShapeFlags
Definition ShapeFlags.c:13
SCR_FieldOfViewSettings Attribute
proto int ARGB(int a, int r, int g, int b)