3 [
Attribute(
"{00B4F7EE9753F658}Configs\CharacterLinking\BushTypeSlow.conf",
UIWidgets.ResourceNamePicker,
category:
"Foliage Slowdown")]
36 float m_fFaceAlphaTest = 0;
53 protected static const string SIGNAL_NAME_SPECIAL_CONTACT =
"SpecialContact";
54 protected static const string SIGNAL_NAME_SPECIAL_ENTITY_HEIGHT =
"SpecialContactEntityHeight";
62 m_pFactionComponent = FactionAffiliationComponent.Cast(FindComponent(FactionAffiliationComponent));
82 return faction.GetFactionKey();
90 RplComponent sourceRplComp = RplComponent.Cast(
Replication.FindItem(rplId));
94 IEntity soundEntity = sourceRplComp.GetEntity();
132 IEntity wpnEntity = wpnComp.GetOwner();
135 WeaponSoundComponent wpnSoundComp = WeaponSoundComponent.Cast(wpnEntity.
FindComponent(WeaponSoundComponent));
170 CompartmentAccessComponent access = GetCompartmentAccessComponent();
182 if (vehicle.GetPilotCompartmentSlot() != pilotSlot)
188 Physics physics = vehicle.GetPhysics();
192 return physics.GetVelocity().LengthSq() >= minSpeedSq;
230 bool isAuthority = characterRplComp && !characterRplComp.IsProxy();
232 RplComponent changedEntityRplComp;
235 RplId changedEntityRplId;
246 if (changedEntityRplComp)
247 changedEntityRplId = changedEntityRplComp.Id();
249 changedEntityRplId =
RplId.Invalid();
258 float highestModifiedHeight, evaluationModHeight;
263 SCR_SpecialCollisionHandlerComponent specialCollisionComponent;
264 foreach (
IEntity newContact : contacts)
269 specialCollisionComponent = SCR_SpecialCollisionHandlerComponent.Cast(newContact.FindComponent(SCR_SpecialCollisionHandlerComponent));
270 if (!specialCollisionComponent)
272 currentTree =
Tree.Cast(newContact);
277 newContact.GetBounds(mins, maxs);
279 currentTreeType =
TreeClass.Cast(currentTree.GetPrefabData()).SoundType;
282 if (evaluationModHeight > highestModifiedHeight)
283 highestModifiedHeight = evaluationModHeight;
291 if (changedEntityRplComp)
328 if (
RplId.Invalid() == changedEntityRplId)
334 RplComponent rplComp = RplComponent.Cast(
Replication.FindItem(changedEntityRplId));
338 IEntity changedEntity = rplComp.GetEntity();
356 array <SCR_SpecialCollisionDamageEffect> specialDamageEffects = {};
358 SCR_SpecialCollisionHandlerComponent specialCollisionComponent = SCR_SpecialCollisionHandlerComponent.Cast(newContact.FindComponent(SCR_SpecialCollisionHandlerComponent));
359 if (!specialCollisionComponent)
367 bool isAuthority = characterRplComp && characterRplComp.Role() ==
RplRole.Authority;
374 data.GetSpecialCollisionDamageEffects(specialDamageEffects);
378 effect.SetResponsibleEntity(newContact);
383 specialCollisionComponent.OnContactStart(
this);
388 int contactSignalId = signalsMgr.AddOrFindMPSignal(SIGNAL_NAME_SPECIAL_CONTACT, 1, 1);
389 if (contactSignalId < 0 ||
data.GetContactType() < 1)
392 signalsMgr.SetSignalValue(contactSignalId,
data.GetContactType());
394 int heightSignalId = signalsMgr.AddOrFindMPSignal(SIGNAL_NAME_SPECIAL_ENTITY_HEIGHT, 0.2, 1);
395 if (heightSignalId < 0)
398 signalsMgr.SetSignalValue(heightSignalId, specialCollisionComponent.GetContactHeight());
410 bool isAuthority = characterRplComp && characterRplComp.Role() ==
RplRole.Authority;
417 array<ref SCR_PersistentDamageEffect> effects = {};
418 damageMgr.GetPersistentEffects(effects);
429 specialEffect.Terminate();
437 int contactSignalId = signalsMgr.FindSignal(SIGNAL_NAME_SPECIAL_CONTACT);
438 if (contactSignalId < 0)
441 int heightSignalId = signalsMgr.FindSignal(SIGNAL_NAME_SPECIAL_ENTITY_HEIGHT);
444 signalsMgr.SetSignalValue(contactSignalId, 0);
445 if (heightSignalId >= 0)
446 signalsMgr.SetSignalValue(heightSignalId, 0);
452 for (
int lastId =
m_aContacts.Count() - 1; lastId >= 0; lastId--)
463 signalsMgr.SetSignalValue(contactSignalId, 0);
464 if (heightSignalId >= 0)
465 signalsMgr.SetSignalValue(heightSignalId, 0);
470 SCR_SpecialCollisionHandlerComponent specialCollisionComponent;
477 specialCollisionComponent = SCR_SpecialCollisionHandlerComponent.Cast(oldContact.FindComponent(SCR_SpecialCollisionHandlerComponent));
478 if (specialCollisionComponent)
480 specialCollisionComponent.OnContactEnd(
this);
484 if (
data && signalsMgr.GetSignalValue(contactSignalId) !=
data.GetContactType())
487 if (oldContact && lastContact.
GetPrefabData() == oldContact.GetPrefabData())
491 specialCollisionComponent = SCR_SpecialCollisionHandlerComponent.Cast(lastContact.
FindComponent(SCR_SpecialCollisionHandlerComponent));
492 if (!specialCollisionComponent)
496 signalsMgr.SetSignalValue(contactSignalId,
data.GetContactType());
497 if (heightSignalId < 0)
501 if (
data.GetContactType() != 0)
502 height = specialCollisionComponent.GetContactHeight();
504 signalsMgr.SetSignalValue(heightSignalId, height);
516 float speedLimit = 1;
535 if (tempLimit < speedLimit)
536 speedLimit = tempLimit;
546 if (characterSlowdownSystem)
547 characterSlowdownSystem.
Register(
this);
551 if (characterSlowdownSystem)
ArmaReforgerScripted GetGame()
SCR_CharacterControllerComponent GetCharacterController()
SCR_CacheNoteComponentClass ScriptComponentClass RplProp()] protected ref array< string > m_aLines
SCR_CampaignFaction GetFaction()
ref map< Managed, float > m_mSpeedReferences
void UpdateSlowdown(float transitionTime)
void RemoveOldContact(IEntity oldContact=null)
FactionAffiliationComponent m_pFactionComponent
override void OnSpecialContactsChagned(notnull array< IEntity > contacts)
This is called locally by the owner of the character.
SCR_ChimeraCharacterClass ChimeraCharacterClass NonSerialized()] float m_fFaceAlphaTest=0
void CalculateAndSetSlowdown(float bushModdedHeight)
void SetNewZoomLevel(int zoomLevel, bool increased, RplId rplId)
void SetSpeedLimit(Managed source, float limit)
void RPC_SetNewZoomLevel_BC(int zoomLevel, bool increased, RplId rplId)
Using RPC here because it is only for sound, so we don't care when weapon is streamed in.
void OverrideSpeed(float speed)
void RPC_SetIllumination_BC(bool state, RplId rplId)
Using RPC here because it is only for sound, so we don't care when weapon is streamed in.
void SetIllumination(bool illuminated, RplId rplId)
void AddNewContact(notnull IEntity newContact)
float GetModifiedBushHeight(float foliageHeight, ETreeSoundTypes treeType=ETreeSoundTypes.Bush)
void SetRecruited(bool recruited)
SCR_CharacterPerceivableComponent m_pPerceivableComponent
void RPC_SetIllumination_S(bool state, RplId rplId)
bool IsDriving(float minSpeedSq=-1)
ref array< IEntity > m_aContacts
void Rpc_ContactChanged(RplId changedEntityRplId, bool wasAdded)
void SetRecruitable(bool isRecruitable)
void RPC_SetNewZoomLevel_S(int zoomLevel, bool increased, RplId rplId)
Get all prefabs that have the spawner data
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
FactionKey GetFactionKey()
SCR_VehicleDamageManagerComponentClass GetPrefabData()
SCR_VehicleDamageManagerComponent GetDamageManager()
proto external Managed FindComponent(typename typeName)
proto external EntityPrefabData GetPrefabData()
Object holding reference to resource. In destructor release the resource.
Replication item identifier.
Config file to keep track of the different foliage types and the weight of the slowdown effect.
float GetHeightSlowEffectModifier(ETreeSoundTypes treeType)
Get the weight of the slowdown effect of the given tree type.
void AddSpecialContactEffect(notnull SCR_SpecialCollisionDamageEffect effect)
A system to help with easing the slowdown effect applied to the character.
void Register(notnull SCR_ChimeraCharacter character)
void Unregister(notnull SCR_ChimeraCharacter character)
ref Curve m_cFoliageHeightSlowCurve
SCR_BushTypeSlowConfig GetBushSlowTypeCfg()
ResourceName m_sBushSlowTypeCfgPath
Curve GetFoliageHeightSlowdownCurve()
static ref SCR_BushTypeSlowConfig s_BushSlowTypeCfg
static RplComponent GetEntityRplComponent(notnull IEntity entity)
IEntity GetResponsibleEntity()
enum EPhysicsLayerPresets Vehicle
override void EOnInit(IEntity owner)
SCR_FieldOfViewSettings Attribute
RplComponent GetRplComponent()
Returns the replication component associated to this entity.
RplRole
Role of replicated node (and all items in it) within the replication system.
void RplRpc(RplChannel channel, RplRcver rcver, RplCondition condition=RplCondition.None, string customConditionName="")
RplChannel
Communication channel. Reliable is guaranteed to be delivered. Unreliable not.