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

◆ GetBaitEffectivity()

float SpawnItemOnLocation::GetBaitEffectivity ( )
protected

generic effectivity as a bait for animal catching

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

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