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

◆ UsesGlobalDeploy()

bool SpawnItemOnLocation::UsesGlobalDeploy ( )
protected

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

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