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

◆ GetValidFinishers()

array< int > SpawnItemOnLocation::GetValidFinishers ( )
protected

returns an array of possible finishers

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

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