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

◆ GetHeadHidingSelection()

array< string > SpawnItemOnLocation::GetHeadHidingSelection ( )
protected

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

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