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

◆ ProcessVariables()

override void SpawnItemOnLocation::ProcessVariables ( )
protected

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

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

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