DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ GetTemperatureFreezeTime()

override float SpawnItemOnLocation::GetTemperatureFreezeTime ( )
protected

См. определение в файле ItemBase.c строка 9398

9402{
9403 override bool CanPutAsAttachment(EntityAI parent)
9404 {
9405 return true;
9406 }
9407};
9408
9409//const bool QUANTITY_DEBUG_REMOVE_ME = false;
9410
9411class ItemBase extends InventoryItem
9412{
9416
9418
9419 static int m_DebugActionsMask;
9421 // ============================================
9422 // Variable Manipulation System
9423 // ============================================
9424 // Quantity
9425
9426 float m_VarQuantity;
9427 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
9429 int m_VarQuantityMin;
9430 int m_VarQuantityMax;
9431 int m_Count;
9432 float m_VarStackMax;
9433 float m_StoreLoadedQuantity = float.LOWEST;
9434 // Wet
9435 float m_VarWet;
9436 float m_VarWetPrev;//for client to know wetness changed during synchronization
9437 float m_VarWetInit;
9438 float m_VarWetMin;
9439 float m_VarWetMax;
9440 // Cleanness
9441 int m_Cleanness;
9442 int m_CleannessInit;
9443 int m_CleannessMin;
9444 int m_CleannessMax;
9445 // impact sounds
9447 bool m_CanPlayImpactSound = true;
9448 float m_ImpactSpeed;
9450 //
9451 float m_HeatIsolation;
9452 float m_ItemModelLength;
9453 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
9455 int m_VarLiquidType;
9456 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
9457 int m_QuickBarBonus;
9458 bool m_IsBeingPlaced;
9459 bool m_IsHologram;
9460 bool m_IsTakeable;
9461 bool m_ThrowItemOnDrop;
9464 bool m_FixDamageSystemInit = false; //can be changed on storage version check
9465 bool can_this_be_combined; //Check if item can be combined
9466 bool m_CanThisBeSplit; //Check if item can be split
9467 bool m_IsStoreLoad = false;
9468 bool m_CanShowQuantity;
9469 bool m_HasQuantityBar;
9470 protected bool m_CanBeDigged;
9471 protected bool m_IsResultOfSplit
9472
9473 string m_SoundAttType;
9474 // items color variables
9479 //-------------------------------------------------------
9480
9481 // light source managing
9483
9487
9488 //==============================================
9489 // agent system
9490 private int m_AttachedAgents;
9491
9493 void TransferModifiers(PlayerBase reciever);
9494
9495
9496 // Weapons & suppressors particle effects
9501 static int m_LastRegisteredWeaponID = 0;
9502
9503 // Overheating effects
9505 float m_OverheatingShots;
9506 ref Timer m_CheckOverheating;
9507 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
9508 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
9509 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
9510 ref array <ref OverheatingParticle> m_OverheatingParticles;
9511
9513 protected bool m_HideSelectionsBySlot;
9514
9515 // Admin Log
9516 PluginAdminLog m_AdminLog;
9517
9518 // misc
9519 ref Timer m_PhysDropTimer;
9520
9521 // Attachment Locking variables
9522 ref array<int> m_CompatibleLocks;
9523 protected int m_LockType;
9524 protected ref EffectSound m_LockingSound;
9525 protected string m_LockSoundSet;
9526
9527 // ItemSoundHandler
9528 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
9529 protected int m_SoundSyncPlay; // id for sound to play
9530 protected int m_SoundSyncStop; // id for sound to stop
9532
9533 //temperature
9534 private float m_TemperaturePerQuantityWeight;
9535
9536 // -------------------------------------------------------------------------
9537 void ItemBase()
9538 {
9539 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
9543
9544 if (!GetGame().IsDedicatedServer())
9545 {
9546 if (HasMuzzle())
9547 {
9549
9551 {
9553 }
9554 }
9555
9557 m_ActionsInitialize = false;
9558 }
9559
9560 m_OldLocation = null;
9561
9562 if (GetGame().IsServer())
9563 {
9564 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
9565 }
9566
9567 if (ConfigIsExisting("headSelectionsToHide"))
9568 {
9570 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
9571 }
9572
9573 m_HideSelectionsBySlot = false;
9574 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9575 {
9576 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
9577 }
9578
9579 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
9580
9581 m_IsResultOfSplit = false;
9582
9584 }
9585
9586 override void InitItemVariables()
9587 {
9588 super.InitItemVariables();
9589
9590 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
9591 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
9592 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
9593 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
9594 m_VarStackMax = ConfigGetFloat("varStackMax");
9595 m_Count = ConfigGetInt("count");
9596
9597 m_CanShowQuantity = ConfigGetBool("quantityShow");
9598 m_HasQuantityBar = ConfigGetBool("quantityBar");
9599
9600 m_CleannessInit = ConfigGetInt("varCleannessInit");
9602 m_CleannessMin = ConfigGetInt("varCleannessMin");
9603 m_CleannessMax = ConfigGetInt("varCleannessMax");
9604
9605 m_WantPlayImpactSound = false;
9606 m_ImpactSpeed = 0.0;
9607
9608 m_VarWetInit = ConfigGetFloat("varWetInit");
9610 m_VarWetMin = ConfigGetFloat("varWetMin");
9611 m_VarWetMax = ConfigGetFloat("varWetMax");
9612
9613 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
9614 if (IsLiquidContainer() && GetQuantity() != 0)
9616 m_IsBeingPlaced = false;
9617 m_IsHologram = false;
9618 m_IsTakeable = true;
9619 m_CanBeMovedOverride = false;
9623 m_CanBeDigged = ConfigGetBool("canBeDigged");
9624
9625 m_CompatibleLocks = new array<int>();
9626 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
9627 m_LockType = ConfigGetInt("lockType");
9628
9629 //Define if item can be split and set ability to be combined accordingly
9630 m_CanThisBeSplit = false;
9631 can_this_be_combined = false;
9632 if (ConfigIsExisting("canBeSplit"))
9633 {
9634 can_this_be_combined = ConfigGetBool("canBeSplit");
9636 }
9637
9638 m_ItemBehaviour = -1;
9639 if (ConfigIsExisting("itemBehaviour"))
9640 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
9641
9642 //RegisterNetSyncVariableInt("m_VariablesMask");
9643 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
9644 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
9645 RegisterNetSyncVariableInt("m_VarLiquidType");
9646 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9647
9648 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9649 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9650 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9651
9652 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9653 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9654 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9655 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9656
9657 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9658 RegisterNetSyncVariableBool("m_IsTakeable");
9659 RegisterNetSyncVariableBool("m_IsHologram");
9660
9661 InitItemSounds();
9663 {
9664 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
9665 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
9666 }
9667
9668 m_LockSoundSet = ConfigGetString("lockSoundSet");
9669
9671 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9672 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
9673
9674 }
9675
9676 override int GetQuickBarBonus()
9677 {
9678 return m_QuickBarBonus;
9679 }
9680
9681 void InitializeActions()
9682 {
9684 if (!m_InputActionMap)
9685 {
9687 m_InputActionMap = iam;
9688 SetActions();
9690 }
9691 }
9692
9693 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
9694 {
9696 {
9697 m_ActionsInitialize = true;
9699 }
9700
9701 actions = m_InputActionMap.Get(action_input_type);
9702 }
9703
9704 void SetActions()
9705 {
9706 AddAction(ActionTakeItem);
9707 AddAction(ActionTakeItemToHands);
9708 AddAction(ActionWorldCraft);
9710 AddAction(ActionAttachWithSwitch);
9711 }
9712
9713 void SetActionAnimOverrides(); // Override action animation for specific item
9714
9715 void AddAction(typename actionName)
9716 {
9717 ActionBase action = ActionManagerBase.GetAction(actionName);
9718
9719 if (!action)
9720 {
9721 Debug.LogError("Action " + actionName + " dosn't exist!");
9722 return;
9723 }
9724
9725 typename ai = action.GetInputType();
9726 if (!ai)
9727 {
9728 m_ActionsInitialize = false;
9729 return;
9730 }
9731
9732 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
9733 if (!action_array)
9734 {
9735 action_array = new array<ActionBase_Basic>;
9736 m_InputActionMap.Insert(ai, action_array);
9737 }
9738 if (LogManager.IsActionLogEnable())
9739 {
9740 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
9741 }
9742
9743 if (action_array.Find(action) != -1)
9744 {
9745 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
9746 }
9747 else
9748 {
9749 action_array.Insert(action);
9750 }
9751 }
9752
9753 void RemoveAction(typename actionName)
9754 {
9755 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
9756 ActionBase action = player.GetActionManager().GetAction(actionName);
9757 typename ai = action.GetInputType();
9758 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
9759
9760 if (action_array)
9761 {
9762 action_array.RemoveItem(action);
9763 }
9764 }
9765
9766 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
9767 // Set -1 for params which should stay in default state
9768 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
9769 {
9770 ActionOverrideData overrideData = new ActionOverrideData();
9771 overrideData.m_CommandUID = commandUID;
9772 overrideData.m_CommandUIDProne = commandUIDProne;
9773 overrideData.m_StanceMask = stanceMask;
9774
9775 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
9776 if (!actionMap) // create new map of action > overidables map
9777 {
9778 actionMap = new TActionAnimOverrideMap();
9779 m_ItemActionOverrides.Insert(action, actionMap);
9780 }
9781
9782 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
9783
9784 }
9785
9786 void OnItemInHandsPlayerSwimStart(PlayerBase player);
9787
9788 ScriptedLightBase GetLight();
9789
9790 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
9791 void LoadParticleConfigOnFire(int id)
9792 {
9793 if (!m_OnFireEffect)
9795
9798
9799 string config_to_search = "CfgVehicles";
9800 string muzzle_owner_config;
9801
9802 if (!m_OnFireEffect.Contains(id))
9803 {
9804 if (IsInherited(Weapon))
9805 config_to_search = "CfgWeapons";
9806
9807 muzzle_owner_config = config_to_search + " " + GetType() + " ";
9808
9809 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9810
9811 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
9812
9813 if (config_OnFire_subclass_count > 0)
9814 {
9815 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9816
9817 for (int i = 0; i < config_OnFire_subclass_count; i++)
9818 {
9819 string particle_class = "";
9820 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
9821 string config_OnFire_entry = config_OnFire_class + particle_class;
9822 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9823 WPOF_array.Insert(WPOF);
9824 }
9825
9826
9827 m_OnFireEffect.Insert(id, WPOF_array);
9828 }
9829 }
9830
9831 if (!m_OnBulletCasingEjectEffect.Contains(id))
9832 {
9833 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
9834 muzzle_owner_config = config_to_search + " " + GetType() + " ";
9835
9836 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9837
9838 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9839
9840 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9841 {
9842 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9843
9844 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9845 {
9846 string particle_class2 = "";
9847 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9848 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9849 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9850 WPOBE_array.Insert(WPOBE);
9851 }
9852
9853
9854 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
9855 }
9856 }
9857 }
9858
9859 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
9861 {
9864
9865 if (!m_OnOverheatingEffect.Contains(id))
9866 {
9867 string config_to_search = "CfgVehicles";
9868
9869 if (IsInherited(Weapon))
9870 config_to_search = "CfgWeapons";
9871
9872 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
9873 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9874
9875 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
9876 {
9877
9878 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
9879
9881 {
9882 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
9883 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9884 Error(error);
9885 return;
9886 }
9887
9888 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
9889 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
9890
9891
9892
9893 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
9894 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9895
9896 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9897 {
9898 string particle_class = "";
9899 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9900 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9901 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
9902
9903 if (entry_type == CT_CLASS)
9904 {
9905 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9906 WPOOH_array.Insert(WPOF);
9907 }
9908 }
9909
9910
9911 m_OnOverheatingEffect.Insert(id, WPOOH_array);
9912 }
9913 }
9914 }
9915
9916 float GetOverheatingValue()
9917 {
9918 return m_OverheatingShots;
9919 }
9920
9921 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9922 {
9923 if (m_MaxOverheatingValue > 0)
9924 {
9926
9927 if (!m_CheckOverheating)
9929
9931 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
9932
9933 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9934 }
9935 }
9936
9937 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9938 {
9940 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9941
9943 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9944
9946 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9947
9949 {
9951 }
9952 }
9953
9955 {
9957 }
9958
9959 void OnOverheatingDecay()
9960 {
9961 if (m_MaxOverheatingValue > 0)
9962 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
9963 else
9965
9966 if (m_OverheatingShots <= 0)
9967 {
9970 }
9971 else
9972 {
9973 if (!m_CheckOverheating)
9975
9977 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
9978 }
9979
9980 CheckOverheating(this, "", this);
9981 }
9982
9983 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9984 {
9986 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
9987 }
9988
9989 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9990 {
9992 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
9994 }
9995
9996 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9997 {
9999 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10000 }
10001
10002 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
10003 {
10005 m_OverheatingParticles = new array<ref OverheatingParticle>;
10006
10007 OverheatingParticle OP = new OverheatingParticle();
10008 OP.RegisterParticle(p);
10009 OP.SetOverheatingLimitMin(min_heat_coef);
10010 OP.SetOverheatingLimitMax(max_heat_coef);
10011 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
10012
10013 m_OverheatingParticles.Insert(OP);
10014 }
10015
10016 float GetOverheatingCoef()
10017 {
10018 if (m_MaxOverheatingValue > 0)
10020
10021 return -1;
10022 }
10023
10025 {
10027 {
10028 float overheat_coef = GetOverheatingCoef();
10029 int count = m_OverheatingParticles.Count();
10030
10031 for (int i = count; i > 0; --i)
10032 {
10033 int id = i - 1;
10034 OverheatingParticle OP = m_OverheatingParticles.Get(id);
10035 Particle p = OP.GetParticle();
10036
10037 float overheat_min = OP.GetOverheatingLimitMin();
10038 float overheat_max = OP.GetOverheatingLimitMax();
10039
10040 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10041 {
10042 if (p)
10043 {
10044 p.Stop();
10045 OP.RegisterParticle(null);
10046 }
10047 }
10048 }
10049 }
10050 }
10051
10053 {
10055 {
10056 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
10057 {
10058 int id = i - 1;
10059 OverheatingParticle OP = m_OverheatingParticles.Get(id);
10060
10061 if (OP)
10062 {
10063 Particle p = OP.GetParticle();
10064
10065 if (p)
10066 {
10067 p.Stop();
10068 }
10069
10070 delete OP;
10071 }
10072 }
10073
10074 m_OverheatingParticles.Clear();
10076 }
10077 }
10078
10080 float GetInfectionChance(int system = 0, Param param = null)
10081 {
10082 return 0.0;
10083 }
10084
10085
10086 float GetDisinfectQuantity(int system = 0, Param param1 = null)
10087 {
10088 return 250;//default value
10089 }
10090
10091 float GetFilterDamageRatio()
10092 {
10093 return 0;
10094 }
10095
10097 bool HasMuzzle()
10098 {
10099 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
10100 return true;
10101
10102 return false;
10103 }
10104
10106 int GetMuzzleID()
10107 {
10108 if (!m_WeaponTypeToID)
10110
10111 if (m_WeaponTypeToID.Contains(GetType()))
10112 {
10113 return m_WeaponTypeToID.Get(GetType());
10114 }
10115 else
10116 {
10117 // Register new weapon ID
10119 }
10120
10122 }
10123
10130 {
10131 return -1;
10132 }
10133
10134
10135
10136 // -------------------------------------------------------------------------
10137 void ~ItemBase()
10138 {
10139 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
10140 {
10141 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
10142 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10143
10144 if (r_index >= 0)
10145 {
10146 InventoryLocation r_il = new InventoryLocation;
10147 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10148
10149 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10150 int r_type = r_il.GetType();
10151 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
10152 {
10153 r_il.GetParent().GetOnReleaseLock().Invoke(this);
10154 }
10155 else if (r_type == InventoryLocationType.ATTACHMENT)
10156 {
10157 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
10158 }
10159
10160 }
10161
10162 player.GetHumanInventory().ClearUserReservedLocation(this);
10163 }
10164
10165 if (m_LockingSound)
10166 SEffectManager.DestroyEffect(m_LockingSound);
10167 }
10168
10169
10170
10171 // -------------------------------------------------------------------------
10172 static int GetDebugActionsMask()
10173 {
10174 return ItemBase.m_DebugActionsMask;
10175 }
10176
10177 static bool HasDebugActionsMask(int mask)
10178 {
10179 return ItemBase.m_DebugActionsMask & mask;
10180 }
10181
10182 static void SetDebugActionsMask(int mask)
10183 {
10184 ItemBase.m_DebugActionsMask = mask;
10185 }
10186
10187 static void AddDebugActionsMask(int mask)
10188 {
10189 ItemBase.m_DebugActionsMask |= mask;
10190 }
10191
10192 static void RemoveDebugActionsMask(int mask)
10193 {
10194 ItemBase.m_DebugActionsMask &= ~mask;
10195 }
10196
10197 static void ToggleDebugActionsMask(int mask)
10198 {
10199 if (HasDebugActionsMask(mask))
10200 {
10202 }
10203 else
10204 {
10205 AddDebugActionsMask(mask);
10206 }
10207 }
10208
10209 // -------------------------------------------------------------------------
10210 void SetCEBasedQuantity()
10211 {
10212 if (GetEconomyProfile())
10213 {
10214 float q_max = GetEconomyProfile().GetQuantityMax();
10215 if (q_max > 0)
10216 {
10217 float q_min = GetEconomyProfile().GetQuantityMin();
10218 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10219
10220 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
10221 {
10222 ComponentEnergyManager comp = GetCompEM();
10223 if (comp && (comp.GetEnergyMaxPristine() || comp.GetEnergyAtSpawn()))//checking for a potential for energy, we need to check both values, as both are optional, only when both are set to 0, we know the item can't have energy
10224 {
10225 comp.SetEnergy0To1(quantity_randomized);
10226 }
10227 }
10228 else if (HasQuantity())
10229 {
10230 SetQuantityNormalized(quantity_randomized, false);
10231 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
10232 }
10233
10234 }
10235 }
10236 }
10237
10239 void LockToParent()
10240 {
10241 EntityAI parent = GetHierarchyParent();
10242
10243 if (parent)
10244 {
10245 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10246 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10247 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
10248 }
10249 }
10250
10252 void UnlockFromParent()
10253 {
10254 EntityAI parent = GetHierarchyParent();
10255
10256 if (parent)
10257 {
10258 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10259 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10260 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
10261 }
10262 }
10263
10264 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
10265 {
10266 /*
10267 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
10268 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
10269 */
10270 ItemBase item2 = ItemBase.Cast(entity2);
10271
10272 if (GetGame().IsClient())
10273 {
10274 if (ScriptInputUserData.CanStoreInputUserData())
10275 {
10276 ScriptInputUserData ctx = new ScriptInputUserData;
10278 ctx.Write(-1);
10279 ItemBase i1 = this; // @NOTE: workaround for correct serialization
10280 ctx.Write(i1);
10281 ctx.Write(item2);
10282 ctx.Write(use_stack_max);
10283 ctx.Write(-1);
10284 ctx.Send();
10285
10286 if (IsCombineAll(item2, use_stack_max))
10287 {
10288 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10289 }
10290 }
10291 }
10292 else if (!GetGame().IsMultiplayer())
10293 {
10294 CombineItems(item2, use_stack_max);
10295 }
10296 }
10297
10298 bool IsLiquidPresent()
10299 {
10300 return (GetLiquidType() != 0 && HasQuantity());
10301 }
10302
10303 bool IsLiquidContainer()
10304 {
10305 return m_LiquidContainerMask != 0;
10306 }
10307
10309 {
10310 return m_LiquidContainerMask;
10311 }
10312
10313 bool IsBloodContainer()
10314 {
10315 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
10316 return false;
10317 }
10318
10319 bool IsNVG()
10320 {
10321 return false;
10322 }
10323
10326 bool IsExplosive()
10327 {
10328 return false;
10329 }
10330
10332 {
10333 return "";
10334 }
10335
10337
10338 bool IsLightSource()
10339 {
10340 return false;
10341 }
10342
10344 {
10345 return true;
10346 }
10347
10348 //--- ACTION CONDITIONS
10349 //direction
10350 bool IsFacingPlayer(PlayerBase player, string selection)
10351 {
10352 return true;
10353 }
10354
10355 bool IsPlayerInside(PlayerBase player, string selection)
10356 {
10357 return true;
10358 }
10359
10360 override bool CanObstruct()
10361 {
10362 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
10363 return !player || !IsPlayerInside(player, "");
10364 }
10365
10366 override bool IsBeingPlaced()
10367 {
10368 return m_IsBeingPlaced;
10369 }
10370
10371 void SetIsBeingPlaced(bool is_being_placed)
10372 {
10373 m_IsBeingPlaced = is_being_placed;
10374 if (!is_being_placed)
10376 SetSynchDirty();
10377 }
10378
10379 //server-side
10380 void OnEndPlacement() {}
10381
10382 override bool IsHologram()
10383 {
10384 return m_IsHologram;
10385 }
10386
10387 bool CanBeDigged()
10388 {
10389 return m_CanBeDigged;
10390 }
10391
10393 {
10394 return 1;
10395 }
10396
10397 bool CanMakeGardenplot()
10398 {
10399 return false;
10400 }
10401
10402 void SetIsHologram(bool is_hologram)
10403 {
10404 m_IsHologram = is_hologram;
10405 SetSynchDirty();
10406 }
10407 /*
10408 protected float GetNutritionalEnergy()
10409 {
10410 Edible_Base edible = Edible_Base.Cast(this);
10411 return edible.GetFoodEnergy();
10412 }
10413
10414 protected float GetNutritionalWaterContent()
10415 {
10416 Edible_Base edible = Edible_Base.Cast(this);
10417 return edible.GetFoodWater();
10418 }
10419
10420 protected float GetNutritionalIndex()
10421 {
10422 Edible_Base edible = Edible_Base.Cast(this);
10423 return edible.GetFoodNutritionalIndex();
10424 }
10425
10426 protected float GetNutritionalFullnessIndex()
10427 {
10428 Edible_Base edible = Edible_Base.Cast(this);
10429 return edible.GetFoodTotalVolume();
10430 }
10431
10432 protected float GetNutritionalToxicity()
10433 {
10434 Edible_Base edible = Edible_Base.Cast(this);
10435 return edible.GetFoodToxicity();
10436
10437 }
10438 */
10439
10440
10441 // -------------------------------------------------------------------------
10442 override void OnMovedInsideCargo(EntityAI container)
10443 {
10444 super.OnMovedInsideCargo(container);
10445
10446 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10447 }
10448
10449 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10450 {
10451 super.EEItemLocationChanged(oldLoc,newLoc);
10452
10453 PlayerBase new_player = null;
10454 PlayerBase old_player = null;
10455
10456 if (newLoc.GetParent())
10457 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10458
10459 if (oldLoc.GetParent())
10460 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10461
10462 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
10463 {
10464 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
10465
10466 if (r_index >= 0)
10467 {
10468 InventoryLocation r_il = new InventoryLocation;
10469 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10470
10471 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10472 int r_type = r_il.GetType();
10473 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
10474 {
10475 r_il.GetParent().GetOnReleaseLock().Invoke(this);
10476 }
10477 else if (r_type == InventoryLocationType.ATTACHMENT)
10478 {
10479 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
10480 }
10481
10482 }
10483 }
10484
10485 if (newLoc.GetType() == InventoryLocationType.HANDS)
10486 {
10487 if (new_player)
10488 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
10489
10490 if (new_player == old_player)
10491 {
10492
10493 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10494 {
10495 if (oldLoc.GetType() == InventoryLocationType.CARGO)
10496 {
10497 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10498 {
10499 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10500 }
10501 }
10502 else
10503 {
10504 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10505 }
10506 }
10507
10508 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10509 {
10510 int type = oldLoc.GetType();
10511 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
10512 {
10513 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10514 }
10515 else if (type == InventoryLocationType.ATTACHMENT)
10516 {
10517 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10518 }
10519 }
10520 if (!m_OldLocation)
10521 {
10522 m_OldLocation = new InventoryLocation;
10523 }
10524 m_OldLocation.Copy(oldLoc);
10525 }
10526 else
10527 {
10528 if (m_OldLocation)
10529 {
10530 m_OldLocation.Reset();
10531 }
10532 }
10533
10535 }
10536 else
10537 {
10538 if (new_player)
10539 {
10540 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10541 if (res_index >= 0)
10542 {
10543 InventoryLocation il = new InventoryLocation;
10544 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
10545 ItemBase it = ItemBase.Cast(il.GetItem());
10546 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
10547 int rel_type = il.GetType();
10548 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
10549 {
10550 il.GetParent().GetOnReleaseLock().Invoke(it);
10551 }
10552 else if (rel_type == InventoryLocationType.ATTACHMENT)
10553 {
10554 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
10555 }
10556 //it.GetOnReleaseLock().Invoke(it);
10557 }
10558 }
10559 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
10560 {
10561 //ThrowPhysically(old_player, vector.Zero);
10562 m_ThrowItemOnDrop = false;
10563 }
10564
10565 if (m_OldLocation)
10566 {
10567 m_OldLocation.Reset();
10568 }
10569 }
10570 }
10571
10572 override void EOnContact(IEntity other, Contact extra)
10573 {
10575 {
10576 int liquidType = -1;
10577 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
10578 if (impactSpeed > 0.0)
10579 {
10580 m_ImpactSpeed = impactSpeed;
10581 #ifndef SERVER
10582 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
10583 #else
10584 m_WantPlayImpactSound = true;
10585 SetSynchDirty();
10586 #endif
10587 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
10588 }
10589 }
10590
10591 #ifdef SERVER
10592 if (GetCompEM() && GetCompEM().IsPlugged())
10593 {
10594 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
10595 GetCompEM().UnplugThis();
10596 }
10597 #endif
10598 }
10599
10600 void RefreshPhysics();
10601
10602 override void OnCreatePhysics()
10603 {
10605 }
10606
10607 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10608 {
10609
10610 }
10611 // -------------------------------------------------------------------------
10612 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
10613 {
10614 super.OnItemLocationChanged(old_owner, new_owner);
10615
10616 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10617 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10618
10619 if (!relatedPlayer && playerNew)
10620 relatedPlayer = playerNew;
10621
10622 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10623 {
10624 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
10625 if (actionMgr)
10626 {
10627 ActionBase currentAction = actionMgr.GetRunningAction();
10628 if (currentAction)
10629 currentAction.OnItemLocationChanged(this);
10630 }
10631 }
10632
10633 Man ownerPlayerOld = null;
10634 Man ownerPlayerNew = null;
10635
10636 if (old_owner)
10637 {
10638 if (old_owner.IsMan())
10639 {
10640 ownerPlayerOld = Man.Cast(old_owner);
10641 }
10642 else
10643 {
10644 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10645 }
10646 }
10647 else
10648 {
10649 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
10650 {
10651 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
10652
10653 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
10654 {
10655 GetCompEM().UnplugThis();
10656 }
10657 }
10658 }
10659
10660 if (new_owner)
10661 {
10662 if (new_owner.IsMan())
10663 {
10664 ownerPlayerNew = Man.Cast(new_owner);
10665 }
10666 else
10667 {
10668 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10669 }
10670 }
10671
10672 if (ownerPlayerOld != ownerPlayerNew)
10673 {
10674 if (ownerPlayerOld)
10675 {
10676 array<EntityAI> subItemsExit = new array<EntityAI>;
10677 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
10678 for (int i = 0; i < subItemsExit.Count(); i++)
10679 {
10680 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
10681 itemExit.OnInventoryExit(ownerPlayerOld);
10682 }
10683 }
10684
10685 if (ownerPlayerNew)
10686 {
10687 array<EntityAI> subItemsEnter = new array<EntityAI>;
10688 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
10689 for (int j = 0; j < subItemsEnter.Count(); j++)
10690 {
10691 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
10692 itemEnter.OnInventoryEnter(ownerPlayerNew);
10693 }
10694 }
10695 }
10696 else if (ownerPlayerNew != null)
10697 {
10698 PlayerBase nplayer;
10699 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10700 {
10701 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10702 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
10703 for (int k = 0; k < subItemsUpdate.Count(); k++)
10704 {
10705 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
10706 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10707 }
10708 }
10709 }
10710
10711 if (old_owner)
10712 old_owner.OnChildItemRemoved(this);
10713 if (new_owner)
10714 new_owner.OnChildItemReceived(this);
10715 }
10716
10717 // -------------------------------------------------------------------------------
10718 override void EEDelete(EntityAI parent)
10719 {
10720 super.EEDelete(parent);
10721 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10722 if (player)
10723 {
10724 OnInventoryExit(player);
10725
10726 if (player.IsAlive())
10727 {
10728 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10729 if (r_index >= 0)
10730 {
10731 InventoryLocation r_il = new InventoryLocation;
10732 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10733
10734 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10735 int r_type = r_il.GetType();
10736 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
10737 {
10738 r_il.GetParent().GetOnReleaseLock().Invoke(this);
10739 }
10740 else if (r_type == InventoryLocationType.ATTACHMENT)
10741 {
10742 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
10743 }
10744
10745 }
10746
10747 player.RemoveQuickBarEntityShortcut(this);
10748 }
10749 }
10750 }
10751 // -------------------------------------------------------------------------------
10752 override void EEKilled(Object killer)
10753 {
10754 super.EEKilled(killer);
10755
10757 if (killer && killer.IsFireplace() && CanExplodeInFire())
10758 {
10759 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10760 {
10761 if (IsMagazine())
10762 {
10763 if (Magazine.Cast(this).GetAmmoCount() > 0)
10764 {
10765 ExplodeAmmo();
10766 }
10767 }
10768 else
10769 {
10770 Explode(DamageType.EXPLOSION);
10771 }
10772 }
10773 }
10774 }
10775
10776 override void OnWasAttached(EntityAI parent, int slot_id)
10777 {
10778 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10779
10780 super.OnWasAttached(parent, slot_id);
10781
10782 if (HasQuantity())
10783 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
10784
10785 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
10786 }
10787
10788 override void OnWasDetached(EntityAI parent, int slot_id)
10789 {
10790 super.OnWasDetached(parent, slot_id);
10791
10792 if (HasQuantity())
10793 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
10794 }
10795
10796 override string ChangeIntoOnAttach(string slot)
10797 {
10798 int idx;
10799 TStringArray inventory_slots = new TStringArray;
10800 TStringArray attach_types = new TStringArray;
10801
10802 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10803 if (inventory_slots.Count() < 1) //is string
10804 {
10805 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10806 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10807 }
10808 else //is array
10809 {
10810 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10811 }
10812
10813 idx = inventory_slots.Find(slot);
10814 if (idx < 0)
10815 return "";
10816
10817 return attach_types.Get(idx);
10818 }
10819
10820 override string ChangeIntoOnDetach()
10821 {
10822 int idx = -1;
10823 string slot;
10824
10825 TStringArray inventory_slots = new TStringArray;
10826 TStringArray detach_types = new TStringArray;
10827
10828 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10829 if (inventory_slots.Count() < 1) //is string
10830 {
10831 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10832 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10833 }
10834 else //is array
10835 {
10836 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10837 if (detach_types.Count() < 1)
10838 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10839 }
10840
10841 for (int i = 0; i < inventory_slots.Count(); i++)
10842 {
10843 slot = inventory_slots.Get(i);
10844 }
10845
10846 if (slot != "")
10847 {
10848 if (detach_types.Count() == 1)
10849 idx = 0;
10850 else
10851 idx = inventory_slots.Find(slot);
10852 }
10853 if (idx < 0)
10854 return "";
10855
10856 return detach_types.Get(idx);
10857 }
10858
10859 void ExplodeAmmo()
10860 {
10861 //timer
10862 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
10863
10864 //min/max time
10865 float min_time = 1;
10866 float max_time = 3;
10867 float delay = Math.RandomFloat(min_time, max_time);
10868
10869 explode_timer.Run(delay, this, "DoAmmoExplosion");
10870 }
10871
10872 void DoAmmoExplosion()
10873 {
10874 Magazine magazine = Magazine.Cast(this);
10875 int pop_sounds_count = 6;
10876 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10877
10878 //play sound
10879 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10880 string sound_name = pop_sounds[ sound_idx ];
10881 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
10882
10883 //remove ammo count
10884 magazine.ServerAddAmmoCount(-1);
10885
10886 //if condition then repeat -> ExplodeAmmo
10887 float min_temp_to_explode = 100; //min temperature for item to explode
10888
10889 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
10890 {
10891 ExplodeAmmo();
10892 }
10893 }
10894
10895 // -------------------------------------------------------------------------------
10896 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
10897 {
10898 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
10899
10900 const int CHANCE_DAMAGE_CARGO = 4;
10901 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10902 const int CHANCE_DAMAGE_NOTHING = 2;
10903
10904 if (IsClothing() || IsContainer() || IsItemTent())
10905 {
10906 float dmg = damageResult.GetDamage("","Health") * -0.5;
10907 int chances;
10908 int rnd;
10909
10910 if (GetInventory().GetCargo())
10911 {
10912 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10913 rnd = Math.RandomInt(0,chances);
10914
10915 if (rnd < CHANCE_DAMAGE_CARGO)
10916 {
10917 DamageItemInCargo(dmg);
10918 }
10919 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10920 {
10922 }
10923 }
10924 else
10925 {
10926 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10927 rnd = Math.RandomInt(0,chances);
10928
10929 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10930 {
10932 }
10933 }
10934 }
10935 }
10936
10937 bool DamageItemInCargo(float damage)
10938 {
10939 if (GetInventory().GetCargo())
10940 {
10941 int item_count = GetInventory().GetCargo().GetItemCount();
10942 if (item_count > 0)
10943 {
10944 int random_pick = Math.RandomInt(0, item_count);
10945 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
10946 if (!item.IsExplosive())
10947 {
10948 item.AddHealth("","",damage);
10949 return true;
10950 }
10951 }
10952 }
10953 return false;
10954 }
10955
10956 bool DamageItemAttachments(float damage)
10957 {
10958 int attachment_count = GetInventory().AttachmentCount();
10959 if (attachment_count > 0)
10960 {
10961 int random_pick = Math.RandomInt(0, attachment_count);
10962 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
10963 if (!attachment.IsExplosive())
10964 {
10965 attachment.AddHealth("","",damage);
10966 return true;
10967 }
10968 }
10969 return false;
10970 }
10971
10972 override bool IsSplitable()
10973 {
10974 return m_CanThisBeSplit;
10975 }
10976 //----------------
10977 override bool CanBeSplit()
10978 {
10979 if (IsSplitable() && (GetQuantity() > 1))
10980 return GetInventory().CanRemoveEntity();
10981
10982 return false;
10983 }
10984
10985 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
10986 {
10987 if (!CanBeSplit())
10988 return;
10989
10990 if (GetGame().IsClient())
10991 {
10992 if (ScriptInputUserData.CanStoreInputUserData())
10993 {
10994 ScriptInputUserData ctx = new ScriptInputUserData;
10996 ctx.Write(1);
10997 ItemBase i1 = this; // @NOTE: workaround for correct serialization
10998 ctx.Write(i1);
10999 ctx.Write(destination_entity);
11000 ctx.Write(true);
11001 ctx.Write(slot_id);
11002 ctx.Send();
11003 }
11004 }
11005 else if (!GetGame().IsMultiplayer())
11006 {
11007 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
11008 }
11009 }
11010
11011 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
11012 {
11013 if (!CanBeSplit())
11014 return;
11015
11016 float split_quantity_new;
11017 ref ItemBase new_item;
11018 float quantity = GetQuantity();
11019 float stack_max = GetTargetQuantityMax(slot_id);
11020 InventoryLocation loc = new InventoryLocation;
11021
11022 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11023 {
11024 if (stack_max <= GetQuantity())
11025 split_quantity_new = stack_max;
11026 else
11027 split_quantity_new = GetQuantity();
11028
11029 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
11030 if (new_item)
11031 {
11032 new_item.SetResultOfSplit(true);
11033 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11034 AddQuantity(-split_quantity_new);
11035 new_item.SetQuantity(split_quantity_new);
11036 }
11037 }
11038 else if (destination_entity && slot_id == -1)
11039 {
11040 if (quantity > stack_max)
11041 split_quantity_new = stack_max;
11042 else
11043 split_quantity_new = quantity;
11044
11045 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
11046 {
11047 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
11048 new_item = ItemBase.Cast(o);
11049 }
11050
11051 if (new_item)
11052 {
11053 new_item.SetResultOfSplit(true);
11054 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11055 AddQuantity(-split_quantity_new);
11056 new_item.SetQuantity(split_quantity_new);
11057 }
11058 }
11059 else
11060 {
11061 if (stack_max != 0)
11062 {
11063 if (stack_max < GetQuantity())
11064 {
11065 split_quantity_new = GetQuantity() - stack_max;
11066 }
11067
11068 if (split_quantity_new == 0)
11069 {
11070 if (!GetGame().IsMultiplayer())
11071 player.PhysicalPredictiveDropItem(this);
11072 else
11073 player.ServerDropEntity(this);
11074 return;
11075 }
11076
11077 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
11078
11079 if (new_item)
11080 {
11081 new_item.SetResultOfSplit(true);
11082 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11083 SetQuantity(split_quantity_new);
11084 new_item.SetQuantity(stack_max);
11085 new_item.PlaceOnSurface();
11086 }
11087 }
11088 }
11089 }
11090
11091 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
11092 {
11093 if (!CanBeSplit())
11094 return;
11095
11096 float split_quantity_new;
11097 ref ItemBase new_item;
11098 float quantity = GetQuantity();
11099 float stack_max = GetTargetQuantityMax(slot_id);
11100 InventoryLocation loc = new InventoryLocation;
11101
11102 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11103 {
11104 if (stack_max <= GetQuantity())
11105 split_quantity_new = stack_max;
11106 else
11107 split_quantity_new = GetQuantity();
11108
11109 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
11110 if (new_item)
11111 {
11112 new_item.SetResultOfSplit(true);
11113 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11114 AddQuantity(-split_quantity_new);
11115 new_item.SetQuantity(split_quantity_new);
11116 }
11117 }
11118 else if (destination_entity && slot_id == -1)
11119 {
11120 if (quantity > stack_max)
11121 split_quantity_new = stack_max;
11122 else
11123 split_quantity_new = quantity;
11124
11125 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
11126 {
11127 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
11128 new_item = ItemBase.Cast(o);
11129 }
11130
11131 if (new_item)
11132 {
11133 new_item.SetResultOfSplit(true);
11134 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11135 AddQuantity(-split_quantity_new);
11136 new_item.SetQuantity(split_quantity_new);
11137 }
11138 }
11139 else
11140 {
11141 if (stack_max != 0)
11142 {
11143 if (stack_max < GetQuantity())
11144 {
11145 split_quantity_new = GetQuantity() - stack_max;
11146 }
11147
11148 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
11149
11150 if (new_item)
11151 {
11152 new_item.SetResultOfSplit(true);
11153 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11154 SetQuantity(split_quantity_new);
11155 new_item.SetQuantity(stack_max);
11156 new_item.PlaceOnSurface();
11157 }
11158 }
11159 }
11160 }
11161
11162 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
11163 {
11164 if (!CanBeSplit())
11165 return;
11166
11167 if (GetGame().IsClient())
11168 {
11169 if (ScriptInputUserData.CanStoreInputUserData())
11170 {
11171 ScriptInputUserData ctx = new ScriptInputUserData;
11173 ctx.Write(4);
11174 ItemBase thiz = this; // @NOTE: workaround for correct serialization
11175 ctx.Write(thiz);
11176 dst.WriteToContext(ctx);
11177 ctx.Send();
11178 }
11179 }
11180 else if (!GetGame().IsMultiplayer())
11181 {
11183 }
11184 }
11185
11186 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
11187 {
11188 if (!CanBeSplit())
11189 return;
11190
11191 if (GetGame().IsClient())
11192 {
11193 if (ScriptInputUserData.CanStoreInputUserData())
11194 {
11195 ScriptInputUserData ctx = new ScriptInputUserData;
11197 ctx.Write(2);
11198 ItemBase dummy = this; // @NOTE: workaround for correct serialization
11199 ctx.Write(dummy);
11200 ctx.Write(destination_entity);
11201 ctx.Write(true);
11202 ctx.Write(idx);
11203 ctx.Write(row);
11204 ctx.Write(col);
11205 ctx.Send();
11206 }
11207 }
11208 else if (!GetGame().IsMultiplayer())
11209 {
11210 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
11211 }
11212 }
11213
11214 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
11215 {
11217 }
11218
11219 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
11220 {
11221 if (!CanBeSplit())
11222 return this;
11223
11224 float quantity = GetQuantity();
11225 float split_quantity_new;
11226 ItemBase new_item;
11227 if (dst.IsValid())
11228 {
11229 int slot_id = dst.GetSlot();
11230 float stack_max = GetTargetQuantityMax(slot_id);
11231
11232 if (quantity > stack_max)
11233 split_quantity_new = stack_max;
11234 else
11235 split_quantity_new = quantity;
11236
11237 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
11238
11239 if (new_item)
11240 {
11241 new_item.SetResultOfSplit(true);
11242 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11243 AddQuantity(-split_quantity_new);
11244 new_item.SetQuantity(split_quantity_new);
11245 }
11246
11247 return new_item;
11248 }
11249
11250 return null;
11251 }
11252
11253 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
11254 {
11255 if (!CanBeSplit())
11256 return;
11257
11258 float quantity = GetQuantity();
11259 float split_quantity_new;
11260 ref ItemBase new_item;
11261 if (destination_entity)
11262 {
11263 float stackable = GetTargetQuantityMax();
11264 if (quantity > stackable)
11265 split_quantity_new = stackable;
11266 else
11267 split_quantity_new = quantity;
11268
11269 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
11270 if (new_item)
11271 {
11272 new_item.SetResultOfSplit(true);
11273 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11274 AddQuantity(-split_quantity_new);
11275 new_item.SetQuantity(split_quantity_new);
11276 }
11277 }
11278 }
11279
11280 void SplitIntoStackMaxHandsClient(PlayerBase player)
11281 {
11282 if (!CanBeSplit())
11283 return;
11284
11285 if (GetGame().IsClient())
11286 {
11287 if (ScriptInputUserData.CanStoreInputUserData())
11288 {
11289 ScriptInputUserData ctx = new ScriptInputUserData;
11291 ctx.Write(3);
11292 ItemBase i1 = this; // @NOTE: workaround for correct serialization
11293 ctx.Write(i1);
11294 ItemBase destination_entity = this;
11295 ctx.Write(destination_entity);
11296 ctx.Write(true);
11297 ctx.Write(0);
11298 ctx.Send();
11299 }
11300 }
11301 else if (!GetGame().IsMultiplayer())
11302 {
11303 SplitIntoStackMaxHands(player);
11304 }
11305 }
11306
11307 void SplitIntoStackMaxHands(PlayerBase player)
11308 {
11309 if (!CanBeSplit())
11310 return;
11311
11312 float quantity = GetQuantity();
11313 float split_quantity_new;
11314 ref ItemBase new_item;
11315 if (player)
11316 {
11317 float stackable = GetTargetQuantityMax();
11318 if (quantity > stackable)
11319 split_quantity_new = stackable;
11320 else
11321 split_quantity_new = quantity;
11322
11323 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
11324 new_item = ItemBase.Cast(in_hands);
11325 if (new_item)
11326 {
11327 new_item.SetResultOfSplit(true);
11328 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11329 AddQuantity(-split_quantity_new);
11330 new_item.SetQuantity(split_quantity_new);
11331 }
11332 }
11333 }
11334
11335 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
11336 {
11337 if (!CanBeSplit())
11338 return;
11339
11340 float quantity = GetQuantity();
11341 float split_quantity_new = Math.Floor(quantity * 0.5);
11342
11343 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
11344
11345 if (new_item)
11346 {
11347 if (new_item.GetQuantityMax() < split_quantity_new)
11348 {
11349 split_quantity_new = new_item.GetQuantityMax();
11350 }
11351
11352 new_item.SetResultOfSplit(true);
11353 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11354
11355 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
11356 {
11357 AddQuantity(-1);
11358 new_item.SetQuantity(1);
11359 }
11360 else
11361 {
11362 AddQuantity(-split_quantity_new);
11363 new_item.SetQuantity(split_quantity_new);
11364 }
11365 }
11366 }
11367
11368 void SplitItem(PlayerBase player)
11369 {
11370 if (!CanBeSplit())
11371 return;
11372
11373 float quantity = GetQuantity();
11374 float split_quantity_new = Math.Floor(quantity / 2);
11375
11376 InventoryLocation invloc = new InventoryLocation;
11377 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
11378
11379 ItemBase new_item;
11380 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11381
11382 if (new_item)
11383 {
11384 if (new_item.GetQuantityMax() < split_quantity_new)
11385 {
11386 split_quantity_new = new_item.GetQuantityMax();
11387 }
11388 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
11389 {
11390 AddQuantity(-1);
11391 new_item.SetQuantity(1);
11392 }
11393 else
11394 {
11395 AddQuantity(-split_quantity_new);
11396 new_item.SetQuantity(split_quantity_new);
11397 }
11398 }
11399 }
11400
11402 void OnQuantityChanged(float delta)
11403 {
11404 SetWeightDirty();
11405 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
11406
11407 if (parent)
11408 parent.OnAttachmentQuantityChangedEx(this, delta);
11409
11410 if (IsLiquidContainer())
11411 {
11412 if (GetQuantityNormalized() <= 0.0)
11413 {
11415 }
11416 else if (GetLiquidType() == LIQUID_NONE)
11417 {
11418 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
11420 }
11421 }
11422
11423 }
11424
11427 {
11428 // insert code here
11429 }
11430
11432 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
11433 {
11435 }
11436
11437 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
11438 {
11439 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11440
11441 if (GetGame().IsServer())
11442 {
11443 if (newLevel == GameConstants.STATE_RUINED)
11444 {
11446 EntityAI parent = GetHierarchyParent();
11447 if (parent && parent.IsFireplace())
11448 {
11449 CargoBase cargo = GetInventory().GetCargo();
11450 if (cargo)
11451 {
11452 for (int i = 0; i < cargo.GetItemCount(); ++i)
11453 {
11454 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
11455 }
11456 }
11457 }
11458 }
11459
11460 if (IsResultOfSplit())
11461 {
11462 // reset the splitting result flag, return to normal item behavior
11463 SetResultOfSplit(false);
11464 return;
11465 }
11466
11467 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11468 {
11469 SetCleanness(0);//unclean the item upon damage dealt
11470 }
11471 }
11472 }
11473
11474 // just the split? TODO: verify
11475 override void OnRightClick()
11476 {
11477 super.OnRightClick();
11478
11479 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
11480 {
11481 if (GetGame().IsClient())
11482 {
11483 if (ScriptInputUserData.CanStoreInputUserData())
11484 {
11485 vector m4[4];
11486 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
11487
11488 EntityAI root = GetHierarchyRoot();
11489
11490 InventoryLocation dst = new InventoryLocation;
11491 if (!player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.CARGO, dst))
11492 {
11493 if (root)
11494 {
11495 root.GetTransform(m4);
11496 dst.SetGround(this, m4);
11497 }
11498 else
11499 GetInventory().GetCurrentInventoryLocation(dst);
11500 }
11501 else
11502 {
11503 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
11504 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
11505 this shouldnt cause issues within this scope*/
11506 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
11507 {
11508 if (root)
11509 {
11510 root.GetTransform(m4);
11511 dst.SetGround(this, m4);
11512 }
11513 else
11514 GetInventory().GetCurrentInventoryLocation(dst);
11515 }
11516 else
11517 {
11518 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11519 }
11520 }
11521
11522 ScriptInputUserData ctx = new ScriptInputUserData;
11524 ctx.Write(4);
11525 ItemBase thiz = this; // @NOTE: workaround for correct serialization
11526 ctx.Write(thiz);
11527 dst.WriteToContext(ctx);
11528 ctx.Write(true); // dummy
11529 ctx.Send();
11530 }
11531 }
11532 else if (!GetGame().IsMultiplayer())
11533 {
11534 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
11535 }
11536 }
11537 }
11538
11539 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
11540 {
11541 //TODO: delete check zero quantity check after fix double posts hands fsm events
11542 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
11543 return false;
11544
11545 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11546 return false;
11547
11548 //can_this_be_combined = ConfigGetBool("canBeSplit");
11550 return false;
11551
11552
11553 Magazine mag = Magazine.Cast(this);
11554 if (mag)
11555 {
11556 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11557 return false;
11558
11559 if (stack_max_limit)
11560 {
11561 Magazine other_mag = Magazine.Cast(other_item);
11562 if (other_item)
11563 {
11564 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11565 return false;
11566 }
11567
11568 }
11569 }
11570 else
11571 {
11572 //TODO: delete check zero quantity check after fix double posts hands fsm events
11573 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
11574 return false;
11575
11576 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
11577 return false;
11578 }
11579
11580 PlayerBase player = null;
11581 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
11582 {
11583 if (player.GetInventory().HasAttachment(this))
11584 return false;
11585
11586 if (player.IsItemsToDelete())
11587 return false;
11588 }
11589
11590 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11591 return false;
11592
11593 int slotID;
11594 string slotName;
11595 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11596 return false;
11597
11598 return true;
11599 }
11600
11601 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
11602 {
11603 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
11604 }
11605
11606 bool IsResultOfSplit()
11607 {
11608 return m_IsResultOfSplit;
11609 }
11610
11611 void SetResultOfSplit(bool value)
11612 {
11613 m_IsResultOfSplit = value;
11614 }
11615
11616 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
11617 {
11618 return ComputeQuantityUsedEx(other_item, use_stack_max);
11619 }
11620
11621 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
11622 {
11623 float other_item_quantity = other_item.GetQuantity();
11624 float this_free_space;
11625
11626 float stack_max = GetQuantityMax();
11627
11628 this_free_space = stack_max - GetQuantity();
11629
11630 if (other_item_quantity > this_free_space)
11631 {
11632 return this_free_space;
11633 }
11634 else
11635 {
11636 return other_item_quantity;
11637 }
11638 }
11639
11640 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
11641 {
11642 CombineItems(ItemBase.Cast(entity2),use_stack_max);
11643 }
11644
11645 void CombineItems(ItemBase other_item, bool use_stack_max = true)
11646 {
11647 if (!CanBeCombined(other_item, false))
11648 return;
11649
11650 if (!IsMagazine() && other_item)
11651 {
11652 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
11653 if (quantity_used != 0)
11654 {
11655 float hp1 = GetHealth01("","");
11656 float hp2 = other_item.GetHealth01("","");
11657 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
11658 hpResult = hpResult / (GetQuantity() + quantity_used);
11659
11660 hpResult *= GetMaxHealth();
11661 Math.Round(hpResult);
11662 SetHealth("", "Health", hpResult);
11663
11664 AddQuantity(quantity_used);
11665 other_item.AddQuantity(-quantity_used);
11666 }
11667 }
11668 OnCombine(other_item);
11669 }
11670
11671 void OnCombine(ItemBase other_item)
11672 {
11673 #ifdef SERVER
11674 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11675 GetHierarchyParent().IncreaseLifetimeUp();
11676 #endif
11677 };
11678
11679 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
11680 {
11681 PlayerBase p = PlayerBase.Cast(player);
11682
11683 array<int> recipesIds = p.m_Recipes;
11684 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
11685 if (moduleRecipesManager)
11686 {
11687 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
11688 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
11689 }
11690
11691 for (int i = 0;i < recipesIds.Count(); i++)
11692 {
11693 int key = recipesIds.Get(i);
11694 string recipeName = moduleRecipesManager.GetRecipeName(key);
11695 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
11696 }
11697 }
11698
11699 // -------------------------------------------------------------------------
11700 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11701 {
11702 super.GetDebugActions(outputList);
11703
11704 //quantity
11705 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
11706 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
11707 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
11708 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
11709
11710 //health
11711 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
11712 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
11713 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
11714 //temperature
11715 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
11716 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
11717 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
11718
11719 //wet
11720 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
11721 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
11722
11723 //liquidtype
11724 if (IsLiquidContainer())
11725 {
11726 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
11727 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
11728 }
11729
11730 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
11731 // watch
11732 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
11733 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
11734
11735 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
11736 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
11737 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
11738 }
11739
11740 // -------------------------------------------------------------------------
11741 // -------------------------------------------------------------------------
11742 // -------------------------------------------------------------------------
11743 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
11744 {
11745 super.OnAction(action_id, player, ctx);
11746 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
11747 {
11748 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
11749 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
11750 PlayerBase p = PlayerBase.Cast(player);
11751 if (EActions.RECIPES_RANGE_START < 1000)
11752 {
11753 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11754 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11755 }
11756 }
11757 #ifndef SERVER
11758 else if (action_id == EActions.WATCH_PLAYER)
11759 {
11760 PluginDeveloper.SetDeveloperItemClientEx(player);
11761 }
11762 #endif
11763 if (GetGame().IsServer())
11764 {
11765 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11766 {
11767 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11768 OnDebugButtonPressServer(id + 1);
11769 }
11770
11771 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11772 {
11773 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11774 InsertAgent(agent_id,100);
11775 }
11776
11777 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11778 {
11779 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11780 RemoveAgent(agent_id2);
11781 }
11782
11783 else if (action_id == EActions.ADD_QUANTITY)
11784 {
11785 if (IsMagazine())
11786 {
11787 Magazine mag = Magazine.Cast(this);
11788 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11789 }
11790 else
11791 {
11792 AddQuantity(GetQuantityMax() * 0.2);
11793 }
11794
11795 if (m_EM)
11796 {
11797 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11798 }
11799 //PrintVariables();
11800 }
11801
11802 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
11803 {
11804 if (IsMagazine())
11805 {
11806 Magazine mag2 = Magazine.Cast(this);
11807 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11808 }
11809 else
11810 {
11811 AddQuantity(- GetQuantityMax() * 0.2);
11812 }
11813 if (m_EM)
11814 {
11815 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11816 }
11817 //PrintVariables();
11818 }
11819
11820 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
11821 {
11822 SetQuantity(0);
11823
11824 if (m_EM)
11825 {
11826 m_EM.SetEnergy(0);
11827 }
11828 }
11829
11830 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
11831 {
11833
11834 if (m_EM)
11835 {
11836 m_EM.SetEnergy(m_EM.GetEnergyMax());
11837 }
11838 }
11839
11840 else if (action_id == EActions.ADD_HEALTH)
11841 {
11842 AddHealth("","",GetMaxHealth("","Health")/5);
11843 }
11844 else if (action_id == EActions.REMOVE_HEALTH)
11845 {
11846 AddHealth("","",-GetMaxHealth("","Health")/5);
11847 }
11848 else if (action_id == EActions.DESTROY_HEALTH)
11849 {
11850 SetHealth01("","",0);
11851 }
11852 else if (action_id == EActions.WATCH_ITEM)
11853 {
11855 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
11856 #ifdef DEVELOPER
11857 SetDebugDeveloper_item(this);
11858 #endif
11859 }
11860
11861 else if (action_id == EActions.ADD_TEMPERATURE)
11862 {
11863 AddTemperature(20);
11864 //PrintVariables();
11865 }
11866
11867 else if (action_id == EActions.REMOVE_TEMPERATURE)
11868 {
11869 AddTemperature(-20);
11870 //PrintVariables();
11871 }
11872
11873 else if (action_id == EActions.FLIP_FROZEN)
11874 {
11875 SetFrozen(!GetIsFrozen());
11876 //PrintVariables();
11877 }
11878
11879 else if (action_id == EActions.ADD_WETNESS)
11880 {
11881 AddWet(GetWetMax()/5);
11882 //PrintVariables();
11883 }
11884
11885 else if (action_id == EActions.REMOVE_WETNESS)
11886 {
11887 AddWet(-GetWetMax()/5);
11888 //PrintVariables();
11889 }
11890
11891 else if (action_id == EActions.LIQUIDTYPE_UP)
11892 {
11893 int curr_type = GetLiquidType();
11894 SetLiquidType(curr_type * 2);
11895 //AddWet(1);
11896 //PrintVariables();
11897 }
11898
11899 else if (action_id == EActions.LIQUIDTYPE_DOWN)
11900 {
11901 int curr_type2 = GetLiquidType();
11902 SetLiquidType(curr_type2 / 2);
11903 }
11904
11905 else if (action_id == EActions.MAKE_SPECIAL)
11906 {
11907 auto debugParams = DebugSpawnParams.WithPlayer(player);
11908 OnDebugSpawnEx(debugParams);
11909 }
11910
11911 else if (action_id == EActions.DELETE)
11912 {
11913 Delete();
11914 }
11915
11916 }
11917
11918
11919 return false;
11920 }
11921
11922 // -------------------------------------------------------------------------
11923
11924
11927 void OnActivatedByTripWire();
11928
11930 void OnActivatedByItem(notnull ItemBase item);
11931
11932 //----------------------------------------------------------------
11933 //returns true if item is able to explode when put in fire
11934 bool CanExplodeInFire()
11935 {
11936 return false;
11937 }
11938
11939 //----------------------------------------------------------------
11940 bool CanEat()
11941 {
11942 return true;
11943 }
11944
11945 //----------------------------------------------------------------
11946 override bool IsIgnoredByConstruction()
11947 {
11948 return true;
11949 }
11950
11951 //----------------------------------------------------------------
11952 //has FoodStages in config?
11953 bool HasFoodStage()
11954 {
11955 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
11956 return GetGame().ConfigIsExisting(config_path);
11957 }
11958
11960 FoodStage GetFoodStage()
11961 {
11962 return null;
11963 }
11964
11965 bool CanBeCooked()
11966 {
11967 return false;
11968 }
11969
11970 bool CanBeCookedOnStick()
11971 {
11972 return false;
11973 }
11974
11976 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
11978
11979 //----------------------------------------------------------------
11980 bool CanRepair(ItemBase item_repair_kit)
11981 {
11982 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
11983 return module_repairing.CanRepair(this, item_repair_kit);
11984 }
11985
11986 //----------------------------------------------------------------
11987 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
11988 {
11989 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
11990 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11991 }
11992
11993 //----------------------------------------------------------------
11994 int GetItemSize()
11995 {
11996 /*
11997 vector v_size = this.ConfigGetVector("itemSize");
11998 int v_size_x = v_size[0];
11999 int v_size_y = v_size[1];
12000 int size = v_size_x * v_size_y;
12001 return size;
12002 */
12003
12004 return 1;
12005 }
12006
12007 //----------------------------------------------------------------
12008 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
12009 bool CanBeMovedOverride()
12010 {
12011 return m_CanBeMovedOverride;
12012 }
12013
12014 //----------------------------------------------------------------
12015 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
12016 void SetCanBeMovedOverride(bool setting)
12017 {
12018 m_CanBeMovedOverride = setting;
12019 }
12020
12021 //----------------------------------------------------------------
12029 void MessageToOwnerStatus(string text)
12030 {
12031 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12032
12033 if (player)
12034 {
12035 player.MessageStatus(text);
12036 }
12037 }
12038
12039 //----------------------------------------------------------------
12047 void MessageToOwnerAction(string text)
12048 {
12049 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12050
12051 if (player)
12052 {
12053 player.MessageAction(text);
12054 }
12055 }
12056
12057 //----------------------------------------------------------------
12065 void MessageToOwnerFriendly(string text)
12066 {
12067 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12068
12069 if (player)
12070 {
12071 player.MessageFriendly(text);
12072 }
12073 }
12074
12075 //----------------------------------------------------------------
12083 void MessageToOwnerImportant(string text)
12084 {
12085 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12086
12087 if (player)
12088 {
12089 player.MessageImportant(text);
12090 }
12091 }
12092
12093 override bool IsItemBase()
12094 {
12095 return true;
12096 }
12097
12098 // Checks if item is of questioned kind
12099 override bool KindOf(string tag)
12100 {
12101 bool found = false;
12102 string item_name = this.GetType();
12103 ref TStringArray item_tag_array = new TStringArray;
12104 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
12105
12106 int array_size = item_tag_array.Count();
12107 for (int i = 0; i < array_size; i++)
12108 {
12109 if (item_tag_array.Get(i) == tag)
12110 {
12111 found = true;
12112 break;
12113 }
12114 }
12115 return found;
12116 }
12117
12118
12119 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
12120 {
12121 //Debug.Log("OnRPC called");
12122 super.OnRPC(sender, rpc_type,ctx);
12123
12124 //Play soundset for attachment locking (ActionLockAttachment.c)
12125 switch (rpc_type)
12126 {
12127 #ifndef SERVER
12128 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12129 Param2<bool, string> p = new Param2<bool, string>(false, "");
12130
12131 if (!ctx.Read(p))
12132 return;
12133
12134 bool play = p.param1;
12135 string soundSet = p.param2;
12136
12137 if (play)
12138 {
12139 if (m_LockingSound)
12140 {
12142 {
12143 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
12144 }
12145 }
12146 else
12147 {
12148 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
12149 }
12150 }
12151 else
12152 {
12153 SEffectManager.DestroyEffect(m_LockingSound);
12154 }
12155
12156 break;
12157 #endif
12158
12159 }
12160
12161 if (GetWrittenNoteData())
12162 {
12163 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
12164 }
12165 }
12166
12167 //-----------------------------
12168 // VARIABLE MANIPULATION SYSTEM
12169 //-----------------------------
12170 int NameToID(string name)
12171 {
12172 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
12173 return plugin.GetID(name);
12174 }
12175
12176 string IDToName(int id)
12177 {
12178 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
12179 return plugin.GetName(id);
12180 }
12181
12183 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
12184 {
12185 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
12186 //read the flags
12187 int varFlags;
12188 if (!ctx.Read(varFlags))
12189 return;
12190
12191 if (varFlags & ItemVariableFlags.FLOAT)
12192 {
12193 ReadVarsFromCTX(ctx);
12194 }
12195 }
12196
12197 override void SerializeNumericalVars(array<float> floats_out)
12198 {
12199 //some variables handled on EntityAI level already!
12200 super.SerializeNumericalVars(floats_out);
12201
12202 // the order of serialization must be the same as the order of de-serialization
12203 //--------------------------------------------
12204 if (IsVariableSet(VARIABLE_QUANTITY))
12205 {
12206 floats_out.Insert(m_VarQuantity);
12207 }
12208 //--------------------------------------------
12209 if (IsVariableSet(VARIABLE_WET))
12210 {
12211 floats_out.Insert(m_VarWet);
12212 }
12213 //--------------------------------------------
12214 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
12215 {
12216 floats_out.Insert(m_VarLiquidType);
12217 }
12218 //--------------------------------------------
12219 if (IsVariableSet(VARIABLE_COLOR))
12220 {
12221 floats_out.Insert(m_ColorComponentR);
12222 floats_out.Insert(m_ColorComponentG);
12223 floats_out.Insert(m_ColorComponentB);
12224 floats_out.Insert(m_ColorComponentA);
12225 }
12226 //--------------------------------------------
12227 if (IsVariableSet(VARIABLE_CLEANNESS))
12228 {
12229 floats_out.Insert(m_Cleanness);
12230 }
12231 }
12232
12233 override void DeSerializeNumericalVars(array<float> floats)
12234 {
12235 //some variables handled on EntityAI level already!
12236 super.DeSerializeNumericalVars(floats);
12237
12238 // the order of serialization must be the same as the order of de-serialization
12239 int index = 0;
12240 int mask = Math.Round(floats.Get(index));
12241
12242 index++;
12243 //--------------------------------------------
12244 if (mask & VARIABLE_QUANTITY)
12245 {
12246 if (m_IsStoreLoad)
12247 {
12248 SetStoreLoadedQuantity(floats.Get(index));
12249 }
12250 else
12251 {
12252 float quantity = floats.Get(index);
12253 SetQuantity(quantity, true, false, false, false);
12254 }
12255 index++;
12256 }
12257 //--------------------------------------------
12258 if (mask & VARIABLE_WET)
12259 {
12260 float wet = floats.Get(index);
12261 SetWet(wet);
12262 index++;
12263 }
12264 //--------------------------------------------
12265 if (mask & VARIABLE_LIQUIDTYPE)
12266 {
12267 int liquidtype = Math.Round(floats.Get(index));
12268 SetLiquidType(liquidtype);
12269 index++;
12270 }
12271 //--------------------------------------------
12272 if (mask & VARIABLE_COLOR)
12273 {
12274 m_ColorComponentR = Math.Round(floats.Get(index));
12275 index++;
12276 m_ColorComponentG = Math.Round(floats.Get(index));
12277 index++;
12278 m_ColorComponentB = Math.Round(floats.Get(index));
12279 index++;
12280 m_ColorComponentA = Math.Round(floats.Get(index));
12281 index++;
12282 }
12283 //--------------------------------------------
12284 if (mask & VARIABLE_CLEANNESS)
12285 {
12286 int cleanness = Math.Round(floats.Get(index));
12287 SetCleanness(cleanness);
12288 index++;
12289 }
12290 }
12291
12292 override void WriteVarsToCTX(ParamsWriteContext ctx)
12293 {
12294 super.WriteVarsToCTX(ctx);
12295
12296 //--------------------------------------------
12297 if (IsVariableSet(VARIABLE_QUANTITY))
12298 {
12299 ctx.Write(GetQuantity());
12300 }
12301 //--------------------------------------------
12302 if (IsVariableSet(VARIABLE_WET))
12303 {
12304 ctx.Write(GetWet());
12305 }
12306 //--------------------------------------------
12307 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
12308 {
12309 ctx.Write(GetLiquidType());
12310 }
12311 //--------------------------------------------
12312 if (IsVariableSet(VARIABLE_COLOR))
12313 {
12314 int r,g,b,a;
12315 GetColor(r,g,b,a);
12316 ctx.Write(r);
12317 ctx.Write(g);
12318 ctx.Write(b);
12319 ctx.Write(a);
12320 }
12321 //--------------------------------------------
12322 if (IsVariableSet(VARIABLE_CLEANNESS))
12323 {
12324 ctx.Write(GetCleanness());
12325 }
12326 }
12327
12328 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
12329 {
12330 if (!super.ReadVarsFromCTX(ctx,version))
12331 return false;
12332
12333 int intValue;
12334 float value;
12335
12336 if (version < 140)
12337 {
12338 if (!ctx.Read(intValue))
12339 return false;
12340
12341 m_VariablesMask = intValue;
12342 }
12343
12344 if (m_VariablesMask & VARIABLE_QUANTITY)
12345 {
12346 if (!ctx.Read(value))
12347 return false;
12348
12349 if (IsStoreLoad())
12350 {
12352 }
12353 else
12354 {
12355 SetQuantity(value, true, false, false, false);
12356 }
12357 }
12358 //--------------------------------------------
12359 if (version < 140)
12360 {
12361 if (m_VariablesMask & VARIABLE_TEMPERATURE)
12362 {
12363 if (!ctx.Read(value))
12364 return false;
12365 SetTemperatureDirect(value);
12366 }
12367 }
12368 //--------------------------------------------
12369 if (m_VariablesMask & VARIABLE_WET)
12370 {
12371 if (!ctx.Read(value))
12372 return false;
12373 SetWet(value);
12374 }
12375 //--------------------------------------------
12376 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
12377 {
12378 if (!ctx.Read(intValue))
12379 return false;
12380 SetLiquidType(intValue);
12381 }
12382 //--------------------------------------------
12383 if (m_VariablesMask & VARIABLE_COLOR)
12384 {
12385 int r,g,b,a;
12386 if (!ctx.Read(r))
12387 return false;
12388 if (!ctx.Read(g))
12389 return false;
12390 if (!ctx.Read(b))
12391 return false;
12392 if (!ctx.Read(a))
12393 return false;
12394
12395 SetColor(r,g,b,a);
12396 }
12397 //--------------------------------------------
12398 if (m_VariablesMask & VARIABLE_CLEANNESS)
12399 {
12400 if (!ctx.Read(intValue))
12401 return false;
12402 SetCleanness(intValue);
12403 }
12404 //--------------------------------------------
12405 if (version >= 138 && version < 140)
12406 {
12407 if (m_VariablesMask & VARIABLE_TEMPERATURE)
12408 {
12409 if (!ctx.Read(intValue))
12410 return false;
12411 SetFrozen(intValue);
12412 }
12413 }
12414
12415 return true;
12416 }
12417
12418 //----------------------------------------------------------------
12419 override bool OnStoreLoad(ParamsReadContext ctx, int version)
12420 {
12421 m_IsStoreLoad = true;
12423 {
12424 m_FixDamageSystemInit = true;
12425 }
12426
12427 if (!super.OnStoreLoad(ctx, version))
12428 {
12429 m_IsStoreLoad = false;
12430 return false;
12431 }
12432
12433 if (version >= 114)
12434 {
12435 bool hasQuickBarIndexSaved;
12436
12437 if (!ctx.Read(hasQuickBarIndexSaved))
12438 {
12439 m_IsStoreLoad = false;
12440 return false;
12441 }
12442
12443 if (hasQuickBarIndexSaved)
12444 {
12445 int itmQBIndex;
12446
12447 //Load quickbar item bind
12448 if (!ctx.Read(itmQBIndex))
12449 {
12450 m_IsStoreLoad = false;
12451 return false;
12452 }
12453
12454 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12455 if (itmQBIndex != -1 && parentPlayer)
12456 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12457 }
12458 }
12459 else
12460 {
12461 // Backup of how it used to be
12462 PlayerBase player;
12463 int itemQBIndex;
12464 if (version == int.MAX)
12465 {
12466 if (!ctx.Read(itemQBIndex))
12467 {
12468 m_IsStoreLoad = false;
12469 return false;
12470 }
12471 }
12472 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12473 {
12474 //Load quickbar item bind
12475 if (!ctx.Read(itemQBIndex))
12476 {
12477 m_IsStoreLoad = false;
12478 return false;
12479 }
12480 if (itemQBIndex != -1 && player)
12481 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12482 }
12483 }
12484
12485 if (version < 140)
12486 {
12487 // variable management system
12488 if (!LoadVariables(ctx, version))
12489 {
12490 m_IsStoreLoad = false;
12491 return false;
12492 }
12493 }
12494
12495 //agent trasmission system
12496 if (!LoadAgents(ctx, version))
12497 {
12498 m_IsStoreLoad = false;
12499 return false;
12500 }
12501 if (version >= 132)
12502 {
12503 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
12504 if (raib)
12505 {
12506 if (!raib.OnStoreLoad(ctx,version))
12507 {
12508 m_IsStoreLoad = false;
12509 return false;
12510 }
12511 }
12512 }
12513
12514 m_IsStoreLoad = false;
12515 return true;
12516 }
12517
12518 //----------------------------------------------------------------
12519
12520 override void OnStoreSave(ParamsWriteContext ctx)
12521 {
12522 super.OnStoreSave(ctx);
12523
12524 PlayerBase player;
12525 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12526 {
12527 ctx.Write(true); // Keep track of if we should actually read this in or not
12528 //Save quickbar item bind
12529 int itemQBIndex = -1;
12530 itemQBIndex = player.FindQuickBarEntityIndex(this);
12531 ctx.Write(itemQBIndex);
12532 }
12533 else
12534 {
12535 ctx.Write(false); // Keep track of if we should actually read this in or not
12536 }
12537
12538 SaveAgents(ctx);//agent trasmission system
12539
12540 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
12541 if (raib)
12542 {
12543 raib.OnStoreSave(ctx);
12544 }
12545 }
12546 //----------------------------------------------------------------
12547
12548 override void AfterStoreLoad()
12549 {
12550 super.AfterStoreLoad();
12551
12553 {
12555 }
12556
12557 if (GetStoreLoadedQuantity() != float.LOWEST)
12558 {
12560 SetStoreLoadedQuantity(float.LOWEST);//IMPORTANT to do this !! we use 'm_StoreLoadedQuantity' inside SetQuantity to distinguish between initial quantity setting and the consequent(normal gameplay) calls
12561 }
12562 }
12563
12564 override void EEOnAfterLoad()
12565 {
12566 super.EEOnAfterLoad();
12567
12569 {
12570 m_FixDamageSystemInit = false;
12571 }
12572
12575 }
12576
12577 bool CanBeDisinfected()
12578 {
12579 return false;
12580 }
12581
12582
12583 //----------------------------------------------------------------
12584 override void OnVariablesSynchronized()
12585 {
12586 if (m_Initialized)
12587 {
12588 #ifdef PLATFORM_CONSOLE
12589 //bruteforce it is
12590 if (IsSplitable())
12591 {
12592 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
12593 if (menu)
12594 {
12595 menu.Refresh();
12596 }
12597 }
12598 #endif
12599 }
12600
12602 {
12603 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
12604 m_WantPlayImpactSound = false;
12605 }
12606
12608 {
12609 SetWeightDirty();
12611 }
12612 if (m_VarWet != m_VarWetPrev)
12613 {
12616 }
12617
12618 if (m_SoundSyncPlay != 0)
12619 {
12620 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
12621 m_SoundSyncPlay = 0;
12622 }
12623 if (m_SoundSyncStop != 0)
12624 {
12625 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
12626 m_SoundSyncStop = 0;
12627 }
12628
12629 super.OnVariablesSynchronized();
12630 }
12631
12632 //------------------------- Quantity
12633 //----------------------------------------------------------------
12635 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
12636 {
12637 if (!IsServerCheck(allow_client))
12638 return false;
12639
12640 if (!HasQuantity())
12641 return false;
12642
12643 float min = GetQuantityMin();
12644 float max = GetQuantityMax();
12645
12646 if (value <= (min + 0.001))
12647 value = min;
12648
12649 if (value == min)
12650 {
12651 if (destroy_config)
12652 {
12653 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12654 if (dstr)
12655 {
12656 m_VarQuantity = Math.Clamp(value, min, max);
12657 this.Delete();
12658 return true;
12659 }
12660 }
12661 else if (destroy_forced)
12662 {
12663 m_VarQuantity = Math.Clamp(value, min, max);
12664 this.Delete();
12665 return true;
12666 }
12667 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
12668 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
12669 }
12670
12671 float delta = m_VarQuantity;
12672 m_VarQuantity = Math.Clamp(value, min, max);
12673
12674 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
12675 {
12676 delta = m_VarQuantity - delta;
12677
12678 if (delta)
12679 OnQuantityChanged(delta);
12680 }
12681
12682 SetVariableMask(VARIABLE_QUANTITY);
12683
12684 return false;
12685 }
12686
12687 //----------------------------------------------------------------
12689 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
12690 {
12691 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
12692 }
12693 //----------------------------------------------------------------
12694 void SetQuantityMax()
12695 {
12696 float max = GetQuantityMax();
12697 SetQuantity(max);
12698 }
12699
12700 override void SetQuantityToMinimum()
12701 {
12702 float min = GetQuantityMin();
12703 SetQuantity(min);
12704 }
12705 //----------------------------------------------------------------
12707 void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
12708 {
12709 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
12710 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
12711 SetQuantity(result, destroy_config, destroy_forced);
12712 }
12713
12714 //----------------------------------------------------------------
12716 override float GetQuantityNormalized()
12717 {
12718 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
12719 }
12720
12722 {
12723 return GetQuantityNormalized();
12724 }
12725
12726 /*void SetAmmoNormalized(float value)
12727 {
12728 float value_clamped = Math.Clamp(value, 0, 1);
12729 Magazine this_mag = Magazine.Cast(this);
12730 int max_rounds = this_mag.GetAmmoMax();
12731 int result = value * max_rounds;//can the rounded if higher precision is required
12732 this_mag.SetAmmoCount(result);
12733 }*/
12734 //----------------------------------------------------------------
12735 override int GetQuantityMax()
12736 {
12737 int slot = -1;
12738 if (GetInventory())
12739 {
12740 InventoryLocation il = new InventoryLocation;
12741 GetInventory().GetCurrentInventoryLocation(il);
12742 slot = il.GetSlot();
12743 }
12744
12745 return GetTargetQuantityMax(slot);
12746 }
12747
12748 override int GetTargetQuantityMax(int attSlotID = -1)
12749 {
12750 float quantity_max = 0;
12751
12752 if (IsSplitable()) //only stackable/splitable items can check for stack size
12753 {
12754 if (attSlotID != -1)
12755 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12756
12757 if (quantity_max <= 0)
12758 quantity_max = m_VarStackMax;
12759 }
12760
12761 if (quantity_max <= 0)
12762 quantity_max = m_VarQuantityMax;
12763
12764 return quantity_max;
12765 }
12766 //----------------------------------------------------------------
12767 override int GetQuantityMin()
12768 {
12769 return m_VarQuantityMin;
12770 }
12771 //----------------------------------------------------------------
12772 int GetQuantityInit()
12773 {
12774 return m_VarQuantityInit;
12775 }
12776
12777 //----------------------------------------------------------------
12778 override bool HasQuantity()
12779 {
12780 return !(GetQuantityMax() - GetQuantityMin() == 0);
12781 }
12782
12783 override float GetQuantity()
12784 {
12785 return m_VarQuantity;
12786 }
12787
12788 bool IsFullQuantity()
12789 {
12790 return GetQuantity() >= GetQuantityMax();
12791 }
12792
12793 //Calculates weight of single item without attachments and cargo
12794 override float GetSingleInventoryItemWeightEx()
12795 {
12796 //this needs to be first stored inside local variables, when returned directly during inside return call, the result is completely different due to enforce script bug
12797 float weightEx = GetWeightEx();//overall weight of the item
12798 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
12799 return weightEx - special;
12800 }
12801
12802 // Obsolete, use GetSingleInventoryItemWeightEx() instead
12804 {
12806 }
12807
12808 override protected float GetWeightSpecialized(bool forceRecalc = false)
12809 {
12810 if (IsSplitable()) //quantity determines size of the stack
12811 {
12812 #ifdef DEVELOPER
12813 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12814 {
12815 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12816 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
12817 }
12818 #endif
12819
12820 return GetQuantity() * GetConfigWeightModified();
12821 }
12822 else if (HasEnergyManager())// items with energy manager
12823 {
12824 #ifdef DEVELOPER
12825 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12826 {
12827 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12828 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
12829 }
12830 #endif
12831 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
12832 }
12833 else//everything else
12834 {
12835 #ifdef DEVELOPER
12836 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12837 {
12838 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12839 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
12840 }
12841 #endif
12842 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
12843 }
12844 }
12845
12847 int GetNumberOfItems()
12848 {
12849 int item_count = 0;
12850 ItemBase item;
12851
12852 if (GetInventory().GetCargo() != NULL)
12853 {
12854 item_count = GetInventory().GetCargo().GetItemCount();
12855 }
12856
12857 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
12858 {
12859 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
12860 if (item)
12861 item_count += item.GetNumberOfItems();
12862 }
12863 return item_count;
12864 }
12865
12867 float GetUnitWeight(bool include_wetness = true)
12868 {
12869 float weight = 0;
12870 float wetness = 1;
12871 if (include_wetness)
12872 wetness += GetWet();
12873 if (IsSplitable()) //quantity determines size of the stack
12874 {
12875 weight = wetness * m_ConfigWeight;
12876 }
12877 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
12878 {
12879 weight = 1;
12880 }
12881 return weight;
12882 }
12883
12884 //-----------------------------------------------------------------
12885
12886 override void ClearInventory()
12887 {
12888 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
12889 {
12890 GameInventory inv = GetInventory();
12891 array<EntityAI> items = new array<EntityAI>;
12892 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
12893 for (int i = 0; i < items.Count(); i++)
12894 {
12895 ItemBase item = ItemBase.Cast(items.Get(i));
12896 if (item)
12897 {
12898 GetGame().ObjectDelete(item);
12899 }
12900 }
12901 }
12902 }
12903
12904 //------------------------- Energy
12905
12906 //----------------------------------------------------------------
12907 float GetEnergy()
12908 {
12909 float energy = 0;
12910 if (HasEnergyManager())
12911 {
12912 energy = GetCompEM().GetEnergy();
12913 }
12914 return energy;
12915 }
12916
12917
12918 override void OnEnergyConsumed()
12919 {
12920 super.OnEnergyConsumed();
12921
12923 }
12924
12925 override void OnEnergyAdded()
12926 {
12927 super.OnEnergyAdded();
12928
12930 }
12931
12932 // Converts energy (from Energy Manager) to quantity, if enabled.
12934 {
12935 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12936 {
12937 if (HasQuantity())
12938 {
12939 float energy_0to1 = GetCompEM().GetEnergy0To1();
12940 SetQuantityNormalized(energy_0to1);
12941 }
12942 }
12943 }
12944
12945 //----------------------------------------------------------------
12946 float GetHeatIsolationInit()
12947 {
12948 return ConfigGetFloat("heatIsolation");
12949 }
12950
12951 float GetHeatIsolation()
12952 {
12953 return m_HeatIsolation;
12954 }
12955
12956 float GetDryingIncrement(string pIncrementName)
12957 {
12958 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
12959 if (GetGame().ConfigIsExisting(paramPath))
12960 return GetGame().ConfigGetFloat(paramPath);
12961
12962 return 0.0;
12963 }
12964
12965 float GetSoakingIncrement(string pIncrementName)
12966 {
12967 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
12968 if (GetGame().ConfigIsExisting(paramPath))
12969 return GetGame().ConfigGetFloat(paramPath);
12970
12971 return 0.0;
12972 }
12973 //----------------------------------------------------------------
12974 override void SetWet(float value, bool allow_client = false)
12975 {
12976 if (!IsServerCheck(allow_client))
12977 return;
12978
12979 float min = GetWetMin();
12980 float max = GetWetMax();
12981
12982 float previousValue = m_VarWet;
12983
12984 m_VarWet = Math.Clamp(value, min, max);
12985
12986 if (previousValue != m_VarWet)
12987 {
12988 SetVariableMask(VARIABLE_WET);
12989 OnWetChanged(m_VarWet, previousValue);
12990 }
12991 }
12992 //----------------------------------------------------------------
12993 override void AddWet(float value)
12994 {
12995 SetWet(GetWet() + value);
12996 }
12997 //----------------------------------------------------------------
12998 override void SetWetMax()
12999 {
13001 }
13002 //----------------------------------------------------------------
13003 override float GetWet()
13004 {
13005 return m_VarWet;
13006 }
13007 //----------------------------------------------------------------
13008 override float GetWetMax()
13009 {
13010 return m_VarWetMax;
13011 }
13012 //----------------------------------------------------------------
13013 override float GetWetMin()
13014 {
13015 return m_VarWetMin;
13016 }
13017 //----------------------------------------------------------------
13018 override float GetWetInit()
13019 {
13020 return m_VarWetInit;
13021 }
13022 //----------------------------------------------------------------
13023 override void OnWetChanged(float newVal, float oldVal)
13024 {
13025 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
13026 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
13027 if (newLevel != oldLevel)
13028 {
13029 OnWetLevelChanged(newLevel,oldLevel);
13030 }
13031 }
13032
13033 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
13034 {
13035 SetWeightDirty();
13036 }
13037
13038 override EWetnessLevel GetWetLevel()
13039 {
13040 return GetWetLevelInternal(m_VarWet);
13041 }
13042
13043 //----------------------------------------------------------------
13044
13045 override void SetStoreLoad(bool value)
13046 {
13047 m_IsStoreLoad = value;
13048 }
13049
13050 override bool IsStoreLoad()
13051 {
13052 return m_IsStoreLoad;
13053 }
13054
13055 override void SetStoreLoadedQuantity(float value)
13056 {
13057 m_StoreLoadedQuantity = value;
13058 }
13059
13060 override float GetStoreLoadedQuantity()
13061 {
13062 return m_StoreLoadedQuantity;
13063 }
13064
13065 //----------------------------------------------------------------
13066
13067 float GetItemModelLength()
13068 {
13069 if (ConfigIsExisting("itemModelLength"))
13070 {
13071 return ConfigGetFloat("itemModelLength");
13072 }
13073 return 0;
13074 }
13075
13076 float GetItemAttachOffset()
13077 {
13078 if (ConfigIsExisting("itemAttachOffset"))
13079 {
13080 return ConfigGetFloat("itemAttachOffset");
13081 }
13082 return 0;
13083 }
13084
13085 override void SetCleanness(int value, bool allow_client = false)
13086 {
13087 if (!IsServerCheck(allow_client))
13088 return;
13089
13090 int previousValue = m_Cleanness;
13091
13092 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
13093
13094 if (previousValue != m_Cleanness)
13095 SetVariableMask(VARIABLE_CLEANNESS);
13096 }
13097
13098 override int GetCleanness()
13099 {
13100 return m_Cleanness;
13101 }
13102
13104 {
13105 return true;
13106 }
13107
13108 //----------------------------------------------------------------
13109 // ATTACHMENT LOCKING
13110 // Getters relevant to generic ActionLockAttachment
13111 int GetLockType()
13112 {
13113 return m_LockType;
13114 }
13115
13116 string GetLockSoundSet()
13117 {
13118 return m_LockSoundSet;
13119 }
13120
13121 //----------------------------------------------------------------
13122 //------------------------- Color
13123 // sets items color variable given color components
13124 override void SetColor(int r, int g, int b, int a)
13125 {
13130 SetVariableMask(VARIABLE_COLOR);
13131 }
13133 override void GetColor(out int r,out int g,out int b,out int a)
13134 {
13139 }
13140
13141 bool IsColorSet()
13142 {
13143 return IsVariableSet(VARIABLE_COLOR);
13144 }
13145
13147 string GetColorString()
13148 {
13149 int r,g,b,a;
13150 GetColor(r,g,b,a);
13151 r = r/255;
13152 g = g/255;
13153 b = b/255;
13154 a = a/255;
13155 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13156 }
13157 //----------------------------------------------------------------
13158 //------------------------- LiquidType
13159
13160 override void SetLiquidType(int value, bool allow_client = false)
13161 {
13162 if (!IsServerCheck(allow_client))
13163 return;
13164
13165 int old = m_VarLiquidType;
13166 m_VarLiquidType = value;
13167 OnLiquidTypeChanged(old,value);
13168 SetVariableMask(VARIABLE_LIQUIDTYPE);
13169 }
13170
13171 int GetLiquidTypeInit()
13172 {
13173 return ConfigGetInt("varLiquidTypeInit");
13174 }
13175
13176 override int GetLiquidType()
13177 {
13178 return m_VarLiquidType;
13179 }
13180
13181 protected void OnLiquidTypeChanged(int oldType, int newType)
13182 {
13183 if (newType == LIQUID_NONE && GetIsFrozen())
13184 SetFrozen(false);
13185 }
13186
13188 void UpdateQuickbarShortcutVisibility(PlayerBase player)
13189 {
13190 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13191 }
13192
13193 // -------------------------------------------------------------------------
13195 void OnInventoryEnter(Man player)
13196 {
13197 PlayerBase nplayer;
13198 if (PlayerBase.CastTo(nplayer, player))
13199 {
13200 m_CanPlayImpactSound = true;
13201 //nplayer.OnItemInventoryEnter(this);
13202 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13203 }
13204 }
13205
13206 // -------------------------------------------------------------------------
13208 void OnInventoryExit(Man player)
13209 {
13210 PlayerBase nplayer;
13211 if (PlayerBase.CastTo(nplayer,player))
13212 {
13213 //nplayer.OnItemInventoryExit(this);
13214 nplayer.SetEnableQuickBarEntityShortcut(this,false);
13215
13216 }
13217
13218 //if (!GetGame().IsDedicatedServer())
13219 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13220
13221
13222 if (HasEnergyManager())
13223 {
13224 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
13225 }
13226 }
13227
13228 // ADVANCED PLACEMENT EVENTS
13229 override void OnPlacementStarted(Man player)
13230 {
13231 super.OnPlacementStarted(player);
13232
13233 SetTakeable(false);
13234 }
13235
13236 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
13237 {
13238 if (m_AdminLog)
13239 {
13240 m_AdminLog.OnPlacementComplete(player, this);
13241 }
13242
13243 super.OnPlacementComplete(player, position, orientation);
13244 }
13245
13246 //-----------------------------
13247 // AGENT SYSTEM
13248 //-----------------------------
13249 //--------------------------------------------------------------------------
13250 bool ContainsAgent(int agent_id)
13251 {
13252 if (agent_id & m_AttachedAgents)
13253 {
13254 return true;
13255 }
13256 else
13257 {
13258 return false;
13259 }
13260 }
13261
13262 //--------------------------------------------------------------------------
13263 override void RemoveAgent(int agent_id)
13264 {
13265 if (ContainsAgent(agent_id))
13266 {
13267 m_AttachedAgents = ~agent_id & m_AttachedAgents;
13268 }
13269 }
13270
13271 //--------------------------------------------------------------------------
13272 override void RemoveAllAgents()
13273 {
13274 m_AttachedAgents = 0;
13275 }
13276 //--------------------------------------------------------------------------
13277 override void RemoveAllAgentsExcept(int agent_to_keep)
13278 {
13279 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
13280 }
13281 // -------------------------------------------------------------------------
13282 override void InsertAgent(int agent, float count = 1)
13283 {
13284 if (count < 1)
13285 return;
13286 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
13288 }
13289
13291 void TransferAgents(int agents)
13292 {
13294 }
13295
13296 // -------------------------------------------------------------------------
13297 override int GetAgents()
13298 {
13299 return m_AttachedAgents;
13300 }
13301 //----------------------------------------------------------------------
13302
13303 /*int GetContaminationType()
13304 {
13305 int contamination_type;
13306
13307 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
13308 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
13309 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
13310 const int DIRTY_MASK = eAgents.WOUND_AGENT;
13311
13312 Edible_Base edible = Edible_Base.Cast(this);
13313 int agents = GetAgents();
13314 if (edible)
13315 {
13316 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
13317 if (profile)
13318 {
13319 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
13320 }
13321 }
13322 if (agents & CONTAMINATED_MASK)
13323 {
13324 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
13325 }
13326 if (agents & POISONED_MASK)
13327 {
13328 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
13329 }
13330 if (agents & NERVE_GAS_MASK)
13331 {
13332 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
13333 }
13334 if (agents & DIRTY_MASK)
13335 {
13336 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
13337 }
13338
13339 return agents;
13340 }*/
13341
13342 // -------------------------------------------------------------------------
13343 bool LoadAgents(ParamsReadContext ctx, int version)
13344 {
13345 if (!ctx.Read(m_AttachedAgents))
13346 return false;
13347 return true;
13348 }
13349 // -------------------------------------------------------------------------
13351 {
13352
13354 }
13355 // -------------------------------------------------------------------------
13356
13358 override void CheckForRoofLimited(float timeTresholdMS = 3000)
13359 {
13360 super.CheckForRoofLimited(timeTresholdMS);
13361
13362 float time = GetGame().GetTime();
13363 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13364 {
13365 m_PreviousRoofTestTime = time;
13366 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13367 }
13368 }
13369
13370 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
13371 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
13372 {
13373 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
13374 {
13375 return 0;
13376 }
13377
13378 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
13379 {
13380 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
13381 if (filter)
13382 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
13383 else
13384 return 0;//otherwise return 0 when no filter attached
13385 }
13386
13387 string subclassPath, entryName;
13388
13389 switch (type)
13390 {
13391 case DEF_BIOLOGICAL:
13392 entryName = "biological";
13393 break;
13394 case DEF_CHEMICAL:
13395 entryName = "chemical";
13396 break;
13397 default:
13398 entryName = "biological";
13399 break;
13400 }
13401
13402 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
13403
13404 return GetGame().ConfigGetFloat(subclassPath + entryName);
13405 }
13406
13407
13408
13410 override void EEOnCECreate()
13411 {
13412 if (!IsMagazine())
13414
13416 }
13417
13418
13419 //-------------------------
13420 // OPEN/CLOSE USER ACTIONS
13421 //-------------------------
13423 void Open();
13424 void Close();
13425 bool IsOpen()
13426 {
13427 return true;
13428 }
13429
13430 override bool CanDisplayCargo()
13431 {
13432 return IsOpen();
13433 }
13434
13435
13436 // ------------------------------------------------------------
13437 // CONDITIONS
13438 // ------------------------------------------------------------
13439 override bool CanPutInCargo(EntityAI parent)
13440 {
13441 if (parent)
13442 {
13443 if (parent.IsInherited(DayZInfected))
13444 return true;
13445
13446 if (!parent.IsRuined())
13447 return true;
13448 }
13449
13450 return true;
13451 }
13452
13453 override bool CanPutAsAttachment(EntityAI parent)
13454 {
13455 if (!super.CanPutAsAttachment(parent))
13456 {
13457 return false;
13458 }
13459
13460 if (!IsRuined() && !parent.IsRuined())
13461 {
13462 return true;
13463 }
13464
13465 return false;
13466 }
13467
13468 override bool CanReceiveItemIntoCargo(EntityAI item)
13469 {
13470 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
13471 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
13472 // return false;
13473
13474 return super.CanReceiveItemIntoCargo(item);
13475 }
13476
13477 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
13478 {
13479 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
13480 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
13481 // return false;
13482
13483 GameInventory attachmentInv = attachment.GetInventory();
13484 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
13485 {
13486 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13487 return false;
13488 }
13489
13490 InventoryLocation loc = new InventoryLocation();
13491 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13492 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
13493 return false;
13494
13495 return super.CanReceiveAttachment(attachment, slotId);
13496 }
13497
13498 override bool CanReleaseAttachment(EntityAI attachment)
13499 {
13500 if (!super.CanReleaseAttachment(attachment))
13501 return false;
13502
13503 return GetInventory().AreChildrenAccessible();
13504 }
13505
13506 /*override bool CanLoadAttachment(EntityAI attachment)
13507 {
13508 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
13509 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
13510 // return false;
13511
13512 GameInventory attachmentInv = attachment.GetInventory();
13513 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
13514 {
13515 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
13516 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
13517
13518 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13519 return false;
13520 }
13521
13522 return super.CanLoadAttachment(attachment);
13523 }*/
13524
13525 // Plays muzzle flash particle effects
13526 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
13527 {
13528 int id = muzzle_owner.GetMuzzleID();
13529 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
13530
13531 if (WPOF_array)
13532 {
13533 for (int i = 0; i < WPOF_array.Count(); i++)
13534 {
13535 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13536
13537 if (WPOF)
13538 {
13539 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13540 }
13541 }
13542 }
13543 }
13544
13545 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
13546 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
13547 {
13548 int id = muzzle_owner.GetMuzzleID();
13549 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
13550
13551 if (WPOBE_array)
13552 {
13553 for (int i = 0; i < WPOBE_array.Count(); i++)
13554 {
13555 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13556
13557 if (WPOBE)
13558 {
13559 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13560 }
13561 }
13562 }
13563 }
13564
13565 // Plays all weapon overheating particles
13566 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
13567 {
13568 int id = muzzle_owner.GetMuzzleID();
13569 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13570
13571 if (WPOOH_array)
13572 {
13573 for (int i = 0; i < WPOOH_array.Count(); i++)
13574 {
13575 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13576
13577 if (WPOOH)
13578 {
13579 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13580 }
13581 }
13582 }
13583 }
13584
13585 // Updates all weapon overheating particles
13586 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
13587 {
13588 int id = muzzle_owner.GetMuzzleID();
13589 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13590
13591 if (WPOOH_array)
13592 {
13593 for (int i = 0; i < WPOOH_array.Count(); i++)
13594 {
13595 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13596
13597 if (WPOOH)
13598 {
13599 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13600 }
13601 }
13602 }
13603 }
13604
13605 // Stops overheating particles
13606 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
13607 {
13608 int id = muzzle_owner.GetMuzzleID();
13609 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13610
13611 if (WPOOH_array)
13612 {
13613 for (int i = 0; i < WPOOH_array.Count(); i++)
13614 {
13615 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13616
13617 if (WPOOH)
13618 {
13619 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13620 }
13621 }
13622 }
13623 }
13624
13625 //----------------------------------------------------------------
13626 //Item Behaviour - unified approach
13627 override bool IsHeavyBehaviour()
13628 {
13629 if (m_ItemBehaviour == 0)
13630 {
13631 return true;
13632 }
13633
13634 return false;
13635 }
13636
13637 override bool IsOneHandedBehaviour()
13638 {
13639 if (m_ItemBehaviour == 1)
13640 {
13641 return true;
13642 }
13643
13644 return false;
13645 }
13646
13647 override bool IsTwoHandedBehaviour()
13648 {
13649 if (m_ItemBehaviour == 2)
13650 {
13651 return true;
13652 }
13653
13654 return false;
13655 }
13656
13657 bool IsDeployable()
13658 {
13659 return false;
13660 }
13661
13663 float GetDeployTime()
13664 {
13665 return UATimeSpent.DEFAULT_DEPLOY;
13666 }
13667
13668
13669 //----------------------------------------------------------------
13670 // Item Targeting (User Actions)
13671 override void SetTakeable(bool pState)
13672 {
13673 m_IsTakeable = pState;
13674 SetSynchDirty();
13675 }
13676
13677 override bool IsTakeable()
13678 {
13679 return m_IsTakeable;
13680 }
13681
13682 // For cases where we want to show object widget which cant be taken to hands
13684 {
13685 return false;
13686 }
13687
13689 protected void PreLoadSoundAttachmentType()
13690 {
13691 string att_type = "None";
13692
13693 if (ConfigIsExisting("soundAttType"))
13694 {
13695 att_type = ConfigGetString("soundAttType");
13696 }
13697
13698 m_SoundAttType = att_type;
13699 }
13700
13701 override string GetAttachmentSoundType()
13702 {
13703 return m_SoundAttType;
13704 }
13705
13706 //----------------------------------------------------------------
13707 //SOUNDS - ItemSoundHandler
13708 //----------------------------------------------------------------
13709
13710 string GetPlaceSoundset(); // played when deploy starts
13711 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
13712 string GetDeploySoundset(); // played when deploy sucessfully finishes
13713
13715 {
13716 if (!m_ItemSoundHandler)
13718
13719 return m_ItemSoundHandler;
13720 }
13721
13722 // override to initialize sounds
13723 protected void InitItemSounds()
13724 {
13725 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
13726 return;
13727
13729
13730 if (GetPlaceSoundset() != string.Empty)
13731 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
13732
13733 if (GetDeploySoundset() != string.Empty)
13734 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
13735
13736 SoundParameters params = new SoundParameters();
13737 params.m_Loop = true;
13738 if (GetLoopDeploySoundset() != string.Empty)
13739 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
13740 }
13741
13742 // Start sound using ItemSoundHandler
13743 void StartItemSoundServer(int id)
13744 {
13745 if (!GetGame().IsServer())
13746 return;
13747
13748 m_SoundSyncPlay = id;
13749 SetSynchDirty();
13750
13751 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
13753 }
13754
13755 // Stop sound using ItemSoundHandler
13756 void StopItemSoundServer(int id)
13757 {
13758 if (!GetGame().IsServer())
13759 return;
13760
13761 m_SoundSyncStop = id;
13762 SetSynchDirty();
13763
13764 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
13766 }
13767
13768 protected void ClearStartItemSoundServer()
13769 {
13770 m_SoundSyncPlay = 0;
13771 }
13772
13773 protected void ClearStopItemSoundServer()
13774 {
13775 m_SoundSyncStop = 0;
13776 }
13777
13779 void PlayAttachSound(string slot_type)
13780 {
13781 if (!GetGame().IsDedicatedServer())
13782 {
13783 if (ConfigIsExisting("attachSoundSet"))
13784 {
13785 string cfg_path = "";
13786 string soundset = "";
13787 string type_name = GetType();
13788
13789 TStringArray cfg_soundset_array = new TStringArray;
13790 TStringArray cfg_slot_array = new TStringArray;
13791 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13792 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13793
13794 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13795 {
13796 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13797 {
13798 if (cfg_slot_array[i] == slot_type)
13799 {
13800 soundset = cfg_soundset_array[i];
13801 break;
13802 }
13803 }
13804 }
13805
13806 if (soundset != "")
13807 {
13808 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
13809 sound.SetAutodestroy(true);
13810 }
13811 }
13812 }
13813 }
13814
13815 void PlayDetachSound(string slot_type)
13816 {
13817 //TODO - evaluate if needed and devise universal config structure if so
13818 }
13819
13820 void OnApply(PlayerBase player);
13821
13823 {
13824 return 1.0;
13825 };
13826 //returns applicable selection
13827 array<string> GetHeadHidingSelection()
13828 {
13830 }
13831
13833 {
13835 }
13836
13837 WrittenNoteData GetWrittenNoteData() {};
13838
13840 {
13841 SetDynamicPhysicsLifeTime(0.01);
13842 m_ItemBeingDroppedPhys = false;
13843 }
13844
13846 {
13847 array<string> zone_names = new array<string>;
13848 GetDamageZones(zone_names);
13849 for (int i = 0; i < zone_names.Count(); i++)
13850 {
13851 SetHealthMax(zone_names.Get(i),"Health");
13852 }
13853 SetHealthMax("","Health");
13854 }
13855
13857 void SetZoneDamageCEInit()
13858 {
13859 float global_health = GetHealth01("","Health");
13860 array<string> zones = new array<string>;
13861 GetDamageZones(zones);
13862 //set damage of all zones to match global health level
13863 for (int i = 0; i < zones.Count(); i++)
13864 {
13865 SetHealth01(zones.Get(i),"Health",global_health);
13866 }
13867 }
13868
13870 bool IsCoverFaceForShave(string slot_name)
13871 {
13872 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13873 }
13874
13875 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
13876 {
13877 if (!hasRootAsPlayer)
13878 {
13879 if (refParentIB)
13880 {
13881 // parent is wet
13882 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
13883 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13884 // parent has liquid inside
13885 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
13886 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13887 // drying
13888 else if (m_VarWet > m_VarWetMin)
13889 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
13890 }
13891 else
13892 {
13893 // drying on ground or inside non-itembase (car, ...)
13894 if (m_VarWet > m_VarWetMin)
13895 AddWet(-1 * delta * GetDryingIncrement("ground"));
13896 }
13897 }
13898 }
13899
13900 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
13901 {
13903 {
13904 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
13905 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
13906 {
13907 float heatPermCoef = 1.0;
13908 EntityAI ent = this;
13909 while (ent)
13910 {
13911 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13912 ent = ent.GetHierarchyParent();
13913 }
13914
13915 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13916 }
13917 }
13918 }
13919
13920 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
13921 {
13922 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
13923 EntityAI parent = GetHierarchyParent();
13924 if (!parent)
13925 {
13926 hasParent = false;
13927 hasRootAsPlayer = false;
13928 }
13929 else
13930 {
13931 hasParent = true;
13932 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13933 refParentIB = ItemBase.Cast(parent);
13934 }
13935 }
13936
13937 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
13938 {
13939 // this is stub, implemented on Edible_Base
13940 }
13941
13942 bool CanDecay()
13943 {
13944 // return true used on selected food clases so they can decay
13945 return false;
13946 }
13947
13948 protected bool CanProcessDecay()
13949 {
13950 // this is stub, implemented on Edible_Base class
13951 // used to determine whether it is still necessary for the food to decay
13952 return false;
13953 }
13954
13955 protected bool CanHaveWetness()
13956 {
13957 // return true used on selected items that have a wetness effect
13958 return false;
13959 }
13960
13962 bool CanBeConsumed(ConsumeConditionData data = null)
13963 {
13964 return !GetIsFrozen() && IsOpen();
13965 }
13966
13967 override void ProcessVariables()
13968 {
13969 bool hasParent = false, hasRootAsPlayer = false;
13970 ItemBase refParentIB;
13971
13972 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
13973 bool foodDecay = g_Game.IsFoodDecayEnabled();
13974
13975 if (wwtu || foodDecay)
13976 {
13977 bool processWetness = wwtu && CanHaveWetness();
13978 bool processTemperature = wwtu && CanHaveTemperature();
13979 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
13980
13981 if (processWetness || processTemperature || processDecay)
13982 {
13983 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
13984
13985 if (processWetness)
13986 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13987
13988 if (processTemperature)
13989 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13990
13991 if (processDecay)
13992 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13993 }
13994 }
13995 }
13996
13999 {
14000 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
14001 }
14002
14003 override float GetTemperatureFreezeThreshold()
14004 {
14006 return Liquid.GetFreezeThreshold(GetLiquidType());
14007
14008 return super.GetTemperatureFreezeThreshold();
14009 }
14010
14011 override float GetTemperatureThawThreshold()
14012 {
14014 return Liquid.GetThawThreshold(GetLiquidType());
14015
14016 return super.GetTemperatureThawThreshold();
14017 }
14018
14019 override float GetItemOverheatThreshold()
14020 {
14022 return Liquid.GetBoilThreshold(GetLiquidType());
14023
14024 return super.GetItemOverheatThreshold();
14025 }
14026
14027 override float GetTemperatureFreezeTime()
14028 {
14029 if (HasQuantity())
14030 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
14031
14032 return super.GetTemperatureFreezeTime();
14033 }
14034
14035 override float GetTemperatureThawTime()
14036 {
14037 if (HasQuantity())
14038 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
14039
14040 return super.GetTemperatureThawTime();
14041 }
14042
14044 void AffectLiquidContainerOnFill(int liquid_type, float amount);
14046 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
14047
14048 bool IsCargoException4x3(EntityAI item)
14049 {
14050 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14051 }
14052
14054 {
14055 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14056 }
14057
14059 void AddLightSourceItem(ItemBase lightsource)
14060 {
14061 m_LightSourceItem = lightsource;
14062 }
14063
14065 {
14066 m_LightSourceItem = null;
14067 }
14068
14070 {
14071 return m_LightSourceItem;
14072 }
14073
14075 array<int> GetValidFinishers()
14076 {
14077 return null;
14078 }
14079
14081 bool GetActionWidgetOverride(out typename name)
14082 {
14083 return false;
14084 }
14085
14086 bool PairWithDevice(notnull ItemBase otherDevice)
14087 {
14088 if (GetGame().IsServer())
14089 {
14090 ItemBase explosive = otherDevice;
14092 if (!trg)
14093 {
14094 trg = RemoteDetonatorTrigger.Cast(otherDevice);
14095 explosive = this;
14096 }
14097
14098 explosive.PairRemote(trg);
14099 trg.SetControlledDevice(explosive);
14100
14101 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14102 trg.SetPersistentPairID(persistentID);
14103 explosive.SetPersistentPairID(persistentID);
14104
14105 return true;
14106 }
14107 return false;
14108 }
14109
14111 float GetBaitEffectivity()
14112 {
14113 float ret = 1.0;
14114 if (HasQuantity())
14115 ret *= GetQuantityNormalized();
14116 ret *= GetHealth01();
14117
14118 return ret;
14119 }
14120
14121 #ifdef DEVELOPER
14122 override void SetDebugItem()
14123 {
14124 super.SetDebugItem();
14125 _itemBase = this;
14126 }
14127
14128 override string GetDebugText()
14129 {
14130 string text = super.GetDebugText();
14131
14132 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
14133 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
14134
14135 return text;
14136 }
14137 #endif
14138
14139 bool CanBeUsedForSuicide()
14140 {
14141 return true;
14142 }
14143
14145 //DEPRECATED BELOW
14147 // Backwards compatibility
14148 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
14149 {
14150 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
14151 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
14152 }
14153
14154 // replaced by ItemSoundHandler
14155 protected EffectSound m_SoundDeployFinish;
14156 protected EffectSound m_SoundPlace;
14157 protected EffectSound m_DeployLoopSoundEx;
14158 protected EffectSound m_SoundDeploy;
14159 bool m_IsPlaceSound;
14160 bool m_IsDeploySound;
14162
14163 string GetDeployFinishSoundset();
14164 void PlayDeploySound();
14165 void PlayDeployFinishSound();
14166 void PlayPlaceSound();
14167 void PlayDeployLoopSoundEx();
14168 void StopDeployLoopSoundEx();
14169 void SoundSynchRemoteReset();
14170 void SoundSynchRemote();
14171 bool UsesGlobalDeploy(){return false;}
14172 bool CanPlayDeployLoopSound(){return false;}
14174 bool IsPlaceSound(){return m_IsPlaceSound;}
14175 bool IsDeploySound(){return m_IsDeploySound;}
14176 void SetIsPlaceSound(bool is_place_sound);
14177 void SetIsDeploySound(bool is_deploy_sound);
14178}
14179
14180EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
14181{
14182 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
14183 if (entity)
14184 {
14185 bool is_item = entity.IsInherited(ItemBase);
14186 if (is_item && full_quantity)
14187 {
14188 ItemBase item = ItemBase.Cast(entity);
14189 item.SetQuantity(item.GetQuantityInit());
14190 }
14191 }
14192 else
14193 {
14194 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
14195 return NULL;
14196 }
14197 return entity;
14198}
14199
14200void SetupSpawnedItem(ItemBase item, float health, float quantity)
14201{
14202 if (item)
14203 {
14204 if (health > 0)
14205 item.SetHealth("", "", health);
14206
14207 if (item.CanHaveTemperature())
14208 {
14209 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
14210 if (item.CanFreeze())
14211 item.SetFrozen(false);
14212 }
14213
14214 if (item.HasEnergyManager())
14215 {
14216 if (quantity >= 0)
14217 {
14218 item.GetCompEM().SetEnergy0To1(quantity);
14219 }
14220 else
14221 {
14222 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
14223 }
14224 }
14225 else if (item.IsMagazine())
14226 {
14227 Magazine mag = Magazine.Cast(item);
14228 if (quantity >= 0)
14229 {
14230 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14231 }
14232 else
14233 {
14234 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
14235 }
14236
14237 }
14238 else
14239 {
14240 if (quantity >= 0)
14241 {
14242 item.SetQuantityNormalized(quantity, false);
14243 }
14244 else
14245 {
14246 item.SetQuantity(Math.AbsFloat(quantity));
14247 }
14248
14249 }
14250 }
14251}
14252
14253#ifdef DEVELOPER
14254ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
14255#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Определения EntityAI.c:97
Param3 TSelectableActionInfo
EWetnessLevel
Определения EntityAI.c:2
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Определения Inventory.c:22
const int INPUT_UDT_ITEM_MANIPULATION
Определения _constants.c:8
class LogManager EntityAI
eBleedingSourceType GetType()
Определения BleedingSource.c:63
ItemSuppressor SuppressorBase
Определения InventoryItem.c:7
void ActionDropItem()
Определения ActionDropItem.c:14
void ActionManagerBase(PlayerBase player)
Определения ActionManagerBase.c:63
map< typename, ref array< ActionBase_Basic > > TInputActionMap
Определения ActionManagerClient.c:1
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
void RemoveAction(typename actionName)
Определения AdvancedCommunication.c:252
TInputActionMap m_InputActionMap
Определения AdvancedCommunication.c:137
bool m_ActionsInitialize
Определения AdvancedCommunication.c:138
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
Определения AdvancedCommunication.c:202
void InitializeActions()
Определения AdvancedCommunication.c:190
const int ECE_PLACE_ON_SURFACE
Определения CentralEconomy.c:37
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
Определения CentralEconomy.c:36
const int RF_DEFAULT
Определения CentralEconomy.c:65
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
map
Определения ControlsXboxNew.c:4
CookingMethodType
Определения Cooking.c:2
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
DayZGame g_Game
Определения DayZGame.c:3868
DayZGame GetDayZGame()
Определения DayZGame.c:3870
EActions
Определения EActions.c:2
ERPCs
Определения ERPCs.c:2
PluginAdminLog m_AdminLog
Определения EmoteManager.c:142
const int MAX
Определения EnConvert.c:27
override bool IsExplosive()
Определения ExplosivesBase.c:59
override bool CanHaveTemperature()
Определения FireplaceBase.c:557
class GP5GasMask extends MaskBase ItemBase
Empty
Определения Hand_States.c:14
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
Определения ItemBase.c:6308
static bool HasDebugActionsMask(int mask)
Определения ItemBase.c:5548
bool HidesSelectionBySlot()
Определения ItemBase.c:9203
float m_VarWetMin
Определения ItemBase.c:4809
void SplitItem(PlayerBase player)
Определения ItemBase.c:6739
void CopyScriptPropertiesFrom(EntityAI oldItem)
Определения ItemBase.c:9424
override void InsertAgent(int agent, float count=1)
Определения ItemBase.c:8653
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
Определения ItemBase.c:8087
static void SetDebugActionsMask(int mask)
Определения ItemBase.c:5553
void SetIsDeploySound(bool is_deploy_sound)
bool IsOpen()
Определения ItemBase.c:8796
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6706
override bool IsHeavyBehaviour()
Определения ItemBase.c:8998
override void SetWetMax()
Определения ItemBase.c:8369
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
Определения ItemBase.c:9241
void ClearStartItemSoundServer()
Определения ItemBase.c:9139
float m_VarWet
Определения ItemBase.c:4806
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9271
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
Определения ItemBase.c:2
override void RemoveAllAgentsExcept(int agent_to_keep)
Определения ItemBase.c:8648
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
Определения ItemBase.c:4869
bool CanBeMovedOverride()
Определения ItemBase.c:7380
override void SetWet(float value, bool allow_client=false)
Определения ItemBase.c:8345
ref TIntArray m_SingleUseActions
Определения ItemBase.c:4855
override void ProcessVariables()
Определения ItemBase.c:9338
ref TStringArray m_HeadHidingSelections
Определения ItemBase.c:4883
float GetWeightSpecialized(bool forceRecalc=false)
Определения ItemBase.c:8179
bool LoadAgents(ParamsReadContext ctx, int version)
Определения ItemBase.c:8714
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
Определения ItemBase.c:8559
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
Определения ItemBase.c:5139
ref array< ref OverheatingParticle > m_OverheatingParticles
Определения ItemBase.c:4881
override float GetTemperatureFreezeThreshold()
Определения ItemBase.c:9374
bool m_IsSoundSynchRemote
Определения ItemBase.c:9532
float m_OverheatingShots
Определения ItemBase.c:4876
void StopItemSoundServer(int id)
Определения ItemBase.c:9127
static void ToggleDebugActionsMask(int mask)
Определения ItemBase.c:5568
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:5292
override float GetTemperatureFreezeTime()
Определения ItemBase.c:9398
ref array< int > m_CompatibleLocks
Определения ItemBase.c:4893
bool CanBeCooked()
Определения ItemBase.c:7336
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:5635
float m_TemperaturePerQuantityWeight
Определения ItemBase.c:4905
bool m_RecipesInitialized
Определения ItemBase.c:4791
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
Определения ItemBase.c:6382
override float GetTemperatureThawThreshold()
Определения ItemBase.c:9382
override void OnEnergyConsumed()
Определения ItemBase.c:8289
void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
Определения ItemBase.c:8078
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
Определения Bottle_Base.c:158
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
Определения ItemBase.c:8218
override EWetnessLevel GetWetLevel()
Определения ItemBase.c:8409
float GetSingleInventoryItemWeight()
Определения ItemBase.c:8174
ref TIntArray m_InteractActions
Определения ItemBase.c:4857
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
Определения ItemBase.c:7400
float m_VarQuantity
Определения ItemBase.c:4797
bool CanPlayDeployLoopSound()
Определения ItemBase.c:9543
override float GetWetMax()
Определения ItemBase.c:8379
bool CanBeUsedForSuicide()
Определения ItemBase.c:9510
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:7011
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
Определения ItemBase.c:5773
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
Определения ItemBase.c:7554
void StartItemSoundServer(int id)
Определения ItemBase.c:9114
void DoAmmoExplosion()
Определения ItemBase.c:6243
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
Определения ItemBase.c:4868
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6557
int GetItemSize()
Определения ItemBase.c:7365
bool m_CanBeMovedOverride
Определения ItemBase.c:4834
override string ChangeIntoOnAttach(string slot)
Определения ItemBase.c:6167
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5360
bool CanDecay()
Определения ItemBase.c:9313
ScriptedLightBase GetLight()
string GetPlaceSoundset()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
Определения ItemBase.c:8060
void SetQuantityMax()
Определения ItemBase.c:8065
override float GetQuantity()
Определения ItemBase.c:8154
int m_ColorComponentR
Определения ItemBase.c:4846
int m_ShotsToStartOverheating
Определения ItemBase.c:4878
override void OnWetChanged(float newVal, float oldVal)
Определения ItemBase.c:8394
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5367
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8897
void OnOverheatingDecay()
Определения ItemBase.c:5330
float GetDryingIncrement(string pIncrementName)
Определения ItemBase.c:8327
void SoundSynchRemoteReset()
int m_Cleanness
Определения ItemBase.c:4812
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
Определения ItemBase.c:5468
bool UsesGlobalDeploy()
Определения ItemBase.c:9542
int m_ItemBehaviour
Определения ItemBase.c:4827
override bool CanReleaseAttachment(EntityAI attachment)
Определения ItemBase.c:8869
float m_HeatIsolation
Определения ItemBase.c:4822
float m_VarWetInit
Определения ItemBase.c:4808
override void OnMovedInsideCargo(EntityAI container)
Определения ItemBase.c:5813
void SetCEBasedQuantity()
Определения ItemBase.c:5581
bool m_CanPlayImpactSound
Определения ItemBase.c:4818
override string GetAttachmentSoundType()
Определения ItemBase.c:9072
float GetOverheatingCoef()
Определения ItemBase.c:5387
array< string > GetHeadHidingSelection()
Определения ItemBase.c:9198
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
Определения ItemBase.c:9150
override bool IsStoreLoad()
Определения ItemBase.c:8421
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:6987
bool IsLightSource()
Определения ItemBase.c:5709
bool m_HasQuantityBar
Определения ItemBase.c:4840
void SetResultOfSplit(bool value)
Определения ItemBase.c:6982
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6624
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6797
void UpdateAllOverheatingParticles()
Определения ItemBase.c:5395
float GetSoakingIncrement(string pIncrementName)
Определения ItemBase.c:8336
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8977
override float GetStoreLoadedQuantity()
Определения ItemBase.c:8431
int m_LockType
Определения ItemBase.c:4894
const int ITEM_SOUNDS_MAX
Определения ItemBase.c:4899
bool m_CanBeDigged
Определения ItemBase.c:4841
float m_ItemAttachOffset
Определения ItemBase.c:4824
float GetItemModelLength()
Определения ItemBase.c:8438
bool m_ThrowItemOnDrop
Определения ItemBase.c:4832
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
Определения ItemBase.c:7699
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
Определения ItemBase.c:8729
void Close()
float GetHeatIsolation()
Определения ItemBase.c:8322
void CombineItems(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7016
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
Определения ItemBase.c:9369
bool CanHaveWetness()
Определения ItemBase.c:9326
int m_CleannessMin
Определения ItemBase.c:4814
void TransferAgents(int agents)
transfer agents from another item
Определения ItemBase.c:8662
string IDToName(int id)
Определения ItemBase.c:7547
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
Определения ItemBase.c:9333
float GetHeatIsolationInit()
Определения ItemBase.c:8317
void PlayPlaceSound()
void SetCanBeMovedOverride(bool setting)
Определения ItemBase.c:7387
override bool HasQuantity()
Определения ItemBase.c:8149
float m_VarWetPrev
Определения ItemBase.c:4807
int m_SoundSyncStop
Определения ItemBase.c:4901
bool IsCargoException4x3(EntityAI item)
Определения ItemBase.c:9419
ref TIntArray m_ContinuousActions
Определения ItemBase.c:4856
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
Определения ItemBase.c:5477
void LoadParticleConfigOnFire(int id)
Определения ItemBase.c:5162
int m_VarLiquidType
Определения ItemBase.c:4826
int m_QuickBarBonus
Определения ItemBase.c:4828
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
Определения ItemBase.c:9060
override float GetWetInit()
Определения ItemBase.c:8389
int m_ImpactSoundSurfaceHash
Определения ItemBase.c:4820
int m_SoundSyncPlay
Определения ItemBase.c:4900
int m_MaxOverheatingValue
Определения ItemBase.c:4879
void SetupSpawnedItem(ItemBase item, float health, float quantity)
Определения ItemBase.c:4803
bool m_IsTakeable
Определения ItemBase.c:4831
static ref map< string, int > m_WeaponTypeToID
Определения ItemBase.c:4871
string GetLockSoundSet()
Определения ItemBase.c:8487
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
Определения ItemBase.c:8518
array< int > GetValidFinishers()
returns an array of possible finishers
Определения ItemBase.c:9446
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6803
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
Определения ItemBase.c:4783
ItemSoundHandler GetItemSoundHandler()
Определения ItemBase.c:9085
override int GetQuantityMin()
Определения ItemBase.c:8138
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
Определения ItemBase.c:6533
override int GetQuickBarBonus()
Определения ItemBase.c:5047
override void SetTakeable(bool pState)
Определения ItemBase.c:9042
float m_OverheatingDecayInterval
Определения ItemBase.c:4880
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6356
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
Определения ItemBase.c:9291
bool CanProcessDecay()
Определения ItemBase.c:9319
void RemoveAudioVisualsOnClient()
Определения Bottle_Base.c:151
void SoundSynchRemote()
static void AddDebugActionsMask(int mask)
Определения ItemBase.c:5558
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
Определения ItemBase.c:9435
bool CanRepair(ItemBase item_repair_kit)
Определения ItemBase.c:7351
bool can_this_be_combined
Определения ItemBase.c:4836
EffectSound m_SoundDeploy
Определения ItemBase.c:9529
int m_Count
Определения ItemBase.c:4802
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
Определения ItemBase.c:9482
float GetDeployTime()
how long it takes to deploy this item in seconds
Определения ItemBase.c:9034
override bool IsSplitable()
Определения ItemBase.c:6343
bool DamageItemAttachments(float damage)
Определения ItemBase.c:6327
override void WriteVarsToCTX(ParamsWriteContext ctx)
Определения ItemBase.c:7663
void ConvertEnergyToQuantity()
Определения ItemBase.c:8304
override void RemoveAllAgents()
Определения ItemBase.c:8643
override void SetQuantityToMinimum()
Определения ItemBase.c:8071
bool m_WantPlayImpactSound
Определения ItemBase.c:4817
override float GetTemperatureThawTime()
Определения ItemBase.c:9406
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
Определения ItemBase.c:4870
int m_ColorComponentG
Определения ItemBase.c:4847
float m_StoreLoadedQuantity
Определения ItemBase.c:4804
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
Определения ItemBase.c:7418
int m_ColorComponentA
Определения ItemBase.c:4849
int m_VarQuantityInit
Определения ItemBase.c:4799
float GetFilterDamageRatio()
Определения ItemBase.c:5462
override void SetLiquidType(int value, bool allow_client=false)
Определения ItemBase.c:8531
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
Определения ItemBase.c:6773
void OnApply(PlayerBase player)
bool m_HideSelectionsBySlot
Определения ItemBase.c:4884
bool IsOverheatingEffectActive()
Определения ItemBase.c:5325
void SetIsBeingPlaced(bool is_being_placed)
Определения ItemBase.c:5742
int GetLiquidContainerMask()
Определения ItemBase.c:5679
ref Timer m_CheckOverheating
Определения ItemBase.c:4877
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
Определения ItemBase.c:5373
float GetEnergy()
Определения ItemBase.c:8278
bool CanBeDigged()
Определения ItemBase.c:5758
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
Определения ItemBase.c:9452
bool IsNVG()
Определения ItemBase.c:5690
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
Определения ItemBase.c:8238
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
Определения ItemBase.c:9228
bool m_IsDeploySound
Определения ItemBase.c:9531
bool CanEat()
Определения ItemBase.c:7311
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8937
override bool IsOneHandedBehaviour()
Определения ItemBase.c:9008
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
Определения ItemBase.c:9430
bool IsLiquidContainer()
Определения ItemBase.c:5674
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
Определения ItemBase.c:7331
override float GetSingleInventoryItemWeightEx()
Определения ItemBase.c:8165
void SaveAgents(ParamsWriteContext ctx)
Определения ItemBase.c:8721
override int GetTargetQuantityMax(int attSlotID=-1)
Определения ItemBase.c:8119
int m_CleannessInit
Определения ItemBase.c:4813
float GetDisinfectQuantity(int system=0, Param param1=null)
Определения ItemBase.c:5457
override int GetAgents()
Определения ItemBase.c:8668
int m_VarQuantityMax
Определения ItemBase.c:4801
override bool IsHologram()
Определения ItemBase.c:5753
float GetItemAttachOffset()
Определения ItemBase.c:8447
bool IsPlaceSound()
Определения ItemBase.c:9545
static int GetDebugActionsMask()
Определения ItemBase.c:5543
override int GetLiquidType()
Определения ItemBase.c:8547
void ProcessDecay(float delta, bool hasRootAsPlayer)
Определения ItemBase.c:9308
override bool IsItemBase()
Определения ItemBase.c:7464
void PlayDeploySound()
override bool IsTwoHandedBehaviour()
Определения ItemBase.c:9018
void ExplodeAmmo()
Определения ItemBase.c:6230
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
Определения ItemBase.c:6972
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
Определения ItemBase.c:8742
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8917
override void OnEnergyAdded()
Определения ItemBase.c:8296
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
Определения ItemBase.c:5702
EffectSound m_DeployLoopSoundEx
Определения ItemBase.c:9528
override void DeSerializeNumericalVars(array< float > floats)
Определения ItemBase.c:7604
void StopItemDynamicPhysics()
Определения ItemBase.c:9210
bool HasFoodStage()
Определения ItemBase.c:7324
override void SetStoreLoad(bool value)
Определения ItemBase.c:8416
float GetOverheatingValue()
Определения ItemBase.c:5287
bool ContainsAgent(int agent_id)
Определения ItemBase.c:8621
override void AddWet(float value)
Определения ItemBase.c:8364
bool IsLiquidPresent()
Определения ItemBase.c:5669
bool IsFullQuantity()
Определения ItemBase.c:8159
override void EOnContact(IEntity other, Contact extra)
Определения ItemBase.c:5943
void SplitIntoStackMaxHands(PlayerBase player)
Определения ItemBase.c:6678
void SplitIntoStackMaxHandsClient(PlayerBase player)
Определения ItemBase.c:6651
int m_CleannessMax
Определения ItemBase.c:4815
float m_VarStackMax
Определения ItemBase.c:4803
ref Timer m_PhysDropTimer
Определения ItemBase.c:4890
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
Определения ItemBase.c:7436
override void SetStoreLoadedQuantity(float value)
Определения ItemBase.c:8426
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
Определения ItemBase.c:4844
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5308
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
Определения ItemBase.c:5623
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
Определения ItemBase.c:7358
void OnLiquidTypeChanged(int oldType, int newType)
Определения ItemBase.c:8552
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5354
void PlayDeployFinishSound()
bool AllowFoodConsumption()
Определения ItemBase.c:8474
bool m_IsOverheatingEffectActive
Определения ItemBase.c:4875
int m_LiquidContainerMask
Определения ItemBase.c:4825
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9246
override int GetCleanness()
Определения ItemBase.c:8469
bool PairWithDevice(notnull ItemBase otherDevice)
Определения ItemBase.c:9457
bool IsDeploySound()
Определения ItemBase.c:9546
static void RemoveDebugActionsMask(int mask)
Определения ItemBase.c:5563
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8957
int m_VarQuantityMin
Определения ItemBase.c:4800
void PerformDamageSystemReinit()
Определения ItemBase.c:9216
override void ClearInventory()
Определения ItemBase.c:8257
static int m_LastRegisteredWeaponID
Определения ItemBase.c:4872
ItemBase GetLightSourceItem()
Определения ItemBase.c:9440
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
Определения ItemBase.c:7454
override float GetItemOverheatThreshold()
Определения ItemBase.c:9390
void StopDeployLoopSoundEx()
bool m_CanThisBeSplit
Определения ItemBase.c:4837
override void SerializeNumericalVars(array< float > floats_out)
Определения ItemBase.c:7568
void Open()
Implementations only.
Определения CannedFood.c:100
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
Определения ItemBase.c:6590
float m_ItemModelLength
Определения ItemBase.c:4823
bool m_IsHologram
Определения ItemBase.c:4830
static int m_DebugActionsMask
Определения ItemBase.c:4790
void KillAllOverheatingParticles()
Определения ItemBase.c:5423
bool CanBeCookedOnStick()
Определения ItemBase.c:7341
override int GetQuantityMax()
Определения ItemBase.c:8106
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
Определения ItemBase.c:7050
void OnActivatedByTripWire()
bool IsColorSet()
Определения ItemBase.c:8512
override void RemoveAgent(int agent_id)
Определения ItemBase.c:8634
bool m_ItemBeingDroppedPhys
Определения ItemBase.c:4833
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:8824
void PlayDetachSound(string slot_type)
Определения ItemBase.c:9186
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
Определения ItemBase.c:4784
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9519
override bool IsBeingPlaced()
Определения ItemBase.c:5737
int GetQuantityInit()
Определения ItemBase.c:8143
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:6992
bool IsResultOfSplit()
Определения ItemBase.c:6977
bool m_FixDamageSystemInit
Определения ItemBase.c:4835
float m_ImpactSpeed
Определения ItemBase.c:4819
bool m_IsStoreLoad
Определения ItemBase.c:4838
int GetLiquidTypeInit()
Определения ItemBase.c:8542
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
Определения ItemBase.c:4853
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
Определения ItemBase.c:5610
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6462
int m_AttachedAgents
Определения ItemBase.c:4861
string m_LockSoundSet
Определения ItemBase.c:4896
void LoadParticleConfigOnOverheating(int id)
Определения ItemBase.c:5231
float m_VarQuantityPrev
Определения ItemBase.c:4798
bool IsSoundSynchRemote()
Определения ItemBase.c:9544
bool m_CanShowQuantity
Определения ItemBase.c:4839
override void EEOnCECreate()
Called when entity is being created as new by CE/ Debug.
Определения ItemBase.c:8781
override void OnRightClick()
Определения ItemBase.c:6846
int m_ColorComponentB
Определения ItemBase.c:4848
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
Определения ItemBase.c:4786
bool IsActionTargetVisible()
Определения ItemBase.c:9054
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения ItemBase.c:5978
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Определения ItemBase.c:6267
bool m_IsBeingPlaced
Определения ItemBase.c:4829
int NameToID(string name)
Определения ItemBase.c:7541
void ~ItemBase()
Определения ItemBase.c:5508
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
Определения ItemBase.c:8404
void ClearStopItemSoundServer()
Определения ItemBase.c:9144
override string ChangeIntoOnDetach()
Определения ItemBase.c:6191
float m_VarWetMax
Определения ItemBase.c:4810
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6585
int GetLockType()
Определения ItemBase.c:8482
EffectSound m_SoundDeployFinish
Определения ItemBase.c:9526
override float GetWet()
Определения ItemBase.c:8374
EffectSound m_SoundPlace
Определения ItemBase.c:9527
float GetQuantityNormalizedScripted()
Определения ItemBase.c:8092
override void SetCleanness(int value, bool allow_client=false)
Определения ItemBase.c:8456
bool m_IsPlaceSound
Определения ItemBase.c:9530
override float GetWetMin()
Определения ItemBase.c:8384
ref ItemSoundHandler m_ItemSoundHandler
Определения ItemBase.c:4902
override bool KindOf(string tag)
Определения ItemBase.c:7470
void ItemSoundHandler(ItemBase parent)
Определения ItemSoundHandler.c:31
string Type
Определения JsonDataContaminatedArea.c:11
EffectSound m_LockingSound
Определения Land_Underground_Entrance.c:321
string GetDebugText()
Определения ModifierBase.c:71
PlayerBase GetPlayer()
Определения ModifierBase.c:51
@ LOWEST
Определения PPEConstants.c:54
void PluginItemDiagnostic()
Определения PluginItemDiagnostic.c:74
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:316
EntityAI GetItem()
Определения RadialQuickbarMenu.c:37
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
Определения RemoteDetonator.c:272
void RemoteDetonatorTrigger()
Определения RemoteDetonator.c:233
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
Определения RemoteDetonator.c:305
int particle_id
Определения SmokeSimulation.c:28
ETemperatureAccessTypes
Определения TemperatureAccessConstants.c:2
override void Explode(int damageType, string ammoType="")
Определения Trap_LandMine.c:220
bool m_Initialized
Определения UiHintPanel.c:317
void Debug()
Определения UniversalTemperatureSource.c:349
int GetID()
Определения ActionBase.c:1321
void OnItemLocationChanged(ItemBase item)
Определения ActionBase.c:962
GetInputType()
Определения ActionBase.c:215
int m_StanceMask
Определения ActionBase.c:25
int m_CommandUIDProne
Определения ActionBase.c:24
int m_CommandUID
Определения ActionBase.c:23
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
Определения AnalyticsManagerClient.c:77
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
Определения DayZGame.c:1187
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
Определения Game.c:1513
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
float GetEnergyAtSpawn()
Определения ComponentEnergyManager.c:1280
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
Определения ComponentEnergyManager.c:541
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
Определения ComponentEnergyManager.c:1275
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
Определения EffectSound.c:603
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
Определения EffectSound.c:274
override bool IsMan()
Определения Man.c:44
Определения Building.c:6
Определения constants.c:659
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
Определения ItemBase.c:15
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
bool WriteToContext(ParamsWriteContext ctx)
Определения InventoryLocation.c:469
proto native int GetType()
returns type of InventoryLocation
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native bool GetFlip()
returns flip status of cargo
proto native EntityAI GetItem()
returns item of current inventory location
InventoryLocation.
Определения InventoryLocation.c:29
override bool CanDisplayCargo()
Определения UndergroundStash.c:24
override void OnInventoryEnter(Man player)
Определения BarbedWire.c:203
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:6
override bool CanReceiveItemIntoCargo(EntityAI item)
Определения TentBase.c:913
override bool OnStoreLoad(ParamsReadContext ctx, int version)
Определения GardenBase.c:149
override void OnWasDetached(EntityAI parent, int slot_id)
Определения InventoryItem.c:920
override void EEOnAfterLoad()
Определения GardenBase.c:187
override void EEDelete(EntityAI parent)
Определения BaseBuildingBase.c:68
override bool CanBeRepairedByCrafting()
Определения TentBase.c:86
override void OnPlacementStarted(Man player)
Определения BatteryCharger.c:376
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
Определения BarbedWire.c:357
override bool IsElectricAppliance()
Определения BatteryCharger.c:43
override bool IsItemTent()
Определения TentBase.c:81
override void SetActions()
Определения InventoryItem.c:732
override bool CanMakeGardenplot()
Определения FieldShovel.c:3
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Определения PowerGenerator.c:412
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения HandcuffsLocked.c:12
override WrittenNoteData GetWrittenNoteData()
Определения Paper.c:30
override int GetDamageSystemVersionChange()
Определения BaseBuildingBase.c:1218
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Определения PileOfWoodenPlanks.c:88
override void InitItemVariables()
Определения Matchbox.c:3
override void SetActionAnimOverrides()
Определения PickAxe.c:28
override void OnCreatePhysics()
Определения BaseBuildingBase.c:465
override string GetDeploySoundset()
Определения BarbedWire.c:392
override float GetBandagingEffectivity()
Определения BandageDressing.c:49
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Определения PowerGenerator.c:424
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
Определения BaseBuildingBase.c:472
override void OnStoreSave(ParamsWriteContext ctx)
Определения GardenBase.c:206
override void AfterStoreLoad()
Определения GardenBase.c:182
override int GetOnDigWormsAmount()
Определения FieldShovel.c:27
override bool IsSelfAdjustingTemperature()
Определения PortableGasStove.c:287
override bool IsPlayerInside(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1017
override void OnVariablesSynchronized()
Определения GardenBase.c:68
override void RefreshPhysics()
Определения BatteryCharger.c:359
override bool CanObstruct()
Определения BaseBuildingBase.c:84
override void OnWasAttached(EntityAI parent, int slot_id)
Определения InventoryItem.c:912
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
Определения BaseBuildingBase.c:962
override bool CanPutInCargo(EntityAI parent)
Определения GardenBase.c:269
override string GetLoopDeploySoundset()
Определения BarbedWire.c:397
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
Определения BarbedWire.c:372
override void OnInventoryExit(Man player)
Определения BatteryCharger.c:341
override bool IsTakeable()
Определения BaseBuildingBase.c:988
override bool IsIgnoredByConstruction()
Определения BaseBuildingBase.c:1150
override void InitItemSounds()
Определения TentBase.c:810
override void EEKilled(Object killer)
Определения HandcuffsLocked.c:70
override void OnCombine(ItemBase other_item)
Определения BandageDressing.c:71
override bool CanExplodeInFire()
Определения LargeGasCannister.c:3
override bool IsFacingPlayer(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1012
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
Определения Rag.c:61
override bool IsBloodContainer()
Определения BloodContainerBase.c:10
override bool IsClothing()
Определения InventoryItem.c:840
override bool CanBeSplit()
Определения Rag.c:34
override bool IsDeployable()
Определения BaseBuildingBase.c:341
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Определения ToolBase.c:24
override bool CanBeDisinfected()
Определения BandageDressing.c:54
override float GetInfectionChance(int system=0, Param param=null)
Определения BandageDressing.c:59
override void OnEndPlacement()
Определения KitBase.c:65
Определения InventoryItem.c:731
Определения EnMath.c:7
float GetOverheatingLimitMax()
Определения WeaponParticles.c:417
void SetOverheatingLimitMax(float max)
Определения WeaponParticles.c:407
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
Определения WeaponParticles.c:422
float GetOverheatingLimitMin()
Определения WeaponParticles.c:412
Particle GetParticle()
Определения WeaponParticles.c:397
void SetOverheatingLimitMin(float min)
Определения WeaponParticles.c:402
void RegisterParticle(Particle p)
Определения WeaponParticles.c:392
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
Определения Particle.c:266
void SetControlledDevice(EntityAI pDevice)
Определения RemoteDetonator.c:140
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
proto void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, 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)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto native void Send()
proto bool Write(void value_out)
proto bool Read(void value_in)
bool m_Loop
Определения ItemSoundHandler.c:5
override void Stop()
Определения DayZPlayerImplement.c:64
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
Определения UIManager.c:160
override void Refresh()
Определения ChatInputMenu.c:70
void SetCalcDetails(string details)
Определения Debug.c:816
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Определения WrittenNoteData.c:13
const float LOWEST
Определения EnConvert.c:100
Serializer ParamsReadContext
Определения gameplay.c:15
class LOD Object
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Определения gameplay.c:6
proto native CGame GetGame()
Serializer ParamsWriteContext
Определения gameplay.c:16
const int DEF_BIOLOGICAL
Определения constants.c:510
const int DEF_CHEMICAL
Определения constants.c:511
const int COMP_TYPE_ENERGY_MANAGER
Определения Component.c:9
ErrorExSeverity
Определения EnDebug.c:62
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90
enum ShapeType ErrorEx
proto native void SetColor(int color)
array< string > TStringArray
Определения EnScript.c:685
array< int > TIntArray
Определения EnScript.c:687
EntityEvent
Entity events for event-mask, or throwing event from code.
Определения EnEntity.c:45
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Определения constants.c:806
const int VARIABLE_LIQUIDTYPE
Определения constants.c:630
const int VARIABLE_CLEANNESS
Определения constants.c:633
const int VARIABLE_COLOR
Определения constants.c:632
const int VARIABLE_TEMPERATURE
Определения constants.c:628
const int VARIABLE_QUANTITY
Определения constants.c:626
const int VARIABLE_WET
Определения constants.c:629
const int LIQUID_NONE
Определения constants.c:527
static proto float AbsFloat(float f)
Returns absolute value.
const int MENU_INVENTORY
Определения constants.c:180
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_CRAFTING
Определения constants.c:451
const int SAT_DEBUG_ACTION
Определения constants.c:452
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9
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.
const int CALL_CATEGORY_GAMEPLAY
Определения tools.c:10
const int CALL_CATEGORY_SYSTEM
Определения tools.c:8
proto native int GetColor()

Используется в Entity::HandleFreezingProgression().