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

◆ ClearStopItemSoundServer()

void SpawnItemOnLocation::ClearStopItemSoundServer ( )
protected

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

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