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

◆ AddLightSourceItem()

void SpawnItemOnLocation::AddLightSourceItem ( ItemBase lightsource)
protected

Adds a light source child.

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

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