Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_BaseSpawnable.c
Go to the documentation of this file.
3{
4 [Attribute("0 0 0", UIWidgets.Coords, desc: "Positional offset (in local space to the destructible)", params: "inf inf 0 purpose=coords space=entity coordsVar=m_vOffsetPosition")]
6 [Attribute("0 0 0", UIWidgets.Coords, desc: "Yaw, pitch & roll offset (in local space to the destructible)", params: "inf inf 0 purpose=angles space=entity anglesVar=m_vOffsetRotation")]
8
9#ifdef WORKBENCH
10 //------------------------------------------------------------------------------------------------
11 void SetVariables(WorldEditorAPI api, IEntitySource source, array<ref ContainerIdPathEntry> path, int index)
12 {
13 if (source.GetResourceName().Contains("BrickWall_01/BrickWall_01_white_2m.et"))
14 Print("BROKEN");
15
16 // Set all variables of the spawn object
17 api.SetVariableValue(source, path, "m_vOffsetPosition", string.Format("%1 %2 %3", m_vOffsetPosition[0], m_vOffsetPosition[1], m_vOffsetPosition[2]));
18 api.SetVariableValue(source, path, "m_vOffsetRotation", string.Format("%1 %2 %3", m_vOffsetRotation[0], m_vOffsetRotation[1], m_vOffsetRotation[2]));
19 }
20
21 //------------------------------------------------------------------------------------------------
24 bool CompareAttributes(SCR_BaseSpawnable other)
25 {
27 return false;
28
30 return false;
31
32 return true;
33 }
34
35 //------------------------------------------------------------------------------------------------
36 bool AlreadyExists(WorldEditorAPI api, IEntitySource source, int index)
37 {
38 array<ref BaseDestructionPhase> phases = {};
39 source.Get("DamagePhases", phases);
40
41 if (phases && phases.IsIndexValid(index))
42 {
43 SCR_BaseDestructionPhase phase = SCR_BaseDestructionPhase.Cast(phases[index]);
44 for (int i = phase.m_aPhaseDestroySpawnObjects.Count() - 1; i >= 0; i--)
45 {
46 if (phase.m_aPhaseDestroySpawnObjects[i].Type() == Type())
47 {
48 if (CompareAttributes(phase.m_aPhaseDestroySpawnObjects[i]))
49 return true;
50 }
51 }
52 }
53
54 return false;
55 }
56
57 //------------------------------------------------------------------------------------------------
58 bool CreateObject(WorldEditorAPI api, IEntitySource source, array<ref ContainerIdPathEntry> path, int index)
59 {
60 if (!AlreadyExists(api, source, index))
61 {
62 api.CreateObjectArrayVariableMember(source, path, "m_aPhaseDestroySpawnObjects", "SCR_BaseSpawnable", index);
63 return true;
64 }
65
66 return false;
67 }
68
69 //------------------------------------------------------------------------------------------------
70 void CopyToSource(WorldEditorAPI api, IEntitySource source, array<ref ContainerIdPathEntry> path, int index, string currentObjectName)
71 {
72 if (!CreateObject(api, source, path, index))
73 return;
74
75 // Change the path to the current spawn object
76 int last = path.Insert(new ContainerIdPathEntry(currentObjectName, index));
77
78 SetVariables(api, source, path, index);
79
80 path.Remove(last);
81 }
82#endif
83
84 //------------------------------------------------------------------------------------------------
86 void GetSpawnTransform(IEntity owner, out vector outMat[4], bool localCoords = false)
87 {
88 if (localCoords)
89 {
90 Math3D.AnglesToMatrix(m_vOffsetRotation, outMat);
91 // TODO: Remove hotfix for sleeping/static object
92 if (m_vOffsetPosition == vector.Zero)
93 outMat[3] = vector.Up * 0.001;
94 else
95 outMat[3] = m_vOffsetPosition;
96 }
97 else
98 {
99 vector localMat[4], parentMat[4];
100 owner.GetWorldTransform(parentMat);
101 Math3D.AnglesToMatrix(m_vOffsetRotation, localMat);
102 localMat[3] = m_vOffsetPosition;
103
104 Math3D.MatrixMultiply4(parentMat, localMat, outMat);
105 }
106 }
107
108 //------------------------------------------------------------------------------------------------
110 IEntity Spawn(IEntity owner, Physics parentPhysics, SCR_HitInfo hitInfo, bool snapToTerrain = false)
111 {
112 return null;
113 }
114}
115
116class SCR_Spawnable_SmallDebrisTitle : BaseContainerCustomTitle
117{
118 override bool _WB_GetCustomTitle(BaseContainer source, out string title)
119 {
120 title = "Small Debris";
121 return true;
123}
124
126{
127 override bool _WB_GetCustomTitle(BaseContainer source, out string title)
128 {
129 title = "Prefab";
130 return true;
131 }
132}
133
134class SCR_Spawnable_ParticleTitle : BaseContainerCustomTitle
135{
136 override bool _WB_GetCustomTitle(BaseContainer source, out string title)
137 {
138 title = "Particle Effect";
139 return true;
140 }
141}
string path
void ContainerIdPathEntry(string propertyName, int index=-1)
Definition worldEditor.c:30
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
SCR_AIGroupClass snapToTerrain
vector m_vOffsetPosition
vector m_vOffsetRotation
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
int Type
proto external void GetWorldTransform(out vector mat[])
See IEntity::GetTransform.
IEntity Spawn(IEntity owner, Physics parentPhysics, SCR_HitInfo hitInfo, bool snapToTerrain=false)
Spawns the object.
void GetSpawnTransform(IEntity owner, out vector outMat[4], bool localCoords=false)
Calculates the spawn tranformation matrix for the object.
Class to temporarily store information about the last hit that dealt damage.
Definition SCR_HitInfo.c:3
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
SCR_FieldOfViewSettings Attribute
class SCR_BaseManualCameraComponent _WB_GetCustomTitle(BaseContainer source, out string title)