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

◆ GetTemperatureThawTime()

override float SpawnItemOnLocation::GetTemperatureThawTime ( )
protected

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

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

Используется в Entity::HandleFreezingProgression().