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

◆ CheckForRoofLimited()

override void SpawnItemOnLocation::CheckForRoofLimited ( float timeTresholdMS = 3000)
protected

Roof check for entity, limited by time (anti-spam solution)

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

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

Используется в Cooling(), Heating(), FireplaceBase::IsThisIgnitionSuccessful(), OnItemLocationChanged(), StartFire() и StopFire().