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

◆ GetLightSourceItem()

ItemBase SpawnItemOnLocation::GetLightSourceItem ( )
protected

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

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