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

◆ Repair()

bool SpawnItemOnLocation::Repair ( PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight )
private

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

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