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

◆ GetItemOverheatThreshold()

override float SpawnItemOnLocation::GetItemOverheatThreshold ( )
protected

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

9394{
9395 override bool CanPutAsAttachment(EntityAI parent)
9396 {
9397 return true;
9398 }
9399};
9400
9401//const bool QUANTITY_DEBUG_REMOVE_ME = false;
9402
9403class ItemBase extends InventoryItem
9404{
9408
9410
9411 static int m_DebugActionsMask;
9413 // ============================================
9414 // Variable Manipulation System
9415 // ============================================
9416 // Quantity
9417
9418 float m_VarQuantity;
9419 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
9421 int m_VarQuantityMin;
9422 int m_VarQuantityMax;
9423 int m_Count;
9424 float m_VarStackMax;
9425 float m_StoreLoadedQuantity = float.LOWEST;
9426 // Wet
9427 float m_VarWet;
9428 float m_VarWetPrev;//for client to know wetness changed during synchronization
9429 float m_VarWetInit;
9430 float m_VarWetMin;
9431 float m_VarWetMax;
9432 // Cleanness
9433 int m_Cleanness;
9434 int m_CleannessInit;
9435 int m_CleannessMin;
9436 int m_CleannessMax;
9437 // impact sounds
9439 bool m_CanPlayImpactSound = true;
9440 float m_ImpactSpeed;
9442 //
9443 float m_HeatIsolation;
9444 float m_ItemModelLength;
9445 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
9447 int m_VarLiquidType;
9448 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
9449 int m_QuickBarBonus;
9450 bool m_IsBeingPlaced;
9451 bool m_IsHologram;
9452 bool m_IsTakeable;
9453 bool m_ThrowItemOnDrop;
9456 bool m_FixDamageSystemInit = false; //can be changed on storage version check
9457 bool can_this_be_combined; //Check if item can be combined
9458 bool m_CanThisBeSplit; //Check if item can be split
9459 bool m_IsStoreLoad = false;
9460 bool m_CanShowQuantity;
9461 bool m_HasQuantityBar;
9462 protected bool m_CanBeDigged;
9463 protected bool m_IsResultOfSplit
9464
9465 string m_SoundAttType;
9466 // items color variables
9471 //-------------------------------------------------------
9472
9473 // light source managing
9475
9479
9480 //==============================================
9481 // agent system
9482 private int m_AttachedAgents;
9483
9485 void TransferModifiers(PlayerBase reciever);
9486
9487
9488 // Weapons & suppressors particle effects
9493 static int m_LastRegisteredWeaponID = 0;
9494
9495 // Overheating effects
9497 float m_OverheatingShots;
9498 ref Timer m_CheckOverheating;
9499 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
9500 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
9501 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
9502 ref array <ref OverheatingParticle> m_OverheatingParticles;
9503
9505 protected bool m_HideSelectionsBySlot;
9506
9507 // Admin Log
9508 PluginAdminLog m_AdminLog;
9509
9510 // misc
9511 ref Timer m_PhysDropTimer;
9512
9513 // Attachment Locking variables
9514 ref array<int> m_CompatibleLocks;
9515 protected int m_LockType;
9516 protected ref EffectSound m_LockingSound;
9517 protected string m_LockSoundSet;
9518
9519 // ItemSoundHandler
9520 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
9521 protected int m_SoundSyncPlay; // id for sound to play
9522 protected int m_SoundSyncStop; // id for sound to stop
9524
9525 //temperature
9526 private float m_TemperaturePerQuantityWeight;
9527
9528 // -------------------------------------------------------------------------
9529 void ItemBase()
9530 {
9531 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
9535
9536 if (!GetGame().IsDedicatedServer())
9537 {
9538 if (HasMuzzle())
9539 {
9541
9543 {
9545 }
9546 }
9547
9549 m_ActionsInitialize = false;
9550 }
9551
9552 m_OldLocation = null;
9553
9554 if (GetGame().IsServer())
9555 {
9556 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
9557 }
9558
9559 if (ConfigIsExisting("headSelectionsToHide"))
9560 {
9562 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
9563 }
9564
9565 m_HideSelectionsBySlot = false;
9566 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
9567 {
9568 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
9569 }
9570
9571 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
9572
9573 m_IsResultOfSplit = false;
9574
9576 }
9577
9578 override void InitItemVariables()
9579 {
9580 super.InitItemVariables();
9581
9582 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
9583 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
9584 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
9585 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
9586 m_VarStackMax = ConfigGetFloat("varStackMax");
9587 m_Count = ConfigGetInt("count");
9588
9589 m_CanShowQuantity = ConfigGetBool("quantityShow");
9590 m_HasQuantityBar = ConfigGetBool("quantityBar");
9591
9592 m_CleannessInit = ConfigGetInt("varCleannessInit");
9594 m_CleannessMin = ConfigGetInt("varCleannessMin");
9595 m_CleannessMax = ConfigGetInt("varCleannessMax");
9596
9597 m_WantPlayImpactSound = false;
9598 m_ImpactSpeed = 0.0;
9599
9600 m_VarWetInit = ConfigGetFloat("varWetInit");
9602 m_VarWetMin = ConfigGetFloat("varWetMin");
9603 m_VarWetMax = ConfigGetFloat("varWetMax");
9604
9605 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
9606 if (IsLiquidContainer() && GetQuantity() != 0)
9608 m_IsBeingPlaced = false;
9609 m_IsHologram = false;
9610 m_IsTakeable = true;
9611 m_CanBeMovedOverride = false;
9615 m_CanBeDigged = ConfigGetBool("canBeDigged");
9616
9617 m_CompatibleLocks = new array<int>();
9618 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
9619 m_LockType = ConfigGetInt("lockType");
9620
9621 //Define if item can be split and set ability to be combined accordingly
9622 m_CanThisBeSplit = false;
9623 can_this_be_combined = false;
9624 if (ConfigIsExisting("canBeSplit"))
9625 {
9626 can_this_be_combined = ConfigGetBool("canBeSplit");
9628 }
9629
9630 m_ItemBehaviour = -1;
9631 if (ConfigIsExisting("itemBehaviour"))
9632 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
9633
9634 //RegisterNetSyncVariableInt("m_VariablesMask");
9635 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
9636 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
9637 RegisterNetSyncVariableInt("m_VarLiquidType");
9638 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9639
9640 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9641 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9642 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9643
9644 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9645 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9646 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9647 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9648
9649 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9650 RegisterNetSyncVariableBool("m_IsTakeable");
9651 RegisterNetSyncVariableBool("m_IsHologram");
9652
9653 InitItemSounds();
9655 {
9656 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
9657 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
9658 }
9659
9660 m_LockSoundSet = ConfigGetString("lockSoundSet");
9661
9663 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9664 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
9665
9666 }
9667
9668 override int GetQuickBarBonus()
9669 {
9670 return m_QuickBarBonus;
9671 }
9672
9673 void InitializeActions()
9674 {
9676 if (!m_InputActionMap)
9677 {
9679 m_InputActionMap = iam;
9680 SetActions();
9682 }
9683 }
9684
9685 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
9686 {
9688 {
9689 m_ActionsInitialize = true;
9691 }
9692
9693 actions = m_InputActionMap.Get(action_input_type);
9694 }
9695
9696 void SetActions()
9697 {
9698 AddAction(ActionTakeItem);
9699 AddAction(ActionTakeItemToHands);
9700 AddAction(ActionWorldCraft);
9702 AddAction(ActionAttachWithSwitch);
9703 }
9704
9705 void SetActionAnimOverrides(); // Override action animation for specific item
9706
9707 void AddAction(typename actionName)
9708 {
9709 ActionBase action = ActionManagerBase.GetAction(actionName);
9710
9711 if (!action)
9712 {
9713 Debug.LogError("Action " + actionName + " dosn't exist!");
9714 return;
9715 }
9716
9717 typename ai = action.GetInputType();
9718 if (!ai)
9719 {
9720 m_ActionsInitialize = false;
9721 return;
9722 }
9723
9724 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
9725 if (!action_array)
9726 {
9727 action_array = new array<ActionBase_Basic>;
9728 m_InputActionMap.Insert(ai, action_array);
9729 }
9730 if (LogManager.IsActionLogEnable())
9731 {
9732 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
9733 }
9734
9735 if (action_array.Find(action) != -1)
9736 {
9737 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
9738 }
9739 else
9740 {
9741 action_array.Insert(action);
9742 }
9743 }
9744
9745 void RemoveAction(typename actionName)
9746 {
9747 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
9748 ActionBase action = player.GetActionManager().GetAction(actionName);
9749 typename ai = action.GetInputType();
9750 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
9751
9752 if (action_array)
9753 {
9754 action_array.RemoveItem(action);
9755 }
9756 }
9757
9758 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
9759 // Set -1 for params which should stay in default state
9760 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
9761 {
9762 ActionOverrideData overrideData = new ActionOverrideData();
9763 overrideData.m_CommandUID = commandUID;
9764 overrideData.m_CommandUIDProne = commandUIDProne;
9765 overrideData.m_StanceMask = stanceMask;
9766
9767 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
9768 if (!actionMap) // create new map of action > overidables map
9769 {
9770 actionMap = new TActionAnimOverrideMap();
9771 m_ItemActionOverrides.Insert(action, actionMap);
9772 }
9773
9774 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
9775
9776 }
9777
9778 void OnItemInHandsPlayerSwimStart(PlayerBase player);
9779
9780 ScriptedLightBase GetLight();
9781
9782 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
9783 void LoadParticleConfigOnFire(int id)
9784 {
9785 if (!m_OnFireEffect)
9787
9790
9791 string config_to_search = "CfgVehicles";
9792 string muzzle_owner_config;
9793
9794 if (!m_OnFireEffect.Contains(id))
9795 {
9796 if (IsInherited(Weapon))
9797 config_to_search = "CfgWeapons";
9798
9799 muzzle_owner_config = config_to_search + " " + GetType() + " ";
9800
9801 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9802
9803 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
9804
9805 if (config_OnFire_subclass_count > 0)
9806 {
9807 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9808
9809 for (int i = 0; i < config_OnFire_subclass_count; i++)
9810 {
9811 string particle_class = "";
9812 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
9813 string config_OnFire_entry = config_OnFire_class + particle_class;
9814 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9815 WPOF_array.Insert(WPOF);
9816 }
9817
9818
9819 m_OnFireEffect.Insert(id, WPOF_array);
9820 }
9821 }
9822
9823 if (!m_OnBulletCasingEjectEffect.Contains(id))
9824 {
9825 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
9826 muzzle_owner_config = config_to_search + " " + GetType() + " ";
9827
9828 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9829
9830 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9831
9832 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9833 {
9834 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9835
9836 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9837 {
9838 string particle_class2 = "";
9839 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9840 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9841 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9842 WPOBE_array.Insert(WPOBE);
9843 }
9844
9845
9846 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
9847 }
9848 }
9849 }
9850
9851 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
9853 {
9856
9857 if (!m_OnOverheatingEffect.Contains(id))
9858 {
9859 string config_to_search = "CfgVehicles";
9860
9861 if (IsInherited(Weapon))
9862 config_to_search = "CfgWeapons";
9863
9864 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
9865 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9866
9867 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
9868 {
9869
9870 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
9871
9873 {
9874 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
9875 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9876 Error(error);
9877 return;
9878 }
9879
9880 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
9881 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
9882
9883
9884
9885 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
9886 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9887
9888 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9889 {
9890 string particle_class = "";
9891 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9892 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9893 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
9894
9895 if (entry_type == CT_CLASS)
9896 {
9897 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9898 WPOOH_array.Insert(WPOF);
9899 }
9900 }
9901
9902
9903 m_OnOverheatingEffect.Insert(id, WPOOH_array);
9904 }
9905 }
9906 }
9907
9908 float GetOverheatingValue()
9909 {
9910 return m_OverheatingShots;
9911 }
9912
9913 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9914 {
9915 if (m_MaxOverheatingValue > 0)
9916 {
9918
9919 if (!m_CheckOverheating)
9921
9923 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
9924
9925 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9926 }
9927 }
9928
9929 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9930 {
9932 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9933
9935 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9936
9938 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9939
9941 {
9943 }
9944 }
9945
9947 {
9949 }
9950
9951 void OnOverheatingDecay()
9952 {
9953 if (m_MaxOverheatingValue > 0)
9954 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
9955 else
9957
9958 if (m_OverheatingShots <= 0)
9959 {
9962 }
9963 else
9964 {
9965 if (!m_CheckOverheating)
9967
9969 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
9970 }
9971
9972 CheckOverheating(this, "", this);
9973 }
9974
9975 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9976 {
9978 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
9979 }
9980
9981 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9982 {
9984 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
9986 }
9987
9988 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9989 {
9991 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9992 }
9993
9994 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
9995 {
9997 m_OverheatingParticles = new array<ref OverheatingParticle>;
9998
9999 OverheatingParticle OP = new OverheatingParticle();
10000 OP.RegisterParticle(p);
10001 OP.SetOverheatingLimitMin(min_heat_coef);
10002 OP.SetOverheatingLimitMax(max_heat_coef);
10003 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
10004
10005 m_OverheatingParticles.Insert(OP);
10006 }
10007
10008 float GetOverheatingCoef()
10009 {
10010 if (m_MaxOverheatingValue > 0)
10012
10013 return -1;
10014 }
10015
10017 {
10019 {
10020 float overheat_coef = GetOverheatingCoef();
10021 int count = m_OverheatingParticles.Count();
10022
10023 for (int i = count; i > 0; --i)
10024 {
10025 int id = i - 1;
10026 OverheatingParticle OP = m_OverheatingParticles.Get(id);
10027 Particle p = OP.GetParticle();
10028
10029 float overheat_min = OP.GetOverheatingLimitMin();
10030 float overheat_max = OP.GetOverheatingLimitMax();
10031
10032 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
10033 {
10034 if (p)
10035 {
10036 p.Stop();
10037 OP.RegisterParticle(null);
10038 }
10039 }
10040 }
10041 }
10042 }
10043
10045 {
10047 {
10048 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
10049 {
10050 int id = i - 1;
10051 OverheatingParticle OP = m_OverheatingParticles.Get(id);
10052
10053 if (OP)
10054 {
10055 Particle p = OP.GetParticle();
10056
10057 if (p)
10058 {
10059 p.Stop();
10060 }
10061
10062 delete OP;
10063 }
10064 }
10065
10066 m_OverheatingParticles.Clear();
10068 }
10069 }
10070
10072 float GetInfectionChance(int system = 0, Param param = null)
10073 {
10074 return 0.0;
10075 }
10076
10077
10078 float GetDisinfectQuantity(int system = 0, Param param1 = null)
10079 {
10080 return 250;//default value
10081 }
10082
10083 float GetFilterDamageRatio()
10084 {
10085 return 0;
10086 }
10087
10089 bool HasMuzzle()
10090 {
10091 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
10092 return true;
10093
10094 return false;
10095 }
10096
10098 int GetMuzzleID()
10099 {
10100 if (!m_WeaponTypeToID)
10102
10103 if (m_WeaponTypeToID.Contains(GetType()))
10104 {
10105 return m_WeaponTypeToID.Get(GetType());
10106 }
10107 else
10108 {
10109 // Register new weapon ID
10111 }
10112
10114 }
10115
10122 {
10123 return -1;
10124 }
10125
10126
10127
10128 // -------------------------------------------------------------------------
10129 void ~ItemBase()
10130 {
10131 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
10132 {
10133 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
10134 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10135
10136 if (r_index >= 0)
10137 {
10138 InventoryLocation r_il = new InventoryLocation;
10139 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10140
10141 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10142 int r_type = r_il.GetType();
10143 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
10144 {
10145 r_il.GetParent().GetOnReleaseLock().Invoke(this);
10146 }
10147 else if (r_type == InventoryLocationType.ATTACHMENT)
10148 {
10149 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
10150 }
10151
10152 }
10153
10154 player.GetHumanInventory().ClearUserReservedLocation(this);
10155 }
10156
10157 if (m_LockingSound)
10158 SEffectManager.DestroyEffect(m_LockingSound);
10159 }
10160
10161
10162
10163 // -------------------------------------------------------------------------
10164 static int GetDebugActionsMask()
10165 {
10166 return ItemBase.m_DebugActionsMask;
10167 }
10168
10169 static bool HasDebugActionsMask(int mask)
10170 {
10171 return ItemBase.m_DebugActionsMask & mask;
10172 }
10173
10174 static void SetDebugActionsMask(int mask)
10175 {
10176 ItemBase.m_DebugActionsMask = mask;
10177 }
10178
10179 static void AddDebugActionsMask(int mask)
10180 {
10181 ItemBase.m_DebugActionsMask |= mask;
10182 }
10183
10184 static void RemoveDebugActionsMask(int mask)
10185 {
10186 ItemBase.m_DebugActionsMask &= ~mask;
10187 }
10188
10189 static void ToggleDebugActionsMask(int mask)
10190 {
10191 if (HasDebugActionsMask(mask))
10192 {
10194 }
10195 else
10196 {
10197 AddDebugActionsMask(mask);
10198 }
10199 }
10200
10201 // -------------------------------------------------------------------------
10202 void SetCEBasedQuantity()
10203 {
10204 if (GetEconomyProfile())
10205 {
10206 float q_max = GetEconomyProfile().GetQuantityMax();
10207 if (q_max > 0)
10208 {
10209 float q_min = GetEconomyProfile().GetQuantityMin();
10210 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
10211
10212 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
10213 {
10214 ComponentEnergyManager comp = GetCompEM();
10215 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
10216 {
10217 comp.SetEnergy0To1(quantity_randomized);
10218 }
10219 }
10220 else if (HasQuantity())
10221 {
10222 SetQuantityNormalized(quantity_randomized, false);
10223 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
10224 }
10225
10226 }
10227 }
10228 }
10229
10231 void LockToParent()
10232 {
10233 EntityAI parent = GetHierarchyParent();
10234
10235 if (parent)
10236 {
10237 InventoryLocation inventory_location_to_lock = new InventoryLocation;
10238 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
10239 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
10240 }
10241 }
10242
10244 void UnlockFromParent()
10245 {
10246 EntityAI parent = GetHierarchyParent();
10247
10248 if (parent)
10249 {
10250 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
10251 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
10252 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
10253 }
10254 }
10255
10256 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
10257 {
10258 /*
10259 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
10260 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
10261 */
10262 ItemBase item2 = ItemBase.Cast(entity2);
10263
10264 if (GetGame().IsClient())
10265 {
10266 if (ScriptInputUserData.CanStoreInputUserData())
10267 {
10268 ScriptInputUserData ctx = new ScriptInputUserData;
10270 ctx.Write(-1);
10271 ItemBase i1 = this; // @NOTE: workaround for correct serialization
10272 ctx.Write(i1);
10273 ctx.Write(item2);
10274 ctx.Write(use_stack_max);
10275 ctx.Write(-1);
10276 ctx.Send();
10277
10278 if (IsCombineAll(item2, use_stack_max))
10279 {
10280 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
10281 }
10282 }
10283 }
10284 else if (!GetGame().IsMultiplayer())
10285 {
10286 CombineItems(item2, use_stack_max);
10287 }
10288 }
10289
10290 bool IsLiquidPresent()
10291 {
10292 return (GetLiquidType() != 0 && HasQuantity());
10293 }
10294
10295 bool IsLiquidContainer()
10296 {
10297 return m_LiquidContainerMask != 0;
10298 }
10299
10301 {
10302 return m_LiquidContainerMask;
10303 }
10304
10305 bool IsBloodContainer()
10306 {
10307 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
10308 return false;
10309 }
10310
10311 bool IsNVG()
10312 {
10313 return false;
10314 }
10315
10318 bool IsExplosive()
10319 {
10320 return false;
10321 }
10322
10324 {
10325 return "";
10326 }
10327
10329
10330 bool IsLightSource()
10331 {
10332 return false;
10333 }
10334
10336 {
10337 return true;
10338 }
10339
10340 //--- ACTION CONDITIONS
10341 //direction
10342 bool IsFacingPlayer(PlayerBase player, string selection)
10343 {
10344 return true;
10345 }
10346
10347 bool IsPlayerInside(PlayerBase player, string selection)
10348 {
10349 return true;
10350 }
10351
10352 override bool CanObstruct()
10353 {
10354 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
10355 return !player || !IsPlayerInside(player, "");
10356 }
10357
10358 override bool IsBeingPlaced()
10359 {
10360 return m_IsBeingPlaced;
10361 }
10362
10363 void SetIsBeingPlaced(bool is_being_placed)
10364 {
10365 m_IsBeingPlaced = is_being_placed;
10366 if (!is_being_placed)
10368 SetSynchDirty();
10369 }
10370
10371 //server-side
10372 void OnEndPlacement() {}
10373
10374 override bool IsHologram()
10375 {
10376 return m_IsHologram;
10377 }
10378
10379 bool CanBeDigged()
10380 {
10381 return m_CanBeDigged;
10382 }
10383
10385 {
10386 return 1;
10387 }
10388
10389 bool CanMakeGardenplot()
10390 {
10391 return false;
10392 }
10393
10394 void SetIsHologram(bool is_hologram)
10395 {
10396 m_IsHologram = is_hologram;
10397 SetSynchDirty();
10398 }
10399 /*
10400 protected float GetNutritionalEnergy()
10401 {
10402 Edible_Base edible = Edible_Base.Cast(this);
10403 return edible.GetFoodEnergy();
10404 }
10405
10406 protected float GetNutritionalWaterContent()
10407 {
10408 Edible_Base edible = Edible_Base.Cast(this);
10409 return edible.GetFoodWater();
10410 }
10411
10412 protected float GetNutritionalIndex()
10413 {
10414 Edible_Base edible = Edible_Base.Cast(this);
10415 return edible.GetFoodNutritionalIndex();
10416 }
10417
10418 protected float GetNutritionalFullnessIndex()
10419 {
10420 Edible_Base edible = Edible_Base.Cast(this);
10421 return edible.GetFoodTotalVolume();
10422 }
10423
10424 protected float GetNutritionalToxicity()
10425 {
10426 Edible_Base edible = Edible_Base.Cast(this);
10427 return edible.GetFoodToxicity();
10428
10429 }
10430 */
10431
10432
10433 // -------------------------------------------------------------------------
10434 override void OnMovedInsideCargo(EntityAI container)
10435 {
10436 super.OnMovedInsideCargo(container);
10437
10438 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10439 }
10440
10441 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10442 {
10443 super.EEItemLocationChanged(oldLoc,newLoc);
10444
10445 PlayerBase new_player = null;
10446 PlayerBase old_player = null;
10447
10448 if (newLoc.GetParent())
10449 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
10450
10451 if (oldLoc.GetParent())
10452 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
10453
10454 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
10455 {
10456 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
10457
10458 if (r_index >= 0)
10459 {
10460 InventoryLocation r_il = new InventoryLocation;
10461 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10462
10463 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10464 int r_type = r_il.GetType();
10465 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
10466 {
10467 r_il.GetParent().GetOnReleaseLock().Invoke(this);
10468 }
10469 else if (r_type == InventoryLocationType.ATTACHMENT)
10470 {
10471 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
10472 }
10473
10474 }
10475 }
10476
10477 if (newLoc.GetType() == InventoryLocationType.HANDS)
10478 {
10479 if (new_player)
10480 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
10481
10482 if (new_player == old_player)
10483 {
10484
10485 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
10486 {
10487 if (oldLoc.GetType() == InventoryLocationType.CARGO)
10488 {
10489 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
10490 {
10491 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10492 }
10493 }
10494 else
10495 {
10496 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
10497 }
10498 }
10499
10500 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
10501 {
10502 int type = oldLoc.GetType();
10503 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
10504 {
10505 oldLoc.GetParent().GetOnSetLock().Invoke(this);
10506 }
10507 else if (type == InventoryLocationType.ATTACHMENT)
10508 {
10509 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
10510 }
10511 }
10512 if (!m_OldLocation)
10513 {
10514 m_OldLocation = new InventoryLocation;
10515 }
10516 m_OldLocation.Copy(oldLoc);
10517 }
10518 else
10519 {
10520 if (m_OldLocation)
10521 {
10522 m_OldLocation.Reset();
10523 }
10524 }
10525
10527 }
10528 else
10529 {
10530 if (new_player)
10531 {
10532 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
10533 if (res_index >= 0)
10534 {
10535 InventoryLocation il = new InventoryLocation;
10536 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
10537 ItemBase it = ItemBase.Cast(il.GetItem());
10538 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
10539 int rel_type = il.GetType();
10540 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
10541 {
10542 il.GetParent().GetOnReleaseLock().Invoke(it);
10543 }
10544 else if (rel_type == InventoryLocationType.ATTACHMENT)
10545 {
10546 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
10547 }
10548 //it.GetOnReleaseLock().Invoke(it);
10549 }
10550 }
10551 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
10552 {
10553 //ThrowPhysically(old_player, vector.Zero);
10554 m_ThrowItemOnDrop = false;
10555 }
10556
10557 if (m_OldLocation)
10558 {
10559 m_OldLocation.Reset();
10560 }
10561 }
10562 }
10563
10564 override void EOnContact(IEntity other, Contact extra)
10565 {
10567 {
10568 int liquidType = -1;
10569 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
10570 if (impactSpeed > 0.0)
10571 {
10572 m_ImpactSpeed = impactSpeed;
10573 #ifndef SERVER
10574 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
10575 #else
10576 m_WantPlayImpactSound = true;
10577 SetSynchDirty();
10578 #endif
10579 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
10580 }
10581 }
10582
10583 #ifdef SERVER
10584 if (GetCompEM() && GetCompEM().IsPlugged())
10585 {
10586 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
10587 GetCompEM().UnplugThis();
10588 }
10589 #endif
10590 }
10591
10592 void RefreshPhysics();
10593
10594 override void OnCreatePhysics()
10595 {
10597 }
10598
10599 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
10600 {
10601
10602 }
10603 // -------------------------------------------------------------------------
10604 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
10605 {
10606 super.OnItemLocationChanged(old_owner, new_owner);
10607
10608 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
10609 PlayerBase playerNew = PlayerBase.Cast(new_owner);
10610
10611 if (!relatedPlayer && playerNew)
10612 relatedPlayer = playerNew;
10613
10614 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
10615 {
10616 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
10617 if (actionMgr)
10618 {
10619 ActionBase currentAction = actionMgr.GetRunningAction();
10620 if (currentAction)
10621 currentAction.OnItemLocationChanged(this);
10622 }
10623 }
10624
10625 Man ownerPlayerOld = null;
10626 Man ownerPlayerNew = null;
10627
10628 if (old_owner)
10629 {
10630 if (old_owner.IsMan())
10631 {
10632 ownerPlayerOld = Man.Cast(old_owner);
10633 }
10634 else
10635 {
10636 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10637 }
10638 }
10639 else
10640 {
10641 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
10642 {
10643 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
10644
10645 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
10646 {
10647 GetCompEM().UnplugThis();
10648 }
10649 }
10650 }
10651
10652 if (new_owner)
10653 {
10654 if (new_owner.IsMan())
10655 {
10656 ownerPlayerNew = Man.Cast(new_owner);
10657 }
10658 else
10659 {
10660 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10661 }
10662 }
10663
10664 if (ownerPlayerOld != ownerPlayerNew)
10665 {
10666 if (ownerPlayerOld)
10667 {
10668 array<EntityAI> subItemsExit = new array<EntityAI>;
10669 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
10670 for (int i = 0; i < subItemsExit.Count(); i++)
10671 {
10672 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
10673 itemExit.OnInventoryExit(ownerPlayerOld);
10674 }
10675 }
10676
10677 if (ownerPlayerNew)
10678 {
10679 array<EntityAI> subItemsEnter = new array<EntityAI>;
10680 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
10681 for (int j = 0; j < subItemsEnter.Count(); j++)
10682 {
10683 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
10684 itemEnter.OnInventoryEnter(ownerPlayerNew);
10685 }
10686 }
10687 }
10688 else if (ownerPlayerNew != null)
10689 {
10690 PlayerBase nplayer;
10691 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10692 {
10693 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10694 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
10695 for (int k = 0; k < subItemsUpdate.Count(); k++)
10696 {
10697 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
10698 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10699 }
10700 }
10701 }
10702
10703 if (old_owner)
10704 old_owner.OnChildItemRemoved(this);
10705 if (new_owner)
10706 new_owner.OnChildItemReceived(this);
10707 }
10708
10709 // -------------------------------------------------------------------------------
10710 override void EEDelete(EntityAI parent)
10711 {
10712 super.EEDelete(parent);
10713 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10714 if (player)
10715 {
10716 OnInventoryExit(player);
10717
10718 if (player.IsAlive())
10719 {
10720 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10721 if (r_index >= 0)
10722 {
10723 InventoryLocation r_il = new InventoryLocation;
10724 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10725
10726 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10727 int r_type = r_il.GetType();
10728 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
10729 {
10730 r_il.GetParent().GetOnReleaseLock().Invoke(this);
10731 }
10732 else if (r_type == InventoryLocationType.ATTACHMENT)
10733 {
10734 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
10735 }
10736
10737 }
10738
10739 player.RemoveQuickBarEntityShortcut(this);
10740 }
10741 }
10742 }
10743 // -------------------------------------------------------------------------------
10744 override void EEKilled(Object killer)
10745 {
10746 super.EEKilled(killer);
10747
10749 if (killer && killer.IsFireplace() && CanExplodeInFire())
10750 {
10751 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10752 {
10753 if (IsMagazine())
10754 {
10755 if (Magazine.Cast(this).GetAmmoCount() > 0)
10756 {
10757 ExplodeAmmo();
10758 }
10759 }
10760 else
10761 {
10762 Explode(DamageType.EXPLOSION);
10763 }
10764 }
10765 }
10766 }
10767
10768 override void OnWasAttached(EntityAI parent, int slot_id)
10769 {
10770 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10771
10772 super.OnWasAttached(parent, slot_id);
10773
10774 if (HasQuantity())
10775 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
10776
10777 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
10778 }
10779
10780 override void OnWasDetached(EntityAI parent, int slot_id)
10781 {
10782 super.OnWasDetached(parent, slot_id);
10783
10784 if (HasQuantity())
10785 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
10786 }
10787
10788 override string ChangeIntoOnAttach(string slot)
10789 {
10790 int idx;
10791 TStringArray inventory_slots = new TStringArray;
10792 TStringArray attach_types = new TStringArray;
10793
10794 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10795 if (inventory_slots.Count() < 1) //is string
10796 {
10797 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10798 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10799 }
10800 else //is array
10801 {
10802 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10803 }
10804
10805 idx = inventory_slots.Find(slot);
10806 if (idx < 0)
10807 return "";
10808
10809 return attach_types.Get(idx);
10810 }
10811
10812 override string ChangeIntoOnDetach()
10813 {
10814 int idx = -1;
10815 string slot;
10816
10817 TStringArray inventory_slots = new TStringArray;
10818 TStringArray detach_types = new TStringArray;
10819
10820 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10821 if (inventory_slots.Count() < 1) //is string
10822 {
10823 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10824 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10825 }
10826 else //is array
10827 {
10828 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10829 if (detach_types.Count() < 1)
10830 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10831 }
10832
10833 for (int i = 0; i < inventory_slots.Count(); i++)
10834 {
10835 slot = inventory_slots.Get(i);
10836 }
10837
10838 if (slot != "")
10839 {
10840 if (detach_types.Count() == 1)
10841 idx = 0;
10842 else
10843 idx = inventory_slots.Find(slot);
10844 }
10845 if (idx < 0)
10846 return "";
10847
10848 return detach_types.Get(idx);
10849 }
10850
10851 void ExplodeAmmo()
10852 {
10853 //timer
10854 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
10855
10856 //min/max time
10857 float min_time = 1;
10858 float max_time = 3;
10859 float delay = Math.RandomFloat(min_time, max_time);
10860
10861 explode_timer.Run(delay, this, "DoAmmoExplosion");
10862 }
10863
10864 void DoAmmoExplosion()
10865 {
10866 Magazine magazine = Magazine.Cast(this);
10867 int pop_sounds_count = 6;
10868 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10869
10870 //play sound
10871 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10872 string sound_name = pop_sounds[ sound_idx ];
10873 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
10874
10875 //remove ammo count
10876 magazine.ServerAddAmmoCount(-1);
10877
10878 //if condition then repeat -> ExplodeAmmo
10879 float min_temp_to_explode = 100; //min temperature for item to explode
10880
10881 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
10882 {
10883 ExplodeAmmo();
10884 }
10885 }
10886
10887 // -------------------------------------------------------------------------------
10888 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
10889 {
10890 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
10891
10892 const int CHANCE_DAMAGE_CARGO = 4;
10893 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10894 const int CHANCE_DAMAGE_NOTHING = 2;
10895
10896 if (IsClothing() || IsContainer() || IsItemTent())
10897 {
10898 float dmg = damageResult.GetDamage("","Health") * -0.5;
10899 int chances;
10900 int rnd;
10901
10902 if (GetInventory().GetCargo())
10903 {
10904 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10905 rnd = Math.RandomInt(0,chances);
10906
10907 if (rnd < CHANCE_DAMAGE_CARGO)
10908 {
10909 DamageItemInCargo(dmg);
10910 }
10911 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10912 {
10914 }
10915 }
10916 else
10917 {
10918 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10919 rnd = Math.RandomInt(0,chances);
10920
10921 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10922 {
10924 }
10925 }
10926 }
10927 }
10928
10929 bool DamageItemInCargo(float damage)
10930 {
10931 if (GetInventory().GetCargo())
10932 {
10933 int item_count = GetInventory().GetCargo().GetItemCount();
10934 if (item_count > 0)
10935 {
10936 int random_pick = Math.RandomInt(0, item_count);
10937 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
10938 if (!item.IsExplosive())
10939 {
10940 item.AddHealth("","",damage);
10941 return true;
10942 }
10943 }
10944 }
10945 return false;
10946 }
10947
10948 bool DamageItemAttachments(float damage)
10949 {
10950 int attachment_count = GetInventory().AttachmentCount();
10951 if (attachment_count > 0)
10952 {
10953 int random_pick = Math.RandomInt(0, attachment_count);
10954 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
10955 if (!attachment.IsExplosive())
10956 {
10957 attachment.AddHealth("","",damage);
10958 return true;
10959 }
10960 }
10961 return false;
10962 }
10963
10964 override bool IsSplitable()
10965 {
10966 return m_CanThisBeSplit;
10967 }
10968 //----------------
10969 override bool CanBeSplit()
10970 {
10971 if (IsSplitable() && (GetQuantity() > 1))
10972 return GetInventory().CanRemoveEntity();
10973
10974 return false;
10975 }
10976
10977 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
10978 {
10979 if (!CanBeSplit())
10980 return;
10981
10982 if (GetGame().IsClient())
10983 {
10984 if (ScriptInputUserData.CanStoreInputUserData())
10985 {
10986 ScriptInputUserData ctx = new ScriptInputUserData;
10988 ctx.Write(1);
10989 ItemBase i1 = this; // @NOTE: workaround for correct serialization
10990 ctx.Write(i1);
10991 ctx.Write(destination_entity);
10992 ctx.Write(true);
10993 ctx.Write(slot_id);
10994 ctx.Send();
10995 }
10996 }
10997 else if (!GetGame().IsMultiplayer())
10998 {
10999 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
11000 }
11001 }
11002
11003 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
11004 {
11005 if (!CanBeSplit())
11006 return;
11007
11008 float split_quantity_new;
11009 ref ItemBase new_item;
11010 float quantity = GetQuantity();
11011 float stack_max = GetTargetQuantityMax(slot_id);
11012 InventoryLocation loc = new InventoryLocation;
11013
11014 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11015 {
11016 if (stack_max <= GetQuantity())
11017 split_quantity_new = stack_max;
11018 else
11019 split_quantity_new = GetQuantity();
11020
11021 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
11022 if (new_item)
11023 {
11024 new_item.SetResultOfSplit(true);
11025 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11026 AddQuantity(-split_quantity_new);
11027 new_item.SetQuantity(split_quantity_new);
11028 }
11029 }
11030 else if (destination_entity && slot_id == -1)
11031 {
11032 if (quantity > stack_max)
11033 split_quantity_new = stack_max;
11034 else
11035 split_quantity_new = quantity;
11036
11037 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
11038 {
11039 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
11040 new_item = ItemBase.Cast(o);
11041 }
11042
11043 if (new_item)
11044 {
11045 new_item.SetResultOfSplit(true);
11046 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11047 AddQuantity(-split_quantity_new);
11048 new_item.SetQuantity(split_quantity_new);
11049 }
11050 }
11051 else
11052 {
11053 if (stack_max != 0)
11054 {
11055 if (stack_max < GetQuantity())
11056 {
11057 split_quantity_new = GetQuantity() - stack_max;
11058 }
11059
11060 if (split_quantity_new == 0)
11061 {
11062 if (!GetGame().IsMultiplayer())
11063 player.PhysicalPredictiveDropItem(this);
11064 else
11065 player.ServerDropEntity(this);
11066 return;
11067 }
11068
11069 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
11070
11071 if (new_item)
11072 {
11073 new_item.SetResultOfSplit(true);
11074 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11075 SetQuantity(split_quantity_new);
11076 new_item.SetQuantity(stack_max);
11077 new_item.PlaceOnSurface();
11078 }
11079 }
11080 }
11081 }
11082
11083 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
11084 {
11085 if (!CanBeSplit())
11086 return;
11087
11088 float split_quantity_new;
11089 ref ItemBase new_item;
11090 float quantity = GetQuantity();
11091 float stack_max = GetTargetQuantityMax(slot_id);
11092 InventoryLocation loc = new InventoryLocation;
11093
11094 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
11095 {
11096 if (stack_max <= GetQuantity())
11097 split_quantity_new = stack_max;
11098 else
11099 split_quantity_new = GetQuantity();
11100
11101 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
11102 if (new_item)
11103 {
11104 new_item.SetResultOfSplit(true);
11105 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11106 AddQuantity(-split_quantity_new);
11107 new_item.SetQuantity(split_quantity_new);
11108 }
11109 }
11110 else if (destination_entity && slot_id == -1)
11111 {
11112 if (quantity > stack_max)
11113 split_quantity_new = stack_max;
11114 else
11115 split_quantity_new = quantity;
11116
11117 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
11118 {
11119 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
11120 new_item = ItemBase.Cast(o);
11121 }
11122
11123 if (new_item)
11124 {
11125 new_item.SetResultOfSplit(true);
11126 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11127 AddQuantity(-split_quantity_new);
11128 new_item.SetQuantity(split_quantity_new);
11129 }
11130 }
11131 else
11132 {
11133 if (stack_max != 0)
11134 {
11135 if (stack_max < GetQuantity())
11136 {
11137 split_quantity_new = GetQuantity() - stack_max;
11138 }
11139
11140 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
11141
11142 if (new_item)
11143 {
11144 new_item.SetResultOfSplit(true);
11145 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11146 SetQuantity(split_quantity_new);
11147 new_item.SetQuantity(stack_max);
11148 new_item.PlaceOnSurface();
11149 }
11150 }
11151 }
11152 }
11153
11154 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
11155 {
11156 if (!CanBeSplit())
11157 return;
11158
11159 if (GetGame().IsClient())
11160 {
11161 if (ScriptInputUserData.CanStoreInputUserData())
11162 {
11163 ScriptInputUserData ctx = new ScriptInputUserData;
11165 ctx.Write(4);
11166 ItemBase thiz = this; // @NOTE: workaround for correct serialization
11167 ctx.Write(thiz);
11168 dst.WriteToContext(ctx);
11169 ctx.Send();
11170 }
11171 }
11172 else if (!GetGame().IsMultiplayer())
11173 {
11175 }
11176 }
11177
11178 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
11179 {
11180 if (!CanBeSplit())
11181 return;
11182
11183 if (GetGame().IsClient())
11184 {
11185 if (ScriptInputUserData.CanStoreInputUserData())
11186 {
11187 ScriptInputUserData ctx = new ScriptInputUserData;
11189 ctx.Write(2);
11190 ItemBase dummy = this; // @NOTE: workaround for correct serialization
11191 ctx.Write(dummy);
11192 ctx.Write(destination_entity);
11193 ctx.Write(true);
11194 ctx.Write(idx);
11195 ctx.Write(row);
11196 ctx.Write(col);
11197 ctx.Send();
11198 }
11199 }
11200 else if (!GetGame().IsMultiplayer())
11201 {
11202 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
11203 }
11204 }
11205
11206 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
11207 {
11209 }
11210
11211 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
11212 {
11213 if (!CanBeSplit())
11214 return this;
11215
11216 float quantity = GetQuantity();
11217 float split_quantity_new;
11218 ItemBase new_item;
11219 if (dst.IsValid())
11220 {
11221 int slot_id = dst.GetSlot();
11222 float stack_max = GetTargetQuantityMax(slot_id);
11223
11224 if (quantity > stack_max)
11225 split_quantity_new = stack_max;
11226 else
11227 split_quantity_new = quantity;
11228
11229 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
11230
11231 if (new_item)
11232 {
11233 new_item.SetResultOfSplit(true);
11234 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11235 AddQuantity(-split_quantity_new);
11236 new_item.SetQuantity(split_quantity_new);
11237 }
11238
11239 return new_item;
11240 }
11241
11242 return null;
11243 }
11244
11245 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
11246 {
11247 if (!CanBeSplit())
11248 return;
11249
11250 float quantity = GetQuantity();
11251 float split_quantity_new;
11252 ref ItemBase new_item;
11253 if (destination_entity)
11254 {
11255 float stackable = GetTargetQuantityMax();
11256 if (quantity > stackable)
11257 split_quantity_new = stackable;
11258 else
11259 split_quantity_new = quantity;
11260
11261 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
11262 if (new_item)
11263 {
11264 new_item.SetResultOfSplit(true);
11265 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11266 AddQuantity(-split_quantity_new);
11267 new_item.SetQuantity(split_quantity_new);
11268 }
11269 }
11270 }
11271
11272 void SplitIntoStackMaxHandsClient(PlayerBase player)
11273 {
11274 if (!CanBeSplit())
11275 return;
11276
11277 if (GetGame().IsClient())
11278 {
11279 if (ScriptInputUserData.CanStoreInputUserData())
11280 {
11281 ScriptInputUserData ctx = new ScriptInputUserData;
11283 ctx.Write(3);
11284 ItemBase i1 = this; // @NOTE: workaround for correct serialization
11285 ctx.Write(i1);
11286 ItemBase destination_entity = this;
11287 ctx.Write(destination_entity);
11288 ctx.Write(true);
11289 ctx.Write(0);
11290 ctx.Send();
11291 }
11292 }
11293 else if (!GetGame().IsMultiplayer())
11294 {
11295 SplitIntoStackMaxHands(player);
11296 }
11297 }
11298
11299 void SplitIntoStackMaxHands(PlayerBase player)
11300 {
11301 if (!CanBeSplit())
11302 return;
11303
11304 float quantity = GetQuantity();
11305 float split_quantity_new;
11306 ref ItemBase new_item;
11307 if (player)
11308 {
11309 float stackable = GetTargetQuantityMax();
11310 if (quantity > stackable)
11311 split_quantity_new = stackable;
11312 else
11313 split_quantity_new = quantity;
11314
11315 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
11316 new_item = ItemBase.Cast(in_hands);
11317 if (new_item)
11318 {
11319 new_item.SetResultOfSplit(true);
11320 MiscGameplayFunctions.TransferItemProperties(this,new_item);
11321 AddQuantity(-split_quantity_new);
11322 new_item.SetQuantity(split_quantity_new);
11323 }
11324 }
11325 }
11326
11327 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
11328 {
11329 if (!CanBeSplit())
11330 return;
11331
11332 float quantity = GetQuantity();
11333 float split_quantity_new = Math.Floor(quantity * 0.5);
11334
11335 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
11336
11337 if (new_item)
11338 {
11339 if (new_item.GetQuantityMax() < split_quantity_new)
11340 {
11341 split_quantity_new = new_item.GetQuantityMax();
11342 }
11343
11344 new_item.SetResultOfSplit(true);
11345 MiscGameplayFunctions.TransferItemProperties(this, new_item);
11346
11347 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
11348 {
11349 AddQuantity(-1);
11350 new_item.SetQuantity(1);
11351 }
11352 else
11353 {
11354 AddQuantity(-split_quantity_new);
11355 new_item.SetQuantity(split_quantity_new);
11356 }
11357 }
11358 }
11359
11360 void SplitItem(PlayerBase player)
11361 {
11362 if (!CanBeSplit())
11363 return;
11364
11365 float quantity = GetQuantity();
11366 float split_quantity_new = Math.Floor(quantity / 2);
11367
11368 InventoryLocation invloc = new InventoryLocation;
11369 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
11370
11371 ItemBase new_item;
11372 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
11373
11374 if (new_item)
11375 {
11376 if (new_item.GetQuantityMax() < split_quantity_new)
11377 {
11378 split_quantity_new = new_item.GetQuantityMax();
11379 }
11380 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
11381 {
11382 AddQuantity(-1);
11383 new_item.SetQuantity(1);
11384 }
11385 else
11386 {
11387 AddQuantity(-split_quantity_new);
11388 new_item.SetQuantity(split_quantity_new);
11389 }
11390 }
11391 }
11392
11394 void OnQuantityChanged(float delta)
11395 {
11396 SetWeightDirty();
11397 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
11398
11399 if (parent)
11400 parent.OnAttachmentQuantityChangedEx(this, delta);
11401
11402 if (IsLiquidContainer())
11403 {
11404 if (GetQuantityNormalized() <= 0.0)
11405 {
11407 }
11408 else if (GetLiquidType() == LIQUID_NONE)
11409 {
11410 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
11412 }
11413 }
11414
11415 }
11416
11419 {
11420 // insert code here
11421 }
11422
11424 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
11425 {
11427 }
11428
11429 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
11430 {
11431 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
11432
11433 if (GetGame().IsServer())
11434 {
11435 if (newLevel == GameConstants.STATE_RUINED)
11436 {
11438 EntityAI parent = GetHierarchyParent();
11439 if (parent && parent.IsFireplace())
11440 {
11441 CargoBase cargo = GetInventory().GetCargo();
11442 if (cargo)
11443 {
11444 for (int i = 0; i < cargo.GetItemCount(); ++i)
11445 {
11446 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
11447 }
11448 }
11449 }
11450 }
11451
11452 if (IsResultOfSplit())
11453 {
11454 // reset the splitting result flag, return to normal item behavior
11455 SetResultOfSplit(false);
11456 return;
11457 }
11458
11459 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
11460 {
11461 SetCleanness(0);//unclean the item upon damage dealt
11462 }
11463 }
11464 }
11465
11466 // just the split? TODO: verify
11467 override void OnRightClick()
11468 {
11469 super.OnRightClick();
11470
11471 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
11472 {
11473 if (GetGame().IsClient())
11474 {
11475 if (ScriptInputUserData.CanStoreInputUserData())
11476 {
11477 vector m4[4];
11478 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
11479
11480 EntityAI root = GetHierarchyRoot();
11481
11482 InventoryLocation dst = new InventoryLocation;
11483 if (!player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.CARGO, dst))
11484 {
11485 if (root)
11486 {
11487 root.GetTransform(m4);
11488 dst.SetGround(this, m4);
11489 }
11490 else
11491 GetInventory().GetCurrentInventoryLocation(dst);
11492 }
11493 else
11494 {
11495 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
11496 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
11497 this shouldnt cause issues within this scope*/
11498 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
11499 {
11500 if (root)
11501 {
11502 root.GetTransform(m4);
11503 dst.SetGround(this, m4);
11504 }
11505 else
11506 GetInventory().GetCurrentInventoryLocation(dst);
11507 }
11508 else
11509 {
11510 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
11511 }
11512 }
11513
11514 ScriptInputUserData ctx = new ScriptInputUserData;
11516 ctx.Write(4);
11517 ItemBase thiz = this; // @NOTE: workaround for correct serialization
11518 ctx.Write(thiz);
11519 dst.WriteToContext(ctx);
11520 ctx.Write(true); // dummy
11521 ctx.Send();
11522 }
11523 }
11524 else if (!GetGame().IsMultiplayer())
11525 {
11526 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
11527 }
11528 }
11529 }
11530
11531 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
11532 {
11533 //TODO: delete check zero quantity check after fix double posts hands fsm events
11534 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
11535 return false;
11536
11537 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
11538 return false;
11539
11540 //can_this_be_combined = ConfigGetBool("canBeSplit");
11542 return false;
11543
11544
11545 Magazine mag = Magazine.Cast(this);
11546 if (mag)
11547 {
11548 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
11549 return false;
11550
11551 if (stack_max_limit)
11552 {
11553 Magazine other_mag = Magazine.Cast(other_item);
11554 if (other_item)
11555 {
11556 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
11557 return false;
11558 }
11559
11560 }
11561 }
11562 else
11563 {
11564 //TODO: delete check zero quantity check after fix double posts hands fsm events
11565 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
11566 return false;
11567
11568 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
11569 return false;
11570 }
11571
11572 PlayerBase player = null;
11573 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
11574 {
11575 if (player.GetInventory().HasAttachment(this))
11576 return false;
11577
11578 if (player.IsItemsToDelete())
11579 return false;
11580 }
11581
11582 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
11583 return false;
11584
11585 int slotID;
11586 string slotName;
11587 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
11588 return false;
11589
11590 return true;
11591 }
11592
11593 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
11594 {
11595 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
11596 }
11597
11598 bool IsResultOfSplit()
11599 {
11600 return m_IsResultOfSplit;
11601 }
11602
11603 void SetResultOfSplit(bool value)
11604 {
11605 m_IsResultOfSplit = value;
11606 }
11607
11608 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
11609 {
11610 return ComputeQuantityUsedEx(other_item, use_stack_max);
11611 }
11612
11613 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
11614 {
11615 float other_item_quantity = other_item.GetQuantity();
11616 float this_free_space;
11617
11618 float stack_max = GetQuantityMax();
11619
11620 this_free_space = stack_max - GetQuantity();
11621
11622 if (other_item_quantity > this_free_space)
11623 {
11624 return this_free_space;
11625 }
11626 else
11627 {
11628 return other_item_quantity;
11629 }
11630 }
11631
11632 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
11633 {
11634 CombineItems(ItemBase.Cast(entity2),use_stack_max);
11635 }
11636
11637 void CombineItems(ItemBase other_item, bool use_stack_max = true)
11638 {
11639 if (!CanBeCombined(other_item, false))
11640 return;
11641
11642 if (!IsMagazine() && other_item)
11643 {
11644 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
11645 if (quantity_used != 0)
11646 {
11647 float hp1 = GetHealth01("","");
11648 float hp2 = other_item.GetHealth01("","");
11649 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
11650 hpResult = hpResult / (GetQuantity() + quantity_used);
11651
11652 hpResult *= GetMaxHealth();
11653 Math.Round(hpResult);
11654 SetHealth("", "Health", hpResult);
11655
11656 AddQuantity(quantity_used);
11657 other_item.AddQuantity(-quantity_used);
11658 }
11659 }
11660 OnCombine(other_item);
11661 }
11662
11663 void OnCombine(ItemBase other_item)
11664 {
11665 #ifdef SERVER
11666 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11667 GetHierarchyParent().IncreaseLifetimeUp();
11668 #endif
11669 };
11670
11671 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
11672 {
11673 PlayerBase p = PlayerBase.Cast(player);
11674
11675 array<int> recipesIds = p.m_Recipes;
11676 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
11677 if (moduleRecipesManager)
11678 {
11679 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
11680 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
11681 }
11682
11683 for (int i = 0;i < recipesIds.Count(); i++)
11684 {
11685 int key = recipesIds.Get(i);
11686 string recipeName = moduleRecipesManager.GetRecipeName(key);
11687 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
11688 }
11689 }
11690
11691 // -------------------------------------------------------------------------
11692 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11693 {
11694 super.GetDebugActions(outputList);
11695
11696 //quantity
11697 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
11698 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
11699 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
11700 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
11701
11702 //health
11703 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
11704 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
11705 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
11706 //temperature
11707 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
11708 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
11709 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
11710
11711 //wet
11712 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
11713 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
11714
11715 //liquidtype
11716 if (IsLiquidContainer())
11717 {
11718 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
11719 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
11720 }
11721
11722 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
11723 // watch
11724 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
11725 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
11726
11727 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
11728 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
11729 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
11730 }
11731
11732 // -------------------------------------------------------------------------
11733 // -------------------------------------------------------------------------
11734 // -------------------------------------------------------------------------
11735 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
11736 {
11737 super.OnAction(action_id, player, ctx);
11738 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
11739 {
11740 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
11741 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
11742 PlayerBase p = PlayerBase.Cast(player);
11743 if (EActions.RECIPES_RANGE_START < 1000)
11744 {
11745 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11746 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11747 }
11748 }
11749 #ifndef SERVER
11750 else if (action_id == EActions.WATCH_PLAYER)
11751 {
11752 PluginDeveloper.SetDeveloperItemClientEx(player);
11753 }
11754 #endif
11755 if (GetGame().IsServer())
11756 {
11757 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11758 {
11759 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11760 OnDebugButtonPressServer(id + 1);
11761 }
11762
11763 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11764 {
11765 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11766 InsertAgent(agent_id,100);
11767 }
11768
11769 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11770 {
11771 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11772 RemoveAgent(agent_id2);
11773 }
11774
11775 else if (action_id == EActions.ADD_QUANTITY)
11776 {
11777 if (IsMagazine())
11778 {
11779 Magazine mag = Magazine.Cast(this);
11780 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11781 }
11782 else
11783 {
11784 AddQuantity(GetQuantityMax() * 0.2);
11785 }
11786
11787 if (m_EM)
11788 {
11789 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11790 }
11791 //PrintVariables();
11792 }
11793
11794 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
11795 {
11796 if (IsMagazine())
11797 {
11798 Magazine mag2 = Magazine.Cast(this);
11799 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11800 }
11801 else
11802 {
11803 AddQuantity(- GetQuantityMax() * 0.2);
11804 }
11805 if (m_EM)
11806 {
11807 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11808 }
11809 //PrintVariables();
11810 }
11811
11812 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
11813 {
11814 SetQuantity(0);
11815
11816 if (m_EM)
11817 {
11818 m_EM.SetEnergy(0);
11819 }
11820 }
11821
11822 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
11823 {
11825
11826 if (m_EM)
11827 {
11828 m_EM.SetEnergy(m_EM.GetEnergyMax());
11829 }
11830 }
11831
11832 else if (action_id == EActions.ADD_HEALTH)
11833 {
11834 AddHealth("","",GetMaxHealth("","Health")/5);
11835 }
11836 else if (action_id == EActions.REMOVE_HEALTH)
11837 {
11838 AddHealth("","",-GetMaxHealth("","Health")/5);
11839 }
11840 else if (action_id == EActions.DESTROY_HEALTH)
11841 {
11842 SetHealth01("","",0);
11843 }
11844 else if (action_id == EActions.WATCH_ITEM)
11845 {
11847 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
11848 #ifdef DEVELOPER
11849 SetDebugDeveloper_item(this);
11850 #endif
11851 }
11852
11853 else if (action_id == EActions.ADD_TEMPERATURE)
11854 {
11855 AddTemperature(20);
11856 //PrintVariables();
11857 }
11858
11859 else if (action_id == EActions.REMOVE_TEMPERATURE)
11860 {
11861 AddTemperature(-20);
11862 //PrintVariables();
11863 }
11864
11865 else if (action_id == EActions.FLIP_FROZEN)
11866 {
11867 SetFrozen(!GetIsFrozen());
11868 //PrintVariables();
11869 }
11870
11871 else if (action_id == EActions.ADD_WETNESS)
11872 {
11873 AddWet(GetWetMax()/5);
11874 //PrintVariables();
11875 }
11876
11877 else if (action_id == EActions.REMOVE_WETNESS)
11878 {
11879 AddWet(-GetWetMax()/5);
11880 //PrintVariables();
11881 }
11882
11883 else if (action_id == EActions.LIQUIDTYPE_UP)
11884 {
11885 int curr_type = GetLiquidType();
11886 SetLiquidType(curr_type * 2);
11887 //AddWet(1);
11888 //PrintVariables();
11889 }
11890
11891 else if (action_id == EActions.LIQUIDTYPE_DOWN)
11892 {
11893 int curr_type2 = GetLiquidType();
11894 SetLiquidType(curr_type2 / 2);
11895 }
11896
11897 else if (action_id == EActions.MAKE_SPECIAL)
11898 {
11899 auto debugParams = DebugSpawnParams.WithPlayer(player);
11900 OnDebugSpawnEx(debugParams);
11901 }
11902
11903 else if (action_id == EActions.DELETE)
11904 {
11905 Delete();
11906 }
11907
11908 }
11909
11910
11911 return false;
11912 }
11913
11914 // -------------------------------------------------------------------------
11915
11916
11919 void OnActivatedByTripWire();
11920
11922 void OnActivatedByItem(notnull ItemBase item);
11923
11924 //----------------------------------------------------------------
11925 //returns true if item is able to explode when put in fire
11926 bool CanExplodeInFire()
11927 {
11928 return false;
11929 }
11930
11931 //----------------------------------------------------------------
11932 bool CanEat()
11933 {
11934 return true;
11935 }
11936
11937 //----------------------------------------------------------------
11938 override bool IsIgnoredByConstruction()
11939 {
11940 return true;
11941 }
11942
11943 //----------------------------------------------------------------
11944 //has FoodStages in config?
11945 bool HasFoodStage()
11946 {
11947 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
11948 return GetGame().ConfigIsExisting(config_path);
11949 }
11950
11952 FoodStage GetFoodStage()
11953 {
11954 return null;
11955 }
11956
11957 bool CanBeCooked()
11958 {
11959 return false;
11960 }
11961
11962 bool CanBeCookedOnStick()
11963 {
11964 return false;
11965 }
11966
11968 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
11970
11971 //----------------------------------------------------------------
11972 bool CanRepair(ItemBase item_repair_kit)
11973 {
11974 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
11975 return module_repairing.CanRepair(this, item_repair_kit);
11976 }
11977
11978 //----------------------------------------------------------------
11979 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
11980 {
11981 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
11982 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11983 }
11984
11985 //----------------------------------------------------------------
11986 int GetItemSize()
11987 {
11988 /*
11989 vector v_size = this.ConfigGetVector("itemSize");
11990 int v_size_x = v_size[0];
11991 int v_size_y = v_size[1];
11992 int size = v_size_x * v_size_y;
11993 return size;
11994 */
11995
11996 return 1;
11997 }
11998
11999 //----------------------------------------------------------------
12000 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
12001 bool CanBeMovedOverride()
12002 {
12003 return m_CanBeMovedOverride;
12004 }
12005
12006 //----------------------------------------------------------------
12007 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
12008 void SetCanBeMovedOverride(bool setting)
12009 {
12010 m_CanBeMovedOverride = setting;
12011 }
12012
12013 //----------------------------------------------------------------
12021 void MessageToOwnerStatus(string text)
12022 {
12023 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12024
12025 if (player)
12026 {
12027 player.MessageStatus(text);
12028 }
12029 }
12030
12031 //----------------------------------------------------------------
12039 void MessageToOwnerAction(string text)
12040 {
12041 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12042
12043 if (player)
12044 {
12045 player.MessageAction(text);
12046 }
12047 }
12048
12049 //----------------------------------------------------------------
12057 void MessageToOwnerFriendly(string text)
12058 {
12059 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12060
12061 if (player)
12062 {
12063 player.MessageFriendly(text);
12064 }
12065 }
12066
12067 //----------------------------------------------------------------
12075 void MessageToOwnerImportant(string text)
12076 {
12077 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
12078
12079 if (player)
12080 {
12081 player.MessageImportant(text);
12082 }
12083 }
12084
12085 override bool IsItemBase()
12086 {
12087 return true;
12088 }
12089
12090 // Checks if item is of questioned kind
12091 override bool KindOf(string tag)
12092 {
12093 bool found = false;
12094 string item_name = this.GetType();
12095 ref TStringArray item_tag_array = new TStringArray;
12096 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
12097
12098 int array_size = item_tag_array.Count();
12099 for (int i = 0; i < array_size; i++)
12100 {
12101 if (item_tag_array.Get(i) == tag)
12102 {
12103 found = true;
12104 break;
12105 }
12106 }
12107 return found;
12108 }
12109
12110
12111 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
12112 {
12113 //Debug.Log("OnRPC called");
12114 super.OnRPC(sender, rpc_type,ctx);
12115
12116 //Play soundset for attachment locking (ActionLockAttachment.c)
12117 switch (rpc_type)
12118 {
12119 #ifndef SERVER
12120 case ERPCs.RPC_SOUND_LOCK_ATTACH:
12121 Param2<bool, string> p = new Param2<bool, string>(false, "");
12122
12123 if (!ctx.Read(p))
12124 return;
12125
12126 bool play = p.param1;
12127 string soundSet = p.param2;
12128
12129 if (play)
12130 {
12131 if (m_LockingSound)
12132 {
12134 {
12135 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
12136 }
12137 }
12138 else
12139 {
12140 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
12141 }
12142 }
12143 else
12144 {
12145 SEffectManager.DestroyEffect(m_LockingSound);
12146 }
12147
12148 break;
12149 #endif
12150
12151 }
12152
12153 if (GetWrittenNoteData())
12154 {
12155 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
12156 }
12157 }
12158
12159 //-----------------------------
12160 // VARIABLE MANIPULATION SYSTEM
12161 //-----------------------------
12162 int NameToID(string name)
12163 {
12164 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
12165 return plugin.GetID(name);
12166 }
12167
12168 string IDToName(int id)
12169 {
12170 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
12171 return plugin.GetName(id);
12172 }
12173
12175 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
12176 {
12177 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
12178 //read the flags
12179 int varFlags;
12180 if (!ctx.Read(varFlags))
12181 return;
12182
12183 if (varFlags & ItemVariableFlags.FLOAT)
12184 {
12185 ReadVarsFromCTX(ctx);
12186 }
12187 }
12188
12189 override void SerializeNumericalVars(array<float> floats_out)
12190 {
12191 //some variables handled on EntityAI level already!
12192 super.SerializeNumericalVars(floats_out);
12193
12194 // the order of serialization must be the same as the order of de-serialization
12195 //--------------------------------------------
12196 if (IsVariableSet(VARIABLE_QUANTITY))
12197 {
12198 floats_out.Insert(m_VarQuantity);
12199 }
12200 //--------------------------------------------
12201 if (IsVariableSet(VARIABLE_WET))
12202 {
12203 floats_out.Insert(m_VarWet);
12204 }
12205 //--------------------------------------------
12206 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
12207 {
12208 floats_out.Insert(m_VarLiquidType);
12209 }
12210 //--------------------------------------------
12211 if (IsVariableSet(VARIABLE_COLOR))
12212 {
12213 floats_out.Insert(m_ColorComponentR);
12214 floats_out.Insert(m_ColorComponentG);
12215 floats_out.Insert(m_ColorComponentB);
12216 floats_out.Insert(m_ColorComponentA);
12217 }
12218 //--------------------------------------------
12219 if (IsVariableSet(VARIABLE_CLEANNESS))
12220 {
12221 floats_out.Insert(m_Cleanness);
12222 }
12223 }
12224
12225 override void DeSerializeNumericalVars(array<float> floats)
12226 {
12227 //some variables handled on EntityAI level already!
12228 super.DeSerializeNumericalVars(floats);
12229
12230 // the order of serialization must be the same as the order of de-serialization
12231 int index = 0;
12232 int mask = Math.Round(floats.Get(index));
12233
12234 index++;
12235 //--------------------------------------------
12236 if (mask & VARIABLE_QUANTITY)
12237 {
12238 if (m_IsStoreLoad)
12239 {
12240 SetStoreLoadedQuantity(floats.Get(index));
12241 }
12242 else
12243 {
12244 float quantity = floats.Get(index);
12245 SetQuantity(quantity, true, false, false, false);
12246 }
12247 index++;
12248 }
12249 //--------------------------------------------
12250 if (mask & VARIABLE_WET)
12251 {
12252 float wet = floats.Get(index);
12253 SetWet(wet);
12254 index++;
12255 }
12256 //--------------------------------------------
12257 if (mask & VARIABLE_LIQUIDTYPE)
12258 {
12259 int liquidtype = Math.Round(floats.Get(index));
12260 SetLiquidType(liquidtype);
12261 index++;
12262 }
12263 //--------------------------------------------
12264 if (mask & VARIABLE_COLOR)
12265 {
12266 m_ColorComponentR = Math.Round(floats.Get(index));
12267 index++;
12268 m_ColorComponentG = Math.Round(floats.Get(index));
12269 index++;
12270 m_ColorComponentB = Math.Round(floats.Get(index));
12271 index++;
12272 m_ColorComponentA = Math.Round(floats.Get(index));
12273 index++;
12274 }
12275 //--------------------------------------------
12276 if (mask & VARIABLE_CLEANNESS)
12277 {
12278 int cleanness = Math.Round(floats.Get(index));
12279 SetCleanness(cleanness);
12280 index++;
12281 }
12282 }
12283
12284 override void WriteVarsToCTX(ParamsWriteContext ctx)
12285 {
12286 super.WriteVarsToCTX(ctx);
12287
12288 //--------------------------------------------
12289 if (IsVariableSet(VARIABLE_QUANTITY))
12290 {
12291 ctx.Write(GetQuantity());
12292 }
12293 //--------------------------------------------
12294 if (IsVariableSet(VARIABLE_WET))
12295 {
12296 ctx.Write(GetWet());
12297 }
12298 //--------------------------------------------
12299 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
12300 {
12301 ctx.Write(GetLiquidType());
12302 }
12303 //--------------------------------------------
12304 if (IsVariableSet(VARIABLE_COLOR))
12305 {
12306 int r,g,b,a;
12307 GetColor(r,g,b,a);
12308 ctx.Write(r);
12309 ctx.Write(g);
12310 ctx.Write(b);
12311 ctx.Write(a);
12312 }
12313 //--------------------------------------------
12314 if (IsVariableSet(VARIABLE_CLEANNESS))
12315 {
12316 ctx.Write(GetCleanness());
12317 }
12318 }
12319
12320 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
12321 {
12322 if (!super.ReadVarsFromCTX(ctx,version))
12323 return false;
12324
12325 int intValue;
12326 float value;
12327
12328 if (version < 140)
12329 {
12330 if (!ctx.Read(intValue))
12331 return false;
12332
12333 m_VariablesMask = intValue;
12334 }
12335
12336 if (m_VariablesMask & VARIABLE_QUANTITY)
12337 {
12338 if (!ctx.Read(value))
12339 return false;
12340
12341 if (IsStoreLoad())
12342 {
12344 }
12345 else
12346 {
12347 SetQuantity(value, true, false, false, false);
12348 }
12349 }
12350 //--------------------------------------------
12351 if (version < 140)
12352 {
12353 if (m_VariablesMask & VARIABLE_TEMPERATURE)
12354 {
12355 if (!ctx.Read(value))
12356 return false;
12357 SetTemperatureDirect(value);
12358 }
12359 }
12360 //--------------------------------------------
12361 if (m_VariablesMask & VARIABLE_WET)
12362 {
12363 if (!ctx.Read(value))
12364 return false;
12365 SetWet(value);
12366 }
12367 //--------------------------------------------
12368 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
12369 {
12370 if (!ctx.Read(intValue))
12371 return false;
12372 SetLiquidType(intValue);
12373 }
12374 //--------------------------------------------
12375 if (m_VariablesMask & VARIABLE_COLOR)
12376 {
12377 int r,g,b,a;
12378 if (!ctx.Read(r))
12379 return false;
12380 if (!ctx.Read(g))
12381 return false;
12382 if (!ctx.Read(b))
12383 return false;
12384 if (!ctx.Read(a))
12385 return false;
12386
12387 SetColor(r,g,b,a);
12388 }
12389 //--------------------------------------------
12390 if (m_VariablesMask & VARIABLE_CLEANNESS)
12391 {
12392 if (!ctx.Read(intValue))
12393 return false;
12394 SetCleanness(intValue);
12395 }
12396 //--------------------------------------------
12397 if (version >= 138 && version < 140)
12398 {
12399 if (m_VariablesMask & VARIABLE_TEMPERATURE)
12400 {
12401 if (!ctx.Read(intValue))
12402 return false;
12403 SetFrozen(intValue);
12404 }
12405 }
12406
12407 return true;
12408 }
12409
12410 //----------------------------------------------------------------
12411 override bool OnStoreLoad(ParamsReadContext ctx, int version)
12412 {
12413 m_IsStoreLoad = true;
12415 {
12416 m_FixDamageSystemInit = true;
12417 }
12418
12419 if (!super.OnStoreLoad(ctx, version))
12420 {
12421 m_IsStoreLoad = false;
12422 return false;
12423 }
12424
12425 if (version >= 114)
12426 {
12427 bool hasQuickBarIndexSaved;
12428
12429 if (!ctx.Read(hasQuickBarIndexSaved))
12430 {
12431 m_IsStoreLoad = false;
12432 return false;
12433 }
12434
12435 if (hasQuickBarIndexSaved)
12436 {
12437 int itmQBIndex;
12438
12439 //Load quickbar item bind
12440 if (!ctx.Read(itmQBIndex))
12441 {
12442 m_IsStoreLoad = false;
12443 return false;
12444 }
12445
12446 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
12447 if (itmQBIndex != -1 && parentPlayer)
12448 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
12449 }
12450 }
12451 else
12452 {
12453 // Backup of how it used to be
12454 PlayerBase player;
12455 int itemQBIndex;
12456 if (version == int.MAX)
12457 {
12458 if (!ctx.Read(itemQBIndex))
12459 {
12460 m_IsStoreLoad = false;
12461 return false;
12462 }
12463 }
12464 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
12465 {
12466 //Load quickbar item bind
12467 if (!ctx.Read(itemQBIndex))
12468 {
12469 m_IsStoreLoad = false;
12470 return false;
12471 }
12472 if (itemQBIndex != -1 && player)
12473 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
12474 }
12475 }
12476
12477 if (version < 140)
12478 {
12479 // variable management system
12480 if (!LoadVariables(ctx, version))
12481 {
12482 m_IsStoreLoad = false;
12483 return false;
12484 }
12485 }
12486
12487 //agent trasmission system
12488 if (!LoadAgents(ctx, version))
12489 {
12490 m_IsStoreLoad = false;
12491 return false;
12492 }
12493 if (version >= 132)
12494 {
12495 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
12496 if (raib)
12497 {
12498 if (!raib.OnStoreLoad(ctx,version))
12499 {
12500 m_IsStoreLoad = false;
12501 return false;
12502 }
12503 }
12504 }
12505
12506 m_IsStoreLoad = false;
12507 return true;
12508 }
12509
12510 //----------------------------------------------------------------
12511
12512 override void OnStoreSave(ParamsWriteContext ctx)
12513 {
12514 super.OnStoreSave(ctx);
12515
12516 PlayerBase player;
12517 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
12518 {
12519 ctx.Write(true); // Keep track of if we should actually read this in or not
12520 //Save quickbar item bind
12521 int itemQBIndex = -1;
12522 itemQBIndex = player.FindQuickBarEntityIndex(this);
12523 ctx.Write(itemQBIndex);
12524 }
12525 else
12526 {
12527 ctx.Write(false); // Keep track of if we should actually read this in or not
12528 }
12529
12530 SaveAgents(ctx);//agent trasmission system
12531
12532 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
12533 if (raib)
12534 {
12535 raib.OnStoreSave(ctx);
12536 }
12537 }
12538 //----------------------------------------------------------------
12539
12540 override void AfterStoreLoad()
12541 {
12542 super.AfterStoreLoad();
12543
12545 {
12547 }
12548
12549 if (GetStoreLoadedQuantity() != float.LOWEST)
12550 {
12552 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
12553 }
12554 }
12555
12556 override void EEOnAfterLoad()
12557 {
12558 super.EEOnAfterLoad();
12559
12561 {
12562 m_FixDamageSystemInit = false;
12563 }
12564
12567 }
12568
12569 bool CanBeDisinfected()
12570 {
12571 return false;
12572 }
12573
12574
12575 //----------------------------------------------------------------
12576 override void OnVariablesSynchronized()
12577 {
12578 if (m_Initialized)
12579 {
12580 #ifdef PLATFORM_CONSOLE
12581 //bruteforce it is
12582 if (IsSplitable())
12583 {
12584 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
12585 if (menu)
12586 {
12587 menu.Refresh();
12588 }
12589 }
12590 #endif
12591 }
12592
12594 {
12595 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
12596 m_WantPlayImpactSound = false;
12597 }
12598
12600 {
12601 SetWeightDirty();
12603 }
12604 if (m_VarWet != m_VarWetPrev)
12605 {
12608 }
12609
12610 if (m_SoundSyncPlay != 0)
12611 {
12612 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
12613 m_SoundSyncPlay = 0;
12614 }
12615 if (m_SoundSyncStop != 0)
12616 {
12617 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
12618 m_SoundSyncStop = 0;
12619 }
12620
12621 super.OnVariablesSynchronized();
12622 }
12623
12624 //------------------------- Quantity
12625 //----------------------------------------------------------------
12627 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
12628 {
12629 if (!IsServerCheck(allow_client))
12630 return false;
12631
12632 if (!HasQuantity())
12633 return false;
12634
12635 float min = GetQuantityMin();
12636 float max = GetQuantityMax();
12637
12638 if (value <= (min + 0.001))
12639 value = min;
12640
12641 if (value == min)
12642 {
12643 if (destroy_config)
12644 {
12645 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12646 if (dstr)
12647 {
12648 m_VarQuantity = Math.Clamp(value, min, max);
12649 this.Delete();
12650 return true;
12651 }
12652 }
12653 else if (destroy_forced)
12654 {
12655 m_VarQuantity = Math.Clamp(value, min, max);
12656 this.Delete();
12657 return true;
12658 }
12659 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
12660 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
12661 }
12662
12663 float delta = m_VarQuantity;
12664 m_VarQuantity = Math.Clamp(value, min, max);
12665
12666 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
12667 {
12668 delta = m_VarQuantity - delta;
12669
12670 if (delta)
12671 OnQuantityChanged(delta);
12672 }
12673
12674 SetVariableMask(VARIABLE_QUANTITY);
12675
12676 return false;
12677 }
12678
12679 //----------------------------------------------------------------
12681 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
12682 {
12683 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
12684 }
12685 //----------------------------------------------------------------
12686 void SetQuantityMax()
12687 {
12688 float max = GetQuantityMax();
12689 SetQuantity(max);
12690 }
12691
12692 override void SetQuantityToMinimum()
12693 {
12694 float min = GetQuantityMin();
12695 SetQuantity(min);
12696 }
12697 //----------------------------------------------------------------
12699 void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
12700 {
12701 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
12702 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
12703 SetQuantity(result, destroy_config, destroy_forced);
12704 }
12705
12706 //----------------------------------------------------------------
12708 override float GetQuantityNormalized()
12709 {
12710 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
12711 }
12712
12714 {
12715 return GetQuantityNormalized();
12716 }
12717
12718 /*void SetAmmoNormalized(float value)
12719 {
12720 float value_clamped = Math.Clamp(value, 0, 1);
12721 Magazine this_mag = Magazine.Cast(this);
12722 int max_rounds = this_mag.GetAmmoMax();
12723 int result = value * max_rounds;//can the rounded if higher precision is required
12724 this_mag.SetAmmoCount(result);
12725 }*/
12726 //----------------------------------------------------------------
12727 override int GetQuantityMax()
12728 {
12729 int slot = -1;
12730 if (GetInventory())
12731 {
12732 InventoryLocation il = new InventoryLocation;
12733 GetInventory().GetCurrentInventoryLocation(il);
12734 slot = il.GetSlot();
12735 }
12736
12737 return GetTargetQuantityMax(slot);
12738 }
12739
12740 override int GetTargetQuantityMax(int attSlotID = -1)
12741 {
12742 float quantity_max = 0;
12743
12744 if (IsSplitable()) //only stackable/splitable items can check for stack size
12745 {
12746 if (attSlotID != -1)
12747 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12748
12749 if (quantity_max <= 0)
12750 quantity_max = m_VarStackMax;
12751 }
12752
12753 if (quantity_max <= 0)
12754 quantity_max = m_VarQuantityMax;
12755
12756 return quantity_max;
12757 }
12758 //----------------------------------------------------------------
12759 override int GetQuantityMin()
12760 {
12761 return m_VarQuantityMin;
12762 }
12763 //----------------------------------------------------------------
12764 int GetQuantityInit()
12765 {
12766 return m_VarQuantityInit;
12767 }
12768
12769 //----------------------------------------------------------------
12770 override bool HasQuantity()
12771 {
12772 return !(GetQuantityMax() - GetQuantityMin() == 0);
12773 }
12774
12775 override float GetQuantity()
12776 {
12777 return m_VarQuantity;
12778 }
12779
12780 bool IsFullQuantity()
12781 {
12782 return GetQuantity() >= GetQuantityMax();
12783 }
12784
12785 //Calculates weight of single item without attachments and cargo
12786 override float GetSingleInventoryItemWeightEx()
12787 {
12788 //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
12789 float weightEx = GetWeightEx();//overall weight of the item
12790 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
12791 return weightEx - special;
12792 }
12793
12794 // Obsolete, use GetSingleInventoryItemWeightEx() instead
12796 {
12798 }
12799
12800 override protected float GetWeightSpecialized(bool forceRecalc = false)
12801 {
12802 if (IsSplitable()) //quantity determines size of the stack
12803 {
12804 #ifdef DEVELOPER
12805 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12806 {
12807 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12808 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
12809 }
12810 #endif
12811
12812 return GetQuantity() * GetConfigWeightModified();
12813 }
12814 else if (HasEnergyManager())// items with energy manager
12815 {
12816 #ifdef DEVELOPER
12817 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12818 {
12819 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12820 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
12821 }
12822 #endif
12823 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
12824 }
12825 else//everything else
12826 {
12827 #ifdef DEVELOPER
12828 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12829 {
12830 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12831 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
12832 }
12833 #endif
12834 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
12835 }
12836 }
12837
12839 int GetNumberOfItems()
12840 {
12841 int item_count = 0;
12842 ItemBase item;
12843
12844 if (GetInventory().GetCargo() != NULL)
12845 {
12846 item_count = GetInventory().GetCargo().GetItemCount();
12847 }
12848
12849 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
12850 {
12851 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
12852 if (item)
12853 item_count += item.GetNumberOfItems();
12854 }
12855 return item_count;
12856 }
12857
12859 float GetUnitWeight(bool include_wetness = true)
12860 {
12861 float weight = 0;
12862 float wetness = 1;
12863 if (include_wetness)
12864 wetness += GetWet();
12865 if (IsSplitable()) //quantity determines size of the stack
12866 {
12867 weight = wetness * m_ConfigWeight;
12868 }
12869 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
12870 {
12871 weight = 1;
12872 }
12873 return weight;
12874 }
12875
12876 //-----------------------------------------------------------------
12877
12878 override void ClearInventory()
12879 {
12880 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
12881 {
12882 GameInventory inv = GetInventory();
12883 array<EntityAI> items = new array<EntityAI>;
12884 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
12885 for (int i = 0; i < items.Count(); i++)
12886 {
12887 ItemBase item = ItemBase.Cast(items.Get(i));
12888 if (item)
12889 {
12890 GetGame().ObjectDelete(item);
12891 }
12892 }
12893 }
12894 }
12895
12896 //------------------------- Energy
12897
12898 //----------------------------------------------------------------
12899 float GetEnergy()
12900 {
12901 float energy = 0;
12902 if (HasEnergyManager())
12903 {
12904 energy = GetCompEM().GetEnergy();
12905 }
12906 return energy;
12907 }
12908
12909
12910 override void OnEnergyConsumed()
12911 {
12912 super.OnEnergyConsumed();
12913
12915 }
12916
12917 override void OnEnergyAdded()
12918 {
12919 super.OnEnergyAdded();
12920
12922 }
12923
12924 // Converts energy (from Energy Manager) to quantity, if enabled.
12926 {
12927 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12928 {
12929 if (HasQuantity())
12930 {
12931 float energy_0to1 = GetCompEM().GetEnergy0To1();
12932 SetQuantityNormalized(energy_0to1);
12933 }
12934 }
12935 }
12936
12937 //----------------------------------------------------------------
12938 float GetHeatIsolationInit()
12939 {
12940 return ConfigGetFloat("heatIsolation");
12941 }
12942
12943 float GetHeatIsolation()
12944 {
12945 return m_HeatIsolation;
12946 }
12947
12948 float GetDryingIncrement(string pIncrementName)
12949 {
12950 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
12951 if (GetGame().ConfigIsExisting(paramPath))
12952 return GetGame().ConfigGetFloat(paramPath);
12953
12954 return 0.0;
12955 }
12956
12957 float GetSoakingIncrement(string pIncrementName)
12958 {
12959 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
12960 if (GetGame().ConfigIsExisting(paramPath))
12961 return GetGame().ConfigGetFloat(paramPath);
12962
12963 return 0.0;
12964 }
12965 //----------------------------------------------------------------
12966 override void SetWet(float value, bool allow_client = false)
12967 {
12968 if (!IsServerCheck(allow_client))
12969 return;
12970
12971 float min = GetWetMin();
12972 float max = GetWetMax();
12973
12974 float previousValue = m_VarWet;
12975
12976 m_VarWet = Math.Clamp(value, min, max);
12977
12978 if (previousValue != m_VarWet)
12979 {
12980 SetVariableMask(VARIABLE_WET);
12981 OnWetChanged(m_VarWet, previousValue);
12982 }
12983 }
12984 //----------------------------------------------------------------
12985 override void AddWet(float value)
12986 {
12987 SetWet(GetWet() + value);
12988 }
12989 //----------------------------------------------------------------
12990 override void SetWetMax()
12991 {
12993 }
12994 //----------------------------------------------------------------
12995 override float GetWet()
12996 {
12997 return m_VarWet;
12998 }
12999 //----------------------------------------------------------------
13000 override float GetWetMax()
13001 {
13002 return m_VarWetMax;
13003 }
13004 //----------------------------------------------------------------
13005 override float GetWetMin()
13006 {
13007 return m_VarWetMin;
13008 }
13009 //----------------------------------------------------------------
13010 override float GetWetInit()
13011 {
13012 return m_VarWetInit;
13013 }
13014 //----------------------------------------------------------------
13015 override void OnWetChanged(float newVal, float oldVal)
13016 {
13017 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
13018 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
13019 if (newLevel != oldLevel)
13020 {
13021 OnWetLevelChanged(newLevel,oldLevel);
13022 }
13023 }
13024
13025 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
13026 {
13027 SetWeightDirty();
13028 }
13029
13030 override EWetnessLevel GetWetLevel()
13031 {
13032 return GetWetLevelInternal(m_VarWet);
13033 }
13034
13035 //----------------------------------------------------------------
13036
13037 override void SetStoreLoad(bool value)
13038 {
13039 m_IsStoreLoad = value;
13040 }
13041
13042 override bool IsStoreLoad()
13043 {
13044 return m_IsStoreLoad;
13045 }
13046
13047 override void SetStoreLoadedQuantity(float value)
13048 {
13049 m_StoreLoadedQuantity = value;
13050 }
13051
13052 override float GetStoreLoadedQuantity()
13053 {
13054 return m_StoreLoadedQuantity;
13055 }
13056
13057 //----------------------------------------------------------------
13058
13059 float GetItemModelLength()
13060 {
13061 if (ConfigIsExisting("itemModelLength"))
13062 {
13063 return ConfigGetFloat("itemModelLength");
13064 }
13065 return 0;
13066 }
13067
13068 float GetItemAttachOffset()
13069 {
13070 if (ConfigIsExisting("itemAttachOffset"))
13071 {
13072 return ConfigGetFloat("itemAttachOffset");
13073 }
13074 return 0;
13075 }
13076
13077 override void SetCleanness(int value, bool allow_client = false)
13078 {
13079 if (!IsServerCheck(allow_client))
13080 return;
13081
13082 int previousValue = m_Cleanness;
13083
13084 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
13085
13086 if (previousValue != m_Cleanness)
13087 SetVariableMask(VARIABLE_CLEANNESS);
13088 }
13089
13090 override int GetCleanness()
13091 {
13092 return m_Cleanness;
13093 }
13094
13096 {
13097 return true;
13098 }
13099
13100 //----------------------------------------------------------------
13101 // ATTACHMENT LOCKING
13102 // Getters relevant to generic ActionLockAttachment
13103 int GetLockType()
13104 {
13105 return m_LockType;
13106 }
13107
13108 string GetLockSoundSet()
13109 {
13110 return m_LockSoundSet;
13111 }
13112
13113 //----------------------------------------------------------------
13114 //------------------------- Color
13115 // sets items color variable given color components
13116 override void SetColor(int r, int g, int b, int a)
13117 {
13122 SetVariableMask(VARIABLE_COLOR);
13123 }
13125 override void GetColor(out int r,out int g,out int b,out int a)
13126 {
13131 }
13132
13133 bool IsColorSet()
13134 {
13135 return IsVariableSet(VARIABLE_COLOR);
13136 }
13137
13139 string GetColorString()
13140 {
13141 int r,g,b,a;
13142 GetColor(r,g,b,a);
13143 r = r/255;
13144 g = g/255;
13145 b = b/255;
13146 a = a/255;
13147 return MiscGameplayFunctions.GetColorString(r, g, b, a);
13148 }
13149 //----------------------------------------------------------------
13150 //------------------------- LiquidType
13151
13152 override void SetLiquidType(int value, bool allow_client = false)
13153 {
13154 if (!IsServerCheck(allow_client))
13155 return;
13156
13157 int old = m_VarLiquidType;
13158 m_VarLiquidType = value;
13159 OnLiquidTypeChanged(old,value);
13160 SetVariableMask(VARIABLE_LIQUIDTYPE);
13161 }
13162
13163 int GetLiquidTypeInit()
13164 {
13165 return ConfigGetInt("varLiquidTypeInit");
13166 }
13167
13168 override int GetLiquidType()
13169 {
13170 return m_VarLiquidType;
13171 }
13172
13173 protected void OnLiquidTypeChanged(int oldType, int newType)
13174 {
13175 if (newType == LIQUID_NONE && GetIsFrozen())
13176 SetFrozen(false);
13177 }
13178
13180 void UpdateQuickbarShortcutVisibility(PlayerBase player)
13181 {
13182 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13183 }
13184
13185 // -------------------------------------------------------------------------
13187 void OnInventoryEnter(Man player)
13188 {
13189 PlayerBase nplayer;
13190 if (PlayerBase.CastTo(nplayer, player))
13191 {
13192 m_CanPlayImpactSound = true;
13193 //nplayer.OnItemInventoryEnter(this);
13194 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
13195 }
13196 }
13197
13198 // -------------------------------------------------------------------------
13200 void OnInventoryExit(Man player)
13201 {
13202 PlayerBase nplayer;
13203 if (PlayerBase.CastTo(nplayer,player))
13204 {
13205 //nplayer.OnItemInventoryExit(this);
13206 nplayer.SetEnableQuickBarEntityShortcut(this,false);
13207
13208 }
13209
13210 //if (!GetGame().IsDedicatedServer())
13211 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
13212
13213
13214 if (HasEnergyManager())
13215 {
13216 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
13217 }
13218 }
13219
13220 // ADVANCED PLACEMENT EVENTS
13221 override void OnPlacementStarted(Man player)
13222 {
13223 super.OnPlacementStarted(player);
13224
13225 SetTakeable(false);
13226 }
13227
13228 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
13229 {
13230 if (m_AdminLog)
13231 {
13232 m_AdminLog.OnPlacementComplete(player, this);
13233 }
13234
13235 super.OnPlacementComplete(player, position, orientation);
13236 }
13237
13238 //-----------------------------
13239 // AGENT SYSTEM
13240 //-----------------------------
13241 //--------------------------------------------------------------------------
13242 bool ContainsAgent(int agent_id)
13243 {
13244 if (agent_id & m_AttachedAgents)
13245 {
13246 return true;
13247 }
13248 else
13249 {
13250 return false;
13251 }
13252 }
13253
13254 //--------------------------------------------------------------------------
13255 override void RemoveAgent(int agent_id)
13256 {
13257 if (ContainsAgent(agent_id))
13258 {
13259 m_AttachedAgents = ~agent_id & m_AttachedAgents;
13260 }
13261 }
13262
13263 //--------------------------------------------------------------------------
13264 override void RemoveAllAgents()
13265 {
13266 m_AttachedAgents = 0;
13267 }
13268 //--------------------------------------------------------------------------
13269 override void RemoveAllAgentsExcept(int agent_to_keep)
13270 {
13271 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
13272 }
13273 // -------------------------------------------------------------------------
13274 override void InsertAgent(int agent, float count = 1)
13275 {
13276 if (count < 1)
13277 return;
13278 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
13280 }
13281
13283 void TransferAgents(int agents)
13284 {
13286 }
13287
13288 // -------------------------------------------------------------------------
13289 override int GetAgents()
13290 {
13291 return m_AttachedAgents;
13292 }
13293 //----------------------------------------------------------------------
13294
13295 /*int GetContaminationType()
13296 {
13297 int contamination_type;
13298
13299 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
13300 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
13301 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
13302 const int DIRTY_MASK = eAgents.WOUND_AGENT;
13303
13304 Edible_Base edible = Edible_Base.Cast(this);
13305 int agents = GetAgents();
13306 if (edible)
13307 {
13308 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
13309 if (profile)
13310 {
13311 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
13312 }
13313 }
13314 if (agents & CONTAMINATED_MASK)
13315 {
13316 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
13317 }
13318 if (agents & POISONED_MASK)
13319 {
13320 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
13321 }
13322 if (agents & NERVE_GAS_MASK)
13323 {
13324 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
13325 }
13326 if (agents & DIRTY_MASK)
13327 {
13328 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
13329 }
13330
13331 return agents;
13332 }*/
13333
13334 // -------------------------------------------------------------------------
13335 bool LoadAgents(ParamsReadContext ctx, int version)
13336 {
13337 if (!ctx.Read(m_AttachedAgents))
13338 return false;
13339 return true;
13340 }
13341 // -------------------------------------------------------------------------
13343 {
13344
13346 }
13347 // -------------------------------------------------------------------------
13348
13350 override void CheckForRoofLimited(float timeTresholdMS = 3000)
13351 {
13352 super.CheckForRoofLimited(timeTresholdMS);
13353
13354 float time = GetGame().GetTime();
13355 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
13356 {
13357 m_PreviousRoofTestTime = time;
13358 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
13359 }
13360 }
13361
13362 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
13363 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
13364 {
13365 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
13366 {
13367 return 0;
13368 }
13369
13370 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
13371 {
13372 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
13373 if (filter)
13374 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
13375 else
13376 return 0;//otherwise return 0 when no filter attached
13377 }
13378
13379 string subclassPath, entryName;
13380
13381 switch (type)
13382 {
13383 case DEF_BIOLOGICAL:
13384 entryName = "biological";
13385 break;
13386 case DEF_CHEMICAL:
13387 entryName = "chemical";
13388 break;
13389 default:
13390 entryName = "biological";
13391 break;
13392 }
13393
13394 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
13395
13396 return GetGame().ConfigGetFloat(subclassPath + entryName);
13397 }
13398
13399
13400
13402 override void EEOnCECreate()
13403 {
13404 if (!IsMagazine())
13406
13408 }
13409
13410
13411 //-------------------------
13412 // OPEN/CLOSE USER ACTIONS
13413 //-------------------------
13415 void Open();
13416 void Close();
13417 bool IsOpen()
13418 {
13419 return true;
13420 }
13421
13422 override bool CanDisplayCargo()
13423 {
13424 return IsOpen();
13425 }
13426
13427
13428 // ------------------------------------------------------------
13429 // CONDITIONS
13430 // ------------------------------------------------------------
13431 override bool CanPutInCargo(EntityAI parent)
13432 {
13433 if (parent)
13434 {
13435 if (parent.IsInherited(DayZInfected))
13436 return true;
13437
13438 if (!parent.IsRuined())
13439 return true;
13440 }
13441
13442 return true;
13443 }
13444
13445 override bool CanPutAsAttachment(EntityAI parent)
13446 {
13447 if (!super.CanPutAsAttachment(parent))
13448 {
13449 return false;
13450 }
13451
13452 if (!IsRuined() && !parent.IsRuined())
13453 {
13454 return true;
13455 }
13456
13457 return false;
13458 }
13459
13460 override bool CanReceiveItemIntoCargo(EntityAI item)
13461 {
13462 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
13463 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
13464 // return false;
13465
13466 return super.CanReceiveItemIntoCargo(item);
13467 }
13468
13469 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
13470 {
13471 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
13472 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
13473 // return false;
13474
13475 GameInventory attachmentInv = attachment.GetInventory();
13476 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
13477 {
13478 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13479 return false;
13480 }
13481
13482 InventoryLocation loc = new InventoryLocation();
13483 attachment.GetInventory().GetCurrentInventoryLocation(loc);
13484 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
13485 return false;
13486
13487 return super.CanReceiveAttachment(attachment, slotId);
13488 }
13489
13490 override bool CanReleaseAttachment(EntityAI attachment)
13491 {
13492 if (!super.CanReleaseAttachment(attachment))
13493 return false;
13494
13495 return GetInventory().AreChildrenAccessible();
13496 }
13497
13498 /*override bool CanLoadAttachment(EntityAI attachment)
13499 {
13500 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
13501 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
13502 // return false;
13503
13504 GameInventory attachmentInv = attachment.GetInventory();
13505 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
13506 {
13507 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
13508 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
13509
13510 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
13511 return false;
13512 }
13513
13514 return super.CanLoadAttachment(attachment);
13515 }*/
13516
13517 // Plays muzzle flash particle effects
13518 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
13519 {
13520 int id = muzzle_owner.GetMuzzleID();
13521 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
13522
13523 if (WPOF_array)
13524 {
13525 for (int i = 0; i < WPOF_array.Count(); i++)
13526 {
13527 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
13528
13529 if (WPOF)
13530 {
13531 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
13532 }
13533 }
13534 }
13535 }
13536
13537 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
13538 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
13539 {
13540 int id = muzzle_owner.GetMuzzleID();
13541 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
13542
13543 if (WPOBE_array)
13544 {
13545 for (int i = 0; i < WPOBE_array.Count(); i++)
13546 {
13547 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
13548
13549 if (WPOBE)
13550 {
13551 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13552 }
13553 }
13554 }
13555 }
13556
13557 // Plays all weapon overheating particles
13558 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
13559 {
13560 int id = muzzle_owner.GetMuzzleID();
13561 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13562
13563 if (WPOOH_array)
13564 {
13565 for (int i = 0; i < WPOOH_array.Count(); i++)
13566 {
13567 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13568
13569 if (WPOOH)
13570 {
13571 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13572 }
13573 }
13574 }
13575 }
13576
13577 // Updates all weapon overheating particles
13578 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
13579 {
13580 int id = muzzle_owner.GetMuzzleID();
13581 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13582
13583 if (WPOOH_array)
13584 {
13585 for (int i = 0; i < WPOOH_array.Count(); i++)
13586 {
13587 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13588
13589 if (WPOOH)
13590 {
13591 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13592 }
13593 }
13594 }
13595 }
13596
13597 // Stops overheating particles
13598 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
13599 {
13600 int id = muzzle_owner.GetMuzzleID();
13601 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13602
13603 if (WPOOH_array)
13604 {
13605 for (int i = 0; i < WPOOH_array.Count(); i++)
13606 {
13607 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13608
13609 if (WPOOH)
13610 {
13611 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13612 }
13613 }
13614 }
13615 }
13616
13617 //----------------------------------------------------------------
13618 //Item Behaviour - unified approach
13619 override bool IsHeavyBehaviour()
13620 {
13621 if (m_ItemBehaviour == 0)
13622 {
13623 return true;
13624 }
13625
13626 return false;
13627 }
13628
13629 override bool IsOneHandedBehaviour()
13630 {
13631 if (m_ItemBehaviour == 1)
13632 {
13633 return true;
13634 }
13635
13636 return false;
13637 }
13638
13639 override bool IsTwoHandedBehaviour()
13640 {
13641 if (m_ItemBehaviour == 2)
13642 {
13643 return true;
13644 }
13645
13646 return false;
13647 }
13648
13649 bool IsDeployable()
13650 {
13651 return false;
13652 }
13653
13655 float GetDeployTime()
13656 {
13657 return UATimeSpent.DEFAULT_DEPLOY;
13658 }
13659
13660
13661 //----------------------------------------------------------------
13662 // Item Targeting (User Actions)
13663 override void SetTakeable(bool pState)
13664 {
13665 m_IsTakeable = pState;
13666 SetSynchDirty();
13667 }
13668
13669 override bool IsTakeable()
13670 {
13671 return m_IsTakeable;
13672 }
13673
13674 // For cases where we want to show object widget which cant be taken to hands
13676 {
13677 return false;
13678 }
13679
13681 protected void PreLoadSoundAttachmentType()
13682 {
13683 string att_type = "None";
13684
13685 if (ConfigIsExisting("soundAttType"))
13686 {
13687 att_type = ConfigGetString("soundAttType");
13688 }
13689
13690 m_SoundAttType = att_type;
13691 }
13692
13693 override string GetAttachmentSoundType()
13694 {
13695 return m_SoundAttType;
13696 }
13697
13698 //----------------------------------------------------------------
13699 //SOUNDS - ItemSoundHandler
13700 //----------------------------------------------------------------
13701
13702 string GetPlaceSoundset(); // played when deploy starts
13703 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
13704 string GetDeploySoundset(); // played when deploy sucessfully finishes
13705
13707 {
13708 if (!m_ItemSoundHandler)
13710
13711 return m_ItemSoundHandler;
13712 }
13713
13714 // override to initialize sounds
13715 protected void InitItemSounds()
13716 {
13717 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
13718 return;
13719
13721
13722 if (GetPlaceSoundset() != string.Empty)
13723 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
13724
13725 if (GetDeploySoundset() != string.Empty)
13726 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
13727
13728 SoundParameters params = new SoundParameters();
13729 params.m_Loop = true;
13730 if (GetLoopDeploySoundset() != string.Empty)
13731 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
13732 }
13733
13734 // Start sound using ItemSoundHandler
13735 void StartItemSoundServer(int id)
13736 {
13737 if (!GetGame().IsServer())
13738 return;
13739
13740 m_SoundSyncPlay = id;
13741 SetSynchDirty();
13742
13743 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
13745 }
13746
13747 // Stop sound using ItemSoundHandler
13748 void StopItemSoundServer(int id)
13749 {
13750 if (!GetGame().IsServer())
13751 return;
13752
13753 m_SoundSyncStop = id;
13754 SetSynchDirty();
13755
13756 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
13758 }
13759
13760 protected void ClearStartItemSoundServer()
13761 {
13762 m_SoundSyncPlay = 0;
13763 }
13764
13765 protected void ClearStopItemSoundServer()
13766 {
13767 m_SoundSyncStop = 0;
13768 }
13769
13771 void PlayAttachSound(string slot_type)
13772 {
13773 if (!GetGame().IsDedicatedServer())
13774 {
13775 if (ConfigIsExisting("attachSoundSet"))
13776 {
13777 string cfg_path = "";
13778 string soundset = "";
13779 string type_name = GetType();
13780
13781 TStringArray cfg_soundset_array = new TStringArray;
13782 TStringArray cfg_slot_array = new TStringArray;
13783 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13784 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13785
13786 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13787 {
13788 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13789 {
13790 if (cfg_slot_array[i] == slot_type)
13791 {
13792 soundset = cfg_soundset_array[i];
13793 break;
13794 }
13795 }
13796 }
13797
13798 if (soundset != "")
13799 {
13800 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
13801 sound.SetAutodestroy(true);
13802 }
13803 }
13804 }
13805 }
13806
13807 void PlayDetachSound(string slot_type)
13808 {
13809 //TODO - evaluate if needed and devise universal config structure if so
13810 }
13811
13812 void OnApply(PlayerBase player);
13813
13815 {
13816 return 1.0;
13817 };
13818 //returns applicable selection
13819 array<string> GetHeadHidingSelection()
13820 {
13822 }
13823
13825 {
13827 }
13828
13829 WrittenNoteData GetWrittenNoteData() {};
13830
13832 {
13833 SetDynamicPhysicsLifeTime(0.01);
13834 m_ItemBeingDroppedPhys = false;
13835 }
13836
13838 {
13839 array<string> zone_names = new array<string>;
13840 GetDamageZones(zone_names);
13841 for (int i = 0; i < zone_names.Count(); i++)
13842 {
13843 SetHealthMax(zone_names.Get(i),"Health");
13844 }
13845 SetHealthMax("","Health");
13846 }
13847
13849 void SetZoneDamageCEInit()
13850 {
13851 float global_health = GetHealth01("","Health");
13852 array<string> zones = new array<string>;
13853 GetDamageZones(zones);
13854 //set damage of all zones to match global health level
13855 for (int i = 0; i < zones.Count(); i++)
13856 {
13857 SetHealth01(zones.Get(i),"Health",global_health);
13858 }
13859 }
13860
13862 bool IsCoverFaceForShave(string slot_name)
13863 {
13864 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13865 }
13866
13867 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
13868 {
13869 if (!hasRootAsPlayer)
13870 {
13871 if (refParentIB)
13872 {
13873 // parent is wet
13874 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
13875 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13876 // parent has liquid inside
13877 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
13878 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13879 // drying
13880 else if (m_VarWet > m_VarWetMin)
13881 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
13882 }
13883 else
13884 {
13885 // drying on ground or inside non-itembase (car, ...)
13886 if (m_VarWet > m_VarWetMin)
13887 AddWet(-1 * delta * GetDryingIncrement("ground"));
13888 }
13889 }
13890 }
13891
13892 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
13893 {
13895 {
13896 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
13897 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
13898 {
13899 float heatPermCoef = 1.0;
13900 EntityAI ent = this;
13901 while (ent)
13902 {
13903 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13904 ent = ent.GetHierarchyParent();
13905 }
13906
13907 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13908 }
13909 }
13910 }
13911
13912 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
13913 {
13914 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
13915 EntityAI parent = GetHierarchyParent();
13916 if (!parent)
13917 {
13918 hasParent = false;
13919 hasRootAsPlayer = false;
13920 }
13921 else
13922 {
13923 hasParent = true;
13924 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13925 refParentIB = ItemBase.Cast(parent);
13926 }
13927 }
13928
13929 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
13930 {
13931 // this is stub, implemented on Edible_Base
13932 }
13933
13934 bool CanDecay()
13935 {
13936 // return true used on selected food clases so they can decay
13937 return false;
13938 }
13939
13940 protected bool CanProcessDecay()
13941 {
13942 // this is stub, implemented on Edible_Base class
13943 // used to determine whether it is still necessary for the food to decay
13944 return false;
13945 }
13946
13947 protected bool CanHaveWetness()
13948 {
13949 // return true used on selected items that have a wetness effect
13950 return false;
13951 }
13952
13954 bool CanBeConsumed(ConsumeConditionData data = null)
13955 {
13956 return !GetIsFrozen() && IsOpen();
13957 }
13958
13959 override void ProcessVariables()
13960 {
13961 bool hasParent = false, hasRootAsPlayer = false;
13962 ItemBase refParentIB;
13963
13964 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
13965 bool foodDecay = g_Game.IsFoodDecayEnabled();
13966
13967 if (wwtu || foodDecay)
13968 {
13969 bool processWetness = wwtu && CanHaveWetness();
13970 bool processTemperature = wwtu && CanHaveTemperature();
13971 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
13972
13973 if (processWetness || processTemperature || processDecay)
13974 {
13975 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
13976
13977 if (processWetness)
13978 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13979
13980 if (processTemperature)
13981 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13982
13983 if (processDecay)
13984 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13985 }
13986 }
13987 }
13988
13991 {
13992 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
13993 }
13994
13995 override float GetTemperatureFreezeThreshold()
13996 {
13998 return Liquid.GetFreezeThreshold(GetLiquidType());
13999
14000 return super.GetTemperatureFreezeThreshold();
14001 }
14002
14003 override float GetTemperatureThawThreshold()
14004 {
14006 return Liquid.GetThawThreshold(GetLiquidType());
14007
14008 return super.GetTemperatureThawThreshold();
14009 }
14010
14011 override float GetItemOverheatThreshold()
14012 {
14014 return Liquid.GetBoilThreshold(GetLiquidType());
14015
14016 return super.GetItemOverheatThreshold();
14017 }
14018
14019 override float GetTemperatureFreezeTime()
14020 {
14021 if (HasQuantity())
14022 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
14023
14024 return super.GetTemperatureFreezeTime();
14025 }
14026
14027 override float GetTemperatureThawTime()
14028 {
14029 if (HasQuantity())
14030 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
14031
14032 return super.GetTemperatureThawTime();
14033 }
14034
14036 void AffectLiquidContainerOnFill(int liquid_type, float amount);
14038 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
14039
14040 bool IsCargoException4x3(EntityAI item)
14041 {
14042 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
14043 }
14044
14046 {
14047 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
14048 }
14049
14051 void AddLightSourceItem(ItemBase lightsource)
14052 {
14053 m_LightSourceItem = lightsource;
14054 }
14055
14057 {
14058 m_LightSourceItem = null;
14059 }
14060
14062 {
14063 return m_LightSourceItem;
14064 }
14065
14067 array<int> GetValidFinishers()
14068 {
14069 return null;
14070 }
14071
14073 bool GetActionWidgetOverride(out typename name)
14074 {
14075 return false;
14076 }
14077
14078 bool PairWithDevice(notnull ItemBase otherDevice)
14079 {
14080 if (GetGame().IsServer())
14081 {
14082 ItemBase explosive = otherDevice;
14084 if (!trg)
14085 {
14086 trg = RemoteDetonatorTrigger.Cast(otherDevice);
14087 explosive = this;
14088 }
14089
14090 explosive.PairRemote(trg);
14091 trg.SetControlledDevice(explosive);
14092
14093 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
14094 trg.SetPersistentPairID(persistentID);
14095 explosive.SetPersistentPairID(persistentID);
14096
14097 return true;
14098 }
14099 return false;
14100 }
14101
14103 float GetBaitEffectivity()
14104 {
14105 float ret = 1.0;
14106 if (HasQuantity())
14107 ret *= GetQuantityNormalized();
14108 ret *= GetHealth01();
14109
14110 return ret;
14111 }
14112
14113 #ifdef DEVELOPER
14114 override void SetDebugItem()
14115 {
14116 super.SetDebugItem();
14117 _itemBase = this;
14118 }
14119
14120 override string GetDebugText()
14121 {
14122 string text = super.GetDebugText();
14123
14124 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
14125 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
14126
14127 return text;
14128 }
14129 #endif
14130
14131 bool CanBeUsedForSuicide()
14132 {
14133 return true;
14134 }
14135
14137 //DEPRECATED BELOW
14139 // Backwards compatibility
14140 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
14141 {
14142 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
14143 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
14144 }
14145
14146 // replaced by ItemSoundHandler
14147 protected EffectSound m_SoundDeployFinish;
14148 protected EffectSound m_SoundPlace;
14149 protected EffectSound m_DeployLoopSoundEx;
14150 protected EffectSound m_SoundDeploy;
14151 bool m_IsPlaceSound;
14152 bool m_IsDeploySound;
14154
14155 string GetDeployFinishSoundset();
14156 void PlayDeploySound();
14157 void PlayDeployFinishSound();
14158 void PlayPlaceSound();
14159 void PlayDeployLoopSoundEx();
14160 void StopDeployLoopSoundEx();
14161 void SoundSynchRemoteReset();
14162 void SoundSynchRemote();
14163 bool UsesGlobalDeploy(){return false;}
14164 bool CanPlayDeployLoopSound(){return false;}
14166 bool IsPlaceSound(){return m_IsPlaceSound;}
14167 bool IsDeploySound(){return m_IsDeploySound;}
14168 void SetIsPlaceSound(bool is_place_sound);
14169 void SetIsDeploySound(bool is_deploy_sound);
14170}
14171
14172EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
14173{
14174 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
14175 if (entity)
14176 {
14177 bool is_item = entity.IsInherited(ItemBase);
14178 if (is_item && full_quantity)
14179 {
14180 ItemBase item = ItemBase.Cast(entity);
14181 item.SetQuantity(item.GetQuantityInit());
14182 }
14183 }
14184 else
14185 {
14186 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
14187 return NULL;
14188 }
14189 return entity;
14190}
14191
14192void SetupSpawnedItem(ItemBase item, float health, float quantity)
14193{
14194 if (item)
14195 {
14196 if (health > 0)
14197 item.SetHealth("", "", health);
14198
14199 if (item.CanHaveTemperature())
14200 {
14201 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
14202 if (item.CanFreeze())
14203 item.SetFrozen(false);
14204 }
14205
14206 if (item.HasEnergyManager())
14207 {
14208 if (quantity >= 0)
14209 {
14210 item.GetCompEM().SetEnergy0To1(quantity);
14211 }
14212 else
14213 {
14214 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
14215 }
14216 }
14217 else if (item.IsMagazine())
14218 {
14219 Magazine mag = Magazine.Cast(item);
14220 if (quantity >= 0)
14221 {
14222 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
14223 }
14224 else
14225 {
14226 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
14227 }
14228
14229 }
14230 else
14231 {
14232 if (quantity >= 0)
14233 {
14234 item.SetQuantityNormalized(quantity, false);
14235 }
14236 else
14237 {
14238 item.SetQuantity(Math.AbsFloat(quantity));
14239 }
14240
14241 }
14242 }
14243}
14244
14245#ifdef DEVELOPER
14246ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
14247#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()

Используется в Entity::SetTemperatureEx().