7477{
7479 {
7480 return true;
7481 }
7482};
7483
7484
7485
7487{
7491
7493
7496
7497
7498
7499
7500
7509
7515
7520
7525
7546 protected bool m_IsResultOfSplit
7547
7549
7554
7555
7556
7558
7562
7563
7564
7566
7569
7570
7571
7577
7578
7586
7589
7590
7592
7593
7595
7596
7601
7602
7607
7608
7610
7611
7613 {
7618
7619 if (!
GetGame().IsDedicatedServer())
7620 {
7622 {
7624
7626 {
7628 }
7629 }
7630
7633 }
7634
7635 m_OldLocation = null;
7636
7638 {
7640 }
7641
7642 if (ConfigIsExisting("headSelectionsToHide"))
7643 {
7646 }
7647
7649 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7650 {
7652 }
7653
7655
7656 m_IsResultOfSplit = false;
7657
7659 }
7660
7662 {
7663 super.InitItemVariables();
7664
7670 m_Count = ConfigGetInt(
"count");
7671
7674
7679
7682
7687
7699
7703
7704
7707 if (ConfigIsExisting("canBeSplit"))
7708 {
7711 }
7712
7714 if (ConfigIsExisting("itemBehaviour"))
7716
7717
7720 RegisterNetSyncVariableInt("m_VarLiquidType");
7721 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7722
7723 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7724 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7725 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7726
7727 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7728 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7729 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7730 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7731
7732 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7733 RegisterNetSyncVariableBool("m_IsTakeable");
7734 RegisterNetSyncVariableBool("m_IsHologram");
7735
7738 {
7741 }
7742
7744
7746 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7748
7749 }
7750
7752 {
7754 }
7755
7757 {
7760 {
7765 }
7766 }
7767
7768 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7769 {
7771 {
7774 }
7775
7777 }
7778
7780 {
7786 }
7787
7789
7791 {
7793
7794 if (!action)
7795 {
7796 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7797 return;
7798 }
7799
7801 if (!ai)
7802 {
7804 return;
7805 }
7806
7808 if (!action_array)
7809 {
7810 action_array = new array<ActionBase_Basic>;
7812 }
7813 if (LogManager.IsActionLogEnable())
7814 {
7815 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7816 }
7817
7818 if (action_array.Find(action) != -1)
7819 {
7820 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7821 }
7822 else
7823 {
7824 action_array.Insert(action);
7825 }
7826 }
7827
7829 {
7831 ActionBase action = player.GetActionManager().GetAction(actionName);
7834
7835 if (action_array)
7836 {
7837 action_array.RemoveItem(action);
7838 }
7839 }
7840
7841
7842
7844 {
7845 ActionOverrideData overrideData = new ActionOverrideData();
7849
7851 if (!actionMap)
7852 {
7855 }
7856
7857 actionMap.Insert(this.
Type(), overrideData);
7858
7859 }
7860
7862
7864
7865
7867 {
7870
7873
7874 string config_to_search = "CfgVehicles";
7875 string muzzle_owner_config;
7876
7878 {
7879 if (IsInherited(Weapon))
7880 config_to_search = "CfgWeapons";
7881
7882 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7883
7884 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7885
7887
7888 if (config_OnFire_subclass_count > 0)
7889 {
7890 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7891
7892 for (int i = 0; i < config_OnFire_subclass_count; i++)
7893 {
7894 string particle_class = "";
7896 string config_OnFire_entry = config_OnFire_class + particle_class;
7897 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7898 WPOF_array.Insert(WPOF);
7899 }
7900
7901
7903 }
7904 }
7905
7907 {
7908 config_to_search = "CfgWeapons";
7909 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7910
7911 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7912
7914
7915 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7916 {
7917 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7918
7919 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7920 {
7921 string particle_class2 = "";
7923 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7924 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7925 WPOBE_array.Insert(WPOBE);
7926 }
7927
7928
7930 }
7931 }
7932 }
7933
7934
7936 {
7939
7941 {
7942 string config_to_search = "CfgVehicles";
7943
7944 if (IsInherited(Weapon))
7945 config_to_search = "CfgWeapons";
7946
7947 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7948 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7949
7950 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
7951 {
7952
7954
7956 {
7958 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7960 return;
7961 }
7962
7965
7966
7967
7969 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7970
7971 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7972 {
7973 string particle_class = "";
7975 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7977
7978 if (entry_type == CT_CLASS)
7979 {
7980 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7981 WPOOH_array.Insert(WPOF);
7982 }
7983 }
7984
7985
7987 }
7988 }
7989 }
7990
7992 {
7994 }
7995
7997 {
7999 {
8001
8004
8007
8008 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8009 }
8010 }
8011
8013 {
8015 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8016
8018 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8019
8021 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8022
8024 {
8026 }
8027 }
8028
8030 {
8032 }
8033
8035 {
8038 else
8040
8042 {
8045 }
8046 else
8047 {
8050
8053 }
8054
8056 }
8057
8059 {
8061 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8062 }
8063
8065 {
8067 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8069 }
8070
8072 {
8074 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8075 }
8076
8078 {
8081
8082 OverheatingParticle OP = new OverheatingParticle();
8087
8089 }
8090
8092 {
8095
8096 return -1;
8097 }
8098
8100 {
8102 {
8105
8106 for (int i = count; i > 0; --i)
8107 {
8108 int id = i - 1;
8111
8114
8115 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8116 {
8117 if (p)
8118 {
8121 }
8122 }
8123 }
8124 }
8125 }
8126
8128 {
8130 {
8132 {
8133 int id = i - 1;
8135
8136 if (OP)
8137 {
8139
8140 if (p)
8141 {
8143 }
8144
8145 delete OP;
8146 }
8147 }
8148
8151 }
8152 }
8153
8156 {
8157 return 0.0;
8158 }
8159
8160
8162 {
8163 return 250;
8164 }
8165
8167 {
8168 return 0;
8169 }
8170
8173 {
8175 return true;
8176
8177 return false;
8178 }
8179
8182 {
8185
8187 {
8189 }
8190 else
8191 {
8192
8194 }
8195
8197 }
8198
8205 {
8206 return -1;
8207 }
8208
8209
8210
8211
8213 {
8215 {
8217 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8218
8219 if (r_index >= 0)
8220 {
8221 InventoryLocation r_il = new InventoryLocation;
8222 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8223
8224 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8227 {
8228 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8229 }
8231 {
8232 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8233 }
8234
8235 }
8236
8237 player.GetHumanInventory().ClearUserReservedLocation(this);
8238 }
8239
8242 }
8243
8244
8245
8246
8248 {
8249 return ItemBase.m_DebugActionsMask;
8250 }
8251
8253 {
8254 return ItemBase.m_DebugActionsMask & mask;
8255 }
8256
8258 {
8259 ItemBase.m_DebugActionsMask = mask;
8260 }
8261
8263 {
8264 ItemBase.m_DebugActionsMask |= mask;
8265 }
8266
8268 {
8269 ItemBase.m_DebugActionsMask &= ~mask;
8270 }
8271
8273 {
8275 {
8277 }
8278 else
8279 {
8281 }
8282 }
8283
8284
8286 {
8287 if (GetEconomyProfile())
8288 {
8289 float q_max = GetEconomyProfile().GetQuantityMax();
8290 if (q_max > 0)
8291 {
8292 float q_min = GetEconomyProfile().GetQuantityMin();
8293 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8294
8296 {
8297 ComponentEnergyManager comp = GetCompEM();
8299 {
8301 }
8302 }
8304 {
8306
8307 }
8308
8309 }
8310 }
8311 }
8312
8315 {
8316 EntityAI parent = GetHierarchyParent();
8317
8318 if (parent)
8319 {
8320 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8321 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8322 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8323 }
8324 }
8325
8328 {
8329 EntityAI parent = GetHierarchyParent();
8330
8331 if (parent)
8332 {
8333 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8334 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8335 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8336 }
8337 }
8338
8340 {
8341
8342
8343
8344
8346
8348 {
8349 if (ScriptInputUserData.CanStoreInputUserData())
8350 {
8351 ScriptInputUserData ctx = new ScriptInputUserData;
8357 ctx.
Write(use_stack_max);
8360
8362 {
8363 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8364 }
8365 }
8366 }
8367 else if (!
GetGame().IsMultiplayer())
8368 {
8370 }
8371 }
8372
8374 {
8376 }
8377
8379 {
8381 }
8382
8384 {
8386 }
8387
8389 {
8390
8391 return false;
8392 }
8393
8395 {
8396 return false;
8397 }
8398
8402 {
8403 return false;
8404 }
8405
8407 {
8408 return "";
8409 }
8410
8412
8414 {
8415 return false;
8416 }
8417
8419 {
8420 return true;
8421 }
8422
8423
8424
8426 {
8427 return true;
8428 }
8429
8431 {
8432 return true;
8433 }
8434
8436 {
8437 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8439 }
8440
8442 {
8444 }
8445
8447 {
8449 if (!is_being_placed)
8451 SetSynchDirty();
8452 }
8453
8454
8456
8458 {
8460 }
8461
8463 {
8465 }
8466
8468 {
8469 return 1;
8470 }
8471
8473 {
8474 return false;
8475 }
8476
8478 {
8480 SetSynchDirty();
8481 }
8482
8483
8484
8485
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8496
8497
8498
8499
8500
8501
8502
8503
8504
8505
8506
8507
8508
8509
8510
8511
8512
8513
8514
8515
8516
8518 {
8519 super.OnMovedInsideCargo(container);
8520
8521 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8522 }
8523
8524 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8525 {
8526 super.EEItemLocationChanged(oldLoc,newLoc);
8527
8528 PlayerBase new_player = null;
8529 PlayerBase old_player = null;
8530
8531 if (newLoc.GetParent())
8532 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8533
8534 if (oldLoc.GetParent())
8535 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8536
8538 {
8539 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
8540
8541 if (r_index >= 0)
8542 {
8543 InventoryLocation r_il = new InventoryLocation;
8544 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8545
8546 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8549 {
8550 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8551 }
8553 {
8554 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8555 }
8556
8557 }
8558 }
8559
8561 {
8562 if (new_player)
8563 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
8564
8565 if (new_player == old_player)
8566 {
8567
8568 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8569 {
8571 {
8572 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8573 {
8574 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8575 }
8576 }
8577 else
8578 {
8579 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8580 }
8581 }
8582
8583 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8584 {
8585 int type = oldLoc.GetType();
8587 {
8588 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8589 }
8591 {
8592 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8593 }
8594 }
8595 if (!m_OldLocation)
8596 {
8597 m_OldLocation = new InventoryLocation;
8598 }
8599 m_OldLocation.Copy(oldLoc);
8600 }
8601 else
8602 {
8603 if (m_OldLocation)
8604 {
8605 m_OldLocation.Reset();
8606 }
8607 }
8608
8610 }
8611 else
8612 {
8613 if (new_player)
8614 {
8615 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8616 if (res_index >= 0)
8617 {
8618 InventoryLocation il = new InventoryLocation;
8619 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
8621 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
8624 {
8625 il.
GetParent().GetOnReleaseLock().Invoke(it);
8626 }
8628 {
8630 }
8631
8632 }
8633 }
8635 {
8636
8638 }
8639
8640 if (m_OldLocation)
8641 {
8642 m_OldLocation.Reset();
8643 }
8644 }
8645 }
8646
8647 override void EOnContact(IEntity other, Contact extra)
8648 {
8650 {
8651 int liquidType = -1;
8653 if (impactSpeed > 0.0)
8654 {
8656 #ifndef SERVER
8658 #else
8660 SetSynchDirty();
8661 #endif
8663 }
8664 }
8665
8666 #ifdef SERVER
8667 if (GetCompEM() && GetCompEM().IsPlugged())
8668 {
8669 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8670 GetCompEM().UnplugThis();
8671 }
8672 #endif
8673 }
8674
8676
8678 {
8680 }
8681
8683 {
8684
8685 }
8686
8688 {
8689 super.OnItemLocationChanged(old_owner, new_owner);
8690
8691 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8692 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8693
8694 if (!relatedPlayer && playerNew)
8695 relatedPlayer = playerNew;
8696
8697 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8698 {
8700 if (actionMgr)
8701 {
8702 ActionBase currentAction = actionMgr.GetRunningAction();
8703 if (currentAction)
8705 }
8706 }
8707
8708 Man ownerPlayerOld = null;
8709 Man ownerPlayerNew = null;
8710
8711 if (old_owner)
8712 {
8713 if (old_owner.
IsMan())
8714 {
8715 ownerPlayerOld = Man.Cast(old_owner);
8716 }
8717 else
8718 {
8719 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8720 }
8721 }
8722 else
8723 {
8725 {
8727
8728 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8729 {
8730 GetCompEM().UnplugThis();
8731 }
8732 }
8733 }
8734
8735 if (new_owner)
8736 {
8737 if (new_owner.
IsMan())
8738 {
8739 ownerPlayerNew = Man.Cast(new_owner);
8740 }
8741 else
8742 {
8743 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8744 }
8745 }
8746
8747 if (ownerPlayerOld != ownerPlayerNew)
8748 {
8749 if (ownerPlayerOld)
8750 {
8751 array<EntityAI> subItemsExit = new array<EntityAI>;
8753 for (int i = 0; i < subItemsExit.Count(); i++)
8754 {
8757 }
8758 }
8759
8760 if (ownerPlayerNew)
8761 {
8762 array<EntityAI> subItemsEnter = new array<EntityAI>;
8764 for (int j = 0; j < subItemsEnter.Count(); j++)
8765 {
8768 }
8769 }
8770 }
8771 else if (ownerPlayerNew != null)
8772 {
8773 PlayerBase nplayer;
8774 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8775 {
8776 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8778 for (int k = 0; k < subItemsUpdate.Count(); k++)
8779 {
8781 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8782 }
8783 }
8784 }
8785
8786 if (old_owner)
8787 old_owner.OnChildItemRemoved(this);
8788 if (new_owner)
8789 new_owner.OnChildItemReceived(this);
8790 }
8791
8792
8794 {
8795 super.EEDelete(parent);
8796 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8797 if (player)
8798 {
8800
8801 if (player.IsAlive())
8802 {
8803 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8804 if (r_index >= 0)
8805 {
8806 InventoryLocation r_il = new InventoryLocation;
8807 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8808
8809 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8812 {
8813 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8814 }
8816 {
8817 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8818 }
8819
8820 }
8821
8822 player.RemoveQuickBarEntityShortcut(this);
8823 }
8824 }
8825 }
8826
8828 {
8829 super.EEKilled(killer);
8830
8833 {
8834 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8835 {
8836 if (IsMagazine())
8837 {
8838 if (Magazine.Cast(this).GetAmmoCount() > 0)
8839 {
8841 }
8842 }
8843 else
8844 {
8846 }
8847 }
8848 }
8849 }
8850
8852 {
8853 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8854
8855 super.OnWasAttached(parent, slot_id);
8856
8859
8861 }
8862
8864 {
8865 super.OnWasDetached(parent, slot_id);
8866
8869 }
8870
8872 {
8873 int idx;
8876
8877 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8878 if (inventory_slots.Count() < 1)
8879 {
8880 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8881 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8882 }
8883 else
8884 {
8885 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8886 }
8887
8888 idx = inventory_slots.Find(slot);
8889 if (idx < 0)
8890 return "";
8891
8892 return attach_types.Get(idx);
8893 }
8894
8896 {
8897 int idx = -1;
8898 string slot;
8899
8902
8903 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8904 if (inventory_slots.Count() < 1)
8905 {
8906 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8907 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8908 }
8909 else
8910 {
8911 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8912 if (detach_types.Count() < 1)
8913 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8914 }
8915
8916 for (int i = 0; i < inventory_slots.Count(); i++)
8917 {
8918 slot = inventory_slots.Get(i);
8919 }
8920
8921 if (slot != "")
8922 {
8923 if (detach_types.Count() == 1)
8924 idx = 0;
8925 else
8926 idx = inventory_slots.Find(slot);
8927 }
8928 if (idx < 0)
8929 return "";
8930
8931 return detach_types.Get(idx);
8932 }
8933
8935 {
8936
8938
8939
8940 float min_time = 1;
8941 float max_time = 3;
8942 float delay = Math.RandomFloat(min_time, max_time);
8943
8944 explode_timer.Run(delay, this, "DoAmmoExplosion");
8945 }
8946
8948 {
8949 Magazine magazine = Magazine.Cast(this);
8950 int pop_sounds_count = 6;
8951 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8952
8953
8954 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8955 string sound_name = pop_sounds[ sound_idx ];
8957
8958
8959 magazine.ServerAddAmmoCount(-1);
8960
8961
8962 float min_temp_to_explode = 100;
8963
8964 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8965 {
8967 }
8968 }
8969
8970
8971 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8972 {
8973 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8974
8975 const int CHANCE_DAMAGE_CARGO = 4;
8976 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8977 const int CHANCE_DAMAGE_NOTHING = 2;
8978
8980 {
8981 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8982 int chances;
8983 int rnd;
8984
8985 if (GetInventory().GetCargo())
8986 {
8987 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8988 rnd = Math.RandomInt(0,chances);
8989
8990 if (rnd < CHANCE_DAMAGE_CARGO)
8991 {
8993 }
8994 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8995 {
8997 }
8998 }
8999 else
9000 {
9001 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9002 rnd = Math.RandomInt(0,chances);
9003
9004 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9005 {
9007 }
9008 }
9009 }
9010 }
9011
9013 {
9014 if (GetInventory().GetCargo())
9015 {
9016 int item_count = GetInventory().GetCargo().GetItemCount();
9017 if (item_count > 0)
9018 {
9019 int random_pick = Math.RandomInt(0, item_count);
9021 if (!item.IsExplosive())
9022 {
9023 item.AddHealth("","",damage);
9024 return true;
9025 }
9026 }
9027 }
9028 return false;
9029 }
9030
9032 {
9033 int attachment_count = GetInventory().AttachmentCount();
9034 if (attachment_count > 0)
9035 {
9036 int random_pick = Math.RandomInt(0, attachment_count);
9037 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
9038 if (!attachment.IsExplosive())
9039 {
9040 attachment.AddHealth("","",damage);
9041 return true;
9042 }
9043 }
9044 return false;
9045 }
9046
9048 {
9050 }
9051
9053 {
9055 return GetInventory().CanRemoveEntity();
9056
9057 return false;
9058 }
9059
9061 {
9062
9064 return false;
9065
9066
9068 return false;
9069
9070
9071
9073 if (delta == 0)
9074 return false;
9075
9076
9077 return true;
9078 }
9079
9081 {
9083 {
9084 if (ScriptInputUserData.CanStoreInputUserData())
9085 {
9086 ScriptInputUserData ctx = new ScriptInputUserData;
9091 ctx.
Write(destination_entity);
9095 }
9096 }
9097 else if (!
GetGame().IsMultiplayer())
9098 {
9100 }
9101 }
9102
9104 {
9105 float split_quantity_new;
9109 InventoryLocation loc = new InventoryLocation;
9110
9111 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9112 {
9114 split_quantity_new = stack_max;
9115 else
9117
9119 {
9120 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9121 if (new_item)
9122 {
9123 new_item.SetResultOfSplit(true);
9124 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9126 new_item.
SetQuantity(split_quantity_new,
false,
true);
9127 }
9128 }
9129 }
9130 else if (destination_entity && slot_id == -1)
9131 {
9132 if (quantity > stack_max)
9133 split_quantity_new = stack_max;
9134 else
9135 split_quantity_new = quantity;
9136
9138 {
9140 {
9143 }
9144
9145 if (new_item)
9146 {
9147 new_item.SetResultOfSplit(true);
9148 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9150 new_item.
SetQuantity(split_quantity_new,
false,
true);
9151 }
9152 }
9153 }
9154 else
9155 {
9156 if (stack_max != 0)
9157 {
9159 {
9161 }
9162
9163 if (split_quantity_new == 0)
9164 {
9165 if (!
GetGame().IsMultiplayer())
9166 player.PhysicalPredictiveDropItem(this);
9167 else
9168 player.ServerDropEntity(this);
9169 return;
9170 }
9171
9173 {
9175
9176 if (new_item)
9177 {
9178 new_item.SetResultOfSplit(true);
9179 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9182 new_item.PlaceOnSurface();
9183 }
9184 }
9185 }
9186 }
9187 }
9188
9190 {
9191 float split_quantity_new;
9195 InventoryLocation loc = new InventoryLocation;
9196
9197 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9198 {
9200 split_quantity_new = stack_max;
9201 else
9203
9205 {
9206 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9207 if (new_item)
9208 {
9209 new_item.SetResultOfSplit(true);
9210 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9212 new_item.
SetQuantity(split_quantity_new,
false,
true);
9213 }
9214 }
9215 }
9216 else if (destination_entity && slot_id == -1)
9217 {
9218 if (quantity > stack_max)
9219 split_quantity_new = stack_max;
9220 else
9221 split_quantity_new = quantity;
9222
9224 {
9226 {
9229 }
9230
9231 if (new_item)
9232 {
9233 new_item.SetResultOfSplit(true);
9234 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9236 new_item.
SetQuantity(split_quantity_new,
false,
true);
9237 }
9238 }
9239 }
9240 else
9241 {
9242 if (stack_max != 0)
9243 {
9245 {
9247 }
9248
9250 {
9252
9253 if (new_item)
9254 {
9255 new_item.SetResultOfSplit(true);
9256 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9259 new_item.PlaceOnSurface();
9260 }
9261 }
9262 }
9263 }
9264 }
9265
9267 {
9269 {
9270 if (ScriptInputUserData.CanStoreInputUserData())
9271 {
9272 ScriptInputUserData ctx = new ScriptInputUserData;
9277 dst.WriteToContext(ctx);
9279 }
9280 }
9281 else if (!
GetGame().IsMultiplayer())
9282 {
9284 }
9285 }
9286
9288 {
9290 {
9291 if (ScriptInputUserData.CanStoreInputUserData())
9292 {
9293 ScriptInputUserData ctx = new ScriptInputUserData;
9298 ctx.
Write(destination_entity);
9304 }
9305 }
9306 else if (!
GetGame().IsMultiplayer())
9307 {
9309 }
9310 }
9311
9313 {
9315 }
9316
9318 {
9320 float split_quantity_new;
9322 if (dst.IsValid())
9323 {
9324 int slot_id = dst.GetSlot();
9326
9327 if (quantity > stack_max)
9328 split_quantity_new = stack_max;
9329 else
9330 split_quantity_new = quantity;
9331
9333 {
9335
9336 if (new_item)
9337 {
9338 new_item.SetResultOfSplit(true);
9339 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9341 new_item.
SetQuantity(split_quantity_new,
false,
true);
9342 }
9343
9344 return new_item;
9345 }
9346 }
9347
9348 return null;
9349 }
9350
9352 {
9354 float split_quantity_new;
9356 if (destination_entity)
9357 {
9359 if (quantity > stackable)
9360 split_quantity_new = stackable;
9361 else
9362 split_quantity_new = quantity;
9363
9365 {
9366 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9367 if (new_item)
9368 {
9369 new_item.SetResultOfSplit(true);
9370 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9372 new_item.
SetQuantity(split_quantity_new,
false,
true);
9373 }
9374 }
9375 }
9376 }
9377
9379 {
9381 {
9382 if (ScriptInputUserData.CanStoreInputUserData())
9383 {
9384 ScriptInputUserData ctx = new ScriptInputUserData;
9389 ItemBase destination_entity =
this;
9390 ctx.
Write(destination_entity);
9394 }
9395 }
9396 else if (!
GetGame().IsMultiplayer())
9397 {
9399 }
9400 }
9401
9403 {
9405 float split_quantity_new;
9407 if (player)
9408 {
9410 if (quantity > stackable)
9411 split_quantity_new = stackable;
9412 else
9413 split_quantity_new = quantity;
9414
9416 {
9417 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9418 new_item =
ItemBase.Cast(in_hands);
9419 if (new_item)
9420 {
9421 new_item.SetResultOfSplit(true);
9422 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9424 new_item.SetQuantity(split_quantity_new, false, true);
9425 }
9426 }
9427 }
9428 }
9429
9431 {
9433 float split_quantity_new = Math.Floor(quantity * 0.5);
9434
9436 return;
9437
9439
9440 if (new_item)
9441 {
9442 if (new_item.GetQuantityMax() < split_quantity_new)
9443 {
9444 split_quantity_new = new_item.GetQuantityMax();
9445 }
9446
9447 new_item.SetResultOfSplit(true);
9448 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9449
9451 {
9454 }
9455 else
9456 {
9458 new_item.
SetQuantity(split_quantity_new,
false,
true);
9459 }
9460 }
9461 }
9462
9464 {
9466 float split_quantity_new = Math.Floor(quantity / 2);
9467
9469 return;
9470
9471 InventoryLocation invloc = new InventoryLocation;
9473
9475 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9476
9477 if (new_item)
9478 {
9479 if (new_item.GetQuantityMax() < split_quantity_new)
9480 {
9481 split_quantity_new = new_item.GetQuantityMax();
9482 }
9484 {
9487 }
9488 else if (split_quantity_new > 1)
9489 {
9491 new_item.
SetQuantity(split_quantity_new,
false,
true);
9492 }
9493 }
9494 }
9495
9498 {
9499 SetWeightDirty();
9501
9502 if (parent)
9503 parent.OnAttachmentQuantityChangedEx(this, delta);
9504
9506 {
9508 {
9510 }
9512 {
9513 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9515 }
9516 }
9517
9518 }
9519
9522 {
9523
9524 }
9525
9528 {
9530 }
9531
9533 {
9534 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9535
9537 {
9538 if (newLevel == GameConstants.STATE_RUINED)
9539 {
9541 EntityAI parent = GetHierarchyParent();
9542 if (parent && parent.IsFireplace())
9543 {
9544 CargoBase cargo = GetInventory().GetCargo();
9545 if (cargo)
9546 {
9548 {
9550 }
9551 }
9552 }
9553 }
9554
9556 {
9557
9559 return;
9560 }
9561
9562 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9563 {
9565 }
9566 }
9567 }
9568
9569
9571 {
9572 super.OnRightClick();
9573
9575 {
9577 {
9578 if (ScriptInputUserData.CanStoreInputUserData())
9579 {
9580 EntityAI root = GetHierarchyRoot();
9581 Man playerOwner = GetHierarchyRootPlayer();
9582 InventoryLocation dst = new InventoryLocation;
9583
9584
9585 if (!playerOwner && root && root == this)
9586 {
9588 }
9589 else
9590 {
9591
9592 GetInventory().GetCurrentInventoryLocation(dst);
9594 {
9597 {
9599 }
9600 else
9601 {
9603
9604
9605 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9606 {
9608 }
9609 else
9610 {
9611 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9612 }
9613 }
9614 }
9615 }
9616
9617 ScriptInputUserData ctx = new ScriptInputUserData;
9625 }
9626 }
9627 else if (!
GetGame().IsMultiplayer())
9628 {
9630 }
9631 }
9632 }
9633
9635 {
9636 if (root)
9637 {
9638 vector m4[4];
9639 root.GetTransform(m4);
9640 dst.SetGround(this, m4);
9641 }
9642 else
9643 {
9644 GetInventory().GetCurrentInventoryLocation(dst);
9645 }
9646 }
9647
9648 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9649 {
9650
9651 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9652 return false;
9653
9654 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9655 return false;
9656
9657
9659 return false;
9660
9661
9662 Magazine mag = Magazine.Cast(this);
9663 if (mag)
9664 {
9665 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9666 return false;
9667
9668 if (stack_max_limit)
9669 {
9670 Magazine other_mag = Magazine.Cast(other_item);
9671 if (other_item)
9672 {
9673 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9674 return false;
9675 }
9676
9677 }
9678 }
9679 else
9680 {
9681
9683 return false;
9684
9686 return false;
9687 }
9688
9689 PlayerBase player = null;
9690 if (CastTo(player, GetHierarchyRootPlayer()))
9691 {
9692 if (player.GetInventory().HasAttachment(this))
9693 return false;
9694
9695 if (player.IsItemsToDelete())
9696 return false;
9697 }
9698
9699 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9700 return false;
9701
9702 int slotID;
9704 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9705 return false;
9706
9707 return true;
9708 }
9709
9711 {
9713 }
9714
9716 {
9717 return m_IsResultOfSplit;
9718 }
9719
9721 {
9722 m_IsResultOfSplit = value;
9723 }
9724
9726 {
9728 }
9729
9731 {
9732 float other_item_quantity = other_item.GetQuantity();
9733 float this_free_space;
9734
9736
9738
9739 if (other_item_quantity > this_free_space)
9740 {
9741 return this_free_space;
9742 }
9743 else
9744 {
9745 return other_item_quantity;
9746 }
9747 }
9748
9750 {
9752 }
9753
9755 {
9757 return;
9758
9759 if (!IsMagazine() && other_item)
9760 {
9762 if (quantity_used != 0)
9763 {
9764 float hp1 = GetHealth01("","");
9765 float hp2 = other_item.GetHealth01("","");
9766 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9767 hpResult = hpResult / (
GetQuantity() + quantity_used);
9768
9769 hpResult *= GetMaxHealth();
9770 Math.Round(hpResult);
9771 SetHealth("", "Health", hpResult);
9772
9774 other_item.AddQuantity(-quantity_used);
9775 }
9776 }
9778 }
9779
9781 {
9782 #ifdef SERVER
9783 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9784 GetHierarchyParent().IncreaseLifetimeUp();
9785 #endif
9786 };
9787
9789 {
9790 PlayerBase p = PlayerBase.Cast(player);
9791
9792 array<int> recipesIds = p.m_Recipes;
9793 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9794 if (moduleRecipesManager)
9795 {
9796 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
9797 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9798 }
9799
9800 for (int i = 0;i < recipesIds.Count(); i++)
9801 {
9802 int key = recipesIds.Get(i);
9803 string recipeName = moduleRecipesManager.GetRecipeName(key);
9805 }
9806 }
9807
9808
9809 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9810 {
9811 super.GetDebugActions(outputList);
9812
9813
9819
9820
9825
9830
9831
9835
9836
9838 {
9842 }
9843
9846
9847
9851
9853
9854 InventoryLocation loc = new InventoryLocation();
9855 GetInventory().GetCurrentInventoryLocation(loc);
9857 {
9858 if (Gizmo_IsSupported())
9861 }
9862
9864 }
9865
9866
9867
9868
9870 {
9871 super.OnAction(action_id, player, ctx);
9872
9874 {
9875 switch (action_id)
9876 {
9879 return true;
9882 return true;
9883 }
9884 }
9885
9887 {
9888 switch (action_id)
9889 {
9891 Delete();
9892 return true;
9893 }
9894 }
9895
9896 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9897 {
9898 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9899 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9900 PlayerBase p = PlayerBase.Cast(player);
9901 if (
EActions.RECIPES_RANGE_START < 1000)
9902 {
9903 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9904 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9905 }
9906 }
9907 #ifndef SERVER
9908 else if (action_id ==
EActions.WATCH_PLAYER)
9909 {
9910 PluginDeveloper.SetDeveloperItemClientEx(player);
9911 }
9912 #endif
9914 {
9915 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9916 {
9917 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9918 OnDebugButtonPressServer(id + 1);
9919 }
9920
9921 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9922 {
9923 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9925 }
9926
9927 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9928 {
9929 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9931 }
9932
9933 else if (action_id ==
EActions.ADD_QUANTITY)
9934 {
9935 if (IsMagazine())
9936 {
9937 Magazine mag = Magazine.Cast(this);
9938 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9939 }
9940 else
9941 {
9943 }
9944
9945 if (m_EM)
9946 {
9947 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9948 }
9949
9950 }
9951
9952 else if (action_id ==
EActions.REMOVE_QUANTITY)
9953 {
9954 if (IsMagazine())
9955 {
9956 Magazine mag2 = Magazine.Cast(this);
9957 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9958 }
9959 else
9960 {
9962 }
9963 if (m_EM)
9964 {
9965 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9966 }
9967
9968 }
9969
9970 else if (action_id ==
EActions.SET_QUANTITY_0)
9971 {
9973
9974 if (m_EM)
9975 {
9976 m_EM.SetEnergy(0);
9977 }
9978 }
9979
9980 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9981 {
9983
9984 if (m_EM)
9985 {
9986 m_EM.SetEnergy(m_EM.GetEnergyMax());
9987 }
9988 }
9989
9990 else if (action_id ==
EActions.ADD_HEALTH)
9991 {
9992 AddHealth("","",GetMaxHealth("","Health")/5);
9993 }
9994 else if (action_id ==
EActions.REMOVE_HEALTH)
9995 {
9996 AddHealth("","",-GetMaxHealth("","Health")/5);
9997 }
9998 else if (action_id ==
EActions.DESTROY_HEALTH)
9999 {
10000 SetHealth01("","",0);
10001 }
10002 else if (action_id ==
EActions.WATCH_ITEM)
10003 {
10005 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10006 #ifdef DEVELOPER
10007 SetDebugDeveloper_item(this);
10008 #endif
10009 }
10010
10011 else if (action_id ==
EActions.ADD_TEMPERATURE)
10012 {
10013 AddTemperature(20);
10014
10015 }
10016
10017 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10018 {
10019 AddTemperature(-20);
10020
10021 }
10022
10023 else if (action_id ==
EActions.FLIP_FROZEN)
10024 {
10025 SetFrozen(!GetIsFrozen());
10026
10027 }
10028
10029 else if (action_id ==
EActions.ADD_WETNESS)
10030 {
10032
10033 }
10034
10035 else if (action_id ==
EActions.REMOVE_WETNESS)
10036 {
10038
10039 }
10040
10041 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10042 {
10045
10046
10047 }
10048
10049 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10050 {
10053 }
10054
10055 else if (action_id ==
EActions.MAKE_SPECIAL)
10056 {
10057 auto debugParams = DebugSpawnParams.WithPlayer(player);
10058 OnDebugSpawnEx(debugParams);
10059 }
10060
10061 }
10062
10063
10064 return false;
10065 }
10066
10067
10068
10069
10073
10076
10077
10078
10080 {
10081 return false;
10082 }
10083
10084
10086 {
10087 return true;
10088 }
10089
10090
10092 {
10093 return true;
10094 }
10095
10096
10097
10099 {
10100 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10102 }
10103
10106 {
10107 return null;
10108 }
10109
10111 {
10112 return false;
10113 }
10114
10116 {
10117 return false;
10118 }
10119
10123
10124
10126 {
10127 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10128 return module_repairing.CanRepair(this, item_repair_kit);
10129 }
10130
10131
10132 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10133 {
10134 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10135 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10136 }
10137
10138
10140 {
10141
10142
10143
10144
10145
10146
10147
10148
10149 return 1;
10150 }
10151
10152
10153
10155 {
10157 }
10158
10159
10160
10162 {
10164 }
10165
10166
10175 {
10176 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10177
10178 if (player)
10179 {
10180 player.MessageStatus(text);
10181 }
10182 }
10183
10184
10193 {
10194 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10195
10196 if (player)
10197 {
10198 player.MessageAction(text);
10199 }
10200 }
10201
10202
10211 {
10212 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10213
10214 if (player)
10215 {
10216 player.MessageFriendly(text);
10217 }
10218 }
10219
10220
10229 {
10230 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10231
10232 if (player)
10233 {
10234 player.MessageImportant(text);
10235 }
10236 }
10237
10239 {
10240 return true;
10241 }
10242
10243
10244 override bool KindOf(
string tag)
10245 {
10246 bool found = false;
10247 string item_name = this.
GetType();
10250
10251 int array_size = item_tag_array.Count();
10252 for (int i = 0; i < array_size; i++)
10253 {
10254 if (item_tag_array.Get(i) == tag)
10255 {
10256 found = true;
10257 break;
10258 }
10259 }
10260 return found;
10261 }
10262
10263
10265 {
10266
10267 super.OnRPC(sender, rpc_type,ctx);
10268
10269
10270 switch (rpc_type)
10271 {
10272 #ifndef SERVER
10273 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10274 Param2<bool, string> p = new Param2<bool, string>(false, "");
10275
10277 return;
10278
10279 bool play = p.param1;
10280 string soundSet = p.param2;
10281
10282 if (play)
10283 {
10285 {
10287 {
10289 }
10290 }
10291 else
10292 {
10294 }
10295 }
10296 else
10297 {
10299 }
10300
10301 break;
10302 #endif
10303
10304 }
10305
10307 {
10309 }
10310 }
10311
10312
10313
10314
10316 {
10317 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10318 return plugin.GetID(
name);
10319 }
10320
10322 {
10323 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10324 return plugin.GetName(id);
10325 }
10326
10329 {
10330
10331
10332 int varFlags;
10333 if (!ctx.
Read(varFlags))
10334 return;
10335
10336 if (varFlags & ItemVariableFlags.FLOAT)
10337 {
10339 }
10340 }
10341
10343 {
10344
10345 super.SerializeNumericalVars(floats_out);
10346
10347
10348
10350 {
10352 }
10353
10355 {
10357 }
10358
10360 {
10362 }
10363
10365 {
10370 }
10371
10373 {
10375 }
10376 }
10377
10379 {
10380
10381 super.DeSerializeNumericalVars(floats);
10382
10383
10384 int index = 0;
10385 int mask = Math.Round(floats.Get(index));
10386
10387 index++;
10388
10390 {
10392 {
10394 }
10395 else
10396 {
10397 float quantity = floats.Get(index);
10398 SetQuantity(quantity,
true,
false,
false,
false);
10399 }
10400 index++;
10401 }
10402
10404 {
10405 float wet = floats.Get(index);
10407 index++;
10408 }
10409
10411 {
10412 int liquidtype = Math.Round(floats.Get(index));
10414 index++;
10415 }
10416
10418 {
10420 index++;
10422 index++;
10424 index++;
10426 index++;
10427 }
10428
10430 {
10431 int cleanness = Math.Round(floats.Get(index));
10433 index++;
10434 }
10435 }
10436
10438 {
10439 super.WriteVarsToCTX(ctx);
10440
10441
10443 {
10445 }
10446
10448 {
10450 }
10451
10453 {
10455 }
10456
10458 {
10459 int r,g,b,a;
10465 }
10466
10468 {
10470 }
10471 }
10472
10474 {
10475 if (!super.ReadVarsFromCTX(ctx,version))
10476 return false;
10477
10478 int intValue;
10479 float value;
10480
10481 if (version < 140)
10482 {
10483 if (!ctx.
Read(intValue))
10484 return false;
10485
10486 m_VariablesMask = intValue;
10487 }
10488
10490 {
10491 if (!ctx.
Read(value))
10492 return false;
10493
10495 {
10497 }
10498 else
10499 {
10501 }
10502 }
10503
10504 if (version < 140)
10505 {
10507 {
10508 if (!ctx.
Read(value))
10509 return false;
10510 SetTemperatureDirect(value);
10511 }
10512 }
10513
10515 {
10516 if (!ctx.
Read(value))
10517 return false;
10519 }
10520
10522 {
10523 if (!ctx.
Read(intValue))
10524 return false;
10526 }
10527
10529 {
10530 int r,g,b,a;
10532 return false;
10534 return false;
10536 return false;
10538 return false;
10539
10541 }
10542
10544 {
10545 if (!ctx.
Read(intValue))
10546 return false;
10548 }
10549
10550 if (version >= 138 && version < 140)
10551 {
10553 {
10554 if (!ctx.
Read(intValue))
10555 return false;
10556 SetFrozen(intValue);
10557 }
10558 }
10559
10560 return true;
10561 }
10562
10563
10565 {
10568 {
10570 }
10571
10572 if (!super.OnStoreLoad(ctx, version))
10573 {
10575 return false;
10576 }
10577
10578 if (version >= 114)
10579 {
10580 bool hasQuickBarIndexSaved;
10581
10582 if (!ctx.
Read(hasQuickBarIndexSaved))
10583 {
10585 return false;
10586 }
10587
10588 if (hasQuickBarIndexSaved)
10589 {
10590 int itmQBIndex;
10591
10592
10593 if (!ctx.
Read(itmQBIndex))
10594 {
10596 return false;
10597 }
10598
10599 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10600 if (itmQBIndex != -1 && parentPlayer)
10601 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10602 }
10603 }
10604 else
10605 {
10606
10607 PlayerBase player;
10608 int itemQBIndex;
10609 if (version ==
int.
MAX)
10610 {
10611 if (!ctx.
Read(itemQBIndex))
10612 {
10614 return false;
10615 }
10616 }
10617 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10618 {
10619
10620 if (!ctx.
Read(itemQBIndex))
10621 {
10623 return false;
10624 }
10625 if (itemQBIndex != -1 && player)
10626 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10627 }
10628 }
10629
10630 if (version < 140)
10631 {
10632
10633 if (!LoadVariables(ctx, version))
10634 {
10636 return false;
10637 }
10638 }
10639
10640
10642 {
10644 return false;
10645 }
10646 if (version >= 132)
10647 {
10649 if (raib)
10650 {
10652 {
10654 return false;
10655 }
10656 }
10657 }
10658
10660 return true;
10661 }
10662
10663
10664
10666 {
10667 super.OnStoreSave(ctx);
10668
10669 PlayerBase player;
10670 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10671 {
10673
10674 int itemQBIndex = -1;
10675 itemQBIndex = player.FindQuickBarEntityIndex(this);
10676 ctx.
Write(itemQBIndex);
10677 }
10678 else
10679 {
10681 }
10682
10684
10686 if (raib)
10687 {
10689 }
10690 }
10691
10692
10694 {
10695 super.AfterStoreLoad();
10696
10698 {
10700 }
10701
10703 {
10706 }
10707 }
10708
10710 {
10711 super.EEOnAfterLoad();
10712
10714 {
10716 }
10717
10720 }
10721
10723 {
10724 return false;
10725 }
10726
10727
10728
10730 {
10732 {
10733 #ifdef PLATFORM_CONSOLE
10734
10736 {
10738 if (menu)
10739 {
10741 }
10742 }
10743 #endif
10744 }
10745
10747 {
10750 }
10751
10753 {
10754 SetWeightDirty();
10756 }
10758 {
10761 }
10762
10764 {
10767 }
10769 {
10772 }
10773
10774 super.OnVariablesSynchronized();
10775 }
10776
10777
10778
10780 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10781 {
10782 if (!IsServerCheck(allow_client))
10783 return false;
10784
10786 return false;
10787
10790
10791 if (value <= (min + 0.001))
10792 value = min;
10793
10794 if (value == min)
10795 {
10796 if (destroy_config)
10797 {
10798 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10799 if (dstr)
10800 {
10802 this.Delete();
10803 return true;
10804 }
10805 }
10806 else if (destroy_forced)
10807 {
10809 this.Delete();
10810 return true;
10811 }
10812
10814 }
10815
10818
10820 {
10822
10823 if (delta)
10825 }
10826
10828
10829 return false;
10830 }
10831
10832
10834 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10835 {
10837 }
10838
10840 {
10843 }
10844
10846 {
10849 }
10850
10852 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10853 {
10854 float value_clamped = Math.Clamp(value, 0, 1);
10856 SetQuantity(result, destroy_config, destroy_forced);
10857 }
10858
10859
10862 {
10864 }
10865
10867 {
10869 }
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10881 {
10882 int slot = -1;
10883 if (GetInventory())
10884 {
10885 InventoryLocation il = new InventoryLocation;
10886 GetInventory().GetCurrentInventoryLocation(il);
10888 }
10889
10891 }
10892
10894 {
10895 float quantity_max = 0;
10896
10898 {
10899 if (attSlotID != -1)
10900 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10901
10902 if (quantity_max <= 0)
10904 }
10905
10906 if (quantity_max <= 0)
10908
10909 return quantity_max;
10910 }
10911
10913 {
10915 }
10916
10918 {
10920 }
10921
10922
10924 {
10926 }
10927
10929 {
10931 }
10932
10934 {
10936 }
10937
10938
10940 {
10941
10942 float weightEx = GetWeightEx();
10943 float special = GetInventoryAndCargoWeight();
10944 return weightEx - special;
10945 }
10946
10947
10949 {
10951 }
10952
10954 {
10956 {
10957 #ifdef DEVELOPER
10958 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10959 {
10960 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10962 }
10963 #endif
10964
10965 return GetQuantity() * GetConfigWeightModified();
10966 }
10967 else if (HasEnergyManager())
10968 {
10969 #ifdef DEVELOPER
10970 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10971 {
10972 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10973 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10974 }
10975 #endif
10976 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10977 }
10978 else
10979 {
10980 #ifdef DEVELOPER
10981 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10982 {
10983 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10984 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10985 }
10986 #endif
10987 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10988 }
10989 }
10990
10993 {
10994 int item_count = 0;
10996
10997 if (GetInventory().GetCargo() != NULL)
10998 {
10999 item_count = GetInventory().GetCargo().GetItemCount();
11000 }
11001
11002 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
11003 {
11004 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
11005 if (item)
11006 item_count += item.GetNumberOfItems();
11007 }
11008 return item_count;
11009 }
11010
11013 {
11014 float weight = 0;
11015 float wetness = 1;
11016 if (include_wetness)
11019 {
11020 weight = wetness * m_ConfigWeight;
11021 }
11023 {
11024 weight = 1;
11025 }
11026 return weight;
11027 }
11028
11029
11030
11032 {
11033 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
11034 {
11035 GameInventory inv = GetInventory();
11036 array<EntityAI> items = new array<EntityAI>;
11038 for (int i = 0; i < items.Count(); i++)
11039 {
11041 if (item)
11042 {
11044 }
11045 }
11046 }
11047 }
11048
11049
11050
11051
11053 {
11054 float energy = 0;
11055 if (HasEnergyManager())
11056 {
11057 energy = GetCompEM().GetEnergy();
11058 }
11059 return energy;
11060 }
11061
11062
11064 {
11065 super.OnEnergyConsumed();
11066
11068 }
11069
11071 {
11072 super.OnEnergyAdded();
11073
11075 }
11076
11077
11079 {
11080 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11081 {
11083 {
11084 float energy_0to1 = GetCompEM().GetEnergy0To1();
11086 }
11087 }
11088 }
11089
11090
11092 {
11093 return ConfigGetFloat("heatIsolation");
11094 }
11095
11097 {
11099 }
11100
11102 {
11103 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11104 if (
GetGame().ConfigIsExisting(paramPath))
11106
11107 return 0.0;
11108 }
11109
11111 {
11112 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11113 if (
GetGame().ConfigIsExisting(paramPath))
11115
11116 return 0.0;
11117 }
11118
11119 override void SetWet(
float value,
bool allow_client =
false)
11120 {
11121 if (!IsServerCheck(allow_client))
11122 return;
11123
11126
11128
11129 m_VarWet = Math.Clamp(value, min, max);
11130
11132 {
11135 }
11136 }
11137
11138 override void AddWet(
float value)
11139 {
11141 }
11142
11144 {
11146 }
11147
11149 {
11151 }
11152
11154 {
11156 }
11157
11159 {
11161 }
11162
11164 {
11166 }
11167
11168 override void OnWetChanged(
float newVal,
float oldVal)
11169 {
11172 if (newLevel != oldLevel)
11173 {
11175 }
11176 }
11177
11179 {
11180 SetWeightDirty();
11181 }
11182
11184 {
11185 return GetWetLevelInternal(
m_VarWet);
11186 }
11187
11188
11189
11191 {
11193 }
11194
11196 {
11198 }
11199
11201 {
11203 }
11204
11206 {
11208 }
11209
11210
11211
11213 {
11214 if (ConfigIsExisting("itemModelLength"))
11215 {
11216 return ConfigGetFloat("itemModelLength");
11217 }
11218 return 0;
11219 }
11220
11222 {
11223 if (ConfigIsExisting("itemAttachOffset"))
11224 {
11225 return ConfigGetFloat("itemAttachOffset");
11226 }
11227 return 0;
11228 }
11229
11230 override void SetCleanness(
int value,
bool allow_client =
false)
11231 {
11232 if (!IsServerCheck(allow_client))
11233 return;
11234
11236
11238
11241 }
11242
11244 {
11246 }
11247
11249 {
11250 return true;
11251 }
11252
11253
11254
11255
11257 {
11259 }
11260
11262 {
11264 }
11265
11266
11267
11268
11269 override void SetColor(
int r,
int g,
int b,
int a)
11270 {
11276 }
11278 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11279 {
11284 }
11285
11287 {
11289 }
11290
11293 {
11294 int r,g,b,a;
11296 r = r/255;
11297 g = g/255;
11298 b = b/255;
11299 a = a/255;
11300 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11301 }
11302
11303
11304
11305 override void SetLiquidType(
int value,
bool allow_client =
false)
11306 {
11307 if (!IsServerCheck(allow_client))
11308 return;
11309
11314 }
11315
11317 {
11318 return ConfigGetInt("varLiquidTypeInit");
11319 }
11320
11322 {
11324 }
11325
11327 {
11329 SetFrozen(false);
11330 }
11331
11334 {
11335 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11336 }
11337
11338
11341 {
11342 PlayerBase nplayer;
11343 if (PlayerBase.CastTo(nplayer, player))
11344 {
11346
11347 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11348 }
11349 }
11350
11351
11354 {
11355 PlayerBase nplayer;
11356 if (PlayerBase.CastTo(nplayer,player))
11357 {
11358
11359 nplayer.SetEnableQuickBarEntityShortcut(this,false);
11360
11361 }
11362
11363
11364 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11365
11366
11367 if (HasEnergyManager())
11368 {
11369 GetCompEM().UpdatePlugState();
11370 }
11371 }
11372
11373
11375 {
11376 super.OnPlacementStarted(player);
11377
11379 }
11380
11381 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11382 {
11384 {
11385 m_AdminLog.OnPlacementComplete(player,
this);
11386 }
11387
11388 super.OnPlacementComplete(player, position, orientation);
11389 }
11390
11391
11392
11393
11394
11396 {
11398 {
11399 return true;
11400 }
11401 else
11402 {
11403 return false;
11404 }
11405 }
11406
11407
11409 {
11411 {
11413 }
11414 }
11415
11416
11418 {
11420 }
11421
11423 {
11425 }
11426
11427 override void InsertAgent(
int agent,
float count = 1)
11428 {
11429 if (count < 1)
11430 return;
11431
11433 }
11434
11437 {
11439 }
11440
11441
11443 {
11445 }
11446
11447
11448
11449
11450
11451
11452
11453
11454
11455
11456
11457
11458
11459
11460
11461
11462
11463
11464
11465
11466
11467
11468
11469
11470
11471
11472
11473
11474
11475
11476
11477
11478
11479
11480
11481
11482
11483
11484
11485
11486
11487
11489 {
11491 return false;
11492 return true;
11493 }
11494
11496 {
11497
11499 }
11500
11501
11504 {
11505 super.CheckForRoofLimited(timeTresholdMS);
11506
11508 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11509 {
11510 m_PreviousRoofTestTime = time;
11511 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11512 }
11513 }
11514
11515
11517 {
11519 {
11520 return 0;
11521 }
11522
11523 if (GetInventory().GetAttachmentSlotsCount() != 0)
11524 {
11525 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11526 if (filter)
11527 return filter.GetProtectionLevel(type, false, system);
11528 else
11529 return 0;
11530 }
11531
11532 string subclassPath, entryName;
11533
11534 switch (type)
11535 {
11537 entryName = "biological";
11538 break;
11540 entryName = "chemical";
11541 break;
11542 default:
11543 entryName = "biological";
11544 break;
11545 }
11546
11547 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11548
11550 }
11551
11552
11553
11556 {
11557 if (!IsMagazine())
11559
11561 }
11562
11563
11564
11565
11566
11571 {
11572 return true;
11573 }
11574
11576 {
11578 }
11579
11580
11581
11582
11583
11585 {
11586 if (parent)
11587 {
11588 if (parent.IsInherited(DayZInfected))
11589 return true;
11590
11591 if (!parent.IsRuined())
11592 return true;
11593 }
11594
11595 return true;
11596 }
11597
11599 {
11600 if (!super.CanPutAsAttachment(parent))
11601 {
11602 return false;
11603 }
11604
11605 if (!IsRuined() && !parent.IsRuined())
11606 {
11607 return true;
11608 }
11609
11610 return false;
11611 }
11612
11614 {
11615
11616
11617
11618
11619 return super.CanReceiveItemIntoCargo(item);
11620 }
11621
11623 {
11624
11625
11626
11627
11628 GameInventory attachmentInv = attachment.GetInventory();
11630 {
11631 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11632 return false;
11633 }
11634
11635 InventoryLocation loc = new InventoryLocation();
11636 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11637 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11638 return false;
11639
11640 return super.CanReceiveAttachment(attachment, slotId);
11641 }
11642
11644 {
11645 if (!super.CanReleaseAttachment(attachment))
11646 return false;
11647
11648 return GetInventory().AreChildrenAccessible();
11649 }
11650
11651
11652
11653
11654
11655
11656
11657
11658
11659
11660
11661
11662
11663
11664
11665
11666
11667
11668
11669
11670
11672 {
11673 int id = muzzle_owner.GetMuzzleID();
11674 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11675
11676 if (WPOF_array)
11677 {
11678 for (int i = 0; i < WPOF_array.Count(); i++)
11679 {
11680 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11681
11682 if (WPOF)
11683 {
11684 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11685 }
11686 }
11687 }
11688 }
11689
11690
11692 {
11693 int id = muzzle_owner.GetMuzzleID();
11695
11696 if (WPOBE_array)
11697 {
11698 for (int i = 0; i < WPOBE_array.Count(); i++)
11699 {
11700 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11701
11702 if (WPOBE)
11703 {
11704 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11705 }
11706 }
11707 }
11708 }
11709
11710
11712 {
11713 int id = muzzle_owner.GetMuzzleID();
11714 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11715
11716 if (WPOOH_array)
11717 {
11718 for (int i = 0; i < WPOOH_array.Count(); i++)
11719 {
11720 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11721
11722 if (WPOOH)
11723 {
11724 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11725 }
11726 }
11727 }
11728 }
11729
11730
11732 {
11733 int id = muzzle_owner.GetMuzzleID();
11734 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11735
11736 if (WPOOH_array)
11737 {
11738 for (int i = 0; i < WPOOH_array.Count(); i++)
11739 {
11740 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11741
11742 if (WPOOH)
11743 {
11744 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11745 }
11746 }
11747 }
11748 }
11749
11750
11752 {
11753 int id = muzzle_owner.GetMuzzleID();
11754 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11755
11756 if (WPOOH_array)
11757 {
11758 for (int i = 0; i < WPOOH_array.Count(); i++)
11759 {
11760 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11761
11762 if (WPOOH)
11763 {
11764 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11765 }
11766 }
11767 }
11768 }
11769
11770
11771
11773 {
11775 {
11776 return true;
11777 }
11778
11779 return false;
11780 }
11781
11783 {
11785 {
11786 return true;
11787 }
11788
11789 return false;
11790 }
11791
11793 {
11795 {
11796 return true;
11797 }
11798
11799 return false;
11800 }
11801
11803 {
11804 return false;
11805 }
11806
11809 {
11810 return UATimeSpent.DEFAULT_DEPLOY;
11811 }
11812
11813
11814
11815
11817 {
11819 SetSynchDirty();
11820 }
11821
11823 {
11825 }
11826
11827
11829 {
11830 return false;
11831 }
11832
11835 {
11836 string att_type = "None";
11837
11838 if (ConfigIsExisting("soundAttType"))
11839 {
11840 att_type = ConfigGetString("soundAttType");
11841 }
11842
11844 }
11845
11847 {
11849 }
11850
11851
11852
11853
11854
11860
11862 {
11865
11867 }
11868
11869
11871 {
11873 return;
11874
11876
11879
11882
11883 SoundParameters params = new SoundParameters();
11887 }
11888
11889
11891 {
11893 return;
11894
11896 SetSynchDirty();
11897
11900 }
11901
11902
11904 {
11906 return;
11907
11909 SetSynchDirty();
11910
11913 }
11914
11916 {
11918 }
11919
11921 {
11923 }
11924
11927 {
11928 if (!
GetGame().IsDedicatedServer())
11929 {
11930 if (ConfigIsExisting("attachSoundSet"))
11931 {
11932 string cfg_path = "";
11933 string soundset = "";
11934 string type_name =
GetType();
11935
11938 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11939 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11940
11941 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11942 {
11943 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11944 {
11945 if (cfg_slot_array[i] == slot_type)
11946 {
11947 soundset = cfg_soundset_array[i];
11948 break;
11949 }
11950 }
11951 }
11952
11953 if (soundset != "")
11954 {
11955 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11957 }
11958 }
11959 }
11960 }
11961
11963 {
11964
11965 }
11966
11967 void OnApply(PlayerBase player);
11968
11970 {
11971 return 1.0;
11972 };
11973
11975 {
11977 }
11978
11980 {
11982 }
11983
11985
11987 {
11988 SetDynamicPhysicsLifeTime(0.01);
11990 }
11991
11993 {
11994 array<string> zone_names = new array<string>;
11995 GetDamageZones(zone_names);
11996 for (int i = 0; i < zone_names.Count(); i++)
11997 {
11998 SetHealthMax(zone_names.Get(i),"Health");
11999 }
12000 SetHealthMax("","Health");
12001 }
12002
12005 {
12006 float global_health = GetHealth01("","Health");
12007 array<string> zones = new array<string>;
12008 GetDamageZones(zones);
12009
12010 for (int i = 0; i < zones.Count(); i++)
12011 {
12012 SetHealth01(zones.Get(i),"Health",global_health);
12013 }
12014 }
12015
12018 {
12019 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12020 }
12021
12023 {
12024 if (!hasRootAsPlayer)
12025 {
12026 if (refParentIB)
12027 {
12028
12029 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12030 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12031
12032 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12033 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12034
12037 }
12038 else
12039 {
12040
12043 }
12044 }
12045 }
12046
12048 {
12050 {
12051 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12052 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12053 {
12054 float heatPermCoef = 1.0;
12056 while (ent)
12057 {
12058 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12059 ent = ent.GetHierarchyParent();
12060 }
12061
12062 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12063 }
12064 }
12065 }
12066
12068 {
12069
12070 EntityAI parent = GetHierarchyParent();
12071 if (!parent)
12072 {
12073 hasParent = false;
12074 hasRootAsPlayer = false;
12075 }
12076 else
12077 {
12078 hasParent = true;
12079 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12080 refParentIB =
ItemBase.Cast(parent);
12081 }
12082 }
12083
12084 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12085 {
12086
12087 }
12088
12090 {
12091
12092 return false;
12093 }
12094
12096 {
12097
12098
12099 return false;
12100 }
12101
12103 {
12104
12105 return false;
12106 }
12107
12110 {
12111 return !GetIsFrozen() &&
IsOpen();
12112 }
12113
12115 {
12116 bool hasParent = false, hasRootAsPlayer = false;
12118
12119 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12120 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12121
12122 if (wwtu || foodDecay)
12123 {
12127
12128 if (processWetness || processTemperature || processDecay)
12129 {
12131
12132 if (processWetness)
12133 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12134
12135 if (processTemperature)
12137
12138 if (processDecay)
12139 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12140 }
12141 }
12142 }
12143
12146 {
12148 }
12149
12151 {
12154
12155 return super.GetTemperatureFreezeThreshold();
12156 }
12157
12159 {
12162
12163 return super.GetTemperatureThawThreshold();
12164 }
12165
12167 {
12170
12171 return super.GetItemOverheatThreshold();
12172 }
12173
12175 {
12177 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12178
12179 return super.GetTemperatureFreezeTime();
12180 }
12181
12183 {
12185 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12186
12187 return super.GetTemperatureThawTime();
12188 }
12189
12194
12196 {
12197 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12198 }
12199
12201 {
12202 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12203 }
12204
12207 {
12209 }
12210
12212 {
12214 }
12215
12217 {
12219 }
12220
12223 {
12224 return null;
12225 }
12226
12229 {
12230 return false;
12231 }
12232
12234 {
12236 {
12239 if (!trg)
12240 {
12242 explosive = this;
12243 }
12244
12245 explosive.PairRemote(trg);
12247
12248 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12249 trg.SetPersistentPairID(persistentID);
12250 explosive.SetPersistentPairID(persistentID);
12251
12252 return true;
12253 }
12254 return false;
12255 }
12256
12259 {
12260 float ret = 1.0;
12263 ret *= GetHealth01();
12264
12265 return ret;
12266 }
12267
12268 #ifdef DEVELOPER
12269 override void SetDebugItem()
12270 {
12271 super.SetDebugItem();
12272 _itemBase = this;
12273 }
12274
12276 {
12277 string text = super.GetDebugText();
12278
12280 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12281
12282 return text;
12283 }
12284 #endif
12285
12287 {
12288 return true;
12289 }
12290
12292
12294
12296 {
12299 }
12300
12301
12309
12325}
12326
12328{
12330 if (entity)
12331 {
12332 bool is_item = entity.IsInherited(
ItemBase);
12333 if (is_item && full_quantity)
12334 {
12337 }
12338 }
12339 else
12340 {
12342 return NULL;
12343 }
12344 return entity;
12345}
12346
12348{
12349 if (item)
12350 {
12351 if (health > 0)
12352 item.SetHealth("", "", health);
12353
12354 if (item.CanHaveTemperature())
12355 {
12357 if (item.CanFreeze())
12358 item.SetFrozen(false);
12359 }
12360
12361 if (item.HasEnergyManager())
12362 {
12363 if (quantity >= 0)
12364 {
12365 item.GetCompEM().SetEnergy0To1(quantity);
12366 }
12367 else
12368 {
12370 }
12371 }
12372 else if (item.IsMagazine())
12373 {
12374 Magazine mag = Magazine.Cast(item);
12375 if (quantity >= 0)
12376 {
12377 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12378 }
12379 else
12380 {
12382 }
12383
12384 }
12385 else
12386 {
12387 if (quantity >= 0)
12388 {
12389 item.SetQuantityNormalized(quantity, false);
12390 }
12391 else
12392 {
12394 }
12395
12396 }
12397 }
12398}
12399
12400#ifdef DEVELOPER
12402#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
void ActionManagerBase(PlayerBase player)
map< typename, ref array< ActionBase_Basic > > TInputActionMap
void AddAction(typename actionName)
void RemoveAction(typename actionName)
TInputActionMap m_InputActionMap
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
const int ECE_PLACE_ON_SURFACE
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
Open
Implementations only.
override void EEOnCECreate()
DamageType
exposed from C++ (do not change)
PluginAdminLog m_AdminLog
override bool IsExplosive()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
static bool HasDebugActionsMask(int mask)
bool HidesSelectionBySlot()
void SplitItem(PlayerBase player)
void CopyScriptPropertiesFrom(EntityAI oldItem)
override void InsertAgent(int agent, float count=1)
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
static void SetDebugActionsMask(int mask)
void SetIsDeploySound(bool is_deploy_sound)
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
override bool IsHeavyBehaviour()
override void SetWetMax()
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
void ClearStartItemSoundServer()
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
override void RemoveAllAgentsExcept(int agent_to_keep)
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
bool CanBeMovedOverride()
override void SetWet(float value, bool allow_client=false)
ref TIntArray m_SingleUseActions
override void ProcessVariables()
ref TStringArray m_HeadHidingSelections
float GetWeightSpecialized(bool forceRecalc=false)
bool LoadAgents(ParamsReadContext ctx, int version)
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
ref array< ref OverheatingParticle > m_OverheatingParticles
override float GetTemperatureFreezeThreshold()
bool m_IsSoundSynchRemote
void StopItemSoundServer(int id)
static void ToggleDebugActionsMask(int mask)
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetTemperatureFreezeTime()
ref array< int > m_CompatibleLocks
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
float m_TemperaturePerQuantityWeight
bool m_RecipesInitialized
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
override float GetTemperatureThawThreshold()
override void OnEnergyConsumed()
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
override EWetnessLevel GetWetLevel()
float GetSingleInventoryItemWeight()
ref TIntArray m_InteractActions
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
bool CanPlayDeployLoopSound()
override float GetWetMax()
bool CanBeUsedForSuicide()
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
void StartItemSoundServer(int id)
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
bool m_CanBeMovedOverride
override string ChangeIntoOnAttach(string slot)
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
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...
override float GetQuantity()
int m_ShotsToStartOverheating
override void OnWetChanged(float newVal, float oldVal)
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void OnOverheatingDecay()
float GetDryingIncrement(string pIncrementName)
void SoundSynchRemoteReset()
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
override bool CanReleaseAttachment(EntityAI attachment)
override void OnMovedInsideCargo(EntityAI container)
void SetCEBasedQuantity()
bool m_CanPlayImpactSound
override string GetAttachmentSoundType()
float GetOverheatingCoef()
array< string > GetHeadHidingSelection()
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
override bool IsStoreLoad()
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
void SetResultOfSplit(bool value)
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
void UpdateAllOverheatingParticles()
float GetSoakingIncrement(string pIncrementName)
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetStoreLoadedQuantity()
const int ITEM_SOUNDS_MAX
float GetItemModelLength()
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
void CombineItems(ItemBase other_item, bool use_stack_max=true)
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
void TransferAgents(int agents)
transfer agents from another item
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
float GetHeatIsolationInit()
void SetCanBeMovedOverride(bool setting)
override bool HasQuantity()
bool IsCargoException4x3(EntityAI item)
ref TIntArray m_ContinuousActions
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
void LoadParticleConfigOnFire(int id)
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
override float GetWetInit()
int m_ImpactSoundSurfaceHash
int m_MaxOverheatingValue
void SetupSpawnedItem(ItemBase item, float health, float quantity)
bool ShouldSplitQuantity(float quantity)
static ref map< string, int > m_WeaponTypeToID
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
array< int > GetValidFinishers()
returns an array of possible finishers
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
ItemSoundHandler GetItemSoundHandler()
override int GetQuantityMin()
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
override int GetQuickBarBonus()
override void SetTakeable(bool pState)
float m_OverheatingDecayInterval
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
void RemoveAudioVisualsOnClient()
static void AddDebugActionsMask(int mask)
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
bool CanRepair(ItemBase item_repair_kit)
bool can_this_be_combined
EffectSound m_SoundDeploy
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
float GetDeployTime()
how long it takes to deploy this item in seconds
override bool IsSplitable()
bool DamageItemAttachments(float damage)
override void WriteVarsToCTX(ParamsWriteContext ctx)
void ConvertEnergyToQuantity()
override void RemoveAllAgents()
override void SetQuantityToMinimum()
bool m_WantPlayImpactSound
override float GetTemperatureThawTime()
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
float m_StoreLoadedQuantity
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
float GetFilterDamageRatio()
override void SetLiquidType(int value, bool allow_client=false)
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
void OnApply(PlayerBase player)
override void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
ref Timer m_CheckOverheating
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override bool IsOneHandedBehaviour()
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
override float GetSingleInventoryItemWeightEx()
void SaveAgents(ParamsWriteContext ctx)
override int GetTargetQuantityMax(int attSlotID=-1)
float GetDisinfectQuantity(int system=0, Param param1=null)
override bool IsHologram()
float GetItemAttachOffset()
static int GetDebugActionsMask()
void ProcessDecay(float delta, bool hasRootAsPlayer)
override bool IsItemBase()
override bool IsTwoHandedBehaviour()
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override void OnEnergyAdded()
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()
EffectSound m_DeployLoopSoundEx
override void DeSerializeNumericalVars(array< float > floats)
void StopItemDynamicPhysics()
override void SetStoreLoad(bool value)
float GetOverheatingValue()
bool ContainsAgent(int agent_id)
override void AddWet(float value)
override void EOnContact(IEntity other, Contact extra)
void SplitIntoStackMaxHands(PlayerBase player)
void SplitIntoStackMaxHandsClient(PlayerBase player)
ref Timer m_PhysDropTimer
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
override void SetStoreLoadedQuantity(float value)
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
void OnLiquidTypeChanged(int oldType, int newType)
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void PlayDeployFinishSound()
bool AllowFoodConsumption()
bool m_IsOverheatingEffectActive
int m_LiquidContainerMask
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override int GetCleanness()
bool PairWithDevice(notnull ItemBase otherDevice)
static void RemoveDebugActionsMask(int mask)
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void PerformDamageSystemReinit()
override void ClearInventory()
static int m_LastRegisteredWeaponID
ItemBase GetLightSourceItem()
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
override float GetItemOverheatThreshold()
void StopDeployLoopSoundEx()
override void SerializeNumericalVars(array< float > floats_out)
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
static int m_DebugActionsMask
void KillAllOverheatingParticles()
bool CanBeCookedOnStick()
override int GetQuantityMax()
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
void OnActivatedByTripWire()
override void RemoveAgent(int agent_id)
bool m_ItemBeingDroppedPhys
override bool CanPutAsAttachment(EntityAI parent)
void PlayDetachSound(string slot_type)
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override bool IsBeingPlaced()
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
bool m_FixDamageSystemInit
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
void LoadParticleConfigOnOverheating(int id)
bool IsSoundSynchRemote()
override void OnRightClick()
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
bool IsActionTargetVisible()
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
int NameToID(string name)
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
void ClearStopItemSoundServer()
override string ChangeIntoOnDetach()
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
EffectSound m_SoundDeployFinish
float GetQuantityNormalizedScripted()
override void SetCleanness(int value, bool allow_client=false)
override float GetWetMin()
ref ItemSoundHandler m_ItemSoundHandler
override bool KindOf(string tag)
void ItemSoundHandler(ItemBase parent)
EffectSound m_LockingSound
void PluginItemDiagnostic()
PluginBase GetPlugin(typename plugin_type)
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
void RemoteDetonatorTrigger()
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
override void Explode(int damageType, string ammoType="")
void OnItemLocationChanged(ItemBase item)
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
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)
proto native void GizmoSelectObject(Object object)
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto native void GizmoSelectPhysics(Physics physics)
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
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)
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
bool WriteToContext(ParamsWriteContext ctx)
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
override bool CanDisplayCargo()
override void OnInventoryEnter(Man player)
override string GetFoldSoundset()
override bool CanPutAsAttachment(EntityAI parent)
override bool CanReceiveItemIntoCargo(EntityAI item)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override void OnWasDetached(EntityAI parent, int slot_id)
override void EEOnAfterLoad()
override void EEDelete(EntityAI parent)
override bool CanBeRepairedByCrafting()
override void OnPlacementStarted(Man player)
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
override bool IsElectricAppliance()
override bool IsItemTent()
override void SetActions()
override string GetLoopFoldSoundset()
override bool CanMakeGardenplot()
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override WrittenNoteData GetWrittenNoteData()
override int GetDamageSystemVersionChange()
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
override void InitItemVariables()
override void SetActionAnimOverrides()
override void OnCreatePhysics()
override string GetDeploySoundset()
override float GetBandagingEffectivity()
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
override void OnStoreSave(ParamsWriteContext ctx)
override void AfterStoreLoad()
override int GetOnDigWormsAmount()
override bool IsSelfAdjustingTemperature()
override bool IsPlayerInside(PlayerBase player, string selection)
override void OnVariablesSynchronized()
override void RefreshPhysics()
override bool CanObstruct()
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override bool CanPutInCargo(EntityAI parent)
override string GetLoopDeploySoundset()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
override void OnInventoryExit(Man player)
override bool IsTakeable()
override bool IsIgnoredByConstruction()
override void InitItemSounds()
override void EEKilled(Object killer)
override void OnCombine(ItemBase other_item)
override bool CanExplodeInFire()
override bool IsFacingPlayer(PlayerBase player, string selection)
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
override bool IsBloodContainer()
override bool IsClothing()
override bool CanBeSplit()
override bool IsDeployable()
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
override bool CanBeDisinfected()
override float GetInfectionChance(int system=0, Param param=null)
override void OnEndPlacement()
float GetOverheatingLimitMax()
void SetOverheatingLimitMax(float max)
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
float GetOverheatingLimitMin()
void SetOverheatingLimitMin(float min)
void RegisterParticle(Particle p)
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
void SetControlledDevice(EntityAI pDevice)
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 bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
void SetCalcDetails(string details)
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Serializer ParamsReadContext
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
proto native CGame GetGame()
Serializer ParamsWriteContext
const int COMP_TYPE_ENERGY_MANAGER
void Error(string err)
Messagebox with error message.
proto native void SetColor(int color)
array< string > TStringArray
EntityEvent
Entity events for event-mask, or throwing event from code.
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
const int VARIABLE_LIQUIDTYPE
const int VARIABLE_CLEANNESS
const int VARIABLE_TEMPERATURE
const int VARIABLE_QUANTITY
static proto float AbsFloat(float f)
Returns absolute value.
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_DEBUG_ACTION
class JsonUndergroundAreaTriggerData GetPosition
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.