DayZ 1.24
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))
23 }
24
25 protected bool LoadBillboardConfigs()
26 {
28
29 int setCount = g_Game.ConfigGetChildrenCount(ROOT_CLASS);
30
31 for (int setIndex = 0; setIndex < setCount; setIndex++)
32 {
33 string setName;
34 GetGame().ConfigGetChildName(ROOT_CLASS, setIndex, setName);
35 string path = ROOT_CLASS + " " + setName;
37 }
38
39 return true;
40 }
41
43 {
44 if (!g_Game)
45 return false;
46
47 if (m_SetIndexCached == -1)
48 {
49 int setCount = g_Game.ConfigGetChildrenCount(ROOT_CLASS);
50 for (int setIndex = 0; setIndex < setCount; setIndex++)
51 {
52 string setName;
53 GetGame().ConfigGetChildName(ROOT_CLASS, setIndex, setName);
54
55 if (setName == setClassName)
56 {
58 break
59 }
60 }
61 }
62
63 if (m_SetIndexCached != -1)
64 {
66 GetGame().RPCSingleParam(identity.GetPlayer(), ERPCs.RPC_SET_BILLBOARDS, param, true, identity);
67 return true;
68 }
69 return false;
70 }
71}
72
73
74class BillboardSet
75{
77
78 void BillboardSet(string path)
79 {
81 }
82
83 string GetTextureByType(string type)
84 {
85 return m_TypeTextureMapping.Get(type);
86 }
87
88 protected void LoadConfig(string path)
89 {
90 int count = g_Game.ConfigGetChildrenCount(path);
91 for (int i = 0; i < count; i++)
92 {
93 string itemName;
94 GetGame().ConfigGetChildName(path, i, itemName);
95
96 string typesPath = path + " " + itemName + " types";
97 string texturePath = path + " " + itemName + " texture";
98
99 if (GetGame().ConfigIsExisting(typesPath) && GetGame().ConfigIsExisting(texturePath))
100 {
102 string texture;
103 GetGame().ConfigGetText(texturePath, texture);
104 GetGame().ConfigGetTextArray(typesPath, types);
105
106 foreach (string s: types)
108 }
109 else
110 ErrorEx("Billboard set incorrect configuration, type or texture param missing: " + path);
111
112 }
113 }
114}
class BillboardSetHandler m_TypeTextureMapping
void BillboardSet(string path)
string GetTextureByType(string type)
void LoadConfig(string path)
DayZGame g_Game
Definition DayZGame.c:3528
ERPCs
Definition ERPCs.c:2
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:376
proto native CGame GetGame()
enum ShapeType ErrorEx
array< string > TStringArray
Definition EnScript.c:666