56 PPERequester_BurlapSackEffects,
57 PPERequester_FlashbangEffects
163 #ifdef PLATFORM_CONSOLE
185 bool showConsoleIcons =
false;
186 #ifdef PLATFORM_CONSOLE
187 showConsoleIcons =
g_Game.GetInput().GetCurrentInputDevice() ==
EInputDeviceType.CONTROLLER || !
g_Game.GetInput().IsEnabledMouseAndKeyboardEvenOnServer();
202 int q_min, q_max = -1;
215 SetInteractActionIcon(
"interact",
"interact_icon_frame",
"interact_btn_inner_icon",
"interact_btn_text");
219 SetInteractActionIcon(
"continuous_interact",
"continuous_interact_icon_frame",
"continuous_interact_btn_inner_icon",
"continuous_interact_btn_text");
244 float pos_x, pos_y = 0.0;
258 pos_x = screen_pos[0];
259 pos_y = screen_pos[1];
273 parentWdg.GetScreenSize(screen_w, screen_h);
274 m_Root.GetSize(wdg_w, wdg_h);
276 if (pos_x + wdg_w > screen_w)
277 pos_x = screen_w - wdg_w;
279 if (pos_y + wdg_h > screen_h)
280 pos_y = screen_h - wdg_h;
282 m_Root.SetPos(pos_x, pos_y);
337 if (isVisionObstructionActive ||
m_Hud.GetHudVisibility().IsContextFlagActive(IngameHudVisibility.HUD_HIDE_FLAGS))
452 m_Root.FindAnyWidget(widget +
"_btn_icon_xbox").Show(show_xbox_icon);
453 m_Root.FindAnyWidget(widget +
"_btn_icon").Show(!show_xbox_icon);
460 float parent_width, parent_height;
461 vector transformed_pos, screen_pos;
464 screen_pos =
g_Game.GetScreenPosRelative(pWorldPos);
466 m_Root.GetParent().GetScreenSize(parent_width, parent_height);
469 transformed_pos[0] = screen_pos[0] * parent_width;
470 transformed_pos[1] = screen_pos[1] * parent_height;
472 return transformed_pos;
477 const float DEFAULT_HANDLE_OFFSET = 0.2;
478 const string CE_CENTER_COMP_NAME =
"ce_center";
482 float pivotOffset = 0.0;
483 float memOffset = 0.0;
486 bool isTargetForced =
false;
501 compIdx =
m_Target.GetComponentIndex();
504 isTargetForced =
true;
515 compName =
object.GetActionComponentName(compIdx);
516 int namedComponentType =
object.GetActionComponentNameList(compIdx, components);
524 pivotOffset =
object.ConfigGetFloat(
"actionTargetPivotOffsetY");
525 memOffset =
object.ConfigGetFloat(
"actionTargetMemOffsetY");
528 lod =
object.GetLODByName(MEM_LOD_NAME);
535 if (MiscGameplayFunctions.IsComponentInSelection(memSelections, CE_CENTER_COMP_NAME))
537 for (
int i2 = 0; i2 < memSelections.Count(); ++i2)
539 if (memSelections[i2].
GetName() == CE_CENTER_COMP_NAME && memSelections[i2].GetVertexCount() == 1)
542 modelPos =
object.GetSelectionPositionMS(CE_CENTER_COMP_NAME);
543 worldPos =
object.ModelToWorld(modelPos);
544 if (memOffset != 0.0)
546 worldPos[1] = worldPos[1] + memOffset;
550 worldPos[1] = worldPos[1] + DEFAULT_HANDLE_OFFSET;
561 for (
int i1 = 0; i1 < memSelections.Count(); ++i1)
564 if (memSelections[i1].
GetName() == compName && memSelections[i1].GetVertexCount() == 1)
566 modelPos =
object.GetSelectionPositionMS(compName);
567 worldPos =
object.ModelToWorld(modelPos);
570 if (
object.
GetType() ==
"Fence" ||
object.
GetType() ==
"Watchttower" ||
object.
GetType() ==
"GardenPlot")
573 if (memOffset != 0.0)
575 worldPos[1] = worldPos[1] + memOffset;
579 worldPos[1] = worldPos[1] + DEFAULT_HANDLE_OFFSET;
584 if (memSelections[i1].
GetName() == compName && memSelections[i1].GetVertexCount() > 1)
586 for (
int j = 0; j < components.Count(); ++j)
590 modelPos =
object.GetSelectionPositionMS(components[j]);
591 worldPos =
object.ModelToWorld(modelPos);
594 if (memOffset != 0.0)
596 worldPos[1] = worldPos[1] + memOffset;
600 worldPos[1] = worldPos[1] + DEFAULT_HANDLE_OFFSET;
613 vector ladderHandlePointLS, ladderHandlePointWS;
615 float lastDistance = 0;
617 for (
int i3 = 0; i3 < memSelections.Count(); ++i3)
619 if (memSelections[i3].
GetName() == compName && memSelections[i3].GetVertexCount() > 1)
621 ladderHandlePointLS = memSelections[i3].GetVertexPosition(lod, 0);
622 ladderHandlePointWS =
object.ModelToWorld(ladderHandlePointLS);
623 closestHandlePos = ladderHandlePointWS;
626 for (
int k = 1; k < memSelections[i3].GetVertexCount(); ++k)
628 ladderHandlePointLS = memSelections[i3].GetVertexPosition(lod, k);
629 ladderHandlePointWS =
object.ModelToWorld(ladderHandlePointLS);
634 closestHandlePos = ladderHandlePointWS;
639 worldPos = closestHandlePos;
640 if (memOffset != 0.0)
642 worldPos[1] = worldPos[1] + memOffset;
646 worldPos[1] = worldPos[1] + DEFAULT_HANDLE_OFFSET;
676 isTargetForced =
false;
682 return MiscGameplayFunctions.IsComponentInSelection(selection, compName);
757 item.GetInventory().GetCurrentInventoryLocation(invLocation);
767 if (action && action.
GetText())
773 if (extraDescription)
774 desc =
string.
Format(
"%1 (%2)", desc, extraDescription);
794 if (!tgObject.IsAlive())
797 if (!tgParent || tgObject.DisplayNameRuinAttach())
798 desc = tgObject.GetDisplayName();
800 desc = tgParent.GetDisplayName();
806 if (tgParent && (tgParent.IsItemBase() || tgParent.IsTransport()))
808 targetEntity =
EntityAI.Cast(tgParent);
811 if (tgObject.IsItemBase() || tgObject.IsTransport())
813 targetEntity =
EntityAI.Cast(tgObject);
826 if (DamageSystem.GetDamageZoneFromComponentName(targetEntity, tgObject.GetActionComponentName(
m_Target.GetComponentIndex(),
LOD.
NAME_FIRE), zone))
828 desc = DamageSystem.GetDamageDisplayName(targetEntity, zone);
833 targetEntity.GetActionComponentNameList(
m_Target.GetComponentIndex(), selections,
LOD.
NAME_VIEW);
836 for (
int s = 0; s < selections.Count(); s++)
838 if (DamageSystem.GetDamageZoneFromComponentName(targetEntity, selections[s], zone))
840 desc = DamageSystem.GetDamageDisplayName(targetEntity, zone);
847 if (targetEntity && desc ==
"")
848 desc = targetEntity.GetDisplayName();
875 if (!tgObject.IsAlive())
881 health = tgObject.GetHealthLevel();
886 if (tgParent && (tgParent.IsItemBase() || tgParent.IsTransport()))
888 targetEntity =
EntityAI.Cast(tgParent);
891 if (tgObject.IsItemBase() || tgObject.IsTransport())
893 targetEntity =
EntityAI.Cast(tgObject);
898 if (!targetEntity.IsDamageDestroyed())
906 if (DamageSystem.GetDamageZoneFromComponentName(targetEntity, tgObject.GetActionComponentName(
m_Target.GetComponentIndex(),
LOD.
NAME_FIRE), zone))
908 health = targetEntity.GetHealthLevel(zone);
914 targetEntity.GetActionComponentNameList(
m_Target.GetComponentIndex(), selections,
LOD.
NAME_VIEW);
916 for (
int s = 0; s < selections.Count(); s++)
918 if (DamageSystem.GetDamageZoneFromComponentName(targetEntity , selections[s], zone))
920 health = targetEntity.GetHealthLevel(zone);
927 health = targetEntity.GetHealthLevel();
932 health = tgObject.GetHealthLevel();
952 targetEntity =
EntityAI.Cast(tgParent);
956 targetEntity =
EntityAI.Cast(tgObject);
959 return (targetEntity && targetEntity.GetIsFrozen());
965 protected void GetItemQuantity(out
int q_type, out
float q_cur, out
int q_min, out
int q_max)
1015 protected void SetItemDesc(
string descText,
int cargoCount,
string itemWidget,
string descWidget)
1018 widget =
m_Root.FindAnyWidget(itemWidget);
1023 string msg = playerT.GetLastUAMessage();
1033 Class.
CastTo(itemName, widget.FindAnyWidget(descWidget));
1037 descText =
string.
Format(
"[+] %1 %2", descText, msg);
1039 descText =
string.
Format(
"%1 %2", descText, msg);
1041 itemName.SetText(descText);
1045 protected void SetItemHealth(
int health,
string itemWidget,
string healthWidget,
bool enabled)
1051 ImageWidget healthMark;
1052 Class.
CastTo(healthMark, widget.FindAnyWidget(healthWidget));
1056 healthMark.GetParent().Show(
false);
1057 widget.Show(enabled);
1061 int color = 0x00FFFFFF;
1067 healthMark.SetColor(color);
1068 healthMark.SetAlpha(0.5);
1069 healthMark.GetParent().Show(
true);
1072 widget.Show(enabled);
1075 protected void SetItemQuantity(
int type,
float current,
int min,
int max,
string itemWidget,
string quantityPBWidget,
string quantityTextWidget,
bool enabled)
1079 widget =
m_Root.FindAnyWidget(itemWidget);
1083 ProgressBarWidget progressBar;
1085 Class.
CastTo(progressBar, widget.FindAnyWidget(quantityPBWidget));
1086 Class.
CastTo(textWidget, widget.FindAnyWidget(quantityTextWidget));
1092 progressBar.Show(
false);
1093 textWidget.Show(
false);
1094 textWidget.GetParent().Show(
false);
1097 if (max > 1 || current > 1)
1099 string qty_text =
string.Format(
"%1/%2",
Math.
Round(current).
ToString(), max.ToString());
1100 progressBar.Show(
false);
1101 textWidget.SetText(qty_text);
1102 textWidget.Show(
true);
1103 textWidget.GetParent().Show(
true);
1107 progressBar.Show(
false);
1108 textWidget.Show(
false);
1109 textWidget.GetParent().Show(
false);
1113 float qty_num =
Math.
Round((current / max) * 100);
1115 textWidget.Show(
false);
1116 progressBar.SetCurrent(qty_num);
1117 progressBar.Show(
true);
1118 textWidget.GetParent().Show(
true);
1136 Class.
CastTo(actionName, widget.FindAnyWidget(descWidget));
1140 descText = descText +
" " +
"#action_target_cursor_hold";
1141 actionName.SetText(descText);
1145 actionName.SetText(descText);
1151 actionName.GetTextSize(
x,
y);
1169 Widget widget, widget_not_select;
1171 widget =
m_Root.FindAnyWidget(multiActionsWidget);
1172 widget_not_select =
m_Root.FindAnyWidget(multiActionsWidget_NotSelect);
1179 widget_not_select.Show(
false);
1184 widget_not_select.Show(
true);
1190 widget_not_select.Show(
false);
1196 Widget widget, widget_not_select;
1198 widget =
m_Root.FindAnyWidget(multiActionsWidget);
1199 widget_not_select =
m_Root.FindAnyWidget(multiActionsWidget_NotSelect);
1206 widget_not_select.Show(
false);
1211 widget_not_select.Show(
true);
1217 widget_not_select.Show(
false);
1222 protected void SetMultipleItemAction(
string multiActionsWidget,
string multiActionsWidget_NotSelect)
1224 Widget widget, widget_not_select;
1226 widget =
m_Root.FindAnyWidget(multiActionsWidget);
1227 widget_not_select =
m_Root.FindAnyWidget(multiActionsWidget_NotSelect);
1234 widget_not_select.Show(
false);
1239 widget_not_select.Show(
true);
1245 widget_not_select.Show(
false);
1251 Widget widget, widget_not_select;
1253 widget =
m_Root.FindAnyWidget(multiActionsWidget);
1254 widget_not_select =
m_Root.FindAnyWidget(multiActionsWidget_NotSelect);
1261 widget_not_select.Show(
false);
1266 widget_not_select.Show(
true);
1272 widget_not_select.Show(
false);
1276 protected void SetInteractActionIcon(
string actionWidget,
string actionIconFrameWidget,
string actionIconWidget,
string actionIconTextWidget)
1279 ImageWidget iconWidget;
1282 widget =
m_Root.FindAnyWidget(actionWidget);
1283 Class.
CastTo(iconWidget, widget.FindAnyWidget(actionIconWidget));
1284 Class.
CastTo(textWidget, widget.FindAnyWidget(actionIconTextWidget));
1289 iconWidget.Show(
false);
1291 textWidget.Show(
true);
1298 entity =
EntityAI.Cast(target.GetParent());
1305 w.Show(entity.IsRefresherSignalingViable() &&
m_Player.IsTargetInActiveRefresherRange(entity));
1310 int attachmentsWithInventory = 0;
1318 for (
int i = 0; i < inventory.AttachmentCount(); i++)
1320 EntityAI attachment = inventory.GetAttachmentFromIndex(i);
1321 int attachmentSlotId = attachment.GetInventory().GetSlotId(0);
1323 if (attachment.GetInventory())
1325 attachmentsWithInventory += 1;
1329 return attachmentsWithInventory;
1332 protected IngameHud
GetHud()
1337 IngameHud hud = IngameHud.Cast(
mission.GetHud());
eBleedingSourceType GetType()
class ActionTargets ActionTarget
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
bool DisplayTargetInActionText()
string GetTargetName(PlayerBase player, ActionTarget target)
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 SetXboxIcon(string name, string imageset_name, string image_name)
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)
DEPRECATED.
void SetContinuousXboxIcon(string imageset_name, string image_name)
void GetOnScreenPosition(out float x, out float y)
void SetMultipleItemAction(string multiActionsWidget, string multiActionsWidget_NotSelect)
void SetMultipleContinuousItemAction(string multiActionsWidget, string multiActionsWidget_NotSelect)
float m_MaxWidthChild
widget width
void SetQuantityVisibility(bool state)
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 GetItemCargoCount(out int cargoCount)
returns number of items in cargo for targeted entity
void SetControllerIcon(string pWidgetName, string pInputName)
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)
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)
int AttachmentsWithInventoryOrCargoCount(notnull GameInventory inventory)
void SetMultipleContinuousInteractAction(string multiActionsWidget, string multiActionsWidget_NotSelect)
ref ATCCachedObject m_CachedObject
void PrepareCursorContent()
UAIDWrapper m_UseActionWrapper
void ShowXboxHidePCIcons(string widget, bool show_xbox_icon)
void ~ActionTargetsCursor()
void BuildFloatingCursor(bool forceRebuild)
proto native int GetItemCount()
represents base for cargo storage for entities
Super root of all classes in Enforce script.
override bool ShowZonesHealth()
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.
static proto float Round(float f)
Returns mathematical round of value.
static proto float Ceil(float f)
Returns ceil 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.
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.