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

◆ GetBaitEffectivity()

float SpawnItemOnLocation::GetBaitEffectivity ( )
protected

generic effectivity as a bait for animal catching

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

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