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

◆ GetBandagingEffectivity()

float SpawnItemOnLocation::GetBandagingEffectivity ( )
protected

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

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