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

◆ GetItemSoundHandler()

ItemSoundHandler SpawnItemOnLocation::GetItemSoundHandler ( )
protected

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

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

Используется в Barrel_ColorBase::InitItemSounds(), FireplaceBase::InitItemSounds(), InitItemSounds(), InventoryItem::InitItemSounds(), ItemBase::InitItemSounds() и ShippingContainerKeys_ColorBase::InitItemSounds().