12 const int SCHEDULER_PLAYERS_PER_TICK = 5;
19 private float m_ArtyBarrageTimer = 0;
22 protected bool m_PlayArty =
false;
23 protected float m_ArtyDelay = 0;
24 protected int m_MinSimultaneousStrikes = 0;
25 protected int m_MaxSimultaneousStrikes = 0;
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"
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"
88 super.OnMissionStart();
96 UpdateDummyScheduler();
99 m_WorldData.UpdateBaseEnvTemperature(timeslice);
100 m_RainProcHandler.Update(timeslice);
104 super.OnUpdate(timeslice);
113 InitialiseWorldData();
123 if (m_ArtyBarrageTimer > m_ArtyDelay)
126 m_MaxSimultaneousStrikes =
Math.
Clamp(m_MaxSimultaneousStrikes, 1, m_FiringPos.Count());
127 m_MinSimultaneousStrikes =
Math.
Clamp(m_MinSimultaneousStrikes, 1, m_MaxSimultaneousStrikes);
134 if (m_MaxSimultaneousStrikes == 1)
138 pos =
new Param1<vector>(m_FiringPos[randPos]);
154 for (
int i = 0; i < randFireNb; i++)
158 if (usedIndices.Count() <= 0 || usedIndices.Find(randPos) < 0)
161 pos =
new Param1<vector>(m_FiringPos[randPos]);
169 usedIndices.Insert(randPos);
175 m_ArtyBarrageTimer = 0.0;
178 m_ArtyBarrageTimer += deltaTime;
189 return (m_LogoutPlayers && m_LogoutPlayers.Contains(
PlayerBase.Cast(player))) || (m_NewLogoutPlayers && m_NewLogoutPlayers.Contains(
PlayerBase.Cast(player)));
199 for (
int i = 0; i < players.Count(); i++)
206 player.StatUpdateByTime(
"playtime");
207 player.StatUpdateByPosition(
"dist");
209 module_lifespan.UpdateLifespan(player);
218 m_LogoutPlayers.Insert(player, info);
219 m_NewLogoutPlayers.Remove(player);
225 for (
int i = 0; i < m_LogoutPlayers.Count();)
227 LogoutInfo info = m_LogoutPlayers.GetElement(i);
232 PlayerBase player = m_LogoutPlayers.GetKey(i);
235 identity = player.GetIdentity();
236 m_LogoutPlayers.Remove(player);
240 m_LogoutPlayers.RemoveElement(i);
268 OnClientPrepareEvent(clientPrepareParams.param1, clientPrepareParams.param2, clientPrepareParams.param3, clientPrepareParams.param4, clientPrepareParams.param5);
274 player =
OnClientNewEvent(newParams.param1, newParams.param2, newParams.param3);
277 Debug.
Log(
"ClientNewEvent: Player is empty");
280 identity = newParams.param1;
292 identity = readyParams.param1;
296 Debug.
Log(
"ClientReadyEvent: Player is empty");
311 identity = respawnParams.param1;
315 Debug.
Log(
"ClientRespawnEvent: Player is empty");
326 identity = reconnectParams.param1;
330 Debug.
Log(
"ClientReconnectEvent: Player is empty");
341 identity = discoParams.param1;
343 int logoutTime = discoParams.param3;
344 bool authFailed = discoParams.param4;
348 Debug.
Log(
"ClientDisconnectenEvent: Player is empty");
360 identity = player.GetIdentity();
365 Print(
"[Logout]: Player " + identity.
GetId() +
" cancelled");
369 Print(
"[Logout]: Player cancelled");
371 m_LogoutPlayers.Remove(player);
372 m_NewLogoutPlayers.Remove(player);
388 player.OnDisconnect();
402 pos =
"1189.3 0.0 5392.48";
413 Param1<bool> personal_light_toggle =
new Param1<bool>(is_personal_light);
418 Error(
"Error! Player was not initialized at the right time. Thus cannot send RPC command to enable or disable personal light!");
428 Param1<int> lightID =
new Param1<int>(lightingID);
456 string attachment_type;
457 for (
int i = 0; i < DefaultCharacterCreationMethods.GetAttachmentSlotsArray().
Count(); i++)
459 slot_ID = DefaultCharacterCreationMethods.GetAttachmentSlotsArray().Get(i);
460 attachment_type =
"";
464 if (DefaultCharacterCreationMethods.GetConfigArrayCountFromSlotID(slot_ID) > 0)
466 attachment_type = DefaultCharacterCreationMethods.GetConfigAttachmentTypes(slot_ID).GetRandomElement();
472 if (attachment_type !=
"")
474 m_player.GetInventory().CreateAttachmentEx(attachment_type,slot_ID);
488 return DefaultCharacterCreationMethods.GetConfigAttachmentTypes(slot_ID).Find(attachment_type) > -1;
493 string characterType;
499 if (
GetGame().ListAvailableCharacters().Find(
GetGame().GetMenuDefaultCharacterData().GetCharacterType()) > -1)
522 #ifdef DIAG_DEVELOPER
523 if (FeatureTimeAccel.m_CurrentTimeAccel)
534 if (player.IsUnconscious() || player.IsRestrained())
537 player.SetHealth(
"",
"", 0.0);
541 #ifdef DIAG_DEVELOPER
542 if (FeatureTimeAccel.m_CurrentTimeAccel)
553 player.OnReconnect();
559 bool disconnectNow =
true;
565 if (player.IsAlive())
567 if (!m_LogoutPlayers.Contains(player) && !m_NewLogoutPlayers.Contains(player))
569 Print(
"[Logout]: New player " + identity.
GetId() +
" with logout time " + logoutTime.
ToString());
572 player.StatSyncToClient();
580 m_NewLogoutPlayers.Insert(player, params);
589 disconnectNow =
false;
597 Print(
"[Logout]: New player " + identity.
GetId() +
" with instant logout");
611 Print(
"[Logout]: Skipping player " + uid +
", already removed");
621 Print(
"[Logout]: Player " + uid +
" finished");
633 player.ReleaseNetworkControls();
644 if (player.IsUnconscious() || player.IsRestrained())
646 switch (player.GetKickOffReason())
666 if (player.IsAlive())
670 player.SetHealth(
"",
"", 0.0);
682 int players_count = m_Players.Count();
683 int tick_count_max =
Math.
Min(players_count, SCHEDULER_PLAYERS_PER_TICK);
685 for (
int i = 0; i < tick_count_max; i++)
687 if (m_currentPlayer >= players_count)
695 currentPlayer.OnTick();
704 return m_DeadPlayersArray.Insert(corpse_data) >= 0;
709 if (m_DeadPlayersArray.Count() == 0)
715 for (
int i = 0; i < m_DeadPlayersArray.Count(); i++)
717 corpse_data = m_DeadPlayersArray.Get(i);
718 if (!corpse_data || (corpse_data && (!corpse_data.
m_Player || !corpse_data.
m_bUpdate)))
720 invalid_corpses.Insert(i);
730 if (invalid_corpses.Count() > 0)
732 for (i = invalid_corpses.Count() - 1; i > -1; i--)
734 m_DeadPlayersArray.Remove(invalid_corpses.Get(i));
743 rpc.
Write(m_RespawnMode);
744 rpc.
Send(null,
ERPCs.RPC_SERVER_RESPAWN_MODE,
true, identity);
proto native Hive GetHive()
PluginBase GetPlugin(typename plugin_type)
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)
override string CreateRandomPlayer()
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)
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
void SetDebugMonitorEnabled(int value)
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.
void UpdateCorpseState(bool force_check=false)
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.
static void CreateZones()
proto native void CharacterExit(Man player)
protected ref array< vector > m_FiringPos
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 UpdateLogoutPlayers()
override bool InsertCorpse(Man player)
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)
void PlayerDisconnected(PlayerBase player, PlayerIdentity identity, string uid)
void InvokeOnConnect(PlayerBase player, PlayerIdentity identity)
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...
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)
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:
proto bool Write(void value_out)
static void SendPlayerList()
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
Param1< Man > LogoutCancelEventParams
Player.
const EventType ClientNewEventTypeID
params: ClientNewEventParams
Param5< PlayerIdentity, bool, vector, float, int > ClientPrepareEventParams
PlayerIdentity, useDB, pos, yaw, preloadTimeout (= additional time in seconds to how long server wait...
const EventType ClientReconnectEventTypeID
params: ClientReconnectEventParams
Param4< PlayerIdentity, Man, int, bool > ClientDisconnectedEventParams
PlayerIdentity, Man, LogoutTime, AuthFailed.
const EventType ClientRespawnEventTypeID
params: ClientRespawnEventParams
Param3< PlayerIdentity, vector, Serializer > ClientNewEventParams
PlayerIdentity, PlayerPos, Top, Bottom, Shoe, Skin.
const EventType ClientDisconnectedEventTypeID
params: ClientDisconnectedEventParams
proto native CGame GetGame()
const EventType ClientReadyEventTypeID
params: ClientReadyEventParams
const EventType ClientPrepareEventTypeID
params: ClientPrepareEventParams
void Error(string err)
Messagebox with error message.
proto void Print(void var)
Prints content of variable to console/log.
const int RESPAWN_MODE_CUSTOM
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].
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.
Param2< int, string > LogoutInfo
int time of the logout end