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

◆ GetTemperaturePerQuantityWeight()

float SpawnItemOnLocation::GetTemperaturePerQuantityWeight ( )
protected

Used in heat comfort calculations only!

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

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