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

◆ CanProcessDecay()

override bool CanProcessDecay ( )
protected

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

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

Используется в InventoryItem::ProcessVariables().