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

◆ UpdateAllOverheatingParticles()

void SpawnItemOnLocation::UpdateAllOverheatingParticles ( )
private

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

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

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