DayZ 1.24
Loading...
Searching...
No Matches
ObjectSpawnerHandler Class Reference
Collaboration diagram for ObjectSpawnerHandler:
[legend]

Static Protected Member Functions

static void SpawnObjects ()
 
static void SpawnObject (ITEM_SpawnerObject item)
 
static void OnGameplayDataHandlerLoad ()
 
static bool ValidatePath (string path)
 

Static Protected Attributes

static const ref TStringArray VALID_PATHS = {"DZ\\plants", "DZ\\plants_bliss", "DZ\\rocks", "DZ\\rocks_bliss", "DZ/plants", "DZ/plants_bliss", "DZ/rocks", "DZ/rocks_bliss"}
 

Detailed Description

Definition at line 1 of file ObjectSpawner.c.

Member Function Documentation

◆ OnGameplayDataHandlerLoad()

static void ObjectSpawnerHandler::OnGameplayDataHandlerLoad ( )
inlinestaticprotected

Definition at line 63 of file ObjectSpawner.c.

64 {
66 GetGame().GetWorld().ProcessMarkedObjectsForPathgraphUpdate();
67 }
static void SpawnObjects()
proto native CGame GetGame()

References GetGame(), and SpawnObjects().

Referenced by CGame::GlobalsInit().

◆ SpawnObject()

static void ObjectSpawnerHandler::SpawnObject ( ITEM_SpawnerObject item)
inlinestaticprotected

Definition at line 27 of file ObjectSpawner.c.

28 {
30
31 float scale = item.scale;
32 if (scale == 0)
33 scale = 1;
34
35 if (item.name.Contains("\\") || item.name.Contains("/"))
36 {
37 if (ValidatePath(item.name))
38 object = GetGame().CreateStaticObjectUsingP3D(item.name, vector.ArrayToVec(item.pos), vector.ArrayToVec(item.ypr), scale);
39 }
40 else
41 {
43
44 if (item.enableCEPersistency)
45 {
46 flags &= ~ECE_DYNAMIC_PERSISTENCY;
47 flags &= ~ECE_NOLIFETIME;
48 }
49
50 object = GetGame().CreateObjectEx(item.name, vector.ArrayToVec(item.pos), flags, RF_IGNORE);
51 if (object)
52 {
53 object.SetOrientation(vector.ArrayToVec(item.ypr));
54 if (item.scale != 1)
55 object.SetScale(scale);
56 }
57 }
58
59 if (!object)
60 PrintToRPT("Object spawner failed to spawn " + item.name);
61 }
const int ECE_SETUP
const int ECE_UPDATEPATHGRAPH
const int RF_IGNORE
const int ECE_DYNAMIC_PERSISTENCY
const int ECE_NOLIFETIME
const int ECE_CREATEPHYSICS
static bool ValidatePath(string path)
static vector ArrayToVec(float arr[])
Convert static array of floats into a vector.
Definition EnConvert.c:503
proto void PrintToRPT(void var)
Prints content of variable to RPT file (performance warning - each write means fflush!...

References vector::ArrayToVec(), ECE_CREATEPHYSICS, ECE_DYNAMIC_PERSISTENCY, ECE_NOLIFETIME, ECE_SETUP, ECE_UPDATEPATHGRAPH, GetGame(), PrintToRPT(), RF_IGNORE, and ValidatePath().

Referenced by SpawnObjects().

◆ SpawnObjects()

static void ObjectSpawnerHandler::SpawnObjects ( )
inlinestaticprotected

Definition at line 5 of file ObjectSpawner.c.

6 {
8 {
10 foreach (string spawnerFilePath: arr)
11 {
12 string path = "$mission:" + spawnerFilePath;
13
14 string errorMessage;
17 {
18 foreach (ITEM_SpawnerObject o : spawner.Objects)
20 }
21 else
23 }
24 }
25 }
static TStringArray GetObjectSpawnersArr()
static void SpawnObject(ITEM_SpawnerObject item)
enum ShapeType ErrorEx

References ErrorEx, CfgGameplayHandler::GetObjectSpawnersArr(), path, and SpawnObject().

Referenced by OnGameplayDataHandlerLoad().

◆ ValidatePath()

static bool ObjectSpawnerHandler::ValidatePath ( string path)
inlinestaticprotected

Definition at line 70 of file ObjectSpawner.c.

71 {
72 foreach (string p: VALID_PATHS)
73 {
74 if (path.Contains(p))
75 return true;
76 }
77 return false;
78 }
static const ref TStringArray VALID_PATHS
bool Contains(string sample)
Returns true if sample is substring of string.
Definition EnString.c:286

References string::Contains(), path, and VALID_PATHS.

Referenced by SpawnObject().

Member Data Documentation

◆ VALID_PATHS

const ref TStringArray ObjectSpawnerHandler::VALID_PATHS = {"DZ\\plants", "DZ\\plants_bliss", "DZ\\rocks", "DZ\\rocks_bliss", "DZ/plants", "DZ/plants_bliss", "DZ/rocks", "DZ/rocks_bliss"}
staticprotected

Definition at line 3 of file ObjectSpawner.c.

3{"DZ\\plants", "DZ\\plants_bliss", "DZ\\rocks", "DZ\\rocks_bliss", "DZ/plants", "DZ/plants_bliss", "DZ/rocks", "DZ/rocks_bliss"};

Referenced by ValidatePath().


The documentation for this class was generated from the following file: