4 [
Attribute(
"SOUND_VEHICLE_REPAIR_PARTIAL",
desc:
"Sound effect played when heal is updated and not done. Broadcast to players. Leave empty if no sfx",
category:
"Heal/Repair Support Station")]
7 [
Attribute(
desc:
"Sound effect played when Damage over Time is removed (Other than fire). Broadcast to players. Leave empty if no sfx",
category:
"Heal/Repair Support Station")]
25 SCR_AudioSourceConfiguration audioSourceConfiguration =
new SCR_AudioSourceConfiguration();
27 audioSourceConfiguration.m_sSoundEventName = soundEventName;
34 return audioSourceConfiguration;
60class SCR_BaseDamageHealSupportStationComponent : SCR_BaseSupportStationComponent
62 [
Attribute(
"500",
desc:
"Max damage healed each execute. If you hold the action it will heal each time the action ends",
category:
"Heal/Repair Support Station",
params:
"0.01 inf")]
63 protected float m_iDamageHealedEachExecution;
65 [
Attribute(
"100",
desc:
"Supply cost for ever 'Damage Healed Each Execution' damage healed. If the left over damage is less then it will of course be cheaper with a min value of 1",
category:
"Heal/Repair Support Station",
params:
"0 inf")]
66 protected int m_iSupplyCostDamageHealed;
68 [
Attribute(
"1",
desc:
"The max percentage that this support station can heal scaled. 1 == 100%, This is not calculated as a whole but for each hitZone. Aka if hitZone A is less than this percentage then the heal action can be executed even if total health is more than this %",
params:
"0.01 1",
category:
"Heal/Repair Support Station")]
69 protected float m_fMaxHealScaled;
72 [
Attribute(
"0.05",
desc:
"Hotfix: If server then this value is added on top of the m_fMaxHealScaled. This is because there is a potential desync of around 5% between client and server. EG: client can only heal up to 20% but server up to 25% so if client things the health is 19% and server things it is 21% the heal is still executed up to 25%",
params:
"0 0.10",
category:
"Heal/Repair Support Station")]
73 protected float m_fServerAddedMaxHealScaled;
75 [
Attribute(
desc:
"The DPS types that cost supplies to be healed/repaired. It will still remove the DPS effect even if it is not included here. It simply does not cost extra", uiwidget:
UIWidgets.SearchComboBox, enumType:
EDamageType,
category:
"Heal/Repair Support Station")]
76 protected ref array<EDamageType> m_aDoTTypesHealed;
78 [
Attribute(
"100",
desc:
"Supplies needed to heal conditions such as bleeding. Ignored if 0 or m_aDoTTypesHealed is empty. Fire uses own supply calculation",
params:
"0 inf 1",
category:
"Heal/Repair Support Station")]
79 protected int m_iSuppliesPerDoTHealed;
85 protected float m_fMaxDamageToHealSupplyCap = -1;
89 protected float GetMaxHealScaled()
91 if (m_fMaxHealScaled >= 1 ||
Replication.IsClient())
92 return m_fMaxHealScaled;
94 return Math.Clamp(m_fMaxHealScaled + m_fServerAddedMaxHealScaled, m_fMaxHealScaled, 1);
102 Debug.Error2(
"SCR_BaseDamageHealSupportStationComponent",
"'IsValid' fails as the damage heal support station is executed with a non SCR_BaseDamageHealSupportStationAction action! This is will break the support station!");
106 if (!super.IsValid(actionOwner, actionUser, action, actionPosition, reasonInvalid, supplyAmount))
110 array<HitZone> hitZones = {};
111 float damageToHeal =
GetDamageOrStateToHeal(actionOwner, actionUser, SCR_BaseDamageHealSupportStationAction.Cast(action), activeDot, hitZones);
113 if (activeDot == -1 && damageToHeal <= 0)
115 foreach (HitZone hitzone : hitZones)
120 reasonInvalid = m_eMaxHealDone;
136 action.GetHitZonesToHeal(hitZones);
143 foreach (
HitZone hitZone : hitZones)
145 if (hitZone.GetDamageOverTime(DoT))
154 return Math.Clamp(action.GetActionDamageManager().GetHitZonesDamage(GetMaxHealScaled(), hitZones), 0, m_iDamageHealedEachExecution);
160 m_fMaxDamageToHealSupplyCap = -1;
166 array<HitZone> hitZones = {};
177 if (damageToHeal <= 0)
181 float damageHealCost = (damageToHeal / m_iDamageHealedEachExecution) * m_iSupplyCostDamageHealed;
188 m_fMaxDamageToHealSupplyCap = (m_iDamageHealedEachExecution / m_iSupplyCostDamageHealed) * availableSupplies;
189 return availableSupplies;
215 array<HitZone> hitZones = {};
216 float damageToHeal =
GetDamageOrStateToHeal(actionOwner, actionUser, damageHealAction, activeDoT, hitZones);
219 if (m_fMaxDamageToHealSupplyCap > 0 && m_fMaxDamageToHealSupplyCap < damageToHeal)
220 damageToHeal = m_fMaxDamageToHealSupplyCap;
227 FindEntityIds(actionOwner, actionUser, ownerId, userId, playerId);
234 foreach (
HitZone hitZone : hitZones)
236 hitZone.SetDamageOverTime(activeDoT, 0);
249 float maxHealScaled = GetMaxHealScaled();
252 damageManager.HealHitZones(damageToHeal,
true, maxHealScaled, hitZones);
255 if (damageManager.GetHitZonesDamage(maxHealScaled, hitZones) > 0)
262 if (maxHealScaled >= 1)
286 IEntity actionOwner, actionUser;
331 SCR_DamageManagerComponent damageManager = SCR_DamageManagerComponent.GetDamageManager(actionOwner);
ESupportStationReasonInvalid
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
EAudioSourceConfigurationFlag
SCR_EDamageSupportStationHealState
@ HEAL_UPDATE
To notify the system that health was updated but healing is not done.
@ BLOOD_DONE_NOT_FULL_HEAL
To notify the system that blood amount was updated and healing is done, but the entity is not full bl...
@ FIRE_EXTINGUISH_DONE
To notify the system that the fire extinguish was updated but the fire state was removed.
@ FIRE_EXTINGUISH_UPDATE
To notify the system that the fire extinguish was updated but the fire state is not removed.
@ BLOOD_DONE
To notify the system that blood amount was updated and healing is done.
@ BLOOD_UPDATE
To notify the system that blood amount was updated but healing is not done.
@ HEAL_DONE_NOT_FULL_HEAL
To notify the system that health was updated and healing is done. But the entity is not full heal aka...
@ HEAL_DONE
To notify the system that health was updated and healing is done.
@ DOT_REMOVED
To notify the system that a Damage over time effect was removed.
override int GetSupplyAmountAction(IEntity actionOwner, IEntity actionUser, SCR_BaseUseSupportStationAction action)
float GetDamageOrStateToHeal(IEntity actionOwner, IEntity actionUser, notnull SCR_BaseDamageHealSupportStationAction action, out EDamageType activeDoT, out notnull array< HitZone > hitZones)
override void OnExecute(IEntity actionOwner, IEntity actionUser, int playerId, SCR_BaseUseSupportStationAction action)
void OnExecuteDamageSystemBroadcast(RplId ownerId, RplId userId, SCR_EDamageSupportStationHealState healState, int actionId, float healthScaled)
void OnExecuteDamageSystem(IEntity actionOwner, IEntity actionUser, SCR_EDamageSupportStationHealState healState, SCR_BaseDamageHealSupportStationAction action, float healthScaled)
void SendDamageSupportStationNotification(IEntity actionOwner, IEntity actionUser, SCR_BaseUseSupportStationAction action, SCR_EDamageSupportStationHealState healState, float healthScaled)
override void OnExecutedServer(notnull IEntity actionOwner, notnull IEntity actionUser, notnull SCR_BaseUseSupportStationAction action)
bool GetSendNotificationOnUse()
bool AreSuppliesEnabled()
void PlayCharacterVoiceEvent(IEntity character)
int m_iBaseSupplyCostOnUse
bool OnConsumeSuppliesServer(int amount)
void FindEntityIds(IEntity owner, IEntity user, out RplId ownerId, out RplId userId, out int playerId)
void GetEntitiesFromID(RplId ownerId, RplId userId, out IEntity owner, out IEntity user)
int GetMaxAvailableSupplies()
void OnSuccessfullyExecuted(IEntity actionOwner, IEntity actionUser, SCR_BaseUseSupportStationAction action)
void PlaySoundEffect(SCR_AudioSourceConfiguration audioConfig, notnull IEntity soundOwner, SCR_BaseUseSupportStationAction action)
SCR_AudioSourceConfiguration GetOnUseAudioConfig()
SCR_CharacterSoundComponentClass GetComponentData()
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
proto external Managed FindComponent(typename typeName)
Replication item identifier.
Allows healing of action owner (not user).
SCR_DamageManagerComponent GetActionDamageManager()
SCR_AudioSourceConfiguration CreateSoundAudioConfig(string soundEventName)
string m_sOnHealUpdateSoundEffectEventName
SCR_AudioSourceConfiguration GetOnHealUpdateAudioConfig()
ref SCR_AudioSourceConfiguration m_OnHealUpdateAudioSourceConfiguration
SCR_AudioSourceConfiguration GetOnDoTRemovedAudioConfig()
string m_sOnDoTRemovedSoundEffectEventName
ref SCR_AudioSourceConfiguration m_OnDoTRemovedAudioSourceConfiguration
ResourceName m_sOnUseSoundEffectFile
bool CanMoveWithPhysics()
static bool IsEmptyOrWhiteSpace(string input)
IEntity GetOwner()
Owner entity of the fuel tank.
SCR_FieldOfViewSettings Attribute
void RplRpc(RplChannel channel, RplRcver rcver, RplCondition condition=RplCondition.None, string customConditionName="")
RplChannel
Communication channel. Reliable is guaranteed to be delivered. Unreliable not.