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

◆ IsStoreLoad()

override bool SpawnItemOnLocation::IsStoreLoad ( )
protected

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

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

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