7612{
7614 {
7615 return true;
7616 }
7617};
7618
7620{
7621
7622};
7623
7624
7625
7627{
7631
7633
7636
7637
7638
7639
7640
7649
7655
7660
7665
7686 protected bool m_IsResultOfSplit
7687
7689
7694
7695
7696
7698
7702
7703
7704
7706
7709
7710
7711
7717
7718
7726
7729
7730
7732
7733
7735
7736
7741
7742
7747
7749
7750
7752
7753
7755 {
7760
7761 if (!
g_Game.IsDedicatedServer())
7762 {
7764 {
7766
7768 {
7770 }
7771 }
7772
7775 }
7776
7777 m_OldLocation = null;
7778
7780 {
7782 }
7783
7784 if (ConfigIsExisting("headSelectionsToHide"))
7785 {
7788 }
7789
7791 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7792 {
7794 }
7795
7797
7798 m_IsResultOfSplit = false;
7799
7801 }
7802
7804 {
7805 super.InitItemVariables();
7806
7812 m_Count = ConfigGetInt(
"count");
7813
7816
7821
7824
7829
7841
7845
7846
7849 if (ConfigIsExisting("canBeSplit"))
7850 {
7853 }
7854
7856 if (ConfigIsExisting("itemBehaviour"))
7858
7859
7862 RegisterNetSyncVariableInt("m_VarLiquidType");
7863 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7864
7865 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7866 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7867 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7868
7869 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7870 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7871 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7872 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7873
7874 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7875 RegisterNetSyncVariableBool("m_IsTakeable");
7876 RegisterNetSyncVariableBool("m_IsHologram");
7877
7880 {
7883 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7884 }
7885
7887
7889 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7891
7893 }
7894
7896 {
7898 }
7899
7901 {
7904 {
7909 }
7910 }
7911
7912 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7913 {
7915 {
7918 }
7919
7921 }
7922
7924 {
7930 }
7931
7933
7935 {
7937
7938 if (!action)
7939 {
7940 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7941 return;
7942 }
7943
7945 if (!ai)
7946 {
7948 return;
7949 }
7950
7952 if (!action_array)
7953 {
7954 action_array = new array<ActionBase_Basic>;
7956 }
7957 if (LogManager.IsActionLogEnable())
7958 {
7959 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7960 }
7961
7962 if (action_array.Find(action) != -1)
7963 {
7964 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7965 }
7966 else
7967 {
7968 action_array.Insert(action);
7969 }
7970 }
7971
7973 {
7974 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7975 ActionBase action = player.GetActionManager().GetAction(actionName);
7978
7979 if (action_array)
7980 {
7981 action_array.RemoveItem(action);
7982 }
7983 }
7984
7985
7986
7988 {
7989 ActionOverrideData overrideData = new ActionOverrideData();
7993
7995 if (!actionMap)
7996 {
7999 }
8000
8001 actionMap.Insert(this.
Type(), overrideData);
8002
8003 }
8004
8006
8008
8009
8011 {
8014
8017
8018 string config_to_search = "CfgVehicles";
8019 string muzzle_owner_config;
8020
8022 {
8023 if (IsInherited(Weapon))
8024 config_to_search = "CfgWeapons";
8025
8026 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8027
8028 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8029
8030 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8031
8032 if (config_OnFire_subclass_count > 0)
8033 {
8034 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8035
8036 for (int i = 0; i < config_OnFire_subclass_count; i++)
8037 {
8038 string particle_class = "";
8039 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8040 string config_OnFire_entry = config_OnFire_class + particle_class;
8041 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8042 WPOF_array.Insert(WPOF);
8043 }
8044
8045
8047 }
8048 }
8049
8051 {
8052 config_to_search = "CfgWeapons";
8053 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8054
8055 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8056
8057 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8058
8059 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8060 {
8061 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8062
8063 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8064 {
8065 string particle_class2 = "";
8066 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8067 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8068 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8069 WPOBE_array.Insert(WPOBE);
8070 }
8071
8072
8074 }
8075 }
8076 }
8077
8078
8080 {
8083
8085 {
8086 string config_to_search = "CfgVehicles";
8087
8088 if (IsInherited(Weapon))
8089 config_to_search = "CfgWeapons";
8090
8091 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8092 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8093
8094 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8095 {
8096
8098
8100 {
8102 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8104 return;
8105 }
8106
8109
8110
8111
8112 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8113 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8114
8115 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8116 {
8117 string particle_class = "";
8118 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8119 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8120 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8121
8122 if (entry_type == CT_CLASS)
8123 {
8124 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8125 WPOOH_array.Insert(WPOF);
8126 }
8127 }
8128
8129
8131 }
8132 }
8133 }
8134
8136 {
8138 }
8139
8141 {
8143 {
8145
8148
8151
8152 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8153 }
8154 }
8155
8157 {
8159 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8160
8162 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8163
8165 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8166
8168 {
8170 }
8171 }
8172
8174 {
8176 }
8177
8179 {
8182 else
8184
8186 {
8189 }
8190 else
8191 {
8194
8197 }
8198
8200 }
8201
8203 {
8205 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8206 }
8207
8209 {
8211 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8213 }
8214
8216 {
8218 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8219 }
8220
8222 {
8225
8226 OverheatingParticle OP = new OverheatingParticle();
8231
8233 }
8234
8236 {
8239
8240 return -1;
8241 }
8242
8244 {
8246 {
8249
8250 for (int i = count; i > 0; --i)
8251 {
8252 int id = i - 1;
8255
8258
8259 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8260 {
8261 if (p)
8262 {
8265 }
8266 }
8267 }
8268 }
8269 }
8270
8272 {
8274 {
8276 {
8277 int id = i - 1;
8279
8280 if (OP)
8281 {
8283
8284 if (p)
8285 {
8287 }
8288
8289 delete OP;
8290 }
8291 }
8292
8295 }
8296 }
8297
8300 {
8301 return 0.0;
8302 }
8303
8304
8306 {
8307 return 250;
8308 }
8309
8311 {
8312 return 0;
8313 }
8314
8317 {
8319 return true;
8320
8321 return false;
8322 }
8323
8326 {
8329
8331 {
8333 }
8334 else
8335 {
8336
8338 }
8339
8341 }
8342
8349 {
8350 return -1;
8351 }
8352
8353
8354
8355
8357 {
8359 {
8360 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8361 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8362
8363 if (r_index >= 0)
8364 {
8365 InventoryLocation r_il = new InventoryLocation;
8366 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8367
8368 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8371 {
8372 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8373 }
8375 {
8376 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8377 }
8378
8379 }
8380
8381 player.GetHumanInventory().ClearUserReservedLocation(this);
8382 }
8383
8386 }
8387
8388
8389
8390
8392 {
8393 return ItemBase.m_DebugActionsMask;
8394 }
8395
8397 {
8398 return ItemBase.m_DebugActionsMask & mask;
8399 }
8400
8402 {
8403 ItemBase.m_DebugActionsMask = mask;
8404 }
8405
8407 {
8408 ItemBase.m_DebugActionsMask |= mask;
8409 }
8410
8412 {
8413 ItemBase.m_DebugActionsMask &= ~mask;
8414 }
8415
8417 {
8419 {
8421 }
8422 else
8423 {
8425 }
8426 }
8427
8428
8430 {
8431 if (GetEconomyProfile())
8432 {
8433 float q_max = GetEconomyProfile().GetQuantityMax();
8434 if (q_max > 0)
8435 {
8436 float q_min = GetEconomyProfile().GetQuantityMin();
8437 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8438
8440 {
8441 ComponentEnergyManager comp = GetCompEM();
8443 {
8445 }
8446 }
8448 {
8450
8451 }
8452
8453 }
8454 }
8455 }
8456
8459 {
8460 EntityAI parent = GetHierarchyParent();
8461
8462 if (parent)
8463 {
8464 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8465 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8466 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8467 }
8468 }
8469
8472 {
8473 EntityAI parent = GetHierarchyParent();
8474
8475 if (parent)
8476 {
8477 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8478 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8479 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8480 }
8481 }
8482
8484 {
8485
8486
8487
8488
8490
8492 {
8493 if (ScriptInputUserData.CanStoreInputUserData())
8494 {
8495 ScriptInputUserData ctx = new ScriptInputUserData;
8501 ctx.
Write(use_stack_max);
8504
8506 {
8507 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8508 }
8509 }
8510 }
8511 else if (!
g_Game.IsMultiplayer())
8512 {
8514 }
8515 }
8516
8518 {
8520 }
8521
8523 {
8525 }
8526
8528 {
8530 }
8531
8533 {
8534
8535 return false;
8536 }
8537
8539 {
8540 return false;
8541 }
8542
8546 {
8547 return false;
8548 }
8549
8551 {
8552 return "";
8553 }
8554
8556
8558 {
8559 return false;
8560 }
8561
8563 {
8564 return true;
8565 }
8566
8567
8568
8570 {
8571 return true;
8572 }
8573
8575 {
8576 return true;
8577 }
8578
8580 {
8581 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8583 }
8584
8586 {
8588 }
8589
8591 {
8593 if (!is_being_placed)
8595 SetSynchDirty();
8596 }
8597
8598
8600
8602 {
8604 }
8605
8607 {
8609 }
8610
8612 {
8613 return 1;
8614 }
8615
8617 {
8618 return false;
8619 }
8620
8622 {
8624 SetSynchDirty();
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
8654
8655
8656
8657
8658
8659
8660
8662 {
8663 super.OnMovedInsideCargo(container);
8664
8665 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8666 }
8667
8668 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8669 {
8670 super.EEItemLocationChanged(oldLoc, newLoc);
8671
8672 PlayerBase newPlayer = null;
8673 PlayerBase oldPlayer = null;
8674
8675 if (newLoc.GetParent())
8676 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8677
8678 if (oldLoc.GetParent())
8679 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8680
8682 {
8683 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8684
8685 if (rIndex >= 0)
8686 {
8687 InventoryLocation rIl = new InventoryLocation;
8688 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8689
8690 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8693 {
8694 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8695 }
8697 {
8699 }
8700
8701 }
8702 }
8703
8705 {
8706 if (newPlayer)
8707 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8708
8709 if (newPlayer == oldPlayer)
8710 {
8711 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8712 {
8714 {
8715 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8716 {
8717 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8718 }
8719 }
8720 else
8721 {
8722 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8723 }
8724 }
8725
8726 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8727 {
8728 int type = oldLoc.GetType();
8730 {
8731 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8732 }
8734 {
8735 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8736 }
8737 }
8738 if (!m_OldLocation)
8739 {
8740 m_OldLocation = new InventoryLocation;
8741 }
8742 m_OldLocation.Copy(oldLoc);
8743 }
8744 else
8745 {
8746 if (m_OldLocation)
8747 {
8748 m_OldLocation.Reset();
8749 }
8750 }
8751
8752 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8753 }
8754 else
8755 {
8756 if (newPlayer)
8757 {
8758 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8759 if (resIndex >= 0)
8760 {
8761 InventoryLocation il = new InventoryLocation;
8762 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8764 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8767 {
8768 il.
GetParent().GetOnReleaseLock().Invoke(it);
8769 }
8771 {
8773 }
8774
8775 }
8776 }
8778 {
8779
8781 }
8782
8783 if (m_OldLocation)
8784 {
8785 m_OldLocation.Reset();
8786 }
8787 }
8788
8790 {
8791 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8792 }
8793
8795 {
8796 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8797 }
8798 }
8799
8800 override void EOnContact(IEntity other, Contact extra)
8801 {
8803 {
8804 int liquidType = -1;
8806 if (impactSpeed > 0.0)
8807 {
8809 #ifndef SERVER
8811 #else
8813 SetSynchDirty();
8814 #endif
8816 }
8817 }
8818
8819 #ifdef SERVER
8820 if (GetCompEM() && GetCompEM().IsPlugged())
8821 {
8822 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8823 GetCompEM().UnplugThis();
8824 }
8825 #endif
8826 }
8827
8829
8831 {
8833 }
8834
8836 {
8837
8838 }
8839
8841 {
8842 super.OnItemLocationChanged(old_owner, new_owner);
8843
8844 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8845 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8846
8847 if (!relatedPlayer && playerNew)
8848 relatedPlayer = playerNew;
8849
8850 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8851 {
8853 if (actionMgr)
8854 {
8855 ActionBase currentAction = actionMgr.GetRunningAction();
8856 if (currentAction)
8858 }
8859 }
8860
8861 Man ownerPlayerOld = null;
8862 Man ownerPlayerNew = null;
8863
8864 if (old_owner)
8865 {
8866 if (old_owner.
IsMan())
8867 {
8868 ownerPlayerOld = Man.Cast(old_owner);
8869 }
8870 else
8871 {
8872 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8873 }
8874 }
8875 else
8876 {
8878 {
8880
8881 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8882 {
8883 GetCompEM().UnplugThis();
8884 }
8885 }
8886 }
8887
8888 if (new_owner)
8889 {
8890 if (new_owner.
IsMan())
8891 {
8892 ownerPlayerNew = Man.Cast(new_owner);
8893 }
8894 else
8895 {
8896 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8897 }
8898 }
8899
8900 if (ownerPlayerOld != ownerPlayerNew)
8901 {
8902 if (ownerPlayerOld)
8903 {
8904 array<EntityAI> subItemsExit = new array<EntityAI>;
8906 for (int i = 0; i < subItemsExit.Count(); i++)
8907 {
8910 }
8911 }
8912
8913 if (ownerPlayerNew)
8914 {
8915 array<EntityAI> subItemsEnter = new array<EntityAI>;
8917 for (int j = 0; j < subItemsEnter.Count(); j++)
8918 {
8921 }
8922 }
8923 }
8924 else if (ownerPlayerNew != null)
8925 {
8926 PlayerBase nplayer;
8927 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8928 {
8929 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8931 for (int k = 0; k < subItemsUpdate.Count(); k++)
8932 {
8934 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8935 }
8936 }
8937 }
8938
8939 if (old_owner)
8940 old_owner.OnChildItemRemoved(this);
8941 if (new_owner)
8942 new_owner.OnChildItemReceived(this);
8943 }
8944
8945
8947 {
8948 super.EEDelete(parent);
8949 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8950 if (player)
8951 {
8953
8954 if (player.IsAlive())
8955 {
8956 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8957 if (r_index >= 0)
8958 {
8959 InventoryLocation r_il = new InventoryLocation;
8960 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8961
8962 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8965 {
8966 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8967 }
8969 {
8970 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8971 }
8972
8973 }
8974
8975 player.RemoveQuickBarEntityShortcut(this);
8976 }
8977 }
8978 }
8979
8981 {
8982 super.EEKilled(killer);
8983
8986 {
8987 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8988 {
8989 if (IsMagazine())
8990 {
8991 if (Magazine.Cast(this).GetAmmoCount() > 0)
8992 {
8994 }
8995 }
8996 else
8997 {
8999 }
9000 }
9001 }
9002 }
9003
9005 {
9006 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9007
9008 super.OnWasAttached(parent, slot_id);
9009
9012
9015 }
9016
9018 {
9019 super.OnWasDetached(parent, slot_id);
9020
9023
9026 }
9027
9029 {
9030 int idx;
9033
9034 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9035 if (inventory_slots.Count() < 1)
9036 {
9037 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9038 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9039 }
9040 else
9041 {
9042 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9043 }
9044
9045 idx = inventory_slots.Find(slot);
9046 if (idx < 0)
9047 return "";
9048
9049 return attach_types.Get(idx);
9050 }
9051
9053 {
9054 int idx = -1;
9055 string slot;
9056
9059
9060 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9061 if (inventory_slots.Count() < 1)
9062 {
9063 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9064 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9065 }
9066 else
9067 {
9068 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9069 if (detach_types.Count() < 1)
9070 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9071 }
9072
9073 for (int i = 0; i < inventory_slots.Count(); i++)
9074 {
9075 slot = inventory_slots.Get(i);
9076 }
9077
9078 if (slot != "")
9079 {
9080 if (detach_types.Count() == 1)
9081 idx = 0;
9082 else
9083 idx = inventory_slots.Find(slot);
9084 }
9085 if (idx < 0)
9086 return "";
9087
9088 return detach_types.Get(idx);
9089 }
9090
9092 {
9093
9095
9096
9097 float min_time = 1;
9098 float max_time = 3;
9099 float delay = Math.RandomFloat(min_time, max_time);
9100
9101 explode_timer.Run(delay, this, "DoAmmoExplosion");
9102 }
9103
9105 {
9106 Magazine magazine = Magazine.Cast(this);
9107 int pop_sounds_count = 6;
9108 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9109
9110
9111 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9112 string sound_name = pop_sounds[ sound_idx ];
9113 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9114
9115
9116 magazine.ServerAddAmmoCount(-1);
9117
9118
9119 float min_temp_to_explode = 100;
9120
9121 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9122 {
9124 }
9125 }
9126
9127
9128 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9129 {
9130 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9131
9132 const int CHANCE_DAMAGE_CARGO = 4;
9133 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9134 const int CHANCE_DAMAGE_NOTHING = 2;
9135
9137 {
9138 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9139 int chances;
9140 int rnd;
9141
9142 if (GetInventory().GetCargo())
9143 {
9144 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9145 rnd = Math.RandomInt(0,chances);
9146
9147 if (rnd < CHANCE_DAMAGE_CARGO)
9148 {
9150 }
9151 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9152 {
9154 }
9155 }
9156 else
9157 {
9158 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9159 rnd = Math.RandomInt(0,chances);
9160
9161 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9162 {
9164 }
9165 }
9166 }
9167 }
9168
9170 {
9171 CargoBase cargo = GetInventory().GetCargo();
9172 if (cargo)
9173 {
9175 if (item_count > 0)
9176 {
9177 int random_pick = Math.RandomInt(0, item_count);
9179 if (!item.IsExplosive())
9180 {
9181 item.AddHealth("","",damage);
9182 return true;
9183 }
9184 }
9185 }
9186 return false;
9187 }
9188
9190 {
9191 GameInventory inventory = GetInventory();
9193 if (attachment_count > 0)
9194 {
9195 int random_pick = Math.RandomInt(0, attachment_count);
9197 if (!attachment.IsExplosive())
9198 {
9199 attachment.AddHealth("","",damage);
9200 return true;
9201 }
9202 }
9203 return false;
9204 }
9205
9207 {
9209 }
9210
9212 {
9214 return GetInventory().CanRemoveEntity();
9215
9216 return false;
9217 }
9218
9220 {
9221
9223 return false;
9224
9225
9227 return false;
9228
9229
9230
9232 if (delta == 0)
9233 return false;
9234
9235
9236 return true;
9237 }
9238
9240 {
9242 {
9243 if (ScriptInputUserData.CanStoreInputUserData())
9244 {
9245 ScriptInputUserData ctx = new ScriptInputUserData;
9250 ctx.
Write(destination_entity);
9254 }
9255 }
9256 else if (!
g_Game.IsMultiplayer())
9257 {
9259 }
9260 }
9261
9263 {
9264 float split_quantity_new;
9268 InventoryLocation loc = new InventoryLocation;
9269
9270 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9271 {
9273 split_quantity_new = stack_max;
9274 else
9276
9278 {
9279 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9280 if (new_item)
9281 {
9282 new_item.SetResultOfSplit(true);
9283 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9285 new_item.
SetQuantity(split_quantity_new,
false,
true);
9286 }
9287 }
9288 }
9289 else if (destination_entity && slot_id == -1)
9290 {
9291 if (quantity > stack_max)
9292 split_quantity_new = stack_max;
9293 else
9294 split_quantity_new = quantity;
9295
9297 {
9298 GameInventory destinationInventory = destination_entity.GetInventory();
9300 {
9303 }
9304
9305 if (new_item)
9306 {
9307 new_item.SetResultOfSplit(true);
9308 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9310 new_item.
SetQuantity(split_quantity_new,
false,
true);
9311 }
9312 }
9313 }
9314 else
9315 {
9316 if (stack_max != 0)
9317 {
9319 {
9321 }
9322
9323 if (split_quantity_new == 0)
9324 {
9325 if (!
g_Game.IsMultiplayer())
9326 player.PhysicalPredictiveDropItem(this);
9327 else
9328 player.ServerDropEntity(this);
9329 return;
9330 }
9331
9333 {
9335
9336 if (new_item)
9337 {
9338 new_item.SetResultOfSplit(true);
9339 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9342 new_item.PlaceOnSurface();
9343 }
9344 }
9345 }
9346 }
9347 }
9348
9350 {
9351 float split_quantity_new;
9355 InventoryLocation loc = new InventoryLocation;
9356
9357 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9358 {
9360 split_quantity_new = stack_max;
9361 else
9363
9365 {
9366 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9367 if (new_item)
9368 {
9369 new_item.SetResultOfSplit(true);
9370 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9372 new_item.
SetQuantity(split_quantity_new,
false,
true);
9373 }
9374 }
9375 }
9376 else if (destination_entity && slot_id == -1)
9377 {
9378 if (quantity > stack_max)
9379 split_quantity_new = stack_max;
9380 else
9381 split_quantity_new = quantity;
9382
9384 {
9385 GameInventory destinationInventory = destination_entity.GetInventory();
9387 {
9390 }
9391
9392 if (new_item)
9393 {
9394 new_item.SetResultOfSplit(true);
9395 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9397 new_item.
SetQuantity(split_quantity_new,
false,
true);
9398 }
9399 }
9400 }
9401 else
9402 {
9403 if (stack_max != 0)
9404 {
9406 {
9408 }
9409
9411 {
9413
9414 if (new_item)
9415 {
9416 new_item.SetResultOfSplit(true);
9417 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9420 new_item.PlaceOnSurface();
9421 }
9422 }
9423 }
9424 }
9425 }
9426
9428 {
9430 {
9431 if (ScriptInputUserData.CanStoreInputUserData())
9432 {
9433 ScriptInputUserData ctx = new ScriptInputUserData;
9438 dst.WriteToContext(ctx);
9440 }
9441 }
9442 else if (!
g_Game.IsMultiplayer())
9443 {
9445 }
9446 }
9447
9449 {
9451 {
9452 if (ScriptInputUserData.CanStoreInputUserData())
9453 {
9454 ScriptInputUserData ctx = new ScriptInputUserData;
9459 ctx.
Write(destination_entity);
9465 }
9466 }
9467 else if (!
g_Game.IsMultiplayer())
9468 {
9470 }
9471 }
9472
9474 {
9476 }
9477
9479 {
9481 float split_quantity_new;
9483 if (dst.IsValid())
9484 {
9485 int slot_id = dst.GetSlot();
9487
9488 if (quantity > stack_max)
9489 split_quantity_new = stack_max;
9490 else
9491 split_quantity_new = quantity;
9492
9494 {
9496
9497 if (new_item)
9498 {
9499 new_item.SetResultOfSplit(true);
9500 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9502 new_item.
SetQuantity(split_quantity_new,
false,
true);
9503 }
9504
9505 return new_item;
9506 }
9507 }
9508
9509 return null;
9510 }
9511
9513 {
9515 float split_quantity_new;
9517 if (destination_entity)
9518 {
9520 if (quantity > stackable)
9521 split_quantity_new = stackable;
9522 else
9523 split_quantity_new = quantity;
9524
9526 {
9527 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9528 if (new_item)
9529 {
9530 new_item.SetResultOfSplit(true);
9531 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9533 new_item.
SetQuantity(split_quantity_new,
false,
true);
9534 }
9535 }
9536 }
9537 }
9538
9540 {
9542 {
9543 if (ScriptInputUserData.CanStoreInputUserData())
9544 {
9545 ScriptInputUserData ctx = new ScriptInputUserData;
9550 ItemBase destination_entity =
this;
9551 ctx.
Write(destination_entity);
9555 }
9556 }
9557 else if (!
g_Game.IsMultiplayer())
9558 {
9560 }
9561 }
9562
9564 {
9566 float split_quantity_new;
9568 if (player)
9569 {
9571 if (quantity > stackable)
9572 split_quantity_new = stackable;
9573 else
9574 split_quantity_new = quantity;
9575
9577 {
9578 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9579 new_item =
ItemBase.Cast(in_hands);
9580 if (new_item)
9581 {
9582 new_item.SetResultOfSplit(true);
9583 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9585 new_item.SetQuantity(split_quantity_new, false, true);
9586 }
9587 }
9588 }
9589 }
9590
9592 {
9594 float split_quantity_new = Math.Floor(quantity * 0.5);
9595
9597 return;
9598
9600
9601 if (new_item)
9602 {
9603 if (new_item.GetQuantityMax() < split_quantity_new)
9604 {
9605 split_quantity_new = new_item.GetQuantityMax();
9606 }
9607
9608 new_item.SetResultOfSplit(true);
9609 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9610
9612 {
9615 }
9616 else
9617 {
9619 new_item.
SetQuantity(split_quantity_new,
false,
true);
9620 }
9621 }
9622 }
9623
9625 {
9627 float split_quantity_new = Math.Floor(quantity / 2);
9628
9630 return;
9631
9632 InventoryLocation invloc = new InventoryLocation;
9634
9636 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9637
9638 if (new_item)
9639 {
9640 if (new_item.GetQuantityMax() < split_quantity_new)
9641 {
9642 split_quantity_new = new_item.GetQuantityMax();
9643 }
9645 {
9648 }
9649 else if (split_quantity_new > 1)
9650 {
9652 new_item.
SetQuantity(split_quantity_new,
false,
true);
9653 }
9654 }
9655 }
9656
9659 {
9660 SetWeightDirty();
9662
9663 if (parent)
9664 parent.OnAttachmentQuantityChangedEx(this, delta);
9665
9667 {
9669 {
9671 }
9673 {
9674 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9676 }
9677 }
9678 }
9679
9682 {
9683
9684 }
9685
9688 {
9690 }
9691
9693 {
9694 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9695
9697 {
9698 if (newLevel == GameConstants.STATE_RUINED)
9699 {
9701 EntityAI parent = GetHierarchyParent();
9702 if (parent && parent.IsFireplace())
9703 {
9704 CargoBase cargo = GetInventory().GetCargo();
9705 if (cargo)
9706 {
9708 {
9710 }
9711 }
9712 }
9713 }
9714
9716 {
9717
9719 return;
9720 }
9721
9722 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9723 {
9725 }
9726 }
9727 }
9728
9729
9731 {
9732 super.OnRightClick();
9733
9735 {
9737 {
9738 if (ScriptInputUserData.CanStoreInputUserData())
9739 {
9740 EntityAI root = GetHierarchyRoot();
9741 Man playerOwner = GetHierarchyRootPlayer();
9742 InventoryLocation dst = new InventoryLocation;
9743
9744
9745 if (!playerOwner && root && root == this)
9746 {
9748 }
9749 else
9750 {
9751
9752 GetInventory().GetCurrentInventoryLocation(dst);
9754 {
9755 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9757 {
9759 }
9760 else
9761 {
9763
9764
9765 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9766 {
9768 }
9769 else
9770 {
9771 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9772 }
9773 }
9774 }
9775 }
9776
9777 ScriptInputUserData ctx = new ScriptInputUserData;
9785 }
9786 }
9787 else if (!
g_Game.IsMultiplayer())
9788 {
9790 }
9791 }
9792 }
9793
9795 {
9796 if (root)
9797 {
9798 vector m4[4];
9799 root.GetTransform(m4);
9800 dst.SetGround(this, m4);
9801 }
9802 else
9803 {
9804 GetInventory().GetCurrentInventoryLocation(dst);
9805 }
9806 }
9807
9808 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9809 {
9810
9811 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9812 return false;
9813
9814 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9815 return false;
9816
9817
9819 return false;
9820
9821
9822 Magazine mag = Magazine.Cast(this);
9823 if (mag)
9824 {
9825 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9826 return false;
9827
9828 if (stack_max_limit)
9829 {
9830 Magazine other_mag = Magazine.Cast(other_item);
9831 if (other_item)
9832 {
9833 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9834 return false;
9835 }
9836
9837 }
9838 }
9839 else
9840 {
9841
9843 return false;
9844
9846 return false;
9847 }
9848
9849 PlayerBase player = null;
9850 if (CastTo(player, GetHierarchyRootPlayer()))
9851 {
9852 if (player.GetInventory().HasAttachment(this))
9853 return false;
9854
9855 if (player.IsItemsToDelete())
9856 return false;
9857 }
9858
9859 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9860 return false;
9861
9862 int slotID;
9864 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9865 return false;
9866
9867 return true;
9868 }
9869
9871 {
9873 }
9874
9876 {
9877 return m_IsResultOfSplit;
9878 }
9879
9881 {
9882 m_IsResultOfSplit = value;
9883 }
9884
9886 {
9888 }
9889
9891 {
9892 float other_item_quantity = other_item.GetQuantity();
9893 float this_free_space;
9894
9896
9898
9899 if (other_item_quantity > this_free_space)
9900 {
9901 return this_free_space;
9902 }
9903 else
9904 {
9905 return other_item_quantity;
9906 }
9907 }
9908
9910 {
9912 }
9913
9915 {
9917 return;
9918
9919 if (!IsMagazine() && other_item)
9920 {
9922 if (quantity_used != 0)
9923 {
9924 float hp1 = GetHealth01("","");
9925 float hp2 = other_item.GetHealth01("","");
9926 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9927 hpResult = hpResult / (
GetQuantity() + quantity_used);
9928
9929 hpResult *= GetMaxHealth();
9930 Math.Round(hpResult);
9931 SetHealth("", "Health", hpResult);
9932
9934 other_item.AddQuantity(-quantity_used);
9935 }
9936 }
9938 }
9939
9941 {
9942 #ifdef SERVER
9943 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9944 GetHierarchyParent().IncreaseLifetimeUp();
9945 #endif
9946 };
9947
9949 {
9950 PlayerBase p = PlayerBase.Cast(player);
9951
9952 array<int> recipesIds = p.m_Recipes;
9953 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9954 if (moduleRecipesManager)
9955 {
9956 EntityAI itemInHands = player.GetEntityInHands();
9957 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9958 }
9959
9960 for (int i = 0;i < recipesIds.Count(); i++)
9961 {
9962 int key = recipesIds.Get(i);
9963 string recipeName = moduleRecipesManager.GetRecipeName(key);
9965 }
9966 }
9967
9968
9969 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9970 {
9971 super.GetDebugActions(outputList);
9972
9973
9979
9980
9985
9990
9991
9995
9996
9998 {
10002 }
10003
10006
10007
10011
10013
10014 InventoryLocation loc = new InventoryLocation();
10015 GetInventory().GetCurrentInventoryLocation(loc);
10017 {
10018 if (Gizmo_IsSupported())
10021 }
10022
10024 }
10025
10026
10027
10028
10030 {
10031 super.OnAction(action_id, player, ctx);
10032
10034 {
10035 switch (action_id)
10036 {
10040 return true;
10044 return true;
10045 }
10046 }
10047
10049 {
10050 switch (action_id)
10051 {
10053 Delete();
10054 return true;
10055 }
10056 }
10057
10058 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10059 {
10060 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10061 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10062 PlayerBase p = PlayerBase.Cast(player);
10063 if (
EActions.RECIPES_RANGE_START < 1000)
10064 {
10065 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10066 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10067 }
10068 }
10069 #ifndef SERVER
10070 else if (action_id ==
EActions.WATCH_PLAYER)
10071 {
10072 PluginDeveloper.SetDeveloperItemClientEx(player);
10073 }
10074 #endif
10076 {
10077 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10078 {
10079 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10080 OnDebugButtonPressServer(id + 1);
10081 }
10082
10083 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10084 {
10085 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10087 }
10088
10089 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10090 {
10091 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10093 }
10094
10095 else if (action_id ==
EActions.ADD_QUANTITY)
10096 {
10097 if (IsMagazine())
10098 {
10099 Magazine mag = Magazine.Cast(this);
10100 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10101 }
10102 else
10103 {
10105 }
10106
10107 if (m_EM)
10108 {
10109 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10110 }
10111
10112 }
10113
10114 else if (action_id ==
EActions.REMOVE_QUANTITY)
10115 {
10116 if (IsMagazine())
10117 {
10118 Magazine mag2 = Magazine.Cast(this);
10119 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10120 }
10121 else
10122 {
10124 }
10125 if (m_EM)
10126 {
10127 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10128 }
10129
10130 }
10131
10132 else if (action_id ==
EActions.SET_QUANTITY_0)
10133 {
10135
10136 if (m_EM)
10137 {
10138 m_EM.SetEnergy(0);
10139 }
10140 }
10141
10142 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10143 {
10145
10146 if (m_EM)
10147 {
10148 m_EM.SetEnergy(m_EM.GetEnergyMax());
10149 }
10150 }
10151
10152 else if (action_id ==
EActions.ADD_HEALTH)
10153 {
10154 AddHealth("","",GetMaxHealth("","Health")/5);
10155 }
10156 else if (action_id ==
EActions.REMOVE_HEALTH)
10157 {
10158 AddHealth("","",-GetMaxHealth("","Health")/5);
10159 }
10160 else if (action_id ==
EActions.DESTROY_HEALTH)
10161 {
10162 SetHealth01("","",0);
10163 }
10164 else if (action_id ==
EActions.WATCH_ITEM)
10165 {
10167 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10168 #ifdef DEVELOPER
10169 SetDebugDeveloper_item(this);
10170 #endif
10171 }
10172
10173 else if (action_id ==
EActions.ADD_TEMPERATURE)
10174 {
10175 AddTemperature(20);
10176
10177 }
10178
10179 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10180 {
10181 AddTemperature(-20);
10182
10183 }
10184
10185 else if (action_id ==
EActions.FLIP_FROZEN)
10186 {
10187 SetFrozen(!GetIsFrozen());
10188
10189 }
10190
10191 else if (action_id ==
EActions.ADD_WETNESS)
10192 {
10194
10195 }
10196
10197 else if (action_id ==
EActions.REMOVE_WETNESS)
10198 {
10200
10201 }
10202
10203 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10204 {
10207
10208
10209 }
10210
10211 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10212 {
10215 }
10216
10217 else if (action_id ==
EActions.MAKE_SPECIAL)
10218 {
10219 auto debugParams = DebugSpawnParams.WithPlayer(player);
10220 OnDebugSpawnEx(debugParams);
10221 }
10222
10223 }
10224
10225
10226 return false;
10227 }
10228
10229
10230
10231
10235
10238
10239
10240
10242 {
10243 return false;
10244 }
10245
10246
10248 {
10249 return true;
10250 }
10251
10252
10254 {
10255 return true;
10256 }
10257
10258
10259
10261 {
10262 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10263 return g_Game.ConfigIsExisting(config_path);
10264 }
10265
10268 {
10269 return null;
10270 }
10271
10273 {
10274 return false;
10275 }
10276
10278 {
10279 return false;
10280 }
10281
10285
10286
10288 {
10289 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10290 return module_repairing.CanRepair(this, item_repair_kit);
10291 }
10292
10293
10294 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10295 {
10296 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10297 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10298 }
10299
10300
10302 {
10303
10304
10305
10306
10307
10308
10309
10310
10311 return 1;
10312 }
10313
10314
10315
10317 {
10319 }
10320
10321
10322
10324 {
10326 }
10327
10328
10337 {
10338 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10339
10340 if (player)
10341 {
10342 player.MessageStatus(text);
10343 }
10344 }
10345
10346
10355 {
10356 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10357
10358 if (player)
10359 {
10360 player.MessageAction(text);
10361 }
10362 }
10363
10364
10373 {
10374 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10375
10376 if (player)
10377 {
10378 player.MessageFriendly(text);
10379 }
10380 }
10381
10382
10391 {
10392 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10393
10394 if (player)
10395 {
10396 player.MessageImportant(text);
10397 }
10398 }
10399
10401 {
10402 return true;
10403 }
10404
10405
10406 override bool KindOf(
string tag)
10407 {
10408 bool found = false;
10409 string item_name = this.
GetType();
10411 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10412
10413 int array_size = item_tag_array.Count();
10414 for (int i = 0; i < array_size; i++)
10415 {
10416 if (item_tag_array.Get(i) == tag)
10417 {
10418 found = true;
10419 break;
10420 }
10421 }
10422 return found;
10423 }
10424
10425
10427 {
10428
10429 super.OnRPC(sender, rpc_type,ctx);
10430
10431
10432 switch (rpc_type)
10433 {
10434 #ifndef SERVER
10435 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10436 Param2<bool, string> p = new Param2<bool, string>(false, "");
10437
10439 return;
10440
10441 bool play = p.param1;
10442 string soundSet = p.param2;
10443
10444 if (play)
10445 {
10447 {
10449 {
10451 }
10452 }
10453 else
10454 {
10456 }
10457 }
10458 else
10459 {
10461 }
10462
10463 break;
10464 #endif
10465
10466 }
10467
10469 {
10471 }
10472 }
10473
10474
10475
10476
10478 {
10479 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10480 return plugin.GetID(
name);
10481 }
10482
10484 {
10485 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10486 return plugin.GetName(id);
10487 }
10488
10491 {
10492
10493
10494 int varFlags;
10495 if (!ctx.
Read(varFlags))
10496 return;
10497
10498 if (varFlags & ItemVariableFlags.FLOAT)
10499 {
10501 }
10502 }
10503
10505 {
10506
10507 super.SerializeNumericalVars(floats_out);
10508
10509
10510
10512 {
10514 }
10515
10517 {
10519 }
10520
10522 {
10524 }
10525
10527 {
10532 }
10533
10535 {
10537 }
10538 }
10539
10541 {
10542
10543 super.DeSerializeNumericalVars(floats);
10544
10545
10546 int index = 0;
10547 int mask = Math.Round(floats.Get(index));
10548
10549 index++;
10550
10552 {
10554 {
10556 }
10557 else
10558 {
10559 float quantity = floats.Get(index);
10560 SetQuantity(quantity,
true,
false,
false,
false);
10561 }
10562 index++;
10563 }
10564
10566 {
10567 float wet = floats.Get(index);
10569 index++;
10570 }
10571
10573 {
10574 int liquidtype = Math.Round(floats.Get(index));
10576 index++;
10577 }
10578
10580 {
10582 index++;
10584 index++;
10586 index++;
10588 index++;
10589 }
10590
10592 {
10593 int cleanness = Math.Round(floats.Get(index));
10595 index++;
10596 }
10597 }
10598
10600 {
10601 super.WriteVarsToCTX(ctx);
10602
10603
10605 {
10607 }
10608
10610 {
10612 }
10613
10615 {
10617 }
10618
10620 {
10621 int r,g,b,a;
10627 }
10628
10630 {
10632 }
10633 }
10634
10636 {
10637 if (!super.ReadVarsFromCTX(ctx,version))
10638 return false;
10639
10640 int intValue;
10641 float value;
10642
10643 if (version < 140)
10644 {
10645 if (!ctx.
Read(intValue))
10646 return false;
10647
10648 m_VariablesMask = intValue;
10649 }
10650
10652 {
10653 if (!ctx.
Read(value))
10654 return false;
10655
10657 {
10659 }
10660 else
10661 {
10663 }
10664 }
10665
10666 if (version < 140)
10667 {
10669 {
10670 if (!ctx.
Read(value))
10671 return false;
10672 SetTemperatureDirect(value);
10673 }
10674 }
10675
10677 {
10678 if (!ctx.
Read(value))
10679 return false;
10681 }
10682
10684 {
10685 if (!ctx.
Read(intValue))
10686 return false;
10688 }
10689
10691 {
10692 int r,g,b,a;
10694 return false;
10696 return false;
10698 return false;
10700 return false;
10701
10703 }
10704
10706 {
10707 if (!ctx.
Read(intValue))
10708 return false;
10710 }
10711
10712 if (version >= 138 && version < 140)
10713 {
10715 {
10716 if (!ctx.
Read(intValue))
10717 return false;
10718 SetFrozen(intValue);
10719 }
10720 }
10721
10722 return true;
10723 }
10724
10725
10727 {
10730 {
10732 }
10733
10734 if (!super.OnStoreLoad(ctx, version))
10735 {
10737 return false;
10738 }
10739
10740 if (version >= 114)
10741 {
10742 bool hasQuickBarIndexSaved;
10743
10744 if (!ctx.
Read(hasQuickBarIndexSaved))
10745 {
10747 return false;
10748 }
10749
10750 if (hasQuickBarIndexSaved)
10751 {
10752 int itmQBIndex;
10753
10754
10755 if (!ctx.
Read(itmQBIndex))
10756 {
10758 return false;
10759 }
10760
10761 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10762 if (itmQBIndex != -1 && parentPlayer)
10763 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10764 }
10765 }
10766 else
10767 {
10768
10769 PlayerBase player;
10770 int itemQBIndex;
10771 if (version ==
int.
MAX)
10772 {
10773 if (!ctx.
Read(itemQBIndex))
10774 {
10776 return false;
10777 }
10778 }
10779 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10780 {
10781
10782 if (!ctx.
Read(itemQBIndex))
10783 {
10785 return false;
10786 }
10787 if (itemQBIndex != -1 && player)
10788 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10789 }
10790 }
10791
10792 if (version < 140)
10793 {
10794
10795 if (!LoadVariables(ctx, version))
10796 {
10798 return false;
10799 }
10800 }
10801
10802
10804 {
10806 return false;
10807 }
10808 if (version >= 132)
10809 {
10811 if (raib)
10812 {
10814 {
10816 return false;
10817 }
10818 }
10819 }
10820
10822 return true;
10823 }
10824
10825
10826
10828 {
10829 super.OnStoreSave(ctx);
10830
10831 PlayerBase player;
10832 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10833 {
10835
10836 int itemQBIndex = -1;
10837 itemQBIndex = player.FindQuickBarEntityIndex(this);
10838 ctx.
Write(itemQBIndex);
10839 }
10840 else
10841 {
10843 }
10844
10846
10848 if (raib)
10849 {
10851 }
10852 }
10853
10854
10856 {
10857 super.AfterStoreLoad();
10858
10860 {
10862 }
10863
10865 {
10868 }
10869 }
10870
10872 {
10873 super.EEOnAfterLoad();
10874
10876 {
10878 }
10879
10882 }
10883
10885 {
10886 return false;
10887 }
10888
10889
10890
10892 {
10894 {
10895 #ifdef PLATFORM_CONSOLE
10896
10898 {
10900 if (menu)
10901 {
10903 }
10904 }
10905 #endif
10906 }
10907
10909 {
10912 }
10913
10915 {
10916 SetWeightDirty();
10918 }
10920 {
10923 }
10924
10926 {
10929
10932 }
10934 {
10938 }
10939
10940 super.OnVariablesSynchronized();
10941 }
10942
10943
10944
10946 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10947 {
10948 if (!IsServerCheck(allow_client))
10949 return false;
10950
10952 return false;
10953
10956
10957 if (value <= (min + 0.001))
10958 value = min;
10959
10960 if (value == min)
10961 {
10962 if (destroy_config)
10963 {
10964 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10965 if (dstr)
10966 {
10968 this.Delete();
10969 return true;
10970 }
10971 }
10972 else if (destroy_forced)
10973 {
10975 this.Delete();
10976 return true;
10977 }
10978
10980 }
10981
10984
10986 {
10987 EntityAI parent = GetHierarchyRoot();
10988 InventoryLocation iLoc = new InventoryLocation();
10989 GetInventory().GetCurrentInventoryLocation(iLoc);
10991 {
10992 int iLocSlot = iLoc.
GetSlot();
10994 {
10996 }
10998 {
11000 }
11001 }
11002 }
11003
11005 {
11007
11008 if (delta)
11010 }
11011
11013
11014 return false;
11015 }
11016
11017
11019 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11020 {
11022 }
11023
11025 {
11028 }
11029
11031 {
11034 }
11035
11037 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11038 {
11039 float value_clamped = Math.Clamp(value, 0, 1);
11041 SetQuantity(result, destroy_config, destroy_forced);
11042 }
11043
11044
11047 {
11049 }
11050
11052 {
11054 }
11055
11056
11057
11058
11059
11060
11061
11062
11063
11064
11066 {
11067 int slot = -1;
11068 GameInventory inventory = GetInventory();
11069 if (inventory)
11070 {
11071 InventoryLocation il = new InventoryLocation;
11074 }
11075
11077 }
11078
11080 {
11081 float quantity_max = 0;
11082
11084 {
11085 if (attSlotID != -1)
11086 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11087
11088 if (quantity_max <= 0)
11090 }
11091
11092 if (quantity_max <= 0)
11094
11095 return quantity_max;
11096 }
11097
11099 {
11101 }
11102
11104 {
11106 }
11107
11108
11110 {
11112 }
11113
11115 {
11117 }
11118
11120 {
11122 }
11123
11124
11126 {
11127
11128 float weightEx = GetWeightEx();
11129 float special = GetInventoryAndCargoWeight();
11130 return weightEx - special;
11131 }
11132
11133
11135 {
11137 }
11138
11140 {
11142 {
11143 #ifdef DEVELOPER
11144 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11145 {
11146 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11148 }
11149 #endif
11150
11151 return GetQuantity() * GetConfigWeightModified();
11152 }
11153 else if (HasEnergyManager())
11154 {
11155 #ifdef DEVELOPER
11156 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11157 {
11158 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11159 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11160 }
11161 #endif
11162 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11163 }
11164 else
11165 {
11166 #ifdef DEVELOPER
11167 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11168 {
11169 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11170 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11171 }
11172 #endif
11173 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11174 }
11175 }
11176
11179 {
11180 int item_count = 0;
11182
11183 GameInventory inventory = GetInventory();
11184 CargoBase cargo = inventory.
GetCargo();
11185 if (cargo != NULL)
11186 {
11188 }
11189
11191 for (int i = 0; i < nAttachments; ++i)
11192 {
11194 if (item)
11195 item_count += item.GetNumberOfItems();
11196 }
11197 return item_count;
11198 }
11199
11202 {
11203 float weight = 0;
11204 float wetness = 1;
11205 if (include_wetness)
11208 {
11209 weight = wetness * m_ConfigWeight;
11210 }
11212 {
11213 weight = 1;
11214 }
11215 return weight;
11216 }
11217
11218
11219
11221 {
11222 GameInventory inventory = GetInventory();
11223 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11224 {
11225 array<EntityAI> items = new array<EntityAI>;
11227 for (int i = 0; i < items.Count(); ++i)
11228 {
11230 if (item)
11231 {
11232 g_Game.ObjectDelete(item);
11233 }
11234 }
11235 }
11236 }
11237
11238
11239
11240
11242 {
11243 float energy = 0;
11244 if (HasEnergyManager())
11245 {
11246 energy = GetCompEM().GetEnergy();
11247 }
11248 return energy;
11249 }
11250
11251
11253 {
11254 super.OnEnergyConsumed();
11255
11257 }
11258
11260 {
11261 super.OnEnergyAdded();
11262
11264 }
11265
11266
11268 {
11269 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11270 {
11272 {
11273 float energy_0to1 = GetCompEM().GetEnergy0To1();
11275 }
11276 }
11277 }
11278
11279
11281 {
11282 return ConfigGetFloat("heatIsolation");
11283 }
11284
11286 {
11288 }
11289
11291 {
11292 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11293 if (
g_Game.ConfigIsExisting(paramPath))
11294 return g_Game.ConfigGetFloat(paramPath);
11295
11296 return 0.0;
11297 }
11298
11300 {
11301 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11302 if (
g_Game.ConfigIsExisting(paramPath))
11303 return g_Game.ConfigGetFloat(paramPath);
11304
11305 return 0.0;
11306 }
11307
11308 override void SetWet(
float value,
bool allow_client =
false)
11309 {
11310 if (!IsServerCheck(allow_client))
11311 return;
11312
11315
11317
11318 m_VarWet = Math.Clamp(value, min, max);
11319
11321 {
11324 }
11325 }
11326
11327 override void AddWet(
float value)
11328 {
11330 }
11331
11333 {
11335 }
11336
11338 {
11340 }
11341
11343 {
11345 }
11346
11348 {
11350 }
11351
11353 {
11355 }
11356
11357 override void OnWetChanged(
float newVal,
float oldVal)
11358 {
11361 if (newLevel != oldLevel)
11362 {
11364 }
11365 }
11366
11368 {
11369 SetWeightDirty();
11370 }
11371
11373 {
11374 return GetWetLevelInternal(
m_VarWet);
11375 }
11376
11377
11378
11380 {
11382 }
11383
11385 {
11387 }
11388
11390 {
11392 }
11393
11395 {
11397 }
11398
11399
11400
11402 {
11403 if (ConfigIsExisting("itemModelLength"))
11404 {
11405 return ConfigGetFloat("itemModelLength");
11406 }
11407 return 0;
11408 }
11409
11411 {
11412 if (ConfigIsExisting("itemAttachOffset"))
11413 {
11414 return ConfigGetFloat("itemAttachOffset");
11415 }
11416 return 0;
11417 }
11418
11419 override void SetCleanness(
int value,
bool allow_client =
false)
11420 {
11421 if (!IsServerCheck(allow_client))
11422 return;
11423
11425
11427
11430 }
11431
11433 {
11435 }
11436
11438 {
11439 return true;
11440 }
11441
11442
11443
11444
11446 {
11448 }
11449
11451 {
11453 }
11454
11455
11456
11457
11458 override void SetColor(
int r,
int g,
int b,
int a)
11459 {
11465 }
11467 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11468 {
11473 }
11474
11476 {
11478 }
11479
11482 {
11483 int r,g,b,a;
11485 r = r/255;
11486 g = g/255;
11487 b = b/255;
11488 a = a/255;
11489 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11490 }
11491
11492
11493
11494 override void SetLiquidType(
int value,
bool allow_client =
false)
11495 {
11496 if (!IsServerCheck(allow_client))
11497 return;
11498
11503 }
11504
11506 {
11507 return ConfigGetInt("varLiquidTypeInit");
11508 }
11509
11511 {
11513 }
11514
11516 {
11518 SetFrozen(false);
11519 }
11520
11523 {
11524 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11525 }
11526
11527
11530 {
11531 PlayerBase nplayer;
11532 if (PlayerBase.CastTo(nplayer, player))
11533 {
11535 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11536 }
11537 }
11538
11539
11542 {
11543 PlayerBase nplayer;
11544 if (PlayerBase.CastTo(nplayer,player))
11545 {
11546 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11547 }
11548
11549 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11550
11551 if (HasEnergyManager())
11552 {
11553 GetCompEM().UpdatePlugState();
11554 }
11555 }
11556
11557
11559 {
11560 super.OnPlacementStarted(player);
11561
11563 }
11564
11565 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11566 {
11568 {
11569 m_AdminLog.OnPlacementComplete(player,
this);
11570 }
11571
11572 super.OnPlacementComplete(player, position, orientation);
11573 }
11574
11575
11576
11577
11578
11580 {
11582 {
11583 return true;
11584 }
11585 else
11586 {
11587 return false;
11588 }
11589 }
11590
11591
11593 {
11595 {
11597 }
11598 }
11599
11600
11602 {
11604 }
11605
11607 {
11609 }
11610
11611 override void InsertAgent(
int agent,
float count = 1)
11612 {
11613 if (count < 1)
11614 return;
11615
11617 }
11618
11621 {
11623 }
11624
11625
11627 {
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
11665
11666
11667
11668
11669
11670
11671
11673 {
11675 return false;
11676 return true;
11677 }
11678
11680 {
11681
11683 }
11684
11685
11688 {
11689 super.CheckForRoofLimited(timeTresholdMS);
11690
11691 float time =
g_Game.GetTime();
11692 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11693 {
11694 m_PreviousRoofTestTime = time;
11695 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11696 }
11697 }
11698
11699
11701 {
11703 {
11704 return 0;
11705 }
11706
11707 if (GetInventory().GetAttachmentSlotsCount() != 0)
11708 {
11709 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11710 if (filter)
11711 return filter.GetProtectionLevel(type, false, system);
11712 else
11713 return 0;
11714 }
11715
11716 string subclassPath, entryName;
11717
11718 switch (type)
11719 {
11721 entryName = "biological";
11722 break;
11724 entryName = "chemical";
11725 break;
11726 default:
11727 entryName = "biological";
11728 break;
11729 }
11730
11731 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11732
11733 return g_Game.ConfigGetFloat(subclassPath + entryName);
11734 }
11735
11736
11737
11740 {
11741 if (!IsMagazine())
11743
11745 }
11746
11747
11748
11749
11750
11755 {
11756 return true;
11757 }
11758
11760 {
11762 }
11763
11764
11765
11766
11767
11769 {
11770 if (parent)
11771 {
11772 if (parent.IsInherited(DayZInfected))
11773 return true;
11774
11775 if (!parent.IsRuined())
11776 return true;
11777 }
11778
11779 return true;
11780 }
11781
11783 {
11784 if (!super.CanPutAsAttachment(parent))
11785 {
11786 return false;
11787 }
11788
11789 if (!IsRuined() && !parent.IsRuined())
11790 {
11791 return true;
11792 }
11793
11794 return false;
11795 }
11796
11798 {
11799
11800
11801
11802
11803 return super.CanReceiveItemIntoCargo(item);
11804 }
11805
11807 {
11808
11809
11810
11811
11812 GameInventory attachmentInv = attachment.GetInventory();
11814 {
11815 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11816 return false;
11817 }
11818
11819 InventoryLocation loc = new InventoryLocation();
11820 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11821 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11822 return false;
11823
11824 return super.CanReceiveAttachment(attachment, slotId);
11825 }
11826
11828 {
11829 if (!super.CanReleaseAttachment(attachment))
11830 return false;
11831
11832 return GetInventory().AreChildrenAccessible();
11833 }
11834
11835
11836
11837
11838
11839
11840
11841
11842
11843
11844
11845
11846
11847
11848
11849
11850
11851
11852
11853
11854
11856 {
11857 int id = muzzle_owner.GetMuzzleID();
11858 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11859
11860 if (WPOF_array)
11861 {
11862 for (int i = 0; i < WPOF_array.Count(); i++)
11863 {
11864 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11865
11866 if (WPOF)
11867 {
11868 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11869 }
11870 }
11871 }
11872 }
11873
11874
11876 {
11877 int id = muzzle_owner.GetMuzzleID();
11879
11880 if (WPOBE_array)
11881 {
11882 for (int i = 0; i < WPOBE_array.Count(); i++)
11883 {
11884 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11885
11886 if (WPOBE)
11887 {
11888 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11889 }
11890 }
11891 }
11892 }
11893
11894
11896 {
11897 int id = muzzle_owner.GetMuzzleID();
11898 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11899
11900 if (WPOOH_array)
11901 {
11902 for (int i = 0; i < WPOOH_array.Count(); i++)
11903 {
11904 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11905
11906 if (WPOOH)
11907 {
11908 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11909 }
11910 }
11911 }
11912 }
11913
11914
11916 {
11917 int id = muzzle_owner.GetMuzzleID();
11918 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11919
11920 if (WPOOH_array)
11921 {
11922 for (int i = 0; i < WPOOH_array.Count(); i++)
11923 {
11924 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11925
11926 if (WPOOH)
11927 {
11928 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11929 }
11930 }
11931 }
11932 }
11933
11934
11936 {
11937 int id = muzzle_owner.GetMuzzleID();
11938 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11939
11940 if (WPOOH_array)
11941 {
11942 for (int i = 0; i < WPOOH_array.Count(); i++)
11943 {
11944 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11945
11946 if (WPOOH)
11947 {
11948 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11949 }
11950 }
11951 }
11952 }
11953
11954
11955
11957 {
11959 {
11960 return true;
11961 }
11962
11963 return false;
11964 }
11965
11967 {
11969 {
11970 return true;
11971 }
11972
11973 return false;
11974 }
11975
11977 {
11979 {
11980 return true;
11981 }
11982
11983 return false;
11984 }
11985
11987 {
11988 return false;
11989 }
11990
11993 {
11994 return UATimeSpent.DEFAULT_DEPLOY;
11995 }
11996
11997
11998
11999
12001 {
12003 SetSynchDirty();
12004 }
12005
12007 {
12009 }
12010
12011
12013 {
12014 return false;
12015 }
12016
12019 {
12020 string att_type = "None";
12021
12022 if (ConfigIsExisting("soundAttType"))
12023 {
12024 att_type = ConfigGetString("soundAttType");
12025 }
12026
12028 }
12029
12031 {
12033 }
12034
12035
12036
12037
12038
12044
12046 {
12049
12051 }
12052
12053
12055 {
12057 return;
12058
12060
12063
12066
12067 SoundParameters params = new SoundParameters();
12071 }
12072
12073
12075 {
12077 {
12080
12081 SetSynchDirty();
12082
12085 }
12086 }
12087
12089 {
12091 }
12092
12093
12095 {
12097 return;
12098
12100 SetSynchDirty();
12101
12104 }
12105
12107 {
12110 }
12111
12113 {
12115 }
12116
12117 void OnApply(PlayerBase player);
12118
12120 {
12121 return 1.0;
12122 };
12123
12125 {
12127 }
12128
12130 {
12132 }
12133
12135
12137 {
12138 SetDynamicPhysicsLifeTime(0.01);
12140 }
12141
12143 {
12144 array<string> zone_names = new array<string>;
12145 GetDamageZones(zone_names);
12146 for (int i = 0; i < zone_names.Count(); i++)
12147 {
12148 SetHealthMax(zone_names.Get(i),"Health");
12149 }
12150 SetHealthMax("","Health");
12151 }
12152
12155 {
12156 float global_health = GetHealth01("","Health");
12157 array<string> zones = new array<string>;
12158 GetDamageZones(zones);
12159
12160 for (int i = 0; i < zones.Count(); i++)
12161 {
12162 SetHealth01(zones.Get(i),"Health",global_health);
12163 }
12164 }
12165
12168 {
12169 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12170 }
12171
12173 {
12174 if (!hasRootAsPlayer)
12175 {
12176 if (refParentIB)
12177 {
12178
12179 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12180 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12181
12182 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12183 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12184
12187 }
12188 else
12189 {
12190
12193 }
12194 }
12195 }
12196
12198 {
12200 {
12201 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12202 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12203 {
12204 float heatPermCoef = 1.0;
12206 while (ent)
12207 {
12208 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12209 ent = ent.GetHierarchyParent();
12210 }
12211
12212 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12213 }
12214 }
12215 }
12216
12218 {
12219
12220 EntityAI parent = GetHierarchyParent();
12221 if (!parent)
12222 {
12223 hasParent = false;
12224 hasRootAsPlayer = false;
12225 }
12226 else
12227 {
12228 hasParent = true;
12229 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12230 refParentIB =
ItemBase.Cast(parent);
12231 }
12232 }
12233
12234 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12235 {
12236
12237 }
12238
12240 {
12241
12242 return false;
12243 }
12244
12246 {
12247
12248
12249 return false;
12250 }
12251
12253 {
12254
12255 return false;
12256 }
12257
12260 {
12261 return !GetIsFrozen() &&
IsOpen();
12262 }
12263
12265 {
12266 bool hasParent = false, hasRootAsPlayer = false;
12268
12269 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12270 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12271
12272 if (wwtu || foodDecay)
12273 {
12277
12278 if (processWetness || processTemperature || processDecay)
12279 {
12281
12282 if (processWetness)
12283 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12284
12285 if (processTemperature)
12287
12288 if (processDecay)
12289 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12290 }
12291 }
12292 }
12293
12296 {
12298 }
12299
12301 {
12304
12305 return super.GetTemperatureFreezeThreshold();
12306 }
12307
12309 {
12312
12313 return super.GetTemperatureThawThreshold();
12314 }
12315
12317 {
12320
12321 return super.GetItemOverheatThreshold();
12322 }
12323
12325 {
12327 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12328
12329 return super.GetTemperatureFreezeTime();
12330 }
12331
12333 {
12335 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12336
12337 return super.GetTemperatureThawTime();
12338 }
12339
12344
12346 {
12347 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12348 }
12349
12351 {
12352 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12353 }
12354
12357 {
12359 }
12360
12362 {
12364 }
12365
12367 {
12369 }
12370
12373 {
12374 return null;
12375 }
12376
12379 {
12380 return false;
12381 }
12382
12384 {
12386 {
12389 if (!trg)
12390 {
12392 explosive = this;
12393 }
12394
12395 explosive.PairRemote(trg);
12397
12398 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12399 trg.SetPersistentPairID(persistentID);
12400 explosive.SetPersistentPairID(persistentID);
12401
12402 return true;
12403 }
12404 return false;
12405 }
12406
12409 {
12410 float ret = 1.0;
12413 ret *= GetHealth01();
12414
12415 return ret;
12416 }
12417
12418 #ifdef DEVELOPER
12419 override void SetDebugItem()
12420 {
12421 super.SetDebugItem();
12422 _itemBase = this;
12423 }
12424
12426 {
12427 string text = super.GetDebugText();
12428
12430 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12431
12432 return text;
12433 }
12434 #endif
12435
12437 {
12438 return true;
12439 }
12440
12442
12444
12446 {
12449 }
12450
12451
12459
12475
12476 [
Obsolete(
"Use ItemSoundHandler instead")]
12479 {
12480 if (!
g_Game.IsDedicatedServer())
12481 {
12482 if (ConfigIsExisting("attachSoundSet"))
12483 {
12484 string cfg_path = "";
12485 string soundset = "";
12486 string type_name =
GetType();
12487
12490 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12491 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12492
12493 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12494 {
12495 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12496 {
12497 if (cfg_slot_array[i] == slot_type)
12498 {
12499 soundset = cfg_soundset_array[i];
12500 break;
12501 }
12502 }
12503 }
12504
12505 if (soundset != "")
12506 {
12507 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12509 }
12510 }
12511 }
12512 }
12513
12515}
12516
12518{
12520 if (entity)
12521 {
12522 bool is_item = entity.IsInherited(
ItemBase);
12523 if (is_item && full_quantity)
12524 {
12527 }
12528 }
12529 else
12530 {
12532 return NULL;
12533 }
12534 return entity;
12535}
12536
12538{
12539 if (item)
12540 {
12541 if (health > 0)
12542 item.SetHealth("", "", health);
12543
12544 if (item.CanHaveTemperature())
12545 {
12547 if (item.CanFreeze())
12548 item.SetFrozen(false);
12549 }
12550
12551 if (item.HasEnergyManager())
12552 {
12553 if (quantity >= 0)
12554 {
12555 item.GetCompEM().SetEnergy0To1(quantity);
12556 }
12557 else
12558 {
12560 }
12561 }
12562 else if (item.IsMagazine())
12563 {
12564 Magazine mag = Magazine.Cast(item);
12565 if (quantity >= 0)
12566 {
12567 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12568 }
12569 else
12570 {
12572 }
12573
12574 }
12575 else
12576 {
12577 if (quantity >= 0)
12578 {
12579 item.SetQuantityNormalized(quantity, false);
12580 }
12581 else
12582 {
12584 }
12585
12586 }
12587 }
12588}
12589
12590#ifdef DEVELOPER
12592#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.