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

◆ MessageToOwnerAction()

void SpawnItemOnLocation::MessageToOwnerAction ( string text)
private

Send message to owner player in yellow color.

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

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

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