Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
game.c
Go to the documentation of this file.
1
5static int GAME_STORAGE_VERSION = 142;
6
7class CGame
8{
9 // enableDebugMonitor in server config
10 int m_DebugMonitorEnabled;
11
12 ScriptModule GameScript;
13
14 //Obsolete, port [Obsolete()] as well, maybe?
15 private ref array<ref Param> m_ParamCache;
16
17 //analytics
18 ref AnalyticsManagerServer m_AnalyticsManagerServer;
19 ref AnalyticsManagerClient m_AnalyticsManagerClient;
20 ref MenuDefaultCharacterData m_CharacterData;
21
22 #ifdef DIAG_DEVELOPER
23 ref array<ComponentEnergyManager> m_EnergyManagerArray;
24 void EnableEMPlugs(bool enable)
25 {
26 for (int i = 0; i < GetGame().m_EnergyManagerArray.Count(); ++i)
27 {
28 if (GetGame().m_EnergyManagerArray[i])
29 GetGame().m_EnergyManagerArray[i].SetDebugPlugs(enable);
30 }
31 }
32 #endif
33
34 void CGame()
35 {
36 Math.Randomize(-1);
37
38 LogManager.Init();
39
40 m_ParamCache = new array<ref Param>;
41 m_ParamCache.Insert(null);
42
43 //analytics
44 m_AnalyticsManagerServer = new AnalyticsManagerServer;
45 m_AnalyticsManagerClient = new AnalyticsManagerClient;
46
47 //m_CharacterData = new MenuCharacrerData;
48
49 // actual script version - increase by one when you make changes
50 StorageVersion(GAME_STORAGE_VERSION);
51
52 #ifdef DIAG_DEVELOPER
53 m_EnergyManagerArray = new array<ComponentEnergyManager>;
54 #endif
55
56 if (!IsDedicatedServer())
57 {
59 AmmoEffects.Init();
60 VONManager.Init();
61 if (!IsMultiplayer())
62 {
64 }
65 }
66 else
67 {
69 }
70 }
71
72 private void ~CGame()
73 {
74 // Clean these up even if it is dedicated server, just to be safe
76 AmmoEffects.Cleanup();
77 VONManager.CleanupInstance();
78
79 // Is initialized in StartupEvent
80 ParticleManager.CleanupInstance();
81 }
82
83 proto native WorkspaceWidget GetWorkspace();
84 proto native WorkspaceWidget GetLoadingWorkspace();
85
87
92 void OnEvent(EventType eventTypeId, Param params)
93 {
94 }
95
96 //PLM Type: 0 == RESUMED, 1 == SUSPENDED
97 void OnProcessLifetimeChanged(int plmtype)
98 {
99
100 }
101
102 void OnLicenseChanged()
103 {
104
105 }
106
110 void OnAfterCreate()
111 {
112 }
113
117 void OnActivateMessage()
118 {
119 }
120
125 {
126 }
127
131 bool OnInitialize()
132 {
133 return false;
134 }
135
139 void OnDeviceReset()
140 {
141 }
142
148 void OnUpdate(bool doSim, float timeslice)
149 {
150 }
151
157 void OnPostUpdate(bool doSim, float timeslice)
158 {
159 }
160
165 void OnKeyPress(int key)
166 {
167 }
168
173 void OnKeyRelease(int key)
174 {
175 }
176
181 void OnMouseButtonPress(int button)
182 {
183 }
184
189 void OnMouseButtonRelease(int button)
190 {
191 }
192
196 UIScriptedMenu CreateScriptedMenu( int id ) { }
197
201 UIScriptedWindow CreateScriptedWindow( int id ) { }
202
209 void OnRPC(PlayerIdentity sender, Object target, int rpc_type, ParamsReadContext ctx)
210 {
211 }
212
216 proto native void RequestExit( int code );
217
221 proto native void RequestRestart(int code);
222
226 proto native bool IsAppActive();
227
231 proto bool GetHostAddress( out string address, out int port );
232
236 proto owned string GetHostName();
237
241 proto GetServersResultRow GetHostData();
242
250 proto native int Connect( UIScriptedMenu parent , string IpAddress, int port, string password );
255 proto native int ConnectLastSession( UIScriptedMenu parent , int selectedCharacter = -1 );
259 proto native void DisconnectSession();
260
264 proto native void DisconnectSessionForce();
265
266 // profile functions
277 proto native void GetProfileStringList(string name, out TStringArray values);
278
285 proto bool GetProfileString(string name, out string value);
286
292 proto native void SetProfileStringList(string name, TStringArray values);
293
299 proto native void SetProfileString(string name, string value);
300
304 proto native void SaveProfile();
305
310 proto void GetPlayerName(out string name);
311
317 proto void GetPlayerNameShort(int maxLength, out string name);
318
323 proto native void SetPlayerName(string name);
324
330 proto native Entity CreatePlayer(PlayerIdentity identity, string name, vector pos, float radius, string spec);
331
338 proto native void SelectPlayer(PlayerIdentity identity, Object player);
339
347 proto void GetPlayerNetworkIDByIdentityID( int playerIdentityID, out int networkIdLowBits, out int networkIdHightBits );
348
354 proto native Object GetObjectByNetworkId( int networkIdLowBits, int networkIdHighBits );
355
361 proto native bool RegisterNetworkStaticObject(Object object);
362
369 proto native bool IsNetworkInputBufferFull();
370
377 proto native void SelectSpectator(PlayerIdentity identity, string spectatorObjType, vector position);
378
383 proto native void UpdateSpectatorPosition(vector position);
384
391 proto native void SendLogoutTime(Object player, int time);
392
397 proto native void DisconnectPlayer(PlayerIdentity identity, string uid = "");
398
404 proto native void AddToReconnectCache(PlayerIdentity identity);
405
411 proto native void RemoveFromReconnectCache(string uid);
412
417 proto native void ClearReconnectCache();
418
419
423 proto native void StorageVersion( int iVersion );
424
428 proto native int LoadVersion();
429
433 proto native int SaveVersion();
434
438 proto native float GetDayTime();
439
440 // config functions
447 proto bool ConfigGetText(string path, out string value);
448
456 proto bool ConfigGetTextRaw(string path, out string value);
457
463 string ConfigGetTextOut(string path)
464 {
465 string ret_s;
466 ConfigGetText(path, ret_s);
467 return ret_s;
468 }
469
475 bool FormatRawConfigStringKeys(inout string value)
476 {
477 int ret;
478 ret = value.Replace("$STR_","#STR_");
479 return ret > 0;
480 }
481
487 string GetModelName(string class_name)
488 {
489 if ( class_name != "" )
490 {
491 string cfg = "CfgVehicles " + class_name + " model";
492 string model_path;
493 if ( GetGame().ConfigGetText(cfg, model_path) )
494 {
495 int to_substring_end = model_path.Length() - 4; // -4 to leave out the '.p3d' suffix
496 int to_substring_start = 0;
497
498 // Currently we have model path. To get the name out of it we need to parse this string from the end and stop at the first found '\' sign
499 for (int i = to_substring_end; i > 0; i--)
500 {
501 string sign = model_path.Get(i);
502 if ( sign == "\\" )
503 {
504 to_substring_start = i + 1;
505 break
506 }
507 }
508
509 string model_name = model_path.Substring(to_substring_start, to_substring_end - to_substring_start);
510 return model_name;
511 }
512 }
513
514 return "UNKNOWN_P3D_FILE";
515 }
516
522 proto native float ConfigGetFloat(string path);
523
524
530 proto native vector ConfigGetVector(string path);
531
537 proto native int ConfigGetInt(string path);
538
544 proto native int ConfigGetType(string path);
545
556 proto native void ConfigGetTextArray(string path, out TStringArray values);
557
569 proto native void ConfigGetTextArrayRaw(string path, out TStringArray values);
570
576 proto native void ConfigGetFloatArray(string path, out TFloatArray values);
577
583 proto native void ConfigGetIntArray(string path, out TIntArray values);
584
592 proto bool ConfigGetChildName(string path, int index, out string name);
593
600 proto bool ConfigGetBaseName(string path, out string base_name);
601
609 proto native int ConfigGetChildrenCount(string path);
610 proto native bool ConfigIsExisting(string path);
611
612 proto native void ConfigGetFullPath(string path, out TStringArray full_path);
613 proto native void ConfigGetObjectFullPath(Object obj, out TStringArray full_path);
614
615 proto native void GetModInfos(notnull out array<ref ModInfo> modArray);
616 proto native bool GetModToBeReported();
617
626 string ConfigPathToString(TStringArray array_path)
627 {
628 string return_path = "";
629 int count = array_path.Count();
630
631 for (int i = 0; i < count; i++)
632 {
633 return_path += array_path.Get(i);
634
635 if ( i < count - 1 )
636 {
637 return_path += " ";
638 }
639 }
640
641 return return_path;
642 }
643
659 proto bool CommandlineGetParam(string name, out string value);
660
661 proto native void CopyToClipboard(string text);
662 proto void CopyFromClipboard(out string text);
663
664 proto native void BeginOptionsVideo();
665 proto native void EndOptionsVideo();
666
667 proto native void AdminLog(string text);
668
669 // entity functions
676 proto native bool PreloadObject( string type, float distance );
677
678 proto native Object CreateStaticObjectUsingP3D(string p3dFilename, vector position, vector orientation, float scale = 1.0, bool createLocal = false);
679
689 proto native Object CreateObject( string type, vector pos, bool create_local = false, bool init_ai = false, bool create_physics = true );
690 proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local = false);
691 proto native SoundWaveOnVehicle CreateSoundWaveOnObject(Object source, SoundObject soundObject, AbstractWave soundWave);
692
701 proto native Object CreateObjectEx( string type, vector pos, int iFlags, int iRotation = RF_DEFAULT );
702
703 proto native void ObjectDelete( Object obj );
704 proto native void ObjectDeleteOnClient( Object obj );
705 proto native void RemoteObjectDelete( Object obj );
706 proto native void RemoteObjectTreeDelete( Object obj );
707 proto native void RemoteObjectCreate( Object obj );
708 proto native void RemoteObjectTreeCreate( Object obj );
709 proto native int ObjectRelease( Object obj );
710 proto void ObjectGetType( Object obj, out string type );
711 proto void ObjectGetDisplayName( Object obj, out string name );
712 proto native vector ObjectGetSelectionPosition(Object obj, string name);
713 proto native vector ObjectGetSelectionPositionLS(Object obj, string name);
714 proto native vector ObjectGetSelectionPositionMS(Object obj, string name);
715 proto native vector ObjectGetSelectionPositionWS(Object obj, string name);
716 proto native vector ObjectModelToWorld(Object obj, vector modelPos);
717 proto native vector ObjectWorldToModel(Object obj, vector worldPos);
719 proto native bool IsObjectAccesible(EntityAI item, Man player);
720
721#ifdef DIAG_DEVELOPER
722 proto native void ReloadShape(Object obj);
723#endif
724
725 // input
726 proto native Input GetInput();
727
728 // camera
729 proto native vector GetCurrentCameraPosition();
730 proto native vector GetCurrentCameraDirection();
731
732 // sound
733 proto native AbstractSoundScene GetSoundScene();
734
735 // noise
736 proto native NoiseSystem GetNoiseSystem();
737
738 // inventory
739 proto native bool AddInventoryJuncture(Man player, notnull EntityAI item, InventoryLocation dst, bool test_dst_occupancy, int timeout_ms);
740
741 bool AddInventoryJunctureEx(Man player, notnull EntityAI item, InventoryLocation dst, bool test_dst_occupancy, int timeout_ms)
742 {
743 bool result = AddInventoryJuncture(player, item, dst, test_dst_occupancy, timeout_ms/*10000000*/);
744 #ifdef ENABLE_LOGGING
745 if ( LogManager.IsInventoryReservationLogEnable() )
746 {
747 Debug.InventoryReservationLog("STS = " + player.GetSimulationTimeStamp() + " result: " + result + " item:" + item + " dst: " + InventoryLocation.DumpToStringNullSafe(dst), "n/a" , "n/a", "AddInventoryJuncture",player.ToString() );
748 }
749 #endif
750 //Print("Juncture - STS = " + player.GetSimulationTimeStamp() + " item:" + item + " dst: " + InventoryLocation.DumpToStringNullSafe(dst));
751 return result;
752 }
753
754 //Has inventory juncture for any player
755 proto native bool HasInventoryJunctureItem(notnull EntityAI item);
756
757 proto native bool HasInventoryJunctureDestination(Man player, notnull InventoryLocation dst);
758 proto native bool AddActionJuncture(Man player, notnull EntityAI item, int timeout_ms);
759 proto native bool ExtendActionJuncture(Man player, notnull EntityAI item, int timeout_ms);
760 proto native bool ClearJuncture(Man player, notnull EntityAI item);
761
762 bool ClearJunctureEx(Man player, notnull EntityAI item)
763 {
764 #ifdef ENABLE_LOGGING
765 if ( LogManager.IsInventoryReservationLogEnable() )
766 {
767 Debug.InventoryReservationLog("STS = " + player.GetSimulationTimeStamp()+ " item:" + item, "n/a" , "n/a", "ClearJuncture",player.ToString() );
768 }
769 #endif
770 return ClearJuncture( player, item);
771 }
772
773 // support
775 proto native bool ExecuteEnforceScript(string expression, string mainFnName);
777 proto native void DumpInstances(bool csvFormatting);
778
779 proto native bool ScriptTest();
781 proto native void GetDiagModeNames(out TStringArray diag_names);
783 proto native void SetDiagModeEnable(int diag_mode, bool enabled);
785 proto native bool GetDiagModeEnable(int diag_mode);
786
788 proto native void GetDiagDrawModeNames(out TStringArray diag_names);
790 proto native void SetDiagDrawMode(int diag_draw_mode);
792 proto native int GetDiagDrawMode();
793
795 proto native bool IsPhysicsExtrapolationEnabled();
796
800 proto native int GizmoGetCount();
801
805 proto native Class GizmoGetInstance(int index);
806
810 proto native Managed GizmoGetTracker(int index);
811
815 proto native int GizmoFindByTracker(Managed tracker);
816
820 proto native void GizmoClear(int index);
821
825 proto native void GizmoClearAll();
826
832 proto native void GizmoSelectObject(Object object);
833
841 proto native void GizmoSelectPhysics(Physics physics);
842
850 proto native void GizmoSelectUser(Managed instance);
851
856 proto native float GetFps();
857
862 proto native float GetLastFPS();
863
869 proto native float GetAvgFPS(int nFrames = 64);
870
876 proto native float GetMinFPS(int nFrames = 64);
877
883 proto native float GetMaxFPS(int nFrames = 64);
884
892 void GetFPSStats(out float min, out float max, out float avg, int nFrames = 64)
893 {
894 min = GetMinFPS(nFrames);
895 max = GetMaxFPS(nFrames);
896 avg = GetAvgFPS(nFrames);
897 }
898
903 proto native float GetTickTime();
904
905 proto void GetInventoryItemSize(InventoryItem item, out int width, out int height);
912 proto native void GetObjectsAtPosition(vector pos, float radius, out array<Object> objects, out array<CargoBase> proxyCargos);
919 proto native void GetObjectsAtPosition3D(vector pos, float radius, out array<Object> objects, out array<CargoBase> proxyCargos);
920 proto native World GetWorld();
921 proto void GetWorldName( out string world_name );
922
923 string GetWorldName()
924 {
925 string world_name;
926 g_Game.GetWorldName(world_name);
927 return world_name;
928 }
929
930 proto native bool VerifyWorldOwnership( string sWorldName );
931 proto native bool GoBuyWorldDLC( string sWorldName );
932
933 proto void FormatString( string format, string params[], out string output);
934 proto void GetVersion( out string version );
935 proto native UIManager GetUIManager();
936 proto native DayZPlayer GetPlayer();
937 proto native void GetPlayers( out array<Man> players );
938 DayZPlayer GetPlayerByIndex(int index = 0)
939 {
940 array<Man> players();
941 GetPlayers(players);
942 if (index >= players.Count())
943 return null;
944 return DayZPlayer.Cast(players[index]);
945 }
946
948 proto native void StoreLoginData(ParamsWriteContext ctx);
949
951 proto native vector GetPointerDirection();
953 proto native vector GetWorldDirectionFromScreen(vector world_pos);
955 proto native vector GetScreenPos(vector world_pos);
957 proto native vector GetScreenPosRelative(vector world_pos);
958
960 proto native MenuData GetMenuData();
1003 proto native void RPC(Object target, int rpcType, notnull array<ref Param> params, bool guaranteed,PlayerIdentity recipient = null);
1005 proto native void RPCSingleParam(Object target, int rpc_type, Param param, bool guaranteed, PlayerIdentity recipient = null);
1007 proto native void RPCSelf(Object target, int rpcType, notnull array<ref Param> params);
1008 proto native void RPCSelfSingleParam(Object target, int rpcType, Param param);
1009
1011 proto native void ProfilerStart(string name);
1013 proto native void ProfilerStop(string name);
1014
1015
1025 proto native void Chat(string text, string colorClass);
1026 proto native void ChatMP(Man recipient, string text, string colorClass);
1027 proto native void ChatPlayer(string text);
1033 proto native void MutePlayer(string muteUID, string playerUID, bool mute);
1034
1040 proto native void MuteAllPlayers(string listenerId, bool mute);
1041
1047 proto native void EnableVoN(Object player, bool enable);
1048
1055 proto native void SetVoiceEffect(Object player, int effect, bool enable);
1056
1061 proto native void SetVoiceLevel(int level);
1062
1066 proto native int GetVoiceLevel(Object player = null);
1067
1072 proto native void EnableMicCapture(bool enable);
1073
1077 proto native bool IsMicCapturing();
1078
1082 proto native bool IsInPartyChat();
1083
1084 // mission
1085 proto native Mission GetMission();
1086 proto native void SetMission(Mission mission);
1087
1088
1090 proto native void StartRandomCutscene(string world);
1092 proto native void PlayMission(string path);
1093
1095 proto protected native void CreateMission(string path);
1096 proto native void RestartMission();
1098 proto native void AbortMission();
1099 proto native void RespawnPlayer();
1100 proto native bool CanRespawnPlayer();
1101 proto native void SetLoginTimerFinished();
1102
1103 proto native void SetMainMenuWorld(string world);
1104 proto native owned string GetMainMenuWorld();
1105
1107 proto native void LogoutRequestTime();
1108 proto native void LogoutRequestCancel();
1109
1110 proto native bool IsMultiplayer();
1111 proto native bool IsClient();
1112 proto native bool IsServer();
1117 proto native bool IsDedicatedServer();
1118
1120 proto native int ServerConfigGetInt(string name);
1121
1122 // Internal build
1123 proto native bool IsDebug();
1124
1125//#ifdef PLATFORM_XBOX
1126 static bool IsDigitalCopy()
1127 {
1128 return OnlineServices.IsGameActive(false);
1129 }
1130//#endif
1131
1132 /*bool IsNewMenu()
1133 {
1134 return m_ParamNewMenu;
1135 }*/
1136
1138 {
1139 m_DebugMonitorEnabled = value;
1140 }
1141
1143 {
1144 return IsServer() && m_DebugMonitorEnabled;
1145 }
1146
1147 proto native void GetPlayerIndentities( out array<PlayerIdentity> identities );
1148
1151
1152 proto native float SurfaceY(float x, float z);
1153 proto native float SurfaceRoadY(float x, float z, RoadSurfaceDetection rsd = RoadSurfaceDetection.LEGACY);
1154 proto native float SurfaceRoadY3D(float x, float y, float z, RoadSurfaceDetection rsd);
1156 proto float SurfaceGetType(float x, float z, out string type);
1158 proto float SurfaceGetType3D(float x, float y, float z, out string type);
1159 proto void SurfaceUnderObject(notnull Object object, out string type, out int liquidType);
1160 proto void SurfaceUnderObjectEx(notnull Object object, out string type, out string impact, out int liquidType);
1161 proto void SurfaceUnderObjectByBone(notnull Object object, int boneType, out string type, out int liquidType);
1162 proto native float SurfaceGetNoiseMultiplier(Object directHit, vector pos, int componentIndex);
1163 proto native vector SurfaceGetNormal(float x, float z);
1164 proto native float SurfaceGetSeaLevelMin();
1165 proto native float SurfaceGetSeaLevelMax();
1166 proto native float SurfaceGetSeaLevel();
1167 proto native bool SurfaceIsSea(float x, float z);
1168 proto native bool SurfaceIsPond(float x, float z);
1169 proto native float GetWaterDepth(vector posWS);
1170
1171 proto native void UpdatePathgraphRegion(vector regionMin, vector regionMax);
1172
1175 {
1176 float high = -9999999;
1177 float low = 99999999;
1178
1179 for (int i = 0; i < positions.Count(); i++)
1180 {
1181 vector pos = positions.Get(i);
1182 pos[1] = SurfaceRoadY( pos[0], pos[2]);
1183 float y = pos[1];
1184
1185 if ( y > high )
1186 high = y;
1187
1188 if ( y < low )
1189 low = y;
1190
1191 ;
1192 }
1193
1194 return high - low;
1195 }
1196
1199 {
1200 vector normal = GetGame().SurfaceGetNormal(x, z);
1201 vector angles = normal.VectorToAngles();
1202 angles[1] = angles[1]+270; // This fixes rotation of item so it stands vertically. Feel free to change, but fix existing use cases.
1203
1204 //Hack because setorientation and similar functions break and flip stuff upside down when using exactly this vector ¯\_(ツ)_/¯ (note: happens when surface is flat)
1205 if (angles == "0 540 0")
1206 angles = "0 0 0";
1207 return angles;
1208 }
1209
1211 bool IsSurfaceDigable(string surface)
1212 {
1213 return ConfigGetInt("CfgSurfaces " + surface + " isDigable");
1214 }
1215
1216 bool GetSurfaceDigPile(string surface, out string result)
1217 {
1218 return ConfigGetText("CfgSurfaces " + surface + " digPile", result);
1219 }
1220
1222 bool IsSurfaceFertile(string surface)
1223 {
1224 return ConfigGetInt("CfgSurfaces " + surface + " isFertile");
1225 }
1226
1227 int CorrectLiquidType(int liquidType)
1228 {
1229 if (liquidType == -1)
1230 return LIQUID_NONE;
1231
1232 if (liquidType == 0)
1233 return LIQUID_SALTWATER;
1234
1235 return liquidType;
1236 }
1237
1238 void SurfaceUnderObjectCorrectedLiquid(notnull Object object, out string type, out int liquidType)
1239 {
1240 SurfaceUnderObject(object, type, liquidType);
1241 liquidType = CorrectLiquidType(liquidType);
1242 }
1243 void SurfaceUnderObjectExCorrectedLiquid(notnull Object object, out string type, out string impact, out int liquidType)
1244 {
1245 SurfaceUnderObjectEx(object, type, impact, liquidType);
1246 liquidType = CorrectLiquidType(liquidType);
1247 }
1248 void SurfaceUnderObjectByBoneCorrectedLiquid(notnull Object object, int boneType, out string type, out int liquidType)
1249 {
1250 SurfaceUnderObjectByBone(object, boneType, type, liquidType);
1251 liquidType = CorrectLiquidType(liquidType);
1252 }
1253
1255 {
1256 if ( object )
1257 {
1258 vector pos = object.GetPosition();
1259 vector min_max[2];
1260 float radius = object.ClippingInfo ( min_max );
1261 vector min = Vector ( pos[0] - radius, pos[1], pos[2] - radius );
1262 vector max = Vector ( pos[0] + radius, pos[1], pos[2] + radius );
1263 UpdatePathgraphRegion( min, max );
1264 }
1265 }
1266
1294 proto native bool IsBoxColliding(vector center, vector orientation, vector edgeLength, array<Object> excludeObjects, array<Object> collidedObjects = NULL);
1295
1326 proto native bool IsBoxCollidingGeometry(vector center, vector orientation, vector edgeLength, int iPrimaryType, int iSecondaryType, array<Object> excludeObjects, array<Object> collidedObjects = NULL);
1327
1328 proto native bool IsBoxCollidingGeometryProxy(notnull BoxCollidingParams params, array<Object> excludeObjects, array<ref BoxCollidingResult> collidedObjects = NULL);
1329
1331 proto native Weather GetWeather();
1332
1334 proto native void SetEVUser(float value);
1335
1336 proto native void OverrideDOF(bool enable, float focusDistance, float focusLength, float focusLengthNear, float blur, float focusDepthOffset);
1337
1338 proto native void AddPPMask(float ndcX, float ndcY, float ndcRadius, float ndcBlur);
1339
1340 proto native void ResetPPMask();
1341
1349 proto native void OverrideInventoryLights(vector diffuse, vector ambient, vector ground, vector dir);
1350
1356 proto native void NightVissionLightParams(float lightIntensityMul, float noiseIntensity);
1357
1358
1359 proto native void OpenURL(string url);
1360
1362 proto native void InitDamageEffects(Object effect);
1363
1364//-----------------------------------------------------------------------------
1365// persitence
1366//-----------------------------------------------------------------------------
1367
1370
1378 proto native EntityAI GetEntityByPersitentID( int b1, int b2, int b3, int b4 );
1379
1380//-----------------------------------------------------------------------------
1381
1394 bool IsKindOf(string cfg_class_name, string cfg_parent_name)
1395 {
1396 TStringArray full_path = new TStringArray;
1397
1398 ConfigGetFullPath("CfgVehicles " + cfg_class_name, full_path);
1399
1400 if (full_path.Count() == 0)
1401 {
1402 ConfigGetFullPath("CfgAmmo " + cfg_class_name, full_path);
1403 }
1404
1405 if (full_path.Count() == 0)
1406 {
1407 ConfigGetFullPath("CfgMagazines " + cfg_class_name, full_path);
1408 }
1409
1410 if (full_path.Count() == 0)
1411 {
1412 ConfigGetFullPath("cfgWeapons " + cfg_class_name, full_path);
1413 }
1414
1415 if (full_path.Count() == 0)
1416 {
1417 ConfigGetFullPath("CfgNonAIVehicles " + cfg_class_name, full_path);
1418 }
1419
1420 cfg_parent_name.ToLower();
1421 for (int i = 0; i < full_path.Count(); i++)
1422 {
1423 string tmp = full_path.Get(i);
1424 tmp.ToLower();
1425 if (tmp == cfg_parent_name)
1426 {
1427 return true;
1428 }
1429 }
1430
1431 return false;
1432 }
1433
1446 bool ObjectIsKindOf(Object object, string cfg_parent_name)
1447 {
1448 TStringArray full_path = new TStringArray;
1449 ConfigGetObjectFullPath(object, full_path);
1450
1451 cfg_parent_name.ToLower();
1452
1453 for (int i = 0; i < full_path.Count(); i++)
1454 {
1455 string tmp = full_path.Get(i);
1456 tmp.ToLower();
1457 if (tmp == cfg_parent_name)
1458 {
1459 return true;
1460 }
1461 }
1462
1463 return false;
1464 }
1465
1474 int ConfigFindClassIndex(string config_path, string searched_member)
1475 {
1476 int class_count = ConfigGetChildrenCount(config_path);
1477 for (int index = 0; index < class_count; index++)
1478 {
1479 string found_class = "";
1480 ConfigGetChildName(config_path, index, found_class);
1481 if (found_class == searched_member)
1482 {
1483 return index;
1484 }
1485 }
1486 return -1;
1487 }
1488
1490 proto int GetTime();
1491
1505 ScriptCallQueue GetCallQueue(int call_category) {}
1506
1507 ScriptInvoker GetUpdateQueue(int call_category) {}
1508
1509 ScriptInvoker GetPostUpdateQueue(int call_category) {}
1517 TimerQueue GetTimerQueue(int call_category) {}
1518
1522 DragQueue GetDragQueue() {}
1523
1526
1529
1532
1534 {
1535 }
1536
1538
1541
1544 {
1545 return (g_Game.GetMissionState() == DayZGame.MISSION_STATE_MAINMENU);
1546 }
1547
1549 {
1550 //Print("GetMenuDefaultCharacterData");
1551 //DumpStack();
1552 //if used on server, creates an empty container to be filled by received data
1553 if (!m_CharacterData)
1554 {
1555 m_CharacterData = new MenuDefaultCharacterData;
1556 if (fill_data)
1557 GetGame().GetMenuData().RequestGetDefaultCharacterData(); //fills the structure
1558 }
1559 return m_CharacterData;
1560 }
1561
1562 //Analytics Manager
1564 {
1565 return m_AnalyticsManagerServer;
1566 }
1567
1569 {
1570 return m_AnalyticsManagerClient;
1571 }
1572};
#define LIQUID_SALTWATER
const int RF_DEFAULT
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
Static data holder for certain ammo config values.
Definition ammoeffects.c:6
Class that holds parameters to feed into CGame.IsBoxCollidingGeometryProxy.
float GetHighestSurfaceYDifference(array< vector > positions)
Returns the largest height difference between the given positions.
Definition game.c:1174
proto void SurfaceUnderObjectByBone(notnull Object object, int boneType, out string type, out int liquidType)
proto native void RestartMission()
proto native void ResetPPMask()
override void OnUpdate(bool doSim, float timeslice)
Definition dayzgame.c:2891
proto native bool IsBoxCollidingGeometry(vector center, vector orientation, vector edgeLength, int iPrimaryType, int iSecondaryType, array< Object > excludeObjects, array< Object > collidedObjects=NULL)
Finds all objects with geometry iType that are in choosen oriented bounding box (OBB)
void SurfaceUnderObjectByBoneCorrectedLiquid(notnull Object object, int boneType, out string type, out int liquidType)
Definition game.c:1248
override void OnActivateMessage()
Definition dayzgame.c:2046
proto native float SurfaceY(float x, float z)
override void OnDeactivateMessage()
Definition dayzgame.c:2052
proto native float SurfaceGetSeaLevelMax()
proto native void AddPPMask(float ndcX, float ndcY, float ndcRadius, float ndcBlur)
proto native float SurfaceGetSeaLevel()
proto native float GetWaterDepth(vector posWS)
proto native void GetPlayerIndentities(out array< PlayerIdentity > identities)
string CreateDefaultPlayer()
returns class name of first valid survivor (TODO address confusing naming?)
Definition game.c:1525
override void OnPostUpdate(bool doSim, float timeslice)
Definition dayzgame.c:2980
override void OnDeviceReset()
Definition dayzgame.c:2876
proto native bool IsBoxCollidingGeometryProxy(notnull BoxCollidingParams params, array< Object > excludeObjects, array< ref BoxCollidingResult > collidedObjects=NULL)
override void OnAfterCreate()
Definition dayzgame.c:2040
proto native bool IsMultiplayer()
proto native float SurfaceRoadY(float x, float z, RoadSurfaceDetection rsd=RoadSurfaceDetection.LEGACY)
proto native bool SurfaceIsSea(float x, float z)
DragQueue GetDragQueue()
Definition game.c:1522
bool IsKindOf(string cfg_class_name, string cfg_parent_name)
Returns is class name inherited from parent class name.
Definition game.c:1394
void SetDebugMonitorEnabled(int value)
Definition game.c:1137
proto native BiosUserManager GetUserManager()
proto native bool IsDebug()
override void OnKeyPress(int key)
Definition dayzgame.c:2782
bool IsSurfaceFertile(string surface)
Checks if the surface is fertile.
Definition game.c:1222
ScriptCallQueue GetCallQueue(int call_category)
Definition game.c:1505
int CorrectLiquidType(int liquidType)
Definition game.c:1227
proto native vector SurfaceGetNormal(float x, float z)
proto native void SetMainMenuWorld(string world)
proto native bool IsBoxColliding(vector center, vector orientation, vector edgeLength, array< Object > excludeObjects, array< Object > collidedObjects=NULL)
Finds all objects that are in choosen oriented bounding box (OBB)
proto float SurfaceGetType3D(float x, float y, float z, out string type)
Y input: Maximum Y to trace down from; Returns: Y position the surface was found.
bool ObjectIsKindOf(Object object, string cfg_parent_name)
Returns is object inherited from parent class name.
Definition game.c:1446
proto native void UpdatePathgraphRegion(vector regionMin, vector regionMax)
proto native void InitDamageEffects(Object effect)
Initialization of damage effects.
proto native bool IsServer()
bool IsSurfaceDigable(string surface)
Checks if the surface is digable.
Definition game.c:1211
void Connect()
Definition dayzgame.c:2645
void UpdatePathgraphRegionByObject(Object object)
Definition game.c:1254
bool IsDebugMonitor()
Definition game.c:1142
bool IsMissionMainMenu()
Returns true when current mission is Main Menu.
Definition game.c:1543
proto float SurfaceGetType(float x, float z, out string type)
Returns: Y position the surface was found.
proto native void OverrideInventoryLights(vector diffuse, vector ambient, vector ground, vector dir)
proto native void LogoutRequestTime()
Logout methods.
proto native bool SurfaceIsPond(float x, float z)
proto native void LogoutRequestCancel()
override void OnKeyRelease(int key)
Definition dayzgame.c:2821
proto native float SurfaceGetSeaLevelMin()
ScriptInvoker GetUpdateQueue(int call_category)
Definition game.c:1507
proto native owned string GetMainMenuWorld()
override void OnMouseButtonRelease(int button)
Definition dayzgame.c:2866
bool IsInventoryOpen()
Definition game.c:1533
proto native void OverrideDOF(bool enable, float focusDistance, float focusLength, float focusLengthNear, float blur, float focusDepthOffset)
override void OnMouseButtonPress(int button)
Definition dayzgame.c:2856
AnalyticsManagerServer GetAnalyticsServer()
Definition game.c:1563
proto native Weather GetWeather()
Returns weather controller object.
proto native bool GetSurface(SurfaceDetectionParameters params, SurfaceDetectionResult result)
API for surface detection.
TimerQueue GetTimerQueue(int call_category)
Definition game.c:1517
proto native bool IsDedicatedServer()
Robust check which is preferred than the above, as it is valid much sooner.
bool GetSurfaceDigPile(string surface, out string result)
Definition game.c:1216
proto native float SurfaceRoadY3D(float x, float y, float z, RoadSurfaceDetection rsd)
proto int GetTime()
returns mission time in milliseconds
proto native void NightVissionLightParams(float lightIntensityMul, float noiseIntensity)
proto native bool IsClient()
proto void SurfaceUnderObject(notnull Object object, out string type, out int liquidType)
proto native void RespawnPlayer()
vector GetSurfaceOrientation(float x, float z)
Returns tilt of the ground on the given position in degrees, so you can use this value to rotate any ...
Definition game.c:1198
native void CreateMission(string path)
Create only enforce script mission, used for mission script reloading.
AnalyticsManagerClient GetAnalyticsClient()
Definition game.c:1568
override bool OnInitialize()
Definition dayzgame.c:2058
void SurfaceUnderObjectCorrectedLiquid(notnull Object object, out string type, out int liquidType)
Definition game.c:1238
proto native float SurfaceGetNoiseMultiplier(Object directHit, vector pos, int componentIndex)
proto native EntityAI GetEntityByPersitentID(int b1, int b2, int b3, int b4)
proto native void OpenURL(string url)
override void OnRPC(PlayerIdentity sender, Object target, int rpc_type, ParamsReadContext ctx)
Definition dayzgame.c:3012
string CreateRandomPlayer()
returns class name of random survivor (TODO address confusing naming?)
Definition game.c:1528
static bool IsDigitalCopy()
Definition game.c:1126
proto native void SetLoginTimerFinished()
int ConfigFindClassIndex(string config_path, string searched_member)
Definition game.c:1474
proto native void SetEVUser(float value)
Sets custom camera camera EV. range: -50.0..50.0? //TODO.
void SurfaceUnderObjectExCorrectedLiquid(notnull Object object, out string type, out string impact, out int liquidType)
Definition game.c:1243
proto native void AbortMission()
Returns to main menu, leave world empty for using last mission world.
proto native int ServerConfigGetInt(string name)
Server config parsing. Returns 0 if not found.
proto void SurfaceUnderObjectEx(notnull Object object, out string type, out string impact, out int liquidType)
proto native ContentDLC GetContentDLCService()
Return DLC service (service for entitlement keys for unlock content)
ScriptInvoker GetPostUpdateQueue(int call_category)
Definition game.c:1509
MenuDefaultCharacterData GetMenuDefaultCharacterData(bool fill_data=true)
Definition game.c:1548
TStringArray ListAvailableCharacters()
outputs array of all valid survivor class names
Definition game.c:1531
proto native bool CanRespawnPlayer()
Definition chat.c:15
Super root of all classes in Enforce script.
Definition enscript.c:11
ContentDLC is for query installed DLC (only as entitlement keys, not content)
Definition contentdlc.c:11
Definition debug.c:2
Definition camera.c:2
GetServersResultRow the output structure of the GetServers operation that represents one game server.
Definition input.c:11
InventoryLocation.
TODO doc.
Definition enscript.c:118
Definition enmath.c:7
Mission class.
Definition gameplay.c:687
static bool IsGameActive(bool sim)
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
The class that will be instanced (moddable)
Definition gameplay.c:389
Manager class for managing Effect (EffectParticle, EffectSound)
static void Cleanup()
Cleanup method to properly clean up the static data.
static void InitServer()
static void Init()
Initialize the containers.
ScriptCallQueue Class provide "lazy" calls - when we don't want to execute function immediately but l...
Definition tools.c:53
ScriptInvoker Class provide list of callbacks usage:
Definition tools.c:116
Module containing compiled scripts.
Definition enscript.c:131
Serialization general interface. Serializer API works with:
Definition serializer.c:56
Definition world.c:2
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DayZGame g_Game
Definition dayzgame.c:3868
Mission mission
proto native CGame GetGame()
array< string > TStringArray
Definition enscript.c:709
const int LIQUID_NONE
Definition constants.c:529
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
void AbstractWave()
Definition sound.c:167
TypeID EventType
Definition enwidgets.c:55
Icon x
Icon y
class OptionSelectorMultistate extends OptionSelector class_name
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
int GetVersion()