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

◆ GetTemperatureThawThreshold()

override float SpawnItemOnLocation::GetTemperatureThawThreshold ( )
protected

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

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

Используется в Entity::CanFreeze() и Entity::SetTemperatureEx().