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

◆ StopOverheatingParticles()

static void SpawnItemOnLocation::StopOverheatingParticles ( ItemBase weapon,
string ammoType,
ItemBase muzzle_owner,
ItemBase suppressor,
string config_to_search )
staticprotected

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

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