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

◆ GetAttachmentSoundType()

override string SpawnItemOnLocation::GetAttachmentSoundType ( )
protected

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

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