37 #ifndef PLATFORM_CONSOLE
51 #ifdef PLATFORM_CONSOLE
156 if( serialized_types.Count() > 0 )
170 for(
int i = 0; i < serialized_types.Count(); i++ )
173 serialized_types.Get( i ).Split(
",", strs );
174 bool is_opened = strs.Get( 1 ).ToInt();
189 if( serialized_types.Count() > 0 )
203 for(
int i = 0; i < serialized_types.Count(); i++ )
206 serialized_types.Get( i ).Split(
",", strs );
207 bool is_opened = strs.Get( 1 ).ToInt();
250 EntityAI owner = item.GetHierarchyParent();
258 item.GetInventory().GetCurrentInventoryLocation( inv_loc_src );
259 int loc_type = inv_loc_src.
GetType();
359 switch (pHealthLevel)
382 switch (item.GetHealthLevel(zone))
404 if( fraction > 1 || fraction < 0 )
406 else if( fraction > 0.80 )
408 else if( fraction > 0.6 )
410 else if( fraction > 0.4 )
412 else if( fraction > 0.2 )
424 if ( item && item.IsInherited(
ItemBase ) )
429 string name = item_w.GetName();
431 Widget temperature_widget = item_w.GetParent().FindAnyWidget(
name );
434 temperature_widget.Show(
true );
435 temperature_widget.SetColor( color );
439 temperature_widget.Show(
false );
442 temperature_widget.SetAlpha( 0.3 );
453 if ( item && item.IsInherited(
ItemBase ) )
459 Widget color_widget = item_w.FindAnyWidget(
"Color" );
462 color_widget.SetColor( color );
487 int screen_w, screen_h;
494 x = screen_w/2 - w/2;
496 m_RootWidget.FindAnyWidget(
"InventoryFrameWidget").GetScreenPos(x1,y1);
499 else if (
x == 0 &&
y == 0 &&
GetGame().
GetInput().IsEnabledMouseAndKeyboardEvenOnServer())
508 int rightEdge =
x + w;
509 if (rightEdge > screen_w)
514 int bottomEdge =
y + h;
515 if (bottomEdge > screen_h)
553 int screen_w, screen_h;
564#ifndef PLATFORM_CONSOLE
566 y += slot_normal_h + 5;
572 while (scrollerWidget)
574 if (ScrollWidget.Cast(scrollerWidget))
580 scrollerWidget = scrollerWidget.GetParent();
584 int rightEdge =
x + w;
585 if (rightEdge > screen_w)
590 int bottomEdge =
y + h;
593 float scrollerX, scrollerY, scrollerSizeX, scrollerSizeY;
594 scrollerWidget.GetScreenPos(scrollerX,scrollerY);
595 scrollerWidget.GetScreenSize(scrollerSizeX,scrollerSizeY);
597 int scroller_bottom = scrollerY + scrollerSizeY;
598 if (bottomEdge > scroller_bottom)
600 y = scroller_bottom - slot_normal_h;
609 if (bottomEdge > screen_h)
637 draggable = !player.GetInventory().HasInventoryReservation( entity, null ) && !player.IsItemsToDelete();
639 draggable = draggable && entity.GetInventory().CanRemoveEntity();
675 if( !entity1 || !entity2 )
690 else if( entity1.GetInventory().CanAddAttachment( entity2 ) )
692 if( !entity1.IsInherited(
ZombieBase ) && !entity1.IsInherited( Car ) && !entity2.IsInherited(
ZombieBase ) && !entity2.IsInherited( Car ) )
699 if( entity1 ==
m_player.GetHumanInventory().GetEntityInHands() || entity2 ==
m_player.GetHumanInventory().GetEntityInHands())
703 if( entity1 ==
m_player.GetHumanInventory().GetEntityInHands() )
736 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin( PluginRecipesManager ) );
InventoryLocationType
types of Inventory Location
PluginBase GetPlugin(typename plugin_type)
bool CanSetActionFromInventory(ItemBase mainItem, ItemBase targetItem)
bool CanPerformActionFromInventory(ItemBase mainItem, ItemBase targetItem)
proto native void GetProfileStringList(string name, out TStringArray values)
Gets array of strings from profile variable.
proto native void SetProfileString(string name, string value)
Sets string to profile variable.
proto bool GetProfileString(string name, out string value)
Gets string from profile variable.
proto native WorkspaceWidget GetWorkspace()
proto native void SaveProfile()
Saves profile on disk.
proto native void SetProfileStringList(string name, TStringArray values)
Sets array of strings to profile variable.
Super root of all classes in Enforce script.
static ColorManager GetInstance()
int GetItemColor(ItemBase item)
const int COLOR_BADLY_DAMAGED
static const int ADD_AS_CARGO
static const int PERFORM_ACTION
static const int ADD_AS_ATTACHMENT
static const int COMBINE_QUANTITY2
static const int SET_ACTION
static const int RECIPE_ANYWHERE
proto native int GetType()
returns type of InventoryLocation
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
Widget GetCenterDropzone()
EntityAI GetSelectedItem()
protected ref Timer m_TooltipSlotTimer
protected ref Widget m_TooltipWidget
void SetDraggedIcon(Icon dragged_icon)
void PrepareTooltip(EntityAI item, int x=0, int y=0)
bool IsMicromanagmentMode()
HandsPreview GetHandsPreview()
protected ref Timer m_ToolTipTimer
protected bool m_SlotInfoShown
void SerializeDefaultOpenStates()
Widget GetSelectedWidget()
void ShowSourceDropzone(EntityAI item)
void DeserializeDefaultOpenStates()
protected EntityAI m_DraggedItem
protected Icon m_DraggedIcon
protected int m_TooltipPosX
protected bool m_IsDragging
protected Widget m_CenterDropzone
protected ref Widget m_TooltipSlotWidget
bool GetDefaultOpenStateHands()
Container GetSelectedContainer()
void UpdateTooltipSlotPosition()
static int GetCombinationFlags(EntityAI entity1, EntityAI entity2)
static int GetItemHealthColor(EntityAI item, string zone="")
protected int m_HandsDefaultOpenState
protected Widget m_RightDropzone
void ClearDefaultOpenStates()
protected Container m_SelectedContainer
void SetWidgetDraggable(Widget w, bool draggable)
protected SlotsIcon m_SelectedIcon
protected Widget m_SelectedWidget
protected ref Widget m_TooltipCategoryWidget
bool GetDefaultOpenState(string type)
static int ColorFromFloat(float fraction)
static int GetItemHealthColor(int pHealthLevel)
void SetDefaultHeaderOpenState(string type, bool is_opened)
protected Widget m_LeftDropzone
protected EntityAI m_HoveredItem
void SetTemperature(EntityAI item, Widget item_w)
void DeserializeDefaultHeaderOpenStates()
void ClearDefaultHeaderOpenStates()
protected const float TOOLTIP_DELAY
void SetItemMicromanagmentMode(bool item_micromanagment_mode)
protected ref map< string, bool > m_DefautOpenStates
static int GetRecipeCount(bool recipe_anywhere, EntityAI entity1, EntityAI entity2)
void SetDraggedItem(EntityAI dragged_item)
protected bool m_ItemMicromanagmentMode
protected ref map< string, bool > m_DefautHeaderOpenStates
protected Widget m_TooltipSourceWidget
bool EvaluateContainerDragabilityDefault(EntityAI entity)
void SetHandsPreview(HandsPreview hansd_preview)
void PrepareSlotsTooltip(string name, string desc, int x=0, int y=0)
position is currentlycalculated from the owning 'm_TooltipSourceWidget' directly
void SetIconTemperature(EntityAI item, Widget item_w)
void SetDefaultOpenState(string type, bool is_opened)
private static ref ItemManager m_Instance
void SetSelectedItem(EntityAI selected_item, Container selected_container, Widget selected_widget, SlotsIcon selected_icon)
Widget GetRightDropzone()
void CalculateTooltipSlotPosition(int x=0, int y=0)
protected HandsPreview m_HandsPreview
protected ItemPreviewWidget m_ItemPreviewWidget
bool GetDefaultHeaderOpenState(string type)
EntityAI GetHoveredItem()
void SerializeDefaultHeaderOpenStates()
void ItemManager(Widget root)
void SetTooltipWidget(Widget w)
void SetDefaultOpenStateHands(bool is_opened)
protected int m_TooltipPosY
void SetIsDragging(bool is_dragging)
protected Widget m_RootWidget
protected EntityAI m_SelectedItem
SlotsIcon GetSelectedIcon()
static ItemManager GetInstance()
EntityAI GetDraggedItem()
static int GetNormalWidth()
static int GetNormalHeight()
proto native CGame GetGame()
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
array< string > TStringArray
const int STATE_BADLY_DAMAGED
proto void GetScreenSize(out int x, out int y)
proto void GetMousePos(out int x, out int y)
proto native int ToInt()
Converts string to integer.
proto int Replace(string sample, string replace)
Replace all occurrances of 'sample' in 'str' by 'replace'.