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

◆ OnEnergyConsumed()

override void SpawnItemOnLocation::OnEnergyConsumed ( )
protected

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

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