7 [
Attribute(
"0", UIWidgets.ComboBox,
"Stat to affect when used on self",
"", ParamEnumArray.FromEnum(
SCR_EDataStats) )]
10 [
Attribute(
"0", UIWidgets.ComboBox,
"Stat to affect when used on a different character",
"", ParamEnumArray.FromEnum(
SCR_EDataStats) )]
16 return m_eConsumableType;
23 return m_eDataStatsSelf;
25 return m_eDataStatsFriend;
32 [
Attribute(
"", UIWidgets.Object,
"Healing Items")]
33 protected ref array<ref ConsumableTypeStats> m_aConsumableTypes;
35 protected ref map<int, IEntity> m_mTrackedPlayers =
new map<int, IEntity>();
38 protected override void AddInvokers(IEntity player)
40 super.AddInvokers(player);
44 SCR_ChimeraCharacter chimeraPlayer = SCR_ChimeraCharacter.Cast(player);
49 if (!characterController)
52 characterController.m_OnItemUseEndedInvoker.Insert(HealingItemUsed);
56 protected override void RemoveInvokers(IEntity player)
58 super.RemoveInvokers(player);
62 SCR_ChimeraCharacter chimeraPlayer = SCR_ChimeraCharacter.Cast(player);
67 if (!characterController)
70 characterController.m_OnItemUseEndedInvoker.Remove(HealingItemUsed);
74 protected void HealingItemUsed(IEntity item,
bool ActionCompleted,
ItemUseParameters animParams)
76 if (!item || !ActionCompleted)
79 SCR_ConsumableItemComponent consumableItem = SCR_ConsumableItemComponent.Cast(item.FindComponent(SCR_ConsumableItemComponent));
83 IEntity user = consumableItem.GetCharacterOwner();
87 IEntity target = consumableItem.GetTargetCharacter();
91 int userID =
GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(user);
97 for (
int i = m_aConsumableTypes.Count() - 1; i >= 0; i--)
101 GetGame().GetDataCollector().GetPlayerData(userID).AddStat(m_aConsumableTypes[i].GetStat(target == user));
106 Print(
"SCR_DataCollectorHealingItemsModule:HealingItemUsed: Error: Unidentified Healing item typeId. Value is " + typeId +
".", LogLevel.WARNING);
110 override void OnPlayerSpawned(
int playerID, IEntity controlledEntity)
112 IEntity ent = m_mTrackedPlayers.Get(playerID);
116 AddInvokers(controlledEntity);
118 m_mTrackedPlayers.Insert(playerID, controlledEntity);
122 override void OnPlayerDisconnected(
int playerID, IEntity controlledEntity =
null)
124 m_mTrackedPlayers.Remove(playerID);
131 super.OnControlledEntityChanged(from, to);
135 int playerID =
GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(to);
136 m_mTrackedPlayers.Insert(playerID, to);
140 int playerID =
GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(from);
141 m_mTrackedPlayers.Remove(playerID);
147 override void Update(
float timeTick)
161 for (
int i = m_mTrackedPlayers.Count() - 1; i >= 0; i--)
163 playerId = m_mTrackedPlayers.GetKey(i);
164 playerData =
GetGame().GetDataCollector().GetPlayerData(playerId);
168 if (m_StatsVisualization)
170 m_StatsVisualization.Get(SCR_EHealingItemsModuleStats.BANDAGESSELF).SetText(playerData.GetStat(
SCR_EDataStats.BANDAGE_SELF).ToString());
171 m_StatsVisualization.Get(SCR_EHealingItemsModuleStats.BANDAGESFRIENDLIES).SetText(playerData.GetStat(
SCR_EDataStats.BANDAGE_FRIENDLIES).ToString());
172 m_StatsVisualization.Get(SCR_EHealingItemsModuleStats.TOURNIQUETSSELF).SetText(playerData.GetStat(
SCR_EDataStats.TOURNIQUET_SELF).ToString());
173 m_StatsVisualization.Get(SCR_EHealingItemsModuleStats.TOURNIQUETSFRIENDLIES).SetText(playerData.GetStat(
SCR_EDataStats.TOURNIQUET_FRIENDLIES).ToString());
174 m_StatsVisualization.Get(SCR_EHealingItemsModuleStats.SALINESELF).SetText(playerData.GetStat(
SCR_EDataStats.SALINE_SELF).ToString());
175 m_StatsVisualization.Get(SCR_EHealingItemsModuleStats.SALINEFRIENDLIES).SetText(playerData.GetStat(
SCR_EDataStats.SALINE_FRIENDLIES).ToString());
176 m_StatsVisualization.Get(SCR_EHealingItemsModuleStats.MORPHINESELF).SetText(playerData.GetStat(
SCR_EDataStats.MORPHINE_SELF).ToString());
177 m_StatsVisualization.Get(SCR_EHealingItemsModuleStats.MORPHINEFRIENDLIES).SetText(playerData.GetStat(
SCR_EDataStats.MORPHINE_FRIENDLIES).ToString());
186 override void CreateVisualization()
188 super.CreateVisualization();
189 if (!m_StatsVisualization)
192 CreateEntry(
"Bandages on self: ", 0, SCR_EHealingItemsModuleStats.BANDAGESSELF);
193 CreateEntry(
"Bandages on friendlies: ", 0, SCR_EHealingItemsModuleStats.BANDAGESFRIENDLIES);
194 CreateEntry(
"Tourniquets on self: ", 0, SCR_EHealingItemsModuleStats.TOURNIQUETSSELF);
195 CreateEntry(
"Tourniquets on friendlies: ", 0, SCR_EHealingItemsModuleStats.TOURNIQUETSFRIENDLIES);
196 CreateEntry(
"saline on self: ", 0, SCR_EHealingItemsModuleStats.SALINESELF);
197 CreateEntry(
"saline on friendlies: ", 0, SCR_EHealingItemsModuleStats.SALINEFRIENDLIES);
198 CreateEntry(
"Morphine on self: ", 0, SCR_EHealingItemsModuleStats.MORPHINESELF);
199 CreateEntry(
"Morphine on friendlies: ", 0, SCR_EHealingItemsModuleStats.MORPHINEFRIENDLIES);
205 enum SCR_EHealingItemsModuleStats
210 TOURNIQUETSFRIENDLIES,