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

◆ ContainsAgent()

bool SpawnItemOnLocation::ContainsAgent ( int agent_id)
protected

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

8767{
8768 override bool CanPutAsAttachment(EntityAI parent)
8769 {
8770 return true;
8771 }
8772};
8773
8774//const bool QUANTITY_DEBUG_REMOVE_ME = false;
8775
8776class ItemBase extends InventoryItem
8777{
8781
8783
8784 static int m_DebugActionsMask;
8786 // ============================================
8787 // Variable Manipulation System
8788 // ============================================
8789 // Quantity
8790
8791 float m_VarQuantity;
8792 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
8794 int m_VarQuantityMin;
8795 int m_VarQuantityMax;
8796 int m_Count;
8797 float m_VarStackMax;
8798 float m_StoreLoadedQuantity = float.LOWEST;
8799 // Wet
8800 float m_VarWet;
8801 float m_VarWetPrev;//for client to know wetness changed during synchronization
8802 float m_VarWetInit;
8803 float m_VarWetMin;
8804 float m_VarWetMax;
8805 // Cleanness
8806 int m_Cleanness;
8807 int m_CleannessInit;
8808 int m_CleannessMin;
8809 int m_CleannessMax;
8810 // impact sounds
8812 bool m_CanPlayImpactSound = true;
8813 float m_ImpactSpeed;
8815 //
8816 float m_HeatIsolation;
8817 float m_ItemModelLength;
8818 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
8820 int m_VarLiquidType;
8821 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
8822 int m_QuickBarBonus;
8823 bool m_IsBeingPlaced;
8824 bool m_IsHologram;
8825 bool m_IsTakeable;
8826 bool m_ThrowItemOnDrop;
8829 bool m_FixDamageSystemInit = false; //can be changed on storage version check
8830 bool can_this_be_combined; //Check if item can be combined
8831 bool m_CanThisBeSplit; //Check if item can be split
8832 bool m_IsStoreLoad = false;
8833 bool m_CanShowQuantity;
8834 bool m_HasQuantityBar;
8835 protected bool m_CanBeDigged;
8836 protected bool m_IsResultOfSplit
8837
8838 string m_SoundAttType;
8839 // items color variables
8844 //-------------------------------------------------------
8845
8846 // light source managing
8848
8852
8853 //==============================================
8854 // agent system
8855 private int m_AttachedAgents;
8856
8858 void TransferModifiers(PlayerBase reciever);
8859
8860
8861 // Weapons & suppressors particle effects
8866 static int m_LastRegisteredWeaponID = 0;
8867
8868 // Overheating effects
8870 float m_OverheatingShots;
8871 ref Timer m_CheckOverheating;
8872 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
8873 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
8874 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
8875 ref array <ref OverheatingParticle> m_OverheatingParticles;
8876
8878 protected bool m_HideSelectionsBySlot;
8879
8880 // Admin Log
8881 PluginAdminLog m_AdminLog;
8882
8883 // misc
8884 ref Timer m_PhysDropTimer;
8885
8886 // Attachment Locking variables
8887 ref array<int> m_CompatibleLocks;
8888 protected int m_LockType;
8889 protected ref EffectSound m_LockingSound;
8890 protected string m_LockSoundSet;
8891
8892 // ItemSoundHandler
8893 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
8894 protected int m_SoundSyncPlay; // id for sound to play
8895 protected int m_SoundSyncStop; // id for sound to stop
8897
8898 //temperature
8899 private float m_TemperaturePerQuantityWeight;
8900
8901 // -------------------------------------------------------------------------
8902 void ItemBase()
8903 {
8904 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
8908
8909 if (!GetGame().IsDedicatedServer())
8910 {
8911 if (HasMuzzle())
8912 {
8914
8916 {
8918 }
8919 }
8920
8922 m_ActionsInitialize = false;
8923 }
8924
8925 m_OldLocation = null;
8926
8927 if (GetGame().IsServer())
8928 {
8929 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
8930 }
8931
8932 if (ConfigIsExisting("headSelectionsToHide"))
8933 {
8935 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
8936 }
8937
8938 m_HideSelectionsBySlot = false;
8939 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8940 {
8941 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
8942 }
8943
8944 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
8945
8946 m_IsResultOfSplit = false;
8947
8949 }
8950
8951 override void InitItemVariables()
8952 {
8953 super.InitItemVariables();
8954
8955 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
8956 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
8957 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
8958 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
8959 m_VarStackMax = ConfigGetFloat("varStackMax");
8960 m_Count = ConfigGetInt("count");
8961
8962 m_CanShowQuantity = ConfigGetBool("quantityShow");
8963 m_HasQuantityBar = ConfigGetBool("quantityBar");
8964
8965 m_CleannessInit = ConfigGetInt("varCleannessInit");
8967 m_CleannessMin = ConfigGetInt("varCleannessMin");
8968 m_CleannessMax = ConfigGetInt("varCleannessMax");
8969
8970 m_WantPlayImpactSound = false;
8971 m_ImpactSpeed = 0.0;
8972
8973 m_VarWetInit = ConfigGetFloat("varWetInit");
8975 m_VarWetMin = ConfigGetFloat("varWetMin");
8976 m_VarWetMax = ConfigGetFloat("varWetMax");
8977
8978 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
8979 if (IsLiquidContainer() && GetQuantity() != 0)
8981 m_IsBeingPlaced = false;
8982 m_IsHologram = false;
8983 m_IsTakeable = true;
8984 m_CanBeMovedOverride = false;
8988 m_CanBeDigged = ConfigGetBool("canBeDigged");
8989
8990 m_CompatibleLocks = new array<int>();
8991 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
8992 m_LockType = ConfigGetInt("lockType");
8993
8994 //Define if item can be split and set ability to be combined accordingly
8995 m_CanThisBeSplit = false;
8996 can_this_be_combined = false;
8997 if (ConfigIsExisting("canBeSplit"))
8998 {
8999 can_this_be_combined = ConfigGetBool("canBeSplit");
9001 }
9002
9003 m_ItemBehaviour = -1;
9004 if (ConfigIsExisting("itemBehaviour"))
9005 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
9006
9007 //RegisterNetSyncVariableInt("m_VariablesMask");
9008 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
9009 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
9010 RegisterNetSyncVariableInt("m_VarLiquidType");
9011 RegisterNetSyncVariableInt("m_Cleanness",0,1);
9012
9013 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
9014 RegisterNetSyncVariableFloat("m_ImpactSpeed");
9015 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
9016
9017 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
9018 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
9019 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
9020 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
9021
9022 RegisterNetSyncVariableBool("m_IsBeingPlaced");
9023 RegisterNetSyncVariableBool("m_IsTakeable");
9024 RegisterNetSyncVariableBool("m_IsHologram");
9025
9026 InitItemSounds();
9028 {
9029 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
9030 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
9031 }
9032
9033 m_LockSoundSet = ConfigGetString("lockSoundSet");
9034
9036 if (ConfigIsExisting("temperaturePerQuantityWeight"))
9037 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
9038
9039 }
9040
9041 override int GetQuickBarBonus()
9042 {
9043 return m_QuickBarBonus;
9044 }
9045
9046 void InitializeActions()
9047 {
9049 if (!m_InputActionMap)
9050 {
9052 m_InputActionMap = iam;
9053 SetActions();
9055 }
9056 }
9057
9058 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
9059 {
9061 {
9062 m_ActionsInitialize = true;
9064 }
9065
9066 actions = m_InputActionMap.Get(action_input_type);
9067 }
9068
9069 void SetActions()
9070 {
9071 AddAction(ActionTakeItem);
9072 AddAction(ActionTakeItemToHands);
9073 AddAction(ActionWorldCraft);
9075 AddAction(ActionAttachWithSwitch);
9076 }
9077
9078 void SetActionAnimOverrides(); // Override action animation for specific item
9079
9080 void AddAction(typename actionName)
9081 {
9082 ActionBase action = ActionManagerBase.GetAction(actionName);
9083
9084 if (!action)
9085 {
9086 Debug.LogError("Action " + actionName + " dosn't exist!");
9087 return;
9088 }
9089
9090 typename ai = action.GetInputType();
9091 if (!ai)
9092 {
9093 m_ActionsInitialize = false;
9094 return;
9095 }
9096
9097 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
9098 if (!action_array)
9099 {
9100 action_array = new array<ActionBase_Basic>;
9101 m_InputActionMap.Insert(ai, action_array);
9102 }
9103 if (LogManager.IsActionLogEnable())
9104 {
9105 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
9106 }
9107
9108 if (action_array.Find(action) != -1)
9109 {
9110 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
9111 }
9112 else
9113 {
9114 action_array.Insert(action);
9115 }
9116 }
9117
9118 void RemoveAction(typename actionName)
9119 {
9120 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
9121 ActionBase action = player.GetActionManager().GetAction(actionName);
9122 typename ai = action.GetInputType();
9123 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
9124
9125 if (action_array)
9126 {
9127 action_array.RemoveItem(action);
9128 }
9129 }
9130
9131 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
9132 // Set -1 for params which should stay in default state
9133 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
9134 {
9135 ActionOverrideData overrideData = new ActionOverrideData();
9136 overrideData.m_CommandUID = commandUID;
9137 overrideData.m_CommandUIDProne = commandUIDProne;
9138 overrideData.m_StanceMask = stanceMask;
9139
9140 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
9141 if (!actionMap) // create new map of action > overidables map
9142 {
9143 actionMap = new TActionAnimOverrideMap();
9144 m_ItemActionOverrides.Insert(action, actionMap);
9145 }
9146
9147 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
9148
9149 }
9150
9151 void OnItemInHandsPlayerSwimStart(PlayerBase player);
9152
9153 ScriptedLightBase GetLight();
9154
9155 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
9156 void LoadParticleConfigOnFire(int id)
9157 {
9158 if (!m_OnFireEffect)
9160
9163
9164 string config_to_search = "CfgVehicles";
9165 string muzzle_owner_config;
9166
9167 if (!m_OnFireEffect.Contains(id))
9168 {
9169 if (IsInherited(Weapon))
9170 config_to_search = "CfgWeapons";
9171
9172 muzzle_owner_config = config_to_search + " " + GetType() + " ";
9173
9174 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9175
9176 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
9177
9178 if (config_OnFire_subclass_count > 0)
9179 {
9180 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9181
9182 for (int i = 0; i < config_OnFire_subclass_count; i++)
9183 {
9184 string particle_class = "";
9185 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
9186 string config_OnFire_entry = config_OnFire_class + particle_class;
9187 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9188 WPOF_array.Insert(WPOF);
9189 }
9190
9191
9192 m_OnFireEffect.Insert(id, WPOF_array);
9193 }
9194 }
9195
9196 if (!m_OnBulletCasingEjectEffect.Contains(id))
9197 {
9198 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
9199 muzzle_owner_config = config_to_search + " " + GetType() + " ";
9200
9201 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9202
9203 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9204
9205 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9206 {
9207 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9208
9209 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9210 {
9211 string particle_class2 = "";
9212 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9213 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9214 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9215 WPOBE_array.Insert(WPOBE);
9216 }
9217
9218
9219 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
9220 }
9221 }
9222 }
9223
9224 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
9226 {
9229
9230 if (!m_OnOverheatingEffect.Contains(id))
9231 {
9232 string config_to_search = "CfgVehicles";
9233
9234 if (IsInherited(Weapon))
9235 config_to_search = "CfgWeapons";
9236
9237 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
9238 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9239
9240 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
9241 {
9242
9243 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
9244
9246 {
9247 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
9248 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9249 Error(error);
9250 return;
9251 }
9252
9253 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
9254 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
9255
9256
9257
9258 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
9259 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9260
9261 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9262 {
9263 string particle_class = "";
9264 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9265 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9266 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
9267
9268 if (entry_type == CT_CLASS)
9269 {
9270 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9271 WPOOH_array.Insert(WPOF);
9272 }
9273 }
9274
9275
9276 m_OnOverheatingEffect.Insert(id, WPOOH_array);
9277 }
9278 }
9279 }
9280
9281 float GetOverheatingValue()
9282 {
9283 return m_OverheatingShots;
9284 }
9285
9286 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9287 {
9288 if (m_MaxOverheatingValue > 0)
9289 {
9291
9292 if (!m_CheckOverheating)
9294
9296 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
9297
9298 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9299 }
9300 }
9301
9302 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9303 {
9305 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9306
9308 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9309
9311 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9312
9314 {
9316 }
9317 }
9318
9320 {
9322 }
9323
9324 void OnOverheatingDecay()
9325 {
9326 if (m_MaxOverheatingValue > 0)
9327 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
9328 else
9330
9331 if (m_OverheatingShots <= 0)
9332 {
9335 }
9336 else
9337 {
9338 if (!m_CheckOverheating)
9340
9342 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
9343 }
9344
9345 CheckOverheating(this, "", this);
9346 }
9347
9348 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9349 {
9351 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
9352 }
9353
9354 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9355 {
9357 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
9359 }
9360
9361 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9362 {
9364 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9365 }
9366
9367 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
9368 {
9370 m_OverheatingParticles = new array<ref OverheatingParticle>;
9371
9372 OverheatingParticle OP = new OverheatingParticle();
9373 OP.RegisterParticle(p);
9374 OP.SetOverheatingLimitMin(min_heat_coef);
9375 OP.SetOverheatingLimitMax(max_heat_coef);
9376 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
9377
9378 m_OverheatingParticles.Insert(OP);
9379 }
9380
9381 float GetOverheatingCoef()
9382 {
9383 if (m_MaxOverheatingValue > 0)
9385
9386 return -1;
9387 }
9388
9390 {
9392 {
9393 float overheat_coef = GetOverheatingCoef();
9394 int count = m_OverheatingParticles.Count();
9395
9396 for (int i = count; i > 0; --i)
9397 {
9398 int id = i - 1;
9399 OverheatingParticle OP = m_OverheatingParticles.Get(id);
9400 Particle p = OP.GetParticle();
9401
9402 float overheat_min = OP.GetOverheatingLimitMin();
9403 float overheat_max = OP.GetOverheatingLimitMax();
9404
9405 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9406 {
9407 if (p)
9408 {
9409 p.Stop();
9410 OP.RegisterParticle(null);
9411 }
9412 }
9413 }
9414 }
9415 }
9416
9418 {
9420 {
9421 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
9422 {
9423 int id = i - 1;
9424 OverheatingParticle OP = m_OverheatingParticles.Get(id);
9425
9426 if (OP)
9427 {
9428 Particle p = OP.GetParticle();
9429
9430 if (p)
9431 {
9432 p.Stop();
9433 }
9434
9435 delete OP;
9436 }
9437 }
9438
9439 m_OverheatingParticles.Clear();
9441 }
9442 }
9443
9445 float GetInfectionChance(int system = 0, Param param = null)
9446 {
9447 return 0.0;
9448 }
9449
9450
9451 float GetDisinfectQuantity(int system = 0, Param param1 = null)
9452 {
9453 return 250;//default value
9454 }
9455
9456 float GetFilterDamageRatio()
9457 {
9458 return 0;
9459 }
9460
9462 bool HasMuzzle()
9463 {
9464 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
9465 return true;
9466
9467 return false;
9468 }
9469
9471 int GetMuzzleID()
9472 {
9473 if (!m_WeaponTypeToID)
9475
9476 if (m_WeaponTypeToID.Contains(GetType()))
9477 {
9478 return m_WeaponTypeToID.Get(GetType());
9479 }
9480 else
9481 {
9482 // Register new weapon ID
9484 }
9485
9487 }
9488
9495 {
9496 return -1;
9497 }
9498
9499
9500
9501 // -------------------------------------------------------------------------
9502 void ~ItemBase()
9503 {
9504 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
9505 {
9506 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
9507 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9508
9509 if (r_index >= 0)
9510 {
9511 InventoryLocation r_il = new InventoryLocation;
9512 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9513
9514 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9515 int r_type = r_il.GetType();
9516 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
9517 {
9518 r_il.GetParent().GetOnReleaseLock().Invoke(this);
9519 }
9520 else if (r_type == InventoryLocationType.ATTACHMENT)
9521 {
9522 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
9523 }
9524
9525 }
9526
9527 player.GetHumanInventory().ClearUserReservedLocation(this);
9528 }
9529
9530 if (m_LockingSound)
9531 SEffectManager.DestroyEffect(m_LockingSound);
9532 }
9533
9534
9535
9536 // -------------------------------------------------------------------------
9537 static int GetDebugActionsMask()
9538 {
9539 return ItemBase.m_DebugActionsMask;
9540 }
9541
9542 static bool HasDebugActionsMask(int mask)
9543 {
9544 return ItemBase.m_DebugActionsMask & mask;
9545 }
9546
9547 static void SetDebugActionsMask(int mask)
9548 {
9549 ItemBase.m_DebugActionsMask = mask;
9550 }
9551
9552 static void AddDebugActionsMask(int mask)
9553 {
9554 ItemBase.m_DebugActionsMask |= mask;
9555 }
9556
9557 static void RemoveDebugActionsMask(int mask)
9558 {
9559 ItemBase.m_DebugActionsMask &= ~mask;
9560 }
9561
9562 static void ToggleDebugActionsMask(int mask)
9563 {
9564 if (HasDebugActionsMask(mask))
9565 {
9567 }
9568 else
9569 {
9570 AddDebugActionsMask(mask);
9571 }
9572 }
9573
9574 // -------------------------------------------------------------------------
9575 void SetCEBasedQuantity()
9576 {
9577 if (GetEconomyProfile())
9578 {
9579 float q_max = GetEconomyProfile().GetQuantityMax();
9580 if (q_max > 0)
9581 {
9582 float q_min = GetEconomyProfile().GetQuantityMin();
9583 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9584
9585 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
9586 {
9587 ComponentEnergyManager comp = GetCompEM();
9588 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
9589 {
9590 comp.SetEnergy0To1(quantity_randomized);
9591 }
9592 }
9593 else if (HasQuantity())
9594 {
9595 SetQuantityNormalized(quantity_randomized, false);
9596 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
9597 }
9598
9599 }
9600 }
9601 }
9602
9604 void LockToParent()
9605 {
9606 EntityAI parent = GetHierarchyParent();
9607
9608 if (parent)
9609 {
9610 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9611 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9612 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
9613 }
9614 }
9615
9617 void UnlockFromParent()
9618 {
9619 EntityAI parent = GetHierarchyParent();
9620
9621 if (parent)
9622 {
9623 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9624 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9625 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
9626 }
9627 }
9628
9629 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
9630 {
9631 /*
9632 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
9633 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
9634 */
9635 ItemBase item2 = ItemBase.Cast(entity2);
9636
9637 if (GetGame().IsClient())
9638 {
9639 if (ScriptInputUserData.CanStoreInputUserData())
9640 {
9641 ScriptInputUserData ctx = new ScriptInputUserData;
9643 ctx.Write(-1);
9644 ItemBase i1 = this; // @NOTE: workaround for correct serialization
9645 ctx.Write(i1);
9646 ctx.Write(item2);
9647 ctx.Write(use_stack_max);
9648 ctx.Write(-1);
9649 ctx.Send();
9650
9651 if (IsCombineAll(item2, use_stack_max))
9652 {
9653 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9654 }
9655 }
9656 }
9657 else if (!GetGame().IsMultiplayer())
9658 {
9659 CombineItems(item2, use_stack_max);
9660 }
9661 }
9662
9663 bool IsLiquidPresent()
9664 {
9665 return (GetLiquidType() != 0 && HasQuantity());
9666 }
9667
9668 bool IsLiquidContainer()
9669 {
9670 return m_LiquidContainerMask != 0;
9671 }
9672
9674 {
9675 return m_LiquidContainerMask;
9676 }
9677
9678 bool IsBloodContainer()
9679 {
9680 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
9681 return false;
9682 }
9683
9684 bool IsNVG()
9685 {
9686 return false;
9687 }
9688
9691 bool IsExplosive()
9692 {
9693 return false;
9694 }
9695
9697 {
9698 return "";
9699 }
9700
9702
9703 bool IsLightSource()
9704 {
9705 return false;
9706 }
9707
9709 {
9710 return true;
9711 }
9712
9713 //--- ACTION CONDITIONS
9714 //direction
9715 bool IsFacingPlayer(PlayerBase player, string selection)
9716 {
9717 return true;
9718 }
9719
9720 bool IsPlayerInside(PlayerBase player, string selection)
9721 {
9722 return true;
9723 }
9724
9725 override bool CanObstruct()
9726 {
9727 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
9728 return !player || !IsPlayerInside(player, "");
9729 }
9730
9731 override bool IsBeingPlaced()
9732 {
9733 return m_IsBeingPlaced;
9734 }
9735
9736 void SetIsBeingPlaced(bool is_being_placed)
9737 {
9738 m_IsBeingPlaced = is_being_placed;
9739 if (!is_being_placed)
9741 SetSynchDirty();
9742 }
9743
9744 //server-side
9745 void OnEndPlacement() {}
9746
9747 override bool IsHologram()
9748 {
9749 return m_IsHologram;
9750 }
9751
9752 bool CanBeDigged()
9753 {
9754 return m_CanBeDigged;
9755 }
9756
9758 {
9759 return 1;
9760 }
9761
9762 bool CanMakeGardenplot()
9763 {
9764 return false;
9765 }
9766
9767 void SetIsHologram(bool is_hologram)
9768 {
9769 m_IsHologram = is_hologram;
9770 SetSynchDirty();
9771 }
9772 /*
9773 protected float GetNutritionalEnergy()
9774 {
9775 Edible_Base edible = Edible_Base.Cast(this);
9776 return edible.GetFoodEnergy();
9777 }
9778
9779 protected float GetNutritionalWaterContent()
9780 {
9781 Edible_Base edible = Edible_Base.Cast(this);
9782 return edible.GetFoodWater();
9783 }
9784
9785 protected float GetNutritionalIndex()
9786 {
9787 Edible_Base edible = Edible_Base.Cast(this);
9788 return edible.GetFoodNutritionalIndex();
9789 }
9790
9791 protected float GetNutritionalFullnessIndex()
9792 {
9793 Edible_Base edible = Edible_Base.Cast(this);
9794 return edible.GetFoodTotalVolume();
9795 }
9796
9797 protected float GetNutritionalToxicity()
9798 {
9799 Edible_Base edible = Edible_Base.Cast(this);
9800 return edible.GetFoodToxicity();
9801
9802 }
9803 */
9804
9805
9806 // -------------------------------------------------------------------------
9807 override void OnMovedInsideCargo(EntityAI container)
9808 {
9809 super.OnMovedInsideCargo(container);
9810
9811 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9812 }
9813
9814 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9815 {
9816 super.EEItemLocationChanged(oldLoc,newLoc);
9817
9818 PlayerBase new_player = null;
9819 PlayerBase old_player = null;
9820
9821 if (newLoc.GetParent())
9822 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9823
9824 if (oldLoc.GetParent())
9825 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9826
9827 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
9828 {
9829 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
9830
9831 if (r_index >= 0)
9832 {
9833 InventoryLocation r_il = new InventoryLocation;
9834 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9835
9836 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9837 int r_type = r_il.GetType();
9838 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
9839 {
9840 r_il.GetParent().GetOnReleaseLock().Invoke(this);
9841 }
9842 else if (r_type == InventoryLocationType.ATTACHMENT)
9843 {
9844 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
9845 }
9846
9847 }
9848 }
9849
9850 if (newLoc.GetType() == InventoryLocationType.HANDS)
9851 {
9852 if (new_player)
9853 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
9854
9855 if (new_player == old_player)
9856 {
9857
9858 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9859 {
9860 if (oldLoc.GetType() == InventoryLocationType.CARGO)
9861 {
9862 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9863 {
9864 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9865 }
9866 }
9867 else
9868 {
9869 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9870 }
9871 }
9872
9873 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9874 {
9875 int type = oldLoc.GetType();
9876 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
9877 {
9878 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9879 }
9880 else if (type == InventoryLocationType.ATTACHMENT)
9881 {
9882 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9883 }
9884 }
9885 if (!m_OldLocation)
9886 {
9887 m_OldLocation = new InventoryLocation;
9888 }
9889 m_OldLocation.Copy(oldLoc);
9890 }
9891 else
9892 {
9893 if (m_OldLocation)
9894 {
9895 m_OldLocation.Reset();
9896 }
9897 }
9898
9900 }
9901 else
9902 {
9903 if (new_player)
9904 {
9905 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9906 if (res_index >= 0)
9907 {
9908 InventoryLocation il = new InventoryLocation;
9909 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
9910 ItemBase it = ItemBase.Cast(il.GetItem());
9911 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
9912 int rel_type = il.GetType();
9913 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
9914 {
9915 il.GetParent().GetOnReleaseLock().Invoke(it);
9916 }
9917 else if (rel_type == InventoryLocationType.ATTACHMENT)
9918 {
9919 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
9920 }
9921 //it.GetOnReleaseLock().Invoke(it);
9922 }
9923 }
9924 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
9925 {
9926 //ThrowPhysically(old_player, vector.Zero);
9927 m_ThrowItemOnDrop = false;
9928 }
9929
9930 if (m_OldLocation)
9931 {
9932 m_OldLocation.Reset();
9933 }
9934 }
9935 }
9936
9937 override void EOnContact(IEntity other, Contact extra)
9938 {
9940 {
9941 int liquidType = -1;
9942 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
9943 if (impactSpeed > 0.0)
9944 {
9945 m_ImpactSpeed = impactSpeed;
9946 #ifndef SERVER
9947 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
9948 #else
9949 m_WantPlayImpactSound = true;
9950 SetSynchDirty();
9951 #endif
9952 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
9953 }
9954 }
9955
9956 #ifdef SERVER
9957 if (GetCompEM() && GetCompEM().IsPlugged())
9958 {
9959 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
9960 GetCompEM().UnplugThis();
9961 }
9962 #endif
9963 }
9964
9965 void RefreshPhysics();
9966
9967 override void OnCreatePhysics()
9968 {
9970 }
9971
9972 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9973 {
9974
9975 }
9976 // -------------------------------------------------------------------------
9977 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
9978 {
9979 super.OnItemLocationChanged(old_owner, new_owner);
9980
9981 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9982 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9983
9984 if (!relatedPlayer && playerNew)
9985 relatedPlayer = playerNew;
9986
9987 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9988 {
9989 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
9990 if (actionMgr)
9991 {
9992 ActionBase currentAction = actionMgr.GetRunningAction();
9993 if (currentAction)
9994 currentAction.OnItemLocationChanged(this);
9995 }
9996 }
9997
9998 Man ownerPlayerOld = null;
9999 Man ownerPlayerNew = null;
10000
10001 if (old_owner)
10002 {
10003 if (old_owner.IsMan())
10004 {
10005 ownerPlayerOld = Man.Cast(old_owner);
10006 }
10007 else
10008 {
10009 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
10010 }
10011 }
10012 else
10013 {
10014 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
10015 {
10016 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
10017
10018 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
10019 {
10020 GetCompEM().UnplugThis();
10021 }
10022 }
10023 }
10024
10025 if (new_owner)
10026 {
10027 if (new_owner.IsMan())
10028 {
10029 ownerPlayerNew = Man.Cast(new_owner);
10030 }
10031 else
10032 {
10033 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
10034 }
10035 }
10036
10037 if (ownerPlayerOld != ownerPlayerNew)
10038 {
10039 if (ownerPlayerOld)
10040 {
10041 array<EntityAI> subItemsExit = new array<EntityAI>;
10042 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
10043 for (int i = 0; i < subItemsExit.Count(); i++)
10044 {
10045 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
10046 itemExit.OnInventoryExit(ownerPlayerOld);
10047 }
10048 }
10049
10050 if (ownerPlayerNew)
10051 {
10052 array<EntityAI> subItemsEnter = new array<EntityAI>;
10053 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
10054 for (int j = 0; j < subItemsEnter.Count(); j++)
10055 {
10056 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
10057 itemEnter.OnInventoryEnter(ownerPlayerNew);
10058 }
10059 }
10060 }
10061 else if (ownerPlayerNew != null)
10062 {
10063 PlayerBase nplayer;
10064 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10065 {
10066 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10067 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
10068 for (int k = 0; k < subItemsUpdate.Count(); k++)
10069 {
10070 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
10071 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10072 }
10073 }
10074 }
10075
10076 if (old_owner)
10077 old_owner.OnChildItemRemoved(this);
10078 if (new_owner)
10079 new_owner.OnChildItemReceived(this);
10080 }
10081
10082 // -------------------------------------------------------------------------------
10083 override void EEDelete(EntityAI parent)
10084 {
10085 super.EEDelete(parent);
10086 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10087 if (player)
10088 {
10089 OnInventoryExit(player);
10090
10091 if (player.IsAlive())
10092 {
10093 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10094 if (r_index >= 0)
10095 {
10096 InventoryLocation r_il = new InventoryLocation;
10097 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10098
10099 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10100 int r_type = r_il.GetType();
10101 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
10102 {
10103 r_il.GetParent().GetOnReleaseLock().Invoke(this);
10104 }
10105 else if (r_type == InventoryLocationType.ATTACHMENT)
10106 {
10107 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
10108 }
10109
10110 }
10111
10112 player.RemoveQuickBarEntityShortcut(this);
10113 }
10114 }
10115 }
10116 // -------------------------------------------------------------------------------
10117 override void EEKilled(Object killer)
10118 {
10119 super.EEKilled(killer);
10120
10122 if (killer && killer.IsFireplace() && CanExplodeInFire())
10123 {
10124 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10125 {
10126 if (IsMagazine())
10127 {
10128 if (Magazine.Cast(this).GetAmmoCount() > 0)
10129 {
10130 ExplodeAmmo();
10131 }
10132 }
10133 else
10134 {
10135 Explode(DamageType.EXPLOSION);
10136 }
10137 }
10138 }
10139 }
10140
10141 override void OnWasAttached(EntityAI parent, int slot_id)
10142 {
10143 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10144
10145 super.OnWasAttached(parent, slot_id);
10146
10147 if (HasQuantity())
10148 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
10149
10150 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
10151 }
10152
10153 override void OnWasDetached(EntityAI parent, int slot_id)
10154 {
10155 super.OnWasDetached(parent, slot_id);
10156
10157 if (HasQuantity())
10158 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
10159 }
10160
10161 override string ChangeIntoOnAttach(string slot)
10162 {
10163 int idx;
10164 TStringArray inventory_slots = new TStringArray;
10165 TStringArray attach_types = new TStringArray;
10166
10167 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10168 if (inventory_slots.Count() < 1) //is string
10169 {
10170 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10171 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10172 }
10173 else //is array
10174 {
10175 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10176 }
10177
10178 idx = inventory_slots.Find(slot);
10179 if (idx < 0)
10180 return "";
10181
10182 return attach_types.Get(idx);
10183 }
10184
10185 override string ChangeIntoOnDetach()
10186 {
10187 int idx = -1;
10188 string slot;
10189
10190 TStringArray inventory_slots = new TStringArray;
10191 TStringArray detach_types = new TStringArray;
10192
10193 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10194 if (inventory_slots.Count() < 1) //is string
10195 {
10196 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10197 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10198 }
10199 else //is array
10200 {
10201 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10202 if (detach_types.Count() < 1)
10203 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10204 }
10205
10206 for (int i = 0; i < inventory_slots.Count(); i++)
10207 {
10208 slot = inventory_slots.Get(i);
10209 }
10210
10211 if (slot != "")
10212 {
10213 if (detach_types.Count() == 1)
10214 idx = 0;
10215 else
10216 idx = inventory_slots.Find(slot);
10217 }
10218 if (idx < 0)
10219 return "";
10220
10221 return detach_types.Get(idx);
10222 }
10223
10224 void ExplodeAmmo()
10225 {
10226 //timer
10227 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
10228
10229 //min/max time
10230 float min_time = 1;
10231 float max_time = 3;
10232 float delay = Math.RandomFloat(min_time, max_time);
10233
10234 explode_timer.Run(delay, this, "DoAmmoExplosion");
10235 }
10236
10237 void DoAmmoExplosion()
10238 {
10239 Magazine magazine = Magazine.Cast(this);
10240 int pop_sounds_count = 6;
10241 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10242
10243 //play sound
10244 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10245 string sound_name = pop_sounds[ sound_idx ];
10246 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
10247
10248 //remove ammo count
10249 magazine.ServerAddAmmoCount(-1);
10250
10251 //if condition then repeat -> ExplodeAmmo
10252 float min_temp_to_explode = 100; //min temperature for item to explode
10253
10254 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
10255 {
10256 ExplodeAmmo();
10257 }
10258 }
10259
10260 // -------------------------------------------------------------------------------
10261 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
10262 {
10263 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
10264
10265 const int CHANCE_DAMAGE_CARGO = 4;
10266 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10267 const int CHANCE_DAMAGE_NOTHING = 2;
10268
10269 if (IsClothing() || IsContainer() || IsItemTent())
10270 {
10271 float dmg = damageResult.GetDamage("","Health") * -0.5;
10272 int chances;
10273 int rnd;
10274
10275 if (GetInventory().GetCargo())
10276 {
10277 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10278 rnd = Math.RandomInt(0,chances);
10279
10280 if (rnd < CHANCE_DAMAGE_CARGO)
10281 {
10282 DamageItemInCargo(dmg);
10283 }
10284 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10285 {
10287 }
10288 }
10289 else
10290 {
10291 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10292 rnd = Math.RandomInt(0,chances);
10293
10294 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10295 {
10297 }
10298 }
10299 }
10300 }
10301
10302 bool DamageItemInCargo(float damage)
10303 {
10304 if (GetInventory().GetCargo())
10305 {
10306 int item_count = GetInventory().GetCargo().GetItemCount();
10307 if (item_count > 0)
10308 {
10309 int random_pick = Math.RandomInt(0, item_count);
10310 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
10311 if (!item.IsExplosive())
10312 {
10313 item.AddHealth("","",damage);
10314 return true;
10315 }
10316 }
10317 }
10318 return false;
10319 }
10320
10321 bool DamageItemAttachments(float damage)
10322 {
10323 int attachment_count = GetInventory().AttachmentCount();
10324 if (attachment_count > 0)
10325 {
10326 int random_pick = Math.RandomInt(0, attachment_count);
10327 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
10328 if (!attachment.IsExplosive())
10329 {
10330 attachment.AddHealth("","",damage);
10331 return true;
10332 }
10333 }
10334 return false;
10335 }
10336
10337 override bool IsSplitable()
10338 {
10339 return m_CanThisBeSplit;
10340 }
10341 //----------------
10342 override bool CanBeSplit()
10343 {
10344 if (IsSplitable() && (GetQuantity() > 1))
10345 return GetInventory().CanRemoveEntity();
10346
10347 return false;
10348 }
10349
10350 protected bool ShouldSplitQuantity(float quantity)
10351 {
10352 // don't call 'CanBeSplit' here, too strict and will introduce a freeze-crash when dismantling fence with a fireplace nearby
10353 if (!IsSplitable())
10354 return false;
10355
10356 // nothing to split?
10357 if (GetQuantity() <= 1)
10358 return false;
10359
10360 // check if we should re-use the item instead of creating a new copy?
10361 // implicit cast to int, if 'IsSplitable' returns true, these values are assumed ints
10362 int delta = GetQuantity() - quantity;
10363 if (delta == 0)
10364 return false;
10365
10366 // valid to split
10367 return true;
10368 }
10369
10370 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
10371 {
10372 if (GetGame().IsClient())
10373 {
10374 if (ScriptInputUserData.CanStoreInputUserData())
10375 {
10376 ScriptInputUserData ctx = new ScriptInputUserData;
10378 ctx.Write(1);
10379 ItemBase i1 = this; // @NOTE: workaround for correct serialization
10380 ctx.Write(i1);
10381 ctx.Write(destination_entity);
10382 ctx.Write(true);
10383 ctx.Write(slot_id);
10384 ctx.Send();
10385 }
10386 }
10387 else if (!GetGame().IsMultiplayer())
10388 {
10389 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
10390 }
10391 }
10392
10393 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
10394 {
10395 float split_quantity_new;
10396 ItemBase new_item;
10397 float quantity = GetQuantity();
10398 float stack_max = GetTargetQuantityMax(slot_id);
10399 InventoryLocation loc = new InventoryLocation;
10400
10401 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10402 {
10403 if (stack_max <= GetQuantity())
10404 split_quantity_new = stack_max;
10405 else
10406 split_quantity_new = GetQuantity();
10407
10408 if (ShouldSplitQuantity(split_quantity_new))
10409 {
10410 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
10411 if (new_item)
10412 {
10413 new_item.SetResultOfSplit(true);
10414 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10415 AddQuantity(-split_quantity_new, false, true);
10416 new_item.SetQuantity(split_quantity_new, false, true);
10417 }
10418 }
10419 }
10420 else if (destination_entity && slot_id == -1)
10421 {
10422 if (quantity > stack_max)
10423 split_quantity_new = stack_max;
10424 else
10425 split_quantity_new = quantity;
10426
10427 if (ShouldSplitQuantity(split_quantity_new))
10428 {
10429 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
10430 {
10431 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
10432 new_item = ItemBase.Cast(o);
10433 }
10434
10435 if (new_item)
10436 {
10437 new_item.SetResultOfSplit(true);
10438 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10439 AddQuantity(-split_quantity_new, false, true);
10440 new_item.SetQuantity(split_quantity_new, false, true);
10441 }
10442 }
10443 }
10444 else
10445 {
10446 if (stack_max != 0)
10447 {
10448 if (stack_max < GetQuantity())
10449 {
10450 split_quantity_new = GetQuantity() - stack_max;
10451 }
10452
10453 if (split_quantity_new == 0)
10454 {
10455 if (!GetGame().IsMultiplayer())
10456 player.PhysicalPredictiveDropItem(this);
10457 else
10458 player.ServerDropEntity(this);
10459 return;
10460 }
10461
10462 if (ShouldSplitQuantity(split_quantity_new))
10463 {
10464 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
10465
10466 if (new_item)
10467 {
10468 new_item.SetResultOfSplit(true);
10469 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10470 SetQuantity(split_quantity_new, false, true);
10471 new_item.SetQuantity(stack_max, false, true);
10472 new_item.PlaceOnSurface();
10473 }
10474 }
10475 }
10476 }
10477 }
10478
10479 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
10480 {
10481 float split_quantity_new;
10482 ItemBase new_item;
10483 float quantity = GetQuantity();
10484 float stack_max = GetTargetQuantityMax(slot_id);
10485 InventoryLocation loc = new InventoryLocation;
10486
10487 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10488 {
10489 if (stack_max <= GetQuantity())
10490 split_quantity_new = stack_max;
10491 else
10492 split_quantity_new = GetQuantity();
10493
10494 if (ShouldSplitQuantity(split_quantity_new))
10495 {
10496 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
10497 if (new_item)
10498 {
10499 new_item.SetResultOfSplit(true);
10500 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10501 AddQuantity(-split_quantity_new, false, true);
10502 new_item.SetQuantity(split_quantity_new, false, true);
10503 }
10504 }
10505 }
10506 else if (destination_entity && slot_id == -1)
10507 {
10508 if (quantity > stack_max)
10509 split_quantity_new = stack_max;
10510 else
10511 split_quantity_new = quantity;
10512
10513 if (ShouldSplitQuantity(split_quantity_new))
10514 {
10515 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
10516 {
10517 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
10518 new_item = ItemBase.Cast(o);
10519 }
10520
10521 if (new_item)
10522 {
10523 new_item.SetResultOfSplit(true);
10524 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10525 AddQuantity(-split_quantity_new, false, true);
10526 new_item.SetQuantity(split_quantity_new, false, true);
10527 }
10528 }
10529 }
10530 else
10531 {
10532 if (stack_max != 0)
10533 {
10534 if (stack_max < GetQuantity())
10535 {
10536 split_quantity_new = GetQuantity() - stack_max;
10537 }
10538
10539 if (ShouldSplitQuantity(split_quantity_new))
10540 {
10541 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
10542
10543 if (new_item)
10544 {
10545 new_item.SetResultOfSplit(true);
10546 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10547 SetQuantity(split_quantity_new, false, true);
10548 new_item.SetQuantity(stack_max, false, true);
10549 new_item.PlaceOnSurface();
10550 }
10551 }
10552 }
10553 }
10554 }
10555
10556 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
10557 {
10558 if (GetGame().IsClient())
10559 {
10560 if (ScriptInputUserData.CanStoreInputUserData())
10561 {
10562 ScriptInputUserData ctx = new ScriptInputUserData;
10564 ctx.Write(4);
10565 ItemBase thiz = this; // @NOTE: workaround for correct serialization
10566 ctx.Write(thiz);
10567 dst.WriteToContext(ctx);
10568 ctx.Send();
10569 }
10570 }
10571 else if (!GetGame().IsMultiplayer())
10572 {
10574 }
10575 }
10576
10577 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
10578 {
10579 if (GetGame().IsClient())
10580 {
10581 if (ScriptInputUserData.CanStoreInputUserData())
10582 {
10583 ScriptInputUserData ctx = new ScriptInputUserData;
10585 ctx.Write(2);
10586 ItemBase dummy = this; // @NOTE: workaround for correct serialization
10587 ctx.Write(dummy);
10588 ctx.Write(destination_entity);
10589 ctx.Write(true);
10590 ctx.Write(idx);
10591 ctx.Write(row);
10592 ctx.Write(col);
10593 ctx.Send();
10594 }
10595 }
10596 else if (!GetGame().IsMultiplayer())
10597 {
10598 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
10599 }
10600 }
10601
10602 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
10603 {
10605 }
10606
10607 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
10608 {
10609 float quantity = GetQuantity();
10610 float split_quantity_new;
10611 ItemBase new_item;
10612 if (dst.IsValid())
10613 {
10614 int slot_id = dst.GetSlot();
10615 float stack_max = GetTargetQuantityMax(slot_id);
10616
10617 if (quantity > stack_max)
10618 split_quantity_new = stack_max;
10619 else
10620 split_quantity_new = quantity;
10621
10622 if (ShouldSplitQuantity(split_quantity_new))
10623 {
10624 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
10625
10626 if (new_item)
10627 {
10628 new_item.SetResultOfSplit(true);
10629 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10630 AddQuantity(-split_quantity_new, false, true);
10631 new_item.SetQuantity(split_quantity_new, false, true);
10632 }
10633
10634 return new_item;
10635 }
10636 }
10637
10638 return null;
10639 }
10640
10641 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
10642 {
10643 float quantity = GetQuantity();
10644 float split_quantity_new;
10645 ItemBase new_item;
10646 if (destination_entity)
10647 {
10648 float stackable = GetTargetQuantityMax();
10649 if (quantity > stackable)
10650 split_quantity_new = stackable;
10651 else
10652 split_quantity_new = quantity;
10653
10654 if (ShouldSplitQuantity(split_quantity_new))
10655 {
10656 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
10657 if (new_item)
10658 {
10659 new_item.SetResultOfSplit(true);
10660 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10661 AddQuantity(-split_quantity_new, false, true);
10662 new_item.SetQuantity(split_quantity_new, false, true);
10663 }
10664 }
10665 }
10666 }
10667
10668 void SplitIntoStackMaxHandsClient(PlayerBase player)
10669 {
10670 if (GetGame().IsClient())
10671 {
10672 if (ScriptInputUserData.CanStoreInputUserData())
10673 {
10674 ScriptInputUserData ctx = new ScriptInputUserData;
10676 ctx.Write(3);
10677 ItemBase i1 = this; // @NOTE: workaround for correct serialization
10678 ctx.Write(i1);
10679 ItemBase destination_entity = this;
10680 ctx.Write(destination_entity);
10681 ctx.Write(true);
10682 ctx.Write(0);
10683 ctx.Send();
10684 }
10685 }
10686 else if (!GetGame().IsMultiplayer())
10687 {
10688 SplitIntoStackMaxHands(player);
10689 }
10690 }
10691
10692 void SplitIntoStackMaxHands(PlayerBase player)
10693 {
10694 float quantity = GetQuantity();
10695 float split_quantity_new;
10696 ref ItemBase new_item;
10697 if (player)
10698 {
10699 float stackable = GetTargetQuantityMax();
10700 if (quantity > stackable)
10701 split_quantity_new = stackable;
10702 else
10703 split_quantity_new = quantity;
10704
10705 if (ShouldSplitQuantity(split_quantity_new))
10706 {
10707 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
10708 new_item = ItemBase.Cast(in_hands);
10709 if (new_item)
10710 {
10711 new_item.SetResultOfSplit(true);
10712 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10713 AddQuantity(-split_quantity_new, false, true);
10714 new_item.SetQuantity(split_quantity_new, false, true);
10715 }
10716 }
10717 }
10718 }
10719
10720 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
10721 {
10722 float quantity = GetQuantity();
10723 float split_quantity_new = Math.Floor(quantity * 0.5);
10724
10725 if (!ShouldSplitQuantity(split_quantity_new))
10726 return;
10727
10728 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
10729
10730 if (new_item)
10731 {
10732 if (new_item.GetQuantityMax() < split_quantity_new)
10733 {
10734 split_quantity_new = new_item.GetQuantityMax();
10735 }
10736
10737 new_item.SetResultOfSplit(true);
10738 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10739
10740 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
10741 {
10742 AddQuantity(-1, false, true);
10743 new_item.SetQuantity(1, false, true);
10744 }
10745 else
10746 {
10747 AddQuantity(-split_quantity_new, false, true);
10748 new_item.SetQuantity(split_quantity_new, false, true);
10749 }
10750 }
10751 }
10752
10753 void SplitItem(PlayerBase player)
10754 {
10755 float quantity = GetQuantity();
10756 float split_quantity_new = Math.Floor(quantity / 2);
10757
10758 if (!ShouldSplitQuantity(split_quantity_new))
10759 return;
10760
10761 InventoryLocation invloc = new InventoryLocation;
10762 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
10763
10764 ItemBase new_item;
10765 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10766
10767 if (new_item)
10768 {
10769 if (new_item.GetQuantityMax() < split_quantity_new)
10770 {
10771 split_quantity_new = new_item.GetQuantityMax();
10772 }
10773 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
10774 {
10775 AddQuantity(-1, false, true);
10776 new_item.SetQuantity(1, false, true);
10777 }
10778 else if (split_quantity_new > 1)
10779 {
10780 AddQuantity(-split_quantity_new, false, true);
10781 new_item.SetQuantity(split_quantity_new, false, true);
10782 }
10783 }
10784 }
10785
10787 void OnQuantityChanged(float delta)
10788 {
10789 SetWeightDirty();
10790 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
10791
10792 if (parent)
10793 parent.OnAttachmentQuantityChangedEx(this, delta);
10794
10795 if (IsLiquidContainer())
10796 {
10797 if (GetQuantityNormalized() <= 0.0)
10798 {
10800 }
10801 else if (GetLiquidType() == LIQUID_NONE)
10802 {
10803 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
10805 }
10806 }
10807
10808 }
10809
10812 {
10813 // insert code here
10814 }
10815
10817 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
10818 {
10820 }
10821
10822 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
10823 {
10824 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10825
10826 if (GetGame().IsServer())
10827 {
10828 if (newLevel == GameConstants.STATE_RUINED)
10829 {
10831 EntityAI parent = GetHierarchyParent();
10832 if (parent && parent.IsFireplace())
10833 {
10834 CargoBase cargo = GetInventory().GetCargo();
10835 if (cargo)
10836 {
10837 for (int i = 0; i < cargo.GetItemCount(); ++i)
10838 {
10839 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
10840 }
10841 }
10842 }
10843 }
10844
10845 if (IsResultOfSplit())
10846 {
10847 // reset the splitting result flag, return to normal item behavior
10848 SetResultOfSplit(false);
10849 return;
10850 }
10851
10852 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10853 {
10854 SetCleanness(0);//unclean the item upon damage dealt
10855 }
10856 }
10857 }
10858
10859 // just the split? TODO: verify
10860 override void OnRightClick()
10861 {
10862 super.OnRightClick();
10863
10864 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
10865 {
10866 if (GetGame().IsClient())
10867 {
10868 if (ScriptInputUserData.CanStoreInputUserData())
10869 {
10870 EntityAI root = GetHierarchyRoot();
10871 Man playerOwner = GetHierarchyRootPlayer();
10872 InventoryLocation dst = new InventoryLocation;
10873
10874 // 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
10875 if (!playerOwner && root && root == this)
10876 {
10878 }
10879 else
10880 {
10881 // 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
10882 GetInventory().GetCurrentInventoryLocation(dst);
10883 if (!dst.GetParent() || dst.GetParent() && !dst.GetParent().GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.CARGO, dst))
10884 {
10885 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
10886 if (!player.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.CARGO, dst) || !playerOwner)
10887 {
10889 }
10890 else
10891 {
10892 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
10893 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
10894 this shouldnt cause issues within this scope*/
10895 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
10896 {
10898 }
10899 else
10900 {
10901 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10902 }
10903 }
10904 }
10905 }
10906
10907 ScriptInputUserData ctx = new ScriptInputUserData;
10909 ctx.Write(4);
10910 ItemBase thiz = this; // @NOTE: workaround for correct serialization
10911 ctx.Write(thiz);
10912 dst.WriteToContext(ctx);
10913 ctx.Write(true); // dummy
10914 ctx.Send();
10915 }
10916 }
10917 else if (!GetGame().IsMultiplayer())
10918 {
10919 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
10920 }
10921 }
10922 }
10923
10924 protected void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
10925 {
10926 if (root)
10927 {
10928 vector m4[4];
10929 root.GetTransform(m4);
10930 dst.SetGround(this, m4);
10931 }
10932 else
10933 {
10934 GetInventory().GetCurrentInventoryLocation(dst);
10935 }
10936 }
10937
10938 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
10939 {
10940 //TODO: delete check zero quantity check after fix double posts hands fsm events
10941 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
10942 return false;
10943
10944 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10945 return false;
10946
10947 //can_this_be_combined = ConfigGetBool("canBeSplit");
10949 return false;
10950
10951
10952 Magazine mag = Magazine.Cast(this);
10953 if (mag)
10954 {
10955 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10956 return false;
10957
10958 if (stack_max_limit)
10959 {
10960 Magazine other_mag = Magazine.Cast(other_item);
10961 if (other_item)
10962 {
10963 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10964 return false;
10965 }
10966
10967 }
10968 }
10969 else
10970 {
10971 //TODO: delete check zero quantity check after fix double posts hands fsm events
10972 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
10973 return false;
10974
10975 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
10976 return false;
10977 }
10978
10979 PlayerBase player = null;
10980 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
10981 {
10982 if (player.GetInventory().HasAttachment(this))
10983 return false;
10984
10985 if (player.IsItemsToDelete())
10986 return false;
10987 }
10988
10989 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10990 return false;
10991
10992 int slotID;
10993 string slotName;
10994 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10995 return false;
10996
10997 return true;
10998 }
10999
11000 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
11001 {
11002 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
11003 }
11004
11005 bool IsResultOfSplit()
11006 {
11007 return m_IsResultOfSplit;
11008 }
11009
11010 void SetResultOfSplit(bool value)
11011 {
11012 m_IsResultOfSplit = value;
11013 }
11014
11015 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
11016 {
11017 return ComputeQuantityUsedEx(other_item, use_stack_max);
11018 }
11019
11020 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
11021 {
11022 float other_item_quantity = other_item.GetQuantity();
11023 float this_free_space;
11024
11025 float stack_max = GetQuantityMax();
11026
11027 this_free_space = stack_max - GetQuantity();
11028
11029 if (other_item_quantity > this_free_space)
11030 {
11031 return this_free_space;
11032 }
11033 else
11034 {
11035 return other_item_quantity;
11036 }
11037 }
11038
11039 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
11040 {
11041 CombineItems(ItemBase.Cast(entity2),use_stack_max);
11042 }
11043
11044 void CombineItems(ItemBase other_item, bool use_stack_max = true)
11045 {
11046 if (!CanBeCombined(other_item, false))
11047 return;
11048
11049 if (!IsMagazine() && other_item)
11050 {
11051 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
11052 if (quantity_used != 0)
11053 {
11054 float hp1 = GetHealth01("","");
11055 float hp2 = other_item.GetHealth01("","");
11056 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
11057 hpResult = hpResult / (GetQuantity() + quantity_used);
11058
11059 hpResult *= GetMaxHealth();
11060 Math.Round(hpResult);
11061 SetHealth("", "Health", hpResult);
11062
11063 AddQuantity(quantity_used);
11064 other_item.AddQuantity(-quantity_used);
11065 }
11066 }
11067 OnCombine(other_item);
11068 }
11069
11070 void OnCombine(ItemBase other_item)
11071 {
11072 #ifdef SERVER
11073 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
11074 GetHierarchyParent().IncreaseLifetimeUp();
11075 #endif
11076 };
11077
11078 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
11079 {
11080 PlayerBase p = PlayerBase.Cast(player);
11081
11082 array<int> recipesIds = p.m_Recipes;
11083 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
11084 if (moduleRecipesManager)
11085 {
11086 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
11087 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
11088 }
11089
11090 for (int i = 0;i < recipesIds.Count(); i++)
11091 {
11092 int key = recipesIds.Get(i);
11093 string recipeName = moduleRecipesManager.GetRecipeName(key);
11094 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
11095 }
11096 }
11097
11098 // -------------------------------------------------------------------------
11099 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11100 {
11101 super.GetDebugActions(outputList);
11102
11103 //quantity
11104 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
11105 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
11106 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
11107 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
11108 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
11109
11110 //health
11111 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
11112 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
11113 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
11114 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
11115 //temperature
11116 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
11117 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
11118 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
11119 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
11120
11121 //wet
11122 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
11123 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
11124 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
11125
11126 //liquidtype
11127 if (IsLiquidContainer())
11128 {
11129 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
11130 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
11131 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
11132 }
11133
11134 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
11135 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
11136
11137 // watch
11138 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
11139 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
11140 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
11141
11142 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
11143
11144 InventoryLocation loc = new InventoryLocation();
11145 GetInventory().GetCurrentInventoryLocation(loc);
11146 if (!loc || loc.GetType() == InventoryLocationType.GROUND)
11147 {
11148 if (Gizmo_IsSupported())
11149 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GIZMO_OBJECT, "Gizmo Object", FadeColors.LIGHT_GREY));
11150 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.GIZMO_PHYSICS, "Gizmo Physics (SP Only)", FadeColors.LIGHT_GREY)); // intentionally allowed for testing physics desync
11151 }
11152
11153 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "___________________________", FadeColors.RED));
11154 }
11155
11156 // -------------------------------------------------------------------------
11157 // -------------------------------------------------------------------------
11158 // -------------------------------------------------------------------------
11159 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
11160 {
11161 super.OnAction(action_id, player, ctx);
11162
11163 if (GetGame().IsClient() || !GetGame().IsMultiplayer())
11164 {
11165 switch (action_id)
11166 {
11167 case EActions.GIZMO_OBJECT:
11168 GetGame().GizmoSelectObject(this);
11169 return true;
11170 case EActions.GIZMO_PHYSICS:
11171 GetGame().GizmoSelectPhysics(GetPhysics());
11172 return true;
11173 }
11174 }
11175
11176 if (GetGame().IsServer())
11177 {
11178 switch (action_id)
11179 {
11180 case EActions.DELETE:
11181 Delete();
11182 return true;
11183 }
11184 }
11185
11186 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
11187 {
11188 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
11189 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
11190 PlayerBase p = PlayerBase.Cast(player);
11191 if (EActions.RECIPES_RANGE_START < 1000)
11192 {
11193 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11194 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11195 }
11196 }
11197 #ifndef SERVER
11198 else if (action_id == EActions.WATCH_PLAYER)
11199 {
11200 PluginDeveloper.SetDeveloperItemClientEx(player);
11201 }
11202 #endif
11203 if (GetGame().IsServer())
11204 {
11205 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11206 {
11207 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11208 OnDebugButtonPressServer(id + 1);
11209 }
11210
11211 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11212 {
11213 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11214 InsertAgent(agent_id,100);
11215 }
11216
11217 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11218 {
11219 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11220 RemoveAgent(agent_id2);
11221 }
11222
11223 else if (action_id == EActions.ADD_QUANTITY)
11224 {
11225 if (IsMagazine())
11226 {
11227 Magazine mag = Magazine.Cast(this);
11228 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11229 }
11230 else
11231 {
11232 AddQuantity(GetQuantityMax() * 0.2);
11233 }
11234
11235 if (m_EM)
11236 {
11237 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11238 }
11239 //PrintVariables();
11240 }
11241
11242 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
11243 {
11244 if (IsMagazine())
11245 {
11246 Magazine mag2 = Magazine.Cast(this);
11247 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11248 }
11249 else
11250 {
11251 AddQuantity(- GetQuantityMax() * 0.2);
11252 }
11253 if (m_EM)
11254 {
11255 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11256 }
11257 //PrintVariables();
11258 }
11259
11260 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
11261 {
11262 SetQuantity(0);
11263
11264 if (m_EM)
11265 {
11266 m_EM.SetEnergy(0);
11267 }
11268 }
11269
11270 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
11271 {
11273
11274 if (m_EM)
11275 {
11276 m_EM.SetEnergy(m_EM.GetEnergyMax());
11277 }
11278 }
11279
11280 else if (action_id == EActions.ADD_HEALTH)
11281 {
11282 AddHealth("","",GetMaxHealth("","Health")/5);
11283 }
11284 else if (action_id == EActions.REMOVE_HEALTH)
11285 {
11286 AddHealth("","",-GetMaxHealth("","Health")/5);
11287 }
11288 else if (action_id == EActions.DESTROY_HEALTH)
11289 {
11290 SetHealth01("","",0);
11291 }
11292 else if (action_id == EActions.WATCH_ITEM)
11293 {
11295 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
11296 #ifdef DEVELOPER
11297 SetDebugDeveloper_item(this);
11298 #endif
11299 }
11300
11301 else if (action_id == EActions.ADD_TEMPERATURE)
11302 {
11303 AddTemperature(20);
11304 //PrintVariables();
11305 }
11306
11307 else if (action_id == EActions.REMOVE_TEMPERATURE)
11308 {
11309 AddTemperature(-20);
11310 //PrintVariables();
11311 }
11312
11313 else if (action_id == EActions.FLIP_FROZEN)
11314 {
11315 SetFrozen(!GetIsFrozen());
11316 //PrintVariables();
11317 }
11318
11319 else if (action_id == EActions.ADD_WETNESS)
11320 {
11321 AddWet(GetWetMax()/5);
11322 //PrintVariables();
11323 }
11324
11325 else if (action_id == EActions.REMOVE_WETNESS)
11326 {
11327 AddWet(-GetWetMax()/5);
11328 //PrintVariables();
11329 }
11330
11331 else if (action_id == EActions.LIQUIDTYPE_UP)
11332 {
11333 int curr_type = GetLiquidType();
11334 SetLiquidType(curr_type * 2);
11335 //AddWet(1);
11336 //PrintVariables();
11337 }
11338
11339 else if (action_id == EActions.LIQUIDTYPE_DOWN)
11340 {
11341 int curr_type2 = GetLiquidType();
11342 SetLiquidType(curr_type2 / 2);
11343 }
11344
11345 else if (action_id == EActions.MAKE_SPECIAL)
11346 {
11347 auto debugParams = DebugSpawnParams.WithPlayer(player);
11348 OnDebugSpawnEx(debugParams);
11349 }
11350
11351 }
11352
11353
11354 return false;
11355 }
11356
11357 // -------------------------------------------------------------------------
11358
11359
11362 void OnActivatedByTripWire();
11363
11365 void OnActivatedByItem(notnull ItemBase item);
11366
11367 //----------------------------------------------------------------
11368 //returns true if item is able to explode when put in fire
11369 bool CanExplodeInFire()
11370 {
11371 return false;
11372 }
11373
11374 //----------------------------------------------------------------
11375 bool CanEat()
11376 {
11377 return true;
11378 }
11379
11380 //----------------------------------------------------------------
11381 override bool IsIgnoredByConstruction()
11382 {
11383 return true;
11384 }
11385
11386 //----------------------------------------------------------------
11387 //has FoodStages in config?
11388 bool HasFoodStage()
11389 {
11390 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
11391 return GetGame().ConfigIsExisting(config_path);
11392 }
11393
11395 FoodStage GetFoodStage()
11396 {
11397 return null;
11398 }
11399
11400 bool CanBeCooked()
11401 {
11402 return false;
11403 }
11404
11405 bool CanBeCookedOnStick()
11406 {
11407 return false;
11408 }
11409
11411 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
11413
11414 //----------------------------------------------------------------
11415 bool CanRepair(ItemBase item_repair_kit)
11416 {
11417 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
11418 return module_repairing.CanRepair(this, item_repair_kit);
11419 }
11420
11421 //----------------------------------------------------------------
11422 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
11423 {
11424 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
11425 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11426 }
11427
11428 //----------------------------------------------------------------
11429 int GetItemSize()
11430 {
11431 /*
11432 vector v_size = this.ConfigGetVector("itemSize");
11433 int v_size_x = v_size[0];
11434 int v_size_y = v_size[1];
11435 int size = v_size_x * v_size_y;
11436 return size;
11437 */
11438
11439 return 1;
11440 }
11441
11442 //----------------------------------------------------------------
11443 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
11444 bool CanBeMovedOverride()
11445 {
11446 return m_CanBeMovedOverride;
11447 }
11448
11449 //----------------------------------------------------------------
11450 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
11451 void SetCanBeMovedOverride(bool setting)
11452 {
11453 m_CanBeMovedOverride = setting;
11454 }
11455
11456 //----------------------------------------------------------------
11464 void MessageToOwnerStatus(string text)
11465 {
11466 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11467
11468 if (player)
11469 {
11470 player.MessageStatus(text);
11471 }
11472 }
11473
11474 //----------------------------------------------------------------
11482 void MessageToOwnerAction(string text)
11483 {
11484 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11485
11486 if (player)
11487 {
11488 player.MessageAction(text);
11489 }
11490 }
11491
11492 //----------------------------------------------------------------
11500 void MessageToOwnerFriendly(string text)
11501 {
11502 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11503
11504 if (player)
11505 {
11506 player.MessageFriendly(text);
11507 }
11508 }
11509
11510 //----------------------------------------------------------------
11518 void MessageToOwnerImportant(string text)
11519 {
11520 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11521
11522 if (player)
11523 {
11524 player.MessageImportant(text);
11525 }
11526 }
11527
11528 override bool IsItemBase()
11529 {
11530 return true;
11531 }
11532
11533 // Checks if item is of questioned kind
11534 override bool KindOf(string tag)
11535 {
11536 bool found = false;
11537 string item_name = this.GetType();
11538 ref TStringArray item_tag_array = new TStringArray;
11539 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
11540
11541 int array_size = item_tag_array.Count();
11542 for (int i = 0; i < array_size; i++)
11543 {
11544 if (item_tag_array.Get(i) == tag)
11545 {
11546 found = true;
11547 break;
11548 }
11549 }
11550 return found;
11551 }
11552
11553
11554 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
11555 {
11556 //Debug.Log("OnRPC called");
11557 super.OnRPC(sender, rpc_type,ctx);
11558
11559 //Play soundset for attachment locking (ActionLockAttachment.c)
11560 switch (rpc_type)
11561 {
11562 #ifndef SERVER
11563 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11564 Param2<bool, string> p = new Param2<bool, string>(false, "");
11565
11566 if (!ctx.Read(p))
11567 return;
11568
11569 bool play = p.param1;
11570 string soundSet = p.param2;
11571
11572 if (play)
11573 {
11574 if (m_LockingSound)
11575 {
11577 {
11578 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
11579 }
11580 }
11581 else
11582 {
11583 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
11584 }
11585 }
11586 else
11587 {
11588 SEffectManager.DestroyEffect(m_LockingSound);
11589 }
11590
11591 break;
11592 #endif
11593
11594 }
11595
11596 if (GetWrittenNoteData())
11597 {
11598 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
11599 }
11600 }
11601
11602 //-----------------------------
11603 // VARIABLE MANIPULATION SYSTEM
11604 //-----------------------------
11605 int NameToID(string name)
11606 {
11607 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
11608 return plugin.GetID(name);
11609 }
11610
11611 string IDToName(int id)
11612 {
11613 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
11614 return plugin.GetName(id);
11615 }
11616
11618 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
11619 {
11620 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
11621 //read the flags
11622 int varFlags;
11623 if (!ctx.Read(varFlags))
11624 return;
11625
11626 if (varFlags & ItemVariableFlags.FLOAT)
11627 {
11628 ReadVarsFromCTX(ctx);
11629 }
11630 }
11631
11632 override void SerializeNumericalVars(array<float> floats_out)
11633 {
11634 //some variables handled on EntityAI level already!
11635 super.SerializeNumericalVars(floats_out);
11636
11637 // the order of serialization must be the same as the order of de-serialization
11638 //--------------------------------------------
11639 if (IsVariableSet(VARIABLE_QUANTITY))
11640 {
11641 floats_out.Insert(m_VarQuantity);
11642 }
11643 //--------------------------------------------
11644 if (IsVariableSet(VARIABLE_WET))
11645 {
11646 floats_out.Insert(m_VarWet);
11647 }
11648 //--------------------------------------------
11649 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
11650 {
11651 floats_out.Insert(m_VarLiquidType);
11652 }
11653 //--------------------------------------------
11654 if (IsVariableSet(VARIABLE_COLOR))
11655 {
11656 floats_out.Insert(m_ColorComponentR);
11657 floats_out.Insert(m_ColorComponentG);
11658 floats_out.Insert(m_ColorComponentB);
11659 floats_out.Insert(m_ColorComponentA);
11660 }
11661 //--------------------------------------------
11662 if (IsVariableSet(VARIABLE_CLEANNESS))
11663 {
11664 floats_out.Insert(m_Cleanness);
11665 }
11666 }
11667
11668 override void DeSerializeNumericalVars(array<float> floats)
11669 {
11670 //some variables handled on EntityAI level already!
11671 super.DeSerializeNumericalVars(floats);
11672
11673 // the order of serialization must be the same as the order of de-serialization
11674 int index = 0;
11675 int mask = Math.Round(floats.Get(index));
11676
11677 index++;
11678 //--------------------------------------------
11679 if (mask & VARIABLE_QUANTITY)
11680 {
11681 if (m_IsStoreLoad)
11682 {
11683 SetStoreLoadedQuantity(floats.Get(index));
11684 }
11685 else
11686 {
11687 float quantity = floats.Get(index);
11688 SetQuantity(quantity, true, false, false, false);
11689 }
11690 index++;
11691 }
11692 //--------------------------------------------
11693 if (mask & VARIABLE_WET)
11694 {
11695 float wet = floats.Get(index);
11696 SetWet(wet);
11697 index++;
11698 }
11699 //--------------------------------------------
11700 if (mask & VARIABLE_LIQUIDTYPE)
11701 {
11702 int liquidtype = Math.Round(floats.Get(index));
11703 SetLiquidType(liquidtype);
11704 index++;
11705 }
11706 //--------------------------------------------
11707 if (mask & VARIABLE_COLOR)
11708 {
11709 m_ColorComponentR = Math.Round(floats.Get(index));
11710 index++;
11711 m_ColorComponentG = Math.Round(floats.Get(index));
11712 index++;
11713 m_ColorComponentB = Math.Round(floats.Get(index));
11714 index++;
11715 m_ColorComponentA = Math.Round(floats.Get(index));
11716 index++;
11717 }
11718 //--------------------------------------------
11719 if (mask & VARIABLE_CLEANNESS)
11720 {
11721 int cleanness = Math.Round(floats.Get(index));
11722 SetCleanness(cleanness);
11723 index++;
11724 }
11725 }
11726
11727 override void WriteVarsToCTX(ParamsWriteContext ctx)
11728 {
11729 super.WriteVarsToCTX(ctx);
11730
11731 //--------------------------------------------
11732 if (IsVariableSet(VARIABLE_QUANTITY))
11733 {
11734 ctx.Write(GetQuantity());
11735 }
11736 //--------------------------------------------
11737 if (IsVariableSet(VARIABLE_WET))
11738 {
11739 ctx.Write(GetWet());
11740 }
11741 //--------------------------------------------
11742 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
11743 {
11744 ctx.Write(GetLiquidType());
11745 }
11746 //--------------------------------------------
11747 if (IsVariableSet(VARIABLE_COLOR))
11748 {
11749 int r,g,b,a;
11750 GetColor(r,g,b,a);
11751 ctx.Write(r);
11752 ctx.Write(g);
11753 ctx.Write(b);
11754 ctx.Write(a);
11755 }
11756 //--------------------------------------------
11757 if (IsVariableSet(VARIABLE_CLEANNESS))
11758 {
11759 ctx.Write(GetCleanness());
11760 }
11761 }
11762
11763 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
11764 {
11765 if (!super.ReadVarsFromCTX(ctx,version))
11766 return false;
11767
11768 int intValue;
11769 float value;
11770
11771 if (version < 140)
11772 {
11773 if (!ctx.Read(intValue))
11774 return false;
11775
11776 m_VariablesMask = intValue;
11777 }
11778
11779 if (m_VariablesMask & VARIABLE_QUANTITY)
11780 {
11781 if (!ctx.Read(value))
11782 return false;
11783
11784 if (IsStoreLoad())
11785 {
11787 }
11788 else
11789 {
11790 SetQuantity(value, true, false, false, false);
11791 }
11792 }
11793 //--------------------------------------------
11794 if (version < 140)
11795 {
11796 if (m_VariablesMask & VARIABLE_TEMPERATURE)
11797 {
11798 if (!ctx.Read(value))
11799 return false;
11800 SetTemperatureDirect(value);
11801 }
11802 }
11803 //--------------------------------------------
11804 if (m_VariablesMask & VARIABLE_WET)
11805 {
11806 if (!ctx.Read(value))
11807 return false;
11808 SetWet(value);
11809 }
11810 //--------------------------------------------
11811 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
11812 {
11813 if (!ctx.Read(intValue))
11814 return false;
11815 SetLiquidType(intValue);
11816 }
11817 //--------------------------------------------
11818 if (m_VariablesMask & VARIABLE_COLOR)
11819 {
11820 int r,g,b,a;
11821 if (!ctx.Read(r))
11822 return false;
11823 if (!ctx.Read(g))
11824 return false;
11825 if (!ctx.Read(b))
11826 return false;
11827 if (!ctx.Read(a))
11828 return false;
11829
11830 SetColor(r,g,b,a);
11831 }
11832 //--------------------------------------------
11833 if (m_VariablesMask & VARIABLE_CLEANNESS)
11834 {
11835 if (!ctx.Read(intValue))
11836 return false;
11837 SetCleanness(intValue);
11838 }
11839 //--------------------------------------------
11840 if (version >= 138 && version < 140)
11841 {
11842 if (m_VariablesMask & VARIABLE_TEMPERATURE)
11843 {
11844 if (!ctx.Read(intValue))
11845 return false;
11846 SetFrozen(intValue);
11847 }
11848 }
11849
11850 return true;
11851 }
11852
11853 //----------------------------------------------------------------
11854 override bool OnStoreLoad(ParamsReadContext ctx, int version)
11855 {
11856 m_IsStoreLoad = true;
11858 {
11859 m_FixDamageSystemInit = true;
11860 }
11861
11862 if (!super.OnStoreLoad(ctx, version))
11863 {
11864 m_IsStoreLoad = false;
11865 return false;
11866 }
11867
11868 if (version >= 114)
11869 {
11870 bool hasQuickBarIndexSaved;
11871
11872 if (!ctx.Read(hasQuickBarIndexSaved))
11873 {
11874 m_IsStoreLoad = false;
11875 return false;
11876 }
11877
11878 if (hasQuickBarIndexSaved)
11879 {
11880 int itmQBIndex;
11881
11882 //Load quickbar item bind
11883 if (!ctx.Read(itmQBIndex))
11884 {
11885 m_IsStoreLoad = false;
11886 return false;
11887 }
11888
11889 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11890 if (itmQBIndex != -1 && parentPlayer)
11891 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11892 }
11893 }
11894 else
11895 {
11896 // Backup of how it used to be
11897 PlayerBase player;
11898 int itemQBIndex;
11899 if (version == int.MAX)
11900 {
11901 if (!ctx.Read(itemQBIndex))
11902 {
11903 m_IsStoreLoad = false;
11904 return false;
11905 }
11906 }
11907 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11908 {
11909 //Load quickbar item bind
11910 if (!ctx.Read(itemQBIndex))
11911 {
11912 m_IsStoreLoad = false;
11913 return false;
11914 }
11915 if (itemQBIndex != -1 && player)
11916 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11917 }
11918 }
11919
11920 if (version < 140)
11921 {
11922 // variable management system
11923 if (!LoadVariables(ctx, version))
11924 {
11925 m_IsStoreLoad = false;
11926 return false;
11927 }
11928 }
11929
11930 //agent trasmission system
11931 if (!LoadAgents(ctx, version))
11932 {
11933 m_IsStoreLoad = false;
11934 return false;
11935 }
11936 if (version >= 132)
11937 {
11938 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
11939 if (raib)
11940 {
11941 if (!raib.OnStoreLoad(ctx,version))
11942 {
11943 m_IsStoreLoad = false;
11944 return false;
11945 }
11946 }
11947 }
11948
11949 m_IsStoreLoad = false;
11950 return true;
11951 }
11952
11953 //----------------------------------------------------------------
11954
11955 override void OnStoreSave(ParamsWriteContext ctx)
11956 {
11957 super.OnStoreSave(ctx);
11958
11959 PlayerBase player;
11960 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11961 {
11962 ctx.Write(true); // Keep track of if we should actually read this in or not
11963 //Save quickbar item bind
11964 int itemQBIndex = -1;
11965 itemQBIndex = player.FindQuickBarEntityIndex(this);
11966 ctx.Write(itemQBIndex);
11967 }
11968 else
11969 {
11970 ctx.Write(false); // Keep track of if we should actually read this in or not
11971 }
11972
11973 SaveAgents(ctx);//agent trasmission system
11974
11975 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
11976 if (raib)
11977 {
11978 raib.OnStoreSave(ctx);
11979 }
11980 }
11981 //----------------------------------------------------------------
11982
11983 override void AfterStoreLoad()
11984 {
11985 super.AfterStoreLoad();
11986
11988 {
11990 }
11991
11992 if (GetStoreLoadedQuantity() != float.LOWEST)
11993 {
11995 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
11996 }
11997 }
11998
11999 override void EEOnAfterLoad()
12000 {
12001 super.EEOnAfterLoad();
12002
12004 {
12005 m_FixDamageSystemInit = false;
12006 }
12007
12010 }
12011
12012 bool CanBeDisinfected()
12013 {
12014 return false;
12015 }
12016
12017
12018 //----------------------------------------------------------------
12019 override void OnVariablesSynchronized()
12020 {
12021 if (m_Initialized)
12022 {
12023 #ifdef PLATFORM_CONSOLE
12024 //bruteforce it is
12025 if (IsSplitable())
12026 {
12027 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
12028 if (menu)
12029 {
12030 menu.Refresh();
12031 }
12032 }
12033 #endif
12034 }
12035
12037 {
12038 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
12039 m_WantPlayImpactSound = false;
12040 }
12041
12043 {
12044 SetWeightDirty();
12046 }
12047 if (m_VarWet != m_VarWetPrev)
12048 {
12051 }
12052
12053 if (m_SoundSyncPlay != 0)
12054 {
12055 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
12056 m_SoundSyncPlay = 0;
12057 }
12058 if (m_SoundSyncStop != 0)
12059 {
12060 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
12061 m_SoundSyncStop = 0;
12062 }
12063
12064 super.OnVariablesSynchronized();
12065 }
12066
12067 //------------------------- Quantity
12068 //----------------------------------------------------------------
12070 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
12071 {
12072 if (!IsServerCheck(allow_client))
12073 return false;
12074
12075 if (!HasQuantity())
12076 return false;
12077
12078 float min = GetQuantityMin();
12079 float max = GetQuantityMax();
12080
12081 if (value <= (min + 0.001))
12082 value = min;
12083
12084 if (value == min)
12085 {
12086 if (destroy_config)
12087 {
12088 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
12089 if (dstr)
12090 {
12091 m_VarQuantity = Math.Clamp(value, min, max);
12092 this.Delete();
12093 return true;
12094 }
12095 }
12096 else if (destroy_forced)
12097 {
12098 m_VarQuantity = Math.Clamp(value, min, max);
12099 this.Delete();
12100 return true;
12101 }
12102 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
12103 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
12104 }
12105
12106 float delta = m_VarQuantity;
12107 m_VarQuantity = Math.Clamp(value, min, max);
12108
12109 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
12110 {
12111 delta = m_VarQuantity - delta;
12112
12113 if (delta)
12114 OnQuantityChanged(delta);
12115 }
12116
12117 SetVariableMask(VARIABLE_QUANTITY);
12118
12119 return false;
12120 }
12121
12122 //----------------------------------------------------------------
12124 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
12125 {
12126 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
12127 }
12128 //----------------------------------------------------------------
12129 void SetQuantityMax()
12130 {
12131 float max = GetQuantityMax();
12132 SetQuantity(max);
12133 }
12134
12135 override void SetQuantityToMinimum()
12136 {
12137 float min = GetQuantityMin();
12138 SetQuantity(min);
12139 }
12140 //----------------------------------------------------------------
12142 override void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
12143 {
12144 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
12145 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
12146 SetQuantity(result, destroy_config, destroy_forced);
12147 }
12148
12149 //----------------------------------------------------------------
12151 override float GetQuantityNormalized()
12152 {
12153 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
12154 }
12155
12157 {
12158 return GetQuantityNormalized();
12159 }
12160
12161 /*void SetAmmoNormalized(float value)
12162 {
12163 float value_clamped = Math.Clamp(value, 0, 1);
12164 Magazine this_mag = Magazine.Cast(this);
12165 int max_rounds = this_mag.GetAmmoMax();
12166 int result = value * max_rounds;//can the rounded if higher precision is required
12167 this_mag.SetAmmoCount(result);
12168 }*/
12169 //----------------------------------------------------------------
12170 override int GetQuantityMax()
12171 {
12172 int slot = -1;
12173 if (GetInventory())
12174 {
12175 InventoryLocation il = new InventoryLocation;
12176 GetInventory().GetCurrentInventoryLocation(il);
12177 slot = il.GetSlot();
12178 }
12179
12180 return GetTargetQuantityMax(slot);
12181 }
12182
12183 override int GetTargetQuantityMax(int attSlotID = -1)
12184 {
12185 float quantity_max = 0;
12186
12187 if (IsSplitable()) //only stackable/splitable items can check for stack size
12188 {
12189 if (attSlotID != -1)
12190 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12191
12192 if (quantity_max <= 0)
12193 quantity_max = m_VarStackMax;
12194 }
12195
12196 if (quantity_max <= 0)
12197 quantity_max = m_VarQuantityMax;
12198
12199 return quantity_max;
12200 }
12201 //----------------------------------------------------------------
12202 override int GetQuantityMin()
12203 {
12204 return m_VarQuantityMin;
12205 }
12206 //----------------------------------------------------------------
12207 int GetQuantityInit()
12208 {
12209 return m_VarQuantityInit;
12210 }
12211
12212 //----------------------------------------------------------------
12213 override bool HasQuantity()
12214 {
12215 return !(GetQuantityMax() - GetQuantityMin() == 0);
12216 }
12217
12218 override float GetQuantity()
12219 {
12220 return m_VarQuantity;
12221 }
12222
12223 bool IsFullQuantity()
12224 {
12225 return GetQuantity() >= GetQuantityMax();
12226 }
12227
12228 //Calculates weight of single item without attachments and cargo
12229 override float GetSingleInventoryItemWeightEx()
12230 {
12231 //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
12232 float weightEx = GetWeightEx();//overall weight of the item
12233 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
12234 return weightEx - special;
12235 }
12236
12237 // Obsolete, use GetSingleInventoryItemWeightEx() instead
12239 {
12241 }
12242
12243 override protected float GetWeightSpecialized(bool forceRecalc = false)
12244 {
12245 if (IsSplitable()) //quantity determines size of the stack
12246 {
12247 #ifdef DEVELOPER
12248 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12249 {
12250 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12251 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
12252 }
12253 #endif
12254
12255 return GetQuantity() * GetConfigWeightModified();
12256 }
12257 else if (HasEnergyManager())// items with energy manager
12258 {
12259 #ifdef DEVELOPER
12260 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12261 {
12262 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12263 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
12264 }
12265 #endif
12266 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12267 }
12268 else//everything else
12269 {
12270 #ifdef DEVELOPER
12271 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12272 {
12273 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12274 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
12275 }
12276 #endif
12277 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
12278 }
12279 }
12280
12282 int GetNumberOfItems()
12283 {
12284 int item_count = 0;
12285 ItemBase item;
12286
12287 if (GetInventory().GetCargo() != NULL)
12288 {
12289 item_count = GetInventory().GetCargo().GetItemCount();
12290 }
12291
12292 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
12293 {
12294 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
12295 if (item)
12296 item_count += item.GetNumberOfItems();
12297 }
12298 return item_count;
12299 }
12300
12302 float GetUnitWeight(bool include_wetness = true)
12303 {
12304 float weight = 0;
12305 float wetness = 1;
12306 if (include_wetness)
12307 wetness += GetWet();
12308 if (IsSplitable()) //quantity determines size of the stack
12309 {
12310 weight = wetness * m_ConfigWeight;
12311 }
12312 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
12313 {
12314 weight = 1;
12315 }
12316 return weight;
12317 }
12318
12319 //-----------------------------------------------------------------
12320
12321 override void ClearInventory()
12322 {
12323 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
12324 {
12325 GameInventory inv = GetInventory();
12326 array<EntityAI> items = new array<EntityAI>;
12327 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
12328 for (int i = 0; i < items.Count(); i++)
12329 {
12330 ItemBase item = ItemBase.Cast(items.Get(i));
12331 if (item)
12332 {
12333 GetGame().ObjectDelete(item);
12334 }
12335 }
12336 }
12337 }
12338
12339 //------------------------- Energy
12340
12341 //----------------------------------------------------------------
12342 float GetEnergy()
12343 {
12344 float energy = 0;
12345 if (HasEnergyManager())
12346 {
12347 energy = GetCompEM().GetEnergy();
12348 }
12349 return energy;
12350 }
12351
12352
12353 override void OnEnergyConsumed()
12354 {
12355 super.OnEnergyConsumed();
12356
12358 }
12359
12360 override void OnEnergyAdded()
12361 {
12362 super.OnEnergyAdded();
12363
12365 }
12366
12367 // Converts energy (from Energy Manager) to quantity, if enabled.
12369 {
12370 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12371 {
12372 if (HasQuantity())
12373 {
12374 float energy_0to1 = GetCompEM().GetEnergy0To1();
12375 SetQuantityNormalized(energy_0to1);
12376 }
12377 }
12378 }
12379
12380 //----------------------------------------------------------------
12381 float GetHeatIsolationInit()
12382 {
12383 return ConfigGetFloat("heatIsolation");
12384 }
12385
12386 float GetHeatIsolation()
12387 {
12388 return m_HeatIsolation;
12389 }
12390
12391 float GetDryingIncrement(string pIncrementName)
12392 {
12393 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
12394 if (GetGame().ConfigIsExisting(paramPath))
12395 return GetGame().ConfigGetFloat(paramPath);
12396
12397 return 0.0;
12398 }
12399
12400 float GetSoakingIncrement(string pIncrementName)
12401 {
12402 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
12403 if (GetGame().ConfigIsExisting(paramPath))
12404 return GetGame().ConfigGetFloat(paramPath);
12405
12406 return 0.0;
12407 }
12408 //----------------------------------------------------------------
12409 override void SetWet(float value, bool allow_client = false)
12410 {
12411 if (!IsServerCheck(allow_client))
12412 return;
12413
12414 float min = GetWetMin();
12415 float max = GetWetMax();
12416
12417 float previousValue = m_VarWet;
12418
12419 m_VarWet = Math.Clamp(value, min, max);
12420
12421 if (previousValue != m_VarWet)
12422 {
12423 SetVariableMask(VARIABLE_WET);
12424 OnWetChanged(m_VarWet, previousValue);
12425 }
12426 }
12427 //----------------------------------------------------------------
12428 override void AddWet(float value)
12429 {
12430 SetWet(GetWet() + value);
12431 }
12432 //----------------------------------------------------------------
12433 override void SetWetMax()
12434 {
12436 }
12437 //----------------------------------------------------------------
12438 override float GetWet()
12439 {
12440 return m_VarWet;
12441 }
12442 //----------------------------------------------------------------
12443 override float GetWetMax()
12444 {
12445 return m_VarWetMax;
12446 }
12447 //----------------------------------------------------------------
12448 override float GetWetMin()
12449 {
12450 return m_VarWetMin;
12451 }
12452 //----------------------------------------------------------------
12453 override float GetWetInit()
12454 {
12455 return m_VarWetInit;
12456 }
12457 //----------------------------------------------------------------
12458 override void OnWetChanged(float newVal, float oldVal)
12459 {
12460 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
12461 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
12462 if (newLevel != oldLevel)
12463 {
12464 OnWetLevelChanged(newLevel,oldLevel);
12465 }
12466 }
12467
12468 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
12469 {
12470 SetWeightDirty();
12471 }
12472
12473 override EWetnessLevel GetWetLevel()
12474 {
12475 return GetWetLevelInternal(m_VarWet);
12476 }
12477
12478 //----------------------------------------------------------------
12479
12480 override void SetStoreLoad(bool value)
12481 {
12482 m_IsStoreLoad = value;
12483 }
12484
12485 override bool IsStoreLoad()
12486 {
12487 return m_IsStoreLoad;
12488 }
12489
12490 override void SetStoreLoadedQuantity(float value)
12491 {
12492 m_StoreLoadedQuantity = value;
12493 }
12494
12495 override float GetStoreLoadedQuantity()
12496 {
12497 return m_StoreLoadedQuantity;
12498 }
12499
12500 //----------------------------------------------------------------
12501
12502 float GetItemModelLength()
12503 {
12504 if (ConfigIsExisting("itemModelLength"))
12505 {
12506 return ConfigGetFloat("itemModelLength");
12507 }
12508 return 0;
12509 }
12510
12511 float GetItemAttachOffset()
12512 {
12513 if (ConfigIsExisting("itemAttachOffset"))
12514 {
12515 return ConfigGetFloat("itemAttachOffset");
12516 }
12517 return 0;
12518 }
12519
12520 override void SetCleanness(int value, bool allow_client = false)
12521 {
12522 if (!IsServerCheck(allow_client))
12523 return;
12524
12525 int previousValue = m_Cleanness;
12526
12527 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
12528
12529 if (previousValue != m_Cleanness)
12530 SetVariableMask(VARIABLE_CLEANNESS);
12531 }
12532
12533 override int GetCleanness()
12534 {
12535 return m_Cleanness;
12536 }
12537
12539 {
12540 return true;
12541 }
12542
12543 //----------------------------------------------------------------
12544 // ATTACHMENT LOCKING
12545 // Getters relevant to generic ActionLockAttachment
12546 int GetLockType()
12547 {
12548 return m_LockType;
12549 }
12550
12551 string GetLockSoundSet()
12552 {
12553 return m_LockSoundSet;
12554 }
12555
12556 //----------------------------------------------------------------
12557 //------------------------- Color
12558 // sets items color variable given color components
12559 override void SetColor(int r, int g, int b, int a)
12560 {
12565 SetVariableMask(VARIABLE_COLOR);
12566 }
12568 override void GetColor(out int r,out int g,out int b,out int a)
12569 {
12574 }
12575
12576 bool IsColorSet()
12577 {
12578 return IsVariableSet(VARIABLE_COLOR);
12579 }
12580
12582 string GetColorString()
12583 {
12584 int r,g,b,a;
12585 GetColor(r,g,b,a);
12586 r = r/255;
12587 g = g/255;
12588 b = b/255;
12589 a = a/255;
12590 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12591 }
12592 //----------------------------------------------------------------
12593 //------------------------- LiquidType
12594
12595 override void SetLiquidType(int value, bool allow_client = false)
12596 {
12597 if (!IsServerCheck(allow_client))
12598 return;
12599
12600 int old = m_VarLiquidType;
12601 m_VarLiquidType = value;
12602 OnLiquidTypeChanged(old,value);
12603 SetVariableMask(VARIABLE_LIQUIDTYPE);
12604 }
12605
12606 int GetLiquidTypeInit()
12607 {
12608 return ConfigGetInt("varLiquidTypeInit");
12609 }
12610
12611 override int GetLiquidType()
12612 {
12613 return m_VarLiquidType;
12614 }
12615
12616 protected void OnLiquidTypeChanged(int oldType, int newType)
12617 {
12618 if (newType == LIQUID_NONE && GetIsFrozen())
12619 SetFrozen(false);
12620 }
12621
12623 void UpdateQuickbarShortcutVisibility(PlayerBase player)
12624 {
12625 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12626 }
12627
12628 // -------------------------------------------------------------------------
12630 void OnInventoryEnter(Man player)
12631 {
12632 PlayerBase nplayer;
12633 if (PlayerBase.CastTo(nplayer, player))
12634 {
12635 m_CanPlayImpactSound = true;
12636 //nplayer.OnItemInventoryEnter(this);
12637 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12638 }
12639 }
12640
12641 // -------------------------------------------------------------------------
12643 void OnInventoryExit(Man player)
12644 {
12645 PlayerBase nplayer;
12646 if (PlayerBase.CastTo(nplayer,player))
12647 {
12648 //nplayer.OnItemInventoryExit(this);
12649 nplayer.SetEnableQuickBarEntityShortcut(this,false);
12650
12651 }
12652
12653 //if (!GetGame().IsDedicatedServer())
12654 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12655
12656
12657 if (HasEnergyManager())
12658 {
12659 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
12660 }
12661 }
12662
12663 // ADVANCED PLACEMENT EVENTS
12664 override void OnPlacementStarted(Man player)
12665 {
12666 super.OnPlacementStarted(player);
12667
12668 SetTakeable(false);
12669 }
12670
12671 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
12672 {
12673 if (m_AdminLog)
12674 {
12675 m_AdminLog.OnPlacementComplete(player, this);
12676 }
12677
12678 super.OnPlacementComplete(player, position, orientation);
12679 }
12680
12681 //-----------------------------
12682 // AGENT SYSTEM
12683 //-----------------------------
12684 //--------------------------------------------------------------------------
12685 bool ContainsAgent(int agent_id)
12686 {
12687 if (agent_id & m_AttachedAgents)
12688 {
12689 return true;
12690 }
12691 else
12692 {
12693 return false;
12694 }
12695 }
12696
12697 //--------------------------------------------------------------------------
12698 override void RemoveAgent(int agent_id)
12699 {
12700 if (ContainsAgent(agent_id))
12701 {
12702 m_AttachedAgents = ~agent_id & m_AttachedAgents;
12703 }
12704 }
12705
12706 //--------------------------------------------------------------------------
12707 override void RemoveAllAgents()
12708 {
12709 m_AttachedAgents = 0;
12710 }
12711 //--------------------------------------------------------------------------
12712 override void RemoveAllAgentsExcept(int agent_to_keep)
12713 {
12714 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
12715 }
12716 // -------------------------------------------------------------------------
12717 override void InsertAgent(int agent, float count = 1)
12718 {
12719 if (count < 1)
12720 return;
12721 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
12723 }
12724
12726 void TransferAgents(int agents)
12727 {
12729 }
12730
12731 // -------------------------------------------------------------------------
12732 override int GetAgents()
12733 {
12734 return m_AttachedAgents;
12735 }
12736 //----------------------------------------------------------------------
12737
12738 /*int GetContaminationType()
12739 {
12740 int contamination_type;
12741
12742 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
12743 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
12744 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
12745 const int DIRTY_MASK = eAgents.WOUND_AGENT;
12746
12747 Edible_Base edible = Edible_Base.Cast(this);
12748 int agents = GetAgents();
12749 if (edible)
12750 {
12751 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
12752 if (profile)
12753 {
12754 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
12755 }
12756 }
12757 if (agents & CONTAMINATED_MASK)
12758 {
12759 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
12760 }
12761 if (agents & POISONED_MASK)
12762 {
12763 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
12764 }
12765 if (agents & NERVE_GAS_MASK)
12766 {
12767 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
12768 }
12769 if (agents & DIRTY_MASK)
12770 {
12771 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
12772 }
12773
12774 return agents;
12775 }*/
12776
12777 // -------------------------------------------------------------------------
12778 bool LoadAgents(ParamsReadContext ctx, int version)
12779 {
12780 if (!ctx.Read(m_AttachedAgents))
12781 return false;
12782 return true;
12783 }
12784 // -------------------------------------------------------------------------
12786 {
12787
12789 }
12790 // -------------------------------------------------------------------------
12791
12793 override void CheckForRoofLimited(float timeTresholdMS = 3000)
12794 {
12795 super.CheckForRoofLimited(timeTresholdMS);
12796
12797 float time = GetGame().GetTime();
12798 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12799 {
12800 m_PreviousRoofTestTime = time;
12801 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12802 }
12803 }
12804
12805 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
12806 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
12807 {
12808 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
12809 {
12810 return 0;
12811 }
12812
12813 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
12814 {
12815 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
12816 if (filter)
12817 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
12818 else
12819 return 0;//otherwise return 0 when no filter attached
12820 }
12821
12822 string subclassPath, entryName;
12823
12824 switch (type)
12825 {
12826 case DEF_BIOLOGICAL:
12827 entryName = "biological";
12828 break;
12829 case DEF_CHEMICAL:
12830 entryName = "chemical";
12831 break;
12832 default:
12833 entryName = "biological";
12834 break;
12835 }
12836
12837 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
12838
12839 return GetGame().ConfigGetFloat(subclassPath + entryName);
12840 }
12841
12842
12843
12845 override void EEOnCECreate()
12846 {
12847 if (!IsMagazine())
12849
12851 }
12852
12853
12854 //-------------------------
12855 // OPEN/CLOSE USER ACTIONS
12856 //-------------------------
12858 void Open();
12859 void Close();
12860 bool IsOpen()
12861 {
12862 return true;
12863 }
12864
12865 override bool CanDisplayCargo()
12866 {
12867 return IsOpen();
12868 }
12869
12870
12871 // ------------------------------------------------------------
12872 // CONDITIONS
12873 // ------------------------------------------------------------
12874 override bool CanPutInCargo(EntityAI parent)
12875 {
12876 if (parent)
12877 {
12878 if (parent.IsInherited(DayZInfected))
12879 return true;
12880
12881 if (!parent.IsRuined())
12882 return true;
12883 }
12884
12885 return true;
12886 }
12887
12888 override bool CanPutAsAttachment(EntityAI parent)
12889 {
12890 if (!super.CanPutAsAttachment(parent))
12891 {
12892 return false;
12893 }
12894
12895 if (!IsRuined() && !parent.IsRuined())
12896 {
12897 return true;
12898 }
12899
12900 return false;
12901 }
12902
12903 override bool CanReceiveItemIntoCargo(EntityAI item)
12904 {
12905 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12906 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12907 // return false;
12908
12909 return super.CanReceiveItemIntoCargo(item);
12910 }
12911
12912 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
12913 {
12914 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12915 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12916 // return false;
12917
12918 GameInventory attachmentInv = attachment.GetInventory();
12919 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
12920 {
12921 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12922 return false;
12923 }
12924
12925 InventoryLocation loc = new InventoryLocation();
12926 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12927 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
12928 return false;
12929
12930 return super.CanReceiveAttachment(attachment, slotId);
12931 }
12932
12933 override bool CanReleaseAttachment(EntityAI attachment)
12934 {
12935 if (!super.CanReleaseAttachment(attachment))
12936 return false;
12937
12938 return GetInventory().AreChildrenAccessible();
12939 }
12940
12941 /*override bool CanLoadAttachment(EntityAI attachment)
12942 {
12943 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12944 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12945 // return false;
12946
12947 GameInventory attachmentInv = attachment.GetInventory();
12948 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
12949 {
12950 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
12951 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
12952
12953 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12954 return false;
12955 }
12956
12957 return super.CanLoadAttachment(attachment);
12958 }*/
12959
12960 // Plays muzzle flash particle effects
12961 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12962 {
12963 int id = muzzle_owner.GetMuzzleID();
12964 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
12965
12966 if (WPOF_array)
12967 {
12968 for (int i = 0; i < WPOF_array.Count(); i++)
12969 {
12970 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12971
12972 if (WPOF)
12973 {
12974 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12975 }
12976 }
12977 }
12978 }
12979
12980 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
12981 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12982 {
12983 int id = muzzle_owner.GetMuzzleID();
12984 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
12985
12986 if (WPOBE_array)
12987 {
12988 for (int i = 0; i < WPOBE_array.Count(); i++)
12989 {
12990 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12991
12992 if (WPOBE)
12993 {
12994 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12995 }
12996 }
12997 }
12998 }
12999
13000 // Plays all weapon overheating particles
13001 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
13002 {
13003 int id = muzzle_owner.GetMuzzleID();
13004 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13005
13006 if (WPOOH_array)
13007 {
13008 for (int i = 0; i < WPOOH_array.Count(); i++)
13009 {
13010 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13011
13012 if (WPOOH)
13013 {
13014 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
13015 }
13016 }
13017 }
13018 }
13019
13020 // Updates all weapon overheating particles
13021 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
13022 {
13023 int id = muzzle_owner.GetMuzzleID();
13024 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13025
13026 if (WPOOH_array)
13027 {
13028 for (int i = 0; i < WPOOH_array.Count(); i++)
13029 {
13030 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13031
13032 if (WPOOH)
13033 {
13034 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13035 }
13036 }
13037 }
13038 }
13039
13040 // Stops overheating particles
13041 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
13042 {
13043 int id = muzzle_owner.GetMuzzleID();
13044 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
13045
13046 if (WPOOH_array)
13047 {
13048 for (int i = 0; i < WPOOH_array.Count(); i++)
13049 {
13050 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
13051
13052 if (WPOOH)
13053 {
13054 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
13055 }
13056 }
13057 }
13058 }
13059
13060 //----------------------------------------------------------------
13061 //Item Behaviour - unified approach
13062 override bool IsHeavyBehaviour()
13063 {
13064 if (m_ItemBehaviour == 0)
13065 {
13066 return true;
13067 }
13068
13069 return false;
13070 }
13071
13072 override bool IsOneHandedBehaviour()
13073 {
13074 if (m_ItemBehaviour == 1)
13075 {
13076 return true;
13077 }
13078
13079 return false;
13080 }
13081
13082 override bool IsTwoHandedBehaviour()
13083 {
13084 if (m_ItemBehaviour == 2)
13085 {
13086 return true;
13087 }
13088
13089 return false;
13090 }
13091
13092 bool IsDeployable()
13093 {
13094 return false;
13095 }
13096
13098 float GetDeployTime()
13099 {
13100 return UATimeSpent.DEFAULT_DEPLOY;
13101 }
13102
13103
13104 //----------------------------------------------------------------
13105 // Item Targeting (User Actions)
13106 override void SetTakeable(bool pState)
13107 {
13108 m_IsTakeable = pState;
13109 SetSynchDirty();
13110 }
13111
13112 override bool IsTakeable()
13113 {
13114 return m_IsTakeable;
13115 }
13116
13117 // For cases where we want to show object widget which cant be taken to hands
13119 {
13120 return false;
13121 }
13122
13124 protected void PreLoadSoundAttachmentType()
13125 {
13126 string att_type = "None";
13127
13128 if (ConfigIsExisting("soundAttType"))
13129 {
13130 att_type = ConfigGetString("soundAttType");
13131 }
13132
13133 m_SoundAttType = att_type;
13134 }
13135
13136 override string GetAttachmentSoundType()
13137 {
13138 return m_SoundAttType;
13139 }
13140
13141 //----------------------------------------------------------------
13142 //SOUNDS - ItemSoundHandler
13143 //----------------------------------------------------------------
13144
13145 string GetPlaceSoundset(); // played when deploy starts
13146 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
13147 string GetDeploySoundset(); // played when deploy sucessfully finishes
13148 string GetLoopFoldSoundset(); // played when fold starts and stopped when it finishes
13149 string GetFoldSoundset(); // played when fold sucessfully finishes
13150
13152 {
13153 if (!m_ItemSoundHandler)
13155
13156 return m_ItemSoundHandler;
13157 }
13158
13159 // override to initialize sounds
13160 protected void InitItemSounds()
13161 {
13162 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
13163 return;
13164
13166
13167 if (GetPlaceSoundset() != string.Empty)
13168 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
13169
13170 if (GetDeploySoundset() != string.Empty)
13171 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
13172
13173 SoundParameters params = new SoundParameters();
13174 params.m_Loop = true;
13175 if (GetLoopDeploySoundset() != string.Empty)
13176 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
13177 }
13178
13179 // Start sound using ItemSoundHandler
13180 void StartItemSoundServer(int id)
13181 {
13182 if (!GetGame().IsServer())
13183 return;
13184
13185 m_SoundSyncPlay = id;
13186 SetSynchDirty();
13187
13188 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
13190 }
13191
13192 // Stop sound using ItemSoundHandler
13193 void StopItemSoundServer(int id)
13194 {
13195 if (!GetGame().IsServer())
13196 return;
13197
13198 m_SoundSyncStop = id;
13199 SetSynchDirty();
13200
13201 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
13203 }
13204
13205 protected void ClearStartItemSoundServer()
13206 {
13207 m_SoundSyncPlay = 0;
13208 }
13209
13210 protected void ClearStopItemSoundServer()
13211 {
13212 m_SoundSyncStop = 0;
13213 }
13214
13216 void PlayAttachSound(string slot_type)
13217 {
13218 if (!GetGame().IsDedicatedServer())
13219 {
13220 if (ConfigIsExisting("attachSoundSet"))
13221 {
13222 string cfg_path = "";
13223 string soundset = "";
13224 string type_name = GetType();
13225
13226 TStringArray cfg_soundset_array = new TStringArray;
13227 TStringArray cfg_slot_array = new TStringArray;
13228 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13229 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13230
13231 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13232 {
13233 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13234 {
13235 if (cfg_slot_array[i] == slot_type)
13236 {
13237 soundset = cfg_soundset_array[i];
13238 break;
13239 }
13240 }
13241 }
13242
13243 if (soundset != "")
13244 {
13245 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
13246 sound.SetAutodestroy(true);
13247 }
13248 }
13249 }
13250 }
13251
13252 void PlayDetachSound(string slot_type)
13253 {
13254 //TODO - evaluate if needed and devise universal config structure if so
13255 }
13256
13257 void OnApply(PlayerBase player);
13258
13260 {
13261 return 1.0;
13262 };
13263 //returns applicable selection
13264 array<string> GetHeadHidingSelection()
13265 {
13267 }
13268
13270 {
13272 }
13273
13274 WrittenNoteData GetWrittenNoteData() {};
13275
13277 {
13278 SetDynamicPhysicsLifeTime(0.01);
13279 m_ItemBeingDroppedPhys = false;
13280 }
13281
13283 {
13284 array<string> zone_names = new array<string>;
13285 GetDamageZones(zone_names);
13286 for (int i = 0; i < zone_names.Count(); i++)
13287 {
13288 SetHealthMax(zone_names.Get(i),"Health");
13289 }
13290 SetHealthMax("","Health");
13291 }
13292
13294 void SetZoneDamageCEInit()
13295 {
13296 float global_health = GetHealth01("","Health");
13297 array<string> zones = new array<string>;
13298 GetDamageZones(zones);
13299 //set damage of all zones to match global health level
13300 for (int i = 0; i < zones.Count(); i++)
13301 {
13302 SetHealth01(zones.Get(i),"Health",global_health);
13303 }
13304 }
13305
13307 bool IsCoverFaceForShave(string slot_name)
13308 {
13309 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13310 }
13311
13312 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
13313 {
13314 if (!hasRootAsPlayer)
13315 {
13316 if (refParentIB)
13317 {
13318 // parent is wet
13319 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
13320 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13321 // parent has liquid inside
13322 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
13323 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13324 // drying
13325 else if (m_VarWet > m_VarWetMin)
13326 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
13327 }
13328 else
13329 {
13330 // drying on ground or inside non-itembase (car, ...)
13331 if (m_VarWet > m_VarWetMin)
13332 AddWet(-1 * delta * GetDryingIncrement("ground"));
13333 }
13334 }
13335 }
13336
13337 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
13338 {
13340 {
13341 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
13342 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
13343 {
13344 float heatPermCoef = 1.0;
13345 EntityAI ent = this;
13346 while (ent)
13347 {
13348 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13349 ent = ent.GetHierarchyParent();
13350 }
13351
13352 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13353 }
13354 }
13355 }
13356
13357 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
13358 {
13359 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
13360 EntityAI parent = GetHierarchyParent();
13361 if (!parent)
13362 {
13363 hasParent = false;
13364 hasRootAsPlayer = false;
13365 }
13366 else
13367 {
13368 hasParent = true;
13369 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13370 refParentIB = ItemBase.Cast(parent);
13371 }
13372 }
13373
13374 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
13375 {
13376 // this is stub, implemented on Edible_Base
13377 }
13378
13379 bool CanDecay()
13380 {
13381 // return true used on selected food clases so they can decay
13382 return false;
13383 }
13384
13385 protected bool CanProcessDecay()
13386 {
13387 // this is stub, implemented on Edible_Base class
13388 // used to determine whether it is still necessary for the food to decay
13389 return false;
13390 }
13391
13392 protected bool CanHaveWetness()
13393 {
13394 // return true used on selected items that have a wetness effect
13395 return false;
13396 }
13397
13399 bool CanBeConsumed(ConsumeConditionData data = null)
13400 {
13401 return !GetIsFrozen() && IsOpen();
13402 }
13403
13404 override void ProcessVariables()
13405 {
13406 bool hasParent = false, hasRootAsPlayer = false;
13407 ItemBase refParentIB;
13408
13409 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
13410 bool foodDecay = g_Game.IsFoodDecayEnabled();
13411
13412 if (wwtu || foodDecay)
13413 {
13414 bool processWetness = wwtu && CanHaveWetness();
13415 bool processTemperature = wwtu && CanHaveTemperature();
13416 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
13417
13418 if (processWetness || processTemperature || processDecay)
13419 {
13420 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
13421
13422 if (processWetness)
13423 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13424
13425 if (processTemperature)
13426 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13427
13428 if (processDecay)
13429 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13430 }
13431 }
13432 }
13433
13436 {
13437 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
13438 }
13439
13440 override float GetTemperatureFreezeThreshold()
13441 {
13443 return Liquid.GetFreezeThreshold(GetLiquidType());
13444
13445 return super.GetTemperatureFreezeThreshold();
13446 }
13447
13448 override float GetTemperatureThawThreshold()
13449 {
13451 return Liquid.GetThawThreshold(GetLiquidType());
13452
13453 return super.GetTemperatureThawThreshold();
13454 }
13455
13456 override float GetItemOverheatThreshold()
13457 {
13459 return Liquid.GetBoilThreshold(GetLiquidType());
13460
13461 return super.GetItemOverheatThreshold();
13462 }
13463
13464 override float GetTemperatureFreezeTime()
13465 {
13466 if (HasQuantity())
13467 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
13468
13469 return super.GetTemperatureFreezeTime();
13470 }
13471
13472 override float GetTemperatureThawTime()
13473 {
13474 if (HasQuantity())
13475 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
13476
13477 return super.GetTemperatureThawTime();
13478 }
13479
13481 void AffectLiquidContainerOnFill(int liquid_type, float amount);
13483 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
13484
13485 bool IsCargoException4x3(EntityAI item)
13486 {
13487 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13488 }
13489
13491 {
13492 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13493 }
13494
13496 void AddLightSourceItem(ItemBase lightsource)
13497 {
13498 m_LightSourceItem = lightsource;
13499 }
13500
13502 {
13503 m_LightSourceItem = null;
13504 }
13505
13507 {
13508 return m_LightSourceItem;
13509 }
13510
13512 array<int> GetValidFinishers()
13513 {
13514 return null;
13515 }
13516
13518 bool GetActionWidgetOverride(out typename name)
13519 {
13520 return false;
13521 }
13522
13523 bool PairWithDevice(notnull ItemBase otherDevice)
13524 {
13525 if (GetGame().IsServer())
13526 {
13527 ItemBase explosive = otherDevice;
13529 if (!trg)
13530 {
13531 trg = RemoteDetonatorTrigger.Cast(otherDevice);
13532 explosive = this;
13533 }
13534
13535 explosive.PairRemote(trg);
13536 trg.SetControlledDevice(explosive);
13537
13538 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13539 trg.SetPersistentPairID(persistentID);
13540 explosive.SetPersistentPairID(persistentID);
13541
13542 return true;
13543 }
13544 return false;
13545 }
13546
13548 float GetBaitEffectivity()
13549 {
13550 float ret = 1.0;
13551 if (HasQuantity())
13552 ret *= GetQuantityNormalized();
13553 ret *= GetHealth01();
13554
13555 return ret;
13556 }
13557
13558 #ifdef DEVELOPER
13559 override void SetDebugItem()
13560 {
13561 super.SetDebugItem();
13562 _itemBase = this;
13563 }
13564
13565 override string GetDebugText()
13566 {
13567 string text = super.GetDebugText();
13568
13569 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
13570 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
13571
13572 return text;
13573 }
13574 #endif
13575
13576 bool CanBeUsedForSuicide()
13577 {
13578 return true;
13579 }
13580
13582 //DEPRECATED BELOW
13584 // Backwards compatibility
13585 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
13586 {
13587 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
13588 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
13589 }
13590
13591 // replaced by ItemSoundHandler
13592 protected EffectSound m_SoundDeployFinish;
13593 protected EffectSound m_SoundPlace;
13594 protected EffectSound m_DeployLoopSoundEx;
13595 protected EffectSound m_SoundDeploy;
13596 bool m_IsPlaceSound;
13597 bool m_IsDeploySound;
13599
13600 string GetDeployFinishSoundset();
13601 void PlayDeploySound();
13602 void PlayDeployFinishSound();
13603 void PlayPlaceSound();
13604 void PlayDeployLoopSoundEx();
13605 void StopDeployLoopSoundEx();
13606 void SoundSynchRemoteReset();
13607 void SoundSynchRemote();
13608 bool UsesGlobalDeploy(){return false;}
13609 bool CanPlayDeployLoopSound(){return false;}
13611 bool IsPlaceSound(){return m_IsPlaceSound;}
13612 bool IsDeploySound(){return m_IsDeploySound;}
13613 void SetIsPlaceSound(bool is_place_sound);
13614 void SetIsDeploySound(bool is_deploy_sound);
13615}
13616
13617EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
13618{
13619 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
13620 if (entity)
13621 {
13622 bool is_item = entity.IsInherited(ItemBase);
13623 if (is_item && full_quantity)
13624 {
13625 ItemBase item = ItemBase.Cast(entity);
13626 item.SetQuantity(item.GetQuantityInit());
13627 }
13628 }
13629 else
13630 {
13631 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
13632 return NULL;
13633 }
13634 return entity;
13635}
13636
13637void SetupSpawnedItem(ItemBase item, float health, float quantity)
13638{
13639 if (item)
13640 {
13641 if (health > 0)
13642 item.SetHealth("", "", health);
13643
13644 if (item.CanHaveTemperature())
13645 {
13646 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
13647 if (item.CanFreeze())
13648 item.SetFrozen(false);
13649 }
13650
13651 if (item.HasEnergyManager())
13652 {
13653 if (quantity >= 0)
13654 {
13655 item.GetCompEM().SetEnergy0To1(quantity);
13656 }
13657 else
13658 {
13659 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
13660 }
13661 }
13662 else if (item.IsMagazine())
13663 {
13664 Magazine mag = Magazine.Cast(item);
13665 if (quantity >= 0)
13666 {
13667 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13668 }
13669 else
13670 {
13671 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
13672 }
13673
13674 }
13675 else
13676 {
13677 if (quantity >= 0)
13678 {
13679 item.SetQuantityNormalized(quantity, false);
13680 }
13681 else
13682 {
13683 item.SetQuantity(Math.AbsFloat(quantity));
13684 }
13685
13686 }
13687 }
13688}
13689
13690#ifdef DEVELOPER
13691ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
13692#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Определения 3_Game/Entities/EntityAI.c:97
Param3 TSelectableActionInfo
EWetnessLevel
Определения 3_Game/Entities/EntityAI.c:2
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
const int INPUT_UDT_ITEM_MANIPULATION
class LogManager EntityAI
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
void ActionDropItem()
Определения ActionDropItem.c:14
void ActionManagerBase(PlayerBase player)
Определения ActionManagerBase.c:63
map< typename, ref array< ActionBase_Basic > > TInputActionMap
Определения ActionManagerClient.c:1
void AddAction(typename actionName)
Определения AdvancedCommunication.c:220
void RemoveAction(typename actionName)
Определения AdvancedCommunication.c:252
TInputActionMap m_InputActionMap
Определения AdvancedCommunication.c:137
bool m_ActionsInitialize
Определения AdvancedCommunication.c:138
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
Определения AdvancedCommunication.c:202
void InitializeActions()
Определения AdvancedCommunication.c:190
int GetLiquidType()
Определения CCTWaterSurface.c:129
const int ECE_PLACE_ON_SURFACE
Определения CentralEconomy.c:37
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
Определения CentralEconomy.c:36
const int RF_DEFAULT
Определения CentralEconomy.c:65
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
Open
Implementations only.
override void EEOnCECreate()
Определения ContaminatedArea_Dynamic.c:42
map
Определения ControlsXboxNew.c:4
CookingMethodType
Определения Cooking.c:2
DamageType
exposed from C++ (do not change)
Определения DamageSystem.c:11
DayZGame g_Game
Определения DayZGame.c:3868
DayZGame GetDayZGame()
Определения DayZGame.c:3870
EActions
Определения EActions.c:2
ERPCs
Определения ERPCs.c:2
PluginAdminLog m_AdminLog
Определения EmoteManager.c:142
const int MAX
Определения EnConvert.c:27
float GetTemperature()
Определения Environment.c:497
override bool IsExplosive()
Определения ExplosivesBase.c:59
override bool CanHaveTemperature()
Определения FireplaceBase.c:559
class GP5GasMask extends MaskBase ItemBase
Empty
Определения Hand_States.c:14
FindInventoryLocationType
flags for searching locations in inventory
Определения InventoryLocation.c:17
InventoryLocationType
types of Inventory Location
Определения InventoryLocation.c:4
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
Определения ItemBase.c:6380
static bool HasDebugActionsMask(int mask)
Определения ItemBase.c:5620
bool HidesSelectionBySlot()
Определения ItemBase.c:9347
float m_VarWetMin
Определения ItemBase.c:4881
void SplitItem(PlayerBase player)
Определения ItemBase.c:6831
void CopyScriptPropertiesFrom(EntityAI oldItem)
Определения ItemBase.c:9568
override void InsertAgent(int agent, float count=1)
Определения ItemBase.c:8795
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
Определения ItemBase.c:8229
static void SetDebugActionsMask(int mask)
Определения ItemBase.c:5625
void SetIsDeploySound(bool is_deploy_sound)
bool IsOpen()
Определения ItemBase.c:8938
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6798
override bool IsHeavyBehaviour()
Определения ItemBase.c:9140
override void SetWetMax()
Определения ItemBase.c:8511
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
Определения ItemBase.c:9385
void ClearStartItemSoundServer()
Определения ItemBase.c:9283
float m_VarWet
Определения ItemBase.c:4878
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9415
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
Определения ItemBase.c:2
override void RemoveAllAgentsExcept(int agent_to_keep)
Определения ItemBase.c:8790
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
Определения ItemBase.c:4941
bool CanBeMovedOverride()
Определения ItemBase.c:7522
override void SetWet(float value, bool allow_client=false)
Определения ItemBase.c:8487
ref TIntArray m_SingleUseActions
Определения ItemBase.c:4927
override void ProcessVariables()
Определения ItemBase.c:9482
ref TStringArray m_HeadHidingSelections
Определения ItemBase.c:4955
float GetWeightSpecialized(bool forceRecalc=false)
Определения ItemBase.c:8321
bool LoadAgents(ParamsReadContext ctx, int version)
Определения ItemBase.c:8856
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
Определения ItemBase.c:8701
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
Определения ItemBase.c:5211
ref array< ref OverheatingParticle > m_OverheatingParticles
Определения ItemBase.c:4953
override float GetTemperatureFreezeThreshold()
Определения ItemBase.c:9518
bool m_IsSoundSynchRemote
Определения ItemBase.c:9676
float m_OverheatingShots
Определения ItemBase.c:4948
void StopItemSoundServer(int id)
Определения ItemBase.c:9271
static void ToggleDebugActionsMask(int mask)
Определения ItemBase.c:5640
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:5364
override float GetTemperatureFreezeTime()
Определения ItemBase.c:9542
ref array< int > m_CompatibleLocks
Определения ItemBase.c:4965
bool CanBeCooked()
Определения ItemBase.c:7478
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:5707
float m_TemperaturePerQuantityWeight
Определения ItemBase.c:4977
bool m_RecipesInitialized
Определения ItemBase.c:4863
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
Определения ItemBase.c:6471
override float GetTemperatureThawThreshold()
Определения ItemBase.c:9526
override void OnEnergyConsumed()
Определения ItemBase.c:8431
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
Определения Bottle_Base.c:158
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
Определения ItemBase.c:8360
override EWetnessLevel GetWetLevel()
Определения ItemBase.c:8551
float GetSingleInventoryItemWeight()
Определения ItemBase.c:8316
ref TIntArray m_InteractActions
Определения ItemBase.c:4929
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
Определения ItemBase.c:7542
float m_VarQuantity
Определения ItemBase.c:4869
bool CanPlayDeployLoopSound()
Определения ItemBase.c:9687
override float GetWetMax()
Определения ItemBase.c:8521
bool CanBeUsedForSuicide()
Определения ItemBase.c:9654
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
Определения ItemBase.c:7117
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
Определения ItemBase.c:5845
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
Определения ItemBase.c:7696
void StartItemSoundServer(int id)
Определения ItemBase.c:9258
void DoAmmoExplosion()
Определения ItemBase.c:6315
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
Определения ItemBase.c:4940
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6655
int GetItemSize()
Определения ItemBase.c:7507
bool m_CanBeMovedOverride
Определения ItemBase.c:4906
override string ChangeIntoOnAttach(string slot)
Определения ItemBase.c:6239
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5432
bool CanDecay()
Определения ItemBase.c:9457
ScriptedLightBase GetLight()
string GetPlaceSoundset()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
Определения ItemBase.c:8202
void SetQuantityMax()
Определения ItemBase.c:8207
override float GetQuantity()
Определения ItemBase.c:8296
int m_ColorComponentR
Определения ItemBase.c:4918
int m_ShotsToStartOverheating
Определения ItemBase.c:4950
override void OnWetChanged(float newVal, float oldVal)
Определения ItemBase.c:8536
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5439
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9039
void OnOverheatingDecay()
Определения ItemBase.c:5402
float GetDryingIncrement(string pIncrementName)
Определения ItemBase.c:8469
void SoundSynchRemoteReset()
int m_Cleanness
Определения ItemBase.c:4884
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
Определения ItemBase.c:5540
bool UsesGlobalDeploy()
Определения ItemBase.c:9686
int m_ItemBehaviour
Определения ItemBase.c:4899
override bool CanReleaseAttachment(EntityAI attachment)
Определения ItemBase.c:9011
float m_HeatIsolation
Определения ItemBase.c:4894
float m_VarWetInit
Определения ItemBase.c:4880
override void OnMovedInsideCargo(EntityAI container)
Определения ItemBase.c:5885
void SetCEBasedQuantity()
Определения ItemBase.c:5653
bool m_CanPlayImpactSound
Определения ItemBase.c:4890
override string GetAttachmentSoundType()
Определения ItemBase.c:9214
float GetOverheatingCoef()
Определения ItemBase.c:5459
array< string > GetHeadHidingSelection()
Определения ItemBase.c:9342
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
Определения ItemBase.c:9294
override bool IsStoreLoad()
Определения ItemBase.c:8563
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7093
bool IsLightSource()
Определения ItemBase.c:5781
bool m_HasQuantityBar
Определения ItemBase.c:4912
void SetResultOfSplit(bool value)
Определения ItemBase.c:7088
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
Определения ItemBase.c:6719
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6889
void UpdateAllOverheatingParticles()
Определения ItemBase.c:5467
float GetSoakingIncrement(string pIncrementName)
Определения ItemBase.c:8478
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9119
override float GetStoreLoadedQuantity()
Определения ItemBase.c:8573
int m_LockType
Определения ItemBase.c:4966
const int ITEM_SOUNDS_MAX
Определения ItemBase.c:4971
bool m_CanBeDigged
Определения ItemBase.c:4913
float m_ItemAttachOffset
Определения ItemBase.c:4896
float GetItemModelLength()
Определения ItemBase.c:8580
bool m_ThrowItemOnDrop
Определения ItemBase.c:4904
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
Определения ItemBase.c:7841
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
Определения ItemBase.c:8871
void Close()
float GetHeatIsolation()
Определения ItemBase.c:8464
void CombineItems(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7122
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
Определения ItemBase.c:9513
bool CanHaveWetness()
Определения ItemBase.c:9470
int m_CleannessMin
Определения ItemBase.c:4886
void TransferAgents(int agents)
transfer agents from another item
Определения ItemBase.c:8804
string IDToName(int id)
Определения ItemBase.c:7689
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
Определения ItemBase.c:9477
float GetHeatIsolationInit()
Определения ItemBase.c:8459
void PlayPlaceSound()
void SetCanBeMovedOverride(bool setting)
Определения ItemBase.c:7529
override bool HasQuantity()
Определения ItemBase.c:8291
float m_VarWetPrev
Определения ItemBase.c:4879
int m_SoundSyncStop
Определения ItemBase.c:4973
bool IsCargoException4x3(EntityAI item)
Определения ItemBase.c:9563
ref TIntArray m_ContinuousActions
Определения ItemBase.c:4928
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
Определения ItemBase.c:5549
void LoadParticleConfigOnFire(int id)
Определения ItemBase.c:5234
int m_VarLiquidType
Определения ItemBase.c:4898
int m_QuickBarBonus
Определения ItemBase.c:4900
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
Определения ItemBase.c:9202
override float GetWetInit()
Определения ItemBase.c:8531
int m_ImpactSoundSurfaceHash
Определения ItemBase.c:4892
int m_SoundSyncPlay
Определения ItemBase.c:4972
int m_MaxOverheatingValue
Определения ItemBase.c:4951
void SetupSpawnedItem(ItemBase item, float health, float quantity)
Определения ItemBase.c:4875
bool m_IsTakeable
Определения ItemBase.c:4903
bool ShouldSplitQuantity(float quantity)
Определения ItemBase.c:6428
static ref map< string, int > m_WeaponTypeToID
Определения ItemBase.c:4943
string GetLockSoundSet()
Определения ItemBase.c:8629
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
Определения ItemBase.c:8660
array< int > GetValidFinishers()
returns an array of possible finishers
Определения ItemBase.c:9590
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
Определения ItemBase.c:6895
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
Определения ItemBase.c:4855
ItemSoundHandler GetItemSoundHandler()
Определения ItemBase.c:9229
override int GetQuantityMin()
Определения ItemBase.c:8280
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
Определения ItemBase.c:6634
override int GetQuickBarBonus()
Определения ItemBase.c:5119
override void SetTakeable(bool pState)
Определения ItemBase.c:9184
float m_OverheatingDecayInterval
Определения ItemBase.c:4952
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6448
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
Определения ItemBase.c:9435
bool CanProcessDecay()
Определения ItemBase.c:9463
void RemoveAudioVisualsOnClient()
Определения Bottle_Base.c:151
void SoundSynchRemote()
static void AddDebugActionsMask(int mask)
Определения ItemBase.c:5630
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
Определения ItemBase.c:9579
bool CanRepair(ItemBase item_repair_kit)
Определения ItemBase.c:7493
bool can_this_be_combined
Определения ItemBase.c:4908
EffectSound m_SoundDeploy
Определения ItemBase.c:9673
int m_Count
Определения ItemBase.c:4874
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
Определения ItemBase.c:9626
float GetDeployTime()
how long it takes to deploy this item in seconds
Определения ItemBase.c:9176
override bool IsSplitable()
Определения ItemBase.c:6415
bool DamageItemAttachments(float damage)
Определения ItemBase.c:6399
override void WriteVarsToCTX(ParamsWriteContext ctx)
Определения ItemBase.c:7805
void ConvertEnergyToQuantity()
Определения ItemBase.c:8446
override void RemoveAllAgents()
Определения ItemBase.c:8785
override void SetQuantityToMinimum()
Определения ItemBase.c:8213
bool m_WantPlayImpactSound
Определения ItemBase.c:4889
override float GetTemperatureThawTime()
Определения ItemBase.c:9550
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
Определения ItemBase.c:4942
int m_ColorComponentG
Определения ItemBase.c:4919
float m_StoreLoadedQuantity
Определения ItemBase.c:4876
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
Определения ItemBase.c:7560
int m_ColorComponentA
Определения ItemBase.c:4921
int m_VarQuantityInit
Определения ItemBase.c:4871
float GetFilterDamageRatio()
Определения ItemBase.c:5534
override void SetLiquidType(int value, bool allow_client=false)
Определения ItemBase.c:8673
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
Определения ItemBase.c:6865
void OnApply(PlayerBase player)
override void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
Определения ItemBase.c:8220
bool m_HideSelectionsBySlot
Определения ItemBase.c:4956
bool IsOverheatingEffectActive()
Определения ItemBase.c:5397
void SetIsBeingPlaced(bool is_being_placed)
Определения ItemBase.c:5814
int GetLiquidContainerMask()
Определения ItemBase.c:5751
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
Определения ItemBase.c:7002
ref Timer m_CheckOverheating
Определения ItemBase.c:4949
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
Определения ItemBase.c:5445
float GetEnergy()
Определения ItemBase.c:8420
bool CanBeDigged()
Определения ItemBase.c:5830
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
Определения ItemBase.c:9596
bool IsNVG()
Определения ItemBase.c:5762
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
Определения ItemBase.c:8380
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
Определения ItemBase.c:9372
bool m_IsDeploySound
Определения ItemBase.c:9675
bool CanEat()
Определения ItemBase.c:7453
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9079
override bool IsOneHandedBehaviour()
Определения ItemBase.c:9150
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
Определения ItemBase.c:9574
bool IsLiquidContainer()
Определения ItemBase.c:5746
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
Определения ItemBase.c:7473
override float GetSingleInventoryItemWeightEx()
Определения ItemBase.c:8307
void SaveAgents(ParamsWriteContext ctx)
Определения ItemBase.c:8863
override int GetTargetQuantityMax(int attSlotID=-1)
Определения ItemBase.c:8261
int m_CleannessInit
Определения ItemBase.c:4885
float GetDisinfectQuantity(int system=0, Param param1=null)
Определения ItemBase.c:5529
override int GetAgents()
Определения ItemBase.c:8810
int m_VarQuantityMax
Определения ItemBase.c:4873
override bool IsHologram()
Определения ItemBase.c:5825
float GetItemAttachOffset()
Определения ItemBase.c:8589
bool IsPlaceSound()
Определения ItemBase.c:9689
static int GetDebugActionsMask()
Определения ItemBase.c:5615
void ProcessDecay(float delta, bool hasRootAsPlayer)
Определения ItemBase.c:9452
override bool IsItemBase()
Определения ItemBase.c:7606
void PlayDeploySound()
override bool IsTwoHandedBehaviour()
Определения ItemBase.c:9160
void ExplodeAmmo()
Определения ItemBase.c:6302
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
Определения ItemBase.c:7078
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
Определения ItemBase.c:8884
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9059
override void OnEnergyAdded()
Определения ItemBase.c:8438
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
Определения ItemBase.c:5774
EffectSound m_DeployLoopSoundEx
Определения ItemBase.c:9672
override void DeSerializeNumericalVars(array< float > floats)
Определения ItemBase.c:7746
void StopItemDynamicPhysics()
Определения ItemBase.c:9354
bool HasFoodStage()
Определения ItemBase.c:7466
override void SetStoreLoad(bool value)
Определения ItemBase.c:8558
float GetOverheatingValue()
Определения ItemBase.c:5359
bool ContainsAgent(int agent_id)
Определения ItemBase.c:8763
override void AddWet(float value)
Определения ItemBase.c:8506
bool IsLiquidPresent()
Определения ItemBase.c:5741
bool IsFullQuantity()
Определения ItemBase.c:8301
override void EOnContact(IEntity other, Contact extra)
Определения ItemBase.c:6015
void SplitIntoStackMaxHands(PlayerBase player)
Определения ItemBase.c:6770
void SplitIntoStackMaxHandsClient(PlayerBase player)
Определения ItemBase.c:6746
int m_CleannessMax
Определения ItemBase.c:4887
float m_VarStackMax
Определения ItemBase.c:4875
ref Timer m_PhysDropTimer
Определения ItemBase.c:4962
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
Определения ItemBase.c:7578
override void SetStoreLoadedQuantity(float value)
Определения ItemBase.c:8568
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
Определения ItemBase.c:4916
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5380
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
Определения ItemBase.c:5695
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
Определения ItemBase.c:7500
void OnLiquidTypeChanged(int oldType, int newType)
Определения ItemBase.c:8694
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
Определения ItemBase.c:5426
void PlayDeployFinishSound()
bool AllowFoodConsumption()
Определения ItemBase.c:8616
bool m_IsOverheatingEffectActive
Определения ItemBase.c:4947
int m_LiquidContainerMask
Определения ItemBase.c:4897
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9390
override int GetCleanness()
Определения ItemBase.c:8611
bool PairWithDevice(notnull ItemBase otherDevice)
Определения ItemBase.c:9601
bool IsDeploySound()
Определения ItemBase.c:9690
static void RemoveDebugActionsMask(int mask)
Определения ItemBase.c:5635
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
Определения ItemBase.c:9099
int m_VarQuantityMin
Определения ItemBase.c:4872
void PerformDamageSystemReinit()
Определения ItemBase.c:9360
override void ClearInventory()
Определения ItemBase.c:8399
static int m_LastRegisteredWeaponID
Определения ItemBase.c:4944
ItemBase GetLightSourceItem()
Определения ItemBase.c:9584
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
Определения ItemBase.c:7596
override float GetItemOverheatThreshold()
Определения ItemBase.c:9534
void StopDeployLoopSoundEx()
bool m_CanThisBeSplit
Определения ItemBase.c:4909
override void SerializeNumericalVars(array< float > floats_out)
Определения ItemBase.c:7710
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
Определения ItemBase.c:6685
float m_ItemModelLength
Определения ItemBase.c:4895
bool m_IsHologram
Определения ItemBase.c:4902
static int m_DebugActionsMask
Определения ItemBase.c:4862
void KillAllOverheatingParticles()
Определения ItemBase.c:5495
bool CanBeCookedOnStick()
Определения ItemBase.c:7483
override int GetQuantityMax()
Определения ItemBase.c:8248
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
Определения ItemBase.c:7156
void OnActivatedByTripWire()
bool IsColorSet()
Определения ItemBase.c:8654
override void RemoveAgent(int agent_id)
Определения ItemBase.c:8776
bool m_ItemBeingDroppedPhys
Определения ItemBase.c:4905
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:8966
void PlayDetachSound(string slot_type)
Определения ItemBase.c:9330
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
Определения ItemBase.c:4856
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
Определения ItemBase.c:9663
override bool IsBeingPlaced()
Определения ItemBase.c:5809
int GetQuantityInit()
Определения ItemBase.c:8285
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
Определения ItemBase.c:7098
bool IsResultOfSplit()
Определения ItemBase.c:7083
bool m_FixDamageSystemInit
Определения ItemBase.c:4907
float m_ImpactSpeed
Определения ItemBase.c:4891
bool m_IsStoreLoad
Определения ItemBase.c:4910
int GetLiquidTypeInit()
Определения ItemBase.c:8684
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
Определения ItemBase.c:4925
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
Определения ItemBase.c:5682
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
Определения ItemBase.c:6557
int m_AttachedAgents
Определения ItemBase.c:4933
string m_LockSoundSet
Определения ItemBase.c:4968
void LoadParticleConfigOnOverheating(int id)
Определения ItemBase.c:5303
float m_VarQuantityPrev
Определения ItemBase.c:4870
bool IsSoundSynchRemote()
Определения ItemBase.c:9688
bool m_CanShowQuantity
Определения ItemBase.c:4911
override void OnRightClick()
Определения ItemBase.c:6938
int m_ColorComponentB
Определения ItemBase.c:4920
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
Определения ItemBase.c:4858
bool IsActionTargetVisible()
Определения ItemBase.c:9196
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения ItemBase.c:6050
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
Определения ItemBase.c:6339
bool m_IsBeingPlaced
Определения ItemBase.c:4901
int NameToID(string name)
Определения ItemBase.c:7683
void ~ItemBase()
Определения ItemBase.c:5580
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
Определения ItemBase.c:8546
void ClearStopItemSoundServer()
Определения ItemBase.c:9288
override string ChangeIntoOnDetach()
Определения ItemBase.c:6263
float m_VarWetMax
Определения ItemBase.c:4882
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
Определения ItemBase.c:6680
int GetLockType()
Определения ItemBase.c:8624
EffectSound m_SoundDeployFinish
Определения ItemBase.c:9670
override float GetWet()
Определения ItemBase.c:8516
EffectSound m_SoundPlace
Определения ItemBase.c:9671
float GetQuantityNormalizedScripted()
Определения ItemBase.c:8234
override void SetCleanness(int value, bool allow_client=false)
Определения ItemBase.c:8598
bool m_IsPlaceSound
Определения ItemBase.c:9674
override float GetWetMin()
Определения ItemBase.c:8526
ref ItemSoundHandler m_ItemSoundHandler
Определения ItemBase.c:4974
override bool KindOf(string tag)
Определения ItemBase.c:7612
void ItemSoundHandler(ItemBase parent)
Определения ItemSoundHandler.c:31
string Type
Определения JsonDataContaminatedArea.c:11
EffectSound m_LockingSound
Определения Land_Underground_Entrance.c:321
string GetDebugText()
Определения ModifierBase.c:71
PlayerBase GetPlayer()
Определения ModifierBase.c:51
@ LOWEST
Определения PPEConstants.c:54
void PluginItemDiagnostic()
Определения PluginItemDiagnostic.c:74
PluginBase GetPlugin(typename plugin_type)
Определения PluginManager.c:316
EntityAI GetItem()
Определения RadialQuickbarMenu.c:37
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
Определения RemoteDetonator.c:272
void RemoteDetonatorTrigger()
Определения RemoteDetonator.c:233
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
Определения RemoteDetonator.c:305
int particle_id
Определения SmokeSimulation.c:28
ETemperatureAccessTypes
Определения TemperatureAccessConstants.c:2
override void Explode(int damageType, string ammoType="")
Определения Trap_LandMine.c:220
bool m_Initialized
Определения UiHintPanel.c:317
void Debug()
Определения UniversalTemperatureSource.c:349
int GetID()
Определения ActionBase.c:1360
void OnItemLocationChanged(ItemBase item)
Определения ActionBase.c:998
GetInputType()
Определения ActionBase.c:215
int m_StanceMask
Определения ActionBase.c:25
int m_CommandUIDProne
Определения ActionBase.c:24
int m_CommandUID
Определения ActionBase.c:23
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
Определения AnalyticsManagerClient.c:77
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
Определения DayZGame.c:1187
proto native void GizmoSelectObject(Object object)
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto native void GizmoSelectPhysics(Physics physics)
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
Определения Global/game.c:1568
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
float GetEnergyAtSpawn()
Определения ComponentEnergyManager.c:1280
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
Определения ComponentEnergyManager.c:541
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
Определения ComponentEnergyManager.c:1275
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
Определения EffectSound.c:603
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
Определения EffectSound.c:274
override bool IsMan()
Определения 3_Game/Entities/Man.c:44
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
Определения ItemBase.c:15
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
bool WriteToContext(ParamsWriteContext ctx)
Определения InventoryLocation.c:469
proto native int GetType()
returns type of InventoryLocation
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native bool GetFlip()
returns flip status of cargo
proto native EntityAI GetItem()
returns item of current inventory location
InventoryLocation.
Определения InventoryLocation.c:29
override bool CanDisplayCargo()
Определения UndergroundStash.c:24
override void OnInventoryEnter(Man player)
Определения BarbedWire.c:203
override string GetFoldSoundset()
Определения BaseBuildingBase.c:108
override bool CanPutAsAttachment(EntityAI parent)
Определения ItemBase.c:6
override bool CanReceiveItemIntoCargo(EntityAI item)
Определения TentBase.c:913
override bool OnStoreLoad(ParamsReadContext ctx, int version)
Определения GardenBase.c:199
override void OnWasDetached(EntityAI parent, int slot_id)
override void EEOnAfterLoad()
Определения GardenBase.c:242
override void EEDelete(EntityAI parent)
Определения BaseBuildingBase.c:68
override bool CanBeRepairedByCrafting()
Определения TentBase.c:86
override void OnPlacementStarted(Man player)
Определения BatteryCharger.c:376
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
Определения BarbedWire.c:357
override bool IsElectricAppliance()
Определения BatteryCharger.c:43
override bool IsItemTent()
Определения TentBase.c:81
override void SetActions()
override string GetLoopFoldSoundset()
Определения BaseBuildingBase.c:113
override bool CanMakeGardenplot()
Определения FieldShovel.c:3
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
Определения PowerGenerator.c:412
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
Определения HandcuffsLocked.c:12
override WrittenNoteData GetWrittenNoteData()
Определения Paper.c:30
override int GetDamageSystemVersionChange()
Определения BaseBuildingBase.c:1238
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
Определения PileOfWoodenPlanks.c:88
override void InitItemVariables()
Определения Matchbox.c:3
override void SetActionAnimOverrides()
Определения PickAxe.c:28
override void OnCreatePhysics()
Определения BaseBuildingBase.c:489
override string GetDeploySoundset()
Определения BarbedWire.c:392
override float GetBandagingEffectivity()
Определения BandageDressing.c:49
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
Определения PowerGenerator.c:424
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
Определения BaseBuildingBase.c:496
override void OnStoreSave(ParamsWriteContext ctx)
Определения GardenBase.c:266
override void AfterStoreLoad()
Определения BarbedWire.c:155
override int GetOnDigWormsAmount()
Определения FieldShovel.c:27
override bool IsSelfAdjustingTemperature()
Определения PortableGasStove.c:287
override bool IsPlayerInside(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1037
override void OnVariablesSynchronized()
Определения GardenBase.c:97
override void RefreshPhysics()
Определения BatteryCharger.c:359
override bool CanObstruct()
Определения BaseBuildingBase.c:84
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
Определения BaseBuildingBase.c:982
override bool CanPutInCargo(EntityAI parent)
Определения GardenBase.c:331
override string GetLoopDeploySoundset()
Определения BarbedWire.c:397
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
Определения BarbedWire.c:372
override void OnInventoryExit(Man player)
Определения BatteryCharger.c:341
override bool IsTakeable()
Определения BaseBuildingBase.c:1008
override bool IsIgnoredByConstruction()
Определения BaseBuildingBase.c:1170
override void InitItemSounds()
Определения BaseBuildingBase.c:94
override void EEKilled(Object killer)
Определения HandcuffsLocked.c:70
override void OnCombine(ItemBase other_item)
Определения BandageDressing.c:71
override bool CanExplodeInFire()
Определения LargeGasCannister.c:3
override bool IsFacingPlayer(PlayerBase player, string selection)
Определения BaseBuildingBase.c:1032
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
Определения Rag.c:61
override bool IsBloodContainer()
Определения BloodContainerBase.c:10
override bool IsClothing()
override bool CanBeSplit()
Определения Rag.c:34
override bool IsDeployable()
Определения BaseBuildingBase.c:365
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Определения ToolBase.c:24
override bool CanBeDisinfected()
Определения BandageDressing.c:54
override float GetInfectionChance(int system=0, Param param=null)
Определения BandageDressing.c:59
override void OnEndPlacement()
Определения KitBase.c:65
Определения EnMath.c:7
float GetOverheatingLimitMax()
Определения WeaponParticles.c:417
void SetOverheatingLimitMax(float max)
Определения WeaponParticles.c:407
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
Определения WeaponParticles.c:422
float GetOverheatingLimitMin()
Определения WeaponParticles.c:412
Particle GetParticle()
Определения WeaponParticles.c:397
void SetOverheatingLimitMin(float min)
Определения WeaponParticles.c:402
void RegisterParticle(Particle p)
Определения WeaponParticles.c:392
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
Определения Particle.c:266
void SetControlledDevice(EntityAI pDevice)
Определения RemoteDetonator.c:140
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
proto void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto native void Send()
proto bool Write(void value_out)
proto bool Read(void value_in)
bool m_Loop
Определения ItemSoundHandler.c:5
override void Stop()
Определения DayZPlayerImplement.c:64
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
Определения UIManager.c:160
override void Refresh()
Определения ChatInputMenu.c:70
void SetCalcDetails(string details)
Определения 3_Game/tools/Debug.c:816
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Определения WrittenNoteData.c:13
const float LOWEST
Определения EnConvert.c:100
Serializer ParamsReadContext
Определения gameplay.c:15
class LOD Object
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Определения gameplay.c:6
proto native CGame GetGame()
Serializer ParamsWriteContext
Определения gameplay.c:16
const int DEF_BIOLOGICAL
Определения 3_Game/constants.c:512
const int DEF_CHEMICAL
Определения 3_Game/constants.c:513
const int COMP_TYPE_ENERGY_MANAGER
Определения Component.c:9
ErrorExSeverity
Определения EnDebug.c:62
void Error(string err)
Messagebox with error message.
Определения EnDebug.c:90
enum ShapeType ErrorEx
proto native void SetColor(int color)
array< string > TStringArray
Определения EnScript.c:709
array< int > TIntArray
Определения EnScript.c:711
EntityEvent
Entity events for event-mask, or throwing event from code.
Определения EnEntity.c:45
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
Определения 3_Game/constants.c:808
const int VARIABLE_LIQUIDTYPE
Определения 3_Game/constants.c:632
const int VARIABLE_CLEANNESS
Определения 3_Game/constants.c:635
const int VARIABLE_COLOR
Определения 3_Game/constants.c:634
const int VARIABLE_TEMPERATURE
Определения 3_Game/constants.c:630
const int VARIABLE_QUANTITY
Определения 3_Game/constants.c:628
const int VARIABLE_WET
Определения 3_Game/constants.c:631
const int LIQUID_NONE
Определения 3_Game/constants.c:529
static proto float AbsFloat(float f)
Returns absolute value.
const int MENU_INVENTORY
Определения 3_Game/constants.c:180
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_CRAFTING
Определения 3_Game/constants.c:453
const int SAT_DEBUG_ACTION
Определения 3_Game/constants.c:454
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.
const int CALL_CATEGORY_GAMEPLAY
Определения 3_Game/tools/tools.c:10
const int CALL_CATEGORY_SYSTEM
Определения 3_Game/tools/tools.c:8
proto native int GetColor()

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