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

◆ GetTemperatureFreezeTime()

override float SpawnItemOnLocation::GetTemperatureFreezeTime ( )
protected

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

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

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