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

◆ MessageToOwnerImportant()

void SpawnItemOnLocation::MessageToOwnerImportant ( string text)
private

Send message to owner player in red color.

Возвращает
void
item_stone.MessageToOwnerImportant("Some Important Message");

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

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