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

◆ SetDebugActionsMask()

static void SpawnItemOnLocation::SetDebugActionsMask ( int mask)
staticprivate

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

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