DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
Game.c
Go to the documentation of this file.
1
5static int GAME_STORAGE_VERSION = 134;
6
7class CGame
8{
9 // enableDebugMonitor in server config
11
13
15
16 //analytics
20
21 #ifdef DIAG_DEVELOPER
22 ref array<ComponentEnergyManager> m_EnergyManagerArray;
23 void EnableEMPlugs(bool enable)
24 {
25 for (int i = 0; i < GetGame().m_EnergyManagerArray.Count(); ++i)
26 {
27 if (GetGame().m_EnergyManagerArray[i])
28 GetGame().m_EnergyManagerArray[i].SetDebugPlugs(enable);
29 }
30 }
31 #endif
32
33 void CGame()
34 {
35 Math.Randomize(-1);
36
39 m_ParamCache.Insert(null);
40
41 //analytics
44
45 //m_CharacterData = new MenuCharacrerData;
46
47 // actual script version - increase by one when you make changes
49
50 #ifdef DIAG_DEVELOPER
51 m_EnergyManagerArray = new array<ComponentEnergyManager>;
52 #endif
53
54 if (!IsDedicatedServer())
55 {
59 }
60 }
61
62 private void ~CGame()
63 {
64 // Clean these up even if it is dedicated server, just to be safe
68
69 // Is initialized in StartupEvent
70 ParticleManager.CleanupInstance();
71 }
72
75
77
82 void OnEvent(EventType eventTypeId, Param params)
83 {
84 }
85
86 //PLM Type: 0 == RESUMED, 1 == SUSPENDED
87 void OnProcessLifetimeChanged(int plmtype)
88 {
89
90 }
91
93 {
94
95 }
96
101 {
102 }
103
108 {
109 }
110
115 {
116 }
117
122 {
123 return false;
124 }
125
130 {
131 }
132
138 void OnUpdate(bool doSim, float timeslice)
139 {
140 }
141
147 void OnPostUpdate(bool doSim, float timeslice)
148 {
149 }
150
155 void OnKeyPress(int key)
156 {
157 }
158
163 void OnKeyRelease(int key)
164 {
165 }
166
171 void OnMouseButtonPress(int button)
172 {
173 }
174
179 void OnMouseButtonRelease(int button)
180 {
181 }
182
187
192
199 void OnRPC(PlayerIdentity sender, Object target, int rpc_type, ParamsReadContext ctx)
200 {
201 }
202
206 proto native void RequestExit( int code );
207
211 proto native void RequestRestart(int code);
212
216 proto bool GetHostAddress( out string address, out int port );
217
221 proto owned string GetHostName();
222
226 proto GetServersResultRow GetHostData();
227
235 proto native int Connect( UIScriptedMenu parent , string IpAddress, int port, string password );
240 proto native int ConnectLastSession( UIScriptedMenu parent , int selectedCharacter = -1 );
244 proto native void DisconnectSession();
245
249 proto native void DisconnectSessionForce();
250
251 // profile functions
262 proto native void GetProfileStringList(string name, out TStringArray values);
263
270 proto bool GetProfileString(string name, out string value);
271
277 proto native void SetProfileStringList(string name, TStringArray values);
278
284 proto native void SetProfileString(string name, string value);
285
289 proto native void SaveProfile();
290
295 proto void GetPlayerName(out string name);
296
302 proto void GetPlayerNameShort(int maxLength, out string name);
303
308 proto native void SetPlayerName(string name);
309
315 proto native Entity CreatePlayer(PlayerIdentity identity, string name, vector pos, float radius, string spec);
316
323 proto native void SelectPlayer(PlayerIdentity identity, Object player);
324
332 proto void GetPlayerNetworkIDByIdentityID( int playerIdentityID, out int networkIdLowBits, out int networkIdHightBits );
333
339 proto native Object GetObjectByNetworkId( int networkIdLowBits, int networkIdHighBits );
340
346 proto native bool RegisterNetworkStaticObject(Object object);
347
354 proto native void SelectSpectator(PlayerIdentity identity, string spectatorObjType, vector position);
355
360 proto native void UpdateSpectatorPosition(vector position);
361
368 proto native void SendLogoutTime(Object player, int time);
369
374 proto native void DisconnectPlayer(PlayerIdentity identity, string uid = "");
375
381 proto native void AddToReconnectCache(PlayerIdentity identity);
382
388 proto native void RemoveFromReconnectCache(string uid);
389
394 proto native void ClearReconnectCache();
395
396
400 proto native void StorageVersion( int iVersion );
401
405 proto native int LoadVersion();
406
410 proto native int SaveVersion();
411
415 proto native float GetDayTime();
416
417 // config functions
424 proto bool ConfigGetText(string path, out string value);
425
433 proto bool ConfigGetTextRaw(string path, out string value);
434
440 string ConfigGetTextOut(string path)
441 {
442 string ret_s;
443 ConfigGetText(path, ret_s);
444 return ret_s;
445 }
446
452 bool FormatRawConfigStringKeys(inout string value)
453 {
454 int ret;
455 ret = value.Replace("$STR_","#STR_");
456 return ret > 0;
457 }
458
465 {
466 if ( class_name != "" )
467 {
468 string cfg = "CfgVehicles " + class_name + " model";
469 string model_path;
470 if ( GetGame().ConfigGetText(cfg, model_path) )
471 {
472 int to_substring_end = model_path.Length() - 4; // -4 to leave out the '.p3d' suffix
473 int to_substring_start = 0;
474
475 // 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
476 for (int i = to_substring_end; i > 0; i--)
477 {
478 string sign = model_path.Get(i);
479 if ( sign == "\\" )
480 {
481 to_substring_start = i + 1;
482 break
483 }
484 }
485
486 string model_name = model_path.Substring(to_substring_start, to_substring_end - to_substring_start);
487 return model_name;
488 }
489 }
490
491 return "UNKNOWN_P3D_FILE";
492 }
493
499 proto native float ConfigGetFloat(string path);
500
501
507 proto native vector ConfigGetVector(string path);
508
514 proto native int ConfigGetInt(string path);
515
521 proto native int ConfigGetType(string path);
522
533 proto native void ConfigGetTextArray(string path, out TStringArray values);
534
546 proto native void ConfigGetTextArrayRaw(string path, out TStringArray values);
547
553 proto native void ConfigGetFloatArray(string path, out TFloatArray values);
554
560 proto native void ConfigGetIntArray(string path, out TIntArray values);
561
569 proto bool ConfigGetChildName(string path, int index, out string name);
570
577 proto bool ConfigGetBaseName(string path, out string base_name);
578
586 proto native int ConfigGetChildrenCount(string path);
587 proto native bool ConfigIsExisting(string path);
588
589 proto native void ConfigGetFullPath(string path, out TStringArray full_path);
590 proto native void ConfigGetObjectFullPath(Object obj, out TStringArray full_path);
591
592 proto native void GetModInfos(notnull out array<ref ModInfo> modArray);
593 proto native bool GetModToBeReported();
594
604 {
605 string return_path = "";
606 int count = array_path.Count();
607
608 for (int i = 0; i < count; i++)
609 {
610 return_path += array_path.Get(i);
611
612 if ( i < count - 1 )
613 {
614 return_path += " ";
615 }
616 }
617
618 return return_path;
619 }
620
636 proto bool CommandlineGetParam(string name, out string value);
637
638 proto native void CopyToClipboard(string text);
639 proto void CopyFromClipboard(out string text);
640
641 proto native void BeginOptionsVideo();
642 proto native void EndOptionsVideo();
643
644 proto native void AdminLog(string text);
645
646 // entity functions
653 proto native bool PreloadObject( string type, float distance );
654
655 proto native Object CreateStaticObjectUsingP3D(string p3dFilename, vector position, vector orientation, float scale = 1.0, bool createLocal = false);
656
666 proto native Object CreateObject( string type, vector pos, bool create_local = false, bool init_ai = false, bool create_physics = true );
667 proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local = false);
668 proto native SoundWaveOnVehicle CreateSoundWaveOnObject(Object source, SoundObject soundObject, AbstractWave soundWave);
669
678 proto native Object CreateObjectEx( string type, vector pos, int iFlags, int iRotation = RF_DEFAULT );
679
680 proto native void ObjectDelete( Object obj );
681 proto native void ObjectDeleteOnClient( Object obj );
682 proto native void RemoteObjectDelete( Object obj );
683 proto native void RemoteObjectTreeDelete( Object obj );
684 proto native void RemoteObjectCreate( Object obj );
685 proto native void RemoteObjectTreeCreate( Object obj );
686 proto native int ObjectRelease( Object obj );
687 proto void ObjectGetType( Object obj, out string type );
688 proto void ObjectGetDisplayName( Object obj, out string name );
689 proto native vector ObjectGetSelectionPosition(Object obj, string name);
693 proto native vector ObjectModelToWorld(Object obj, vector modelPos);
694 proto native vector ObjectWorldToModel(Object obj, vector worldPos);
696 proto native bool IsObjectAccesible(EntityAI item, Man player);
697
698 // input
699 proto native Input GetInput();
700
701 // camera
704
705 // sound
707
708 // noise
710
711 // inventory
712 proto native bool AddInventoryJuncture(Man player, notnull EntityAI item, InventoryLocation dst, bool test_dst_occupancy, int timeout_ms);
713
714 bool AddInventoryJunctureEx(Man player, notnull EntityAI item, InventoryLocation dst, bool test_dst_occupancy, int timeout_ms)
715 {
716 bool result = AddInventoryJuncture(player, item, dst, test_dst_occupancy, timeout_ms/*10000000*/);
717 #ifdef DEVELOPER
719 {
720 Debug.InventoryReservationLog("STS = " + player.GetSimulationTimeStamp() + " result: " + result + " item:" + item + " dst: " + InventoryLocation.DumpToStringNullSafe(dst), "n/a" , "n/a", "AddInventoryJuncture",player.ToString() );
721 }
722 #endif
723 //Print("Juncture - STS = " + player.GetSimulationTimeStamp() + " item:" + item + " dst: " + InventoryLocation.DumpToStringNullSafe(dst));
724 return result;
725 }
726
727 //Has inventory juncture for any player
728 proto native bool HasInventoryJunctureItem(notnull EntityAI item);
729
730 proto native bool HasInventoryJunctureDestination(Man player, notnull InventoryLocation dst);
731 proto native bool AddActionJuncture(Man player, notnull EntityAI item, int timeout_ms);
732 proto native bool ExtendActionJuncture(Man player, notnull EntityAI item, int timeout_ms);
733 proto native bool ClearJuncture(Man player, notnull EntityAI item);
734
735 bool ClearJunctureEx(Man player, notnull EntityAI item)
736 {
737 #ifdef DEVELOPER
739 {
740 Debug.InventoryReservationLog("STS = " + player.GetSimulationTimeStamp()+ " item:" + item, "n/a" , "n/a", "ClearJuncture",player.ToString() );
741 }
742 #endif
743 return ClearJuncture( player, item);
744 }
745
746 // support
748 proto native bool ExecuteEnforceScript(string expression, string mainFnName);
750 proto native void DumpInstances(bool csvFormatting);
751
752 proto native bool ScriptTest();
754 proto native void GetDiagModeNames(out TStringArray diag_names);
756 proto native void SetDiagModeEnable(int diag_mode, bool enabled);
758 proto native bool GetDiagModeEnable(int diag_mode);
759
761 proto native void GetDiagDrawModeNames(out TStringArray diag_names);
763 proto native void SetDiagDrawMode(int diag_draw_mode);
765 proto native int GetDiagDrawMode();
766
768 proto native bool IsPhysicsExtrapolationEnabled();
769
774 proto native float GetFps();
775
780 proto native float GetTickTime();
781
782 proto void GetInventoryItemSize(InventoryItem item, out int width, out int height);
789 proto native void GetObjectsAtPosition(vector pos, float radius, out array<Object> objects, out array<CargoBase> proxyCargos);
796 proto native void GetObjectsAtPosition3D(vector pos, float radius, out array<Object> objects, out array<CargoBase> proxyCargos);
797 proto native World GetWorld();
798 proto void GetWorldName( out string world_name );
799
801 {
802 string world_name;
803 g_Game.GetWorldName(world_name);
804 return world_name;
805 }
806
807 proto native bool VerifyWorldOwnership( string sWorldName );
808 proto native bool GoBuyWorldDLC( string sWorldName );
809
810 proto void FormatString( string format, string params[], out string output);
811 proto void GetVersion( out string version );
812 proto native UIManager GetUIManager();
813 proto native DayZPlayer GetPlayer();
814 proto native void GetPlayers( out array<Man> players );
816 {
817 array<Man> players();
818 GetPlayers(players);
819 if (index >= players.Count())
820 return null;
821 return DayZPlayer.Cast(players[index]);
822 }
823
825 proto native void StoreLoginData(ParamsWriteContext ctx);
826
832 proto native vector GetScreenPos(vector world_pos);
834 proto native vector GetScreenPosRelative(vector world_pos);
835
837 proto native MenuData GetMenuData();
880 proto native void RPC(Object target, int rpcType, notnull array<ref Param> params, bool guaranteed,PlayerIdentity recipient = null);
882 void RPCSingleParam(Object target, int rpc_type, Param param, bool guaranteed, PlayerIdentity recipient = null)
883 {
884 m_ParamCache.Set(0, param);
885 RPC(target, rpc_type, m_ParamCache, guaranteed, recipient);
886 }
888 proto native void RPCSelf(Object target, int rpcType, notnull array<ref Param> params);
889 void RPCSelfSingleParam(Object target, int rpcType, Param param)
890 {
891 m_ParamCache.Set(0, param);
892 RPCSelf(target, rpcType, m_ParamCache);
893 }
894
896 proto native void ProfilerStart(string name);
898 proto native void ProfilerStop(string name);
899
900
910 proto native void Chat(string text, string colorClass);
911 proto native void ChatMP(Man recipient, string text, string colorClass);
912 proto native void ChatPlayer(string text);
918 proto native void MutePlayer(string muteUID, string playerUID, bool mute);
919
925 proto native void MuteAllPlayers(string listenerId, bool mute);
926
932 proto native void EnableVoN(Object player, bool enable);
933
940 proto native void SetVoiceEffect(Object player, int effect, bool enable);
941
946 proto native void SetVoiceLevel(int level);
947
951 proto native int GetVoiceLevel(Object player = null);
952
957 proto native void EnableMicCapture(bool enable);
958
962 proto native bool IsMicCapturing();
963
967 proto native bool IsInPartyChat();
968
969 // mission
970 proto native Mission GetMission();
971 proto native void SetMission(Mission mission);
972
973
975 proto native void StartRandomCutscene(string world);
977 proto native void PlayMission(string path);
978
980 proto protected native void CreateMission(string path);
981 proto native void RestartMission();
983 proto native void AbortMission();
984 proto native void RespawnPlayer();
985 proto native bool CanRespawnPlayer();
986
987 proto native void SetMainMenuWorld(string world);
988 proto native owned string GetMainMenuWorld();
989
991 proto native void LogoutRequestTime();
992 proto native void LogoutRequestCancel();
993
994 proto native bool IsMultiplayer();
995 proto native bool IsClient();
996 proto native bool IsServer();
1001 proto native bool IsDedicatedServer();
1002
1004 proto native int ServerConfigGetInt(string name);
1005
1006 // Internal build
1007 proto native bool IsDebug();
1008
1009//#ifdef PLATFORM_XBOX
1010 static bool IsDigitalCopy()
1011 {
1012 return OnlineServices.IsGameActive(false);
1013 }
1014//#endif
1015
1016 /*bool IsNewMenu()
1017 {
1018 return m_ParamNewMenu;
1019 }*/
1020
1022 {
1023 m_DebugMonitorEnabled = value;
1024 }
1025
1027 {
1028 return IsServer() && m_DebugMonitorEnabled;
1029 }
1030
1031 proto native void GetPlayerIndentities( out array<PlayerIdentity> identities );
1032
1033 proto native float SurfaceY(float x, float z);
1034 proto native float SurfaceRoadY(float x, float z);
1035 proto void SurfaceGetType(float x, float z, out string type);
1036 proto void SurfaceGetType3D(float x, float y, float z, out string type);
1037 proto void SurfaceUnderObject(notnull Object object, out string type, out int liquidType);
1038 proto void SurfaceUnderObjectEx(notnull Object object, out string type, out string impact, out int liquidType);
1039 proto void SurfaceUnderObjectByBone(notnull Object object, int boneType, out string type, out int liquidType);
1040 proto native float SurfaceGetNoiseMultiplier(Object directHit, vector pos, int componentIndex);
1041 proto native vector SurfaceGetNormal(float x, float z);
1042 proto native float SurfaceGetSeaLevel();
1043 proto native bool SurfaceIsSea(float x, float z);
1044 proto native bool SurfaceIsPond(float x, float z);
1045 proto native float GetWaterDepth(vector posWS);
1046
1047 proto native void UpdatePathgraphRegion(vector regionMin, vector regionMax);
1048
1051 {
1052 float high = -9999999;
1053 float low = 99999999;
1054
1055 for (int i = 0; i < positions.Count(); i++)
1056 {
1057 vector pos = positions.Get(i);
1058 pos[1] = SurfaceRoadY( pos[0], pos[2]);
1059 float y = pos[1];
1060
1061 if ( y > high )
1062 high = y;
1063
1064 if ( y < low )
1065 low = y;
1066
1067 ;
1068 }
1069
1070 return high - low;
1071 }
1072
1075 {
1076 vector normal = GetGame().SurfaceGetNormal(x, z);
1077 vector angles = normal.VectorToAngles();
1078 angles[1] = angles[1]+270; // This fixes rotation of item so it stands vertically. Feel free to change, but fix existing use cases.
1079
1080 //Hack because setorientation and similar functions break and flip stuff upside down when using exactly this vector ยฏ\_(ใƒ„)_/ยฏ (note: happens when surface is flat)
1081 if (angles == "0 540 0")
1082 angles = "0 0 0";
1083 return angles;
1084 }
1085
1087 bool IsSurfaceDigable(string surface)
1088 {
1089 return ConfigGetInt("CfgSurfaces " + surface + " isDigable");
1090 }
1091
1093 bool IsSurfaceFertile(string surface)
1094 {
1095 return ConfigGetInt("CfgSurfaces " + surface + " isFertile");
1096 }
1097
1099 {
1100 if ( object )
1101 {
1102 vector pos = object.GetPosition();
1103 vector min_max[2];
1104 float radius = object.ClippingInfo ( min_max );
1105 vector min = Vector ( pos[0] - radius, pos[1], pos[2] - radius );
1106 vector max = Vector ( pos[0] + radius, pos[1], pos[2] + radius );
1107 UpdatePathgraphRegion( min, max );
1108 }
1109 }
1110
1138 proto native bool IsBoxColliding(vector center, vector orientation, vector edgeLength, array<Object> excludeObjects, array<Object> collidedObjects = NULL);
1139
1170 proto native bool IsBoxCollidingGeometry(vector center, vector orientation, vector edgeLength, int iPrimaryType, int iSecondaryType, array<Object> excludeObjects, array<Object> collidedObjects = NULL);
1171
1172 proto native bool IsBoxCollidingGeometryProxy(notnull BoxCollidingParams params, array<Object> excludeObjects, array<ref BoxCollidingResult> collidedObjects = NULL);
1173
1175 proto native Weather GetWeather();
1176
1178 proto native void SetEVUser(float value);
1179
1180 proto native void OverrideDOF(bool enable, float focusDistance, float focusLength, float focusLengthNear, float blur, float focusDepthOffset);
1181
1182 proto native void AddPPMask(float ndcX, float ndcY, float ndcRadius, float ndcBlur);
1183
1184 proto native void ResetPPMask();
1185
1193 proto native void OverrideInventoryLights(vector diffuse, vector ambient, vector ground, vector dir);
1194
1200 proto native void NightVissionLightParams(float lightIntensityMul, float noiseIntensity);
1201
1202
1203 proto native void OpenURL(string url);
1204
1206 proto native void InitDamageEffects(Object effect);
1207
1208//-----------------------------------------------------------------------------
1209// persitence
1210//-----------------------------------------------------------------------------
1211
1214
1222 proto native EntityAI GetEntityByPersitentID( int b1, int b2, int b3, int b4 );
1223
1224//-----------------------------------------------------------------------------
1225
1238 bool IsKindOf(string cfg_class_name, string cfg_parent_name)
1239 {
1240 TStringArray full_path = new TStringArray;
1241
1242 ConfigGetFullPath("CfgVehicles " + cfg_class_name, full_path);
1243
1244 if (full_path.Count() == 0)
1245 {
1246 ConfigGetFullPath("CfgAmmo " + cfg_class_name, full_path);
1247 }
1248
1249 if (full_path.Count() == 0)
1250 {
1251 ConfigGetFullPath("CfgMagazines " + cfg_class_name, full_path);
1252 }
1253
1254 if (full_path.Count() == 0)
1255 {
1256 ConfigGetFullPath("cfgWeapons " + cfg_class_name, full_path);
1257 }
1258
1259 if (full_path.Count() == 0)
1260 {
1261 ConfigGetFullPath("CfgNonAIVehicles " + cfg_class_name, full_path);
1262 }
1263
1264 cfg_parent_name.ToLower();
1265 for (int i = 0; i < full_path.Count(); i++)
1266 {
1267 string tmp = full_path.Get(i);
1268 tmp.ToLower();
1269 if (tmp == cfg_parent_name)
1270 {
1271 return true;
1272 }
1273 }
1274
1275 return false;
1276 }
1277
1290 bool ObjectIsKindOf(Object object, string cfg_parent_name)
1291 {
1292 TStringArray full_path = new TStringArray;
1293 ConfigGetObjectFullPath(object, full_path);
1294
1295 cfg_parent_name.ToLower();
1296
1297 for (int i = 0; i < full_path.Count(); i++)
1298 {
1299 string tmp = full_path.Get(i);
1300 tmp.ToLower();
1301 if (tmp == cfg_parent_name)
1302 {
1303 return true;
1304 }
1305 }
1306
1307 return false;
1308 }
1309
1318 int ConfigFindClassIndex(string config_path, string searched_member)
1319 {
1320 int class_count = ConfigGetChildrenCount(config_path);
1321 for (int index = 0; index < class_count; index++)
1322 {
1323 string found_class = "";
1324 ConfigGetChildName(config_path, index, found_class);
1325 if (found_class == searched_member)
1326 {
1327 return index;
1328 }
1329 }
1330 return -1;
1331 }
1332
1334 proto int GetTime();
1335
1349 ScriptCallQueue GetCallQueue(int call_category) {}
1350
1351 ScriptInvoker GetUpdateQueue(int call_category) {}
1352
1353 ScriptInvoker GetPostUpdateQueue(int call_category) {}
1361 TimerQueue GetTimerQueue(int call_category) {}
1362
1366 DragQueue GetDragQueue() {}
1367
1370
1373
1376
1378 {
1379 }
1380
1382
1385
1388 {
1389 return (g_Game.GetMissionState() == DayZGame.MISSION_STATE_MAINMENU);
1390 }
1391
1393 {
1394 //Print("GetMenuDefaultCharacterData");
1395 //DumpStack();
1396 //if used on server, creates an empty container to be filled by received data
1397 if (!m_CharacterData)
1398 {
1400 if (fill_data)
1401 GetGame().GetMenuData().RequestGetDefaultCharacterData(); //fills the structure
1402 }
1403 return m_CharacterData;
1404 }
1405
1406 //Analytics Manager
1408 {
1410 }
1411
1413 {
1415 }
1416};
const int RF_DEFAULT
DayZGame g_Game
Definition DayZGame.c:3654
Mission mission
static int GAME_STORAGE_VERSION
Definition Game.c:5
Icon x
Icon y
class OptionSelectorMultistate extends OptionSelector class_name
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
string name
enum WaveKind AbstractSoundScene()
Definition Sound.c:18
class SoundObjectBuilder SoundObject(SoundParams soundParams)
Static data holder for certain ammo config values.
Definition AmmoEffects.c:6
static void Init()
Initialize the containers: this is done this way, to have these not exist on server.
static void Cleanup()
Clean up the data.
Class that holds parameters to feed into CGame.IsBoxCollidingGeometryProxy.
void OnPostUpdate(bool doSim, float timeslice)
Called on World update after simulation of entities.
Definition Game.c:147
proto native void RemoveFromReconnectCache(string uid)
Remove player from reconnect cache.
UIScriptedMenu CreateScriptedMenu(int id)
create custom main menu part (submenu)
Definition Game.c:186
proto native void RemoteObjectDelete(Object obj)
proto native bool RegisterNetworkStaticObject(Object object)
Static objects cannot be replicated by default (there are too many objects on the map)....
proto void SurfaceUnderObject(notnull Object object, out string type, out int liquidType)
proto native void RespawnPlayer()
proto void GetVersion(out string version)
proto native bool PreloadObject(string type, float distance)
Preload objects with certain type in certain distance from camera.
proto native void ObjectDelete(Object obj)
proto native void SetEVUser(float value)
Sets custom camera camera EV. range: -50.0..50.0? //TODO.
proto native void SetVoiceLevel(int level)
Set voice level of VoN (only on client) (VoiceLevelWhisper = 0, VoiceLevelNormal = 1,...
proto native void SetVoiceEffect(Object player, int effect, bool enable)
Enable/disable VoN effect (only on server)
proto void GetWorldName(out string world_name)
proto native float GetDayTime()
Returns current daytime on server.
proto native bool SurfaceIsPond(float x, float z)
proto native vector GetCurrentCameraDirection()
string GetWorldName()
Definition Game.c:800
proto native int LoadVersion()
Returns actual storage version - loading.
proto native vector ConfigGetVector(string path)
Get vector value from config on path.
proto native void RemoteObjectTreeDelete(Object obj)
RemoteObjectDelete - deletes only remote object (unregisters from network). do not use if not sure wh...
proto native void GetDiagModeNames(out TStringArray diag_names)
Get list of all debug modes.
proto native bool VerifyWorldOwnership(string sWorldName)
proto native vector ObjectGetSelectionPosition(Object obj, string name)
void OnAfterCreate()
Called after creating of CGame instance.
Definition Game.c:100
proto native void AddToReconnectCache(PlayerIdentity identity)
Add player to reconnect cache to be able to rejoin character still existing in the world.
proto native vector ObjectGetSelectionPositionWS(Object obj, string name)
proto native bool IsDedicatedServer()
Robust check which is preferred than the above, as it is valid much sooner.
TimerQueue GetTimerQueue(int call_category)
Definition Game.c:1361
proto native void SelectSpectator(PlayerIdentity identity, string spectatorObjType, vector position)
Creates spectator object (mostly cameras)
bool AddInventoryJunctureEx(Man player, notnull EntityAI item, InventoryLocation dst, bool test_dst_occupancy, int timeout_ms)
Definition Game.c:714
proto native int ServerConfigGetInt(string name)
Server config parsing. Returns 0 if not found.
proto void GetInventoryItemSize(InventoryItem item, out int width, out int height)
proto native vector ObjectWorldToModel(Object obj, vector worldPos)
proto native bool IsBoxCollidingGeometryProxy(notnull BoxCollidingParams params, array< Object > excludeObjects, array< ref BoxCollidingResult > collidedObjects=NULL)
proto native float GetWaterDepth(vector posWS)
proto native void UpdateSpectatorPosition(vector position)
Updates spectator position on server = position of network bubble.
proto native Mission GetMission()
proto native void EndOptionsVideo()
bool IsInventoryOpen()
Definition Game.c:1377
float GetHighestSurfaceYDifference(array< vector > positions)
Returns the largest height difference between the given positions.
Definition Game.c:1050
AnalyticsManagerServer GetAnalyticsServer()
Definition Game.c:1407
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto void SurfaceGetType(float x, float z, out string type)
proto native void RPC(Object target, int rpcType, notnull array< ref Param > params, bool guaranteed, PlayerIdentity recipient=null)
Initiate remote procedure call. When called on client, RPC is evaluated on server; When called on ser...
proto native void InitDamageEffects(Object effect)
Initialization of damage effects.
proto native void ChatPlayer(string text)
void OnMouseButtonPress(int button)
Called when mouse button is pressed.
Definition Game.c:171
ScriptInvoker GetPostUpdateQueue(int call_category)
Definition Game.c:1353
proto native vector SurfaceGetNormal(float x, float z)
proto void SurfaceUnderObjectEx(notnull Object object, out string type, out string impact, out int liquidType)
proto native bool GetModToBeReported()
proto native void MuteAllPlayers(string listenerId, bool mute)
Mute all players for listenerId.
proto bool GetHostAddress(out string address, out int port)
Gets the server address. (from client)
proto native void Chat(string text, string colorClass)
Prints text into game chat.
proto void CopyFromClipboard(out string text)
private ref array< ref Param > m_ParamCache
Definition Game.c:14
proto native float SurfaceGetSeaLevel()
proto native void StartRandomCutscene(string world)
Starts intro.
proto native bool ClearJuncture(Man player, notnull EntityAI item)
MenuDefaultCharacterData GetMenuDefaultCharacterData(bool fill_data=true)
Definition Game.c:1392
proto void SurfaceGetType3D(float x, float y, float z, out string type)
proto native void ConfigGetFloatArray(string path, out TFloatArray values)
Get array of floats from config on path.
proto void GetPlayerNameShort(int maxLength, out string name)
Gets current player name. If length of player name is grater than maxLength, then it is omitted and a...
proto native Object CreateObjectEx(string type, vector pos, int iFlags, int iRotation=RF_DEFAULT)
Creates object of certain type.
proto native void DisconnectSessionForce()
Forces disconnect from current multiplayer session even if not yet in the game.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
proto bool ConfigGetBaseName(string path, out string base_name)
Get name of base class of config class on path.
proto native int ConnectLastSession(UIScriptedMenu parent, int selectedCharacter=-1)
Connects to last success network session.
proto native vector GetWorldDirectionFromScreen(vector world_pos)
Transforms position in world to position in screen in pixels as x, y component of vector,...
proto native int Connect(UIScriptedMenu parent, string IpAddress, int port, string password)
Connects to IsServer.
proto native Object CreateStaticObjectUsingP3D(string p3dFilename, vector position, vector orientation, float scale=1.0, bool createLocal=false)
proto native vector ObjectGetSelectionPositionMS(Object obj, string name)
DayZPlayer GetPlayerByIndex(int index=0)
Definition Game.c:815
proto native void CopyToClipboard(string text)
proto native int SaveVersion()
Returns actual storage version - saving.
ref AnalyticsManagerClient m_AnalyticsManagerClient
Definition Game.c:18
ScriptInvoker GetUpdateQueue(int call_category)
Definition Game.c:1351
proto native Input GetInput()
proto native void SetPlayerName(string name)
Sets current player name.
bool IsSurfaceDigable(string surface)
Checks if the surface is digable.
Definition Game.c:1087
proto native void ConfigGetIntArray(string path, out TIntArray values)
Get array of integers from config on path.
proto native void OverrideInventoryLights(vector diffuse, vector ambient, vector ground, vector dir)
proto native void SelectPlayer(PlayerIdentity identity, Object player)
Selects player's controlled object.
proto native bool ScriptTest()
proto native bool AddInventoryJuncture(Man player, notnull EntityAI item, InventoryLocation dst, bool test_dst_occupancy, int timeout_ms)
static bool IsDigitalCopy()
Definition Game.c:1010
proto native void GetPlayers(out array< Man > players)
proto native void StorageVersion(int iVersion)
Set actual storage version - for next save.
proto void FormatString(string format, string params[], out string output)
string CreateDefaultPlayer()
returns class name of first valid survivor (TODO address confusing naming?)
Definition Game.c:1369
proto native Object CreateObject(string type, vector pos, bool create_local=false, bool init_ai=false, bool create_physics=true)
Creates object of certain type.
void RPCSelfSingleParam(Object target, int rpcType, Param param)
Definition Game.c:889
string ConfigPathToString(TStringArray array_path)
Converts array of strings into single string.
Definition Game.c:603
proto native AbstractSoundScene GetSoundScene()
proto native void ProfilerStop(string name)
Use for profiling code from start to stop, they must match have same name, look wiki pages for more i...
bool IsMissionMainMenu()
Returns true when current mission is Main Menu.
Definition Game.c:1387
proto native void SetMission(Mission mission)
proto native WorkspaceWidget GetLoadingWorkspace()
proto native DayZPlayer GetPlayer()
proto native void GetProfileStringList(string name, out TStringArray values)
Gets array of strings from profile variable.
string GetModelName(string class_name)
Get name of the p3d file of the given class name.
Definition Game.c:464
proto bool ConfigGetText(string path, out string value)
Get string value from config on path.
string CreateRandomPlayer()
returns class name of random survivor (TODO address confusing naming?)
Definition Game.c:1372
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
void OnUpdate(bool doSim, float timeslice)
Called on World update.
Definition Game.c:138
proto native ContentDLC GetContentDLCService()
Return DLC service (service for entitlement keys for unlock content)
proto native void RequestExit(int code)
Sets exit code and quits in the right moment.
void OnLicenseChanged()
Definition Game.c:92
proto native void SetProfileString(string name, string value)
Sets string to profile variable.
proto native void GetPlayerIndentities(out array< PlayerIdentity > identities)
proto native float SurfaceRoadY(float x, float z)
proto native void ConfigGetObjectFullPath(Object obj, out TStringArray full_path)
proto void GetPlayerName(out string name)
Gets current player name.
proto native bool ExtendActionJuncture(Man player, notnull EntityAI item, int timeout_ms)
proto native bool SurfaceIsSea(float x, float z)
proto native void AddPPMask(float ndcX, float ndcY, float ndcRadius, float ndcBlur)
void OnRPC(PlayerIdentity sender, Object target, int rpc_type, ParamsReadContext ctx)
Called after remote procedure call is recieved for this object.
Definition Game.c:199
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
AnalyticsManagerClient GetAnalyticsClient()
Definition Game.c:1412
proto native void BeginOptionsVideo()
proto native void ProfilerStart(string name)
Use for profiling code from start to stop, they must match have same name, look wiki pages for more i...
proto native void DisconnectPlayer(PlayerIdentity identity, string uid="")
Destroy player info and disconnect.
ScriptCallQueue GetCallQueue(int call_category)
Definition Game.c:1349
proto native MenuData GetMenuData()
Return singleton of MenuData class - at main menu contains characters played with current profile.
proto native void MutePlayer(string muteUID, string playerUID, bool mute)
Mutes voice of source player to target player.
int m_DebugMonitorEnabled
Definition Game.c:10
proto native int ConfigGetInt(string path)
Get int value from config on path.
ref AnalyticsManagerServer m_AnalyticsManagerServer
Definition Game.c:17
proto native float GetFps()
Returns average FPS of last 16 frames.
proto native float SurfaceGetNoiseMultiplier(Object directHit, vector pos, int componentIndex)
void OnDeviceReset()
Called when inputs is not possible (Steam overlay active or something), all internal script variables...
Definition Game.c:129
proto native bool GetDiagModeEnable(int diag_mode)
Gets state of specific debug mode.
proto native Object GetObjectByNetworkId(int networkIdLowBits, int networkIdHighBits)
Returns entity identified by network id.
proto native World GetWorld()
bool IsDebugMonitor()
Definition Game.c:1026
proto bool GetProfileString(string name, out string value)
Gets string from profile variable.
proto native void GetDiagDrawModeNames(out TStringArray diag_names)
Get list of all debug draw modes.
proto native bool ConfigIsExisting(string path)
proto void SurfaceUnderObjectByBone(notnull Object object, int boneType, out string type, out int liquidType)
int ConfigFindClassIndex(string config_path, string searched_member)
Definition Game.c:1318
proto native bool IsObjectAccesible(EntityAI item, Man player)
returns true if player can access item's cargo/attachments (check only distance)
bool OnInitialize()
Called once before game update loop starts, ret value indicates if init was done in scripts,...
Definition Game.c:121
proto native void SetDiagModeEnable(int diag_mode, bool enabled)
Set specific debug mode.
ref MenuDefaultCharacterData m_CharacterData
Definition Game.c:19
proto native bool IsClient()
proto native bool IsServer()
proto native vector ObjectGetSelectionPositionLS(Object obj, string name)
proto native bool AddActionJuncture(Man player, notnull EntityAI item, int timeout_ms)
void OnKeyPress(int key)
Called when key is pressed.
Definition Game.c:155
proto native void RemoteObjectCreate(Object obj)
RemoteObjectDelete - deletes only remote object tree (unregisters from network). do not use if not su...
proto native bool GoBuyWorldDLC(string sWorldName)
void OnKeyRelease(int key)
Called when key is released.
Definition Game.c:163
void RPCSingleParam(Object target, int rpc_type, Param param, bool guaranteed, PlayerIdentity recipient=null)
see CGame.RPC
Definition Game.c:882
proto native void EnableVoN(Object player, bool enable)
Enable/disable VoN for target player.
bool IsKindOf(string cfg_class_name, string cfg_parent_name)
Returns is class name inherited from parent class name.
Definition Game.c:1238
void SetDebugMonitorEnabled(int value)
Definition Game.c:1021
bool ObjectIsKindOf(Object object, string cfg_parent_name)
Returns is object inherited from parent class name.
Definition Game.c:1290
proto native int GetDiagDrawMode()
Gets current debug draw mode.
proto native vector GetScreenPos(vector world_pos)
Transforms position in world to position in screen in pixels as x, y component of vector,...
proto native void RestartMission()
proto native int ObjectRelease(Object obj)
RemoteObjectTreeCreate - postponed registration of network object tree (and creation of remote object...
proto native bool IsMicCapturing()
Returns whether mic is currently capturing audio from user.
proto native void GetModInfos(notnull out array< ref ModInfo > modArray)
proto bool ConfigGetTextRaw(string path, out string value)
Get raw string value from config on path.
proto native void ClearReconnectCache()
Remove all player from reconnect cache.
proto protected native void CreateMission(string path)
Create only enforce script mission, used for mission script reloading.
bool FormatRawConfigStringKeys(inout string value)
Changes localization key format to script-friendly format.
Definition Game.c:452
bool ClearJunctureEx(Man player, notnull EntityAI item)
Definition Game.c:735
proto native void UpdatePathgraphRegion(vector regionMin, vector regionMax)
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto bool CommandlineGetParam(string name, out string value)
Get command line parameter value.
proto native void DisconnectSession()
Disconnects from current multiplayer session.
proto native SoundWaveOnVehicle CreateSoundWaveOnObject(Object source, SoundObject soundObject, AbstractWave soundWave)
proto native void SendLogoutTime(Object player, int time)
Inform client about logout time (creates logout screen on specified client)
proto native void AdminLog(string text)
proto native bool IsMultiplayer()
proto native BiosUserManager GetUserManager()
proto native void ResetPPMask()
proto native void NightVissionLightParams(float lightIntensityMul, float noiseIntensity)
proto native owned string GetMainMenuWorld()
proto void ObjectGetType(Object obj, out string type)
DragQueue GetDragQueue()
Definition Game.c:1366
void OnActivateMessage()
Called when recieving focus (windows)
Definition Game.c:107
proto native vector ObjectModelToWorld(Object obj, vector modelPos)
void UpdatePathgraphRegionByObject(Object object)
Definition Game.c:1098
proto native vector GetPointerDirection()
Returns the direction where the mouse points, from the camera view.
proto native void OpenURL(string url)
proto native void ConfigGetTextArrayRaw(string path, out TStringArray values)
Get array of raw strings from config on path.
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)
UIScriptedWindow CreateScriptedWindow(int id)
create custom window part
Definition Game.c:191
proto native UIManager GetUIManager()
void OnEvent(EventType eventTypeId, Param params)
Called when some system event occur.
Definition Game.c:82
proto void GetPlayerNetworkIDByIdentityID(int playerIdentityID, out int networkIdLowBits, out int networkIdHightBits)
returns player's network id from identity id in out parameters
void DayZGame()
Definition DayZGame.c:965
proto native Weather GetWeather()
Returns weather controller object.
proto native void RequestRestart(int code)
Sets exit code and restart in the right moment.
proto native vector GetCurrentCameraPosition()
void CGame()
Definition Game.c:33
void OnDeactivateMessage()
Called when loosing focus (windows)
Definition Game.c:114
proto native void ChatMP(Man recipient, string text, string colorClass)
proto native void DumpInstances(bool csvFormatting)
Delevoper only: Dump all script allocations.
proto native Entity CreatePlayer(PlayerIdentity identity, string name, vector pos, float radius, string spec)
Assign player entity to client (in multiplayer)
proto native void RemoteObjectTreeCreate(Object obj)
RemoteObjectCreate - postponed registration of network object (and creation of remote object)....
proto GetServersResultRow GetHostData()
Gets the server data. (from client)
proto native void LogoutRequestTime()
Logout methods.
proto native void RPCSelf(Object target, int rpcType, notnull array< ref Param > params)
Not actually an RPC, as it will send it only to yourself.
proto native void ConfigGetFullPath(string path, out TStringArray full_path)
proto native bool HasInventoryJunctureDestination(Man player, notnull InventoryLocation dst)
proto native WorkspaceWidget GetWorkspace()
proto native float SurfaceY(float x, float z)
proto native void SaveProfile()
Saves profile on disk.
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)
proto native bool CanRespawnPlayer()
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:1074
proto native NoiseSystem GetNoiseSystem()
proto native void SetProfileStringList(string name, TStringArray values)
Sets array of strings to profile variable.
string ConfigGetTextOut(string path)
Get string value from config on path.
Definition Game.c:440
TStringArray ListAvailableCharacters()
outputs array of all valid survivor class names
Definition Game.c:1375
proto native void SetDiagDrawMode(int diag_draw_mode)
Set debug draw mode.
proto native void OverrideDOF(bool enable, float focusDistance, float focusLength, float focusLengthNear, float blur, float focusDepthOffset)
proto native void AbortMission()
Returns to main menu, leave world empty for using last mission world.
bool IsSurfaceFertile(string surface)
Checks if the surface is fertile.
Definition Game.c:1093
proto native void StoreLoginData(ParamsWriteContext ctx)
Stores login userdata as parameters which are sent to server
proto native void GetObjectsAtPosition(vector pos, float radius, out array< Object > objects, out array< CargoBase > proxyCargos)
Returns list of all objects in circle "radius" around position "pos".
proto native bool ExecuteEnforceScript(string expression, string mainFnName)
Delevoper only: Executes Enforce Script expression, if there is an error, is printed into the script ...
proto native EntityAI GetEntityByPersitentID(int b1, int b2, int b3, int b4)
proto owned string GetHostName()
Gets the server name. (from client)
proto native void ObjectDeleteOnClient(Object obj)
proto native bool IsInPartyChat()
Returns whether user is currently in a voice party (currently only supported on xbox)
void OnProcessLifetimeChanged(int plmtype)
Definition Game.c:87
proto void ObjectGetDisplayName(Object obj, out string name)
proto native void GetObjectsAtPosition3D(vector pos, float radius, out array< Object > objects, out array< CargoBase > proxyCargos)
Returns list of all objects in sphere "radius" around position "pos".
proto native void PlayMission(string path)
Starts mission (equivalent for SQF playMission). You MUST use double slash \.
proto native bool IsPhysicsExtrapolationEnabled()
If physics extrapolation is enabled, always true on retail release builds.
proto native bool HasInventoryJunctureItem(notnull EntityAI item)
proto native void SetMainMenuWorld(string world)
proto native void LogoutRequestCancel()
proto native float GetTickTime()
Returns current time from start of the game.
proto native int ConfigGetType(string path)
Returns type of config value.
proto int GetTime()
returns mission time in milliseconds
private void ~CGame()
Definition Game.c:62
proto native bool IsDebug()
ScriptModule GameScript
Definition Game.c:12
proto native int GetVoiceLevel(Object player=null)
Get voice level of VoN (on both client and server) (VoiceLevelWhisper = 0, VoiceLevelNormal = 1,...
proto native vector GetScreenPosRelative(vector world_pos)
Transforms position in world to position in screen in percentage (0.0 - 1.0) as x,...
void OnMouseButtonRelease(int button)
Called when mouse button is released.
Definition Game.c:179
proto native void EnableMicCapture(bool enable)
Enable microphone to locally capture audio from user. Audio heard does NOT automatically get transmit...
ContentDLC is for query installed DLC (only as entitlement keys, not content)
Definition ContentDLC.c:11
Definition Debug.c:14
static void InventoryReservationLog(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Definition Debug.c:153
Definition Camera.c:2
Definition input.c:11
InventoryLocation.
static string DumpToStringNullSafe(InventoryLocation loc)
static void Init()
Definition Debug.c:563
static bool IsInventoryReservationLogEnable()
Definition Debug.c:610
Definition EnMath.c:7
proto bool RequestGetDefaultCharacterData()
Mission class.
Definition gameplay.c:670
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:378
Manager class for managing Effect (EffectParticle, EffectSound)
static void Init()
Initialize the containers.
static void Cleanup()
Cleanup method to properly clean up the static data.
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
Manager class which handles Voice-over-network functionality while player is connected to a server.
Definition VONManager.c:301
static void Init()
Initializes VONManager, runs when user first connects to a server.
Definition VONManager.c:316
static void CleanupInstance()
Uninitializes VONManager, runs when user disconnects from server.
Definition VONManager.c:325
Definition World.c:2
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto vector VectorToAngles()
Converts vector to spherical coordinates with radius = 1.
proto native CGame GetGame()
array< string > TStringArray
Definition EnScript.c:685
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static proto int Randomize(int seed)
Sets the seed for the random number generator.
proto string Substring(int start, int len)
Substring of 'str' from 'start' position 'len' number of characters.
string Get(int index)
Gets n-th character from string.
Definition EnString.c:434
proto int ToLower()
Changes string to lowercase. Returns length.
static proto string ToString(void var, bool type=false, bool name=false, bool quotes=true)
Return string representation of variable.
proto native int Length()
Returns length of string.
TypeID EventType
Definition EnWidgets.c:54