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

◆ GetValidFinishers()

array< int > SpawnItemOnLocation::GetValidFinishers ( )
protected

returns an array of possible finishers

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

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