DayZ 1.24
Loading...
Searching...
No Matches
PluginLocalProfileScene.c
Go to the documentation of this file.
1/*
2 //Mission = "ChernarusPlus"
3 typedef CfgParamString DefCfgParamString
4
5 //InitTime = 220
6 typedef CfgParamInt DefCfgParamInt
7
8 //InitWeatherRain = 0.5
9 typedef CfgParamFloat DefCfgParamFloat
10
11 //InitWeatherFog = 0.3
12 typedef CfgParamFloat DefCfgParamFloat
13
14 //SceneObjectsCount = 1
15 typedef CfgParamInt DefCfgParamInt
16*/
17
19{
20 private const string FILE_ROOT = "$saves:";
21 private const string FILE_ROOT_SCENES = "Scenes";
22 private const string PARAM_MISSION = "Mission";
23 private const string PARAM_TIME = "InitTime";
24 private const string PARAM_RAIN = "InitWeatherRain";
25 private const string PARAM_FOG = "InitWeatherFog";
26 private const string PARAM_OBJ_COUNT = "SceneObjectsCount";
27 private const string PARAM_OBJ_NAME = "SceneObject";
28
29 private string m_FileSceneName;
30
31 //========================================
32 // GetPathScenes
33 //========================================
35 {
36 return FILE_ROOT + "\\" + FILE_ROOT_SCENES;
37 }
38
39 //========================================
40 // GetFileName
41 //========================================
42 override string GetFileName()
43 {
44 string file_name = GetPathScenes() + "\\" + m_FileSceneName;
45 return file_name;
46 }
47
48 //========================================
49 // OnInit
50 //========================================
51 override void OnInit()
52 {
53 super.OnInit();
54 }
55
56 //========================================
57 // GetSceneList
58 //========================================
60 {
61 if (!FileExist(GetPathScenes()))
62 MakeDirectory(GetPathScenes());
63
64 string file_name;
65 int file_attr;
66 int flags;
68
69 string path_find_pattern = GetPathScenes() + "/*.scene";
71
72 bool found = true;
73 while (found)
74 {
75 list.Insert(file_name);
76
78 }
79
80 return list;
81 }
82
83 //========================================
84 // SceneSave
85 //========================================
87 {
88 m_FileSceneName = scene.GetNameScene() + ".scene";
89
90 array<ref SceneObject> objects = scene.GetSceneObjects();
91
92 // Save Mission Name
93 SetParameterString(PARAM_MISSION, scene.GetNameMission(), false);
94 //Save Init Time
95 SetParameterFloat(PARAM_TIME, scene.GetInitTime(), false);
96 //Save Init Weather Rain
97 SetParameterFloat(PARAM_RAIN, scene.GetInitRain(), false);
98 //Save Init Weather Rain
99 SetParameterFloat(PARAM_FOG, scene.GetInitFog(), false);
100 // Save Count Of missions
101 SetParameterInt(PARAM_OBJ_COUNT, objects.Count(), false);
102
103
104 for (int i = 0; i < objects.Count(); ++i)
105 {
106 SceneObject obj = objects.Get(i);
107
108 string param_name = PARAM_OBJ_NAME + "_" + i.ToString();
110 SetSubParameterInArray(param_name, 0, "ClassName", obj.GetTypeName(), false);
111 }
112
113
114 SaveConfigToFile();
115 }
116}
override string GetFileName()
void SceneSave(SceneData scene)
string GetTypeName()
proto void Print(void var)
Prints content of variable to console/log.
array< string > TStringArray
Definition EnScript.c:666
proto native bool MakeDirectory(string name)
Makes a directory.
enum FindFileFlags FindFile(string pattern, out string fileName, out FileAttr fileAttributes, FindFileFlags flags)
proto bool FindNextFile(FindFileHandle handle, out string fileName, out FileAttr fileAttributes)
proto bool FileExist(string name)
Check existence of file.