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

◆ ClearStartItemSoundServer()

void SpawnItemOnLocation::ClearStartItemSoundServer ( )
protected

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

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