6#define RESPAWN_TIMER_COMPONENT_DEBUG
14 protected ref array<ref SCR_RespawnTimer> m_aFactionRespawnTimers = {};
22 #ifdef RESPAWN_TIMER_COMPONENT_DEBUG
26 super.DrawDebugInfo();
28 DbgUI.Begin(
"Wave Respawn Diag");
31 DbgUI.Text(
"Allowed Players:");
35 string playerText =
string.Format(
"%1: %2", playerId, playerManager.GetPlayerName(playerId));
36 DbgUI.Text(playerText);
40 DbgUI.Text(
"Waiting Players:");
43 string playerText =
string.Format(
"%1: %2", playerId, playerManager.GetPlayerName(playerId));
44 DbgUI.Text(playerText);
53 DbgUI.Text(
"Faction Timers:");
57 Faction affiliatedFaction = factionManager.GetFactionByIndex(
index);
58 if (affiliatedFaction)
60 string factionText =
string.Format(
"%1: %2s (%3)",
index, respawnTimer.GetRemainingTime(timeNow), affiliatedFaction.GetFactionName());
61 DbgUI.Text(factionText);
91 Faction faction = factionManager.GetPlayerFaction(playerID);
92 int factionIndex = factionManager.GetFactionIndex(faction);
97 return m_aFactionRespawnTimers[factionIndex].GetRemainingTime(timeNow);
103 super.OnPlayerSpawnFinalize_S(requestComponent, handlerComponent,
data, entity);
105 if (!requestComponent)
108 int playerId = requestComponent.GetPlayerId();
111 if (allowedIndex != -1)
115 if (waitingIndex != -1)
124 super.OnPlayerKilled(instigatorContextData);
157 timer.
Start(rplTime);
169 int timersCount = m_aFactionRespawnTimers.Count();
175 for (
int i = 0; i < timersCount; i++)
184 for (
int playerIndex =
m_aWaitingPlayers.Count() -1; playerIndex >= 0; playerIndex--)
187 playerFaction = factionManager.GetPlayerFaction(playerId);
190 int factionIndex = factionManager.GetFactionIndex(playerFaction);
191 if (factionIndex == i)
221 super.OnPostInit(owner);
235 array<Faction> factions = {};
238 factionsCount = factionManager.GetFactionsList(factions);
243 for (
int i = 0; i < factionsCount; i++)
247 timer.
Start(timeNow.PlusSeconds(-m_fRespawnTime));
248 m_aFactionRespawnTimers.Insert(timer);
ArmaReforgerScripted GetGame()
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
SCR_CacheNoteComponentClass ScriptComponentClass RplProp()] protected ref array< string > m_aLines
RplComponent m_RplComponent
void OnPlayerKilled(notnull SCR_InstigatorContextData instigatorContextData)
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Get all prefabs that have the spawner data
void SCR_FactionManager(IEntitySource src, IEntity parent)
override void EOnFrame(IEntity owner, float timeSlice)
void OnPlayerDeleted(int playerId, IEntity player)
WorldTimestamp GetCurrentTime()
void SCR_RespawnTimerComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
bool GetCanPlayerSpawn(int playerID, float additionalTime=0)
int GetPlayerRemainingTime(int playerID, float additionalTime=0)
override void OnPlayerSpawnFinalize_S(SCR_SpawnRequestComponent requestComponent, SCR_SpawnHandlerComponent handlerComponent, SCR_SpawnData data, IEntity entity)
ref array< int > m_aWaitingPlayers
void RpcDo_StartFactionTimer(int factionIndex, WorldTimestamp rplTime)
ref array< int > m_aAllowedPlayers
proto external Managed FindComponent(typename typeName)
void Start(WorldTimestamp timeNow)
void SetDuration(float duration)
bool IsFinished(WorldTimestamp timeNow, float additionalTime=0)
override void EOnInit(IEntity owner)
EntityEvent
Various entity events.
void OnPlayerConnected(int playerId)
void RplRpc(RplChannel channel, RplRcver rcver, RplCondition condition=RplCondition.None, string customConditionName="")
RplChannel
Communication channel. Reliable is guaranteed to be delivered. Unreliable not.