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

◆ Repair()

bool SpawnItemOnLocation::Repair ( PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight )
protected

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

7504{
7505 override bool CanPutAsAttachment(EntityAI parent)
7506 {
7507 return true;
7508 }
7509};
7510
7511//const bool QUANTITY_DEBUG_REMOVE_ME = false;
7512
7513class ItemBase extends InventoryItem
7514{
7518
7520
7521 static int m_DebugActionsMask;
7523 // ============================================
7524 // Variable Manipulation System
7525 // ============================================
7526 // Quantity
7527
7528 float m_VarQuantity;
7529 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
7531 int m_VarQuantityMin;
7532 int m_VarQuantityMax;
7533 int m_Count;
7534 float m_VarStackMax;
7535 float m_StoreLoadedQuantity = float.LOWEST;
7536 // Wet
7537 float m_VarWet;
7538 float m_VarWetPrev;//for client to know wetness changed during synchronization
7539 float m_VarWetInit;
7540 float m_VarWetMin;
7541 float m_VarWetMax;
7542 // Cleanness
7543 int m_Cleanness;
7544 int m_CleannessInit;
7545 int m_CleannessMin;
7546 int m_CleannessMax;
7547 // impact sounds
7549 bool m_CanPlayImpactSound = true;
7550 float m_ImpactSpeed;
7552 //
7553 float m_HeatIsolation;
7554 float m_ItemModelLength;
7555 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
7557 int m_VarLiquidType;
7558 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
7559 int m_QuickBarBonus;
7560 bool m_IsBeingPlaced;
7561 bool m_IsHologram;
7562 bool m_IsTakeable;
7563 bool m_ThrowItemOnDrop;
7566 bool m_FixDamageSystemInit = false; //can be changed on storage version check
7567 bool can_this_be_combined; //Check if item can be combined
7568 bool m_CanThisBeSplit; //Check if item can be split
7569 bool m_IsStoreLoad = false;
7570 bool m_CanShowQuantity;
7571 bool m_HasQuantityBar;
7572 protected bool m_CanBeDigged;
7573 protected bool m_IsResultOfSplit
7574
7575 string m_SoundAttType;
7576 // items color variables
7581 //-------------------------------------------------------
7582
7583 // light source managing
7585
7589
7590 //==============================================
7591 // agent system
7592 private int m_AttachedAgents;
7593
7595 void TransferModifiers(PlayerBase reciever);
7596
7597
7598 // Weapons & suppressors particle effects
7603 static int m_LastRegisteredWeaponID = 0;
7604
7605 // Overheating effects
7607 float m_OverheatingShots;
7608 ref Timer m_CheckOverheating;
7609 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
7610 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
7611 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
7612 ref array <ref OverheatingParticle> m_OverheatingParticles;
7613
7615 protected bool m_HideSelectionsBySlot;
7616
7617 // Admin Log
7618 PluginAdminLog m_AdminLog;
7619
7620 // misc
7621 ref Timer m_PhysDropTimer;
7622
7623 // Attachment Locking variables
7624 ref array<int> m_CompatibleLocks;
7625 protected int m_LockType;
7626 protected ref EffectSound m_LockingSound;
7627 protected string m_LockSoundSet;
7628
7629 // ItemSoundHandler
7630 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
7631 protected int m_SoundSyncPlay; // id for sound to play
7632 protected int m_SoundSyncStop; // id for sound to stop
7634
7635 //temperature
7636 private float m_TemperaturePerQuantityWeight;
7637
7638 // -------------------------------------------------------------------------
7639 void ItemBase()
7640 {
7641 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
7645
7646 if (!GetGame().IsDedicatedServer())
7647 {
7648 if (HasMuzzle())
7649 {
7651
7653 {
7655 }
7656 }
7657
7659 m_ActionsInitialize = false;
7660 }
7661
7662 m_OldLocation = null;
7663
7664 if (GetGame().IsServer())
7665 {
7666 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
7667 }
7668
7669 if (ConfigIsExisting("headSelectionsToHide"))
7670 {
7672 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
7673 }
7674
7675 m_HideSelectionsBySlot = false;
7676 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7677 {
7678 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
7679 }
7680
7681 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
7682
7683 m_IsResultOfSplit = false;
7684
7686 }
7687
7688 override void InitItemVariables()
7689 {
7690 super.InitItemVariables();
7691
7692 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
7693 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
7694 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
7695 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
7696 m_VarStackMax = ConfigGetFloat("varStackMax");
7697 m_Count = ConfigGetInt("count");
7698
7699 m_CanShowQuantity = ConfigGetBool("quantityShow");
7700 m_HasQuantityBar = ConfigGetBool("quantityBar");
7701
7702 m_CleannessInit = ConfigGetInt("varCleannessInit");
7704 m_CleannessMin = ConfigGetInt("varCleannessMin");
7705 m_CleannessMax = ConfigGetInt("varCleannessMax");
7706
7707 m_WantPlayImpactSound = false;
7708 m_ImpactSpeed = 0.0;
7709
7710 m_VarWetInit = ConfigGetFloat("varWetInit");
7712 m_VarWetMin = ConfigGetFloat("varWetMin");
7713 m_VarWetMax = ConfigGetFloat("varWetMax");
7714
7715 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
7716 if (IsLiquidContainer() && GetQuantity() != 0)
7718 m_IsBeingPlaced = false;
7719 m_IsHologram = false;
7720 m_IsTakeable = true;
7721 m_CanBeMovedOverride = false;
7725 m_CanBeDigged = ConfigGetBool("canBeDigged");
7726
7727 m_CompatibleLocks = new array<int>();
7728 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
7729 m_LockType = ConfigGetInt("lockType");
7730
7731 //Define if item can be split and set ability to be combined accordingly
7732 m_CanThisBeSplit = false;
7733 can_this_be_combined = false;
7734 if (ConfigIsExisting("canBeSplit"))
7735 {
7736 can_this_be_combined = ConfigGetBool("canBeSplit");
7738 }
7739
7740 m_ItemBehaviour = -1;
7741 if (ConfigIsExisting("itemBehaviour"))
7742 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
7743
7744 //RegisterNetSyncVariableInt("m_VariablesMask");
7745 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
7746 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
7747 RegisterNetSyncVariableInt("m_VarLiquidType");
7748 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7749
7750 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7751 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7752 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7753
7754 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7755 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7756 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7757 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7758
7759 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7760 RegisterNetSyncVariableBool("m_IsTakeable");
7761 RegisterNetSyncVariableBool("m_IsHologram");
7762
7763 InitItemSounds();
7765 {
7766 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
7767 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
7768 }
7769
7770 m_LockSoundSet = ConfigGetString("lockSoundSet");
7771
7773 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7774 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
7775
7776 }
7777
7778 override int GetQuickBarBonus()
7779 {
7780 return m_QuickBarBonus;
7781 }
7782
7783 void InitializeActions()
7784 {
7786 if (!m_InputActionMap)
7787 {
7789 m_InputActionMap = iam;
7790 SetActions();
7792 }
7793 }
7794
7795 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
7796 {
7798 {
7799 m_ActionsInitialize = true;
7801 }
7802
7803 actions = m_InputActionMap.Get(action_input_type);
7804 }
7805
7806 void SetActions()
7807 {
7808 AddAction(ActionTakeItem);
7809 AddAction(ActionTakeItemToHands);
7810 AddAction(ActionWorldCraft);
7812 AddAction(ActionAttachWithSwitch);
7813 }
7814
7815 void SetActionAnimOverrides(); // Override action animation for specific item
7816
7817 void AddAction(typename actionName)
7818 {
7819 ActionBase action = ActionManagerBase.GetAction(actionName);
7820
7821 if (!action)
7822 {
7823 Debug.LogError("Action " + actionName + " dosn't exist!");
7824 return;
7825 }
7826
7827 typename ai = action.GetInputType();
7828 if (!ai)
7829 {
7830 m_ActionsInitialize = false;
7831 return;
7832 }
7833
7834 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
7835 if (!action_array)
7836 {
7837 action_array = new array<ActionBase_Basic>;
7838 m_InputActionMap.Insert(ai, action_array);
7839 }
7840 if (LogManager.IsActionLogEnable())
7841 {
7842 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
7843 }
7844
7845 if (action_array.Find(action) != -1)
7846 {
7847 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
7848 }
7849 else
7850 {
7851 action_array.Insert(action);
7852 }
7853 }
7854
7855 void RemoveAction(typename actionName)
7856 {
7857 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
7858 ActionBase action = player.GetActionManager().GetAction(actionName);
7859 typename ai = action.GetInputType();
7860 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
7861
7862 if (action_array)
7863 {
7864 action_array.RemoveItem(action);
7865 }
7866 }
7867
7868 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
7869 // Set -1 for params which should stay in default state
7870 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
7871 {
7872 ActionOverrideData overrideData = new ActionOverrideData();
7873 overrideData.m_CommandUID = commandUID;
7874 overrideData.m_CommandUIDProne = commandUIDProne;
7875 overrideData.m_StanceMask = stanceMask;
7876
7877 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
7878 if (!actionMap) // create new map of action > overidables map
7879 {
7880 actionMap = new TActionAnimOverrideMap();
7881 m_ItemActionOverrides.Insert(action, actionMap);
7882 }
7883
7884 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
7885
7886 }
7887
7888 void OnItemInHandsPlayerSwimStart(PlayerBase player);
7889
7890 ScriptedLightBase GetLight();
7891
7892 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
7893 void LoadParticleConfigOnFire(int id)
7894 {
7895 if (!m_OnFireEffect)
7897
7900
7901 string config_to_search = "CfgVehicles";
7902 string muzzle_owner_config;
7903
7904 if (!m_OnFireEffect.Contains(id))
7905 {
7906 if (IsInherited(Weapon))
7907 config_to_search = "CfgWeapons";
7908
7909 muzzle_owner_config = config_to_search + " " + GetType() + " ";
7910
7911 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7912
7913 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
7914
7915 if (config_OnFire_subclass_count > 0)
7916 {
7917 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7918
7919 for (int i = 0; i < config_OnFire_subclass_count; i++)
7920 {
7921 string particle_class = "";
7922 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
7923 string config_OnFire_entry = config_OnFire_class + particle_class;
7924 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7925 WPOF_array.Insert(WPOF);
7926 }
7927
7928
7929 m_OnFireEffect.Insert(id, WPOF_array);
7930 }
7931 }
7932
7933 if (!m_OnBulletCasingEjectEffect.Contains(id))
7934 {
7935 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
7936 muzzle_owner_config = config_to_search + " " + GetType() + " ";
7937
7938 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7939
7940 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7941
7942 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7943 {
7944 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7945
7946 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7947 {
7948 string particle_class2 = "";
7949 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7950 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7951 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7952 WPOBE_array.Insert(WPOBE);
7953 }
7954
7955
7956 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
7957 }
7958 }
7959 }
7960
7961 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
7963 {
7966
7967 if (!m_OnOverheatingEffect.Contains(id))
7968 {
7969 string config_to_search = "CfgVehicles";
7970
7971 if (IsInherited(Weapon))
7972 config_to_search = "CfgWeapons";
7973
7974 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
7975 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7976
7977 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
7978 {
7979
7980 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
7981
7983 {
7984 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
7985 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7986 Error(error);
7987 return;
7988 }
7989
7990 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
7991 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
7992
7993
7994
7995 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
7996 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7997
7998 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7999 {
8000 string particle_class = "";
8001 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8002 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8003 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
8004
8005 if (entry_type == CT_CLASS)
8006 {
8007 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8008 WPOOH_array.Insert(WPOF);
8009 }
8010 }
8011
8012
8013 m_OnOverheatingEffect.Insert(id, WPOOH_array);
8014 }
8015 }
8016 }
8017
8018 float GetOverheatingValue()
8019 {
8020 return m_OverheatingShots;
8021 }
8022
8023 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
8024 {
8025 if (m_MaxOverheatingValue > 0)
8026 {
8028
8029 if (!m_CheckOverheating)
8031
8033 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
8034
8035 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8036 }
8037 }
8038
8039 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8040 {
8042 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8043
8045 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8046
8048 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8049
8051 {
8053 }
8054 }
8055
8057 {
8059 }
8060
8061 void OnOverheatingDecay()
8062 {
8063 if (m_MaxOverheatingValue > 0)
8064 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
8065 else
8067
8068 if (m_OverheatingShots <= 0)
8069 {
8072 }
8073 else
8074 {
8075 if (!m_CheckOverheating)
8077
8079 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
8080 }
8081
8082 CheckOverheating(this, "", this);
8083 }
8084
8085 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8086 {
8088 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
8089 }
8090
8091 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8092 {
8094 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
8096 }
8097
8098 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
8099 {
8101 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8102 }
8103
8104 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
8105 {
8107 m_OverheatingParticles = new array<ref OverheatingParticle>;
8108
8109 OverheatingParticle OP = new OverheatingParticle();
8110 OP.RegisterParticle(p);
8111 OP.SetOverheatingLimitMin(min_heat_coef);
8112 OP.SetOverheatingLimitMax(max_heat_coef);
8113 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
8114
8115 m_OverheatingParticles.Insert(OP);
8116 }
8117
8118 float GetOverheatingCoef()
8119 {
8120 if (m_MaxOverheatingValue > 0)
8122
8123 return -1;
8124 }
8125
8127 {
8129 {
8130 float overheat_coef = GetOverheatingCoef();
8131 int count = m_OverheatingParticles.Count();
8132
8133 for (int i = count; i > 0; --i)
8134 {
8135 int id = i - 1;
8136 OverheatingParticle OP = m_OverheatingParticles.Get(id);
8137 Particle p = OP.GetParticle();
8138
8139 float overheat_min = OP.GetOverheatingLimitMin();
8140 float overheat_max = OP.GetOverheatingLimitMax();
8141
8142 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8143 {
8144 if (p)
8145 {
8146 p.Stop();
8147 OP.RegisterParticle(null);
8148 }
8149 }
8150 }
8151 }
8152 }
8153
8155 {
8157 {
8158 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
8159 {
8160 int id = i - 1;
8161 OverheatingParticle OP = m_OverheatingParticles.Get(id);
8162
8163 if (OP)
8164 {
8165 Particle p = OP.GetParticle();
8166
8167 if (p)
8168 {
8169 p.Stop();
8170 }
8171
8172 delete OP;
8173 }
8174 }
8175
8176 m_OverheatingParticles.Clear();
8178 }
8179 }
8180
8182 float GetInfectionChance(int system = 0, Param param = null)
8183 {
8184 return 0.0;
8185 }
8186
8187
8188 float GetDisinfectQuantity(int system = 0, Param param1 = null)
8189 {
8190 return 250;//default value
8191 }
8192
8193 float GetFilterDamageRatio()
8194 {
8195 return 0;
8196 }
8197
8199 bool HasMuzzle()
8200 {
8201 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
8202 return true;
8203
8204 return false;
8205 }
8206
8208 int GetMuzzleID()
8209 {
8210 if (!m_WeaponTypeToID)
8212
8213 if (m_WeaponTypeToID.Contains(GetType()))
8214 {
8215 return m_WeaponTypeToID.Get(GetType());
8216 }
8217 else
8218 {
8219 // Register new weapon ID
8221 }
8222
8224 }
8225
8232 {
8233 return -1;
8234 }
8235
8236
8237
8238 // -------------------------------------------------------------------------
8239 void ~ItemBase()
8240 {
8241 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
8242 {
8243 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
8244 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8245
8246 if (r_index >= 0)
8247 {
8248 InventoryLocation r_il = new InventoryLocation;
8249 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8250
8251 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8252 int r_type = r_il.GetType();
8253 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
8254 {
8255 r_il.GetParent().GetOnReleaseLock().Invoke(this);
8256 }
8257 else if (r_type == InventoryLocationType.ATTACHMENT)
8258 {
8259 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
8260 }
8261
8262 }
8263
8264 player.GetHumanInventory().ClearUserReservedLocation(this);
8265 }
8266
8267 if (m_LockingSound)
8268 SEffectManager.DestroyEffect(m_LockingSound);
8269 }
8270
8271
8272
8273 // -------------------------------------------------------------------------
8274 static int GetDebugActionsMask()
8275 {
8276 return ItemBase.m_DebugActionsMask;
8277 }
8278
8279 static bool HasDebugActionsMask(int mask)
8280 {
8281 return ItemBase.m_DebugActionsMask & mask;
8282 }
8283
8284 static void SetDebugActionsMask(int mask)
8285 {
8286 ItemBase.m_DebugActionsMask = mask;
8287 }
8288
8289 static void AddDebugActionsMask(int mask)
8290 {
8291 ItemBase.m_DebugActionsMask |= mask;
8292 }
8293
8294 static void RemoveDebugActionsMask(int mask)
8295 {
8296 ItemBase.m_DebugActionsMask &= ~mask;
8297 }
8298
8299 static void ToggleDebugActionsMask(int mask)
8300 {
8301 if (HasDebugActionsMask(mask))
8302 {
8304 }
8305 else
8306 {
8307 AddDebugActionsMask(mask);
8308 }
8309 }
8310
8311 // -------------------------------------------------------------------------
8312 void SetCEBasedQuantity()
8313 {
8314 if (GetEconomyProfile())
8315 {
8316 float q_max = GetEconomyProfile().GetQuantityMax();
8317 if (q_max > 0)
8318 {
8319 float q_min = GetEconomyProfile().GetQuantityMin();
8320 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8321
8322 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
8323 {
8324 ComponentEnergyManager comp = GetCompEM();
8325 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
8326 {
8327 comp.SetEnergy0To1(quantity_randomized);
8328 }
8329 }
8330 else if (HasQuantity())
8331 {
8332 SetQuantityNormalized(quantity_randomized, false);
8333 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
8334 }
8335
8336 }
8337 }
8338 }
8339
8341 void LockToParent()
8342 {
8343 EntityAI parent = GetHierarchyParent();
8344
8345 if (parent)
8346 {
8347 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8348 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8349 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
8350 }
8351 }
8352
8354 void UnlockFromParent()
8355 {
8356 EntityAI parent = GetHierarchyParent();
8357
8358 if (parent)
8359 {
8360 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8361 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8362 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
8363 }
8364 }
8365
8366 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
8367 {
8368 /*
8369 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
8370 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
8371 */
8372 ItemBase item2 = ItemBase.Cast(entity2);
8373
8374 if (GetGame().IsClient())
8375 {
8376 if (ScriptInputUserData.CanStoreInputUserData())
8377 {
8378 ScriptInputUserData ctx = new ScriptInputUserData;
8380 ctx.Write(-1);
8381 ItemBase i1 = this; // @NOTE: workaround for correct serialization
8382 ctx.Write(i1);
8383 ctx.Write(item2);
8384 ctx.Write(use_stack_max);
8385 ctx.Write(-1);
8386 ctx.Send();
8387
8388 if (IsCombineAll(item2, use_stack_max))
8389 {
8390 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8391 }
8392 }
8393 }
8394 else if (!GetGame().IsMultiplayer())
8395 {
8396 CombineItems(item2, use_stack_max);
8397 }
8398 }
8399
8400 bool IsLiquidPresent()
8401 {
8402 return (GetLiquidType() != 0 && HasQuantity());
8403 }
8404
8405 bool IsLiquidContainer()
8406 {
8407 return m_LiquidContainerMask != 0;
8408 }
8409
8411 {
8412 return m_LiquidContainerMask;
8413 }
8414
8415 bool IsBloodContainer()
8416 {
8417 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
8418 return false;
8419 }
8420
8421 bool IsNVG()
8422 {
8423 return false;
8424 }
8425
8428 bool IsExplosive()
8429 {
8430 return false;
8431 }
8432
8434 {
8435 return "";
8436 }
8437
8439
8440 bool IsLightSource()
8441 {
8442 return false;
8443 }
8444
8446 {
8447 return true;
8448 }
8449
8450 //--- ACTION CONDITIONS
8451 //direction
8452 bool IsFacingPlayer(PlayerBase player, string selection)
8453 {
8454 return true;
8455 }
8456
8457 bool IsPlayerInside(PlayerBase player, string selection)
8458 {
8459 return true;
8460 }
8461
8462 override bool CanObstruct()
8463 {
8464 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
8465 return !player || !IsPlayerInside(player, "");
8466 }
8467
8468 override bool IsBeingPlaced()
8469 {
8470 return m_IsBeingPlaced;
8471 }
8472
8473 void SetIsBeingPlaced(bool is_being_placed)
8474 {
8475 m_IsBeingPlaced = is_being_placed;
8476 if (!is_being_placed)
8478 SetSynchDirty();
8479 }
8480
8481 //server-side
8482 void OnEndPlacement() {}
8483
8484 override bool IsHologram()
8485 {
8486 return m_IsHologram;
8487 }
8488
8489 bool CanBeDigged()
8490 {
8491 return m_CanBeDigged;
8492 }
8493
8495 {
8496 return 1;
8497 }
8498
8499 bool CanMakeGardenplot()
8500 {
8501 return false;
8502 }
8503
8504 void SetIsHologram(bool is_hologram)
8505 {
8506 m_IsHologram = is_hologram;
8507 SetSynchDirty();
8508 }
8509 /*
8510 protected float GetNutritionalEnergy()
8511 {
8512 Edible_Base edible = Edible_Base.Cast(this);
8513 return edible.GetFoodEnergy();
8514 }
8515
8516 protected float GetNutritionalWaterContent()
8517 {
8518 Edible_Base edible = Edible_Base.Cast(this);
8519 return edible.GetFoodWater();
8520 }
8521
8522 protected float GetNutritionalIndex()
8523 {
8524 Edible_Base edible = Edible_Base.Cast(this);
8525 return edible.GetFoodNutritionalIndex();
8526 }
8527
8528 protected float GetNutritionalFullnessIndex()
8529 {
8530 Edible_Base edible = Edible_Base.Cast(this);
8531 return edible.GetFoodTotalVolume();
8532 }
8533
8534 protected float GetNutritionalToxicity()
8535 {
8536 Edible_Base edible = Edible_Base.Cast(this);
8537 return edible.GetFoodToxicity();
8538
8539 }
8540 */
8541
8542
8543 // -------------------------------------------------------------------------
8544 override void OnMovedInsideCargo(EntityAI container)
8545 {
8546 super.OnMovedInsideCargo(container);
8547
8548 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8549 }
8550
8551 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8552 {
8553 super.EEItemLocationChanged(oldLoc,newLoc);
8554
8555 PlayerBase new_player = null;
8556 PlayerBase old_player = null;
8557
8558 if (newLoc.GetParent())
8559 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8560
8561 if (oldLoc.GetParent())
8562 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8563
8564 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
8565 {
8566 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
8567
8568 if (r_index >= 0)
8569 {
8570 InventoryLocation r_il = new InventoryLocation;
8571 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8572
8573 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8574 int r_type = r_il.GetType();
8575 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
8576 {
8577 r_il.GetParent().GetOnReleaseLock().Invoke(this);
8578 }
8579 else if (r_type == InventoryLocationType.ATTACHMENT)
8580 {
8581 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
8582 }
8583
8584 }
8585 }
8586
8587 if (newLoc.GetType() == InventoryLocationType.HANDS)
8588 {
8589 if (new_player)
8590 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
8591
8592 if (new_player == old_player)
8593 {
8594
8595 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8596 {
8597 if (oldLoc.GetType() == InventoryLocationType.CARGO)
8598 {
8599 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8600 {
8601 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8602 }
8603 }
8604 else
8605 {
8606 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8607 }
8608 }
8609
8610 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8611 {
8612 int type = oldLoc.GetType();
8613 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
8614 {
8615 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8616 }
8617 else if (type == InventoryLocationType.ATTACHMENT)
8618 {
8619 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8620 }
8621 }
8622 if (!m_OldLocation)
8623 {
8624 m_OldLocation = new InventoryLocation;
8625 }
8626 m_OldLocation.Copy(oldLoc);
8627 }
8628 else
8629 {
8630 if (m_OldLocation)
8631 {
8632 m_OldLocation.Reset();
8633 }
8634 }
8635
8637 }
8638 else
8639 {
8640 if (new_player)
8641 {
8642 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8643 if (res_index >= 0)
8644 {
8645 InventoryLocation il = new InventoryLocation;
8646 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
8647 ItemBase it = ItemBase.Cast(il.GetItem());
8648 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
8649 int rel_type = il.GetType();
8650 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
8651 {
8652 il.GetParent().GetOnReleaseLock().Invoke(it);
8653 }
8654 else if (rel_type == InventoryLocationType.ATTACHMENT)
8655 {
8656 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
8657 }
8658 //it.GetOnReleaseLock().Invoke(it);
8659 }
8660 }
8661 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
8662 {
8663 //ThrowPhysically(old_player, vector.Zero);
8664 m_ThrowItemOnDrop = false;
8665 }
8666
8667 if (m_OldLocation)
8668 {
8669 m_OldLocation.Reset();
8670 }
8671 }
8672 }
8673
8674 override void EOnContact(IEntity other, Contact extra)
8675 {
8677 {
8678 int liquidType = -1;
8679 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
8680 if (impactSpeed > 0.0)
8681 {
8682 m_ImpactSpeed = impactSpeed;
8683 #ifndef SERVER
8684 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
8685 #else
8686 m_WantPlayImpactSound = true;
8687 SetSynchDirty();
8688 #endif
8689 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
8690 }
8691 }
8692
8693 #ifdef SERVER
8694 if (GetCompEM() && GetCompEM().IsPlugged())
8695 {
8696 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
8697 GetCompEM().UnplugThis();
8698 }
8699 #endif
8700 }
8701
8702 void RefreshPhysics();
8703
8704 override void OnCreatePhysics()
8705 {
8707 }
8708
8709 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8710 {
8711
8712 }
8713 // -------------------------------------------------------------------------
8714 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
8715 {
8716 super.OnItemLocationChanged(old_owner, new_owner);
8717
8718 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8719 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8720
8721 if (!relatedPlayer && playerNew)
8722 relatedPlayer = playerNew;
8723
8724 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8725 {
8726 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
8727 if (actionMgr)
8728 {
8729 ActionBase currentAction = actionMgr.GetRunningAction();
8730 if (currentAction)
8731 currentAction.OnItemLocationChanged(this);
8732 }
8733 }
8734
8735 Man ownerPlayerOld = null;
8736 Man ownerPlayerNew = null;
8737
8738 if (old_owner)
8739 {
8740 if (old_owner.IsMan())
8741 {
8742 ownerPlayerOld = Man.Cast(old_owner);
8743 }
8744 else
8745 {
8746 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8747 }
8748 }
8749 else
8750 {
8751 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
8752 {
8753 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
8754
8755 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
8756 {
8757 GetCompEM().UnplugThis();
8758 }
8759 }
8760 }
8761
8762 if (new_owner)
8763 {
8764 if (new_owner.IsMan())
8765 {
8766 ownerPlayerNew = Man.Cast(new_owner);
8767 }
8768 else
8769 {
8770 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8771 }
8772 }
8773
8774 if (ownerPlayerOld != ownerPlayerNew)
8775 {
8776 if (ownerPlayerOld)
8777 {
8778 array<EntityAI> subItemsExit = new array<EntityAI>;
8779 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
8780 for (int i = 0; i < subItemsExit.Count(); i++)
8781 {
8782 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
8783 itemExit.OnInventoryExit(ownerPlayerOld);
8784 }
8785 }
8786
8787 if (ownerPlayerNew)
8788 {
8789 array<EntityAI> subItemsEnter = new array<EntityAI>;
8790 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
8791 for (int j = 0; j < subItemsEnter.Count(); j++)
8792 {
8793 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
8794 itemEnter.OnInventoryEnter(ownerPlayerNew);
8795 }
8796 }
8797 }
8798 else if (ownerPlayerNew != null)
8799 {
8800 PlayerBase nplayer;
8801 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8802 {
8803 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8804 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
8805 for (int k = 0; k < subItemsUpdate.Count(); k++)
8806 {
8807 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
8808 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8809 }
8810 }
8811 }
8812
8813 if (old_owner)
8814 old_owner.OnChildItemRemoved(this);
8815 if (new_owner)
8816 new_owner.OnChildItemReceived(this);
8817 }
8818
8819 // -------------------------------------------------------------------------------
8820 override void EEDelete(EntityAI parent)
8821 {
8822 super.EEDelete(parent);
8823 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8824 if (player)
8825 {
8826 OnInventoryExit(player);
8827
8828 if (player.IsAlive())
8829 {
8830 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8831 if (r_index >= 0)
8832 {
8833 InventoryLocation r_il = new InventoryLocation;
8834 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8835
8836 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8837 int r_type = r_il.GetType();
8838 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
8839 {
8840 r_il.GetParent().GetOnReleaseLock().Invoke(this);
8841 }
8842 else if (r_type == InventoryLocationType.ATTACHMENT)
8843 {
8844 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
8845 }
8846
8847 }
8848
8849 player.RemoveQuickBarEntityShortcut(this);
8850 }
8851 }
8852 }
8853 // -------------------------------------------------------------------------------
8854 override void EEKilled(Object killer)
8855 {
8856 super.EEKilled(killer);
8857
8859 if (killer && killer.IsFireplace() && CanExplodeInFire())
8860 {
8861 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8862 {
8863 if (IsMagazine())
8864 {
8865 if (Magazine.Cast(this).GetAmmoCount() > 0)
8866 {
8867 ExplodeAmmo();
8868 }
8869 }
8870 else
8871 {
8872 Explode(DamageType.EXPLOSION);
8873 }
8874 }
8875 }
8876 }
8877
8878 override void OnWasAttached(EntityAI parent, int slot_id)
8879 {
8880 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8881
8882 super.OnWasAttached(parent, slot_id);
8883
8884 if (HasQuantity())
8885 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
8886
8887 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
8888 }
8889
8890 override void OnWasDetached(EntityAI parent, int slot_id)
8891 {
8892 super.OnWasDetached(parent, slot_id);
8893
8894 if (HasQuantity())
8895 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
8896 }
8897
8898 override string ChangeIntoOnAttach(string slot)
8899 {
8900 int idx;
8901 TStringArray inventory_slots = new TStringArray;
8902 TStringArray attach_types = new TStringArray;
8903
8904 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8905 if (inventory_slots.Count() < 1) //is string
8906 {
8907 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8908 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8909 }
8910 else //is array
8911 {
8912 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8913 }
8914
8915 idx = inventory_slots.Find(slot);
8916 if (idx < 0)
8917 return "";
8918
8919 return attach_types.Get(idx);
8920 }
8921
8922 override string ChangeIntoOnDetach()
8923 {
8924 int idx = -1;
8925 string slot;
8926
8927 TStringArray inventory_slots = new TStringArray;
8928 TStringArray detach_types = new TStringArray;
8929
8930 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8931 if (inventory_slots.Count() < 1) //is string
8932 {
8933 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8934 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8935 }
8936 else //is array
8937 {
8938 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8939 if (detach_types.Count() < 1)
8940 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8941 }
8942
8943 for (int i = 0; i < inventory_slots.Count(); i++)
8944 {
8945 slot = inventory_slots.Get(i);
8946 }
8947
8948 if (slot != "")
8949 {
8950 if (detach_types.Count() == 1)
8951 idx = 0;
8952 else
8953 idx = inventory_slots.Find(slot);
8954 }
8955 if (idx < 0)
8956 return "";
8957
8958 return detach_types.Get(idx);
8959 }
8960
8961 void ExplodeAmmo()
8962 {
8963 //timer
8964 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
8965
8966 //min/max time
8967 float min_time = 1;
8968 float max_time = 3;
8969 float delay = Math.RandomFloat(min_time, max_time);
8970
8971 explode_timer.Run(delay, this, "DoAmmoExplosion");
8972 }
8973
8974 void DoAmmoExplosion()
8975 {
8976 Magazine magazine = Magazine.Cast(this);
8977 int pop_sounds_count = 6;
8978 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8979
8980 //play sound
8981 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8982 string sound_name = pop_sounds[ sound_idx ];
8983 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
8984
8985 //remove ammo count
8986 magazine.ServerAddAmmoCount(-1);
8987
8988 //if condition then repeat -> ExplodeAmmo
8989 float min_temp_to_explode = 100; //min temperature for item to explode
8990
8991 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
8992 {
8993 ExplodeAmmo();
8994 }
8995 }
8996
8997 // -------------------------------------------------------------------------------
8998 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
8999 {
9000 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
9001
9002 const int CHANCE_DAMAGE_CARGO = 4;
9003 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9004 const int CHANCE_DAMAGE_NOTHING = 2;
9005
9006 if (IsClothing() || IsContainer() || IsItemTent())
9007 {
9008 float dmg = damageResult.GetDamage("","Health") * -0.5;
9009 int chances;
9010 int rnd;
9011
9012 if (GetInventory().GetCargo())
9013 {
9014 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9015 rnd = Math.RandomInt(0,chances);
9016
9017 if (rnd < CHANCE_DAMAGE_CARGO)
9018 {
9019 DamageItemInCargo(dmg);
9020 }
9021 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9022 {
9024 }
9025 }
9026 else
9027 {
9028 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9029 rnd = Math.RandomInt(0,chances);
9030
9031 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9032 {
9034 }
9035 }
9036 }
9037 }
9038
9039 bool DamageItemInCargo(float damage)
9040 {
9041 if (GetInventory().GetCargo())
9042 {
9043 int item_count = GetInventory().GetCargo().GetItemCount();
9044 if (item_count > 0)
9045 {
9046 int random_pick = Math.RandomInt(0, item_count);
9047 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
9048 if (!item.IsExplosive())
9049 {
9050 item.AddHealth("","",damage);
9051 return true;
9052 }
9053 }
9054 }
9055 return false;
9056 }
9057
9058 bool DamageItemAttachments(float damage)
9059 {
9060 int attachment_count = GetInventory().AttachmentCount();
9061 if (attachment_count > 0)
9062 {
9063 int random_pick = Math.RandomInt(0, attachment_count);
9064 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
9065 if (!attachment.IsExplosive())
9066 {
9067 attachment.AddHealth("","",damage);
9068 return true;
9069 }
9070 }
9071 return false;
9072 }
9073
9074 override bool IsSplitable()
9075 {
9076 return m_CanThisBeSplit;
9077 }
9078 //----------------
9079 override bool CanBeSplit()
9080 {
9081 if (IsSplitable() && (GetQuantity() > 1))
9082 return GetInventory().CanRemoveEntity();
9083
9084 return false;
9085 }
9086
9087 protected bool ShouldSplitQuantity(float quantity)
9088 {
9089 // don't call 'CanBeSplit' here, too strict and will introduce a freeze-crash when dismantling fence with a fireplace nearby
9090 if (!IsSplitable())
9091 return false;
9092
9093 // nothing to split?
9094 if (GetQuantity() <= 1)
9095 return false;
9096
9097 // check if we should re-use the item instead of creating a new copy?
9098 // implicit cast to int, if 'IsSplitable' returns true, these values are assumed ints
9099 int delta = GetQuantity() - quantity;
9100 if (delta == 0)
9101 return false;
9102
9103 // valid to split
9104 return true;
9105 }
9106
9107 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
9108 {
9109 if (GetGame().IsClient())
9110 {
9111 if (ScriptInputUserData.CanStoreInputUserData())
9112 {
9113 ScriptInputUserData ctx = new ScriptInputUserData;
9115 ctx.Write(1);
9116 ItemBase i1 = this; // @NOTE: workaround for correct serialization
9117 ctx.Write(i1);
9118 ctx.Write(destination_entity);
9119 ctx.Write(true);
9120 ctx.Write(slot_id);
9121 ctx.Send();
9122 }
9123 }
9124 else if (!GetGame().IsMultiplayer())
9125 {
9126 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
9127 }
9128 }
9129
9130 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
9131 {
9132 float split_quantity_new;
9133 ItemBase new_item;
9134 float quantity = GetQuantity();
9135 float stack_max = GetTargetQuantityMax(slot_id);
9136 InventoryLocation loc = new InventoryLocation;
9137
9138 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9139 {
9140 if (stack_max <= GetQuantity())
9141 split_quantity_new = stack_max;
9142 else
9143 split_quantity_new = GetQuantity();
9144
9145 if (ShouldSplitQuantity(split_quantity_new))
9146 {
9147 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
9148 if (new_item)
9149 {
9150 new_item.SetResultOfSplit(true);
9151 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9152 AddQuantity(-split_quantity_new, false, true);
9153 new_item.SetQuantity(split_quantity_new, false, true);
9154 }
9155 }
9156 }
9157 else if (destination_entity && slot_id == -1)
9158 {
9159 if (quantity > stack_max)
9160 split_quantity_new = stack_max;
9161 else
9162 split_quantity_new = quantity;
9163
9164 if (ShouldSplitQuantity(split_quantity_new))
9165 {
9166 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
9167 {
9168 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
9169 new_item = ItemBase.Cast(o);
9170 }
9171
9172 if (new_item)
9173 {
9174 new_item.SetResultOfSplit(true);
9175 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9176 AddQuantity(-split_quantity_new, false, true);
9177 new_item.SetQuantity(split_quantity_new, false, true);
9178 }
9179 }
9180 }
9181 else
9182 {
9183 if (stack_max != 0)
9184 {
9185 if (stack_max < GetQuantity())
9186 {
9187 split_quantity_new = GetQuantity() - stack_max;
9188 }
9189
9190 if (split_quantity_new == 0)
9191 {
9192 if (!GetGame().IsMultiplayer())
9193 player.PhysicalPredictiveDropItem(this);
9194 else
9195 player.ServerDropEntity(this);
9196 return;
9197 }
9198
9199 if (ShouldSplitQuantity(split_quantity_new))
9200 {
9201 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
9202
9203 if (new_item)
9204 {
9205 new_item.SetResultOfSplit(true);
9206 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9207 SetQuantity(split_quantity_new, false, true);
9208 new_item.SetQuantity(stack_max, false, true);
9209 new_item.PlaceOnSurface();
9210 }
9211 }
9212 }
9213 }
9214 }
9215
9216 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
9217 {
9218 float split_quantity_new;
9219 ItemBase new_item;
9220 float quantity = GetQuantity();
9221 float stack_max = GetTargetQuantityMax(slot_id);
9222 InventoryLocation loc = new InventoryLocation;
9223
9224 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9225 {
9226 if (stack_max <= GetQuantity())
9227 split_quantity_new = stack_max;
9228 else
9229 split_quantity_new = GetQuantity();
9230
9231 if (ShouldSplitQuantity(split_quantity_new))
9232 {
9233 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
9234 if (new_item)
9235 {
9236 new_item.SetResultOfSplit(true);
9237 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9238 AddQuantity(-split_quantity_new, false, true);
9239 new_item.SetQuantity(split_quantity_new, false, true);
9240 }
9241 }
9242 }
9243 else if (destination_entity && slot_id == -1)
9244 {
9245 if (quantity > stack_max)
9246 split_quantity_new = stack_max;
9247 else
9248 split_quantity_new = quantity;
9249
9250 if (ShouldSplitQuantity(split_quantity_new))
9251 {
9252 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
9253 {
9254 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
9255 new_item = ItemBase.Cast(o);
9256 }
9257
9258 if (new_item)
9259 {
9260 new_item.SetResultOfSplit(true);
9261 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9262 AddQuantity(-split_quantity_new, false, true);
9263 new_item.SetQuantity(split_quantity_new, false, true);
9264 }
9265 }
9266 }
9267 else
9268 {
9269 if (stack_max != 0)
9270 {
9271 if (stack_max < GetQuantity())
9272 {
9273 split_quantity_new = GetQuantity() - stack_max;
9274 }
9275
9276 if (ShouldSplitQuantity(split_quantity_new))
9277 {
9278 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
9279
9280 if (new_item)
9281 {
9282 new_item.SetResultOfSplit(true);
9283 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9284 SetQuantity(split_quantity_new, false, true);
9285 new_item.SetQuantity(stack_max, false, true);
9286 new_item.PlaceOnSurface();
9287 }
9288 }
9289 }
9290 }
9291 }
9292
9293 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
9294 {
9295 if (GetGame().IsClient())
9296 {
9297 if (ScriptInputUserData.CanStoreInputUserData())
9298 {
9299 ScriptInputUserData ctx = new ScriptInputUserData;
9301 ctx.Write(4);
9302 ItemBase thiz = this; // @NOTE: workaround for correct serialization
9303 ctx.Write(thiz);
9304 dst.WriteToContext(ctx);
9305 ctx.Send();
9306 }
9307 }
9308 else if (!GetGame().IsMultiplayer())
9309 {
9311 }
9312 }
9313
9314 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
9315 {
9316 if (GetGame().IsClient())
9317 {
9318 if (ScriptInputUserData.CanStoreInputUserData())
9319 {
9320 ScriptInputUserData ctx = new ScriptInputUserData;
9322 ctx.Write(2);
9323 ItemBase dummy = this; // @NOTE: workaround for correct serialization
9324 ctx.Write(dummy);
9325 ctx.Write(destination_entity);
9326 ctx.Write(true);
9327 ctx.Write(idx);
9328 ctx.Write(row);
9329 ctx.Write(col);
9330 ctx.Send();
9331 }
9332 }
9333 else if (!GetGame().IsMultiplayer())
9334 {
9335 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
9336 }
9337 }
9338
9339 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
9340 {
9342 }
9343
9344 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
9345 {
9346 float quantity = GetQuantity();
9347 float split_quantity_new;
9348 ItemBase new_item;
9349 if (dst.IsValid())
9350 {
9351 int slot_id = dst.GetSlot();
9352 float stack_max = GetTargetQuantityMax(slot_id);
9353
9354 if (quantity > stack_max)
9355 split_quantity_new = stack_max;
9356 else
9357 split_quantity_new = quantity;
9358
9359 if (ShouldSplitQuantity(split_quantity_new))
9360 {
9361 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
9362
9363 if (new_item)
9364 {
9365 new_item.SetResultOfSplit(true);
9366 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9367 AddQuantity(-split_quantity_new, false, true);
9368 new_item.SetQuantity(split_quantity_new, false, true);
9369 }
9370
9371 return new_item;
9372 }
9373 }
9374
9375 return null;
9376 }
9377
9378 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
9379 {
9380 float quantity = GetQuantity();
9381 float split_quantity_new;
9382 ItemBase new_item;
9383 if (destination_entity)
9384 {
9385 float stackable = GetTargetQuantityMax();
9386 if (quantity > stackable)
9387 split_quantity_new = stackable;
9388 else
9389 split_quantity_new = quantity;
9390
9391 if (ShouldSplitQuantity(split_quantity_new))
9392 {
9393 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
9394 if (new_item)
9395 {
9396 new_item.SetResultOfSplit(true);
9397 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9398 AddQuantity(-split_quantity_new, false, true);
9399 new_item.SetQuantity(split_quantity_new, false, true);
9400 }
9401 }
9402 }
9403 }
9404
9405 void SplitIntoStackMaxHandsClient(PlayerBase player)
9406 {
9407 if (GetGame().IsClient())
9408 {
9409 if (ScriptInputUserData.CanStoreInputUserData())
9410 {
9411 ScriptInputUserData ctx = new ScriptInputUserData;
9413 ctx.Write(3);
9414 ItemBase i1 = this; // @NOTE: workaround for correct serialization
9415 ctx.Write(i1);
9416 ItemBase destination_entity = this;
9417 ctx.Write(destination_entity);
9418 ctx.Write(true);
9419 ctx.Write(0);
9420 ctx.Send();
9421 }
9422 }
9423 else if (!GetGame().IsMultiplayer())
9424 {
9425 SplitIntoStackMaxHands(player);
9426 }
9427 }
9428
9429 void SplitIntoStackMaxHands(PlayerBase player)
9430 {
9431 float quantity = GetQuantity();
9432 float split_quantity_new;
9433 ref ItemBase new_item;
9434 if (player)
9435 {
9436 float stackable = GetTargetQuantityMax();
9437 if (quantity > stackable)
9438 split_quantity_new = stackable;
9439 else
9440 split_quantity_new = quantity;
9441
9442 if (ShouldSplitQuantity(split_quantity_new))
9443 {
9444 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
9445 new_item = ItemBase.Cast(in_hands);
9446 if (new_item)
9447 {
9448 new_item.SetResultOfSplit(true);
9449 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9450 AddQuantity(-split_quantity_new, false, true);
9451 new_item.SetQuantity(split_quantity_new, false, true);
9452 }
9453 }
9454 }
9455 }
9456
9457 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
9458 {
9459 float quantity = GetQuantity();
9460 float split_quantity_new = Math.Floor(quantity * 0.5);
9461
9462 if (!ShouldSplitQuantity(split_quantity_new))
9463 return;
9464
9465 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
9466
9467 if (new_item)
9468 {
9469 if (new_item.GetQuantityMax() < split_quantity_new)
9470 {
9471 split_quantity_new = new_item.GetQuantityMax();
9472 }
9473
9474 new_item.SetResultOfSplit(true);
9475 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9476
9477 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
9478 {
9479 AddQuantity(-1, false, true);
9480 new_item.SetQuantity(1, false, true);
9481 }
9482 else
9483 {
9484 AddQuantity(-split_quantity_new, false, true);
9485 new_item.SetQuantity(split_quantity_new, false, true);
9486 }
9487 }
9488 }
9489
9490 void SplitItem(PlayerBase player)
9491 {
9492 float quantity = GetQuantity();
9493 float split_quantity_new = Math.Floor(quantity / 2);
9494
9495 if (!ShouldSplitQuantity(split_quantity_new))
9496 return;
9497
9498 InventoryLocation invloc = new InventoryLocation;
9499 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
9500
9501 ItemBase new_item;
9502 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9503
9504 if (new_item)
9505 {
9506 if (new_item.GetQuantityMax() < split_quantity_new)
9507 {
9508 split_quantity_new = new_item.GetQuantityMax();
9509 }
9510 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
9511 {
9512 AddQuantity(-1, false, true);
9513 new_item.SetQuantity(1, false, true);
9514 }
9515 else if (split_quantity_new > 1)
9516 {
9517 AddQuantity(-split_quantity_new, false, true);
9518 new_item.SetQuantity(split_quantity_new, false, true);
9519 }
9520 }
9521 }
9522
9524 void OnQuantityChanged(float delta)
9525 {
9526 SetWeightDirty();
9527 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
9528
9529 if (parent)
9530 parent.OnAttachmentQuantityChangedEx(this, delta);
9531
9532 if (IsLiquidContainer())
9533 {
9534 if (GetQuantityNormalized() <= 0.0)
9535 {
9537 }
9538 else if (GetLiquidType() == LIQUID_NONE)
9539 {
9540 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
9542 }
9543 }
9544
9545 }
9546
9549 {
9550 // insert code here
9551 }
9552
9554 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
9555 {
9557 }
9558
9559 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
9560 {
9561 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9562
9563 if (GetGame().IsServer())
9564 {
9565 if (newLevel == GameConstants.STATE_RUINED)
9566 {
9568 EntityAI parent = GetHierarchyParent();
9569 if (parent && parent.IsFireplace())
9570 {
9571 CargoBase cargo = GetInventory().GetCargo();
9572 if (cargo)
9573 {
9574 for (int i = 0; i < cargo.GetItemCount(); ++i)
9575 {
9576 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
9577 }
9578 }
9579 }
9580 }
9581
9582 if (IsResultOfSplit())
9583 {
9584 // reset the splitting result flag, return to normal item behavior
9585 SetResultOfSplit(false);
9586 return;
9587 }
9588
9589 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9590 {
9591 SetCleanness(0);//unclean the item upon damage dealt
9592 }
9593 }
9594 }
9595
9596 // just the split? TODO: verify
9597 override void OnRightClick()
9598 {
9599 super.OnRightClick();
9600
9601 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
9602 {
9603 if (GetGame().IsClient())
9604 {
9605 if (ScriptInputUserData.CanStoreInputUserData())
9606 {
9607 EntityAI root = GetHierarchyRoot();
9608 Man playerOwner = GetHierarchyRootPlayer();
9609 InventoryLocation dst = new InventoryLocation;
9610
9611 // If we have no hierarchy root player and the root is the same as this item the source item is in the vicinity so we want to create the new split item there also
9612 if (!playerOwner && root && root == this)
9613 {
9615 }
9616 else
9617 {
9618 // Check if we can place the new split item in the same parent where the source item is placed in or otherwise drop it in vicinity
9619 GetInventory().GetCurrentInventoryLocation(dst);
9620 if (!dst.GetParent() || dst.GetParent() && !dst.GetParent().GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.CARGO, dst))
9621 {
9622 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
9623 if (!player.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.CARGO, dst) || !playerOwner)
9624 {
9626 }
9627 else
9628 {
9629 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
9630 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
9631 this shouldnt cause issues within this scope*/
9632 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
9633 {
9635 }
9636 else
9637 {
9638 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9639 }
9640 }
9641 }
9642 }
9643
9644 ScriptInputUserData ctx = new ScriptInputUserData;
9646 ctx.Write(4);
9647 ItemBase thiz = this; // @NOTE: workaround for correct serialization
9648 ctx.Write(thiz);
9649 dst.WriteToContext(ctx);
9650 ctx.Write(true); // dummy
9651 ctx.Send();
9652 }
9653 }
9654 else if (!GetGame().IsMultiplayer())
9655 {
9656 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
9657 }
9658 }
9659 }
9660
9661 protected void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
9662 {
9663 if (root)
9664 {
9665 vector m4[4];
9666 root.GetTransform(m4);
9667 dst.SetGround(this, m4);
9668 }
9669 else
9670 {
9671 GetInventory().GetCurrentInventoryLocation(dst);
9672 }
9673 }
9674
9675 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
9676 {
9677 //TODO: delete check zero quantity check after fix double posts hands fsm events
9678 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
9679 return false;
9680
9681 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9682 return false;
9683
9684 //can_this_be_combined = ConfigGetBool("canBeSplit");
9686 return false;
9687
9688
9689 Magazine mag = Magazine.Cast(this);
9690 if (mag)
9691 {
9692 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9693 return false;
9694
9695 if (stack_max_limit)
9696 {
9697 Magazine other_mag = Magazine.Cast(other_item);
9698 if (other_item)
9699 {
9700 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9701 return false;
9702 }
9703
9704 }
9705 }
9706 else
9707 {
9708 //TODO: delete check zero quantity check after fix double posts hands fsm events
9709 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
9710 return false;
9711
9712 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
9713 return false;
9714 }
9715
9716 PlayerBase player = null;
9717 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
9718 {
9719 if (player.GetInventory().HasAttachment(this))
9720 return false;
9721
9722 if (player.IsItemsToDelete())
9723 return false;
9724 }
9725
9726 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9727 return false;
9728
9729 int slotID;
9730 string slotName;
9731 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9732 return false;
9733
9734 return true;
9735 }
9736
9737 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
9738 {
9739 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
9740 }
9741
9742 bool IsResultOfSplit()
9743 {
9744 return m_IsResultOfSplit;
9745 }
9746
9747 void SetResultOfSplit(bool value)
9748 {
9749 m_IsResultOfSplit = value;
9750 }
9751
9752 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
9753 {
9754 return ComputeQuantityUsedEx(other_item, use_stack_max);
9755 }
9756
9757 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
9758 {
9759 float other_item_quantity = other_item.GetQuantity();
9760 float this_free_space;
9761
9762 float stack_max = GetQuantityMax();
9763
9764 this_free_space = stack_max - GetQuantity();
9765
9766 if (other_item_quantity > this_free_space)
9767 {
9768 return this_free_space;
9769 }
9770 else
9771 {
9772 return other_item_quantity;
9773 }
9774 }
9775
9776 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
9777 {
9778 CombineItems(ItemBase.Cast(entity2),use_stack_max);
9779 }
9780
9781 void CombineItems(ItemBase other_item, bool use_stack_max = true)
9782 {
9783 if (!CanBeCombined(other_item, false))
9784 return;
9785
9786 if (!IsMagazine() && other_item)
9787 {
9788 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
9789 if (quantity_used != 0)
9790 {
9791 float hp1 = GetHealth01("","");
9792 float hp2 = other_item.GetHealth01("","");
9793 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
9794 hpResult = hpResult / (GetQuantity() + quantity_used);
9795
9796 hpResult *= GetMaxHealth();
9797 Math.Round(hpResult);
9798 SetHealth("", "Health", hpResult);
9799
9800 AddQuantity(quantity_used);
9801 other_item.AddQuantity(-quantity_used);
9802 }
9803 }
9804 OnCombine(other_item);
9805 }
9806
9807 void OnCombine(ItemBase other_item)
9808 {
9809 #ifdef SERVER
9810 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9811 GetHierarchyParent().IncreaseLifetimeUp();
9812 #endif
9813 };
9814
9815 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
9816 {
9817 PlayerBase p = PlayerBase.Cast(player);
9818
9819 array<int> recipesIds = p.m_Recipes;
9820 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
9821 if (moduleRecipesManager)
9822 {
9823 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
9824 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
9825 }
9826
9827 for (int i = 0;i < recipesIds.Count(); i++)
9828 {
9829 int key = recipesIds.Get(i);
9830 string recipeName = moduleRecipesManager.GetRecipeName(key);
9831 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
9832 }
9833 }
9834
9835 // -------------------------------------------------------------------------
9836 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9837 {
9838 super.GetDebugActions(outputList);
9839
9840 //quantity
9841 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
9842 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
9843 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
9844 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
9845 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
9846
9847 //health
9848 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
9849 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
9850 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
9851 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
9852 //temperature
9853 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
9854 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
9855 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
9856 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
9857
9858 //wet
9859 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
9860 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
9861 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
9862
9863 //liquidtype
9864 if (IsLiquidContainer())
9865 {
9866 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
9867 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
9868 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
9869 }
9870
9871 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
9872 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
9873
9874 // watch
9875 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
9876 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
9877 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
9878
9879 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
9880
9881 InventoryLocation loc = new InventoryLocation();
9882 GetInventory().GetCurrentInventoryLocation(loc);
9883 if (!loc || loc.GetType() == InventoryLocationType.GROUND)
9884 {
9885 if (Gizmo_IsSupported())
9886 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GIZMO_OBJECT, "Gizmo Object", FadeColors.LIGHT_GREY));
9887 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GIZMO_PHYSICS, "Gizmo Physics (SP Only)", FadeColors.LIGHT_GREY)); // intentionally allowed for testing physics desync
9888 }
9889
9890 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
9891 }
9892
9893 // -------------------------------------------------------------------------
9894 // -------------------------------------------------------------------------
9895 // -------------------------------------------------------------------------
9896 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
9897 {
9898 super.OnAction(action_id, player, ctx);
9899
9900 if (GetGame().IsClient() || !GetGame().IsMultiplayer())
9901 {
9902 switch (action_id)
9903 {
9904 case EActions.GIZMO_OBJECT:
9905 GetGame().GizmoSelectObject(this);
9906 return true;
9907 case EActions.GIZMO_PHYSICS:
9908 GetGame().GizmoSelectPhysics(GetPhysics());
9909 return true;
9910 }
9911 }
9912
9913 if (GetGame().IsServer())
9914 {
9915 switch (action_id)
9916 {
9917 case EActions.DELETE:
9918 Delete();
9919 return true;
9920 }
9921 }
9922
9923 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
9924 {
9925 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
9926 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
9927 PlayerBase p = PlayerBase.Cast(player);
9928 if (EActions.RECIPES_RANGE_START < 1000)
9929 {
9930 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9931 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9932 }
9933 }
9934 #ifndef SERVER
9935 else if (action_id == EActions.WATCH_PLAYER)
9936 {
9937 PluginDeveloper.SetDeveloperItemClientEx(player);
9938 }
9939 #endif
9940 if (GetGame().IsServer())
9941 {
9942 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9943 {
9944 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9945 OnDebugButtonPressServer(id + 1);
9946 }
9947
9948 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9949 {
9950 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9951 InsertAgent(agent_id,100);
9952 }
9953
9954 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9955 {
9956 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9957 RemoveAgent(agent_id2);
9958 }
9959
9960 else if (action_id == EActions.ADD_QUANTITY)
9961 {
9962 if (IsMagazine())
9963 {
9964 Magazine mag = Magazine.Cast(this);
9965 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9966 }
9967 else
9968 {
9969 AddQuantity(GetQuantityMax() * 0.2);
9970 }
9971
9972 if (m_EM)
9973 {
9974 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9975 }
9976 //PrintVariables();
9977 }
9978
9979 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
9980 {
9981 if (IsMagazine())
9982 {
9983 Magazine mag2 = Magazine.Cast(this);
9984 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9985 }
9986 else
9987 {
9988 AddQuantity(- GetQuantityMax() * 0.2);
9989 }
9990 if (m_EM)
9991 {
9992 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9993 }
9994 //PrintVariables();
9995 }
9996
9997 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
9998 {
9999 SetQuantity(0);
10000
10001 if (m_EM)
10002 {
10003 m_EM.SetEnergy(0);
10004 }
10005 }
10006
10007 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
10008 {
10010
10011 if (m_EM)
10012 {
10013 m_EM.SetEnergy(m_EM.GetEnergyMax());
10014 }
10015 }
10016
10017 else if (action_id == EActions.ADD_HEALTH)
10018 {
10019 AddHealth("","",GetMaxHealth("","Health")/5);
10020 }
10021 else if (action_id == EActions.REMOVE_HEALTH)
10022 {
10023 AddHealth("","",-GetMaxHealth("","Health")/5);
10024 }
10025 else if (action_id == EActions.DESTROY_HEALTH)
10026 {
10027 SetHealth01("","",0);
10028 }
10029 else if (action_id == EActions.WATCH_ITEM)
10030 {
10032 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
10033 #ifdef DEVELOPER
10034 SetDebugDeveloper_item(this);
10035 #endif
10036 }
10037
10038 else if (action_id == EActions.ADD_TEMPERATURE)
10039 {
10040 AddTemperature(20);
10041 //PrintVariables();
10042 }
10043
10044 else if (action_id == EActions.REMOVE_TEMPERATURE)
10045 {
10046 AddTemperature(-20);
10047 //PrintVariables();
10048 }
10049
10050 else if (action_id == EActions.FLIP_FROZEN)
10051 {
10052 SetFrozen(!GetIsFrozen());
10053 //PrintVariables();
10054 }
10055
10056 else if (action_id == EActions.ADD_WETNESS)
10057 {
10058 AddWet(GetWetMax()/5);
10059 //PrintVariables();
10060 }
10061
10062 else if (action_id == EActions.REMOVE_WETNESS)
10063 {
10064 AddWet(-GetWetMax()/5);
10065 //PrintVariables();
10066 }
10067
10068 else if (action_id == EActions.LIQUIDTYPE_UP)
10069 {
10070 int curr_type = GetLiquidType();
10071 SetLiquidType(curr_type * 2);
10072 //AddWet(1);
10073 //PrintVariables();
10074 }
10075
10076 else if (action_id == EActions.LIQUIDTYPE_DOWN)
10077 {
10078 int curr_type2 = GetLiquidType();
10079 SetLiquidType(curr_type2 / 2);
10080 }
10081
10082 else if (action_id == EActions.MAKE_SPECIAL)
10083 {
10084 auto debugParams = DebugSpawnParams.WithPlayer(player);
10085 OnDebugSpawnEx(debugParams);
10086 }
10087
10088 }
10089
10090
10091 return false;
10092 }
10093
10094 // -------------------------------------------------------------------------
10095
10096
10099 void OnActivatedByTripWire();
10100
10102 void OnActivatedByItem(notnull ItemBase item);
10103
10104 //----------------------------------------------------------------
10105 //returns true if item is able to explode when put in fire
10106 bool CanExplodeInFire()
10107 {
10108 return false;
10109 }
10110
10111 //----------------------------------------------------------------
10112 bool CanEat()
10113 {
10114 return true;
10115 }
10116
10117 //----------------------------------------------------------------
10118 override bool IsIgnoredByConstruction()
10119 {
10120 return true;
10121 }
10122
10123 //----------------------------------------------------------------
10124 //has FoodStages in config?
10125 bool HasFoodStage()
10126 {
10127 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
10128 return GetGame().ConfigIsExisting(config_path);
10129 }
10130
10132 FoodStage GetFoodStage()
10133 {
10134 return null;
10135 }
10136
10137 bool CanBeCooked()
10138 {
10139 return false;
10140 }
10141
10142 bool CanBeCookedOnStick()
10143 {
10144 return false;
10145 }
10146
10148 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
10150
10151 //----------------------------------------------------------------
10152 bool CanRepair(ItemBase item_repair_kit)
10153 {
10154 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
10155 return module_repairing.CanRepair(this, item_repair_kit);
10156 }
10157
10158 //----------------------------------------------------------------
10159 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
10160 {
10161 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
10162 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10163 }
10164
10165 //----------------------------------------------------------------
10166 int GetItemSize()
10167 {
10168 /*
10169 vector v_size = this.ConfigGetVector("itemSize");
10170 int v_size_x = v_size[0];
10171 int v_size_y = v_size[1];
10172 int size = v_size_x * v_size_y;
10173 return size;
10174 */
10175
10176 return 1;
10177 }
10178
10179 //----------------------------------------------------------------
10180 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
10181 bool CanBeMovedOverride()
10182 {
10183 return m_CanBeMovedOverride;
10184 }
10185
10186 //----------------------------------------------------------------
10187 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
10188 void SetCanBeMovedOverride(bool setting)
10189 {
10190 m_CanBeMovedOverride = setting;
10191 }
10192
10193 //----------------------------------------------------------------
10201 void MessageToOwnerStatus(string text)
10202 {
10203 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10204
10205 if (player)
10206 {
10207 player.MessageStatus(text);
10208 }
10209 }
10210
10211 //----------------------------------------------------------------
10219 void MessageToOwnerAction(string text)
10220 {
10221 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10222
10223 if (player)
10224 {
10225 player.MessageAction(text);
10226 }
10227 }
10228
10229 //----------------------------------------------------------------
10237 void MessageToOwnerFriendly(string text)
10238 {
10239 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10240
10241 if (player)
10242 {
10243 player.MessageFriendly(text);
10244 }
10245 }
10246
10247 //----------------------------------------------------------------
10255 void MessageToOwnerImportant(string text)
10256 {
10257 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10258
10259 if (player)
10260 {
10261 player.MessageImportant(text);
10262 }
10263 }
10264
10265 override bool IsItemBase()
10266 {
10267 return true;
10268 }
10269
10270 // Checks if item is of questioned kind
10271 override bool KindOf(string tag)
10272 {
10273 bool found = false;
10274 string item_name = this.GetType();
10275 ref TStringArray item_tag_array = new TStringArray;
10276 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
10277
10278 int array_size = item_tag_array.Count();
10279 for (int i = 0; i < array_size; i++)
10280 {
10281 if (item_tag_array.Get(i) == tag)
10282 {
10283 found = true;
10284 break;
10285 }
10286 }
10287 return found;
10288 }
10289
10290
10291 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
10292 {
10293 //Debug.Log("OnRPC called");
10294 super.OnRPC(sender, rpc_type,ctx);
10295
10296 //Play soundset for attachment locking (ActionLockAttachment.c)
10297 switch (rpc_type)
10298 {
10299 #ifndef SERVER
10300 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10301 Param2<bool, string> p = new Param2<bool, string>(false, "");
10302
10303 if (!ctx.Read(p))
10304 return;
10305
10306 bool play = p.param1;
10307 string soundSet = p.param2;
10308
10309 if (play)
10310 {
10311 if (m_LockingSound)
10312 {
10314 {
10315 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
10316 }
10317 }
10318 else
10319 {
10320 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
10321 }
10322 }
10323 else
10324 {
10325 SEffectManager.DestroyEffect(m_LockingSound);
10326 }
10327
10328 break;
10329 #endif
10330
10331 }
10332
10333 if (GetWrittenNoteData())
10334 {
10335 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
10336 }
10337 }
10338
10339 //-----------------------------
10340 // VARIABLE MANIPULATION SYSTEM
10341 //-----------------------------
10342 int NameToID(string name)
10343 {
10344 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
10345 return plugin.GetID(name);
10346 }
10347
10348 string IDToName(int id)
10349 {
10350 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
10351 return plugin.GetName(id);
10352 }
10353
10355 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
10356 {
10357 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
10358 //read the flags
10359 int varFlags;
10360 if (!ctx.Read(varFlags))
10361 return;
10362
10363 if (varFlags & ItemVariableFlags.FLOAT)
10364 {
10365 ReadVarsFromCTX(ctx);
10366 }
10367 }
10368
10369 override void SerializeNumericalVars(array<float> floats_out)
10370 {
10371 //some variables handled on EntityAI level already!
10372 super.SerializeNumericalVars(floats_out);
10373
10374 // the order of serialization must be the same as the order of de-serialization
10375 //--------------------------------------------
10376 if (IsVariableSet(VARIABLE_QUANTITY))
10377 {
10378 floats_out.Insert(m_VarQuantity);
10379 }
10380 //--------------------------------------------
10381 if (IsVariableSet(VARIABLE_WET))
10382 {
10383 floats_out.Insert(m_VarWet);
10384 }
10385 //--------------------------------------------
10386 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
10387 {
10388 floats_out.Insert(m_VarLiquidType);
10389 }
10390 //--------------------------------------------
10391 if (IsVariableSet(VARIABLE_COLOR))
10392 {
10393 floats_out.Insert(m_ColorComponentR);
10394 floats_out.Insert(m_ColorComponentG);
10395 floats_out.Insert(m_ColorComponentB);
10396 floats_out.Insert(m_ColorComponentA);
10397 }
10398 //--------------------------------------------
10399 if (IsVariableSet(VARIABLE_CLEANNESS))
10400 {
10401 floats_out.Insert(m_Cleanness);
10402 }
10403 }
10404
10405 override void DeSerializeNumericalVars(array<float> floats)
10406 {
10407 //some variables handled on EntityAI level already!
10408 super.DeSerializeNumericalVars(floats);
10409
10410 // the order of serialization must be the same as the order of de-serialization
10411 int index = 0;
10412 int mask = Math.Round(floats.Get(index));
10413
10414 index++;
10415 //--------------------------------------------
10416 if (mask & VARIABLE_QUANTITY)
10417 {
10418 if (m_IsStoreLoad)
10419 {
10420 SetStoreLoadedQuantity(floats.Get(index));
10421 }
10422 else
10423 {
10424 float quantity = floats.Get(index);
10425 SetQuantity(quantity, true, false, false, false);
10426 }
10427 index++;
10428 }
10429 //--------------------------------------------
10430 if (mask & VARIABLE_WET)
10431 {
10432 float wet = floats.Get(index);
10433 SetWet(wet);
10434 index++;
10435 }
10436 //--------------------------------------------
10437 if (mask & VARIABLE_LIQUIDTYPE)
10438 {
10439 int liquidtype = Math.Round(floats.Get(index));
10440 SetLiquidType(liquidtype);
10441 index++;
10442 }
10443 //--------------------------------------------
10444 if (mask & VARIABLE_COLOR)
10445 {
10446 m_ColorComponentR = Math.Round(floats.Get(index));
10447 index++;
10448 m_ColorComponentG = Math.Round(floats.Get(index));
10449 index++;
10450 m_ColorComponentB = Math.Round(floats.Get(index));
10451 index++;
10452 m_ColorComponentA = Math.Round(floats.Get(index));
10453 index++;
10454 }
10455 //--------------------------------------------
10456 if (mask & VARIABLE_CLEANNESS)
10457 {
10458 int cleanness = Math.Round(floats.Get(index));
10459 SetCleanness(cleanness);
10460 index++;
10461 }
10462 }
10463
10464 override void WriteVarsToCTX(ParamsWriteContext ctx)
10465 {
10466 super.WriteVarsToCTX(ctx);
10467
10468 //--------------------------------------------
10469 if (IsVariableSet(VARIABLE_QUANTITY))
10470 {
10471 ctx.Write(GetQuantity());
10472 }
10473 //--------------------------------------------
10474 if (IsVariableSet(VARIABLE_WET))
10475 {
10476 ctx.Write(GetWet());
10477 }
10478 //--------------------------------------------
10479 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
10480 {
10481 ctx.Write(GetLiquidType());
10482 }
10483 //--------------------------------------------
10484 if (IsVariableSet(VARIABLE_COLOR))
10485 {
10486 int r,g,b,a;
10487 GetColor(r,g,b,a);
10488 ctx.Write(r);
10489 ctx.Write(g);
10490 ctx.Write(b);
10491 ctx.Write(a);
10492 }
10493 //--------------------------------------------
10494 if (IsVariableSet(VARIABLE_CLEANNESS))
10495 {
10496 ctx.Write(GetCleanness());
10497 }
10498 }
10499
10500 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
10501 {
10502 if (!super.ReadVarsFromCTX(ctx,version))
10503 return false;
10504
10505 int intValue;
10506 float value;
10507
10508 if (version < 140)
10509 {
10510 if (!ctx.Read(intValue))
10511 return false;
10512
10513 m_VariablesMask = intValue;
10514 }
10515
10516 if (m_VariablesMask & VARIABLE_QUANTITY)
10517 {
10518 if (!ctx.Read(value))
10519 return false;
10520
10521 if (IsStoreLoad())
10522 {
10524 }
10525 else
10526 {
10527 SetQuantity(value, true, false, false, false);
10528 }
10529 }
10530 //--------------------------------------------
10531 if (version < 140)
10532 {
10533 if (m_VariablesMask & VARIABLE_TEMPERATURE)
10534 {
10535 if (!ctx.Read(value))
10536 return false;
10537 SetTemperatureDirect(value);
10538 }
10539 }
10540 //--------------------------------------------
10541 if (m_VariablesMask & VARIABLE_WET)
10542 {
10543 if (!ctx.Read(value))
10544 return false;
10545 SetWet(value);
10546 }
10547 //--------------------------------------------
10548 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
10549 {
10550 if (!ctx.Read(intValue))
10551 return false;
10552 SetLiquidType(intValue);
10553 }
10554 //--------------------------------------------
10555 if (m_VariablesMask & VARIABLE_COLOR)
10556 {
10557 int r,g,b,a;
10558 if (!ctx.Read(r))
10559 return false;
10560 if (!ctx.Read(g))
10561 return false;
10562 if (!ctx.Read(b))
10563 return false;
10564 if (!ctx.Read(a))
10565 return false;
10566
10567 SetColor(r,g,b,a);
10568 }
10569 //--------------------------------------------
10570 if (m_VariablesMask & VARIABLE_CLEANNESS)
10571 {
10572 if (!ctx.Read(intValue))
10573 return false;
10574 SetCleanness(intValue);
10575 }
10576 //--------------------------------------------
10577 if (version >= 138 && version < 140)
10578 {
10579 if (m_VariablesMask & VARIABLE_TEMPERATURE)
10580 {
10581 if (!ctx.Read(intValue))
10582 return false;
10583 SetFrozen(intValue);
10584 }
10585 }
10586
10587 return true;
10588 }
10589
10590 //----------------------------------------------------------------
10591 override bool OnStoreLoad(ParamsReadContext ctx, int version)
10592 {
10593 m_IsStoreLoad = true;
10595 {
10596 m_FixDamageSystemInit = true;
10597 }
10598
10599 if (!super.OnStoreLoad(ctx, version))
10600 {
10601 m_IsStoreLoad = false;
10602 return false;
10603 }
10604
10605 if (version >= 114)
10606 {
10607 bool hasQuickBarIndexSaved;
10608
10609 if (!ctx.Read(hasQuickBarIndexSaved))
10610 {
10611 m_IsStoreLoad = false;
10612 return false;
10613 }
10614
10615 if (hasQuickBarIndexSaved)
10616 {
10617 int itmQBIndex;
10618
10619 //Load quickbar item bind
10620 if (!ctx.Read(itmQBIndex))
10621 {
10622 m_IsStoreLoad = false;
10623 return false;
10624 }
10625
10626 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10627 if (itmQBIndex != -1 && parentPlayer)
10628 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10629 }
10630 }
10631 else
10632 {
10633 // Backup of how it used to be
10634 PlayerBase player;
10635 int itemQBIndex;
10636 if (version == int.MAX)
10637 {
10638 if (!ctx.Read(itemQBIndex))
10639 {
10640 m_IsStoreLoad = false;
10641 return false;
10642 }
10643 }
10644 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10645 {
10646 //Load quickbar item bind
10647 if (!ctx.Read(itemQBIndex))
10648 {
10649 m_IsStoreLoad = false;
10650 return false;
10651 }
10652 if (itemQBIndex != -1 && player)
10653 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10654 }
10655 }
10656
10657 if (version < 140)
10658 {
10659 // variable management system
10660 if (!LoadVariables(ctx, version))
10661 {
10662 m_IsStoreLoad = false;
10663 return false;
10664 }
10665 }
10666
10667 //agent trasmission system
10668 if (!LoadAgents(ctx, version))
10669 {
10670 m_IsStoreLoad = false;
10671 return false;
10672 }
10673 if (version >= 132)
10674 {
10675 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
10676 if (raib)
10677 {
10678 if (!raib.OnStoreLoad(ctx,version))
10679 {
10680 m_IsStoreLoad = false;
10681 return false;
10682 }
10683 }
10684 }
10685
10686 m_IsStoreLoad = false;
10687 return true;
10688 }
10689
10690 //----------------------------------------------------------------
10691
10692 override void OnStoreSave(ParamsWriteContext ctx)
10693 {
10694 super.OnStoreSave(ctx);
10695
10696 PlayerBase player;
10697 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10698 {
10699 ctx.Write(true); // Keep track of if we should actually read this in or not
10700 //Save quickbar item bind
10701 int itemQBIndex = -1;
10702 itemQBIndex = player.FindQuickBarEntityIndex(this);
10703 ctx.Write(itemQBIndex);
10704 }
10705 else
10706 {
10707 ctx.Write(false); // Keep track of if we should actually read this in or not
10708 }
10709
10710 SaveAgents(ctx);//agent trasmission system
10711
10712 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
10713 if (raib)
10714 {
10715 raib.OnStoreSave(ctx);
10716 }
10717 }
10718 //----------------------------------------------------------------
10719
10720 override void AfterStoreLoad()
10721 {
10722 super.AfterStoreLoad();
10723
10725 {
10727 }
10728
10729 if (GetStoreLoadedQuantity() != float.LOWEST)
10730 {
10732 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
10733 }
10734 }
10735
10736 override void EEOnAfterLoad()
10737 {
10738 super.EEOnAfterLoad();
10739
10741 {
10742 m_FixDamageSystemInit = false;
10743 }
10744
10747 }
10748
10749 bool CanBeDisinfected()
10750 {
10751 return false;
10752 }
10753
10754
10755 //----------------------------------------------------------------
10756 override void OnVariablesSynchronized()
10757 {
10758 if (m_Initialized)
10759 {
10760 #ifdef PLATFORM_CONSOLE
10761 //bruteforce it is
10762 if (IsSplitable())
10763 {
10764 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
10765 if (menu)
10766 {
10767 menu.Refresh();
10768 }
10769 }
10770 #endif
10771 }
10772
10774 {
10775 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
10776 m_WantPlayImpactSound = false;
10777 }
10778
10780 {
10781 SetWeightDirty();
10783 }
10784 if (m_VarWet != m_VarWetPrev)
10785 {
10788 }
10789
10790 if (m_SoundSyncPlay != 0)
10791 {
10792 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
10793 m_SoundSyncPlay = 0;
10794 }
10795 if (m_SoundSyncStop != 0)
10796 {
10797 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
10798 m_SoundSyncStop = 0;
10799 }
10800
10801 super.OnVariablesSynchronized();
10802 }
10803
10804 //------------------------- Quantity
10805 //----------------------------------------------------------------
10807 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
10808 {
10809 if (!IsServerCheck(allow_client))
10810 return false;
10811
10812 if (!HasQuantity())
10813 return false;
10814
10815 float min = GetQuantityMin();
10816 float max = GetQuantityMax();
10817
10818 if (value <= (min + 0.001))
10819 value = min;
10820
10821 if (value == min)
10822 {
10823 if (destroy_config)
10824 {
10825 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10826 if (dstr)
10827 {
10828 m_VarQuantity = Math.Clamp(value, min, max);
10829 this.Delete();
10830 return true;
10831 }
10832 }
10833 else if (destroy_forced)
10834 {
10835 m_VarQuantity = Math.Clamp(value, min, max);
10836 this.Delete();
10837 return true;
10838 }
10839 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
10840 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
10841 }
10842
10843 float delta = m_VarQuantity;
10844 m_VarQuantity = Math.Clamp(value, min, max);
10845
10846 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
10847 {
10848 delta = m_VarQuantity - delta;
10849
10850 if (delta)
10851 OnQuantityChanged(delta);
10852 }
10853
10854 SetVariableMask(VARIABLE_QUANTITY);
10855
10856 return false;
10857 }
10858
10859 //----------------------------------------------------------------
10861 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
10862 {
10863 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
10864 }
10865 //----------------------------------------------------------------
10866 void SetQuantityMax()
10867 {
10868 float max = GetQuantityMax();
10869 SetQuantity(max);
10870 }
10871
10872 override void SetQuantityToMinimum()
10873 {
10874 float min = GetQuantityMin();
10875 SetQuantity(min);
10876 }
10877 //----------------------------------------------------------------
10879 override void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
10880 {
10881 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
10882 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
10883 SetQuantity(result, destroy_config, destroy_forced);
10884 }
10885
10886 //----------------------------------------------------------------
10888 override float GetQuantityNormalized()
10889 {
10890 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
10891 }
10892
10894 {
10895 return GetQuantityNormalized();
10896 }
10897
10898 /*void SetAmmoNormalized(float value)
10899 {
10900 float value_clamped = Math.Clamp(value, 0, 1);
10901 Magazine this_mag = Magazine.Cast(this);
10902 int max_rounds = this_mag.GetAmmoMax();
10903 int result = value * max_rounds;//can the rounded if higher precision is required
10904 this_mag.SetAmmoCount(result);
10905 }*/
10906 //----------------------------------------------------------------
10907 override int GetQuantityMax()
10908 {
10909 int slot = -1;
10910 if (GetInventory())
10911 {
10912 InventoryLocation il = new InventoryLocation;
10913 GetInventory().GetCurrentInventoryLocation(il);
10914 slot = il.GetSlot();
10915 }
10916
10917 return GetTargetQuantityMax(slot);
10918 }
10919
10920 override int GetTargetQuantityMax(int attSlotID = -1)
10921 {
10922 float quantity_max = 0;
10923
10924 if (IsSplitable()) //only stackable/splitable items can check for stack size
10925 {
10926 if (attSlotID != -1)
10927 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10928
10929 if (quantity_max <= 0)
10930 quantity_max = m_VarStackMax;
10931 }
10932
10933 if (quantity_max <= 0)
10934 quantity_max = m_VarQuantityMax;
10935
10936 return quantity_max;
10937 }
10938 //----------------------------------------------------------------
10939 override int GetQuantityMin()
10940 {
10941 return m_VarQuantityMin;
10942 }
10943 //----------------------------------------------------------------
10944 int GetQuantityInit()
10945 {
10946 return m_VarQuantityInit;
10947 }
10948
10949 //----------------------------------------------------------------
10950 override bool HasQuantity()
10951 {
10952 return !(GetQuantityMax() - GetQuantityMin() == 0);
10953 }
10954
10955 override float GetQuantity()
10956 {
10957 return m_VarQuantity;
10958 }
10959
10960 bool IsFullQuantity()
10961 {
10962 return GetQuantity() >= GetQuantityMax();
10963 }
10964
10965 //Calculates weight of single item without attachments and cargo
10966 override float GetSingleInventoryItemWeightEx()
10967 {
10968 //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
10969 float weightEx = GetWeightEx();//overall weight of the item
10970 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
10971 return weightEx - special;
10972 }
10973
10974 // Obsolete, use GetSingleInventoryItemWeightEx() instead
10976 {
10978 }
10979
10980 override protected float GetWeightSpecialized(bool forceRecalc = false)
10981 {
10982 if (IsSplitable()) //quantity determines size of the stack
10983 {
10984 #ifdef DEVELOPER
10985 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10986 {
10987 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10988 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
10989 }
10990 #endif
10991
10992 return GetQuantity() * GetConfigWeightModified();
10993 }
10994 else if (HasEnergyManager())// items with energy manager
10995 {
10996 #ifdef DEVELOPER
10997 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10998 {
10999 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11000 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
11001 }
11002 #endif
11003 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11004 }
11005 else//everything else
11006 {
11007 #ifdef DEVELOPER
11008 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11009 {
11010 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11011 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
11012 }
11013 #endif
11014 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11015 }
11016 }
11017
11019 int GetNumberOfItems()
11020 {
11021 int item_count = 0;
11022 ItemBase item;
11023
11024 if (GetInventory().GetCargo() != NULL)
11025 {
11026 item_count = GetInventory().GetCargo().GetItemCount();
11027 }
11028
11029 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
11030 {
11031 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
11032 if (item)
11033 item_count += item.GetNumberOfItems();
11034 }
11035 return item_count;
11036 }
11037
11039 float GetUnitWeight(bool include_wetness = true)
11040 {
11041 float weight = 0;
11042 float wetness = 1;
11043 if (include_wetness)
11044 wetness += GetWet();
11045 if (IsSplitable()) //quantity determines size of the stack
11046 {
11047 weight = wetness * m_ConfigWeight;
11048 }
11049 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
11050 {
11051 weight = 1;
11052 }
11053 return weight;
11054 }
11055
11056 //-----------------------------------------------------------------
11057
11058 override void ClearInventory()
11059 {
11060 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
11061 {
11062 GameInventory inv = GetInventory();
11063 array<EntityAI> items = new array<EntityAI>;
11064 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
11065 for (int i = 0; i < items.Count(); i++)
11066 {
11067 ItemBase item = ItemBase.Cast(items.Get(i));
11068 if (item)
11069 {
11070 GetGame().ObjectDelete(item);
11071 }
11072 }
11073 }
11074 }
11075
11076 //------------------------- Energy
11077
11078 //----------------------------------------------------------------
11079 float GetEnergy()
11080 {
11081 float energy = 0;
11082 if (HasEnergyManager())
11083 {
11084 energy = GetCompEM().GetEnergy();
11085 }
11086 return energy;
11087 }
11088
11089
11090 override void OnEnergyConsumed()
11091 {
11092 super.OnEnergyConsumed();
11093
11095 }
11096
11097 override void OnEnergyAdded()
11098 {
11099 super.OnEnergyAdded();
11100
11102 }
11103
11104 // Converts energy (from Energy Manager) to quantity, if enabled.
11106 {
11107 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11108 {
11109 if (HasQuantity())
11110 {
11111 float energy_0to1 = GetCompEM().GetEnergy0To1();
11112 SetQuantityNormalized(energy_0to1);
11113 }
11114 }
11115 }
11116
11117 //----------------------------------------------------------------
11118 float GetHeatIsolationInit()
11119 {
11120 return ConfigGetFloat("heatIsolation");
11121 }
11122
11123 float GetHeatIsolation()
11124 {
11125 return m_HeatIsolation;
11126 }
11127
11128 float GetDryingIncrement(string pIncrementName)
11129 {
11130 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
11131 if (GetGame().ConfigIsExisting(paramPath))
11132 return GetGame().ConfigGetFloat(paramPath);
11133
11134 return 0.0;
11135 }
11136
11137 float GetSoakingIncrement(string pIncrementName)
11138 {
11139 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
11140 if (GetGame().ConfigIsExisting(paramPath))
11141 return GetGame().ConfigGetFloat(paramPath);
11142
11143 return 0.0;
11144 }
11145 //----------------------------------------------------------------
11146 override void SetWet(float value, bool allow_client = false)
11147 {
11148 if (!IsServerCheck(allow_client))
11149 return;
11150
11151 float min = GetWetMin();
11152 float max = GetWetMax();
11153
11154 float previousValue = m_VarWet;
11155
11156 m_VarWet = Math.Clamp(value, min, max);
11157
11158 if (previousValue != m_VarWet)
11159 {
11160 SetVariableMask(VARIABLE_WET);
11161 OnWetChanged(m_VarWet, previousValue);
11162 }
11163 }
11164 //----------------------------------------------------------------
11165 override void AddWet(float value)
11166 {
11167 SetWet(GetWet() + value);
11168 }
11169 //----------------------------------------------------------------
11170 override void SetWetMax()
11171 {
11173 }
11174 //----------------------------------------------------------------
11175 override float GetWet()
11176 {
11177 return m_VarWet;
11178 }
11179 //----------------------------------------------------------------
11180 override float GetWetMax()
11181 {
11182 return m_VarWetMax;
11183 }
11184 //----------------------------------------------------------------
11185 override float GetWetMin()
11186 {
11187 return m_VarWetMin;
11188 }
11189 //----------------------------------------------------------------
11190 override float GetWetInit()
11191 {
11192 return m_VarWetInit;
11193 }
11194 //----------------------------------------------------------------
11195 override void OnWetChanged(float newVal, float oldVal)
11196 {
11197 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
11198 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
11199 if (newLevel != oldLevel)
11200 {
11201 OnWetLevelChanged(newLevel,oldLevel);
11202 }
11203 }
11204
11205 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
11206 {
11207 SetWeightDirty();
11208 }
11209
11210 override EWetnessLevel GetWetLevel()
11211 {
11212 return GetWetLevelInternal(m_VarWet);
11213 }
11214
11215 //----------------------------------------------------------------
11216
11217 override void SetStoreLoad(bool value)
11218 {
11219 m_IsStoreLoad = value;
11220 }
11221
11222 override bool IsStoreLoad()
11223 {
11224 return m_IsStoreLoad;
11225 }
11226
11227 override void SetStoreLoadedQuantity(float value)
11228 {
11229 m_StoreLoadedQuantity = value;
11230 }
11231
11232 override float GetStoreLoadedQuantity()
11233 {
11234 return m_StoreLoadedQuantity;
11235 }
11236
11237 //----------------------------------------------------------------
11238
11239 float GetItemModelLength()
11240 {
11241 if (ConfigIsExisting("itemModelLength"))
11242 {
11243 return ConfigGetFloat("itemModelLength");
11244 }
11245 return 0;
11246 }
11247
11248 float GetItemAttachOffset()
11249 {
11250 if (ConfigIsExisting("itemAttachOffset"))
11251 {
11252 return ConfigGetFloat("itemAttachOffset");
11253 }
11254 return 0;
11255 }
11256
11257 override void SetCleanness(int value, bool allow_client = false)
11258 {
11259 if (!IsServerCheck(allow_client))
11260 return;
11261
11262 int previousValue = m_Cleanness;
11263
11264 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
11265
11266 if (previousValue != m_Cleanness)
11267 SetVariableMask(VARIABLE_CLEANNESS);
11268 }
11269
11270 override int GetCleanness()
11271 {
11272 return m_Cleanness;
11273 }
11274
11276 {
11277 return true;
11278 }
11279
11280 //----------------------------------------------------------------
11281 // ATTACHMENT LOCKING
11282 // Getters relevant to generic ActionLockAttachment
11283 int GetLockType()
11284 {
11285 return m_LockType;
11286 }
11287
11288 string GetLockSoundSet()
11289 {
11290 return m_LockSoundSet;
11291 }
11292
11293 //----------------------------------------------------------------
11294 //------------------------- Color
11295 // sets items color variable given color components
11296 override void SetColor(int r, int g, int b, int a)
11297 {
11302 SetVariableMask(VARIABLE_COLOR);
11303 }
11305 override void GetColor(out int r,out int g,out int b,out int a)
11306 {
11311 }
11312
11313 bool IsColorSet()
11314 {
11315 return IsVariableSet(VARIABLE_COLOR);
11316 }
11317
11319 string GetColorString()
11320 {
11321 int r,g,b,a;
11322 GetColor(r,g,b,a);
11323 r = r/255;
11324 g = g/255;
11325 b = b/255;
11326 a = a/255;
11327 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11328 }
11329 //----------------------------------------------------------------
11330 //------------------------- LiquidType
11331
11332 override void SetLiquidType(int value, bool allow_client = false)
11333 {
11334 if (!IsServerCheck(allow_client))
11335 return;
11336
11337 int old = m_VarLiquidType;
11338 m_VarLiquidType = value;
11339 OnLiquidTypeChanged(old,value);
11340 SetVariableMask(VARIABLE_LIQUIDTYPE);
11341 }
11342
11343 int GetLiquidTypeInit()
11344 {
11345 return ConfigGetInt("varLiquidTypeInit");
11346 }
11347
11348 override int GetLiquidType()
11349 {
11350 return m_VarLiquidType;
11351 }
11352
11353 protected void OnLiquidTypeChanged(int oldType, int newType)
11354 {
11355 if (newType == LIQUID_NONE && GetIsFrozen())
11356 SetFrozen(false);
11357 }
11358
11360 void UpdateQuickbarShortcutVisibility(PlayerBase player)
11361 {
11362 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11363 }
11364
11365 // -------------------------------------------------------------------------
11367 void OnInventoryEnter(Man player)
11368 {
11369 PlayerBase nplayer;
11370 if (PlayerBase.CastTo(nplayer, player))
11371 {
11372 m_CanPlayImpactSound = true;
11373 //nplayer.OnItemInventoryEnter(this);
11374 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11375 }
11376 }
11377
11378 // -------------------------------------------------------------------------
11380 void OnInventoryExit(Man player)
11381 {
11382 PlayerBase nplayer;
11383 if (PlayerBase.CastTo(nplayer,player))
11384 {
11385 //nplayer.OnItemInventoryExit(this);
11386 nplayer.SetEnableQuickBarEntityShortcut(this,false);
11387
11388 }
11389
11390 //if (!GetGame().IsDedicatedServer())
11391 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11392
11393
11394 if (HasEnergyManager())
11395 {
11396 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
11397 }
11398 }
11399
11400 // ADVANCED PLACEMENT EVENTS
11401 override void OnPlacementStarted(Man player)
11402 {
11403 super.OnPlacementStarted(player);
11404
11405 SetTakeable(false);
11406 }
11407
11408 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
11409 {
11410 if (m_AdminLog)
11411 {
11412 m_AdminLog.OnPlacementComplete(player, this);
11413 }
11414
11415 super.OnPlacementComplete(player, position, orientation);
11416 }
11417
11418 //-----------------------------
11419 // AGENT SYSTEM
11420 //-----------------------------
11421 //--------------------------------------------------------------------------
11422 bool ContainsAgent(int agent_id)
11423 {
11424 if (agent_id & m_AttachedAgents)
11425 {
11426 return true;
11427 }
11428 else
11429 {
11430 return false;
11431 }
11432 }
11433
11434 //--------------------------------------------------------------------------
11435 override void RemoveAgent(int agent_id)
11436 {
11437 if (ContainsAgent(agent_id))
11438 {
11439 m_AttachedAgents = ~agent_id & m_AttachedAgents;
11440 }
11441 }
11442
11443 //--------------------------------------------------------------------------
11444 override void RemoveAllAgents()
11445 {
11446 m_AttachedAgents = 0;
11447 }
11448 //--------------------------------------------------------------------------
11449 override void RemoveAllAgentsExcept(int agent_to_keep)
11450 {
11451 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
11452 }
11453 // -------------------------------------------------------------------------
11454 override void InsertAgent(int agent, float count = 1)
11455 {
11456 if (count < 1)
11457 return;
11458 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
11460 }
11461
11463 void TransferAgents(int agents)
11464 {
11466 }
11467
11468 // -------------------------------------------------------------------------
11469 override int GetAgents()
11470 {
11471 return m_AttachedAgents;
11472 }
11473 //----------------------------------------------------------------------
11474
11475 /*int GetContaminationType()
11476 {
11477 int contamination_type;
11478
11479 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
11480 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
11481 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
11482 const int DIRTY_MASK = eAgents.WOUND_AGENT;
11483
11484 Edible_Base edible = Edible_Base.Cast(this);
11485 int agents = GetAgents();
11486 if (edible)
11487 {
11488 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
11489 if (profile)
11490 {
11491 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
11492 }
11493 }
11494 if (agents & CONTAMINATED_MASK)
11495 {
11496 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
11497 }
11498 if (agents & POISONED_MASK)
11499 {
11500 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
11501 }
11502 if (agents & NERVE_GAS_MASK)
11503 {
11504 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
11505 }
11506 if (agents & DIRTY_MASK)
11507 {
11508 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
11509 }
11510
11511 return agents;
11512 }*/
11513
11514 // -------------------------------------------------------------------------
11515 bool LoadAgents(ParamsReadContext ctx, int version)
11516 {
11517 if (!ctx.Read(m_AttachedAgents))
11518 return false;
11519 return true;
11520 }
11521 // -------------------------------------------------------------------------
11523 {
11524
11526 }
11527 // -------------------------------------------------------------------------
11528
11530 override void CheckForRoofLimited(float timeTresholdMS = 3000)
11531 {
11532 super.CheckForRoofLimited(timeTresholdMS);
11533
11534 float time = GetGame().GetTime();
11535 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11536 {
11537 m_PreviousRoofTestTime = time;
11538 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11539 }
11540 }
11541
11542 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
11543 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
11544 {
11545 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
11546 {
11547 return 0;
11548 }
11549
11550 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
11551 {
11552 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
11553 if (filter)
11554 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
11555 else
11556 return 0;//otherwise return 0 when no filter attached
11557 }
11558
11559 string subclassPath, entryName;
11560
11561 switch (type)
11562 {
11563 case DEF_BIOLOGICAL:
11564 entryName = "biological";
11565 break;
11566 case DEF_CHEMICAL:
11567 entryName = "chemical";
11568 break;
11569 default:
11570 entryName = "biological";
11571 break;
11572 }
11573
11574 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
11575
11576 return GetGame().ConfigGetFloat(subclassPath + entryName);
11577 }
11578
11579
11580
11582 override void EEOnCECreate()
11583 {
11584 if (!IsMagazine())
11586
11588 }
11589
11590
11591 //-------------------------
11592 // OPEN/CLOSE USER ACTIONS
11593 //-------------------------
11595 void Open();
11596 void Close();
11597 bool IsOpen()
11598 {
11599 return true;
11600 }
11601
11602 override bool CanDisplayCargo()
11603 {
11604 return IsOpen();
11605 }
11606
11607
11608 // ------------------------------------------------------------
11609 // CONDITIONS
11610 // ------------------------------------------------------------
11611 override bool CanPutInCargo(EntityAI parent)
11612 {
11613 if (parent)
11614 {
11615 if (parent.IsInherited(DayZInfected))
11616 return true;
11617
11618 if (!parent.IsRuined())
11619 return true;
11620 }
11621
11622 return true;
11623 }
11624
11625 override bool CanPutAsAttachment(EntityAI parent)
11626 {
11627 if (!super.CanPutAsAttachment(parent))
11628 {
11629 return false;
11630 }
11631
11632 if (!IsRuined() && !parent.IsRuined())
11633 {
11634 return true;
11635 }
11636
11637 return false;
11638 }
11639
11640 override bool CanReceiveItemIntoCargo(EntityAI item)
11641 {
11642 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
11643 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
11644 // return false;
11645
11646 return super.CanReceiveItemIntoCargo(item);
11647 }
11648
11649 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
11650 {
11651 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
11652 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
11653 // return false;
11654
11655 GameInventory attachmentInv = attachment.GetInventory();
11656 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
11657 {
11658 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11659 return false;
11660 }
11661
11662 InventoryLocation loc = new InventoryLocation();
11663 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11664 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
11665 return false;
11666
11667 return super.CanReceiveAttachment(attachment, slotId);
11668 }
11669
11670 override bool CanReleaseAttachment(EntityAI attachment)
11671 {
11672 if (!super.CanReleaseAttachment(attachment))
11673 return false;
11674
11675 return GetInventory().AreChildrenAccessible();
11676 }
11677
11678 /*override bool CanLoadAttachment(EntityAI attachment)
11679 {
11680 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
11681 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
11682 // return false;
11683
11684 GameInventory attachmentInv = attachment.GetInventory();
11685 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
11686 {
11687 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
11688 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
11689
11690 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11691 return false;
11692 }
11693
11694 return super.CanLoadAttachment(attachment);
11695 }*/
11696
11697 // Plays muzzle flash particle effects
11698 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
11699 {
11700 int id = muzzle_owner.GetMuzzleID();
11701 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
11702
11703 if (WPOF_array)
11704 {
11705 for (int i = 0; i < WPOF_array.Count(); i++)
11706 {
11707 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11708
11709 if (WPOF)
11710 {
11711 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11712 }
11713 }
11714 }
11715 }
11716
11717 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
11718 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
11719 {
11720 int id = muzzle_owner.GetMuzzleID();
11721 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
11722
11723 if (WPOBE_array)
11724 {
11725 for (int i = 0; i < WPOBE_array.Count(); i++)
11726 {
11727 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11728
11729 if (WPOBE)
11730 {
11731 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11732 }
11733 }
11734 }
11735 }
11736
11737 // Plays all weapon overheating particles
11738 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
11739 {
11740 int id = muzzle_owner.GetMuzzleID();
11741 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11742
11743 if (WPOOH_array)
11744 {
11745 for (int i = 0; i < WPOOH_array.Count(); i++)
11746 {
11747 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11748
11749 if (WPOOH)
11750 {
11751 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11752 }
11753 }
11754 }
11755 }
11756
11757 // Updates all weapon overheating particles
11758 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
11759 {
11760 int id = muzzle_owner.GetMuzzleID();
11761 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11762
11763 if (WPOOH_array)
11764 {
11765 for (int i = 0; i < WPOOH_array.Count(); i++)
11766 {
11767 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11768
11769 if (WPOOH)
11770 {
11771 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11772 }
11773 }
11774 }
11775 }
11776
11777 // Stops overheating particles
11778 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
11779 {
11780 int id = muzzle_owner.GetMuzzleID();
11781 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11782
11783 if (WPOOH_array)
11784 {
11785 for (int i = 0; i < WPOOH_array.Count(); i++)
11786 {
11787 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11788
11789 if (WPOOH)
11790 {
11791 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11792 }
11793 }
11794 }
11795 }
11796
11797 //----------------------------------------------------------------
11798 //Item Behaviour - unified approach
11799 override bool IsHeavyBehaviour()
11800 {
11801 if (m_ItemBehaviour == 0)
11802 {
11803 return true;
11804 }
11805
11806 return false;
11807 }
11808
11809 override bool IsOneHandedBehaviour()
11810 {
11811 if (m_ItemBehaviour == 1)
11812 {
11813 return true;
11814 }
11815
11816 return false;
11817 }
11818
11819 override bool IsTwoHandedBehaviour()
11820 {
11821 if (m_ItemBehaviour == 2)
11822 {
11823 return true;
11824 }
11825
11826 return false;
11827 }
11828
11829 bool IsDeployable()
11830 {
11831 return false;
11832 }
11833
11835 float GetDeployTime()
11836 {
11837 return UATimeSpent.DEFAULT_DEPLOY;
11838 }
11839
11840
11841 //----------------------------------------------------------------
11842 // Item Targeting (User Actions)
11843 override void SetTakeable(bool pState)
11844 {
11845 m_IsTakeable = pState;
11846 SetSynchDirty();
11847 }
11848
11849 override bool IsTakeable()
11850 {
11851 return m_IsTakeable;
11852 }
11853
11854 // For cases where we want to show object widget which cant be taken to hands
11856 {
11857 return false;
11858 }
11859
11861 protected void PreLoadSoundAttachmentType()
11862 {
11863 string att_type = "None";
11864
11865 if (ConfigIsExisting("soundAttType"))
11866 {
11867 att_type = ConfigGetString("soundAttType");
11868 }
11869
11870 m_SoundAttType = att_type;
11871 }
11872
11873 override string GetAttachmentSoundType()
11874 {
11875 return m_SoundAttType;
11876 }
11877
11878 //----------------------------------------------------------------
11879 //SOUNDS - ItemSoundHandler
11880 //----------------------------------------------------------------
11881
11882 string GetPlaceSoundset(); // played when deploy starts
11883 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
11884 string GetDeploySoundset(); // played when deploy sucessfully finishes
11885 string GetLoopFoldSoundset(); // played when fold starts and stopped when it finishes
11886 string GetFoldSoundset(); // played when fold sucessfully finishes
11887
11889 {
11890 if (!m_ItemSoundHandler)
11892
11893 return m_ItemSoundHandler;
11894 }
11895
11896 // override to initialize sounds
11897 protected void InitItemSounds()
11898 {
11899 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
11900 return;
11901
11903
11904 if (GetPlaceSoundset() != string.Empty)
11905 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
11906
11907 if (GetDeploySoundset() != string.Empty)
11908 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
11909
11910 SoundParameters params = new SoundParameters();
11911 params.m_Loop = true;
11912 if (GetLoopDeploySoundset() != string.Empty)
11913 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
11914 }
11915
11916 // Start sound using ItemSoundHandler
11917 void StartItemSoundServer(int id)
11918 {
11919 if (!GetGame().IsServer())
11920 return;
11921
11922 m_SoundSyncPlay = id;
11923 SetSynchDirty();
11924
11925 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
11927 }
11928
11929 // Stop sound using ItemSoundHandler
11930 void StopItemSoundServer(int id)
11931 {
11932 if (!GetGame().IsServer())
11933 return;
11934
11935 m_SoundSyncStop = id;
11936 SetSynchDirty();
11937
11938 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
11940 }
11941
11942 protected void ClearStartItemSoundServer()
11943 {
11944 m_SoundSyncPlay = 0;
11945 }
11946
11947 protected void ClearStopItemSoundServer()
11948 {
11949 m_SoundSyncStop = 0;
11950 }
11951
11953 void PlayAttachSound(string slot_type)
11954 {
11955 if (!GetGame().IsDedicatedServer())
11956 {
11957 if (ConfigIsExisting("attachSoundSet"))
11958 {
11959 string cfg_path = "";
11960 string soundset = "";
11961 string type_name = GetType();
11962
11963 TStringArray cfg_soundset_array = new TStringArray;
11964 TStringArray cfg_slot_array = new TStringArray;
11965 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11966 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11967
11968 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11969 {
11970 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11971 {
11972 if (cfg_slot_array[i] == slot_type)
11973 {
11974 soundset = cfg_soundset_array[i];
11975 break;
11976 }
11977 }
11978 }
11979
11980 if (soundset != "")
11981 {
11982 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
11983 sound.SetAutodestroy(true);
11984 }
11985 }
11986 }
11987 }
11988
11989 void PlayDetachSound(string slot_type)
11990 {
11991 //TODO - evaluate if needed and devise universal config structure if so
11992 }
11993
11994 void OnApply(PlayerBase player);
11995
11997 {
11998 return 1.0;
11999 };
12000 //returns applicable selection
12001 array<string> GetHeadHidingSelection()
12002 {
12004 }
12005
12007 {
12009 }
12010
12011 WrittenNoteData GetWrittenNoteData() {};
12012
12014 {
12015 SetDynamicPhysicsLifeTime(0.01);
12016 m_ItemBeingDroppedPhys = false;
12017 }
12018
12020 {
12021 array<string> zone_names = new array<string>;
12022 GetDamageZones(zone_names);
12023 for (int i = 0; i < zone_names.Count(); i++)
12024 {
12025 SetHealthMax(zone_names.Get(i),"Health");
12026 }
12027 SetHealthMax("","Health");
12028 }
12029
12031 void SetZoneDamageCEInit()
12032 {
12033 float global_health = GetHealth01("","Health");
12034 array<string> zones = new array<string>;
12035 GetDamageZones(zones);
12036 //set damage of all zones to match global health level
12037 for (int i = 0; i < zones.Count(); i++)
12038 {
12039 SetHealth01(zones.Get(i),"Health",global_health);
12040 }
12041 }
12042
12044 bool IsCoverFaceForShave(string slot_name)
12045 {
12046 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12047 }
12048
12049 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
12050 {
12051 if (!hasRootAsPlayer)
12052 {
12053 if (refParentIB)
12054 {
12055 // parent is wet
12056 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
12057 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12058 // parent has liquid inside
12059 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
12060 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12061 // drying
12062 else if (m_VarWet > m_VarWetMin)
12063 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
12064 }
12065 else
12066 {
12067 // drying on ground or inside non-itembase (car, ...)
12068 if (m_VarWet > m_VarWetMin)
12069 AddWet(-1 * delta * GetDryingIncrement("ground"));
12070 }
12071 }
12072 }
12073
12074 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
12075 {
12077 {
12078 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
12079 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
12080 {
12081 float heatPermCoef = 1.0;
12082 EntityAI ent = this;
12083 while (ent)
12084 {
12085 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12086 ent = ent.GetHierarchyParent();
12087 }
12088
12089 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12090 }
12091 }
12092 }
12093
12094 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
12095 {
12096 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
12097 EntityAI parent = GetHierarchyParent();
12098 if (!parent)
12099 {
12100 hasParent = false;
12101 hasRootAsPlayer = false;
12102 }
12103 else
12104 {
12105 hasParent = true;
12106 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12107 refParentIB = ItemBase.Cast(parent);
12108 }
12109 }
12110
12111 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
12112 {
12113 // this is stub, implemented on Edible_Base
12114 }
12115
12116 bool CanDecay()
12117 {
12118 // return true used on selected food clases so they can decay
12119 return false;
12120 }
12121
12122 protected bool CanProcessDecay()
12123 {
12124 // this is stub, implemented on Edible_Base class
12125 // used to determine whether it is still necessary for the food to decay
12126 return false;
12127 }
12128
12129 protected bool CanHaveWetness()
12130 {
12131 // return true used on selected items that have a wetness effect
12132 return false;
12133 }
12134
12136 bool CanBeConsumed(ConsumeConditionData data = null)
12137 {
12138 return !GetIsFrozen() && IsOpen();
12139 }
12140
12141 override void ProcessVariables()
12142 {
12143 bool hasParent = false, hasRootAsPlayer = false;
12144 ItemBase refParentIB;
12145
12146 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
12147 bool foodDecay = g_Game.IsFoodDecayEnabled();
12148
12149 if (wwtu || foodDecay)
12150 {
12151 bool processWetness = wwtu && CanHaveWetness();
12152 bool processTemperature = wwtu && CanHaveTemperature();
12153 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
12154
12155 if (processWetness || processTemperature || processDecay)
12156 {
12157 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
12158
12159 if (processWetness)
12160 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12161
12162 if (processTemperature)
12163 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12164
12165 if (processDecay)
12166 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12167 }
12168 }
12169 }
12170
12173 {
12174 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
12175 }
12176
12177 override float GetTemperatureFreezeThreshold()
12178 {
12180 return Liquid.GetFreezeThreshold(GetLiquidType());
12181
12182 return super.GetTemperatureFreezeThreshold();
12183 }
12184
12185 override float GetTemperatureThawThreshold()
12186 {
12188 return Liquid.GetThawThreshold(GetLiquidType());
12189
12190 return super.GetTemperatureThawThreshold();
12191 }
12192
12193 override float GetItemOverheatThreshold()
12194 {
12196 return Liquid.GetBoilThreshold(GetLiquidType());
12197
12198 return super.GetItemOverheatThreshold();
12199 }
12200
12201 override float GetTemperatureFreezeTime()
12202 {
12203 if (HasQuantity())
12204 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
12205
12206 return super.GetTemperatureFreezeTime();
12207 }
12208
12209 override float GetTemperatureThawTime()
12210 {
12211 if (HasQuantity())
12212 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
12213
12214 return super.GetTemperatureThawTime();
12215 }
12216
12218 void AffectLiquidContainerOnFill(int liquid_type, float amount);
12220 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
12221
12222 bool IsCargoException4x3(EntityAI item)
12223 {
12224 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12225 }
12226
12228 {
12229 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12230 }
12231
12233 void AddLightSourceItem(ItemBase lightsource)
12234 {
12235 m_LightSourceItem = lightsource;
12236 }
12237
12239 {
12240 m_LightSourceItem = null;
12241 }
12242
12244 {
12245 return m_LightSourceItem;
12246 }
12247
12249 array<int> GetValidFinishers()
12250 {
12251 return null;
12252 }
12253
12255 bool GetActionWidgetOverride(out typename name)
12256 {
12257 return false;
12258 }
12259
12260 bool PairWithDevice(notnull ItemBase otherDevice)
12261 {
12262 if (GetGame().IsServer())
12263 {
12264 ItemBase explosive = otherDevice;
12266 if (!trg)
12267 {
12268 trg = RemoteDetonatorTrigger.Cast(otherDevice);
12269 explosive = this;
12270 }
12271
12272 explosive.PairRemote(trg);
12273 trg.SetControlledDevice(explosive);
12274
12275 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12276 trg.SetPersistentPairID(persistentID);
12277 explosive.SetPersistentPairID(persistentID);
12278
12279 return true;
12280 }
12281 return false;
12282 }
12283
12285 float GetBaitEffectivity()
12286 {
12287 float ret = 1.0;
12288 if (HasQuantity())
12289 ret *= GetQuantityNormalized();
12290 ret *= GetHealth01();
12291
12292 return ret;
12293 }
12294
12295 #ifdef DEVELOPER
12296 override void SetDebugItem()
12297 {
12298 super.SetDebugItem();
12299 _itemBase = this;
12300 }
12301
12302 override string GetDebugText()
12303 {
12304 string text = super.GetDebugText();
12305
12306 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
12307 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
12308
12309 return text;
12310 }
12311 #endif
12312
12313 bool CanBeUsedForSuicide()
12314 {
12315 return true;
12316 }
12317
12319 //DEPRECATED BELOW
12321 // Backwards compatibility
12322 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
12323 {
12324 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
12325 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
12326 }
12327
12328 // replaced by ItemSoundHandler
12329 protected EffectSound m_SoundDeployFinish;
12330 protected EffectSound m_SoundPlace;
12331 protected EffectSound m_DeployLoopSoundEx;
12332 protected EffectSound m_SoundDeploy;
12333 bool m_IsPlaceSound;
12334 bool m_IsDeploySound;
12336
12337 string GetDeployFinishSoundset();
12338 void PlayDeploySound();
12339 void PlayDeployFinishSound();
12340 void PlayPlaceSound();
12341 void PlayDeployLoopSoundEx();
12342 void StopDeployLoopSoundEx();
12343 void SoundSynchRemoteReset();
12344 void SoundSynchRemote();
12345 bool UsesGlobalDeploy(){return false;}
12346 bool CanPlayDeployLoopSound(){return false;}
12348 bool IsPlaceSound(){return m_IsPlaceSound;}
12349 bool IsDeploySound(){return m_IsDeploySound;}
12350 void SetIsPlaceSound(bool is_place_sound);
12351 void SetIsDeploySound(bool is_deploy_sound);
12352}
12353
12354EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
12355{
12356 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
12357 if (entity)
12358 {
12359 bool is_item = entity.IsInherited(ItemBase);
12360 if (is_item && full_quantity)
12361 {
12362 ItemBase item = ItemBase.Cast(entity);
12363 item.SetQuantity(item.GetQuantityInit());
12364 }
12365 }
12366 else
12367 {
12368 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
12369 return NULL;
12370 }
12371 return entity;
12372}
12373
12374void SetupSpawnedItem(ItemBase item, float health, float quantity)
12375{
12376 if (item)
12377 {
12378 if (health > 0)
12379 item.SetHealth("", "", health);
12380
12381 if (item.CanHaveTemperature())
12382 {
12383 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
12384 if (item.CanFreeze())
12385 item.SetFrozen(false);
12386 }
12387
12388 if (item.HasEnergyManager())
12389 {
12390 if (quantity >= 0)
12391 {
12392 item.GetCompEM().SetEnergy0To1(quantity);
12393 }
12394 else
12395 {
12396 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
12397 }
12398 }
12399 else if (item.IsMagazine())
12400 {
12401 Magazine mag = Magazine.Cast(item);
12402 if (quantity >= 0)
12403 {
12404 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12405 }
12406 else
12407 {
12408 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
12409 }
12410
12411 }
12412 else
12413 {
12414 if (quantity >= 0)
12415 {
12416 item.SetQuantityNormalized(quantity, false);
12417 }
12418 else
12419 {
12420 item.SetQuantity(Math.AbsFloat(quantity));
12421 }
12422
12423 }
12424 }
12425}
12426
12427#ifdef DEVELOPER
12428ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
12429#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Определения 3_Game/Entities/EntityAI.c:97
Param3 TSelectableActionInfo
EWetnessLevel
Определения 3_Game/Entities/EntityAI.c:2
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
const int INPUT_UDT_ITEM_MANIPULATION
class LogManager EntityAI
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
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
int GetLiquidType()
Определения CCTWaterSurface.c:129
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
Open
Implementations only.
override void EEOnCECreate()
Определения ContaminatedArea_Dynamic.c:42
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
float GetTemperature()
Определения Environment.c:497
override bool IsExplosive()
Определения ExplosivesBase.c:59
override bool CanHaveTemperature()
Определения FireplaceBase.c:559
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:6380
static bool HasDebugActionsMask(int mask)
Определения ItemBase.c:5620
bool HidesSelectionBySlot()
Определения ItemBase.c:9347
float m_VarWetMin
Определения ItemBase.c:4881
void SplitItem(PlayerBase player)
Определения ItemBase.c:6831
void CopyScriptPropertiesFrom(EntityAI oldItem)
Определения ItemBase.c:9568
override void InsertAgent(int agent, float count=1)
Определения ItemBase.c:8795
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:8229
static void SetDebugActionsMask(int mask)
Определения ItemBase.c:5625
void SetIsDeploySound(bool is_deploy_sound)
bool IsOpen()
Определения ItemBase.c:8938
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6798
override bool IsHeavyBehaviour()
Определения ItemBase.c:9140
override void SetWetMax()
Определения ItemBase.c:8511
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
Определения ItemBase.c:9385
void ClearStartItemSoundServer()
Определения ItemBase.c:9283
float m_VarWet
Определения ItemBase.c:4878
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9415
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
Определения ItemBase.c:2
override void RemoveAllAgentsExcept(int agent_to_keep)
Определения ItemBase.c:8790
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
Определения ItemBase.c:4941
bool CanBeMovedOverride()
Определения ItemBase.c:7522
override void SetWet(float value, bool allow_client=false)
Определения ItemBase.c:8487
ref TIntArray m_SingleUseActions
Определения ItemBase.c:4927
override void ProcessVariables()
Определения ItemBase.c:9482
ref TStringArray m_HeadHidingSelections
Определения ItemBase.c:4955
float GetWeightSpecialized(bool forceRecalc=false)
Определения ItemBase.c:8321
bool LoadAgents(ParamsReadContext ctx, int version)
Определения ItemBase.c:8856
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
Определения ItemBase.c:8701
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
Определения ItemBase.c:5211
ref array< ref OverheatingParticle > m_OverheatingParticles
Определения ItemBase.c:4953
override float GetTemperatureFreezeThreshold()
Определения ItemBase.c:9518
bool m_IsSoundSynchRemote
Определения ItemBase.c:9676
float m_OverheatingShots
Определения ItemBase.c:4948
void StopItemSoundServer(int id)
Определения ItemBase.c:9271
static void ToggleDebugActionsMask(int mask)
Определения ItemBase.c:5640
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:5364
override float GetTemperatureFreezeTime()
Определения ItemBase.c:9542
ref array< int > m_CompatibleLocks
Определения ItemBase.c:4965
bool CanBeCooked()
Определения ItemBase.c:7478
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:5707
float m_TemperaturePerQuantityWeight
Определения ItemBase.c:4977
bool m_RecipesInitialized
Определения ItemBase.c:4863
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
Определения ItemBase.c:6471
override float GetTemperatureThawThreshold()
Определения ItemBase.c:9526
override void OnEnergyConsumed()
Определения ItemBase.c:8431
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:8360
override EWetnessLevel GetWetLevel()
Определения ItemBase.c:8551
float GetSingleInventoryItemWeight()
Определения ItemBase.c:8316
ref TIntArray m_InteractActions
Определения ItemBase.c:4929
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
Определения ItemBase.c:7542
float m_VarQuantity
Определения ItemBase.c:4869
bool CanPlayDeployLoopSound()
Определения ItemBase.c:9687
override float GetWetMax()
Определения ItemBase.c:8521
bool CanBeUsedForSuicide()
Определения ItemBase.c:9654
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:7117
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
Определения ItemBase.c:5845
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
Определения ItemBase.c:7696
void StartItemSoundServer(int id)
Определения ItemBase.c:9258
void DoAmmoExplosion()
Определения ItemBase.c:6315
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
Определения ItemBase.c:4940
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6655
int GetItemSize()
Определения ItemBase.c:7507
bool m_CanBeMovedOverride
Определения ItemBase.c:4906
override string ChangeIntoOnAttach(string slot)
Определения ItemBase.c:6239
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5432
bool CanDecay()
Определения ItemBase.c:9457
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:8202
void SetQuantityMax()
Определения ItemBase.c:8207
override float GetQuantity()
Определения ItemBase.c:8296
int m_ColorComponentR
Определения ItemBase.c:4918
int m_ShotsToStartOverheating
Определения ItemBase.c:4950
override void OnWetChanged(float newVal, float oldVal)
Определения ItemBase.c:8536
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5439
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9039
void OnOverheatingDecay()
Определения ItemBase.c:5402
float GetDryingIncrement(string pIncrementName)
Определения ItemBase.c:8469
void SoundSynchRemoteReset()
int m_Cleanness
Определения ItemBase.c:4884
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
Определения ItemBase.c:5540
bool UsesGlobalDeploy()
Определения ItemBase.c:9686
int m_ItemBehaviour
Определения ItemBase.c:4899
override bool CanReleaseAttachment(EntityAI attachment)
Определения ItemBase.c:9011
float m_HeatIsolation
Определения ItemBase.c:4894
float m_VarWetInit
Определения ItemBase.c:4880
override void OnMovedInsideCargo(EntityAI container)
Определения ItemBase.c:5885
void SetCEBasedQuantity()
Определения ItemBase.c:5653
bool m_CanPlayImpactSound
Определения ItemBase.c:4890
override string GetAttachmentSoundType()
Определения ItemBase.c:9214
float GetOverheatingCoef()
Определения ItemBase.c:5459
array< string > GetHeadHidingSelection()
Определения ItemBase.c:9342
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
Определения ItemBase.c:9294
override bool IsStoreLoad()
Определения ItemBase.c:8563
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7093
bool IsLightSource()
Определения ItemBase.c:5781
bool m_HasQuantityBar
Определения ItemBase.c:4912
void SetResultOfSplit(bool value)
Определения ItemBase.c:7088
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6719
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6889
void UpdateAllOverheatingParticles()
Определения ItemBase.c:5467
float GetSoakingIncrement(string pIncrementName)
Определения ItemBase.c:8478
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9119
override float GetStoreLoadedQuantity()
Определения ItemBase.c:8573
int m_LockType
Определения ItemBase.c:4966
const int ITEM_SOUNDS_MAX
Определения ItemBase.c:4971
bool m_CanBeDigged
Определения ItemBase.c:4913
float m_ItemAttachOffset
Определения ItemBase.c:4896
float GetItemModelLength()
Определения ItemBase.c:8580
bool m_ThrowItemOnDrop
Определения ItemBase.c:4904
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
Определения ItemBase.c:7841
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
Определения ItemBase.c:8871
void Close()
float GetHeatIsolation()
Определения ItemBase.c:8464
void CombineItems(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7122
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
Определения ItemBase.c:9513
bool CanHaveWetness()
Определения ItemBase.c:9470
int m_CleannessMin
Определения ItemBase.c:4886
void TransferAgents(int agents)
transfer agents from another item
Определения ItemBase.c:8804
string IDToName(int id)
Определения ItemBase.c:7689
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
Определения ItemBase.c:9477
float GetHeatIsolationInit()
Определения ItemBase.c:8459
void PlayPlaceSound()
void SetCanBeMovedOverride(bool setting)
Определения ItemBase.c:7529
override bool HasQuantity()
Определения ItemBase.c:8291
float m_VarWetPrev
Определения ItemBase.c:4879
int m_SoundSyncStop
Определения ItemBase.c:4973
bool IsCargoException4x3(EntityAI item)
Определения ItemBase.c:9563
ref TIntArray m_ContinuousActions
Определения ItemBase.c:4928
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
Определения ItemBase.c:5549
void LoadParticleConfigOnFire(int id)
Определения ItemBase.c:5234
int m_VarLiquidType
Определения ItemBase.c:4898
int m_QuickBarBonus
Определения ItemBase.c:4900
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
Определения ItemBase.c:9202
override float GetWetInit()
Определения ItemBase.c:8531
int m_ImpactSoundSurfaceHash
Определения ItemBase.c:4892
int m_SoundSyncPlay
Определения ItemBase.c:4972
int m_MaxOverheatingValue
Определения ItemBase.c:4951
void SetupSpawnedItem(ItemBase item, float health, float quantity)
Определения ItemBase.c:4875
bool m_IsTakeable
Определения ItemBase.c:4903
bool ShouldSplitQuantity(float quantity)
Определения ItemBase.c:6428
static ref map< string, int > m_WeaponTypeToID
Определения ItemBase.c:4943
string GetLockSoundSet()
Определения ItemBase.c:8629
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
Определения ItemBase.c:8660
array< int > GetValidFinishers()
returns an array of possible finishers
Определения ItemBase.c:9590
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6895
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
Определения ItemBase.c:4855
ItemSoundHandler GetItemSoundHandler()
Определения ItemBase.c:9229
override int GetQuantityMin()
Определения ItemBase.c:8280
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
Определения ItemBase.c:6634
override int GetQuickBarBonus()
Определения ItemBase.c:5119
override void SetTakeable(bool pState)
Определения ItemBase.c:9184
float m_OverheatingDecayInterval
Определения ItemBase.c:4952
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6448
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
Определения ItemBase.c:9435
bool CanProcessDecay()
Определения ItemBase.c:9463
void RemoveAudioVisualsOnClient()
Определения Bottle_Base.c:151
void SoundSynchRemote()
static void AddDebugActionsMask(int mask)
Определения ItemBase.c:5630
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
Определения ItemBase.c:9579
bool CanRepair(ItemBase item_repair_kit)
Определения ItemBase.c:7493
bool can_this_be_combined
Определения ItemBase.c:4908
EffectSound m_SoundDeploy
Определения ItemBase.c:9673
int m_Count
Определения ItemBase.c:4874
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
Определения ItemBase.c:9626
float GetDeployTime()
how long it takes to deploy this item in seconds
Определения ItemBase.c:9176
override bool IsSplitable()
Определения ItemBase.c:6415
bool DamageItemAttachments(float damage)
Определения ItemBase.c:6399
override void WriteVarsToCTX(ParamsWriteContext ctx)
Определения ItemBase.c:7805
void ConvertEnergyToQuantity()
Определения ItemBase.c:8446
override void RemoveAllAgents()
Определения ItemBase.c:8785
override void SetQuantityToMinimum()
Определения ItemBase.c:8213
bool m_WantPlayImpactSound
Определения ItemBase.c:4889
override float GetTemperatureThawTime()
Определения ItemBase.c:9550
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
Определения ItemBase.c:4942
int m_ColorComponentG
Определения ItemBase.c:4919
float m_StoreLoadedQuantity
Определения ItemBase.c:4876
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
Определения ItemBase.c:7560
int m_ColorComponentA
Определения ItemBase.c:4921
int m_VarQuantityInit
Определения ItemBase.c:4871
float GetFilterDamageRatio()
Определения ItemBase.c:5534
override void SetLiquidType(int value, bool allow_client=false)
Определения ItemBase.c:8673
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
Определения ItemBase.c:6865
void OnApply(PlayerBase player)
override 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:8220
bool m_HideSelectionsBySlot
Определения ItemBase.c:4956
bool IsOverheatingEffectActive()
Определения ItemBase.c:5397
void SetIsBeingPlaced(bool is_being_placed)
Определения ItemBase.c:5814
int GetLiquidContainerMask()
Определения ItemBase.c:5751
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
Определения ItemBase.c:7002
ref Timer m_CheckOverheating
Определения ItemBase.c:4949
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:5445
float GetEnergy()
Определения ItemBase.c:8420
bool CanBeDigged()
Определения ItemBase.c:5830
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
Определения ItemBase.c:9596
bool IsNVG()
Определения ItemBase.c:5762
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
Определения ItemBase.c:8380
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
Определения ItemBase.c:9372
bool m_IsDeploySound
Определения ItemBase.c:9675
bool CanEat()
Определения ItemBase.c:7453
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9079
override bool IsOneHandedBehaviour()
Определения ItemBase.c:9150
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
Определения ItemBase.c:9574
bool IsLiquidContainer()
Определения ItemBase.c:5746
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
Определения ItemBase.c:7473
override float GetSingleInventoryItemWeightEx()
Определения ItemBase.c:8307
void SaveAgents(ParamsWriteContext ctx)
Определения ItemBase.c:8863
override int GetTargetQuantityMax(int attSlotID=-1)
Определения ItemBase.c:8261
int m_CleannessInit
Определения ItemBase.c:4885
float GetDisinfectQuantity(int system=0, Param param1=null)
Определения ItemBase.c:5529
override int GetAgents()
Определения ItemBase.c:8810
int m_VarQuantityMax
Определения ItemBase.c:4873
override bool IsHologram()
Определения ItemBase.c:5825
float GetItemAttachOffset()
Определения ItemBase.c:8589
bool IsPlaceSound()
Определения ItemBase.c:9689
static int GetDebugActionsMask()
Определения ItemBase.c:5615
void ProcessDecay(float delta, bool hasRootAsPlayer)
Определения ItemBase.c:9452
override bool IsItemBase()
Определения ItemBase.c:7606
void PlayDeploySound()
override bool IsTwoHandedBehaviour()
Определения ItemBase.c:9160
void ExplodeAmmo()
Определения ItemBase.c:6302
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
Определения ItemBase.c:7078
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
Определения ItemBase.c:8884
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9059
override void OnEnergyAdded()
Определения ItemBase.c:8438
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:5774
EffectSound m_DeployLoopSoundEx
Определения ItemBase.c:9672
override void DeSerializeNumericalVars(array< float > floats)
Определения ItemBase.c:7746
void StopItemDynamicPhysics()
Определения ItemBase.c:9354
bool HasFoodStage()
Определения ItemBase.c:7466
override void SetStoreLoad(bool value)
Определения ItemBase.c:8558
float GetOverheatingValue()
Определения ItemBase.c:5359
bool ContainsAgent(int agent_id)
Определения ItemBase.c:8763
override void AddWet(float value)
Определения ItemBase.c:8506
bool IsLiquidPresent()
Определения ItemBase.c:5741
bool IsFullQuantity()
Определения ItemBase.c:8301
override void EOnContact(IEntity other, Contact extra)
Определения ItemBase.c:6015
void SplitIntoStackMaxHands(PlayerBase player)
Определения ItemBase.c:6770
void SplitIntoStackMaxHandsClient(PlayerBase player)
Определения ItemBase.c:6746
int m_CleannessMax
Определения ItemBase.c:4887
float m_VarStackMax
Определения ItemBase.c:4875
ref Timer m_PhysDropTimer
Определения ItemBase.c:4962
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
Определения ItemBase.c:7578
override void SetStoreLoadedQuantity(float value)
Определения ItemBase.c:8568
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
Определения ItemBase.c:4916
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5380
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
Определения ItemBase.c:5695
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
Определения ItemBase.c:7500
void OnLiquidTypeChanged(int oldType, int newType)
Определения ItemBase.c:8694
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5426
void PlayDeployFinishSound()
bool AllowFoodConsumption()
Определения ItemBase.c:8616
bool m_IsOverheatingEffectActive
Определения ItemBase.c:4947
int m_LiquidContainerMask
Определения ItemBase.c:4897
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9390
override int GetCleanness()
Определения ItemBase.c:8611
bool PairWithDevice(notnull ItemBase otherDevice)
Определения ItemBase.c:9601
bool IsDeploySound()
Определения ItemBase.c:9690
static void RemoveDebugActionsMask(int mask)
Определения ItemBase.c:5635
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9099
int m_VarQuantityMin
Определения ItemBase.c:4872
void PerformDamageSystemReinit()
Определения ItemBase.c:9360
override void ClearInventory()
Определения ItemBase.c:8399
static int m_LastRegisteredWeaponID
Определения ItemBase.c:4944
ItemBase GetLightSourceItem()
Определения ItemBase.c:9584
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
Определения ItemBase.c:7596
override float GetItemOverheatThreshold()
Определения ItemBase.c:9534
void StopDeployLoopSoundEx()
bool m_CanThisBeSplit
Определения ItemBase.c:4909
override void SerializeNumericalVars(array< float > floats_out)
Определения ItemBase.c:7710
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
Определения ItemBase.c:6685
float m_ItemModelLength
Определения ItemBase.c:4895
bool m_IsHologram
Определения ItemBase.c:4902
static int m_DebugActionsMask
Определения ItemBase.c:4862
void KillAllOverheatingParticles()
Определения ItemBase.c:5495
bool CanBeCookedOnStick()
Определения ItemBase.c:7483
override int GetQuantityMax()
Определения ItemBase.c:8248
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
Определения ItemBase.c:7156
void OnActivatedByTripWire()
bool IsColorSet()
Определения ItemBase.c:8654
override void RemoveAgent(int agent_id)
Определения ItemBase.c:8776
bool m_ItemBeingDroppedPhys
Определения ItemBase.c:4905
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:8966
void PlayDetachSound(string slot_type)
Определения ItemBase.c:9330
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
Определения ItemBase.c:4856
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9663
override bool IsBeingPlaced()
Определения ItemBase.c:5809
int GetQuantityInit()
Определения ItemBase.c:8285
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7098
bool IsResultOfSplit()
Определения ItemBase.c:7083
bool m_FixDamageSystemInit
Определения ItemBase.c:4907
float m_ImpactSpeed
Определения ItemBase.c:4891
bool m_IsStoreLoad
Определения ItemBase.c:4910
int GetLiquidTypeInit()
Определения ItemBase.c:8684
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
Определения ItemBase.c:4925
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
Определения ItemBase.c:5682
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6557
int m_AttachedAgents
Определения ItemBase.c:4933
string m_LockSoundSet
Определения ItemBase.c:4968
void LoadParticleConfigOnOverheating(int id)
Определения ItemBase.c:5303
float m_VarQuantityPrev
Определения ItemBase.c:4870
bool IsSoundSynchRemote()
Определения ItemBase.c:9688
bool m_CanShowQuantity
Определения ItemBase.c:4911
override void OnRightClick()
Определения ItemBase.c:6938
int m_ColorComponentB
Определения ItemBase.c:4920
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
Определения ItemBase.c:4858
bool IsActionTargetVisible()
Определения ItemBase.c:9196
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения ItemBase.c:6050
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Определения ItemBase.c:6339
bool m_IsBeingPlaced
Определения ItemBase.c:4901
int NameToID(string name)
Определения ItemBase.c:7683
void ~ItemBase()
Определения ItemBase.c:5580
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
Определения ItemBase.c:8546
void ClearStopItemSoundServer()
Определения ItemBase.c:9288
override string ChangeIntoOnDetach()
Определения ItemBase.c:6263
float m_VarWetMax
Определения ItemBase.c:4882
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6680
int GetLockType()
Определения ItemBase.c:8624
EffectSound m_SoundDeployFinish
Определения ItemBase.c:9670
override float GetWet()
Определения ItemBase.c:8516
EffectSound m_SoundPlace
Определения ItemBase.c:9671
float GetQuantityNormalizedScripted()
Определения ItemBase.c:8234
override void SetCleanness(int value, bool allow_client=false)
Определения ItemBase.c:8598
bool m_IsPlaceSound
Определения ItemBase.c:9674
override float GetWetMin()
Определения ItemBase.c:8526
ref ItemSoundHandler m_ItemSoundHandler
Определения ItemBase.c:4974
override bool KindOf(string tag)
Определения ItemBase.c:7612
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:1360
void OnItemLocationChanged(ItemBase item)
Определения ActionBase.c:998
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 void GizmoSelectObject(Object object)
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 native void GizmoSelectPhysics(Physics physics)
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
Определения Global/game.c:1568
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()
Определения 3_Game/Entities/Man.c:44
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
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 string GetFoldSoundset()
Определения BaseBuildingBase.c:108
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:199
override void OnWasDetached(EntityAI parent, int slot_id)
override void EEOnAfterLoad()
Определения GardenBase.c:242
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()
override string GetLoopFoldSoundset()
Определения BaseBuildingBase.c:113
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:1238
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:489
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:496
override void OnStoreSave(ParamsWriteContext ctx)
Определения GardenBase.c:266
override void AfterStoreLoad()
Определения BarbedWire.c:155
override int GetOnDigWormsAmount()
Определения FieldShovel.c:27
override bool IsSelfAdjustingTemperature()
Определения PortableGasStove.c:287
override bool IsPlayerInside(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1037
override void OnVariablesSynchronized()
Определения GardenBase.c:97
override void RefreshPhysics()
Определения BatteryCharger.c:359
override bool CanObstruct()
Определения BaseBuildingBase.c:84
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
Определения BaseBuildingBase.c:982
override bool CanPutInCargo(EntityAI parent)
Определения GardenBase.c:331
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:1008
override bool IsIgnoredByConstruction()
Определения BaseBuildingBase.c:1170
override void InitItemSounds()
Определения BaseBuildingBase.c:94
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:1032
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()
override bool CanBeSplit()
Определения Rag.c:34
override bool IsDeployable()
Определения BaseBuildingBase.c:365
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
Определения 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)
Определения 3_Game/tools/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
Определения 3_Game/constants.c:512
const int DEF_CHEMICAL
Определения 3_Game/constants.c:513
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:709
array< int > TIntArray
Определения EnScript.c:711
EntityEvent
Entity events for event-mask, or throwing event from code.
Определения EnEntity.c:45
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Определения 3_Game/constants.c:808
const int VARIABLE_LIQUIDTYPE
Определения 3_Game/constants.c:632
const int VARIABLE_CLEANNESS
Определения 3_Game/constants.c:635
const int VARIABLE_COLOR
Определения 3_Game/constants.c:634
const int VARIABLE_TEMPERATURE
Определения 3_Game/constants.c:630
const int VARIABLE_QUANTITY
Определения 3_Game/constants.c:628
const int VARIABLE_WET
Определения 3_Game/constants.c:631
const int LIQUID_NONE
Определения 3_Game/constants.c:529
static proto float AbsFloat(float f)
Returns absolute value.
const int MENU_INVENTORY
Определения 3_Game/constants.c:180
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_CRAFTING
Определения 3_Game/constants.c:453
const int SAT_DEBUG_ACTION
Определения 3_Game/constants.c:454
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
Определения 3_Game/tools/tools.c:10
const int CALL_CATEGORY_SYSTEM
Определения 3_Game/tools/tools.c:8
proto native int GetColor()