55 [
RplProp(onRplName:
"OnRplMainEntityFromID")]
82 super.OnOwnershipChanged(changing, becameOwner);
86 SocialComponent socialComp = SocialComponent.Cast(FindComponent(SocialComponent));
98 if (gameMode && !gameMode.
IsMaster())
100 SCR_MapMarkerManagerComponent markerManager = SCR_MapMarkerManagerComponent.Cast(gameMode.FindComponent(SCR_MapMarkerManagerComponent));
102 markerManager.RegisterLocalController(
this);
130 blocklist.UpdateBlockList();
164 PrintFormat(
"SCR_PlayerController::OnAuthorsRequestFinished - Number of UGC Authors: %1", activeUGCAuthors.Count(), level:
LogLevel.VERBOSE);
168 array<string> identityIDs = {};
169 foreach (SCR_EditableEntityAuthor author : activeUGCAuthors)
171 identityIDs.Insert(author.m_sAuthorUID);
176 bool isBlockedAuthorPresent;
177 foreach (SCR_EditableEntityAuthor author : activeUGCAuthors)
179 const bool isBlocked = blocklist.IsBlockedIdentity(author.m_sAuthorUID, author.m_ePlatform, author.m_sAuthorPlatformID);
183 "Blocked user left UGC in this world {identity: %1; account: %2; platform: %3}",
185 author.m_sAuthorPlatformID,
189 isBlockedAuthorPresent =
true;
194 if (isBlockedAuthorPresent)
204 Print(
"SCR_PlayerController - Name Cache Updated!",
LogLevel.VERBOSE);
212 world.PauseGameTime(
false);
220 SCR_NotificationsComponent.SendLocal(
ENotification.PLAYER_ON_BLOCKLIST_JOINED, playerID);
238 SCR_HeadTrackingSettings.SetHeadTrackingSettings();
246 SCR_FireModeManagerComponent fireModeMgr;
247 if (abandonedCharacter)
252 fireModeMgr.RemoveActionListeners();
256 if (!possessedCharacter)
262 fireModeMgr.SetUpAllActionListeners(possessedCharacter);
274 CharacterControllerComponent.SetStickyADS(stickyADS);
278 CharacterControllerComponent.SetStickyGadget(stickyGadgets);
280 bool mouseControlAircraft;
282 CharacterControllerComponent.SetMouseControlAircraft(mouseControlAircraft);
284 bool gamepadFreelookInAircraft;
285 if (
gameplaySettings.Get(
"m_bGamepadFreelookInAircraft", gamepadFreelookInAircraft))
286 CharacterControllerComponent.SetGamepadControlAircraft(!gamepadFreelookInAircraft);
290 VehicleControllerComponent.SetDrivingAssistanceMode(drivingAssistance);
293 BaseContainer fovSettings =
GetGame().GetGameUserSettings().GetModule(
"SCR_FieldOfViewSettings");
297 if (fovSettings.Get(
"m_fFocusInADS", focusInADS))
301 if (fovSettings.Get(
"m_fFocusInPIP", focusInPIP))
325 if (controlledEntity)
327 RplComponent rpl = RplComponent.Cast(controlledEntity.
FindComponent(RplComponent));
339 SCR_PossessingManagerComponent possessingManager = SCR_PossessingManagerComponent.GetInstance();
340 if (possessingManager)
344 RplComponent rpl = RplComponent.Cast(entity.
FindComponent(RplComponent));
364 SCR_PossessingManagerComponent possessingManager = SCR_PossessingManagerComponent.GetInstance();
365 if (possessingManager)
370 if (controlledEntity)
372 RplComponent rpl = RplComponent.Cast(controlledEntity.
FindComponent(RplComponent));
382 RplComponent rpl = RplComponent.Cast(
m_MainEntity.FindComponent(RplComponent));
410 RplComponent rpl = RplComponent.Cast(entity.FindComponent(RplComponent));
418 SCR_PossessingManagerComponent possessingManager = SCR_PossessingManagerComponent.GetInstance();
419 if (possessingManager)
469 AIControlComponent aiControl = AIControlComponent.Cast(entity.
FindComponent(AIControlComponent));
474 aiControl.ActivateAI();
476 aiControl.DeactivateAI();
483 PlayerController pPlayerController =
GetGame().GetPlayerController();
484 if (!pPlayerController)
487 return pPlayerController.GetPlayerId();
497 PlayerController pPlayerController =
GetGame().GetPlayerController();
498 if (pPlayerController)
499 return pPlayerController.GetControlledEntity();
514 if (playerController)
529 PlayerController playerController =
GetGame().GetPlayerController();
530 if (!playerController)
533 IEntity controlledEntity = playerController.GetControlledEntity();
534 if (!controlledEntity)
537 FactionAffiliationComponent factionAffiliation = FactionAffiliationComponent.Cast(controlledEntity.
FindComponent(FactionAffiliationComponent));
538 if (factionAffiliation)
539 return factionAffiliation.GetAffiliatedFaction();
554 if (!playerController)
558 if (!controlledEntity)
561 FactionAffiliationComponent factionAffiliation = FactionAffiliationComponent.Cast(controlledEntity.
FindComponent(FactionAffiliationComponent));
562 if (factionAffiliation)
563 return factionAffiliation.GetAffiliatedFaction();
572 super.OnDestroyed(killer);
573 IEntity killerEntity = killer.GetInstigatorEntity();
580 if (!s_pLocalPlayerController)
598 s_pLocalPlayerController =
this;
604 inputManager.AddActionListener(
"CharacterWalk",
EActionTrigger.DOWN, OnWalk);
605 inputManager.AddActionListener(
"CharacterWalk",
EActionTrigger.UP, OnEndWalk);
606 inputManager.AddActionListener(
"FocusToggle",
EActionTrigger.DOWN, ActionFocusToggle);
607 inputManager.AddActionListener(
"FocusToggleVehicle",
EActionTrigger.DOWN, ActionFocusToggleVehicle);
608 inputManager.AddActionListener(
"FocusToggleUnarmed",
EActionTrigger.DOWN, ActionFocusToggleUnarmed);
609 inputManager.AddActionListener(
"Inventory",
EActionTrigger.DOWN, ActionOpenInventory);
610 inputManager.AddActionListener(
"TacticalPing",
EActionTrigger.DOWN, ActionGesturePing);
611 inputManager.AddActionListener(
"TacticalPingHold",
EActionTrigger.DOWN, ActionGesturePingHold);
612 inputManager.AddActionListener(
"TacticalPingHold",
EActionTrigger.UP, ActionGesturePingHold);
620 bool disableControls =
GetGame().GetMenuManager().IsAnyMenuOpen();
624 SetDisableControls(disableControls);
643 int lrExitState = ladderCMD.CanExitLR();
644 if (lrExitState & 0x1)
646 Print(
"Can exit right");
648 if (lrExitState & 0x2)
650 Print(
"Can exit left");
659 if (characterController)
667 if (characterController)
685 private void SetDisableControls(
bool value)
688 if (!characterController)
691 characterController.SetDisableViewControls(value);
692 characterController.SetDisableWeaponControls(value);
693 characterController.SetDisableMovementControls(value)
702 float GetFocusValue(
float adsProgress = 0,
float dt = -1)
713 if (SCR_2DPIPSightsComponent.IsPIPActive())
718 focus *= Math.Min(adsProgress, 1);
726 float freelookAngle = headAiming.GetAimingRotation().Length();
727 float freelookFocus = 1 - Math.InverseLerp(1, 6, freelookAngle);
728 focus *= Math.Clamp(freelookFocus, 0, 1);
733 InputManager inputManager =
GetGame().GetInputManager();
736 bool inputDigital = inputManager.GetActionTriggered(
"Focus");
742 if (character && character.IsInVehicle())
772 bool isVehicleContextActive = inputManager.IsContextActive(
"CarContext") || inputManager.IsContextActive(
"TrackedContext") || inputManager.IsContextActive(
"HelicopterContext");
774 if (!isVehicleContextActive)
777 float focusAnalogue = Math.Sqrt(
FOCUS_ANALOGUE_SCALE * inputManager.GetActionValue(
"FocusAnalog"));
795 if (!isADS && character)
797 CompartmentAccessComponent compartmentAccess = character.GetCompartmentAccessComponent();
799 BaseCompartmentSlot compartment;
800 if (compartmentAccess)
801 compartment = compartmentAccess.GetCompartment();
803 TurretControllerComponent turretController;
805 turretController = TurretControllerComponent.Cast(compartment.GetController());
807 if (turretController)
808 isADS = turretController.IsWeaponADS();
817 else if (inputAnalogue < FOCUS_ACTIVATION && s_fFocusTimeout > 0)
835 input = inputAnalogue;
838 focus = Math.Max(focus, input);
841 focus = Math.Clamp(focus, 0, 1);
847 void SetIsBinocularsZoomed(
bool value)
854 bool GetIsBinocularsZoomed()
861 void SetGadgetFocus(
bool gadgetFocus)
868 bool GetGadgetFocus()
893 if (character && !character.IsInVehicle())
919 if (character && character.IsInVehicle())
965 void ActionOpenInventory()
967 IEntity entity = s_pLocalPlayerController.GetControlledEntity();
971 SCR_InventoryStorageManagerComponent inventory = SCR_InventoryStorageManagerComponent.Cast(entity.
FindComponent(SCR_InventoryStorageManagerComponent));
973 inventory.Action_OpenInventory();
1011 bool SetPlatformImageTo(
int playerID, notnull ImageWidget image, ImageWidget glow = null,
bool setVisible =
true,
bool showOnPC =
false,
bool showOnXbox =
false)
1013 PlayerManager playerMgr =
GetGame().GetPlayerManager();
1017 PlatformKind targetPlatformKind = playerMgr.GetPlatformKind(playerID);
1023 else if (!showOnPC && !showOnXbox)
1026 switch (ownPlatformKind)
1055 bool SetPlatformImageToKind(
PlatformKind targetPlatform, notnull ImageWidget image, ImageWidget glow = null,
bool setVisible =
true,
bool showOnPC =
false,
bool showOnXbox =
false)
1063 if (!showOnPC && !showOnXbox)
1066 switch (ownPlatformKind)
1108 image.SetVisible(
true);
1110 glow.SetVisible(
true);
1117 switch (targetPlatformKind)
1126 icon =
UIConstants.PLATFROM_PLAYSTATION_ICON_NAME;
1133 image.LoadImageFromSet(0,
UIConstants.ICONS_IMAGE_SET, icon);
1135 glow.LoadImageFromSet(0,
UIConstants.ICONS_GLOW_IMAGE_SET, icon);
1140 image.SetVisible(
true);
1142 glow.SetVisible(
true);
1149 switch (targetPlatformKind)
1158 icon =
UIConstants.PLATFROM_PLAYSTATION_ICON_NAME;
1165 image.LoadImageFromSet(0,
UIConstants.ICONS_IMAGE_SET, icon);
1167 glow.LoadImageFromSet(0,
UIConstants.ICONS_GLOW_IMAGE_SET, icon);
1172 image.SetVisible(
true);
1174 glow.SetVisible(
true);
ArmaReforgerScripted GetGame()
SCR_BaseGameMode GetGameMode()
SCR_CacheNoteComponentClass ScriptComponentClass RplProp()] protected ref array< string > m_aLines
void SCR_EditorManagerEntity(IEntitySource src, IEntity parent)
SCR_HelicopterControllerComponentClass gameplaySettings
func OnDestroyedPlayerController
ScriptInvokerBase< OnBeforePossessed > OnBeforePossessedInvoker
ScriptInvokerBase< OnDestroyedPlayerController > OnDestroyedPlayerControllerInvoker
func OnControlledEntityChangedPlayerController
ScriptInvokerBase< OnPossessed > OnPossessedInvoker
ScriptInvokerBase< OwnershipChangedDelegate > OnOwnershipChangedInvoker
ScriptInvokerBase< OnControlledEntityChangedPlayerController > OnControlledEntityChangedPlayerControllerInvoker
func OwnershipChangedDelegate
enum EVehicleType IEntity
proto external Managed FindComponent(typename typeName)
Replication item identifier.
Replication connection identity.
void SetNextSights(int direction=1)
void SetNextSightsFOVInfo(int direction=1, bool allowCycling=false)
SCR_FireModeManagerComponent GetControlledFireModeManager()
ref ScriptInvoker m_OnCancel
static SCR_ConfigurableDialogUi CreateFromPreset(ResourceName presetsResourceName, string tag, SCR_ConfigurableDialogUi customDialogObj=null)
Creates a dialog from preset.
void StartObservingControlledEntityChanges(notnull SCR_PlayerController controller, bool changing, bool becameOwner)
ref ScriptInvoker_AuthorRequestedFinishedEvent Event_OnAuthorsRegisteredFinished
Core component to manage SCR_EditorManagerEntity.
ref OnPossessedInvoker m_OnPossessed
ref OnDestroyedPlayerControllerInvoker m_OnDestroyed
void ChangeWeaponOptics()
void SetPossessedEntity(IEntity entity)
static int GetLocalPlayerId()
Returns either a valid ID of local player or 0.
static const float FOCUS_ACTIVATION
static const float FOCUS_ANALOGUE_SCALE
static const float FOCUS_DEACTIVATION
void OnPlayerRegistered(SCR_EditorManagerEntity managerEntity)
OnOwnershipChangedInvoker GetOnOwnershipChangedInvoker()
void OnPlayerNameCacheUpdate(bool success)
static const float WALK_SPEED
void OnRplMainEntityFromID()
static const float FOCUS_TOLERANCE
static void SetGameUserSettings()
override void OnOwnershipChanged(bool changing, bool becameOwner)
ref OnOwnershipChangedInvoker m_OnOwnershipChangedInvoker
void OnBlockedPlayerJoined(int playerID)
static const float FOCUS_TIMEOUT
static Faction GetLocalControlledEntityFaction()
void UpdateLocalPlayerController()
Find if this is local player controller. We assume that this never changes during scenario.
ref OnBeforePossessedInvoker m_OnBeforePossess
void SetPlatformImagePC(PlatformKind targetPlatformKind, notnull ImageWidget image, ImageWidget glow=null, bool setVisible=true)
override void OnDestroyed(notnull Instigator killer)
static float s_fFocusAnalogue
override void OnControlledEntityChanged(IEntity from, IEntity to)
void OnInit(IEntity owner)
void DisconnectFromGame()
void OnAuthorsRequestFinished(set< SCR_EditableEntityAuthor > activeUGCAuthors)
static float s_fFocusTimeout
bool m_bIsLocalPlayerController
void UpdateControls()
Update disabling of character controls in menus.
CharacterControllerComponent m_CharacterController
SCR_EFocusToggleMode m_eFocusToggle
ref OnControlledEntityChangedPlayerControllerInvoker m_OnControlledEntityChanged
override void OnUpdate(float timeSlice)
static IEntity GetLocalControlledEntity()
static Faction GetLocalMainEntityFaction()
void OnBlockedListUpdated(bool success)
static IEntity GetLocalMainEntity()
void SetInitialMainEntity(notnull IEntity entity)
void SetAIActivation(IEntity entity, bool activate)
bool m_bIsBinocularsZoomed
void ChangeMagnification(float value)
void SetPlatformImageXbox(PlatformKind targetPlatformKind, notnull ImageWidget image, ImageWidget glow=null, bool setVisible=true)
SCR_CharacterControllerComponent GetCharacterController()
void SetPlatformImagePSN(PlatformKind targetPlatformKind, notnull ImageWidget image, ImageWidget glow=null, bool setVisible=true)
void UpdateTurretFireModeControlls(IEntity from, IEntity to)
SCR_EditableEntityComponent GetControlledEntity()
EVehicleDrivingAssistanceMode
Player vehicle driving assistance modes. Individual features may become separate options in future.
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
proto void PrintFormat(string fmt, 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, LogLevel level=LogLevel.NORMAL)
proto external PlayerController GetPlayerController()
void SetControlledEntity(IEntity controlledEntity)
proto external int GetPlayerId()
proto external int GetRplIdentity()