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

◆ CanHaveWetness()

bool SpawnItemOnLocation::CanHaveWetness ( )
protected

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

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

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