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

◆ GetTemperaturePerQuantityWeight()

float SpawnItemOnLocation::GetTemperaturePerQuantityWeight ( )
protected

Used in heat comfort calculations only!

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

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