Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
missionserver.c
Go to the documentation of this file.
1
2//: string uid of the player
4
5class MissionServer extends MissionBase
6{
7 ref array<Man> m_Players;
8 ref array<ref CorpseData> m_DeadPlayersArray;
9 ref map<PlayerBase, ref LogoutInfo> m_LogoutPlayers;
10 ref map<PlayerBase, ref LogoutInfo> m_NewLogoutPlayers;
11 ref RainProcurementHandler m_RainProcHandler;
12 const int SCHEDULER_PLAYERS_PER_TICK = 5;
13 int m_currentPlayer;
14 int m_RespawnMode;
15
16 // -----------------------
17 // ARTILLERY SOUNDS SETUP
18 // -----------------------
19 private float m_ArtyBarrageTimer = 0; // This is not to be edited in Init.c this is just to increment time
20
21 // Variables to be modified in Init.c
22 protected bool m_PlayArty = false; // Toggle if Off map artillery sounds are played
23 protected float m_ArtyDelay = 0; // Set how much time there is between two barrages (in seconds)
24 protected int m_MinSimultaneousStrikes = 0; // The MIN of simultaneous shots on the map (Will be clamped between 1 and max shots)
25 protected int m_MaxSimultaneousStrikes = 0; // The MAX of simultaneous shots on the map (Will be clamped between 1 and max amount of coords)
26 protected ref array<vector> m_FiringPos; // Where we should fire from. On Init set the relevant data
27
28 //All Chernarus firing coordinates
29 protected const ref array<vector> CHERNARUS_STRIKE_POS =
30 {
31 "-500.00 165.00 5231.69",
32 "-500.00 300.00 9934.41",
33 "10406.86 192.00 15860.00",
34 "4811.75 370.00 15860.00",
35 "-500.00 453.00 15860.00"
36 };
37
38 //All livonia firing coordinates
39 protected const ref array<vector> LIVONIA_STRIKE_POS =
40 {
41 "7440.00 417.00 -500.00",
42 "-500.00 276.00 5473.00",
43 "-500.00 265.00 9852.00",
44 "4953.00 240.00 13300.00",
45 "9620.00 188.00 13300.00",
46 "13300.00 204.00 10322.00",
47 "13300.00 288.00 6204.00",
48 "13300.00 296.00 -500.00"
49 };
50 // -----------------------
51 // END OF ARTILLERY SETUP
52 // -----------------------
53
56
58 {
59 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(this.UpdatePlayersStats, 30000, true);
60
61 m_DeadPlayersArray = new array<ref CorpseData>;
63 m_Players = new array<Man>;
64
65 m_LogoutPlayers = new map<PlayerBase, ref LogoutInfo>;
66 m_NewLogoutPlayers = new map<PlayerBase, ref LogoutInfo>;
67 m_RainProcHandler = new RainProcurementHandler(this);
68 m_ActiveRefresherLocations = new array<vector>();
69 }
70
72 {
73 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).Remove(this.UpdatePlayersStats);
74 }
75
76 override void OnInit()
77 {
78 super.OnInit();
79 CfgGameplayHandler.LoadData();
80 PlayerSpawnHandler.LoadData();
82 UndergroundAreaLoader.SpawnAllTriggerCarriers();
83 //Either pass consts in Init.c or insert all desired coords (or do both ;))
84 m_FiringPos = new array<vector>();
85 }
86
87 override void OnMissionStart()
88 {
89 super.OnMissionStart();
90
91 // We will load the Effect areas on Default mission start
92 EffectAreaLoader.CreateZones();
93 }
94
95 override void OnUpdate(float timeslice)
96 {
97 UpdateDummyScheduler();
98 TickScheduler(timeslice);
100 m_WorldData.UpdateBaseEnvTemperature(timeslice); // re-calculate base enviro temperature
101 m_RainProcHandler.Update(timeslice);
102
103 RandomArtillery(timeslice);
104
105 super.OnUpdate(timeslice);
106 }
107
109 {
110 m_RespawnMode = CfgGameplayHandler.GetDisableRespawnDialog();
111 GetGame().SetDebugMonitorEnabled(GetGame().ServerConfigGetInt("enableDebugMonitor"));
112
113 InitialiseWorldData();
114 }
115
116
117 void RandomArtillery(float deltaTime)
118 {
119 // ARTY barrage
120 if (m_PlayArty)
121 {
122 // We only perform timer checks and increments if we enabled the artillery barrage
123 if (m_ArtyBarrageTimer > m_ArtyDelay)
124 {
125 //We clamp to guarantee 1 and never have multiple shots on same pos, even in case of entry error
126 m_MaxSimultaneousStrikes = Math.Clamp(m_MaxSimultaneousStrikes, 1, m_FiringPos.Count());
127 m_MinSimultaneousStrikes = Math.Clamp(m_MinSimultaneousStrikes, 1, m_MaxSimultaneousStrikes);
128
129 // Variables to be used in this scope
130 int randPos; // Select random position
131 Param1<vector> pos; // The value to be sent through RPC
132 array<ref Param> params; // The RPC params
133
134 if (m_MaxSimultaneousStrikes == 1)
135 {
136 // We only have one set of coordinates to send
137 randPos = Math.RandomIntInclusive(0, m_FiringPos.Count() - 1);
138 pos = new Param1<vector>(m_FiringPos[randPos]);
139 params = new array<ref Param>;
140 params.Insert(pos);
141 GetGame().RPC(null, ERPCs.RPC_SOUND_ARTILLERY, params, true);
142 }
143 else
144 {
145 //We will do some extra steps to
146 /*
147 1. Send multiple coords (Send one RPC per coord set)
148 2. Ensure we don't have duplicates
149 */
150 array<int> usedIndices = new array<int>; // Will store all previusly fired upon indices
151
152 // We determine how many positions fire between MIN and MAX
153 int randFireNb = Math.RandomIntInclusive(m_MinSimultaneousStrikes, m_MaxSimultaneousStrikes);
154 for (int i = 0; i < randFireNb; i++)
155 {
156 randPos = Math.RandomIntInclusive(0, m_FiringPos.Count() - 1);
157
158 if (usedIndices.Count() <= 0 || usedIndices.Find(randPos) < 0) //We do not find the index or array is empty
159 {
160 // We prepare to send the message
161 pos = new Param1<vector>(m_FiringPos[randPos]);
162 params = new array<ref Param>;
163
164 // We send the message with this set of coords
165 params.Insert(pos);
166 GetGame().RPC(null, ERPCs.RPC_SOUND_ARTILLERY, params, true);
167
168 // We store the last used value
169 usedIndices.Insert(randPos);
170 }
171 }
172 }
173
174 // Reset timer for new loop
175 m_ArtyBarrageTimer = 0.0;
176 }
177
178 m_ArtyBarrageTimer += deltaTime;
179 }
180 }
181
182 override bool IsServer()
183 {
184 return true;
185 }
186
187 override bool IsPlayerDisconnecting(Man player)
188 {
189 return (m_LogoutPlayers && m_LogoutPlayers.Contains(PlayerBase.Cast(player))) || (m_NewLogoutPlayers && m_NewLogoutPlayers.Contains(PlayerBase.Cast(player)));
190 }
191
193 {
194 PluginLifespan moduleLifespan;
195 Class.CastTo(moduleLifespan, GetPlugin(PluginLifespan));
196 array<Man> players = new array<Man>();
197 GetGame().GetPlayers(players);
198
199 foreach (Man man : players)
200 {
201 PlayerBase player;
202 if (Class.CastTo(player, man))
203 {
204 player.StatUpdateByTime(AnalyticsManagerServer.STAT_PLAYTIME);
205 player.StatUpdateByPosition(AnalyticsManagerServer.STAT_DISTANCE);
206
207 moduleLifespan.UpdateLifespan(player);
208 }
209 }
210
212 }
213
214 protected void AddNewPlayerLogout(PlayerBase player, notnull LogoutInfo info)
215 {
216 m_LogoutPlayers.Insert(player, info);
217 m_NewLogoutPlayers.Remove(player);
218 }
219
220 // check if logout finished for some players
222 {
223 for (int i = 0; i < m_LogoutPlayers.Count();)
224 {
225 LogoutInfo info = m_LogoutPlayers.GetElement(i);
226
227 if (GetGame().GetTime() >= info.param1)
228 {
229 PlayerIdentity identity;
230 PlayerBase player = m_LogoutPlayers.GetKey(i);
231 if (player)
232 {
233 identity = player.GetIdentity();
234 m_LogoutPlayers.Remove(player);
235 }
236 else
237 {
238 m_LogoutPlayers.RemoveElement(i);
239 }
240
241 // disable reconnecting to old char
242 // GetGame().RemoveFromReconnectCache(info.param2);
243
244 PlayerDisconnected(player, identity, info.param2);
245 }
246 else
247 {
248 ++i;
249 }
250 }
251 }
252
253 override void OnEvent(EventType eventTypeId, Param params)
254 {
255 PlayerIdentity identity;
256 PlayerBase player;
257 int counter = 0;
258
259 switch (eventTypeId)
260 {
262 ClientPrepareEventParams clientPrepareParams;
263 Class.CastTo(clientPrepareParams, params);
264 CfgGameplayHandler.SyncDataSendEx(clientPrepareParams.param1);
265 UndergroundAreaLoader.SyncDataSend(clientPrepareParams.param1);
266 CfgPlayerRestrictedAreaHandler.SyncDataSend(clientPrepareParams.param1);
267 OnClientPrepareEvent(clientPrepareParams.param1, clientPrepareParams.param2, clientPrepareParams.param3, clientPrepareParams.param4, clientPrepareParams.param5);
268 break;
269
271 ClientNewEventParams newParams;
272 Class.CastTo(newParams, params);
273 player = OnClientNewEvent(newParams.param1, newParams.param2, newParams.param3);
274 if (!player)
275 {
276 Debug.Log("ClientNewEvent: Player is empty");
277 return;
278 }
279 identity = newParams.param1;
280 InvokeOnConnect(player,identity);
281 SyncEvents.SendPlayerList();
282
283 ControlPersonalLight(player);
284 SyncGlobalLighting(player);
285
286 break;
287
289 ClientReadyEventParams readyParams;
290 Class.CastTo(readyParams, params);
291 identity = readyParams.param1;
292 Class.CastTo(player, readyParams.param2);
293 if (!player)
294 {
295 Debug.Log("ClientReadyEvent: Player is empty");
296 return;
297 }
298
299 OnClientReadyEvent(identity, player);
300 InvokeOnConnect(player, identity);
301 // Send list of players at all clients
302 SyncEvents.SendPlayerList();
303 ControlPersonalLight(player);
304 SyncGlobalLighting(player);
305 break;
306
308 ClientRespawnEventParams respawnParams;
309 Class.CastTo(respawnParams, params);
310 identity = respawnParams.param1;
311 Class.CastTo(player, respawnParams.param2);
312 if (!player)
313 {
314 Debug.Log("ClientRespawnEvent: Player is empty");
315 return;
316 }
317
318 OnClientRespawnEvent(identity, player);
319 break;
320
322 ClientReconnectEventParams reconnectParams;
323 Class.CastTo(reconnectParams, params);
324
325 identity = reconnectParams.param1;
326 Class.CastTo(player, reconnectParams.param2);
327 if (!player)
328 {
329 Debug.Log("ClientReconnectEvent: Player is empty");
330 return;
331 }
332
333 OnClientReconnectEvent(identity, player);
334 break;
335
338 Class.CastTo(discoParams, params);
339
340 identity = discoParams.param1;
341 Class.CastTo(player, discoParams.param2);
342 int logoutTime = discoParams.param3;
343 bool authFailed = discoParams.param4;
344
345 if (!player)
346 {
347 Debug.Log("ClientDisconnectenEvent: Player is empty");
348 return;
349 }
350
351 OnClientDisconnectedEvent(identity, player, logoutTime, authFailed);
352 break;
353
355 LogoutCancelEventParams logoutCancelParams;
356
357 Class.CastTo(logoutCancelParams, params);
358 Class.CastTo(player, logoutCancelParams.param1);
359 identity = player.GetIdentity();
360 if (identity)
361 {
362 // disable reconnecting to old char
363 // GetGame().RemoveFromReconnectCache(identity.GetId());
364 Print("[Logout]: Player " + identity.GetId() + " cancelled");
365 }
366 else
367 {
368 Print("[Logout]: Player cancelled");
369 }
370 m_LogoutPlayers.Remove(player);
371 m_NewLogoutPlayers.Remove(player);
372 break;
373 }
374 }
375
377 {
378 Debug.Log("InvokeOnConnect:"+this.ToString(),"Connect");
379 if (player)
380 player.OnConnect();
381 }
382
384 {
385 Debug.Log("InvokeOnDisconnect:"+this.ToString(),"Connect");
386 if (player)
387 player.OnDisconnect();
388 }
389
390 void OnClientPrepareEvent(PlayerIdentity identity, out bool useDB, out vector pos, out float yaw, out int preloadTimeout)
391 {
392 if (GetHive())
393 {
394 // use character from database
395 useDB = true;
396 }
397 else
398 {
399 // use following data without database
400 useDB = false;
401 pos = "1189.3 0.0 5392.48";
402 yaw = 0;
403 }
404 }
405
406 // Enables/Disables personal light on the given player.
408 {
409 if (player)
410 {
411 bool is_personal_light = ! GetGame().ServerConfigGetInt("disablePersonalLight");
412 Param1<bool> personal_light_toggle = new Param1<bool>(is_personal_light);
413 GetGame().RPCSingleParam(player, ERPCs.RPC_TOGGLE_PERSONAL_LIGHT, personal_light_toggle, true, player.GetIdentity());
414 }
415 else
416 {
417 Error("Error! Player was not initialized at the right time. Thus cannot send RPC command to enable or disable personal light!");
418 }
419 }
420
421 // syncs global lighting setup from the server (lightingConfig server config parameter)
423 {
424 if (player)
425 {
426 int lightingID = GetGame().ServerConfigGetInt("lightingConfig");
427 Param1<int> lightID = new Param1<int>(lightingID);
428 GetGame().RPCSingleParam(player, ERPCs.RPC_SEND_LIGHTING_SETUP, lightID, true, player.GetIdentity());
429 }
430 }
431
434 {
435 //creates temporary server-side structure for handling default character spawn
436 return GetGame().GetMenuDefaultCharacterData(false).DeserializeCharacterData(ctx);
437 }
438
439 //
440 PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
441 {
442 Entity playerEnt;
443 playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");//Creates random player
444 Class.CastTo(m_player, playerEnt);
445
446 GetGame().SelectPlayer(identity, m_player);
447
448 return m_player;
449 }
450
453 {
454 int slot_ID;
455 string attachment_type;
456 for (int i = 0; i < DefaultCharacterCreationMethods.GetAttachmentSlotsArray().Count(); i++)
457 {
458 slot_ID = DefaultCharacterCreationMethods.GetAttachmentSlotsArray().Get(i);
459 attachment_type = "";
460 if (m_RespawnMode != GameConstants.RESPAWN_MODE_CUSTOM || !char_data.GetAttachmentMap().Find(slot_ID,attachment_type) || !VerifyAttachmentType(slot_ID,attachment_type)) //todo insert verification fn here
461 {
462 //randomize
463 if (DefaultCharacterCreationMethods.GetConfigArrayCountFromSlotID(slot_ID) > 0)
464 {
465 attachment_type = DefaultCharacterCreationMethods.GetConfigAttachmentTypes(slot_ID).GetRandomElement();
466 }
467 else //undefined, moving on
468 continue;
469 }
470
471 if (attachment_type != "")
472 {
473 m_player.GetInventory().CreateAttachmentEx(attachment_type,slot_ID);
474 }
475 }
476
478 }
479
481 void StartingEquipSetup(PlayerBase player, bool clothesChosen)
482 {
483 }
484
485 bool VerifyAttachmentType(int slot_ID, string attachment_type)
486 {
487 return DefaultCharacterCreationMethods.GetConfigAttachmentTypes(slot_ID).Find(attachment_type) > -1;
488 }
489
491 {
492 string characterType = GetGame().CreateRandomPlayer();
493 bool generateRandomEquip = false;
494
495 // get login data for new character
496 if (ProcessLoginData(ctx) && (m_RespawnMode == GameConstants.RESPAWN_MODE_CUSTOM) && !GetGame().GetMenuDefaultCharacterData(false).IsRandomCharacterForced())
497 {
498 if (GetGame().ListAvailableCharacters().Find(GetGame().GetMenuDefaultCharacterData().GetCharacterType()) > -1)
499 characterType = GetGame().GetMenuDefaultCharacterData().GetCharacterType();
500 }
501 else
502 {
503 generateRandomEquip = true;
504 }
505
506 if (PlayerSpawnHandler.IsInitialized())
507 {
508 PlayerSpawnPreset presetData = PlayerSpawnHandler.GetRandomCharacterPreset();
509 if (presetData && presetData.IsValid())
510 {
511 string presetCharType = presetData.GetRandomCharacterType();
512 if (presetCharType == string.Empty)
513 presetCharType = characterType;
514 if (CreateCharacter(identity, pos, ctx, presetCharType) != null)
515 {
516 PlayerSpawnHandler.ProcessEquipmentData(m_player,presetData);
517 return m_player;
518 }
519 else
520 {
521 ErrorEx("Failed to create character from type: " + presetCharType + ", using default spawning method");
522 }
523 }
524 else
525 {
526 ErrorEx("Failed to load PlayerSpawnPreset data properly, using default spawning method");
527 }
528 }
529
530 if (CreateCharacter(identity, pos, ctx, characterType))
531 {
532 if (generateRandomEquip)
533 GetGame().GetMenuDefaultCharacterData().GenerateRandomEquip();
534 EquipCharacter(GetGame().GetMenuDefaultCharacterData());
535 }
536
537 return m_player;
538 }
539
541 {
542 GetGame().SelectPlayer(identity, player);
543
544 #ifdef DIAG_DEVELOPER
545 if (FeatureTimeAccel.m_CurrentTimeAccel)
546 {
547 GetGame().RPCSingleParam(player, ERPCs.DIAG_TIMEACCEL_CLIENT_SYNC, FeatureTimeAccel.m_CurrentTimeAccel, true, identity);
548 }
549 #endif
550 }
551
553 {
554 if (player)
555 {
556 if (player.IsUnconscious() || player.IsRestrained())
557 {
558 PluginAdminLog adm = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
559 adm.PlayerKilledByRespawn(player);
560
561 // kill character
562 player.SetHealth("", "", 0.0);
563 }
564 }
565
566 #ifdef DIAG_DEVELOPER
567 if (FeatureTimeAccel.m_CurrentTimeAccel)
568 {
569 GetGame().RPCSingleParam(player, ERPCs.DIAG_TIMEACCEL_CLIENT_SYNC, FeatureTimeAccel.m_CurrentTimeAccel, true, identity);
570 }
571 #endif
572 }
573
575 {
576 if (player)
577 {
578 player.OnReconnect();
579 }
580 }
581
582 void OnClientDisconnectedEvent(PlayerIdentity identity, PlayerBase player, int logoutTime, bool authFailed)
583 {
584 bool disconnectNow = true;
585
586 // TODO: get out of vehicle
587 // using database and no saving if authorization failed
588 if (GetHive() && !authFailed)
589 {
590 if (player.IsAlive())
591 {
592 if (!m_LogoutPlayers.Contains(player) && !m_NewLogoutPlayers.Contains(player))
593 {
594 Print("[Logout]: New player " + identity.GetId() + " with logout time " + logoutTime.ToString());
595
596 // send statistics to client
597 player.StatSyncToClient();
598
599 // inform client about logout time
600 GetGame().SendLogoutTime(player, logoutTime);
601
602 // wait for some time before logout and save
603 LogoutInfo params = new LogoutInfo(GetGame().GetTime() + logoutTime * 1000, identity.GetId());
604
605 m_NewLogoutPlayers.Insert(player, params);
606 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(AddNewPlayerLogout, 0, false, player, params);
607
608 // allow reconnecting to old char only if not in cars, od ladders etc. as they cannot be properly synchronized for reconnect
609 //if (!player.GetCommand_Vehicle() && !player.GetCommand_Ladder())
610 //{
611 // GetGame().AddToReconnectCache(identity);
612 //}
613 // wait until logout timer runs out
614 disconnectNow = false;
615 }
616 return;
617 }
618 }
619
620 if (disconnectNow)
621 {
622 Print("[Logout]: New player " + identity.GetId() + " with instant logout");
623
624 // inform client about instant logout
625 GetGame().SendLogoutTime(player, 0);
626
627 PlayerDisconnected(player, identity, identity.GetId());
628 }
629 }
630
631 void PlayerDisconnected(PlayerBase player, PlayerIdentity identity, string uid)
632 {
633 // Note: At this point, identity can be already deleted
634 if (!player)
635 {
636 Print("[Logout]: Skipping player " + uid + ", already removed");
637 return;
638 }
639
640 // disable reconnecting to old char
641 //GetGame().RemoveFromReconnectCache(uid);
642
643 // now player can't cancel logout anymore, so call everything needed upon disconnect
644 InvokeOnDisconnect(player);
645
646 Print("[Logout]: Player " + uid + " finished");
647
648 if (GetHive())
649 {
650 // save player
651 player.Save();
652
653 // unlock player in DB
654 GetHive().CharacterExit(player);
655 }
656
657 // handle player's existing char in the world
658 player.ReleaseNetworkControls();
659 HandleBody(player);
660
661 // remove player from server
662 GetGame().DisconnectPlayer(identity, uid);
663 // Send list of players at all clients
664 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).CallLater(SyncEvents.SendPlayerList, 1000);
665 }
666
668 {
669 if (player.IsUnconscious() || player.IsRestrained())
670 {
671 switch (player.GetKickOffReason())
672 {
673 case EClientKicked.SERVER_EXIT:
674 return false;
675 case EClientKicked.KICK_ALL_ADMIN:
676 return false;
677 case EClientKicked.KICK_ALL_SERVER:
678 return false;
679 case EClientKicked.SERVER_SHUTDOWN:
680 return false;
681 default:
682 return true;
683 }
684 }
685
686 return false;
687 }
688
690 {
691 if (player.IsAlive())
692 {
693 if (ShouldPlayerBeKilled(player))
694 {
695 PluginAdminLog adm = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
696 adm.PlayerKilledByDisconnect(player);
697
698 player.SetHealth("", "", 0.0);//kill
699 }
700 else
701 {
702 player.Delete();// remove the body
703 }
704 }
705 }
706
707 void TickScheduler(float timeslice)
708 {
709 GetGame().GetWorld().GetPlayerList(m_Players);
710 int players_count = m_Players.Count();
711 int tick_count_max = Math.Min(players_count, SCHEDULER_PLAYERS_PER_TICK);
712
713 for (int i = 0; i < tick_count_max; i++)
714 {
715 if (m_currentPlayer >= players_count)
716 {
717 m_currentPlayer = 0;
718 }
719
720 PlayerBase currentPlayer = PlayerBase.Cast(m_Players.Get(m_currentPlayer));
721
722 if (currentPlayer)
723 currentPlayer.OnTick();
724 m_currentPlayer++;
725 }
726 }
727
728 //--------------------------------------------------
729 override bool InsertCorpse(Man player)
730 {
731 CorpseData corpse_data = new CorpseData(PlayerBase.Cast(player),GetGame().GetTime());
732 return m_DeadPlayersArray.Insert(corpse_data) >= 0;
733 }
734
736 {
737 if (m_DeadPlayersArray.Count() == 0)//nothing to process, abort
738 return;
739 int current_time = GetGame().GetTime();
740 array<int> invalid_corpses = new array<int>;
741 CorpseData corpse_data;
742
743 for (int i = 0; i < m_DeadPlayersArray.Count(); i++)
744 {
745 corpse_data = m_DeadPlayersArray.Get(i);
746 if (!corpse_data || (corpse_data && (!corpse_data.m_Player || !corpse_data.m_bUpdate)))
747 {
748 invalid_corpses.Insert(i);
749 }
750 else if (corpse_data.m_bUpdate && current_time - corpse_data.m_iLastUpdateTime >= 30000)
751 {
752 corpse_data.UpdateCorpseState();
753 corpse_data.m_iLastUpdateTime = current_time;
754 }
755 }
756
757 //cleanup
758 if (invalid_corpses.Count() > 0)
759 {
760 for (i = invalid_corpses.Count() - 1; i > -1; i--)
761 {
762 m_DeadPlayersArray.Remove(invalid_corpses.Get(i));
763 }
764 }
765 }
766 //--------------------------------------------------
767
768 override void SyncRespawnModeInfo(PlayerIdentity identity)
769 {
770 ScriptRPC rpc = new ScriptRPC();
771 rpc.Write(m_RespawnMode);
772 rpc.Send(null, ERPCs.RPC_SERVER_RESPAWN_MODE, true, identity);
773 }
774
776 {
777 return m_RainProcHandler;
778 }
779
781 {
782 return m_ActiveRefresherLocations;
783 }
784
786 PluginAdditionalInfo m_moduleDefaultCharacter;
787}
788
override string CreateRandomPlayer()
Definition dayzgame.c:3384
void SetDebugMonitorEnabled(int value)
Definition game.c:1137
proto int GetTime()
returns mission time in milliseconds
proto native int ServerConfigGetInt(string name)
Server config parsing. Returns 0 if not found.
MenuDefaultCharacterData GetMenuDefaultCharacterData(bool fill_data=true)
Definition game.c:1548
Super root of all classes in Enforce script.
Definition enscript.c:11
Definition debug.c:2
Definition camera.c:2
Definition enmath.c:7
void RandomArtillery(float deltaTime)
void ~MissionServer()
ref array< vector > m_FiringPos
void EquipCharacter(MenuDefaultCharacterData char_data)
Spawns character equip from received data. Checks validity against config, randomizes if invalid valu...
override void OnUpdate(float timeslice)
override void OnInit()
PluginAdditionalInfo m_moduleDefaultCharacter
DEPRECATED.
void AddNewPlayerLogout(PlayerBase player, notnull LogoutInfo info)
void SyncGlobalLighting(PlayerBase player)
override bool InsertCorpse(Man player)
void UpdateCorpseStatesServer()
override RainProcurementHandler GetRainProcurementHandler()
override void OnGameplayDataHandlerLoad()
void HandleBody(PlayerBase player)
void MissionServer()
override bool IsServer()
void TickScheduler(float timeslice)
override void OnEvent(EventType eventTypeId, Param params)
MissionBase m_mission
void UpdatePlayersStats()
bool ProcessLoginData(ParamsReadContext ctx)
returns whether received data is valid, ctx can be filled on client in StoreLoginData()
void InvokeOnConnect(PlayerBase player, PlayerIdentity identity)
PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
void PlayerDisconnected(PlayerBase player, PlayerIdentity identity, string uid)
bool ShouldPlayerBeKilled(PlayerBase player)
void InvokeOnDisconnect(PlayerBase player)
void ControlPersonalLight(PlayerBase player)
bool VerifyAttachmentType(int slot_ID, string attachment_type)
void StartingEquipSetup(PlayerBase player, bool clothesChosen)
can be overriden to manually set up starting equip. 'clothesChosen' is legacy parameter,...
PlayerBase m_player
void OnClientReadyEvent(PlayerIdentity identity, PlayerBase player)
void OnClientPrepareEvent(PlayerIdentity identity, out bool useDB, out vector pos, out float yaw, out int preloadTimeout)
override void SyncRespawnModeInfo(PlayerIdentity identity)
void OnClientDisconnectedEvent(PlayerIdentity identity, PlayerBase player, int logoutTime, bool authFailed)
void UpdateLogoutPlayers()
override void OnMissionStart()
void OnClientReconnectEvent(PlayerIdentity identity, PlayerBase player)
PlayerBase OnClientNewEvent(PlayerIdentity identity, vector pos, ParamsReadContext ctx)
override array< vector > GetActiveRefresherLocations()
void OnClientRespawnEvent(PlayerIdentity identity, PlayerBase player)
override bool IsPlayerDisconnecting(Man player)
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
Serialization general interface. Serializer API works with:
Definition serializer.c:56
void UpdateBaseEnvTemperature(float timeslice)
Definition worlddata.c:164
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
EClientKicked
proto string ToString()
WorldData m_WorldData
Definition environment.c:85
ERPCs
Definition erpcs.c:2
const EventType LogoutCancelEventTypeID
params: LogoutCancelEventParams
Definition gameplay.c:529
Param1< Man > LogoutCancelEventParams
Player.
Definition gameplay.c:435
const EventType ClientNewEventTypeID
params: ClientNewEventParams
Definition gameplay.c:509
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
const EventType ClientReconnectEventTypeID
params: ClientReconnectEventParams
Definition gameplay.c:515
Param4< PlayerIdentity, Man, int, bool > ClientDisconnectedEventParams
PlayerIdentity, Man, LogoutTime, AuthFailed.
Definition gameplay.c:426
const EventType ClientRespawnEventTypeID
params: ClientRespawnEventParams
Definition gameplay.c:513
const EventType ClientDisconnectedEventTypeID
params: ClientDisconnectedEventParams
Definition gameplay.c:519
proto native CGame GetGame()
const EventType ClientReadyEventTypeID
params: ClientReadyEventParams
Definition gameplay.c:517
const EventType ClientPrepareEventTypeID
params: ClientPrepareEventParams
Definition gameplay.c:507
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
const int CALL_CATEGORY_GAMEPLAY
Definition tools.c:10
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8
TypeID EventType
Definition enwidgets.c:55
Empty
Definition hand_states.c:14
proto native Hive GetHive()
Param2< int, string > LogoutInfo
int time of the logout end
float GetTime()
void PluginLifespan()
PluginBase GetPlugin(typename plugin_type)
DayZPlayer m_player