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

◆ SaveAgents()

void SpawnItemOnLocation::SaveAgents ( ParamsWriteContext ctx)
protected

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

8725{
8726 override bool CanPutAsAttachment(EntityAI parent)
8727 {
8728 return true;
8729 }
8730};
8731
8732//const bool QUANTITY_DEBUG_REMOVE_ME = false;
8733
8734class ItemBase extends InventoryItem
8735{
8739
8741
8742 static int m_DebugActionsMask;
8744 // ============================================
8745 // Variable Manipulation System
8746 // ============================================
8747 // Quantity
8748
8749 float m_VarQuantity;
8750 float m_VarQuantityPrev;//for client to know quantity changed during synchronization
8752 int m_VarQuantityMin;
8753 int m_VarQuantityMax;
8754 int m_Count;
8755 float m_VarStackMax;
8756 float m_StoreLoadedQuantity = float.LOWEST;
8757 // Wet
8758 float m_VarWet;
8759 float m_VarWetPrev;//for client to know wetness changed during synchronization
8760 float m_VarWetInit;
8761 float m_VarWetMin;
8762 float m_VarWetMax;
8763 // Cleanness
8764 int m_Cleanness;
8765 int m_CleannessInit;
8766 int m_CleannessMin;
8767 int m_CleannessMax;
8768 // impact sounds
8770 bool m_CanPlayImpactSound = true;
8771 float m_ImpactSpeed;
8773 //
8774 float m_HeatIsolation;
8775 float m_ItemModelLength;
8776 float m_ItemAttachOffset; // Offset length for when the item is attached e.g. to weapon
8778 int m_VarLiquidType;
8779 int m_ItemBehaviour; // -1 = not specified; 0 = heavy item; 1= onehanded item; 2 = twohanded item
8780 int m_QuickBarBonus;
8781 bool m_IsBeingPlaced;
8782 bool m_IsHologram;
8783 bool m_IsTakeable;
8784 bool m_ThrowItemOnDrop;
8787 bool m_FixDamageSystemInit = false; //can be changed on storage version check
8788 bool can_this_be_combined; //Check if item can be combined
8789 bool m_CanThisBeSplit; //Check if item can be split
8790 bool m_IsStoreLoad = false;
8791 bool m_CanShowQuantity;
8792 bool m_HasQuantityBar;
8793 protected bool m_CanBeDigged;
8794 protected bool m_IsResultOfSplit
8795
8796 string m_SoundAttType;
8797 // items color variables
8802 //-------------------------------------------------------
8803
8804 // light source managing
8806
8810
8811 //==============================================
8812 // agent system
8813 private int m_AttachedAgents;
8814
8816 void TransferModifiers(PlayerBase reciever);
8817
8818
8819 // Weapons & suppressors particle effects
8824 static int m_LastRegisteredWeaponID = 0;
8825
8826 // Overheating effects
8828 float m_OverheatingShots;
8829 ref Timer m_CheckOverheating;
8830 int m_ShotsToStartOverheating = 0; // After these many shots, the overheating effect begins
8831 int m_MaxOverheatingValue = 0; // Limits the number of shots that will be tracked
8832 float m_OverheatingDecayInterval = 1; // Timer's interval for decrementing overheat effect's lifespan
8833 ref array <ref OverheatingParticle> m_OverheatingParticles;
8834
8836 protected bool m_HideSelectionsBySlot;
8837
8838 // Admin Log
8839 PluginAdminLog m_AdminLog;
8840
8841 // misc
8842 ref Timer m_PhysDropTimer;
8843
8844 // Attachment Locking variables
8845 ref array<int> m_CompatibleLocks;
8846 protected int m_LockType;
8847 protected ref EffectSound m_LockingSound;
8848 protected string m_LockSoundSet;
8849
8850 // ItemSoundHandler
8851 protected const int ITEM_SOUNDS_MAX = 63; // optimize network synch
8852 protected int m_SoundSyncPlay; // id for sound to play
8853 protected int m_SoundSyncStop; // id for sound to stop
8855
8856 //temperature
8857 private float m_TemperaturePerQuantityWeight;
8858
8859 // -------------------------------------------------------------------------
8860 void ItemBase()
8861 {
8862 SetEventMask(EntityEvent.INIT); // Enable EOnInit event
8866
8867 if (!GetGame().IsDedicatedServer())
8868 {
8869 if (HasMuzzle())
8870 {
8872
8874 {
8876 }
8877 }
8878
8880 m_ActionsInitialize = false;
8881 }
8882
8883 m_OldLocation = null;
8884
8885 if (GetGame().IsServer())
8886 {
8887 m_AdminLog = PluginAdminLog.Cast(GetPlugin(PluginAdminLog));
8888 }
8889
8890 if (ConfigIsExisting("headSelectionsToHide"))
8891 {
8893 ConfigGetTextArray("headSelectionsToHide",m_HeadHidingSelections);
8894 }
8895
8896 m_HideSelectionsBySlot = false;
8897 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
8898 {
8899 m_HideSelectionsBySlot = ConfigGetBool("hideSelectionsByinventorySlot");
8900 }
8901
8902 m_QuickBarBonus = Math.Max(0, ConfigGetInt("quickBarBonus"));
8903
8904 m_IsResultOfSplit = false;
8905
8907 }
8908
8909 override void InitItemVariables()
8910 {
8911 super.InitItemVariables();
8912
8913 m_VarQuantityInit = ConfigGetInt("varQuantityInit");
8914 m_VarQuantity = m_VarQuantityInit;//should be by the CE, this is just a precaution
8915 m_VarQuantityMin = ConfigGetInt("varQuantityMin");
8916 m_VarQuantityMax = ConfigGetInt("varQuantityMax");
8917 m_VarStackMax = ConfigGetFloat("varStackMax");
8918 m_Count = ConfigGetInt("count");
8919
8920 m_CanShowQuantity = ConfigGetBool("quantityShow");
8921 m_HasQuantityBar = ConfigGetBool("quantityBar");
8922
8923 m_CleannessInit = ConfigGetInt("varCleannessInit");
8925 m_CleannessMin = ConfigGetInt("varCleannessMin");
8926 m_CleannessMax = ConfigGetInt("varCleannessMax");
8927
8928 m_WantPlayImpactSound = false;
8929 m_ImpactSpeed = 0.0;
8930
8931 m_VarWetInit = ConfigGetFloat("varWetInit");
8933 m_VarWetMin = ConfigGetFloat("varWetMin");
8934 m_VarWetMax = ConfigGetFloat("varWetMax");
8935
8936 m_LiquidContainerMask = ConfigGetInt("liquidContainerType");
8937 if (IsLiquidContainer() && GetQuantity() != 0)
8939 m_IsBeingPlaced = false;
8940 m_IsHologram = false;
8941 m_IsTakeable = true;
8942 m_CanBeMovedOverride = false;
8946 m_CanBeDigged = ConfigGetBool("canBeDigged");
8947
8948 m_CompatibleLocks = new array<int>();
8949 ConfigGetIntArray("compatibleLocks", m_CompatibleLocks);
8950 m_LockType = ConfigGetInt("lockType");
8951
8952 //Define if item can be split and set ability to be combined accordingly
8953 m_CanThisBeSplit = false;
8954 can_this_be_combined = false;
8955 if (ConfigIsExisting("canBeSplit"))
8956 {
8957 can_this_be_combined = ConfigGetBool("canBeSplit");
8959 }
8960
8961 m_ItemBehaviour = -1;
8962 if (ConfigIsExisting("itemBehaviour"))
8963 m_ItemBehaviour = ConfigGetInt("itemBehaviour");
8964
8965 //RegisterNetSyncVariableInt("m_VariablesMask");
8966 if (HasQuantity()) RegisterNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
8967 RegisterNetSyncVariableFloat("m_VarWet", GetWetMin(), GetWetMax(), 2);
8968 RegisterNetSyncVariableInt("m_VarLiquidType");
8969 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8970
8971 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8972 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8973 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8974
8975 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8976 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8977 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8978 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8979
8980 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8981 RegisterNetSyncVariableBool("m_IsTakeable");
8982 RegisterNetSyncVariableBool("m_IsHologram");
8983
8984 InitItemSounds();
8986 {
8987 RegisterNetSyncVariableInt("m_SoundSyncPlay", 0, ITEM_SOUNDS_MAX);
8988 RegisterNetSyncVariableInt("m_SoundSyncStop", 0, ITEM_SOUNDS_MAX);
8989 }
8990
8991 m_LockSoundSet = ConfigGetString("lockSoundSet");
8992
8994 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8995 m_TemperaturePerQuantityWeight = ConfigGetFloat("temperaturePerQuantityWeight");
8996
8997 }
8998
8999 override int GetQuickBarBonus()
9000 {
9001 return m_QuickBarBonus;
9002 }
9003
9004 void InitializeActions()
9005 {
9007 if (!m_InputActionMap)
9008 {
9010 m_InputActionMap = iam;
9011 SetActions();
9013 }
9014 }
9015
9016 override void GetActions(typename action_input_type, out array<ActionBase_Basic> actions)
9017 {
9019 {
9020 m_ActionsInitialize = true;
9022 }
9023
9024 actions = m_InputActionMap.Get(action_input_type);
9025 }
9026
9027 void SetActions()
9028 {
9029 AddAction(ActionTakeItem);
9030 AddAction(ActionTakeItemToHands);
9031 AddAction(ActionWorldCraft);
9033 AddAction(ActionAttachWithSwitch);
9034 }
9035
9036 void SetActionAnimOverrides(); // Override action animation for specific item
9037
9038 void AddAction(typename actionName)
9039 {
9040 ActionBase action = ActionManagerBase.GetAction(actionName);
9041
9042 if (!action)
9043 {
9044 Debug.LogError("Action " + actionName + " dosn't exist!");
9045 return;
9046 }
9047
9048 typename ai = action.GetInputType();
9049 if (!ai)
9050 {
9051 m_ActionsInitialize = false;
9052 return;
9053 }
9054
9055 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
9056 if (!action_array)
9057 {
9058 action_array = new array<ActionBase_Basic>;
9059 m_InputActionMap.Insert(ai, action_array);
9060 }
9061 if (LogManager.IsActionLogEnable())
9062 {
9063 Debug.ActionLog(action.ToString() + " -> " + ai, this.ToString() , "n/a", "Add action");
9064 }
9065
9066 if (action_array.Find(action) != -1)
9067 {
9068 Debug.Log("Action " + action.Type() + " already added to " + this + ", skipping!");
9069 }
9070 else
9071 {
9072 action_array.Insert(action);
9073 }
9074 }
9075
9076 void RemoveAction(typename actionName)
9077 {
9078 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
9079 ActionBase action = player.GetActionManager().GetAction(actionName);
9080 typename ai = action.GetInputType();
9081 array<ActionBase_Basic> action_array = m_InputActionMap.Get(ai);
9082
9083 if (action_array)
9084 {
9085 action_array.RemoveItem(action);
9086 }
9087 }
9088
9089 // Allows override of default action command per item, defined in the SetActionAnimOverrides() of the item's class
9090 // Set -1 for params which should stay in default state
9091 void OverrideActionAnimation(typename action, int commandUID, int stanceMask = -1, int commandUIDProne = -1)
9092 {
9093 ActionOverrideData overrideData = new ActionOverrideData();
9094 overrideData.m_CommandUID = commandUID;
9095 overrideData.m_CommandUIDProne = commandUIDProne;
9096 overrideData.m_StanceMask = stanceMask;
9097
9098 TActionAnimOverrideMap actionMap = m_ItemActionOverrides.Get(action);
9099 if (!actionMap) // create new map of action > overidables map
9100 {
9101 actionMap = new TActionAnimOverrideMap();
9102 m_ItemActionOverrides.Insert(action, actionMap);
9103 }
9104
9105 actionMap.Insert(this.Type(), overrideData); // insert item -> overrides
9106
9107 }
9108
9109 void OnItemInHandsPlayerSwimStart(PlayerBase player);
9110
9111 ScriptedLightBase GetLight();
9112
9113 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
9114 void LoadParticleConfigOnFire(int id)
9115 {
9116 if (!m_OnFireEffect)
9118
9121
9122 string config_to_search = "CfgVehicles";
9123 string muzzle_owner_config;
9124
9125 if (!m_OnFireEffect.Contains(id))
9126 {
9127 if (IsInherited(Weapon))
9128 config_to_search = "CfgWeapons";
9129
9130 muzzle_owner_config = config_to_search + " " + GetType() + " ";
9131
9132 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
9133
9134 int config_OnFire_subclass_count = GetGame().ConfigGetChildrenCount(config_OnFire_class);
9135
9136 if (config_OnFire_subclass_count > 0)
9137 {
9138 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
9139
9140 for (int i = 0; i < config_OnFire_subclass_count; i++)
9141 {
9142 string particle_class = "";
9143 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
9144 string config_OnFire_entry = config_OnFire_class + particle_class;
9145 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
9146 WPOF_array.Insert(WPOF);
9147 }
9148
9149
9150 m_OnFireEffect.Insert(id, WPOF_array);
9151 }
9152 }
9153
9154 if (!m_OnBulletCasingEjectEffect.Contains(id))
9155 {
9156 config_to_search = "CfgWeapons"; // Bullet Eject efect is supported on weapons only.
9157 muzzle_owner_config = config_to_search + " " + GetType() + " ";
9158
9159 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
9160
9161 int config_OnBulletCasingEject_count = GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
9162
9163 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
9164 {
9165 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
9166
9167 for (i = 0; i < config_OnBulletCasingEject_count; i++)
9168 {
9169 string particle_class2 = "";
9170 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
9171 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
9172 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
9173 WPOBE_array.Insert(WPOBE);
9174 }
9175
9176
9177 m_OnBulletCasingEjectEffect.Insert(id, WPOBE_array);
9178 }
9179 }
9180 }
9181
9182 // Loads muzzle flash particle configuration from config and saves it to a map for faster access
9184 {
9187
9188 if (!m_OnOverheatingEffect.Contains(id))
9189 {
9190 string config_to_search = "CfgVehicles";
9191
9192 if (IsInherited(Weapon))
9193 config_to_search = "CfgWeapons";
9194
9195 string muzzle_owner_config = config_to_search + " " + GetType() + " ";
9196 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
9197
9198 if (GetGame().ConfigIsExisting(config_OnOverheating_class))
9199 {
9200
9201 m_ShotsToStartOverheating = GetGame().ConfigGetFloat(config_OnOverheating_class + "shotsToStartOverheating");
9202
9204 {
9205 m_ShotsToStartOverheating = -1; // This prevents futher readings from config for future creations of this item
9206 string error = "Error reading config " + GetType() + ">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
9207 Error(error);
9208 return;
9209 }
9210
9211 m_OverheatingDecayInterval = GetGame().ConfigGetFloat(config_OnOverheating_class + "overheatingDecayInterval");
9212 m_MaxOverheatingValue = GetGame().ConfigGetFloat(config_OnOverheating_class + "maxOverheatingValue");
9213
9214
9215
9216 int config_OnOverheating_subclass_count = GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
9217 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
9218
9219 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
9220 {
9221 string particle_class = "";
9222 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
9223 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
9224 int entry_type = GetGame().ConfigGetType(config_OnOverheating_entry);
9225
9226 if (entry_type == CT_CLASS)
9227 {
9228 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
9229 WPOOH_array.Insert(WPOF);
9230 }
9231 }
9232
9233
9234 m_OnOverheatingEffect.Insert(id, WPOOH_array);
9235 }
9236 }
9237 }
9238
9239 float GetOverheatingValue()
9240 {
9241 return m_OverheatingShots;
9242 }
9243
9244 void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
9245 {
9246 if (m_MaxOverheatingValue > 0)
9247 {
9249
9250 if (!m_CheckOverheating)
9252
9254 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
9255
9256 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9257 }
9258 }
9259
9260 void CheckOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9261 {
9263 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9264
9266 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9267
9269 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9270
9272 {
9274 }
9275 }
9276
9278 {
9280 }
9281
9282 void OnOverheatingDecay()
9283 {
9284 if (m_MaxOverheatingValue > 0)
9285 m_OverheatingShots -= 1 + m_OverheatingShots / m_MaxOverheatingValue; // The hotter a barrel is, the faster it needs to cool down.
9286 else
9288
9289 if (m_OverheatingShots <= 0)
9290 {
9293 }
9294 else
9295 {
9296 if (!m_CheckOverheating)
9298
9300 m_CheckOverheating.Run(m_OverheatingDecayInterval, this, "OnOverheatingDecay");
9301 }
9302
9303 CheckOverheating(this, "", this);
9304 }
9305
9306 void StartOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9307 {
9309 ItemBase.PlayOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
9310 }
9311
9312 void UpdateOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9313 {
9315 ItemBase.UpdateOverheatingParticles(this, ammoType, this, suppressor, "CfgWeapons");
9317 }
9318
9319 void StopOverheating(ItemBase weapon = null, string ammoType = "", ItemBase muzzle_owner = null, ItemBase suppressor = null, string config_to_search = "")
9320 {
9322 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9323 }
9324
9325 void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
9326 {
9328 m_OverheatingParticles = new array<ref OverheatingParticle>;
9329
9330 OverheatingParticle OP = new OverheatingParticle();
9331 OP.RegisterParticle(p);
9332 OP.SetOverheatingLimitMin(min_heat_coef);
9333 OP.SetOverheatingLimitMax(max_heat_coef);
9334 OP.SetParticleParams(particle_id, parent, local_pos, local_ori);
9335
9336 m_OverheatingParticles.Insert(OP);
9337 }
9338
9339 float GetOverheatingCoef()
9340 {
9341 if (m_MaxOverheatingValue > 0)
9343
9344 return -1;
9345 }
9346
9348 {
9350 {
9351 float overheat_coef = GetOverheatingCoef();
9352 int count = m_OverheatingParticles.Count();
9353
9354 for (int i = count; i > 0; --i)
9355 {
9356 int id = i - 1;
9357 OverheatingParticle OP = m_OverheatingParticles.Get(id);
9358 Particle p = OP.GetParticle();
9359
9360 float overheat_min = OP.GetOverheatingLimitMin();
9361 float overheat_max = OP.GetOverheatingLimitMax();
9362
9363 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
9364 {
9365 if (p)
9366 {
9367 p.Stop();
9368 OP.RegisterParticle(null);
9369 }
9370 }
9371 }
9372 }
9373 }
9374
9376 {
9378 {
9379 for (int i = m_OverheatingParticles.Count(); i > 0; i--)
9380 {
9381 int id = i - 1;
9382 OverheatingParticle OP = m_OverheatingParticles.Get(id);
9383
9384 if (OP)
9385 {
9386 Particle p = OP.GetParticle();
9387
9388 if (p)
9389 {
9390 p.Stop();
9391 }
9392
9393 delete OP;
9394 }
9395 }
9396
9397 m_OverheatingParticles.Clear();
9399 }
9400 }
9401
9403 float GetInfectionChance(int system = 0, Param param = null)
9404 {
9405 return 0.0;
9406 }
9407
9408
9409 float GetDisinfectQuantity(int system = 0, Param param1 = null)
9410 {
9411 return 250;//default value
9412 }
9413
9414 float GetFilterDamageRatio()
9415 {
9416 return 0;
9417 }
9418
9420 bool HasMuzzle()
9421 {
9422 if (IsInherited(Weapon) || IsInherited(SuppressorBase))
9423 return true;
9424
9425 return false;
9426 }
9427
9429 int GetMuzzleID()
9430 {
9431 if (!m_WeaponTypeToID)
9433
9434 if (m_WeaponTypeToID.Contains(GetType()))
9435 {
9436 return m_WeaponTypeToID.Get(GetType());
9437 }
9438 else
9439 {
9440 // Register new weapon ID
9442 }
9443
9445 }
9446
9453 {
9454 return -1;
9455 }
9456
9457
9458
9459 // -------------------------------------------------------------------------
9460 void ~ItemBase()
9461 {
9462 if (GetGame() && GetGame().GetPlayer() && (!GetGame().IsDedicatedServer()))
9463 {
9464 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
9465 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9466
9467 if (r_index >= 0)
9468 {
9469 InventoryLocation r_il = new InventoryLocation;
9470 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9471
9472 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9473 int r_type = r_il.GetType();
9474 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
9475 {
9476 r_il.GetParent().GetOnReleaseLock().Invoke(this);
9477 }
9478 else if (r_type == InventoryLocationType.ATTACHMENT)
9479 {
9480 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
9481 }
9482
9483 }
9484
9485 player.GetHumanInventory().ClearUserReservedLocation(this);
9486 }
9487
9488 if (m_LockingSound)
9489 SEffectManager.DestroyEffect(m_LockingSound);
9490 }
9491
9492
9493
9494 // -------------------------------------------------------------------------
9495 static int GetDebugActionsMask()
9496 {
9497 return ItemBase.m_DebugActionsMask;
9498 }
9499
9500 static bool HasDebugActionsMask(int mask)
9501 {
9502 return ItemBase.m_DebugActionsMask & mask;
9503 }
9504
9505 static void SetDebugActionsMask(int mask)
9506 {
9507 ItemBase.m_DebugActionsMask = mask;
9508 }
9509
9510 static void AddDebugActionsMask(int mask)
9511 {
9512 ItemBase.m_DebugActionsMask |= mask;
9513 }
9514
9515 static void RemoveDebugActionsMask(int mask)
9516 {
9517 ItemBase.m_DebugActionsMask &= ~mask;
9518 }
9519
9520 static void ToggleDebugActionsMask(int mask)
9521 {
9522 if (HasDebugActionsMask(mask))
9523 {
9525 }
9526 else
9527 {
9528 AddDebugActionsMask(mask);
9529 }
9530 }
9531
9532 // -------------------------------------------------------------------------
9533 void SetCEBasedQuantity()
9534 {
9535 if (GetEconomyProfile())
9536 {
9537 float q_max = GetEconomyProfile().GetQuantityMax();
9538 if (q_max > 0)
9539 {
9540 float q_min = GetEconomyProfile().GetQuantityMin();
9541 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
9542
9543 if (HasComponent(COMP_TYPE_ENERGY_MANAGER))//more direct access for speed
9544 {
9545 ComponentEnergyManager comp = GetCompEM();
9546 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
9547 {
9548 comp.SetEnergy0To1(quantity_randomized);
9549 }
9550 }
9551 else if (HasQuantity())
9552 {
9553 SetQuantityNormalized(quantity_randomized, false);
9554 //PrintString("<==> Normalized quantity for item: "+ GetType()+", qmin:"+q_min.ToString()+"; qmax:"+q_max.ToString()+";quantity:" +quantity_randomized.ToString());
9555 }
9556
9557 }
9558 }
9559 }
9560
9562 void LockToParent()
9563 {
9564 EntityAI parent = GetHierarchyParent();
9565
9566 if (parent)
9567 {
9568 InventoryLocation inventory_location_to_lock = new InventoryLocation;
9569 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
9570 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(), true);
9571 }
9572 }
9573
9575 void UnlockFromParent()
9576 {
9577 EntityAI parent = GetHierarchyParent();
9578
9579 if (parent)
9580 {
9581 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
9582 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
9583 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(), false);
9584 }
9585 }
9586
9587 override void CombineItemsClient(EntityAI entity2, bool use_stack_max = true)
9588 {
9589 /*
9590 ref Param1<EntityAI> item = new Param1<EntityAI>(entity2);
9591 RPCSingleParam(ERPCs.RPC_ITEM_COMBINE, item, GetGame().GetPlayer());
9592 */
9593 ItemBase item2 = ItemBase.Cast(entity2);
9594
9595 if (GetGame().IsClient())
9596 {
9597 if (ScriptInputUserData.CanStoreInputUserData())
9598 {
9599 ScriptInputUserData ctx = new ScriptInputUserData;
9601 ctx.Write(-1);
9602 ItemBase i1 = this; // @NOTE: workaround for correct serialization
9603 ctx.Write(i1);
9604 ctx.Write(item2);
9605 ctx.Write(use_stack_max);
9606 ctx.Write(-1);
9607 ctx.Send();
9608
9609 if (IsCombineAll(item2, use_stack_max))
9610 {
9611 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
9612 }
9613 }
9614 }
9615 else if (!GetGame().IsMultiplayer())
9616 {
9617 CombineItems(item2, use_stack_max);
9618 }
9619 }
9620
9621 bool IsLiquidPresent()
9622 {
9623 return (GetLiquidType() != 0 && HasQuantity());
9624 }
9625
9626 bool IsLiquidContainer()
9627 {
9628 return m_LiquidContainerMask != 0;
9629 }
9630
9632 {
9633 return m_LiquidContainerMask;
9634 }
9635
9636 bool IsBloodContainer()
9637 {
9638 //m_LiquidContainerMask & GROUP_LIQUID_BLOOD ???
9639 return false;
9640 }
9641
9642 bool IsNVG()
9643 {
9644 return false;
9645 }
9646
9649 bool IsExplosive()
9650 {
9651 return false;
9652 }
9653
9655 {
9656 return "";
9657 }
9658
9660
9661 bool IsLightSource()
9662 {
9663 return false;
9664 }
9665
9667 {
9668 return true;
9669 }
9670
9671 //--- ACTION CONDITIONS
9672 //direction
9673 bool IsFacingPlayer(PlayerBase player, string selection)
9674 {
9675 return true;
9676 }
9677
9678 bool IsPlayerInside(PlayerBase player, string selection)
9679 {
9680 return true;
9681 }
9682
9683 override bool CanObstruct()
9684 {
9685 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
9686 return !player || !IsPlayerInside(player, "");
9687 }
9688
9689 override bool IsBeingPlaced()
9690 {
9691 return m_IsBeingPlaced;
9692 }
9693
9694 void SetIsBeingPlaced(bool is_being_placed)
9695 {
9696 m_IsBeingPlaced = is_being_placed;
9697 if (!is_being_placed)
9699 SetSynchDirty();
9700 }
9701
9702 //server-side
9703 void OnEndPlacement() {}
9704
9705 override bool IsHologram()
9706 {
9707 return m_IsHologram;
9708 }
9709
9710 bool CanBeDigged()
9711 {
9712 return m_CanBeDigged;
9713 }
9714
9716 {
9717 return 1;
9718 }
9719
9720 bool CanMakeGardenplot()
9721 {
9722 return false;
9723 }
9724
9725 void SetIsHologram(bool is_hologram)
9726 {
9727 m_IsHologram = is_hologram;
9728 SetSynchDirty();
9729 }
9730 /*
9731 protected float GetNutritionalEnergy()
9732 {
9733 Edible_Base edible = Edible_Base.Cast(this);
9734 return edible.GetFoodEnergy();
9735 }
9736
9737 protected float GetNutritionalWaterContent()
9738 {
9739 Edible_Base edible = Edible_Base.Cast(this);
9740 return edible.GetFoodWater();
9741 }
9742
9743 protected float GetNutritionalIndex()
9744 {
9745 Edible_Base edible = Edible_Base.Cast(this);
9746 return edible.GetFoodNutritionalIndex();
9747 }
9748
9749 protected float GetNutritionalFullnessIndex()
9750 {
9751 Edible_Base edible = Edible_Base.Cast(this);
9752 return edible.GetFoodTotalVolume();
9753 }
9754
9755 protected float GetNutritionalToxicity()
9756 {
9757 Edible_Base edible = Edible_Base.Cast(this);
9758 return edible.GetFoodToxicity();
9759
9760 }
9761 */
9762
9763
9764 // -------------------------------------------------------------------------
9765 override void OnMovedInsideCargo(EntityAI container)
9766 {
9767 super.OnMovedInsideCargo(container);
9768
9769 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9770 }
9771
9772 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9773 {
9774 super.EEItemLocationChanged(oldLoc,newLoc);
9775
9776 PlayerBase new_player = null;
9777 PlayerBase old_player = null;
9778
9779 if (newLoc.GetParent())
9780 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
9781
9782 if (oldLoc.GetParent())
9783 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
9784
9785 if (old_player && oldLoc.GetType() == InventoryLocationType.HANDS)
9786 {
9787 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
9788
9789 if (r_index >= 0)
9790 {
9791 InventoryLocation r_il = new InventoryLocation;
9792 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9793
9794 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9795 int r_type = r_il.GetType();
9796 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
9797 {
9798 r_il.GetParent().GetOnReleaseLock().Invoke(this);
9799 }
9800 else if (r_type == InventoryLocationType.ATTACHMENT)
9801 {
9802 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
9803 }
9804
9805 }
9806 }
9807
9808 if (newLoc.GetType() == InventoryLocationType.HANDS)
9809 {
9810 if (new_player)
9811 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
9812
9813 if (new_player == old_player)
9814 {
9815
9816 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
9817 {
9818 if (oldLoc.GetType() == InventoryLocationType.CARGO)
9819 {
9820 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
9821 {
9822 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9823 }
9824 }
9825 else
9826 {
9827 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
9828 }
9829 }
9830
9831 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
9832 {
9833 int type = oldLoc.GetType();
9834 if (type == InventoryLocationType.CARGO || type == InventoryLocationType.PROXYCARGO)
9835 {
9836 oldLoc.GetParent().GetOnSetLock().Invoke(this);
9837 }
9838 else if (type == InventoryLocationType.ATTACHMENT)
9839 {
9840 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
9841 }
9842 }
9843 if (!m_OldLocation)
9844 {
9845 m_OldLocation = new InventoryLocation;
9846 }
9847 m_OldLocation.Copy(oldLoc);
9848 }
9849 else
9850 {
9851 if (m_OldLocation)
9852 {
9853 m_OldLocation.Reset();
9854 }
9855 }
9856
9858 }
9859 else
9860 {
9861 if (new_player)
9862 {
9863 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
9864 if (res_index >= 0)
9865 {
9866 InventoryLocation il = new InventoryLocation;
9867 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
9868 ItemBase it = ItemBase.Cast(il.GetItem());
9869 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
9870 int rel_type = il.GetType();
9871 if (rel_type == InventoryLocationType.CARGO || rel_type == InventoryLocationType.PROXYCARGO)
9872 {
9873 il.GetParent().GetOnReleaseLock().Invoke(it);
9874 }
9875 else if (rel_type == InventoryLocationType.ATTACHMENT)
9876 {
9877 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
9878 }
9879 //it.GetOnReleaseLock().Invoke(it);
9880 }
9881 }
9882 else if (old_player && newLoc.GetType() == InventoryLocationType.GROUND && m_ThrowItemOnDrop)
9883 {
9884 //ThrowPhysically(old_player, vector.Zero);
9885 m_ThrowItemOnDrop = false;
9886 }
9887
9888 if (m_OldLocation)
9889 {
9890 m_OldLocation.Reset();
9891 }
9892 }
9893 }
9894
9895 override void EOnContact(IEntity other, Contact extra)
9896 {
9898 {
9899 int liquidType = -1;
9900 float impactSpeed = ProcessImpactSoundEx(other, extra, m_ConfigWeight, m_ImpactSoundSurfaceHash, liquidType);
9901 if (impactSpeed > 0.0)
9902 {
9903 m_ImpactSpeed = impactSpeed;
9904 #ifndef SERVER
9905 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
9906 #else
9907 m_WantPlayImpactSound = true;
9908 SetSynchDirty();
9909 #endif
9910 m_CanPlayImpactSound = (liquidType == -1);// prevents further playing of the sound when the surface is a liquid type
9911 }
9912 }
9913
9914 #ifdef SERVER
9915 if (GetCompEM() && GetCompEM().IsPlugged())
9916 {
9917 if (GetCompEM().GetCordLength() < vector.Distance(GetPosition(), GetCompEM().GetEnergySource().GetPosition()))
9918 GetCompEM().UnplugThis();
9919 }
9920 #endif
9921 }
9922
9923 void RefreshPhysics();
9924
9925 override void OnCreatePhysics()
9926 {
9928 }
9929
9930 override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
9931 {
9932
9933 }
9934 // -------------------------------------------------------------------------
9935 override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
9936 {
9937 super.OnItemLocationChanged(old_owner, new_owner);
9938
9939 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9940 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9941
9942 if (!relatedPlayer && playerNew)
9943 relatedPlayer = playerNew;
9944
9945 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9946 {
9947 ActionManagerBase actionMgr = relatedPlayer.GetActionManager();
9948 if (actionMgr)
9949 {
9950 ActionBase currentAction = actionMgr.GetRunningAction();
9951 if (currentAction)
9952 currentAction.OnItemLocationChanged(this);
9953 }
9954 }
9955
9956 Man ownerPlayerOld = null;
9957 Man ownerPlayerNew = null;
9958
9959 if (old_owner)
9960 {
9961 if (old_owner.IsMan())
9962 {
9963 ownerPlayerOld = Man.Cast(old_owner);
9964 }
9965 else
9966 {
9967 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9968 }
9969 }
9970 else
9971 {
9972 if (new_owner && IsElectricAppliance() && GetCompEM() && GetCompEM().IsPlugged())
9973 {
9974 ActionBase action = ActionManagerBase.GetAction(ActionRepositionPluggedItem);
9975
9976 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.GetID())
9977 {
9978 GetCompEM().UnplugThis();
9979 }
9980 }
9981 }
9982
9983 if (new_owner)
9984 {
9985 if (new_owner.IsMan())
9986 {
9987 ownerPlayerNew = Man.Cast(new_owner);
9988 }
9989 else
9990 {
9991 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9992 }
9993 }
9994
9995 if (ownerPlayerOld != ownerPlayerNew)
9996 {
9997 if (ownerPlayerOld)
9998 {
9999 array<EntityAI> subItemsExit = new array<EntityAI>;
10000 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsExit);
10001 for (int i = 0; i < subItemsExit.Count(); i++)
10002 {
10003 ItemBase itemExit = ItemBase.Cast(subItemsExit.Get(i));
10004 itemExit.OnInventoryExit(ownerPlayerOld);
10005 }
10006 }
10007
10008 if (ownerPlayerNew)
10009 {
10010 array<EntityAI> subItemsEnter = new array<EntityAI>;
10011 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsEnter);
10012 for (int j = 0; j < subItemsEnter.Count(); j++)
10013 {
10014 ItemBase itemEnter = ItemBase.Cast(subItemsEnter.Get(j));
10015 itemEnter.OnInventoryEnter(ownerPlayerNew);
10016 }
10017 }
10018 }
10019 else if (ownerPlayerNew != null)
10020 {
10021 PlayerBase nplayer;
10022 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
10023 {
10024 array<EntityAI> subItemsUpdate = new array<EntityAI>;
10025 GetInventory().EnumerateInventory(InventoryTraversalType.PREORDER,subItemsUpdate);
10026 for (int k = 0; k < subItemsUpdate.Count(); k++)
10027 {
10028 ItemBase itemUpdate = ItemBase.Cast(subItemsUpdate.Get(k));
10029 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
10030 }
10031 }
10032 }
10033
10034 if (old_owner)
10035 old_owner.OnChildItemRemoved(this);
10036 if (new_owner)
10037 new_owner.OnChildItemReceived(this);
10038 }
10039
10040 // -------------------------------------------------------------------------------
10041 override void EEDelete(EntityAI parent)
10042 {
10043 super.EEDelete(parent);
10044 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
10045 if (player)
10046 {
10047 OnInventoryExit(player);
10048
10049 if (player.IsAlive())
10050 {
10051 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
10052 if (r_index >= 0)
10053 {
10054 InventoryLocation r_il = new InventoryLocation;
10055 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
10056
10057 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
10058 int r_type = r_il.GetType();
10059 if (r_type == InventoryLocationType.CARGO || r_type == InventoryLocationType.PROXYCARGO)
10060 {
10061 r_il.GetParent().GetOnReleaseLock().Invoke(this);
10062 }
10063 else if (r_type == InventoryLocationType.ATTACHMENT)
10064 {
10065 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(this, r_il.GetSlot());
10066 }
10067
10068 }
10069
10070 player.RemoveQuickBarEntityShortcut(this);
10071 }
10072 }
10073 }
10074 // -------------------------------------------------------------------------------
10075 override void EEKilled(Object killer)
10076 {
10077 super.EEKilled(killer);
10078
10080 if (killer && killer.IsFireplace() && CanExplodeInFire())
10081 {
10082 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
10083 {
10084 if (IsMagazine())
10085 {
10086 if (Magazine.Cast(this).GetAmmoCount() > 0)
10087 {
10088 ExplodeAmmo();
10089 }
10090 }
10091 else
10092 {
10093 Explode(DamageType.EXPLOSION);
10094 }
10095 }
10096 }
10097 }
10098
10099 override void OnWasAttached(EntityAI parent, int slot_id)
10100 {
10101 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
10102
10103 super.OnWasAttached(parent, slot_id);
10104
10105 if (HasQuantity())
10106 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
10107
10108 PlayAttachSound(InventorySlots.GetSlotName(slot_id));
10109 }
10110
10111 override void OnWasDetached(EntityAI parent, int slot_id)
10112 {
10113 super.OnWasDetached(parent, slot_id);
10114
10115 if (HasQuantity())
10116 UpdateNetSyncVariableFloat("m_VarQuantity", GetQuantityMin(), m_VarQuantityMax);
10117 }
10118
10119 override string ChangeIntoOnAttach(string slot)
10120 {
10121 int idx;
10122 TStringArray inventory_slots = new TStringArray;
10123 TStringArray attach_types = new TStringArray;
10124
10125 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10126 if (inventory_slots.Count() < 1) //is string
10127 {
10128 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
10129 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
10130 }
10131 else //is array
10132 {
10133 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
10134 }
10135
10136 idx = inventory_slots.Find(slot);
10137 if (idx < 0)
10138 return "";
10139
10140 return attach_types.Get(idx);
10141 }
10142
10143 override string ChangeIntoOnDetach()
10144 {
10145 int idx = -1;
10146 string slot;
10147
10148 TStringArray inventory_slots = new TStringArray;
10149 TStringArray detach_types = new TStringArray;
10150
10151 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
10152 if (inventory_slots.Count() < 1) //is string
10153 {
10154 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
10155 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10156 }
10157 else //is array
10158 {
10159 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
10160 if (detach_types.Count() < 1)
10161 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
10162 }
10163
10164 for (int i = 0; i < inventory_slots.Count(); i++)
10165 {
10166 slot = inventory_slots.Get(i);
10167 }
10168
10169 if (slot != "")
10170 {
10171 if (detach_types.Count() == 1)
10172 idx = 0;
10173 else
10174 idx = inventory_slots.Find(slot);
10175 }
10176 if (idx < 0)
10177 return "";
10178
10179 return detach_types.Get(idx);
10180 }
10181
10182 void ExplodeAmmo()
10183 {
10184 //timer
10185 ref Timer explode_timer = new Timer(CALL_CATEGORY_SYSTEM);
10186
10187 //min/max time
10188 float min_time = 1;
10189 float max_time = 3;
10190 float delay = Math.RandomFloat(min_time, max_time);
10191
10192 explode_timer.Run(delay, this, "DoAmmoExplosion");
10193 }
10194
10195 void DoAmmoExplosion()
10196 {
10197 Magazine magazine = Magazine.Cast(this);
10198 int pop_sounds_count = 6;
10199 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
10200
10201 //play sound
10202 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
10203 string sound_name = pop_sounds[ sound_idx ];
10204 GetGame().CreateSoundOnObject(this, sound_name, 20, false);
10205
10206 //remove ammo count
10207 magazine.ServerAddAmmoCount(-1);
10208
10209 //if condition then repeat -> ExplodeAmmo
10210 float min_temp_to_explode = 100; //min temperature for item to explode
10211
10212 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode) //TODO ? add check for parent -> fireplace
10213 {
10214 ExplodeAmmo();
10215 }
10216 }
10217
10218 // -------------------------------------------------------------------------------
10219 override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
10220 {
10221 super.EEHitBy(damageResult, damageType, source, component, dmgZone, ammo, modelPos, speedCoef);
10222
10223 const int CHANCE_DAMAGE_CARGO = 4;
10224 const int CHANCE_DAMAGE_ATTACHMENT = 1;
10225 const int CHANCE_DAMAGE_NOTHING = 2;
10226
10227 if (IsClothing() || IsContainer() || IsItemTent())
10228 {
10229 float dmg = damageResult.GetDamage("","Health") * -0.5;
10230 int chances;
10231 int rnd;
10232
10233 if (GetInventory().GetCargo())
10234 {
10235 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10236 rnd = Math.RandomInt(0,chances);
10237
10238 if (rnd < CHANCE_DAMAGE_CARGO)
10239 {
10240 DamageItemInCargo(dmg);
10241 }
10242 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
10243 {
10245 }
10246 }
10247 else
10248 {
10249 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
10250 rnd = Math.RandomInt(0,chances);
10251
10252 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
10253 {
10255 }
10256 }
10257 }
10258 }
10259
10260 bool DamageItemInCargo(float damage)
10261 {
10262 if (GetInventory().GetCargo())
10263 {
10264 int item_count = GetInventory().GetCargo().GetItemCount();
10265 if (item_count > 0)
10266 {
10267 int random_pick = Math.RandomInt(0, item_count);
10268 ItemBase item = ItemBase.Cast(GetInventory().GetCargo().GetItem(random_pick));
10269 if (!item.IsExplosive())
10270 {
10271 item.AddHealth("","",damage);
10272 return true;
10273 }
10274 }
10275 }
10276 return false;
10277 }
10278
10279 bool DamageItemAttachments(float damage)
10280 {
10281 int attachment_count = GetInventory().AttachmentCount();
10282 if (attachment_count > 0)
10283 {
10284 int random_pick = Math.RandomInt(0, attachment_count);
10285 ItemBase attachment = ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
10286 if (!attachment.IsExplosive())
10287 {
10288 attachment.AddHealth("","",damage);
10289 return true;
10290 }
10291 }
10292 return false;
10293 }
10294
10295 override bool IsSplitable()
10296 {
10297 return m_CanThisBeSplit;
10298 }
10299 //----------------
10300 override bool CanBeSplit()
10301 {
10302 if (IsSplitable() && (GetQuantity() > 1))
10303 return GetInventory().CanRemoveEntity();
10304
10305 return false;
10306 }
10307
10308 override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id )
10309 {
10310 if (!CanBeSplit())
10311 return;
10312
10313 if (GetGame().IsClient())
10314 {
10315 if (ScriptInputUserData.CanStoreInputUserData())
10316 {
10317 ScriptInputUserData ctx = new ScriptInputUserData;
10319 ctx.Write(1);
10320 ItemBase i1 = this; // @NOTE: workaround for correct serialization
10321 ctx.Write(i1);
10322 ctx.Write(destination_entity);
10323 ctx.Write(true);
10324 ctx.Write(slot_id);
10325 ctx.Send();
10326 }
10327 }
10328 else if (!GetGame().IsMultiplayer())
10329 {
10330 SplitIntoStackMax(destination_entity, slot_id, PlayerBase.Cast(GetGame().GetPlayer()));
10331 }
10332 }
10333
10334 void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
10335 {
10336 if (!CanBeSplit())
10337 return;
10338
10339 float split_quantity_new;
10340 ref ItemBase new_item;
10341 float quantity = GetQuantity();
10342 float stack_max = GetTargetQuantityMax(slot_id);
10343 InventoryLocation loc = new InventoryLocation;
10344
10345 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10346 {
10347 if (stack_max <= GetQuantity())
10348 split_quantity_new = stack_max;
10349 else
10350 split_quantity_new = GetQuantity();
10351
10352 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
10353 if (new_item)
10354 {
10355 new_item.SetResultOfSplit(true);
10356 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10357 AddQuantity(-split_quantity_new);
10358 new_item.SetQuantity(split_quantity_new);
10359 }
10360 }
10361 else if (destination_entity && slot_id == -1)
10362 {
10363 if (quantity > stack_max)
10364 split_quantity_new = stack_max;
10365 else
10366 split_quantity_new = quantity;
10367
10368 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
10369 {
10370 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
10371 new_item = ItemBase.Cast(o);
10372 }
10373
10374 if (new_item)
10375 {
10376 new_item.SetResultOfSplit(true);
10377 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10378 AddQuantity(-split_quantity_new);
10379 new_item.SetQuantity(split_quantity_new);
10380 }
10381 }
10382 else
10383 {
10384 if (stack_max != 0)
10385 {
10386 if (stack_max < GetQuantity())
10387 {
10388 split_quantity_new = GetQuantity() - stack_max;
10389 }
10390
10391 if (split_quantity_new == 0)
10392 {
10393 if (!GetGame().IsMultiplayer())
10394 player.PhysicalPredictiveDropItem(this);
10395 else
10396 player.ServerDropEntity(this);
10397 return;
10398 }
10399
10400 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(), player.GetWorldPosition(), ECE_PLACE_ON_SURFACE));
10401
10402 if (new_item)
10403 {
10404 new_item.SetResultOfSplit(true);
10405 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10406 SetQuantity(split_quantity_new);
10407 new_item.SetQuantity(stack_max);
10408 new_item.PlaceOnSurface();
10409 }
10410 }
10411 }
10412 }
10413
10414 override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
10415 {
10416 if (!CanBeSplit())
10417 return;
10418
10419 float split_quantity_new;
10420 ref ItemBase new_item;
10421 float quantity = GetQuantity();
10422 float stack_max = GetTargetQuantityMax(slot_id);
10423 InventoryLocation loc = new InventoryLocation;
10424
10425 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
10426 {
10427 if (stack_max <= GetQuantity())
10428 split_quantity_new = stack_max;
10429 else
10430 split_quantity_new = GetQuantity();
10431
10432 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(this.GetType(), slot_id));
10433 if (new_item)
10434 {
10435 new_item.SetResultOfSplit(true);
10436 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10437 AddQuantity(-split_quantity_new);
10438 new_item.SetQuantity(split_quantity_new);
10439 }
10440 }
10441 else if (destination_entity && slot_id == -1)
10442 {
10443 if (quantity > stack_max)
10444 split_quantity_new = stack_max;
10445 else
10446 split_quantity_new = quantity;
10447
10448 if (destination_entity.GetInventory().FindFreeLocationFor(this, FindInventoryLocationType.ANY, loc))
10449 {
10450 Object o = destination_entity.GetInventory().LocationCreateEntity(loc, GetType(), ECE_IN_INVENTORY, RF_DEFAULT);
10451 new_item = ItemBase.Cast(o);
10452 }
10453
10454 if (new_item)
10455 {
10456 new_item.SetResultOfSplit(true);
10457 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10458 AddQuantity(-split_quantity_new);
10459 new_item.SetQuantity(split_quantity_new);
10460 }
10461 }
10462 else
10463 {
10464 if (stack_max != 0)
10465 {
10466 if (stack_max < GetQuantity())
10467 {
10468 split_quantity_new = GetQuantity() - stack_max;
10469 }
10470
10471 new_item = ItemBase.Cast(GetGame().CreateObjectEx(GetType(),GetWorldPosition(), ECE_PLACE_ON_SURFACE));
10472
10473 if (new_item)
10474 {
10475 new_item.SetResultOfSplit(true);
10476 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10477 SetQuantity(split_quantity_new);
10478 new_item.SetQuantity(stack_max);
10479 new_item.PlaceOnSurface();
10480 }
10481 }
10482 }
10483 }
10484
10485 void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
10486 {
10487 if (!CanBeSplit())
10488 return;
10489
10490 if (GetGame().IsClient())
10491 {
10492 if (ScriptInputUserData.CanStoreInputUserData())
10493 {
10494 ScriptInputUserData ctx = new ScriptInputUserData;
10496 ctx.Write(4);
10497 ItemBase thiz = this; // @NOTE: workaround for correct serialization
10498 ctx.Write(thiz);
10499 dst.WriteToContext(ctx);
10500 ctx.Send();
10501 }
10502 }
10503 else if (!GetGame().IsMultiplayer())
10504 {
10506 }
10507 }
10508
10509 void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
10510 {
10511 if (!CanBeSplit())
10512 return;
10513
10514 if (GetGame().IsClient())
10515 {
10516 if (ScriptInputUserData.CanStoreInputUserData())
10517 {
10518 ScriptInputUserData ctx = new ScriptInputUserData;
10520 ctx.Write(2);
10521 ItemBase dummy = this; // @NOTE: workaround for correct serialization
10522 ctx.Write(dummy);
10523 ctx.Write(destination_entity);
10524 ctx.Write(true);
10525 ctx.Write(idx);
10526 ctx.Write(row);
10527 ctx.Write(col);
10528 ctx.Send();
10529 }
10530 }
10531 else if (!GetGame().IsMultiplayer())
10532 {
10533 SplitIntoStackMaxCargo(destination_entity, idx, row, col);
10534 }
10535 }
10536
10537 void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
10538 {
10540 }
10541
10542 ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
10543 {
10544 if (!CanBeSplit())
10545 return this;
10546
10547 float quantity = GetQuantity();
10548 float split_quantity_new;
10549 ItemBase new_item;
10550 if (dst.IsValid())
10551 {
10552 int slot_id = dst.GetSlot();
10553 float stack_max = GetTargetQuantityMax(slot_id);
10554
10555 if (quantity > stack_max)
10556 split_quantity_new = stack_max;
10557 else
10558 split_quantity_new = quantity;
10559
10560 new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, this.GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
10561
10562 if (new_item)
10563 {
10564 new_item.SetResultOfSplit(true);
10565 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10566 AddQuantity(-split_quantity_new);
10567 new_item.SetQuantity(split_quantity_new);
10568 }
10569
10570 return new_item;
10571 }
10572
10573 return null;
10574 }
10575
10576 void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
10577 {
10578 if (!CanBeSplit())
10579 return;
10580
10581 float quantity = GetQuantity();
10582 float split_quantity_new;
10583 ref ItemBase new_item;
10584 if (destination_entity)
10585 {
10586 float stackable = GetTargetQuantityMax();
10587 if (quantity > stackable)
10588 split_quantity_new = stackable;
10589 else
10590 split_quantity_new = quantity;
10591
10592 new_item = ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(this.GetType(), idx, row, col, false));
10593 if (new_item)
10594 {
10595 new_item.SetResultOfSplit(true);
10596 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10597 AddQuantity(-split_quantity_new);
10598 new_item.SetQuantity(split_quantity_new);
10599 }
10600 }
10601 }
10602
10603 void SplitIntoStackMaxHandsClient(PlayerBase player)
10604 {
10605 if (!CanBeSplit())
10606 return;
10607
10608 if (GetGame().IsClient())
10609 {
10610 if (ScriptInputUserData.CanStoreInputUserData())
10611 {
10612 ScriptInputUserData ctx = new ScriptInputUserData;
10614 ctx.Write(3);
10615 ItemBase i1 = this; // @NOTE: workaround for correct serialization
10616 ctx.Write(i1);
10617 ItemBase destination_entity = this;
10618 ctx.Write(destination_entity);
10619 ctx.Write(true);
10620 ctx.Write(0);
10621 ctx.Send();
10622 }
10623 }
10624 else if (!GetGame().IsMultiplayer())
10625 {
10626 SplitIntoStackMaxHands(player);
10627 }
10628 }
10629
10630 void SplitIntoStackMaxHands(PlayerBase player)
10631 {
10632 if (!CanBeSplit())
10633 return;
10634
10635 float quantity = GetQuantity();
10636 float split_quantity_new;
10637 ref ItemBase new_item;
10638 if (player)
10639 {
10640 float stackable = GetTargetQuantityMax();
10641 if (quantity > stackable)
10642 split_quantity_new = stackable;
10643 else
10644 split_quantity_new = quantity;
10645
10646 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.GetType());
10647 new_item = ItemBase.Cast(in_hands);
10648 if (new_item)
10649 {
10650 new_item.SetResultOfSplit(true);
10651 MiscGameplayFunctions.TransferItemProperties(this,new_item);
10652 AddQuantity(-split_quantity_new);
10653 new_item.SetQuantity(split_quantity_new);
10654 }
10655 }
10656 }
10657
10658 void SplitItemToInventoryLocation(notnull InventoryLocation dst)
10659 {
10660 if (!CanBeSplit())
10661 return;
10662
10663 float quantity = GetQuantity();
10664 float split_quantity_new = Math.Floor(quantity * 0.5);
10665
10666 ItemBase new_item = ItemBase.Cast(GameInventory.LocationCreateEntity(dst, GetType(), ECE_IN_INVENTORY, RF_DEFAULT));
10667
10668 if (new_item)
10669 {
10670 if (new_item.GetQuantityMax() < split_quantity_new)
10671 {
10672 split_quantity_new = new_item.GetQuantityMax();
10673 }
10674
10675 new_item.SetResultOfSplit(true);
10676 MiscGameplayFunctions.TransferItemProperties(this, new_item);
10677
10678 if (dst.IsValid() && dst.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
10679 {
10680 AddQuantity(-1);
10681 new_item.SetQuantity(1);
10682 }
10683 else
10684 {
10685 AddQuantity(-split_quantity_new);
10686 new_item.SetQuantity(split_quantity_new);
10687 }
10688 }
10689 }
10690
10691 void SplitItem(PlayerBase player)
10692 {
10693 if (!CanBeSplit())
10694 return;
10695
10696 float quantity = GetQuantity();
10697 float split_quantity_new = Math.Floor(quantity / 2);
10698
10699 InventoryLocation invloc = new InventoryLocation;
10700 bool found = player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.ATTACHMENT, invloc);
10701
10702 ItemBase new_item;
10703 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
10704
10705 if (new_item)
10706 {
10707 if (new_item.GetQuantityMax() < split_quantity_new)
10708 {
10709 split_quantity_new = new_item.GetQuantityMax();
10710 }
10711 if (found && invloc.IsValid() && invloc.GetType() == InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
10712 {
10713 AddQuantity(-1);
10714 new_item.SetQuantity(1);
10715 }
10716 else
10717 {
10718 AddQuantity(-split_quantity_new);
10719 new_item.SetQuantity(split_quantity_new);
10720 }
10721 }
10722 }
10723
10725 void OnQuantityChanged(float delta)
10726 {
10727 SetWeightDirty();
10728 ItemBase parent = ItemBase.Cast(GetHierarchyParent());
10729
10730 if (parent)
10731 parent.OnAttachmentQuantityChangedEx(this, delta);
10732
10733 if (IsLiquidContainer())
10734 {
10735 if (GetQuantityNormalized() <= 0.0)
10736 {
10738 }
10739 else if (GetLiquidType() == LIQUID_NONE)
10740 {
10741 ErrorEx("Undefined liquid type quantity changed, please define liquid type first! Using init value.",ErrorExSeverity.INFO);
10743 }
10744 }
10745
10746 }
10747
10750 {
10751 // insert code here
10752 }
10753
10755 void OnAttachmentQuantityChangedEx(ItemBase item , float delta)
10756 {
10758 }
10759
10760 override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
10761 {
10762 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
10763
10764 if (GetGame().IsServer())
10765 {
10766 if (newLevel == GameConstants.STATE_RUINED)
10767 {
10769 EntityAI parent = GetHierarchyParent();
10770 if (parent && parent.IsFireplace())
10771 {
10772 CargoBase cargo = GetInventory().GetCargo();
10773 if (cargo)
10774 {
10775 for (int i = 0; i < cargo.GetItemCount(); ++i)
10776 {
10777 parent.GetInventory().TakeEntityToInventory(InventoryMode.SERVER, FindInventoryLocationType.CARGO, cargo.GetItem(i));
10778 }
10779 }
10780 }
10781 }
10782
10783 if (IsResultOfSplit())
10784 {
10785 // reset the splitting result flag, return to normal item behavior
10786 SetResultOfSplit(false);
10787 return;
10788 }
10789
10790 if (m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
10791 {
10792 SetCleanness(0);//unclean the item upon damage dealt
10793 }
10794 }
10795 }
10796
10797 // just the split? TODO: verify
10798 override void OnRightClick()
10799 {
10800 super.OnRightClick();
10801
10802 if (CanBeSplit() && !GetDayZGame().IsLeftCtrlDown() && !GetGame().GetPlayer().GetInventory().HasInventoryReservation(this,null))
10803 {
10804 if (GetGame().IsClient())
10805 {
10806 if (ScriptInputUserData.CanStoreInputUserData())
10807 {
10808 vector m4[4];
10809 PlayerBase player = PlayerBase.Cast(GetGame().GetPlayer());
10810
10811 EntityAI root = GetHierarchyRoot();
10812
10813 InventoryLocation dst = new InventoryLocation;
10814 if (!player.GetInventory().FindFirstFreeLocationForNewEntity(GetType(), FindInventoryLocationType.CARGO, dst))
10815 {
10816 if (root)
10817 {
10818 root.GetTransform(m4);
10819 dst.SetGround(this, m4);
10820 }
10821 else
10822 GetInventory().GetCurrentInventoryLocation(dst);
10823 }
10824 else
10825 {
10826 dst.SetCargo(dst.GetParent(), this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
10827 /* hacky solution to check reservation of "this" item instead of null since the gamecode is checking null against null and returning reservation=true incorrectly
10828 this shouldnt cause issues within this scope*/
10829 if (GetGame().GetPlayer().GetInventory().HasInventoryReservation(this, dst))
10830 {
10831 if (root)
10832 {
10833 root.GetTransform(m4);
10834 dst.SetGround(this, m4);
10835 }
10836 else
10837 GetInventory().GetCurrentInventoryLocation(dst);
10838 }
10839 else
10840 {
10841 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
10842 }
10843 }
10844
10845 ScriptInputUserData ctx = new ScriptInputUserData;
10847 ctx.Write(4);
10848 ItemBase thiz = this; // @NOTE: workaround for correct serialization
10849 ctx.Write(thiz);
10850 dst.WriteToContext(ctx);
10851 ctx.Write(true); // dummy
10852 ctx.Send();
10853 }
10854 }
10855 else if (!GetGame().IsMultiplayer())
10856 {
10857 SplitItem(PlayerBase.Cast(GetGame().GetPlayer()));
10858 }
10859 }
10860 }
10861
10862 override bool CanBeCombined(EntityAI other_item, bool reservation_check = true, bool stack_max_limit = false)
10863 {
10864 //TODO: delete check zero quantity check after fix double posts hands fsm events
10865 if (!other_item || GetType() != other_item.GetType() || (IsFullQuantity() && other_item.GetQuantity() > 0) || other_item == this)
10866 return false;
10867
10868 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
10869 return false;
10870
10871 //can_this_be_combined = ConfigGetBool("canBeSplit");
10873 return false;
10874
10875
10876 Magazine mag = Magazine.Cast(this);
10877 if (mag)
10878 {
10879 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
10880 return false;
10881
10882 if (stack_max_limit)
10883 {
10884 Magazine other_mag = Magazine.Cast(other_item);
10885 if (other_item)
10886 {
10887 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10888 return false;
10889 }
10890
10891 }
10892 }
10893 else
10894 {
10895 //TODO: delete check zero quantity check after fix double posts hands fsm events
10896 if (GetQuantity() >= GetQuantityMax() && other_item.GetQuantity() > 0 )
10897 return false;
10898
10899 if (stack_max_limit && (GetQuantity() + other_item.GetQuantity() > GetQuantityMax()))
10900 return false;
10901 }
10902
10903 PlayerBase player = null;
10904 if (CastTo(player, GetHierarchyRootPlayer())) //false when attached to player's attachment slot
10905 {
10906 if (player.GetInventory().HasAttachment(this))
10907 return false;
10908
10909 if (player.IsItemsToDelete())
10910 return false;
10911 }
10912
10913 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10914 return false;
10915
10916 int slotID;
10917 string slotName;
10918 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10919 return false;
10920
10921 return true;
10922 }
10923
10924 bool IsCombineAll(ItemBase other_item, bool use_stack_max = false)
10925 {
10926 return ComputeQuantityUsed(other_item, use_stack_max) == other_item.GetQuantity();
10927 }
10928
10929 bool IsResultOfSplit()
10930 {
10931 return m_IsResultOfSplit;
10932 }
10933
10934 void SetResultOfSplit(bool value)
10935 {
10936 m_IsResultOfSplit = value;
10937 }
10938
10939 int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max = true)
10940 {
10941 return ComputeQuantityUsedEx(other_item, use_stack_max);
10942 }
10943
10944 float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max = true)
10945 {
10946 float other_item_quantity = other_item.GetQuantity();
10947 float this_free_space;
10948
10949 float stack_max = GetQuantityMax();
10950
10951 this_free_space = stack_max - GetQuantity();
10952
10953 if (other_item_quantity > this_free_space)
10954 {
10955 return this_free_space;
10956 }
10957 else
10958 {
10959 return other_item_quantity;
10960 }
10961 }
10962
10963 override void CombineItemsEx(EntityAI entity2, bool use_stack_max = true)
10964 {
10965 CombineItems(ItemBase.Cast(entity2),use_stack_max);
10966 }
10967
10968 void CombineItems(ItemBase other_item, bool use_stack_max = true)
10969 {
10970 if (!CanBeCombined(other_item, false))
10971 return;
10972
10973 if (!IsMagazine() && other_item)
10974 {
10975 float quantity_used = ComputeQuantityUsedEx(other_item,use_stack_max);
10976 if (quantity_used != 0)
10977 {
10978 float hp1 = GetHealth01("","");
10979 float hp2 = other_item.GetHealth01("","");
10980 float hpResult = ((hp1*GetQuantity()) + (hp2*quantity_used));
10981 hpResult = hpResult / (GetQuantity() + quantity_used);
10982
10983 hpResult *= GetMaxHealth();
10984 Math.Round(hpResult);
10985 SetHealth("", "Health", hpResult);
10986
10987 AddQuantity(quantity_used);
10988 other_item.AddQuantity(-quantity_used);
10989 }
10990 }
10991 OnCombine(other_item);
10992 }
10993
10994 void OnCombine(ItemBase other_item)
10995 {
10996 #ifdef SERVER
10997 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10998 GetHierarchyParent().IncreaseLifetimeUp();
10999 #endif
11000 };
11001
11002 void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
11003 {
11004 PlayerBase p = PlayerBase.Cast(player);
11005
11006 array<int> recipesIds = p.m_Recipes;
11007 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
11008 if (moduleRecipesManager)
11009 {
11010 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
11011 moduleRecipesManager.GetValidRecipes(ItemBase.Cast(this), ItemBase.Cast(itemInHands), recipesIds, p);
11012 }
11013
11014 for (int i = 0;i < recipesIds.Count(); i++)
11015 {
11016 int key = recipesIds.Get(i);
11017 string recipeName = moduleRecipesManager.GetRecipeName(key);
11018 outputList.Insert(new TSelectableActionInfo(SAT_CRAFTING, key, recipeName));
11019 }
11020 }
11021
11022 // -------------------------------------------------------------------------
11023 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
11024 {
11025 super.GetDebugActions(outputList);
11026
11027 //quantity
11028 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_QUANTITY, "Quantity +20%", FadeColors.LIGHT_GREY));
11029 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_QUANTITY, "Quantity -20%", FadeColors.LIGHT_GREY));
11030 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_QUANTITY_0, "Set Quantity 0", FadeColors.LIGHT_GREY));
11031 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SET_MAX_QUANTITY, "Set Quantity Max", FadeColors.LIGHT_GREY));
11032
11033 //health
11034 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_HEALTH, "Health +20%", FadeColors.LIGHT_GREY));
11035 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_HEALTH, "Health -20%", FadeColors.LIGHT_GREY));
11036 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DESTROY_HEALTH, "Health 0", FadeColors.LIGHT_GREY));
11037 //temperature
11038 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_TEMPERATURE, "Temperature +20", FadeColors.LIGHT_GREY));
11039 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_TEMPERATURE, "Temperature -20", FadeColors.LIGHT_GREY));
11040 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.FLIP_FROZEN, "Toggle Frozen", FadeColors.LIGHT_GREY));
11041
11042 //wet
11043 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.ADD_WETNESS, "Wetness +20", FadeColors.LIGHT_GREY));
11044 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.REMOVE_WETNESS, "Wetness -20", FadeColors.LIGHT_GREY));
11045
11046 //liquidtype
11047 if (IsLiquidContainer())
11048 {
11049 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_UP, "LiquidType Next", FadeColors.LIGHT_GREY));
11050 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.LIQUIDTYPE_DOWN, "LiquidType Previous", FadeColors.LIGHT_GREY));
11051 }
11052
11053 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.MAKE_SPECIAL, "Make Special", FadeColors.LIGHT_GREY));
11054 // watch
11055 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_ITEM, "Watch (CTRL-Z)", FadeColors.LIGHT_GREY));
11056 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.WATCH_PLAYER, "Watch Player", FadeColors.LIGHT_GREY));
11057
11058 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
11059 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.DELETE, "Delete", FadeColors.RED));
11060 outputList.Insert(new TSelectableActionInfoWithColor(SAT_DEBUG_ACTION, EActions.SEPARATOR, "", FadeColors.RED));
11061 }
11062
11063 // -------------------------------------------------------------------------
11064 // -------------------------------------------------------------------------
11065 // -------------------------------------------------------------------------
11066 override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
11067 {
11068 super.OnAction(action_id, player, ctx);
11069 if (action_id >= EActions.RECIPES_RANGE_START && action_id < EActions.RECIPES_RANGE_END)
11070 {
11071 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(GetPlugin(PluginRecipesManager));
11072 int idWithoutOffset = action_id - EActions.RECIPES_RANGE_START;
11073 PlayerBase p = PlayerBase.Cast(player);
11074 if (EActions.RECIPES_RANGE_START < 1000)
11075 {
11076 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
11077 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
11078 }
11079 }
11080 #ifndef SERVER
11081 else if (action_id == EActions.WATCH_PLAYER)
11082 {
11083 PluginDeveloper.SetDeveloperItemClientEx(player);
11084 }
11085 #endif
11086 if (GetGame().IsServer())
11087 {
11088 if (action_id >= EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id < EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
11089 {
11090 int id = action_id - EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
11091 OnDebugButtonPressServer(id + 1);
11092 }
11093
11094 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id < EActions.DEBUG_AGENTS_RANGE_INJECT_END)
11095 {
11096 int agent_id = action_id - EActions.DEBUG_AGENTS_RANGE_INJECT_START;
11097 InsertAgent(agent_id,100);
11098 }
11099
11100 else if (action_id >= EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id < EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
11101 {
11102 int agent_id2 = action_id - EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
11103 RemoveAgent(agent_id2);
11104 }
11105
11106 else if (action_id == EActions.ADD_QUANTITY)
11107 {
11108 if (IsMagazine())
11109 {
11110 Magazine mag = Magazine.Cast(this);
11111 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
11112 }
11113 else
11114 {
11115 AddQuantity(GetQuantityMax() * 0.2);
11116 }
11117
11118 if (m_EM)
11119 {
11120 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
11121 }
11122 //PrintVariables();
11123 }
11124
11125 else if (action_id == EActions.REMOVE_QUANTITY) //Quantity -20%
11126 {
11127 if (IsMagazine())
11128 {
11129 Magazine mag2 = Magazine.Cast(this);
11130 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
11131 }
11132 else
11133 {
11134 AddQuantity(- GetQuantityMax() * 0.2);
11135 }
11136 if (m_EM)
11137 {
11138 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
11139 }
11140 //PrintVariables();
11141 }
11142
11143 else if (action_id == EActions.SET_QUANTITY_0) //SetMaxQuantity
11144 {
11145 SetQuantity(0);
11146
11147 if (m_EM)
11148 {
11149 m_EM.SetEnergy(0);
11150 }
11151 }
11152
11153 else if (action_id == EActions.SET_MAX_QUANTITY) //SetMaxQuantity
11154 {
11156
11157 if (m_EM)
11158 {
11159 m_EM.SetEnergy(m_EM.GetEnergyMax());
11160 }
11161 }
11162
11163 else if (action_id == EActions.ADD_HEALTH)
11164 {
11165 AddHealth("","",GetMaxHealth("","Health")/5);
11166 }
11167 else if (action_id == EActions.REMOVE_HEALTH)
11168 {
11169 AddHealth("","",-GetMaxHealth("","Health")/5);
11170 }
11171 else if (action_id == EActions.DESTROY_HEALTH)
11172 {
11173 SetHealth01("","",0);
11174 }
11175 else if (action_id == EActions.WATCH_ITEM)
11176 {
11178 mid.RegisterDebugItem(ItemBase.Cast(this), PlayerBase.Cast(player));
11179 #ifdef DEVELOPER
11180 SetDebugDeveloper_item(this);
11181 #endif
11182 }
11183
11184 else if (action_id == EActions.ADD_TEMPERATURE)
11185 {
11186 AddTemperature(20);
11187 //PrintVariables();
11188 }
11189
11190 else if (action_id == EActions.REMOVE_TEMPERATURE)
11191 {
11192 AddTemperature(-20);
11193 //PrintVariables();
11194 }
11195
11196 else if (action_id == EActions.FLIP_FROZEN)
11197 {
11198 SetFrozen(!GetIsFrozen());
11199 //PrintVariables();
11200 }
11201
11202 else if (action_id == EActions.ADD_WETNESS)
11203 {
11204 AddWet(GetWetMax()/5);
11205 //PrintVariables();
11206 }
11207
11208 else if (action_id == EActions.REMOVE_WETNESS)
11209 {
11210 AddWet(-GetWetMax()/5);
11211 //PrintVariables();
11212 }
11213
11214 else if (action_id == EActions.LIQUIDTYPE_UP)
11215 {
11216 int curr_type = GetLiquidType();
11217 SetLiquidType(curr_type * 2);
11218 //AddWet(1);
11219 //PrintVariables();
11220 }
11221
11222 else if (action_id == EActions.LIQUIDTYPE_DOWN)
11223 {
11224 int curr_type2 = GetLiquidType();
11225 SetLiquidType(curr_type2 / 2);
11226 }
11227
11228 else if (action_id == EActions.MAKE_SPECIAL)
11229 {
11230 auto debugParams = DebugSpawnParams.WithPlayer(player);
11231 OnDebugSpawnEx(debugParams);
11232 }
11233
11234 else if (action_id == EActions.DELETE)
11235 {
11236 Delete();
11237 }
11238
11239 }
11240
11241
11242 return false;
11243 }
11244
11245 // -------------------------------------------------------------------------
11246
11247
11250 void OnActivatedByTripWire();
11251
11253 void OnActivatedByItem(notnull ItemBase item);
11254
11255 //----------------------------------------------------------------
11256 //returns true if item is able to explode when put in fire
11257 bool CanExplodeInFire()
11258 {
11259 return false;
11260 }
11261
11262 //----------------------------------------------------------------
11263 bool CanEat()
11264 {
11265 return true;
11266 }
11267
11268 //----------------------------------------------------------------
11269 override bool IsIgnoredByConstruction()
11270 {
11271 return true;
11272 }
11273
11274 //----------------------------------------------------------------
11275 //has FoodStages in config?
11276 bool HasFoodStage()
11277 {
11278 string config_path = string.Format("CfgVehicles %1 Food FoodStages", GetType());
11279 return GetGame().ConfigIsExisting(config_path);
11280 }
11281
11283 FoodStage GetFoodStage()
11284 {
11285 return null;
11286 }
11287
11288 bool CanBeCooked()
11289 {
11290 return false;
11291 }
11292
11293 bool CanBeCookedOnStick()
11294 {
11295 return false;
11296 }
11297
11299 void RefreshAudioVisualsOnClient( CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned );
11301
11302 //----------------------------------------------------------------
11303 bool CanRepair(ItemBase item_repair_kit)
11304 {
11305 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
11306 return module_repairing.CanRepair(this, item_repair_kit);
11307 }
11308
11309 //----------------------------------------------------------------
11310 bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
11311 {
11312 PluginRepairing module_repairing = PluginRepairing.Cast(GetPlugin(PluginRepairing));
11313 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
11314 }
11315
11316 //----------------------------------------------------------------
11317 int GetItemSize()
11318 {
11319 /*
11320 vector v_size = this.ConfigGetVector("itemSize");
11321 int v_size_x = v_size[0];
11322 int v_size_y = v_size[1];
11323 int size = v_size_x * v_size_y;
11324 return size;
11325 */
11326
11327 return 1;
11328 }
11329
11330 //----------------------------------------------------------------
11331 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
11332 bool CanBeMovedOverride()
11333 {
11334 return m_CanBeMovedOverride;
11335 }
11336
11337 //----------------------------------------------------------------
11338 //Override for allowing seemingly unallowed moves when two clients send a conflicting message simultaneously
11339 void SetCanBeMovedOverride(bool setting)
11340 {
11341 m_CanBeMovedOverride = setting;
11342 }
11343
11344 //----------------------------------------------------------------
11352 void MessageToOwnerStatus(string text)
11353 {
11354 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11355
11356 if (player)
11357 {
11358 player.MessageStatus(text);
11359 }
11360 }
11361
11362 //----------------------------------------------------------------
11370 void MessageToOwnerAction(string text)
11371 {
11372 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11373
11374 if (player)
11375 {
11376 player.MessageAction(text);
11377 }
11378 }
11379
11380 //----------------------------------------------------------------
11388 void MessageToOwnerFriendly(string text)
11389 {
11390 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11391
11392 if (player)
11393 {
11394 player.MessageFriendly(text);
11395 }
11396 }
11397
11398 //----------------------------------------------------------------
11406 void MessageToOwnerImportant(string text)
11407 {
11408 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
11409
11410 if (player)
11411 {
11412 player.MessageImportant(text);
11413 }
11414 }
11415
11416 override bool IsItemBase()
11417 {
11418 return true;
11419 }
11420
11421 // Checks if item is of questioned kind
11422 override bool KindOf(string tag)
11423 {
11424 bool found = false;
11425 string item_name = this.GetType();
11426 ref TStringArray item_tag_array = new TStringArray;
11427 GetGame().ConfigGetTextArray("cfgVehicles " + item_name + " itemInfo", item_tag_array);
11428
11429 int array_size = item_tag_array.Count();
11430 for (int i = 0; i < array_size; i++)
11431 {
11432 if (item_tag_array.Get(i) == tag)
11433 {
11434 found = true;
11435 break;
11436 }
11437 }
11438 return found;
11439 }
11440
11441
11442 override void OnRPC(PlayerIdentity sender, int rpc_type,ParamsReadContext ctx)
11443 {
11444 //Debug.Log("OnRPC called");
11445 super.OnRPC(sender, rpc_type,ctx);
11446
11447 //Play soundset for attachment locking (ActionLockAttachment.c)
11448 switch (rpc_type)
11449 {
11450 #ifndef SERVER
11451 case ERPCs.RPC_SOUND_LOCK_ATTACH:
11452 Param2<bool, string> p = new Param2<bool, string>(false, "");
11453
11454 if (!ctx.Read(p))
11455 return;
11456
11457 bool play = p.param1;
11458 string soundSet = p.param2;
11459
11460 if (play)
11461 {
11462 if (m_LockingSound)
11463 {
11465 {
11466 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
11467 }
11468 }
11469 else
11470 {
11471 m_LockingSound = SEffectManager.PlaySound(soundSet, GetPosition(), 0, 0, true);
11472 }
11473 }
11474 else
11475 {
11476 SEffectManager.DestroyEffect(m_LockingSound);
11477 }
11478
11479 break;
11480 #endif
11481
11482 }
11483
11484 if (GetWrittenNoteData())
11485 {
11486 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
11487 }
11488 }
11489
11490 //-----------------------------
11491 // VARIABLE MANIPULATION SYSTEM
11492 //-----------------------------
11493 int NameToID(string name)
11494 {
11495 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
11496 return plugin.GetID(name);
11497 }
11498
11499 string IDToName(int id)
11500 {
11501 PluginVariables plugin = PluginVariables.Cast(GetPlugin(PluginVariables));
11502 return plugin.GetName(id);
11503 }
11504
11506 void OnSyncVariables(ParamsReadContext ctx)//with ID optimization
11507 {
11508 //Debug.Log("OnSyncVariables called for item: "+ ToString(this.GetType()),"varSync");
11509 //read the flags
11510 int varFlags;
11511 if (!ctx.Read(varFlags))
11512 return;
11513
11514 if (varFlags & ItemVariableFlags.FLOAT)
11515 {
11516 ReadVarsFromCTX(ctx);
11517 }
11518 }
11519
11520 override void SerializeNumericalVars(array<float> floats_out)
11521 {
11522 //some variables handled on EntityAI level already!
11523 super.SerializeNumericalVars(floats_out);
11524
11525 // the order of serialization must be the same as the order of de-serialization
11526 //--------------------------------------------
11527 if (IsVariableSet(VARIABLE_QUANTITY))
11528 {
11529 floats_out.Insert(m_VarQuantity);
11530 }
11531 //--------------------------------------------
11532 if (IsVariableSet(VARIABLE_WET))
11533 {
11534 floats_out.Insert(m_VarWet);
11535 }
11536 //--------------------------------------------
11537 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
11538 {
11539 floats_out.Insert(m_VarLiquidType);
11540 }
11541 //--------------------------------------------
11542 if (IsVariableSet(VARIABLE_COLOR))
11543 {
11544 floats_out.Insert(m_ColorComponentR);
11545 floats_out.Insert(m_ColorComponentG);
11546 floats_out.Insert(m_ColorComponentB);
11547 floats_out.Insert(m_ColorComponentA);
11548 }
11549 //--------------------------------------------
11550 if (IsVariableSet(VARIABLE_CLEANNESS))
11551 {
11552 floats_out.Insert(m_Cleanness);
11553 }
11554 }
11555
11556 override void DeSerializeNumericalVars(array<float> floats)
11557 {
11558 //some variables handled on EntityAI level already!
11559 super.DeSerializeNumericalVars(floats);
11560
11561 // the order of serialization must be the same as the order of de-serialization
11562 int index = 0;
11563 int mask = Math.Round(floats.Get(index));
11564
11565 index++;
11566 //--------------------------------------------
11567 if (mask & VARIABLE_QUANTITY)
11568 {
11569 if (m_IsStoreLoad)
11570 {
11571 SetStoreLoadedQuantity(floats.Get(index));
11572 }
11573 else
11574 {
11575 float quantity = floats.Get(index);
11576 SetQuantity(quantity, true, false, false, false);
11577 }
11578 index++;
11579 }
11580 //--------------------------------------------
11581 if (mask & VARIABLE_WET)
11582 {
11583 float wet = floats.Get(index);
11584 SetWet(wet);
11585 index++;
11586 }
11587 //--------------------------------------------
11588 if (mask & VARIABLE_LIQUIDTYPE)
11589 {
11590 int liquidtype = Math.Round(floats.Get(index));
11591 SetLiquidType(liquidtype);
11592 index++;
11593 }
11594 //--------------------------------------------
11595 if (mask & VARIABLE_COLOR)
11596 {
11597 m_ColorComponentR = Math.Round(floats.Get(index));
11598 index++;
11599 m_ColorComponentG = Math.Round(floats.Get(index));
11600 index++;
11601 m_ColorComponentB = Math.Round(floats.Get(index));
11602 index++;
11603 m_ColorComponentA = Math.Round(floats.Get(index));
11604 index++;
11605 }
11606 //--------------------------------------------
11607 if (mask & VARIABLE_CLEANNESS)
11608 {
11609 int cleanness = Math.Round(floats.Get(index));
11610 SetCleanness(cleanness);
11611 index++;
11612 }
11613 }
11614
11615 override void WriteVarsToCTX(ParamsWriteContext ctx)
11616 {
11617 super.WriteVarsToCTX(ctx);
11618
11619 //--------------------------------------------
11620 if (IsVariableSet(VARIABLE_QUANTITY))
11621 {
11622 ctx.Write(GetQuantity());
11623 }
11624 //--------------------------------------------
11625 if (IsVariableSet(VARIABLE_WET))
11626 {
11627 ctx.Write(GetWet());
11628 }
11629 //--------------------------------------------
11630 if (IsVariableSet(VARIABLE_LIQUIDTYPE))
11631 {
11632 ctx.Write(GetLiquidType());
11633 }
11634 //--------------------------------------------
11635 if (IsVariableSet(VARIABLE_COLOR))
11636 {
11637 int r,g,b,a;
11638 GetColor(r,g,b,a);
11639 ctx.Write(r);
11640 ctx.Write(g);
11641 ctx.Write(b);
11642 ctx.Write(a);
11643 }
11644 //--------------------------------------------
11645 if (IsVariableSet(VARIABLE_CLEANNESS))
11646 {
11647 ctx.Write(GetCleanness());
11648 }
11649 }
11650
11651 override bool ReadVarsFromCTX(ParamsReadContext ctx, int version = -1)//with ID optimization
11652 {
11653 if (!super.ReadVarsFromCTX(ctx,version))
11654 return false;
11655
11656 int intValue;
11657 float value;
11658
11659 if (version < 140)
11660 {
11661 if (!ctx.Read(intValue))
11662 return false;
11663
11664 m_VariablesMask = intValue;
11665 }
11666
11667 if (m_VariablesMask & VARIABLE_QUANTITY)
11668 {
11669 if (!ctx.Read(value))
11670 return false;
11671
11672 if (IsStoreLoad())
11673 {
11675 }
11676 else
11677 {
11678 SetQuantity(value, true, false, false, false);
11679 }
11680 }
11681 //--------------------------------------------
11682 if (version < 140)
11683 {
11684 if (m_VariablesMask & VARIABLE_TEMPERATURE)
11685 {
11686 if (!ctx.Read(value))
11687 return false;
11688 SetTemperatureDirect(value);
11689 }
11690 }
11691 //--------------------------------------------
11692 if (m_VariablesMask & VARIABLE_WET)
11693 {
11694 if (!ctx.Read(value))
11695 return false;
11696 SetWet(value);
11697 }
11698 //--------------------------------------------
11699 if (m_VariablesMask & VARIABLE_LIQUIDTYPE)
11700 {
11701 if (!ctx.Read(intValue))
11702 return false;
11703 SetLiquidType(intValue);
11704 }
11705 //--------------------------------------------
11706 if (m_VariablesMask & VARIABLE_COLOR)
11707 {
11708 int r,g,b,a;
11709 if (!ctx.Read(r))
11710 return false;
11711 if (!ctx.Read(g))
11712 return false;
11713 if (!ctx.Read(b))
11714 return false;
11715 if (!ctx.Read(a))
11716 return false;
11717
11718 SetColor(r,g,b,a);
11719 }
11720 //--------------------------------------------
11721 if (m_VariablesMask & VARIABLE_CLEANNESS)
11722 {
11723 if (!ctx.Read(intValue))
11724 return false;
11725 SetCleanness(intValue);
11726 }
11727 //--------------------------------------------
11728 if (version >= 138 && version < 140)
11729 {
11730 if (m_VariablesMask & VARIABLE_TEMPERATURE)
11731 {
11732 if (!ctx.Read(intValue))
11733 return false;
11734 SetFrozen(intValue);
11735 }
11736 }
11737
11738 return true;
11739 }
11740
11741 //----------------------------------------------------------------
11742 override bool OnStoreLoad(ParamsReadContext ctx, int version)
11743 {
11744 m_IsStoreLoad = true;
11746 {
11747 m_FixDamageSystemInit = true;
11748 }
11749
11750 if (!super.OnStoreLoad(ctx, version))
11751 {
11752 m_IsStoreLoad = false;
11753 return false;
11754 }
11755
11756 if (version >= 114)
11757 {
11758 bool hasQuickBarIndexSaved;
11759
11760 if (!ctx.Read(hasQuickBarIndexSaved))
11761 {
11762 m_IsStoreLoad = false;
11763 return false;
11764 }
11765
11766 if (hasQuickBarIndexSaved)
11767 {
11768 int itmQBIndex;
11769
11770 //Load quickbar item bind
11771 if (!ctx.Read(itmQBIndex))
11772 {
11773 m_IsStoreLoad = false;
11774 return false;
11775 }
11776
11777 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
11778 if (itmQBIndex != -1 && parentPlayer)
11779 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
11780 }
11781 }
11782 else
11783 {
11784 // Backup of how it used to be
11785 PlayerBase player;
11786 int itemQBIndex;
11787 if (version == int.MAX)
11788 {
11789 if (!ctx.Read(itemQBIndex))
11790 {
11791 m_IsStoreLoad = false;
11792 return false;
11793 }
11794 }
11795 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
11796 {
11797 //Load quickbar item bind
11798 if (!ctx.Read(itemQBIndex))
11799 {
11800 m_IsStoreLoad = false;
11801 return false;
11802 }
11803 if (itemQBIndex != -1 && player)
11804 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
11805 }
11806 }
11807
11808 if (version < 140)
11809 {
11810 // variable management system
11811 if (!LoadVariables(ctx, version))
11812 {
11813 m_IsStoreLoad = false;
11814 return false;
11815 }
11816 }
11817
11818 //agent trasmission system
11819 if (!LoadAgents(ctx, version))
11820 {
11821 m_IsStoreLoad = false;
11822 return false;
11823 }
11824 if (version >= 132)
11825 {
11826 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
11827 if (raib)
11828 {
11829 if (!raib.OnStoreLoad(ctx,version))
11830 {
11831 m_IsStoreLoad = false;
11832 return false;
11833 }
11834 }
11835 }
11836
11837 m_IsStoreLoad = false;
11838 return true;
11839 }
11840
11841 //----------------------------------------------------------------
11842
11843 override void OnStoreSave(ParamsWriteContext ctx)
11844 {
11845 super.OnStoreSave(ctx);
11846
11847 PlayerBase player;
11848 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11849 {
11850 ctx.Write(true); // Keep track of if we should actually read this in or not
11851 //Save quickbar item bind
11852 int itemQBIndex = -1;
11853 itemQBIndex = player.FindQuickBarEntityIndex(this);
11854 ctx.Write(itemQBIndex);
11855 }
11856 else
11857 {
11858 ctx.Write(false); // Keep track of if we should actually read this in or not
11859 }
11860
11861 SaveAgents(ctx);//agent trasmission system
11862
11863 RemotelyActivatedItemBehaviour raib = GetRemotelyActivatedItemBehaviour();
11864 if (raib)
11865 {
11866 raib.OnStoreSave(ctx);
11867 }
11868 }
11869 //----------------------------------------------------------------
11870
11871 override void AfterStoreLoad()
11872 {
11873 super.AfterStoreLoad();
11874
11876 {
11878 }
11879
11880 if (GetStoreLoadedQuantity() != float.LOWEST)
11881 {
11883 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
11884 }
11885 }
11886
11887 override void EEOnAfterLoad()
11888 {
11889 super.EEOnAfterLoad();
11890
11892 {
11893 m_FixDamageSystemInit = false;
11894 }
11895
11898 }
11899
11900 bool CanBeDisinfected()
11901 {
11902 return false;
11903 }
11904
11905
11906 //----------------------------------------------------------------
11907 override void OnVariablesSynchronized()
11908 {
11909 if (m_Initialized)
11910 {
11911 #ifdef PLATFORM_CONSOLE
11912 //bruteforce it is
11913 if (IsSplitable())
11914 {
11915 UIScriptedMenu menu = GetGame().GetUIManager().FindMenu(MENU_INVENTORY);
11916 if (menu)
11917 {
11918 menu.Refresh();
11919 }
11920 }
11921 #endif
11922 }
11923
11925 {
11926 PlayImpactSound(m_ConfigWeight, m_ImpactSpeed, m_ImpactSoundSurfaceHash);
11927 m_WantPlayImpactSound = false;
11928 }
11929
11931 {
11932 SetWeightDirty();
11934 }
11935 if (m_VarWet != m_VarWetPrev)
11936 {
11939 }
11940
11941 if (m_SoundSyncPlay != 0)
11942 {
11943 m_ItemSoundHandler.PlayItemSoundClient(m_SoundSyncPlay);
11944 m_SoundSyncPlay = 0;
11945 }
11946 if (m_SoundSyncStop != 0)
11947 {
11948 m_ItemSoundHandler.StopItemSoundClient(m_SoundSyncStop);
11949 m_SoundSyncStop = 0;
11950 }
11951
11952 super.OnVariablesSynchronized();
11953 }
11954
11955 //------------------------- Quantity
11956 //----------------------------------------------------------------
11958 override bool SetQuantity(float value, bool destroy_config = true, bool destroy_forced = false, bool allow_client = false, bool clamp_to_stack_max = true)
11959 {
11960 if (!IsServerCheck(allow_client))
11961 return false;
11962
11963 if (!HasQuantity())
11964 return false;
11965
11966 float min = GetQuantityMin();
11967 float max = GetQuantityMax();
11968
11969 if (value <= (min + 0.001))
11970 value = min;
11971
11972 if (value == min)
11973 {
11974 if (destroy_config)
11975 {
11976 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11977 if (dstr)
11978 {
11979 m_VarQuantity = Math.Clamp(value, min, max);
11980 this.Delete();
11981 return true;
11982 }
11983 }
11984 else if (destroy_forced)
11985 {
11986 m_VarQuantity = Math.Clamp(value, min, max);
11987 this.Delete();
11988 return true;
11989 }
11990 // we get here if destroy_config IS true AND dstr(config destroy param) IS false;
11991 RemoveAllAgents();//we remove all agents when we got to the min value, but the item is not getting deleted
11992 }
11993
11994 float delta = m_VarQuantity;
11995 m_VarQuantity = Math.Clamp(value, min, max);
11996
11997 if (GetStoreLoadedQuantity() == float.LOWEST)//any other value means we are setting quantity from storage
11998 {
11999 delta = m_VarQuantity - delta;
12000
12001 if (delta)
12002 OnQuantityChanged(delta);
12003 }
12004
12005 SetVariableMask(VARIABLE_QUANTITY);
12006
12007 return false;
12008 }
12009
12010 //----------------------------------------------------------------
12012 bool AddQuantity(float value, bool destroy_config = true, bool destroy_forced = false)
12013 {
12014 return SetQuantity(GetQuantity() + value, destroy_config, destroy_forced);
12015 }
12016 //----------------------------------------------------------------
12017 void SetQuantityMax()
12018 {
12019 float max = GetQuantityMax();
12020 SetQuantity(max);
12021 }
12022
12023 override void SetQuantityToMinimum()
12024 {
12025 float min = GetQuantityMin();
12026 SetQuantity(min);
12027 }
12028 //----------------------------------------------------------------
12030 void SetQuantityNormalized(float value, bool destroy_config = true, bool destroy_forced = false)
12031 {
12032 float value_clamped = Math.Clamp(value, 0, 1);//just to make sure
12033 int result = Math.Round(Math.Lerp(GetQuantityMin(), GetQuantityMax(), value_clamped));
12034 SetQuantity(result, destroy_config, destroy_forced);
12035 }
12036
12037 //----------------------------------------------------------------
12039 override float GetQuantityNormalized()
12040 {
12041 return Math.InverseLerp(GetQuantityMin(), GetQuantityMax(),m_VarQuantity);
12042 }
12043
12045 {
12046 return GetQuantityNormalized();
12047 }
12048
12049 /*void SetAmmoNormalized(float value)
12050 {
12051 float value_clamped = Math.Clamp(value, 0, 1);
12052 Magazine this_mag = Magazine.Cast(this);
12053 int max_rounds = this_mag.GetAmmoMax();
12054 int result = value * max_rounds;//can the rounded if higher precision is required
12055 this_mag.SetAmmoCount(result);
12056 }*/
12057 //----------------------------------------------------------------
12058 override int GetQuantityMax()
12059 {
12060 int slot = -1;
12061 if (GetInventory())
12062 {
12063 InventoryLocation il = new InventoryLocation;
12064 GetInventory().GetCurrentInventoryLocation(il);
12065 slot = il.GetSlot();
12066 }
12067
12068 return GetTargetQuantityMax(slot);
12069 }
12070
12071 override int GetTargetQuantityMax(int attSlotID = -1)
12072 {
12073 float quantity_max = 0;
12074
12075 if (IsSplitable()) //only stackable/splitable items can check for stack size
12076 {
12077 if (attSlotID != -1)
12078 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
12079
12080 if (quantity_max <= 0)
12081 quantity_max = m_VarStackMax;
12082 }
12083
12084 if (quantity_max <= 0)
12085 quantity_max = m_VarQuantityMax;
12086
12087 return quantity_max;
12088 }
12089 //----------------------------------------------------------------
12090 override int GetQuantityMin()
12091 {
12092 return m_VarQuantityMin;
12093 }
12094 //----------------------------------------------------------------
12095 int GetQuantityInit()
12096 {
12097 return m_VarQuantityInit;
12098 }
12099
12100 //----------------------------------------------------------------
12101 override bool HasQuantity()
12102 {
12103 return !(GetQuantityMax() - GetQuantityMin() == 0);
12104 }
12105
12106 override float GetQuantity()
12107 {
12108 return m_VarQuantity;
12109 }
12110
12111 bool IsFullQuantity()
12112 {
12113 return GetQuantity() >= GetQuantityMax();
12114 }
12115
12116 //Calculates weight of single item without attachments and cargo
12117 override float GetSingleInventoryItemWeightEx()
12118 {
12119 //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
12120 float weightEx = GetWeightEx();//overall weight of the item
12121 float special = GetInventoryAndCargoWeight();//cargo and attachment weight
12122 return weightEx - special;
12123 }
12124
12125 // Obsolete, use GetSingleInventoryItemWeightEx() instead
12127 {
12129 }
12130
12131 override protected float GetWeightSpecialized(bool forceRecalc = false)
12132 {
12133 if (IsSplitable()) //quantity determines size of the stack
12134 {
12135 #ifdef DEVELOPER
12136 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12137 {
12138 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
12139 data1.SetCalcDetails("TIB1: " + GetConfigWeightModifiedDebugText() +" * " + GetQuantity()+"(quantity)");
12140 }
12141 #endif
12142
12143 return GetQuantity() * GetConfigWeightModified();
12144 }
12145 else if (HasEnergyManager())// items with energy manager
12146 {
12147 #ifdef DEVELOPER
12148 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12149 {
12150 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
12151 data2.SetCalcDetails("TIB2: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetCompEM().GetEnergy()+"(energy) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit)");
12152 }
12153 #endif
12154 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
12155 }
12156 else//everything else
12157 {
12158 #ifdef DEVELOPER
12159 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
12160 {
12161 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
12162 data3.SetCalcDetails("TIB3: "+super.GetWeightSpecialized(forceRecalc)+"(contents weight) + " + GetConfigWeightModifiedDebugText() +" + " + GetQuantity()+"(quantity) * " + ConfigGetFloat("weightPerQuantityUnit") +"(weightPerQuantityUnit))");
12163 }
12164 #endif
12165 return super.GetWeightSpecialized(forceRecalc) + (GetQuantity() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
12166 }
12167 }
12168
12170 int GetNumberOfItems()
12171 {
12172 int item_count = 0;
12173 ItemBase item;
12174
12175 if (GetInventory().GetCargo() != NULL)
12176 {
12177 item_count = GetInventory().GetCargo().GetItemCount();
12178 }
12179
12180 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
12181 {
12182 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
12183 if (item)
12184 item_count += item.GetNumberOfItems();
12185 }
12186 return item_count;
12187 }
12188
12190 float GetUnitWeight(bool include_wetness = true)
12191 {
12192 float weight = 0;
12193 float wetness = 1;
12194 if (include_wetness)
12195 wetness += GetWet();
12196 if (IsSplitable()) //quantity determines size of the stack
12197 {
12198 weight = wetness * m_ConfigWeight;
12199 }
12200 else if (IsLiquidContainer()) //is a liquid container, default liquid weight is set to 1. May revisit later?
12201 {
12202 weight = 1;
12203 }
12204 return weight;
12205 }
12206
12207 //-----------------------------------------------------------------
12208
12209 override void ClearInventory()
12210 {
12211 if ((GetGame().IsServer() || !GetGame().IsMultiplayer()) && GetInventory())
12212 {
12213 GameInventory inv = GetInventory();
12214 array<EntityAI> items = new array<EntityAI>;
12215 inv.EnumerateInventory(InventoryTraversalType.INORDER, items);
12216 for (int i = 0; i < items.Count(); i++)
12217 {
12218 ItemBase item = ItemBase.Cast(items.Get(i));
12219 if (item)
12220 {
12221 GetGame().ObjectDelete(item);
12222 }
12223 }
12224 }
12225 }
12226
12227 //------------------------- Energy
12228
12229 //----------------------------------------------------------------
12230 float GetEnergy()
12231 {
12232 float energy = 0;
12233 if (HasEnergyManager())
12234 {
12235 energy = GetCompEM().GetEnergy();
12236 }
12237 return energy;
12238 }
12239
12240
12241 override void OnEnergyConsumed()
12242 {
12243 super.OnEnergyConsumed();
12244
12246 }
12247
12248 override void OnEnergyAdded()
12249 {
12250 super.OnEnergyAdded();
12251
12253 }
12254
12255 // Converts energy (from Energy Manager) to quantity, if enabled.
12257 {
12258 if (GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
12259 {
12260 if (HasQuantity())
12261 {
12262 float energy_0to1 = GetCompEM().GetEnergy0To1();
12263 SetQuantityNormalized(energy_0to1);
12264 }
12265 }
12266 }
12267
12268 //----------------------------------------------------------------
12269 float GetHeatIsolationInit()
12270 {
12271 return ConfigGetFloat("heatIsolation");
12272 }
12273
12274 float GetHeatIsolation()
12275 {
12276 return m_HeatIsolation;
12277 }
12278
12279 float GetDryingIncrement(string pIncrementName)
12280 {
12281 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Drying %2", GetType(), pIncrementName);
12282 if (GetGame().ConfigIsExisting(paramPath))
12283 return GetGame().ConfigGetFloat(paramPath);
12284
12285 return 0.0;
12286 }
12287
12288 float GetSoakingIncrement(string pIncrementName)
12289 {
12290 string paramPath = string.Format("CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2", GetType(), pIncrementName);
12291 if (GetGame().ConfigIsExisting(paramPath))
12292 return GetGame().ConfigGetFloat(paramPath);
12293
12294 return 0.0;
12295 }
12296 //----------------------------------------------------------------
12297 override void SetWet(float value, bool allow_client = false)
12298 {
12299 if (!IsServerCheck(allow_client))
12300 return;
12301
12302 float min = GetWetMin();
12303 float max = GetWetMax();
12304
12305 float previousValue = m_VarWet;
12306
12307 m_VarWet = Math.Clamp(value, min, max);
12308
12309 if (previousValue != m_VarWet)
12310 {
12311 SetVariableMask(VARIABLE_WET);
12312 OnWetChanged(m_VarWet, previousValue);
12313 }
12314 }
12315 //----------------------------------------------------------------
12316 override void AddWet(float value)
12317 {
12318 SetWet(GetWet() + value);
12319 }
12320 //----------------------------------------------------------------
12321 override void SetWetMax()
12322 {
12324 }
12325 //----------------------------------------------------------------
12326 override float GetWet()
12327 {
12328 return m_VarWet;
12329 }
12330 //----------------------------------------------------------------
12331 override float GetWetMax()
12332 {
12333 return m_VarWetMax;
12334 }
12335 //----------------------------------------------------------------
12336 override float GetWetMin()
12337 {
12338 return m_VarWetMin;
12339 }
12340 //----------------------------------------------------------------
12341 override float GetWetInit()
12342 {
12343 return m_VarWetInit;
12344 }
12345 //----------------------------------------------------------------
12346 override void OnWetChanged(float newVal, float oldVal)
12347 {
12348 EWetnessLevel newLevel = GetWetLevelInternal(newVal);
12349 EWetnessLevel oldLevel = GetWetLevelInternal(oldVal);
12350 if (newLevel != oldLevel)
12351 {
12352 OnWetLevelChanged(newLevel,oldLevel);
12353 }
12354 }
12355
12356 override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
12357 {
12358 SetWeightDirty();
12359 }
12360
12361 override EWetnessLevel GetWetLevel()
12362 {
12363 return GetWetLevelInternal(m_VarWet);
12364 }
12365
12366 //----------------------------------------------------------------
12367
12368 override void SetStoreLoad(bool value)
12369 {
12370 m_IsStoreLoad = value;
12371 }
12372
12373 override bool IsStoreLoad()
12374 {
12375 return m_IsStoreLoad;
12376 }
12377
12378 override void SetStoreLoadedQuantity(float value)
12379 {
12380 m_StoreLoadedQuantity = value;
12381 }
12382
12383 override float GetStoreLoadedQuantity()
12384 {
12385 return m_StoreLoadedQuantity;
12386 }
12387
12388 //----------------------------------------------------------------
12389
12390 float GetItemModelLength()
12391 {
12392 if (ConfigIsExisting("itemModelLength"))
12393 {
12394 return ConfigGetFloat("itemModelLength");
12395 }
12396 return 0;
12397 }
12398
12399 float GetItemAttachOffset()
12400 {
12401 if (ConfigIsExisting("itemAttachOffset"))
12402 {
12403 return ConfigGetFloat("itemAttachOffset");
12404 }
12405 return 0;
12406 }
12407
12408 override void SetCleanness(int value, bool allow_client = false)
12409 {
12410 if (!IsServerCheck(allow_client))
12411 return;
12412
12413 int previousValue = m_Cleanness;
12414
12415 m_Cleanness = Math.Clamp(value, m_CleannessMin, m_CleannessMax);
12416
12417 if (previousValue != m_Cleanness)
12418 SetVariableMask(VARIABLE_CLEANNESS);
12419 }
12420
12421 override int GetCleanness()
12422 {
12423 return m_Cleanness;
12424 }
12425
12427 {
12428 return true;
12429 }
12430
12431 //----------------------------------------------------------------
12432 // ATTACHMENT LOCKING
12433 // Getters relevant to generic ActionLockAttachment
12434 int GetLockType()
12435 {
12436 return m_LockType;
12437 }
12438
12439 string GetLockSoundSet()
12440 {
12441 return m_LockSoundSet;
12442 }
12443
12444 //----------------------------------------------------------------
12445 //------------------------- Color
12446 // sets items color variable given color components
12447 override void SetColor(int r, int g, int b, int a)
12448 {
12453 SetVariableMask(VARIABLE_COLOR);
12454 }
12456 override void GetColor(out int r,out int g,out int b,out int a)
12457 {
12462 }
12463
12464 bool IsColorSet()
12465 {
12466 return IsVariableSet(VARIABLE_COLOR);
12467 }
12468
12470 string GetColorString()
12471 {
12472 int r,g,b,a;
12473 GetColor(r,g,b,a);
12474 r = r/255;
12475 g = g/255;
12476 b = b/255;
12477 a = a/255;
12478 return MiscGameplayFunctions.GetColorString(r, g, b, a);
12479 }
12480 //----------------------------------------------------------------
12481 //------------------------- LiquidType
12482
12483 override void SetLiquidType(int value, bool allow_client = false)
12484 {
12485 if (!IsServerCheck(allow_client))
12486 return;
12487
12488 int old = m_VarLiquidType;
12489 m_VarLiquidType = value;
12490 OnLiquidTypeChanged(old,value);
12491 SetVariableMask(VARIABLE_LIQUIDTYPE);
12492 }
12493
12494 int GetLiquidTypeInit()
12495 {
12496 return ConfigGetInt("varLiquidTypeInit");
12497 }
12498
12499 override int GetLiquidType()
12500 {
12501 return m_VarLiquidType;
12502 }
12503
12504 protected void OnLiquidTypeChanged(int oldType, int newType)
12505 {
12506 if (newType == LIQUID_NONE && GetIsFrozen())
12507 SetFrozen(false);
12508 }
12509
12511 void UpdateQuickbarShortcutVisibility(PlayerBase player)
12512 {
12513 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12514 }
12515
12516 // -------------------------------------------------------------------------
12518 void OnInventoryEnter(Man player)
12519 {
12520 PlayerBase nplayer;
12521 if (PlayerBase.CastTo(nplayer, player))
12522 {
12523 m_CanPlayImpactSound = true;
12524 //nplayer.OnItemInventoryEnter(this);
12525 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
12526 }
12527 }
12528
12529 // -------------------------------------------------------------------------
12531 void OnInventoryExit(Man player)
12532 {
12533 PlayerBase nplayer;
12534 if (PlayerBase.CastTo(nplayer,player))
12535 {
12536 //nplayer.OnItemInventoryExit(this);
12537 nplayer.SetEnableQuickBarEntityShortcut(this,false);
12538
12539 }
12540
12541 //if (!GetGame().IsDedicatedServer())
12542 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
12543
12544
12545 if (HasEnergyManager())
12546 {
12547 GetCompEM().UpdatePlugState(); // Unplug the el. device if it's necesarry.
12548 }
12549 }
12550
12551 // ADVANCED PLACEMENT EVENTS
12552 override void OnPlacementStarted(Man player)
12553 {
12554 super.OnPlacementStarted(player);
12555
12556 SetTakeable(false);
12557 }
12558
12559 override void OnPlacementComplete(Man player, vector position = "0 0 0", vector orientation = "0 0 0")
12560 {
12561 if (m_AdminLog)
12562 {
12563 m_AdminLog.OnPlacementComplete(player, this);
12564 }
12565
12566 super.OnPlacementComplete(player, position, orientation);
12567 }
12568
12569 //-----------------------------
12570 // AGENT SYSTEM
12571 //-----------------------------
12572 //--------------------------------------------------------------------------
12573 bool ContainsAgent(int agent_id)
12574 {
12575 if (agent_id & m_AttachedAgents)
12576 {
12577 return true;
12578 }
12579 else
12580 {
12581 return false;
12582 }
12583 }
12584
12585 //--------------------------------------------------------------------------
12586 override void RemoveAgent(int agent_id)
12587 {
12588 if (ContainsAgent(agent_id))
12589 {
12590 m_AttachedAgents = ~agent_id & m_AttachedAgents;
12591 }
12592 }
12593
12594 //--------------------------------------------------------------------------
12595 override void RemoveAllAgents()
12596 {
12597 m_AttachedAgents = 0;
12598 }
12599 //--------------------------------------------------------------------------
12600 override void RemoveAllAgentsExcept(int agent_to_keep)
12601 {
12602 m_AttachedAgents = m_AttachedAgents & agent_to_keep;
12603 }
12604 // -------------------------------------------------------------------------
12605 override void InsertAgent(int agent, float count = 1)
12606 {
12607 if (count < 1)
12608 return;
12609 //Debug.Log("Inserting Agent on item: " + agent.ToString() +" count: " + count.ToString());
12611 }
12612
12614 void TransferAgents(int agents)
12615 {
12617 }
12618
12619 // -------------------------------------------------------------------------
12620 override int GetAgents()
12621 {
12622 return m_AttachedAgents;
12623 }
12624 //----------------------------------------------------------------------
12625
12626 /*int GetContaminationType()
12627 {
12628 int contamination_type;
12629
12630 const int CONTAMINATED_MASK = eAgents.CHOLERA | eAgents.INFLUENZA | eAgents.SALMONELLA | eAgents.BRAIN;
12631 const int POISONED_MASK = eAgents.FOOD_POISON | eAgents.CHEMICAL_POISON;
12632 const int NERVE_GAS_MASK = eAgents.CHEMICAL_POISON;
12633 const int DIRTY_MASK = eAgents.WOUND_AGENT;
12634
12635 Edible_Base edible = Edible_Base.Cast(this);
12636 int agents = GetAgents();
12637 if (edible)
12638 {
12639 NutritionalProfile profile = Edible_Base.GetNutritionalProfile(edible);
12640 if (profile)
12641 {
12642 agents = agents | profile.GetAgents();//merge item's agents with nutritional agents
12643 }
12644 }
12645 if (agents & CONTAMINATED_MASK)
12646 {
12647 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_CONTAMINATED;
12648 }
12649 if (agents & POISONED_MASK)
12650 {
12651 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_POISONED;
12652 }
12653 if (agents & NERVE_GAS_MASK)
12654 {
12655 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_NERVE_GAS;
12656 }
12657 if (agents & DIRTY_MASK)
12658 {
12659 contamination_type = contamination_type | EContaminationTypes.ITEM_BADGE_DIRTY;
12660 }
12661
12662 return agents;
12663 }*/
12664
12665 // -------------------------------------------------------------------------
12666 bool LoadAgents(ParamsReadContext ctx, int version)
12667 {
12668 if (!ctx.Read(m_AttachedAgents))
12669 return false;
12670 return true;
12671 }
12672 // -------------------------------------------------------------------------
12674 {
12675
12677 }
12678 // -------------------------------------------------------------------------
12679
12681 override void CheckForRoofLimited(float timeTresholdMS = 3000)
12682 {
12683 super.CheckForRoofLimited(timeTresholdMS);
12684
12685 float time = GetGame().GetTime();
12686 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
12687 {
12688 m_PreviousRoofTestTime = time;
12689 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
12690 }
12691 }
12692
12693 // returns item's protection level against enviromental hazard, for masks with filters, returns the filters protection for valid filter, otherwise 0
12694 float GetProtectionLevel(int type, bool consider_filter = false, int system = 0)
12695 {
12696 if (IsDamageDestroyed() || (HasQuantity() && GetQuantity() <= 0))
12697 {
12698 return 0;
12699 }
12700
12701 if (GetInventory().GetAttachmentSlotsCount() != 0)//is it an item with attachable filter ?
12702 {
12703 ItemBase filter = ItemBase.Cast(FindAttachmentBySlotName("GasMaskFilter"));
12704 if (filter)
12705 return filter.GetProtectionLevel(type, false, system);//it's a valid filter, return the protection
12706 else
12707 return 0;//otherwise return 0 when no filter attached
12708 }
12709
12710 string subclassPath, entryName;
12711
12712 switch (type)
12713 {
12714 case DEF_BIOLOGICAL:
12715 entryName = "biological";
12716 break;
12717 case DEF_CHEMICAL:
12718 entryName = "chemical";
12719 break;
12720 default:
12721 entryName = "biological";
12722 break;
12723 }
12724
12725 subclassPath = "CfgVehicles " + this.GetType() + " Protection ";
12726
12727 return GetGame().ConfigGetFloat(subclassPath + entryName);
12728 }
12729
12730
12731
12733 override void EEOnCECreate()
12734 {
12735 if (!IsMagazine())
12737
12739 }
12740
12741
12742 //-------------------------
12743 // OPEN/CLOSE USER ACTIONS
12744 //-------------------------
12746 void Open();
12747 void Close();
12748 bool IsOpen()
12749 {
12750 return true;
12751 }
12752
12753 override bool CanDisplayCargo()
12754 {
12755 return IsOpen();
12756 }
12757
12758
12759 // ------------------------------------------------------------
12760 // CONDITIONS
12761 // ------------------------------------------------------------
12762 override bool CanPutInCargo(EntityAI parent)
12763 {
12764 if (parent)
12765 {
12766 if (parent.IsInherited(DayZInfected))
12767 return true;
12768
12769 if (!parent.IsRuined())
12770 return true;
12771 }
12772
12773 return true;
12774 }
12775
12776 override bool CanPutAsAttachment(EntityAI parent)
12777 {
12778 if (!super.CanPutAsAttachment(parent))
12779 {
12780 return false;
12781 }
12782
12783 if (!IsRuined() && !parent.IsRuined())
12784 {
12785 return true;
12786 }
12787
12788 return false;
12789 }
12790
12791 override bool CanReceiveItemIntoCargo(EntityAI item)
12792 {
12793 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12794 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12795 // return false;
12796
12797 return super.CanReceiveItemIntoCargo(item);
12798 }
12799
12800 override bool CanReceiveAttachment(EntityAI attachment, int slotId)
12801 {
12802 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12803 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12804 // return false;
12805
12806 GameInventory attachmentInv = attachment.GetInventory();
12807 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
12808 {
12809 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12810 return false;
12811 }
12812
12813 InventoryLocation loc = new InventoryLocation();
12814 attachment.GetInventory().GetCurrentInventoryLocation(loc);
12815 if (loc && loc.IsValid() && !GetInventory().AreChildrenAccessible())
12816 return false;
12817
12818 return super.CanReceiveAttachment(attachment, slotId);
12819 }
12820
12821 override bool CanReleaseAttachment(EntityAI attachment)
12822 {
12823 if (!super.CanReleaseAttachment(attachment))
12824 return false;
12825
12826 return GetInventory().AreChildrenAccessible();
12827 }
12828
12829 /*override bool CanLoadAttachment(EntityAI attachment)
12830 {
12831 //removed 15.06. coz of loading from storage -> after load items in cargo was lost -> waiting for proper solution
12832 //if (GetHealthLevel() == GameConstants.STATE_RUINED)
12833 // return false;
12834
12835 GameInventory attachmentInv = attachment.GetInventory();
12836 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
12837 {
12838 bool boo = (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase));
12839 ErrorEx("CanLoadAttachment | this: " + this + " | attachment: " + attachment + " | boo: " + boo,ErrorExSeverity.INFO);
12840
12841 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
12842 return false;
12843 }
12844
12845 return super.CanLoadAttachment(attachment);
12846 }*/
12847
12848 // Plays muzzle flash particle effects
12849 static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12850 {
12851 int id = muzzle_owner.GetMuzzleID();
12852 array<ref WeaponParticlesOnFire> WPOF_array = m_OnFireEffect.Get(id);
12853
12854 if (WPOF_array)
12855 {
12856 for (int i = 0; i < WPOF_array.Count(); i++)
12857 {
12858 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12859
12860 if (WPOF)
12861 {
12862 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12863 }
12864 }
12865 }
12866 }
12867
12868 // Plays bullet eject particle effects (usually just smoke, the bullet itself is a 3D model and is not part of this function)
12869 static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12870 {
12871 int id = muzzle_owner.GetMuzzleID();
12872 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = m_OnBulletCasingEjectEffect.Get(id);
12873
12874 if (WPOBE_array)
12875 {
12876 for (int i = 0; i < WPOBE_array.Count(); i++)
12877 {
12878 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12879
12880 if (WPOBE)
12881 {
12882 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12883 }
12884 }
12885 }
12886 }
12887
12888 // Plays all weapon overheating particles
12889 static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12890 {
12891 int id = muzzle_owner.GetMuzzleID();
12892 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12893
12894 if (WPOOH_array)
12895 {
12896 for (int i = 0; i < WPOOH_array.Count(); i++)
12897 {
12898 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12899
12900 if (WPOOH)
12901 {
12902 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12903 }
12904 }
12905 }
12906 }
12907
12908 // Updates all weapon overheating particles
12909 static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12910 {
12911 int id = muzzle_owner.GetMuzzleID();
12912 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12913
12914 if (WPOOH_array)
12915 {
12916 for (int i = 0; i < WPOOH_array.Count(); i++)
12917 {
12918 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12919
12920 if (WPOOH)
12921 {
12922 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12923 }
12924 }
12925 }
12926 }
12927
12928 // Stops overheating particles
12929 static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
12930 {
12931 int id = muzzle_owner.GetMuzzleID();
12932 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12933
12934 if (WPOOH_array)
12935 {
12936 for (int i = 0; i < WPOOH_array.Count(); i++)
12937 {
12938 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12939
12940 if (WPOOH)
12941 {
12942 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12943 }
12944 }
12945 }
12946 }
12947
12948 //----------------------------------------------------------------
12949 //Item Behaviour - unified approach
12950 override bool IsHeavyBehaviour()
12951 {
12952 if (m_ItemBehaviour == 0)
12953 {
12954 return true;
12955 }
12956
12957 return false;
12958 }
12959
12960 override bool IsOneHandedBehaviour()
12961 {
12962 if (m_ItemBehaviour == 1)
12963 {
12964 return true;
12965 }
12966
12967 return false;
12968 }
12969
12970 override bool IsTwoHandedBehaviour()
12971 {
12972 if (m_ItemBehaviour == 2)
12973 {
12974 return true;
12975 }
12976
12977 return false;
12978 }
12979
12980 bool IsDeployable()
12981 {
12982 return false;
12983 }
12984
12986 float GetDeployTime()
12987 {
12988 return UATimeSpent.DEFAULT_DEPLOY;
12989 }
12990
12991
12992 //----------------------------------------------------------------
12993 // Item Targeting (User Actions)
12994 override void SetTakeable(bool pState)
12995 {
12996 m_IsTakeable = pState;
12997 SetSynchDirty();
12998 }
12999
13000 override bool IsTakeable()
13001 {
13002 return m_IsTakeable;
13003 }
13004
13005 // For cases where we want to show object widget which cant be taken to hands
13007 {
13008 return false;
13009 }
13010
13012 protected void PreLoadSoundAttachmentType()
13013 {
13014 string att_type = "None";
13015
13016 if (ConfigIsExisting("soundAttType"))
13017 {
13018 att_type = ConfigGetString("soundAttType");
13019 }
13020
13021 m_SoundAttType = att_type;
13022 }
13023
13024 override string GetAttachmentSoundType()
13025 {
13026 return m_SoundAttType;
13027 }
13028
13029 //----------------------------------------------------------------
13030 //SOUNDS - ItemSoundHandler
13031 //----------------------------------------------------------------
13032
13033 string GetPlaceSoundset(); // played when deploy starts
13034 string GetLoopDeploySoundset(); // played when deploy starts and stopped when it finishes
13035 string GetDeploySoundset(); // played when deploy sucessfully finishes
13036
13038 {
13039 if (!m_ItemSoundHandler)
13041
13042 return m_ItemSoundHandler;
13043 }
13044
13045 // override to initialize sounds
13046 protected void InitItemSounds()
13047 {
13048 if (GetPlaceSoundset() == string.Empty && GetDeploySoundset() == string.Empty && GetLoopDeploySoundset() == string.Empty)
13049 return;
13050
13052
13053 if (GetPlaceSoundset() != string.Empty)
13054 handler.AddSound(SoundConstants.ITEM_PLACE, GetPlaceSoundset());
13055
13056 if (GetDeploySoundset() != string.Empty)
13057 handler.AddSound(SoundConstants.ITEM_DEPLOY, GetDeploySoundset());
13058
13059 SoundParameters params = new SoundParameters();
13060 params.m_Loop = true;
13061 if (GetLoopDeploySoundset() != string.Empty)
13062 handler.AddSound(SoundConstants.ITEM_DEPLOY_LOOP, GetLoopDeploySoundset(), params);
13063 }
13064
13065 // Start sound using ItemSoundHandler
13066 void StartItemSoundServer(int id)
13067 {
13068 if (!GetGame().IsServer())
13069 return;
13070
13071 m_SoundSyncPlay = id;
13072 SetSynchDirty();
13073
13074 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStartItemSoundServer); // in case one is queued already
13076 }
13077
13078 // Stop sound using ItemSoundHandler
13079 void StopItemSoundServer(int id)
13080 {
13081 if (!GetGame().IsServer())
13082 return;
13083
13084 m_SoundSyncStop = id;
13085 SetSynchDirty();
13086
13087 GetGame().GetCallQueue(CALL_CATEGORY_SYSTEM).Remove(ClearStopItemSoundServer); // in case one is queued already
13089 }
13090
13091 protected void ClearStartItemSoundServer()
13092 {
13093 m_SoundSyncPlay = 0;
13094 }
13095
13096 protected void ClearStopItemSoundServer()
13097 {
13098 m_SoundSyncStop = 0;
13099 }
13100
13102 void PlayAttachSound(string slot_type)
13103 {
13104 if (!GetGame().IsDedicatedServer())
13105 {
13106 if (ConfigIsExisting("attachSoundSet"))
13107 {
13108 string cfg_path = "";
13109 string soundset = "";
13110 string type_name = GetType();
13111
13112 TStringArray cfg_soundset_array = new TStringArray;
13113 TStringArray cfg_slot_array = new TStringArray;
13114 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
13115 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
13116
13117 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
13118 {
13119 for (int i = 0; i < cfg_soundset_array.Count(); i++)
13120 {
13121 if (cfg_slot_array[i] == slot_type)
13122 {
13123 soundset = cfg_soundset_array[i];
13124 break;
13125 }
13126 }
13127 }
13128
13129 if (soundset != "")
13130 {
13131 EffectSound sound = SEffectManager.PlaySound(soundset, GetPosition());
13132 sound.SetAutodestroy(true);
13133 }
13134 }
13135 }
13136 }
13137
13138 void PlayDetachSound(string slot_type)
13139 {
13140 //TODO - evaluate if needed and devise universal config structure if so
13141 }
13142
13143 void OnApply(PlayerBase player);
13144
13146 {
13147 return 1.0;
13148 };
13149 //returns applicable selection
13150 array<string> GetHeadHidingSelection()
13151 {
13153 }
13154
13156 {
13158 }
13159
13160 WrittenNoteData GetWrittenNoteData() {};
13161
13163 {
13164 SetDynamicPhysicsLifeTime(0.01);
13165 m_ItemBeingDroppedPhys = false;
13166 }
13167
13169 {
13170 array<string> zone_names = new array<string>;
13171 GetDamageZones(zone_names);
13172 for (int i = 0; i < zone_names.Count(); i++)
13173 {
13174 SetHealthMax(zone_names.Get(i),"Health");
13175 }
13176 SetHealthMax("","Health");
13177 }
13178
13180 void SetZoneDamageCEInit()
13181 {
13182 float global_health = GetHealth01("","Health");
13183 array<string> zones = new array<string>;
13184 GetDamageZones(zones);
13185 //set damage of all zones to match global health level
13186 for (int i = 0; i < zones.Count(); i++)
13187 {
13188 SetHealth01(zones.Get(i),"Health",global_health);
13189 }
13190 }
13191
13193 bool IsCoverFaceForShave(string slot_name)
13194 {
13195 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
13196 }
13197
13198 void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
13199 {
13200 if (!hasRootAsPlayer)
13201 {
13202 if (refParentIB)
13203 {
13204 // parent is wet
13205 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (m_VarWet < m_VarWetMax))
13206 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
13207 // parent has liquid inside
13208 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (m_VarWet < m_VarWetMax))
13209 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
13210 // drying
13211 else if (m_VarWet > m_VarWetMin)
13212 AddWet(-1 * delta * GetDryingIncrement("ground") * 2);
13213 }
13214 else
13215 {
13216 // drying on ground or inside non-itembase (car, ...)
13217 if (m_VarWet > m_VarWetMin)
13218 AddWet(-1 * delta * GetDryingIncrement("ground"));
13219 }
13220 }
13221 }
13222
13223 void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
13224 {
13226 {
13227 float target = g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(this);
13228 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
13229 {
13230 float heatPermCoef = 1.0;
13231 EntityAI ent = this;
13232 while (ent)
13233 {
13234 heatPermCoef *= ent.GetHeatPermeabilityCoef();
13235 ent = ent.GetHierarchyParent();
13236 }
13237
13238 SetTemperatureEx(new TemperatureDataInterpolated(target,ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
13239 }
13240 }
13241 }
13242
13243 void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
13244 {
13245 // hierarchy check for an item to decide whether it has some parent and it is in some player inventory
13246 EntityAI parent = GetHierarchyParent();
13247 if (!parent)
13248 {
13249 hasParent = false;
13250 hasRootAsPlayer = false;
13251 }
13252 else
13253 {
13254 hasParent = true;
13255 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
13256 refParentIB = ItemBase.Cast(parent);
13257 }
13258 }
13259
13260 protected void ProcessDecay(float delta, bool hasRootAsPlayer)
13261 {
13262 // this is stub, implemented on Edible_Base
13263 }
13264
13265 bool CanDecay()
13266 {
13267 // return true used on selected food clases so they can decay
13268 return false;
13269 }
13270
13271 protected bool CanProcessDecay()
13272 {
13273 // this is stub, implemented on Edible_Base class
13274 // used to determine whether it is still necessary for the food to decay
13275 return false;
13276 }
13277
13278 protected bool CanHaveWetness()
13279 {
13280 // return true used on selected items that have a wetness effect
13281 return false;
13282 }
13283
13285 bool CanBeConsumed(ConsumeConditionData data = null)
13286 {
13287 return !GetIsFrozen() && IsOpen();
13288 }
13289
13290 override void ProcessVariables()
13291 {
13292 bool hasParent = false, hasRootAsPlayer = false;
13293 ItemBase refParentIB;
13294
13295 bool wwtu = g_Game.IsWorldWetTempUpdateEnabled();
13296 bool foodDecay = g_Game.IsFoodDecayEnabled();
13297
13298 if (wwtu || foodDecay)
13299 {
13300 bool processWetness = wwtu && CanHaveWetness();
13301 bool processTemperature = wwtu && CanHaveTemperature();
13302 bool processDecay = foodDecay && CanDecay() && CanProcessDecay();
13303
13304 if (processWetness || processTemperature || processDecay)
13305 {
13306 HierarchyCheck(hasParent, hasRootAsPlayer, refParentIB);
13307
13308 if (processWetness)
13309 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13310
13311 if (processTemperature)
13312 ProcessItemTemperature(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
13313
13314 if (processDecay)
13315 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
13316 }
13317 }
13318 }
13319
13322 {
13323 return m_TemperaturePerQuantityWeight * GameConstants.ITEM_TEMPERATURE_QUANTITY_WEIGHT_MULTIPLIER;
13324 }
13325
13326 override float GetTemperatureFreezeThreshold()
13327 {
13329 return Liquid.GetFreezeThreshold(GetLiquidType());
13330
13331 return super.GetTemperatureFreezeThreshold();
13332 }
13333
13334 override float GetTemperatureThawThreshold()
13335 {
13337 return Liquid.GetThawThreshold(GetLiquidType());
13338
13339 return super.GetTemperatureThawThreshold();
13340 }
13341
13342 override float GetItemOverheatThreshold()
13343 {
13345 return Liquid.GetBoilThreshold(GetLiquidType());
13346
13347 return super.GetItemOverheatThreshold();
13348 }
13349
13350 override float GetTemperatureFreezeTime()
13351 {
13352 if (HasQuantity())
13353 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),GetQuantityNormalized());
13354
13355 return super.GetTemperatureFreezeTime();
13356 }
13357
13358 override float GetTemperatureThawTime()
13359 {
13360 if (HasQuantity())
13361 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),GetQuantityNormalized());
13362
13363 return super.GetTemperatureThawTime();
13364 }
13365
13367 void AffectLiquidContainerOnFill(int liquid_type, float amount);
13369 void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature);
13370
13371 bool IsCargoException4x3(EntityAI item)
13372 {
13373 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
13374 }
13375
13377 {
13378 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
13379 }
13380
13382 void AddLightSourceItem(ItemBase lightsource)
13383 {
13384 m_LightSourceItem = lightsource;
13385 }
13386
13388 {
13389 m_LightSourceItem = null;
13390 }
13391
13393 {
13394 return m_LightSourceItem;
13395 }
13396
13398 array<int> GetValidFinishers()
13399 {
13400 return null;
13401 }
13402
13404 bool GetActionWidgetOverride(out typename name)
13405 {
13406 return false;
13407 }
13408
13409 bool PairWithDevice(notnull ItemBase otherDevice)
13410 {
13411 if (GetGame().IsServer())
13412 {
13413 ItemBase explosive = otherDevice;
13415 if (!trg)
13416 {
13417 trg = RemoteDetonatorTrigger.Cast(otherDevice);
13418 explosive = this;
13419 }
13420
13421 explosive.PairRemote(trg);
13422 trg.SetControlledDevice(explosive);
13423
13424 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
13425 trg.SetPersistentPairID(persistentID);
13426 explosive.SetPersistentPairID(persistentID);
13427
13428 return true;
13429 }
13430 return false;
13431 }
13432
13434 float GetBaitEffectivity()
13435 {
13436 float ret = 1.0;
13437 if (HasQuantity())
13438 ret *= GetQuantityNormalized();
13439 ret *= GetHealth01();
13440
13441 return ret;
13442 }
13443
13444 #ifdef DEVELOPER
13445 override void SetDebugItem()
13446 {
13447 super.SetDebugItem();
13448 _itemBase = this;
13449 }
13450
13451 override string GetDebugText()
13452 {
13453 string text = super.GetDebugText();
13454
13455 text += string.Format("Heat isolation(raw): %1\n", GetHeatIsolation());
13456 text += string.Format("Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(this));
13457
13458 return text;
13459 }
13460 #endif
13461
13462 bool CanBeUsedForSuicide()
13463 {
13464 return true;
13465 }
13466
13468 //DEPRECATED BELOW
13470 // Backwards compatibility
13471 void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
13472 {
13473 ProcessItemWetness(delta, hasParent, hasRootAsPlayer, refParentIB);
13474 ProcessItemTemperature(delta, hasParent, hasRootAsPlayer, refParentIB);
13475 }
13476
13477 // replaced by ItemSoundHandler
13478 protected EffectSound m_SoundDeployFinish;
13479 protected EffectSound m_SoundPlace;
13480 protected EffectSound m_DeployLoopSoundEx;
13481 protected EffectSound m_SoundDeploy;
13482 bool m_IsPlaceSound;
13483 bool m_IsDeploySound;
13485
13486 string GetDeployFinishSoundset();
13487 void PlayDeploySound();
13488 void PlayDeployFinishSound();
13489 void PlayPlaceSound();
13490 void PlayDeployLoopSoundEx();
13491 void StopDeployLoopSoundEx();
13492 void SoundSynchRemoteReset();
13493 void SoundSynchRemote();
13494 bool UsesGlobalDeploy(){return false;}
13495 bool CanPlayDeployLoopSound(){return false;}
13497 bool IsPlaceSound(){return m_IsPlaceSound;}
13498 bool IsDeploySound(){return m_IsDeploySound;}
13499 void SetIsPlaceSound(bool is_place_sound);
13500 void SetIsDeploySound(bool is_deploy_sound);
13501}
13502
13503EntityAI SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
13504{
13505 EntityAI entity = SpawnEntity(object_name, loc, ECE_IN_INVENTORY, RF_DEFAULT);
13506 if (entity)
13507 {
13508 bool is_item = entity.IsInherited(ItemBase);
13509 if (is_item && full_quantity)
13510 {
13511 ItemBase item = ItemBase.Cast(entity);
13512 item.SetQuantity(item.GetQuantityInit());
13513 }
13514 }
13515 else
13516 {
13517 ErrorEx("Cannot spawn entity: " + object_name,ErrorExSeverity.INFO);
13518 return NULL;
13519 }
13520 return entity;
13521}
13522
13523void SetupSpawnedItem(ItemBase item, float health, float quantity)
13524{
13525 if (item)
13526 {
13527 if (health > 0)
13528 item.SetHealth("", "", health);
13529
13530 if (item.CanHaveTemperature())
13531 {
13532 item.SetTemperatureDirect(GameConstants.ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE);
13533 if (item.CanFreeze())
13534 item.SetFrozen(false);
13535 }
13536
13537 if (item.HasEnergyManager())
13538 {
13539 if (quantity >= 0)
13540 {
13541 item.GetCompEM().SetEnergy0To1(quantity);
13542 }
13543 else
13544 {
13545 item.GetCompEM().SetEnergy(Math.AbsFloat(quantity));
13546 }
13547 }
13548 else if (item.IsMagazine())
13549 {
13550 Magazine mag = Magazine.Cast(item);
13551 if (quantity >= 0)
13552 {
13553 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
13554 }
13555 else
13556 {
13557 mag.ServerSetAmmoCount(Math.AbsFloat(quantity));
13558 }
13559
13560 }
13561 else
13562 {
13563 if (quantity >= 0)
13564 {
13565 item.SetQuantityNormalized(quantity, false);
13566 }
13567 else
13568 {
13569 item.SetQuantity(Math.AbsFloat(quantity));
13570 }
13571
13572 }
13573 }
13574}
13575
13576#ifdef DEVELOPER
13577ItemBase _itemBase;//watched item goes here(LCTRL+RMB->Watch)
13578#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()

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