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

◆ GetSingleInventoryItemWeight()

float SpawnItemOnLocation::GetSingleInventoryItemWeight ( )
private

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

8178{
8179 override bool CanPutAsAttachment(EntityAI parent)
8180 {
8181 return true;
8182 }
8183};
8184
8185//const bool QUANTITY_DEBUG_REMOVE_ME = false;
8186
8187class ItemBase extends InventoryItem
8188{
8192
8194
8195 static int m_DebugActionsMask;
8197 // ============================================
8198 // Variable Manipulation System
8199 // ============================================
8200 // Quantity
8201
8202 float m_VarQuantity;
8203 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
8205 int m_VarQuantityMin;
8206 int m_VarQuantityMax;
8207 int m_Count;
8208 float m_VarStackMax;
8209 float m_StoreLoadedQuantity = float.LOWEST;
8210 // Wet
8211 float m_VarWet;
8212 float m_VarWetPrev;//for client to know wetness changed during synchronization
8213 float m_VarWetInit;
8214 float m_VarWetMin;
8215 float m_VarWetMax;
8216 // Cleanness
8217 int m_Cleanness;
8218 int m_CleannessInit;
8219 int m_CleannessMin;
8220 int m_CleannessMax;
8221 // impact sounds
8223 bool m_CanPlayImpactSound = true;
8224 float m_ImpactSpeed;
8226 //
8227 float m_HeatIsolation;
8228 float m_ItemModelLength;
8229 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
8231 int m_VarLiquidType;
8232 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
8233 int m_QuickBarBonus;
8234 bool m_IsBeingPlaced;
8235 bool m_IsHologram;
8236 bool m_IsTakeable;
8237 bool m_ThrowItemOnDrop;
8240 bool m_FixDamageSystemInit = false; //can be changed on storage version check
8241 bool can_this_be_combined; //Check if item can be combined
8242 bool m_CanThisBeSplit; //Check if item can be split
8243 bool m_IsStoreLoad = false;
8244 bool m_CanShowQuantity;
8245 bool m_HasQuantityBar;
8246 protected bool m_CanBeDigged;
8247 protected bool m_IsResultOfSplit
8248
8249 string m_SoundAttType;
8250 // items color variables
8255 //-------------------------------------------------------
8256
8257 // light source managing
8259
8263
8264 //==============================================
8265 // agent system
8266 private int m_AttachedAgents;
8267
8269 void TransferModifiers(PlayerBase reciever);
8270
8271
8272 // Weapons & suppressors particle effects
8277 static int m_LastRegisteredWeaponID = 0;
8278
8279 // Overheating effects
8281 float m_OverheatingShots;
8282 ref Timer m_CheckOverheating;
8283 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
8284 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
8285 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
8286 ref array <ref OverheatingParticle> m_OverheatingParticles;
8287
8289 protected bool m_HideSelectionsBySlot;
8290
8291 // Admin Log
8292 PluginAdminLog m_AdminLog;
8293
8294 // misc
8295 ref Timer m_PhysDropTimer;
8296
8297 // Attachment Locking variables
8298 ref array<int> m_CompatibleLocks;
8299 protected int m_LockType;
8300 protected ref EffectSound m_LockingSound;
8301 protected string m_LockSoundSet;
8302
8303 // ItemSoundHandler
8304 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
8305 protected int m_SoundSyncPlay; // id for sound to play
8306 protected int m_SoundSyncStop; // id for sound to stop
8308
8309 //temperature
8310 private float m_TemperaturePerQuantityWeight;
8311
8312 // -------------------------------------------------------------------------
8313 void ItemBase()
8314 {
8315 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
8319
8320 if (!GetGame().IsDedicatedServer())
8321 {
8322 if (HasMuzzle())
8323 {
8325
8327 {
8329 }
8330 }
8331
8333 m_ActionsInitialize = false;
8334 }
8335
8336 m_OldLocation = null;
8337
8338 if (GetGame().IsServer())
8339 {
8340 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
8341 }
8342
8343 if (ConfigIsExisting("headSelectionsToHide"))
8344 {
8346 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
8347 }
8348
8349 m_HideSelectionsBySlot = false;
8350 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8351 {
8352 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
8353 }
8354
8355 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
8356
8357 m_IsResultOfSplit = false;
8358
8360 }
8361
8362 override void InitItemVariables()
8363 {
8364 super.InitItemVariables();
8365
8366 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
8367 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
8368 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
8369 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
8370 m_VarStackMax = ConfigGetFloat("varStackMax");
8371 m_Count = ConfigGetInt("count");
8372
8373 m_CanShowQuantity = ConfigGetBool("quantityShow");
8374 m_HasQuantityBar = ConfigGetBool("quantityBar");
8375
8376 m_CleannessInit = ConfigGetInt("varCleannessInit");
8378 m_CleannessMin = ConfigGetInt("varCleannessMin");
8379 m_CleannessMax = ConfigGetInt("varCleannessMax");
8380
8381 m_WantPlayImpactSound = false;
8382 m_ImpactSpeed = 0.0;
8383
8384 m_VarWetInit = ConfigGetFloat("varWetInit");
8386 m_VarWetMin = ConfigGetFloat("varWetMin");
8387 m_VarWetMax = ConfigGetFloat("varWetMax");
8388
8389 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
8390 if (IsLiquidContainer() && GetQuantity() != 0)
8392 m_IsBeingPlaced = false;
8393 m_IsHologram = false;
8394 m_IsTakeable = true;
8395 m_CanBeMovedOverride = false;
8399 m_CanBeDigged = ConfigGetBool("canBeDigged");
8400
8401 m_CompatibleLocks = new array<int>();
8402 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
8403 m_LockType = ConfigGetInt("lockType");
8404
8405 //Define if item can be split and set ability to be combined accordingly
8406 m_CanThisBeSplit = false;
8407 can_this_be_combined = false;
8408 if (ConfigIsExisting("canBeSplit"))
8409 {
8410 can_this_be_combined = ConfigGetBool("canBeSplit");
8412 }
8413
8414 m_ItemBehaviour = -1;
8415 if (ConfigIsExisting("itemBehaviour"))
8416 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
8417
8418 //RegisterNetSyncVariableInt("m_VariablesMask");
8419 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
8420 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
8421 RegisterNetSyncVariableInt("m_VarLiquidType");
8422 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8423
8424 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8425 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8426 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8427
8428 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8429 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8430 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8431 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8432
8433 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8434 RegisterNetSyncVariableBool("m_IsTakeable");
8435 RegisterNetSyncVariableBool("m_IsHologram");
8436
8437 InitItemSounds();
8439 {
8440 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
8441 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
8442 }
8443
8444 m_LockSoundSet = ConfigGetString("lockSoundSet");
8445
8447 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8448 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
8449
8450 }
8451
8452 override int GetQuickBarBonus()
8453 {
8454 return m_QuickBarBonus;
8455 }
8456
8457 void InitializeActions()
8458 {
8460 if (!m_InputActionMap)
8461 {
8463 m_InputActionMap = iam;
8464 SetActions();
8466 }
8467 }
8468
8469 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
8470 {
8472 {
8473 m_ActionsInitialize = true;
8475 }
8476
8477 actions = m_InputActionMap.Get(action_input_type);
8478 }
8479
8480 void SetActions()
8481 {
8482 AddAction(ActionTakeItem);
8483 AddAction(ActionTakeItemToHands);
8484 AddAction(ActionWorldCraft);
8486 AddAction(ActionAttachWithSwitch);
8487 }
8488
8489 void SetActionAnimOverrides(); // Override action animation for specific item
8490
8491 void AddAction(typename actionName)
8492 {
8493 ActionBase action = ActionManagerBase.GetAction(actionName);
8494
8495 if (!action)
8496 {
8497 Debug.LogError("Action " + actionName + " dosn't exist!");
8498 return;
8499 }
8500
8501 typename ai = action.GetInputType();
8502 if (!ai)
8503 {
8504 m_ActionsInitialize = false;
8505 return;
8506 }
8507
8508 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
8509 if (!action_array)
8510 {
8511 action_array = new array<ActionBase_Basic>;
8512 m_InputActionMap.Insert(ai, action_array);
8513 }
8514 if (LogManager.IsActionLogEnable())
8515 {
8516 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
8517 }
8518
8519 if (action_array.Find(action) != -1)
8520 {
8521 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
8522 }
8523 else
8524 {
8525 action_array.Insert(action);
8526 }
8527 }
8528
8529 void RemoveAction(typename actionName)
8530 {
8531 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
8532 ActionBase action = player.GetActionManager().GetAction(actionName);
8533 typename ai = action.GetInputType();
8534 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
8535
8536 if (action_array)
8537 {
8538 action_array.RemoveItem(action);
8539 }
8540 }
8541
8542 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
8543 // Set -1 for params which should stay in default state
8544 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
8545 {
8546 ActionOverrideData overrideData = new ActionOverrideData();
8547 overrideData.m_CommandUID = commandUID;
8548 overrideData.m_CommandUIDProne = commandUIDProne;
8549 overrideData.m_StanceMask = stanceMask;
8550
8551 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
8552 if (!actionMap) // create new map of action > overidables map
8553 {
8554 actionMap = new TActionAnimOverrideMap();
8555 m_ItemActionOverrides.Insert(action, actionMap);
8556 }
8557
8558 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
8559
8560 }
8561
8562 void OnItemInHandsPlayerSwimStart(PlayerBase player);
8563
8564 ScriptedLightBase GetLight();
8565
8566 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
8567 void LoadParticleConfigOnFire(int id)
8568 {
8569 if (!m_OnFireEffect)
8571
8574
8575 string config_to_search = "CfgVehicles";
8576 string muzzle_owner_config;
8577
8578 if (!m_OnFireEffect.Contains(id))
8579 {
8580 if (IsInherited(Weapon))
8581 config_to_search = "CfgWeapons";
8582
8583 muzzle_owner_config = config_to_search + " " + GetType() + " ";
8584
8585 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8586
8587 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
8588
8589 if (config_OnFire_subclass_count > 0)
8590 {
8591 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8592
8593 for (int i = 0; i < config_OnFire_subclass_count; i++)
8594 {
8595 string particle_class = "";
8596 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
8597 string config_OnFire_entry = config_OnFire_class + particle_class;
8598 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8599 WPOF_array.Insert(WPOF);
8600 }
8601
8602
8603 m_OnFireEffect.Insert(id, WPOF_array);
8604 }
8605 }
8606
8607 if (!m_OnBulletCasingEjectEffect.Contains(id))
8608 {
8609 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
8610 muzzle_owner_config = config_to_search + " " + GetType() + " ";
8611
8612 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8613
8614 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8615
8616 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8617 {
8618 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8619
8620 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8621 {
8622 string particle_class2 = "";
8623 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8624 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8625 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8626 WPOBE_array.Insert(WPOBE);
8627 }
8628
8629
8630 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
8631 }
8632 }
8633 }
8634
8635 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
8637 {
8640
8641 if (!m_OnOverheatingEffect.Contains(id))
8642 {
8643 string config_to_search = "CfgVehicles";
8644
8645 if (IsInherited(Weapon))
8646 config_to_search = "CfgWeapons";
8647
8648 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
8649 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8650
8651 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
8652 {
8653
8654 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
8655
8657 {
8658 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
8659 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8660 Error(error);
8661 return;
8662 }
8663
8664 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
8665 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
8666
8667
8668
8669 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
8670 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8671
8672 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8673 {
8674 string particle_class = "";
8675 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8676 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8677 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
8678
8679 if (entry_type == CT_CLASS)
8680 {
8681 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8682 WPOOH_array.Insert(WPOF);
8683 }
8684 }
8685
8686
8687 m_OnOverheatingEffect.Insert(id, WPOOH_array);
8688 }
8689 }
8690 }
8691
8692 float GetOverheatingValue()
8693 {
8694 return m_OverheatingShots;
8695 }
8696
8697 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
8698 {
8699 if (m_MaxOverheatingValue > 0)
8700 {
8702
8703 if (!m_CheckOverheating)
8705
8707 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
8708
8709 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8710 }
8711 }
8712
8713 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8714 {
8716 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8717
8719 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8720
8722 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8723
8725 {
8727 }
8728 }
8729
8731 {
8733 }
8734
8735 void OnOverheatingDecay()
8736 {
8737 if (m_MaxOverheatingValue > 0)
8738 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
8739 else
8741
8742 if (m_OverheatingShots <= 0)
8743 {
8746 }
8747 else
8748 {
8749 if (!m_CheckOverheating)
8751
8753 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
8754 }
8755
8756 CheckOverheating(this, "", this);
8757 }
8758
8759 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8760 {
8762 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
8763 }
8764
8765 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8766 {
8768 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
8770 }
8771
8772 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8773 {
8775 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8776 }
8777
8778 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
8779 {
8781 m_OverheatingParticles = new array<ref OverheatingParticle>;
8782
8783 OverheatingParticle OP = new OverheatingParticle();
8784 OP.RegisterParticle(p);
8785 OP.SetOverheatingLimitMin(min_heat_coef);
8786 OP.SetOverheatingLimitMax(max_heat_coef);
8787 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
8788
8789 m_OverheatingParticles.Insert(OP);
8790 }
8791
8792 float GetOverheatingCoef()
8793 {
8794 if (m_MaxOverheatingValue > 0)
8796
8797 return -1;
8798 }
8799
8801 {
8803 {
8804 float overheat_coef = GetOverheatingCoef();
8805 int count = m_OverheatingParticles.Count();
8806
8807 for (int i = count; i > 0; --i)
8808 {
8809 int id = i - 1;
8810 OverheatingParticle OP = m_OverheatingParticles.Get(id);
8811 Particle p = OP.GetParticle();
8812
8813 float overheat_min = OP.GetOverheatingLimitMin();
8814 float overheat_max = OP.GetOverheatingLimitMax();
8815
8816 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8817 {
8818 if (p)
8819 {
8820 p.Stop();
8821 OP.RegisterParticle(null);
8822 }
8823 }
8824 }
8825 }
8826 }
8827
8829 {
8831 {
8832 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
8833 {
8834 int id = i - 1;
8835 OverheatingParticle OP = m_OverheatingParticles.Get(id);
8836
8837 if (OP)
8838 {
8839 Particle p = OP.GetParticle();
8840
8841 if (p)
8842 {
8843 p.Stop();
8844 }
8845
8846 delete OP;
8847 }
8848 }
8849
8850 m_OverheatingParticles.Clear();
8852 }
8853 }
8854
8856 float GetInfectionChance(int system = 0, Param param = null)
8857 {
8858 return 0.0;
8859 }
8860
8861
8862 float GetDisinfectQuantity(int system = 0, Param param1 = null)
8863 {
8864 return 250;//default value
8865 }
8866
8867 float GetFilterDamageRatio()
8868 {
8869 return 0;
8870 }
8871
8873 bool HasMuzzle()
8874 {
8875 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
8876 return true;
8877
8878 return false;
8879 }
8880
8882 int GetMuzzleID()
8883 {
8884 if (!m_WeaponTypeToID)
8886
8887 if (m_WeaponTypeToID.Contains(GetType()))
8888 {
8889 return m_WeaponTypeToID.Get(GetType());
8890 }
8891 else
8892 {
8893 // Register new weapon ID
8895 }
8896
8898 }
8899
8906 {
8907 return -1;
8908 }
8909
8910
8911
8912 // -------------------------------------------------------------------------
8913 void ~ItemBase()
8914 {
8915 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
8916 {
8917 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
8918 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8919
8920 if (r_index >= 0)
8921 {
8922 InventoryLocation r_il = new InventoryLocation;
8923 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8924
8925 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8926 int r_type = r_il.GetType();
8927 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
8928 {
8929 r_il.GetParent().GetOnReleaseLock().Invoke(this);
8930 }
8931 else if (r_type == InventoryLocationType.ATTACHMENT)
8932 {
8933 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
8934 }
8935
8936 }
8937
8938 player.GetHumanInventory().ClearUserReservedLocation(this);
8939 }
8940
8941 if (m_LockingSound)
8942 SEffectManager.DestroyEffect(m_LockingSound);
8943 }
8944
8945
8946
8947 // -------------------------------------------------------------------------
8948 static int GetDebugActionsMask()
8949 {
8950 return ItemBase.m_DebugActionsMask;
8951 }
8952
8953 static bool HasDebugActionsMask(int mask)
8954 {
8955 return ItemBase.m_DebugActionsMask & mask;
8956 }
8957
8958 static void SetDebugActionsMask(int mask)
8959 {
8960 ItemBase.m_DebugActionsMask = mask;
8961 }
8962
8963 static void AddDebugActionsMask(int mask)
8964 {
8965 ItemBase.m_DebugActionsMask |= mask;
8966 }
8967
8968 static void RemoveDebugActionsMask(int mask)
8969 {
8970 ItemBase.m_DebugActionsMask &= ~mask;
8971 }
8972
8973 static void ToggleDebugActionsMask(int mask)
8974 {
8975 if (HasDebugActionsMask(mask))
8976 {
8978 }
8979 else
8980 {
8981 AddDebugActionsMask(mask);
8982 }
8983 }
8984
8985 // -------------------------------------------------------------------------
8986 void SetCEBasedQuantity()
8987 {
8988 if (GetEconomyProfile())
8989 {
8990 float q_max = GetEconomyProfile().GetQuantityMax();
8991 if (q_max > 0)
8992 {
8993 float q_min = GetEconomyProfile().GetQuantityMin();
8994 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8995
8996 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
8997 {
8998 ComponentEnergyManager comp = GetCompEM();
8999 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
9000 {
9001 comp.SetEnergy0To1(quantity_randomized);
9002 }
9003 }
9004 else if (HasQuantity())
9005 {
9006 SetQuantityNormalized(quantity_randomized, false);
9007 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
9008 }
9009
9010 }
9011 }
9012 }
9013
9015 void LockToParent()
9016 {
9017 EntityAI parent = GetHierarchyParent();
9018
9019 if (parent)
9020 {
9021 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9022 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9023 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
9024 }
9025 }
9026
9028 void UnlockFromParent()
9029 {
9030 EntityAI parent = GetHierarchyParent();
9031
9032 if (parent)
9033 {
9034 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9035 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9036 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
9037 }
9038 }
9039
9040 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
9041 {
9042 /*
9043 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
9044 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
9045 */
9046 ItemBase item2 = ItemBase.Cast(entity2);
9047
9048 if (GetGame().IsClient())
9049 {
9050 if (ScriptInputUserData.CanStoreInputUserData())
9051 {
9052 ScriptInputUserData ctx = new ScriptInputUserData;
9054 ctx.Write(-1);
9055 ItemBase i1 = this; // @NOTE: workaround for correct serialization
9056 ctx.Write(i1);
9057 ctx.Write(item2);
9058 ctx.Write(use_stack_max);
9059 ctx.Write(-1);
9060 ctx.Send();
9061
9062 if (IsCombineAll(item2, use_stack_max))
9063 {
9064 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9065 }
9066 }
9067 }
9068 else if (!GetGame().IsMultiplayer())
9069 {
9070 CombineItems(item2, use_stack_max);
9071 }
9072 }
9073
9074 bool IsLiquidPresent()
9075 {
9076 return (GetLiquidType() != 0 && HasQuantity());
9077 }
9078
9079 bool IsLiquidContainer()
9080 {
9081 return m_LiquidContainerMask != 0;
9082 }
9083
9085 {
9086 return m_LiquidContainerMask;
9087 }
9088
9089 bool IsBloodContainer()
9090 {
9091 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
9092 return false;
9093 }
9094
9095 bool IsNVG()
9096 {
9097 return false;
9098 }
9099
9102 bool IsExplosive()
9103 {
9104 return false;
9105 }
9106
9108 {
9109 return "";
9110 }
9111
9113
9114 bool IsLightSource()
9115 {
9116 return false;
9117 }
9118
9120 {
9121 return true;
9122 }
9123
9124 //--- ACTION CONDITIONS
9125 //direction
9126 bool IsFacingPlayer(PlayerBase player, string selection)
9127 {
9128 return true;
9129 }
9130
9131 bool IsPlayerInside(PlayerBase player, string selection)
9132 {
9133 return true;
9134 }
9135
9136 override bool CanObstruct()
9137 {
9138 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
9139 return !player || !IsPlayerInside(player, "");
9140 }
9141
9142 override bool IsBeingPlaced()
9143 {
9144 return m_IsBeingPlaced;
9145 }
9146
9147 void SetIsBeingPlaced(bool is_being_placed)
9148 {
9149 m_IsBeingPlaced = is_being_placed;
9150 if (!is_being_placed)
9152 SetSynchDirty();
9153 }
9154
9155 //server-side
9156 void OnEndPlacement() {}
9157
9158 override bool IsHologram()
9159 {
9160 return m_IsHologram;
9161 }
9162
9163 bool CanBeDigged()
9164 {
9165 return m_CanBeDigged;
9166 }
9167
9169 {
9170 return 1;
9171 }
9172
9173 bool CanMakeGardenplot()
9174 {
9175 return false;
9176 }
9177
9178 void SetIsHologram(bool is_hologram)
9179 {
9180 m_IsHologram = is_hologram;
9181 SetSynchDirty();
9182 }
9183 /*
9184 protected float GetNutritionalEnergy()
9185 {
9186 Edible_Base edible = Edible_Base.Cast(this);
9187 return edible.GetFoodEnergy();
9188 }
9189
9190 protected float GetNutritionalWaterContent()
9191 {
9192 Edible_Base edible = Edible_Base.Cast(this);
9193 return edible.GetFoodWater();
9194 }
9195
9196 protected float GetNutritionalIndex()
9197 {
9198 Edible_Base edible = Edible_Base.Cast(this);
9199 return edible.GetFoodNutritionalIndex();
9200 }
9201
9202 protected float GetNutritionalFullnessIndex()
9203 {
9204 Edible_Base edible = Edible_Base.Cast(this);
9205 return edible.GetFoodTotalVolume();
9206 }
9207
9208 protected float GetNutritionalToxicity()
9209 {
9210 Edible_Base edible = Edible_Base.Cast(this);
9211 return edible.GetFoodToxicity();
9212
9213 }
9214 */
9215
9216
9217 // -------------------------------------------------------------------------
9218 override void OnMovedInsideCargo(EntityAI container)
9219 {
9220 super.OnMovedInsideCargo(container);
9221
9222 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9223 }
9224
9225 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9226 {
9227 super.EEItemLocationChanged(oldLoc,newLoc);
9228
9229 PlayerBase new_player = null;
9230 PlayerBase old_player = null;
9231
9232 if (newLoc.GetParent())
9233 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9234
9235 if (oldLoc.GetParent())
9236 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9237
9238 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
9239 {
9240 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
9241
9242 if (r_index >= 0)
9243 {
9244 InventoryLocation r_il = new InventoryLocation;
9245 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9246
9247 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9248 int r_type = r_il.GetType();
9249 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
9250 {
9251 r_il.GetParent().GetOnReleaseLock().Invoke(this);
9252 }
9253 else if (r_type == InventoryLocationType.ATTACHMENT)
9254 {
9255 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
9256 }
9257
9258 }
9259 }
9260
9261 if (newLoc.GetType() == InventoryLocationType.HANDS)
9262 {
9263 if (new_player)
9264 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
9265
9266 if (new_player == old_player)
9267 {
9268
9269 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9270 {
9271 if (oldLoc.GetType() == InventoryLocationType.CARGO)
9272 {
9273 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9274 {
9275 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9276 }
9277 }
9278 else
9279 {
9280 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9281 }
9282 }
9283
9284 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9285 {
9286 int type = oldLoc.GetType();
9287 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
9288 {
9289 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9290 }
9291 else if (type == InventoryLocationType.ATTACHMENT)
9292 {
9293 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9294 }
9295 }
9296 if (!m_OldLocation)
9297 {
9298 m_OldLocation = new InventoryLocation;
9299 }
9300 m_OldLocation.Copy(oldLoc);
9301 }
9302 else
9303 {
9304 if (m_OldLocation)
9305 {
9306 m_OldLocation.Reset();
9307 }
9308 }
9309
9311 }
9312 else
9313 {
9314 if (new_player)
9315 {
9316 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9317 if (res_index >= 0)
9318 {
9319 InventoryLocation il = new InventoryLocation;
9320 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
9321 ItemBase it = ItemBase.Cast(il.GetItem());
9322 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
9323 int rel_type = il.GetType();
9324 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
9325 {
9326 il.GetParent().GetOnReleaseLock().Invoke(it);
9327 }
9328 else if (rel_type == InventoryLocationType.ATTACHMENT)
9329 {
9330 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
9331 }
9332 //it.GetOnReleaseLock().Invoke(it);
9333 }
9334 }
9335 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
9336 {
9337 //ThrowPhysically(old_player, vector.Zero);
9338 m_ThrowItemOnDrop = false;
9339 }
9340
9341 if (m_OldLocation)
9342 {
9343 m_OldLocation.Reset();
9344 }
9345 }
9346 }
9347
9348 override void EOnContact(IEntity other, Contact extra)
9349 {
9351 {
9352 int liquidType = -1;
9353 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
9354 if (impactSpeed > 0.0)
9355 {
9356 m_ImpactSpeed = impactSpeed;
9357 #ifndef SERVER
9358 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
9359 #else
9360 m_WantPlayImpactSound = true;
9361 SetSynchDirty();
9362 #endif
9363 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
9364 }
9365 }
9366
9367 #ifdef SERVER
9368 if (GetCompEM() && GetCompEM().IsPlugged())
9369 {
9370 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
9371 GetCompEM().UnplugThis();
9372 }
9373 #endif
9374 }
9375
9376 void RefreshPhysics();
9377
9378 override void OnCreatePhysics()
9379 {
9381 }
9382
9383 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9384 {
9385
9386 }
9387 // -------------------------------------------------------------------------
9388 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
9389 {
9390 super.OnItemLocationChanged(old_owner, new_owner);
9391
9392 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9393 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9394
9395 if (!relatedPlayer && playerNew)
9396 relatedPlayer = playerNew;
9397
9398 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9399 {
9400 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
9401 if (actionMgr)
9402 {
9403 ActionBase currentAction = actionMgr.GetRunningAction();
9404 if (currentAction)
9405 currentAction.OnItemLocationChanged(this);
9406 }
9407 }
9408
9409 Man ownerPlayerOld = null;
9410 Man ownerPlayerNew = null;
9411
9412 if (old_owner)
9413 {
9414 if (old_owner.IsMan())
9415 {
9416 ownerPlayerOld = Man.Cast(old_owner);
9417 }
9418 else
9419 {
9420 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9421 }
9422 }
9423 else
9424 {
9425 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
9426 {
9427 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
9428
9429 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
9430 {
9431 GetCompEM().UnplugThis();
9432 }
9433 }
9434 }
9435
9436 if (new_owner)
9437 {
9438 if (new_owner.IsMan())
9439 {
9440 ownerPlayerNew = Man.Cast(new_owner);
9441 }
9442 else
9443 {
9444 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9445 }
9446 }
9447
9448 if (ownerPlayerOld != ownerPlayerNew)
9449 {
9450 if (ownerPlayerOld)
9451 {
9452 array<EntityAI> subItemsExit = new array<EntityAI>;
9453 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
9454 for (int i = 0; i < subItemsExit.Count(); i++)
9455 {
9456 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
9457 itemExit.OnInventoryExit(ownerPlayerOld);
9458 }
9459 }
9460
9461 if (ownerPlayerNew)
9462 {
9463 array<EntityAI> subItemsEnter = new array<EntityAI>;
9464 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
9465 for (int j = 0; j < subItemsEnter.Count(); j++)
9466 {
9467 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
9468 itemEnter.OnInventoryEnter(ownerPlayerNew);
9469 }
9470 }
9471 }
9472 else if (ownerPlayerNew != null)
9473 {
9474 PlayerBase nplayer;
9475 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9476 {
9477 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9478 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
9479 for (int k = 0; k < subItemsUpdate.Count(); k++)
9480 {
9481 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
9482 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9483 }
9484 }
9485 }
9486
9487 if (old_owner)
9488 old_owner.OnChildItemRemoved(this);
9489 if (new_owner)
9490 new_owner.OnChildItemReceived(this);
9491 }
9492
9493 // -------------------------------------------------------------------------------
9494 override void EEDelete(EntityAI parent)
9495 {
9496 super.EEDelete(parent);
9497 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9498 if (player)
9499 {
9500 OnInventoryExit(player);
9501
9502 if (player.IsAlive())
9503 {
9504 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9505 if (r_index >= 0)
9506 {
9507 InventoryLocation r_il = new InventoryLocation;
9508 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9509
9510 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9511 int r_type = r_il.GetType();
9512 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
9513 {
9514 r_il.GetParent().GetOnReleaseLock().Invoke(this);
9515 }
9516 else if (r_type == InventoryLocationType.ATTACHMENT)
9517 {
9518 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
9519 }
9520
9521 }
9522
9523 player.RemoveQuickBarEntityShortcut(this);
9524 }
9525 }
9526 }
9527 // -------------------------------------------------------------------------------
9528 override void EEKilled(Object killer)
9529 {
9530 super.EEKilled(killer);
9531
9533 if (killer && killer.IsFireplace() && CanExplodeInFire())
9534 {
9535 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9536 {
9537 if (IsMagazine())
9538 {
9539 if (Magazine.Cast(this).GetAmmoCount() > 0)
9540 {
9541 ExplodeAmmo();
9542 }
9543 }
9544 else
9545 {
9546 Explode(DamageType.EXPLOSION);
9547 }
9548 }
9549 }
9550 }
9551
9552 override void OnWasAttached(EntityAI parent, int slot_id)
9553 {
9554 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9555
9556 super.OnWasAttached(parent, slot_id);
9557
9558 if (HasQuantity())
9559 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
9560
9561 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
9562 }
9563
9564 override void OnWasDetached(EntityAI parent, int slot_id)
9565 {
9566 super.OnWasDetached(parent, slot_id);
9567
9568 if (HasQuantity())
9569 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
9570 }
9571
9572 override string ChangeIntoOnAttach(string slot)
9573 {
9574 int idx;
9575 TStringArray inventory_slots = new TStringArray;
9576 TStringArray attach_types = new TStringArray;
9577
9578 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9579 if (inventory_slots.Count() < 1) //is string
9580 {
9581 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9582 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9583 }
9584 else //is array
9585 {
9586 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9587 }
9588
9589 idx = inventory_slots.Find(slot);
9590 if (idx < 0)
9591 return "";
9592
9593 return attach_types.Get(idx);
9594 }
9595
9596 override string ChangeIntoOnDetach()
9597 {
9598 int idx = -1;
9599 string slot;
9600
9601 TStringArray inventory_slots = new TStringArray;
9602 TStringArray detach_types = new TStringArray;
9603
9604 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9605 if (inventory_slots.Count() < 1) //is string
9606 {
9607 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9608 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9609 }
9610 else //is array
9611 {
9612 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9613 if (detach_types.Count() < 1)
9614 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9615 }
9616
9617 for (int i = 0; i < inventory_slots.Count(); i++)
9618 {
9619 slot = inventory_slots.Get(i);
9620 }
9621
9622 if (slot != "")
9623 {
9624 if (detach_types.Count() == 1)
9625 idx = 0;
9626 else
9627 idx = inventory_slots.Find(slot);
9628 }
9629 if (idx < 0)
9630 return "";
9631
9632 return detach_types.Get(idx);
9633 }
9634
9635 void ExplodeAmmo()
9636 {
9637 //timer
9638 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
9639
9640 //min/max time
9641 float min_time = 1;
9642 float max_time = 3;
9643 float delay = Math.RandomFloat(min_time, max_time);
9644
9645 explode_timer.Run(delay, this, "DoAmmoExplosion");
9646 }
9647
9648 void DoAmmoExplosion()
9649 {
9650 Magazine magazine = Magazine.Cast(this);
9651 int pop_sounds_count = 6;
9652 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9653
9654 //play sound
9655 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9656 string sound_name = pop_sounds[ sound_idx ];
9657 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
9658
9659 //remove ammo count
9660 magazine.ServerAddAmmoCount(-1);
9661
9662 //if condition then repeat -> ExplodeAmmo
9663 float min_temp_to_explode = 100; //min temperature for item to explode
9664
9665 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
9666 {
9667 ExplodeAmmo();
9668 }
9669 }
9670
9671 // -------------------------------------------------------------------------------
9672 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
9673 {
9674 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
9675
9676 const int CHANCE_DAMAGE_CARGO = 4;
9677 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9678 const int CHANCE_DAMAGE_NOTHING = 2;
9679
9680 if (IsClothing() || IsContainer() || IsItemTent())
9681 {
9682 float dmg = damageResult.GetDamage("","Health") * -0.5;
9683 int chances;
9684 int rnd;
9685
9686 if (GetInventory().GetCargo())
9687 {
9688 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9689 rnd = Math.RandomInt(0,chances);
9690
9691 if (rnd < CHANCE_DAMAGE_CARGO)
9692 {
9693 DamageItemInCargo(dmg);
9694 }
9695 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9696 {
9698 }
9699 }
9700 else
9701 {
9702 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9703 rnd = Math.RandomInt(0,chances);
9704
9705 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9706 {
9708 }
9709 }
9710 }
9711 }
9712
9713 bool DamageItemInCargo(float damage)
9714 {
9715 if (GetInventory().GetCargo())
9716 {
9717 int item_count = GetInventory().GetCargo().GetItemCount();
9718 if (item_count > 0)
9719 {
9720 int random_pick = Math.RandomInt(0, item_count);
9721 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
9722 if (!item.IsExplosive())
9723 {
9724 item.AddHealth("","",damage);
9725 return true;
9726 }
9727 }
9728 }
9729 return false;
9730 }
9731
9732 bool DamageItemAttachments(float damage)
9733 {
9734 int attachment_count = GetInventory().AttachmentCount();
9735 if (attachment_count > 0)
9736 {
9737 int random_pick = Math.RandomInt(0, attachment_count);
9738 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
9739 if (!attachment.IsExplosive())
9740 {
9741 attachment.AddHealth("","",damage);
9742 return true;
9743 }
9744 }
9745 return false;
9746 }
9747
9748 override bool IsSplitable()
9749 {
9750 return m_CanThisBeSplit;
9751 }
9752 //----------------
9753 override bool CanBeSplit()
9754 {
9755 if (IsSplitable() && (GetQuantity() > 1))
9756 return GetInventory().CanRemoveEntity();
9757
9758 return false;
9759 }
9760
9761 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
9762 {
9763 if (!CanBeSplit())
9764 return;
9765
9766 if (GetGame().IsClient())
9767 {
9768 if (ScriptInputUserData.CanStoreInputUserData())
9769 {
9770 ScriptInputUserData ctx = new ScriptInputUserData;
9772 ctx.Write(1);
9773 ItemBase i1 = this; // @NOTE: workaround for correct serialization
9774 ctx.Write(i1);
9775 ctx.Write(destination_entity);
9776 ctx.Write(true);
9777 ctx.Write(slot_id);
9778 ctx.Send();
9779 }
9780 }
9781 else if (!GetGame().IsMultiplayer())
9782 {
9783 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
9784 }
9785 }
9786
9787 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
9788 {
9789 if (!CanBeSplit())
9790 return;
9791
9792 float split_quantity_new;
9793 ref ItemBase new_item;
9794 float quantity = GetQuantity();
9795 float stack_max = GetTargetQuantityMax(slot_id);
9796 InventoryLocation loc = new InventoryLocation;
9797
9798 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9799 {
9800 if (stack_max <= GetQuantity())
9801 split_quantity_new = stack_max;
9802 else
9803 split_quantity_new = GetQuantity();
9804
9805 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
9806 if (new_item)
9807 {
9808 new_item.SetResultOfSplit(true);
9809 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9810 AddQuantity(-split_quantity_new);
9811 new_item.SetQuantity(split_quantity_new);
9812 }
9813 }
9814 else if (destination_entity && slot_id == -1)
9815 {
9816 if (quantity > stack_max)
9817 split_quantity_new = stack_max;
9818 else
9819 split_quantity_new = quantity;
9820
9821 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
9822 {
9823 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
9824 new_item = ItemBase.Cast(o);
9825 }
9826
9827 if (new_item)
9828 {
9829 new_item.SetResultOfSplit(true);
9830 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9831 AddQuantity(-split_quantity_new);
9832 new_item.SetQuantity(split_quantity_new);
9833 }
9834 }
9835 else
9836 {
9837 if (stack_max != 0)
9838 {
9839 if (stack_max < GetQuantity())
9840 {
9841 split_quantity_new = GetQuantity() - stack_max;
9842 }
9843
9844 if (split_quantity_new == 0)
9845 {
9846 if (!GetGame().IsMultiplayer())
9847 player.PhysicalPredictiveDropItem(this);
9848 else
9849 player.ServerDropEntity(this);
9850 return;
9851 }
9852
9853 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
9854
9855 if (new_item)
9856 {
9857 new_item.SetResultOfSplit(true);
9858 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9859 SetQuantity(split_quantity_new);
9860 new_item.SetQuantity(stack_max);
9861 new_item.PlaceOnSurface();
9862 }
9863 }
9864 }
9865 }
9866
9867 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
9868 {
9869 if (!CanBeSplit())
9870 return;
9871
9872 float split_quantity_new;
9873 ref ItemBase new_item;
9874 float quantity = GetQuantity();
9875 float stack_max = GetTargetQuantityMax(slot_id);
9876 InventoryLocation loc = new InventoryLocation;
9877
9878 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9879 {
9880 if (stack_max <= GetQuantity())
9881 split_quantity_new = stack_max;
9882 else
9883 split_quantity_new = GetQuantity();
9884
9885 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
9886 if (new_item)
9887 {
9888 new_item.SetResultOfSplit(true);
9889 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9890 AddQuantity(-split_quantity_new);
9891 new_item.SetQuantity(split_quantity_new);
9892 }
9893 }
9894 else if (destination_entity && slot_id == -1)
9895 {
9896 if (quantity > stack_max)
9897 split_quantity_new = stack_max;
9898 else
9899 split_quantity_new = quantity;
9900
9901 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
9902 {
9903 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
9904 new_item = ItemBase.Cast(o);
9905 }
9906
9907 if (new_item)
9908 {
9909 new_item.SetResultOfSplit(true);
9910 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9911 AddQuantity(-split_quantity_new);
9912 new_item.SetQuantity(split_quantity_new);
9913 }
9914 }
9915 else
9916 {
9917 if (stack_max != 0)
9918 {
9919 if (stack_max < GetQuantity())
9920 {
9921 split_quantity_new = GetQuantity() - stack_max;
9922 }
9923
9924 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
9925
9926 if (new_item)
9927 {
9928 new_item.SetResultOfSplit(true);
9929 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9930 SetQuantity(split_quantity_new);
9931 new_item.SetQuantity(stack_max);
9932 new_item.PlaceOnSurface();
9933 }
9934 }
9935 }
9936 }
9937
9938 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
9939 {
9940 if (!CanBeSplit())
9941 return;
9942
9943 if (GetGame().IsClient())
9944 {
9945 if (ScriptInputUserData.CanStoreInputUserData())
9946 {
9947 ScriptInputUserData ctx = new ScriptInputUserData;
9949 ctx.Write(4);
9950 ItemBase thiz = this; // @NOTE: workaround for correct serialization
9951 ctx.Write(thiz);
9952 dst.WriteToContext(ctx);
9953 ctx.Send();
9954 }
9955 }
9956 else if (!GetGame().IsMultiplayer())
9957 {
9959 }
9960 }
9961
9962 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
9963 {
9964 if (!CanBeSplit())
9965 return;
9966
9967 if (GetGame().IsClient())
9968 {
9969 if (ScriptInputUserData.CanStoreInputUserData())
9970 {
9971 ScriptInputUserData ctx = new ScriptInputUserData;
9973 ctx.Write(2);
9974 ItemBase dummy = this; // @NOTE: workaround for correct serialization
9975 ctx.Write(dummy);
9976 ctx.Write(destination_entity);
9977 ctx.Write(true);
9978 ctx.Write(idx);
9979 ctx.Write(row);
9980 ctx.Write(col);
9981 ctx.Send();
9982 }
9983 }
9984 else if (!GetGame().IsMultiplayer())
9985 {
9986 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
9987 }
9988 }
9989
9990 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
9991 {
9993 }
9994
9995 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
9996 {
9997 if (!CanBeSplit())
9998 return this;
9999
10000 float quantity = GetQuantity();
10001 float split_quantity_new;
10002 ItemBase new_item;
10003 if (dst.IsValid())
10004 {
10005 int slot_id = dst.GetSlot();
10006 float stack_max = GetTargetQuantityMax(slot_id);
10007
10008 if (quantity > stack_max)
10009 split_quantity_new = stack_max;
10010 else
10011 split_quantity_new = quantity;
10012
10013 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
10014
10015 if (new_item)
10016 {
10017 new_item.SetResultOfSplit(true);
10018 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10019 AddQuantity(-split_quantity_new);
10020 new_item.SetQuantity(split_quantity_new);
10021 }
10022
10023 return new_item;
10024 }
10025
10026 return null;
10027 }
10028
10029 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
10030 {
10031 if (!CanBeSplit())
10032 return;
10033
10034 float quantity = GetQuantity();
10035 float split_quantity_new;
10036 ref ItemBase new_item;
10037 if (destination_entity)
10038 {
10039 float stackable = GetTargetQuantityMax();
10040 if (quantity > stackable)
10041 split_quantity_new = stackable;
10042 else
10043 split_quantity_new = quantity;
10044
10045 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
10046 if (new_item)
10047 {
10048 new_item.SetResultOfSplit(true);
10049 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10050 AddQuantity(-split_quantity_new);
10051 new_item.SetQuantity(split_quantity_new);
10052 }
10053 }
10054 }
10055
10056 void SplitIntoStackMaxHandsClient(PlayerBase player)
10057 {
10058 if (!CanBeSplit())
10059 return;
10060
10061 if (GetGame().IsClient())
10062 {
10063 if (ScriptInputUserData.CanStoreInputUserData())
10064 {
10065 ScriptInputUserData ctx = new ScriptInputUserData;
10067 ctx.Write(3);
10068 ItemBase i1 = this; // @NOTE: workaround for correct serialization
10069 ctx.Write(i1);
10070 ItemBase destination_entity = this;
10071 ctx.Write(destination_entity);
10072 ctx.Write(true);
10073 ctx.Write(0);
10074 ctx.Send();
10075 }
10076 }
10077 else if (!GetGame().IsMultiplayer())
10078 {
10079 SplitIntoStackMaxHands(player);
10080 }
10081 }
10082
10083 void SplitIntoStackMaxHands(PlayerBase player)
10084 {
10085 if (!CanBeSplit())
10086 return;
10087
10088 float quantity = GetQuantity();
10089 float split_quantity_new;
10090 ref ItemBase new_item;
10091 if (player)
10092 {
10093 float stackable = GetTargetQuantityMax();
10094 if (quantity > stackable)
10095 split_quantity_new = stackable;
10096 else
10097 split_quantity_new = quantity;
10098
10099 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
10100 new_item = ItemBase.Cast(in_hands);
10101 if (new_item)
10102 {
10103 new_item.SetResultOfSplit(true);
10104 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10105 AddQuantity(-split_quantity_new);
10106 new_item.SetQuantity(split_quantity_new);
10107 }
10108 }
10109 }
10110
10111 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
10112 {
10113 if (!CanBeSplit())
10114 return;
10115
10116 float quantity = GetQuantity();
10117 float split_quantity_new = Math.Floor(quantity * 0.5);
10118
10119 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
10120
10121 if (new_item)
10122 {
10123 if (new_item.GetQuantityMax() < split_quantity_new)
10124 {
10125 split_quantity_new = new_item.GetQuantityMax();
10126 }
10127
10128 new_item.SetResultOfSplit(true);
10129 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10130
10131 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
10132 {
10133 AddQuantity(-1);
10134 new_item.SetQuantity(1);
10135 }
10136 else
10137 {
10138 AddQuantity(-split_quantity_new);
10139 new_item.SetQuantity(split_quantity_new);
10140 }
10141 }
10142 }
10143
10144 void SplitItem(PlayerBase player)
10145 {
10146 if (!CanBeSplit())
10147 return;
10148
10149 float quantity = GetQuantity();
10150 float split_quantity_new = Math.Floor(quantity / 2);
10151
10152 InventoryLocation invloc = new InventoryLocation;
10153 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
10154
10155 ItemBase new_item;
10156 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10157
10158 if (new_item)
10159 {
10160 if (new_item.GetQuantityMax() < split_quantity_new)
10161 {
10162 split_quantity_new = new_item.GetQuantityMax();
10163 }
10164 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
10165 {
10166 AddQuantity(-1);
10167 new_item.SetQuantity(1);
10168 }
10169 else
10170 {
10171 AddQuantity(-split_quantity_new);
10172 new_item.SetQuantity(split_quantity_new);
10173 }
10174 }
10175 }
10176
10178 void OnQuantityChanged(float delta)
10179 {
10180 SetWeightDirty();
10181 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
10182
10183 if (parent)
10184 parent.OnAttachmentQuantityChangedEx(this, delta);
10185
10186 if (IsLiquidContainer())
10187 {
10188 if (GetQuantityNormalized() <= 0.0)
10189 {
10191 }
10192 else if (GetLiquidType() == LIQUID_NONE)
10193 {
10194 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
10196 }
10197 }
10198
10199 }
10200
10203 {
10204 // insert code here
10205 }
10206
10208 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
10209 {
10211 }
10212
10213 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
10214 {
10215 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10216
10217 if (GetGame().IsServer())
10218 {
10219 if (newLevel == GameConstants.STATE_RUINED)
10220 {
10222 EntityAI parent = GetHierarchyParent();
10223 if (parent && parent.IsFireplace())
10224 {
10225 CargoBase cargo = GetInventory().GetCargo();
10226 if (cargo)
10227 {
10228 for (int i = 0; i < cargo.GetItemCount(); ++i)
10229 {
10230 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
10231 }
10232 }
10233 }
10234 }
10235
10236 if (IsResultOfSplit())
10237 {
10238 // reset the splitting result flag, return to normal item behavior
10239 SetResultOfSplit(false);
10240 return;
10241 }
10242
10243 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10244 {
10245 SetCleanness(0);//unclean the item upon damage dealt
10246 }
10247 }
10248 }
10249
10250 // just the split? TODO: verify
10251 override void OnRightClick()
10252 {
10253 super.OnRightClick();
10254
10255 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
10256 {
10257 if (GetGame().IsClient())
10258 {
10259 if (ScriptInputUserData.CanStoreInputUserData())
10260 {
10261 vector m4[4];
10262 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
10263
10264 EntityAI root = GetHierarchyRoot();
10265
10266 InventoryLocation dst = new InventoryLocation;
10267 if (!player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.CARGO, dst))
10268 {
10269 if (root)
10270 {
10271 root.GetTransform(m4);
10272 dst.SetGround(this, m4);
10273 }
10274 else
10275 GetInventory().GetCurrentInventoryLocation(dst);
10276 }
10277 else
10278 {
10279 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
10280 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
10281 this shouldnt cause issues within this scope*/
10282 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
10283 {
10284 if (root)
10285 {
10286 root.GetTransform(m4);
10287 dst.SetGround(this, m4);
10288 }
10289 else
10290 GetInventory().GetCurrentInventoryLocation(dst);
10291 }
10292 else
10293 {
10294 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10295 }
10296 }
10297
10298 ScriptInputUserData ctx = new ScriptInputUserData;
10300 ctx.Write(4);
10301 ItemBase thiz = this; // @NOTE: workaround for correct serialization
10302 ctx.Write(thiz);
10303 dst.WriteToContext(ctx);
10304 ctx.Write(true); // dummy
10305 ctx.Send();
10306 }
10307 }
10308 else if (!GetGame().IsMultiplayer())
10309 {
10310 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
10311 }
10312 }
10313 }
10314
10315 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
10316 {
10317 //TODO: delete check zero quantity check after fix double posts hands fsm events
10318 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
10319 return false;
10320
10321 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10322 return false;
10323
10324 //can_this_be_combined = ConfigGetBool("canBeSplit");
10326 return false;
10327
10328
10329 Magazine mag = Magazine.Cast(this);
10330 if (mag)
10331 {
10332 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10333 return false;
10334
10335 if (stack_max_limit)
10336 {
10337 Magazine other_mag = Magazine.Cast(other_item);
10338 if (other_item)
10339 {
10340 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10341 return false;
10342 }
10343
10344 }
10345 }
10346 else
10347 {
10348 //TODO: delete check zero quantity check after fix double posts hands fsm events
10349 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
10350 return false;
10351
10352 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
10353 return false;
10354 }
10355
10356 PlayerBase player = null;
10357 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
10358 {
10359 if (player.GetInventory().HasAttachment(this))
10360 return false;
10361
10362 if (player.IsItemsToDelete())
10363 return false;
10364 }
10365
10366 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10367 return false;
10368
10369 int slotID;
10370 string slotName;
10371 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10372 return false;
10373
10374 return true;
10375 }
10376
10377 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
10378 {
10379 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
10380 }
10381
10382 bool IsResultOfSplit()
10383 {
10384 return m_IsResultOfSplit;
10385 }
10386
10387 void SetResultOfSplit(bool value)
10388 {
10389 m_IsResultOfSplit = value;
10390 }
10391
10392 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
10393 {
10394 return ComputeQuantityUsedEx(other_item, use_stack_max);
10395 }
10396
10397 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
10398 {
10399 float other_item_quantity = other_item.GetQuantity();
10400 float this_free_space;
10401
10402 float stack_max = GetQuantityMax();
10403
10404 this_free_space = stack_max - GetQuantity();
10405
10406 if (other_item_quantity > this_free_space)
10407 {
10408 return this_free_space;
10409 }
10410 else
10411 {
10412 return other_item_quantity;
10413 }
10414 }
10415
10416 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
10417 {
10418 CombineItems(ItemBase.Cast(entity2),use_stack_max);
10419 }
10420
10421 void CombineItems(ItemBase other_item, bool use_stack_max = true)
10422 {
10423 if (!CanBeCombined(other_item, false))
10424 return;
10425
10426 if (!IsMagazine() && other_item)
10427 {
10428 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
10429 if (quantity_used != 0)
10430 {
10431 float hp1 = GetHealth01("","");
10432 float hp2 = other_item.GetHealth01("","");
10433 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
10434 hpResult = hpResult / (GetQuantity() + quantity_used);
10435
10436 hpResult *= GetMaxHealth();
10437 Math.Round(hpResult);
10438 SetHealth("", "Health", hpResult);
10439
10440 AddQuantity(quantity_used);
10441 other_item.AddQuantity(-quantity_used);
10442 }
10443 }
10444 OnCombine(other_item);
10445 }
10446
10447 void OnCombine(ItemBase other_item)
10448 {
10449 #ifdef SERVER
10450 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10451 GetHierarchyParent().IncreaseLifetimeUp();
10452 #endif
10453 };
10454
10455 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
10456 {
10457 PlayerBase p = PlayerBase.Cast(player);
10458
10459 array<int> recipesIds = p.m_Recipes;
10460 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
10461 if (moduleRecipesManager)
10462 {
10463 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
10464 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
10465 }
10466
10467 for (int i = 0;i < recipesIds.Count(); i++)
10468 {
10469 int key = recipesIds.Get(i);
10470 string recipeName = moduleRecipesManager.GetRecipeName(key);
10471 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
10472 }
10473 }
10474
10475 // -------------------------------------------------------------------------
10476 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10477 {
10478 super.GetDebugActions(outputList);
10479
10480 //quantity
10481 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
10482 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
10483 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
10484 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
10485
10486 //health
10487 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
10488 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
10489 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
10490 //temperature
10491 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
10492 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
10493 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
10494
10495 //wet
10496 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
10497 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
10498
10499 //liquidtype
10500 if (IsLiquidContainer())
10501 {
10502 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
10503 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
10504 }
10505
10506 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
10507 // watch
10508 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
10509 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
10510
10511 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
10512 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
10513 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
10514 }
10515
10516 // -------------------------------------------------------------------------
10517 // -------------------------------------------------------------------------
10518 // -------------------------------------------------------------------------
10519 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
10520 {
10521 super.OnAction(action_id, player, ctx);
10522 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
10523 {
10524 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
10525 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
10526 PlayerBase p = PlayerBase.Cast(player);
10527 if (EActions.RECIPES_RANGE_START < 1000)
10528 {
10529 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10530 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10531 }
10532 }
10533 #ifndef SERVER
10534 else if (action_id == EActions.WATCH_PLAYER)
10535 {
10536 PluginDeveloper.SetDeveloperItemClientEx(player);
10537 }
10538 #endif
10539 if (GetGame().IsServer())
10540 {
10541 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10542 {
10543 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10544 OnDebugButtonPressServer(id + 1);
10545 }
10546
10547 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10548 {
10549 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10550 InsertAgent(agent_id,100);
10551 }
10552
10553 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10554 {
10555 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10556 RemoveAgent(agent_id2);
10557 }
10558
10559 else if (action_id == EActions.ADD_QUANTITY)
10560 {
10561 if (IsMagazine())
10562 {
10563 Magazine mag = Magazine.Cast(this);
10564 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10565 }
10566 else
10567 {
10568 AddQuantity(GetQuantityMax() * 0.2);
10569 }
10570
10571 if (m_EM)
10572 {
10573 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10574 }
10575 //PrintVariables();
10576 }
10577
10578 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
10579 {
10580 if (IsMagazine())
10581 {
10582 Magazine mag2 = Magazine.Cast(this);
10583 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10584 }
10585 else
10586 {
10587 AddQuantity(- GetQuantityMax() * 0.2);
10588 }
10589 if (m_EM)
10590 {
10591 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10592 }
10593 //PrintVariables();
10594 }
10595
10596 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
10597 {
10598 SetQuantity(0);
10599
10600 if (m_EM)
10601 {
10602 m_EM.SetEnergy(0);
10603 }
10604 }
10605
10606 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
10607 {
10609
10610 if (m_EM)
10611 {
10612 m_EM.SetEnergy(m_EM.GetEnergyMax());
10613 }
10614 }
10615
10616 else if (action_id == EActions.ADD_HEALTH)
10617 {
10618 AddHealth("","",GetMaxHealth("","Health")/5);
10619 }
10620 else if (action_id == EActions.REMOVE_HEALTH)
10621 {
10622 AddHealth("","",-GetMaxHealth("","Health")/5);
10623 }
10624 else if (action_id == EActions.DESTROY_HEALTH)
10625 {
10626 SetHealth01("","",0);
10627 }
10628 else if (action_id == EActions.WATCH_ITEM)
10629 {
10631 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
10632 #ifdef DEVELOPER
10633 SetDebugDeveloper_item(this);
10634 #endif
10635 }
10636
10637 else if (action_id == EActions.ADD_TEMPERATURE)
10638 {
10639 AddTemperature(20);
10640 //PrintVariables();
10641 }
10642
10643 else if (action_id == EActions.REMOVE_TEMPERATURE)
10644 {
10645 AddTemperature(-20);
10646 //PrintVariables();
10647 }
10648
10649 else if (action_id == EActions.FLIP_FROZEN)
10650 {
10651 SetFrozen(!GetIsFrozen());
10652 //PrintVariables();
10653 }
10654
10655 else if (action_id == EActions.ADD_WETNESS)
10656 {
10657 AddWet(GetWetMax()/5);
10658 //PrintVariables();
10659 }
10660
10661 else if (action_id == EActions.REMOVE_WETNESS)
10662 {
10663 AddWet(-GetWetMax()/5);
10664 //PrintVariables();
10665 }
10666
10667 else if (action_id == EActions.LIQUIDTYPE_UP)
10668 {
10669 int curr_type = GetLiquidType();
10670 SetLiquidType(curr_type * 2);
10671 //AddWet(1);
10672 //PrintVariables();
10673 }
10674
10675 else if (action_id == EActions.LIQUIDTYPE_DOWN)
10676 {
10677 int curr_type2 = GetLiquidType();
10678 SetLiquidType(curr_type2 / 2);
10679 }
10680
10681 else if (action_id == EActions.MAKE_SPECIAL)
10682 {
10683 auto debugParams = DebugSpawnParams.WithPlayer(player);
10684 OnDebugSpawnEx(debugParams);
10685 }
10686
10687 else if (action_id == EActions.DELETE)
10688 {
10689 Delete();
10690 }
10691
10692 }
10693
10694
10695 return false;
10696 }
10697
10698 // -------------------------------------------------------------------------
10699
10700
10703 void OnActivatedByTripWire();
10704
10706 void OnActivatedByItem(notnull ItemBase item);
10707
10708 //----------------------------------------------------------------
10709 //returns true if item is able to explode when put in fire
10710 bool CanExplodeInFire()
10711 {
10712 return false;
10713 }
10714
10715 //----------------------------------------------------------------
10716 bool CanEat()
10717 {
10718 return true;
10719 }
10720
10721 //----------------------------------------------------------------
10722 override bool IsIgnoredByConstruction()
10723 {
10724 return true;
10725 }
10726
10727 //----------------------------------------------------------------
10728 //has FoodStages in config?
10729 bool HasFoodStage()
10730 {
10731 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
10732 return GetGame().ConfigIsExisting(config_path);
10733 }
10734
10736 FoodStage GetFoodStage()
10737 {
10738 return null;
10739 }
10740
10741 bool CanBeCooked()
10742 {
10743 return false;
10744 }
10745
10746 bool CanBeCookedOnStick()
10747 {
10748 return false;
10749 }
10750
10752 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
10754
10755 //----------------------------------------------------------------
10756 bool CanRepair(ItemBase item_repair_kit)
10757 {
10758 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
10759 return module_repairing.CanRepair(this, item_repair_kit);
10760 }
10761
10762 //----------------------------------------------------------------
10763 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
10764 {
10765 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
10766 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10767 }
10768
10769 //----------------------------------------------------------------
10770 int GetItemSize()
10771 {
10772 /*
10773 vector v_size = this.ConfigGetVector("itemSize");
10774 int v_size_x = v_size[0];
10775 int v_size_y = v_size[1];
10776 int size = v_size_x * v_size_y;
10777 return size;
10778 */
10779
10780 return 1;
10781 }
10782
10783 //----------------------------------------------------------------
10784 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
10785 bool CanBeMovedOverride()
10786 {
10787 return m_CanBeMovedOverride;
10788 }
10789
10790 //----------------------------------------------------------------
10791 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
10792 void SetCanBeMovedOverride(bool setting)
10793 {
10794 m_CanBeMovedOverride = setting;
10795 }
10796
10797 //----------------------------------------------------------------
10805 void MessageToOwnerStatus(string text)
10806 {
10807 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10808
10809 if (player)
10810 {
10811 player.MessageStatus(text);
10812 }
10813 }
10814
10815 //----------------------------------------------------------------
10823 void MessageToOwnerAction(string text)
10824 {
10825 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10826
10827 if (player)
10828 {
10829 player.MessageAction(text);
10830 }
10831 }
10832
10833 //----------------------------------------------------------------
10841 void MessageToOwnerFriendly(string text)
10842 {
10843 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10844
10845 if (player)
10846 {
10847 player.MessageFriendly(text);
10848 }
10849 }
10850
10851 //----------------------------------------------------------------
10859 void MessageToOwnerImportant(string text)
10860 {
10861 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10862
10863 if (player)
10864 {
10865 player.MessageImportant(text);
10866 }
10867 }
10868
10869 override bool IsItemBase()
10870 {
10871 return true;
10872 }
10873
10874 // Checks if item is of questioned kind
10875 override bool KindOf(string tag)
10876 {
10877 bool found = false;
10878 string item_name = this.GetType();
10879 ref TStringArray item_tag_array = new TStringArray;
10880 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
10881
10882 int array_size = item_tag_array.Count();
10883 for (int i = 0; i < array_size; i++)
10884 {
10885 if (item_tag_array.Get(i) == tag)
10886 {
10887 found = true;
10888 break;
10889 }
10890 }
10891 return found;
10892 }
10893
10894
10895 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
10896 {
10897 //Debug.Log("OnRPC called");
10898 super.OnRPC(sender, rpc_type,ctx);
10899
10900 //Play soundset for attachment locking (ActionLockAttachment.c)
10901 switch (rpc_type)
10902 {
10903 #ifndef SERVER
10904 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10905 Param2<bool, string> p = new Param2<bool, string>(false, "");
10906
10907 if (!ctx.Read(p))
10908 return;
10909
10910 bool play = p.param1;
10911 string soundSet = p.param2;
10912
10913 if (play)
10914 {
10915 if (m_LockingSound)
10916 {
10918 {
10919 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
10920 }
10921 }
10922 else
10923 {
10924 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
10925 }
10926 }
10927 else
10928 {
10929 SEffectManager.DestroyEffect(m_LockingSound);
10930 }
10931
10932 break;
10933 #endif
10934
10935 }
10936
10937 if (GetWrittenNoteData())
10938 {
10939 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
10940 }
10941 }
10942
10943 //-----------------------------
10944 // VARIABLE MANIPULATION SYSTEM
10945 //-----------------------------
10946 int NameToID(string name)
10947 {
10948 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
10949 return plugin.GetID(name);
10950 }
10951
10952 string IDToName(int id)
10953 {
10954 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
10955 return plugin.GetName(id);
10956 }
10957
10959 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
10960 {
10961 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
10962 //read the flags
10963 int varFlags;
10964 if (!ctx.Read(varFlags))
10965 return;
10966
10967 if (varFlags & ItemVariableFlags.FLOAT)
10968 {
10969 ReadVarsFromCTX(ctx);
10970 }
10971 }
10972
10973 override void SerializeNumericalVars(array<float> floats_out)
10974 {
10975 //some variables handled on EntityAI level already!
10976 super.SerializeNumericalVars(floats_out);
10977
10978 // the order of serialization must be the same as the order of de-serialization
10979 //--------------------------------------------
10980 if (IsVariableSet(VARIABLE_QUANTITY))
10981 {
10982 floats_out.Insert(m_VarQuantity);
10983 }
10984 //--------------------------------------------
10985 if (IsVariableSet(VARIABLE_WET))
10986 {
10987 floats_out.Insert(m_VarWet);
10988 }
10989 //--------------------------------------------
10990 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
10991 {
10992 floats_out.Insert(m_VarLiquidType);
10993 }
10994 //--------------------------------------------
10995 if (IsVariableSet(VARIABLE_COLOR))
10996 {
10997 floats_out.Insert(m_ColorComponentR);
10998 floats_out.Insert(m_ColorComponentG);
10999 floats_out.Insert(m_ColorComponentB);
11000 floats_out.Insert(m_ColorComponentA);
11001 }
11002 //--------------------------------------------
11003 if (IsVariableSet(VARIABLE_CLEANNESS))
11004 {
11005 floats_out.Insert(m_Cleanness);
11006 }
11007 }
11008
11009 override void DeSerializeNumericalVars(array<float> floats)
11010 {
11011 //some variables handled on EntityAI level already!
11012 super.DeSerializeNumericalVars(floats);
11013
11014 // the order of serialization must be the same as the order of de-serialization
11015 int index = 0;
11016 int mask = Math.Round(floats.Get(index));
11017
11018 index++;
11019 //--------------------------------------------
11020 if (mask & VARIABLE_QUANTITY)
11021 {
11022 if (m_IsStoreLoad)
11023 {
11024 SetStoreLoadedQuantity(floats.Get(index));
11025 }
11026 else
11027 {
11028 float quantity = floats.Get(index);
11029 SetQuantity(quantity, true, false, false, false);
11030 }
11031 index++;
11032 }
11033 //--------------------------------------------
11034 if (mask & VARIABLE_WET)
11035 {
11036 float wet = floats.Get(index);
11037 SetWet(wet);
11038 index++;
11039 }
11040 //--------------------------------------------
11041 if (mask & VARIABLE_LIQUIDTYPE)
11042 {
11043 int liquidtype = Math.Round(floats.Get(index));
11044 SetLiquidType(liquidtype);
11045 index++;
11046 }
11047 //--------------------------------------------
11048 if (mask & VARIABLE_COLOR)
11049 {
11050 m_ColorComponentR = Math.Round(floats.Get(index));
11051 index++;
11052 m_ColorComponentG = Math.Round(floats.Get(index));
11053 index++;
11054 m_ColorComponentB = Math.Round(floats.Get(index));
11055 index++;
11056 m_ColorComponentA = Math.Round(floats.Get(index));
11057 index++;
11058 }
11059 //--------------------------------------------
11060 if (mask & VARIABLE_CLEANNESS)
11061 {
11062 int cleanness = Math.Round(floats.Get(index));
11063 SetCleanness(cleanness);
11064 index++;
11065 }
11066 }
11067
11068 override void WriteVarsToCTX(ParamsWriteContext ctx)
11069 {
11070 super.WriteVarsToCTX(ctx);
11071
11072 //--------------------------------------------
11073 if (IsVariableSet(VARIABLE_QUANTITY))
11074 {
11075 ctx.Write(GetQuantity());
11076 }
11077 //--------------------------------------------
11078 if (IsVariableSet(VARIABLE_WET))
11079 {
11080 ctx.Write(GetWet());
11081 }
11082 //--------------------------------------------
11083 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
11084 {
11085 ctx.Write(GetLiquidType());
11086 }
11087 //--------------------------------------------
11088 if (IsVariableSet(VARIABLE_COLOR))
11089 {
11090 int r,g,b,a;
11091 GetColor(r,g,b,a);
11092 ctx.Write(r);
11093 ctx.Write(g);
11094 ctx.Write(b);
11095 ctx.Write(a);
11096 }
11097 //--------------------------------------------
11098 if (IsVariableSet(VARIABLE_CLEANNESS))
11099 {
11100 ctx.Write(GetCleanness());
11101 }
11102 }
11103
11104 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
11105 {
11106 if (!super.ReadVarsFromCTX(ctx,version))
11107 return false;
11108
11109 int intValue;
11110 float value;
11111
11112 if (version < 140)
11113 {
11114 if (!ctx.Read(intValue))
11115 return false;
11116
11117 m_VariablesMask = intValue;
11118 }
11119
11120 if (m_VariablesMask & VARIABLE_QUANTITY)
11121 {
11122 if (!ctx.Read(value))
11123 return false;
11124
11125 if (IsStoreLoad())
11126 {
11128 }
11129 else
11130 {
11131 SetQuantity(value, true, false, false, false);
11132 }
11133 }
11134 //--------------------------------------------
11135 if (version < 140)
11136 {
11137 if (m_VariablesMask & VARIABLE_TEMPERATURE)
11138 {
11139 if (!ctx.Read(value))
11140 return false;
11141 SetTemperatureDirect(value);
11142 }
11143 }
11144 //--------------------------------------------
11145 if (m_VariablesMask & VARIABLE_WET)
11146 {
11147 if (!ctx.Read(value))
11148 return false;
11149 SetWet(value);
11150 }
11151 //--------------------------------------------
11152 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
11153 {
11154 if (!ctx.Read(intValue))
11155 return false;
11156 SetLiquidType(intValue);
11157 }
11158 //--------------------------------------------
11159 if (m_VariablesMask & VARIABLE_COLOR)
11160 {
11161 int r,g,b,a;
11162 if (!ctx.Read(r))
11163 return false;
11164 if (!ctx.Read(g))
11165 return false;
11166 if (!ctx.Read(b))
11167 return false;
11168 if (!ctx.Read(a))
11169 return false;
11170
11171 SetColor(r,g,b,a);
11172 }
11173 //--------------------------------------------
11174 if (m_VariablesMask & VARIABLE_CLEANNESS)
11175 {
11176 if (!ctx.Read(intValue))
11177 return false;
11178 SetCleanness(intValue);
11179 }
11180 //--------------------------------------------
11181 if (version >= 138 && version < 140)
11182 {
11183 if (m_VariablesMask & VARIABLE_TEMPERATURE)
11184 {
11185 if (!ctx.Read(intValue))
11186 return false;
11187 SetFrozen(intValue);
11188 }
11189 }
11190
11191 return true;
11192 }
11193
11194 //----------------------------------------------------------------
11195 override bool OnStoreLoad(ParamsReadContext ctx, int version)
11196 {
11197 m_IsStoreLoad = true;
11199 {
11200 m_FixDamageSystemInit = true;
11201 }
11202
11203 if (!super.OnStoreLoad(ctx, version))
11204 {
11205 m_IsStoreLoad = false;
11206 return false;
11207 }
11208
11209 if (version >= 114)
11210 {
11211 bool hasQuickBarIndexSaved;
11212
11213 if (!ctx.Read(hasQuickBarIndexSaved))
11214 {
11215 m_IsStoreLoad = false;
11216 return false;
11217 }
11218
11219 if (hasQuickBarIndexSaved)
11220 {
11221 int itmQBIndex;
11222
11223 //Load quickbar item bind
11224 if (!ctx.Read(itmQBIndex))
11225 {
11226 m_IsStoreLoad = false;
11227 return false;
11228 }
11229
11230 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11231 if (itmQBIndex != -1 && parentPlayer)
11232 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11233 }
11234 }
11235 else
11236 {
11237 // Backup of how it used to be
11238 PlayerBase player;
11239 int itemQBIndex;
11240 if (version == int.MAX)
11241 {
11242 if (!ctx.Read(itemQBIndex))
11243 {
11244 m_IsStoreLoad = false;
11245 return false;
11246 }
11247 }
11248 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11249 {
11250 //Load quickbar item bind
11251 if (!ctx.Read(itemQBIndex))
11252 {
11253 m_IsStoreLoad = false;
11254 return false;
11255 }
11256 if (itemQBIndex != -1 && player)
11257 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11258 }
11259 }
11260
11261 if (version < 140)
11262 {
11263 // variable management system
11264 if (!LoadVariables(ctx, version))
11265 {
11266 m_IsStoreLoad = false;
11267 return false;
11268 }
11269 }
11270
11271 //agent trasmission system
11272 if (!LoadAgents(ctx, version))
11273 {
11274 m_IsStoreLoad = false;
11275 return false;
11276 }
11277 if (version >= 132)
11278 {
11279 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
11280 if (raib)
11281 {
11282 if (!raib.OnStoreLoad(ctx,version))
11283 {
11284 m_IsStoreLoad = false;
11285 return false;
11286 }
11287 }
11288 }
11289
11290 m_IsStoreLoad = false;
11291 return true;
11292 }
11293
11294 //----------------------------------------------------------------
11295
11296 override void OnStoreSave(ParamsWriteContext ctx)
11297 {
11298 super.OnStoreSave(ctx);
11299
11300 PlayerBase player;
11301 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11302 {
11303 ctx.Write(true); // Keep track of if we should actually read this in or not
11304 //Save quickbar item bind
11305 int itemQBIndex = -1;
11306 itemQBIndex = player.FindQuickBarEntityIndex(this);
11307 ctx.Write(itemQBIndex);
11308 }
11309 else
11310 {
11311 ctx.Write(false); // Keep track of if we should actually read this in or not
11312 }
11313
11314 SaveAgents(ctx);//agent trasmission system
11315
11316 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
11317 if (raib)
11318 {
11319 raib.OnStoreSave(ctx);
11320 }
11321 }
11322 //----------------------------------------------------------------
11323
11324 override void AfterStoreLoad()
11325 {
11326 super.AfterStoreLoad();
11327
11329 {
11331 }
11332
11333 if (GetStoreLoadedQuantity() != float.LOWEST)
11334 {
11336 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
11337 }
11338 }
11339
11340 override void EEOnAfterLoad()
11341 {
11342 super.EEOnAfterLoad();
11343
11345 {
11346 m_FixDamageSystemInit = false;
11347 }
11348
11351 }
11352
11353 bool CanBeDisinfected()
11354 {
11355 return false;
11356 }
11357
11358
11359 //----------------------------------------------------------------
11360 override void OnVariablesSynchronized()
11361 {
11362 if (m_Initialized)
11363 {
11364 #ifdef PLATFORM_CONSOLE
11365 //bruteforce it is
11366 if (IsSplitable())
11367 {
11368 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
11369 if (menu)
11370 {
11371 menu.Refresh();
11372 }
11373 }
11374 #endif
11375 }
11376
11378 {
11379 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
11380 m_WantPlayImpactSound = false;
11381 }
11382
11384 {
11385 SetWeightDirty();
11387 }
11388 if (m_VarWet != m_VarWetPrev)
11389 {
11392 }
11393
11394 if (m_SoundSyncPlay != 0)
11395 {
11396 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
11397 m_SoundSyncPlay = 0;
11398 }
11399 if (m_SoundSyncStop != 0)
11400 {
11401 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
11402 m_SoundSyncStop = 0;
11403 }
11404
11405 super.OnVariablesSynchronized();
11406 }
11407
11408 //------------------------- Quantity
11409 //----------------------------------------------------------------
11411 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
11412 {
11413 if (!IsServerCheck(allow_client))
11414 return false;
11415
11416 if (!HasQuantity())
11417 return false;
11418
11419 float min = GetQuantityMin();
11420 float max = GetQuantityMax();
11421
11422 if (value <= (min + 0.001))
11423 value = min;
11424
11425 if (value == min)
11426 {
11427 if (destroy_config)
11428 {
11429 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11430 if (dstr)
11431 {
11432 m_VarQuantity = Math.Clamp(value, min, max);
11433 this.Delete();
11434 return true;
11435 }
11436 }
11437 else if (destroy_forced)
11438 {
11439 m_VarQuantity = Math.Clamp(value, min, max);
11440 this.Delete();
11441 return true;
11442 }
11443 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
11444 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
11445 }
11446
11447 float delta = m_VarQuantity;
11448 m_VarQuantity = Math.Clamp(value, min, max);
11449
11450 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
11451 {
11452 delta = m_VarQuantity - delta;
11453
11454 if (delta)
11455 OnQuantityChanged(delta);
11456 }
11457
11458 SetVariableMask(VARIABLE_QUANTITY);
11459
11460 return false;
11461 }
11462
11463 //----------------------------------------------------------------
11465 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
11466 {
11467 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
11468 }
11469 //----------------------------------------------------------------
11470 void SetQuantityMax()
11471 {
11472 float max = GetQuantityMax();
11473 SetQuantity(max);
11474 }
11475
11476 override void SetQuantityToMinimum()
11477 {
11478 float min = GetQuantityMin();
11479 SetQuantity(min);
11480 }
11481 //----------------------------------------------------------------
11483 void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
11484 {
11485 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
11486 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
11487 SetQuantity(result, destroy_config, destroy_forced);
11488 }
11489
11490 //----------------------------------------------------------------
11492 override float GetQuantityNormalized()
11493 {
11494 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
11495 }
11496
11498 {
11499 return GetQuantityNormalized();
11500 }
11501
11502 /*void SetAmmoNormalized(float value)
11503 {
11504 float value_clamped = Math.Clamp(value, 0, 1);
11505 Magazine this_mag = Magazine.Cast(this);
11506 int max_rounds = this_mag.GetAmmoMax();
11507 int result = value * max_rounds;//can the rounded if higher precision is required
11508 this_mag.SetAmmoCount(result);
11509 }*/
11510 //----------------------------------------------------------------
11511 override int GetQuantityMax()
11512 {
11513 int slot = -1;
11514 if (GetInventory())
11515 {
11516 InventoryLocation il = new InventoryLocation;
11517 GetInventory().GetCurrentInventoryLocation(il);
11518 slot = il.GetSlot();
11519 }
11520
11521 return GetTargetQuantityMax(slot);
11522 }
11523
11524 override int GetTargetQuantityMax(int attSlotID = -1)
11525 {
11526 float quantity_max = 0;
11527
11528 if (IsSplitable()) //only stackable/splitable items can check for stack size
11529 {
11530 if (attSlotID != -1)
11531 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11532
11533 if (quantity_max <= 0)
11534 quantity_max = m_VarStackMax;
11535 }
11536
11537 if (quantity_max <= 0)
11538 quantity_max = m_VarQuantityMax;
11539
11540 return quantity_max;
11541 }
11542 //----------------------------------------------------------------
11543 override int GetQuantityMin()
11544 {
11545 return m_VarQuantityMin;
11546 }
11547 //----------------------------------------------------------------
11548 int GetQuantityInit()
11549 {
11550 return m_VarQuantityInit;
11551 }
11552
11553 //----------------------------------------------------------------
11554 override bool HasQuantity()
11555 {
11556 return !(GetQuantityMax() - GetQuantityMin() == 0);
11557 }
11558
11559 override float GetQuantity()
11560 {
11561 return m_VarQuantity;
11562 }
11563
11564 bool IsFullQuantity()
11565 {
11566 return GetQuantity() >= GetQuantityMax();
11567 }
11568
11569 //Calculates weight of single item without attachments and cargo
11570 override float GetSingleInventoryItemWeightEx()
11571 {
11572 //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
11573 float weightEx = GetWeightEx();//overall weight of the item
11574 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
11575 return weightEx - special;
11576 }
11577
11578 // Obsolete, use GetSingleInventoryItemWeightEx() instead
11580 {
11582 }
11583
11584 override protected float GetWeightSpecialized(bool forceRecalc = false)
11585 {
11586 if (IsSplitable()) //quantity determines size of the stack
11587 {
11588 #ifdef DEVELOPER
11589 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11590 {
11591 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11592 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
11593 }
11594 #endif
11595
11596 return GetQuantity() * GetConfigWeightModified();
11597 }
11598 else if (HasEnergyManager())// items with energy manager
11599 {
11600 #ifdef DEVELOPER
11601 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11602 {
11603 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11604 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
11605 }
11606 #endif
11607 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
11608 }
11609 else//everything else
11610 {
11611 #ifdef DEVELOPER
11612 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11613 {
11614 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11615 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
11616 }
11617 #endif
11618 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
11619 }
11620 }
11621
11623 int GetNumberOfItems()
11624 {
11625 int item_count = 0;
11626 ItemBase item;
11627
11628 if (GetInventory().GetCargo() != NULL)
11629 {
11630 item_count = GetInventory().GetCargo().GetItemCount();
11631 }
11632
11633 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
11634 {
11635 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
11636 if (item)
11637 item_count += item.GetNumberOfItems();
11638 }
11639 return item_count;
11640 }
11641
11643 float GetUnitWeight(bool include_wetness = true)
11644 {
11645 float weight = 0;
11646 float wetness = 1;
11647 if (include_wetness)
11648 wetness += GetWet();
11649 if (IsSplitable()) //quantity determines size of the stack
11650 {
11651 weight = wetness * m_ConfigWeight;
11652 }
11653 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
11654 {
11655 weight = 1;
11656 }
11657 return weight;
11658 }
11659
11660 //-----------------------------------------------------------------
11661
11662 override void ClearInventory()
11663 {
11664 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
11665 {
11666 GameInventory inv = GetInventory();
11667 array<EntityAI> items = new array<EntityAI>;
11668 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
11669 for (int i = 0; i < items.Count(); i++)
11670 {
11671 ItemBase item = ItemBase.Cast(items.Get(i));
11672 if (item)
11673 {
11674 GetGame().ObjectDelete(item);
11675 }
11676 }
11677 }
11678 }
11679
11680 //------------------------- Energy
11681
11682 //----------------------------------------------------------------
11683 float GetEnergy()
11684 {
11685 float energy = 0;
11686 if (HasEnergyManager())
11687 {
11688 energy = GetCompEM().GetEnergy();
11689 }
11690 return energy;
11691 }
11692
11693
11694 override void OnEnergyConsumed()
11695 {
11696 super.OnEnergyConsumed();
11697
11699 }
11700
11701 override void OnEnergyAdded()
11702 {
11703 super.OnEnergyAdded();
11704
11706 }
11707
11708 // Converts energy (from Energy Manager) to quantity, if enabled.
11710 {
11711 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11712 {
11713 if (HasQuantity())
11714 {
11715 float energy_0to1 = GetCompEM().GetEnergy0To1();
11716 SetQuantityNormalized(energy_0to1);
11717 }
11718 }
11719 }
11720
11721 //----------------------------------------------------------------
11722 float GetHeatIsolationInit()
11723 {
11724 return ConfigGetFloat("heatIsolation");
11725 }
11726
11727 float GetHeatIsolation()
11728 {
11729 return m_HeatIsolation;
11730 }
11731
11732 float GetDryingIncrement(string pIncrementName)
11733 {
11734 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
11735 if (GetGame().ConfigIsExisting(paramPath))
11736 return GetGame().ConfigGetFloat(paramPath);
11737
11738 return 0.0;
11739 }
11740
11741 float GetSoakingIncrement(string pIncrementName)
11742 {
11743 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
11744 if (GetGame().ConfigIsExisting(paramPath))
11745 return GetGame().ConfigGetFloat(paramPath);
11746
11747 return 0.0;
11748 }
11749 //----------------------------------------------------------------
11750 override void SetWet(float value, bool allow_client = false)
11751 {
11752 if (!IsServerCheck(allow_client))
11753 return;
11754
11755 float min = GetWetMin();
11756 float max = GetWetMax();
11757
11758 float previousValue = m_VarWet;
11759
11760 m_VarWet = Math.Clamp(value, min, max);
11761
11762 if (previousValue != m_VarWet)
11763 {
11764 SetVariableMask(VARIABLE_WET);
11765 OnWetChanged(m_VarWet, previousValue);
11766 }
11767 }
11768 //----------------------------------------------------------------
11769 override void AddWet(float value)
11770 {
11771 SetWet(GetWet() + value);
11772 }
11773 //----------------------------------------------------------------
11774 override void SetWetMax()
11775 {
11777 }
11778 //----------------------------------------------------------------
11779 override float GetWet()
11780 {
11781 return m_VarWet;
11782 }
11783 //----------------------------------------------------------------
11784 override float GetWetMax()
11785 {
11786 return m_VarWetMax;
11787 }
11788 //----------------------------------------------------------------
11789 override float GetWetMin()
11790 {
11791 return m_VarWetMin;
11792 }
11793 //----------------------------------------------------------------
11794 override float GetWetInit()
11795 {
11796 return m_VarWetInit;
11797 }
11798 //----------------------------------------------------------------
11799 override void OnWetChanged(float newVal, float oldVal)
11800 {
11801 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
11802 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
11803 if (newLevel != oldLevel)
11804 {
11805 OnWetLevelChanged(newLevel,oldLevel);
11806 }
11807 }
11808
11809 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
11810 {
11811 SetWeightDirty();
11812 }
11813
11814 override EWetnessLevel GetWetLevel()
11815 {
11816 return GetWetLevelInternal(m_VarWet);
11817 }
11818
11819 //----------------------------------------------------------------
11820
11821 override void SetStoreLoad(bool value)
11822 {
11823 m_IsStoreLoad = value;
11824 }
11825
11826 override bool IsStoreLoad()
11827 {
11828 return m_IsStoreLoad;
11829 }
11830
11831 override void SetStoreLoadedQuantity(float value)
11832 {
11833 m_StoreLoadedQuantity = value;
11834 }
11835
11836 override float GetStoreLoadedQuantity()
11837 {
11838 return m_StoreLoadedQuantity;
11839 }
11840
11841 //----------------------------------------------------------------
11842
11843 float GetItemModelLength()
11844 {
11845 if (ConfigIsExisting("itemModelLength"))
11846 {
11847 return ConfigGetFloat("itemModelLength");
11848 }
11849 return 0;
11850 }
11851
11852 float GetItemAttachOffset()
11853 {
11854 if (ConfigIsExisting("itemAttachOffset"))
11855 {
11856 return ConfigGetFloat("itemAttachOffset");
11857 }
11858 return 0;
11859 }
11860
11861 override void SetCleanness(int value, bool allow_client = false)
11862 {
11863 if (!IsServerCheck(allow_client))
11864 return;
11865
11866 int previousValue = m_Cleanness;
11867
11868 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
11869
11870 if (previousValue != m_Cleanness)
11871 SetVariableMask(VARIABLE_CLEANNESS);
11872 }
11873
11874 override int GetCleanness()
11875 {
11876 return m_Cleanness;
11877 }
11878
11880 {
11881 return true;
11882 }
11883
11884 //----------------------------------------------------------------
11885 // ATTACHMENT LOCKING
11886 // Getters relevant to generic ActionLockAttachment
11887 int GetLockType()
11888 {
11889 return m_LockType;
11890 }
11891
11892 string GetLockSoundSet()
11893 {
11894 return m_LockSoundSet;
11895 }
11896
11897 //----------------------------------------------------------------
11898 //------------------------- Color
11899 // sets items color variable given color components
11900 override void SetColor(int r, int g, int b, int a)
11901 {
11906 SetVariableMask(VARIABLE_COLOR);
11907 }
11909 override void GetColor(out int r,out int g,out int b,out int a)
11910 {
11915 }
11916
11917 bool IsColorSet()
11918 {
11919 return IsVariableSet(VARIABLE_COLOR);
11920 }
11921
11923 string GetColorString()
11924 {
11925 int r,g,b,a;
11926 GetColor(r,g,b,a);
11927 r = r/255;
11928 g = g/255;
11929 b = b/255;
11930 a = a/255;
11931 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11932 }
11933 //----------------------------------------------------------------
11934 //------------------------- LiquidType
11935
11936 override void SetLiquidType(int value, bool allow_client = false)
11937 {
11938 if (!IsServerCheck(allow_client))
11939 return;
11940
11941 int old = m_VarLiquidType;
11942 m_VarLiquidType = value;
11943 OnLiquidTypeChanged(old,value);
11944 SetVariableMask(VARIABLE_LIQUIDTYPE);
11945 }
11946
11947 int GetLiquidTypeInit()
11948 {
11949 return ConfigGetInt("varLiquidTypeInit");
11950 }
11951
11952 override int GetLiquidType()
11953 {
11954 return m_VarLiquidType;
11955 }
11956
11957 protected void OnLiquidTypeChanged(int oldType, int newType)
11958 {
11959 if (newType == LIQUID_NONE && GetIsFrozen())
11960 SetFrozen(false);
11961 }
11962
11964 void UpdateQuickbarShortcutVisibility(PlayerBase player)
11965 {
11966 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11967 }
11968
11969 // -------------------------------------------------------------------------
11971 void OnInventoryEnter(Man player)
11972 {
11973 PlayerBase nplayer;
11974 if (PlayerBase.CastTo(nplayer, player))
11975 {
11976 m_CanPlayImpactSound = true;
11977 //nplayer.OnItemInventoryEnter(this);
11978 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11979 }
11980 }
11981
11982 // -------------------------------------------------------------------------
11984 void OnInventoryExit(Man player)
11985 {
11986 PlayerBase nplayer;
11987 if (PlayerBase.CastTo(nplayer,player))
11988 {
11989 //nplayer.OnItemInventoryExit(this);
11990 nplayer.SetEnableQuickBarEntityShortcut(this,false);
11991
11992 }
11993
11994 //if (!GetGame().IsDedicatedServer())
11995 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11996
11997
11998 if (HasEnergyManager())
11999 {
12000 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
12001 }
12002 }
12003
12004 // ADVANCED PLACEMENT EVENTS
12005 override void OnPlacementStarted(Man player)
12006 {
12007 super.OnPlacementStarted(player);
12008
12009 SetTakeable(false);
12010 }
12011
12012 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
12013 {
12014 if (m_AdminLog)
12015 {
12016 m_AdminLog.OnPlacementComplete(player, this);
12017 }
12018
12019 super.OnPlacementComplete(player, position, orientation);
12020 }
12021
12022 //-----------------------------
12023 // AGENT SYSTEM
12024 //-----------------------------
12025 //--------------------------------------------------------------------------
12026 bool ContainsAgent(int agent_id)
12027 {
12028 if (agent_id & m_AttachedAgents)
12029 {
12030 return true;
12031 }
12032 else
12033 {
12034 return false;
12035 }
12036 }
12037
12038 //--------------------------------------------------------------------------
12039 override void RemoveAgent(int agent_id)
12040 {
12041 if (ContainsAgent(agent_id))
12042 {
12043 m_AttachedAgents = ~agent_id & m_AttachedAgents;
12044 }
12045 }
12046
12047 //--------------------------------------------------------------------------
12048 override void RemoveAllAgents()
12049 {
12050 m_AttachedAgents = 0;
12051 }
12052 //--------------------------------------------------------------------------
12053 override void RemoveAllAgentsExcept(int agent_to_keep)
12054 {
12055 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
12056 }
12057 // -------------------------------------------------------------------------
12058 override void InsertAgent(int agent, float count = 1)
12059 {
12060 if (count < 1)
12061 return;
12062 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
12064 }
12065
12067 void TransferAgents(int agents)
12068 {
12070 }
12071
12072 // -------------------------------------------------------------------------
12073 override int GetAgents()
12074 {
12075 return m_AttachedAgents;
12076 }
12077 //----------------------------------------------------------------------
12078
12079 /*int GetContaminationType()
12080 {
12081 int contamination_type;
12082
12083 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
12084 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
12085 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
12086 const int DIRTY_MASK = eAgents.WOUND_AGENT;
12087
12088 Edible_Base edible = Edible_Base.Cast(this);
12089 int agents = GetAgents();
12090 if (edible)
12091 {
12092 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
12093 if (profile)
12094 {
12095 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
12096 }
12097 }
12098 if (agents & CONTAMINATED_MASK)
12099 {
12100 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
12101 }
12102 if (agents & POISONED_MASK)
12103 {
12104 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
12105 }
12106 if (agents & NERVE_GAS_MASK)
12107 {
12108 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
12109 }
12110 if (agents & DIRTY_MASK)
12111 {
12112 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
12113 }
12114
12115 return agents;
12116 }*/
12117
12118 // -------------------------------------------------------------------------
12119 bool LoadAgents(ParamsReadContext ctx, int version)
12120 {
12121 if (!ctx.Read(m_AttachedAgents))
12122 return false;
12123 return true;
12124 }
12125 // -------------------------------------------------------------------------
12127 {
12128
12130 }
12131 // -------------------------------------------------------------------------
12132
12134 override void CheckForRoofLimited(float timeTresholdMS = 3000)
12135 {
12136 super.CheckForRoofLimited(timeTresholdMS);
12137
12138 float time = GetGame().GetTime();
12139 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12140 {
12141 m_PreviousRoofTestTime = time;
12142 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12143 }
12144 }
12145
12146 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
12147 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
12148 {
12149 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
12150 {
12151 return 0;
12152 }
12153
12154 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
12155 {
12156 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
12157 if (filter)
12158 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
12159 else
12160 return 0;//otherwise return 0 when no filter attached
12161 }
12162
12163 string subclassPath, entryName;
12164
12165 switch (type)
12166 {
12167 case DEF_BIOLOGICAL:
12168 entryName = "biological";
12169 break;
12170 case DEF_CHEMICAL:
12171 entryName = "chemical";
12172 break;
12173 default:
12174 entryName = "biological";
12175 break;
12176 }
12177
12178 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
12179
12180 return GetGame().ConfigGetFloat(subclassPath + entryName);
12181 }
12182
12183
12184
12186 override void EEOnCECreate()
12187 {
12188 if (!IsMagazine())
12190
12192 }
12193
12194
12195 //-------------------------
12196 // OPEN/CLOSE USER ACTIONS
12197 //-------------------------
12199 void Open();
12200 void Close();
12201 bool IsOpen()
12202 {
12203 return true;
12204 }
12205
12206 override bool CanDisplayCargo()
12207 {
12208 return IsOpen();
12209 }
12210
12211
12212 // ------------------------------------------------------------
12213 // CONDITIONS
12214 // ------------------------------------------------------------
12215 override bool CanPutInCargo(EntityAI parent)
12216 {
12217 if (parent)
12218 {
12219 if (parent.IsInherited(DayZInfected))
12220 return true;
12221
12222 if (!parent.IsRuined())
12223 return true;
12224 }
12225
12226 return true;
12227 }
12228
12229 override bool CanPutAsAttachment(EntityAI parent)
12230 {
12231 if (!super.CanPutAsAttachment(parent))
12232 {
12233 return false;
12234 }
12235
12236 if (!IsRuined() && !parent.IsRuined())
12237 {
12238 return true;
12239 }
12240
12241 return false;
12242 }
12243
12244 override bool CanReceiveItemIntoCargo(EntityAI item)
12245 {
12246 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12247 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12248 // return false;
12249
12250 return super.CanReceiveItemIntoCargo(item);
12251 }
12252
12253 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
12254 {
12255 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12256 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12257 // return false;
12258
12259 GameInventory attachmentInv = attachment.GetInventory();
12260 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
12261 {
12262 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12263 return false;
12264 }
12265
12266 InventoryLocation loc = new InventoryLocation();
12267 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12268 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
12269 return false;
12270
12271 return super.CanReceiveAttachment(attachment, slotId);
12272 }
12273
12274 override bool CanReleaseAttachment(EntityAI attachment)
12275 {
12276 if (!super.CanReleaseAttachment(attachment))
12277 return false;
12278
12279 return GetInventory().AreChildrenAccessible();
12280 }
12281
12282 /*override bool CanLoadAttachment(EntityAI attachment)
12283 {
12284 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12285 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12286 // return false;
12287
12288 GameInventory attachmentInv = attachment.GetInventory();
12289 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
12290 {
12291 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
12292 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
12293
12294 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12295 return false;
12296 }
12297
12298 return super.CanLoadAttachment(attachment);
12299 }*/
12300
12301 // Plays muzzle flash particle effects
12302 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12303 {
12304 int id = muzzle_owner.GetMuzzleID();
12305 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
12306
12307 if (WPOF_array)
12308 {
12309 for (int i = 0; i < WPOF_array.Count(); i++)
12310 {
12311 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12312
12313 if (WPOF)
12314 {
12315 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12316 }
12317 }
12318 }
12319 }
12320
12321 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
12322 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12323 {
12324 int id = muzzle_owner.GetMuzzleID();
12325 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
12326
12327 if (WPOBE_array)
12328 {
12329 for (int i = 0; i < WPOBE_array.Count(); i++)
12330 {
12331 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12332
12333 if (WPOBE)
12334 {
12335 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12336 }
12337 }
12338 }
12339 }
12340
12341 // Plays all weapon overheating particles
12342 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12343 {
12344 int id = muzzle_owner.GetMuzzleID();
12345 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12346
12347 if (WPOOH_array)
12348 {
12349 for (int i = 0; i < WPOOH_array.Count(); i++)
12350 {
12351 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12352
12353 if (WPOOH)
12354 {
12355 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12356 }
12357 }
12358 }
12359 }
12360
12361 // Updates all weapon overheating particles
12362 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12363 {
12364 int id = muzzle_owner.GetMuzzleID();
12365 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12366
12367 if (WPOOH_array)
12368 {
12369 for (int i = 0; i < WPOOH_array.Count(); i++)
12370 {
12371 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12372
12373 if (WPOOH)
12374 {
12375 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12376 }
12377 }
12378 }
12379 }
12380
12381 // Stops overheating particles
12382 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12383 {
12384 int id = muzzle_owner.GetMuzzleID();
12385 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12386
12387 if (WPOOH_array)
12388 {
12389 for (int i = 0; i < WPOOH_array.Count(); i++)
12390 {
12391 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12392
12393 if (WPOOH)
12394 {
12395 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12396 }
12397 }
12398 }
12399 }
12400
12401 //----------------------------------------------------------------
12402 //Item Behaviour - unified approach
12403 override bool IsHeavyBehaviour()
12404 {
12405 if (m_ItemBehaviour == 0)
12406 {
12407 return true;
12408 }
12409
12410 return false;
12411 }
12412
12413 override bool IsOneHandedBehaviour()
12414 {
12415 if (m_ItemBehaviour == 1)
12416 {
12417 return true;
12418 }
12419
12420 return false;
12421 }
12422
12423 override bool IsTwoHandedBehaviour()
12424 {
12425 if (m_ItemBehaviour == 2)
12426 {
12427 return true;
12428 }
12429
12430 return false;
12431 }
12432
12433 bool IsDeployable()
12434 {
12435 return false;
12436 }
12437
12439 float GetDeployTime()
12440 {
12441 return UATimeSpent.DEFAULT_DEPLOY;
12442 }
12443
12444
12445 //----------------------------------------------------------------
12446 // Item Targeting (User Actions)
12447 override void SetTakeable(bool pState)
12448 {
12449 m_IsTakeable = pState;
12450 SetSynchDirty();
12451 }
12452
12453 override bool IsTakeable()
12454 {
12455 return m_IsTakeable;
12456 }
12457
12458 // For cases where we want to show object widget which cant be taken to hands
12460 {
12461 return false;
12462 }
12463
12465 protected void PreLoadSoundAttachmentType()
12466 {
12467 string att_type = "None";
12468
12469 if (ConfigIsExisting("soundAttType"))
12470 {
12471 att_type = ConfigGetString("soundAttType");
12472 }
12473
12474 m_SoundAttType = att_type;
12475 }
12476
12477 override string GetAttachmentSoundType()
12478 {
12479 return m_SoundAttType;
12480 }
12481
12482 //----------------------------------------------------------------
12483 //SOUNDS - ItemSoundHandler
12484 //----------------------------------------------------------------
12485
12486 string GetPlaceSoundset(); // played when deploy starts
12487 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
12488 string GetDeploySoundset(); // played when deploy sucessfully finishes
12489
12491 {
12492 if (!m_ItemSoundHandler)
12494
12495 return m_ItemSoundHandler;
12496 }
12497
12498 // override to initialize sounds
12499 protected void InitItemSounds()
12500 {
12501 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
12502 return;
12503
12505
12506 if (GetPlaceSoundset() != string.Empty)
12507 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
12508
12509 if (GetDeploySoundset() != string.Empty)
12510 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
12511
12512 SoundParameters params = new SoundParameters();
12513 params.m_Loop = true;
12514 if (GetLoopDeploySoundset() != string.Empty)
12515 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
12516 }
12517
12518 // Start sound using ItemSoundHandler
12519 void StartItemSoundServer(int id)
12520 {
12521 if (!GetGame().IsServer())
12522 return;
12523
12524 m_SoundSyncPlay = id;
12525 SetSynchDirty();
12526
12527 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
12529 }
12530
12531 // Stop sound using ItemSoundHandler
12532 void StopItemSoundServer(int id)
12533 {
12534 if (!GetGame().IsServer())
12535 return;
12536
12537 m_SoundSyncStop = id;
12538 SetSynchDirty();
12539
12540 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
12542 }
12543
12544 protected void ClearStartItemSoundServer()
12545 {
12546 m_SoundSyncPlay = 0;
12547 }
12548
12549 protected void ClearStopItemSoundServer()
12550 {
12551 m_SoundSyncStop = 0;
12552 }
12553
12555 void PlayAttachSound(string slot_type)
12556 {
12557 if (!GetGame().IsDedicatedServer())
12558 {
12559 if (ConfigIsExisting("attachSoundSet"))
12560 {
12561 string cfg_path = "";
12562 string soundset = "";
12563 string type_name = GetType();
12564
12565 TStringArray cfg_soundset_array = new TStringArray;
12566 TStringArray cfg_slot_array = new TStringArray;
12567 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12568 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12569
12570 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12571 {
12572 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12573 {
12574 if (cfg_slot_array[i] == slot_type)
12575 {
12576 soundset = cfg_soundset_array[i];
12577 break;
12578 }
12579 }
12580 }
12581
12582 if (soundset != "")
12583 {
12584 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
12585 sound.SetAutodestroy(true);
12586 }
12587 }
12588 }
12589 }
12590
12591 void PlayDetachSound(string slot_type)
12592 {
12593 //TODO - evaluate if needed and devise universal config structure if so
12594 }
12595
12596 void OnApply(PlayerBase player);
12597
12599 {
12600 return 1.0;
12601 };
12602 //returns applicable selection
12603 array<string> GetHeadHidingSelection()
12604 {
12606 }
12607
12609 {
12611 }
12612
12613 WrittenNoteData GetWrittenNoteData() {};
12614
12616 {
12617 SetDynamicPhysicsLifeTime(0.01);
12618 m_ItemBeingDroppedPhys = false;
12619 }
12620
12622 {
12623 array<string> zone_names = new array<string>;
12624 GetDamageZones(zone_names);
12625 for (int i = 0; i < zone_names.Count(); i++)
12626 {
12627 SetHealthMax(zone_names.Get(i),"Health");
12628 }
12629 SetHealthMax("","Health");
12630 }
12631
12633 void SetZoneDamageCEInit()
12634 {
12635 float global_health = GetHealth01("","Health");
12636 array<string> zones = new array<string>;
12637 GetDamageZones(zones);
12638 //set damage of all zones to match global health level
12639 for (int i = 0; i < zones.Count(); i++)
12640 {
12641 SetHealth01(zones.Get(i),"Health",global_health);
12642 }
12643 }
12644
12646 bool IsCoverFaceForShave(string slot_name)
12647 {
12648 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12649 }
12650
12651 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
12652 {
12653 if (!hasRootAsPlayer)
12654 {
12655 if (refParentIB)
12656 {
12657 // parent is wet
12658 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
12659 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12660 // parent has liquid inside
12661 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
12662 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12663 // drying
12664 else if (m_VarWet > m_VarWetMin)
12665 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
12666 }
12667 else
12668 {
12669 // drying on ground or inside non-itembase (car, ...)
12670 if (m_VarWet > m_VarWetMin)
12671 AddWet(-1 * delta * GetDryingIncrement("ground"));
12672 }
12673 }
12674 }
12675
12676 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
12677 {
12679 {
12680 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
12681 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
12682 {
12683 float heatPermCoef = 1.0;
12684 EntityAI ent = this;
12685 while (ent)
12686 {
12687 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12688 ent = ent.GetHierarchyParent();
12689 }
12690
12691 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12692 }
12693 }
12694 }
12695
12696 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
12697 {
12698 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
12699 EntityAI parent = GetHierarchyParent();
12700 if (!parent)
12701 {
12702 hasParent = false;
12703 hasRootAsPlayer = false;
12704 }
12705 else
12706 {
12707 hasParent = true;
12708 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12709 refParentIB = ItemBase.Cast(parent);
12710 }
12711 }
12712
12713 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
12714 {
12715 // this is stub, implemented on Edible_Base
12716 }
12717
12718 bool CanDecay()
12719 {
12720 // return true used on selected food clases so they can decay
12721 return false;
12722 }
12723
12724 protected bool CanProcessDecay()
12725 {
12726 // this is stub, implemented on Edible_Base class
12727 // used to determine whether it is still necessary for the food to decay
12728 return false;
12729 }
12730
12731 protected bool CanHaveWetness()
12732 {
12733 // return true used on selected items that have a wetness effect
12734 return false;
12735 }
12736
12738 bool CanBeConsumed(ConsumeConditionData data = null)
12739 {
12740 return !GetIsFrozen() && IsOpen();
12741 }
12742
12743 override void ProcessVariables()
12744 {
12745 bool hasParent = false, hasRootAsPlayer = false;
12746 ItemBase refParentIB;
12747
12748 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
12749 bool foodDecay = g_Game.IsFoodDecayEnabled();
12750
12751 if (wwtu || foodDecay)
12752 {
12753 bool processWetness = wwtu && CanHaveWetness();
12754 bool processTemperature = wwtu && CanHaveTemperature();
12755 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
12756
12757 if (processWetness || processTemperature || processDecay)
12758 {
12759 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
12760
12761 if (processWetness)
12762 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12763
12764 if (processTemperature)
12765 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12766
12767 if (processDecay)
12768 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12769 }
12770 }
12771 }
12772
12775 {
12776 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
12777 }
12778
12779 override float GetTemperatureFreezeThreshold()
12780 {
12782 return Liquid.GetFreezeThreshold(GetLiquidType());
12783
12784 return super.GetTemperatureFreezeThreshold();
12785 }
12786
12787 override float GetTemperatureThawThreshold()
12788 {
12790 return Liquid.GetThawThreshold(GetLiquidType());
12791
12792 return super.GetTemperatureThawThreshold();
12793 }
12794
12795 override float GetItemOverheatThreshold()
12796 {
12798 return Liquid.GetBoilThreshold(GetLiquidType());
12799
12800 return super.GetItemOverheatThreshold();
12801 }
12802
12803 override float GetTemperatureFreezeTime()
12804 {
12805 if (HasQuantity())
12806 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
12807
12808 return super.GetTemperatureFreezeTime();
12809 }
12810
12811 override float GetTemperatureThawTime()
12812 {
12813 if (HasQuantity())
12814 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
12815
12816 return super.GetTemperatureThawTime();
12817 }
12818
12820 void AffectLiquidContainerOnFill(int liquid_type, float amount);
12822 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
12823
12824 bool IsCargoException4x3(EntityAI item)
12825 {
12826 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12827 }
12828
12830 {
12831 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12832 }
12833
12835 void AddLightSourceItem(ItemBase lightsource)
12836 {
12837 m_LightSourceItem = lightsource;
12838 }
12839
12841 {
12842 m_LightSourceItem = null;
12843 }
12844
12846 {
12847 return m_LightSourceItem;
12848 }
12849
12851 array<int> GetValidFinishers()
12852 {
12853 return null;
12854 }
12855
12857 bool GetActionWidgetOverride(out typename name)
12858 {
12859 return false;
12860 }
12861
12862 bool PairWithDevice(notnull ItemBase otherDevice)
12863 {
12864 if (GetGame().IsServer())
12865 {
12866 ItemBase explosive = otherDevice;
12868 if (!trg)
12869 {
12870 trg = RemoteDetonatorTrigger.Cast(otherDevice);
12871 explosive = this;
12872 }
12873
12874 explosive.PairRemote(trg);
12875 trg.SetControlledDevice(explosive);
12876
12877 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12878 trg.SetPersistentPairID(persistentID);
12879 explosive.SetPersistentPairID(persistentID);
12880
12881 return true;
12882 }
12883 return false;
12884 }
12885
12887 float GetBaitEffectivity()
12888 {
12889 float ret = 1.0;
12890 if (HasQuantity())
12891 ret *= GetQuantityNormalized();
12892 ret *= GetHealth01();
12893
12894 return ret;
12895 }
12896
12897 #ifdef DEVELOPER
12898 override void SetDebugItem()
12899 {
12900 super.SetDebugItem();
12901 _itemBase = this;
12902 }
12903
12904 override string GetDebugText()
12905 {
12906 string text = super.GetDebugText();
12907
12908 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
12909 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
12910
12911 return text;
12912 }
12913 #endif
12914
12915 bool CanBeUsedForSuicide()
12916 {
12917 return true;
12918 }
12919
12921 //DEPRECATED BELOW
12923 // Backwards compatibility
12924 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
12925 {
12926 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
12927 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
12928 }
12929
12930 // replaced by ItemSoundHandler
12931 protected EffectSound m_SoundDeployFinish;
12932 protected EffectSound m_SoundPlace;
12933 protected EffectSound m_DeployLoopSoundEx;
12934 protected EffectSound m_SoundDeploy;
12935 bool m_IsPlaceSound;
12936 bool m_IsDeploySound;
12938
12939 string GetDeployFinishSoundset();
12940 void PlayDeploySound();
12941 void PlayDeployFinishSound();
12942 void PlayPlaceSound();
12943 void PlayDeployLoopSoundEx();
12944 void StopDeployLoopSoundEx();
12945 void SoundSynchRemoteReset();
12946 void SoundSynchRemote();
12947 bool UsesGlobalDeploy(){return false;}
12948 bool CanPlayDeployLoopSound(){return false;}
12950 bool IsPlaceSound(){return m_IsPlaceSound;}
12951 bool IsDeploySound(){return m_IsDeploySound;}
12952 void SetIsPlaceSound(bool is_place_sound);
12953 void SetIsDeploySound(bool is_deploy_sound);
12954}
12955
12956EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
12957{
12958 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
12959 if (entity)
12960 {
12961 bool is_item = entity.IsInherited(ItemBase);
12962 if (is_item && full_quantity)
12963 {
12964 ItemBase item = ItemBase.Cast(entity);
12965 item.SetQuantity(item.GetQuantityInit());
12966 }
12967 }
12968 else
12969 {
12970 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
12971 return NULL;
12972 }
12973 return entity;
12974}
12975
12976void SetupSpawnedItem(ItemBase item, float health, float quantity)
12977{
12978 if (item)
12979 {
12980 if (health > 0)
12981 item.SetHealth("", "", health);
12982
12983 if (item.CanHaveTemperature())
12984 {
12985 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
12986 if (item.CanFreeze())
12987 item.SetFrozen(false);
12988 }
12989
12990 if (item.HasEnergyManager())
12991 {
12992 if (quantity >= 0)
12993 {
12994 item.GetCompEM().SetEnergy0To1(quantity);
12995 }
12996 else
12997 {
12998 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
12999 }
13000 }
13001 else if (item.IsMagazine())
13002 {
13003 Magazine mag = Magazine.Cast(item);
13004 if (quantity >= 0)
13005 {
13006 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13007 }
13008 else
13009 {
13010 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
13011 }
13012
13013 }
13014 else
13015 {
13016 if (quantity >= 0)
13017 {
13018 item.SetQuantityNormalized(quantity, false);
13019 }
13020 else
13021 {
13022 item.SetQuantity(Math.AbsFloat(quantity));
13023 }
13024
13025 }
13026 }
13027}
13028
13029#ifdef DEVELOPER
13030ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
13031#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Определения EntityAI.c:97
Param3 TSelectableActionInfo
EWetnessLevel
Определения EntityAI.c:2
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
Определения Inventory.c:22
const int INPUT_UDT_ITEM_MANIPULATION
Определения _constants.c:8
class LogManager EntityAI
eBleedingSourceType GetType()
Определения BleedingSource.c:63
ItemSuppressor SuppressorBase
Определения InventoryItem.c:7
void ActionDropItem()
Определения ActionDropItem.c:14
void ActionManagerBase(PlayerBase player)
Определения ActionManagerBase.c:63
map< typename, ref array< ActionBase_Basic > > TInputActionMap
Определения ActionManagerClient.c:1
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
void RemoveAction(typename actionName)
Определения AdvancedCommunication.c:252
TInputActionMap m_InputActionMap
Определения AdvancedCommunication.c:137
bool m_ActionsInitialize
Определения AdvancedCommunication.c:138
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
Определения AdvancedCommunication.c:202
void InitializeActions()
Определения AdvancedCommunication.c:190
const int ECE_PLACE_ON_SURFACE
Определения CentralEconomy.c:37
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
Определения CentralEconomy.c:36
const int RF_DEFAULT
Определения CentralEconomy.c:65
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
map
Определения ControlsXboxNew.c:4
CookingMethodType
Определения Cooking.c:2
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
DayZGame g_Game
Определения DayZGame.c:3868
DayZGame GetDayZGame()
Определения DayZGame.c:3870
EActions
Определения EActions.c:2
ERPCs
Определения ERPCs.c:2
PluginAdminLog m_AdminLog
Определения EmoteManager.c:142
const int MAX
Определения EnConvert.c:27
override bool IsExplosive()
Определения ExplosivesBase.c:59
override bool CanHaveTemperature()
Определения FireplaceBase.c:557
class GP5GasMask extends MaskBase ItemBase
Empty
Определения Hand_States.c:14
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
Определения ItemBase.c:6308
static bool HasDebugActionsMask(int mask)
Определения ItemBase.c:5548
bool HidesSelectionBySlot()
Определения ItemBase.c:9203
float m_VarWetMin
Определения ItemBase.c:4809
void SplitItem(PlayerBase player)
Определения ItemBase.c:6739
void CopyScriptPropertiesFrom(EntityAI oldItem)
Определения ItemBase.c:9424
override void InsertAgent(int agent, float count=1)
Определения ItemBase.c:8653
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
Определения ItemBase.c:8087
static void SetDebugActionsMask(int mask)
Определения ItemBase.c:5553
void SetIsDeploySound(bool is_deploy_sound)
bool IsOpen()
Определения ItemBase.c:8796
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6706
override bool IsHeavyBehaviour()
Определения ItemBase.c:8998
override void SetWetMax()
Определения ItemBase.c:8369
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
Определения ItemBase.c:9241
void ClearStartItemSoundServer()
Определения ItemBase.c:9139
float m_VarWet
Определения ItemBase.c:4806
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9271
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
Определения ItemBase.c:2
override void RemoveAllAgentsExcept(int agent_to_keep)
Определения ItemBase.c:8648
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
Определения ItemBase.c:4869
bool CanBeMovedOverride()
Определения ItemBase.c:7380
override void SetWet(float value, bool allow_client=false)
Определения ItemBase.c:8345
ref TIntArray m_SingleUseActions
Определения ItemBase.c:4855
override void ProcessVariables()
Определения ItemBase.c:9338
ref TStringArray m_HeadHidingSelections
Определения ItemBase.c:4883
float GetWeightSpecialized(bool forceRecalc=false)
Определения ItemBase.c:8179
bool LoadAgents(ParamsReadContext ctx, int version)
Определения ItemBase.c:8714
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
Определения ItemBase.c:8559
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
Определения ItemBase.c:5139
ref array< ref OverheatingParticle > m_OverheatingParticles
Определения ItemBase.c:4881
override float GetTemperatureFreezeThreshold()
Определения ItemBase.c:9374
bool m_IsSoundSynchRemote
Определения ItemBase.c:9532
float m_OverheatingShots
Определения ItemBase.c:4876
void StopItemSoundServer(int id)
Определения ItemBase.c:9127
static void ToggleDebugActionsMask(int mask)
Определения ItemBase.c:5568
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:5292
override float GetTemperatureFreezeTime()
Определения ItemBase.c:9398
ref array< int > m_CompatibleLocks
Определения ItemBase.c:4893
bool CanBeCooked()
Определения ItemBase.c:7336
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:5635
float m_TemperaturePerQuantityWeight
Определения ItemBase.c:4905
bool m_RecipesInitialized
Определения ItemBase.c:4791
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
Определения ItemBase.c:6382
override float GetTemperatureThawThreshold()
Определения ItemBase.c:9382
override void OnEnergyConsumed()
Определения ItemBase.c:8289
void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
Определения ItemBase.c:8078
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
Определения Bottle_Base.c:158
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
Определения ItemBase.c:8218
override EWetnessLevel GetWetLevel()
Определения ItemBase.c:8409
float GetSingleInventoryItemWeight()
Определения ItemBase.c:8174
ref TIntArray m_InteractActions
Определения ItemBase.c:4857
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
Определения ItemBase.c:7400
float m_VarQuantity
Определения ItemBase.c:4797
bool CanPlayDeployLoopSound()
Определения ItemBase.c:9543
override float GetWetMax()
Определения ItemBase.c:8379
bool CanBeUsedForSuicide()
Определения ItemBase.c:9510
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:7011
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
Определения ItemBase.c:5773
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
Определения ItemBase.c:7554
void StartItemSoundServer(int id)
Определения ItemBase.c:9114
void DoAmmoExplosion()
Определения ItemBase.c:6243
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
Определения ItemBase.c:4868
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6557
int GetItemSize()
Определения ItemBase.c:7365
bool m_CanBeMovedOverride
Определения ItemBase.c:4834
override string ChangeIntoOnAttach(string slot)
Определения ItemBase.c:6167
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5360
bool CanDecay()
Определения ItemBase.c:9313
ScriptedLightBase GetLight()
string GetPlaceSoundset()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
Определения ItemBase.c:8060
void SetQuantityMax()
Определения ItemBase.c:8065
override float GetQuantity()
Определения ItemBase.c:8154
int m_ColorComponentR
Определения ItemBase.c:4846
int m_ShotsToStartOverheating
Определения ItemBase.c:4878
override void OnWetChanged(float newVal, float oldVal)
Определения ItemBase.c:8394
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5367
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8897
void OnOverheatingDecay()
Определения ItemBase.c:5330
float GetDryingIncrement(string pIncrementName)
Определения ItemBase.c:8327
void SoundSynchRemoteReset()
int m_Cleanness
Определения ItemBase.c:4812
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
Определения ItemBase.c:5468
bool UsesGlobalDeploy()
Определения ItemBase.c:9542
int m_ItemBehaviour
Определения ItemBase.c:4827
override bool CanReleaseAttachment(EntityAI attachment)
Определения ItemBase.c:8869
float m_HeatIsolation
Определения ItemBase.c:4822
float m_VarWetInit
Определения ItemBase.c:4808
override void OnMovedInsideCargo(EntityAI container)
Определения ItemBase.c:5813
void SetCEBasedQuantity()
Определения ItemBase.c:5581
bool m_CanPlayImpactSound
Определения ItemBase.c:4818
override string GetAttachmentSoundType()
Определения ItemBase.c:9072
float GetOverheatingCoef()
Определения ItemBase.c:5387
array< string > GetHeadHidingSelection()
Определения ItemBase.c:9198
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
Определения ItemBase.c:9150
override bool IsStoreLoad()
Определения ItemBase.c:8421
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:6987
bool IsLightSource()
Определения ItemBase.c:5709
bool m_HasQuantityBar
Определения ItemBase.c:4840
void SetResultOfSplit(bool value)
Определения ItemBase.c:6982
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6624
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6797
void UpdateAllOverheatingParticles()
Определения ItemBase.c:5395
float GetSoakingIncrement(string pIncrementName)
Определения ItemBase.c:8336
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8977
override float GetStoreLoadedQuantity()
Определения ItemBase.c:8431
int m_LockType
Определения ItemBase.c:4894
const int ITEM_SOUNDS_MAX
Определения ItemBase.c:4899
bool m_CanBeDigged
Определения ItemBase.c:4841
float m_ItemAttachOffset
Определения ItemBase.c:4824
float GetItemModelLength()
Определения ItemBase.c:8438
bool m_ThrowItemOnDrop
Определения ItemBase.c:4832
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
Определения ItemBase.c:7699
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
Определения ItemBase.c:8729
void Close()
float GetHeatIsolation()
Определения ItemBase.c:8322
void CombineItems(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7016
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
Определения ItemBase.c:9369
bool CanHaveWetness()
Определения ItemBase.c:9326
int m_CleannessMin
Определения ItemBase.c:4814
void TransferAgents(int agents)
transfer agents from another item
Определения ItemBase.c:8662
string IDToName(int id)
Определения ItemBase.c:7547
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
Определения ItemBase.c:9333
float GetHeatIsolationInit()
Определения ItemBase.c:8317
void PlayPlaceSound()
void SetCanBeMovedOverride(bool setting)
Определения ItemBase.c:7387
override bool HasQuantity()
Определения ItemBase.c:8149
float m_VarWetPrev
Определения ItemBase.c:4807
int m_SoundSyncStop
Определения ItemBase.c:4901
bool IsCargoException4x3(EntityAI item)
Определения ItemBase.c:9419
ref TIntArray m_ContinuousActions
Определения ItemBase.c:4856
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
Определения ItemBase.c:5477
void LoadParticleConfigOnFire(int id)
Определения ItemBase.c:5162
int m_VarLiquidType
Определения ItemBase.c:4826
int m_QuickBarBonus
Определения ItemBase.c:4828
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
Определения ItemBase.c:9060
override float GetWetInit()
Определения ItemBase.c:8389
int m_ImpactSoundSurfaceHash
Определения ItemBase.c:4820
int m_SoundSyncPlay
Определения ItemBase.c:4900
int m_MaxOverheatingValue
Определения ItemBase.c:4879
void SetupSpawnedItem(ItemBase item, float health, float quantity)
Определения ItemBase.c:4803
bool m_IsTakeable
Определения ItemBase.c:4831
static ref map< string, int > m_WeaponTypeToID
Определения ItemBase.c:4871
string GetLockSoundSet()
Определения ItemBase.c:8487
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
Определения ItemBase.c:8518
array< int > GetValidFinishers()
returns an array of possible finishers
Определения ItemBase.c:9446
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6803
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
Определения ItemBase.c:4783
ItemSoundHandler GetItemSoundHandler()
Определения ItemBase.c:9085
override int GetQuantityMin()
Определения ItemBase.c:8138
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
Определения ItemBase.c:6533
override int GetQuickBarBonus()
Определения ItemBase.c:5047
override void SetTakeable(bool pState)
Определения ItemBase.c:9042
float m_OverheatingDecayInterval
Определения ItemBase.c:4880
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6356
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
Определения ItemBase.c:9291
bool CanProcessDecay()
Определения ItemBase.c:9319
void RemoveAudioVisualsOnClient()
Определения Bottle_Base.c:151
void SoundSynchRemote()
static void AddDebugActionsMask(int mask)
Определения ItemBase.c:5558
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
Определения ItemBase.c:9435
bool CanRepair(ItemBase item_repair_kit)
Определения ItemBase.c:7351
bool can_this_be_combined
Определения ItemBase.c:4836
EffectSound m_SoundDeploy
Определения ItemBase.c:9529
int m_Count
Определения ItemBase.c:4802
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
Определения ItemBase.c:9482
float GetDeployTime()
how long it takes to deploy this item in seconds
Определения ItemBase.c:9034
override bool IsSplitable()
Определения ItemBase.c:6343
bool DamageItemAttachments(float damage)
Определения ItemBase.c:6327
override void WriteVarsToCTX(ParamsWriteContext ctx)
Определения ItemBase.c:7663
void ConvertEnergyToQuantity()
Определения ItemBase.c:8304
override void RemoveAllAgents()
Определения ItemBase.c:8643
override void SetQuantityToMinimum()
Определения ItemBase.c:8071
bool m_WantPlayImpactSound
Определения ItemBase.c:4817
override float GetTemperatureThawTime()
Определения ItemBase.c:9406
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
Определения ItemBase.c:4870
int m_ColorComponentG
Определения ItemBase.c:4847
float m_StoreLoadedQuantity
Определения ItemBase.c:4804
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
Определения ItemBase.c:7418
int m_ColorComponentA
Определения ItemBase.c:4849
int m_VarQuantityInit
Определения ItemBase.c:4799
float GetFilterDamageRatio()
Определения ItemBase.c:5462
override void SetLiquidType(int value, bool allow_client=false)
Определения ItemBase.c:8531
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
Определения ItemBase.c:6773
void OnApply(PlayerBase player)
bool m_HideSelectionsBySlot
Определения ItemBase.c:4884
bool IsOverheatingEffectActive()
Определения ItemBase.c:5325
void SetIsBeingPlaced(bool is_being_placed)
Определения ItemBase.c:5742
int GetLiquidContainerMask()
Определения ItemBase.c:5679
ref Timer m_CheckOverheating
Определения ItemBase.c:4877
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
Определения ItemBase.c:5373
float GetEnergy()
Определения ItemBase.c:8278
bool CanBeDigged()
Определения ItemBase.c:5758
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
Определения ItemBase.c:9452
bool IsNVG()
Определения ItemBase.c:5690
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
Определения ItemBase.c:8238
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
Определения ItemBase.c:9228
bool m_IsDeploySound
Определения ItemBase.c:9531
bool CanEat()
Определения ItemBase.c:7311
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8937
override bool IsOneHandedBehaviour()
Определения ItemBase.c:9008
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
Определения ItemBase.c:9430
bool IsLiquidContainer()
Определения ItemBase.c:5674
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
Определения ItemBase.c:7331
override float GetSingleInventoryItemWeightEx()
Определения ItemBase.c:8165
void SaveAgents(ParamsWriteContext ctx)
Определения ItemBase.c:8721
override int GetTargetQuantityMax(int attSlotID=-1)
Определения ItemBase.c:8119
int m_CleannessInit
Определения ItemBase.c:4813
float GetDisinfectQuantity(int system=0, Param param1=null)
Определения ItemBase.c:5457
override int GetAgents()
Определения ItemBase.c:8668
int m_VarQuantityMax
Определения ItemBase.c:4801
override bool IsHologram()
Определения ItemBase.c:5753
float GetItemAttachOffset()
Определения ItemBase.c:8447
bool IsPlaceSound()
Определения ItemBase.c:9545
static int GetDebugActionsMask()
Определения ItemBase.c:5543
override int GetLiquidType()
Определения ItemBase.c:8547
void ProcessDecay(float delta, bool hasRootAsPlayer)
Определения ItemBase.c:9308
override bool IsItemBase()
Определения ItemBase.c:7464
void PlayDeploySound()
override bool IsTwoHandedBehaviour()
Определения ItemBase.c:9018
void ExplodeAmmo()
Определения ItemBase.c:6230
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
Определения ItemBase.c:6972
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
Определения ItemBase.c:8742
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8917
override void OnEnergyAdded()
Определения ItemBase.c:8296
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
Определения ItemBase.c:5702
EffectSound m_DeployLoopSoundEx
Определения ItemBase.c:9528
override void DeSerializeNumericalVars(array< float > floats)
Определения ItemBase.c:7604
void StopItemDynamicPhysics()
Определения ItemBase.c:9210
bool HasFoodStage()
Определения ItemBase.c:7324
override void SetStoreLoad(bool value)
Определения ItemBase.c:8416
float GetOverheatingValue()
Определения ItemBase.c:5287
bool ContainsAgent(int agent_id)
Определения ItemBase.c:8621
override void AddWet(float value)
Определения ItemBase.c:8364
bool IsLiquidPresent()
Определения ItemBase.c:5669
bool IsFullQuantity()
Определения ItemBase.c:8159
override void EOnContact(IEntity other, Contact extra)
Определения ItemBase.c:5943
void SplitIntoStackMaxHands(PlayerBase player)
Определения ItemBase.c:6678
void SplitIntoStackMaxHandsClient(PlayerBase player)
Определения ItemBase.c:6651
int m_CleannessMax
Определения ItemBase.c:4815
float m_VarStackMax
Определения ItemBase.c:4803
ref Timer m_PhysDropTimer
Определения ItemBase.c:4890
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
Определения ItemBase.c:7436
override void SetStoreLoadedQuantity(float value)
Определения ItemBase.c:8426
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
Определения ItemBase.c:4844
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5308
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
Определения ItemBase.c:5623
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
Определения ItemBase.c:7358
void OnLiquidTypeChanged(int oldType, int newType)
Определения ItemBase.c:8552
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5354
void PlayDeployFinishSound()
bool AllowFoodConsumption()
Определения ItemBase.c:8474
bool m_IsOverheatingEffectActive
Определения ItemBase.c:4875
int m_LiquidContainerMask
Определения ItemBase.c:4825
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9246
override int GetCleanness()
Определения ItemBase.c:8469
bool PairWithDevice(notnull ItemBase otherDevice)
Определения ItemBase.c:9457
bool IsDeploySound()
Определения ItemBase.c:9546
static void RemoveDebugActionsMask(int mask)
Определения ItemBase.c:5563
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:8957
int m_VarQuantityMin
Определения ItemBase.c:4800
void PerformDamageSystemReinit()
Определения ItemBase.c:9216
override void ClearInventory()
Определения ItemBase.c:8257
static int m_LastRegisteredWeaponID
Определения ItemBase.c:4872
ItemBase GetLightSourceItem()
Определения ItemBase.c:9440
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
Определения ItemBase.c:7454
override float GetItemOverheatThreshold()
Определения ItemBase.c:9390
void StopDeployLoopSoundEx()
bool m_CanThisBeSplit
Определения ItemBase.c:4837
override void SerializeNumericalVars(array< float > floats_out)
Определения ItemBase.c:7568
void Open()
Implementations only.
Определения CannedFood.c:100
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
Определения ItemBase.c:6590
float m_ItemModelLength
Определения ItemBase.c:4823
bool m_IsHologram
Определения ItemBase.c:4830
static int m_DebugActionsMask
Определения ItemBase.c:4790
void KillAllOverheatingParticles()
Определения ItemBase.c:5423
bool CanBeCookedOnStick()
Определения ItemBase.c:7341
override int GetQuantityMax()
Определения ItemBase.c:8106
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
Определения ItemBase.c:7050
void OnActivatedByTripWire()
bool IsColorSet()
Определения ItemBase.c:8512
override void RemoveAgent(int agent_id)
Определения ItemBase.c:8634
bool m_ItemBeingDroppedPhys
Определения ItemBase.c:4833
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:8824
void PlayDetachSound(string slot_type)
Определения ItemBase.c:9186
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
Определения ItemBase.c:4784
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9519
override bool IsBeingPlaced()
Определения ItemBase.c:5737
int GetQuantityInit()
Определения ItemBase.c:8143
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:6992
bool IsResultOfSplit()
Определения ItemBase.c:6977
bool m_FixDamageSystemInit
Определения ItemBase.c:4835
float m_ImpactSpeed
Определения ItemBase.c:4819
bool m_IsStoreLoad
Определения ItemBase.c:4838
int GetLiquidTypeInit()
Определения ItemBase.c:8542
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
Определения ItemBase.c:4853
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
Определения ItemBase.c:5610
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6462
int m_AttachedAgents
Определения ItemBase.c:4861
string m_LockSoundSet
Определения ItemBase.c:4896
void LoadParticleConfigOnOverheating(int id)
Определения ItemBase.c:5231
float m_VarQuantityPrev
Определения ItemBase.c:4798
bool IsSoundSynchRemote()
Определения ItemBase.c:9544
bool m_CanShowQuantity
Определения ItemBase.c:4839
override void EEOnCECreate()
Called when entity is being created as new by CE/ Debug.
Определения ItemBase.c:8781
override void OnRightClick()
Определения ItemBase.c:6846
int m_ColorComponentB
Определения ItemBase.c:4848
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
Определения ItemBase.c:4786
bool IsActionTargetVisible()
Определения ItemBase.c:9054
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения ItemBase.c:5978
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Определения ItemBase.c:6267
bool m_IsBeingPlaced
Определения ItemBase.c:4829
int NameToID(string name)
Определения ItemBase.c:7541
void ~ItemBase()
Определения ItemBase.c:5508
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
Определения ItemBase.c:8404
void ClearStopItemSoundServer()
Определения ItemBase.c:9144
override string ChangeIntoOnDetach()
Определения ItemBase.c:6191
float m_VarWetMax
Определения ItemBase.c:4810
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6585
int GetLockType()
Определения ItemBase.c:8482
EffectSound m_SoundDeployFinish
Определения ItemBase.c:9526
override float GetWet()
Определения ItemBase.c:8374
EffectSound m_SoundPlace
Определения ItemBase.c:9527
float GetQuantityNormalizedScripted()
Определения ItemBase.c:8092
override void SetCleanness(int value, bool allow_client=false)
Определения ItemBase.c:8456
bool m_IsPlaceSound
Определения ItemBase.c:9530
override float GetWetMin()
Определения ItemBase.c:8384
ref ItemSoundHandler m_ItemSoundHandler
Определения ItemBase.c:4902
override bool KindOf(string tag)
Определения ItemBase.c:7470
void ItemSoundHandler(ItemBase parent)
Определения ItemSoundHandler.c:31
string Type
Определения JsonDataContaminatedArea.c:11
EffectSound m_LockingSound
Определения Land_Underground_Entrance.c:321
string GetDebugText()
Определения ModifierBase.c:71
PlayerBase GetPlayer()
Определения ModifierBase.c:51
@ LOWEST
Определения PPEConstants.c:54
void PluginItemDiagnostic()
Определения PluginItemDiagnostic.c:74
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:316
EntityAI GetItem()
Определения RadialQuickbarMenu.c:37
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
Определения RemoteDetonator.c:272
void RemoteDetonatorTrigger()
Определения RemoteDetonator.c:233
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
Определения RemoteDetonator.c:305
int particle_id
Определения SmokeSimulation.c:28
ETemperatureAccessTypes
Определения TemperatureAccessConstants.c:2
override void Explode(int damageType, string ammoType="")
Определения Trap_LandMine.c:220
bool m_Initialized
Определения UiHintPanel.c:317
void Debug()
Определения UniversalTemperatureSource.c:349
int GetID()
Определения ActionBase.c:1321
void OnItemLocationChanged(ItemBase item)
Определения ActionBase.c:962
GetInputType()
Определения ActionBase.c:215
int m_StanceMask
Определения ActionBase.c:25
int m_CommandUIDProne
Определения ActionBase.c:24
int m_CommandUID
Определения ActionBase.c:23
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
Определения AnalyticsManagerClient.c:77
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
Определения DayZGame.c:1187
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
Определения Game.c:1513
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
float GetEnergyAtSpawn()
Определения ComponentEnergyManager.c:1280
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
Определения ComponentEnergyManager.c:541
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
Определения ComponentEnergyManager.c:1275
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
Определения EffectSound.c:603
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
Определения EffectSound.c:274
override bool IsMan()
Определения Man.c:44
Определения Building.c:6
Определения constants.c:659
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
Определения ItemBase.c:15
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
bool WriteToContext(ParamsWriteContext ctx)
Определения InventoryLocation.c:469
proto native int GetType()
returns type of InventoryLocation
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native bool GetFlip()
returns flip status of cargo
proto native EntityAI GetItem()
returns item of current inventory location
InventoryLocation.
Определения InventoryLocation.c:29
override bool CanDisplayCargo()
Определения UndergroundStash.c:24
override void OnInventoryEnter(Man player)
Определения BarbedWire.c:203
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:6
override bool CanReceiveItemIntoCargo(EntityAI item)
Определения TentBase.c:913
override bool OnStoreLoad(ParamsReadContext ctx, int version)
Определения GardenBase.c:149
override void OnWasDetached(EntityAI parent, int slot_id)
Определения InventoryItem.c:920
override void EEOnAfterLoad()
Определения GardenBase.c:187
override void EEDelete(EntityAI parent)
Определения BaseBuildingBase.c:68
override bool CanBeRepairedByCrafting()
Определения TentBase.c:86
override void OnPlacementStarted(Man player)
Определения BatteryCharger.c:376
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
Определения BarbedWire.c:357
override bool IsElectricAppliance()
Определения BatteryCharger.c:43
override bool IsItemTent()
Определения TentBase.c:81
override void SetActions()
Определения InventoryItem.c:732
override bool CanMakeGardenplot()
Определения FieldShovel.c:3
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Определения PowerGenerator.c:412
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения HandcuffsLocked.c:12
override WrittenNoteData GetWrittenNoteData()
Определения Paper.c:30
override int GetDamageSystemVersionChange()
Определения BaseBuildingBase.c:1218
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Определения PileOfWoodenPlanks.c:88
override void InitItemVariables()
Определения Matchbox.c:3
override void SetActionAnimOverrides()
Определения PickAxe.c:28
override void OnCreatePhysics()
Определения BaseBuildingBase.c:465
override string GetDeploySoundset()
Определения BarbedWire.c:392
override float GetBandagingEffectivity()
Определения BandageDressing.c:49
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Определения PowerGenerator.c:424
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
Определения BaseBuildingBase.c:472
override void OnStoreSave(ParamsWriteContext ctx)
Определения GardenBase.c:206
override void AfterStoreLoad()
Определения GardenBase.c:182
override int GetOnDigWormsAmount()
Определения FieldShovel.c:27
override bool IsSelfAdjustingTemperature()
Определения PortableGasStove.c:287
override bool IsPlayerInside(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1017
override void OnVariablesSynchronized()
Определения GardenBase.c:68
override void RefreshPhysics()
Определения BatteryCharger.c:359
override bool CanObstruct()
Определения BaseBuildingBase.c:84
override void OnWasAttached(EntityAI parent, int slot_id)
Определения InventoryItem.c:912
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
Определения BaseBuildingBase.c:962
override bool CanPutInCargo(EntityAI parent)
Определения GardenBase.c:269
override string GetLoopDeploySoundset()
Определения BarbedWire.c:397
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
Определения BarbedWire.c:372
override void OnInventoryExit(Man player)
Определения BatteryCharger.c:341
override bool IsTakeable()
Определения BaseBuildingBase.c:988
override bool IsIgnoredByConstruction()
Определения BaseBuildingBase.c:1150
override void InitItemSounds()
Определения TentBase.c:810
override void EEKilled(Object killer)
Определения HandcuffsLocked.c:70
override void OnCombine(ItemBase other_item)
Определения BandageDressing.c:71
override bool CanExplodeInFire()
Определения LargeGasCannister.c:3
override bool IsFacingPlayer(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1012
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
Определения Rag.c:61
override bool IsBloodContainer()
Определения BloodContainerBase.c:10
override bool IsClothing()
Определения InventoryItem.c:840
override bool CanBeSplit()
Определения Rag.c:34
override bool IsDeployable()
Определения BaseBuildingBase.c:341
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Определения ToolBase.c:24
override bool CanBeDisinfected()
Определения BandageDressing.c:54
override float GetInfectionChance(int system=0, Param param=null)
Определения BandageDressing.c:59
override void OnEndPlacement()
Определения KitBase.c:65
Определения InventoryItem.c:731
Определения EnMath.c:7
float GetOverheatingLimitMax()
Определения WeaponParticles.c:417
void SetOverheatingLimitMax(float max)
Определения WeaponParticles.c:407
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
Определения WeaponParticles.c:422
float GetOverheatingLimitMin()
Определения WeaponParticles.c:412
Particle GetParticle()
Определения WeaponParticles.c:397
void SetOverheatingLimitMin(float min)
Определения WeaponParticles.c:402
void RegisterParticle(Particle p)
Определения WeaponParticles.c:392
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
Определения Particle.c:266
void SetControlledDevice(EntityAI pDevice)
Определения RemoteDetonator.c:140
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
proto void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto native void Send()
proto bool Write(void value_out)
proto bool Read(void value_in)
bool m_Loop
Определения ItemSoundHandler.c:5
override void Stop()
Определения DayZPlayerImplement.c:64
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
Определения UIManager.c:160
override void Refresh()
Определения ChatInputMenu.c:70
void SetCalcDetails(string details)
Определения Debug.c:816
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Определения WrittenNoteData.c:13
const float LOWEST
Определения EnConvert.c:100
Serializer ParamsReadContext
Определения gameplay.c:15
class LOD Object
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Определения gameplay.c:6
proto native CGame GetGame()
Serializer ParamsWriteContext
Определения gameplay.c:16
const int DEF_BIOLOGICAL
Определения constants.c:510
const int DEF_CHEMICAL
Определения constants.c:511
const int COMP_TYPE_ENERGY_MANAGER
Определения Component.c:9
ErrorExSeverity
Определения EnDebug.c:62
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90
enum ShapeType ErrorEx
proto native void SetColor(int color)
array< string > TStringArray
Определения EnScript.c:685
array< int > TIntArray
Определения EnScript.c:687
EntityEvent
Entity events for event-mask, or throwing event from code.
Определения EnEntity.c:45
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Определения constants.c:806
const int VARIABLE_LIQUIDTYPE
Определения constants.c:630
const int VARIABLE_CLEANNESS
Определения constants.c:633
const int VARIABLE_COLOR
Определения constants.c:632
const int VARIABLE_TEMPERATURE
Определения constants.c:628
const int VARIABLE_QUANTITY
Определения constants.c:626
const int VARIABLE_WET
Определения constants.c:629
const int LIQUID_NONE
Определения constants.c:527
static proto float AbsFloat(float f)
Returns absolute value.
const int MENU_INVENTORY
Определения constants.c:180
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_CRAFTING
Определения constants.c:451
const int SAT_DEBUG_ACTION
Определения constants.c:452
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.
const int CALL_CATEGORY_GAMEPLAY
Определения tools.c:10
const int CALL_CATEGORY_SYSTEM
Определения tools.c:8
proto native int GetColor()