7605{
7607 {
7608 return true;
7609 }
7610};
7611
7613{
7614
7615};
7616
7617
7618
7620{
7624
7626
7629
7630
7631
7632
7633
7642
7648
7653
7658
7679 protected bool m_IsResultOfSplit
7680
7682
7687
7688
7689
7691
7695
7696
7697
7699
7702
7703
7704
7710
7711
7719
7722
7723
7725
7726
7728
7729
7734
7735
7740
7742
7743
7745
7746
7748 {
7753
7754 if (!
g_Game.IsDedicatedServer())
7755 {
7757 {
7759
7761 {
7763 }
7764 }
7765
7768 }
7769
7770 m_OldLocation = null;
7771
7773 {
7775 }
7776
7777 if (ConfigIsExisting("headSelectionsToHide"))
7778 {
7781 }
7782
7784 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7785 {
7787 }
7788
7790
7791 m_IsResultOfSplit = false;
7792
7794 }
7795
7797 {
7798 super.InitItemVariables();
7799
7805 m_Count = ConfigGetInt(
"count");
7806
7809
7814
7817
7822
7834
7838
7839
7842 if (ConfigIsExisting("canBeSplit"))
7843 {
7846 }
7847
7849 if (ConfigIsExisting("itemBehaviour"))
7851
7852
7855 RegisterNetSyncVariableInt("m_VarLiquidType");
7856 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7857
7858 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7859 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7860 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7861
7862 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7863 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7864 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7865 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7866
7867 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7868 RegisterNetSyncVariableBool("m_IsTakeable");
7869 RegisterNetSyncVariableBool("m_IsHologram");
7870
7873 {
7876 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7877 }
7878
7880
7882 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7884
7886 }
7887
7889 {
7891 }
7892
7894 {
7897 {
7902 }
7903 }
7904
7905 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7906 {
7908 {
7911 }
7912
7914 }
7915
7917 {
7923 }
7924
7926
7928 {
7930
7931 if (!action)
7932 {
7933 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7934 return;
7935 }
7936
7938 if (!ai)
7939 {
7941 return;
7942 }
7943
7945 if (!action_array)
7946 {
7947 action_array = new array<ActionBase_Basic>;
7949 }
7950 if (LogManager.IsActionLogEnable())
7951 {
7952 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7953 }
7954
7955 if (action_array.Find(action) != -1)
7956 {
7957 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7958 }
7959 else
7960 {
7961 action_array.Insert(action);
7962 }
7963 }
7964
7966 {
7967 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7968 ActionBase action = player.GetActionManager().GetAction(actionName);
7971
7972 if (action_array)
7973 {
7974 action_array.RemoveItem(action);
7975 }
7976 }
7977
7978
7979
7981 {
7982 ActionOverrideData overrideData = new ActionOverrideData();
7986
7988 if (!actionMap)
7989 {
7992 }
7993
7994 actionMap.Insert(this.
Type(), overrideData);
7995
7996 }
7997
7999
8001
8002
8004 {
8007
8010
8011 string config_to_search = "CfgVehicles";
8012 string muzzle_owner_config;
8013
8015 {
8016 if (IsInherited(Weapon))
8017 config_to_search = "CfgWeapons";
8018
8019 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8020
8021 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8022
8023 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8024
8025 if (config_OnFire_subclass_count > 0)
8026 {
8027 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8028
8029 for (int i = 0; i < config_OnFire_subclass_count; i++)
8030 {
8031 string particle_class = "";
8032 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8033 string config_OnFire_entry = config_OnFire_class + particle_class;
8034 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8035 WPOF_array.Insert(WPOF);
8036 }
8037
8038
8040 }
8041 }
8042
8044 {
8045 config_to_search = "CfgWeapons";
8046 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8047
8048 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8049
8050 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8051
8052 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8053 {
8054 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8055
8056 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8057 {
8058 string particle_class2 = "";
8059 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8060 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8061 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8062 WPOBE_array.Insert(WPOBE);
8063 }
8064
8065
8067 }
8068 }
8069 }
8070
8071
8073 {
8076
8078 {
8079 string config_to_search = "CfgVehicles";
8080
8081 if (IsInherited(Weapon))
8082 config_to_search = "CfgWeapons";
8083
8084 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8085 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8086
8087 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8088 {
8089
8091
8093 {
8095 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8097 return;
8098 }
8099
8102
8103
8104
8105 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8106 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8107
8108 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8109 {
8110 string particle_class = "";
8111 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8112 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8113 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8114
8115 if (entry_type == CT_CLASS)
8116 {
8117 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8118 WPOOH_array.Insert(WPOF);
8119 }
8120 }
8121
8122
8124 }
8125 }
8126 }
8127
8129 {
8131 }
8132
8134 {
8136 {
8138
8141
8144
8145 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8146 }
8147 }
8148
8150 {
8152 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8153
8155 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8156
8158 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8159
8161 {
8163 }
8164 }
8165
8167 {
8169 }
8170
8172 {
8175 else
8177
8179 {
8182 }
8183 else
8184 {
8187
8190 }
8191
8193 }
8194
8196 {
8198 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8199 }
8200
8202 {
8204 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8206 }
8207
8209 {
8211 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8212 }
8213
8215 {
8218
8219 OverheatingParticle OP = new OverheatingParticle();
8224
8226 }
8227
8229 {
8232
8233 return -1;
8234 }
8235
8237 {
8239 {
8242
8243 for (int i = count; i > 0; --i)
8244 {
8245 int id = i - 1;
8248
8251
8252 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8253 {
8254 if (p)
8255 {
8258 }
8259 }
8260 }
8261 }
8262 }
8263
8265 {
8267 {
8269 {
8270 int id = i - 1;
8272
8273 if (OP)
8274 {
8276
8277 if (p)
8278 {
8280 }
8281
8282 delete OP;
8283 }
8284 }
8285
8288 }
8289 }
8290
8293 {
8294 return 0.0;
8295 }
8296
8297
8299 {
8300 return 250;
8301 }
8302
8304 {
8305 return 0;
8306 }
8307
8310 {
8312 return true;
8313
8314 return false;
8315 }
8316
8319 {
8322
8324 {
8326 }
8327 else
8328 {
8329
8331 }
8332
8334 }
8335
8342 {
8343 return -1;
8344 }
8345
8346
8347
8348
8350 {
8352 {
8353 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8354 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8355
8356 if (r_index >= 0)
8357 {
8358 InventoryLocation r_il = new InventoryLocation;
8359 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8360
8361 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8364 {
8365 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8366 }
8368 {
8369 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8370 }
8371
8372 }
8373
8374 player.GetHumanInventory().ClearUserReservedLocation(this);
8375 }
8376
8379 }
8380
8381
8382
8383
8385 {
8386 return ItemBase.m_DebugActionsMask;
8387 }
8388
8390 {
8391 return ItemBase.m_DebugActionsMask & mask;
8392 }
8393
8395 {
8396 ItemBase.m_DebugActionsMask = mask;
8397 }
8398
8400 {
8401 ItemBase.m_DebugActionsMask |= mask;
8402 }
8403
8405 {
8406 ItemBase.m_DebugActionsMask &= ~mask;
8407 }
8408
8410 {
8412 {
8414 }
8415 else
8416 {
8418 }
8419 }
8420
8421
8423 {
8424 if (GetEconomyProfile())
8425 {
8426 float q_max = GetEconomyProfile().GetQuantityMax();
8427 if (q_max > 0)
8428 {
8429 float q_min = GetEconomyProfile().GetQuantityMin();
8430 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8431
8433 {
8434 ComponentEnergyManager comp = GetCompEM();
8436 {
8438 }
8439 }
8441 {
8443
8444 }
8445
8446 }
8447 }
8448 }
8449
8452 {
8453 EntityAI parent = GetHierarchyParent();
8454
8455 if (parent)
8456 {
8457 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8458 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8459 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8460 }
8461 }
8462
8465 {
8466 EntityAI parent = GetHierarchyParent();
8467
8468 if (parent)
8469 {
8470 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8471 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8472 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8473 }
8474 }
8475
8477 {
8478
8479
8480
8481
8483
8485 {
8486 if (ScriptInputUserData.CanStoreInputUserData())
8487 {
8488 ScriptInputUserData ctx = new ScriptInputUserData;
8494 ctx.
Write(use_stack_max);
8497
8499 {
8500 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8501 }
8502 }
8503 }
8504 else if (!
g_Game.IsMultiplayer())
8505 {
8507 }
8508 }
8509
8511 {
8513 }
8514
8516 {
8518 }
8519
8521 {
8523 }
8524
8526 {
8527
8528 return false;
8529 }
8530
8532 {
8533 return false;
8534 }
8535
8539 {
8540 return false;
8541 }
8542
8544 {
8545 return "";
8546 }
8547
8549
8551 {
8552 return false;
8553 }
8554
8556 {
8557 return true;
8558 }
8559
8560
8561
8563 {
8564 return true;
8565 }
8566
8568 {
8569 return true;
8570 }
8571
8573 {
8574 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8576 }
8577
8579 {
8581 }
8582
8584 {
8586 if (!is_being_placed)
8588 SetSynchDirty();
8589 }
8590
8591
8593
8595 {
8597 }
8598
8600 {
8602 }
8603
8605 {
8606 return 1;
8607 }
8608
8610 {
8611 return false;
8612 }
8613
8615 {
8617 SetSynchDirty();
8618 }
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8655 {
8656 super.OnMovedInsideCargo(container);
8657
8658 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8659 }
8660
8661 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8662 {
8663 super.EEItemLocationChanged(oldLoc, newLoc);
8664
8665 PlayerBase newPlayer = null;
8666 PlayerBase oldPlayer = null;
8667
8668 if (newLoc.GetParent())
8669 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8670
8671 if (oldLoc.GetParent())
8672 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8673
8675 {
8676 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8677
8678 if (rIndex >= 0)
8679 {
8680 InventoryLocation rIl = new InventoryLocation;
8681 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8682
8683 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8686 {
8687 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8688 }
8690 {
8692 }
8693
8694 }
8695 }
8696
8698 {
8699 if (newPlayer)
8700 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8701
8702 if (newPlayer == oldPlayer)
8703 {
8704 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8705 {
8707 {
8708 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8709 {
8710 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8711 }
8712 }
8713 else
8714 {
8715 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8716 }
8717 }
8718
8719 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8720 {
8721 int type = oldLoc.GetType();
8723 {
8724 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8725 }
8727 {
8728 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8729 }
8730 }
8731 if (!m_OldLocation)
8732 {
8733 m_OldLocation = new InventoryLocation;
8734 }
8735 m_OldLocation.Copy(oldLoc);
8736 }
8737 else
8738 {
8739 if (m_OldLocation)
8740 {
8741 m_OldLocation.Reset();
8742 }
8743 }
8744
8745 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8746 }
8747 else
8748 {
8749 if (newPlayer)
8750 {
8751 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8752 if (resIndex >= 0)
8753 {
8754 InventoryLocation il = new InventoryLocation;
8755 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8757 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8760 {
8761 il.
GetParent().GetOnReleaseLock().Invoke(it);
8762 }
8764 {
8766 }
8767
8768 }
8769 }
8771 {
8772
8774 }
8775
8776 if (m_OldLocation)
8777 {
8778 m_OldLocation.Reset();
8779 }
8780 }
8781
8783 {
8784 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8785 }
8786
8788 {
8789 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8790 }
8791 }
8792
8793 override void EOnContact(IEntity other, Contact extra)
8794 {
8796 {
8797 int liquidType = -1;
8799 if (impactSpeed > 0.0)
8800 {
8802 #ifndef SERVER
8804 #else
8806 SetSynchDirty();
8807 #endif
8809 }
8810 }
8811
8812 #ifdef SERVER
8813 if (GetCompEM() && GetCompEM().IsPlugged())
8814 {
8815 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8816 GetCompEM().UnplugThis();
8817 }
8818 #endif
8819 }
8820
8822
8824 {
8826 }
8827
8829 {
8830
8831 }
8832
8834 {
8835 super.OnItemLocationChanged(old_owner, new_owner);
8836
8837 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8838 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8839
8840 if (!relatedPlayer && playerNew)
8841 relatedPlayer = playerNew;
8842
8843 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8844 {
8846 if (actionMgr)
8847 {
8848 ActionBase currentAction = actionMgr.GetRunningAction();
8849 if (currentAction)
8851 }
8852 }
8853
8854 Man ownerPlayerOld = null;
8855 Man ownerPlayerNew = null;
8856
8857 if (old_owner)
8858 {
8859 if (old_owner.
IsMan())
8860 {
8861 ownerPlayerOld = Man.Cast(old_owner);
8862 }
8863 else
8864 {
8865 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8866 }
8867 }
8868 else
8869 {
8871 {
8873
8874 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8875 {
8876 GetCompEM().UnplugThis();
8877 }
8878 }
8879 }
8880
8881 if (new_owner)
8882 {
8883 if (new_owner.
IsMan())
8884 {
8885 ownerPlayerNew = Man.Cast(new_owner);
8886 }
8887 else
8888 {
8889 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8890 }
8891 }
8892
8893 if (ownerPlayerOld != ownerPlayerNew)
8894 {
8895 if (ownerPlayerOld)
8896 {
8897 array<EntityAI> subItemsExit = new array<EntityAI>;
8899 for (int i = 0; i < subItemsExit.Count(); i++)
8900 {
8903 }
8904 }
8905
8906 if (ownerPlayerNew)
8907 {
8908 array<EntityAI> subItemsEnter = new array<EntityAI>;
8910 for (int j = 0; j < subItemsEnter.Count(); j++)
8911 {
8914 }
8915 }
8916 }
8917 else if (ownerPlayerNew != null)
8918 {
8919 PlayerBase nplayer;
8920 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8921 {
8922 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8924 for (int k = 0; k < subItemsUpdate.Count(); k++)
8925 {
8927 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8928 }
8929 }
8930 }
8931
8932 if (old_owner)
8933 old_owner.OnChildItemRemoved(this);
8934 if (new_owner)
8935 new_owner.OnChildItemReceived(this);
8936 }
8937
8938
8940 {
8941 super.EEDelete(parent);
8942 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8943 if (player)
8944 {
8946
8947 if (player.IsAlive())
8948 {
8949 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8950 if (r_index >= 0)
8951 {
8952 InventoryLocation r_il = new InventoryLocation;
8953 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8954
8955 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8958 {
8959 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8960 }
8962 {
8963 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8964 }
8965
8966 }
8967
8968 player.RemoveQuickBarEntityShortcut(this);
8969 }
8970 }
8971 }
8972
8974 {
8975 super.EEKilled(killer);
8976
8979 {
8980 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8981 {
8982 if (IsMagazine())
8983 {
8984 if (Magazine.Cast(this).GetAmmoCount() > 0)
8985 {
8987 }
8988 }
8989 else
8990 {
8992 }
8993 }
8994 }
8995 }
8996
8998 {
8999 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9000
9001 super.OnWasAttached(parent, slot_id);
9002
9005
9008 }
9009
9011 {
9012 super.OnWasDetached(parent, slot_id);
9013
9016
9019 }
9020
9022 {
9023 int idx;
9026
9027 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9028 if (inventory_slots.Count() < 1)
9029 {
9030 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9031 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9032 }
9033 else
9034 {
9035 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9036 }
9037
9038 idx = inventory_slots.Find(slot);
9039 if (idx < 0)
9040 return "";
9041
9042 return attach_types.Get(idx);
9043 }
9044
9046 {
9047 int idx = -1;
9048 string slot;
9049
9052
9053 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9054 if (inventory_slots.Count() < 1)
9055 {
9056 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9057 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9058 }
9059 else
9060 {
9061 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9062 if (detach_types.Count() < 1)
9063 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9064 }
9065
9066 for (int i = 0; i < inventory_slots.Count(); i++)
9067 {
9068 slot = inventory_slots.Get(i);
9069 }
9070
9071 if (slot != "")
9072 {
9073 if (detach_types.Count() == 1)
9074 idx = 0;
9075 else
9076 idx = inventory_slots.Find(slot);
9077 }
9078 if (idx < 0)
9079 return "";
9080
9081 return detach_types.Get(idx);
9082 }
9083
9085 {
9086
9088
9089
9090 float min_time = 1;
9091 float max_time = 3;
9092 float delay = Math.RandomFloat(min_time, max_time);
9093
9094 explode_timer.Run(delay, this, "DoAmmoExplosion");
9095 }
9096
9098 {
9099 Magazine magazine = Magazine.Cast(this);
9100 int pop_sounds_count = 6;
9101 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9102
9103
9104 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9105 string sound_name = pop_sounds[ sound_idx ];
9106 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9107
9108
9109 magazine.ServerAddAmmoCount(-1);
9110
9111
9112 float min_temp_to_explode = 100;
9113
9114 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9115 {
9117 }
9118 }
9119
9120
9121 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9122 {
9123 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9124
9125 const int CHANCE_DAMAGE_CARGO = 4;
9126 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9127 const int CHANCE_DAMAGE_NOTHING = 2;
9128
9130 {
9131 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9132 int chances;
9133 int rnd;
9134
9135 if (GetInventory().GetCargo())
9136 {
9137 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9138 rnd = Math.RandomInt(0,chances);
9139
9140 if (rnd < CHANCE_DAMAGE_CARGO)
9141 {
9143 }
9144 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9145 {
9147 }
9148 }
9149 else
9150 {
9151 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9152 rnd = Math.RandomInt(0,chances);
9153
9154 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9155 {
9157 }
9158 }
9159 }
9160 }
9161
9163 {
9164 CargoBase cargo = GetInventory().GetCargo();
9165 if (cargo)
9166 {
9168 if (item_count > 0)
9169 {
9170 int random_pick = Math.RandomInt(0, item_count);
9172 if (!item.IsExplosive())
9173 {
9174 item.AddHealth("","",damage);
9175 return true;
9176 }
9177 }
9178 }
9179 return false;
9180 }
9181
9183 {
9184 GameInventory inventory = GetInventory();
9186 if (attachment_count > 0)
9187 {
9188 int random_pick = Math.RandomInt(0, attachment_count);
9190 if (!attachment.IsExplosive())
9191 {
9192 attachment.AddHealth("","",damage);
9193 return true;
9194 }
9195 }
9196 return false;
9197 }
9198
9200 {
9202 }
9203
9205 {
9207 return GetInventory().CanRemoveEntity();
9208
9209 return false;
9210 }
9211
9213 {
9214
9216 return false;
9217
9218
9220 return false;
9221
9222
9223
9225 if (delta == 0)
9226 return false;
9227
9228
9229 return true;
9230 }
9231
9233 {
9235 {
9236 if (ScriptInputUserData.CanStoreInputUserData())
9237 {
9238 ScriptInputUserData ctx = new ScriptInputUserData;
9243 ctx.
Write(destination_entity);
9247 }
9248 }
9249 else if (!
g_Game.IsMultiplayer())
9250 {
9252 }
9253 }
9254
9256 {
9257 float split_quantity_new;
9261 InventoryLocation loc = new InventoryLocation;
9262
9263 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9264 {
9266 split_quantity_new = stack_max;
9267 else
9269
9271 {
9272 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9273 if (new_item)
9274 {
9275 new_item.SetResultOfSplit(true);
9276 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9278 new_item.
SetQuantity(split_quantity_new,
false,
true);
9279 }
9280 }
9281 }
9282 else if (destination_entity && slot_id == -1)
9283 {
9284 if (quantity > stack_max)
9285 split_quantity_new = stack_max;
9286 else
9287 split_quantity_new = quantity;
9288
9290 {
9291 GameInventory destinationInventory = destination_entity.GetInventory();
9293 {
9296 }
9297
9298 if (new_item)
9299 {
9300 new_item.SetResultOfSplit(true);
9301 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9303 new_item.
SetQuantity(split_quantity_new,
false,
true);
9304 }
9305 }
9306 }
9307 else
9308 {
9309 if (stack_max != 0)
9310 {
9312 {
9314 }
9315
9316 if (split_quantity_new == 0)
9317 {
9318 if (!
g_Game.IsMultiplayer())
9319 player.PhysicalPredictiveDropItem(this);
9320 else
9321 player.ServerDropEntity(this);
9322 return;
9323 }
9324
9326 {
9328
9329 if (new_item)
9330 {
9331 new_item.SetResultOfSplit(true);
9332 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9335 new_item.PlaceOnSurface();
9336 }
9337 }
9338 }
9339 }
9340 }
9341
9343 {
9344 float split_quantity_new;
9348 InventoryLocation loc = new InventoryLocation;
9349
9350 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9351 {
9353 split_quantity_new = stack_max;
9354 else
9356
9358 {
9359 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9360 if (new_item)
9361 {
9362 new_item.SetResultOfSplit(true);
9363 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9365 new_item.
SetQuantity(split_quantity_new,
false,
true);
9366 }
9367 }
9368 }
9369 else if (destination_entity && slot_id == -1)
9370 {
9371 if (quantity > stack_max)
9372 split_quantity_new = stack_max;
9373 else
9374 split_quantity_new = quantity;
9375
9377 {
9378 GameInventory destinationInventory = destination_entity.GetInventory();
9380 {
9383 }
9384
9385 if (new_item)
9386 {
9387 new_item.SetResultOfSplit(true);
9388 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9390 new_item.
SetQuantity(split_quantity_new,
false,
true);
9391 }
9392 }
9393 }
9394 else
9395 {
9396 if (stack_max != 0)
9397 {
9399 {
9401 }
9402
9404 {
9406
9407 if (new_item)
9408 {
9409 new_item.SetResultOfSplit(true);
9410 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9413 new_item.PlaceOnSurface();
9414 }
9415 }
9416 }
9417 }
9418 }
9419
9421 {
9423 {
9424 if (ScriptInputUserData.CanStoreInputUserData())
9425 {
9426 ScriptInputUserData ctx = new ScriptInputUserData;
9431 dst.WriteToContext(ctx);
9433 }
9434 }
9435 else if (!
g_Game.IsMultiplayer())
9436 {
9438 }
9439 }
9440
9442 {
9444 {
9445 if (ScriptInputUserData.CanStoreInputUserData())
9446 {
9447 ScriptInputUserData ctx = new ScriptInputUserData;
9452 ctx.
Write(destination_entity);
9458 }
9459 }
9460 else if (!
g_Game.IsMultiplayer())
9461 {
9463 }
9464 }
9465
9467 {
9469 }
9470
9472 {
9474 float split_quantity_new;
9476 if (dst.IsValid())
9477 {
9478 int slot_id = dst.GetSlot();
9480
9481 if (quantity > stack_max)
9482 split_quantity_new = stack_max;
9483 else
9484 split_quantity_new = quantity;
9485
9487 {
9489
9490 if (new_item)
9491 {
9492 new_item.SetResultOfSplit(true);
9493 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9495 new_item.
SetQuantity(split_quantity_new,
false,
true);
9496 }
9497
9498 return new_item;
9499 }
9500 }
9501
9502 return null;
9503 }
9504
9506 {
9508 float split_quantity_new;
9510 if (destination_entity)
9511 {
9513 if (quantity > stackable)
9514 split_quantity_new = stackable;
9515 else
9516 split_quantity_new = quantity;
9517
9519 {
9520 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9521 if (new_item)
9522 {
9523 new_item.SetResultOfSplit(true);
9524 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9526 new_item.
SetQuantity(split_quantity_new,
false,
true);
9527 }
9528 }
9529 }
9530 }
9531
9533 {
9535 {
9536 if (ScriptInputUserData.CanStoreInputUserData())
9537 {
9538 ScriptInputUserData ctx = new ScriptInputUserData;
9543 ItemBase destination_entity =
this;
9544 ctx.
Write(destination_entity);
9548 }
9549 }
9550 else if (!
g_Game.IsMultiplayer())
9551 {
9553 }
9554 }
9555
9557 {
9559 float split_quantity_new;
9561 if (player)
9562 {
9564 if (quantity > stackable)
9565 split_quantity_new = stackable;
9566 else
9567 split_quantity_new = quantity;
9568
9570 {
9571 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9572 new_item =
ItemBase.Cast(in_hands);
9573 if (new_item)
9574 {
9575 new_item.SetResultOfSplit(true);
9576 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9578 new_item.SetQuantity(split_quantity_new, false, true);
9579 }
9580 }
9581 }
9582 }
9583
9585 {
9587 float split_quantity_new = Math.Floor(quantity * 0.5);
9588
9590 return;
9591
9593
9594 if (new_item)
9595 {
9596 if (new_item.GetQuantityMax() < split_quantity_new)
9597 {
9598 split_quantity_new = new_item.GetQuantityMax();
9599 }
9600
9601 new_item.SetResultOfSplit(true);
9602 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9603
9605 {
9608 }
9609 else
9610 {
9612 new_item.
SetQuantity(split_quantity_new,
false,
true);
9613 }
9614 }
9615 }
9616
9618 {
9620 float split_quantity_new = Math.Floor(quantity / 2);
9621
9623 return;
9624
9625 InventoryLocation invloc = new InventoryLocation;
9627
9629 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9630
9631 if (new_item)
9632 {
9633 if (new_item.GetQuantityMax() < split_quantity_new)
9634 {
9635 split_quantity_new = new_item.GetQuantityMax();
9636 }
9638 {
9641 }
9642 else if (split_quantity_new > 1)
9643 {
9645 new_item.
SetQuantity(split_quantity_new,
false,
true);
9646 }
9647 }
9648 }
9649
9652 {
9653 SetWeightDirty();
9655
9656 if (parent)
9657 parent.OnAttachmentQuantityChangedEx(this, delta);
9658
9660 {
9662 {
9664 }
9666 {
9667 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9669 }
9670 }
9671 }
9672
9675 {
9676
9677 }
9678
9681 {
9683 }
9684
9686 {
9687 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9688
9690 {
9691 if (newLevel == GameConstants.STATE_RUINED)
9692 {
9694 EntityAI parent = GetHierarchyParent();
9695 if (parent && parent.IsFireplace())
9696 {
9697 CargoBase cargo = GetInventory().GetCargo();
9698 if (cargo)
9699 {
9701 {
9703 }
9704 }
9705 }
9706 }
9707
9709 {
9710
9712 return;
9713 }
9714
9715 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9716 {
9718 }
9719 }
9720 }
9721
9722
9724 {
9725 super.OnRightClick();
9726
9728 {
9730 {
9731 if (ScriptInputUserData.CanStoreInputUserData())
9732 {
9733 EntityAI root = GetHierarchyRoot();
9734 Man playerOwner = GetHierarchyRootPlayer();
9735 InventoryLocation dst = new InventoryLocation;
9736
9737
9738 if (!playerOwner && root && root == this)
9739 {
9741 }
9742 else
9743 {
9744
9745 GetInventory().GetCurrentInventoryLocation(dst);
9747 {
9748 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9750 {
9752 }
9753 else
9754 {
9756
9757
9758 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9759 {
9761 }
9762 else
9763 {
9764 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9765 }
9766 }
9767 }
9768 }
9769
9770 ScriptInputUserData ctx = new ScriptInputUserData;
9778 }
9779 }
9780 else if (!
g_Game.IsMultiplayer())
9781 {
9783 }
9784 }
9785 }
9786
9788 {
9789 if (root)
9790 {
9791 vector m4[4];
9792 root.GetTransform(m4);
9793 dst.SetGround(this, m4);
9794 }
9795 else
9796 {
9797 GetInventory().GetCurrentInventoryLocation(dst);
9798 }
9799 }
9800
9801 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9802 {
9803
9804 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9805 return false;
9806
9807 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9808 return false;
9809
9810
9812 return false;
9813
9814
9815 Magazine mag = Magazine.Cast(this);
9816 if (mag)
9817 {
9818 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9819 return false;
9820
9821 if (stack_max_limit)
9822 {
9823 Magazine other_mag = Magazine.Cast(other_item);
9824 if (other_item)
9825 {
9826 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9827 return false;
9828 }
9829
9830 }
9831 }
9832 else
9833 {
9834
9836 return false;
9837
9839 return false;
9840 }
9841
9842 PlayerBase player = null;
9843 if (CastTo(player, GetHierarchyRootPlayer()))
9844 {
9845 if (player.GetInventory().HasAttachment(this))
9846 return false;
9847
9848 if (player.IsItemsToDelete())
9849 return false;
9850 }
9851
9852 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9853 return false;
9854
9855 int slotID;
9857 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9858 return false;
9859
9860 return true;
9861 }
9862
9864 {
9866 }
9867
9869 {
9870 return m_IsResultOfSplit;
9871 }
9872
9874 {
9875 m_IsResultOfSplit = value;
9876 }
9877
9879 {
9881 }
9882
9884 {
9885 float other_item_quantity = other_item.GetQuantity();
9886 float this_free_space;
9887
9889
9891
9892 if (other_item_quantity > this_free_space)
9893 {
9894 return this_free_space;
9895 }
9896 else
9897 {
9898 return other_item_quantity;
9899 }
9900 }
9901
9903 {
9905 }
9906
9908 {
9910 return;
9911
9912 if (!IsMagazine() && other_item)
9913 {
9915 if (quantity_used != 0)
9916 {
9917 float hp1 = GetHealth01("","");
9918 float hp2 = other_item.GetHealth01("","");
9919 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9920 hpResult = hpResult / (
GetQuantity() + quantity_used);
9921
9922 hpResult *= GetMaxHealth();
9923 Math.Round(hpResult);
9924 SetHealth("", "Health", hpResult);
9925
9927 other_item.AddQuantity(-quantity_used);
9928 }
9929 }
9931 }
9932
9934 {
9935 #ifdef SERVER
9936 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9937 GetHierarchyParent().IncreaseLifetimeUp();
9938 #endif
9939 };
9940
9942 {
9943 PlayerBase p = PlayerBase.Cast(player);
9944
9945 array<int> recipesIds = p.m_Recipes;
9946 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9947 if (moduleRecipesManager)
9948 {
9949 EntityAI itemInHands = player.GetEntityInHands();
9950 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9951 }
9952
9953 for (int i = 0;i < recipesIds.Count(); i++)
9954 {
9955 int key = recipesIds.Get(i);
9956 string recipeName = moduleRecipesManager.GetRecipeName(key);
9958 }
9959 }
9960
9961
9962 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9963 {
9964 super.GetDebugActions(outputList);
9965
9966
9972
9973
9978
9983
9984
9988
9989
9991 {
9995 }
9996
9999
10000
10004
10006
10007 InventoryLocation loc = new InventoryLocation();
10008 GetInventory().GetCurrentInventoryLocation(loc);
10010 {
10011 if (Gizmo_IsSupported())
10014 }
10015
10017 }
10018
10019
10020
10021
10023 {
10024 super.OnAction(action_id, player, ctx);
10025
10027 {
10028 switch (action_id)
10029 {
10033 return true;
10037 return true;
10038 }
10039 }
10040
10042 {
10043 switch (action_id)
10044 {
10046 Delete();
10047 return true;
10048 }
10049 }
10050
10051 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10052 {
10053 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10054 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10055 PlayerBase p = PlayerBase.Cast(player);
10056 if (
EActions.RECIPES_RANGE_START < 1000)
10057 {
10058 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10059 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10060 }
10061 }
10062 #ifndef SERVER
10063 else if (action_id ==
EActions.WATCH_PLAYER)
10064 {
10065 PluginDeveloper.SetDeveloperItemClientEx(player);
10066 }
10067 #endif
10069 {
10070 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10071 {
10072 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10073 OnDebugButtonPressServer(id + 1);
10074 }
10075
10076 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10077 {
10078 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10080 }
10081
10082 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10083 {
10084 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10086 }
10087
10088 else if (action_id ==
EActions.ADD_QUANTITY)
10089 {
10090 if (IsMagazine())
10091 {
10092 Magazine mag = Magazine.Cast(this);
10093 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10094 }
10095 else
10096 {
10098 }
10099
10100 if (m_EM)
10101 {
10102 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10103 }
10104
10105 }
10106
10107 else if (action_id ==
EActions.REMOVE_QUANTITY)
10108 {
10109 if (IsMagazine())
10110 {
10111 Magazine mag2 = Magazine.Cast(this);
10112 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10113 }
10114 else
10115 {
10117 }
10118 if (m_EM)
10119 {
10120 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10121 }
10122
10123 }
10124
10125 else if (action_id ==
EActions.SET_QUANTITY_0)
10126 {
10128
10129 if (m_EM)
10130 {
10131 m_EM.SetEnergy(0);
10132 }
10133 }
10134
10135 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10136 {
10138
10139 if (m_EM)
10140 {
10141 m_EM.SetEnergy(m_EM.GetEnergyMax());
10142 }
10143 }
10144
10145 else if (action_id ==
EActions.ADD_HEALTH)
10146 {
10147 AddHealth("","",GetMaxHealth("","Health")/5);
10148 }
10149 else if (action_id ==
EActions.REMOVE_HEALTH)
10150 {
10151 AddHealth("","",-GetMaxHealth("","Health")/5);
10152 }
10153 else if (action_id ==
EActions.DESTROY_HEALTH)
10154 {
10155 SetHealth01("","",0);
10156 }
10157 else if (action_id ==
EActions.WATCH_ITEM)
10158 {
10160 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10161 #ifdef DEVELOPER
10162 SetDebugDeveloper_item(this);
10163 #endif
10164 }
10165
10166 else if (action_id ==
EActions.ADD_TEMPERATURE)
10167 {
10168 AddTemperature(20);
10169
10170 }
10171
10172 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10173 {
10174 AddTemperature(-20);
10175
10176 }
10177
10178 else if (action_id ==
EActions.FLIP_FROZEN)
10179 {
10180 SetFrozen(!GetIsFrozen());
10181
10182 }
10183
10184 else if (action_id ==
EActions.ADD_WETNESS)
10185 {
10187
10188 }
10189
10190 else if (action_id ==
EActions.REMOVE_WETNESS)
10191 {
10193
10194 }
10195
10196 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10197 {
10200
10201
10202 }
10203
10204 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10205 {
10208 }
10209
10210 else if (action_id ==
EActions.MAKE_SPECIAL)
10211 {
10212 auto debugParams = DebugSpawnParams.WithPlayer(player);
10213 OnDebugSpawnEx(debugParams);
10214 }
10215
10216 }
10217
10218
10219 return false;
10220 }
10221
10222
10223
10224
10228
10231
10232
10233
10235 {
10236 return false;
10237 }
10238
10239
10241 {
10242 return true;
10243 }
10244
10245
10247 {
10248 return true;
10249 }
10250
10251
10252
10254 {
10255 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10256 return g_Game.ConfigIsExisting(config_path);
10257 }
10258
10261 {
10262 return null;
10263 }
10264
10266 {
10267 return false;
10268 }
10269
10271 {
10272 return false;
10273 }
10274
10278
10279
10281 {
10282 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10283 return module_repairing.CanRepair(this, item_repair_kit);
10284 }
10285
10286
10287 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10288 {
10289 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10290 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10291 }
10292
10293
10295 {
10296
10297
10298
10299
10300
10301
10302
10303
10304 return 1;
10305 }
10306
10307
10308
10310 {
10312 }
10313
10314
10315
10317 {
10319 }
10320
10321
10330 {
10331 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10332
10333 if (player)
10334 {
10335 player.MessageStatus(text);
10336 }
10337 }
10338
10339
10348 {
10349 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10350
10351 if (player)
10352 {
10353 player.MessageAction(text);
10354 }
10355 }
10356
10357
10366 {
10367 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10368
10369 if (player)
10370 {
10371 player.MessageFriendly(text);
10372 }
10373 }
10374
10375
10384 {
10385 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10386
10387 if (player)
10388 {
10389 player.MessageImportant(text);
10390 }
10391 }
10392
10394 {
10395 return true;
10396 }
10397
10398
10399 override bool KindOf(
string tag)
10400 {
10401 bool found = false;
10402 string item_name = this.
GetType();
10404 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10405
10406 int array_size = item_tag_array.Count();
10407 for (int i = 0; i < array_size; i++)
10408 {
10409 if (item_tag_array.Get(i) == tag)
10410 {
10411 found = true;
10412 break;
10413 }
10414 }
10415 return found;
10416 }
10417
10418
10420 {
10421
10422 super.OnRPC(sender, rpc_type,ctx);
10423
10424
10425 switch (rpc_type)
10426 {
10427 #ifndef SERVER
10428 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10429 Param2<bool, string> p = new Param2<bool, string>(false, "");
10430
10432 return;
10433
10434 bool play = p.param1;
10435 string soundSet = p.param2;
10436
10437 if (play)
10438 {
10440 {
10442 {
10444 }
10445 }
10446 else
10447 {
10449 }
10450 }
10451 else
10452 {
10454 }
10455
10456 break;
10457 #endif
10458
10459 }
10460
10462 {
10464 }
10465 }
10466
10467
10468
10469
10471 {
10472 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10473 return plugin.GetID(
name);
10474 }
10475
10477 {
10478 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10479 return plugin.GetName(id);
10480 }
10481
10484 {
10485
10486
10487 int varFlags;
10488 if (!ctx.
Read(varFlags))
10489 return;
10490
10491 if (varFlags & ItemVariableFlags.FLOAT)
10492 {
10494 }
10495 }
10496
10498 {
10499
10500 super.SerializeNumericalVars(floats_out);
10501
10502
10503
10505 {
10507 }
10508
10510 {
10512 }
10513
10515 {
10517 }
10518
10520 {
10525 }
10526
10528 {
10530 }
10531 }
10532
10534 {
10535
10536 super.DeSerializeNumericalVars(floats);
10537
10538
10539 int index = 0;
10540 int mask = Math.Round(floats.Get(index));
10541
10542 index++;
10543
10545 {
10547 {
10549 }
10550 else
10551 {
10552 float quantity = floats.Get(index);
10553 SetQuantity(quantity,
true,
false,
false,
false);
10554 }
10555 index++;
10556 }
10557
10559 {
10560 float wet = floats.Get(index);
10562 index++;
10563 }
10564
10566 {
10567 int liquidtype = Math.Round(floats.Get(index));
10569 index++;
10570 }
10571
10573 {
10575 index++;
10577 index++;
10579 index++;
10581 index++;
10582 }
10583
10585 {
10586 int cleanness = Math.Round(floats.Get(index));
10588 index++;
10589 }
10590 }
10591
10593 {
10594 super.WriteVarsToCTX(ctx);
10595
10596
10598 {
10600 }
10601
10603 {
10605 }
10606
10608 {
10610 }
10611
10613 {
10614 int r,g,b,a;
10620 }
10621
10623 {
10625 }
10626 }
10627
10629 {
10630 if (!super.ReadVarsFromCTX(ctx,version))
10631 return false;
10632
10633 int intValue;
10634 float value;
10635
10636 if (version < 140)
10637 {
10638 if (!ctx.
Read(intValue))
10639 return false;
10640
10641 m_VariablesMask = intValue;
10642 }
10643
10645 {
10646 if (!ctx.
Read(value))
10647 return false;
10648
10650 {
10652 }
10653 else
10654 {
10656 }
10657 }
10658
10659 if (version < 140)
10660 {
10662 {
10663 if (!ctx.
Read(value))
10664 return false;
10665 SetTemperatureDirect(value);
10666 }
10667 }
10668
10670 {
10671 if (!ctx.
Read(value))
10672 return false;
10674 }
10675
10677 {
10678 if (!ctx.
Read(intValue))
10679 return false;
10681 }
10682
10684 {
10685 int r,g,b,a;
10687 return false;
10689 return false;
10691 return false;
10693 return false;
10694
10696 }
10697
10699 {
10700 if (!ctx.
Read(intValue))
10701 return false;
10703 }
10704
10705 if (version >= 138 && version < 140)
10706 {
10708 {
10709 if (!ctx.
Read(intValue))
10710 return false;
10711 SetFrozen(intValue);
10712 }
10713 }
10714
10715 return true;
10716 }
10717
10718
10720 {
10723 {
10725 }
10726
10727 if (!super.OnStoreLoad(ctx, version))
10728 {
10730 return false;
10731 }
10732
10733 if (version >= 114)
10734 {
10735 bool hasQuickBarIndexSaved;
10736
10737 if (!ctx.
Read(hasQuickBarIndexSaved))
10738 {
10740 return false;
10741 }
10742
10743 if (hasQuickBarIndexSaved)
10744 {
10745 int itmQBIndex;
10746
10747
10748 if (!ctx.
Read(itmQBIndex))
10749 {
10751 return false;
10752 }
10753
10754 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10755 if (itmQBIndex != -1 && parentPlayer)
10756 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10757 }
10758 }
10759 else
10760 {
10761
10762 PlayerBase player;
10763 int itemQBIndex;
10764 if (version ==
int.
MAX)
10765 {
10766 if (!ctx.
Read(itemQBIndex))
10767 {
10769 return false;
10770 }
10771 }
10772 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10773 {
10774
10775 if (!ctx.
Read(itemQBIndex))
10776 {
10778 return false;
10779 }
10780 if (itemQBIndex != -1 && player)
10781 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10782 }
10783 }
10784
10785 if (version < 140)
10786 {
10787
10788 if (!LoadVariables(ctx, version))
10789 {
10791 return false;
10792 }
10793 }
10794
10795
10797 {
10799 return false;
10800 }
10801 if (version >= 132)
10802 {
10804 if (raib)
10805 {
10807 {
10809 return false;
10810 }
10811 }
10812 }
10813
10815 return true;
10816 }
10817
10818
10819
10821 {
10822 super.OnStoreSave(ctx);
10823
10824 PlayerBase player;
10825 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10826 {
10828
10829 int itemQBIndex = -1;
10830 itemQBIndex = player.FindQuickBarEntityIndex(this);
10831 ctx.
Write(itemQBIndex);
10832 }
10833 else
10834 {
10836 }
10837
10839
10841 if (raib)
10842 {
10844 }
10845 }
10846
10847
10849 {
10850 super.AfterStoreLoad();
10851
10853 {
10855 }
10856
10858 {
10861 }
10862 }
10863
10865 {
10866 super.EEOnAfterLoad();
10867
10869 {
10871 }
10872
10875 }
10876
10878 {
10879 return false;
10880 }
10881
10882
10883
10885 {
10887 {
10888 #ifdef PLATFORM_CONSOLE
10889
10891 {
10893 if (menu)
10894 {
10896 }
10897 }
10898 #endif
10899 }
10900
10902 {
10905 }
10906
10908 {
10909 SetWeightDirty();
10911 }
10913 {
10916 }
10917
10919 {
10922
10925 }
10927 {
10931 }
10932
10933 super.OnVariablesSynchronized();
10934 }
10935
10936
10937
10939 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10940 {
10941 if (!IsServerCheck(allow_client))
10942 return false;
10943
10945 return false;
10946
10949
10950 if (value <= (min + 0.001))
10951 value = min;
10952
10953 if (value == min)
10954 {
10955 if (destroy_config)
10956 {
10957 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10958 if (dstr)
10959 {
10961 this.Delete();
10962 return true;
10963 }
10964 }
10965 else if (destroy_forced)
10966 {
10968 this.Delete();
10969 return true;
10970 }
10971
10973 }
10974
10977
10979 {
10980 EntityAI parent = GetHierarchyRoot();
10981 InventoryLocation iLoc = new InventoryLocation();
10982 GetInventory().GetCurrentInventoryLocation(iLoc);
10984 {
10985 int iLocSlot = iLoc.
GetSlot();
10987 {
10989 }
10991 {
10993 }
10994 }
10995 }
10996
10998 {
11000
11001 if (delta)
11003 }
11004
11006
11007 return false;
11008 }
11009
11010
11012 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11013 {
11015 }
11016
11018 {
11021 }
11022
11024 {
11027 }
11028
11030 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11031 {
11032 float value_clamped = Math.Clamp(value, 0, 1);
11034 SetQuantity(result, destroy_config, destroy_forced);
11035 }
11036
11037
11040 {
11042 }
11043
11045 {
11047 }
11048
11049
11050
11051
11052
11053
11054
11055
11056
11057
11059 {
11060 int slot = -1;
11061 GameInventory inventory = GetInventory();
11062 if (inventory)
11063 {
11064 InventoryLocation il = new InventoryLocation;
11067 }
11068
11070 }
11071
11073 {
11074 float quantity_max = 0;
11075
11077 {
11078 if (attSlotID != -1)
11079 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11080
11081 if (quantity_max <= 0)
11083 }
11084
11085 if (quantity_max <= 0)
11087
11088 return quantity_max;
11089 }
11090
11092 {
11094 }
11095
11097 {
11099 }
11100
11101
11103 {
11105 }
11106
11108 {
11110 }
11111
11113 {
11115 }
11116
11117
11119 {
11120
11121 float weightEx = GetWeightEx();
11122 float special = GetInventoryAndCargoWeight();
11123 return weightEx - special;
11124 }
11125
11126
11128 {
11130 }
11131
11133 {
11135 {
11136 #ifdef DEVELOPER
11137 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11138 {
11139 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11141 }
11142 #endif
11143
11144 return GetQuantity() * GetConfigWeightModified();
11145 }
11146 else if (HasEnergyManager())
11147 {
11148 #ifdef DEVELOPER
11149 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11150 {
11151 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11152 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11153 }
11154 #endif
11155 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11156 }
11157 else
11158 {
11159 #ifdef DEVELOPER
11160 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11161 {
11162 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11163 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11164 }
11165 #endif
11166 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11167 }
11168 }
11169
11172 {
11173 int item_count = 0;
11175
11176 GameInventory inventory = GetInventory();
11177 CargoBase cargo = inventory.
GetCargo();
11178 if (cargo != NULL)
11179 {
11181 }
11182
11184 for (int i = 0; i < nAttachments; ++i)
11185 {
11187 if (item)
11188 item_count += item.GetNumberOfItems();
11189 }
11190 return item_count;
11191 }
11192
11195 {
11196 float weight = 0;
11197 float wetness = 1;
11198 if (include_wetness)
11201 {
11202 weight = wetness * m_ConfigWeight;
11203 }
11205 {
11206 weight = 1;
11207 }
11208 return weight;
11209 }
11210
11211
11212
11214 {
11215 GameInventory inventory = GetInventory();
11216 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11217 {
11218 array<EntityAI> items = new array<EntityAI>;
11220 for (int i = 0; i < items.Count(); ++i)
11221 {
11223 if (item)
11224 {
11225 g_Game.ObjectDelete(item);
11226 }
11227 }
11228 }
11229 }
11230
11231
11232
11233
11235 {
11236 float energy = 0;
11237 if (HasEnergyManager())
11238 {
11239 energy = GetCompEM().GetEnergy();
11240 }
11241 return energy;
11242 }
11243
11244
11246 {
11247 super.OnEnergyConsumed();
11248
11250 }
11251
11253 {
11254 super.OnEnergyAdded();
11255
11257 }
11258
11259
11261 {
11262 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11263 {
11265 {
11266 float energy_0to1 = GetCompEM().GetEnergy0To1();
11268 }
11269 }
11270 }
11271
11272
11274 {
11275 return ConfigGetFloat("heatIsolation");
11276 }
11277
11279 {
11281 }
11282
11284 {
11285 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11286 if (
g_Game.ConfigIsExisting(paramPath))
11287 return g_Game.ConfigGetFloat(paramPath);
11288
11289 return 0.0;
11290 }
11291
11293 {
11294 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11295 if (
g_Game.ConfigIsExisting(paramPath))
11296 return g_Game.ConfigGetFloat(paramPath);
11297
11298 return 0.0;
11299 }
11300
11301 override void SetWet(
float value,
bool allow_client =
false)
11302 {
11303 if (!IsServerCheck(allow_client))
11304 return;
11305
11308
11310
11311 m_VarWet = Math.Clamp(value, min, max);
11312
11314 {
11317 }
11318 }
11319
11320 override void AddWet(
float value)
11321 {
11323 }
11324
11326 {
11328 }
11329
11331 {
11333 }
11334
11336 {
11338 }
11339
11341 {
11343 }
11344
11346 {
11348 }
11349
11350 override void OnWetChanged(
float newVal,
float oldVal)
11351 {
11354 if (newLevel != oldLevel)
11355 {
11357 }
11358 }
11359
11361 {
11362 SetWeightDirty();
11363 }
11364
11366 {
11367 return GetWetLevelInternal(
m_VarWet);
11368 }
11369
11370
11371
11373 {
11375 }
11376
11378 {
11380 }
11381
11383 {
11385 }
11386
11388 {
11390 }
11391
11392
11393
11395 {
11396 if (ConfigIsExisting("itemModelLength"))
11397 {
11398 return ConfigGetFloat("itemModelLength");
11399 }
11400 return 0;
11401 }
11402
11404 {
11405 if (ConfigIsExisting("itemAttachOffset"))
11406 {
11407 return ConfigGetFloat("itemAttachOffset");
11408 }
11409 return 0;
11410 }
11411
11412 override void SetCleanness(
int value,
bool allow_client =
false)
11413 {
11414 if (!IsServerCheck(allow_client))
11415 return;
11416
11418
11420
11423 }
11424
11426 {
11428 }
11429
11431 {
11432 return true;
11433 }
11434
11435
11436
11437
11439 {
11441 }
11442
11444 {
11446 }
11447
11448
11449
11450
11451 override void SetColor(
int r,
int g,
int b,
int a)
11452 {
11458 }
11460 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11461 {
11466 }
11467
11469 {
11471 }
11472
11475 {
11476 int r,g,b,a;
11478 r = r/255;
11479 g = g/255;
11480 b = b/255;
11481 a = a/255;
11482 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11483 }
11484
11485
11486
11487 override void SetLiquidType(
int value,
bool allow_client =
false)
11488 {
11489 if (!IsServerCheck(allow_client))
11490 return;
11491
11496 }
11497
11499 {
11500 return ConfigGetInt("varLiquidTypeInit");
11501 }
11502
11504 {
11506 }
11507
11509 {
11511 SetFrozen(false);
11512 }
11513
11516 {
11517 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11518 }
11519
11520
11523 {
11524 PlayerBase nplayer;
11525 if (PlayerBase.CastTo(nplayer, player))
11526 {
11528 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11529 }
11530 }
11531
11532
11535 {
11536 PlayerBase nplayer;
11537 if (PlayerBase.CastTo(nplayer,player))
11538 {
11539 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11540 }
11541
11542 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11543
11544 if (HasEnergyManager())
11545 {
11546 GetCompEM().UpdatePlugState();
11547 }
11548 }
11549
11550
11552 {
11553 super.OnPlacementStarted(player);
11554
11556 }
11557
11558 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11559 {
11561 {
11562 m_AdminLog.OnPlacementComplete(player,
this);
11563 }
11564
11565 super.OnPlacementComplete(player, position, orientation);
11566 }
11567
11568
11569
11570
11571
11573 {
11575 {
11576 return true;
11577 }
11578 else
11579 {
11580 return false;
11581 }
11582 }
11583
11584
11586 {
11588 {
11590 }
11591 }
11592
11593
11595 {
11597 }
11598
11600 {
11602 }
11603
11604 override void InsertAgent(
int agent,
float count = 1)
11605 {
11606 if (count < 1)
11607 return;
11608
11610 }
11611
11614 {
11616 }
11617
11618
11620 {
11622 }
11623
11624
11625
11626
11627
11628
11629
11630
11631
11632
11633
11634
11635
11636
11637
11638
11639
11640
11641
11642
11643
11644
11645
11646
11647
11648
11649
11650
11651
11652
11653
11654
11655
11656
11657
11658
11659
11660
11661
11662
11663
11664
11666 {
11668 return false;
11669 return true;
11670 }
11671
11673 {
11674
11676 }
11677
11678
11681 {
11682 super.CheckForRoofLimited(timeTresholdMS);
11683
11684 float time =
g_Game.GetTime();
11685 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11686 {
11687 m_PreviousRoofTestTime = time;
11688 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11689 }
11690 }
11691
11692
11694 {
11696 {
11697 return 0;
11698 }
11699
11700 if (GetInventory().GetAttachmentSlotsCount() != 0)
11701 {
11702 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11703 if (filter)
11704 return filter.GetProtectionLevel(type, false, system);
11705 else
11706 return 0;
11707 }
11708
11709 string subclassPath, entryName;
11710
11711 switch (type)
11712 {
11714 entryName = "biological";
11715 break;
11717 entryName = "chemical";
11718 break;
11719 default:
11720 entryName = "biological";
11721 break;
11722 }
11723
11724 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11725
11726 return g_Game.ConfigGetFloat(subclassPath + entryName);
11727 }
11728
11729
11730
11733 {
11734 if (!IsMagazine())
11736
11738 }
11739
11740
11741
11742
11743
11748 {
11749 return true;
11750 }
11751
11753 {
11755 }
11756
11757
11758
11759
11760
11762 {
11763 if (parent)
11764 {
11765 if (parent.IsInherited(DayZInfected))
11766 return true;
11767
11768 if (!parent.IsRuined())
11769 return true;
11770 }
11771
11772 return true;
11773 }
11774
11776 {
11777 if (!super.CanPutAsAttachment(parent))
11778 {
11779 return false;
11780 }
11781
11782 if (!IsRuined() && !parent.IsRuined())
11783 {
11784 return true;
11785 }
11786
11787 return false;
11788 }
11789
11791 {
11792
11793
11794
11795
11796 return super.CanReceiveItemIntoCargo(item);
11797 }
11798
11800 {
11801
11802
11803
11804
11805 GameInventory attachmentInv = attachment.GetInventory();
11807 {
11808 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11809 return false;
11810 }
11811
11812 InventoryLocation loc = new InventoryLocation();
11813 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11814 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11815 return false;
11816
11817 return super.CanReceiveAttachment(attachment, slotId);
11818 }
11819
11821 {
11822 if (!super.CanReleaseAttachment(attachment))
11823 return false;
11824
11825 return GetInventory().AreChildrenAccessible();
11826 }
11827
11828
11829
11830
11831
11832
11833
11834
11835
11836
11837
11838
11839
11840
11841
11842
11843
11844
11845
11846
11847
11849 {
11850 int id = muzzle_owner.GetMuzzleID();
11851 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11852
11853 if (WPOF_array)
11854 {
11855 for (int i = 0; i < WPOF_array.Count(); i++)
11856 {
11857 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11858
11859 if (WPOF)
11860 {
11861 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11862 }
11863 }
11864 }
11865 }
11866
11867
11869 {
11870 int id = muzzle_owner.GetMuzzleID();
11872
11873 if (WPOBE_array)
11874 {
11875 for (int i = 0; i < WPOBE_array.Count(); i++)
11876 {
11877 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11878
11879 if (WPOBE)
11880 {
11881 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11882 }
11883 }
11884 }
11885 }
11886
11887
11889 {
11890 int id = muzzle_owner.GetMuzzleID();
11891 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11892
11893 if (WPOOH_array)
11894 {
11895 for (int i = 0; i < WPOOH_array.Count(); i++)
11896 {
11897 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11898
11899 if (WPOOH)
11900 {
11901 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11902 }
11903 }
11904 }
11905 }
11906
11907
11909 {
11910 int id = muzzle_owner.GetMuzzleID();
11911 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11912
11913 if (WPOOH_array)
11914 {
11915 for (int i = 0; i < WPOOH_array.Count(); i++)
11916 {
11917 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11918
11919 if (WPOOH)
11920 {
11921 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11922 }
11923 }
11924 }
11925 }
11926
11927
11929 {
11930 int id = muzzle_owner.GetMuzzleID();
11931 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11932
11933 if (WPOOH_array)
11934 {
11935 for (int i = 0; i < WPOOH_array.Count(); i++)
11936 {
11937 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11938
11939 if (WPOOH)
11940 {
11941 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11942 }
11943 }
11944 }
11945 }
11946
11947
11948
11950 {
11952 {
11953 return true;
11954 }
11955
11956 return false;
11957 }
11958
11960 {
11962 {
11963 return true;
11964 }
11965
11966 return false;
11967 }
11968
11970 {
11972 {
11973 return true;
11974 }
11975
11976 return false;
11977 }
11978
11980 {
11981 return false;
11982 }
11983
11986 {
11987 return UATimeSpent.DEFAULT_DEPLOY;
11988 }
11989
11990
11991
11992
11994 {
11996 SetSynchDirty();
11997 }
11998
12000 {
12002 }
12003
12004
12006 {
12007 return false;
12008 }
12009
12012 {
12013 string att_type = "None";
12014
12015 if (ConfigIsExisting("soundAttType"))
12016 {
12017 att_type = ConfigGetString("soundAttType");
12018 }
12019
12021 }
12022
12024 {
12026 }
12027
12028
12029
12030
12031
12037
12039 {
12042
12044 }
12045
12046
12048 {
12050 return;
12051
12053
12056
12059
12060 SoundParameters params = new SoundParameters();
12064 }
12065
12066
12068 {
12070 {
12073
12074 SetSynchDirty();
12075
12078 }
12079 }
12080
12082 {
12084 }
12085
12086
12088 {
12090 return;
12091
12093 SetSynchDirty();
12094
12097 }
12098
12100 {
12103 }
12104
12106 {
12108 }
12109
12110 void OnApply(PlayerBase player);
12111
12113 {
12114 return 1.0;
12115 };
12116
12118 {
12120 }
12121
12123 {
12125 }
12126
12128
12130 {
12131 SetDynamicPhysicsLifeTime(0.01);
12133 }
12134
12136 {
12137 array<string> zone_names = new array<string>;
12138 GetDamageZones(zone_names);
12139 for (int i = 0; i < zone_names.Count(); i++)
12140 {
12141 SetHealthMax(zone_names.Get(i),"Health");
12142 }
12143 SetHealthMax("","Health");
12144 }
12145
12148 {
12149 float global_health = GetHealth01("","Health");
12150 array<string> zones = new array<string>;
12151 GetDamageZones(zones);
12152
12153 for (int i = 0; i < zones.Count(); i++)
12154 {
12155 SetHealth01(zones.Get(i),"Health",global_health);
12156 }
12157 }
12158
12161 {
12162 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12163 }
12164
12166 {
12167 if (!hasRootAsPlayer)
12168 {
12169 if (refParentIB)
12170 {
12171
12172 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12173 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12174
12175 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12176 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12177
12180 }
12181 else
12182 {
12183
12186 }
12187 }
12188 }
12189
12191 {
12193 {
12194 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12195 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12196 {
12197 float heatPermCoef = 1.0;
12199 while (ent)
12200 {
12201 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12202 ent = ent.GetHierarchyParent();
12203 }
12204
12205 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12206 }
12207 }
12208 }
12209
12211 {
12212
12213 EntityAI parent = GetHierarchyParent();
12214 if (!parent)
12215 {
12216 hasParent = false;
12217 hasRootAsPlayer = false;
12218 }
12219 else
12220 {
12221 hasParent = true;
12222 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12223 refParentIB =
ItemBase.Cast(parent);
12224 }
12225 }
12226
12227 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12228 {
12229
12230 }
12231
12233 {
12234
12235 return false;
12236 }
12237
12239 {
12240
12241
12242 return false;
12243 }
12244
12246 {
12247
12248 return false;
12249 }
12250
12253 {
12254 return !GetIsFrozen() &&
IsOpen();
12255 }
12256
12258 {
12259 bool hasParent = false, hasRootAsPlayer = false;
12261
12262 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12263 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12264
12265 if (wwtu || foodDecay)
12266 {
12270
12271 if (processWetness || processTemperature || processDecay)
12272 {
12274
12275 if (processWetness)
12276 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12277
12278 if (processTemperature)
12280
12281 if (processDecay)
12282 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12283 }
12284 }
12285 }
12286
12289 {
12291 }
12292
12294 {
12297
12298 return super.GetTemperatureFreezeThreshold();
12299 }
12300
12302 {
12305
12306 return super.GetTemperatureThawThreshold();
12307 }
12308
12310 {
12313
12314 return super.GetItemOverheatThreshold();
12315 }
12316
12318 {
12320 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12321
12322 return super.GetTemperatureFreezeTime();
12323 }
12324
12326 {
12328 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12329
12330 return super.GetTemperatureThawTime();
12331 }
12332
12337
12339 {
12340 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12341 }
12342
12344 {
12345 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12346 }
12347
12350 {
12352 }
12353
12355 {
12357 }
12358
12360 {
12362 }
12363
12366 {
12367 return null;
12368 }
12369
12372 {
12373 return false;
12374 }
12375
12377 {
12379 {
12382 if (!trg)
12383 {
12385 explosive = this;
12386 }
12387
12388 explosive.PairRemote(trg);
12390
12391 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12392 trg.SetPersistentPairID(persistentID);
12393 explosive.SetPersistentPairID(persistentID);
12394
12395 return true;
12396 }
12397 return false;
12398 }
12399
12402 {
12403 float ret = 1.0;
12406 ret *= GetHealth01();
12407
12408 return ret;
12409 }
12410
12411 #ifdef DEVELOPER
12412 override void SetDebugItem()
12413 {
12414 super.SetDebugItem();
12415 _itemBase = this;
12416 }
12417
12419 {
12420 string text = super.GetDebugText();
12421
12423 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12424
12425 return text;
12426 }
12427 #endif
12428
12430 {
12431 return true;
12432 }
12433
12435
12437
12439 {
12442 }
12443
12444
12452
12468
12469 [
Obsolete(
"Use ItemSoundHandler instead")]
12472 {
12473 if (!
g_Game.IsDedicatedServer())
12474 {
12475 if (ConfigIsExisting("attachSoundSet"))
12476 {
12477 string cfg_path = "";
12478 string soundset = "";
12479 string type_name =
GetType();
12480
12483 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12484 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12485
12486 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12487 {
12488 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12489 {
12490 if (cfg_slot_array[i] == slot_type)
12491 {
12492 soundset = cfg_soundset_array[i];
12493 break;
12494 }
12495 }
12496 }
12497
12498 if (soundset != "")
12499 {
12500 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12502 }
12503 }
12504 }
12505 }
12506
12508}
12509
12511{
12513 if (entity)
12514 {
12515 bool is_item = entity.IsInherited(
ItemBase);
12516 if (is_item && full_quantity)
12517 {
12520 }
12521 }
12522 else
12523 {
12525 return NULL;
12526 }
12527 return entity;
12528}
12529
12531{
12532 if (item)
12533 {
12534 if (health > 0)
12535 item.SetHealth("", "", health);
12536
12537 if (item.CanHaveTemperature())
12538 {
12540 if (item.CanFreeze())
12541 item.SetFrozen(false);
12542 }
12543
12544 if (item.HasEnergyManager())
12545 {
12546 if (quantity >= 0)
12547 {
12548 item.GetCompEM().SetEnergy0To1(quantity);
12549 }
12550 else
12551 {
12553 }
12554 }
12555 else if (item.IsMagazine())
12556 {
12557 Magazine mag = Magazine.Cast(item);
12558 if (quantity >= 0)
12559 {
12560 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12561 }
12562 else
12563 {
12565 }
12566
12567 }
12568 else
12569 {
12570 if (quantity >= 0)
12571 {
12572 item.SetQuantityNormalized(quantity, false);
12573 }
12574 else
12575 {
12577 }
12578
12579 }
12580 }
12581}
12582
12583#ifdef DEVELOPER
12585#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
bool SetAttachSoundEvent()
bool SetDetachSoundEvent()
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 IsPrepareToDelete()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
proto GizmoApi GetGizmoApi()
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
void StartItemSoundServer(int id, int slotId)
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)
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()
override int GetLiquidType()
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)
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 EntityAI GetAttachmentFromIndex(int index)
proto native bool GetCurrentInventoryLocation(out notnull InventoryLocation loc)
returns information about current item location
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
proto native int AttachmentCount()
Returns count of attachments attached to this item.
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
proto void SelectObject(Object object)
proto void SelectPhysics(Physics physics)
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 bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
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
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
void Obsolete(string msg="")
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
vector GetPosition()
Get the world position of the Effect.
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.