Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_Position.c
Go to the documentation of this file.
1[EntityEditorProps(category: "GameScripted/GameMode")]
2class SCR_PositionClass : GenericEntityClass
3{
4}
5
7{
8#ifdef WORKBENCH
9 protected int m_iColor = Color.WHITE;
10 protected string m_sText = string.Empty;
11
12 //------------------------------------------------------------------------------------------------
14 void SetColorAndText();
15
16 //------------------------------------------------------------------------------------------------
17 override int _WB_GetAfterWorldUpdateSpecs(IEntitySource src)
18 {
19 return EEntityFrameUpdateSpecs.CALL_WHEN_ENTITY_VISIBLE;
20 }
21
22 //------------------------------------------------------------------------------------------------
23 override void _WB_AfterWorldUpdate(float timeSlice)
24 {
25 SetColorAndText();
26
27 vector mat[4];
28 GetWorldTransform(mat);
29
30 // Draw point and arrow
31 vector position = mat[3];
32 Shape pointShape = Shape.CreateSphere(m_iColor, ShapeFlags.ONCE | ShapeFlags.NOOUTLINE, position, 0.2);
33 Shape arrowShape = Shape.CreateArrow(position, position + mat[2], 0.2, m_iColor, ShapeFlags.ONCE);
34
35 WorldEditorAPI api = _WB_GetEditorAPI();
36 if (api)
37 {
38 IEntity selectEntity = api.SourceToEntity(api.GetSelectedEntity());
39 if (!SCR_Position.Cast(selectEntity))
40 return;
41 }
42
43 if (!m_sText.IsEmpty())
44 {
45 DebugTextWorldSpace textShape = DebugTextWorldSpace.Create(
46 GetWorld(),
47 m_sText,
48 DebugTextFlags.ONCE | DebugTextFlags.CENTER | DebugTextFlags.FACE_CAMERA,
49 position[0],
50 position[1] + 0.4,
51 position[2],
52 20.0,
53 m_iColor);
54 }
55 }
56#endif
57
58 //------------------------------------------------------------------------------------------------
59 // constructor
62 void SCR_Position(IEntitySource src, IEntity parent)
63 {
64 SetEventMask(EntityEvent.INIT);
65 SetFlags(EntityFlags.STATIC, true);
66 }
67}
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
vector position
SCR_PositionClass GenericEntityClass SCR_Position(IEntitySource src, IEntity parent)
enum EVehicleType IEntity
Definition Color.c:13
DebugTextFlags
ShapeFlags
Definition ShapeFlags.c:13
EntityEvent
Various entity events.
Definition EntityEvent.c:14
EntityFlags
Various entity flags.
Definition EntityFlags.c:14
class WidgetType m_iColor
string m_sText
Definition EnWidgets.c:82