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

◆ ClearStartItemSoundServer()

void SpawnItemOnLocation::ClearStartItemSoundServer ( )
protected

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

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