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

◆ IsItemBase()

override bool SpawnItemOnLocation::IsItemBase ( )
private

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

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

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