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

◆ GetTemperatureFreezeThreshold()

override float SpawnItemOnLocation::GetTemperatureFreezeThreshold ( )
protected

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

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

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