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

◆ IsCoverFaceForShave()

bool SpawnItemOnLocation::IsCoverFaceForShave ( string slot_name)
protected

DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.

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

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