56 PPERequester_BurlapSackEffects,
57 PPERequester_FlashbangEffects
163 #ifdef PLATFORM_CONSOLE
185 bool showConsoleIcons =
false;
186 #ifdef PLATFORM_CONSOLE
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);
334 if (isVisionObstructionActive ||
m_Hud.GetHudVisibility().IsContextFlagActive(IngameHudVisibility.HUD_HIDE_FLAGS))
449 m_Root.FindAnyWidget(widget +
"_btn_icon_xbox").Show(show_xbox_icon);
450 m_Root.FindAnyWidget(widget +
"_btn_icon").Show(!show_xbox_icon);
457 float parent_width, parent_height;
458 vector transformed_pos, screen_pos;
463 m_Root.GetParent().GetScreenSize(parent_width, parent_height);
466 transformed_pos[0] = screen_pos[0] * parent_width;
467 transformed_pos[1] = screen_pos[1] * parent_height;
469 return transformed_pos;
474 const float DEFAULT_HANDLE_OFFSET = 0.2;
475 const string CE_CENTER_COMP_NAME =
"ce_center";
479 float pivotOffset = 0.0;
480 float memOffset = 0.0;
483 bool isTargetForced =
false;
498 compIdx =
m_Target.GetComponentIndex();
501 isTargetForced =
true;
512 compName =
object.GetActionComponentName(compIdx);
513 object.GetActionComponentNameList(compIdx, components);
521 pivotOffset =
object.ConfigGetFloat(
"actionTargetPivotOffsetY");
522 memOffset =
object.ConfigGetFloat(
"actionTargetMemOffsetY");
525 lod =
object.GetLODByName(MEM_LOD_NAME);
532 if (MiscGameplayFunctions.IsComponentInSelection(memSelections, CE_CENTER_COMP_NAME))
534 for (
int i2 = 0; i2 < memSelections.Count(); ++i2)
536 if (memSelections[i2].
GetName() == CE_CENTER_COMP_NAME && memSelections[i2].GetVertexCount() == 1)
539 modelPos =
object.GetSelectionPositionMS(CE_CENTER_COMP_NAME);
540 worldPos =
object.ModelToWorld(modelPos);
541 if (memOffset != 0.0)
543 worldPos[1] = worldPos[1] + memOffset;
547 worldPos[1] = worldPos[1] + DEFAULT_HANDLE_OFFSET;
558 for (
int i1 = 0; i1 < memSelections.Count(); ++i1)
561 if (memSelections[i1].
GetName() == compName && memSelections[i1].GetVertexCount() == 1)
563 modelPos =
object.GetSelectionPositionMS(compName);
564 worldPos =
object.ModelToWorld(modelPos);
567 if (
object.
GetType() ==
"Fence" ||
object.
GetType() ==
"Watchttower" ||
object.
GetType() ==
"GardenPlot")
570 if (memOffset != 0.0)
572 worldPos[1] = worldPos[1] + memOffset;
576 worldPos[1] = worldPos[1] + DEFAULT_HANDLE_OFFSET;
581 if (memSelections[i1].
GetName() == compName && memSelections[i1].GetVertexCount() > 1)
583 for (
int j = 0; j < components.Count(); ++j)
587 modelPos =
object.GetSelectionPositionMS(components[j]);
588 worldPos =
object.ModelToWorld(modelPos);
591 if (memOffset != 0.0)
593 worldPos[1] = worldPos[1] + memOffset;
597 worldPos[1] = worldPos[1] + DEFAULT_HANDLE_OFFSET;
610 vector ladderHandlePointLS, ladderHandlePointWS;
612 float lastDistance = 0;
614 for (
int i3 = 0; i3 < memSelections.Count(); ++i3)
616 if (memSelections[i3].
GetName() == compName && memSelections[i3].GetVertexCount() > 1)
618 ladderHandlePointLS = memSelections[i3].GetVertexPosition(lod, 0);
619 ladderHandlePointWS =
object.ModelToWorld(ladderHandlePointLS);
620 closestHandlePos = ladderHandlePointWS;
623 for (
int k = 1; k < memSelections[i3].GetVertexCount(); ++k)
625 ladderHandlePointLS = memSelections[i3].GetVertexPosition(lod, k);
626 ladderHandlePointWS =
object.ModelToWorld(ladderHandlePointLS);
631 closestHandlePos = ladderHandlePointWS;
636 worldPos = closestHandlePos;
637 if (memOffset != 0.0)
639 worldPos[1] = worldPos[1] + memOffset;
643 worldPos[1] = worldPos[1] + DEFAULT_HANDLE_OFFSET;
673 isTargetForced =
false;
679 return MiscGameplayFunctions.IsComponentInSelection(selection, compName);
754 item.GetInventory().GetCurrentInventoryLocation(invLocation);
764 if (action && action.
GetText())
770 if (extraDescription)
771 desc =
string.
Format(
"%1 (%2)", desc, extraDescription);
791 if (!tgObject.IsAlive())
794 if (!tgParent || tgObject.DisplayNameRuinAttach())
795 desc = tgObject.GetDisplayName();
797 desc = tgParent.GetDisplayName();
803 if (tgParent && (tgParent.IsItemBase() || tgParent.IsTransport()))
805 targetEntity =
EntityAI.Cast(tgParent);
808 if (tgObject.IsItemBase() || tgObject.IsTransport())
810 targetEntity =
EntityAI.Cast(tgObject);
823 if (DamageSystem.GetDamageZoneFromComponentName(targetEntity, tgObject.GetActionComponentName(
m_Target.GetComponentIndex(),
LOD.
NAME_FIRE), zone))
825 desc = DamageSystem.GetDamageDisplayName(targetEntity, zone);
830 targetEntity.GetActionComponentNameList(
m_Target.GetComponentIndex(), selections,
LOD.
NAME_VIEW);
833 for (
int s = 0; s < selections.Count(); s++)
835 if (DamageSystem.GetDamageZoneFromComponentName(targetEntity, selections[s], zone))
837 desc = DamageSystem.GetDamageDisplayName(targetEntity, zone);
844 if (targetEntity && desc ==
"")
845 desc = targetEntity.GetDisplayName();
872 if (!tgObject.IsAlive())
878 health = tgObject.GetHealthLevel();
883 if (tgParent && (tgParent.IsItemBase() || tgParent.IsTransport()))
885 targetEntity =
EntityAI.Cast(tgParent);
888 if (tgObject.IsItemBase() || tgObject.IsTransport())
890 targetEntity =
EntityAI.Cast(tgObject);
895 if (!targetEntity.IsDamageDestroyed())
903 if (DamageSystem.GetDamageZoneFromComponentName(targetEntity, tgObject.GetActionComponentName(
m_Target.GetComponentIndex(),
LOD.
NAME_FIRE), zone))
905 health = targetEntity.GetHealthLevel(zone);
911 targetEntity.GetActionComponentNameList(
m_Target.GetComponentIndex(), selections,
LOD.
NAME_VIEW);
913 for (
int s = 0; s < selections.Count(); s++)
915 if (DamageSystem.GetDamageZoneFromComponentName(targetEntity , selections[s], zone))
917 health = targetEntity.GetHealthLevel(zone);
924 health = targetEntity.GetHealthLevel();
929 health = tgObject.GetHealthLevel();
949 targetEntity =
EntityAI.Cast(tgParent);
953 targetEntity =
EntityAI.Cast(tgObject);
956 return (targetEntity && targetEntity.GetIsFrozen());
962 protected void GetItemQuantity(out
int q_type, out
float q_cur, out
int q_min, out
int q_max)
1012 protected void SetItemDesc(
string descText,
int cargoCount,
string itemWidget,
string descWidget)
1015 widget =
m_Root.FindAnyWidget(itemWidget);
1020 string msg = playerT.GetLastUAMessage();
1030 Class.
CastTo(itemName, widget.FindAnyWidget(descWidget));
1034 descText =
string.
Format(
"[+] %1 %2", descText, msg);
1036 descText =
string.
Format(
"%1 %2", descText, msg);
1038 itemName.SetText(descText);
1042 protected void SetItemHealth(
int health,
string itemWidget,
string healthWidget,
bool enabled)
1048 ImageWidget healthMark;
1049 Class.
CastTo(healthMark, widget.FindAnyWidget(healthWidget));
1053 healthMark.GetParent().Show(
false);
1054 widget.Show(enabled);
1058 int color = 0x00FFFFFF;
1064 healthMark.SetColor(color);
1065 healthMark.SetAlpha(0.5);
1066 healthMark.GetParent().Show(
true);
1069 widget.Show(enabled);
1072 protected void SetItemQuantity(
int type,
float current,
int min,
int max,
string itemWidget,
string quantityPBWidget,
string quantityTextWidget,
bool enabled)
1076 widget =
m_Root.FindAnyWidget(itemWidget);
1080 ProgressBarWidget progressBar;
1082 Class.
CastTo(progressBar, widget.FindAnyWidget(quantityPBWidget));
1083 Class.
CastTo(textWidget, widget.FindAnyWidget(quantityTextWidget));
1089 progressBar.Show(
false);
1090 textWidget.Show(
false);
1091 textWidget.GetParent().Show(
false);
1094 if (max > 1 || current > 1)
1096 string qty_text =
string.Format(
"%1/%2",
Math.
Round(current).
ToString(), max.ToString());
1097 progressBar.Show(
false);
1098 textWidget.SetText(qty_text);
1099 textWidget.Show(
true);
1100 textWidget.GetParent().Show(
true);
1104 progressBar.Show(
false);
1105 textWidget.Show(
false);
1106 textWidget.GetParent().Show(
false);
1110 float qty_num =
Math.
Round((current / max) * 100);
1112 textWidget.Show(
false);
1113 progressBar.SetCurrent(qty_num);
1114 progressBar.Show(
true);
1115 textWidget.GetParent().Show(
true);
1133 Class.
CastTo(actionName, widget.FindAnyWidget(descWidget));
1137 descText = descText +
" " +
"#action_target_cursor_hold";
1138 actionName.SetText(descText);
1142 actionName.SetText(descText);
1148 actionName.GetTextSize(
x,
y);
1166 Widget widget, widget_not_select;
1168 widget =
m_Root.FindAnyWidget(multiActionsWidget);
1169 widget_not_select =
m_Root.FindAnyWidget(multiActionsWidget_NotSelect);
1176 widget_not_select.Show(
false);
1181 widget_not_select.Show(
true);
1187 widget_not_select.Show(
false);
1193 Widget widget, widget_not_select;
1195 widget =
m_Root.FindAnyWidget(multiActionsWidget);
1196 widget_not_select =
m_Root.FindAnyWidget(multiActionsWidget_NotSelect);
1203 widget_not_select.Show(
false);
1208 widget_not_select.Show(
true);
1214 widget_not_select.Show(
false);
1219 protected void SetMultipleItemAction(
string multiActionsWidget,
string multiActionsWidget_NotSelect)
1221 Widget widget, widget_not_select;
1223 widget =
m_Root.FindAnyWidget(multiActionsWidget);
1224 widget_not_select =
m_Root.FindAnyWidget(multiActionsWidget_NotSelect);
1231 widget_not_select.Show(
false);
1236 widget_not_select.Show(
true);
1242 widget_not_select.Show(
false);
1248 Widget widget, widget_not_select;
1250 widget =
m_Root.FindAnyWidget(multiActionsWidget);
1251 widget_not_select =
m_Root.FindAnyWidget(multiActionsWidget_NotSelect);
1258 widget_not_select.Show(
false);
1263 widget_not_select.Show(
true);
1269 widget_not_select.Show(
false);
1273 protected void SetInteractActionIcon(
string actionWidget,
string actionIconFrameWidget,
string actionIconWidget,
string actionIconTextWidget)
1276 ImageWidget iconWidget;
1279 widget =
m_Root.FindAnyWidget(actionWidget);
1280 Class.
CastTo(iconWidget, widget.FindAnyWidget(actionIconWidget));
1281 Class.
CastTo(textWidget, widget.FindAnyWidget(actionIconTextWidget));
1286 iconWidget.Show(
false);
1288 textWidget.Show(
true);
1295 entity =
EntityAI.Cast(target.GetParent());
1302 w.Show(entity.IsRefresherSignalingViable() &&
m_Player.IsTargetInActiveRefresherRange(entity));
1307 int attachmentsWithInventory = 0;
1315 for (
int i = 0; i < inventory.AttachmentCount(); i++)
1317 EntityAI attachment = inventory.GetAttachmentFromIndex(i);
1318 int attachmentSlotId = attachment.GetInventory().GetSlotId(0);
1320 if (attachment.GetInventory())
1322 attachmentsWithInventory += 1;
1326 return attachmentsWithInventory;
1329 protected IngameHud
GetHud()
1334 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 vector GetScreenPosRelative(vector world_pos)
Transforms position in world to position in screen in percentage (0.0 - 1.0) as x,...
proto native Input GetInput()
proto native Mission GetMission()
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)
ScriptInvoker GetOnInputDeviceChanged()
ScriptInvoker GetOnInputPresetChanged()
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)
proto bool Insert(func fn, int flags=EScriptInvokerInsertFlags.IMMEDIATE)
insert method to list
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.
proto native CGame GetGame()
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.