Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
gameplay.c
Go to the documentation of this file.
1
12
13const int INDEX_NOT_FOUND = -1;
14//-----------------------------------------------------------------------------
17
50{
51 void JsonSerializer() {}
52 void ~JsonSerializer() {}
53
68 proto bool WriteToString(void variable_out, bool nice, out string result);
69
100 proto bool ReadFromString(void variable_in, string jsonString, out string error);
101};
102
103
105{
106 void ScriptRPC();
107 void ~ScriptRPC();
109 proto native void Reset();
117 proto native void Send(Object target, int rpc_type, bool guaranteed,PlayerIdentity recipient = NULL);
118};
119
121{
122 void ScriptInputUserData ();
123 void ~ScriptInputUserData ();
124
125 proto native void Reset ();
126 proto native void Send ();
127
128 proto native bool CopyFrom(ParamsReadContext other);
129
131 proto native static bool CanStoreInputUserData ();
132};
133
135{
138
139 proto native ParamsWriteContext GetWriteContext ();
140 proto native ParamsReadContext GetReadContext ();
141};
142
144{
147
148 proto native void Reset ();
149};
150
152{
153 void ScriptJunctureData ();
154 void ~ScriptJunctureData ();
155
156 proto native void Reset ();
157};
158
159//-----------------------------------------------------------------------------
161{
162 proto native int GetModesCount();
163
164 proto native owned string GetModeName(int index);
165
166 proto native owned string GetAmmoTypeName(int index);
167
168 proto native float GetModeRange(int index);
169
170 private void MeleeCombatData();
171 private void ~MeleeCombatData();
172}
173
174//-----------------------------------------------------------------------------
175const string NullStringArray[1] = { "" };
176
177//-----------------------------------------------------------------------------
180{
181 private void Selection() {}
182 private void ~Selection() {}
183
184 proto native owned string GetName();
185 proto native int GetVertexCount();
186 proto native int GetLODVertexIndex(int sel_vertex_index);
187
188 vector GetVertexPosition(LOD lod, int index)
189 {
190 int lodIndex = GetLODVertexIndex(index);
191 if (lodIndex == -1)
192 {
193 Error("Vertex doesn't exist");
194 return vector.Zero;
195 }
196
197 return lod.GetVertexPosition(lodIndex);
198 }
199};
200
201//-----------------------------------------------------------------------------
203class LOD
204{
205 // standard(BI) LOD names in p3d
206 static const string NAME_GEOMETRY = "geometry";
207 static const string NAME_VIEW = "view";
208 static const string NAME_FIRE = "fire";
209 static const string NAME_MEMORY = "memory";
210 static const string NAME_ROADWAY = "roadway";
211
212 private void LOD() {}
213 private void ~LOD() {}
214
215 proto native int GetSelectionCount();
216 proto native bool GetSelections(notnull out array<Selection> selections);
217
218 proto native vector GetVertexPosition(int vertex_index);
219
220 proto native owned string GetName(Object myObject);
221
222 Selection GetSelectionByName(string name)
223 {
224 array<Selection> selections = new array<Selection>;
225 GetSelections(selections);
226
227 for (int i = 0; i < selections.Count(); ++i)
228 {
229 string selection_name = selections.Get(i).GetName();
230 selection_name.ToLower();
231 name.ToLower();
232 if (selection_name == name)
233 {
234 return selections.Get(i);
235 }
236 }
237
238 return null;
239 }
240
241 proto native int GetPropertyCount();
242 proto native owned string GetPropertyName(int index);
243 proto native owned string GetPropertyValue(int index);
244}
245
246class Plant extends Object
247{
249
250/*
251class ParamEntry
252{
253 proto string GetString(string entryName);
254 proto int GetInt(string entryName);
255 proto float GetFloat(string entryName);
256 proto ref ParamEntry GetEntry(string entryName);
257 proto int GetNumChildren();
258 proto ref ParamEntry GetNumChildren(int n);
259};
260*/
261//-----------------------------------------------------------------------------
262
263//-----------------------------------------------------------------------------
264class ProxyInventory extends ObjectTyped
265{
266};
267
268//-----------------------------------------------------------------------------
269class ProxySubpart extends Entity
270{
271};
272
273//-----------------------------------------------------------------------------
274// custom widgets
275//-----------------------------------------------------------------------------
276class ItemPreviewWidget: Widget
277{
278 proto native void SetItem(EntityAI object);
279 proto native EntityAI GetItem();
280
281 proto native int GetView();
288 proto native void SetView(int viewIndex);
289
290 proto native void SetModelOrientation(vector vOrientation);
291 proto native vector GetModelOrientation();
292 proto native void SetModelPosition(vector vPos);
293 proto native vector GetModelPosition();
294
295 proto native void SetForceFlipEnable(bool enable);
296 proto native void SetForceFlip(bool value);
297};
298
299//-----------------------------------------------------------------------------
301{
302 proto native void UpdateItemInHands(EntityAI object);
303 proto native void SetPlayer(DayZPlayer player);
304 //proto native void SetPlayerType(string type);
305 proto native DayZPlayer GetDummyPlayer();
306
307 proto native void Refresh();
308
309 proto native void SetModelOrientation(vector vOrientation);
310 proto native vector GetModelOrientation();
311 proto native void SetModelPosition(vector vPos);
312 proto native vector GetModelPosition();
313};
314
315//-----------------------------------------------------------------------------
316class HtmlWidget extends RichTextWidget
317{
318 proto native void LoadFile(string path);
319};
320
321//-----------------------------------------------------------------------------
322class MapWidget: Widget
323{
324 proto native void ClearUserMarks();
325 proto native void AddUserMark(vector pos, string text, int color /*ARGB*/, string texturePath);
326 proto native vector GetMapPos();
327 proto native void SetMapPos(vector worldPos);
328 proto native float GetScale();
329 proto native void SetScale(float scale);
330 proto native float GetContourInterval();
331 proto native float GetCellSize(float pLegendWidth);
332 proto native vector MapToScreen(vector worldPos);
333 proto native vector ScreenToMap(vector screenPos);
334};
335
336//-----------------------------------------------------------------------------
339{
341 proto int GetPingAct();
343 proto int GetPingMin();
345 proto int GetPingMax();
347 proto int GetPingAvg();
348
350 proto int GetBandwidthMin();
352 proto int GetBandwidthMax();
354 proto int GetBandwidthAvg();
355
357 proto float GetOutputThrottle();
359 proto float GetInputThrottle();
360
362 proto string GetName();
364 proto string GetPlainName();
366 proto string GetFullName();
368 proto string GetId();
370 proto string GetPlainId();
372 proto int GetPlayerId();
373
375 proto Man GetPlayer();
376
377#ifdef FEATURE_NETWORK_RECONCILIATION
379 proto native void Possess(Pawn pawn);
380#endif
381
383 private void PlayerIdentityBase();
384 private void ~PlayerIdentityBase();
385};
386
389{
390
391}
392
393//-----------------------------------------------------------------------------
394const int PROGRESS_START = 0;
395const int PROGRESS_FINISH = 1;
396const int PROGRESS_PROGRESS = 2;
397const int PROGRESS_UPDATE = 3;
398
399//-----------------------------------------------------------------------------
400typedef int ChatChannel;
401
402//-----------------------------------------------------------------------------
405typedef Param1<string> ScriptLogEventParams;
407typedef Param4<int, string, string, string> ChatMessageEventParams;
408typedef Param1<int> ChatChannelEventParams;
409typedef Param1<int> SQFConsoleEventParams;
410
414typedef Param5<PlayerIdentity, bool, vector, float, int> ClientPrepareEventParams;
426typedef Param4<PlayerIdentity, Man, int, bool> ClientDisconnectedEventParams;
427
429typedef Param1<int> LoginTimeEventParams;
431typedef Param1<int> RespawnEventParams;
433typedef Param1<vector> PreloadEventParams;
435typedef Param1<Man> LogoutCancelEventParams;
437typedef Param1<PlayerIdentity> ConnectivityStatsUpdatedEventParams;
439typedef Param4<float, float, int, int> ServerFpsStatsUpdatedEventParams;
443typedef Param1<int> LogoutEventParams;
453typedef Param1<string> DLCOwnerShipFailedParams;
455typedef Param1<FreeDebugCamera> SetFreeCameraEventParams;
457typedef Param1<int> MPConnectionLostEventParams;
463typedef Param1<bool> NetworkInputBufferEventParams;
464
465
466//-----------------------------------------------------------------------------
467
472
473//-----------------------------------------------------------------------------
486
487//-----------------------------------------------------------------------------
496
497//-----------------------------------------------------------------------------
502
503//-----------------------------------------------------------------------------
522
523//-----------------------------------------------------------------------------
540
541//-----------------------------------------------------------------------------
546
547//-----------------------------------------------------------------------------
559
560//-----------------------------------------------------------------------------
574
575//possible in engine events not accessable from script
576//ReloadShadersEvent
577//LoadWorldProgressEvent
578
579//SignStatusEvent
580//SetPausedEvent
581//TerminationEvent
582//UserSettingsChangedEvent
583//StorageChangedEvent
584//BeforeResetEvent
585//AfterRenderEvent
586//AfterResetEvent
587//CrashLogEvent
588//ConsoleEvent
589
591{
592 const string None = "";
593 const string Cursor = "set:dayz_gui image:cursor";
594 const string CloseDoors = "set:dayz_gui image:close";
595 const string OpenDoors = "set:dayz_gui image:open";
596 const string OpenCarDoors = "set:dayz_gui image:open_car";
597 const string CloseCarDoors = "set:dayz_gui image:close_car";
598 const string EngineOff = "set:dayz_gui image:engine_off";
599 const string EngineOn = "set:dayz_gui image:engine_on";
600 const string LadderDown = "set:dayz_gui image:ladderdown";
601 const string LadderOff = "set:dayz_gui image:ladderoff";
602 const string LadderUp = "set:dayz_gui image:ladderup";
603 const string LootCorpse = "set:dayz_gui image:gear";
604 const string CloseHood = "set:dayz_gui image:close_hood";
605 const string OpenHood = "set:dayz_gui image:open_hood";
606 const string GetOut = "set:dayz_gui image:getout";
607 const string GetInCargo = "set:dayz_gui image:get_in_cargo";
608 const string Reload = "set:dayz_gui image:reload";
609 const string GetInDriver = "set:dayz_gui image:get_in_driver";
610 const string GetInCommander = "set:dayz_gui image:get_in_commander";
611 const string GetInPilot = "set:dayz_gui image:get_in_pilot";
612 const string GetInGunner = "set:dayz_gui image:get_in_gunner";
613};
614
615
616
617// some defs for CGame::ShowDialog()
618/*
619const int DBB_NONE = 0;
620const int DBB_OK = 1;
621const int DBB_YES = 2;
622const int DBB_NO = 3;
623const int DBB_CANCEL = 4;
624
625const int DBT_OK = 0; //just OK button
626const int DBT_YESNO = 1; //Yes and No buttons
627const int DBT_YESNOCANCEL = 2; //Yes, No, Cancel buttons
628
629const int DMT_NONE = 0;
630const int DMT_INFO = 1;
631const int DMT_WARNING = 2;
632const int DMT_QUESTION = 3;
633const int DMT_EXCLAMATION = 4;
634*/
635
636proto native CGame GetGame();
637
639{
640 ref Timer m_Timer;
641 void Init(Widget hud_panel_widget) {}
642 void DisplayNotifier(int key, int tendency, int status) {}
643 void DisplayBadge(int key, int value) {}
644 void SetStamina(int value, int range) {}
645 void DisplayStance(int stance) {}
646 void DisplayPresence() {}
647 void ShowCursor() { }
648 void HideCursor() { }
649 void SetCursorIcon(string icon) { }
650 void SetCursorIconScale(string type, float percentage) { }
651 void SetCursorIconOffset(string type, float x, float y) { }
652 void SetCursorIconSize(string type, float x, float y) { }
653 void ShowWalkieTalkie(bool show) { }
654 void ShowWalkieTalkie(int fadeOutSeconds) { }
655 void SetWalkieTalkieText(string text) { }
656 void RefreshQuickbar(bool itemChanged = false) {}
657 void Show(bool show) {}
658 void UpdateBloodName() {}
659 void SetTemperature(string temp);
660 void SetStaminaBarVisibility(bool show);
661 void Update(float timeslice){}
662 void ShowVehicleInfo();
663 void HideVehicleInfo();
664
665 void InitHeatBufferUI(Man player);
666 void ShowQuickbarUI(bool show);
667 void ShowQuickbarPlayer(bool show);
668 void ShowHudPlayer(bool show);
669 void ShowHudUI(bool show);
670 void ShowHudInventory(bool show);
671 void ShowQuickBar(bool show);
672 void UpdateQuickbarGlobalVisibility();
673 void ShowHud(bool show);
674
675 void OnResizeScreen();
676 void OnPlayerLoaded(); // player connects or respawns
677
678 void SetPermanentCrossHair(bool show) {}
679
680 void SpawnHitDirEffect(DayZPlayer player, float hit_direction,float intensity_max);
681 void SetConnectivityStatIcon(EConnectivityStatType type, EConnectivityStatLevel level);
682};
683
684//-----------------------------------------------------------------------------
687{
688 ScriptModule MissionScript;
689
690 ref array<vector> m_ActiveRefresherLocations;
691
698
699 private void ~Mission();
700
701 void OnInit() {}
702 void OnMissionStart() {}
703 void OnMissionFinish() {}
704 void OnUpdate(float timeslice)
705 {
706#ifdef FEATURE_CURSOR
707 m_TimeStamp++;
708#endif
709 }
710 void OnKeyPress(int key) {}
711 void OnKeyRelease(int key) {}
712 void OnMouseButtonPress(int button){}
713 void OnMouseButtonRelease(int button){}
714 void OnEvent(EventType eventTypeId, Param params) {}
715 void OnItemUsed(InventoryItem item, Man owner) {}
716 void AddDummyPlayerToScheduler(Man player){}
717 void Reset(){}
718 void ResetGUI(){}
719 void OnGameplayDataHandlerLoad(){}
720
721 Hud GetHud()
722 {
723 return null;
724 }
725
726 ObjectSnapCallback GetInventoryDropCallback()
727 {
728 return null;
729 }
730
731 bool IsPlayerDisconnecting(Man player);
732
733 UIScriptedMenu CreateScriptedMenu(int id)
734 {
735 return null;
736 }
737
738 UIScriptedWindow CreateScriptedWindow(int id)
739 {
740 return null;
741 }
742
743 WorldData GetWorldData()
744 {
745 return null;
746 }
747
748 WorldLighting GetWorldLighting()
749 {
750 return null;
751 }
752
753 DynamicMusicPlayer GetDynamicMusicPlayer()
754 {
755 return null;
756 }
757
758 bool IsPaused()
759 {
760 return false;
761 }
762
763 bool IsGame()
764 {
765 return false;
766 }
767
768 bool IsServer()
769 {
770 return false;
771 }
772
773 void Pause() {}
774 void Continue() {}
775
776 void AbortMission() {}
777
778 void CreateLogoutMenu(UIMenuPanel parent) {}
779 void StartLogoutMenu(int time) {}
780
781 void CreateDebugMonitor() {}
782 void HideDebugMonitor() {}
783
784 void RefreshCrosshairVisibility() {}
785
786 void HideCrosshairVisibility() {}
787
788 bool IsMissionGameplay()
789 {
790 return false;
791 }
792
793 bool IsControlDisabled() {}
794 int GetControlDisabledMode() {}
795
796 void PlayerControlEnable(bool bForceSupress);
797 void PlayerControlDisable(int mode);
798
799 void RemoveActiveInputExcludes(array<string> excludes, bool bForceSupress = false);
800 void RemoveActiveInputRestriction(int restrictor);
801 void AddActiveInputExcludes(array<string> excludes);
802 void AddActiveInputRestriction(int restrictor);
803 void RefreshExcludes();
804 bool IsInputExcludeActive(string exclude);
805 bool IsInputRestrictionActive(int restriction);
806 void EnableAllInputs(bool bForceSupress = false);
807
808 void ShowInventory() {}
809 void HideInventory() {}
810
811 void ShowChat() {}
812 void HideChat() {}
813 void UpdateVoiceLevelWidgets(int level) {}
814
815 void HideVoiceLevelWidgets() {}
816 bool IsVoNActive() {}
817 void SetVoNActive(bool active) {}
818
819 bool InsertCorpse(Man player)
820 {
821 return false;
822 }
823
824 UIScriptedMenu GetNoteMenu();
825 void SetNoteMenu(UIScriptedMenu menu);
826 void SetPlayerRespawning(bool state);
827 void OnPlayerRespawned(Man player);
828 bool IsPlayerRespawning();
829 array<vector> GetActiveRefresherLocations();
830
832 void SetRespawnModeClient(int mode);
833 int GetRespawnModeClient()
834 {
835 return -1;
836 }
838 void SyncRespawnModeInfo(PlayerIdentity identity);
839
840 ImageWidget GetMicrophoneIcon()
841 {
842 return null;
843 }
844
845 WidgetFadeTimer GetMicWidgetFadeTimer();
846 GameplayEffectWidgets_base GetEffectWidgets();
847
848 map<int,ImageWidget> GetVoiceLevelWidgets();
849 map<int,ref WidgetFadeTimer> GetVoiceLevelTimers();
850
851 ScriptInvoker GetOnInputDeviceChanged()
852 {
855
857 }
858
859 ScriptInvoker GetOnInputPresetChanged()
860 {
863
865 }
866
867 ScriptInvoker GetOnInputDeviceConnected()
868 {
871
873 }
874
875 ScriptInvoker GetOnInputDeviceDisconnected()
876 {
879
881 }
882
883 ScriptInvoker GetOnModMenuVisibilityChanged()
884 {
887
889 }
890
891
892 ScriptInvoker GetOnTimeChanged()
893 {
894 if (!m_OnTimeChanged)
896
897 return m_OnTimeChanged;
898 }
899
900#ifdef FEATURE_CURSOR
901 int m_TimeStamp = 0;
902 int GetTimeStamp()
903 {
904 return m_TimeStamp;
905 }
906#endif
907
908#ifdef DEVELOPER
909 bool m_SuppressNextFrame = true;
910 void SetInputSuppression(bool state);
911 bool GetInputSuppression();
912#endif
913};
914
915// -------------------------------------------------------------------------
916
918{
919 proto native int GetCharactersCount();
920 proto native int GetLastPlayedCharacter();
922 proto native Man CreateCharacterPerson(int index);
923
924 proto void GetLastServerAddress(int index, out string address);
925 proto native int GetLastServerPort(int index);
926 proto native int GetLastSteamQueryPort(int index);
927 proto void GetLastServerName(int index, out string address);
928
929 proto void RequestSetDefaultCharacterData();
930 proto bool RequestGetDefaultCharacterData();
931
933 void OnSetDefaultCharacter(ParamsWriteContext ctx)
934 {
935 if (!GetMenuDefaultCharacterDataInstance()/* || GetGame().IsServer()*/)
936 {
937 Error("MenuData | OnSetDefaultCharacter - failed to get data class!");
938 return;
939 }
940
941 GetMenuDefaultCharacterDataInstance().SerializeCharacterData(ctx);
942 SaveCharactersLocal();
943 }
944
946 bool OnGetDefaultCharacter(ParamsReadContext ctx)
947 {
948 if (!GetMenuDefaultCharacterDataInstance())
949 {
950 Error("MenuData | OnGetDefaultCharacter - failed to get data class!");
951 return false;
952 }
953
954 if (GetMenuDefaultCharacterDataInstance().DeserializeCharacterData(ctx))
955 {
956 return true;
957 }
958 return false;
959 }
960
961 proto void GetCharacterName(int index, out string name);
962 proto native void SetCharacterName(int index, string newName);
963 // save character is set as last played character
964 proto native void SaveCharacter(bool localPlayer, bool verified);
965 proto native void SaveDefaultCharacter(Man character);
966
968 proto native void SaveCharactersLocal();
970 proto native void LoadCharactersLocal();
971 proto native void ClearCharacters();
972
973 MenuDefaultCharacterData GetMenuDefaultCharacterDataInstance()
974 {
976 }
977
978 //proto native void GetCharacterStringList(int characterID, string name, out TStringArray values);
979 //proto bool GetCharacterString(int characterID,string name, out string value);
980};
981
982//holds 'default character' data
984{
985 //const int MODE_SERVER = 0;
986 //const int MODE_CLIENT = 1;
987
988 string m_CharacterName;
989 string m_CharacterType;
990 ref map<int,string> m_AttachmentsMap;
991 bool m_ForceRandomCharacter;
992
994 {
995 Init();
996 }
997
998 void Init()
999 {
1000 if (!GetGame().IsDedicatedServer())
1001 {
1002 GetGame().GetMenuData().LoadCharactersLocal();
1003 }
1004 m_AttachmentsMap = new map<int,string>;
1005 }
1006
1007 void ClearAttachmentsMap()
1008 {
1009 m_AttachmentsMap.Clear();
1010 }
1011
1012 void SetDefaultAttachment(int slotID, string type)
1013 {
1014 m_AttachmentsMap.Set(slotID,type); //using 'Set' instead of 'Insert' for convenience
1015 }
1016
1017 void GenerateRandomEquip()
1018 {
1019 ClearAttachmentsMap();
1020
1021 int slot_ID;
1022 string attachment_type;
1023 for (int i = 0; i < DefaultCharacterCreationMethods.GetAttachmentSlotsArray().Count(); i++)
1024 {
1025 slot_ID = DefaultCharacterCreationMethods.GetAttachmentSlotsArray().Get(i);
1026 if (DefaultCharacterCreationMethods.GetConfigArrayCountFromSlotID(slot_ID) > 0)
1027 {
1028 attachment_type = DefaultCharacterCreationMethods.GetConfigAttachmentTypes(slot_ID).GetRandomElement();
1029 //if (attachment_type != "")
1030 SetDefaultAttachment(slot_ID,attachment_type);
1031 }
1032 }
1033 }
1034
1035 void EquipDefaultCharacter(Man player)
1036 {
1037 if (!player)
1038 {
1039 ErrorEx("WARNING - trying to equip non-existent object! | MenuDefaultCharacterData::EquipDefaultCharacter");
1040 return;
1041 }
1042
1043 int slot_ID;
1044 string attachment_type;
1045 string current_attachment_type;
1046 EntityAI current_attachment_object;
1047
1048 for (int i = 0; i < m_AttachmentsMap.Count(); i++)
1049 {
1050 attachment_type = "";
1051 current_attachment_type = "";
1052 slot_ID = m_AttachmentsMap.GetKey(i);
1053 attachment_type = m_AttachmentsMap.GetElement(i); //Get(i)
1054 current_attachment_object = player.GetInventory().FindAttachment(slot_ID);
1055
1056 if (current_attachment_object)
1057 {
1058 current_attachment_type = current_attachment_object.GetType();
1059 }
1060 if (current_attachment_type != attachment_type)
1061 {
1062 if (current_attachment_object)
1063 g_Game.ObjectDelete(current_attachment_object);
1064 if (attachment_type != "")
1065 player.GetInventory().CreateAttachmentEx(attachment_type,slot_ID);
1066 }
1067 }
1068 }
1069
1071 void SerializeCharacterData(ParamsWriteContext ctx)
1072 {
1073 ctx.Write(m_CharacterType);
1074 ctx.Write(m_AttachmentsMap);
1075 ctx.Write(m_ForceRandomCharacter);
1076 ctx.Write(m_CharacterName);
1077 //DumpAttMapContents();
1078 }
1079
1080 bool DeserializeCharacterData(ParamsReadContext ctx)
1081 {
1082 if (!ctx.Read(m_CharacterType))
1083 return false;
1084 if (!ctx.Read(m_AttachmentsMap))
1085 return false;
1086 if (!ctx.Read(m_ForceRandomCharacter))
1087 return false;
1088 if (!ctx.Read(m_CharacterName))
1089 return false;
1090
1091 //DumpAttMapContents();
1092 return true;
1093 }
1094
1095 void SetCharacterName(string name)
1096 {
1097 m_CharacterName = name;
1098 }
1099
1100 string GetCharacterName()
1101 {
1102 return m_CharacterName;
1103 }
1104
1105 void SetCharacterType(string character_type)
1106 {
1107 m_CharacterType = character_type;
1108 }
1109
1110 string GetCharacterType()
1111 {
1112 return m_CharacterType;
1113 }
1114
1115 void SetRandomCharacterForced(bool state)
1116 {
1117 m_ForceRandomCharacter = state;
1118 }
1119
1120 bool IsRandomCharacterForced()
1121 {
1122 return m_ForceRandomCharacter;
1123 }
1124
1125 map<int,string> GetAttachmentMap()
1126 {
1127 return m_AttachmentsMap;
1128 }
1129
1130 //DEBUG
1131 void DumpAttMapContents()
1132 {
1133 int debugID;
1134 string debugType;
1135 Print("-----------");
1136 Print("m_AttachmentsMap contents:");
1137 for (int j = 0; j < m_AttachmentsMap.Count(); j++)
1138 {
1139 debugID = m_AttachmentsMap.GetKey(j);
1140 debugType = m_AttachmentsMap.GetElement(j);
1141 Print("index " + j);
1142 Print("debugID: " + debugID);
1143 Print("debugType: " + debugType);
1144 }
1145 Print("-----------");
1146 }
1147}
1148
1149class DefaultCharacterCreationMethods
1150{
1151 static ref array<int> m_AttachmentSlots = {
1152 InventorySlots.SHOULDER,
1153 InventorySlots.MELEE,
1154 InventorySlots.HEADGEAR,
1155 InventorySlots.MASK,
1156 InventorySlots.EYEWEAR,
1157 InventorySlots.GLOVES,
1158 InventorySlots.ARMBAND,
1159 InventorySlots.BODY,
1160 InventorySlots.VEST,
1161 InventorySlots.BACK,
1162 InventorySlots.HIPS,
1163 InventorySlots.LEGS,
1164 InventorySlots.FEET
1166 //conversion nescesssary for legacy reasons...
1167 static ref array<string> m_ConfigArrayNames = {
1168 "shoulder",
1169 "melee",
1170 "headgear",
1171 "mask",
1172 "eyewear",
1173 "gloves",
1174 "armband",
1175 "top",
1176 "vests",
1177 "backpacks",
1178 "hips",
1179 "bottom",
1180 "shoe"
1181 };
1182
1183 const static string m_Path = "cfgCharacterCreation";
1184
1186 static string GetPathFromSlotID(int slot_ID)
1187 {
1188 int idx = m_AttachmentSlots.Find(slot_ID);
1189 string path = "" + m_Path + " " + m_ConfigArrayNames.Get(idx);
1190 return path;
1191 }
1192
1194 static int GetConfigArrayCountFromSlotID(int slot_ID)
1195 {
1196 TStringArray types = new TStringArray;
1197 GetGame().ConfigGetTextArray(GetPathFromSlotID(slot_ID),types);
1198 return types.Count();
1199 }
1200
1202 static array<string> GetConfigAttachmentTypes(int slot_ID)
1203 {
1204 TStringArray types = new TStringArray;
1205 GetGame().ConfigGetTextArray(GetPathFromSlotID(slot_ID),types);
1206 return types;
1207 }
1208
1210 static array<int> GetAttachmentSlotsArray()
1211 {
1212 return m_AttachmentSlots;
1213 }
1214
1216 static array<string> GetConfigArrayNames()
1217 {
1218 return m_ConfigArrayNames;
1219 }
1220}
1221
1224{
1268
1274
1286
1289};
1290
1307
1308// -------------------------------------------------------------------------
1309/*
1310// Option Access Control Type
1311const int OA_CT_NUMERIC = 0;
1312const int OA_CT_SWITCH = 1;
1313const int OA_CT_LIST = 2;
1314
1315// Option Field of view constants
1316const float OPTIONS_FIELD_OF_VIEW_MIN = 0.75242724772f;
1317const float OPTIONS_FIELD_OF_VIEW_MAX = 1.30322025726f;
1318*/
1319
1321{
1322 //proto private void ~OptionsAccess();
1323 //proto private void OptionsAccess();
1324
1329 proto native int GetAccessType();
1330
1335 proto native int GetControlType();
1336
1340 proto native void Apply();
1341
1345 proto native void Test();
1346
1350 proto native void Revert();
1351
1356 proto native int IsChanged();
1357
1362 proto native int NeedRestart();
1363
1368 proto native int SetChangeImmediately();
1369 //proto native void Initialize();
1370
1375
1380 private proto void SetScriptEvents(Managed events);
1381
1386 private proto Managed GetScriptEvents();
1387
1392 OptionsAccessEvents GetEvents()
1393 {
1394 return OptionsAccessEvents.Cast(GetScriptEvents());
1395 }
1396
1398
1399
1400
1405
1406 void OnRevert()
1407 {
1408 GetEvents().Event_OnRevert.Invoke(this);
1409 }
1410
1412};
1413
1416{
1417 ref ScriptInvoker Event_OnRevert = new ScriptInvoker();
1418}
1419
1420// -------------------------------------------------------------------------
1421class NumericOptionsAccess extends OptionsAccess
1422{
1423 proto native float ReadValue();
1424 proto native void WriteValue(float value);
1425 proto native float GetMin();
1426 proto native float GetMax();
1427 proto native float GetDefault();
1428};
1429
1430// -------------------------------------------------------------------------
1431class ListOptionsAccess extends OptionsAccess
1432{
1433 proto native int GetIndex();
1434 proto native int GetDefaultIndex();
1435 proto native void SetIndex(int index);
1436 proto native int GetItemsCount();
1437 proto void GetItemText(int index, out string value);
1438
1439 void GetAllItemsText(array<string> output)
1440 {
1441 string s;
1442 for (int i = 0; i < GetItemsCount(); ++i)
1443 {
1444 GetItemText(i, s);
1445 output.Insert(s);
1446 }
1447 }
1449
1450// -------------------------------------------------------------------------
1451class SwitchOptionsAccess extends OptionsAccess
1452{
1453 proto native void Switch();
1454 proto void GetItemText(out string value);
1455 proto native int GetIndex();
1456 proto native int GetDefaultIndex();
1457};
1458
1459// -------------------------------------------------------------------------
1461{
1465 proto native void Apply();
1466
1470 proto native void Revert();
1471
1475 proto native void Test();
1476
1482 proto native OptionsAccess GetOption(int index);
1483
1489 proto native OptionsAccess GetOptionByType(int accessType);
1490
1495 proto native int GetOptionsCount();
1496
1501 proto native int NeedRestart();
1502
1507 proto native int IsChanged();
1508
1512 proto native void Initialize();
1513};
1514
1515
1516typedef Link<Object> OLinkT;
1517
1526EntityAI SpawnEntity (string object_name, notnull InventoryLocation inv_loc, int iSetupFlags, int iRotation)
1527{
1528 return GameInventory.LocationCreateEntity(inv_loc, object_name,iSetupFlags,iRotation);
1529}
1530
1532{
1533};
1534
1535
1536class PrtTest // Temporal class for toggling particles on guns
1537{
1538 static bool m_GunParticlesState = true;
1539}
1540
1541// #include "Scripts/Classes/Component/_include.c"
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
MenuDefaultCharacterData GetMenuDefaultCharacterData(bool fill_data=true)
Definition game.c:1548
Definition camera.c:2
script counterpart to engine's class Inventory
Definition inventory.c:79
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
grouped gameplay effect widgets and their handling
InventoryLocation.
provides access to slot configuration
Class for sending RPC over network.
Definition gameplay.c:50
LOD class.
Definition gameplay.c:204
TODO doc.
Definition enscript.c:118
string GetCharacterName()
void SaveDefaultCharacter()
Mission class.
Definition gameplay.c:687
ref ScriptInvoker m_OnInputDeviceChanged
Definition gameplay.c:692
ref ScriptInvoker m_OnModMenuVisibilityChanged
Definition gameplay.c:696
ref ScriptInvoker m_OnInputDeviceDisconnected
Definition gameplay.c:695
ref ScriptInvoker m_OnInputDeviceConnected
Definition gameplay.c:694
ref ScriptInvoker m_OnInputPresetChanged
Definition gameplay.c:693
ref ScriptInvoker m_OnTimeChanged
Definition gameplay.c:697
Invokers for ParticleManager events.
Definition gameplay.c:1416
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
Player description (base engine class)
Definition gameplay.c:339
The class that will be instanced (moddable)
Definition gameplay.c:389
ScriptInvoker Class provide list of callbacks usage:
Definition tools.c:116
Module containing compiled scripts.
Definition enscript.c:131
Selection class.
Definition gameplay.c:180
Serialization general interface. Serializer API works with:
Definition serializer.c:56
Attribute used for tests annotation and assignment to Suites.
Part of main menu hierarchy to create custom menus from script.
Keeps information about currently loaded world, like temperature.
Definition worlddata.c:3
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
DayZGame g_Game
Definition dayzgame.c:3868
void Show()
Definition dayzgame.c:162
EConnectivityStatType
const EventType LogoutCancelEventTypeID
params: LogoutCancelEventParams
Definition gameplay.c:529
proto native float GetMin()
const int PROGRESS_UPDATE
Definition gameplay.c:397
Param1< int > RespawnEventParams
RespawnTime.
Definition gameplay.c:431
Param1< int > MPConnectionLostEventParams
Duration.
Definition gameplay.c:457
Param2< string, string > VONStartSpeakingEventParams
player name, player id
Definition gameplay.c:449
Param1< Man > LogoutCancelEventParams
Player.
Definition gameplay.c:435
Param1< int > SQFConsoleEventParams
Definition gameplay.c:409
const EventType PartyChatStatusChangedEventTypeID
no params
Definition gameplay.c:561
Param1< int > LoginTimeEventParams
LoginTime.
Definition gameplay.c:429
const EventType ClientNewEventTypeID
params: ClientNewEventParams
Definition gameplay.c:509
const EventType MPSessionEndEventTypeID
no params
Definition gameplay.c:477
const EventType ConnectingStartEventTypeID
no params
Definition gameplay.c:567
PlayerIdentity PROGRESS_START
const int INDEX_NOT_FOUND
Definition gameplay.c:13
Param1< string > ScriptLogEventParams
Definition gameplay.c:405
const EventType LoginStatusEventTypeID
params: LoginStatusEventParams
Definition gameplay.c:539
Param5< PlayerIdentity, bool, vector, float, int > ClientPrepareEventParams
PlayerIdentity, useDB, pos, yaw, preloadTimeout (= additional time in seconds to how long server wait...
Definition gameplay.c:414
Param1< vector > PreloadEventParams
Position.
Definition gameplay.c:433
Param1< bool > NetworkInputBufferEventParams
isFull
Definition gameplay.c:463
const EventType SetFreeCameraEventTypeID
params: SetFreeCameraEventParams
Definition gameplay.c:565
proto native float GetMax()
Serializer ParamsReadContext
Definition gameplay.c:15
Param4< float, float, int, int > ServerFpsStatsUpdatedEventParams
average server fps, highest frame time, skipped physics simulation steps server/client
Definition gameplay.c:439
Param2< PlayerIdentity, Man > ClientRespawnEventParams
PlayerIdentity, Man.
Definition gameplay.c:420
const EventType WorldCleaupEventTypeID
no params
Definition gameplay.c:471
class MeleeCombatData NullStringArray[1]
Param1< string > DLCOwnerShipFailedParams
world name
Definition gameplay.c:453
int ChatChannel
Definition gameplay.c:400
Link< Object > OLinkT
Definition gameplay.c:1516
Param1< int > LogoutEventParams
logoutTime
Definition gameplay.c:443
const EventType ClientReconnectEventTypeID
params: ClientReconnectEventParams
Definition gameplay.c:515
const EventType MPConnectionCloseEventTypeID
params: MPConnectionCloseEventParams
Definition gameplay.c:485
Param2< bool, bool > VONStateEventParams
listening, toggled
Definition gameplay.c:447
Param2< string, string > VONStopSpeakingEventParams
player name, player id
Definition gameplay.c:451
const EventType SelectedUserChangedEventTypeID
no params
Definition gameplay.c:543
Param2< int, string > MPConnectionCloseEventParams
EClientKicked, AdditionalInfo.
Definition gameplay.c:459
const EventType ClientRemovedEventTypeID
no params
Definition gameplay.c:521
const EventType VONStartSpeakingEventTypeID
params: VONStartSpeakingEventParams
Definition gameplay.c:551
const EventType VONStateEventTypeID
params: VONStateEventParams
Definition gameplay.c:549
const EventType RespawnEventTypeID
params: RespawnEventParams
Definition gameplay.c:533
const EventType MPSessionFailEventTypeID
no params
Definition gameplay.c:479
Param3< int, int, bool > WindowsResizeEventParams
Width, Height, Windowed.
Definition gameplay.c:445
const EventType VONUserStoppedTransmittingAudioEventTypeID
no params
Definition gameplay.c:557
const int PROGRESS_PROGRESS
Definition gameplay.c:396
Param4< PlayerIdentity, Man, int, bool > ClientDisconnectedEventParams
PlayerIdentity, Man, LogoutTime, AuthFailed.
Definition gameplay.c:426
const EventType PlayerDeathEventTypeID
params: PlayerDeathEventParams
Definition gameplay.c:571
const EventType StartupEventTypeID
no params
Definition gameplay.c:469
const EventType VONUserStartedTransmittingAudioEventTypeID
no params
Definition gameplay.c:555
const EventType DialogQueuedEventTypeID
no params
Definition gameplay.c:495
const EventType ClientRespawnEventTypeID
params: ClientRespawnEventParams
Definition gameplay.c:513
const EventType ClientConnectedEventTypeID
params: ClientConnectedEventParams
Definition gameplay.c:505
Param4< int, string, string, string > ChatMessageEventParams
channel, from, text, color config class
Definition gameplay.c:407
const EventType VONStopSpeakingEventTypeID
params: VONStopSpeakingEventParams
Definition gameplay.c:553
Param2< string, string > LoginStatusEventParams
text message for line 1, text message for line 2
Definition gameplay.c:441
const EventType MPSessionStartEventTypeID
no params
Definition gameplay.c:475
const EventType ClientNewReadyEventTypeID
params: ClientNewReadyEventParams
Definition gameplay.c:511
Param2< DayZPlayer, Object > PlayerDeathEventParams
Player, "Killer" (Beware: Not necessarily actually the killer, Client doesn't have this info)
Definition gameplay.c:461
Param2< PlayerIdentity, Man > ClientReconnectEventParams
PlayerIdentity, Man.
Definition gameplay.c:424
const EventType NetworkManagerClientEventTypeID
no params
Definition gameplay.c:491
const EventType PreloadEventTypeID
params: PreloadEventParams
Definition gameplay.c:535
Param1< int > ChatChannelEventParams
Definition gameplay.c:408
const EventType LoginTimeEventTypeID
params: LoginTimeEventParams
Definition gameplay.c:531
const EventType NetworkManagerServerEventTypeID
no params
Definition gameplay.c:493
Param1< PlayerIdentity > ConnectivityStatsUpdatedEventParams
PlayerIdentity.
Definition gameplay.c:437
Param2< string, string > ClientConnectedEventParams
Name, uid.
Definition gameplay.c:412
Param2< PlayerIdentity, Man > ClientReadyEventParams
PlayerIdentity, Man.
Definition gameplay.c:422
const EventType NetworkInputBufferEventTypeID
params: NetworkInputBufferEventParams
Definition gameplay.c:573
const EventType ServerFpsStatsUpdatedEventTypeID
params: ServerFpsStatsUpdatedEventParams
Definition gameplay.c:527
const EventType ConnectivityStatsUpdatedEventTypeID
params: ConnectivityStatsUpdatedEventParams
Definition gameplay.c:525
Param3< PlayerIdentity, vector, Serializer > ClientNewEventParams
PlayerIdentity, PlayerPos, Top, Bottom, Shoe, Skin.
Definition gameplay.c:416
Param2< PlayerIdentity, Man > ClientNewReadyEventParams
PlayerIdentity, Man.
Definition gameplay.c:418
class MenuDefaultCharacterData m_AttachmentSlots
proto native float GetDefault()
const EventType MPConnectionLostEventTypeID
params: MPConnectionLostEventParams
Definition gameplay.c:483
const EventType ClientDisconnectedEventTypeID
params: ClientDisconnectedEventParams
Definition gameplay.c:519
EntityAI SpawnEntity(string object_name, notnull InventoryLocation inv_loc, int iSetupFlags, int iRotation)
Definition gameplay.c:1526
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Definition gameplay.c:6
@ INORDER
Definition gameplay.c:8
@ LEVELORDER
Definition gameplay.c:10
@ POSTORDER
Definition gameplay.c:9
@ PREORDER
Definition gameplay.c:7
const EventType LogoutEventTypeID
params: LogoutEventParams
Definition gameplay.c:537
const EventType ScriptLogEventTypeID
params: ScriptLogEventParams
Definition gameplay.c:545
const EventType MPSessionPlayerReadyEventTypeID
no params
Definition gameplay.c:481
const EventType DLCOwnerShipFailedEventTypeID
params: DLCOwnerShipFailedParams
Definition gameplay.c:563
Param3< int, float, string > ProgressEventParams
state, progress, title
Definition gameplay.c:404
const int PROGRESS_FINISH
Definition gameplay.c:395
class ListOptionsAccess extends OptionsAccess ReadValue
OptionIDsScript
Used for script-based game options. For anything C++ based, you would most likely use "Option Access ...
Definition gameplay.c:1293
@ OPTION_CONNECTIVITY_INFO
Definition gameplay.c:1303
@ OPTION_HUD_VEHICLE
Definition gameplay.c:1295
@ OPTION_BLEEDINGINDICATION
Definition gameplay.c:1302
@ OPTION_PLAYER_MESSAGES
Definition gameplay.c:1299
@ OPTION_SERVER_INFO
Definition gameplay.c:1301
@ OPTION_GAME_MESSAGES
Definition gameplay.c:1297
@ OPTION_QUICKBAR
Definition gameplay.c:1300
@ OPTION_ADMIN_MESSAGES
Definition gameplay.c:1298
@ OPTION_AMBIENT_MUSIC_MODE
Definition gameplay.c:1305
@ OPTION_CROSSHAIR
Definition gameplay.c:1296
@ OPTION_HUD_BRIGHTNESS
Definition gameplay.c:1304
@ OPTION_HUD
Definition gameplay.c:1294
const EventType ChatChannelEventTypeID
params: ChatChannelEventParams
Definition gameplay.c:501
proto native CGame GetGame()
const EventType ProgressEventTypeID
params: ProgressEventParams
Definition gameplay.c:489
Param1< FreeDebugCamera > SetFreeCameraEventParams
Camera.
Definition gameplay.c:455
const EventType ClientReadyEventTypeID
params: ClientReadyEventParams
Definition gameplay.c:517
OptionAccessType
C++ OptionAccessType.
Definition gameplay.c:1224
@ AT_OPTIONS_MOUSE_YAXIS_AIM_MOD
Definition gameplay.c:1273
@ AT_UNKNOWN
Definition gameplay.c:1225
@ AT_OPTIONS_CONTROLLER_LS_YAXIS
Definition gameplay.c:1276
@ AT_QUALITY_PREFERENCE
Definition gameplay.c:1235
@ AT_OPTIONS_VON_THRESHOLD_SLIDER
Definition gameplay.c:1267
@ AT_ANISO_DETAIL
Definition gameplay.c:1231
@ AT_ASPECT_RATIO
Definition gameplay.c:1249
@ AT_VSYNC_VALUE
Definition gameplay.c:1230
@ AT_BLOOM
Definition gameplay.c:1238
@ AT_OPTIONS_TERRAIN
Definition gameplay.c:1241
@ AT_OPTIONS_OBJECT_VISIBILITY_COMBO
Definition gameplay.c:1288
@ AT_POSTPROCESS_EFFECTS
Definition gameplay.c:1234
@ AT_OPTIONS_VON_SLIDER
Definition gameplay.c:1253
@ AT_OPTIONS_FLIPMODE
Definition gameplay.c:1266
@ AT_OPTIONS_CONTROLLER_LS_XAXIS
Definition gameplay.c:1275
@ AT_SHADOW_DETAIL
Definition gameplay.c:1240
@ AT_OPTIONS_VISIBILITY_COMBO
Definition gameplay.c:1287
@ AT_OPTIONS_CONTROLLER_RS_DEADZONE
Definition gameplay.c:1285
@ AT_OPTIONS_HWACC
Definition gameplay.c:1255
@ AT_OPTIONS_BRIGHT_SLIDER
Definition gameplay.c:1244
@ AT_OPTIONS_CONTROLLER_RS_YAXIS_INVERTED
Definition gameplay.c:1278
@ AT_CONFIG_MOUSE_FILTERING
Definition gameplay.c:1259
@ AT_OPTIONS_MOUSE_XAXIS_AIM_MOD
Definition gameplay.c:1272
@ AT_OPTIONS_CONTROLLER_RS_YAXIS_AIM_MOD
Definition gameplay.c:1282
@ AT_OPTIONS_TERRAIN_SHADER
Definition gameplay.c:1262
@ AT_CONFIG_HEAD_BOB
Definition gameplay.c:1260
@ AT_OPTIONS_AIM_HELPER
Definition gameplay.c:1263
@ AT_OPTIONS_GAMMA_SLIDER
Definition gameplay.c:1243
@ AT_OPTIONS_FXAA_VALUE
Definition gameplay.c:1232
@ AT_HDR_DETAIL
Definition gameplay.c:1228
@ AT_OPTIONS_DISPLAY_MODE
Definition gameplay.c:1261
@ AT_OPTIONS_DRAWDISTANCE_SLIDER
Definition gameplay.c:1248
@ AT_FSAA_DETAIL
Definition gameplay.c:1229
@ AT_OPTIONS_EFFECTS_SLIDER
Definition gameplay.c:1252
@ AT_OPTIONS_MOUSE_YAXIS_INVERTED
Definition gameplay.c:1269
@ AT_OPTIONS_RADIO
Definition gameplay.c:1258
@ AT_OPTIONS_MOUSE_XAXIS
Definition gameplay.c:1270
@ AT_AMBIENT_OCCLUSION
Definition gameplay.c:1237
@ AT_OPTIONS_MUSIC_SLIDER
Definition gameplay.c:1251
@ AT_OPTIONS_MOUSE_AND_KEYBOARD
Definition gameplay.c:1264
@ AT_OPTIONS_CONTROLLER_LS_DEADZONE
Definition gameplay.c:1284
@ AT_OBJECTS_DETAIL
Definition gameplay.c:1226
@ AT_ROTATION_BLUR
Definition gameplay.c:1239
@ AT_OPTIONS_MOUSE_YAXIS
Definition gameplay.c:1271
@ AT_ATOC_DETAIL
Definition gameplay.c:1236
@ AT_OPTIONS_CONTROLLER_LS_XAXIS_VEHICLE_MOD
Definition gameplay.c:1277
@ AT_OPTIONS_LANGUAGE
Definition gameplay.c:1257
@ AT_TEXTURE_DETAIL
Definition gameplay.c:1227
@ AT_OPTIONS_EAX
Definition gameplay.c:1256
@ AT_OPTIONS_RESOLUTION
Definition gameplay.c:1242
@ AT_OPTIONS_CONTROLLER_RS_XAXIS
Definition gameplay.c:1279
@ AT_OPTIONS_VISIBILITY_SLIDER
Definition gameplay.c:1245
@ AT_OPTIONS_OBJECT_VISIBILITY_SLIDER
Definition gameplay.c:1246
@ AT_OPTIONS_MASTER_VOLUME
Definition gameplay.c:1254
@ AT_OPTIONS_PAUSE
Definition gameplay.c:1265
@ AT_OPTIONS_SW_VALUE
Definition gameplay.c:1233
@ AT_OPTIONS_CONTROLLER_RS_XAXIS_AIM_MOD
Definition gameplay.c:1281
@ AT_OPTIONS_VON_INPUT_MODE
Definition gameplay.c:1283
@ AT_OPTIONS_CONTROLLER_RS_YAXIS
Definition gameplay.c:1280
@ AT_OPTIONS_SHADOW_VISIBILITY_SLIDER
Definition gameplay.c:1247
@ AT_OPTIONS_FIELD_OF_VIEW
Definition gameplay.c:1250
Serializer ParamsWriteContext
Definition gameplay.c:16
const EventType ClientPrepareEventTypeID
params: ClientPrepareEventParams
Definition gameplay.c:507
const EventType ChatMessageEventTypeID
params: ChatMessageEventParams
Definition gameplay.c:499
const EventType ConnectingAbortEventTypeID
no params
Definition gameplay.c:569
proto native void WriteValue(float value)
void Error(string err)
Messagebox with error message.
Definition endebug.c:90
proto void Print(void var)
Prints content of variable to console/log.
enum ShapeType ErrorEx
array< string > TStringArray
Definition enscript.c:709
TypeID EventType
Definition enwidgets.c:55
Icon x
Icon y
void RefreshQuickbar()