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

◆ EEDelete()

override void SpawnItemOnLocation::EEDelete ( EntityAI parent)
private

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

6165{
6166 override bool CanPutAsAttachment(EntityAI parent)
6167 {
6168 return true;
6169 }
6170};
6171
6172//const bool QUANTITY_DEBUG_REMOVE_ME = false;
6173
6174class ItemBase extends InventoryItem
6175{
6179
6181
6182 static int m_DebugActionsMask;
6184 // ============================================
6185 // Variable Manipulation System
6186 // ============================================
6187 // Quantity
6188
6189 float m_VarQuantity;
6190 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
6192 int m_VarQuantityMin;
6193 int m_VarQuantityMax;
6194 int m_Count;
6195 float m_VarStackMax;
6196 float m_StoreLoadedQuantity = float.LOWEST;
6197 // Wet
6198 float m_VarWet;
6199 float m_VarWetPrev;//for client to know wetness changed during synchronization
6200 float m_VarWetInit;
6201 float m_VarWetMin;
6202 float m_VarWetMax;
6203 // Cleanness
6204 int m_Cleanness;
6205 int m_CleannessInit;
6206 int m_CleannessMin;
6207 int m_CleannessMax;
6208 // impact sounds
6210 bool m_CanPlayImpactSound = true;
6211 float m_ImpactSpeed;
6213 //
6214 float m_HeatIsolation;
6215 float m_ItemModelLength;
6216 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
6218 int m_VarLiquidType;
6219 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
6220 int m_QuickBarBonus;
6221 bool m_IsBeingPlaced;
6222 bool m_IsHologram;
6223 bool m_IsTakeable;
6224 bool m_ThrowItemOnDrop;
6227 bool m_FixDamageSystemInit = false; //can be changed on storage version check
6228 bool can_this_be_combined; //Check if item can be combined
6229 bool m_CanThisBeSplit; //Check if item can be split
6230 bool m_IsStoreLoad = false;
6231 bool m_CanShowQuantity;
6232 bool m_HasQuantityBar;
6233 protected bool m_CanBeDigged;
6234 protected bool m_IsResultOfSplit
6235
6236 string m_SoundAttType;
6237 // items color variables
6242 //-------------------------------------------------------
6243
6244 // light source managing
6246
6250
6251 //==============================================
6252 // agent system
6253 private int m_AttachedAgents;
6254
6256 void TransferModifiers(PlayerBase reciever);
6257
6258
6259 // Weapons & suppressors particle effects
6264 static int m_LastRegisteredWeaponID = 0;
6265
6266 // Overheating effects
6268 float m_OverheatingShots;
6269 ref Timer m_CheckOverheating;
6270 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
6271 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
6272 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
6273 ref array <ref OverheatingParticle> m_OverheatingParticles;
6274
6276 protected bool m_HideSelectionsBySlot;
6277
6278 // Admin Log
6279 PluginAdminLog m_AdminLog;
6280
6281 // misc
6282 ref Timer m_PhysDropTimer;
6283
6284 // Attachment Locking variables
6285 ref array<int> m_CompatibleLocks;
6286 protected int m_LockType;
6287 protected ref EffectSound m_LockingSound;
6288 protected string m_LockSoundSet;
6289
6290 // ItemSoundHandler
6291 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
6292 protected int m_SoundSyncPlay; // id for sound to play
6293 protected int m_SoundSyncStop; // id for sound to stop
6295
6296 //temperature
6297 private float m_TemperaturePerQuantityWeight;
6298
6299 // -------------------------------------------------------------------------
6300 void ItemBase()
6301 {
6302 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
6306
6307 if (!GetGame().IsDedicatedServer())
6308 {
6309 if (HasMuzzle())
6310 {
6312
6314 {
6316 }
6317 }
6318
6320 m_ActionsInitialize = false;
6321 }
6322
6323 m_OldLocation = null;
6324
6325 if (GetGame().IsServer())
6326 {
6327 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
6328 }
6329
6330 if (ConfigIsExisting("headSelectionsToHide"))
6331 {
6333 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
6334 }
6335
6336 m_HideSelectionsBySlot = false;
6337 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6338 {
6339 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
6340 }
6341
6342 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
6343
6344 m_IsResultOfSplit = false;
6345
6347 }
6348
6349 override void InitItemVariables()
6350 {
6351 super.InitItemVariables();
6352
6353 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
6354 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
6355 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
6356 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
6357 m_VarStackMax = ConfigGetFloat("varStackMax");
6358 m_Count = ConfigGetInt("count");
6359
6360 m_CanShowQuantity = ConfigGetBool("quantityShow");
6361 m_HasQuantityBar = ConfigGetBool("quantityBar");
6362
6363 m_CleannessInit = ConfigGetInt("varCleannessInit");
6365 m_CleannessMin = ConfigGetInt("varCleannessMin");
6366 m_CleannessMax = ConfigGetInt("varCleannessMax");
6367
6368 m_WantPlayImpactSound = false;
6369 m_ImpactSpeed = 0.0;
6370
6371 m_VarWetInit = ConfigGetFloat("varWetInit");
6373 m_VarWetMin = ConfigGetFloat("varWetMin");
6374 m_VarWetMax = ConfigGetFloat("varWetMax");
6375
6376 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
6377 if (IsLiquidContainer() && GetQuantity() != 0)
6379 m_IsBeingPlaced = false;
6380 m_IsHologram = false;
6381 m_IsTakeable = true;
6382 m_CanBeMovedOverride = false;
6386 m_CanBeDigged = ConfigGetBool("canBeDigged");
6387
6388 m_CompatibleLocks = new array<int>();
6389 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
6390 m_LockType = ConfigGetInt("lockType");
6391
6392 //Define if item can be split and set ability to be combined accordingly
6393 m_CanThisBeSplit = false;
6394 can_this_be_combined = false;
6395 if (ConfigIsExisting("canBeSplit"))
6396 {
6397 can_this_be_combined = ConfigGetBool("canBeSplit");
6399 }
6400
6401 m_ItemBehaviour = -1;
6402 if (ConfigIsExisting("itemBehaviour"))
6403 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
6404
6405 //RegisterNetSyncVariableInt("m_VariablesMask");
6406 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
6407 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
6408 RegisterNetSyncVariableInt("m_VarLiquidType");
6409 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6410
6411 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6412 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6413 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6414
6415 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6416 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6417 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6418 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6419
6420 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6421 RegisterNetSyncVariableBool("m_IsTakeable");
6422 RegisterNetSyncVariableBool("m_IsHologram");
6423
6424 InitItemSounds();
6426 {
6427 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
6428 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
6429 }
6430
6431 m_LockSoundSet = ConfigGetString("lockSoundSet");
6432
6434 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6435 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
6436
6437 }
6438
6439 override int GetQuickBarBonus()
6440 {
6441 return m_QuickBarBonus;
6442 }
6443
6444 void InitializeActions()
6445 {
6447 if (!m_InputActionMap)
6448 {
6450 m_InputActionMap = iam;
6451 SetActions();
6453 }
6454 }
6455
6456 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
6457 {
6459 {
6460 m_ActionsInitialize = true;
6462 }
6463
6464 actions = m_InputActionMap.Get(action_input_type);
6465 }
6466
6467 void SetActions()
6468 {
6469 AddAction(ActionTakeItem);
6470 AddAction(ActionTakeItemToHands);
6471 AddAction(ActionWorldCraft);
6473 AddAction(ActionAttachWithSwitch);
6474 }
6475
6476 void SetActionAnimOverrides(); // Override action animation for specific item
6477
6478 void AddAction(typename actionName)
6479 {
6480 ActionBase action = ActionManagerBase.GetAction(actionName);
6481
6482 if (!action)
6483 {
6484 Debug.LogError("Action " + actionName + " dosn't exist!");
6485 return;
6486 }
6487
6488 typename ai = action.GetInputType();
6489 if (!ai)
6490 {
6491 m_ActionsInitialize = false;
6492 return;
6493 }
6494
6495 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
6496 if (!action_array)
6497 {
6498 action_array = new array<ActionBase_Basic>;
6499 m_InputActionMap.Insert(ai, action_array);
6500 }
6501 if (LogManager.IsActionLogEnable())
6502 {
6503 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
6504 }
6505
6506 if (action_array.Find(action) != -1)
6507 {
6508 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
6509 }
6510 else
6511 {
6512 action_array.Insert(action);
6513 }
6514 }
6515
6516 void RemoveAction(typename actionName)
6517 {
6518 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
6519 ActionBase action = player.GetActionManager().GetAction(actionName);
6520 typename ai = action.GetInputType();
6521 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
6522
6523 if (action_array)
6524 {
6525 action_array.RemoveItem(action);
6526 }
6527 }
6528
6529 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
6530 // Set -1 for params which should stay in default state
6531 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
6532 {
6533 ActionOverrideData overrideData = new ActionOverrideData();
6534 overrideData.m_CommandUID = commandUID;
6535 overrideData.m_CommandUIDProne = commandUIDProne;
6536 overrideData.m_StanceMask = stanceMask;
6537
6538 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
6539 if (!actionMap) // create new map of action > overidables map
6540 {
6541 actionMap = new TActionAnimOverrideMap();
6542 m_ItemActionOverrides.Insert(action, actionMap);
6543 }
6544
6545 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
6546
6547 }
6548
6549 void OnItemInHandsPlayerSwimStart(PlayerBase player);
6550
6551 ScriptedLightBase GetLight();
6552
6553 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
6554 void LoadParticleConfigOnFire(int id)
6555 {
6556 if (!m_OnFireEffect)
6558
6561
6562 string config_to_search = "CfgVehicles";
6563 string muzzle_owner_config;
6564
6565 if (!m_OnFireEffect.Contains(id))
6566 {
6567 if (IsInherited(Weapon))
6568 config_to_search = "CfgWeapons";
6569
6570 muzzle_owner_config = config_to_search + " " + GetType() + " ";
6571
6572 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6573
6574 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
6575
6576 if (config_OnFire_subclass_count > 0)
6577 {
6578 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6579
6580 for (int i = 0; i < config_OnFire_subclass_count; i++)
6581 {
6582 string particle_class = "";
6583 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
6584 string config_OnFire_entry = config_OnFire_class + particle_class;
6585 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6586 WPOF_array.Insert(WPOF);
6587 }
6588
6589
6590 m_OnFireEffect.Insert(id, WPOF_array);
6591 }
6592 }
6593
6594 if (!m_OnBulletCasingEjectEffect.Contains(id))
6595 {
6596 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
6597 muzzle_owner_config = config_to_search + " " + GetType() + " ";
6598
6599 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6600
6601 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6602
6603 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6604 {
6605 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6606
6607 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6608 {
6609 string particle_class2 = "";
6610 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6611 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6612 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6613 WPOBE_array.Insert(WPOBE);
6614 }
6615
6616
6617 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
6618 }
6619 }
6620 }
6621
6622 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
6624 {
6627
6628 if (!m_OnOverheatingEffect.Contains(id))
6629 {
6630 string config_to_search = "CfgVehicles";
6631
6632 if (IsInherited(Weapon))
6633 config_to_search = "CfgWeapons";
6634
6635 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
6636 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6637
6638 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
6639 {
6640
6641 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
6642
6644 {
6645 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
6646 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6647 Error(error);
6648 return;
6649 }
6650
6651 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
6652 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
6653
6654
6655
6656 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
6657 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6658
6659 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6660 {
6661 string particle_class = "";
6662 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6663 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6664 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
6665
6666 if (entry_type == CT_CLASS)
6667 {
6668 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6669 WPOOH_array.Insert(WPOF);
6670 }
6671 }
6672
6673
6674 m_OnOverheatingEffect.Insert(id, WPOOH_array);
6675 }
6676 }
6677 }
6678
6679 float GetOverheatingValue()
6680 {
6681 return m_OverheatingShots;
6682 }
6683
6684 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
6685 {
6686 if (m_MaxOverheatingValue > 0)
6687 {
6689
6690 if (!m_CheckOverheating)
6692
6694 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
6695
6696 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6697 }
6698 }
6699
6700 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6701 {
6703 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6704
6706 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6707
6709 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6710
6712 {
6714 }
6715 }
6716
6718 {
6720 }
6721
6722 void OnOverheatingDecay()
6723 {
6724 if (m_MaxOverheatingValue > 0)
6725 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
6726 else
6728
6729 if (m_OverheatingShots <= 0)
6730 {
6733 }
6734 else
6735 {
6736 if (!m_CheckOverheating)
6738
6740 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
6741 }
6742
6743 CheckOverheating(this, "", this);
6744 }
6745
6746 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6747 {
6749 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
6750 }
6751
6752 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6753 {
6755 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
6757 }
6758
6759 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
6760 {
6762 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6763 }
6764
6765 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
6766 {
6768 m_OverheatingParticles = new array<ref OverheatingParticle>;
6769
6770 OverheatingParticle OP = new OverheatingParticle();
6771 OP.RegisterParticle(p);
6772 OP.SetOverheatingLimitMin(min_heat_coef);
6773 OP.SetOverheatingLimitMax(max_heat_coef);
6774 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
6775
6776 m_OverheatingParticles.Insert(OP);
6777 }
6778
6779 float GetOverheatingCoef()
6780 {
6781 if (m_MaxOverheatingValue > 0)
6783
6784 return -1;
6785 }
6786
6788 {
6790 {
6791 float overheat_coef = GetOverheatingCoef();
6792 int count = m_OverheatingParticles.Count();
6793
6794 for (int i = count; i > 0; --i)
6795 {
6796 int id = i - 1;
6797 OverheatingParticle OP = m_OverheatingParticles.Get(id);
6798 Particle p = OP.GetParticle();
6799
6800 float overheat_min = OP.GetOverheatingLimitMin();
6801 float overheat_max = OP.GetOverheatingLimitMax();
6802
6803 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6804 {
6805 if (p)
6806 {
6807 p.Stop();
6808 OP.RegisterParticle(null);
6809 }
6810 }
6811 }
6812 }
6813 }
6814
6816 {
6818 {
6819 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
6820 {
6821 int id = i - 1;
6822 OverheatingParticle OP = m_OverheatingParticles.Get(id);
6823
6824 if (OP)
6825 {
6826 Particle p = OP.GetParticle();
6827
6828 if (p)
6829 {
6830 p.Stop();
6831 }
6832
6833 delete OP;
6834 }
6835 }
6836
6837 m_OverheatingParticles.Clear();
6839 }
6840 }
6841
6843 float GetInfectionChance(int system = 0, Param param = null)
6844 {
6845 return 0.0;
6846 }
6847
6848
6849 float GetDisinfectQuantity(int system = 0, Param param1 = null)
6850 {
6851 return 250;//default value
6852 }
6853
6854 float GetFilterDamageRatio()
6855 {
6856 return 0;
6857 }
6858
6860 bool HasMuzzle()
6861 {
6862 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
6863 return true;
6864
6865 return false;
6866 }
6867
6869 int GetMuzzleID()
6870 {
6871 if (!m_WeaponTypeToID)
6873
6874 if (m_WeaponTypeToID.Contains(GetType()))
6875 {
6876 return m_WeaponTypeToID.Get(GetType());
6877 }
6878 else
6879 {
6880 // Register new weapon ID
6882 }
6883
6885 }
6886
6893 {
6894 return -1;
6895 }
6896
6897
6898
6899 // -------------------------------------------------------------------------
6900 void ~ItemBase()
6901 {
6902 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
6903 {
6904 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
6905 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6906
6907 if (r_index >= 0)
6908 {
6909 InventoryLocation r_il = new InventoryLocation;
6910 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6911
6912 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6913 int r_type = r_il.GetType();
6914 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
6915 {
6916 r_il.GetParent().GetOnReleaseLock().Invoke(this);
6917 }
6918 else if (r_type == InventoryLocationType.ATTACHMENT)
6919 {
6920 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
6921 }
6922
6923 }
6924
6925 player.GetHumanInventory().ClearUserReservedLocation(this);
6926 }
6927
6928 if (m_LockingSound)
6929 SEffectManager.DestroyEffect(m_LockingSound);
6930 }
6931
6932
6933
6934 // -------------------------------------------------------------------------
6935 static int GetDebugActionsMask()
6936 {
6937 return ItemBase.m_DebugActionsMask;
6938 }
6939
6940 static bool HasDebugActionsMask(int mask)
6941 {
6942 return ItemBase.m_DebugActionsMask & mask;
6943 }
6944
6945 static void SetDebugActionsMask(int mask)
6946 {
6947 ItemBase.m_DebugActionsMask = mask;
6948 }
6949
6950 static void AddDebugActionsMask(int mask)
6951 {
6952 ItemBase.m_DebugActionsMask |= mask;
6953 }
6954
6955 static void RemoveDebugActionsMask(int mask)
6956 {
6957 ItemBase.m_DebugActionsMask &= ~mask;
6958 }
6959
6960 static void ToggleDebugActionsMask(int mask)
6961 {
6962 if (HasDebugActionsMask(mask))
6963 {
6965 }
6966 else
6967 {
6968 AddDebugActionsMask(mask);
6969 }
6970 }
6971
6972 // -------------------------------------------------------------------------
6973 void SetCEBasedQuantity()
6974 {
6975 if (GetEconomyProfile())
6976 {
6977 float q_max = GetEconomyProfile().GetQuantityMax();
6978 if (q_max > 0)
6979 {
6980 float q_min = GetEconomyProfile().GetQuantityMin();
6981 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6982
6983 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
6984 {
6985 ComponentEnergyManager comp = GetCompEM();
6986 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
6987 {
6988 comp.SetEnergy0To1(quantity_randomized);
6989 }
6990 }
6991 else if (HasQuantity())
6992 {
6993 SetQuantityNormalized(quantity_randomized, false);
6994 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
6995 }
6996
6997 }
6998 }
6999 }
7000
7002 void LockToParent()
7003 {
7004 EntityAI parent = GetHierarchyParent();
7005
7006 if (parent)
7007 {
7008 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7009 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7010 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
7011 }
7012 }
7013
7015 void UnlockFromParent()
7016 {
7017 EntityAI parent = GetHierarchyParent();
7018
7019 if (parent)
7020 {
7021 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7022 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7023 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
7024 }
7025 }
7026
7027 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
7028 {
7029 /*
7030 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
7031 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
7032 */
7033 ItemBase item2 = ItemBase.Cast(entity2);
7034
7035 if (GetGame().IsClient())
7036 {
7037 if (ScriptInputUserData.CanStoreInputUserData())
7038 {
7039 ScriptInputUserData ctx = new ScriptInputUserData;
7041 ctx.Write(-1);
7042 ItemBase i1 = this; // @NOTE: workaround for correct serialization
7043 ctx.Write(i1);
7044 ctx.Write(item2);
7045 ctx.Write(use_stack_max);
7046 ctx.Write(-1);
7047 ctx.Send();
7048
7049 if (IsCombineAll(item2, use_stack_max))
7050 {
7051 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7052 }
7053 }
7054 }
7055 else if (!GetGame().IsMultiplayer())
7056 {
7057 CombineItems(item2, use_stack_max);
7058 }
7059 }
7060
7061 bool IsLiquidPresent()
7062 {
7063 return (GetLiquidType() != 0 && HasQuantity());
7064 }
7065
7066 bool IsLiquidContainer()
7067 {
7068 return m_LiquidContainerMask != 0;
7069 }
7070
7072 {
7073 return m_LiquidContainerMask;
7074 }
7075
7076 bool IsBloodContainer()
7077 {
7078 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
7079 return false;
7080 }
7081
7082 bool IsNVG()
7083 {
7084 return false;
7085 }
7086
7089 bool IsExplosive()
7090 {
7091 return false;
7092 }
7093
7095 {
7096 return "";
7097 }
7098
7100
7101 bool IsLightSource()
7102 {
7103 return false;
7104 }
7105
7107 {
7108 return true;
7109 }
7110
7111 //--- ACTION CONDITIONS
7112 //direction
7113 bool IsFacingPlayer(PlayerBase player, string selection)
7114 {
7115 return true;
7116 }
7117
7118 bool IsPlayerInside(PlayerBase player, string selection)
7119 {
7120 return true;
7121 }
7122
7123 override bool CanObstruct()
7124 {
7125 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
7126 return !player || !IsPlayerInside(player, "");
7127 }
7128
7129 override bool IsBeingPlaced()
7130 {
7131 return m_IsBeingPlaced;
7132 }
7133
7134 void SetIsBeingPlaced(bool is_being_placed)
7135 {
7136 m_IsBeingPlaced = is_being_placed;
7137 if (!is_being_placed)
7139 SetSynchDirty();
7140 }
7141
7142 //server-side
7143 void OnEndPlacement() {}
7144
7145 override bool IsHologram()
7146 {
7147 return m_IsHologram;
7148 }
7149
7150 bool CanBeDigged()
7151 {
7152 return m_CanBeDigged;
7153 }
7154
7156 {
7157 return 1;
7158 }
7159
7160 bool CanMakeGardenplot()
7161 {
7162 return false;
7163 }
7164
7165 void SetIsHologram(bool is_hologram)
7166 {
7167 m_IsHologram = is_hologram;
7168 SetSynchDirty();
7169 }
7170 /*
7171 protected float GetNutritionalEnergy()
7172 {
7173 Edible_Base edible = Edible_Base.Cast(this);
7174 return edible.GetFoodEnergy();
7175 }
7176
7177 protected float GetNutritionalWaterContent()
7178 {
7179 Edible_Base edible = Edible_Base.Cast(this);
7180 return edible.GetFoodWater();
7181 }
7182
7183 protected float GetNutritionalIndex()
7184 {
7185 Edible_Base edible = Edible_Base.Cast(this);
7186 return edible.GetFoodNutritionalIndex();
7187 }
7188
7189 protected float GetNutritionalFullnessIndex()
7190 {
7191 Edible_Base edible = Edible_Base.Cast(this);
7192 return edible.GetFoodTotalVolume();
7193 }
7194
7195 protected float GetNutritionalToxicity()
7196 {
7197 Edible_Base edible = Edible_Base.Cast(this);
7198 return edible.GetFoodToxicity();
7199
7200 }
7201 */
7202
7203
7204 // -------------------------------------------------------------------------
7205 override void OnMovedInsideCargo(EntityAI container)
7206 {
7207 super.OnMovedInsideCargo(container);
7208
7209 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7210 }
7211
7212 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7213 {
7214 super.EEItemLocationChanged(oldLoc,newLoc);
7215
7216 PlayerBase new_player = null;
7217 PlayerBase old_player = null;
7218
7219 if (newLoc.GetParent())
7220 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7221
7222 if (oldLoc.GetParent())
7223 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7224
7225 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
7226 {
7227 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
7228
7229 if (r_index >= 0)
7230 {
7231 InventoryLocation r_il = new InventoryLocation;
7232 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7233
7234 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7235 int r_type = r_il.GetType();
7236 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
7237 {
7238 r_il.GetParent().GetOnReleaseLock().Invoke(this);
7239 }
7240 else if (r_type == InventoryLocationType.ATTACHMENT)
7241 {
7242 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
7243 }
7244
7245 }
7246 }
7247
7248 if (newLoc.GetType() == InventoryLocationType.HANDS)
7249 {
7250 if (new_player)
7251 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
7252
7253 if (new_player == old_player)
7254 {
7255
7256 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7257 {
7258 if (oldLoc.GetType() == InventoryLocationType.CARGO)
7259 {
7260 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7261 {
7262 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7263 }
7264 }
7265 else
7266 {
7267 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7268 }
7269 }
7270
7271 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7272 {
7273 int type = oldLoc.GetType();
7274 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
7275 {
7276 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7277 }
7278 else if (type == InventoryLocationType.ATTACHMENT)
7279 {
7280 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7281 }
7282 }
7283 if (!m_OldLocation)
7284 {
7285 m_OldLocation = new InventoryLocation;
7286 }
7287 m_OldLocation.Copy(oldLoc);
7288 }
7289 else
7290 {
7291 if (m_OldLocation)
7292 {
7293 m_OldLocation.Reset();
7294 }
7295 }
7296
7298 }
7299 else
7300 {
7301 if (new_player)
7302 {
7303 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7304 if (res_index >= 0)
7305 {
7306 InventoryLocation il = new InventoryLocation;
7307 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
7308 ItemBase it = ItemBase.Cast(il.GetItem());
7309 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
7310 int rel_type = il.GetType();
7311 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
7312 {
7313 il.GetParent().GetOnReleaseLock().Invoke(it);
7314 }
7315 else if (rel_type == InventoryLocationType.ATTACHMENT)
7316 {
7317 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
7318 }
7319 //it.GetOnReleaseLock().Invoke(it);
7320 }
7321 }
7322 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
7323 {
7324 //ThrowPhysically(old_player, vector.Zero);
7325 m_ThrowItemOnDrop = false;
7326 }
7327
7328 if (m_OldLocation)
7329 {
7330 m_OldLocation.Reset();
7331 }
7332 }
7333 }
7334
7335 override void EOnContact(IEntity other, Contact extra)
7336 {
7338 {
7339 int liquidType = -1;
7340 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
7341 if (impactSpeed > 0.0)
7342 {
7343 m_ImpactSpeed = impactSpeed;
7344 #ifndef SERVER
7345 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
7346 #else
7347 m_WantPlayImpactSound = true;
7348 SetSynchDirty();
7349 #endif
7350 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
7351 }
7352 }
7353
7354 #ifdef SERVER
7355 if (GetCompEM() && GetCompEM().IsPlugged())
7356 {
7357 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
7358 GetCompEM().UnplugThis();
7359 }
7360 #endif
7361 }
7362
7363 void RefreshPhysics();
7364
7365 override void OnCreatePhysics()
7366 {
7368 }
7369
7370 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7371 {
7372
7373 }
7374 // -------------------------------------------------------------------------
7375 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
7376 {
7377 super.OnItemLocationChanged(old_owner, new_owner);
7378
7379 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7380 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7381
7382 if (!relatedPlayer && playerNew)
7383 relatedPlayer = playerNew;
7384
7385 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7386 {
7387 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
7388 if (actionMgr)
7389 {
7390 ActionBase currentAction = actionMgr.GetRunningAction();
7391 if (currentAction)
7392 currentAction.OnItemLocationChanged(this);
7393 }
7394 }
7395
7396 Man ownerPlayerOld = null;
7397 Man ownerPlayerNew = null;
7398
7399 if (old_owner)
7400 {
7401 if (old_owner.IsMan())
7402 {
7403 ownerPlayerOld = Man.Cast(old_owner);
7404 }
7405 else
7406 {
7407 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7408 }
7409 }
7410 else
7411 {
7412 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
7413 {
7414 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
7415
7416 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
7417 {
7418 GetCompEM().UnplugThis();
7419 }
7420 }
7421 }
7422
7423 if (new_owner)
7424 {
7425 if (new_owner.IsMan())
7426 {
7427 ownerPlayerNew = Man.Cast(new_owner);
7428 }
7429 else
7430 {
7431 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7432 }
7433 }
7434
7435 if (ownerPlayerOld != ownerPlayerNew)
7436 {
7437 if (ownerPlayerOld)
7438 {
7439 array<EntityAI> subItemsExit = new array<EntityAI>;
7440 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
7441 for (int i = 0; i < subItemsExit.Count(); i++)
7442 {
7443 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
7444 itemExit.OnInventoryExit(ownerPlayerOld);
7445 }
7446 }
7447
7448 if (ownerPlayerNew)
7449 {
7450 array<EntityAI> subItemsEnter = new array<EntityAI>;
7451 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
7452 for (int j = 0; j < subItemsEnter.Count(); j++)
7453 {
7454 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
7455 itemEnter.OnInventoryEnter(ownerPlayerNew);
7456 }
7457 }
7458 }
7459 else if (ownerPlayerNew != null)
7460 {
7461 PlayerBase nplayer;
7462 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7463 {
7464 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7465 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
7466 for (int k = 0; k < subItemsUpdate.Count(); k++)
7467 {
7468 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
7469 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7470 }
7471 }
7472 }
7473
7474 if (old_owner)
7475 old_owner.OnChildItemRemoved(this);
7476 if (new_owner)
7477 new_owner.OnChildItemReceived(this);
7478 }
7479
7480 // -------------------------------------------------------------------------------
7481 override void EEDelete(EntityAI parent)
7482 {
7483 super.EEDelete(parent);
7484 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7485 if (player)
7486 {
7487 OnInventoryExit(player);
7488
7489 if (player.IsAlive())
7490 {
7491 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7492 if (r_index >= 0)
7493 {
7494 InventoryLocation r_il = new InventoryLocation;
7495 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7496
7497 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7498 int r_type = r_il.GetType();
7499 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
7500 {
7501 r_il.GetParent().GetOnReleaseLock().Invoke(this);
7502 }
7503 else if (r_type == InventoryLocationType.ATTACHMENT)
7504 {
7505 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
7506 }
7507
7508 }
7509
7510 player.RemoveQuickBarEntityShortcut(this);
7511 }
7512 }
7513 }
7514 // -------------------------------------------------------------------------------
7515 override void EEKilled(Object killer)
7516 {
7517 super.EEKilled(killer);
7518
7520 if (killer && killer.IsFireplace() && CanExplodeInFire())
7521 {
7522 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7523 {
7524 if (IsMagazine())
7525 {
7526 if (Magazine.Cast(this).GetAmmoCount() > 0)
7527 {
7528 ExplodeAmmo();
7529 }
7530 }
7531 else
7532 {
7533 Explode(DamageType.EXPLOSION);
7534 }
7535 }
7536 }
7537 }
7538
7539 override void OnWasAttached(EntityAI parent, int slot_id)
7540 {
7541 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7542
7543 super.OnWasAttached(parent, slot_id);
7544
7545 if (HasQuantity())
7546 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
7547
7548 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
7549 }
7550
7551 override void OnWasDetached(EntityAI parent, int slot_id)
7552 {
7553 super.OnWasDetached(parent, slot_id);
7554
7555 if (HasQuantity())
7556 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
7557 }
7558
7559 override string ChangeIntoOnAttach(string slot)
7560 {
7561 int idx;
7562 TStringArray inventory_slots = new TStringArray;
7563 TStringArray attach_types = new TStringArray;
7564
7565 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7566 if (inventory_slots.Count() < 1) //is string
7567 {
7568 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7569 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7570 }
7571 else //is array
7572 {
7573 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7574 }
7575
7576 idx = inventory_slots.Find(slot);
7577 if (idx < 0)
7578 return "";
7579
7580 return attach_types.Get(idx);
7581 }
7582
7583 override string ChangeIntoOnDetach()
7584 {
7585 int idx = -1;
7586 string slot;
7587
7588 TStringArray inventory_slots = new TStringArray;
7589 TStringArray detach_types = new TStringArray;
7590
7591 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7592 if (inventory_slots.Count() < 1) //is string
7593 {
7594 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7595 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7596 }
7597 else //is array
7598 {
7599 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7600 if (detach_types.Count() < 1)
7601 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7602 }
7603
7604 for (int i = 0; i < inventory_slots.Count(); i++)
7605 {
7606 slot = inventory_slots.Get(i);
7607 }
7608
7609 if (slot != "")
7610 {
7611 if (detach_types.Count() == 1)
7612 idx = 0;
7613 else
7614 idx = inventory_slots.Find(slot);
7615 }
7616 if (idx < 0)
7617 return "";
7618
7619 return detach_types.Get(idx);
7620 }
7621
7622 void ExplodeAmmo()
7623 {
7624 //timer
7625 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
7626
7627 //min/max time
7628 float min_time = 1;
7629 float max_time = 3;
7630 float delay = Math.RandomFloat(min_time, max_time);
7631
7632 explode_timer.Run(delay, this, "DoAmmoExplosion");
7633 }
7634
7635 void DoAmmoExplosion()
7636 {
7637 Magazine magazine = Magazine.Cast(this);
7638 int pop_sounds_count = 6;
7639 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7640
7641 //play sound
7642 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7643 string sound_name = pop_sounds[ sound_idx ];
7644 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
7645
7646 //remove ammo count
7647 magazine.ServerAddAmmoCount(-1);
7648
7649 //if condition then repeat -> ExplodeAmmo
7650 float min_temp_to_explode = 100; //min temperature for item to explode
7651
7652 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
7653 {
7654 ExplodeAmmo();
7655 }
7656 }
7657
7658 // -------------------------------------------------------------------------------
7659 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
7660 {
7661 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
7662
7663 const int CHANCE_DAMAGE_CARGO = 4;
7664 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7665 const int CHANCE_DAMAGE_NOTHING = 2;
7666
7667 if (IsClothing() || IsContainer() || IsItemTent())
7668 {
7669 float dmg = damageResult.GetDamage("","Health") * -0.5;
7670 int chances;
7671 int rnd;
7672
7673 if (GetInventory().GetCargo())
7674 {
7675 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7676 rnd = Math.RandomInt(0,chances);
7677
7678 if (rnd < CHANCE_DAMAGE_CARGO)
7679 {
7680 DamageItemInCargo(dmg);
7681 }
7682 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7683 {
7685 }
7686 }
7687 else
7688 {
7689 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7690 rnd = Math.RandomInt(0,chances);
7691
7692 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7693 {
7695 }
7696 }
7697 }
7698 }
7699
7700 bool DamageItemInCargo(float damage)
7701 {
7702 if (GetInventory().GetCargo())
7703 {
7704 int item_count = GetInventory().GetCargo().GetItemCount();
7705 if (item_count > 0)
7706 {
7707 int random_pick = Math.RandomInt(0, item_count);
7708 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
7709 if (!item.IsExplosive())
7710 {
7711 item.AddHealth("","",damage);
7712 return true;
7713 }
7714 }
7715 }
7716 return false;
7717 }
7718
7719 bool DamageItemAttachments(float damage)
7720 {
7721 int attachment_count = GetInventory().AttachmentCount();
7722 if (attachment_count > 0)
7723 {
7724 int random_pick = Math.RandomInt(0, attachment_count);
7725 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7726 if (!attachment.IsExplosive())
7727 {
7728 attachment.AddHealth("","",damage);
7729 return true;
7730 }
7731 }
7732 return false;
7733 }
7734
7735 override bool IsSplitable()
7736 {
7737 return m_CanThisBeSplit;
7738 }
7739 //----------------
7740 override bool CanBeSplit()
7741 {
7742 if (IsSplitable() && (GetQuantity() > 1))
7743 return GetInventory().CanRemoveEntity();
7744
7745 return false;
7746 }
7747
7748 protected bool ShouldSplitQuantity(float quantity)
7749 {
7750 // don't call 'CanBeSplit' here, too strict and will introduce a freeze-crash when dismantling fence with a fireplace nearby
7751 if (!IsSplitable())
7752 return false;
7753
7754 // nothing to split?
7755 if (GetQuantity() <= 1)
7756 return false;
7757
7758 // check if we should re-use the item instead of creating a new copy?
7759 // implicit cast to int, if 'IsSplitable' returns true, these values are assumed ints
7760 int delta = GetQuantity() - quantity;
7761 if (delta == 0)
7762 return false;
7763
7764 // valid to split
7765 return true;
7766 }
7767
7768 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
7769 {
7770 if (GetGame().IsClient())
7771 {
7772 if (ScriptInputUserData.CanStoreInputUserData())
7773 {
7774 ScriptInputUserData ctx = new ScriptInputUserData;
7776 ctx.Write(1);
7777 ItemBase i1 = this; // @NOTE: workaround for correct serialization
7778 ctx.Write(i1);
7779 ctx.Write(destination_entity);
7780 ctx.Write(true);
7781 ctx.Write(slot_id);
7782 ctx.Send();
7783 }
7784 }
7785 else if (!GetGame().IsMultiplayer())
7786 {
7787 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
7788 }
7789 }
7790
7791 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
7792 {
7793 float split_quantity_new;
7794 ItemBase new_item;
7795 float quantity = GetQuantity();
7796 float stack_max = GetTargetQuantityMax(slot_id);
7797 InventoryLocation loc = new InventoryLocation;
7798
7799 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7800 {
7801 if (stack_max <= GetQuantity())
7802 split_quantity_new = stack_max;
7803 else
7804 split_quantity_new = GetQuantity();
7805
7806 if (ShouldSplitQuantity(split_quantity_new))
7807 {
7808 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
7809 if (new_item)
7810 {
7811 new_item.SetResultOfSplit(true);
7812 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7813 AddQuantity(-split_quantity_new, false, true);
7814 new_item.SetQuantity(split_quantity_new, false, true);
7815 }
7816 }
7817 }
7818 else if (destination_entity && slot_id == -1)
7819 {
7820 if (quantity > stack_max)
7821 split_quantity_new = stack_max;
7822 else
7823 split_quantity_new = quantity;
7824
7825 if (ShouldSplitQuantity(split_quantity_new))
7826 {
7827 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
7828 {
7829 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
7830 new_item = ItemBase.Cast(o);
7831 }
7832
7833 if (new_item)
7834 {
7835 new_item.SetResultOfSplit(true);
7836 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7837 AddQuantity(-split_quantity_new, false, true);
7838 new_item.SetQuantity(split_quantity_new, false, true);
7839 }
7840 }
7841 }
7842 else
7843 {
7844 if (stack_max != 0)
7845 {
7846 if (stack_max < GetQuantity())
7847 {
7848 split_quantity_new = GetQuantity() - stack_max;
7849 }
7850
7851 if (split_quantity_new == 0)
7852 {
7853 if (!GetGame().IsMultiplayer())
7854 player.PhysicalPredictiveDropItem(this);
7855 else
7856 player.ServerDropEntity(this);
7857 return;
7858 }
7859
7860 if (ShouldSplitQuantity(split_quantity_new))
7861 {
7862 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
7863
7864 if (new_item)
7865 {
7866 new_item.SetResultOfSplit(true);
7867 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7868 SetQuantity(split_quantity_new, false, true);
7869 new_item.SetQuantity(stack_max, false, true);
7870 new_item.PlaceOnSurface();
7871 }
7872 }
7873 }
7874 }
7875 }
7876
7877 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
7878 {
7879 float split_quantity_new;
7880 ItemBase new_item;
7881 float quantity = GetQuantity();
7882 float stack_max = GetTargetQuantityMax(slot_id);
7883 InventoryLocation loc = new InventoryLocation;
7884
7885 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7886 {
7887 if (stack_max <= GetQuantity())
7888 split_quantity_new = stack_max;
7889 else
7890 split_quantity_new = GetQuantity();
7891
7892 if (ShouldSplitQuantity(split_quantity_new))
7893 {
7894 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
7895 if (new_item)
7896 {
7897 new_item.SetResultOfSplit(true);
7898 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7899 AddQuantity(-split_quantity_new, false, true);
7900 new_item.SetQuantity(split_quantity_new, false, true);
7901 }
7902 }
7903 }
7904 else if (destination_entity && slot_id == -1)
7905 {
7906 if (quantity > stack_max)
7907 split_quantity_new = stack_max;
7908 else
7909 split_quantity_new = quantity;
7910
7911 if (ShouldSplitQuantity(split_quantity_new))
7912 {
7913 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
7914 {
7915 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
7916 new_item = ItemBase.Cast(o);
7917 }
7918
7919 if (new_item)
7920 {
7921 new_item.SetResultOfSplit(true);
7922 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7923 AddQuantity(-split_quantity_new, false, true);
7924 new_item.SetQuantity(split_quantity_new, false, true);
7925 }
7926 }
7927 }
7928 else
7929 {
7930 if (stack_max != 0)
7931 {
7932 if (stack_max < GetQuantity())
7933 {
7934 split_quantity_new = GetQuantity() - stack_max;
7935 }
7936
7937 if (ShouldSplitQuantity(split_quantity_new))
7938 {
7939 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
7940
7941 if (new_item)
7942 {
7943 new_item.SetResultOfSplit(true);
7944 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7945 SetQuantity(split_quantity_new, false, true);
7946 new_item.SetQuantity(stack_max, false, true);
7947 new_item.PlaceOnSurface();
7948 }
7949 }
7950 }
7951 }
7952 }
7953
7954 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
7955 {
7956 if (GetGame().IsClient())
7957 {
7958 if (ScriptInputUserData.CanStoreInputUserData())
7959 {
7960 ScriptInputUserData ctx = new ScriptInputUserData;
7962 ctx.Write(4);
7963 ItemBase thiz = this; // @NOTE: workaround for correct serialization
7964 ctx.Write(thiz);
7965 dst.WriteToContext(ctx);
7966 ctx.Send();
7967 }
7968 }
7969 else if (!GetGame().IsMultiplayer())
7970 {
7972 }
7973 }
7974
7975 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
7976 {
7977 if (GetGame().IsClient())
7978 {
7979 if (ScriptInputUserData.CanStoreInputUserData())
7980 {
7981 ScriptInputUserData ctx = new ScriptInputUserData;
7983 ctx.Write(2);
7984 ItemBase dummy = this; // @NOTE: workaround for correct serialization
7985 ctx.Write(dummy);
7986 ctx.Write(destination_entity);
7987 ctx.Write(true);
7988 ctx.Write(idx);
7989 ctx.Write(row);
7990 ctx.Write(col);
7991 ctx.Send();
7992 }
7993 }
7994 else if (!GetGame().IsMultiplayer())
7995 {
7996 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
7997 }
7998 }
7999
8000 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
8001 {
8003 }
8004
8005 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
8006 {
8007 float quantity = GetQuantity();
8008 float split_quantity_new;
8009 ItemBase new_item;
8010 if (dst.IsValid())
8011 {
8012 int slot_id = dst.GetSlot();
8013 float stack_max = GetTargetQuantityMax(slot_id);
8014
8015 if (quantity > stack_max)
8016 split_quantity_new = stack_max;
8017 else
8018 split_quantity_new = quantity;
8019
8020 if (ShouldSplitQuantity(split_quantity_new))
8021 {
8022 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
8023
8024 if (new_item)
8025 {
8026 new_item.SetResultOfSplit(true);
8027 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8028 AddQuantity(-split_quantity_new, false, true);
8029 new_item.SetQuantity(split_quantity_new, false, true);
8030 }
8031
8032 return new_item;
8033 }
8034 }
8035
8036 return null;
8037 }
8038
8039 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
8040 {
8041 float quantity = GetQuantity();
8042 float split_quantity_new;
8043 ItemBase new_item;
8044 if (destination_entity)
8045 {
8046 float stackable = GetTargetQuantityMax();
8047 if (quantity > stackable)
8048 split_quantity_new = stackable;
8049 else
8050 split_quantity_new = quantity;
8051
8052 if (ShouldSplitQuantity(split_quantity_new))
8053 {
8054 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
8055 if (new_item)
8056 {
8057 new_item.SetResultOfSplit(true);
8058 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8059 AddQuantity(-split_quantity_new, false, true);
8060 new_item.SetQuantity(split_quantity_new, false, true);
8061 }
8062 }
8063 }
8064 }
8065
8066 void SplitIntoStackMaxHandsClient(PlayerBase player)
8067 {
8068 if (GetGame().IsClient())
8069 {
8070 if (ScriptInputUserData.CanStoreInputUserData())
8071 {
8072 ScriptInputUserData ctx = new ScriptInputUserData;
8074 ctx.Write(3);
8075 ItemBase i1 = this; // @NOTE: workaround for correct serialization
8076 ctx.Write(i1);
8077 ItemBase destination_entity = this;
8078 ctx.Write(destination_entity);
8079 ctx.Write(true);
8080 ctx.Write(0);
8081 ctx.Send();
8082 }
8083 }
8084 else if (!GetGame().IsMultiplayer())
8085 {
8086 SplitIntoStackMaxHands(player);
8087 }
8088 }
8089
8090 void SplitIntoStackMaxHands(PlayerBase player)
8091 {
8092 float quantity = GetQuantity();
8093 float split_quantity_new;
8094 ref ItemBase new_item;
8095 if (player)
8096 {
8097 float stackable = GetTargetQuantityMax();
8098 if (quantity > stackable)
8099 split_quantity_new = stackable;
8100 else
8101 split_quantity_new = quantity;
8102
8103 if (ShouldSplitQuantity(split_quantity_new))
8104 {
8105 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
8106 new_item = ItemBase.Cast(in_hands);
8107 if (new_item)
8108 {
8109 new_item.SetResultOfSplit(true);
8110 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8111 AddQuantity(-split_quantity_new, false, true);
8112 new_item.SetQuantity(split_quantity_new, false, true);
8113 }
8114 }
8115 }
8116 }
8117
8118 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
8119 {
8120 float quantity = GetQuantity();
8121 float split_quantity_new = Math.Floor(quantity * 0.5);
8122
8123 if (!ShouldSplitQuantity(split_quantity_new))
8124 return;
8125
8126 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
8127
8128 if (new_item)
8129 {
8130 if (new_item.GetQuantityMax() < split_quantity_new)
8131 {
8132 split_quantity_new = new_item.GetQuantityMax();
8133 }
8134
8135 new_item.SetResultOfSplit(true);
8136 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8137
8138 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
8139 {
8140 AddQuantity(-1, false, true);
8141 new_item.SetQuantity(1, false, true);
8142 }
8143 else
8144 {
8145 AddQuantity(-split_quantity_new, false, true);
8146 new_item.SetQuantity(split_quantity_new, false, true);
8147 }
8148 }
8149 }
8150
8151 void SplitItem(PlayerBase player)
8152 {
8153 float quantity = GetQuantity();
8154 float split_quantity_new = Math.Floor(quantity / 2);
8155
8156 if (!ShouldSplitQuantity(split_quantity_new))
8157 return;
8158
8159 InventoryLocation invloc = new InventoryLocation;
8160 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
8161
8162 ItemBase new_item;
8163 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8164
8165 if (new_item)
8166 {
8167 if (new_item.GetQuantityMax() < split_quantity_new)
8168 {
8169 split_quantity_new = new_item.GetQuantityMax();
8170 }
8171 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
8172 {
8173 AddQuantity(-1, false, true);
8174 new_item.SetQuantity(1, false, true);
8175 }
8176 else if (split_quantity_new > 1)
8177 {
8178 AddQuantity(-split_quantity_new, false, true);
8179 new_item.SetQuantity(split_quantity_new, false, true);
8180 }
8181 }
8182 }
8183
8185 void OnQuantityChanged(float delta)
8186 {
8187 SetWeightDirty();
8188 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
8189
8190 if (parent)
8191 parent.OnAttachmentQuantityChangedEx(this, delta);
8192
8193 if (IsLiquidContainer())
8194 {
8195 if (GetQuantityNormalized() <= 0.0)
8196 {
8198 }
8199 else if (GetLiquidType() == LIQUID_NONE)
8200 {
8201 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
8203 }
8204 }
8205
8206 }
8207
8210 {
8211 // insert code here
8212 }
8213
8215 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
8216 {
8218 }
8219
8220 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
8221 {
8222 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8223
8224 if (GetGame().IsServer())
8225 {
8226 if (newLevel == GameConstants.STATE_RUINED)
8227 {
8229 EntityAI parent = GetHierarchyParent();
8230 if (parent && parent.IsFireplace())
8231 {
8232 CargoBase cargo = GetInventory().GetCargo();
8233 if (cargo)
8234 {
8235 for (int i = 0; i < cargo.GetItemCount(); ++i)
8236 {
8237 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
8238 }
8239 }
8240 }
8241 }
8242
8243 if (IsResultOfSplit())
8244 {
8245 // reset the splitting result flag, return to normal item behavior
8246 SetResultOfSplit(false);
8247 return;
8248 }
8249
8250 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8251 {
8252 SetCleanness(0);//unclean the item upon damage dealt
8253 }
8254 }
8255 }
8256
8257 // just the split? TODO: verify
8258 override void OnRightClick()
8259 {
8260 super.OnRightClick();
8261
8262 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
8263 {
8264 if (GetGame().IsClient())
8265 {
8266 if (ScriptInputUserData.CanStoreInputUserData())
8267 {
8268 EntityAI root = GetHierarchyRoot();
8269 Man playerOwner = GetHierarchyRootPlayer();
8270 InventoryLocation dst = new InventoryLocation;
8271
8272 // 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
8273 if (!playerOwner && root && root == this)
8274 {
8276 }
8277 else
8278 {
8279 // 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
8280 GetInventory().GetCurrentInventoryLocation(dst);
8281 if (!dst.GetParent() || dst.GetParent() && !dst.GetParent().GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.CARGO, dst))
8282 {
8283 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
8284 if (!player.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.CARGO, dst) || !playerOwner)
8285 {
8287 }
8288 else
8289 {
8290 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
8291 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
8292 this shouldnt cause issues within this scope*/
8293 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
8294 {
8296 }
8297 else
8298 {
8299 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8300 }
8301 }
8302 }
8303 }
8304
8305 ScriptInputUserData ctx = new ScriptInputUserData;
8307 ctx.Write(4);
8308 ItemBase thiz = this; // @NOTE: workaround for correct serialization
8309 ctx.Write(thiz);
8310 dst.WriteToContext(ctx);
8311 ctx.Write(true); // dummy
8312 ctx.Send();
8313 }
8314 }
8315 else if (!GetGame().IsMultiplayer())
8316 {
8317 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
8318 }
8319 }
8320 }
8321
8322 protected void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
8323 {
8324 if (root)
8325 {
8326 vector m4[4];
8327 root.GetTransform(m4);
8328 dst.SetGround(this, m4);
8329 }
8330 else
8331 {
8332 GetInventory().GetCurrentInventoryLocation(dst);
8333 }
8334 }
8335
8336 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
8337 {
8338 //TODO: delete check zero quantity check after fix double posts hands fsm events
8339 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
8340 return false;
8341
8342 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8343 return false;
8344
8345 //can_this_be_combined = ConfigGetBool("canBeSplit");
8347 return false;
8348
8349
8350 Magazine mag = Magazine.Cast(this);
8351 if (mag)
8352 {
8353 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8354 return false;
8355
8356 if (stack_max_limit)
8357 {
8358 Magazine other_mag = Magazine.Cast(other_item);
8359 if (other_item)
8360 {
8361 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8362 return false;
8363 }
8364
8365 }
8366 }
8367 else
8368 {
8369 //TODO: delete check zero quantity check after fix double posts hands fsm events
8370 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
8371 return false;
8372
8373 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
8374 return false;
8375 }
8376
8377 PlayerBase player = null;
8378 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
8379 {
8380 if (player.GetInventory().HasAttachment(this))
8381 return false;
8382
8383 if (player.IsItemsToDelete())
8384 return false;
8385 }
8386
8387 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8388 return false;
8389
8390 int slotID;
8391 string slotName;
8392 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8393 return false;
8394
8395 return true;
8396 }
8397
8398 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
8399 {
8400 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
8401 }
8402
8403 bool IsResultOfSplit()
8404 {
8405 return m_IsResultOfSplit;
8406 }
8407
8408 void SetResultOfSplit(bool value)
8409 {
8410 m_IsResultOfSplit = value;
8411 }
8412
8413 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
8414 {
8415 return ComputeQuantityUsedEx(other_item, use_stack_max);
8416 }
8417
8418 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
8419 {
8420 float other_item_quantity = other_item.GetQuantity();
8421 float this_free_space;
8422
8423 float stack_max = GetQuantityMax();
8424
8425 this_free_space = stack_max - GetQuantity();
8426
8427 if (other_item_quantity > this_free_space)
8428 {
8429 return this_free_space;
8430 }
8431 else
8432 {
8433 return other_item_quantity;
8434 }
8435 }
8436
8437 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
8438 {
8439 CombineItems(ItemBase.Cast(entity2),use_stack_max);
8440 }
8441
8442 void CombineItems(ItemBase other_item, bool use_stack_max = true)
8443 {
8444 if (!CanBeCombined(other_item, false))
8445 return;
8446
8447 if (!IsMagazine() && other_item)
8448 {
8449 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
8450 if (quantity_used != 0)
8451 {
8452 float hp1 = GetHealth01("","");
8453 float hp2 = other_item.GetHealth01("","");
8454 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
8455 hpResult = hpResult / (GetQuantity() + quantity_used);
8456
8457 hpResult *= GetMaxHealth();
8458 Math.Round(hpResult);
8459 SetHealth("", "Health", hpResult);
8460
8461 AddQuantity(quantity_used);
8462 other_item.AddQuantity(-quantity_used);
8463 }
8464 }
8465 OnCombine(other_item);
8466 }
8467
8468 void OnCombine(ItemBase other_item)
8469 {
8470 #ifdef SERVER
8471 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8472 GetHierarchyParent().IncreaseLifetimeUp();
8473 #endif
8474 };
8475
8476 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
8477 {
8478 PlayerBase p = PlayerBase.Cast(player);
8479
8480 array<int> recipesIds = p.m_Recipes;
8481 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
8482 if (moduleRecipesManager)
8483 {
8484 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8485 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
8486 }
8487
8488 for (int i = 0;i < recipesIds.Count(); i++)
8489 {
8490 int key = recipesIds.Get(i);
8491 string recipeName = moduleRecipesManager.GetRecipeName(key);
8492 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
8493 }
8494 }
8495
8496 // -------------------------------------------------------------------------
8497 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8498 {
8499 super.GetDebugActions(outputList);
8500
8501 //quantity
8502 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
8503 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
8504 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
8505 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
8506 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
8507
8508 //health
8509 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
8510 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
8511 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
8512 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
8513 //temperature
8514 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
8515 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
8516 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
8517 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
8518
8519 //wet
8520 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
8521 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
8522 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
8523
8524 //liquidtype
8525 if (IsLiquidContainer())
8526 {
8527 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
8528 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
8529 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
8530 }
8531
8532 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
8533 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
8534
8535 // watch
8536 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
8537 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
8538 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
8539
8540 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
8541
8542 InventoryLocation loc = new InventoryLocation();
8543 GetInventory().GetCurrentInventoryLocation(loc);
8544 if (!loc || loc.GetType() == InventoryLocationType.GROUND)
8545 {
8546 if (Gizmo_IsSupported())
8547 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GIZMO_OBJECT, "Gizmo Object", FadeColors.LIGHT_GREY));
8548 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GIZMO_PHYSICS, "Gizmo Physics (SP Only)", FadeColors.LIGHT_GREY)); // intentionally allowed for testing physics desync
8549 }
8550
8551 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
8552 }
8553
8554 // -------------------------------------------------------------------------
8555 // -------------------------------------------------------------------------
8556 // -------------------------------------------------------------------------
8557 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
8558 {
8559 super.OnAction(action_id, player, ctx);
8560
8561 if (GetGame().IsClient() || !GetGame().IsMultiplayer())
8562 {
8563 switch (action_id)
8564 {
8565 case EActions.GIZMO_OBJECT:
8566 GetGame().GizmoSelectObject(this);
8567 return true;
8568 case EActions.GIZMO_PHYSICS:
8569 GetGame().GizmoSelectPhysics(GetPhysics());
8570 return true;
8571 }
8572 }
8573
8574 if (GetGame().IsServer())
8575 {
8576 switch (action_id)
8577 {
8578 case EActions.DELETE:
8579 Delete();
8580 return true;
8581 }
8582 }
8583
8584 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
8585 {
8586 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
8587 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
8588 PlayerBase p = PlayerBase.Cast(player);
8589 if (EActions.RECIPES_RANGE_START < 1000)
8590 {
8591 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8592 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8593 }
8594 }
8595 #ifndef SERVER
8596 else if (action_id == EActions.WATCH_PLAYER)
8597 {
8598 PluginDeveloper.SetDeveloperItemClientEx(player);
8599 }
8600 #endif
8601 if (GetGame().IsServer())
8602 {
8603 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8604 {
8605 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8606 OnDebugButtonPressServer(id + 1);
8607 }
8608
8609 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8610 {
8611 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8612 InsertAgent(agent_id,100);
8613 }
8614
8615 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8616 {
8617 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8618 RemoveAgent(agent_id2);
8619 }
8620
8621 else if (action_id == EActions.ADD_QUANTITY)
8622 {
8623 if (IsMagazine())
8624 {
8625 Magazine mag = Magazine.Cast(this);
8626 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8627 }
8628 else
8629 {
8630 AddQuantity(GetQuantityMax() * 0.2);
8631 }
8632
8633 if (m_EM)
8634 {
8635 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8636 }
8637 //PrintVariables();
8638 }
8639
8640 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
8641 {
8642 if (IsMagazine())
8643 {
8644 Magazine mag2 = Magazine.Cast(this);
8645 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8646 }
8647 else
8648 {
8649 AddQuantity(- GetQuantityMax() * 0.2);
8650 }
8651 if (m_EM)
8652 {
8653 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8654 }
8655 //PrintVariables();
8656 }
8657
8658 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
8659 {
8660 SetQuantity(0);
8661
8662 if (m_EM)
8663 {
8664 m_EM.SetEnergy(0);
8665 }
8666 }
8667
8668 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
8669 {
8671
8672 if (m_EM)
8673 {
8674 m_EM.SetEnergy(m_EM.GetEnergyMax());
8675 }
8676 }
8677
8678 else if (action_id == EActions.ADD_HEALTH)
8679 {
8680 AddHealth("","",GetMaxHealth("","Health")/5);
8681 }
8682 else if (action_id == EActions.REMOVE_HEALTH)
8683 {
8684 AddHealth("","",-GetMaxHealth("","Health")/5);
8685 }
8686 else if (action_id == EActions.DESTROY_HEALTH)
8687 {
8688 SetHealth01("","",0);
8689 }
8690 else if (action_id == EActions.WATCH_ITEM)
8691 {
8693 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
8694 #ifdef DEVELOPER
8695 SetDebugDeveloper_item(this);
8696 #endif
8697 }
8698
8699 else if (action_id == EActions.ADD_TEMPERATURE)
8700 {
8701 AddTemperature(20);
8702 //PrintVariables();
8703 }
8704
8705 else if (action_id == EActions.REMOVE_TEMPERATURE)
8706 {
8707 AddTemperature(-20);
8708 //PrintVariables();
8709 }
8710
8711 else if (action_id == EActions.FLIP_FROZEN)
8712 {
8713 SetFrozen(!GetIsFrozen());
8714 //PrintVariables();
8715 }
8716
8717 else if (action_id == EActions.ADD_WETNESS)
8718 {
8719 AddWet(GetWetMax()/5);
8720 //PrintVariables();
8721 }
8722
8723 else if (action_id == EActions.REMOVE_WETNESS)
8724 {
8725 AddWet(-GetWetMax()/5);
8726 //PrintVariables();
8727 }
8728
8729 else if (action_id == EActions.LIQUIDTYPE_UP)
8730 {
8731 int curr_type = GetLiquidType();
8732 SetLiquidType(curr_type * 2);
8733 //AddWet(1);
8734 //PrintVariables();
8735 }
8736
8737 else if (action_id == EActions.LIQUIDTYPE_DOWN)
8738 {
8739 int curr_type2 = GetLiquidType();
8740 SetLiquidType(curr_type2 / 2);
8741 }
8742
8743 else if (action_id == EActions.MAKE_SPECIAL)
8744 {
8745 auto debugParams = DebugSpawnParams.WithPlayer(player);
8746 OnDebugSpawnEx(debugParams);
8747 }
8748
8749 }
8750
8751
8752 return false;
8753 }
8754
8755 // -------------------------------------------------------------------------
8756
8757
8760 void OnActivatedByTripWire();
8761
8763 void OnActivatedByItem(notnull ItemBase item);
8764
8765 //----------------------------------------------------------------
8766 //returns true if item is able to explode when put in fire
8767 bool CanExplodeInFire()
8768 {
8769 return false;
8770 }
8771
8772 //----------------------------------------------------------------
8773 bool CanEat()
8774 {
8775 return true;
8776 }
8777
8778 //----------------------------------------------------------------
8779 override bool IsIgnoredByConstruction()
8780 {
8781 return true;
8782 }
8783
8784 //----------------------------------------------------------------
8785 //has FoodStages in config?
8786 bool HasFoodStage()
8787 {
8788 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
8789 return GetGame().ConfigIsExisting(config_path);
8790 }
8791
8793 FoodStage GetFoodStage()
8794 {
8795 return null;
8796 }
8797
8798 bool CanBeCooked()
8799 {
8800 return false;
8801 }
8802
8803 bool CanBeCookedOnStick()
8804 {
8805 return false;
8806 }
8807
8809 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
8811
8812 //----------------------------------------------------------------
8813 bool CanRepair(ItemBase item_repair_kit)
8814 {
8815 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
8816 return module_repairing.CanRepair(this, item_repair_kit);
8817 }
8818
8819 //----------------------------------------------------------------
8820 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
8821 {
8822 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
8823 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8824 }
8825
8826 //----------------------------------------------------------------
8827 int GetItemSize()
8828 {
8829 /*
8830 vector v_size = this.ConfigGetVector("itemSize");
8831 int v_size_x = v_size[0];
8832 int v_size_y = v_size[1];
8833 int size = v_size_x * v_size_y;
8834 return size;
8835 */
8836
8837 return 1;
8838 }
8839
8840 //----------------------------------------------------------------
8841 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
8842 bool CanBeMovedOverride()
8843 {
8844 return m_CanBeMovedOverride;
8845 }
8846
8847 //----------------------------------------------------------------
8848 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
8849 void SetCanBeMovedOverride(bool setting)
8850 {
8851 m_CanBeMovedOverride = setting;
8852 }
8853
8854 //----------------------------------------------------------------
8862 void MessageToOwnerStatus(string text)
8863 {
8864 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8865
8866 if (player)
8867 {
8868 player.MessageStatus(text);
8869 }
8870 }
8871
8872 //----------------------------------------------------------------
8880 void MessageToOwnerAction(string text)
8881 {
8882 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8883
8884 if (player)
8885 {
8886 player.MessageAction(text);
8887 }
8888 }
8889
8890 //----------------------------------------------------------------
8898 void MessageToOwnerFriendly(string text)
8899 {
8900 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8901
8902 if (player)
8903 {
8904 player.MessageFriendly(text);
8905 }
8906 }
8907
8908 //----------------------------------------------------------------
8916 void MessageToOwnerImportant(string text)
8917 {
8918 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8919
8920 if (player)
8921 {
8922 player.MessageImportant(text);
8923 }
8924 }
8925
8926 override bool IsItemBase()
8927 {
8928 return true;
8929 }
8930
8931 // Checks if item is of questioned kind
8932 override bool KindOf(string tag)
8933 {
8934 bool found = false;
8935 string item_name = this.GetType();
8936 ref TStringArray item_tag_array = new TStringArray;
8937 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
8938
8939 int array_size = item_tag_array.Count();
8940 for (int i = 0; i < array_size; i++)
8941 {
8942 if (item_tag_array.Get(i) == tag)
8943 {
8944 found = true;
8945 break;
8946 }
8947 }
8948 return found;
8949 }
8950
8951
8952 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
8953 {
8954 //Debug.Log("OnRPC called");
8955 super.OnRPC(sender, rpc_type,ctx);
8956
8957 //Play soundset for attachment locking (ActionLockAttachment.c)
8958 switch (rpc_type)
8959 {
8960 #ifndef SERVER
8961 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8962 Param2<bool, string> p = new Param2<bool, string>(false, "");
8963
8964 if (!ctx.Read(p))
8965 return;
8966
8967 bool play = p.param1;
8968 string soundSet = p.param2;
8969
8970 if (play)
8971 {
8972 if (m_LockingSound)
8973 {
8975 {
8976 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
8977 }
8978 }
8979 else
8980 {
8981 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
8982 }
8983 }
8984 else
8985 {
8986 SEffectManager.DestroyEffect(m_LockingSound);
8987 }
8988
8989 break;
8990 #endif
8991
8992 }
8993
8994 if (GetWrittenNoteData())
8995 {
8996 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
8997 }
8998 }
8999
9000 //-----------------------------
9001 // VARIABLE MANIPULATION SYSTEM
9002 //-----------------------------
9003 int NameToID(string name)
9004 {
9005 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
9006 return plugin.GetID(name);
9007 }
9008
9009 string IDToName(int id)
9010 {
9011 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
9012 return plugin.GetName(id);
9013 }
9014
9016 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
9017 {
9018 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
9019 //read the flags
9020 int varFlags;
9021 if (!ctx.Read(varFlags))
9022 return;
9023
9024 if (varFlags & ItemVariableFlags.FLOAT)
9025 {
9026 ReadVarsFromCTX(ctx);
9027 }
9028 }
9029
9030 override void SerializeNumericalVars(array<float> floats_out)
9031 {
9032 //some variables handled on EntityAI level already!
9033 super.SerializeNumericalVars(floats_out);
9034
9035 // the order of serialization must be the same as the order of de-serialization
9036 //--------------------------------------------
9037 if (IsVariableSet(VARIABLE_QUANTITY))
9038 {
9039 floats_out.Insert(m_VarQuantity);
9040 }
9041 //--------------------------------------------
9042 if (IsVariableSet(VARIABLE_WET))
9043 {
9044 floats_out.Insert(m_VarWet);
9045 }
9046 //--------------------------------------------
9047 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
9048 {
9049 floats_out.Insert(m_VarLiquidType);
9050 }
9051 //--------------------------------------------
9052 if (IsVariableSet(VARIABLE_COLOR))
9053 {
9054 floats_out.Insert(m_ColorComponentR);
9055 floats_out.Insert(m_ColorComponentG);
9056 floats_out.Insert(m_ColorComponentB);
9057 floats_out.Insert(m_ColorComponentA);
9058 }
9059 //--------------------------------------------
9060 if (IsVariableSet(VARIABLE_CLEANNESS))
9061 {
9062 floats_out.Insert(m_Cleanness);
9063 }
9064 }
9065
9066 override void DeSerializeNumericalVars(array<float> floats)
9067 {
9068 //some variables handled on EntityAI level already!
9069 super.DeSerializeNumericalVars(floats);
9070
9071 // the order of serialization must be the same as the order of de-serialization
9072 int index = 0;
9073 int mask = Math.Round(floats.Get(index));
9074
9075 index++;
9076 //--------------------------------------------
9077 if (mask & VARIABLE_QUANTITY)
9078 {
9079 if (m_IsStoreLoad)
9080 {
9081 SetStoreLoadedQuantity(floats.Get(index));
9082 }
9083 else
9084 {
9085 float quantity = floats.Get(index);
9086 SetQuantity(quantity, true, false, false, false);
9087 }
9088 index++;
9089 }
9090 //--------------------------------------------
9091 if (mask & VARIABLE_WET)
9092 {
9093 float wet = floats.Get(index);
9094 SetWet(wet);
9095 index++;
9096 }
9097 //--------------------------------------------
9098 if (mask & VARIABLE_LIQUIDTYPE)
9099 {
9100 int liquidtype = Math.Round(floats.Get(index));
9101 SetLiquidType(liquidtype);
9102 index++;
9103 }
9104 //--------------------------------------------
9105 if (mask & VARIABLE_COLOR)
9106 {
9107 m_ColorComponentR = Math.Round(floats.Get(index));
9108 index++;
9109 m_ColorComponentG = Math.Round(floats.Get(index));
9110 index++;
9111 m_ColorComponentB = Math.Round(floats.Get(index));
9112 index++;
9113 m_ColorComponentA = Math.Round(floats.Get(index));
9114 index++;
9115 }
9116 //--------------------------------------------
9117 if (mask & VARIABLE_CLEANNESS)
9118 {
9119 int cleanness = Math.Round(floats.Get(index));
9120 SetCleanness(cleanness);
9121 index++;
9122 }
9123 }
9124
9125 override void WriteVarsToCTX(ParamsWriteContext ctx)
9126 {
9127 super.WriteVarsToCTX(ctx);
9128
9129 //--------------------------------------------
9130 if (IsVariableSet(VARIABLE_QUANTITY))
9131 {
9132 ctx.Write(GetQuantity());
9133 }
9134 //--------------------------------------------
9135 if (IsVariableSet(VARIABLE_WET))
9136 {
9137 ctx.Write(GetWet());
9138 }
9139 //--------------------------------------------
9140 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
9141 {
9142 ctx.Write(GetLiquidType());
9143 }
9144 //--------------------------------------------
9145 if (IsVariableSet(VARIABLE_COLOR))
9146 {
9147 int r,g,b,a;
9148 GetColor(r,g,b,a);
9149 ctx.Write(r);
9150 ctx.Write(g);
9151 ctx.Write(b);
9152 ctx.Write(a);
9153 }
9154 //--------------------------------------------
9155 if (IsVariableSet(VARIABLE_CLEANNESS))
9156 {
9157 ctx.Write(GetCleanness());
9158 }
9159 }
9160
9161 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
9162 {
9163 if (!super.ReadVarsFromCTX(ctx,version))
9164 return false;
9165
9166 int intValue;
9167 float value;
9168
9169 if (version < 140)
9170 {
9171 if (!ctx.Read(intValue))
9172 return false;
9173
9174 m_VariablesMask = intValue;
9175 }
9176
9177 if (m_VariablesMask & VARIABLE_QUANTITY)
9178 {
9179 if (!ctx.Read(value))
9180 return false;
9181
9182 if (IsStoreLoad())
9183 {
9185 }
9186 else
9187 {
9188 SetQuantity(value, true, false, false, false);
9189 }
9190 }
9191 //--------------------------------------------
9192 if (version < 140)
9193 {
9194 if (m_VariablesMask & VARIABLE_TEMPERATURE)
9195 {
9196 if (!ctx.Read(value))
9197 return false;
9198 SetTemperatureDirect(value);
9199 }
9200 }
9201 //--------------------------------------------
9202 if (m_VariablesMask & VARIABLE_WET)
9203 {
9204 if (!ctx.Read(value))
9205 return false;
9206 SetWet(value);
9207 }
9208 //--------------------------------------------
9209 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
9210 {
9211 if (!ctx.Read(intValue))
9212 return false;
9213 SetLiquidType(intValue);
9214 }
9215 //--------------------------------------------
9216 if (m_VariablesMask & VARIABLE_COLOR)
9217 {
9218 int r,g,b,a;
9219 if (!ctx.Read(r))
9220 return false;
9221 if (!ctx.Read(g))
9222 return false;
9223 if (!ctx.Read(b))
9224 return false;
9225 if (!ctx.Read(a))
9226 return false;
9227
9228 SetColor(r,g,b,a);
9229 }
9230 //--------------------------------------------
9231 if (m_VariablesMask & VARIABLE_CLEANNESS)
9232 {
9233 if (!ctx.Read(intValue))
9234 return false;
9235 SetCleanness(intValue);
9236 }
9237 //--------------------------------------------
9238 if (version >= 138 && version < 140)
9239 {
9240 if (m_VariablesMask & VARIABLE_TEMPERATURE)
9241 {
9242 if (!ctx.Read(intValue))
9243 return false;
9244 SetFrozen(intValue);
9245 }
9246 }
9247
9248 return true;
9249 }
9250
9251 //----------------------------------------------------------------
9252 override bool OnStoreLoad(ParamsReadContext ctx, int version)
9253 {
9254 m_IsStoreLoad = true;
9256 {
9257 m_FixDamageSystemInit = true;
9258 }
9259
9260 if (!super.OnStoreLoad(ctx, version))
9261 {
9262 m_IsStoreLoad = false;
9263 return false;
9264 }
9265
9266 if (version >= 114)
9267 {
9268 bool hasQuickBarIndexSaved;
9269
9270 if (!ctx.Read(hasQuickBarIndexSaved))
9271 {
9272 m_IsStoreLoad = false;
9273 return false;
9274 }
9275
9276 if (hasQuickBarIndexSaved)
9277 {
9278 int itmQBIndex;
9279
9280 //Load quickbar item bind
9281 if (!ctx.Read(itmQBIndex))
9282 {
9283 m_IsStoreLoad = false;
9284 return false;
9285 }
9286
9287 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9288 if (itmQBIndex != -1 && parentPlayer)
9289 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9290 }
9291 }
9292 else
9293 {
9294 // Backup of how it used to be
9295 PlayerBase player;
9296 int itemQBIndex;
9297 if (version == int.MAX)
9298 {
9299 if (!ctx.Read(itemQBIndex))
9300 {
9301 m_IsStoreLoad = false;
9302 return false;
9303 }
9304 }
9305 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9306 {
9307 //Load quickbar item bind
9308 if (!ctx.Read(itemQBIndex))
9309 {
9310 m_IsStoreLoad = false;
9311 return false;
9312 }
9313 if (itemQBIndex != -1 && player)
9314 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9315 }
9316 }
9317
9318 if (version < 140)
9319 {
9320 // variable management system
9321 if (!LoadVariables(ctx, version))
9322 {
9323 m_IsStoreLoad = false;
9324 return false;
9325 }
9326 }
9327
9328 //agent trasmission system
9329 if (!LoadAgents(ctx, version))
9330 {
9331 m_IsStoreLoad = false;
9332 return false;
9333 }
9334 if (version >= 132)
9335 {
9336 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
9337 if (raib)
9338 {
9339 if (!raib.OnStoreLoad(ctx,version))
9340 {
9341 m_IsStoreLoad = false;
9342 return false;
9343 }
9344 }
9345 }
9346
9347 m_IsStoreLoad = false;
9348 return true;
9349 }
9350
9351 //----------------------------------------------------------------
9352
9353 override void OnStoreSave(ParamsWriteContext ctx)
9354 {
9355 super.OnStoreSave(ctx);
9356
9357 PlayerBase player;
9358 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9359 {
9360 ctx.Write(true); // Keep track of if we should actually read this in or not
9361 //Save quickbar item bind
9362 int itemQBIndex = -1;
9363 itemQBIndex = player.FindQuickBarEntityIndex(this);
9364 ctx.Write(itemQBIndex);
9365 }
9366 else
9367 {
9368 ctx.Write(false); // Keep track of if we should actually read this in or not
9369 }
9370
9371 SaveAgents(ctx);//agent trasmission system
9372
9373 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
9374 if (raib)
9375 {
9376 raib.OnStoreSave(ctx);
9377 }
9378 }
9379 //----------------------------------------------------------------
9380
9381 override void AfterStoreLoad()
9382 {
9383 super.AfterStoreLoad();
9384
9386 {
9388 }
9389
9390 if (GetStoreLoadedQuantity() != float.LOWEST)
9391 {
9393 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
9394 }
9395 }
9396
9397 override void EEOnAfterLoad()
9398 {
9399 super.EEOnAfterLoad();
9400
9402 {
9403 m_FixDamageSystemInit = false;
9404 }
9405
9408 }
9409
9410 bool CanBeDisinfected()
9411 {
9412 return false;
9413 }
9414
9415
9416 //----------------------------------------------------------------
9417 override void OnVariablesSynchronized()
9418 {
9419 if (m_Initialized)
9420 {
9421 #ifdef PLATFORM_CONSOLE
9422 //bruteforce it is
9423 if (IsSplitable())
9424 {
9425 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
9426 if (menu)
9427 {
9428 menu.Refresh();
9429 }
9430 }
9431 #endif
9432 }
9433
9435 {
9436 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
9437 m_WantPlayImpactSound = false;
9438 }
9439
9441 {
9442 SetWeightDirty();
9444 }
9445 if (m_VarWet != m_VarWetPrev)
9446 {
9449 }
9450
9451 if (m_SoundSyncPlay != 0)
9452 {
9453 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
9454 m_SoundSyncPlay = 0;
9455 }
9456 if (m_SoundSyncStop != 0)
9457 {
9458 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
9459 m_SoundSyncStop = 0;
9460 }
9461
9462 super.OnVariablesSynchronized();
9463 }
9464
9465 //------------------------- Quantity
9466 //----------------------------------------------------------------
9468 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
9469 {
9470 if (!IsServerCheck(allow_client))
9471 return false;
9472
9473 if (!HasQuantity())
9474 return false;
9475
9476 float min = GetQuantityMin();
9477 float max = GetQuantityMax();
9478
9479 if (value <= (min + 0.001))
9480 value = min;
9481
9482 if (value == min)
9483 {
9484 if (destroy_config)
9485 {
9486 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9487 if (dstr)
9488 {
9489 m_VarQuantity = Math.Clamp(value, min, max);
9490 this.Delete();
9491 return true;
9492 }
9493 }
9494 else if (destroy_forced)
9495 {
9496 m_VarQuantity = Math.Clamp(value, min, max);
9497 this.Delete();
9498 return true;
9499 }
9500 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
9501 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
9502 }
9503
9504 float delta = m_VarQuantity;
9505 m_VarQuantity = Math.Clamp(value, min, max);
9506
9507 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
9508 {
9509 delta = m_VarQuantity - delta;
9510
9511 if (delta)
9512 OnQuantityChanged(delta);
9513 }
9514
9515 SetVariableMask(VARIABLE_QUANTITY);
9516
9517 return false;
9518 }
9519
9520 //----------------------------------------------------------------
9522 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
9523 {
9524 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
9525 }
9526 //----------------------------------------------------------------
9527 void SetQuantityMax()
9528 {
9529 float max = GetQuantityMax();
9530 SetQuantity(max);
9531 }
9532
9533 override void SetQuantityToMinimum()
9534 {
9535 float min = GetQuantityMin();
9536 SetQuantity(min);
9537 }
9538 //----------------------------------------------------------------
9540 override void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
9541 {
9542 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
9543 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
9544 SetQuantity(result, destroy_config, destroy_forced);
9545 }
9546
9547 //----------------------------------------------------------------
9549 override float GetQuantityNormalized()
9550 {
9551 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
9552 }
9553
9555 {
9556 return GetQuantityNormalized();
9557 }
9558
9559 /*void SetAmmoNormalized(float value)
9560 {
9561 float value_clamped = Math.Clamp(value, 0, 1);
9562 Magazine this_mag = Magazine.Cast(this);
9563 int max_rounds = this_mag.GetAmmoMax();
9564 int result = value * max_rounds;//can the rounded if higher precision is required
9565 this_mag.SetAmmoCount(result);
9566 }*/
9567 //----------------------------------------------------------------
9568 override int GetQuantityMax()
9569 {
9570 int slot = -1;
9571 if (GetInventory())
9572 {
9573 InventoryLocation il = new InventoryLocation;
9574 GetInventory().GetCurrentInventoryLocation(il);
9575 slot = il.GetSlot();
9576 }
9577
9578 return GetTargetQuantityMax(slot);
9579 }
9580
9581 override int GetTargetQuantityMax(int attSlotID = -1)
9582 {
9583 float quantity_max = 0;
9584
9585 if (IsSplitable()) //only stackable/splitable items can check for stack size
9586 {
9587 if (attSlotID != -1)
9588 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9589
9590 if (quantity_max <= 0)
9591 quantity_max = m_VarStackMax;
9592 }
9593
9594 if (quantity_max <= 0)
9595 quantity_max = m_VarQuantityMax;
9596
9597 return quantity_max;
9598 }
9599 //----------------------------------------------------------------
9600 override int GetQuantityMin()
9601 {
9602 return m_VarQuantityMin;
9603 }
9604 //----------------------------------------------------------------
9605 int GetQuantityInit()
9606 {
9607 return m_VarQuantityInit;
9608 }
9609
9610 //----------------------------------------------------------------
9611 override bool HasQuantity()
9612 {
9613 return !(GetQuantityMax() - GetQuantityMin() == 0);
9614 }
9615
9616 override float GetQuantity()
9617 {
9618 return m_VarQuantity;
9619 }
9620
9621 bool IsFullQuantity()
9622 {
9623 return GetQuantity() >= GetQuantityMax();
9624 }
9625
9626 //Calculates weight of single item without attachments and cargo
9627 override float GetSingleInventoryItemWeightEx()
9628 {
9629 //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
9630 float weightEx = GetWeightEx();//overall weight of the item
9631 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
9632 return weightEx - special;
9633 }
9634
9635 // Obsolete, use GetSingleInventoryItemWeightEx() instead
9637 {
9639 }
9640
9641 override protected float GetWeightSpecialized(bool forceRecalc = false)
9642 {
9643 if (IsSplitable()) //quantity determines size of the stack
9644 {
9645 #ifdef DEVELOPER
9646 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9647 {
9648 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9649 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
9650 }
9651 #endif
9652
9653 return GetQuantity() * GetConfigWeightModified();
9654 }
9655 else if (HasEnergyManager())// items with energy manager
9656 {
9657 #ifdef DEVELOPER
9658 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9659 {
9660 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9661 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
9662 }
9663 #endif
9664 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9665 }
9666 else//everything else
9667 {
9668 #ifdef DEVELOPER
9669 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9670 {
9671 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9672 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
9673 }
9674 #endif
9675 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9676 }
9677 }
9678
9680 int GetNumberOfItems()
9681 {
9682 int item_count = 0;
9683 ItemBase item;
9684
9685 if (GetInventory().GetCargo() != NULL)
9686 {
9687 item_count = GetInventory().GetCargo().GetItemCount();
9688 }
9689
9690 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9691 {
9692 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9693 if (item)
9694 item_count += item.GetNumberOfItems();
9695 }
9696 return item_count;
9697 }
9698
9700 float GetUnitWeight(bool include_wetness = true)
9701 {
9702 float weight = 0;
9703 float wetness = 1;
9704 if (include_wetness)
9705 wetness += GetWet();
9706 if (IsSplitable()) //quantity determines size of the stack
9707 {
9708 weight = wetness * m_ConfigWeight;
9709 }
9710 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
9711 {
9712 weight = 1;
9713 }
9714 return weight;
9715 }
9716
9717 //-----------------------------------------------------------------
9718
9719 override void ClearInventory()
9720 {
9721 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
9722 {
9723 GameInventory inv = GetInventory();
9724 array<EntityAI> items = new array<EntityAI>;
9725 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
9726 for (int i = 0; i < items.Count(); i++)
9727 {
9728 ItemBase item = ItemBase.Cast(items.Get(i));
9729 if (item)
9730 {
9731 GetGame().ObjectDelete(item);
9732 }
9733 }
9734 }
9735 }
9736
9737 //------------------------- Energy
9738
9739 //----------------------------------------------------------------
9740 float GetEnergy()
9741 {
9742 float energy = 0;
9743 if (HasEnergyManager())
9744 {
9745 energy = GetCompEM().GetEnergy();
9746 }
9747 return energy;
9748 }
9749
9750
9751 override void OnEnergyConsumed()
9752 {
9753 super.OnEnergyConsumed();
9754
9756 }
9757
9758 override void OnEnergyAdded()
9759 {
9760 super.OnEnergyAdded();
9761
9763 }
9764
9765 // Converts energy (from Energy Manager) to quantity, if enabled.
9767 {
9768 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9769 {
9770 if (HasQuantity())
9771 {
9772 float energy_0to1 = GetCompEM().GetEnergy0To1();
9773 SetQuantityNormalized(energy_0to1);
9774 }
9775 }
9776 }
9777
9778 //----------------------------------------------------------------
9779 float GetHeatIsolationInit()
9780 {
9781 return ConfigGetFloat("heatIsolation");
9782 }
9783
9784 float GetHeatIsolation()
9785 {
9786 return m_HeatIsolation;
9787 }
9788
9789 float GetDryingIncrement(string pIncrementName)
9790 {
9791 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
9792 if (GetGame().ConfigIsExisting(paramPath))
9793 return GetGame().ConfigGetFloat(paramPath);
9794
9795 return 0.0;
9796 }
9797
9798 float GetSoakingIncrement(string pIncrementName)
9799 {
9800 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
9801 if (GetGame().ConfigIsExisting(paramPath))
9802 return GetGame().ConfigGetFloat(paramPath);
9803
9804 return 0.0;
9805 }
9806 //----------------------------------------------------------------
9807 override void SetWet(float value, bool allow_client = false)
9808 {
9809 if (!IsServerCheck(allow_client))
9810 return;
9811
9812 float min = GetWetMin();
9813 float max = GetWetMax();
9814
9815 float previousValue = m_VarWet;
9816
9817 m_VarWet = Math.Clamp(value, min, max);
9818
9819 if (previousValue != m_VarWet)
9820 {
9821 SetVariableMask(VARIABLE_WET);
9822 OnWetChanged(m_VarWet, previousValue);
9823 }
9824 }
9825 //----------------------------------------------------------------
9826 override void AddWet(float value)
9827 {
9828 SetWet(GetWet() + value);
9829 }
9830 //----------------------------------------------------------------
9831 override void SetWetMax()
9832 {
9834 }
9835 //----------------------------------------------------------------
9836 override float GetWet()
9837 {
9838 return m_VarWet;
9839 }
9840 //----------------------------------------------------------------
9841 override float GetWetMax()
9842 {
9843 return m_VarWetMax;
9844 }
9845 //----------------------------------------------------------------
9846 override float GetWetMin()
9847 {
9848 return m_VarWetMin;
9849 }
9850 //----------------------------------------------------------------
9851 override float GetWetInit()
9852 {
9853 return m_VarWetInit;
9854 }
9855 //----------------------------------------------------------------
9856 override void OnWetChanged(float newVal, float oldVal)
9857 {
9858 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
9859 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
9860 if (newLevel != oldLevel)
9861 {
9862 OnWetLevelChanged(newLevel,oldLevel);
9863 }
9864 }
9865
9866 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
9867 {
9868 SetWeightDirty();
9869 }
9870
9871 override EWetnessLevel GetWetLevel()
9872 {
9873 return GetWetLevelInternal(m_VarWet);
9874 }
9875
9876 //----------------------------------------------------------------
9877
9878 override void SetStoreLoad(bool value)
9879 {
9880 m_IsStoreLoad = value;
9881 }
9882
9883 override bool IsStoreLoad()
9884 {
9885 return m_IsStoreLoad;
9886 }
9887
9888 override void SetStoreLoadedQuantity(float value)
9889 {
9890 m_StoreLoadedQuantity = value;
9891 }
9892
9893 override float GetStoreLoadedQuantity()
9894 {
9895 return m_StoreLoadedQuantity;
9896 }
9897
9898 //----------------------------------------------------------------
9899
9900 float GetItemModelLength()
9901 {
9902 if (ConfigIsExisting("itemModelLength"))
9903 {
9904 return ConfigGetFloat("itemModelLength");
9905 }
9906 return 0;
9907 }
9908
9909 float GetItemAttachOffset()
9910 {
9911 if (ConfigIsExisting("itemAttachOffset"))
9912 {
9913 return ConfigGetFloat("itemAttachOffset");
9914 }
9915 return 0;
9916 }
9917
9918 override void SetCleanness(int value, bool allow_client = false)
9919 {
9920 if (!IsServerCheck(allow_client))
9921 return;
9922
9923 int previousValue = m_Cleanness;
9924
9925 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
9926
9927 if (previousValue != m_Cleanness)
9928 SetVariableMask(VARIABLE_CLEANNESS);
9929 }
9930
9931 override int GetCleanness()
9932 {
9933 return m_Cleanness;
9934 }
9935
9937 {
9938 return true;
9939 }
9940
9941 //----------------------------------------------------------------
9942 // ATTACHMENT LOCKING
9943 // Getters relevant to generic ActionLockAttachment
9944 int GetLockType()
9945 {
9946 return m_LockType;
9947 }
9948
9949 string GetLockSoundSet()
9950 {
9951 return m_LockSoundSet;
9952 }
9953
9954 //----------------------------------------------------------------
9955 //------------------------- Color
9956 // sets items color variable given color components
9957 override void SetColor(int r, int g, int b, int a)
9958 {
9963 SetVariableMask(VARIABLE_COLOR);
9964 }
9966 override void GetColor(out int r,out int g,out int b,out int a)
9967 {
9972 }
9973
9974 bool IsColorSet()
9975 {
9976 return IsVariableSet(VARIABLE_COLOR);
9977 }
9978
9980 string GetColorString()
9981 {
9982 int r,g,b,a;
9983 GetColor(r,g,b,a);
9984 r = r/255;
9985 g = g/255;
9986 b = b/255;
9987 a = a/255;
9988 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9989 }
9990 //----------------------------------------------------------------
9991 //------------------------- LiquidType
9992
9993 override void SetLiquidType(int value, bool allow_client = false)
9994 {
9995 if (!IsServerCheck(allow_client))
9996 return;
9997
9998 int old = m_VarLiquidType;
9999 m_VarLiquidType = value;
10000 OnLiquidTypeChanged(old,value);
10001 SetVariableMask(VARIABLE_LIQUIDTYPE);
10002 }
10003
10004 int GetLiquidTypeInit()
10005 {
10006 return ConfigGetInt("varLiquidTypeInit");
10007 }
10008
10009 override int GetLiquidType()
10010 {
10011 return m_VarLiquidType;
10012 }
10013
10014 protected void OnLiquidTypeChanged(int oldType, int newType)
10015 {
10016 if (newType == LIQUID_NONE && GetIsFrozen())
10017 SetFrozen(false);
10018 }
10019
10021 void UpdateQuickbarShortcutVisibility(PlayerBase player)
10022 {
10023 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10024 }
10025
10026 // -------------------------------------------------------------------------
10028 void OnInventoryEnter(Man player)
10029 {
10030 PlayerBase nplayer;
10031 if (PlayerBase.CastTo(nplayer, player))
10032 {
10033 m_CanPlayImpactSound = true;
10034 //nplayer.OnItemInventoryEnter(this);
10035 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10036 }
10037 }
10038
10039 // -------------------------------------------------------------------------
10041 void OnInventoryExit(Man player)
10042 {
10043 PlayerBase nplayer;
10044 if (PlayerBase.CastTo(nplayer,player))
10045 {
10046 //nplayer.OnItemInventoryExit(this);
10047 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10048
10049 }
10050
10051 //if (!GetGame().IsDedicatedServer())
10052 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10053
10054
10055 if (HasEnergyManager())
10056 {
10057 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
10058 }
10059 }
10060
10061 // ADVANCED PLACEMENT EVENTS
10062 override void OnPlacementStarted(Man player)
10063 {
10064 super.OnPlacementStarted(player);
10065
10066 SetTakeable(false);
10067 }
10068
10069 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
10070 {
10071 if (m_AdminLog)
10072 {
10073 m_AdminLog.OnPlacementComplete(player, this);
10074 }
10075
10076 super.OnPlacementComplete(player, position, orientation);
10077 }
10078
10079 //-----------------------------
10080 // AGENT SYSTEM
10081 //-----------------------------
10082 //--------------------------------------------------------------------------
10083 bool ContainsAgent(int agent_id)
10084 {
10085 if (agent_id & m_AttachedAgents)
10086 {
10087 return true;
10088 }
10089 else
10090 {
10091 return false;
10092 }
10093 }
10094
10095 //--------------------------------------------------------------------------
10096 override void RemoveAgent(int agent_id)
10097 {
10098 if (ContainsAgent(agent_id))
10099 {
10100 m_AttachedAgents = ~agent_id & m_AttachedAgents;
10101 }
10102 }
10103
10104 //--------------------------------------------------------------------------
10105 override void RemoveAllAgents()
10106 {
10107 m_AttachedAgents = 0;
10108 }
10109 //--------------------------------------------------------------------------
10110 override void RemoveAllAgentsExcept(int agent_to_keep)
10111 {
10112 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
10113 }
10114 // -------------------------------------------------------------------------
10115 override void InsertAgent(int agent, float count = 1)
10116 {
10117 if (count < 1)
10118 return;
10119 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
10121 }
10122
10124 void TransferAgents(int agents)
10125 {
10127 }
10128
10129 // -------------------------------------------------------------------------
10130 override int GetAgents()
10131 {
10132 return m_AttachedAgents;
10133 }
10134 //----------------------------------------------------------------------
10135
10136 /*int GetContaminationType()
10137 {
10138 int contamination_type;
10139
10140 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
10141 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
10142 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
10143 const int DIRTY_MASK = eAgents.WOUND_AGENT;
10144
10145 Edible_Base edible = Edible_Base.Cast(this);
10146 int agents = GetAgents();
10147 if (edible)
10148 {
10149 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
10150 if (profile)
10151 {
10152 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
10153 }
10154 }
10155 if (agents & CONTAMINATED_MASK)
10156 {
10157 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
10158 }
10159 if (agents & POISONED_MASK)
10160 {
10161 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
10162 }
10163 if (agents & NERVE_GAS_MASK)
10164 {
10165 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
10166 }
10167 if (agents & DIRTY_MASK)
10168 {
10169 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
10170 }
10171
10172 return agents;
10173 }*/
10174
10175 // -------------------------------------------------------------------------
10176 bool LoadAgents(ParamsReadContext ctx, int version)
10177 {
10178 if (!ctx.Read(m_AttachedAgents))
10179 return false;
10180 return true;
10181 }
10182 // -------------------------------------------------------------------------
10184 {
10185
10187 }
10188 // -------------------------------------------------------------------------
10189
10191 override void CheckForRoofLimited(float timeTresholdMS = 3000)
10192 {
10193 super.CheckForRoofLimited(timeTresholdMS);
10194
10195 float time = GetGame().GetTime();
10196 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10197 {
10198 m_PreviousRoofTestTime = time;
10199 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10200 }
10201 }
10202
10203 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
10204 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
10205 {
10206 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
10207 {
10208 return 0;
10209 }
10210
10211 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
10212 {
10213 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
10214 if (filter)
10215 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
10216 else
10217 return 0;//otherwise return 0 when no filter attached
10218 }
10219
10220 string subclassPath, entryName;
10221
10222 switch (type)
10223 {
10224 case DEF_BIOLOGICAL:
10225 entryName = "biological";
10226 break;
10227 case DEF_CHEMICAL:
10228 entryName = "chemical";
10229 break;
10230 default:
10231 entryName = "biological";
10232 break;
10233 }
10234
10235 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
10236
10237 return GetGame().ConfigGetFloat(subclassPath + entryName);
10238 }
10239
10240
10241
10243 override void EEOnCECreate()
10244 {
10245 if (!IsMagazine())
10247
10249 }
10250
10251
10252 //-------------------------
10253 // OPEN/CLOSE USER ACTIONS
10254 //-------------------------
10256 void Open();
10257 void Close();
10258 bool IsOpen()
10259 {
10260 return true;
10261 }
10262
10263 override bool CanDisplayCargo()
10264 {
10265 return IsOpen();
10266 }
10267
10268
10269 // ------------------------------------------------------------
10270 // CONDITIONS
10271 // ------------------------------------------------------------
10272 override bool CanPutInCargo(EntityAI parent)
10273 {
10274 if (parent)
10275 {
10276 if (parent.IsInherited(DayZInfected))
10277 return true;
10278
10279 if (!parent.IsRuined())
10280 return true;
10281 }
10282
10283 return true;
10284 }
10285
10286 override bool CanPutAsAttachment(EntityAI parent)
10287 {
10288 if (!super.CanPutAsAttachment(parent))
10289 {
10290 return false;
10291 }
10292
10293 if (!IsRuined() && !parent.IsRuined())
10294 {
10295 return true;
10296 }
10297
10298 return false;
10299 }
10300
10301 override bool CanReceiveItemIntoCargo(EntityAI item)
10302 {
10303 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
10304 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
10305 // return false;
10306
10307 return super.CanReceiveItemIntoCargo(item);
10308 }
10309
10310 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
10311 {
10312 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
10313 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
10314 // return false;
10315
10316 GameInventory attachmentInv = attachment.GetInventory();
10317 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
10318 {
10319 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10320 return false;
10321 }
10322
10323 InventoryLocation loc = new InventoryLocation();
10324 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10325 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
10326 return false;
10327
10328 return super.CanReceiveAttachment(attachment, slotId);
10329 }
10330
10331 override bool CanReleaseAttachment(EntityAI attachment)
10332 {
10333 if (!super.CanReleaseAttachment(attachment))
10334 return false;
10335
10336 return GetInventory().AreChildrenAccessible();
10337 }
10338
10339 /*override bool CanLoadAttachment(EntityAI attachment)
10340 {
10341 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
10342 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
10343 // return false;
10344
10345 GameInventory attachmentInv = attachment.GetInventory();
10346 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
10347 {
10348 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
10349 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
10350
10351 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10352 return false;
10353 }
10354
10355 return super.CanLoadAttachment(attachment);
10356 }*/
10357
10358 // Plays muzzle flash particle effects
10359 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
10360 {
10361 int id = muzzle_owner.GetMuzzleID();
10362 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
10363
10364 if (WPOF_array)
10365 {
10366 for (int i = 0; i < WPOF_array.Count(); i++)
10367 {
10368 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10369
10370 if (WPOF)
10371 {
10372 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10373 }
10374 }
10375 }
10376 }
10377
10378 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
10379 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
10380 {
10381 int id = muzzle_owner.GetMuzzleID();
10382 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
10383
10384 if (WPOBE_array)
10385 {
10386 for (int i = 0; i < WPOBE_array.Count(); i++)
10387 {
10388 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10389
10390 if (WPOBE)
10391 {
10392 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10393 }
10394 }
10395 }
10396 }
10397
10398 // Plays all weapon overheating particles
10399 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
10400 {
10401 int id = muzzle_owner.GetMuzzleID();
10402 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10403
10404 if (WPOOH_array)
10405 {
10406 for (int i = 0; i < WPOOH_array.Count(); i++)
10407 {
10408 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10409
10410 if (WPOOH)
10411 {
10412 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10413 }
10414 }
10415 }
10416 }
10417
10418 // Updates all weapon overheating particles
10419 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
10420 {
10421 int id = muzzle_owner.GetMuzzleID();
10422 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10423
10424 if (WPOOH_array)
10425 {
10426 for (int i = 0; i < WPOOH_array.Count(); i++)
10427 {
10428 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10429
10430 if (WPOOH)
10431 {
10432 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10433 }
10434 }
10435 }
10436 }
10437
10438 // Stops overheating particles
10439 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
10440 {
10441 int id = muzzle_owner.GetMuzzleID();
10442 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10443
10444 if (WPOOH_array)
10445 {
10446 for (int i = 0; i < WPOOH_array.Count(); i++)
10447 {
10448 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10449
10450 if (WPOOH)
10451 {
10452 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10453 }
10454 }
10455 }
10456 }
10457
10458 //----------------------------------------------------------------
10459 //Item Behaviour - unified approach
10460 override bool IsHeavyBehaviour()
10461 {
10462 if (m_ItemBehaviour == 0)
10463 {
10464 return true;
10465 }
10466
10467 return false;
10468 }
10469
10470 override bool IsOneHandedBehaviour()
10471 {
10472 if (m_ItemBehaviour == 1)
10473 {
10474 return true;
10475 }
10476
10477 return false;
10478 }
10479
10480 override bool IsTwoHandedBehaviour()
10481 {
10482 if (m_ItemBehaviour == 2)
10483 {
10484 return true;
10485 }
10486
10487 return false;
10488 }
10489
10490 bool IsDeployable()
10491 {
10492 return false;
10493 }
10494
10496 float GetDeployTime()
10497 {
10498 return UATimeSpent.DEFAULT_DEPLOY;
10499 }
10500
10501
10502 //----------------------------------------------------------------
10503 // Item Targeting (User Actions)
10504 override void SetTakeable(bool pState)
10505 {
10506 m_IsTakeable = pState;
10507 SetSynchDirty();
10508 }
10509
10510 override bool IsTakeable()
10511 {
10512 return m_IsTakeable;
10513 }
10514
10515 // For cases where we want to show object widget which cant be taken to hands
10517 {
10518 return false;
10519 }
10520
10522 protected void PreLoadSoundAttachmentType()
10523 {
10524 string att_type = "None";
10525
10526 if (ConfigIsExisting("soundAttType"))
10527 {
10528 att_type = ConfigGetString("soundAttType");
10529 }
10530
10531 m_SoundAttType = att_type;
10532 }
10533
10534 override string GetAttachmentSoundType()
10535 {
10536 return m_SoundAttType;
10537 }
10538
10539 //----------------------------------------------------------------
10540 //SOUNDS - ItemSoundHandler
10541 //----------------------------------------------------------------
10542
10543 string GetPlaceSoundset(); // played when deploy starts
10544 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
10545 string GetDeploySoundset(); // played when deploy sucessfully finishes
10546 string GetLoopFoldSoundset(); // played when fold starts and stopped when it finishes
10547 string GetFoldSoundset(); // played when fold sucessfully finishes
10548
10550 {
10551 if (!m_ItemSoundHandler)
10553
10554 return m_ItemSoundHandler;
10555 }
10556
10557 // override to initialize sounds
10558 protected void InitItemSounds()
10559 {
10560 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
10561 return;
10562
10564
10565 if (GetPlaceSoundset() != string.Empty)
10566 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
10567
10568 if (GetDeploySoundset() != string.Empty)
10569 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
10570
10571 SoundParameters params = new SoundParameters();
10572 params.m_Loop = true;
10573 if (GetLoopDeploySoundset() != string.Empty)
10574 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
10575 }
10576
10577 // Start sound using ItemSoundHandler
10578 void StartItemSoundServer(int id)
10579 {
10580 if (!GetGame().IsServer())
10581 return;
10582
10583 m_SoundSyncPlay = id;
10584 SetSynchDirty();
10585
10586 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
10588 }
10589
10590 // Stop sound using ItemSoundHandler
10591 void StopItemSoundServer(int id)
10592 {
10593 if (!GetGame().IsServer())
10594 return;
10595
10596 m_SoundSyncStop = id;
10597 SetSynchDirty();
10598
10599 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
10601 }
10602
10603 protected void ClearStartItemSoundServer()
10604 {
10605 m_SoundSyncPlay = 0;
10606 }
10607
10608 protected void ClearStopItemSoundServer()
10609 {
10610 m_SoundSyncStop = 0;
10611 }
10612
10614 void PlayAttachSound(string slot_type)
10615 {
10616 if (!GetGame().IsDedicatedServer())
10617 {
10618 if (ConfigIsExisting("attachSoundSet"))
10619 {
10620 string cfg_path = "";
10621 string soundset = "";
10622 string type_name = GetType();
10623
10624 TStringArray cfg_soundset_array = new TStringArray;
10625 TStringArray cfg_slot_array = new TStringArray;
10626 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10627 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10628
10629 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10630 {
10631 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10632 {
10633 if (cfg_slot_array[i] == slot_type)
10634 {
10635 soundset = cfg_soundset_array[i];
10636 break;
10637 }
10638 }
10639 }
10640
10641 if (soundset != "")
10642 {
10643 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
10644 sound.SetAutodestroy(true);
10645 }
10646 }
10647 }
10648 }
10649
10650 void PlayDetachSound(string slot_type)
10651 {
10652 //TODO - evaluate if needed and devise universal config structure if so
10653 }
10654
10655 void OnApply(PlayerBase player);
10656
10658 {
10659 return 1.0;
10660 };
10661 //returns applicable selection
10662 array<string> GetHeadHidingSelection()
10663 {
10665 }
10666
10668 {
10670 }
10671
10672 WrittenNoteData GetWrittenNoteData() {};
10673
10675 {
10676 SetDynamicPhysicsLifeTime(0.01);
10677 m_ItemBeingDroppedPhys = false;
10678 }
10679
10681 {
10682 array<string> zone_names = new array<string>;
10683 GetDamageZones(zone_names);
10684 for (int i = 0; i < zone_names.Count(); i++)
10685 {
10686 SetHealthMax(zone_names.Get(i),"Health");
10687 }
10688 SetHealthMax("","Health");
10689 }
10690
10692 void SetZoneDamageCEInit()
10693 {
10694 float global_health = GetHealth01("","Health");
10695 array<string> zones = new array<string>;
10696 GetDamageZones(zones);
10697 //set damage of all zones to match global health level
10698 for (int i = 0; i < zones.Count(); i++)
10699 {
10700 SetHealth01(zones.Get(i),"Health",global_health);
10701 }
10702 }
10703
10705 bool IsCoverFaceForShave(string slot_name)
10706 {
10707 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10708 }
10709
10710 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
10711 {
10712 if (!hasRootAsPlayer)
10713 {
10714 if (refParentIB)
10715 {
10716 // parent is wet
10717 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
10718 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10719 // parent has liquid inside
10720 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
10721 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10722 // drying
10723 else if (m_VarWet > m_VarWetMin)
10724 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
10725 }
10726 else
10727 {
10728 // drying on ground or inside non-itembase (car, ...)
10729 if (m_VarWet > m_VarWetMin)
10730 AddWet(-1 * delta * GetDryingIncrement("ground"));
10731 }
10732 }
10733 }
10734
10735 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
10736 {
10738 {
10739 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
10740 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
10741 {
10742 float heatPermCoef = 1.0;
10743 EntityAI ent = this;
10744 while (ent)
10745 {
10746 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10747 ent = ent.GetHierarchyParent();
10748 }
10749
10750 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10751 }
10752 }
10753 }
10754
10755 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
10756 {
10757 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
10758 EntityAI parent = GetHierarchyParent();
10759 if (!parent)
10760 {
10761 hasParent = false;
10762 hasRootAsPlayer = false;
10763 }
10764 else
10765 {
10766 hasParent = true;
10767 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10768 refParentIB = ItemBase.Cast(parent);
10769 }
10770 }
10771
10772 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
10773 {
10774 // this is stub, implemented on Edible_Base
10775 }
10776
10777 bool CanDecay()
10778 {
10779 // return true used on selected food clases so they can decay
10780 return false;
10781 }
10782
10783 protected bool CanProcessDecay()
10784 {
10785 // this is stub, implemented on Edible_Base class
10786 // used to determine whether it is still necessary for the food to decay
10787 return false;
10788 }
10789
10790 protected bool CanHaveWetness()
10791 {
10792 // return true used on selected items that have a wetness effect
10793 return false;
10794 }
10795
10797 bool CanBeConsumed(ConsumeConditionData data = null)
10798 {
10799 return !GetIsFrozen() && IsOpen();
10800 }
10801
10802 override void ProcessVariables()
10803 {
10804 bool hasParent = false, hasRootAsPlayer = false;
10805 ItemBase refParentIB;
10806
10807 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
10808 bool foodDecay = g_Game.IsFoodDecayEnabled();
10809
10810 if (wwtu || foodDecay)
10811 {
10812 bool processWetness = wwtu && CanHaveWetness();
10813 bool processTemperature = wwtu && CanHaveTemperature();
10814 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
10815
10816 if (processWetness || processTemperature || processDecay)
10817 {
10818 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
10819
10820 if (processWetness)
10821 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10822
10823 if (processTemperature)
10824 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10825
10826 if (processDecay)
10827 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10828 }
10829 }
10830 }
10831
10834 {
10835 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
10836 }
10837
10838 override float GetTemperatureFreezeThreshold()
10839 {
10841 return Liquid.GetFreezeThreshold(GetLiquidType());
10842
10843 return super.GetTemperatureFreezeThreshold();
10844 }
10845
10846 override float GetTemperatureThawThreshold()
10847 {
10849 return Liquid.GetThawThreshold(GetLiquidType());
10850
10851 return super.GetTemperatureThawThreshold();
10852 }
10853
10854 override float GetItemOverheatThreshold()
10855 {
10857 return Liquid.GetBoilThreshold(GetLiquidType());
10858
10859 return super.GetItemOverheatThreshold();
10860 }
10861
10862 override float GetTemperatureFreezeTime()
10863 {
10864 if (HasQuantity())
10865 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
10866
10867 return super.GetTemperatureFreezeTime();
10868 }
10869
10870 override float GetTemperatureThawTime()
10871 {
10872 if (HasQuantity())
10873 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
10874
10875 return super.GetTemperatureThawTime();
10876 }
10877
10879 void AffectLiquidContainerOnFill(int liquid_type, float amount);
10881 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
10882
10883 bool IsCargoException4x3(EntityAI item)
10884 {
10885 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10886 }
10887
10889 {
10890 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10891 }
10892
10894 void AddLightSourceItem(ItemBase lightsource)
10895 {
10896 m_LightSourceItem = lightsource;
10897 }
10898
10900 {
10901 m_LightSourceItem = null;
10902 }
10903
10905 {
10906 return m_LightSourceItem;
10907 }
10908
10910 array<int> GetValidFinishers()
10911 {
10912 return null;
10913 }
10914
10916 bool GetActionWidgetOverride(out typename name)
10917 {
10918 return false;
10919 }
10920
10921 bool PairWithDevice(notnull ItemBase otherDevice)
10922 {
10923 if (GetGame().IsServer())
10924 {
10925 ItemBase explosive = otherDevice;
10927 if (!trg)
10928 {
10929 trg = RemoteDetonatorTrigger.Cast(otherDevice);
10930 explosive = this;
10931 }
10932
10933 explosive.PairRemote(trg);
10934 trg.SetControlledDevice(explosive);
10935
10936 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10937 trg.SetPersistentPairID(persistentID);
10938 explosive.SetPersistentPairID(persistentID);
10939
10940 return true;
10941 }
10942 return false;
10943 }
10944
10946 float GetBaitEffectivity()
10947 {
10948 float ret = 1.0;
10949 if (HasQuantity())
10950 ret *= GetQuantityNormalized();
10951 ret *= GetHealth01();
10952
10953 return ret;
10954 }
10955
10956 #ifdef DEVELOPER
10957 override void SetDebugItem()
10958 {
10959 super.SetDebugItem();
10960 _itemBase = this;
10961 }
10962
10963 override string GetDebugText()
10964 {
10965 string text = super.GetDebugText();
10966
10967 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
10968 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
10969
10970 return text;
10971 }
10972 #endif
10973
10974 bool CanBeUsedForSuicide()
10975 {
10976 return true;
10977 }
10978
10980 //DEPRECATED BELOW
10982 // Backwards compatibility
10983 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
10984 {
10985 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
10986 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
10987 }
10988
10989 // replaced by ItemSoundHandler
10990 protected EffectSound m_SoundDeployFinish;
10991 protected EffectSound m_SoundPlace;
10992 protected EffectSound m_DeployLoopSoundEx;
10993 protected EffectSound m_SoundDeploy;
10994 bool m_IsPlaceSound;
10995 bool m_IsDeploySound;
10997
10998 string GetDeployFinishSoundset();
10999 void PlayDeploySound();
11000 void PlayDeployFinishSound();
11001 void PlayPlaceSound();
11002 void PlayDeployLoopSoundEx();
11003 void StopDeployLoopSoundEx();
11004 void SoundSynchRemoteReset();
11005 void SoundSynchRemote();
11006 bool UsesGlobalDeploy(){return false;}
11007 bool CanPlayDeployLoopSound(){return false;}
11009 bool IsPlaceSound(){return m_IsPlaceSound;}
11010 bool IsDeploySound(){return m_IsDeploySound;}
11011 void SetIsPlaceSound(bool is_place_sound);
11012 void SetIsDeploySound(bool is_deploy_sound);
11013}
11014
11015EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
11016{
11017 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
11018 if (entity)
11019 {
11020 bool is_item = entity.IsInherited(ItemBase);
11021 if (is_item && full_quantity)
11022 {
11023 ItemBase item = ItemBase.Cast(entity);
11024 item.SetQuantity(item.GetQuantityInit());
11025 }
11026 }
11027 else
11028 {
11029 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
11030 return NULL;
11031 }
11032 return entity;
11033}
11034
11035void SetupSpawnedItem(ItemBase item, float health, float quantity)
11036{
11037 if (item)
11038 {
11039 if (health > 0)
11040 item.SetHealth("", "", health);
11041
11042 if (item.CanHaveTemperature())
11043 {
11044 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
11045 if (item.CanFreeze())
11046 item.SetFrozen(false);
11047 }
11048
11049 if (item.HasEnergyManager())
11050 {
11051 if (quantity >= 0)
11052 {
11053 item.GetCompEM().SetEnergy0To1(quantity);
11054 }
11055 else
11056 {
11057 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
11058 }
11059 }
11060 else if (item.IsMagazine())
11061 {
11062 Magazine mag = Magazine.Cast(item);
11063 if (quantity >= 0)
11064 {
11065 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11066 }
11067 else
11068 {
11069 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
11070 }
11071
11072 }
11073 else
11074 {
11075 if (quantity >= 0)
11076 {
11077 item.SetQuantityNormalized(quantity, false);
11078 }
11079 else
11080 {
11081 item.SetQuantity(Math.AbsFloat(quantity));
11082 }
11083
11084 }
11085 }
11086}
11087
11088#ifdef DEVELOPER
11089ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
11090#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Определения 3_Game/Entities/EntityAI.c:97
Param3 TSelectableActionInfo
EWetnessLevel
Определения 3_Game/Entities/EntityAI.c:2
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
const int INPUT_UDT_ITEM_MANIPULATION
class LogManager EntityAI
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
void ActionDropItem()
Определения ActionDropItem.c:14
void ActionManagerBase(PlayerBase player)
Определения ActionManagerBase.c:63
map< typename, ref array< ActionBase_Basic > > TInputActionMap
Определения ActionManagerClient.c:1
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
void RemoveAction(typename actionName)
Определения AdvancedCommunication.c:252
TInputActionMap m_InputActionMap
Определения AdvancedCommunication.c:137
bool m_ActionsInitialize
Определения AdvancedCommunication.c:138
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
Определения AdvancedCommunication.c:202
void InitializeActions()
Определения AdvancedCommunication.c:190
int GetLiquidType()
Определения CCTWaterSurface.c:129
const int ECE_PLACE_ON_SURFACE
Определения CentralEconomy.c:37
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
Определения CentralEconomy.c:36
const int RF_DEFAULT
Определения CentralEconomy.c:65
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
Open
Implementations only.
override void EEOnCECreate()
Определения ContaminatedArea_Dynamic.c:42
map
Определения ControlsXboxNew.c:4
CookingMethodType
Определения Cooking.c:2
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
DayZGame g_Game
Определения DayZGame.c:3868
DayZGame GetDayZGame()
Определения DayZGame.c:3870
EActions
Определения EActions.c:2
ERPCs
Определения ERPCs.c:2
PluginAdminLog m_AdminLog
Определения EmoteManager.c:142
const int MAX
Определения EnConvert.c:27
float GetTemperature()
Определения Environment.c:497
override bool IsExplosive()
Определения ExplosivesBase.c:59
override bool CanHaveTemperature()
Определения FireplaceBase.c:559
class GP5GasMask extends MaskBase ItemBase
Empty
Определения Hand_States.c:14
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
Определения ItemBase.c:6380
static bool HasDebugActionsMask(int mask)
Определения ItemBase.c:5620
bool HidesSelectionBySlot()
Определения ItemBase.c:9347
float m_VarWetMin
Определения ItemBase.c:4881
void SplitItem(PlayerBase player)
Определения ItemBase.c:6831
void CopyScriptPropertiesFrom(EntityAI oldItem)
Определения ItemBase.c:9568
override void InsertAgent(int agent, float count=1)
Определения ItemBase.c:8795
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
Определения ItemBase.c:8229
static void SetDebugActionsMask(int mask)
Определения ItemBase.c:5625
void SetIsDeploySound(bool is_deploy_sound)
bool IsOpen()
Определения ItemBase.c:8938
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6798
override bool IsHeavyBehaviour()
Определения ItemBase.c:9140
override void SetWetMax()
Определения ItemBase.c:8511
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
Определения ItemBase.c:9385
void ClearStartItemSoundServer()
Определения ItemBase.c:9283
float m_VarWet
Определения ItemBase.c:4878
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9415
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
Определения ItemBase.c:2
override void RemoveAllAgentsExcept(int agent_to_keep)
Определения ItemBase.c:8790
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
Определения ItemBase.c:4941
bool CanBeMovedOverride()
Определения ItemBase.c:7522
override void SetWet(float value, bool allow_client=false)
Определения ItemBase.c:8487
ref TIntArray m_SingleUseActions
Определения ItemBase.c:4927
override void ProcessVariables()
Определения ItemBase.c:9482
ref TStringArray m_HeadHidingSelections
Определения ItemBase.c:4955
float GetWeightSpecialized(bool forceRecalc=false)
Определения ItemBase.c:8321
bool LoadAgents(ParamsReadContext ctx, int version)
Определения ItemBase.c:8856
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
Определения ItemBase.c:8701
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
Определения ItemBase.c:5211
ref array< ref OverheatingParticle > m_OverheatingParticles
Определения ItemBase.c:4953
override float GetTemperatureFreezeThreshold()
Определения ItemBase.c:9518
bool m_IsSoundSynchRemote
Определения ItemBase.c:9676
float m_OverheatingShots
Определения ItemBase.c:4948
void StopItemSoundServer(int id)
Определения ItemBase.c:9271
static void ToggleDebugActionsMask(int mask)
Определения ItemBase.c:5640
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:5364
override float GetTemperatureFreezeTime()
Определения ItemBase.c:9542
ref array< int > m_CompatibleLocks
Определения ItemBase.c:4965
bool CanBeCooked()
Определения ItemBase.c:7478
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:5707
float m_TemperaturePerQuantityWeight
Определения ItemBase.c:4977
bool m_RecipesInitialized
Определения ItemBase.c:4863
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
Определения ItemBase.c:6471
override float GetTemperatureThawThreshold()
Определения ItemBase.c:9526
override void OnEnergyConsumed()
Определения ItemBase.c:8431
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
Определения Bottle_Base.c:158
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
Определения ItemBase.c:8360
override EWetnessLevel GetWetLevel()
Определения ItemBase.c:8551
float GetSingleInventoryItemWeight()
Определения ItemBase.c:8316
ref TIntArray m_InteractActions
Определения ItemBase.c:4929
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
Определения ItemBase.c:7542
float m_VarQuantity
Определения ItemBase.c:4869
bool CanPlayDeployLoopSound()
Определения ItemBase.c:9687
override float GetWetMax()
Определения ItemBase.c:8521
bool CanBeUsedForSuicide()
Определения ItemBase.c:9654
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:7117
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
Определения ItemBase.c:5845
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
Определения ItemBase.c:7696
void StartItemSoundServer(int id)
Определения ItemBase.c:9258
void DoAmmoExplosion()
Определения ItemBase.c:6315
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
Определения ItemBase.c:4940
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6655
int GetItemSize()
Определения ItemBase.c:7507
bool m_CanBeMovedOverride
Определения ItemBase.c:4906
override string ChangeIntoOnAttach(string slot)
Определения ItemBase.c:6239
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5432
bool CanDecay()
Определения ItemBase.c:9457
ScriptedLightBase GetLight()
string GetPlaceSoundset()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
Определения ItemBase.c:8202
void SetQuantityMax()
Определения ItemBase.c:8207
override float GetQuantity()
Определения ItemBase.c:8296
int m_ColorComponentR
Определения ItemBase.c:4918
int m_ShotsToStartOverheating
Определения ItemBase.c:4950
override void OnWetChanged(float newVal, float oldVal)
Определения ItemBase.c:8536
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5439
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9039
void OnOverheatingDecay()
Определения ItemBase.c:5402
float GetDryingIncrement(string pIncrementName)
Определения ItemBase.c:8469
void SoundSynchRemoteReset()
int m_Cleanness
Определения ItemBase.c:4884
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
Определения ItemBase.c:5540
bool UsesGlobalDeploy()
Определения ItemBase.c:9686
int m_ItemBehaviour
Определения ItemBase.c:4899
override bool CanReleaseAttachment(EntityAI attachment)
Определения ItemBase.c:9011
float m_HeatIsolation
Определения ItemBase.c:4894
float m_VarWetInit
Определения ItemBase.c:4880
override void OnMovedInsideCargo(EntityAI container)
Определения ItemBase.c:5885
void SetCEBasedQuantity()
Определения ItemBase.c:5653
bool m_CanPlayImpactSound
Определения ItemBase.c:4890
override string GetAttachmentSoundType()
Определения ItemBase.c:9214
float GetOverheatingCoef()
Определения ItemBase.c:5459
array< string > GetHeadHidingSelection()
Определения ItemBase.c:9342
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
Определения ItemBase.c:9294
override bool IsStoreLoad()
Определения ItemBase.c:8563
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7093
bool IsLightSource()
Определения ItemBase.c:5781
bool m_HasQuantityBar
Определения ItemBase.c:4912
void SetResultOfSplit(bool value)
Определения ItemBase.c:7088
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6719
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6889
void UpdateAllOverheatingParticles()
Определения ItemBase.c:5467
float GetSoakingIncrement(string pIncrementName)
Определения ItemBase.c:8478
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9119
override float GetStoreLoadedQuantity()
Определения ItemBase.c:8573
int m_LockType
Определения ItemBase.c:4966
const int ITEM_SOUNDS_MAX
Определения ItemBase.c:4971
bool m_CanBeDigged
Определения ItemBase.c:4913
float m_ItemAttachOffset
Определения ItemBase.c:4896
float GetItemModelLength()
Определения ItemBase.c:8580
bool m_ThrowItemOnDrop
Определения ItemBase.c:4904
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
Определения ItemBase.c:7841
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
Определения ItemBase.c:8871
void Close()
float GetHeatIsolation()
Определения ItemBase.c:8464
void CombineItems(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7122
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
Определения ItemBase.c:9513
bool CanHaveWetness()
Определения ItemBase.c:9470
int m_CleannessMin
Определения ItemBase.c:4886
void TransferAgents(int agents)
transfer agents from another item
Определения ItemBase.c:8804
string IDToName(int id)
Определения ItemBase.c:7689
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
Определения ItemBase.c:9477
float GetHeatIsolationInit()
Определения ItemBase.c:8459
void PlayPlaceSound()
void SetCanBeMovedOverride(bool setting)
Определения ItemBase.c:7529
override bool HasQuantity()
Определения ItemBase.c:8291
float m_VarWetPrev
Определения ItemBase.c:4879
int m_SoundSyncStop
Определения ItemBase.c:4973
bool IsCargoException4x3(EntityAI item)
Определения ItemBase.c:9563
ref TIntArray m_ContinuousActions
Определения ItemBase.c:4928
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
Определения ItemBase.c:5549
void LoadParticleConfigOnFire(int id)
Определения ItemBase.c:5234
int m_VarLiquidType
Определения ItemBase.c:4898
int m_QuickBarBonus
Определения ItemBase.c:4900
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
Определения ItemBase.c:9202
override float GetWetInit()
Определения ItemBase.c:8531
int m_ImpactSoundSurfaceHash
Определения ItemBase.c:4892
int m_SoundSyncPlay
Определения ItemBase.c:4972
int m_MaxOverheatingValue
Определения ItemBase.c:4951
void SetupSpawnedItem(ItemBase item, float health, float quantity)
Определения ItemBase.c:4875
bool m_IsTakeable
Определения ItemBase.c:4903
bool ShouldSplitQuantity(float quantity)
Определения ItemBase.c:6428
static ref map< string, int > m_WeaponTypeToID
Определения ItemBase.c:4943
string GetLockSoundSet()
Определения ItemBase.c:8629
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
Определения ItemBase.c:8660
array< int > GetValidFinishers()
returns an array of possible finishers
Определения ItemBase.c:9590
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6895
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
Определения ItemBase.c:4855
ItemSoundHandler GetItemSoundHandler()
Определения ItemBase.c:9229
override int GetQuantityMin()
Определения ItemBase.c:8280
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
Определения ItemBase.c:6634
override int GetQuickBarBonus()
Определения ItemBase.c:5119
override void SetTakeable(bool pState)
Определения ItemBase.c:9184
float m_OverheatingDecayInterval
Определения ItemBase.c:4952
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6448
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
Определения ItemBase.c:9435
bool CanProcessDecay()
Определения ItemBase.c:9463
void RemoveAudioVisualsOnClient()
Определения Bottle_Base.c:151
void SoundSynchRemote()
static void AddDebugActionsMask(int mask)
Определения ItemBase.c:5630
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
Определения ItemBase.c:9579
bool CanRepair(ItemBase item_repair_kit)
Определения ItemBase.c:7493
bool can_this_be_combined
Определения ItemBase.c:4908
EffectSound m_SoundDeploy
Определения ItemBase.c:9673
int m_Count
Определения ItemBase.c:4874
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
Определения ItemBase.c:9626
float GetDeployTime()
how long it takes to deploy this item in seconds
Определения ItemBase.c:9176
override bool IsSplitable()
Определения ItemBase.c:6415
bool DamageItemAttachments(float damage)
Определения ItemBase.c:6399
override void WriteVarsToCTX(ParamsWriteContext ctx)
Определения ItemBase.c:7805
void ConvertEnergyToQuantity()
Определения ItemBase.c:8446
override void RemoveAllAgents()
Определения ItemBase.c:8785
override void SetQuantityToMinimum()
Определения ItemBase.c:8213
bool m_WantPlayImpactSound
Определения ItemBase.c:4889
override float GetTemperatureThawTime()
Определения ItemBase.c:9550
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
Определения ItemBase.c:4942
int m_ColorComponentG
Определения ItemBase.c:4919
float m_StoreLoadedQuantity
Определения ItemBase.c:4876
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
Определения ItemBase.c:7560
int m_ColorComponentA
Определения ItemBase.c:4921
int m_VarQuantityInit
Определения ItemBase.c:4871
float GetFilterDamageRatio()
Определения ItemBase.c:5534
override void SetLiquidType(int value, bool allow_client=false)
Определения ItemBase.c:8673
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
Определения ItemBase.c:6865
void OnApply(PlayerBase player)
override void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
Определения ItemBase.c:8220
bool m_HideSelectionsBySlot
Определения ItemBase.c:4956
bool IsOverheatingEffectActive()
Определения ItemBase.c:5397
void SetIsBeingPlaced(bool is_being_placed)
Определения ItemBase.c:5814
int GetLiquidContainerMask()
Определения ItemBase.c:5751
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
Определения ItemBase.c:7002
ref Timer m_CheckOverheating
Определения ItemBase.c:4949
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
Определения ItemBase.c:5445
float GetEnergy()
Определения ItemBase.c:8420
bool CanBeDigged()
Определения ItemBase.c:5830
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
Определения ItemBase.c:9596
bool IsNVG()
Определения ItemBase.c:5762
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
Определения ItemBase.c:8380
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
Определения ItemBase.c:9372
bool m_IsDeploySound
Определения ItemBase.c:9675
bool CanEat()
Определения ItemBase.c:7453
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9079
override bool IsOneHandedBehaviour()
Определения ItemBase.c:9150
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
Определения ItemBase.c:9574
bool IsLiquidContainer()
Определения ItemBase.c:5746
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
Определения ItemBase.c:7473
override float GetSingleInventoryItemWeightEx()
Определения ItemBase.c:8307
void SaveAgents(ParamsWriteContext ctx)
Определения ItemBase.c:8863
override int GetTargetQuantityMax(int attSlotID=-1)
Определения ItemBase.c:8261
int m_CleannessInit
Определения ItemBase.c:4885
float GetDisinfectQuantity(int system=0, Param param1=null)
Определения ItemBase.c:5529
override int GetAgents()
Определения ItemBase.c:8810
int m_VarQuantityMax
Определения ItemBase.c:4873
override bool IsHologram()
Определения ItemBase.c:5825
float GetItemAttachOffset()
Определения ItemBase.c:8589
bool IsPlaceSound()
Определения ItemBase.c:9689
static int GetDebugActionsMask()
Определения ItemBase.c:5615
void ProcessDecay(float delta, bool hasRootAsPlayer)
Определения ItemBase.c:9452
override bool IsItemBase()
Определения ItemBase.c:7606
void PlayDeploySound()
override bool IsTwoHandedBehaviour()
Определения ItemBase.c:9160
void ExplodeAmmo()
Определения ItemBase.c:6302
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
Определения ItemBase.c:7078
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
Определения ItemBase.c:8884
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9059
override void OnEnergyAdded()
Определения ItemBase.c:8438
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
Определения ItemBase.c:5774
EffectSound m_DeployLoopSoundEx
Определения ItemBase.c:9672
override void DeSerializeNumericalVars(array< float > floats)
Определения ItemBase.c:7746
void StopItemDynamicPhysics()
Определения ItemBase.c:9354
bool HasFoodStage()
Определения ItemBase.c:7466
override void SetStoreLoad(bool value)
Определения ItemBase.c:8558
float GetOverheatingValue()
Определения ItemBase.c:5359
bool ContainsAgent(int agent_id)
Определения ItemBase.c:8763
override void AddWet(float value)
Определения ItemBase.c:8506
bool IsLiquidPresent()
Определения ItemBase.c:5741
bool IsFullQuantity()
Определения ItemBase.c:8301
override void EOnContact(IEntity other, Contact extra)
Определения ItemBase.c:6015
void SplitIntoStackMaxHands(PlayerBase player)
Определения ItemBase.c:6770
void SplitIntoStackMaxHandsClient(PlayerBase player)
Определения ItemBase.c:6746
int m_CleannessMax
Определения ItemBase.c:4887
float m_VarStackMax
Определения ItemBase.c:4875
ref Timer m_PhysDropTimer
Определения ItemBase.c:4962
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
Определения ItemBase.c:7578
override void SetStoreLoadedQuantity(float value)
Определения ItemBase.c:8568
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
Определения ItemBase.c:4916
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5380
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
Определения ItemBase.c:5695
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
Определения ItemBase.c:7500
void OnLiquidTypeChanged(int oldType, int newType)
Определения ItemBase.c:8694
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5426
void PlayDeployFinishSound()
bool AllowFoodConsumption()
Определения ItemBase.c:8616
bool m_IsOverheatingEffectActive
Определения ItemBase.c:4947
int m_LiquidContainerMask
Определения ItemBase.c:4897
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9390
override int GetCleanness()
Определения ItemBase.c:8611
bool PairWithDevice(notnull ItemBase otherDevice)
Определения ItemBase.c:9601
bool IsDeploySound()
Определения ItemBase.c:9690
static void RemoveDebugActionsMask(int mask)
Определения ItemBase.c:5635
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9099
int m_VarQuantityMin
Определения ItemBase.c:4872
void PerformDamageSystemReinit()
Определения ItemBase.c:9360
override void ClearInventory()
Определения ItemBase.c:8399
static int m_LastRegisteredWeaponID
Определения ItemBase.c:4944
ItemBase GetLightSourceItem()
Определения ItemBase.c:9584
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
Определения ItemBase.c:7596
override float GetItemOverheatThreshold()
Определения ItemBase.c:9534
void StopDeployLoopSoundEx()
bool m_CanThisBeSplit
Определения ItemBase.c:4909
override void SerializeNumericalVars(array< float > floats_out)
Определения ItemBase.c:7710
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
Определения ItemBase.c:6685
float m_ItemModelLength
Определения ItemBase.c:4895
bool m_IsHologram
Определения ItemBase.c:4902
static int m_DebugActionsMask
Определения ItemBase.c:4862
void KillAllOverheatingParticles()
Определения ItemBase.c:5495
bool CanBeCookedOnStick()
Определения ItemBase.c:7483
override int GetQuantityMax()
Определения ItemBase.c:8248
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
Определения ItemBase.c:7156
void OnActivatedByTripWire()
bool IsColorSet()
Определения ItemBase.c:8654
override void RemoveAgent(int agent_id)
Определения ItemBase.c:8776
bool m_ItemBeingDroppedPhys
Определения ItemBase.c:4905
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:8966
void PlayDetachSound(string slot_type)
Определения ItemBase.c:9330
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
Определения ItemBase.c:4856
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9663
override bool IsBeingPlaced()
Определения ItemBase.c:5809
int GetQuantityInit()
Определения ItemBase.c:8285
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7098
bool IsResultOfSplit()
Определения ItemBase.c:7083
bool m_FixDamageSystemInit
Определения ItemBase.c:4907
float m_ImpactSpeed
Определения ItemBase.c:4891
bool m_IsStoreLoad
Определения ItemBase.c:4910
int GetLiquidTypeInit()
Определения ItemBase.c:8684
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
Определения ItemBase.c:4925
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
Определения ItemBase.c:5682
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6557
int m_AttachedAgents
Определения ItemBase.c:4933
string m_LockSoundSet
Определения ItemBase.c:4968
void LoadParticleConfigOnOverheating(int id)
Определения ItemBase.c:5303
float m_VarQuantityPrev
Определения ItemBase.c:4870
bool IsSoundSynchRemote()
Определения ItemBase.c:9688
bool m_CanShowQuantity
Определения ItemBase.c:4911
override void OnRightClick()
Определения ItemBase.c:6938
int m_ColorComponentB
Определения ItemBase.c:4920
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
Определения ItemBase.c:4858
bool IsActionTargetVisible()
Определения ItemBase.c:9196
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения ItemBase.c:6050
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Определения ItemBase.c:6339
bool m_IsBeingPlaced
Определения ItemBase.c:4901
int NameToID(string name)
Определения ItemBase.c:7683
void ~ItemBase()
Определения ItemBase.c:5580
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
Определения ItemBase.c:8546
void ClearStopItemSoundServer()
Определения ItemBase.c:9288
override string ChangeIntoOnDetach()
Определения ItemBase.c:6263
float m_VarWetMax
Определения ItemBase.c:4882
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6680
int GetLockType()
Определения ItemBase.c:8624
EffectSound m_SoundDeployFinish
Определения ItemBase.c:9670
override float GetWet()
Определения ItemBase.c:8516
EffectSound m_SoundPlace
Определения ItemBase.c:9671
float GetQuantityNormalizedScripted()
Определения ItemBase.c:8234
override void SetCleanness(int value, bool allow_client=false)
Определения ItemBase.c:8598
bool m_IsPlaceSound
Определения ItemBase.c:9674
override float GetWetMin()
Определения ItemBase.c:8526
ref ItemSoundHandler m_ItemSoundHandler
Определения ItemBase.c:4974
override bool KindOf(string tag)
Определения ItemBase.c:7612
void ItemSoundHandler(ItemBase parent)
Определения ItemSoundHandler.c:31
string Type
Определения JsonDataContaminatedArea.c:11
EffectSound m_LockingSound
Определения Land_Underground_Entrance.c:321
string GetDebugText()
Определения ModifierBase.c:71
PlayerBase GetPlayer()
Определения ModifierBase.c:51
@ LOWEST
Определения PPEConstants.c:54
void PluginItemDiagnostic()
Определения PluginItemDiagnostic.c:74
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:316
EntityAI GetItem()
Определения RadialQuickbarMenu.c:37
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
Определения RemoteDetonator.c:272
void RemoteDetonatorTrigger()
Определения RemoteDetonator.c:233
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
Определения RemoteDetonator.c:305
int particle_id
Определения SmokeSimulation.c:28
ETemperatureAccessTypes
Определения TemperatureAccessConstants.c:2
override void Explode(int damageType, string ammoType="")
Определения Trap_LandMine.c:220
bool m_Initialized
Определения UiHintPanel.c:317
void Debug()
Определения UniversalTemperatureSource.c:349
int GetID()
Определения ActionBase.c:1360
void OnItemLocationChanged(ItemBase item)
Определения ActionBase.c:998
GetInputType()
Определения ActionBase.c:215
int m_StanceMask
Определения ActionBase.c:25
int m_CommandUIDProne
Определения ActionBase.c:24
int m_CommandUID
Определения ActionBase.c:23
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
Определения AnalyticsManagerClient.c:77
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
Определения DayZGame.c:1187
proto native void GizmoSelectObject(Object object)
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto native void GizmoSelectPhysics(Physics physics)
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
Определения Global/game.c:1568
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
float GetEnergyAtSpawn()
Определения ComponentEnergyManager.c:1280
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
Определения ComponentEnergyManager.c:541
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
Определения ComponentEnergyManager.c:1275
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
Определения EffectSound.c:603
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
Определения EffectSound.c:274
override bool IsMan()
Определения 3_Game/Entities/Man.c:44
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
Определения ItemBase.c:15
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
bool WriteToContext(ParamsWriteContext ctx)
Определения InventoryLocation.c:469
proto native int GetType()
returns type of InventoryLocation
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native bool GetFlip()
returns flip status of cargo
proto native EntityAI GetItem()
returns item of current inventory location
InventoryLocation.
Определения InventoryLocation.c:29
override bool CanDisplayCargo()
Определения UndergroundStash.c:24
override void OnInventoryEnter(Man player)
Определения BarbedWire.c:203
override string GetFoldSoundset()
Определения BaseBuildingBase.c:108
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:6
override bool CanReceiveItemIntoCargo(EntityAI item)
Определения TentBase.c:913
override bool OnStoreLoad(ParamsReadContext ctx, int version)
Определения GardenBase.c:199
override void OnWasDetached(EntityAI parent, int slot_id)
override void EEOnAfterLoad()
Определения GardenBase.c:242
override void EEDelete(EntityAI parent)
Определения BaseBuildingBase.c:68
override bool CanBeRepairedByCrafting()
Определения TentBase.c:86
override void OnPlacementStarted(Man player)
Определения BatteryCharger.c:376
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
Определения BarbedWire.c:357
override bool IsElectricAppliance()
Определения BatteryCharger.c:43
override bool IsItemTent()
Определения TentBase.c:81
override void SetActions()
override string GetLoopFoldSoundset()
Определения BaseBuildingBase.c:113
override bool CanMakeGardenplot()
Определения FieldShovel.c:3
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Определения PowerGenerator.c:412
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения HandcuffsLocked.c:12
override WrittenNoteData GetWrittenNoteData()
Определения Paper.c:30
override int GetDamageSystemVersionChange()
Определения BaseBuildingBase.c:1238
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Определения PileOfWoodenPlanks.c:88
override void InitItemVariables()
Определения Matchbox.c:3
override void SetActionAnimOverrides()
Определения PickAxe.c:28
override void OnCreatePhysics()
Определения BaseBuildingBase.c:489
override string GetDeploySoundset()
Определения BarbedWire.c:392
override float GetBandagingEffectivity()
Определения BandageDressing.c:49
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Определения PowerGenerator.c:424
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
Определения BaseBuildingBase.c:496
override void OnStoreSave(ParamsWriteContext ctx)
Определения GardenBase.c:266
override void AfterStoreLoad()
Определения BarbedWire.c:155
override int GetOnDigWormsAmount()
Определения FieldShovel.c:27
override bool IsSelfAdjustingTemperature()
Определения PortableGasStove.c:287
override bool IsPlayerInside(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1037
override void OnVariablesSynchronized()
Определения GardenBase.c:97
override void RefreshPhysics()
Определения BatteryCharger.c:359
override bool CanObstruct()
Определения BaseBuildingBase.c:84
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
Определения BaseBuildingBase.c:982
override bool CanPutInCargo(EntityAI parent)
Определения GardenBase.c:331
override string GetLoopDeploySoundset()
Определения BarbedWire.c:397
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
Определения BarbedWire.c:372
override void OnInventoryExit(Man player)
Определения BatteryCharger.c:341
override bool IsTakeable()
Определения BaseBuildingBase.c:1008
override bool IsIgnoredByConstruction()
Определения BaseBuildingBase.c:1170
override void InitItemSounds()
Определения BaseBuildingBase.c:94
override void EEKilled(Object killer)
Определения HandcuffsLocked.c:70
override void OnCombine(ItemBase other_item)
Определения BandageDressing.c:71
override bool CanExplodeInFire()
Определения LargeGasCannister.c:3
override bool IsFacingPlayer(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1032
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
Определения Rag.c:61
override bool IsBloodContainer()
Определения BloodContainerBase.c:10
override bool IsClothing()
override bool CanBeSplit()
Определения Rag.c:34
override bool IsDeployable()
Определения BaseBuildingBase.c:365
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Определения ToolBase.c:24
override bool CanBeDisinfected()
Определения BandageDressing.c:54
override float GetInfectionChance(int system=0, Param param=null)
Определения BandageDressing.c:59
override void OnEndPlacement()
Определения KitBase.c:65
Определения EnMath.c:7
float GetOverheatingLimitMax()
Определения WeaponParticles.c:417
void SetOverheatingLimitMax(float max)
Определения WeaponParticles.c:407
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
Определения WeaponParticles.c:422
float GetOverheatingLimitMin()
Определения WeaponParticles.c:412
Particle GetParticle()
Определения WeaponParticles.c:397
void SetOverheatingLimitMin(float min)
Определения WeaponParticles.c:402
void RegisterParticle(Particle p)
Определения WeaponParticles.c:392
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
Определения Particle.c:266
void SetControlledDevice(EntityAI pDevice)
Определения RemoteDetonator.c:140
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
proto void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto native void Send()
proto bool Write(void value_out)
proto bool Read(void value_in)
bool m_Loop
Определения ItemSoundHandler.c:5
override void Stop()
Определения DayZPlayerImplement.c:64
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
Определения UIManager.c:160
override void Refresh()
Определения ChatInputMenu.c:70
void SetCalcDetails(string details)
Определения 3_Game/tools/Debug.c:816
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Определения WrittenNoteData.c:13
const float LOWEST
Определения EnConvert.c:100
Serializer ParamsReadContext
Определения gameplay.c:15
class LOD Object
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Определения gameplay.c:6
proto native CGame GetGame()
Serializer ParamsWriteContext
Определения gameplay.c:16
const int DEF_BIOLOGICAL
Определения 3_Game/constants.c:512
const int DEF_CHEMICAL
Определения 3_Game/constants.c:513
const int COMP_TYPE_ENERGY_MANAGER
Определения Component.c:9
ErrorExSeverity
Определения EnDebug.c:62
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90
enum ShapeType ErrorEx
proto native void SetColor(int color)
array< string > TStringArray
Определения EnScript.c:709
array< int > TIntArray
Определения EnScript.c:711
EntityEvent
Entity events for event-mask, or throwing event from code.
Определения EnEntity.c:45
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Определения 3_Game/constants.c:808
const int VARIABLE_LIQUIDTYPE
Определения 3_Game/constants.c:632
const int VARIABLE_CLEANNESS
Определения 3_Game/constants.c:635
const int VARIABLE_COLOR
Определения 3_Game/constants.c:634
const int VARIABLE_TEMPERATURE
Определения 3_Game/constants.c:630
const int VARIABLE_QUANTITY
Определения 3_Game/constants.c:628
const int VARIABLE_WET
Определения 3_Game/constants.c:631
const int LIQUID_NONE
Определения 3_Game/constants.c:529
static proto float AbsFloat(float f)
Returns absolute value.
const int MENU_INVENTORY
Определения 3_Game/constants.c:180
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_CRAFTING
Определения 3_Game/constants.c:453
const int SAT_DEBUG_ACTION
Определения 3_Game/constants.c:454
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.
const int CALL_CATEGORY_GAMEPLAY
Определения 3_Game/tools/tools.c:10
const int CALL_CATEGORY_SYSTEM
Определения 3_Game/tools/tools.c:8
proto native int GetColor()