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

◆ GetActionWidgetOverride()

bool SpawnItemOnLocation::GetActionWidgetOverride ( out typename name)
protected

If we need a different (handheld)item action widget displayed, the logic goes in here.

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

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