60 PPERequester_BurlapSackEffects,
61 PPERequester_FlashbangEffects
165 TargetActionInfoPanelBase tInfoPanel = TargetActionInfoPanelBase.Cast(panelType.Spawn());
166 tInfoPanel.SetParentWidget(
m_Root);
167 m_Root.AddChild(tInfoPanel.GetMainWidget(),
false);
174 tmp.Insert(tInfoPanel);
197 #ifdef PLATFORM_CONSOLE
219 bool showConsoleIcons =
false;
220 #ifdef PLATFORM_CONSOLE
221 showConsoleIcons =
g_Game.GetInput().GetCurrentInputDevice() ==
EInputDeviceType.CONTROLLER || !
g_Game.GetInput().IsEnabledMouseAndKeyboardEvenOnServer();
237 int q_min, q_max = -1;
250 SetInteractActionIcon(
"interact",
"interact_icon_frame",
"interact_btn_inner_icon",
"interact_btn_text");
254 SetInteractActionIcon(
"continuous_interact",
"continuous_interact_icon_frame",
"continuous_interact_btn_inner_icon",
"continuous_interact_btn_text");
334 if (isVisionObstructionActive ||
m_Hud.GetHudVisibility().IsContextFlagActive(IngameHudVisibility.HUD_HIDE_FLAGS))
368 else if (targetObject != null && !targetObject.IsHologram() && (targetObject.IsEntityAI() || targetObject.IsPlainObject() || targetObject.IsWoodBase() || targetObject.IsRock()) && (!targetParent || targetParent && !targetParent.IsHologram()))
405 m_Root.FindAnyWidget(widget +
"_btn_icon_xbox").Show(show_xbox_icon);
406 m_Root.FindAnyWidget(widget +
"_btn_icon").Show(!show_xbox_icon);
413 float parent_width, parent_height;
414 vector transformed_pos, screen_pos;
417 screen_pos =
g_Game.GetScreenPosRelative(pWorldPos);
419 m_Root.GetParent().GetScreenSize(parent_width, parent_height);
422 transformed_pos[0] = screen_pos[0] * parent_width;
423 transformed_pos[1] = screen_pos[1] * parent_height;
425 return transformed_pos;
430 const float DEFAULT_HANDLE_OFFSET = 0.2;
431 const string CE_CENTER_COMP_NAME =
"ce_center";
435 float pivotOffset = 0.0;
436 float memOffset = 0.0;
439 bool isTargetForced =
false;
454 compIdx =
m_Target.GetComponentIndex();
457 isTargetForced =
true;
468 compName =
object.GetActionComponentName(compIdx);
469 int namedComponentType =
object.GetActionComponentNameList(compIdx, components);
477 pivotOffset =
object.ConfigGetFloat(
"actionTargetPivotOffsetY");
478 memOffset =
object.ConfigGetFloat(
"actionTargetMemOffsetY");
481 lod =
object.GetLODByName(MEM_LOD_NAME);
488 if (MiscGameplayFunctions.IsComponentInSelection(memSelections, CE_CENTER_COMP_NAME))
490 for (
int i2 = 0; i2 < memSelections.Count(); ++i2)
492 if (memSelections[i2].
GetName() == CE_CENTER_COMP_NAME && memSelections[i2].GetVertexCount() == 1)
495 modelPos =
object.GetSelectionPositionMS(CE_CENTER_COMP_NAME);
496 worldPos =
object.ModelToWorld(modelPos);
497 if (memOffset != 0.0)
499 worldPos[1] = worldPos[1] + memOffset;
503 worldPos[1] = worldPos[1] + DEFAULT_HANDLE_OFFSET;
514 for (
int i1 = 0; i1 < memSelections.Count(); ++i1)
517 if (memSelections[i1].
GetName() == compName && memSelections[i1].GetVertexCount() == 1)
519 modelPos =
object.GetSelectionPositionMS(compName);
520 worldPos =
object.ModelToWorld(modelPos);
526 if (memOffset != 0.0)
528 worldPos[1] = worldPos[1] + memOffset;
532 worldPos[1] = worldPos[1] + DEFAULT_HANDLE_OFFSET;
537 if (memSelections[i1].
GetName() == compName && memSelections[i1].GetVertexCount() > 1)
539 for (
int j = 0; j < components.Count(); ++j)
543 modelPos =
object.GetSelectionPositionMS(components[j]);
544 worldPos =
object.ModelToWorld(modelPos);
547 if (memOffset != 0.0)
549 worldPos[1] = worldPos[1] + memOffset;
553 worldPos[1] = worldPos[1] + DEFAULT_HANDLE_OFFSET;
566 vector ladderHandlePointLS, ladderHandlePointWS;
568 float lastDistance = 0;
570 for (
int i3 = 0; i3 < memSelections.Count(); ++i3)
572 if (memSelections[i3].
GetName() == compName && memSelections[i3].GetVertexCount() > 1)
574 ladderHandlePointLS = memSelections[i3].GetVertexPosition(lod, 0);
575 ladderHandlePointWS =
object.ModelToWorld(ladderHandlePointLS);
576 closestHandlePos = ladderHandlePointWS;
579 for (
int k = 1; k < memSelections[i3].GetVertexCount(); ++k)
581 ladderHandlePointLS = memSelections[i3].GetVertexPosition(lod, k);
582 ladderHandlePointWS =
object.ModelToWorld(ladderHandlePointLS);
587 closestHandlePos = ladderHandlePointWS;
592 worldPos = closestHandlePos;
593 if (memOffset != 0.0)
595 worldPos[1] = worldPos[1] + memOffset;
599 worldPos[1] = worldPos[1] + DEFAULT_HANDLE_OFFSET;
629 isTargetForced =
false;
635 return MiscGameplayFunctions.IsComponentInSelection(selection, compName);
713 if (targetObj.IsItemBase())
717 item.GetInventory().GetCurrentInventoryLocation(invLocation);
728 if (action && action.GetText())
730 desc = action.GetText();
732 if (desc && action.DisplayTargetInActionText())
734 if (extraDescription)
735 desc =
string.
Format(
"%1 (%2)", desc, extraDescription);
755 if (!tgObject.IsAlive())
758 if (!tgParent || tgObject.DisplayNameRuinAttach())
759 desc = tgObject.GetDisplayName();
761 desc = tgParent.GetDisplayName();
767 if (tgParent && (tgParent.IsItemBase() || tgParent.IsTransport() || tgParent.CanUseConstruction()))
769 targetEntity =
EntityAI.Cast(tgParent);
772 if (tgObject.IsItemBase() || tgObject.IsTransport() || tgObject.CanUseConstruction())
774 targetEntity =
EntityAI.Cast(tgObject);
777 if (targetEntity && targetEntity.ShowZonesHealth())
787 if (DamageSystem.GetDamageZoneFromComponentName(targetEntity, tgObject.GetActionComponentName(
m_Target.GetComponentIndex(),
LOD.
NAME_FIRE), zone))
789 desc = DamageSystem.GetDamageDisplayName(targetEntity, zone);
794 targetEntity.GetActionComponentNameList(
m_Target.GetComponentIndex(), selections,
LOD.
NAME_VIEW);
797 for (
int s = 0; s < selections.Count(); s++)
799 if (DamageSystem.GetDamageZoneFromComponentName(targetEntity, selections[s], zone))
801 desc = DamageSystem.GetDamageDisplayName(targetEntity, zone);
808 if (targetEntity && desc ==
"")
809 desc = targetEntity.GetDisplayName();
836 if (!tgObject.IsAlive())
842 health = tgObject.GetHealthLevel();
847 if (tgParent && (tgParent.IsItemBase() || tgParent.IsTransport() || tgParent.CanUseConstruction()))
849 targetEntity =
EntityAI.Cast(tgParent);
852 if (tgObject.IsItemBase() || tgObject.IsTransport() || tgObject.CanUseConstruction())
854 targetEntity =
EntityAI.Cast(tgObject);
859 if (!targetEntity.IsDamageDestroyed())
867 if (DamageSystem.GetDamageZoneFromComponentName(targetEntity, tgObject.GetActionComponentName(
m_Target.GetComponentIndex(),
LOD.
NAME_FIRE), zone))
869 health = targetEntity.GetHealthLevel(zone);
875 targetEntity.GetActionComponentNameList(
m_Target.GetComponentIndex(), selections,
LOD.
NAME_VIEW);
877 for (
int s = 0; s < selections.Count(); s++)
879 if (DamageSystem.GetDamageZoneFromComponentName(targetEntity , selections[s], zone))
881 health = targetEntity.GetHealthLevel(zone);
888 health = targetEntity.GetHealthLevel();
893 health = tgObject.GetHealthLevel();
913 targetEntity =
EntityAI.Cast(tgParent);
917 targetEntity =
EntityAI.Cast(tgObject);
920 return (targetEntity && targetEntity.GetIsFrozen());
926 protected void GetItemQuantity(out
int q_type, out
float q_cur, out
int q_min, out
int q_max)
976 protected void SetItemDesc(
string descText,
int cargoCount,
string itemWidget,
string descWidget)
979 widget =
m_Root.FindAnyWidget(itemWidget);
984 string msg = playerT.GetLastUAMessage();
994 Class.
CastTo(itemName, widget.FindAnyWidget(descWidget));
998 descText =
string.
Format(
"[+] %1 %2", descText, msg);
1000 descText =
string.
Format(
"%1 %2", descText, msg);
1002 itemName.SetText(descText);
1006 protected void SetItemHealth(
int health,
string itemWidget,
string healthWidget,
bool enabled)
1012 ImageWidget healthMark;
1013 Class.
CastTo(healthMark, widget.FindAnyWidget(healthWidget));
1017 healthMark.GetParent().Show(
false);
1018 widget.Show(enabled);
1022 int color = 0x00FFFFFF;
1028 healthMark.SetColor(color);
1029 healthMark.SetAlpha(0.5);
1030 healthMark.GetParent().Show(
true);
1033 widget.Show(enabled);
1036 protected void SetItemQuantity(
int type,
float current,
int min,
int max,
string itemWidget,
string quantityPBWidget,
string quantityTextWidget,
bool enabled)
1040 widget =
m_Root.FindAnyWidget(itemWidget);
1044 ProgressBarWidget progressBar;
1046 Class.
CastTo(progressBar, widget.FindAnyWidget(quantityPBWidget));
1047 Class.
CastTo(textWidget, widget.FindAnyWidget(quantityTextWidget));
1053 progressBar.Show(
false);
1054 textWidget.Show(
false);
1055 textWidget.GetParent().Show(
false);
1058 if (max > 1 || current > 1)
1061 progressBar.Show(
false);
1062 textWidget.SetText(qty_text);
1063 textWidget.Show(
true);
1064 textWidget.GetParent().Show(
true);
1068 progressBar.Show(
false);
1069 textWidget.Show(
false);
1070 textWidget.GetParent().Show(
false);
1074 float qty_num =
Math.
Round((current / max) * 100);
1076 textWidget.Show(
false);
1077 progressBar.SetCurrent(qty_num);
1078 progressBar.Show(
true);
1079 textWidget.GetParent().Show(
true);
1094 if (action.HasTarget() &&
m_AM.GetActionState() < 1)
1097 Class.
CastTo(actionName, widget.FindAnyWidget(descWidget));
1099 if (action.GetInput().GetInputType() ==
ActionInputType.AIT_CONTINUOUS && action.CanBeStarted())
1101 string text = descText +
" " +
"#action_target_cursor_hold";
1102 actionName.SetText(text);
1106 actionName.SetText(descText);
1112 actionName.GetTextSize(
x,
y);
1118 if (!action.CanBeStarted())
1120 widget.FindAnyWidget(actionWidget +
"_btn_icon_xbox").SetAlpha(0.149);
1121 widget.FindAnyWidget(actionWidget +
"_btn_icon").SetAlpha(0.149);
1125 widget.FindAnyWidget(actionWidget +
"_btn_icon_xbox").SetAlpha(1.0);
1126 widget.FindAnyWidget(actionWidget +
"_btn_icon").SetAlpha(1.0);
1143 Widget widget, widget_not_select;
1145 widget =
m_Root.FindAnyWidget(multiActionsWidget);
1146 widget_not_select =
m_Root.FindAnyWidget(multiActionsWidget_NotSelect);
1153 widget_not_select.Show(
false);
1158 widget_not_select.Show(
true);
1164 widget_not_select.Show(
false);
1170 Widget widget, widget_not_select;
1172 widget =
m_Root.FindAnyWidget(multiActionsWidget);
1173 widget_not_select =
m_Root.FindAnyWidget(multiActionsWidget_NotSelect);
1180 widget_not_select.Show(
false);
1185 widget_not_select.Show(
true);
1191 widget_not_select.Show(
false);
1198 Widget widget, widget_not_select;
1200 widget =
m_Root.FindAnyWidget(multiActionsWidget);
1201 widget_not_select =
m_Root.FindAnyWidget(multiActionsWidget_NotSelect);
1208 widget_not_select.Show(
false);
1213 widget_not_select.Show(
true);
1219 widget_not_select.Show(
false);
1225 Widget widget, widget_not_select;
1227 widget =
m_Root.FindAnyWidget(multiActionsWidget);
1228 widget_not_select =
m_Root.FindAnyWidget(multiActionsWidget_NotSelect);
1235 widget_not_select.Show(
false);
1240 widget_not_select.Show(
true);
1246 widget_not_select.Show(
false);
1250 protected void SetInteractActionIcon(
string actionWidget,
string actionIconFrameWidget,
string actionIconWidget,
string actionIconTextWidget)
1253 ImageWidget iconWidget;
1256 widget =
m_Root.FindAnyWidget(actionWidget);
1257 Class.
CastTo(iconWidget, widget.FindAnyWidget(actionIconWidget));
1258 Class.
CastTo(textWidget, widget.FindAnyWidget(actionIconTextWidget));
1263 iconWidget.Show(
false);
1265 textWidget.Show(
true);
1274 bool update = action != null && action.IsTargetInfoAction();
1278 foreach (TargetActionInfoPanelBase panel : tmp)
1282 panel.UpdateTargetActionInfoPanel(action.GetClientActionInfo(),
m_Target);
1285 else if (panel.IsVisible())
1287 panel.PerformPanelCleanup();
1298 panel.PerformPanelCleanup();
1307 entity =
EntityAI.Cast(target.GetParent());
1314 w.Show(entity.IsRefresherSignalingViable() &&
m_Player.IsTargetInActiveRefresherRange(entity));
1319 int attachmentsWithInventory = 0;
1327 for (
int i = 0; i < inventory.AttachmentCount(); i++)
1329 EntityAI attachment = inventory.GetAttachmentFromIndex(i);
1330 int attachmentSlotId = attachment.GetInventory().GetSlotId(0);
1332 if (attachment.GetInventory())
1334 attachmentsWithInventory += 1;
1338 return attachmentsWithInventory;
1346 IngameHud hud = IngameHud.Cast(
mission.GetHud());
eBleedingSourceType GetType()
void ActionTarget(Object object, Object parent, int componentIndex, vector cursorHitPos, float utility, string surfaceName="")
override bool CanUseConstruction()
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
override bool HasFixedActionTargetCursorPosition()
InventoryLocationType
types of Inventory Location
void Store(Object obj, vector pos, int compIdx)
cache object and its world pos
vector GetCursorWorldPos()
void Invalidate()
invalidate cached objec
void UpdatePCIconsVisibility()
Contains logic for icon set switching (Gamepad/M&K)
void SetItemHealth(int health, string itemWidget, string healthWidget, bool enabled)
string GetItemDesc(ActionBase action)
void SetItemQuantity(int type, float current, int min, int max, string itemWidget, string quantityPBWidget, string quantityTextWidget, bool enabled)
void SetItemDesc(string descText, int cargoCount, string itemWidget, string descWidget)
void ActionTargetsCursor()
void InitActionInfoPanels()
void SetXboxIcon(string name, string imageset_name, string image_name)
void Update(bool fullUpdate=true)
const int ACTION_ORDER_SINGLE
bool IsComponentInSelection(array< Selection > selection, string compName)
void GetItemQuantity(out int q_type, out float q_cur, out int q_min, out int q_max)
const ref array< typename > VISION_OBSTRUCTION_PPEFFECTS_TYPES
void SetInteractXboxIcon(string imageset_name, string image_name)
void SetContinuousXboxIcon(string imageset_name, string image_name)
void GetOnScreenPosition(out float x, out float y)
const int ACTION_ORDER_INTERACT_CONTINUOUS
void SetMultipleItemAction(string multiActionsWidget, string multiActionsWidget_NotSelect)
void SetMultipleContinuousItemAction(string multiActionsWidget, string multiActionsWidget_NotSelect)
float m_MaxWidthChild
widget width
void SetQuantityVisibility(bool state)
void BuildFixedCursor(bool forceRebuild=true)
void UpdateControllerInputIcons()
Loads icons from the latest keybinds.
void SetHealthVisibility(bool state)
void SetContinuousInteractXboxIcon(string imageset_name, string image_name)
override bool OnUpdate(Widget w)
void OnInputPresetChanged()
int m_ContinuousInteractActionsNum
void CreateActionInfoPanel(typename panelType, int actionCategory)
void GetItemCargoCount(out int cargoCount)
returns number of items in cargo for targeted entity
void SetControllerIcon(string pWidgetName, string pInputName)
const int ACTION_ORDER_INTERACT_SINGLE
void CheckRefresherFlagVisibilityEx(ActionTarget target)
Object m_DisplayInteractTarget
void SetActionWidget(ActionBase action, string descText, string actionWidget, string descWidget)
void GetActions()
get actions from Action Manager
int m_ContinuousItemActionsNum
ActionBase m_ContinuousInteract
void OnWidgetScriptInit(Widget w)
string GetActionDesc(ActionBase action)
void SetMultipleInteractAction(string multiActionsWidget, string multiActionsWidget_NotSelect)
shows arrows near the interact action if there are more than one available
void SetInteractActionIcon(string actionWidget, string actionIconFrameWidget, string actionIconWidget, string actionIconTextWidget)
const int ACTION_ORDER_CONTINUOUS
ref array< ref TargetActionInfoPanelBase > m_ActiveInfoPanels
vector TransformToScreenPos(vector pWorldPos)
transform world pos to screen pos (related to parent widget size)
void OnInputDeviceChanged(EInputDeviceType pInputDeviceType)
void SetSingleXboxIcon(string imageset_name, string image_name)
void UpdateAdditionalActionInfo()
int AttachmentsWithInventoryOrCargoCount(notnull GameInventory inventory)
void SetMultipleContinuousInteractAction(string multiActionsWidget, string multiActionsWidget_NotSelect)
ref ATCCachedObject m_CachedObject
ref map< int, ref array< ref TargetActionInfoPanelBase > > m_TargetActionInfoPanelMap
void PrepareCursorContent()
void CheckRefresherFlagVisibility(Object object)
UAIDWrapper m_UseActionWrapper
void ShowXboxHidePCIcons(string widget, bool show_xbox_icon)
void ~ActionTargetsCursor()
ref map< int, ActionBase > m_ActionMap
void BuildFloatingCursor(bool forceRebuild)
proto native int GetItemCount()
represents base for cargo storage for entities
Super root of all classes in Enforce script.
script counterpart to engine's class Inventory
proto native int GetType()
returns type of InventoryLocation
override bool IsTakeable()
static int GetItemHealthColor(int pHealthLevel)
static const string NAME_FIRE
static const string NAME_MEMORY
static const string NAME_VIEW
proto native bool GetSelections(notnull out array< Selection > selections)
static PPEManager GetPPEManager()
Returns the manager instance singleton.
Static component of PPE manager, used to hold the instance.
static float GetItemQuantity(InventoryItem item)
static int HasItemQuantity(notnull EntityAI item)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto string ToString(bool simple=true)
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
const int QUANTITY_PROGRESS
const int QUANTITY_HIDDEN
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
void Obsolete(string msg="")
static proto float Round(float f)
Returns mathematical round of value.
static proto float AbsFloat(float f)
Returns absolute value.
proto void GetScreenSize(out int x, out int y)
proto native int Length()
Returns length of string.
static proto string ToString(void var, bool type=false, bool name=false, bool quotes=true)
Return string representation of variable.
proto int ToUpper()
Changes string to uppercase. Returns length.
bool Contains(string sample)
Returns true if sample is substring of string.
static proto string Format(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)
Gets n-th character from string.