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

◆ CanPlayDeployLoopSound()

bool SpawnItemOnLocation::CanPlayDeployLoopSound ( )
protected

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

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