47 int playerID = SCR_MapHelper<int, SCR_EditableEntityComponent>.GetKeyByValue(
m_MainEntities,entity);
51 return SCR_MapHelper<int, SCR_EditableEntityComponent>.GetKeyByValue(
m_PossessedEntities,entity);
55 return SCR_MapHelper<int, SCR_EditableEntityComponent>.GetKeyByValue(
m_PossessedEntities,entity) != 0;
95 if (!editorManager || !editorManager.IsOpened())
101 IEntity player = SCR_PossessingManagerComponent.GetPlayerMainEntity(editorManager.GetPlayerID());
106 if (parent == player)
207 Print(
"--------------------------------------------------",
LogLevel.DEBUG);
216 entity.
Log(
"",
true);
223 Print(
"--------------------------------------------------",
LogLevel.DEBUG);
240 Faction entityFaction = editableEntity.GetFaction();
246 SCR_PlayerControllerGroupComponent groupComponent = SCR_PlayerControllerGroupComponent.Cast(controller.FindComponent(SCR_PlayerControllerGroupComponent));
250 if (groupComponent.GetGroupID() == -1)
253 groupComponent.CreateAndJoinGroup(entityFaction);
258 SCR_AIGroup currentPlayerGroup = groupComponent.GetPlayersGroup();
259 if (!currentPlayerGroup)
263 if (playerOldFaction != entityFaction)
264 groupComponent.CreateAndJoinGroup(entityFaction);
270 FactionAffiliationComponent factionAffiliaton = FactionAffiliationComponent.Cast(controlledEntity.
FindComponent(FactionAffiliationComponent));
271 if (!factionAffiliaton)
274 factionAffiliaton.SetAffiliatedFaction(factionAffiliaton.GetAffiliatedFaction());
288 if (entity == entityPrev)
return;
356 if (!manager)
return;
359 if (playerID != manager.GetPlayerID())
375 if (playerController)
401 SCR_PossessingManagerComponent possessingManager = SCR_PossessingManagerComponent.GetInstance();
410 if (possessingManager)
420 if (possessingManager)
429 SCR_PossessingManagerComponent possessingManager = SCR_PossessingManagerComponent.GetInstance();
432 array<int> playerIDs =
new array<int>;
433 GetGame().GetPlayerManager().GetPlayers(playerIDs);
436 foreach (
auto playerID: playerIDs)
438 owner = SCR_PossessingManagerComponent.GetPlayerMainEntity(playerID);
442 if (possessingManager && possessingManager.IsPossessing(playerID))
444 owner =
GetGame().GetPlayerManager().GetPlayerControlledEntity(playerID);
476 super.EOnEditorInit();
ArmaReforgerScripted GetGame()
RplMode
Mode of replication.
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
SCR_BaseGameMode GetGameMode()
override int GetPlayerID()
void SCR_EditorManagerEntity(IEntitySource src, IEntity parent)
void Rpc(func method, void p0=NULL, void p1=NULL, void p2=NULL, void p3=NULL, void p4=NULL, void p5=NULL, void p6=NULL, void p7=NULL)
proto external Managed FindComponent(typename typeName)
proto external IEntity GetRootParent()
void SCR_BaseEditorComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
SCR_EditorManagerEntity GetManager()
ScriptInvokerBase< SCR_BaseGameMode_OnPlayerDisconnected > GetOnPlayerDisconnected()
ScriptInvokerBase< SCR_BaseGameMode_PlayerIdAndEntity > GetOnPlayerSpawned()
ScriptInvokerBase< SCR_BaseGameMode_PlayerId > GetOnPlayerConnected()
ScriptInvokerBase< SCR_BaseGameMode_OnControllableDestroyed > GetOnPlayerKilled()
void Log(string prefix="", bool onlyDirect=false, LogLevel logLevel=LogLevel.DEBUG)
static SCR_EditableEntityComponent GetEditableEntity(IEntity owner)
static bool IsPositionWithinTerrainBounds(vector pos)
static bool TeleportPlayer(int playerId, vector worldPosition, SCR_EPlayerTeleportedReason teleportReason=SCR_EPlayerTeleportedReason.DEFAULT)
void SetPossessedEntity(IEntity entity)
static int GetLocalPlayerId()
Returns either a valid ID of local player or 0.
static IEntity GetLocalMainEntity()
override void EOnEditorCloseServer()
ScriptInvoker GetOnConnected()
void OnEntityRegistered(SCR_EditableEntityComponent entity)
bool HasLocalPlayerSpawnedOnce()
ScriptInvoker GetOnSpawn()
ref ScriptInvoker Event_OnPossessed
void TeleportPlayerToPositionBroadcast(int playerId, vector position)
ResourceName m_DefaultPlayer
void TeleportPlayerToPositionServer(IEntity player, int playerId, vector position)
override void EOnEditorOpenServerCallback()
void OnDeathServer(notnull SCR_InstigatorContextData instigatorContextData)
void OnSpawnOwner(int playerID, int entityID)
bool IsPossessed(SCR_EditableEntityComponent entity)
void UpdatePlayerGroup(notnull SCR_EditableEntityComponent editableEntity, notnull IEntity controlledEntity, int playerID)
void OnSpawnServer(int playerID, IEntity controlledEntity)
ref ScriptInvoker Event_OnDeath
ref ScriptInvoker Event_OnSpawn
void OnDeathOwner(int playerID, int entityID, int killerID)
void OnDisconnectedServer(int playerID)
void UpdatePlayerFaction(SCR_EditableEntityComponent editableEntity, IEntity controlledEntity)
void OnPossessedServer(int playerID, IEntity controlledEntity, IEntity mainEntity, bool isPossessing)
ScriptInvoker GetOnPossessed()
void SetServerHandler(bool toAdd)
void RPC_TeleportPlayerToPositionServer(vector position)
int GetPlayers(notnull map< int, SCR_EditableEntityComponent > players)
override void EOnEditorOpen()
ref map< int, SCR_EditableEntityComponent > m_MainEntities
ref map< int, SCR_EditableEntityComponent > m_PossessedEntities
ref ScriptInvoker Event_OnConnected
void OnDisconnectedOwner(int playerID)
void OnPossessedOwner(int playerID, bool isPossessing, int entityID)
void TeleportPlayerToPosition(vector position)
override void EOnEditorInitServer()
ref ScriptInvoker Event_OnDisconnected
ScriptInvoker GetOnDeath()
void TeleportPlayerToPositionOwner(int playerId, vector position)
override void EOnEditorInit()
void OnConnectedOwner(int playerID)
void OnConnectedServer(int playerID)
SCR_EditableEntityComponent GetPlayerEntity(int playerID)
ScriptInvoker GetOnDisconnected()
override void EOnEditorClose()
override void EOnEditorDeleteServer()
int GetPlayerID(SCR_EditableEntityComponent entity)
void OnLimitedChange(bool isLimited)
bool m_LocalPlayerHasSpawnedOnce
proto external GenericEntity GetOwner()
Get owner entity.
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
SCR_FieldOfViewSettings Attribute
EEditorState
Unique editor state.
proto external PlayerController GetPlayerController()
void RplRpc(RplChannel channel, RplRcver rcver, RplCondition condition=RplCondition.None, string customConditionName="")
RplChannel
Communication channel. Reliable is guaranteed to be delivered. Unreliable not.