Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ScenarioFrameworkSlotWaypoint.c
Go to the documentation of this file.
1[EntityEditorProps(category: "GameScripted/ScenarioFramework/SlotWaypoint", description: "")]
6
7//------------------------------------------------------------------------------------------------
9{
10 [Attribute(desc: "Waypoint settings", category: "Waypoint")]
12
13 //------------------------------------------------------------------------------------------------
16 override IEntity SpawnAsset()
17 {
18 //If Randomization is enabled, it will try to apply settings from Attributes.
19 //If it fails anywhere, original m_sObjectToSpawn will be used.
20 if (m_bRandomizePerFaction)
21 {
22 ResourceName randomAsset;
24 {
25 GetRandomAsset(randomAsset);
26 if (!SCR_StringHelper.IsEmptyOrWhiteSpace(randomAsset))
27 m_sObjectToSpawn = randomAsset;
28 }
29 else
30 {
31 randomAsset = GetRandomlySpawnedObject();
32 }
33 }
34
35 if (m_Waypoint)
36 m_sObjectToSpawn = m_Waypoint.GetWaypointPrefab();
37
38 Resource resource = Resource.Load(m_sObjectToSpawn);
39 if (!resource || !resource.IsValid())
40 return null;
41
43 m_SpawnParams.TransformMode = ETransformMode.WORLD;
44 //--- Apply rotation
45 vector angles = Math3D.MatrixToAngles(m_SpawnParams.Transform);
46 Math3D.AnglesToMatrix(angles, m_SpawnParams.Transform);
47
48 //--- Spawn the prefab
49 BaseResourceObject resourceObject = resource.GetResource();
50 if (!resourceObject)
51 return null;
52
53 if (m_bIgnoreOrientChildrenToTerrain)
54 {
55 IEntityComponentSource slotCompositionComponent = SCR_BaseContainerTools.FindComponentSource(resourceObject, SCR_SlotCompositionComponent);
56 if (slotCompositionComponent)
57 {
58 SCR_SlotCompositionComponent.IgnoreOrientChildrenToTerrain();
59 }
60 }
61
62 IEntity entity = GetGame().SpawnEntityPrefab(resource, GetGame().GetWorld(), m_SpawnParams);
63 SCR_AIWorld aiWorld = SCR_AIWorld.Cast(GetGame().GetAIWorld());
64 if (aiWorld)
65 aiWorld.RequestNavmeshRebuildEntity(entity);
66
67 m_aSpawnedEntities.Insert(entity);
68
69 if (m_vPosition != vector.Zero)
70 entity.SetOrigin(m_vPosition);
71
72 if (m_Waypoint)
73 {
74 m_Waypoint.m_SlotWaypoint = this;
75 m_Waypoint.SetupWaypoint(entity);
76 }
77
78 return entity;
79 }
80
81 //------------------------------------------------------------------------------------------------
84 override protected void DrawDebugShape(bool draw)
85 {
86 if (!draw)
87 return;
88
89 Shape dbgShapeCenter = null;
90 Shape dbgShapeOuter = null;
91
92 float radius = m_fDebugShapeRadius;
93 if (m_Waypoint)
94 radius = m_Waypoint.GetWaypointCompletionRadius();
95
96
97 dbgShapeCenter = Shape.CreateCylinder(
99 ShapeFlags.TRANSP | ShapeFlags.DOUBLESIDE | ShapeFlags.NOZWRITE | ShapeFlags.ONCE | ShapeFlags.NOOUTLINE,
101 0.25,
102 10
103 );
104
105 dbgShapeOuter = Shape.CreateCylinder(
107 ShapeFlags.TRANSP | ShapeFlags.DOUBLESIDE | ShapeFlags.NOZWRITE | ShapeFlags.ONCE | ShapeFlags.NOOUTLINE,
109 radius,
110 2
111 );
112 }
113
114#ifdef WORKBENCH
115 //------------------------------------------------------------------------------------------------
120 override bool _WB_OnKeyChanged(IEntity owner, BaseContainer src, string key, BaseContainerList ownerContainers, IEntity parent)
121 {
122 if (key == "m_bShowDebugShapesInWorkbench")
124
125 if (key == "coords")
126 {
127 SCR_EntityHelper.DeleteEntityAndChildren(m_PreviewEntity);
128
129 Resource resource = Resource.Load(m_sObjectToSpawn);
130 if (!resource)
131 return false;
132
133 SpawnEntityPreview(owner, resource);
134 return true;
135 }
136 else if (key == "m_sObjectToSpawn")
137 {
138 SCR_EntityHelper.DeleteEntityAndChildren(m_PreviewEntity);
139 return false;
140 }
141 return false;
142 }
143#endif
144
145 //------------------------------------------------------------------------------------------------
146 // constructor
151 {
152 m_iDebugShapeColor = ARGB(100, 0x00, 0x10, 0xFF);
153 }
154}
ArmaReforgerScripted GetGame()
Definition game.c:1398
ref array< string > angles
vector m_vPosition
vector GetOrigin()
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
override bool _WB_OnKeyChanged(IEntity owner, BaseContainer src, string key, BaseContainerList ownerContainers, IEntity parent)
Any property value has been changed. You can use editor API here and do some additional edit actions ...
IEntity m_PreviewEntity
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
bool m_bShowDebugShapesInWorkbench
ref array< IEntity > m_aSpawnedEntities
void DrawDebugShape(bool draw)
float m_fDebugShapeRadius
SCR_ScenarioFrameworkLayerTaskDestroyClass m_SpawnParams
ResourceName GetRandomlySpawnedObject()
void SCR_ScenarioFrameworkSlotBase(IEntityComponentSource src, IEntity ent, IEntity parent)
IEntity SpawnAsset()
ResourceName GetRandomAsset(out ResourceName prefab)
void SCR_ScenarioFrameworkSlotWaypoint(IEntityComponentSource src, IEntity ent, IEntity parent)
enum EVehicleType IEntity
proto external void SetOrigin(vector orig)
proto external void GetWorldTransform(out vector mat[])
See IEntity::GetTransform.
void RequestNavmeshRebuildEntity(IEntity entity)
static bool IsEmptyOrWhiteSpace(string input)
Instance of created debug visualizer.
Definition Shape.c:14
IEntity GetOwner()
Owner entity of the fuel tank.
ShapeFlags
Definition ShapeFlags.c:13
SCR_FieldOfViewSettings Attribute
proto int ARGB(int a, int r, int g, int b)