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

◆ IsPlaceSound()

bool SpawnItemOnLocation::IsPlaceSound ( )
protected

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

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