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

◆ GetHeadHidingSelection()

array< string > SpawnItemOnLocation::GetHeadHidingSelection ( )
protected

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

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