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

◆ GetItemAttachOffset()

float SpawnItemOnLocation::GetItemAttachOffset ( )
protected

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

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