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

◆ CanDisplayCargo()

override bool SpawnItemOnLocation::CanDisplayCargo ( )
protected

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

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