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

◆ GetUnitWeight()

float SpawnItemOnLocation::GetUnitWeight ( bool include_wetness = true)
protected

Obsolete, use GetWeightEx instead.

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

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