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

◆ MessageToOwnerFriendly()

void SpawnItemOnLocation::MessageToOwnerFriendly ( string text)
private

Send message to owner player in green color.

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

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

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