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

◆ MessageToOwnerStatus()

void SpawnItemOnLocation::MessageToOwnerStatus ( string text)
private

Send message to owner player in grey color.

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

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

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