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

◆ IsHeavyBehaviour()

override bool SpawnItemOnLocation::IsHeavyBehaviour ( )
protected

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

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

Используется в Start().