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

◆ RemoveDebugActionsMask()

static void SpawnItemOnLocation::RemoveDebugActionsMask ( int mask)
staticprivate

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

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