Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
billboardset.c
Go to the documentation of this file.
2{
3 protected bool m_BillboardSetIndex = -1;
5 protected static const string ROOT_CLASS = "BillboardPresets";
6 protected static int m_SetIndexCached = -1;//once we resolve the name into an index, we cache it(this disallows dynamic index swapping during mission's runtime)
7
8 string GetTextureByType(string type)
9 {
10 if (m_BillboardSetIndex == -1)
11 return "";
13 return bbset.GetTextureByType(type);
14 }
15
16 void OnRPCIndex(int index)
17 {
18 if (!m_BillboardSets)
20
21 if (m_BillboardSets && m_BillboardSets.IsValidIndex(index))
22 {
23 m_BillboardSetIndex = index;
24 }
25 }
26
27 protected bool LoadBillboardConfigs()
28 {
30
31 int setCount = g_Game.ConfigGetChildrenCount(ROOT_CLASS);
32
33 for (int setIndex = 0; setIndex < setCount; setIndex++)
34 {
35 string setName;
36 GetGame().ConfigGetChildName(ROOT_CLASS, setIndex, setName);
37 string path = ROOT_CLASS + " " + setName;
39 }
40
41 return true;
42 }
43
44 static bool ActivateBillboardSet(string setClassName, PlayerIdentity identity)
45 {
46 if (!g_Game)
47 return false;
48
49 if (m_SetIndexCached == -1)
50 {
51 int setCount = g_Game.ConfigGetChildrenCount(ROOT_CLASS);
52 for (int setIndex = 0; setIndex < setCount; setIndex++)
53 {
54 string setName;
55 GetGame().ConfigGetChildName(ROOT_CLASS, setIndex, setName);
56
57 if (setName == setClassName)
58 {
59 m_SetIndexCached = setIndex;
60 break
61 }
62 }
63 }
64
65 if (m_SetIndexCached != -1)
66 {
67 auto param = new Param1<int>(m_SetIndexCached);
68 GetGame().RPCSingleParam( identity.GetPlayer(), ERPCs.RPC_SET_BILLBOARDS, param, true, identity );
69 return true;
70 }
71 return false;
72 }
73}
74
75
76class BillboardSet
77{
79
80 void BillboardSet(string path)
81 {
83 }
84
85 string GetTextureByType(string type)
86 {
87 return m_TypeTextureMapping.Get(type);
88 }
89
90 protected void LoadConfig(string path)
91 {
92 int count = g_Game.ConfigGetChildrenCount(path);
93 for ( int i = 0; i < count; i++ )
94 {
95 string itemName;
96 GetGame().ConfigGetChildName(path, i, itemName);
97
98 string typesPath = path + " " + itemName + " types";
99 string texturePath = path + " " + itemName + " texture";
100
101 if (GetGame().ConfigIsExisting(typesPath) && GetGame().ConfigIsExisting(texturePath))
102 {
103 TStringArray types = new TStringArray();
104 string texture;
105 GetGame().ConfigGetText(texturePath, texture);
106 GetGame().ConfigGetTextArray(typesPath, types);
107
108 foreach (string s: types)
109 {
110 m_TypeTextureMapping.Insert(s,texture);
111 }
112 }
113 else
114 {
115 ErrorEx("Billboard set incorrect configuration, type or texture param missing: " + path);
116 }
117
118 }
119 }
120}
class BillboardSetHandler m_TypeTextureMapping
void BillboardSet(string path)
string GetTextureByType(string type)
void LoadConfig(string path)
void OnRPCIndex(int index)
static int m_SetIndexCached
Definition billboardset.c:6
static const string ROOT_CLASS
Definition billboardset.c:5
string GetTextureByType(string type)
Definition billboardset.c:8
static bool ActivateBillboardSet(string setClassName, PlayerIdentity identity)
ref array< ref BillboardSet > m_BillboardSets
Definition billboardset.c:4
The class that will be instanced (moddable)
Definition gameplay.c:389
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DayZGame g_Game
Definition dayzgame.c:3868
ERPCs
Definition erpcs.c:2
proto native CGame GetGame()
enum ShapeType ErrorEx
array< string > TStringArray
Definition enscript.c:709