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

◆ CanReceiveItemIntoCargo()

override bool SpawnItemOnLocation::CanReceiveItemIntoCargo ( EntityAI item)
protected

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

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