7590{
7592 {
7593 return true;
7594 }
7595};
7596
7598{
7599
7600};
7601
7602
7603
7605{
7609
7611
7614
7615
7616
7617
7618
7627
7633
7638
7643
7664 protected bool m_IsResultOfSplit
7665
7667
7672
7673
7674
7676
7680
7681
7682
7684
7687
7688
7689
7695
7696
7704
7707
7708
7710
7711
7713
7714
7719
7720
7725
7727
7728
7730
7731
7733 {
7738
7739 if (!
g_Game.IsDedicatedServer())
7740 {
7742 {
7744
7746 {
7748 }
7749 }
7750
7753 }
7754
7755 m_OldLocation = null;
7756
7758 {
7760 }
7761
7762 if (ConfigIsExisting("headSelectionsToHide"))
7763 {
7766 }
7767
7769 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7770 {
7772 }
7773
7775
7776 m_IsResultOfSplit = false;
7777
7779 }
7780
7782 {
7783 super.InitItemVariables();
7784
7790 m_Count = ConfigGetInt(
"count");
7791
7794
7799
7802
7807
7819
7823
7824
7827 if (ConfigIsExisting("canBeSplit"))
7828 {
7831 }
7832
7834 if (ConfigIsExisting("itemBehaviour"))
7836
7837
7840 RegisterNetSyncVariableInt("m_VarLiquidType");
7841 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7842
7843 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7844 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7845 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7846
7847 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7848 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7849 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7850 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7851
7852 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7853 RegisterNetSyncVariableBool("m_IsTakeable");
7854 RegisterNetSyncVariableBool("m_IsHologram");
7855
7858 {
7861 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7862 }
7863
7865
7867 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7869
7871 }
7872
7874 {
7876 }
7877
7879 {
7882 {
7887 }
7888 }
7889
7890 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7891 {
7893 {
7896 }
7897
7899 }
7900
7902 {
7908 }
7909
7911
7913 {
7915
7916 if (!action)
7917 {
7918 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7919 return;
7920 }
7921
7923 if (!ai)
7924 {
7926 return;
7927 }
7928
7930 if (!action_array)
7931 {
7932 action_array = new array<ActionBase_Basic>;
7934 }
7935 if (LogManager.IsActionLogEnable())
7936 {
7937 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7938 }
7939
7940 if (action_array.Find(action) != -1)
7941 {
7942 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7943 }
7944 else
7945 {
7946 action_array.Insert(action);
7947 }
7948 }
7949
7951 {
7952 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7953 ActionBase action = player.GetActionManager().GetAction(actionName);
7956
7957 if (action_array)
7958 {
7959 action_array.RemoveItem(action);
7960 }
7961 }
7962
7963
7964
7966 {
7967 ActionOverrideData overrideData = new ActionOverrideData();
7971
7973 if (!actionMap)
7974 {
7977 }
7978
7979 actionMap.Insert(this.
Type(), overrideData);
7980
7981 }
7982
7984
7986
7987
7989 {
7992
7995
7996 string config_to_search = "CfgVehicles";
7997 string muzzle_owner_config;
7998
8000 {
8001 if (IsInherited(Weapon))
8002 config_to_search = "CfgWeapons";
8003
8004 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8005
8006 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8007
8008 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8009
8010 if (config_OnFire_subclass_count > 0)
8011 {
8012 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8013
8014 for (int i = 0; i < config_OnFire_subclass_count; i++)
8015 {
8016 string particle_class = "";
8017 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8018 string config_OnFire_entry = config_OnFire_class + particle_class;
8019 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8020 WPOF_array.Insert(WPOF);
8021 }
8022
8023
8025 }
8026 }
8027
8029 {
8030 config_to_search = "CfgWeapons";
8031 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8032
8033 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8034
8035 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8036
8037 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8038 {
8039 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8040
8041 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8042 {
8043 string particle_class2 = "";
8044 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8045 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8046 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8047 WPOBE_array.Insert(WPOBE);
8048 }
8049
8050
8052 }
8053 }
8054 }
8055
8056
8058 {
8061
8063 {
8064 string config_to_search = "CfgVehicles";
8065
8066 if (IsInherited(Weapon))
8067 config_to_search = "CfgWeapons";
8068
8069 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8070 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8071
8072 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8073 {
8074
8076
8078 {
8080 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8082 return;
8083 }
8084
8087
8088
8089
8090 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8091 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8092
8093 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8094 {
8095 string particle_class = "";
8096 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8097 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8098 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8099
8100 if (entry_type == CT_CLASS)
8101 {
8102 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8103 WPOOH_array.Insert(WPOF);
8104 }
8105 }
8106
8107
8109 }
8110 }
8111 }
8112
8114 {
8116 }
8117
8119 {
8121 {
8123
8126
8129
8130 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8131 }
8132 }
8133
8135 {
8137 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8138
8140 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8141
8143 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8144
8146 {
8148 }
8149 }
8150
8152 {
8154 }
8155
8157 {
8160 else
8162
8164 {
8167 }
8168 else
8169 {
8172
8175 }
8176
8178 }
8179
8181 {
8183 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8184 }
8185
8187 {
8189 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8191 }
8192
8194 {
8196 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8197 }
8198
8200 {
8203
8204 OverheatingParticle OP = new OverheatingParticle();
8209
8211 }
8212
8214 {
8217
8218 return -1;
8219 }
8220
8222 {
8224 {
8227
8228 for (int i = count; i > 0; --i)
8229 {
8230 int id = i - 1;
8233
8236
8237 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8238 {
8239 if (p)
8240 {
8243 }
8244 }
8245 }
8246 }
8247 }
8248
8250 {
8252 {
8254 {
8255 int id = i - 1;
8257
8258 if (OP)
8259 {
8261
8262 if (p)
8263 {
8265 }
8266
8267 delete OP;
8268 }
8269 }
8270
8273 }
8274 }
8275
8278 {
8279 return 0.0;
8280 }
8281
8282
8284 {
8285 return 250;
8286 }
8287
8289 {
8290 return 0;
8291 }
8292
8295 {
8297 return true;
8298
8299 return false;
8300 }
8301
8304 {
8307
8309 {
8311 }
8312 else
8313 {
8314
8316 }
8317
8319 }
8320
8327 {
8328 return -1;
8329 }
8330
8331
8332
8333
8335 {
8337 {
8338 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8339 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8340
8341 if (r_index >= 0)
8342 {
8343 InventoryLocation r_il = new InventoryLocation;
8344 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8345
8346 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8349 {
8350 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8351 }
8353 {
8354 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8355 }
8356
8357 }
8358
8359 player.GetHumanInventory().ClearUserReservedLocation(this);
8360 }
8361
8364 }
8365
8366
8367
8368
8370 {
8371 return ItemBase.m_DebugActionsMask;
8372 }
8373
8375 {
8376 return ItemBase.m_DebugActionsMask & mask;
8377 }
8378
8380 {
8381 ItemBase.m_DebugActionsMask = mask;
8382 }
8383
8385 {
8386 ItemBase.m_DebugActionsMask |= mask;
8387 }
8388
8390 {
8391 ItemBase.m_DebugActionsMask &= ~mask;
8392 }
8393
8395 {
8397 {
8399 }
8400 else
8401 {
8403 }
8404 }
8405
8406
8408 {
8409 if (GetEconomyProfile())
8410 {
8411 float q_max = GetEconomyProfile().GetQuantityMax();
8412 if (q_max > 0)
8413 {
8414 float q_min = GetEconomyProfile().GetQuantityMin();
8415 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8416
8418 {
8419 ComponentEnergyManager comp = GetCompEM();
8421 {
8423 }
8424 }
8426 {
8428
8429 }
8430
8431 }
8432 }
8433 }
8434
8437 {
8438 EntityAI parent = GetHierarchyParent();
8439
8440 if (parent)
8441 {
8442 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8443 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8444 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8445 }
8446 }
8447
8450 {
8451 EntityAI parent = GetHierarchyParent();
8452
8453 if (parent)
8454 {
8455 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8456 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8457 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8458 }
8459 }
8460
8462 {
8463
8464
8465
8466
8468
8470 {
8471 if (ScriptInputUserData.CanStoreInputUserData())
8472 {
8473 ScriptInputUserData ctx = new ScriptInputUserData;
8479 ctx.
Write(use_stack_max);
8482
8484 {
8485 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8486 }
8487 }
8488 }
8489 else if (!
g_Game.IsMultiplayer())
8490 {
8492 }
8493 }
8494
8496 {
8498 }
8499
8501 {
8503 }
8504
8506 {
8508 }
8509
8511 {
8512
8513 return false;
8514 }
8515
8517 {
8518 return false;
8519 }
8520
8524 {
8525 return false;
8526 }
8527
8529 {
8530 return "";
8531 }
8532
8534
8536 {
8537 return false;
8538 }
8539
8541 {
8542 return true;
8543 }
8544
8545
8546
8548 {
8549 return true;
8550 }
8551
8553 {
8554 return true;
8555 }
8556
8558 {
8559 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8561 }
8562
8564 {
8566 }
8567
8569 {
8571 if (!is_being_placed)
8573 SetSynchDirty();
8574 }
8575
8576
8578
8580 {
8582 }
8583
8585 {
8587 }
8588
8590 {
8591 return 1;
8592 }
8593
8595 {
8596 return false;
8597 }
8598
8600 {
8602 SetSynchDirty();
8603 }
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8637
8638
8640 {
8641 super.OnMovedInsideCargo(container);
8642
8643 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8644 }
8645
8646 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8647 {
8648 super.EEItemLocationChanged(oldLoc, newLoc);
8649
8650 PlayerBase newPlayer = null;
8651 PlayerBase oldPlayer = null;
8652
8653 if (newLoc.GetParent())
8654 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8655
8656 if (oldLoc.GetParent())
8657 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8658
8660 {
8661 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8662
8663 if (rIndex >= 0)
8664 {
8665 InventoryLocation rIl = new InventoryLocation;
8666 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8667
8668 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8671 {
8672 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8673 }
8675 {
8677 }
8678
8679 }
8680 }
8681
8683 {
8684 if (newPlayer)
8685 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8686
8687 if (newPlayer == oldPlayer)
8688 {
8689 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8690 {
8692 {
8693 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8694 {
8695 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8696 }
8697 }
8698 else
8699 {
8700 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8701 }
8702 }
8703
8704 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8705 {
8706 int type = oldLoc.GetType();
8708 {
8709 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8710 }
8712 {
8713 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8714 }
8715 }
8716 if (!m_OldLocation)
8717 {
8718 m_OldLocation = new InventoryLocation;
8719 }
8720 m_OldLocation.Copy(oldLoc);
8721 }
8722 else
8723 {
8724 if (m_OldLocation)
8725 {
8726 m_OldLocation.Reset();
8727 }
8728 }
8729
8730 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8731 }
8732 else
8733 {
8734 if (newPlayer)
8735 {
8736 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8737 if (resIndex >= 0)
8738 {
8739 InventoryLocation il = new InventoryLocation;
8740 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8742 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8745 {
8746 il.
GetParent().GetOnReleaseLock().Invoke(it);
8747 }
8749 {
8751 }
8752
8753 }
8754 }
8756 {
8757
8759 }
8760
8761 if (m_OldLocation)
8762 {
8763 m_OldLocation.Reset();
8764 }
8765 }
8766
8768 {
8769 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8770 }
8771
8773 {
8774 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8775 }
8776 }
8777
8778 override void EOnContact(IEntity other, Contact extra)
8779 {
8781 {
8782 int liquidType = -1;
8784 if (impactSpeed > 0.0)
8785 {
8787 #ifndef SERVER
8789 #else
8791 SetSynchDirty();
8792 #endif
8794 }
8795 }
8796
8797 #ifdef SERVER
8798 if (GetCompEM() && GetCompEM().IsPlugged())
8799 {
8800 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8801 GetCompEM().UnplugThis();
8802 }
8803 #endif
8804 }
8805
8807
8809 {
8811 }
8812
8814 {
8815
8816 }
8817
8819 {
8820 super.OnItemLocationChanged(old_owner, new_owner);
8821
8822 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8823 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8824
8825 if (!relatedPlayer && playerNew)
8826 relatedPlayer = playerNew;
8827
8828 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8829 {
8831 if (actionMgr)
8832 {
8833 ActionBase currentAction = actionMgr.GetRunningAction();
8834 if (currentAction)
8836 }
8837 }
8838
8839 Man ownerPlayerOld = null;
8840 Man ownerPlayerNew = null;
8841
8842 if (old_owner)
8843 {
8844 if (old_owner.
IsMan())
8845 {
8846 ownerPlayerOld = Man.Cast(old_owner);
8847 }
8848 else
8849 {
8850 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8851 }
8852 }
8853 else
8854 {
8856 {
8858
8859 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8860 {
8861 GetCompEM().UnplugThis();
8862 }
8863 }
8864 }
8865
8866 if (new_owner)
8867 {
8868 if (new_owner.
IsMan())
8869 {
8870 ownerPlayerNew = Man.Cast(new_owner);
8871 }
8872 else
8873 {
8874 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8875 }
8876 }
8877
8878 if (ownerPlayerOld != ownerPlayerNew)
8879 {
8880 if (ownerPlayerOld)
8881 {
8882 array<EntityAI> subItemsExit = new array<EntityAI>;
8884 for (int i = 0; i < subItemsExit.Count(); i++)
8885 {
8888 }
8889 }
8890
8891 if (ownerPlayerNew)
8892 {
8893 array<EntityAI> subItemsEnter = new array<EntityAI>;
8895 for (int j = 0; j < subItemsEnter.Count(); j++)
8896 {
8899 }
8900 }
8901 }
8902 else if (ownerPlayerNew != null)
8903 {
8904 PlayerBase nplayer;
8905 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8906 {
8907 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8909 for (int k = 0; k < subItemsUpdate.Count(); k++)
8910 {
8912 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8913 }
8914 }
8915 }
8916
8917 if (old_owner)
8918 old_owner.OnChildItemRemoved(this);
8919 if (new_owner)
8920 new_owner.OnChildItemReceived(this);
8921 }
8922
8923
8925 {
8926 super.EEDelete(parent);
8927 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8928 if (player)
8929 {
8931
8932 if (player.IsAlive())
8933 {
8934 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8935 if (r_index >= 0)
8936 {
8937 InventoryLocation r_il = new InventoryLocation;
8938 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8939
8940 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8943 {
8944 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8945 }
8947 {
8948 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8949 }
8950
8951 }
8952
8953 player.RemoveQuickBarEntityShortcut(this);
8954 }
8955 }
8956 }
8957
8959 {
8960 super.EEKilled(killer);
8961
8964 {
8965 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8966 {
8967 if (IsMagazine())
8968 {
8969 if (Magazine.Cast(this).GetAmmoCount() > 0)
8970 {
8972 }
8973 }
8974 else
8975 {
8977 }
8978 }
8979 }
8980 }
8981
8983 {
8984 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8985
8986 super.OnWasAttached(parent, slot_id);
8987
8990
8993 }
8994
8996 {
8997 super.OnWasDetached(parent, slot_id);
8998
9001
9004 }
9005
9007 {
9008 int idx;
9011
9012 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9013 if (inventory_slots.Count() < 1)
9014 {
9015 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9016 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9017 }
9018 else
9019 {
9020 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9021 }
9022
9023 idx = inventory_slots.Find(slot);
9024 if (idx < 0)
9025 return "";
9026
9027 return attach_types.Get(idx);
9028 }
9029
9031 {
9032 int idx = -1;
9033 string slot;
9034
9037
9038 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9039 if (inventory_slots.Count() < 1)
9040 {
9041 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9042 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9043 }
9044 else
9045 {
9046 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9047 if (detach_types.Count() < 1)
9048 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9049 }
9050
9051 for (int i = 0; i < inventory_slots.Count(); i++)
9052 {
9053 slot = inventory_slots.Get(i);
9054 }
9055
9056 if (slot != "")
9057 {
9058 if (detach_types.Count() == 1)
9059 idx = 0;
9060 else
9061 idx = inventory_slots.Find(slot);
9062 }
9063 if (idx < 0)
9064 return "";
9065
9066 return detach_types.Get(idx);
9067 }
9068
9070 {
9071
9073
9074
9075 float min_time = 1;
9076 float max_time = 3;
9077 float delay = Math.RandomFloat(min_time, max_time);
9078
9079 explode_timer.Run(delay, this, "DoAmmoExplosion");
9080 }
9081
9083 {
9084 Magazine magazine = Magazine.Cast(this);
9085 int pop_sounds_count = 6;
9086 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9087
9088
9089 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9090 string sound_name = pop_sounds[ sound_idx ];
9091 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9092
9093
9094 magazine.ServerAddAmmoCount(-1);
9095
9096
9097 float min_temp_to_explode = 100;
9098
9099 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9100 {
9102 }
9103 }
9104
9105
9106 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9107 {
9108 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9109
9110 const int CHANCE_DAMAGE_CARGO = 4;
9111 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9112 const int CHANCE_DAMAGE_NOTHING = 2;
9113
9115 {
9116 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9117 int chances;
9118 int rnd;
9119
9120 if (GetInventory().GetCargo())
9121 {
9122 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9123 rnd = Math.RandomInt(0,chances);
9124
9125 if (rnd < CHANCE_DAMAGE_CARGO)
9126 {
9128 }
9129 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9130 {
9132 }
9133 }
9134 else
9135 {
9136 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9137 rnd = Math.RandomInt(0,chances);
9138
9139 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9140 {
9142 }
9143 }
9144 }
9145 }
9146
9148 {
9149 CargoBase cargo = GetInventory().GetCargo();
9150 if (cargo)
9151 {
9153 if (item_count > 0)
9154 {
9155 int random_pick = Math.RandomInt(0, item_count);
9157 if (!item.IsExplosive())
9158 {
9159 item.AddHealth("","",damage);
9160 return true;
9161 }
9162 }
9163 }
9164 return false;
9165 }
9166
9168 {
9169 GameInventory inventory = GetInventory();
9171 if (attachment_count > 0)
9172 {
9173 int random_pick = Math.RandomInt(0, attachment_count);
9175 if (!attachment.IsExplosive())
9176 {
9177 attachment.AddHealth("","",damage);
9178 return true;
9179 }
9180 }
9181 return false;
9182 }
9183
9185 {
9187 }
9188
9190 {
9192 return GetInventory().CanRemoveEntity();
9193
9194 return false;
9195 }
9196
9198 {
9199
9201 return false;
9202
9203
9205 return false;
9206
9207
9208
9210 if (delta == 0)
9211 return false;
9212
9213
9214 return true;
9215 }
9216
9218 {
9220 {
9221 if (ScriptInputUserData.CanStoreInputUserData())
9222 {
9223 ScriptInputUserData ctx = new ScriptInputUserData;
9228 ctx.
Write(destination_entity);
9232 }
9233 }
9234 else if (!
g_Game.IsMultiplayer())
9235 {
9237 }
9238 }
9239
9241 {
9242 float split_quantity_new;
9246 InventoryLocation loc = new InventoryLocation;
9247
9248 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9249 {
9251 split_quantity_new = stack_max;
9252 else
9254
9256 {
9257 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9258 if (new_item)
9259 {
9260 new_item.SetResultOfSplit(true);
9261 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9263 new_item.
SetQuantity(split_quantity_new,
false,
true);
9264 }
9265 }
9266 }
9267 else if (destination_entity && slot_id == -1)
9268 {
9269 if (quantity > stack_max)
9270 split_quantity_new = stack_max;
9271 else
9272 split_quantity_new = quantity;
9273
9275 {
9276 GameInventory destinationInventory = destination_entity.GetInventory();
9278 {
9281 }
9282
9283 if (new_item)
9284 {
9285 new_item.SetResultOfSplit(true);
9286 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9288 new_item.
SetQuantity(split_quantity_new,
false,
true);
9289 }
9290 }
9291 }
9292 else
9293 {
9294 if (stack_max != 0)
9295 {
9297 {
9299 }
9300
9301 if (split_quantity_new == 0)
9302 {
9303 if (!
g_Game.IsMultiplayer())
9304 player.PhysicalPredictiveDropItem(this);
9305 else
9306 player.ServerDropEntity(this);
9307 return;
9308 }
9309
9311 {
9313
9314 if (new_item)
9315 {
9316 new_item.SetResultOfSplit(true);
9317 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9320 new_item.PlaceOnSurface();
9321 }
9322 }
9323 }
9324 }
9325 }
9326
9328 {
9329 float split_quantity_new;
9333 InventoryLocation loc = new InventoryLocation;
9334
9335 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9336 {
9338 split_quantity_new = stack_max;
9339 else
9341
9343 {
9344 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9345 if (new_item)
9346 {
9347 new_item.SetResultOfSplit(true);
9348 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9350 new_item.
SetQuantity(split_quantity_new,
false,
true);
9351 }
9352 }
9353 }
9354 else if (destination_entity && slot_id == -1)
9355 {
9356 if (quantity > stack_max)
9357 split_quantity_new = stack_max;
9358 else
9359 split_quantity_new = quantity;
9360
9362 {
9363 GameInventory destinationInventory = destination_entity.GetInventory();
9365 {
9368 }
9369
9370 if (new_item)
9371 {
9372 new_item.SetResultOfSplit(true);
9373 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9375 new_item.
SetQuantity(split_quantity_new,
false,
true);
9376 }
9377 }
9378 }
9379 else
9380 {
9381 if (stack_max != 0)
9382 {
9384 {
9386 }
9387
9389 {
9391
9392 if (new_item)
9393 {
9394 new_item.SetResultOfSplit(true);
9395 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9398 new_item.PlaceOnSurface();
9399 }
9400 }
9401 }
9402 }
9403 }
9404
9406 {
9408 {
9409 if (ScriptInputUserData.CanStoreInputUserData())
9410 {
9411 ScriptInputUserData ctx = new ScriptInputUserData;
9416 dst.WriteToContext(ctx);
9418 }
9419 }
9420 else if (!
g_Game.IsMultiplayer())
9421 {
9423 }
9424 }
9425
9427 {
9429 {
9430 if (ScriptInputUserData.CanStoreInputUserData())
9431 {
9432 ScriptInputUserData ctx = new ScriptInputUserData;
9437 ctx.
Write(destination_entity);
9443 }
9444 }
9445 else if (!
g_Game.IsMultiplayer())
9446 {
9448 }
9449 }
9450
9452 {
9454 }
9455
9457 {
9459 float split_quantity_new;
9461 if (dst.IsValid())
9462 {
9463 int slot_id = dst.GetSlot();
9465
9466 if (quantity > stack_max)
9467 split_quantity_new = stack_max;
9468 else
9469 split_quantity_new = quantity;
9470
9472 {
9474
9475 if (new_item)
9476 {
9477 new_item.SetResultOfSplit(true);
9478 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9480 new_item.
SetQuantity(split_quantity_new,
false,
true);
9481 }
9482
9483 return new_item;
9484 }
9485 }
9486
9487 return null;
9488 }
9489
9491 {
9493 float split_quantity_new;
9495 if (destination_entity)
9496 {
9498 if (quantity > stackable)
9499 split_quantity_new = stackable;
9500 else
9501 split_quantity_new = quantity;
9502
9504 {
9505 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9506 if (new_item)
9507 {
9508 new_item.SetResultOfSplit(true);
9509 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9511 new_item.
SetQuantity(split_quantity_new,
false,
true);
9512 }
9513 }
9514 }
9515 }
9516
9518 {
9520 {
9521 if (ScriptInputUserData.CanStoreInputUserData())
9522 {
9523 ScriptInputUserData ctx = new ScriptInputUserData;
9528 ItemBase destination_entity =
this;
9529 ctx.
Write(destination_entity);
9533 }
9534 }
9535 else if (!
g_Game.IsMultiplayer())
9536 {
9538 }
9539 }
9540
9542 {
9544 float split_quantity_new;
9546 if (player)
9547 {
9549 if (quantity > stackable)
9550 split_quantity_new = stackable;
9551 else
9552 split_quantity_new = quantity;
9553
9555 {
9556 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9557 new_item =
ItemBase.Cast(in_hands);
9558 if (new_item)
9559 {
9560 new_item.SetResultOfSplit(true);
9561 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9563 new_item.SetQuantity(split_quantity_new, false, true);
9564 }
9565 }
9566 }
9567 }
9568
9570 {
9572 float split_quantity_new = Math.Floor(quantity * 0.5);
9573
9575 return;
9576
9578
9579 if (new_item)
9580 {
9581 if (new_item.GetQuantityMax() < split_quantity_new)
9582 {
9583 split_quantity_new = new_item.GetQuantityMax();
9584 }
9585
9586 new_item.SetResultOfSplit(true);
9587 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9588
9590 {
9593 }
9594 else
9595 {
9597 new_item.
SetQuantity(split_quantity_new,
false,
true);
9598 }
9599 }
9600 }
9601
9603 {
9605 float split_quantity_new = Math.Floor(quantity / 2);
9606
9608 return;
9609
9610 InventoryLocation invloc = new InventoryLocation;
9612
9614 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9615
9616 if (new_item)
9617 {
9618 if (new_item.GetQuantityMax() < split_quantity_new)
9619 {
9620 split_quantity_new = new_item.GetQuantityMax();
9621 }
9623 {
9626 }
9627 else if (split_quantity_new > 1)
9628 {
9630 new_item.
SetQuantity(split_quantity_new,
false,
true);
9631 }
9632 }
9633 }
9634
9637 {
9638 SetWeightDirty();
9640
9641 if (parent)
9642 parent.OnAttachmentQuantityChangedEx(this, delta);
9643
9645 {
9647 {
9649 }
9651 {
9652 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9654 }
9655 }
9656 }
9657
9660 {
9661
9662 }
9663
9666 {
9668 }
9669
9671 {
9672 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9673
9675 {
9676 if (newLevel == GameConstants.STATE_RUINED)
9677 {
9679 EntityAI parent = GetHierarchyParent();
9680 if (parent && parent.IsFireplace())
9681 {
9682 CargoBase cargo = GetInventory().GetCargo();
9683 if (cargo)
9684 {
9686 {
9688 }
9689 }
9690 }
9691 }
9692
9694 {
9695
9697 return;
9698 }
9699
9700 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9701 {
9703 }
9704 }
9705 }
9706
9707
9709 {
9710 super.OnRightClick();
9711
9713 {
9715 {
9716 if (ScriptInputUserData.CanStoreInputUserData())
9717 {
9718 EntityAI root = GetHierarchyRoot();
9719 Man playerOwner = GetHierarchyRootPlayer();
9720 InventoryLocation dst = new InventoryLocation;
9721
9722
9723 if (!playerOwner && root && root == this)
9724 {
9726 }
9727 else
9728 {
9729
9730 GetInventory().GetCurrentInventoryLocation(dst);
9732 {
9733 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9735 {
9737 }
9738 else
9739 {
9741
9742
9743 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9744 {
9746 }
9747 else
9748 {
9749 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9750 }
9751 }
9752 }
9753 }
9754
9755 ScriptInputUserData ctx = new ScriptInputUserData;
9763 }
9764 }
9765 else if (!
g_Game.IsMultiplayer())
9766 {
9768 }
9769 }
9770 }
9771
9773 {
9774 if (root)
9775 {
9776 vector m4[4];
9777 root.GetTransform(m4);
9778 dst.SetGround(this, m4);
9779 }
9780 else
9781 {
9782 GetInventory().GetCurrentInventoryLocation(dst);
9783 }
9784 }
9785
9786 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9787 {
9788
9789 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9790 return false;
9791
9792 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9793 return false;
9794
9795
9797 return false;
9798
9799
9800 Magazine mag = Magazine.Cast(this);
9801 if (mag)
9802 {
9803 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9804 return false;
9805
9806 if (stack_max_limit)
9807 {
9808 Magazine other_mag = Magazine.Cast(other_item);
9809 if (other_item)
9810 {
9811 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9812 return false;
9813 }
9814
9815 }
9816 }
9817 else
9818 {
9819
9821 return false;
9822
9824 return false;
9825 }
9826
9827 PlayerBase player = null;
9828 if (CastTo(player, GetHierarchyRootPlayer()))
9829 {
9830 if (player.GetInventory().HasAttachment(this))
9831 return false;
9832
9833 if (player.IsItemsToDelete())
9834 return false;
9835 }
9836
9837 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9838 return false;
9839
9840 int slotID;
9842 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9843 return false;
9844
9845 return true;
9846 }
9847
9849 {
9851 }
9852
9854 {
9855 return m_IsResultOfSplit;
9856 }
9857
9859 {
9860 m_IsResultOfSplit = value;
9861 }
9862
9864 {
9866 }
9867
9869 {
9870 float other_item_quantity = other_item.GetQuantity();
9871 float this_free_space;
9872
9874
9876
9877 if (other_item_quantity > this_free_space)
9878 {
9879 return this_free_space;
9880 }
9881 else
9882 {
9883 return other_item_quantity;
9884 }
9885 }
9886
9888 {
9890 }
9891
9893 {
9895 return;
9896
9897 if (!IsMagazine() && other_item)
9898 {
9900 if (quantity_used != 0)
9901 {
9902 float hp1 = GetHealth01("","");
9903 float hp2 = other_item.GetHealth01("","");
9904 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9905 hpResult = hpResult / (
GetQuantity() + quantity_used);
9906
9907 hpResult *= GetMaxHealth();
9908 Math.Round(hpResult);
9909 SetHealth("", "Health", hpResult);
9910
9912 other_item.AddQuantity(-quantity_used);
9913 }
9914 }
9916 }
9917
9919 {
9920 #ifdef SERVER
9921 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9922 GetHierarchyParent().IncreaseLifetimeUp();
9923 #endif
9924 };
9925
9927 {
9928 PlayerBase p = PlayerBase.Cast(player);
9929
9930 array<int> recipesIds = p.m_Recipes;
9931 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9932 if (moduleRecipesManager)
9933 {
9934 EntityAI itemInHands = player.GetEntityInHands();
9935 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9936 }
9937
9938 for (int i = 0;i < recipesIds.Count(); i++)
9939 {
9940 int key = recipesIds.Get(i);
9941 string recipeName = moduleRecipesManager.GetRecipeName(key);
9943 }
9944 }
9945
9946
9947 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9948 {
9949 super.GetDebugActions(outputList);
9950
9951
9957
9958
9963
9968
9969
9973
9974
9976 {
9980 }
9981
9984
9985
9989
9991
9992 InventoryLocation loc = new InventoryLocation();
9993 GetInventory().GetCurrentInventoryLocation(loc);
9995 {
9996 if (Gizmo_IsSupported())
9999 }
10000
10002 }
10003
10004
10005
10006
10008 {
10009 super.OnAction(action_id, player, ctx);
10010
10012 {
10013 switch (action_id)
10014 {
10018 return true;
10022 return true;
10023 }
10024 }
10025
10027 {
10028 switch (action_id)
10029 {
10031 Delete();
10032 return true;
10033 }
10034 }
10035
10036 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10037 {
10038 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10039 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10040 PlayerBase p = PlayerBase.Cast(player);
10041 if (
EActions.RECIPES_RANGE_START < 1000)
10042 {
10043 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10044 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10045 }
10046 }
10047 #ifndef SERVER
10048 else if (action_id ==
EActions.WATCH_PLAYER)
10049 {
10050 PluginDeveloper.SetDeveloperItemClientEx(player);
10051 }
10052 #endif
10054 {
10055 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10056 {
10057 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10058 OnDebugButtonPressServer(id + 1);
10059 }
10060
10061 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10062 {
10063 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10065 }
10066
10067 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10068 {
10069 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10071 }
10072
10073 else if (action_id ==
EActions.ADD_QUANTITY)
10074 {
10075 if (IsMagazine())
10076 {
10077 Magazine mag = Magazine.Cast(this);
10078 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10079 }
10080 else
10081 {
10083 }
10084
10085 if (m_EM)
10086 {
10087 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10088 }
10089
10090 }
10091
10092 else if (action_id ==
EActions.REMOVE_QUANTITY)
10093 {
10094 if (IsMagazine())
10095 {
10096 Magazine mag2 = Magazine.Cast(this);
10097 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10098 }
10099 else
10100 {
10102 }
10103 if (m_EM)
10104 {
10105 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10106 }
10107
10108 }
10109
10110 else if (action_id ==
EActions.SET_QUANTITY_0)
10111 {
10113
10114 if (m_EM)
10115 {
10116 m_EM.SetEnergy(0);
10117 }
10118 }
10119
10120 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10121 {
10123
10124 if (m_EM)
10125 {
10126 m_EM.SetEnergy(m_EM.GetEnergyMax());
10127 }
10128 }
10129
10130 else if (action_id ==
EActions.ADD_HEALTH)
10131 {
10132 AddHealth("","",GetMaxHealth("","Health")/5);
10133 }
10134 else if (action_id ==
EActions.REMOVE_HEALTH)
10135 {
10136 AddHealth("","",-GetMaxHealth("","Health")/5);
10137 }
10138 else if (action_id ==
EActions.DESTROY_HEALTH)
10139 {
10140 SetHealth01("","",0);
10141 }
10142 else if (action_id ==
EActions.WATCH_ITEM)
10143 {
10145 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10146 #ifdef DEVELOPER
10147 SetDebugDeveloper_item(this);
10148 #endif
10149 }
10150
10151 else if (action_id ==
EActions.ADD_TEMPERATURE)
10152 {
10153 AddTemperature(20);
10154
10155 }
10156
10157 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10158 {
10159 AddTemperature(-20);
10160
10161 }
10162
10163 else if (action_id ==
EActions.FLIP_FROZEN)
10164 {
10165 SetFrozen(!GetIsFrozen());
10166
10167 }
10168
10169 else if (action_id ==
EActions.ADD_WETNESS)
10170 {
10172
10173 }
10174
10175 else if (action_id ==
EActions.REMOVE_WETNESS)
10176 {
10178
10179 }
10180
10181 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10182 {
10185
10186
10187 }
10188
10189 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10190 {
10193 }
10194
10195 else if (action_id ==
EActions.MAKE_SPECIAL)
10196 {
10197 auto debugParams = DebugSpawnParams.WithPlayer(player);
10198 OnDebugSpawnEx(debugParams);
10199 }
10200
10201 }
10202
10203
10204 return false;
10205 }
10206
10207
10208
10209
10213
10216
10217
10218
10220 {
10221 return false;
10222 }
10223
10224
10226 {
10227 return true;
10228 }
10229
10230
10232 {
10233 return true;
10234 }
10235
10236
10237
10239 {
10240 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10241 return g_Game.ConfigIsExisting(config_path);
10242 }
10243
10246 {
10247 return null;
10248 }
10249
10251 {
10252 return false;
10253 }
10254
10256 {
10257 return false;
10258 }
10259
10263
10264
10266 {
10267 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10268 return module_repairing.CanRepair(this, item_repair_kit);
10269 }
10270
10271
10272 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10273 {
10274 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10275 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10276 }
10277
10278
10280 {
10281
10282
10283
10284
10285
10286
10287
10288
10289 return 1;
10290 }
10291
10292
10293
10295 {
10297 }
10298
10299
10300
10302 {
10304 }
10305
10306
10315 {
10316 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10317
10318 if (player)
10319 {
10320 player.MessageStatus(text);
10321 }
10322 }
10323
10324
10333 {
10334 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10335
10336 if (player)
10337 {
10338 player.MessageAction(text);
10339 }
10340 }
10341
10342
10351 {
10352 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10353
10354 if (player)
10355 {
10356 player.MessageFriendly(text);
10357 }
10358 }
10359
10360
10369 {
10370 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10371
10372 if (player)
10373 {
10374 player.MessageImportant(text);
10375 }
10376 }
10377
10379 {
10380 return true;
10381 }
10382
10383
10384 override bool KindOf(
string tag)
10385 {
10386 bool found = false;
10387 string item_name = this.
GetType();
10389 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10390
10391 int array_size = item_tag_array.Count();
10392 for (int i = 0; i < array_size; i++)
10393 {
10394 if (item_tag_array.Get(i) == tag)
10395 {
10396 found = true;
10397 break;
10398 }
10399 }
10400 return found;
10401 }
10402
10403
10405 {
10406
10407 super.OnRPC(sender, rpc_type,ctx);
10408
10409
10410 switch (rpc_type)
10411 {
10412 #ifndef SERVER
10413 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10414 Param2<bool, string> p = new Param2<bool, string>(false, "");
10415
10417 return;
10418
10419 bool play = p.param1;
10420 string soundSet = p.param2;
10421
10422 if (play)
10423 {
10425 {
10427 {
10429 }
10430 }
10431 else
10432 {
10434 }
10435 }
10436 else
10437 {
10439 }
10440
10441 break;
10442 #endif
10443
10444 }
10445
10447 {
10449 }
10450 }
10451
10452
10453
10454
10456 {
10457 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10458 return plugin.GetID(
name);
10459 }
10460
10462 {
10463 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10464 return plugin.GetName(id);
10465 }
10466
10469 {
10470
10471
10472 int varFlags;
10473 if (!ctx.
Read(varFlags))
10474 return;
10475
10476 if (varFlags & ItemVariableFlags.FLOAT)
10477 {
10479 }
10480 }
10481
10483 {
10484
10485 super.SerializeNumericalVars(floats_out);
10486
10487
10488
10490 {
10492 }
10493
10495 {
10497 }
10498
10500 {
10502 }
10503
10505 {
10510 }
10511
10513 {
10515 }
10516 }
10517
10519 {
10520
10521 super.DeSerializeNumericalVars(floats);
10522
10523
10524 int index = 0;
10525 int mask = Math.Round(floats.Get(index));
10526
10527 index++;
10528
10530 {
10532 {
10534 }
10535 else
10536 {
10537 float quantity = floats.Get(index);
10538 SetQuantity(quantity,
true,
false,
false,
false);
10539 }
10540 index++;
10541 }
10542
10544 {
10545 float wet = floats.Get(index);
10547 index++;
10548 }
10549
10551 {
10552 int liquidtype = Math.Round(floats.Get(index));
10554 index++;
10555 }
10556
10558 {
10560 index++;
10562 index++;
10564 index++;
10566 index++;
10567 }
10568
10570 {
10571 int cleanness = Math.Round(floats.Get(index));
10573 index++;
10574 }
10575 }
10576
10578 {
10579 super.WriteVarsToCTX(ctx);
10580
10581
10583 {
10585 }
10586
10588 {
10590 }
10591
10593 {
10595 }
10596
10598 {
10599 int r,g,b,a;
10605 }
10606
10608 {
10610 }
10611 }
10612
10614 {
10615 if (!super.ReadVarsFromCTX(ctx,version))
10616 return false;
10617
10618 int intValue;
10619 float value;
10620
10621 if (version < 140)
10622 {
10623 if (!ctx.
Read(intValue))
10624 return false;
10625
10626 m_VariablesMask = intValue;
10627 }
10628
10630 {
10631 if (!ctx.
Read(value))
10632 return false;
10633
10635 {
10637 }
10638 else
10639 {
10641 }
10642 }
10643
10644 if (version < 140)
10645 {
10647 {
10648 if (!ctx.
Read(value))
10649 return false;
10650 SetTemperatureDirect(value);
10651 }
10652 }
10653
10655 {
10656 if (!ctx.
Read(value))
10657 return false;
10659 }
10660
10662 {
10663 if (!ctx.
Read(intValue))
10664 return false;
10666 }
10667
10669 {
10670 int r,g,b,a;
10672 return false;
10674 return false;
10676 return false;
10678 return false;
10679
10681 }
10682
10684 {
10685 if (!ctx.
Read(intValue))
10686 return false;
10688 }
10689
10690 if (version >= 138 && version < 140)
10691 {
10693 {
10694 if (!ctx.
Read(intValue))
10695 return false;
10696 SetFrozen(intValue);
10697 }
10698 }
10699
10700 return true;
10701 }
10702
10703
10705 {
10708 {
10710 }
10711
10712 if (!super.OnStoreLoad(ctx, version))
10713 {
10715 return false;
10716 }
10717
10718 if (version >= 114)
10719 {
10720 bool hasQuickBarIndexSaved;
10721
10722 if (!ctx.
Read(hasQuickBarIndexSaved))
10723 {
10725 return false;
10726 }
10727
10728 if (hasQuickBarIndexSaved)
10729 {
10730 int itmQBIndex;
10731
10732
10733 if (!ctx.
Read(itmQBIndex))
10734 {
10736 return false;
10737 }
10738
10739 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10740 if (itmQBIndex != -1 && parentPlayer)
10741 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10742 }
10743 }
10744 else
10745 {
10746
10747 PlayerBase player;
10748 int itemQBIndex;
10749 if (version ==
int.
MAX)
10750 {
10751 if (!ctx.
Read(itemQBIndex))
10752 {
10754 return false;
10755 }
10756 }
10757 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10758 {
10759
10760 if (!ctx.
Read(itemQBIndex))
10761 {
10763 return false;
10764 }
10765 if (itemQBIndex != -1 && player)
10766 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10767 }
10768 }
10769
10770 if (version < 140)
10771 {
10772
10773 if (!LoadVariables(ctx, version))
10774 {
10776 return false;
10777 }
10778 }
10779
10780
10782 {
10784 return false;
10785 }
10786 if (version >= 132)
10787 {
10789 if (raib)
10790 {
10792 {
10794 return false;
10795 }
10796 }
10797 }
10798
10800 return true;
10801 }
10802
10803
10804
10806 {
10807 super.OnStoreSave(ctx);
10808
10809 PlayerBase player;
10810 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10811 {
10813
10814 int itemQBIndex = -1;
10815 itemQBIndex = player.FindQuickBarEntityIndex(this);
10816 ctx.
Write(itemQBIndex);
10817 }
10818 else
10819 {
10821 }
10822
10824
10826 if (raib)
10827 {
10829 }
10830 }
10831
10832
10834 {
10835 super.AfterStoreLoad();
10836
10838 {
10840 }
10841
10843 {
10846 }
10847 }
10848
10850 {
10851 super.EEOnAfterLoad();
10852
10854 {
10856 }
10857
10860 }
10861
10863 {
10864 return false;
10865 }
10866
10867
10868
10870 {
10872 {
10873 #ifdef PLATFORM_CONSOLE
10874
10876 {
10878 if (menu)
10879 {
10881 }
10882 }
10883 #endif
10884 }
10885
10887 {
10890 }
10891
10893 {
10894 SetWeightDirty();
10896 }
10898 {
10901 }
10902
10904 {
10907
10910 }
10912 {
10916 }
10917
10918 super.OnVariablesSynchronized();
10919 }
10920
10921
10922
10924 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10925 {
10926 if (!IsServerCheck(allow_client))
10927 return false;
10928
10930 return false;
10931
10934
10935 if (value <= (min + 0.001))
10936 value = min;
10937
10938 if (value == min)
10939 {
10940 if (destroy_config)
10941 {
10942 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10943 if (dstr)
10944 {
10946 this.Delete();
10947 return true;
10948 }
10949 }
10950 else if (destroy_forced)
10951 {
10953 this.Delete();
10954 return true;
10955 }
10956
10958 }
10959
10962
10964 {
10965 EntityAI parent = GetHierarchyRoot();
10966 InventoryLocation iLoc = new InventoryLocation();
10967 GetInventory().GetCurrentInventoryLocation(iLoc);
10969 {
10970 int iLocSlot = iLoc.
GetSlot();
10972 {
10974 }
10976 {
10978 }
10979 }
10980 }
10981
10983 {
10985
10986 if (delta)
10988 }
10989
10991
10992 return false;
10993 }
10994
10995
10997 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10998 {
11000 }
11001
11003 {
11006 }
11007
11009 {
11012 }
11013
11015 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11016 {
11017 float value_clamped = Math.Clamp(value, 0, 1);
11019 SetQuantity(result, destroy_config, destroy_forced);
11020 }
11021
11022
11025 {
11027 }
11028
11030 {
11032 }
11033
11034
11035
11036
11037
11038
11039
11040
11041
11042
11044 {
11045 int slot = -1;
11046 GameInventory inventory = GetInventory();
11047 if (inventory)
11048 {
11049 InventoryLocation il = new InventoryLocation;
11052 }
11053
11055 }
11056
11058 {
11059 float quantity_max = 0;
11060
11062 {
11063 if (attSlotID != -1)
11064 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11065
11066 if (quantity_max <= 0)
11068 }
11069
11070 if (quantity_max <= 0)
11072
11073 return quantity_max;
11074 }
11075
11077 {
11079 }
11080
11082 {
11084 }
11085
11086
11088 {
11090 }
11091
11093 {
11095 }
11096
11098 {
11100 }
11101
11102
11104 {
11105
11106 float weightEx = GetWeightEx();
11107 float special = GetInventoryAndCargoWeight();
11108 return weightEx - special;
11109 }
11110
11111
11113 {
11115 }
11116
11118 {
11120 {
11121 #ifdef DEVELOPER
11122 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11123 {
11124 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11126 }
11127 #endif
11128
11129 return GetQuantity() * GetConfigWeightModified();
11130 }
11131 else if (HasEnergyManager())
11132 {
11133 #ifdef DEVELOPER
11134 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11135 {
11136 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11137 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11138 }
11139 #endif
11140 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11141 }
11142 else
11143 {
11144 #ifdef DEVELOPER
11145 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11146 {
11147 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11148 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11149 }
11150 #endif
11151 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11152 }
11153 }
11154
11157 {
11158 int item_count = 0;
11160
11161 GameInventory inventory = GetInventory();
11162 CargoBase cargo = inventory.
GetCargo();
11163 if (cargo != NULL)
11164 {
11166 }
11167
11169 for (int i = 0; i < nAttachments; ++i)
11170 {
11172 if (item)
11173 item_count += item.GetNumberOfItems();
11174 }
11175 return item_count;
11176 }
11177
11180 {
11181 float weight = 0;
11182 float wetness = 1;
11183 if (include_wetness)
11186 {
11187 weight = wetness * m_ConfigWeight;
11188 }
11190 {
11191 weight = 1;
11192 }
11193 return weight;
11194 }
11195
11196
11197
11199 {
11200 GameInventory inventory = GetInventory();
11201 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11202 {
11203 array<EntityAI> items = new array<EntityAI>;
11205 for (int i = 0; i < items.Count(); ++i)
11206 {
11208 if (item)
11209 {
11210 g_Game.ObjectDelete(item);
11211 }
11212 }
11213 }
11214 }
11215
11216
11217
11218
11220 {
11221 float energy = 0;
11222 if (HasEnergyManager())
11223 {
11224 energy = GetCompEM().GetEnergy();
11225 }
11226 return energy;
11227 }
11228
11229
11231 {
11232 super.OnEnergyConsumed();
11233
11235 }
11236
11238 {
11239 super.OnEnergyAdded();
11240
11242 }
11243
11244
11246 {
11247 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11248 {
11250 {
11251 float energy_0to1 = GetCompEM().GetEnergy0To1();
11253 }
11254 }
11255 }
11256
11257
11259 {
11260 return ConfigGetFloat("heatIsolation");
11261 }
11262
11264 {
11266 }
11267
11269 {
11270 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11271 if (
g_Game.ConfigIsExisting(paramPath))
11272 return g_Game.ConfigGetFloat(paramPath);
11273
11274 return 0.0;
11275 }
11276
11278 {
11279 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11280 if (
g_Game.ConfigIsExisting(paramPath))
11281 return g_Game.ConfigGetFloat(paramPath);
11282
11283 return 0.0;
11284 }
11285
11286 override void SetWet(
float value,
bool allow_client =
false)
11287 {
11288 if (!IsServerCheck(allow_client))
11289 return;
11290
11293
11295
11296 m_VarWet = Math.Clamp(value, min, max);
11297
11299 {
11302 }
11303 }
11304
11305 override void AddWet(
float value)
11306 {
11308 }
11309
11311 {
11313 }
11314
11316 {
11318 }
11319
11321 {
11323 }
11324
11326 {
11328 }
11329
11331 {
11333 }
11334
11335 override void OnWetChanged(
float newVal,
float oldVal)
11336 {
11339 if (newLevel != oldLevel)
11340 {
11342 }
11343 }
11344
11346 {
11347 SetWeightDirty();
11348 }
11349
11351 {
11352 return GetWetLevelInternal(
m_VarWet);
11353 }
11354
11355
11356
11358 {
11360 }
11361
11363 {
11365 }
11366
11368 {
11370 }
11371
11373 {
11375 }
11376
11377
11378
11380 {
11381 if (ConfigIsExisting("itemModelLength"))
11382 {
11383 return ConfigGetFloat("itemModelLength");
11384 }
11385 return 0;
11386 }
11387
11389 {
11390 if (ConfigIsExisting("itemAttachOffset"))
11391 {
11392 return ConfigGetFloat("itemAttachOffset");
11393 }
11394 return 0;
11395 }
11396
11397 override void SetCleanness(
int value,
bool allow_client =
false)
11398 {
11399 if (!IsServerCheck(allow_client))
11400 return;
11401
11403
11405
11408 }
11409
11411 {
11413 }
11414
11416 {
11417 return true;
11418 }
11419
11420
11421
11422
11424 {
11426 }
11427
11429 {
11431 }
11432
11433
11434
11435
11436 override void SetColor(
int r,
int g,
int b,
int a)
11437 {
11443 }
11445 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11446 {
11451 }
11452
11454 {
11456 }
11457
11460 {
11461 int r,g,b,a;
11463 r = r/255;
11464 g = g/255;
11465 b = b/255;
11466 a = a/255;
11467 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11468 }
11469
11470
11471
11472 override void SetLiquidType(
int value,
bool allow_client =
false)
11473 {
11474 if (!IsServerCheck(allow_client))
11475 return;
11476
11481 }
11482
11484 {
11485 return ConfigGetInt("varLiquidTypeInit");
11486 }
11487
11489 {
11491 }
11492
11494 {
11496 SetFrozen(false);
11497 }
11498
11501 {
11502 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11503 }
11504
11505
11508 {
11509 PlayerBase nplayer;
11510 if (PlayerBase.CastTo(nplayer, player))
11511 {
11513 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11514 }
11515 }
11516
11517
11520 {
11521 PlayerBase nplayer;
11522 if (PlayerBase.CastTo(nplayer,player))
11523 {
11524 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11525 }
11526
11527 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11528
11529 if (HasEnergyManager())
11530 {
11531 GetCompEM().UpdatePlugState();
11532 }
11533 }
11534
11535
11537 {
11538 super.OnPlacementStarted(player);
11539
11541 }
11542
11543 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11544 {
11546 {
11547 m_AdminLog.OnPlacementComplete(player,
this);
11548 }
11549
11550 super.OnPlacementComplete(player, position, orientation);
11551 }
11552
11553
11554
11555
11556
11558 {
11560 {
11561 return true;
11562 }
11563 else
11564 {
11565 return false;
11566 }
11567 }
11568
11569
11571 {
11573 {
11575 }
11576 }
11577
11578
11580 {
11582 }
11583
11585 {
11587 }
11588
11589 override void InsertAgent(
int agent,
float count = 1)
11590 {
11591 if (count < 1)
11592 return;
11593
11595 }
11596
11599 {
11601 }
11602
11603
11605 {
11607 }
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619
11620
11621
11622
11623
11624
11625
11626
11627
11628
11629
11630
11631
11632
11633
11634
11635
11636
11637
11638
11639
11640
11641
11642
11643
11644
11645
11646
11647
11648
11649
11651 {
11653 return false;
11654 return true;
11655 }
11656
11658 {
11659
11661 }
11662
11663
11666 {
11667 super.CheckForRoofLimited(timeTresholdMS);
11668
11669 float time =
g_Game.GetTime();
11670 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11671 {
11672 m_PreviousRoofTestTime = time;
11673 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11674 }
11675 }
11676
11677
11679 {
11681 {
11682 return 0;
11683 }
11684
11685 if (GetInventory().GetAttachmentSlotsCount() != 0)
11686 {
11687 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11688 if (filter)
11689 return filter.GetProtectionLevel(type, false, system);
11690 else
11691 return 0;
11692 }
11693
11694 string subclassPath, entryName;
11695
11696 switch (type)
11697 {
11699 entryName = "biological";
11700 break;
11702 entryName = "chemical";
11703 break;
11704 default:
11705 entryName = "biological";
11706 break;
11707 }
11708
11709 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11710
11711 return g_Game.ConfigGetFloat(subclassPath + entryName);
11712 }
11713
11714
11715
11718 {
11719 if (!IsMagazine())
11721
11723 }
11724
11725
11726
11727
11728
11733 {
11734 return true;
11735 }
11736
11738 {
11740 }
11741
11742
11743
11744
11745
11747 {
11748 if (parent)
11749 {
11750 if (parent.IsInherited(DayZInfected))
11751 return true;
11752
11753 if (!parent.IsRuined())
11754 return true;
11755 }
11756
11757 return true;
11758 }
11759
11761 {
11762 if (!super.CanPutAsAttachment(parent))
11763 {
11764 return false;
11765 }
11766
11767 if (!IsRuined() && !parent.IsRuined())
11768 {
11769 return true;
11770 }
11771
11772 return false;
11773 }
11774
11776 {
11777
11778
11779
11780
11781 return super.CanReceiveItemIntoCargo(item);
11782 }
11783
11785 {
11786
11787
11788
11789
11790 GameInventory attachmentInv = attachment.GetInventory();
11792 {
11793 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11794 return false;
11795 }
11796
11797 InventoryLocation loc = new InventoryLocation();
11798 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11799 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11800 return false;
11801
11802 return super.CanReceiveAttachment(attachment, slotId);
11803 }
11804
11806 {
11807 if (!super.CanReleaseAttachment(attachment))
11808 return false;
11809
11810 return GetInventory().AreChildrenAccessible();
11811 }
11812
11813
11814
11815
11816
11817
11818
11819
11820
11821
11822
11823
11824
11825
11826
11827
11828
11829
11830
11831
11832
11834 {
11835 int id = muzzle_owner.GetMuzzleID();
11836 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11837
11838 if (WPOF_array)
11839 {
11840 for (int i = 0; i < WPOF_array.Count(); i++)
11841 {
11842 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11843
11844 if (WPOF)
11845 {
11846 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11847 }
11848 }
11849 }
11850 }
11851
11852
11854 {
11855 int id = muzzle_owner.GetMuzzleID();
11857
11858 if (WPOBE_array)
11859 {
11860 for (int i = 0; i < WPOBE_array.Count(); i++)
11861 {
11862 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11863
11864 if (WPOBE)
11865 {
11866 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11867 }
11868 }
11869 }
11870 }
11871
11872
11874 {
11875 int id = muzzle_owner.GetMuzzleID();
11876 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11877
11878 if (WPOOH_array)
11879 {
11880 for (int i = 0; i < WPOOH_array.Count(); i++)
11881 {
11882 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11883
11884 if (WPOOH)
11885 {
11886 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11887 }
11888 }
11889 }
11890 }
11891
11892
11894 {
11895 int id = muzzle_owner.GetMuzzleID();
11896 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11897
11898 if (WPOOH_array)
11899 {
11900 for (int i = 0; i < WPOOH_array.Count(); i++)
11901 {
11902 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11903
11904 if (WPOOH)
11905 {
11906 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11907 }
11908 }
11909 }
11910 }
11911
11912
11914 {
11915 int id = muzzle_owner.GetMuzzleID();
11916 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11917
11918 if (WPOOH_array)
11919 {
11920 for (int i = 0; i < WPOOH_array.Count(); i++)
11921 {
11922 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11923
11924 if (WPOOH)
11925 {
11926 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11927 }
11928 }
11929 }
11930 }
11931
11932
11933
11935 {
11937 {
11938 return true;
11939 }
11940
11941 return false;
11942 }
11943
11945 {
11947 {
11948 return true;
11949 }
11950
11951 return false;
11952 }
11953
11955 {
11957 {
11958 return true;
11959 }
11960
11961 return false;
11962 }
11963
11965 {
11966 return false;
11967 }
11968
11971 {
11972 return UATimeSpent.DEFAULT_DEPLOY;
11973 }
11974
11975
11976
11977
11979 {
11981 SetSynchDirty();
11982 }
11983
11985 {
11987 }
11988
11989
11991 {
11992 return false;
11993 }
11994
11997 {
11998 string att_type = "None";
11999
12000 if (ConfigIsExisting("soundAttType"))
12001 {
12002 att_type = ConfigGetString("soundAttType");
12003 }
12004
12006 }
12007
12009 {
12011 }
12012
12013
12014
12015
12016
12022
12024 {
12027
12029 }
12030
12031
12033 {
12035 return;
12036
12038
12041
12044
12045 SoundParameters params = new SoundParameters();
12049 }
12050
12051
12053 {
12055 {
12058
12059 SetSynchDirty();
12060
12063 }
12064 }
12065
12067 {
12069 }
12070
12071
12073 {
12075 return;
12076
12078 SetSynchDirty();
12079
12082 }
12083
12085 {
12088 }
12089
12091 {
12093 }
12094
12095 void OnApply(PlayerBase player);
12096
12098 {
12099 return 1.0;
12100 };
12101
12103 {
12105 }
12106
12108 {
12110 }
12111
12113
12115 {
12116 SetDynamicPhysicsLifeTime(0.01);
12118 }
12119
12121 {
12122 array<string> zone_names = new array<string>;
12123 GetDamageZones(zone_names);
12124 for (int i = 0; i < zone_names.Count(); i++)
12125 {
12126 SetHealthMax(zone_names.Get(i),"Health");
12127 }
12128 SetHealthMax("","Health");
12129 }
12130
12133 {
12134 float global_health = GetHealth01("","Health");
12135 array<string> zones = new array<string>;
12136 GetDamageZones(zones);
12137
12138 for (int i = 0; i < zones.Count(); i++)
12139 {
12140 SetHealth01(zones.Get(i),"Health",global_health);
12141 }
12142 }
12143
12146 {
12147 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12148 }
12149
12151 {
12152 if (!hasRootAsPlayer)
12153 {
12154 if (refParentIB)
12155 {
12156
12157 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12158 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12159
12160 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12161 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12162
12165 }
12166 else
12167 {
12168
12171 }
12172 }
12173 }
12174
12176 {
12178 {
12179 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12180 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12181 {
12182 float heatPermCoef = 1.0;
12184 while (ent)
12185 {
12186 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12187 ent = ent.GetHierarchyParent();
12188 }
12189
12190 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12191 }
12192 }
12193 }
12194
12196 {
12197
12198 EntityAI parent = GetHierarchyParent();
12199 if (!parent)
12200 {
12201 hasParent = false;
12202 hasRootAsPlayer = false;
12203 }
12204 else
12205 {
12206 hasParent = true;
12207 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12208 refParentIB =
ItemBase.Cast(parent);
12209 }
12210 }
12211
12212 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12213 {
12214
12215 }
12216
12218 {
12219
12220 return false;
12221 }
12222
12224 {
12225
12226
12227 return false;
12228 }
12229
12231 {
12232
12233 return false;
12234 }
12235
12238 {
12239 return !GetIsFrozen() &&
IsOpen();
12240 }
12241
12243 {
12244 bool hasParent = false, hasRootAsPlayer = false;
12246
12247 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12248 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12249
12250 if (wwtu || foodDecay)
12251 {
12255
12256 if (processWetness || processTemperature || processDecay)
12257 {
12259
12260 if (processWetness)
12261 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12262
12263 if (processTemperature)
12265
12266 if (processDecay)
12267 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12268 }
12269 }
12270 }
12271
12274 {
12276 }
12277
12279 {
12282
12283 return super.GetTemperatureFreezeThreshold();
12284 }
12285
12287 {
12290
12291 return super.GetTemperatureThawThreshold();
12292 }
12293
12295 {
12298
12299 return super.GetItemOverheatThreshold();
12300 }
12301
12303 {
12305 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12306
12307 return super.GetTemperatureFreezeTime();
12308 }
12309
12311 {
12313 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12314
12315 return super.GetTemperatureThawTime();
12316 }
12317
12322
12324 {
12325 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12326 }
12327
12329 {
12330 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12331 }
12332
12335 {
12337 }
12338
12340 {
12342 }
12343
12345 {
12347 }
12348
12351 {
12352 return null;
12353 }
12354
12357 {
12358 return false;
12359 }
12360
12362 {
12364 {
12367 if (!trg)
12368 {
12370 explosive = this;
12371 }
12372
12373 explosive.PairRemote(trg);
12375
12376 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12377 trg.SetPersistentPairID(persistentID);
12378 explosive.SetPersistentPairID(persistentID);
12379
12380 return true;
12381 }
12382 return false;
12383 }
12384
12387 {
12388 float ret = 1.0;
12391 ret *= GetHealth01();
12392
12393 return ret;
12394 }
12395
12396 #ifdef DEVELOPER
12397 override void SetDebugItem()
12398 {
12399 super.SetDebugItem();
12400 _itemBase = this;
12401 }
12402
12404 {
12405 string text = super.GetDebugText();
12406
12408 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12409
12410 return text;
12411 }
12412 #endif
12413
12415 {
12416 return true;
12417 }
12418
12420
12422
12424 {
12427 }
12428
12429
12437
12453
12454 [
Obsolete(
"Use ItemSoundHandler instead")]
12457 {
12458 if (!
g_Game.IsDedicatedServer())
12459 {
12460 if (ConfigIsExisting("attachSoundSet"))
12461 {
12462 string cfg_path = "";
12463 string soundset = "";
12464 string type_name =
GetType();
12465
12468 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12469 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12470
12471 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12472 {
12473 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12474 {
12475 if (cfg_slot_array[i] == slot_type)
12476 {
12477 soundset = cfg_soundset_array[i];
12478 break;
12479 }
12480 }
12481 }
12482
12483 if (soundset != "")
12484 {
12485 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12487 }
12488 }
12489 }
12490 }
12491
12493}
12494
12496{
12498 if (entity)
12499 {
12500 bool is_item = entity.IsInherited(
ItemBase);
12501 if (is_item && full_quantity)
12502 {
12505 }
12506 }
12507 else
12508 {
12510 return NULL;
12511 }
12512 return entity;
12513}
12514
12516{
12517 if (item)
12518 {
12519 if (health > 0)
12520 item.SetHealth("", "", health);
12521
12522 if (item.CanHaveTemperature())
12523 {
12525 if (item.CanFreeze())
12526 item.SetFrozen(false);
12527 }
12528
12529 if (item.HasEnergyManager())
12530 {
12531 if (quantity >= 0)
12532 {
12533 item.GetCompEM().SetEnergy0To1(quantity);
12534 }
12535 else
12536 {
12538 }
12539 }
12540 else if (item.IsMagazine())
12541 {
12542 Magazine mag = Magazine.Cast(item);
12543 if (quantity >= 0)
12544 {
12545 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12546 }
12547 else
12548 {
12550 }
12551
12552 }
12553 else
12554 {
12555 if (quantity >= 0)
12556 {
12557 item.SetQuantityNormalized(quantity, false);
12558 }
12559 else
12560 {
12562 }
12563
12564 }
12565 }
12566}
12567
12568#ifdef DEVELOPER
12570#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.