DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
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{
12 const int SCHEDULER_PLAYERS_PER_TICK = 5;
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 PluginAdditionalInfo m_moduleDefaultCharacter;
57
59 {
60 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(this.UpdatePlayersStats, 30000, true);
61
62 m_DeadPlayersArray = new array<ref CorpseData>;
64 m_Players = new array<Man>;
65
66 m_LogoutPlayers = new map<PlayerBase, ref LogoutInfo>;
67 m_NewLogoutPlayers = new map<PlayerBase, ref LogoutInfo>;
68 m_RainProcHandler = new RainProcurementHandler(this);
69 }
70
72 {
73 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).Remove(this.UpdatePlayersStats);
74 }
75
76 override void OnInit()
77 {
78 //Print("OnInit()");
79 super.OnInit();
82 //Either pass consts in Init.c or insert all desired coords (or do both ;))
83 m_FiringPos = new array<vector>;
84 }
85
86 override void OnMissionStart()
87 {
88 super.OnMissionStart();
89
90 // We will load the Effect areas on Default mission start
92 }
93
94 override void OnUpdate(float timeslice)
95 {
96 UpdateDummyScheduler();
97 TickScheduler(timeslice);
99 m_WorldData.UpdateBaseEnvTemperature(timeslice); // re-calculate base enviro temperature
100 m_RainProcHandler.Update(timeslice);
101
102 RandomArtillery(timeslice);
103
104 super.OnUpdate(timeslice);
105 }
106
108 {
109 //Print("MissionServer - OnGameplayDataHandlerLoad()");
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 module_lifespan;
195 Class.CastTo(module_lifespan, GetPlugin(PluginLifespan));
196 array<Man> players = new array<Man>;
197 GetGame().GetPlayers(players);
198
199 for (int i = 0; i < players.Count(); i++)
200 {
201 PlayerBase player;
202 Class.CastTo(player, players.Get(i));
203 if (player)
204 {
205 // NEW STATS API
206 player.StatUpdateByTime("playtime");
207 player.StatUpdateByPosition("dist");
208
209 module_lifespan.UpdateLifespan(player);
210 }
211 }
212
214 }
215
216 protected void AddNewPlayerLogout(PlayerBase player, notnull LogoutInfo info)
217 {
218 m_LogoutPlayers.Insert(player, info);
219 m_NewLogoutPlayers.Remove(player);
220 }
221
222 // check if logout finished for some players
224 {
225 for (int i = 0; i < m_LogoutPlayers.Count();)
226 {
227 LogoutInfo info = m_LogoutPlayers.GetElement(i);
228
229 if (GetGame().GetTime() >= info.param1)
230 {
231 PlayerIdentity identity;
232 PlayerBase player = m_LogoutPlayers.GetKey(i);
233 if (player)
234 {
235 identity = player.GetIdentity();
236 m_LogoutPlayers.Remove(player);
237 }
238 else
239 {
240 m_LogoutPlayers.RemoveElement(i);
241 }
242
243 // disable reconnecting to old char
244 // GetGame().RemoveFromReconnectCache(info.param2);
245
246 PlayerDisconnected(player, identity, info.param2);
247 }
248 else
249 {
250 ++i;
251 }
252 }
253 }
254
255 override void OnEvent(EventType eventTypeId, Param params)
256 {
257 PlayerIdentity identity;
258 PlayerBase player;
259 int counter = 0;
260
261 switch (eventTypeId)
262 {
264 ClientPrepareEventParams clientPrepareParams;
265 Class.CastTo(clientPrepareParams, params);
266 CfgGameplayHandler.SyncDataSendEx(clientPrepareParams.param1);
267 UndergroundAreaLoader.SyncDataSend(clientPrepareParams.param1);
268 OnClientPrepareEvent(clientPrepareParams.param1, clientPrepareParams.param2, clientPrepareParams.param3, clientPrepareParams.param4, clientPrepareParams.param5);
269 break;
270
272 ClientNewEventParams newParams;
273 Class.CastTo(newParams, params);
274 player = OnClientNewEvent(newParams.param1, newParams.param2, newParams.param3);
275 if (!player)
276 {
277 Debug.Log("ClientNewEvent: Player is empty");
278 return;
279 }
280 identity = newParams.param1;
281 InvokeOnConnect(player,identity);
283
284 ControlPersonalLight(player);
285 SyncGlobalLighting(player);
286
287 break;
288
290 ClientReadyEventParams readyParams;
291 Class.CastTo(readyParams, params);
292 identity = readyParams.param1;
293 Class.CastTo(player, readyParams.param2);
294 if (!player)
295 {
296 Debug.Log("ClientReadyEvent: Player is empty");
297 return;
298 }
299
300 OnClientReadyEvent(identity, player);
301 InvokeOnConnect(player, identity);
302 // Send list of players at all clients
304 ControlPersonalLight(player);
305 SyncGlobalLighting(player);
306 break;
307
309 ClientRespawnEventParams respawnParams;
310 Class.CastTo(respawnParams, params);
311 identity = respawnParams.param1;
312 Class.CastTo(player, respawnParams.param2);
313 if (!player)
314 {
315 Debug.Log("ClientRespawnEvent: Player is empty");
316 return;
317 }
318
319 OnClientRespawnEvent(identity, player);
320 break;
321
323 ClientReconnectEventParams reconnectParams;
324 Class.CastTo(reconnectParams, params);
325
326 identity = reconnectParams.param1;
327 Class.CastTo(player, reconnectParams.param2);
328 if (!player)
329 {
330 Debug.Log("ClientReconnectEvent: Player is empty");
331 return;
332 }
333
334 OnClientReconnectEvent(identity, player);
335 break;
336
339 Class.CastTo(discoParams, params);
340
341 identity = discoParams.param1;
342 Class.CastTo(player, discoParams.param2);
343 int logoutTime = discoParams.param3;
344 bool authFailed = discoParams.param4;
345
346 if (!player)
347 {
348 Debug.Log("ClientDisconnectenEvent: Player is empty");
349 return;
350 }
351
352 OnClientDisconnectedEvent(identity, player, logoutTime, authFailed);
353 break;
354
356 LogoutCancelEventParams logoutCancelParams;
357
358 Class.CastTo(logoutCancelParams, params);
359 Class.CastTo(player, logoutCancelParams.param1);
360 identity = player.GetIdentity();
361 if (identity)
362 {
363 // disable reconnecting to old char
364 // GetGame().RemoveFromReconnectCache(identity.GetId());
365 Print("[Logout]: Player " + identity.GetId() + " cancelled");
366 }
367 else
368 {
369 Print("[Logout]: Player cancelled");
370 }
371 m_LogoutPlayers.Remove(player);
372 m_NewLogoutPlayers.Remove(player);
373 break;
374 }
375 }
376
378 {
379 Debug.Log("InvokeOnConnect:"+this.ToString(),"Connect");
380 if (player)
381 player.OnConnect();
382 }
383
385 {
386 Debug.Log("InvokeOnDisconnect:"+this.ToString(),"Connect");
387 if (player)
388 player.OnDisconnect();
389 }
390
391 void OnClientPrepareEvent(PlayerIdentity identity, out bool useDB, out vector pos, out float yaw, out int preloadTimeout)
392 {
393 if (GetHive())
394 {
395 // use character from database
396 useDB = true;
397 }
398 else
399 {
400 // use following data without database
401 useDB = false;
402 pos = "1189.3 0.0 5392.48";
403 yaw = 0;
404 }
405 }
406
407 // Enables/Disables personal light on the given player.
409 {
410 if (player)
411 {
412 bool is_personal_light = ! GetGame().ServerConfigGetInt("disablePersonalLight");
413 Param1<bool> personal_light_toggle = new Param1<bool>(is_personal_light);
414 GetGame().RPCSingleParam(player, ERPCs.RPC_TOGGLE_PERSONAL_LIGHT, personal_light_toggle, true, player.GetIdentity());
415 }
416 else
417 {
418 Error("Error! Player was not initialized at the right time. Thus cannot send RPC command to enable or disable personal light!");
419 }
420 }
421
422 // syncs global lighting setup from the server (lightingConfig server config parameter)
424 {
425 if (player)
426 {
427 int lightingID = GetGame().ServerConfigGetInt("lightingConfig");
428 Param1<int> lightID = new Param1<int>(lightingID);
429 GetGame().RPCSingleParam(player, ERPCs.RPC_SEND_LIGHTING_SETUP, lightID, true, player.GetIdentity());
430 }
431 }
432
435 {
436 //creates temporary server-side structure for handling default character spawn
438 }
439
440 //
441 PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
442 {
443 Entity playerEnt;
444 playerEnt = GetGame().CreatePlayer(identity, characterName, pos, 0, "NONE");//Creates random player
445 Class.CastTo(m_player, playerEnt);
446
447 GetGame().SelectPlayer(identity, m_player);
448
449 return m_player;
450 }
451
454 {
455 int slot_ID;
456 string attachment_type;
457 for (int i = 0; i < DefaultCharacterCreationMethods.GetAttachmentSlotsArray().Count(); i++)
458 {
459 slot_ID = DefaultCharacterCreationMethods.GetAttachmentSlotsArray().Get(i);
460 attachment_type = "";
461 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
462 {
463 //randomize
464 if (DefaultCharacterCreationMethods.GetConfigArrayCountFromSlotID(slot_ID) > 0)
465 {
466 attachment_type = DefaultCharacterCreationMethods.GetConfigAttachmentTypes(slot_ID).GetRandomElement();
467 }
468 else //undefined, moving on
469 continue;
470 }
471
472 if (attachment_type != "")
473 {
474 m_player.GetInventory().CreateAttachmentEx(attachment_type,slot_ID);
475 }
476 }
477
479 }
480
482 void StartingEquipSetup(PlayerBase player, bool clothesChosen)
483 {
484 }
485
486 bool VerifyAttachmentType(int slot_ID, string attachment_type)
487 {
488 return DefaultCharacterCreationMethods.GetConfigAttachmentTypes(slot_ID).Find(attachment_type) > -1;
489 }
490
492 {
493 string characterType;
494 //m_RespawnMode = GetGame().ServerConfigGetInt("setRespawnMode"); //todo - init somewhere safe
495 //SyncRespawnModeInfo(identity);
496 // get login data for new character
497 if (ProcessLoginData(ctx) && (m_RespawnMode == GameConstants.RESPAWN_MODE_CUSTOM) && !GetGame().GetMenuDefaultCharacterData(false).IsRandomCharacterForced())
498 {
499 if (GetGame().ListAvailableCharacters().Find(GetGame().GetMenuDefaultCharacterData().GetCharacterType()) > -1)
501 else //random type
502 characterType = GetGame().CreateRandomPlayer();
503 }
504 else
505 {
506 characterType = GetGame().CreateRandomPlayer();
508 }
509
510 if (CreateCharacter(identity, pos, ctx, characterType))
511 {
512 EquipCharacter(GetGame().GetMenuDefaultCharacterData());
513 }
514
515 return m_player;
516 }
517
519 {
520 GetGame().SelectPlayer(identity, player);
521
522 #ifdef DIAG_DEVELOPER
523 if (FeatureTimeAccel.m_CurrentTimeAccel)
524 {
525 GetGame().RPCSingleParam(player, ERPCs.DIAG_TIMEACCEL_CLIENT_SYNC, FeatureTimeAccel.m_CurrentTimeAccel, true, identity);
526 }
527 #endif
528 }
529
531 {
532 if (player)
533 {
534 if (player.IsUnconscious() || player.IsRestrained())
535 {
536 // kill character
537 player.SetHealth("", "", 0.0);
538 }
539 }
540
541 #ifdef DIAG_DEVELOPER
542 if (FeatureTimeAccel.m_CurrentTimeAccel)
543 {
544 GetGame().RPCSingleParam(player, ERPCs.DIAG_TIMEACCEL_CLIENT_SYNC, FeatureTimeAccel.m_CurrentTimeAccel, true, identity);
545 }
546 #endif
547 }
548
550 {
551 if (player)
552 {
553 player.OnReconnect();
554 }
555 }
556
557 void OnClientDisconnectedEvent(PlayerIdentity identity, PlayerBase player, int logoutTime, bool authFailed)
558 {
559 bool disconnectNow = true;
560
561 // TODO: get out of vehicle
562 // using database and no saving if authorization failed
563 if (GetHive() && !authFailed)
564 {
565 if (player.IsAlive())
566 {
567 if (!m_LogoutPlayers.Contains(player) && !m_NewLogoutPlayers.Contains(player))
568 {
569 Print("[Logout]: New player " + identity.GetId() + " with logout time " + logoutTime.ToString());
570
571 // send statistics to client
572 player.StatSyncToClient();
573
574 // inform client about logout time
575 GetGame().SendLogoutTime(player, logoutTime);
576
577 // wait for some time before logout and save
578 LogoutInfo params = new LogoutInfo(GetGame().GetTime() + logoutTime * 1000, identity.GetId());
579
580 m_NewLogoutPlayers.Insert(player, params);
581 GetGame().GetCallQueue(CALL_CATEGORY_GAMEPLAY).CallLater(AddNewPlayerLogout, 0, false, player, params);
582
583 // allow reconnecting to old char only if not in cars, od ladders etc. as they cannot be properly synchronized for reconnect
584 //if (!player.GetCommand_Vehicle() && !player.GetCommand_Ladder())
585 //{
586 // GetGame().AddToReconnectCache(identity);
587 //}
588 // wait until logout timer runs out
589 disconnectNow = false;
590 }
591 return;
592 }
593 }
594
595 if (disconnectNow)
596 {
597 Print("[Logout]: New player " + identity.GetId() + " with instant logout");
598
599 // inform client about instant logout
600 GetGame().SendLogoutTime(player, 0);
601
602 PlayerDisconnected(player, identity, identity.GetId());
603 }
604 }
605
606 void PlayerDisconnected(PlayerBase player, PlayerIdentity identity, string uid)
607 {
608 // Note: At this point, identity can be already deleted
609 if (!player)
610 {
611 Print("[Logout]: Skipping player " + uid + ", already removed");
612 return;
613 }
614
615 // disable reconnecting to old char
616 //GetGame().RemoveFromReconnectCache(uid);
617
618 // now player can't cancel logout anymore, so call everything needed upon disconnect
619 InvokeOnDisconnect(player);
620
621 Print("[Logout]: Player " + uid + " finished");
622
623 if (GetHive())
624 {
625 // save player
626 player.Save();
627
628 // unlock player in DB
629 GetHive().CharacterExit(player);
630 }
631
632 // handle player's existing char in the world
633 player.ReleaseNetworkControls();
634 HandleBody(player);
635
636 // remove player from server
637 GetGame().DisconnectPlayer(identity, uid);
638 // Send list of players at all clients
640 }
641
643 {
644 if (player.IsUnconscious() || player.IsRestrained())
645 {
646 switch (player.GetKickOffReason())
647 {
648 case EClientKicked.SERVER_EXIT:
649 return false;
650 case EClientKicked.KICK_ALL_ADMIN:
651 return false;
652 case EClientKicked.KICK_ALL_SERVER:
653 return false;
654 case EClientKicked.SERVER_SHUTDOWN:
655 return false;
656 default:
657 return true;
658 }
659 }
660
661 return false;
662 }
663
665 {
666 if (player.IsAlive())
667 {
668 if (ShouldPlayerBeKilled(player))
669 {
670 player.SetHealth("", "", 0.0);//kill
671 }
672 else
673 {
674 player.Delete();// remove the body
675 }
676 }
677 }
678
679 void TickScheduler(float timeslice)
680 {
681 GetGame().GetWorld().GetPlayerList(m_Players);
682 int players_count = m_Players.Count();
683 int tick_count_max = Math.Min(players_count, SCHEDULER_PLAYERS_PER_TICK);
684
685 for (int i = 0; i < tick_count_max; i++)
686 {
687 if (m_currentPlayer >= players_count)
688 {
689 m_currentPlayer = 0;
690 }
691
692 PlayerBase currentPlayer = PlayerBase.Cast(m_Players.Get(m_currentPlayer));
693
694 if (currentPlayer)
695 currentPlayer.OnTick();
696 m_currentPlayer++;
697 }
698 }
699
700 //--------------------------------------------------
701 override bool InsertCorpse(Man player)
702 {
703 CorpseData corpse_data = new CorpseData(PlayerBase.Cast(player),GetGame().GetTime());
704 return m_DeadPlayersArray.Insert(corpse_data) >= 0;
705 }
706
708 {
709 if (m_DeadPlayersArray.Count() == 0)//nothing to process, abort
710 return;
711 int current_time = GetGame().GetTime();
712 array<int> invalid_corpses = new array<int>;
713 CorpseData corpse_data;
714
715 for (int i = 0; i < m_DeadPlayersArray.Count(); i++)
716 {
717 corpse_data = m_DeadPlayersArray.Get(i);
718 if (!corpse_data || (corpse_data && (!corpse_data.m_Player || !corpse_data.m_bUpdate)))
719 {
720 invalid_corpses.Insert(i);
721 }
722 else if (corpse_data.m_bUpdate && current_time - corpse_data.m_iLastUpdateTime >= 30000)
723 {
724 corpse_data.UpdateCorpseState();
725 corpse_data.m_iLastUpdateTime = current_time;
726 }
727 }
728
729 //cleanup
730 if (invalid_corpses.Count() > 0)
731 {
732 for (i = invalid_corpses.Count() - 1; i > -1; i--)
733 {
734 m_DeadPlayersArray.Remove(invalid_corpses.Get(i));
735 }
736 }
737 }
738 //--------------------------------------------------
739
740 override void SyncRespawnModeInfo(PlayerIdentity identity)
741 {
742 ScriptRPC rpc = new ScriptRPC();
743 rpc.Write(m_RespawnMode);
744 rpc.Send(null, ERPCs.RPC_SERVER_RESPAWN_MODE, true, identity);
745 }
746
748 {
749 return m_RainProcHandler;
750 }
751}
752
EClientKicked
ERPCs
Definition ERPCs.c:2
proto string ToString()
proto native Hive GetHive()
float GetTime()
void PluginLifespan()
PluginBase GetPlugin(typename plugin_type)
DayZPlayer m_player
proto native int ServerConfigGetInt(string name)
Server config parsing. Returns 0 if not found.
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...
MenuDefaultCharacterData GetMenuDefaultCharacterData(bool fill_data=true)
Definition Game.c:1392
override string CreateRandomPlayer()
Definition DayZGame.c:3246
proto native void SelectPlayer(PlayerIdentity identity, Object player)
Selects player's controlled object.
proto native void GetPlayers(out array< Man > players)
override ScriptCallQueue GetCallQueue(int call_category)
Definition DayZGame.c:1153
proto native void DisconnectPlayer(PlayerIdentity identity, string uid="")
Destroy player info and disconnect.
proto native World GetWorld()
void RPCSingleParam(Object target, int rpc_type, Param param, bool guaranteed, PlayerIdentity recipient=null)
see CGame.RPC
Definition Game.c:882
void SetDebugMonitorEnabled(int value)
Definition Game.c:1021
proto native void SendLogoutTime(Object player, int time)
Inform client about logout time (creates logout screen on specified client)
proto native Entity CreatePlayer(PlayerIdentity identity, string name, vector pos, float radius, string spec)
Assign player entity to client (in multiplayer)
proto int GetTime()
returns mission time in milliseconds
static void SyncDataSendEx(notnull PlayerIdentity identity)
static bool GetDisableRespawnDialog()
Super root of all classes in Enforce script.
Definition EnScript.c:11
PlayerBase m_Player
Definition CorpseData.c:11
void UpdateCorpseState(bool force_check=false)
Definition CorpseData.c:29
bool m_bUpdate
Definition CorpseData.c:5
int m_iLastUpdateTime
Definition CorpseData.c:6
Definition Debug.c:14
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
Definition Debug.c:133
Definition Camera.c:2
proto native void CharacterExit(Man player)
Definition EnMath.c:7
bool DeserializeCharacterData(ParamsReadContext ctx)
Definition gameplay.c:1034
map< int, string > GetAttachmentMap()
Definition gameplay.c:1079
protected ref array< vector > m_FiringPos
void ~MissionServer()
override void OnInit()
protected void AddNewPlayerLogout(PlayerBase player, notnull LogoutInfo info)
PlayerBase CreateCharacter(PlayerIdentity identity, vector pos, ParamsReadContext ctx, string characterName)
override void OnMissionStart()
ref map< PlayerBase, ref LogoutInfo > m_LogoutPlayers
ref array< Man > m_Players
void SyncGlobalLighting(PlayerBase player)
void RandomArtillery(float deltaTime)
void StartingEquipSetup(PlayerBase player, bool clothesChosen)
can be overriden to manually set up starting equip. 'clothesChosen' is legacy parameter,...
void EquipCharacter(MenuDefaultCharacterData char_data)
Spawns character equip from received data. Checks validity against config, randomizes if invalid valu...
bool VerifyAttachmentType(int slot_ID, string attachment_type)
void OnClientRespawnEvent(PlayerIdentity identity, PlayerBase player)
void OnClientReadyEvent(PlayerIdentity identity, PlayerBase player)
void InvokeOnDisconnect(PlayerBase player)
PlayerBase OnClientNewEvent(PlayerIdentity identity, vector pos, ParamsReadContext ctx)
void MissionServer()
void UpdateLogoutPlayers()
override bool InsertCorpse(Man player)
override bool IsServer()
override void SyncRespawnModeInfo(PlayerIdentity identity)
override void OnEvent(EventType eventTypeId, Param params)
override void OnUpdate(float timeslice)
override RainProcurementHandler GetRainProcurementHandler()
void OnClientPrepareEvent(PlayerIdentity identity, out bool useDB, out vector pos, out float yaw, out int preloadTimeout)
override void OnGameplayDataHandlerLoad()
bool ShouldPlayerBeKilled(PlayerBase player)
void OnClientReconnectEvent(PlayerIdentity identity, PlayerBase player)
MissionBase m_mission
void PlayerDisconnected(PlayerBase player, PlayerIdentity identity, string uid)
void InvokeOnConnect(PlayerBase player, PlayerIdentity identity)
PlayerBase m_player
ref RainProcurementHandler m_RainProcHandler
ref map< PlayerBase, ref LogoutInfo > m_NewLogoutPlayers
void HandleBody(PlayerBase player)
void TickScheduler(float timeslice)
override bool IsPlayerDisconnecting(Man player)
bool ProcessLoginData(ParamsReadContext ctx)
returns whether received data is valid, ctx can be filled on client in StoreLoginData()
void UpdatePlayersStats()
void ControlPersonalLight(PlayerBase player)
PluginAdditionalInfo m_moduleDefaultCharacter
void OnClientDisconnectedEvent(PlayerIdentity identity, PlayerBase player, int logoutTime, bool authFailed)
ref array< ref CorpseData > m_DeadPlayersArray
void UpdateCorpseStatesServer()
Base Param Class with no parameters. Used as general purpose parameter overloaded with Param1 to Para...
Definition param.c:12
proto owned string GetId()
unique id of player (hashed steamID, database Xbox id...) can be used in database or logs
The class that will be instanced (moddable)
Definition gameplay.c:378
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto void Remove(func fn)
remove specific call from queue
proto native void Send(Object target, int rpc_type, bool guaranteed, PlayerIdentity recipient=NULL)
Initiate remote procedure call. When called on client, RPC is evaluated on server; When called on ser...
Serialization general interface. Serializer API works with:
Definition Serializer.c:56
proto bool Write(void value_out)
static void SendPlayerList()
Definition SyncEvents.c:46
static void SpawnAllTriggerCarriers()
static void SyncDataSend(PlayerIdentity identity)
proto native void GetPlayerList(out array< Man > players)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
const EventType LogoutCancelEventTypeID
params: LogoutCancelEventParams
Definition gameplay.c:516
Param1< Man > LogoutCancelEventParams
Player.
Definition gameplay.c:424
const EventType ClientNewEventTypeID
params: ClientNewEventParams
Definition gameplay.c:496
Param5< PlayerIdentity, bool, vector, float, int > ClientPrepareEventParams
PlayerIdentity, useDB, pos, yaw, preloadTimeout (= additional time in seconds to how long server wait...
Definition gameplay.c:403
const EventType ClientReconnectEventTypeID
params: ClientReconnectEventParams
Definition gameplay.c:502
Param4< PlayerIdentity, Man, int, bool > ClientDisconnectedEventParams
PlayerIdentity, Man, LogoutTime, AuthFailed.
Definition gameplay.c:415
const EventType ClientRespawnEventTypeID
params: ClientRespawnEventParams
Definition gameplay.c:500
Param3< PlayerIdentity, vector, Serializer > ClientNewEventParams
PlayerIdentity, PlayerPos, Top, Bottom, Shoe, Skin.
Definition gameplay.c:405
const EventType ClientDisconnectedEventTypeID
params: ClientDisconnectedEventParams
Definition gameplay.c:506
proto native CGame GetGame()
const EventType ClientReadyEventTypeID
params: ClientReadyEventParams
Definition gameplay.c:504
const EventType ClientPrepareEventTypeID
params: ClientPrepareEventParams
Definition gameplay.c:494
void Error(string err)
Messagebox with error message.
Definition EnDebug.c:90
proto void Print(void var)
Prints content of variable to console/log.
const int RESPAWN_MODE_CUSTOM
Definition constants.c:878
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
Definition EnMath.c:53
static proto float Min(float x, float y)
Returns smaller of two given values.
static proto string ToString(void var, bool type=false, bool name=false, bool quotes=true)
Return string representation of variable.
const int CALL_CATEGORY_GAMEPLAY
Definition tools.c:10
const int CALL_CATEGORY_SYSTEM
Definition tools.c:8
TypeID EventType
Definition EnWidgets.c:54
Param2< int, string > LogoutInfo
int time of the logout end