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

◆ GetDamageSystemVersionChange()

override int GetDamageSystemVersionChange ( )
private

Re-sets DamageSystem changes.

Возвращает
storage version on which the config changes occured (default -1, to be overriden!)
Заметки
Significant changes to DamageSystem in item configs have to be re-set by increasing the storage version and overriding this method. Default return is -1 (does nothing).

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

5504{
5505 override bool CanPutAsAttachment(EntityAI parent)
5506 {
5507 return true;
5508 }
5509};
5510
5511//const bool QUANTITY_DEBUG_REMOVE_ME = false;
5512
5513class ItemBase extends InventoryItem
5514{
5518
5520
5521 static int m_DebugActionsMask;
5523 // ============================================
5524 // Variable Manipulation System
5525 // ============================================
5526 // Quantity
5527
5528 float m_VarQuantity;
5529 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
5531 int m_VarQuantityMin;
5532 int m_VarQuantityMax;
5533 int m_Count;
5534 float m_VarStackMax;
5535 float m_StoreLoadedQuantity = float.LOWEST;
5536 // Wet
5537 float m_VarWet;
5538 float m_VarWetPrev;//for client to know wetness changed during synchronization
5539 float m_VarWetInit;
5540 float m_VarWetMin;
5541 float m_VarWetMax;
5542 // Cleanness
5543 int m_Cleanness;
5544 int m_CleannessInit;
5545 int m_CleannessMin;
5546 int m_CleannessMax;
5547 // impact sounds
5549 bool m_CanPlayImpactSound = true;
5550 float m_ImpactSpeed;
5552 //
5553 float m_HeatIsolation;
5554 float m_ItemModelLength;
5555 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
5557 int m_VarLiquidType;
5558 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
5559 int m_QuickBarBonus;
5560 bool m_IsBeingPlaced;
5561 bool m_IsHologram;
5562 bool m_IsTakeable;
5563 bool m_ThrowItemOnDrop;
5566 bool m_FixDamageSystemInit = false; //can be changed on storage version check
5567 bool can_this_be_combined; //Check if item can be combined
5568 bool m_CanThisBeSplit; //Check if item can be split
5569 bool m_IsStoreLoad = false;
5570 bool m_CanShowQuantity;
5571 bool m_HasQuantityBar;
5572 protected bool m_CanBeDigged;
5573 protected bool m_IsResultOfSplit
5574
5575 string m_SoundAttType;
5576 // items color variables
5581 //-------------------------------------------------------
5582
5583 // light source managing
5585
5589
5590 //==============================================
5591 // agent system
5592 private int m_AttachedAgents;
5593
5595 void TransferModifiers(PlayerBase reciever);
5596
5597
5598 // Weapons & suppressors particle effects
5603 static int m_LastRegisteredWeaponID = 0;
5604
5605 // Overheating effects
5607 float m_OverheatingShots;
5608 ref Timer m_CheckOverheating;
5609 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
5610 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
5611 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
5612 ref array <ref OverheatingParticle> m_OverheatingParticles;
5613
5615 protected bool m_HideSelectionsBySlot;
5616
5617 // Admin Log
5618 PluginAdminLog m_AdminLog;
5619
5620 // misc
5621 ref Timer m_PhysDropTimer;
5622
5623 // Attachment Locking variables
5624 ref array<int> m_CompatibleLocks;
5625 protected int m_LockType;
5626 protected ref EffectSound m_LockingSound;
5627 protected string m_LockSoundSet;
5628
5629 // ItemSoundHandler
5630 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
5631 protected int m_SoundSyncPlay; // id for sound to play
5632 protected int m_SoundSyncStop; // id for sound to stop
5634
5635 //temperature
5636 private float m_TemperaturePerQuantityWeight;
5637
5638 // -------------------------------------------------------------------------
5639 void ItemBase()
5640 {
5641 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
5645
5646 if (!GetGame().IsDedicatedServer())
5647 {
5648 if (HasMuzzle())
5649 {
5651
5653 {
5655 }
5656 }
5657
5659 m_ActionsInitialize = false;
5660 }
5661
5662 m_OldLocation = null;
5663
5664 if (GetGame().IsServer())
5665 {
5666 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
5667 }
5668
5669 if (ConfigIsExisting("headSelectionsToHide"))
5670 {
5672 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
5673 }
5674
5675 m_HideSelectionsBySlot = false;
5676 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5677 {
5678 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
5679 }
5680
5681 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
5682
5683 m_IsResultOfSplit = false;
5684
5686 }
5687
5688 override void InitItemVariables()
5689 {
5690 super.InitItemVariables();
5691
5692 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
5693 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
5694 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
5695 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
5696 m_VarStackMax = ConfigGetFloat("varStackMax");
5697 m_Count = ConfigGetInt("count");
5698
5699 m_CanShowQuantity = ConfigGetBool("quantityShow");
5700 m_HasQuantityBar = ConfigGetBool("quantityBar");
5701
5702 m_CleannessInit = ConfigGetInt("varCleannessInit");
5704 m_CleannessMin = ConfigGetInt("varCleannessMin");
5705 m_CleannessMax = ConfigGetInt("varCleannessMax");
5706
5707 m_WantPlayImpactSound = false;
5708 m_ImpactSpeed = 0.0;
5709
5710 m_VarWetInit = ConfigGetFloat("varWetInit");
5712 m_VarWetMin = ConfigGetFloat("varWetMin");
5713 m_VarWetMax = ConfigGetFloat("varWetMax");
5714
5715 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
5716 if (IsLiquidContainer() && GetQuantity() != 0)
5718 m_IsBeingPlaced = false;
5719 m_IsHologram = false;
5720 m_IsTakeable = true;
5721 m_CanBeMovedOverride = false;
5725 m_CanBeDigged = ConfigGetBool("canBeDigged");
5726
5727 m_CompatibleLocks = new array<int>();
5728 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
5729 m_LockType = ConfigGetInt("lockType");
5730
5731 //Define if item can be split and set ability to be combined accordingly
5732 m_CanThisBeSplit = false;
5733 can_this_be_combined = false;
5734 if (ConfigIsExisting("canBeSplit"))
5735 {
5736 can_this_be_combined = ConfigGetBool("canBeSplit");
5738 }
5739
5740 m_ItemBehaviour = -1;
5741 if (ConfigIsExisting("itemBehaviour"))
5742 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
5743
5744 //RegisterNetSyncVariableInt("m_VariablesMask");
5745 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
5746 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
5747 RegisterNetSyncVariableInt("m_VarLiquidType");
5748 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5749
5750 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5751 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5752 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5753
5754 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5755 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5756 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5757 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5758
5759 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5760 RegisterNetSyncVariableBool("m_IsTakeable");
5761 RegisterNetSyncVariableBool("m_IsHologram");
5762
5763 InitItemSounds();
5765 {
5766 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
5767 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
5768 }
5769
5770 m_LockSoundSet = ConfigGetString("lockSoundSet");
5771
5773 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5774 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
5775
5776 }
5777
5778 override int GetQuickBarBonus()
5779 {
5780 return m_QuickBarBonus;
5781 }
5782
5783 void InitializeActions()
5784 {
5786 if (!m_InputActionMap)
5787 {
5789 m_InputActionMap = iam;
5790 SetActions();
5792 }
5793 }
5794
5795 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
5796 {
5798 {
5799 m_ActionsInitialize = true;
5801 }
5802
5803 actions = m_InputActionMap.Get(action_input_type);
5804 }
5805
5806 void SetActions()
5807 {
5808 AddAction(ActionTakeItem);
5809 AddAction(ActionTakeItemToHands);
5810 AddAction(ActionWorldCraft);
5812 AddAction(ActionAttachWithSwitch);
5813 }
5814
5815 void SetActionAnimOverrides(); // Override action animation for specific item
5816
5817 void AddAction(typename actionName)
5818 {
5819 ActionBase action = ActionManagerBase.GetAction(actionName);
5820
5821 if (!action)
5822 {
5823 Debug.LogError("Action " + actionName + " dosn't exist!");
5824 return;
5825 }
5826
5827 typename ai = action.GetInputType();
5828 if (!ai)
5829 {
5830 m_ActionsInitialize = false;
5831 return;
5832 }
5833
5834 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
5835 if (!action_array)
5836 {
5837 action_array = new array<ActionBase_Basic>;
5838 m_InputActionMap.Insert(ai, action_array);
5839 }
5840 if (LogManager.IsActionLogEnable())
5841 {
5842 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
5843 }
5844
5845 if (action_array.Find(action) != -1)
5846 {
5847 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
5848 }
5849 else
5850 {
5851 action_array.Insert(action);
5852 }
5853 }
5854
5855 void RemoveAction(typename actionName)
5856 {
5857 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
5858 ActionBase action = player.GetActionManager().GetAction(actionName);
5859 typename ai = action.GetInputType();
5860 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
5861
5862 if (action_array)
5863 {
5864 action_array.RemoveItem(action);
5865 }
5866 }
5867
5868 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
5869 // Set -1 for params which should stay in default state
5870 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
5871 {
5872 ActionOverrideData overrideData = new ActionOverrideData();
5873 overrideData.m_CommandUID = commandUID;
5874 overrideData.m_CommandUIDProne = commandUIDProne;
5875 overrideData.m_StanceMask = stanceMask;
5876
5877 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
5878 if (!actionMap) // create new map of action > overidables map
5879 {
5880 actionMap = new TActionAnimOverrideMap();
5881 m_ItemActionOverrides.Insert(action, actionMap);
5882 }
5883
5884 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
5885
5886 }
5887
5888 void OnItemInHandsPlayerSwimStart(PlayerBase player);
5889
5890 ScriptedLightBase GetLight();
5891
5892 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
5893 void LoadParticleConfigOnFire(int id)
5894 {
5895 if (!m_OnFireEffect)
5897
5900
5901 string config_to_search = "CfgVehicles";
5902 string muzzle_owner_config;
5903
5904 if (!m_OnFireEffect.Contains(id))
5905 {
5906 if (IsInherited(Weapon))
5907 config_to_search = "CfgWeapons";
5908
5909 muzzle_owner_config = config_to_search + " " + GetType() + " ";
5910
5911 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5912
5913 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
5914
5915 if (config_OnFire_subclass_count > 0)
5916 {
5917 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5918
5919 for (int i = 0; i < config_OnFire_subclass_count; i++)
5920 {
5921 string particle_class = "";
5922 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
5923 string config_OnFire_entry = config_OnFire_class + particle_class;
5924 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5925 WPOF_array.Insert(WPOF);
5926 }
5927
5928
5929 m_OnFireEffect.Insert(id, WPOF_array);
5930 }
5931 }
5932
5933 if (!m_OnBulletCasingEjectEffect.Contains(id))
5934 {
5935 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
5936 muzzle_owner_config = config_to_search + " " + GetType() + " ";
5937
5938 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5939
5940 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
5941
5942 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
5943 {
5944 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
5945
5946 for (i = 0; i < config_OnBulletCasingEject_count; i++)
5947 {
5948 string particle_class2 = "";
5949 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
5950 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
5951 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
5952 WPOBE_array.Insert(WPOBE);
5953 }
5954
5955
5956 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
5957 }
5958 }
5959 }
5960
5961 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
5963 {
5966
5967 if (!m_OnOverheatingEffect.Contains(id))
5968 {
5969 string config_to_search = "CfgVehicles";
5970
5971 if (IsInherited(Weapon))
5972 config_to_search = "CfgWeapons";
5973
5974 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
5975 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
5976
5977 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
5978 {
5979
5980 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
5981
5983 {
5984 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
5985 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
5986 Error(error);
5987 return;
5988 }
5989
5990 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
5991 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
5992
5993
5994
5995 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
5996 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
5997
5998 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
5999 {
6000 string particle_class = "";
6001 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6002 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6003 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
6004
6005 if (entry_type == CT_CLASS)
6006 {
6007 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6008 WPOOH_array.Insert(WPOF);
6009 }
6010 }
6011
6012
6013 m_OnOverheatingEffect.Insert(id, WPOOH_array);
6014 }
6015 }
6016 }
6017
6018 float GetOverheatingValue()
6019 {
6020 return m_OverheatingShots;
6021 }
6022
6023 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
6024 {
6025 if (m_MaxOverheatingValue > 0)
6026 {
6028
6029 if (!m_CheckOverheating)
6031
6033 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
6034
6035 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6036 }
6037 }
6038
6039 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6040 {
6042 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6043
6045 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6046
6048 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6049
6051 {
6053 }
6054 }
6055
6057 {
6059 }
6060
6061 void OnOverheatingDecay()
6062 {
6063 if (m_MaxOverheatingValue > 0)
6064 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
6065 else
6067
6068 if (m_OverheatingShots <= 0)
6069 {
6072 }
6073 else
6074 {
6075 if (!m_CheckOverheating)
6077
6079 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
6080 }
6081
6082 CheckOverheating(this, "", this);
6083 }
6084
6085 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6086 {
6088 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
6089 }
6090
6091 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6092 {
6094 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
6096 }
6097
6098 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6099 {
6101 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6102 }
6103
6104 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
6105 {
6107 m_OverheatingParticles = new array<ref OverheatingParticle>;
6108
6109 OverheatingParticle OP = new OverheatingParticle();
6110 OP.RegisterParticle(p);
6111 OP.SetOverheatingLimitMin(min_heat_coef);
6112 OP.SetOverheatingLimitMax(max_heat_coef);
6113 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
6114
6115 m_OverheatingParticles.Insert(OP);
6116 }
6117
6118 float GetOverheatingCoef()
6119 {
6120 if (m_MaxOverheatingValue > 0)
6122
6123 return -1;
6124 }
6125
6127 {
6129 {
6130 float overheat_coef = GetOverheatingCoef();
6131 int count = m_OverheatingParticles.Count();
6132
6133 for (int i = count; i > 0; --i)
6134 {
6135 int id = i - 1;
6136 OverheatingParticle OP = m_OverheatingParticles.Get(id);
6137 Particle p = OP.GetParticle();
6138
6139 float overheat_min = OP.GetOverheatingLimitMin();
6140 float overheat_max = OP.GetOverheatingLimitMax();
6141
6142 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6143 {
6144 if (p)
6145 {
6146 p.Stop();
6147 OP.RegisterParticle(null);
6148 }
6149 }
6150 }
6151 }
6152 }
6153
6155 {
6157 {
6158 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
6159 {
6160 int id = i - 1;
6161 OverheatingParticle OP = m_OverheatingParticles.Get(id);
6162
6163 if (OP)
6164 {
6165 Particle p = OP.GetParticle();
6166
6167 if (p)
6168 {
6169 p.Stop();
6170 }
6171
6172 delete OP;
6173 }
6174 }
6175
6176 m_OverheatingParticles.Clear();
6178 }
6179 }
6180
6182 float GetInfectionChance(int system = 0, Param param = null)
6183 {
6184 return 0.0;
6185 }
6186
6187
6188 float GetDisinfectQuantity(int system = 0, Param param1 = null)
6189 {
6190 return 250;//default value
6191 }
6192
6193 float GetFilterDamageRatio()
6194 {
6195 return 0;
6196 }
6197
6199 bool HasMuzzle()
6200 {
6201 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
6202 return true;
6203
6204 return false;
6205 }
6206
6208 int GetMuzzleID()
6209 {
6210 if (!m_WeaponTypeToID)
6212
6213 if (m_WeaponTypeToID.Contains(GetType()))
6214 {
6215 return m_WeaponTypeToID.Get(GetType());
6216 }
6217 else
6218 {
6219 // Register new weapon ID
6221 }
6222
6224 }
6225
6232 {
6233 return -1;
6234 }
6235
6236
6237
6238 // -------------------------------------------------------------------------
6239 void ~ItemBase()
6240 {
6241 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
6242 {
6243 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
6244 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6245
6246 if (r_index >= 0)
6247 {
6248 InventoryLocation r_il = new InventoryLocation;
6249 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6250
6251 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6252 int r_type = r_il.GetType();
6253 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
6254 {
6255 r_il.GetParent().GetOnReleaseLock().Invoke(this);
6256 }
6257 else if (r_type == InventoryLocationType.ATTACHMENT)
6258 {
6259 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
6260 }
6261
6262 }
6263
6264 player.GetHumanInventory().ClearUserReservedLocation(this);
6265 }
6266
6267 if (m_LockingSound)
6268 SEffectManager.DestroyEffect(m_LockingSound);
6269 }
6270
6271
6272
6273 // -------------------------------------------------------------------------
6274 static int GetDebugActionsMask()
6275 {
6276 return ItemBase.m_DebugActionsMask;
6277 }
6278
6279 static bool HasDebugActionsMask(int mask)
6280 {
6281 return ItemBase.m_DebugActionsMask & mask;
6282 }
6283
6284 static void SetDebugActionsMask(int mask)
6285 {
6286 ItemBase.m_DebugActionsMask = mask;
6287 }
6288
6289 static void AddDebugActionsMask(int mask)
6290 {
6291 ItemBase.m_DebugActionsMask |= mask;
6292 }
6293
6294 static void RemoveDebugActionsMask(int mask)
6295 {
6296 ItemBase.m_DebugActionsMask &= ~mask;
6297 }
6298
6299 static void ToggleDebugActionsMask(int mask)
6300 {
6301 if (HasDebugActionsMask(mask))
6302 {
6304 }
6305 else
6306 {
6307 AddDebugActionsMask(mask);
6308 }
6309 }
6310
6311 // -------------------------------------------------------------------------
6312 void SetCEBasedQuantity()
6313 {
6314 if (GetEconomyProfile())
6315 {
6316 float q_max = GetEconomyProfile().GetQuantityMax();
6317 if (q_max > 0)
6318 {
6319 float q_min = GetEconomyProfile().GetQuantityMin();
6320 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6321
6322 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
6323 {
6324 ComponentEnergyManager comp = GetCompEM();
6325 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
6326 {
6327 comp.SetEnergy0To1(quantity_randomized);
6328 }
6329 }
6330 else if (HasQuantity())
6331 {
6332 SetQuantityNormalized(quantity_randomized, false);
6333 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
6334 }
6335
6336 }
6337 }
6338 }
6339
6341 void LockToParent()
6342 {
6343 EntityAI parent = GetHierarchyParent();
6344
6345 if (parent)
6346 {
6347 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6348 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6349 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
6350 }
6351 }
6352
6354 void UnlockFromParent()
6355 {
6356 EntityAI parent = GetHierarchyParent();
6357
6358 if (parent)
6359 {
6360 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6361 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6362 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
6363 }
6364 }
6365
6366 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
6367 {
6368 /*
6369 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
6370 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
6371 */
6372 ItemBase item2 = ItemBase.Cast(entity2);
6373
6374 if (GetGame().IsClient())
6375 {
6376 if (ScriptInputUserData.CanStoreInputUserData())
6377 {
6378 ScriptInputUserData ctx = new ScriptInputUserData;
6380 ctx.Write(-1);
6381 ItemBase i1 = this; // @NOTE: workaround for correct serialization
6382 ctx.Write(i1);
6383 ctx.Write(item2);
6384 ctx.Write(use_stack_max);
6385 ctx.Write(-1);
6386 ctx.Send();
6387
6388 if (IsCombineAll(item2, use_stack_max))
6389 {
6390 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6391 }
6392 }
6393 }
6394 else if (!GetGame().IsMultiplayer())
6395 {
6396 CombineItems(item2, use_stack_max);
6397 }
6398 }
6399
6400 bool IsLiquidPresent()
6401 {
6402 return (GetLiquidType() != 0 && HasQuantity());
6403 }
6404
6405 bool IsLiquidContainer()
6406 {
6407 return m_LiquidContainerMask != 0;
6408 }
6409
6411 {
6412 return m_LiquidContainerMask;
6413 }
6414
6415 bool IsBloodContainer()
6416 {
6417 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
6418 return false;
6419 }
6420
6421 bool IsNVG()
6422 {
6423 return false;
6424 }
6425
6428 bool IsExplosive()
6429 {
6430 return false;
6431 }
6432
6434 {
6435 return "";
6436 }
6437
6439
6440 bool IsLightSource()
6441 {
6442 return false;
6443 }
6444
6446 {
6447 return true;
6448 }
6449
6450 //--- ACTION CONDITIONS
6451 //direction
6452 bool IsFacingPlayer(PlayerBase player, string selection)
6453 {
6454 return true;
6455 }
6456
6457 bool IsPlayerInside(PlayerBase player, string selection)
6458 {
6459 return true;
6460 }
6461
6462 override bool CanObstruct()
6463 {
6464 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
6465 return !player || !IsPlayerInside(player, "");
6466 }
6467
6468 override bool IsBeingPlaced()
6469 {
6470 return m_IsBeingPlaced;
6471 }
6472
6473 void SetIsBeingPlaced(bool is_being_placed)
6474 {
6475 m_IsBeingPlaced = is_being_placed;
6476 if (!is_being_placed)
6478 SetSynchDirty();
6479 }
6480
6481 //server-side
6482 void OnEndPlacement() {}
6483
6484 override bool IsHologram()
6485 {
6486 return m_IsHologram;
6487 }
6488
6489 bool CanBeDigged()
6490 {
6491 return m_CanBeDigged;
6492 }
6493
6495 {
6496 return 1;
6497 }
6498
6499 bool CanMakeGardenplot()
6500 {
6501 return false;
6502 }
6503
6504 void SetIsHologram(bool is_hologram)
6505 {
6506 m_IsHologram = is_hologram;
6507 SetSynchDirty();
6508 }
6509 /*
6510 protected float GetNutritionalEnergy()
6511 {
6512 Edible_Base edible = Edible_Base.Cast(this);
6513 return edible.GetFoodEnergy();
6514 }
6515
6516 protected float GetNutritionalWaterContent()
6517 {
6518 Edible_Base edible = Edible_Base.Cast(this);
6519 return edible.GetFoodWater();
6520 }
6521
6522 protected float GetNutritionalIndex()
6523 {
6524 Edible_Base edible = Edible_Base.Cast(this);
6525 return edible.GetFoodNutritionalIndex();
6526 }
6527
6528 protected float GetNutritionalFullnessIndex()
6529 {
6530 Edible_Base edible = Edible_Base.Cast(this);
6531 return edible.GetFoodTotalVolume();
6532 }
6533
6534 protected float GetNutritionalToxicity()
6535 {
6536 Edible_Base edible = Edible_Base.Cast(this);
6537 return edible.GetFoodToxicity();
6538
6539 }
6540 */
6541
6542
6543 // -------------------------------------------------------------------------
6544 override void OnMovedInsideCargo(EntityAI container)
6545 {
6546 super.OnMovedInsideCargo(container);
6547
6548 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6549 }
6550
6551 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6552 {
6553 super.EEItemLocationChanged(oldLoc,newLoc);
6554
6555 PlayerBase new_player = null;
6556 PlayerBase old_player = null;
6557
6558 if (newLoc.GetParent())
6559 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6560
6561 if (oldLoc.GetParent())
6562 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6563
6564 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
6565 {
6566 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6567
6568 if (r_index >= 0)
6569 {
6570 InventoryLocation r_il = new InventoryLocation;
6571 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6572
6573 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6574 int r_type = r_il.GetType();
6575 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
6576 {
6577 r_il.GetParent().GetOnReleaseLock().Invoke(this);
6578 }
6579 else if (r_type == InventoryLocationType.ATTACHMENT)
6580 {
6581 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
6582 }
6583
6584 }
6585 }
6586
6587 if (newLoc.GetType() == InventoryLocationType.HANDS)
6588 {
6589 if (new_player)
6590 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6591
6592 if (new_player == old_player)
6593 {
6594
6595 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6596 {
6597 if (oldLoc.GetType() == InventoryLocationType.CARGO)
6598 {
6599 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6600 {
6601 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6602 }
6603 }
6604 else
6605 {
6606 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6607 }
6608 }
6609
6610 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6611 {
6612 int type = oldLoc.GetType();
6613 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
6614 {
6615 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6616 }
6617 else if (type == InventoryLocationType.ATTACHMENT)
6618 {
6619 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6620 }
6621 }
6622 if (!m_OldLocation)
6623 {
6624 m_OldLocation = new InventoryLocation;
6625 }
6626 m_OldLocation.Copy(oldLoc);
6627 }
6628 else
6629 {
6630 if (m_OldLocation)
6631 {
6632 m_OldLocation.Reset();
6633 }
6634 }
6635
6637 }
6638 else
6639 {
6640 if (new_player)
6641 {
6642 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6643 if (res_index >= 0)
6644 {
6645 InventoryLocation il = new InventoryLocation;
6646 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6647 ItemBase it = ItemBase.Cast(il.GetItem());
6648 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6649 int rel_type = il.GetType();
6650 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
6651 {
6652 il.GetParent().GetOnReleaseLock().Invoke(it);
6653 }
6654 else if (rel_type == InventoryLocationType.ATTACHMENT)
6655 {
6656 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
6657 }
6658 //it.GetOnReleaseLock().Invoke(it);
6659 }
6660 }
6661 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
6662 {
6663 //ThrowPhysically(old_player, vector.Zero);
6664 m_ThrowItemOnDrop = false;
6665 }
6666
6667 if (m_OldLocation)
6668 {
6669 m_OldLocation.Reset();
6670 }
6671 }
6672 }
6673
6674 override void EOnContact(IEntity other, Contact extra)
6675 {
6677 {
6678 int liquidType = -1;
6679 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
6680 if (impactSpeed > 0.0)
6681 {
6682 m_ImpactSpeed = impactSpeed;
6683 #ifndef SERVER
6684 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
6685 #else
6686 m_WantPlayImpactSound = true;
6687 SetSynchDirty();
6688 #endif
6689 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
6690 }
6691 }
6692
6693 #ifdef SERVER
6694 if (GetCompEM() && GetCompEM().IsPlugged())
6695 {
6696 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
6697 GetCompEM().UnplugThis();
6698 }
6699 #endif
6700 }
6701
6702 void RefreshPhysics();
6703
6704 override void OnCreatePhysics()
6705 {
6707 }
6708
6709 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6710 {
6711
6712 }
6713 // -------------------------------------------------------------------------
6714 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
6715 {
6716 super.OnItemLocationChanged(old_owner, new_owner);
6717
6718 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6719 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6720
6721 if (!relatedPlayer && playerNew)
6722 relatedPlayer = playerNew;
6723
6724 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6725 {
6726 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
6727 if (actionMgr)
6728 {
6729 ActionBase currentAction = actionMgr.GetRunningAction();
6730 if (currentAction)
6731 currentAction.OnItemLocationChanged(this);
6732 }
6733 }
6734
6735 Man ownerPlayerOld = null;
6736 Man ownerPlayerNew = null;
6737
6738 if (old_owner)
6739 {
6740 if (old_owner.IsMan())
6741 {
6742 ownerPlayerOld = Man.Cast(old_owner);
6743 }
6744 else
6745 {
6746 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6747 }
6748 }
6749 else
6750 {
6751 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
6752 {
6753 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
6754
6755 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
6756 {
6757 GetCompEM().UnplugThis();
6758 }
6759 }
6760 }
6761
6762 if (new_owner)
6763 {
6764 if (new_owner.IsMan())
6765 {
6766 ownerPlayerNew = Man.Cast(new_owner);
6767 }
6768 else
6769 {
6770 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6771 }
6772 }
6773
6774 if (ownerPlayerOld != ownerPlayerNew)
6775 {
6776 if (ownerPlayerOld)
6777 {
6778 array<EntityAI> subItemsExit = new array<EntityAI>;
6779 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
6780 for (int i = 0; i < subItemsExit.Count(); i++)
6781 {
6782 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
6783 itemExit.OnInventoryExit(ownerPlayerOld);
6784 }
6785 }
6786
6787 if (ownerPlayerNew)
6788 {
6789 array<EntityAI> subItemsEnter = new array<EntityAI>;
6790 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
6791 for (int j = 0; j < subItemsEnter.Count(); j++)
6792 {
6793 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
6794 itemEnter.OnInventoryEnter(ownerPlayerNew);
6795 }
6796 }
6797 }
6798 else if (ownerPlayerNew != null)
6799 {
6800 PlayerBase nplayer;
6801 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6802 {
6803 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6804 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
6805 for (int k = 0; k < subItemsUpdate.Count(); k++)
6806 {
6807 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
6808 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6809 }
6810 }
6811 }
6812
6813 if (old_owner)
6814 old_owner.OnChildItemRemoved(this);
6815 if (new_owner)
6816 new_owner.OnChildItemReceived(this);
6817 }
6818
6819 // -------------------------------------------------------------------------------
6820 override void EEDelete(EntityAI parent)
6821 {
6822 super.EEDelete(parent);
6823 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6824 if (player)
6825 {
6826 OnInventoryExit(player);
6827
6828 if (player.IsAlive())
6829 {
6830 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6831 if (r_index >= 0)
6832 {
6833 InventoryLocation r_il = new InventoryLocation;
6834 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6835
6836 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6837 int r_type = r_il.GetType();
6838 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
6839 {
6840 r_il.GetParent().GetOnReleaseLock().Invoke(this);
6841 }
6842 else if (r_type == InventoryLocationType.ATTACHMENT)
6843 {
6844 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
6845 }
6846
6847 }
6848
6849 player.RemoveQuickBarEntityShortcut(this);
6850 }
6851 }
6852 }
6853 // -------------------------------------------------------------------------------
6854 override void EEKilled(Object killer)
6855 {
6856 super.EEKilled(killer);
6857
6859 if (killer && killer.IsFireplace() && CanExplodeInFire())
6860 {
6861 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6862 {
6863 if (IsMagazine())
6864 {
6865 if (Magazine.Cast(this).GetAmmoCount() > 0)
6866 {
6867 ExplodeAmmo();
6868 }
6869 }
6870 else
6871 {
6872 Explode(DamageType.EXPLOSION);
6873 }
6874 }
6875 }
6876 }
6877
6878 override void OnWasAttached(EntityAI parent, int slot_id)
6879 {
6880 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6881
6882 super.OnWasAttached(parent, slot_id);
6883
6884 if (HasQuantity())
6885 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
6886
6887 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
6888 }
6889
6890 override void OnWasDetached(EntityAI parent, int slot_id)
6891 {
6892 super.OnWasDetached(parent, slot_id);
6893
6894 if (HasQuantity())
6895 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
6896 }
6897
6898 override string ChangeIntoOnAttach(string slot)
6899 {
6900 int idx;
6901 TStringArray inventory_slots = new TStringArray;
6902 TStringArray attach_types = new TStringArray;
6903
6904 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6905 if (inventory_slots.Count() < 1) //is string
6906 {
6907 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6908 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6909 }
6910 else //is array
6911 {
6912 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6913 }
6914
6915 idx = inventory_slots.Find(slot);
6916 if (idx < 0)
6917 return "";
6918
6919 return attach_types.Get(idx);
6920 }
6921
6922 override string ChangeIntoOnDetach()
6923 {
6924 int idx = -1;
6925 string slot;
6926
6927 TStringArray inventory_slots = new TStringArray;
6928 TStringArray detach_types = new TStringArray;
6929
6930 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6931 if (inventory_slots.Count() < 1) //is string
6932 {
6933 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6934 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6935 }
6936 else //is array
6937 {
6938 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6939 if (detach_types.Count() < 1)
6940 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6941 }
6942
6943 for (int i = 0; i < inventory_slots.Count(); i++)
6944 {
6945 slot = inventory_slots.Get(i);
6946 }
6947
6948 if (slot != "")
6949 {
6950 if (detach_types.Count() == 1)
6951 idx = 0;
6952 else
6953 idx = inventory_slots.Find(slot);
6954 }
6955 if (idx < 0)
6956 return "";
6957
6958 return detach_types.Get(idx);
6959 }
6960
6961 void ExplodeAmmo()
6962 {
6963 //timer
6964 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
6965
6966 //min/max time
6967 float min_time = 1;
6968 float max_time = 3;
6969 float delay = Math.RandomFloat(min_time, max_time);
6970
6971 explode_timer.Run(delay, this, "DoAmmoExplosion");
6972 }
6973
6974 void DoAmmoExplosion()
6975 {
6976 Magazine magazine = Magazine.Cast(this);
6977 int pop_sounds_count = 6;
6978 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
6979
6980 //play sound
6981 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
6982 string sound_name = pop_sounds[ sound_idx ];
6983 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
6984
6985 //remove ammo count
6986 magazine.ServerAddAmmoCount(-1);
6987
6988 //if condition then repeat -> ExplodeAmmo
6989 float min_temp_to_explode = 100; //min temperature for item to explode
6990
6991 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
6992 {
6993 ExplodeAmmo();
6994 }
6995 }
6996
6997 // -------------------------------------------------------------------------------
6998 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
6999 {
7000 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
7001
7002 const int CHANCE_DAMAGE_CARGO = 4;
7003 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7004 const int CHANCE_DAMAGE_NOTHING = 2;
7005
7006 if (IsClothing() || IsContainer() || IsItemTent())
7007 {
7008 float dmg = damageResult.GetDamage("","Health") * -0.5;
7009 int chances;
7010 int rnd;
7011
7012 if (GetInventory().GetCargo())
7013 {
7014 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7015 rnd = Math.RandomInt(0,chances);
7016
7017 if (rnd < CHANCE_DAMAGE_CARGO)
7018 {
7019 DamageItemInCargo(dmg);
7020 }
7021 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7022 {
7024 }
7025 }
7026 else
7027 {
7028 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7029 rnd = Math.RandomInt(0,chances);
7030
7031 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7032 {
7034 }
7035 }
7036 }
7037 }
7038
7039 bool DamageItemInCargo(float damage)
7040 {
7041 if (GetInventory().GetCargo())
7042 {
7043 int item_count = GetInventory().GetCargo().GetItemCount();
7044 if (item_count > 0)
7045 {
7046 int random_pick = Math.RandomInt(0, item_count);
7047 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
7048 if (!item.IsExplosive())
7049 {
7050 item.AddHealth("","",damage);
7051 return true;
7052 }
7053 }
7054 }
7055 return false;
7056 }
7057
7058 bool DamageItemAttachments(float damage)
7059 {
7060 int attachment_count = GetInventory().AttachmentCount();
7061 if (attachment_count > 0)
7062 {
7063 int random_pick = Math.RandomInt(0, attachment_count);
7064 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7065 if (!attachment.IsExplosive())
7066 {
7067 attachment.AddHealth("","",damage);
7068 return true;
7069 }
7070 }
7071 return false;
7072 }
7073
7074 override bool IsSplitable()
7075 {
7076 return m_CanThisBeSplit;
7077 }
7078 //----------------
7079 override bool CanBeSplit()
7080 {
7081 if (IsSplitable() && (GetQuantity() > 1))
7082 return GetInventory().CanRemoveEntity();
7083
7084 return false;
7085 }
7086
7087 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
7088 {
7089 if (!CanBeSplit())
7090 return;
7091
7092 if (GetGame().IsClient())
7093 {
7094 if (ScriptInputUserData.CanStoreInputUserData())
7095 {
7096 ScriptInputUserData ctx = new ScriptInputUserData;
7098 ctx.Write(1);
7099 ItemBase i1 = this; // @NOTE: workaround for correct serialization
7100 ctx.Write(i1);
7101 ctx.Write(destination_entity);
7102 ctx.Write(true);
7103 ctx.Write(slot_id);
7104 ctx.Send();
7105 }
7106 }
7107 else if (!GetGame().IsMultiplayer())
7108 {
7109 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
7110 }
7111 }
7112
7113 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
7114 {
7115 if (!CanBeSplit())
7116 return;
7117
7118 float split_quantity_new;
7119 ref ItemBase new_item;
7120 float quantity = GetQuantity();
7121 float stack_max = GetTargetQuantityMax(slot_id);
7122 InventoryLocation loc = new InventoryLocation;
7123
7124 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7125 {
7126 if (stack_max <= GetQuantity())
7127 split_quantity_new = stack_max;
7128 else
7129 split_quantity_new = GetQuantity();
7130
7131 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
7132 if (new_item)
7133 {
7134 new_item.SetResultOfSplit(true);
7135 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7136 AddQuantity(-split_quantity_new);
7137 new_item.SetQuantity(split_quantity_new);
7138 }
7139 }
7140 else if (destination_entity && slot_id == -1)
7141 {
7142 if (quantity > stack_max)
7143 split_quantity_new = stack_max;
7144 else
7145 split_quantity_new = quantity;
7146
7147 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
7148 {
7149 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
7150 new_item = ItemBase.Cast(o);
7151 }
7152
7153 if (new_item)
7154 {
7155 new_item.SetResultOfSplit(true);
7156 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7157 AddQuantity(-split_quantity_new);
7158 new_item.SetQuantity(split_quantity_new);
7159 }
7160 }
7161 else
7162 {
7163 if (stack_max != 0)
7164 {
7165 if (stack_max < GetQuantity())
7166 {
7167 split_quantity_new = GetQuantity() - stack_max;
7168 }
7169
7170 if (split_quantity_new == 0)
7171 {
7172 if (!GetGame().IsMultiplayer())
7173 player.PhysicalPredictiveDropItem(this);
7174 else
7175 player.ServerDropEntity(this);
7176 return;
7177 }
7178
7179 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
7180
7181 if (new_item)
7182 {
7183 new_item.SetResultOfSplit(true);
7184 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7185 SetQuantity(split_quantity_new);
7186 new_item.SetQuantity(stack_max);
7187 new_item.PlaceOnSurface();
7188 }
7189 }
7190 }
7191 }
7192
7193 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
7194 {
7195 if (!CanBeSplit())
7196 return;
7197
7198 float split_quantity_new;
7199 ref ItemBase new_item;
7200 float quantity = GetQuantity();
7201 float stack_max = GetTargetQuantityMax(slot_id);
7202 InventoryLocation loc = new InventoryLocation;
7203
7204 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7205 {
7206 if (stack_max <= GetQuantity())
7207 split_quantity_new = stack_max;
7208 else
7209 split_quantity_new = GetQuantity();
7210
7211 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
7212 if (new_item)
7213 {
7214 new_item.SetResultOfSplit(true);
7215 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7216 AddQuantity(-split_quantity_new);
7217 new_item.SetQuantity(split_quantity_new);
7218 }
7219 }
7220 else if (destination_entity && slot_id == -1)
7221 {
7222 if (quantity > stack_max)
7223 split_quantity_new = stack_max;
7224 else
7225 split_quantity_new = quantity;
7226
7227 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
7228 {
7229 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
7230 new_item = ItemBase.Cast(o);
7231 }
7232
7233 if (new_item)
7234 {
7235 new_item.SetResultOfSplit(true);
7236 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7237 AddQuantity(-split_quantity_new);
7238 new_item.SetQuantity(split_quantity_new);
7239 }
7240 }
7241 else
7242 {
7243 if (stack_max != 0)
7244 {
7245 if (stack_max < GetQuantity())
7246 {
7247 split_quantity_new = GetQuantity() - stack_max;
7248 }
7249
7250 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
7251
7252 if (new_item)
7253 {
7254 new_item.SetResultOfSplit(true);
7255 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7256 SetQuantity(split_quantity_new);
7257 new_item.SetQuantity(stack_max);
7258 new_item.PlaceOnSurface();
7259 }
7260 }
7261 }
7262 }
7263
7264 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
7265 {
7266 if (!CanBeSplit())
7267 return;
7268
7269 if (GetGame().IsClient())
7270 {
7271 if (ScriptInputUserData.CanStoreInputUserData())
7272 {
7273 ScriptInputUserData ctx = new ScriptInputUserData;
7275 ctx.Write(4);
7276 ItemBase thiz = this; // @NOTE: workaround for correct serialization
7277 ctx.Write(thiz);
7278 dst.WriteToContext(ctx);
7279 ctx.Send();
7280 }
7281 }
7282 else if (!GetGame().IsMultiplayer())
7283 {
7285 }
7286 }
7287
7288 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
7289 {
7290 if (!CanBeSplit())
7291 return;
7292
7293 if (GetGame().IsClient())
7294 {
7295 if (ScriptInputUserData.CanStoreInputUserData())
7296 {
7297 ScriptInputUserData ctx = new ScriptInputUserData;
7299 ctx.Write(2);
7300 ItemBase dummy = this; // @NOTE: workaround for correct serialization
7301 ctx.Write(dummy);
7302 ctx.Write(destination_entity);
7303 ctx.Write(true);
7304 ctx.Write(idx);
7305 ctx.Write(row);
7306 ctx.Write(col);
7307 ctx.Send();
7308 }
7309 }
7310 else if (!GetGame().IsMultiplayer())
7311 {
7312 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
7313 }
7314 }
7315
7316 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
7317 {
7319 }
7320
7321 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
7322 {
7323 if (!CanBeSplit())
7324 return this;
7325
7326 float quantity = GetQuantity();
7327 float split_quantity_new;
7328 ItemBase new_item;
7329 if (dst.IsValid())
7330 {
7331 int slot_id = dst.GetSlot();
7332 float stack_max = GetTargetQuantityMax(slot_id);
7333
7334 if (quantity > stack_max)
7335 split_quantity_new = stack_max;
7336 else
7337 split_quantity_new = quantity;
7338
7339 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
7340
7341 if (new_item)
7342 {
7343 new_item.SetResultOfSplit(true);
7344 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7345 AddQuantity(-split_quantity_new);
7346 new_item.SetQuantity(split_quantity_new);
7347 }
7348
7349 return new_item;
7350 }
7351
7352 return null;
7353 }
7354
7355 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
7356 {
7357 if (!CanBeSplit())
7358 return;
7359
7360 float quantity = GetQuantity();
7361 float split_quantity_new;
7362 ref ItemBase new_item;
7363 if (destination_entity)
7364 {
7365 float stackable = GetTargetQuantityMax();
7366 if (quantity > stackable)
7367 split_quantity_new = stackable;
7368 else
7369 split_quantity_new = quantity;
7370
7371 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
7372 if (new_item)
7373 {
7374 new_item.SetResultOfSplit(true);
7375 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7376 AddQuantity(-split_quantity_new);
7377 new_item.SetQuantity(split_quantity_new);
7378 }
7379 }
7380 }
7381
7382 void SplitIntoStackMaxHandsClient(PlayerBase player)
7383 {
7384 if (!CanBeSplit())
7385 return;
7386
7387 if (GetGame().IsClient())
7388 {
7389 if (ScriptInputUserData.CanStoreInputUserData())
7390 {
7391 ScriptInputUserData ctx = new ScriptInputUserData;
7393 ctx.Write(3);
7394 ItemBase i1 = this; // @NOTE: workaround for correct serialization
7395 ctx.Write(i1);
7396 ItemBase destination_entity = this;
7397 ctx.Write(destination_entity);
7398 ctx.Write(true);
7399 ctx.Write(0);
7400 ctx.Send();
7401 }
7402 }
7403 else if (!GetGame().IsMultiplayer())
7404 {
7405 SplitIntoStackMaxHands(player);
7406 }
7407 }
7408
7409 void SplitIntoStackMaxHands(PlayerBase player)
7410 {
7411 if (!CanBeSplit())
7412 return;
7413
7414 float quantity = GetQuantity();
7415 float split_quantity_new;
7416 ref ItemBase new_item;
7417 if (player)
7418 {
7419 float stackable = GetTargetQuantityMax();
7420 if (quantity > stackable)
7421 split_quantity_new = stackable;
7422 else
7423 split_quantity_new = quantity;
7424
7425 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
7426 new_item = ItemBase.Cast(in_hands);
7427 if (new_item)
7428 {
7429 new_item.SetResultOfSplit(true);
7430 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7431 AddQuantity(-split_quantity_new);
7432 new_item.SetQuantity(split_quantity_new);
7433 }
7434 }
7435 }
7436
7437 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
7438 {
7439 if (!CanBeSplit())
7440 return;
7441
7442 float quantity = GetQuantity();
7443 float split_quantity_new = Math.Floor(quantity * 0.5);
7444
7445 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
7446
7447 if (new_item)
7448 {
7449 if (new_item.GetQuantityMax() < split_quantity_new)
7450 {
7451 split_quantity_new = new_item.GetQuantityMax();
7452 }
7453
7454 new_item.SetResultOfSplit(true);
7455 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7456
7457 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
7458 {
7459 AddQuantity(-1);
7460 new_item.SetQuantity(1);
7461 }
7462 else
7463 {
7464 AddQuantity(-split_quantity_new);
7465 new_item.SetQuantity(split_quantity_new);
7466 }
7467 }
7468 }
7469
7470 void SplitItem(PlayerBase player)
7471 {
7472 if (!CanBeSplit())
7473 return;
7474
7475 float quantity = GetQuantity();
7476 float split_quantity_new = Math.Floor(quantity / 2);
7477
7478 InventoryLocation invloc = new InventoryLocation;
7479 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
7480
7481 ItemBase new_item;
7482 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7483
7484 if (new_item)
7485 {
7486 if (new_item.GetQuantityMax() < split_quantity_new)
7487 {
7488 split_quantity_new = new_item.GetQuantityMax();
7489 }
7490 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
7491 {
7492 AddQuantity(-1);
7493 new_item.SetQuantity(1);
7494 }
7495 else
7496 {
7497 AddQuantity(-split_quantity_new);
7498 new_item.SetQuantity(split_quantity_new);
7499 }
7500 }
7501 }
7502
7504 void OnQuantityChanged(float delta)
7505 {
7506 SetWeightDirty();
7507 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
7508
7509 if (parent)
7510 parent.OnAttachmentQuantityChangedEx(this, delta);
7511
7512 if (IsLiquidContainer())
7513 {
7514 if (GetQuantityNormalized() <= 0.0)
7515 {
7517 }
7518 else if (GetLiquidType() == LIQUID_NONE)
7519 {
7520 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
7522 }
7523 }
7524
7525 }
7526
7529 {
7530 // insert code here
7531 }
7532
7534 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
7535 {
7537 }
7538
7539 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
7540 {
7541 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7542
7543 if (GetGame().IsServer())
7544 {
7545 if (newLevel == GameConstants.STATE_RUINED)
7546 {
7548 EntityAI parent = GetHierarchyParent();
7549 if (parent && parent.IsFireplace())
7550 {
7551 CargoBase cargo = GetInventory().GetCargo();
7552 if (cargo)
7553 {
7554 for (int i = 0; i < cargo.GetItemCount(); ++i)
7555 {
7556 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
7557 }
7558 }
7559 }
7560 }
7561
7562 if (IsResultOfSplit())
7563 {
7564 // reset the splitting result flag, return to normal item behavior
7565 SetResultOfSplit(false);
7566 return;
7567 }
7568
7569 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7570 {
7571 SetCleanness(0);//unclean the item upon damage dealt
7572 }
7573 }
7574 }
7575
7576 // just the split? TODO: verify
7577 override void OnRightClick()
7578 {
7579 super.OnRightClick();
7580
7581 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
7582 {
7583 if (GetGame().IsClient())
7584 {
7585 if (ScriptInputUserData.CanStoreInputUserData())
7586 {
7587 vector m4[4];
7588 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
7589
7590 EntityAI root = GetHierarchyRoot();
7591
7592 InventoryLocation dst = new InventoryLocation;
7593 if (!player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.CARGO, dst))
7594 {
7595 if (root)
7596 {
7597 root.GetTransform(m4);
7598 dst.SetGround(this, m4);
7599 }
7600 else
7601 GetInventory().GetCurrentInventoryLocation(dst);
7602 }
7603 else
7604 {
7605 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
7606 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
7607 this shouldnt cause issues within this scope*/
7608 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
7609 {
7610 if (root)
7611 {
7612 root.GetTransform(m4);
7613 dst.SetGround(this, m4);
7614 }
7615 else
7616 GetInventory().GetCurrentInventoryLocation(dst);
7617 }
7618 else
7619 {
7620 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7621 }
7622 }
7623
7624 ScriptInputUserData ctx = new ScriptInputUserData;
7626 ctx.Write(4);
7627 ItemBase thiz = this; // @NOTE: workaround for correct serialization
7628 ctx.Write(thiz);
7629 dst.WriteToContext(ctx);
7630 ctx.Write(true); // dummy
7631 ctx.Send();
7632 }
7633 }
7634 else if (!GetGame().IsMultiplayer())
7635 {
7636 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
7637 }
7638 }
7639 }
7640
7641 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
7642 {
7643 //TODO: delete check zero quantity check after fix double posts hands fsm events
7644 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
7645 return false;
7646
7647 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7648 return false;
7649
7650 //can_this_be_combined = ConfigGetBool("canBeSplit");
7652 return false;
7653
7654
7655 Magazine mag = Magazine.Cast(this);
7656 if (mag)
7657 {
7658 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7659 return false;
7660
7661 if (stack_max_limit)
7662 {
7663 Magazine other_mag = Magazine.Cast(other_item);
7664 if (other_item)
7665 {
7666 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7667 return false;
7668 }
7669
7670 }
7671 }
7672 else
7673 {
7674 //TODO: delete check zero quantity check after fix double posts hands fsm events
7675 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
7676 return false;
7677
7678 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
7679 return false;
7680 }
7681
7682 PlayerBase player = null;
7683 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
7684 {
7685 if (player.GetInventory().HasAttachment(this))
7686 return false;
7687
7688 if (player.IsItemsToDelete())
7689 return false;
7690 }
7691
7692 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7693 return false;
7694
7695 int slotID;
7696 string slotName;
7697 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7698 return false;
7699
7700 return true;
7701 }
7702
7703 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
7704 {
7705 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
7706 }
7707
7708 bool IsResultOfSplit()
7709 {
7710 return m_IsResultOfSplit;
7711 }
7712
7713 void SetResultOfSplit(bool value)
7714 {
7715 m_IsResultOfSplit = value;
7716 }
7717
7718 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
7719 {
7720 return ComputeQuantityUsedEx(other_item, use_stack_max);
7721 }
7722
7723 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
7724 {
7725 float other_item_quantity = other_item.GetQuantity();
7726 float this_free_space;
7727
7728 float stack_max = GetQuantityMax();
7729
7730 this_free_space = stack_max - GetQuantity();
7731
7732 if (other_item_quantity > this_free_space)
7733 {
7734 return this_free_space;
7735 }
7736 else
7737 {
7738 return other_item_quantity;
7739 }
7740 }
7741
7742 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
7743 {
7744 CombineItems(ItemBase.Cast(entity2),use_stack_max);
7745 }
7746
7747 void CombineItems(ItemBase other_item, bool use_stack_max = true)
7748 {
7749 if (!CanBeCombined(other_item, false))
7750 return;
7751
7752 if (!IsMagazine() && other_item)
7753 {
7754 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
7755 if (quantity_used != 0)
7756 {
7757 float hp1 = GetHealth01("","");
7758 float hp2 = other_item.GetHealth01("","");
7759 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
7760 hpResult = hpResult / (GetQuantity() + quantity_used);
7761
7762 hpResult *= GetMaxHealth();
7763 Math.Round(hpResult);
7764 SetHealth("", "Health", hpResult);
7765
7766 AddQuantity(quantity_used);
7767 other_item.AddQuantity(-quantity_used);
7768 }
7769 }
7770 OnCombine(other_item);
7771 }
7772
7773 void OnCombine(ItemBase other_item)
7774 {
7775 #ifdef SERVER
7776 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7777 GetHierarchyParent().IncreaseLifetimeUp();
7778 #endif
7779 };
7780
7781 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
7782 {
7783 PlayerBase p = PlayerBase.Cast(player);
7784
7785 array<int> recipesIds = p.m_Recipes;
7786 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
7787 if (moduleRecipesManager)
7788 {
7789 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
7790 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
7791 }
7792
7793 for (int i = 0;i < recipesIds.Count(); i++)
7794 {
7795 int key = recipesIds.Get(i);
7796 string recipeName = moduleRecipesManager.GetRecipeName(key);
7797 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
7798 }
7799 }
7800
7801 // -------------------------------------------------------------------------
7802 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7803 {
7804 super.GetDebugActions(outputList);
7805
7806 //quantity
7807 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
7808 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
7809 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
7810 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
7811
7812 //health
7813 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
7814 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
7815 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
7816 //temperature
7817 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
7818 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
7819 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
7820
7821 //wet
7822 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
7823 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
7824
7825 //liquidtype
7826 if (IsLiquidContainer())
7827 {
7828 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
7829 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
7830 }
7831
7832 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
7833 // watch
7834 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
7835 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
7836
7837 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
7838 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
7839 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
7840 }
7841
7842 // -------------------------------------------------------------------------
7843 // -------------------------------------------------------------------------
7844 // -------------------------------------------------------------------------
7845 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
7846 {
7847 super.OnAction(action_id, player, ctx);
7848 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
7849 {
7850 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
7851 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
7852 PlayerBase p = PlayerBase.Cast(player);
7853 if (EActions.RECIPES_RANGE_START < 1000)
7854 {
7855 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7856 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7857 }
7858 }
7859 #ifndef SERVER
7860 else if (action_id == EActions.WATCH_PLAYER)
7861 {
7862 PluginDeveloper.SetDeveloperItemClientEx(player);
7863 }
7864 #endif
7865 if (GetGame().IsServer())
7866 {
7867 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7868 {
7869 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7870 OnDebugButtonPressServer(id + 1);
7871 }
7872
7873 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7874 {
7875 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
7876 InsertAgent(agent_id,100);
7877 }
7878
7879 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
7880 {
7881 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
7882 RemoveAgent(agent_id2);
7883 }
7884
7885 else if (action_id == EActions.ADD_QUANTITY)
7886 {
7887 if (IsMagazine())
7888 {
7889 Magazine mag = Magazine.Cast(this);
7890 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
7891 }
7892 else
7893 {
7894 AddQuantity(GetQuantityMax() * 0.2);
7895 }
7896
7897 if (m_EM)
7898 {
7899 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
7900 }
7901 //PrintVariables();
7902 }
7903
7904 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
7905 {
7906 if (IsMagazine())
7907 {
7908 Magazine mag2 = Magazine.Cast(this);
7909 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
7910 }
7911 else
7912 {
7913 AddQuantity(- GetQuantityMax() * 0.2);
7914 }
7915 if (m_EM)
7916 {
7917 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
7918 }
7919 //PrintVariables();
7920 }
7921
7922 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
7923 {
7924 SetQuantity(0);
7925
7926 if (m_EM)
7927 {
7928 m_EM.SetEnergy(0);
7929 }
7930 }
7931
7932 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
7933 {
7935
7936 if (m_EM)
7937 {
7938 m_EM.SetEnergy(m_EM.GetEnergyMax());
7939 }
7940 }
7941
7942 else if (action_id == EActions.ADD_HEALTH)
7943 {
7944 AddHealth("","",GetMaxHealth("","Health")/5);
7945 }
7946 else if (action_id == EActions.REMOVE_HEALTH)
7947 {
7948 AddHealth("","",-GetMaxHealth("","Health")/5);
7949 }
7950 else if (action_id == EActions.DESTROY_HEALTH)
7951 {
7952 SetHealth01("","",0);
7953 }
7954 else if (action_id == EActions.WATCH_ITEM)
7955 {
7957 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
7958 #ifdef DEVELOPER
7959 SetDebugDeveloper_item(this);
7960 #endif
7961 }
7962
7963 else if (action_id == EActions.ADD_TEMPERATURE)
7964 {
7965 AddTemperature(20);
7966 //PrintVariables();
7967 }
7968
7969 else if (action_id == EActions.REMOVE_TEMPERATURE)
7970 {
7971 AddTemperature(-20);
7972 //PrintVariables();
7973 }
7974
7975 else if (action_id == EActions.FLIP_FROZEN)
7976 {
7977 SetFrozen(!GetIsFrozen());
7978 //PrintVariables();
7979 }
7980
7981 else if (action_id == EActions.ADD_WETNESS)
7982 {
7983 AddWet(GetWetMax()/5);
7984 //PrintVariables();
7985 }
7986
7987 else if (action_id == EActions.REMOVE_WETNESS)
7988 {
7989 AddWet(-GetWetMax()/5);
7990 //PrintVariables();
7991 }
7992
7993 else if (action_id == EActions.LIQUIDTYPE_UP)
7994 {
7995 int curr_type = GetLiquidType();
7996 SetLiquidType(curr_type * 2);
7997 //AddWet(1);
7998 //PrintVariables();
7999 }
8000
8001 else if (action_id == EActions.LIQUIDTYPE_DOWN)
8002 {
8003 int curr_type2 = GetLiquidType();
8004 SetLiquidType(curr_type2 / 2);
8005 }
8006
8007 else if (action_id == EActions.MAKE_SPECIAL)
8008 {
8009 auto debugParams = DebugSpawnParams.WithPlayer(player);
8010 OnDebugSpawnEx(debugParams);
8011 }
8012
8013 else if (action_id == EActions.DELETE)
8014 {
8015 Delete();
8016 }
8017
8018 }
8019
8020
8021 return false;
8022 }
8023
8024 // -------------------------------------------------------------------------
8025
8026
8029 void OnActivatedByTripWire();
8030
8032 void OnActivatedByItem(notnull ItemBase item);
8033
8034 //----------------------------------------------------------------
8035 //returns true if item is able to explode when put in fire
8036 bool CanExplodeInFire()
8037 {
8038 return false;
8039 }
8040
8041 //----------------------------------------------------------------
8042 bool CanEat()
8043 {
8044 return true;
8045 }
8046
8047 //----------------------------------------------------------------
8048 override bool IsIgnoredByConstruction()
8049 {
8050 return true;
8051 }
8052
8053 //----------------------------------------------------------------
8054 //has FoodStages in config?
8055 bool HasFoodStage()
8056 {
8057 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
8058 return GetGame().ConfigIsExisting(config_path);
8059 }
8060
8062 FoodStage GetFoodStage()
8063 {
8064 return null;
8065 }
8066
8067 bool CanBeCooked()
8068 {
8069 return false;
8070 }
8071
8072 bool CanBeCookedOnStick()
8073 {
8074 return false;
8075 }
8076
8078 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
8080
8081 //----------------------------------------------------------------
8082 bool CanRepair(ItemBase item_repair_kit)
8083 {
8084 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
8085 return module_repairing.CanRepair(this, item_repair_kit);
8086 }
8087
8088 //----------------------------------------------------------------
8089 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
8090 {
8091 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
8092 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8093 }
8094
8095 //----------------------------------------------------------------
8096 int GetItemSize()
8097 {
8098 /*
8099 vector v_size = this.ConfigGetVector("itemSize");
8100 int v_size_x = v_size[0];
8101 int v_size_y = v_size[1];
8102 int size = v_size_x * v_size_y;
8103 return size;
8104 */
8105
8106 return 1;
8107 }
8108
8109 //----------------------------------------------------------------
8110 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
8111 bool CanBeMovedOverride()
8112 {
8113 return m_CanBeMovedOverride;
8114 }
8115
8116 //----------------------------------------------------------------
8117 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
8118 void SetCanBeMovedOverride(bool setting)
8119 {
8120 m_CanBeMovedOverride = setting;
8121 }
8122
8123 //----------------------------------------------------------------
8131 void MessageToOwnerStatus(string text)
8132 {
8133 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8134
8135 if (player)
8136 {
8137 player.MessageStatus(text);
8138 }
8139 }
8140
8141 //----------------------------------------------------------------
8149 void MessageToOwnerAction(string text)
8150 {
8151 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8152
8153 if (player)
8154 {
8155 player.MessageAction(text);
8156 }
8157 }
8158
8159 //----------------------------------------------------------------
8167 void MessageToOwnerFriendly(string text)
8168 {
8169 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8170
8171 if (player)
8172 {
8173 player.MessageFriendly(text);
8174 }
8175 }
8176
8177 //----------------------------------------------------------------
8185 void MessageToOwnerImportant(string text)
8186 {
8187 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8188
8189 if (player)
8190 {
8191 player.MessageImportant(text);
8192 }
8193 }
8194
8195 override bool IsItemBase()
8196 {
8197 return true;
8198 }
8199
8200 // Checks if item is of questioned kind
8201 override bool KindOf(string tag)
8202 {
8203 bool found = false;
8204 string item_name = this.GetType();
8205 ref TStringArray item_tag_array = new TStringArray;
8206 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
8207
8208 int array_size = item_tag_array.Count();
8209 for (int i = 0; i < array_size; i++)
8210 {
8211 if (item_tag_array.Get(i) == tag)
8212 {
8213 found = true;
8214 break;
8215 }
8216 }
8217 return found;
8218 }
8219
8220
8221 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
8222 {
8223 //Debug.Log("OnRPC called");
8224 super.OnRPC(sender, rpc_type,ctx);
8225
8226 //Play soundset for attachment locking (ActionLockAttachment.c)
8227 switch (rpc_type)
8228 {
8229 #ifndef SERVER
8230 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8231 Param2<bool, string> p = new Param2<bool, string>(false, "");
8232
8233 if (!ctx.Read(p))
8234 return;
8235
8236 bool play = p.param1;
8237 string soundSet = p.param2;
8238
8239 if (play)
8240 {
8241 if (m_LockingSound)
8242 {
8244 {
8245 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
8246 }
8247 }
8248 else
8249 {
8250 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
8251 }
8252 }
8253 else
8254 {
8255 SEffectManager.DestroyEffect(m_LockingSound);
8256 }
8257
8258 break;
8259 #endif
8260
8261 }
8262
8263 if (GetWrittenNoteData())
8264 {
8265 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
8266 }
8267 }
8268
8269 //-----------------------------
8270 // VARIABLE MANIPULATION SYSTEM
8271 //-----------------------------
8272 int NameToID(string name)
8273 {
8274 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
8275 return plugin.GetID(name);
8276 }
8277
8278 string IDToName(int id)
8279 {
8280 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
8281 return plugin.GetName(id);
8282 }
8283
8285 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
8286 {
8287 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
8288 //read the flags
8289 int varFlags;
8290 if (!ctx.Read(varFlags))
8291 return;
8292
8293 if (varFlags & ItemVariableFlags.FLOAT)
8294 {
8295 ReadVarsFromCTX(ctx);
8296 }
8297 }
8298
8299 override void SerializeNumericalVars(array<float> floats_out)
8300 {
8301 //some variables handled on EntityAI level already!
8302 super.SerializeNumericalVars(floats_out);
8303
8304 // the order of serialization must be the same as the order of de-serialization
8305 //--------------------------------------------
8306 if (IsVariableSet(VARIABLE_QUANTITY))
8307 {
8308 floats_out.Insert(m_VarQuantity);
8309 }
8310 //--------------------------------------------
8311 if (IsVariableSet(VARIABLE_WET))
8312 {
8313 floats_out.Insert(m_VarWet);
8314 }
8315 //--------------------------------------------
8316 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
8317 {
8318 floats_out.Insert(m_VarLiquidType);
8319 }
8320 //--------------------------------------------
8321 if (IsVariableSet(VARIABLE_COLOR))
8322 {
8323 floats_out.Insert(m_ColorComponentR);
8324 floats_out.Insert(m_ColorComponentG);
8325 floats_out.Insert(m_ColorComponentB);
8326 floats_out.Insert(m_ColorComponentA);
8327 }
8328 //--------------------------------------------
8329 if (IsVariableSet(VARIABLE_CLEANNESS))
8330 {
8331 floats_out.Insert(m_Cleanness);
8332 }
8333 }
8334
8335 override void DeSerializeNumericalVars(array<float> floats)
8336 {
8337 //some variables handled on EntityAI level already!
8338 super.DeSerializeNumericalVars(floats);
8339
8340 // the order of serialization must be the same as the order of de-serialization
8341 int index = 0;
8342 int mask = Math.Round(floats.Get(index));
8343
8344 index++;
8345 //--------------------------------------------
8346 if (mask & VARIABLE_QUANTITY)
8347 {
8348 if (m_IsStoreLoad)
8349 {
8350 SetStoreLoadedQuantity(floats.Get(index));
8351 }
8352 else
8353 {
8354 float quantity = floats.Get(index);
8355 SetQuantity(quantity, true, false, false, false);
8356 }
8357 index++;
8358 }
8359 //--------------------------------------------
8360 if (mask & VARIABLE_WET)
8361 {
8362 float wet = floats.Get(index);
8363 SetWet(wet);
8364 index++;
8365 }
8366 //--------------------------------------------
8367 if (mask & VARIABLE_LIQUIDTYPE)
8368 {
8369 int liquidtype = Math.Round(floats.Get(index));
8370 SetLiquidType(liquidtype);
8371 index++;
8372 }
8373 //--------------------------------------------
8374 if (mask & VARIABLE_COLOR)
8375 {
8376 m_ColorComponentR = Math.Round(floats.Get(index));
8377 index++;
8378 m_ColorComponentG = Math.Round(floats.Get(index));
8379 index++;
8380 m_ColorComponentB = Math.Round(floats.Get(index));
8381 index++;
8382 m_ColorComponentA = Math.Round(floats.Get(index));
8383 index++;
8384 }
8385 //--------------------------------------------
8386 if (mask & VARIABLE_CLEANNESS)
8387 {
8388 int cleanness = Math.Round(floats.Get(index));
8389 SetCleanness(cleanness);
8390 index++;
8391 }
8392 }
8393
8394 override void WriteVarsToCTX(ParamsWriteContext ctx)
8395 {
8396 super.WriteVarsToCTX(ctx);
8397
8398 //--------------------------------------------
8399 if (IsVariableSet(VARIABLE_QUANTITY))
8400 {
8401 ctx.Write(GetQuantity());
8402 }
8403 //--------------------------------------------
8404 if (IsVariableSet(VARIABLE_WET))
8405 {
8406 ctx.Write(GetWet());
8407 }
8408 //--------------------------------------------
8409 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
8410 {
8411 ctx.Write(GetLiquidType());
8412 }
8413 //--------------------------------------------
8414 if (IsVariableSet(VARIABLE_COLOR))
8415 {
8416 int r,g,b,a;
8417 GetColor(r,g,b,a);
8418 ctx.Write(r);
8419 ctx.Write(g);
8420 ctx.Write(b);
8421 ctx.Write(a);
8422 }
8423 //--------------------------------------------
8424 if (IsVariableSet(VARIABLE_CLEANNESS))
8425 {
8426 ctx.Write(GetCleanness());
8427 }
8428 }
8429
8430 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
8431 {
8432 if (!super.ReadVarsFromCTX(ctx,version))
8433 return false;
8434
8435 int intValue;
8436 float value;
8437
8438 if (version < 140)
8439 {
8440 if (!ctx.Read(intValue))
8441 return false;
8442
8443 m_VariablesMask = intValue;
8444 }
8445
8446 if (m_VariablesMask & VARIABLE_QUANTITY)
8447 {
8448 if (!ctx.Read(value))
8449 return false;
8450
8451 if (IsStoreLoad())
8452 {
8454 }
8455 else
8456 {
8457 SetQuantity(value, true, false, false, false);
8458 }
8459 }
8460 //--------------------------------------------
8461 if (version < 140)
8462 {
8463 if (m_VariablesMask & VARIABLE_TEMPERATURE)
8464 {
8465 if (!ctx.Read(value))
8466 return false;
8467 SetTemperatureDirect(value);
8468 }
8469 }
8470 //--------------------------------------------
8471 if (m_VariablesMask & VARIABLE_WET)
8472 {
8473 if (!ctx.Read(value))
8474 return false;
8475 SetWet(value);
8476 }
8477 //--------------------------------------------
8478 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
8479 {
8480 if (!ctx.Read(intValue))
8481 return false;
8482 SetLiquidType(intValue);
8483 }
8484 //--------------------------------------------
8485 if (m_VariablesMask & VARIABLE_COLOR)
8486 {
8487 int r,g,b,a;
8488 if (!ctx.Read(r))
8489 return false;
8490 if (!ctx.Read(g))
8491 return false;
8492 if (!ctx.Read(b))
8493 return false;
8494 if (!ctx.Read(a))
8495 return false;
8496
8497 SetColor(r,g,b,a);
8498 }
8499 //--------------------------------------------
8500 if (m_VariablesMask & VARIABLE_CLEANNESS)
8501 {
8502 if (!ctx.Read(intValue))
8503 return false;
8504 SetCleanness(intValue);
8505 }
8506 //--------------------------------------------
8507 if (version >= 138 && version < 140)
8508 {
8509 if (m_VariablesMask & VARIABLE_TEMPERATURE)
8510 {
8511 if (!ctx.Read(intValue))
8512 return false;
8513 SetFrozen(intValue);
8514 }
8515 }
8516
8517 return true;
8518 }
8519
8520 //----------------------------------------------------------------
8521 override bool OnStoreLoad(ParamsReadContext ctx, int version)
8522 {
8523 m_IsStoreLoad = true;
8525 {
8526 m_FixDamageSystemInit = true;
8527 }
8528
8529 if (!super.OnStoreLoad(ctx, version))
8530 {
8531 m_IsStoreLoad = false;
8532 return false;
8533 }
8534
8535 if (version >= 114)
8536 {
8537 bool hasQuickBarIndexSaved;
8538
8539 if (!ctx.Read(hasQuickBarIndexSaved))
8540 {
8541 m_IsStoreLoad = false;
8542 return false;
8543 }
8544
8545 if (hasQuickBarIndexSaved)
8546 {
8547 int itmQBIndex;
8548
8549 //Load quickbar item bind
8550 if (!ctx.Read(itmQBIndex))
8551 {
8552 m_IsStoreLoad = false;
8553 return false;
8554 }
8555
8556 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8557 if (itmQBIndex != -1 && parentPlayer)
8558 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8559 }
8560 }
8561 else
8562 {
8563 // Backup of how it used to be
8564 PlayerBase player;
8565 int itemQBIndex;
8566 if (version == int.MAX)
8567 {
8568 if (!ctx.Read(itemQBIndex))
8569 {
8570 m_IsStoreLoad = false;
8571 return false;
8572 }
8573 }
8574 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8575 {
8576 //Load quickbar item bind
8577 if (!ctx.Read(itemQBIndex))
8578 {
8579 m_IsStoreLoad = false;
8580 return false;
8581 }
8582 if (itemQBIndex != -1 && player)
8583 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8584 }
8585 }
8586
8587 if (version < 140)
8588 {
8589 // variable management system
8590 if (!LoadVariables(ctx, version))
8591 {
8592 m_IsStoreLoad = false;
8593 return false;
8594 }
8595 }
8596
8597 //agent trasmission system
8598 if (!LoadAgents(ctx, version))
8599 {
8600 m_IsStoreLoad = false;
8601 return false;
8602 }
8603 if (version >= 132)
8604 {
8605 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
8606 if (raib)
8607 {
8608 if (!raib.OnStoreLoad(ctx,version))
8609 {
8610 m_IsStoreLoad = false;
8611 return false;
8612 }
8613 }
8614 }
8615
8616 m_IsStoreLoad = false;
8617 return true;
8618 }
8619
8620 //----------------------------------------------------------------
8621
8622 override void OnStoreSave(ParamsWriteContext ctx)
8623 {
8624 super.OnStoreSave(ctx);
8625
8626 PlayerBase player;
8627 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8628 {
8629 ctx.Write(true); // Keep track of if we should actually read this in or not
8630 //Save quickbar item bind
8631 int itemQBIndex = -1;
8632 itemQBIndex = player.FindQuickBarEntityIndex(this);
8633 ctx.Write(itemQBIndex);
8634 }
8635 else
8636 {
8637 ctx.Write(false); // Keep track of if we should actually read this in or not
8638 }
8639
8640 SaveAgents(ctx);//agent trasmission system
8641
8642 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
8643 if (raib)
8644 {
8645 raib.OnStoreSave(ctx);
8646 }
8647 }
8648 //----------------------------------------------------------------
8649
8650 override void AfterStoreLoad()
8651 {
8652 super.AfterStoreLoad();
8653
8655 {
8657 }
8658
8659 if (GetStoreLoadedQuantity() != float.LOWEST)
8660 {
8662 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
8663 }
8664 }
8665
8666 override void EEOnAfterLoad()
8667 {
8668 super.EEOnAfterLoad();
8669
8671 {
8672 m_FixDamageSystemInit = false;
8673 }
8674
8677 }
8678
8679 bool CanBeDisinfected()
8680 {
8681 return false;
8682 }
8683
8684
8685 //----------------------------------------------------------------
8686 override void OnVariablesSynchronized()
8687 {
8688 if (m_Initialized)
8689 {
8690 #ifdef PLATFORM_CONSOLE
8691 //bruteforce it is
8692 if (IsSplitable())
8693 {
8694 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
8695 if (menu)
8696 {
8697 menu.Refresh();
8698 }
8699 }
8700 #endif
8701 }
8702
8704 {
8705 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
8706 m_WantPlayImpactSound = false;
8707 }
8708
8710 {
8711 SetWeightDirty();
8713 }
8714 if (m_VarWet != m_VarWetPrev)
8715 {
8718 }
8719
8720 if (m_SoundSyncPlay != 0)
8721 {
8722 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
8723 m_SoundSyncPlay = 0;
8724 }
8725 if (m_SoundSyncStop != 0)
8726 {
8727 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
8728 m_SoundSyncStop = 0;
8729 }
8730
8731 super.OnVariablesSynchronized();
8732 }
8733
8734 //------------------------- Quantity
8735 //----------------------------------------------------------------
8737 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
8738 {
8739 if (!IsServerCheck(allow_client))
8740 return false;
8741
8742 if (!HasQuantity())
8743 return false;
8744
8745 float min = GetQuantityMin();
8746 float max = GetQuantityMax();
8747
8748 if (value <= (min + 0.001))
8749 value = min;
8750
8751 if (value == min)
8752 {
8753 if (destroy_config)
8754 {
8755 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8756 if (dstr)
8757 {
8758 m_VarQuantity = Math.Clamp(value, min, max);
8759 this.Delete();
8760 return true;
8761 }
8762 }
8763 else if (destroy_forced)
8764 {
8765 m_VarQuantity = Math.Clamp(value, min, max);
8766 this.Delete();
8767 return true;
8768 }
8769 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
8770 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
8771 }
8772
8773 float delta = m_VarQuantity;
8774 m_VarQuantity = Math.Clamp(value, min, max);
8775
8776 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
8777 {
8778 delta = m_VarQuantity - delta;
8779
8780 if (delta)
8781 OnQuantityChanged(delta);
8782 }
8783
8784 SetVariableMask(VARIABLE_QUANTITY);
8785
8786 return false;
8787 }
8788
8789 //----------------------------------------------------------------
8791 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
8792 {
8793 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
8794 }
8795 //----------------------------------------------------------------
8796 void SetQuantityMax()
8797 {
8798 float max = GetQuantityMax();
8799 SetQuantity(max);
8800 }
8801
8802 override void SetQuantityToMinimum()
8803 {
8804 float min = GetQuantityMin();
8805 SetQuantity(min);
8806 }
8807 //----------------------------------------------------------------
8809 void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
8810 {
8811 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
8812 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
8813 SetQuantity(result, destroy_config, destroy_forced);
8814 }
8815
8816 //----------------------------------------------------------------
8818 override float GetQuantityNormalized()
8819 {
8820 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
8821 }
8822
8824 {
8825 return GetQuantityNormalized();
8826 }
8827
8828 /*void SetAmmoNormalized(float value)
8829 {
8830 float value_clamped = Math.Clamp(value, 0, 1);
8831 Magazine this_mag = Magazine.Cast(this);
8832 int max_rounds = this_mag.GetAmmoMax();
8833 int result = value * max_rounds;//can the rounded if higher precision is required
8834 this_mag.SetAmmoCount(result);
8835 }*/
8836 //----------------------------------------------------------------
8837 override int GetQuantityMax()
8838 {
8839 int slot = -1;
8840 if (GetInventory())
8841 {
8842 InventoryLocation il = new InventoryLocation;
8843 GetInventory().GetCurrentInventoryLocation(il);
8844 slot = il.GetSlot();
8845 }
8846
8847 return GetTargetQuantityMax(slot);
8848 }
8849
8850 override int GetTargetQuantityMax(int attSlotID = -1)
8851 {
8852 float quantity_max = 0;
8853
8854 if (IsSplitable()) //only stackable/splitable items can check for stack size
8855 {
8856 if (attSlotID != -1)
8857 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8858
8859 if (quantity_max <= 0)
8860 quantity_max = m_VarStackMax;
8861 }
8862
8863 if (quantity_max <= 0)
8864 quantity_max = m_VarQuantityMax;
8865
8866 return quantity_max;
8867 }
8868 //----------------------------------------------------------------
8869 override int GetQuantityMin()
8870 {
8871 return m_VarQuantityMin;
8872 }
8873 //----------------------------------------------------------------
8874 int GetQuantityInit()
8875 {
8876 return m_VarQuantityInit;
8877 }
8878
8879 //----------------------------------------------------------------
8880 override bool HasQuantity()
8881 {
8882 return !(GetQuantityMax() - GetQuantityMin() == 0);
8883 }
8884
8885 override float GetQuantity()
8886 {
8887 return m_VarQuantity;
8888 }
8889
8890 bool IsFullQuantity()
8891 {
8892 return GetQuantity() >= GetQuantityMax();
8893 }
8894
8895 //Calculates weight of single item without attachments and cargo
8896 override float GetSingleInventoryItemWeightEx()
8897 {
8898 //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
8899 float weightEx = GetWeightEx();//overall weight of the item
8900 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
8901 return weightEx - special;
8902 }
8903
8904 // Obsolete, use GetSingleInventoryItemWeightEx() instead
8906 {
8908 }
8909
8910 override protected float GetWeightSpecialized(bool forceRecalc = false)
8911 {
8912 if (IsSplitable()) //quantity determines size of the stack
8913 {
8914 #ifdef DEVELOPER
8915 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8916 {
8917 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
8918 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
8919 }
8920 #endif
8921
8922 return GetQuantity() * GetConfigWeightModified();
8923 }
8924 else if (HasEnergyManager())// items with energy manager
8925 {
8926 #ifdef DEVELOPER
8927 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8928 {
8929 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
8930 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
8931 }
8932 #endif
8933 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
8934 }
8935 else//everything else
8936 {
8937 #ifdef DEVELOPER
8938 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8939 {
8940 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
8941 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
8942 }
8943 #endif
8944 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
8945 }
8946 }
8947
8949 int GetNumberOfItems()
8950 {
8951 int item_count = 0;
8952 ItemBase item;
8953
8954 if (GetInventory().GetCargo() != NULL)
8955 {
8956 item_count = GetInventory().GetCargo().GetItemCount();
8957 }
8958
8959 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
8960 {
8961 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
8962 if (item)
8963 item_count += item.GetNumberOfItems();
8964 }
8965 return item_count;
8966 }
8967
8969 float GetUnitWeight(bool include_wetness = true)
8970 {
8971 float weight = 0;
8972 float wetness = 1;
8973 if (include_wetness)
8974 wetness += GetWet();
8975 if (IsSplitable()) //quantity determines size of the stack
8976 {
8977 weight = wetness * m_ConfigWeight;
8978 }
8979 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
8980 {
8981 weight = 1;
8982 }
8983 return weight;
8984 }
8985
8986 //-----------------------------------------------------------------
8987
8988 override void ClearInventory()
8989 {
8990 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
8991 {
8992 GameInventory inv = GetInventory();
8993 array<EntityAI> items = new array<EntityAI>;
8994 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
8995 for (int i = 0; i < items.Count(); i++)
8996 {
8997 ItemBase item = ItemBase.Cast(items.Get(i));
8998 if (item)
8999 {
9000 GetGame().ObjectDelete(item);
9001 }
9002 }
9003 }
9004 }
9005
9006 //------------------------- Energy
9007
9008 //----------------------------------------------------------------
9009 float GetEnergy()
9010 {
9011 float energy = 0;
9012 if (HasEnergyManager())
9013 {
9014 energy = GetCompEM().GetEnergy();
9015 }
9016 return energy;
9017 }
9018
9019
9020 override void OnEnergyConsumed()
9021 {
9022 super.OnEnergyConsumed();
9023
9025 }
9026
9027 override void OnEnergyAdded()
9028 {
9029 super.OnEnergyAdded();
9030
9032 }
9033
9034 // Converts energy (from Energy Manager) to quantity, if enabled.
9036 {
9037 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9038 {
9039 if (HasQuantity())
9040 {
9041 float energy_0to1 = GetCompEM().GetEnergy0To1();
9042 SetQuantityNormalized(energy_0to1);
9043 }
9044 }
9045 }
9046
9047 //----------------------------------------------------------------
9048 float GetHeatIsolationInit()
9049 {
9050 return ConfigGetFloat("heatIsolation");
9051 }
9052
9053 float GetHeatIsolation()
9054 {
9055 return m_HeatIsolation;
9056 }
9057
9058 float GetDryingIncrement(string pIncrementName)
9059 {
9060 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
9061 if (GetGame().ConfigIsExisting(paramPath))
9062 return GetGame().ConfigGetFloat(paramPath);
9063
9064 return 0.0;
9065 }
9066
9067 float GetSoakingIncrement(string pIncrementName)
9068 {
9069 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
9070 if (GetGame().ConfigIsExisting(paramPath))
9071 return GetGame().ConfigGetFloat(paramPath);
9072
9073 return 0.0;
9074 }
9075 //----------------------------------------------------------------
9076 override void SetWet(float value, bool allow_client = false)
9077 {
9078 if (!IsServerCheck(allow_client))
9079 return;
9080
9081 float min = GetWetMin();
9082 float max = GetWetMax();
9083
9084 float previousValue = m_VarWet;
9085
9086 m_VarWet = Math.Clamp(value, min, max);
9087
9088 if (previousValue != m_VarWet)
9089 {
9090 SetVariableMask(VARIABLE_WET);
9091 OnWetChanged(m_VarWet, previousValue);
9092 }
9093 }
9094 //----------------------------------------------------------------
9095 override void AddWet(float value)
9096 {
9097 SetWet(GetWet() + value);
9098 }
9099 //----------------------------------------------------------------
9100 override void SetWetMax()
9101 {
9103 }
9104 //----------------------------------------------------------------
9105 override float GetWet()
9106 {
9107 return m_VarWet;
9108 }
9109 //----------------------------------------------------------------
9110 override float GetWetMax()
9111 {
9112 return m_VarWetMax;
9113 }
9114 //----------------------------------------------------------------
9115 override float GetWetMin()
9116 {
9117 return m_VarWetMin;
9118 }
9119 //----------------------------------------------------------------
9120 override float GetWetInit()
9121 {
9122 return m_VarWetInit;
9123 }
9124 //----------------------------------------------------------------
9125 override void OnWetChanged(float newVal, float oldVal)
9126 {
9127 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
9128 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
9129 if (newLevel != oldLevel)
9130 {
9131 OnWetLevelChanged(newLevel,oldLevel);
9132 }
9133 }
9134
9135 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
9136 {
9137 SetWeightDirty();
9138 }
9139
9140 override EWetnessLevel GetWetLevel()
9141 {
9142 return GetWetLevelInternal(m_VarWet);
9143 }
9144
9145 //----------------------------------------------------------------
9146
9147 override void SetStoreLoad(bool value)
9148 {
9149 m_IsStoreLoad = value;
9150 }
9151
9152 override bool IsStoreLoad()
9153 {
9154 return m_IsStoreLoad;
9155 }
9156
9157 override void SetStoreLoadedQuantity(float value)
9158 {
9159 m_StoreLoadedQuantity = value;
9160 }
9161
9162 override float GetStoreLoadedQuantity()
9163 {
9164 return m_StoreLoadedQuantity;
9165 }
9166
9167 //----------------------------------------------------------------
9168
9169 float GetItemModelLength()
9170 {
9171 if (ConfigIsExisting("itemModelLength"))
9172 {
9173 return ConfigGetFloat("itemModelLength");
9174 }
9175 return 0;
9176 }
9177
9178 float GetItemAttachOffset()
9179 {
9180 if (ConfigIsExisting("itemAttachOffset"))
9181 {
9182 return ConfigGetFloat("itemAttachOffset");
9183 }
9184 return 0;
9185 }
9186
9187 override void SetCleanness(int value, bool allow_client = false)
9188 {
9189 if (!IsServerCheck(allow_client))
9190 return;
9191
9192 int previousValue = m_Cleanness;
9193
9194 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
9195
9196 if (previousValue != m_Cleanness)
9197 SetVariableMask(VARIABLE_CLEANNESS);
9198 }
9199
9200 override int GetCleanness()
9201 {
9202 return m_Cleanness;
9203 }
9204
9206 {
9207 return true;
9208 }
9209
9210 //----------------------------------------------------------------
9211 // ATTACHMENT LOCKING
9212 // Getters relevant to generic ActionLockAttachment
9213 int GetLockType()
9214 {
9215 return m_LockType;
9216 }
9217
9218 string GetLockSoundSet()
9219 {
9220 return m_LockSoundSet;
9221 }
9222
9223 //----------------------------------------------------------------
9224 //------------------------- Color
9225 // sets items color variable given color components
9226 override void SetColor(int r, int g, int b, int a)
9227 {
9232 SetVariableMask(VARIABLE_COLOR);
9233 }
9235 override void GetColor(out int r,out int g,out int b,out int a)
9236 {
9241 }
9242
9243 bool IsColorSet()
9244 {
9245 return IsVariableSet(VARIABLE_COLOR);
9246 }
9247
9249 string GetColorString()
9250 {
9251 int r,g,b,a;
9252 GetColor(r,g,b,a);
9253 r = r/255;
9254 g = g/255;
9255 b = b/255;
9256 a = a/255;
9257 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9258 }
9259 //----------------------------------------------------------------
9260 //------------------------- LiquidType
9261
9262 override void SetLiquidType(int value, bool allow_client = false)
9263 {
9264 if (!IsServerCheck(allow_client))
9265 return;
9266
9267 int old = m_VarLiquidType;
9268 m_VarLiquidType = value;
9269 OnLiquidTypeChanged(old,value);
9270 SetVariableMask(VARIABLE_LIQUIDTYPE);
9271 }
9272
9273 int GetLiquidTypeInit()
9274 {
9275 return ConfigGetInt("varLiquidTypeInit");
9276 }
9277
9278 override int GetLiquidType()
9279 {
9280 return m_VarLiquidType;
9281 }
9282
9283 protected void OnLiquidTypeChanged(int oldType, int newType)
9284 {
9285 if (newType == LIQUID_NONE && GetIsFrozen())
9286 SetFrozen(false);
9287 }
9288
9290 void UpdateQuickbarShortcutVisibility(PlayerBase player)
9291 {
9292 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9293 }
9294
9295 // -------------------------------------------------------------------------
9297 void OnInventoryEnter(Man player)
9298 {
9299 PlayerBase nplayer;
9300 if (PlayerBase.CastTo(nplayer, player))
9301 {
9302 m_CanPlayImpactSound = true;
9303 //nplayer.OnItemInventoryEnter(this);
9304 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9305 }
9306 }
9307
9308 // -------------------------------------------------------------------------
9310 void OnInventoryExit(Man player)
9311 {
9312 PlayerBase nplayer;
9313 if (PlayerBase.CastTo(nplayer,player))
9314 {
9315 //nplayer.OnItemInventoryExit(this);
9316 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9317
9318 }
9319
9320 //if (!GetGame().IsDedicatedServer())
9321 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9322
9323
9324 if (HasEnergyManager())
9325 {
9326 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
9327 }
9328 }
9329
9330 // ADVANCED PLACEMENT EVENTS
9331 override void OnPlacementStarted(Man player)
9332 {
9333 super.OnPlacementStarted(player);
9334
9335 SetTakeable(false);
9336 }
9337
9338 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
9339 {
9340 if (m_AdminLog)
9341 {
9342 m_AdminLog.OnPlacementComplete(player, this);
9343 }
9344
9345 super.OnPlacementComplete(player, position, orientation);
9346 }
9347
9348 //-----------------------------
9349 // AGENT SYSTEM
9350 //-----------------------------
9351 //--------------------------------------------------------------------------
9352 bool ContainsAgent(int agent_id)
9353 {
9354 if (agent_id & m_AttachedAgents)
9355 {
9356 return true;
9357 }
9358 else
9359 {
9360 return false;
9361 }
9362 }
9363
9364 //--------------------------------------------------------------------------
9365 override void RemoveAgent(int agent_id)
9366 {
9367 if (ContainsAgent(agent_id))
9368 {
9369 m_AttachedAgents = ~agent_id & m_AttachedAgents;
9370 }
9371 }
9372
9373 //--------------------------------------------------------------------------
9374 override void RemoveAllAgents()
9375 {
9376 m_AttachedAgents = 0;
9377 }
9378 //--------------------------------------------------------------------------
9379 override void RemoveAllAgentsExcept(int agent_to_keep)
9380 {
9381 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
9382 }
9383 // -------------------------------------------------------------------------
9384 override void InsertAgent(int agent, float count = 1)
9385 {
9386 if (count < 1)
9387 return;
9388 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
9390 }
9391
9393 void TransferAgents(int agents)
9394 {
9396 }
9397
9398 // -------------------------------------------------------------------------
9399 override int GetAgents()
9400 {
9401 return m_AttachedAgents;
9402 }
9403 //----------------------------------------------------------------------
9404
9405 /*int GetContaminationType()
9406 {
9407 int contamination_type;
9408
9409 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
9410 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
9411 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
9412 const int DIRTY_MASK = eAgents.WOUND_AGENT;
9413
9414 Edible_Base edible = Edible_Base.Cast(this);
9415 int agents = GetAgents();
9416 if (edible)
9417 {
9418 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
9419 if (profile)
9420 {
9421 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
9422 }
9423 }
9424 if (agents & CONTAMINATED_MASK)
9425 {
9426 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
9427 }
9428 if (agents & POISONED_MASK)
9429 {
9430 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
9431 }
9432 if (agents & NERVE_GAS_MASK)
9433 {
9434 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
9435 }
9436 if (agents & DIRTY_MASK)
9437 {
9438 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
9439 }
9440
9441 return agents;
9442 }*/
9443
9444 // -------------------------------------------------------------------------
9445 bool LoadAgents(ParamsReadContext ctx, int version)
9446 {
9447 if (!ctx.Read(m_AttachedAgents))
9448 return false;
9449 return true;
9450 }
9451 // -------------------------------------------------------------------------
9453 {
9454
9456 }
9457 // -------------------------------------------------------------------------
9458
9460 override void CheckForRoofLimited(float timeTresholdMS = 3000)
9461 {
9462 super.CheckForRoofLimited(timeTresholdMS);
9463
9464 float time = GetGame().GetTime();
9465 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9466 {
9467 m_PreviousRoofTestTime = time;
9468 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9469 }
9470 }
9471
9472 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
9473 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
9474 {
9475 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
9476 {
9477 return 0;
9478 }
9479
9480 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
9481 {
9482 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
9483 if (filter)
9484 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
9485 else
9486 return 0;//otherwise return 0 when no filter attached
9487 }
9488
9489 string subclassPath, entryName;
9490
9491 switch (type)
9492 {
9493 case DEF_BIOLOGICAL:
9494 entryName = "biological";
9495 break;
9496 case DEF_CHEMICAL:
9497 entryName = "chemical";
9498 break;
9499 default:
9500 entryName = "biological";
9501 break;
9502 }
9503
9504 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
9505
9506 return GetGame().ConfigGetFloat(subclassPath + entryName);
9507 }
9508
9509
9510
9512 override void EEOnCECreate()
9513 {
9514 if (!IsMagazine())
9516
9518 }
9519
9520
9521 //-------------------------
9522 // OPEN/CLOSE USER ACTIONS
9523 //-------------------------
9525 void Open();
9526 void Close();
9527 bool IsOpen()
9528 {
9529 return true;
9530 }
9531
9532 override bool CanDisplayCargo()
9533 {
9534 return IsOpen();
9535 }
9536
9537
9538 // ------------------------------------------------------------
9539 // CONDITIONS
9540 // ------------------------------------------------------------
9541 override bool CanPutInCargo(EntityAI parent)
9542 {
9543 if (parent)
9544 {
9545 if (parent.IsInherited(DayZInfected))
9546 return true;
9547
9548 if (!parent.IsRuined())
9549 return true;
9550 }
9551
9552 return true;
9553 }
9554
9555 override bool CanPutAsAttachment(EntityAI parent)
9556 {
9557 if (!super.CanPutAsAttachment(parent))
9558 {
9559 return false;
9560 }
9561
9562 if (!IsRuined() && !parent.IsRuined())
9563 {
9564 return true;
9565 }
9566
9567 return false;
9568 }
9569
9570 override bool CanReceiveItemIntoCargo(EntityAI item)
9571 {
9572 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
9573 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
9574 // return false;
9575
9576 return super.CanReceiveItemIntoCargo(item);
9577 }
9578
9579 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
9580 {
9581 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
9582 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
9583 // return false;
9584
9585 GameInventory attachmentInv = attachment.GetInventory();
9586 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
9587 {
9588 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9589 return false;
9590 }
9591
9592 InventoryLocation loc = new InventoryLocation();
9593 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9594 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
9595 return false;
9596
9597 return super.CanReceiveAttachment(attachment, slotId);
9598 }
9599
9600 override bool CanReleaseAttachment(EntityAI attachment)
9601 {
9602 if (!super.CanReleaseAttachment(attachment))
9603 return false;
9604
9605 return GetInventory().AreChildrenAccessible();
9606 }
9607
9608 /*override bool CanLoadAttachment(EntityAI attachment)
9609 {
9610 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
9611 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
9612 // return false;
9613
9614 GameInventory attachmentInv = attachment.GetInventory();
9615 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
9616 {
9617 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
9618 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
9619
9620 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9621 return false;
9622 }
9623
9624 return super.CanLoadAttachment(attachment);
9625 }*/
9626
9627 // Plays muzzle flash particle effects
9628 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9629 {
9630 int id = muzzle_owner.GetMuzzleID();
9631 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
9632
9633 if (WPOF_array)
9634 {
9635 for (int i = 0; i < WPOF_array.Count(); i++)
9636 {
9637 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9638
9639 if (WPOF)
9640 {
9641 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9642 }
9643 }
9644 }
9645 }
9646
9647 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
9648 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9649 {
9650 int id = muzzle_owner.GetMuzzleID();
9651 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
9652
9653 if (WPOBE_array)
9654 {
9655 for (int i = 0; i < WPOBE_array.Count(); i++)
9656 {
9657 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9658
9659 if (WPOBE)
9660 {
9661 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9662 }
9663 }
9664 }
9665 }
9666
9667 // Plays all weapon overheating particles
9668 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9669 {
9670 int id = muzzle_owner.GetMuzzleID();
9671 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9672
9673 if (WPOOH_array)
9674 {
9675 for (int i = 0; i < WPOOH_array.Count(); i++)
9676 {
9677 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9678
9679 if (WPOOH)
9680 {
9681 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9682 }
9683 }
9684 }
9685 }
9686
9687 // Updates all weapon overheating particles
9688 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9689 {
9690 int id = muzzle_owner.GetMuzzleID();
9691 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9692
9693 if (WPOOH_array)
9694 {
9695 for (int i = 0; i < WPOOH_array.Count(); i++)
9696 {
9697 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9698
9699 if (WPOOH)
9700 {
9701 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9702 }
9703 }
9704 }
9705 }
9706
9707 // Stops overheating particles
9708 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9709 {
9710 int id = muzzle_owner.GetMuzzleID();
9711 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9712
9713 if (WPOOH_array)
9714 {
9715 for (int i = 0; i < WPOOH_array.Count(); i++)
9716 {
9717 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9718
9719 if (WPOOH)
9720 {
9721 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9722 }
9723 }
9724 }
9725 }
9726
9727 //----------------------------------------------------------------
9728 //Item Behaviour - unified approach
9729 override bool IsHeavyBehaviour()
9730 {
9731 if (m_ItemBehaviour == 0)
9732 {
9733 return true;
9734 }
9735
9736 return false;
9737 }
9738
9739 override bool IsOneHandedBehaviour()
9740 {
9741 if (m_ItemBehaviour == 1)
9742 {
9743 return true;
9744 }
9745
9746 return false;
9747 }
9748
9749 override bool IsTwoHandedBehaviour()
9750 {
9751 if (m_ItemBehaviour == 2)
9752 {
9753 return true;
9754 }
9755
9756 return false;
9757 }
9758
9759 bool IsDeployable()
9760 {
9761 return false;
9762 }
9763
9765 float GetDeployTime()
9766 {
9767 return UATimeSpent.DEFAULT_DEPLOY;
9768 }
9769
9770
9771 //----------------------------------------------------------------
9772 // Item Targeting (User Actions)
9773 override void SetTakeable(bool pState)
9774 {
9775 m_IsTakeable = pState;
9776 SetSynchDirty();
9777 }
9778
9779 override bool IsTakeable()
9780 {
9781 return m_IsTakeable;
9782 }
9783
9784 // For cases where we want to show object widget which cant be taken to hands
9786 {
9787 return false;
9788 }
9789
9791 protected void PreLoadSoundAttachmentType()
9792 {
9793 string att_type = "None";
9794
9795 if (ConfigIsExisting("soundAttType"))
9796 {
9797 att_type = ConfigGetString("soundAttType");
9798 }
9799
9800 m_SoundAttType = att_type;
9801 }
9802
9803 override string GetAttachmentSoundType()
9804 {
9805 return m_SoundAttType;
9806 }
9807
9808 //----------------------------------------------------------------
9809 //SOUNDS - ItemSoundHandler
9810 //----------------------------------------------------------------
9811
9812 string GetPlaceSoundset(); // played when deploy starts
9813 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
9814 string GetDeploySoundset(); // played when deploy sucessfully finishes
9815
9817 {
9818 if (!m_ItemSoundHandler)
9820
9821 return m_ItemSoundHandler;
9822 }
9823
9824 // override to initialize sounds
9825 protected void InitItemSounds()
9826 {
9827 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
9828 return;
9829
9831
9832 if (GetPlaceSoundset() != string.Empty)
9833 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
9834
9835 if (GetDeploySoundset() != string.Empty)
9836 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
9837
9838 SoundParameters params = new SoundParameters();
9839 params.m_Loop = true;
9840 if (GetLoopDeploySoundset() != string.Empty)
9841 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
9842 }
9843
9844 // Start sound using ItemSoundHandler
9845 void StartItemSoundServer(int id)
9846 {
9847 if (!GetGame().IsServer())
9848 return;
9849
9850 m_SoundSyncPlay = id;
9851 SetSynchDirty();
9852
9853 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
9855 }
9856
9857 // Stop sound using ItemSoundHandler
9858 void StopItemSoundServer(int id)
9859 {
9860 if (!GetGame().IsServer())
9861 return;
9862
9863 m_SoundSyncStop = id;
9864 SetSynchDirty();
9865
9866 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
9868 }
9869
9870 protected void ClearStartItemSoundServer()
9871 {
9872 m_SoundSyncPlay = 0;
9873 }
9874
9875 protected void ClearStopItemSoundServer()
9876 {
9877 m_SoundSyncStop = 0;
9878 }
9879
9881 void PlayAttachSound(string slot_type)
9882 {
9883 if (!GetGame().IsDedicatedServer())
9884 {
9885 if (ConfigIsExisting("attachSoundSet"))
9886 {
9887 string cfg_path = "";
9888 string soundset = "";
9889 string type_name = GetType();
9890
9891 TStringArray cfg_soundset_array = new TStringArray;
9892 TStringArray cfg_slot_array = new TStringArray;
9893 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
9894 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
9895
9896 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
9897 {
9898 for (int i = 0; i < cfg_soundset_array.Count(); i++)
9899 {
9900 if (cfg_slot_array[i] == slot_type)
9901 {
9902 soundset = cfg_soundset_array[i];
9903 break;
9904 }
9905 }
9906 }
9907
9908 if (soundset != "")
9909 {
9910 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
9911 sound.SetAutodestroy(true);
9912 }
9913 }
9914 }
9915 }
9916
9917 void PlayDetachSound(string slot_type)
9918 {
9919 //TODO - evaluate if needed and devise universal config structure if so
9920 }
9921
9922 void OnApply(PlayerBase player);
9923
9925 {
9926 return 1.0;
9927 };
9928 //returns applicable selection
9929 array<string> GetHeadHidingSelection()
9930 {
9932 }
9933
9935 {
9937 }
9938
9939 WrittenNoteData GetWrittenNoteData() {};
9940
9942 {
9943 SetDynamicPhysicsLifeTime(0.01);
9944 m_ItemBeingDroppedPhys = false;
9945 }
9946
9948 {
9949 array<string> zone_names = new array<string>;
9950 GetDamageZones(zone_names);
9951 for (int i = 0; i < zone_names.Count(); i++)
9952 {
9953 SetHealthMax(zone_names.Get(i),"Health");
9954 }
9955 SetHealthMax("","Health");
9956 }
9957
9959 void SetZoneDamageCEInit()
9960 {
9961 float global_health = GetHealth01("","Health");
9962 array<string> zones = new array<string>;
9963 GetDamageZones(zones);
9964 //set damage of all zones to match global health level
9965 for (int i = 0; i < zones.Count(); i++)
9966 {
9967 SetHealth01(zones.Get(i),"Health",global_health);
9968 }
9969 }
9970
9972 bool IsCoverFaceForShave(string slot_name)
9973 {
9974 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
9975 }
9976
9977 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
9978 {
9979 if (!hasRootAsPlayer)
9980 {
9981 if (refParentIB)
9982 {
9983 // parent is wet
9984 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
9985 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
9986 // parent has liquid inside
9987 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
9988 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
9989 // drying
9990 else if (m_VarWet > m_VarWetMin)
9991 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
9992 }
9993 else
9994 {
9995 // drying on ground or inside non-itembase (car, ...)
9996 if (m_VarWet > m_VarWetMin)
9997 AddWet(-1 * delta * GetDryingIncrement("ground"));
9998 }
9999 }
10000 }
10001
10002 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
10003 {
10005 {
10006 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
10007 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
10008 {
10009 float heatPermCoef = 1.0;
10010 EntityAI ent = this;
10011 while (ent)
10012 {
10013 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10014 ent = ent.GetHierarchyParent();
10015 }
10016
10017 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10018 }
10019 }
10020 }
10021
10022 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
10023 {
10024 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
10025 EntityAI parent = GetHierarchyParent();
10026 if (!parent)
10027 {
10028 hasParent = false;
10029 hasRootAsPlayer = false;
10030 }
10031 else
10032 {
10033 hasParent = true;
10034 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10035 refParentIB = ItemBase.Cast(parent);
10036 }
10037 }
10038
10039 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
10040 {
10041 // this is stub, implemented on Edible_Base
10042 }
10043
10044 bool CanDecay()
10045 {
10046 // return true used on selected food clases so they can decay
10047 return false;
10048 }
10049
10050 protected bool CanProcessDecay()
10051 {
10052 // this is stub, implemented on Edible_Base class
10053 // used to determine whether it is still necessary for the food to decay
10054 return false;
10055 }
10056
10057 protected bool CanHaveWetness()
10058 {
10059 // return true used on selected items that have a wetness effect
10060 return false;
10061 }
10062
10064 bool CanBeConsumed(ConsumeConditionData data = null)
10065 {
10066 return !GetIsFrozen() && IsOpen();
10067 }
10068
10069 override void ProcessVariables()
10070 {
10071 bool hasParent = false, hasRootAsPlayer = false;
10072 ItemBase refParentIB;
10073
10074 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
10075 bool foodDecay = g_Game.IsFoodDecayEnabled();
10076
10077 if (wwtu || foodDecay)
10078 {
10079 bool processWetness = wwtu && CanHaveWetness();
10080 bool processTemperature = wwtu && CanHaveTemperature();
10081 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
10082
10083 if (processWetness || processTemperature || processDecay)
10084 {
10085 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
10086
10087 if (processWetness)
10088 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10089
10090 if (processTemperature)
10091 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10092
10093 if (processDecay)
10094 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10095 }
10096 }
10097 }
10098
10101 {
10102 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
10103 }
10104
10105 override float GetTemperatureFreezeThreshold()
10106 {
10108 return Liquid.GetFreezeThreshold(GetLiquidType());
10109
10110 return super.GetTemperatureFreezeThreshold();
10111 }
10112
10113 override float GetTemperatureThawThreshold()
10114 {
10116 return Liquid.GetThawThreshold(GetLiquidType());
10117
10118 return super.GetTemperatureThawThreshold();
10119 }
10120
10121 override float GetItemOverheatThreshold()
10122 {
10124 return Liquid.GetBoilThreshold(GetLiquidType());
10125
10126 return super.GetItemOverheatThreshold();
10127 }
10128
10129 override float GetTemperatureFreezeTime()
10130 {
10131 if (HasQuantity())
10132 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
10133
10134 return super.GetTemperatureFreezeTime();
10135 }
10136
10137 override float GetTemperatureThawTime()
10138 {
10139 if (HasQuantity())
10140 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
10141
10142 return super.GetTemperatureThawTime();
10143 }
10144
10146 void AffectLiquidContainerOnFill(int liquid_type, float amount);
10148 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
10149
10150 bool IsCargoException4x3(EntityAI item)
10151 {
10152 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10153 }
10154
10156 {
10157 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10158 }
10159
10161 void AddLightSourceItem(ItemBase lightsource)
10162 {
10163 m_LightSourceItem = lightsource;
10164 }
10165
10167 {
10168 m_LightSourceItem = null;
10169 }
10170
10172 {
10173 return m_LightSourceItem;
10174 }
10175
10177 array<int> GetValidFinishers()
10178 {
10179 return null;
10180 }
10181
10183 bool GetActionWidgetOverride(out typename name)
10184 {
10185 return false;
10186 }
10187
10188 bool PairWithDevice(notnull ItemBase otherDevice)
10189 {
10190 if (GetGame().IsServer())
10191 {
10192 ItemBase explosive = otherDevice;
10194 if (!trg)
10195 {
10196 trg = RemoteDetonatorTrigger.Cast(otherDevice);
10197 explosive = this;
10198 }
10199
10200 explosive.PairRemote(trg);
10201 trg.SetControlledDevice(explosive);
10202
10203 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10204 trg.SetPersistentPairID(persistentID);
10205 explosive.SetPersistentPairID(persistentID);
10206
10207 return true;
10208 }
10209 return false;
10210 }
10211
10213 float GetBaitEffectivity()
10214 {
10215 float ret = 1.0;
10216 if (HasQuantity())
10217 ret *= GetQuantityNormalized();
10218 ret *= GetHealth01();
10219
10220 return ret;
10221 }
10222
10223 #ifdef DEVELOPER
10224 override void SetDebugItem()
10225 {
10226 super.SetDebugItem();
10227 _itemBase = this;
10228 }
10229
10230 override string GetDebugText()
10231 {
10232 string text = super.GetDebugText();
10233
10234 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
10235 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
10236
10237 return text;
10238 }
10239 #endif
10240
10241 bool CanBeUsedForSuicide()
10242 {
10243 return true;
10244 }
10245
10247 //DEPRECATED BELOW
10249 // Backwards compatibility
10250 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
10251 {
10252 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
10253 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
10254 }
10255
10256 // replaced by ItemSoundHandler
10257 protected EffectSound m_SoundDeployFinish;
10258 protected EffectSound m_SoundPlace;
10259 protected EffectSound m_DeployLoopSoundEx;
10260 protected EffectSound m_SoundDeploy;
10261 bool m_IsPlaceSound;
10262 bool m_IsDeploySound;
10264
10265 string GetDeployFinishSoundset();
10266 void PlayDeploySound();
10267 void PlayDeployFinishSound();
10268 void PlayPlaceSound();
10269 void PlayDeployLoopSoundEx();
10270 void StopDeployLoopSoundEx();
10271 void SoundSynchRemoteReset();
10272 void SoundSynchRemote();
10273 bool UsesGlobalDeploy(){return false;}
10274 bool CanPlayDeployLoopSound(){return false;}
10276 bool IsPlaceSound(){return m_IsPlaceSound;}
10277 bool IsDeploySound(){return m_IsDeploySound;}
10278 void SetIsPlaceSound(bool is_place_sound);
10279 void SetIsDeploySound(bool is_deploy_sound);
10280}
10281
10282EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
10283{
10284 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
10285 if (entity)
10286 {
10287 bool is_item = entity.IsInherited(ItemBase);
10288 if (is_item && full_quantity)
10289 {
10290 ItemBase item = ItemBase.Cast(entity);
10291 item.SetQuantity(item.GetQuantityInit());
10292 }
10293 }
10294 else
10295 {
10296 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
10297 return NULL;
10298 }
10299 return entity;
10300}
10301
10302void SetupSpawnedItem(ItemBase item, float health, float quantity)
10303{
10304 if (item)
10305 {
10306 if (health > 0)
10307 item.SetHealth("", "", health);
10308
10309 if (item.CanHaveTemperature())
10310 {
10311 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
10312 if (item.CanFreeze())
10313 item.SetFrozen(false);
10314 }
10315
10316 if (item.HasEnergyManager())
10317 {
10318 if (quantity >= 0)
10319 {
10320 item.GetCompEM().SetEnergy0To1(quantity);
10321 }
10322 else
10323 {
10324 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
10325 }
10326 }
10327 else if (item.IsMagazine())
10328 {
10329 Magazine mag = Magazine.Cast(item);
10330 if (quantity >= 0)
10331 {
10332 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10333 }
10334 else
10335 {
10336 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
10337 }
10338
10339 }
10340 else
10341 {
10342 if (quantity >= 0)
10343 {
10344 item.SetQuantityNormalized(quantity, false);
10345 }
10346 else
10347 {
10348 item.SetQuantity(Math.AbsFloat(quantity));
10349 }
10350
10351 }
10352 }
10353}
10354
10355#ifdef DEVELOPER
10356ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
10357#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Определения EntityAI.c:97
Param3 TSelectableActionInfo
EWetnessLevel
Определения EntityAI.c:2
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Определения Inventory.c:22
const int INPUT_UDT_ITEM_MANIPULATION
Определения _constants.c:8
class LogManager EntityAI
eBleedingSourceType GetType()
Определения BleedingSource.c:63
ItemSuppressor SuppressorBase
Определения InventoryItem.c:7
void ActionDropItem()
Определения ActionDropItem.c:14
void ActionManagerBase(PlayerBase player)
Определения ActionManagerBase.c:63
map< typename, ref array< ActionBase_Basic > > TInputActionMap
Определения ActionManagerClient.c:1
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
void RemoveAction(typename actionName)
Определения AdvancedCommunication.c:252
TInputActionMap m_InputActionMap
Определения AdvancedCommunication.c:137
bool m_ActionsInitialize
Определения AdvancedCommunication.c:138
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
Определения AdvancedCommunication.c:202
void InitializeActions()
Определения AdvancedCommunication.c:190
const int ECE_PLACE_ON_SURFACE
Определения CentralEconomy.c:37
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
Определения CentralEconomy.c:36
const int RF_DEFAULT
Определения CentralEconomy.c:65
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
map
Определения ControlsXboxNew.c:4
CookingMethodType
Определения Cooking.c:2
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
DayZGame g_Game
Определения DayZGame.c:3868
DayZGame GetDayZGame()
Определения DayZGame.c:3870
EActions
Определения EActions.c:2
ERPCs
Определения ERPCs.c:2
PluginAdminLog m_AdminLog
Определения EmoteManager.c:142
const int MAX
Определения EnConvert.c:27
override bool IsExplosive()
Определения ExplosivesBase.c:59
override bool CanHaveTemperature()
Определения FireplaceBase.c:557
class GP5GasMask extends MaskBase ItemBase
Empty
Определения Hand_States.c:14
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
Определения ItemBase.c:6308
static bool HasDebugActionsMask(int mask)
Определения ItemBase.c:5548
bool HidesSelectionBySlot()
Определения ItemBase.c:9203
float m_VarWetMin
Определения ItemBase.c:4809
void SplitItem(PlayerBase player)
Определения ItemBase.c:6739
void CopyScriptPropertiesFrom(EntityAI oldItem)
Определения ItemBase.c:9424
override void InsertAgent(int agent, float count=1)
Определения ItemBase.c:8653
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
Определения ItemBase.c:8087
static void SetDebugActionsMask(int mask)
Определения ItemBase.c:5553
void SetIsDeploySound(bool is_deploy_sound)
bool IsOpen()
Определения ItemBase.c:8796
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6706
override bool IsHeavyBehaviour()
Определения ItemBase.c:8998
override void SetWetMax()
Определения ItemBase.c:8369
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
Определения ItemBase.c:9241
void ClearStartItemSoundServer()
Определения ItemBase.c:9139
float m_VarWet
Определения ItemBase.c:4806
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9271
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
Определения ItemBase.c:2
override void RemoveAllAgentsExcept(int agent_to_keep)
Определения ItemBase.c:8648
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
Определения ItemBase.c:4869
bool CanBeMovedOverride()
Определения ItemBase.c:7380
override void SetWet(float value, bool allow_client=false)
Определения ItemBase.c:8345
ref TIntArray m_SingleUseActions
Определения ItemBase.c:4855
override void ProcessVariables()
Определения ItemBase.c:9338
ref TStringArray m_HeadHidingSelections
Определения ItemBase.c:4883
float GetWeightSpecialized(bool forceRecalc=false)
Определения ItemBase.c:8179
bool LoadAgents(ParamsReadContext ctx, int version)
Определения ItemBase.c:8714
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
Определения ItemBase.c:8559
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
Определения ItemBase.c:5139
ref array< ref OverheatingParticle > m_OverheatingParticles
Определения ItemBase.c:4881
override float GetTemperatureFreezeThreshold()
Определения ItemBase.c:9374
bool m_IsSoundSynchRemote
Определения ItemBase.c:9532
float m_OverheatingShots
Определения ItemBase.c:4876
void StopItemSoundServer(int id)
Определения ItemBase.c:9127
static void ToggleDebugActionsMask(int mask)
Определения ItemBase.c:5568
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:5292
override float GetTemperatureFreezeTime()
Определения ItemBase.c:9398
ref array< int > m_CompatibleLocks
Определения ItemBase.c:4893
bool CanBeCooked()
Определения ItemBase.c:7336
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:5635
float m_TemperaturePerQuantityWeight
Определения ItemBase.c:4905
bool m_RecipesInitialized
Определения ItemBase.c:4791
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
Определения ItemBase.c:6382
override float GetTemperatureThawThreshold()
Определения ItemBase.c:9382
override void OnEnergyConsumed()
Определения ItemBase.c:8289
void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
Определения ItemBase.c:8078
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
Определения Bottle_Base.c:158
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
Определения ItemBase.c:8218
override EWetnessLevel GetWetLevel()
Определения ItemBase.c:8409
float GetSingleInventoryItemWeight()
Определения ItemBase.c:8174
ref TIntArray m_InteractActions
Определения ItemBase.c:4857
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
Определения ItemBase.c:7400
float m_VarQuantity
Определения ItemBase.c:4797
bool CanPlayDeployLoopSound()
Определения ItemBase.c:9543
override float GetWetMax()
Определения ItemBase.c:8379
bool CanBeUsedForSuicide()
Определения ItemBase.c:9510
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:7011
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
Определения ItemBase.c:5773
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
Определения ItemBase.c:7554
void StartItemSoundServer(int id)
Определения ItemBase.c:9114
void DoAmmoExplosion()
Определения ItemBase.c:6243
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
Определения ItemBase.c:4868
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6557
int GetItemSize()
Определения ItemBase.c:7365
bool m_CanBeMovedOverride
Определения ItemBase.c:4834
override string ChangeIntoOnAttach(string slot)
Определения ItemBase.c:6167
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5360
bool CanDecay()
Определения ItemBase.c:9313
ScriptedLightBase GetLight()
string GetPlaceSoundset()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
Определения ItemBase.c:8060
void SetQuantityMax()
Определения ItemBase.c:8065
override float GetQuantity()
Определения ItemBase.c:8154
int m_ColorComponentR
Определения ItemBase.c:4846
int m_ShotsToStartOverheating
Определения ItemBase.c:4878
override void OnWetChanged(float newVal, float oldVal)
Определения ItemBase.c:8394
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5367
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8897
void OnOverheatingDecay()
Определения ItemBase.c:5330
float GetDryingIncrement(string pIncrementName)
Определения ItemBase.c:8327
void SoundSynchRemoteReset()
int m_Cleanness
Определения ItemBase.c:4812
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
Определения ItemBase.c:5468
bool UsesGlobalDeploy()
Определения ItemBase.c:9542
int m_ItemBehaviour
Определения ItemBase.c:4827
override bool CanReleaseAttachment(EntityAI attachment)
Определения ItemBase.c:8869
float m_HeatIsolation
Определения ItemBase.c:4822
float m_VarWetInit
Определения ItemBase.c:4808
override void OnMovedInsideCargo(EntityAI container)
Определения ItemBase.c:5813
void SetCEBasedQuantity()
Определения ItemBase.c:5581
bool m_CanPlayImpactSound
Определения ItemBase.c:4818
override string GetAttachmentSoundType()
Определения ItemBase.c:9072
float GetOverheatingCoef()
Определения ItemBase.c:5387
array< string > GetHeadHidingSelection()
Определения ItemBase.c:9198
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
Определения ItemBase.c:9150
override bool IsStoreLoad()
Определения ItemBase.c:8421
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:6987
bool IsLightSource()
Определения ItemBase.c:5709
bool m_HasQuantityBar
Определения ItemBase.c:4840
void SetResultOfSplit(bool value)
Определения ItemBase.c:6982
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6624
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6797
void UpdateAllOverheatingParticles()
Определения ItemBase.c:5395
float GetSoakingIncrement(string pIncrementName)
Определения ItemBase.c:8336
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8977
override float GetStoreLoadedQuantity()
Определения ItemBase.c:8431
int m_LockType
Определения ItemBase.c:4894
const int ITEM_SOUNDS_MAX
Определения ItemBase.c:4899
bool m_CanBeDigged
Определения ItemBase.c:4841
float m_ItemAttachOffset
Определения ItemBase.c:4824
float GetItemModelLength()
Определения ItemBase.c:8438
bool m_ThrowItemOnDrop
Определения ItemBase.c:4832
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
Определения ItemBase.c:7699
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
Определения ItemBase.c:8729
void Close()
float GetHeatIsolation()
Определения ItemBase.c:8322
void CombineItems(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7016
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
Определения ItemBase.c:9369
bool CanHaveWetness()
Определения ItemBase.c:9326
int m_CleannessMin
Определения ItemBase.c:4814
void TransferAgents(int agents)
transfer agents from another item
Определения ItemBase.c:8662
string IDToName(int id)
Определения ItemBase.c:7547
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
Определения ItemBase.c:9333
float GetHeatIsolationInit()
Определения ItemBase.c:8317
void PlayPlaceSound()
void SetCanBeMovedOverride(bool setting)
Определения ItemBase.c:7387
override bool HasQuantity()
Определения ItemBase.c:8149
float m_VarWetPrev
Определения ItemBase.c:4807
int m_SoundSyncStop
Определения ItemBase.c:4901
bool IsCargoException4x3(EntityAI item)
Определения ItemBase.c:9419
ref TIntArray m_ContinuousActions
Определения ItemBase.c:4856
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
Определения ItemBase.c:5477
void LoadParticleConfigOnFire(int id)
Определения ItemBase.c:5162
int m_VarLiquidType
Определения ItemBase.c:4826
int m_QuickBarBonus
Определения ItemBase.c:4828
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
Определения ItemBase.c:9060
override float GetWetInit()
Определения ItemBase.c:8389
int m_ImpactSoundSurfaceHash
Определения ItemBase.c:4820
int m_SoundSyncPlay
Определения ItemBase.c:4900
int m_MaxOverheatingValue
Определения ItemBase.c:4879
void SetupSpawnedItem(ItemBase item, float health, float quantity)
Определения ItemBase.c:4803
bool m_IsTakeable
Определения ItemBase.c:4831
static ref map< string, int > m_WeaponTypeToID
Определения ItemBase.c:4871
string GetLockSoundSet()
Определения ItemBase.c:8487
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
Определения ItemBase.c:8518
array< int > GetValidFinishers()
returns an array of possible finishers
Определения ItemBase.c:9446
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6803
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
Определения ItemBase.c:4783
ItemSoundHandler GetItemSoundHandler()
Определения ItemBase.c:9085
override int GetQuantityMin()
Определения ItemBase.c:8138
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
Определения ItemBase.c:6533
override int GetQuickBarBonus()
Определения ItemBase.c:5047
override void SetTakeable(bool pState)
Определения ItemBase.c:9042
float m_OverheatingDecayInterval
Определения ItemBase.c:4880
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6356
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
Определения ItemBase.c:9291
bool CanProcessDecay()
Определения ItemBase.c:9319
void RemoveAudioVisualsOnClient()
Определения Bottle_Base.c:151
void SoundSynchRemote()
static void AddDebugActionsMask(int mask)
Определения ItemBase.c:5558
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
Определения ItemBase.c:9435
bool CanRepair(ItemBase item_repair_kit)
Определения ItemBase.c:7351
bool can_this_be_combined
Определения ItemBase.c:4836
EffectSound m_SoundDeploy
Определения ItemBase.c:9529
int m_Count
Определения ItemBase.c:4802
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
Определения ItemBase.c:9482
float GetDeployTime()
how long it takes to deploy this item in seconds
Определения ItemBase.c:9034
override bool IsSplitable()
Определения ItemBase.c:6343
bool DamageItemAttachments(float damage)
Определения ItemBase.c:6327
override void WriteVarsToCTX(ParamsWriteContext ctx)
Определения ItemBase.c:7663
void ConvertEnergyToQuantity()
Определения ItemBase.c:8304
override void RemoveAllAgents()
Определения ItemBase.c:8643
override void SetQuantityToMinimum()
Определения ItemBase.c:8071
bool m_WantPlayImpactSound
Определения ItemBase.c:4817
override float GetTemperatureThawTime()
Определения ItemBase.c:9406
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
Определения ItemBase.c:4870
int m_ColorComponentG
Определения ItemBase.c:4847
float m_StoreLoadedQuantity
Определения ItemBase.c:4804
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
Определения ItemBase.c:7418
int m_ColorComponentA
Определения ItemBase.c:4849
int m_VarQuantityInit
Определения ItemBase.c:4799
float GetFilterDamageRatio()
Определения ItemBase.c:5462
override void SetLiquidType(int value, bool allow_client=false)
Определения ItemBase.c:8531
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
Определения ItemBase.c:6773
void OnApply(PlayerBase player)
bool m_HideSelectionsBySlot
Определения ItemBase.c:4884
bool IsOverheatingEffectActive()
Определения ItemBase.c:5325
void SetIsBeingPlaced(bool is_being_placed)
Определения ItemBase.c:5742
int GetLiquidContainerMask()
Определения ItemBase.c:5679
ref Timer m_CheckOverheating
Определения ItemBase.c:4877
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
Определения ItemBase.c:5373
float GetEnergy()
Определения ItemBase.c:8278
bool CanBeDigged()
Определения ItemBase.c:5758
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
Определения ItemBase.c:9452
bool IsNVG()
Определения ItemBase.c:5690
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
Определения ItemBase.c:8238
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
Определения ItemBase.c:9228
bool m_IsDeploySound
Определения ItemBase.c:9531
bool CanEat()
Определения ItemBase.c:7311
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8937
override bool IsOneHandedBehaviour()
Определения ItemBase.c:9008
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
Определения ItemBase.c:9430
bool IsLiquidContainer()
Определения ItemBase.c:5674
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
Определения ItemBase.c:7331
override float GetSingleInventoryItemWeightEx()
Определения ItemBase.c:8165
void SaveAgents(ParamsWriteContext ctx)
Определения ItemBase.c:8721
override int GetTargetQuantityMax(int attSlotID=-1)
Определения ItemBase.c:8119
int m_CleannessInit
Определения ItemBase.c:4813
float GetDisinfectQuantity(int system=0, Param param1=null)
Определения ItemBase.c:5457
override int GetAgents()
Определения ItemBase.c:8668
int m_VarQuantityMax
Определения ItemBase.c:4801
override bool IsHologram()
Определения ItemBase.c:5753
float GetItemAttachOffset()
Определения ItemBase.c:8447
bool IsPlaceSound()
Определения ItemBase.c:9545
static int GetDebugActionsMask()
Определения ItemBase.c:5543
override int GetLiquidType()
Определения ItemBase.c:8547
void ProcessDecay(float delta, bool hasRootAsPlayer)
Определения ItemBase.c:9308
override bool IsItemBase()
Определения ItemBase.c:7464
void PlayDeploySound()
override bool IsTwoHandedBehaviour()
Определения ItemBase.c:9018
void ExplodeAmmo()
Определения ItemBase.c:6230
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
Определения ItemBase.c:6972
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
Определения ItemBase.c:8742
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8917
override void OnEnergyAdded()
Определения ItemBase.c:8296
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
Определения ItemBase.c:5702
EffectSound m_DeployLoopSoundEx
Определения ItemBase.c:9528
override void DeSerializeNumericalVars(array< float > floats)
Определения ItemBase.c:7604
void StopItemDynamicPhysics()
Определения ItemBase.c:9210
bool HasFoodStage()
Определения ItemBase.c:7324
override void SetStoreLoad(bool value)
Определения ItemBase.c:8416
float GetOverheatingValue()
Определения ItemBase.c:5287
bool ContainsAgent(int agent_id)
Определения ItemBase.c:8621
override void AddWet(float value)
Определения ItemBase.c:8364
bool IsLiquidPresent()
Определения ItemBase.c:5669
bool IsFullQuantity()
Определения ItemBase.c:8159
override void EOnContact(IEntity other, Contact extra)
Определения ItemBase.c:5943
void SplitIntoStackMaxHands(PlayerBase player)
Определения ItemBase.c:6678
void SplitIntoStackMaxHandsClient(PlayerBase player)
Определения ItemBase.c:6651
int m_CleannessMax
Определения ItemBase.c:4815
float m_VarStackMax
Определения ItemBase.c:4803
ref Timer m_PhysDropTimer
Определения ItemBase.c:4890
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
Определения ItemBase.c:7436
override void SetStoreLoadedQuantity(float value)
Определения ItemBase.c:8426
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
Определения ItemBase.c:4844
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5308
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
Определения ItemBase.c:5623
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
Определения ItemBase.c:7358
void OnLiquidTypeChanged(int oldType, int newType)
Определения ItemBase.c:8552
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5354
void PlayDeployFinishSound()
bool AllowFoodConsumption()
Определения ItemBase.c:8474
bool m_IsOverheatingEffectActive
Определения ItemBase.c:4875
int m_LiquidContainerMask
Определения ItemBase.c:4825
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9246
override int GetCleanness()
Определения ItemBase.c:8469
bool PairWithDevice(notnull ItemBase otherDevice)
Определения ItemBase.c:9457
bool IsDeploySound()
Определения ItemBase.c:9546
static void RemoveDebugActionsMask(int mask)
Определения ItemBase.c:5563
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8957
int m_VarQuantityMin
Определения ItemBase.c:4800
void PerformDamageSystemReinit()
Определения ItemBase.c:9216
override void ClearInventory()
Определения ItemBase.c:8257
static int m_LastRegisteredWeaponID
Определения ItemBase.c:4872
ItemBase GetLightSourceItem()
Определения ItemBase.c:9440
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
Определения ItemBase.c:7454
override float GetItemOverheatThreshold()
Определения ItemBase.c:9390
void StopDeployLoopSoundEx()
bool m_CanThisBeSplit
Определения ItemBase.c:4837
override void SerializeNumericalVars(array< float > floats_out)
Определения ItemBase.c:7568
void Open()
Implementations only.
Определения CannedFood.c:100
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
Определения ItemBase.c:6590
float m_ItemModelLength
Определения ItemBase.c:4823
bool m_IsHologram
Определения ItemBase.c:4830
static int m_DebugActionsMask
Определения ItemBase.c:4790
void KillAllOverheatingParticles()
Определения ItemBase.c:5423
bool CanBeCookedOnStick()
Определения ItemBase.c:7341
override int GetQuantityMax()
Определения ItemBase.c:8106
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
Определения ItemBase.c:7050
void OnActivatedByTripWire()
bool IsColorSet()
Определения ItemBase.c:8512
override void RemoveAgent(int agent_id)
Определения ItemBase.c:8634
bool m_ItemBeingDroppedPhys
Определения ItemBase.c:4833
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:8824
void PlayDetachSound(string slot_type)
Определения ItemBase.c:9186
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
Определения ItemBase.c:4784
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9519
override bool IsBeingPlaced()
Определения ItemBase.c:5737
int GetQuantityInit()
Определения ItemBase.c:8143
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:6992
bool IsResultOfSplit()
Определения ItemBase.c:6977
bool m_FixDamageSystemInit
Определения ItemBase.c:4835
float m_ImpactSpeed
Определения ItemBase.c:4819
bool m_IsStoreLoad
Определения ItemBase.c:4838
int GetLiquidTypeInit()
Определения ItemBase.c:8542
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
Определения ItemBase.c:4853
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
Определения ItemBase.c:5610
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6462
int m_AttachedAgents
Определения ItemBase.c:4861
string m_LockSoundSet
Определения ItemBase.c:4896
void LoadParticleConfigOnOverheating(int id)
Определения ItemBase.c:5231
float m_VarQuantityPrev
Определения ItemBase.c:4798
bool IsSoundSynchRemote()
Определения ItemBase.c:9544
bool m_CanShowQuantity
Определения ItemBase.c:4839
override void EEOnCECreate()
Called when entity is being created as new by CE/ Debug.
Определения ItemBase.c:8781
override void OnRightClick()
Определения ItemBase.c:6846
int m_ColorComponentB
Определения ItemBase.c:4848
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
Определения ItemBase.c:4786
bool IsActionTargetVisible()
Определения ItemBase.c:9054
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения ItemBase.c:5978
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Определения ItemBase.c:6267
bool m_IsBeingPlaced
Определения ItemBase.c:4829
int NameToID(string name)
Определения ItemBase.c:7541
void ~ItemBase()
Определения ItemBase.c:5508
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
Определения ItemBase.c:8404
void ClearStopItemSoundServer()
Определения ItemBase.c:9144
override string ChangeIntoOnDetach()
Определения ItemBase.c:6191
float m_VarWetMax
Определения ItemBase.c:4810
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6585
int GetLockType()
Определения ItemBase.c:8482
EffectSound m_SoundDeployFinish
Определения ItemBase.c:9526
override float GetWet()
Определения ItemBase.c:8374
EffectSound m_SoundPlace
Определения ItemBase.c:9527
float GetQuantityNormalizedScripted()
Определения ItemBase.c:8092
override void SetCleanness(int value, bool allow_client=false)
Определения ItemBase.c:8456
bool m_IsPlaceSound
Определения ItemBase.c:9530
override float GetWetMin()
Определения ItemBase.c:8384
ref ItemSoundHandler m_ItemSoundHandler
Определения ItemBase.c:4902
override bool KindOf(string tag)
Определения ItemBase.c:7470
void ItemSoundHandler(ItemBase parent)
Определения ItemSoundHandler.c:31
string Type
Определения JsonDataContaminatedArea.c:11
EffectSound m_LockingSound
Определения Land_Underground_Entrance.c:321
string GetDebugText()
Определения ModifierBase.c:71
PlayerBase GetPlayer()
Определения ModifierBase.c:51
@ LOWEST
Определения PPEConstants.c:54
void PluginItemDiagnostic()
Определения PluginItemDiagnostic.c:74
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:316
EntityAI GetItem()
Определения RadialQuickbarMenu.c:37
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
Определения RemoteDetonator.c:272
void RemoteDetonatorTrigger()
Определения RemoteDetonator.c:233
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
Определения RemoteDetonator.c:305
int particle_id
Определения SmokeSimulation.c:28
ETemperatureAccessTypes
Определения TemperatureAccessConstants.c:2
override void Explode(int damageType, string ammoType="")
Определения Trap_LandMine.c:220
bool m_Initialized
Определения UiHintPanel.c:317
void Debug()
Определения UniversalTemperatureSource.c:349
int GetID()
Определения ActionBase.c:1321
void OnItemLocationChanged(ItemBase item)
Определения ActionBase.c:962
GetInputType()
Определения ActionBase.c:215
int m_StanceMask
Определения ActionBase.c:25
int m_CommandUIDProne
Определения ActionBase.c:24
int m_CommandUID
Определения ActionBase.c:23
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
Определения AnalyticsManagerClient.c:77
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
Определения DayZGame.c:1187
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
Определения Game.c:1513
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
float GetEnergyAtSpawn()
Определения ComponentEnergyManager.c:1280
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
Определения ComponentEnergyManager.c:541
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
Определения ComponentEnergyManager.c:1275
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
Определения EffectSound.c:603
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
Определения EffectSound.c:274
override bool IsMan()
Определения Man.c:44
Определения Building.c:6
Определения constants.c:659
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
Определения ItemBase.c:15
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
bool WriteToContext(ParamsWriteContext ctx)
Определения InventoryLocation.c:469
proto native int GetType()
returns type of InventoryLocation
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native bool GetFlip()
returns flip status of cargo
proto native EntityAI GetItem()
returns item of current inventory location
InventoryLocation.
Определения InventoryLocation.c:29
override bool CanDisplayCargo()
Определения UndergroundStash.c:24
override void OnInventoryEnter(Man player)
Определения BarbedWire.c:203
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:6
override bool CanReceiveItemIntoCargo(EntityAI item)
Определения TentBase.c:913
override bool OnStoreLoad(ParamsReadContext ctx, int version)
Определения GardenBase.c:149
override void OnWasDetached(EntityAI parent, int slot_id)
Определения InventoryItem.c:920
override void EEOnAfterLoad()
Определения GardenBase.c:187
override void EEDelete(EntityAI parent)
Определения BaseBuildingBase.c:68
override bool CanBeRepairedByCrafting()
Определения TentBase.c:86
override void OnPlacementStarted(Man player)
Определения BatteryCharger.c:376
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
Определения BarbedWire.c:357
override bool IsElectricAppliance()
Определения BatteryCharger.c:43
override bool IsItemTent()
Определения TentBase.c:81
override void SetActions()
Определения InventoryItem.c:732
override bool CanMakeGardenplot()
Определения FieldShovel.c:3
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Определения PowerGenerator.c:412
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения HandcuffsLocked.c:12
override WrittenNoteData GetWrittenNoteData()
Определения Paper.c:30
override int GetDamageSystemVersionChange()
Определения BaseBuildingBase.c:1218
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Определения PileOfWoodenPlanks.c:88
override void InitItemVariables()
Определения Matchbox.c:3
override void SetActionAnimOverrides()
Определения PickAxe.c:28
override void OnCreatePhysics()
Определения BaseBuildingBase.c:465
override string GetDeploySoundset()
Определения BarbedWire.c:392
override float GetBandagingEffectivity()
Определения BandageDressing.c:49
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Определения PowerGenerator.c:424
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
Определения BaseBuildingBase.c:472
override void OnStoreSave(ParamsWriteContext ctx)
Определения GardenBase.c:206
override void AfterStoreLoad()
Определения GardenBase.c:182
override int GetOnDigWormsAmount()
Определения FieldShovel.c:27
override bool IsSelfAdjustingTemperature()
Определения PortableGasStove.c:287
override bool IsPlayerInside(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1017
override void OnVariablesSynchronized()
Определения GardenBase.c:68
override void RefreshPhysics()
Определения BatteryCharger.c:359
override bool CanObstruct()
Определения BaseBuildingBase.c:84
override void OnWasAttached(EntityAI parent, int slot_id)
Определения InventoryItem.c:912
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
Определения BaseBuildingBase.c:962
override bool CanPutInCargo(EntityAI parent)
Определения GardenBase.c:269
override string GetLoopDeploySoundset()
Определения BarbedWire.c:397
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
Определения BarbedWire.c:372
override void OnInventoryExit(Man player)
Определения BatteryCharger.c:341
override bool IsTakeable()
Определения BaseBuildingBase.c:988
override bool IsIgnoredByConstruction()
Определения BaseBuildingBase.c:1150
override void InitItemSounds()
Определения TentBase.c:810
override void EEKilled(Object killer)
Определения HandcuffsLocked.c:70
override void OnCombine(ItemBase other_item)
Определения BandageDressing.c:71
override bool CanExplodeInFire()
Определения LargeGasCannister.c:3
override bool IsFacingPlayer(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1012
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
Определения Rag.c:61
override bool IsBloodContainer()
Определения BloodContainerBase.c:10
override bool IsClothing()
Определения InventoryItem.c:840
override bool CanBeSplit()
Определения Rag.c:34
override bool IsDeployable()
Определения BaseBuildingBase.c:341
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Определения ToolBase.c:24
override bool CanBeDisinfected()
Определения BandageDressing.c:54
override float GetInfectionChance(int system=0, Param param=null)
Определения BandageDressing.c:59
override void OnEndPlacement()
Определения KitBase.c:65
Определения InventoryItem.c:731
Определения EnMath.c:7
float GetOverheatingLimitMax()
Определения WeaponParticles.c:417
void SetOverheatingLimitMax(float max)
Определения WeaponParticles.c:407
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
Определения WeaponParticles.c:422
float GetOverheatingLimitMin()
Определения WeaponParticles.c:412
Particle GetParticle()
Определения WeaponParticles.c:397
void SetOverheatingLimitMin(float min)
Определения WeaponParticles.c:402
void RegisterParticle(Particle p)
Определения WeaponParticles.c:392
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
Определения Particle.c:266
void SetControlledDevice(EntityAI pDevice)
Определения RemoteDetonator.c:140
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
proto void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto native void Send()
proto bool Write(void value_out)
proto bool Read(void value_in)
bool m_Loop
Определения ItemSoundHandler.c:5
override void Stop()
Определения DayZPlayerImplement.c:64
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
Определения UIManager.c:160
override void Refresh()
Определения ChatInputMenu.c:70
void SetCalcDetails(string details)
Определения Debug.c:816
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Определения WrittenNoteData.c:13
const float LOWEST
Определения EnConvert.c:100
Serializer ParamsReadContext
Определения gameplay.c:15
class LOD Object
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Определения gameplay.c:6
proto native CGame GetGame()
Serializer ParamsWriteContext
Определения gameplay.c:16
const int DEF_BIOLOGICAL
Определения constants.c:510
const int DEF_CHEMICAL
Определения constants.c:511
const int COMP_TYPE_ENERGY_MANAGER
Определения Component.c:9
ErrorExSeverity
Определения EnDebug.c:62
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90
enum ShapeType ErrorEx
proto native void SetColor(int color)
array< string > TStringArray
Определения EnScript.c:685
array< int > TIntArray
Определения EnScript.c:687
EntityEvent
Entity events for event-mask, or throwing event from code.
Определения EnEntity.c:45
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Определения constants.c:806
const int VARIABLE_LIQUIDTYPE
Определения constants.c:630
const int VARIABLE_CLEANNESS
Определения constants.c:633
const int VARIABLE_COLOR
Определения constants.c:632
const int VARIABLE_TEMPERATURE
Определения constants.c:628
const int VARIABLE_QUANTITY
Определения constants.c:626
const int VARIABLE_WET
Определения constants.c:629
const int LIQUID_NONE
Определения constants.c:527
static proto float AbsFloat(float f)
Returns absolute value.
const int MENU_INVENTORY
Определения constants.c:180
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_CRAFTING
Определения constants.c:451
const int SAT_DEBUG_ACTION
Определения constants.c:452
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.
const int CALL_CATEGORY_GAMEPLAY
Определения tools.c:10
const int CALL_CATEGORY_SYSTEM
Определения tools.c:8
proto native int GetColor()