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

◆ StopItemSoundServer()

void SpawnItemOnLocation::StopItemSoundServer ( int id)
protected

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

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