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

◆ CanBeCookedOnStick()

bool SpawnItemOnLocation::CanBeCookedOnStick ( )
private

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

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