7576{
7578 {
7579 return true;
7580 }
7581};
7582
7584{
7585
7586};
7587
7588
7589
7591{
7595
7597
7600
7601
7602
7603
7604
7613
7619
7624
7629
7650 protected bool m_IsResultOfSplit
7651
7653
7658
7659
7660
7662
7666
7667
7668
7670
7673
7674
7675
7681
7682
7690
7693
7694
7696
7697
7699
7700
7705
7706
7711
7713
7714
7716
7717
7719 {
7724
7725 if (!
g_Game.IsDedicatedServer())
7726 {
7728 {
7730
7732 {
7734 }
7735 }
7736
7739 }
7740
7741 m_OldLocation = null;
7742
7744 {
7746 }
7747
7748 if (ConfigIsExisting("headSelectionsToHide"))
7749 {
7752 }
7753
7755 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7756 {
7758 }
7759
7761
7762 m_IsResultOfSplit = false;
7763
7765 }
7766
7768 {
7769 super.InitItemVariables();
7770
7776 m_Count = ConfigGetInt(
"count");
7777
7780
7785
7788
7793
7805
7809
7810
7813 if (ConfigIsExisting("canBeSplit"))
7814 {
7817 }
7818
7820 if (ConfigIsExisting("itemBehaviour"))
7822
7823
7826 RegisterNetSyncVariableInt("m_VarLiquidType");
7827 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7828
7829 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7830 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7831 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7832
7833 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7834 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7835 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7836 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7837
7838 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7839 RegisterNetSyncVariableBool("m_IsTakeable");
7840 RegisterNetSyncVariableBool("m_IsHologram");
7841
7844 {
7847 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7848 }
7849
7851
7853 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7855
7857 }
7858
7860 {
7862 }
7863
7865 {
7868 {
7873 }
7874 }
7875
7876 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7877 {
7879 {
7882 }
7883
7885 }
7886
7888 {
7894 }
7895
7897
7899 {
7901
7902 if (!action)
7903 {
7904 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7905 return;
7906 }
7907
7909 if (!ai)
7910 {
7912 return;
7913 }
7914
7916 if (!action_array)
7917 {
7918 action_array = new array<ActionBase_Basic>;
7920 }
7921 if (LogManager.IsActionLogEnable())
7922 {
7923 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7924 }
7925
7926 if (action_array.Find(action) != -1)
7927 {
7928 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7929 }
7930 else
7931 {
7932 action_array.Insert(action);
7933 }
7934 }
7935
7937 {
7938 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7939 ActionBase action = player.GetActionManager().GetAction(actionName);
7942
7943 if (action_array)
7944 {
7945 action_array.RemoveItem(action);
7946 }
7947 }
7948
7949
7950
7952 {
7953 ActionOverrideData overrideData = new ActionOverrideData();
7957
7959 if (!actionMap)
7960 {
7963 }
7964
7965 actionMap.Insert(this.
Type(), overrideData);
7966
7967 }
7968
7970
7972
7973
7975 {
7978
7981
7982 string config_to_search = "CfgVehicles";
7983 string muzzle_owner_config;
7984
7986 {
7987 if (IsInherited(Weapon))
7988 config_to_search = "CfgWeapons";
7989
7990 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7991
7992 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7993
7994 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7995
7996 if (config_OnFire_subclass_count > 0)
7997 {
7998 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7999
8000 for (int i = 0; i < config_OnFire_subclass_count; i++)
8001 {
8002 string particle_class = "";
8003 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8004 string config_OnFire_entry = config_OnFire_class + particle_class;
8005 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8006 WPOF_array.Insert(WPOF);
8007 }
8008
8009
8011 }
8012 }
8013
8015 {
8016 config_to_search = "CfgWeapons";
8017 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8018
8019 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8020
8021 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8022
8023 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8024 {
8025 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8026
8027 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8028 {
8029 string particle_class2 = "";
8030 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8031 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8032 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8033 WPOBE_array.Insert(WPOBE);
8034 }
8035
8036
8038 }
8039 }
8040 }
8041
8042
8044 {
8047
8049 {
8050 string config_to_search = "CfgVehicles";
8051
8052 if (IsInherited(Weapon))
8053 config_to_search = "CfgWeapons";
8054
8055 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8056 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8057
8058 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8059 {
8060
8062
8064 {
8066 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8068 return;
8069 }
8070
8073
8074
8075
8076 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8077 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8078
8079 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8080 {
8081 string particle_class = "";
8082 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8083 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8084 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8085
8086 if (entry_type == CT_CLASS)
8087 {
8088 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8089 WPOOH_array.Insert(WPOF);
8090 }
8091 }
8092
8093
8095 }
8096 }
8097 }
8098
8100 {
8102 }
8103
8105 {
8107 {
8109
8112
8115
8116 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8117 }
8118 }
8119
8121 {
8123 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8124
8126 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8127
8129 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8130
8132 {
8134 }
8135 }
8136
8138 {
8140 }
8141
8143 {
8146 else
8148
8150 {
8153 }
8154 else
8155 {
8158
8161 }
8162
8164 }
8165
8167 {
8169 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8170 }
8171
8173 {
8175 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8177 }
8178
8180 {
8182 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8183 }
8184
8186 {
8189
8190 OverheatingParticle OP = new OverheatingParticle();
8195
8197 }
8198
8200 {
8203
8204 return -1;
8205 }
8206
8208 {
8210 {
8213
8214 for (int i = count; i > 0; --i)
8215 {
8216 int id = i - 1;
8219
8222
8223 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8224 {
8225 if (p)
8226 {
8229 }
8230 }
8231 }
8232 }
8233 }
8234
8236 {
8238 {
8240 {
8241 int id = i - 1;
8243
8244 if (OP)
8245 {
8247
8248 if (p)
8249 {
8251 }
8252
8253 delete OP;
8254 }
8255 }
8256
8259 }
8260 }
8261
8264 {
8265 return 0.0;
8266 }
8267
8268
8270 {
8271 return 250;
8272 }
8273
8275 {
8276 return 0;
8277 }
8278
8281 {
8283 return true;
8284
8285 return false;
8286 }
8287
8290 {
8293
8295 {
8297 }
8298 else
8299 {
8300
8302 }
8303
8305 }
8306
8313 {
8314 return -1;
8315 }
8316
8317
8318
8319
8321 {
8323 {
8324 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8325 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8326
8327 if (r_index >= 0)
8328 {
8329 InventoryLocation r_il = new InventoryLocation;
8330 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8331
8332 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8335 {
8336 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8337 }
8339 {
8340 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8341 }
8342
8343 }
8344
8345 player.GetHumanInventory().ClearUserReservedLocation(this);
8346 }
8347
8350 }
8351
8352
8353
8354
8356 {
8357 return ItemBase.m_DebugActionsMask;
8358 }
8359
8361 {
8362 return ItemBase.m_DebugActionsMask & mask;
8363 }
8364
8366 {
8367 ItemBase.m_DebugActionsMask = mask;
8368 }
8369
8371 {
8372 ItemBase.m_DebugActionsMask |= mask;
8373 }
8374
8376 {
8377 ItemBase.m_DebugActionsMask &= ~mask;
8378 }
8379
8381 {
8383 {
8385 }
8386 else
8387 {
8389 }
8390 }
8391
8392
8394 {
8395 if (GetEconomyProfile())
8396 {
8397 float q_max = GetEconomyProfile().GetQuantityMax();
8398 if (q_max > 0)
8399 {
8400 float q_min = GetEconomyProfile().GetQuantityMin();
8401 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8402
8404 {
8405 ComponentEnergyManager comp = GetCompEM();
8407 {
8409 }
8410 }
8412 {
8414
8415 }
8416
8417 }
8418 }
8419 }
8420
8423 {
8424 EntityAI parent = GetHierarchyParent();
8425
8426 if (parent)
8427 {
8428 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8429 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8430 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8431 }
8432 }
8433
8436 {
8437 EntityAI parent = GetHierarchyParent();
8438
8439 if (parent)
8440 {
8441 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8442 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8443 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8444 }
8445 }
8446
8448 {
8449
8450
8451
8452
8454
8456 {
8457 if (ScriptInputUserData.CanStoreInputUserData())
8458 {
8459 ScriptInputUserData ctx = new ScriptInputUserData;
8465 ctx.
Write(use_stack_max);
8468
8470 {
8471 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8472 }
8473 }
8474 }
8475 else if (!
g_Game.IsMultiplayer())
8476 {
8478 }
8479 }
8480
8482 {
8484 }
8485
8487 {
8489 }
8490
8492 {
8494 }
8495
8497 {
8498
8499 return false;
8500 }
8501
8503 {
8504 return false;
8505 }
8506
8510 {
8511 return false;
8512 }
8513
8515 {
8516 return "";
8517 }
8518
8520
8522 {
8523 return false;
8524 }
8525
8527 {
8528 return true;
8529 }
8530
8531
8532
8534 {
8535 return true;
8536 }
8537
8539 {
8540 return true;
8541 }
8542
8544 {
8545 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8547 }
8548
8550 {
8552 }
8553
8555 {
8557 if (!is_being_placed)
8559 SetSynchDirty();
8560 }
8561
8562
8564
8566 {
8568 }
8569
8571 {
8573 }
8574
8576 {
8577 return 1;
8578 }
8579
8581 {
8582 return false;
8583 }
8584
8586 {
8588 SetSynchDirty();
8589 }
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8626 {
8627 super.OnMovedInsideCargo(container);
8628
8629 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8630 }
8631
8632 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8633 {
8634 super.EEItemLocationChanged(oldLoc, newLoc);
8635
8636 PlayerBase newPlayer = null;
8637 PlayerBase oldPlayer = null;
8638
8639 if (newLoc.GetParent())
8640 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8641
8642 if (oldLoc.GetParent())
8643 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8644
8646 {
8647 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8648
8649 if (rIndex >= 0)
8650 {
8651 InventoryLocation rIl = new InventoryLocation;
8652 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8653
8654 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8657 {
8658 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8659 }
8661 {
8663 }
8664
8665 }
8666 }
8667
8669 {
8670 if (newPlayer)
8671 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8672
8673 if (newPlayer == oldPlayer)
8674 {
8675 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8676 {
8678 {
8679 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8680 {
8681 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8682 }
8683 }
8684 else
8685 {
8686 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8687 }
8688 }
8689
8690 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8691 {
8692 int type = oldLoc.GetType();
8694 {
8695 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8696 }
8698 {
8699 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8700 }
8701 }
8702 if (!m_OldLocation)
8703 {
8704 m_OldLocation = new InventoryLocation;
8705 }
8706 m_OldLocation.Copy(oldLoc);
8707 }
8708 else
8709 {
8710 if (m_OldLocation)
8711 {
8712 m_OldLocation.Reset();
8713 }
8714 }
8715
8716 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8717 }
8718 else
8719 {
8720 if (newPlayer)
8721 {
8722 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8723 if (resIndex >= 0)
8724 {
8725 InventoryLocation il = new InventoryLocation;
8726 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8728 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8731 {
8732 il.
GetParent().GetOnReleaseLock().Invoke(it);
8733 }
8735 {
8737 }
8738
8739 }
8740 }
8742 {
8743
8745 }
8746
8747 if (m_OldLocation)
8748 {
8749 m_OldLocation.Reset();
8750 }
8751 }
8752
8754 {
8755 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8756 }
8757
8759 {
8760 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8761 }
8762 }
8763
8764 override void EOnContact(IEntity other, Contact extra)
8765 {
8767 {
8768 int liquidType = -1;
8770 if (impactSpeed > 0.0)
8771 {
8773 #ifndef SERVER
8775 #else
8777 SetSynchDirty();
8778 #endif
8780 }
8781 }
8782
8783 #ifdef SERVER
8784 if (GetCompEM() && GetCompEM().IsPlugged())
8785 {
8786 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8787 GetCompEM().UnplugThis();
8788 }
8789 #endif
8790 }
8791
8793
8795 {
8797 }
8798
8800 {
8801
8802 }
8803
8805 {
8806 super.OnItemLocationChanged(old_owner, new_owner);
8807
8808 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8809 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8810
8811 if (!relatedPlayer && playerNew)
8812 relatedPlayer = playerNew;
8813
8814 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8815 {
8817 if (actionMgr)
8818 {
8819 ActionBase currentAction = actionMgr.GetRunningAction();
8820 if (currentAction)
8822 }
8823 }
8824
8825 Man ownerPlayerOld = null;
8826 Man ownerPlayerNew = null;
8827
8828 if (old_owner)
8829 {
8830 if (old_owner.
IsMan())
8831 {
8832 ownerPlayerOld = Man.Cast(old_owner);
8833 }
8834 else
8835 {
8836 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8837 }
8838 }
8839 else
8840 {
8842 {
8844
8845 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8846 {
8847 GetCompEM().UnplugThis();
8848 }
8849 }
8850 }
8851
8852 if (new_owner)
8853 {
8854 if (new_owner.
IsMan())
8855 {
8856 ownerPlayerNew = Man.Cast(new_owner);
8857 }
8858 else
8859 {
8860 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8861 }
8862 }
8863
8864 if (ownerPlayerOld != ownerPlayerNew)
8865 {
8866 if (ownerPlayerOld)
8867 {
8868 array<EntityAI> subItemsExit = new array<EntityAI>;
8870 for (int i = 0; i < subItemsExit.Count(); i++)
8871 {
8874 }
8875 }
8876
8877 if (ownerPlayerNew)
8878 {
8879 array<EntityAI> subItemsEnter = new array<EntityAI>;
8881 for (int j = 0; j < subItemsEnter.Count(); j++)
8882 {
8885 }
8886 }
8887 }
8888 else if (ownerPlayerNew != null)
8889 {
8890 PlayerBase nplayer;
8891 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8892 {
8893 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8895 for (int k = 0; k < subItemsUpdate.Count(); k++)
8896 {
8898 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8899 }
8900 }
8901 }
8902
8903 if (old_owner)
8904 old_owner.OnChildItemRemoved(this);
8905 if (new_owner)
8906 new_owner.OnChildItemReceived(this);
8907 }
8908
8909
8911 {
8912 super.EEDelete(parent);
8913 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8914 if (player)
8915 {
8917
8918 if (player.IsAlive())
8919 {
8920 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8921 if (r_index >= 0)
8922 {
8923 InventoryLocation r_il = new InventoryLocation;
8924 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8925
8926 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8929 {
8930 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8931 }
8933 {
8934 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8935 }
8936
8937 }
8938
8939 player.RemoveQuickBarEntityShortcut(this);
8940 }
8941 }
8942 }
8943
8945 {
8946 super.EEKilled(killer);
8947
8950 {
8951 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8952 {
8953 if (IsMagazine())
8954 {
8955 if (Magazine.Cast(this).GetAmmoCount() > 0)
8956 {
8958 }
8959 }
8960 else
8961 {
8963 }
8964 }
8965 }
8966 }
8967
8969 {
8970 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8971
8972 super.OnWasAttached(parent, slot_id);
8973
8976
8979 }
8980
8982 {
8983 super.OnWasDetached(parent, slot_id);
8984
8987
8990 }
8991
8993 {
8994 int idx;
8997
8998 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8999 if (inventory_slots.Count() < 1)
9000 {
9001 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9002 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9003 }
9004 else
9005 {
9006 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9007 }
9008
9009 idx = inventory_slots.Find(slot);
9010 if (idx < 0)
9011 return "";
9012
9013 return attach_types.Get(idx);
9014 }
9015
9017 {
9018 int idx = -1;
9019 string slot;
9020
9023
9024 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9025 if (inventory_slots.Count() < 1)
9026 {
9027 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9028 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9029 }
9030 else
9031 {
9032 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9033 if (detach_types.Count() < 1)
9034 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9035 }
9036
9037 for (int i = 0; i < inventory_slots.Count(); i++)
9038 {
9039 slot = inventory_slots.Get(i);
9040 }
9041
9042 if (slot != "")
9043 {
9044 if (detach_types.Count() == 1)
9045 idx = 0;
9046 else
9047 idx = inventory_slots.Find(slot);
9048 }
9049 if (idx < 0)
9050 return "";
9051
9052 return detach_types.Get(idx);
9053 }
9054
9056 {
9057
9059
9060
9061 float min_time = 1;
9062 float max_time = 3;
9063 float delay = Math.RandomFloat(min_time, max_time);
9064
9065 explode_timer.Run(delay, this, "DoAmmoExplosion");
9066 }
9067
9069 {
9070 Magazine magazine = Magazine.Cast(this);
9071 int pop_sounds_count = 6;
9072 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9073
9074
9075 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9076 string sound_name = pop_sounds[ sound_idx ];
9077 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9078
9079
9080 magazine.ServerAddAmmoCount(-1);
9081
9082
9083 float min_temp_to_explode = 100;
9084
9085 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9086 {
9088 }
9089 }
9090
9091
9092 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9093 {
9094 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9095
9096 const int CHANCE_DAMAGE_CARGO = 4;
9097 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9098 const int CHANCE_DAMAGE_NOTHING = 2;
9099
9101 {
9102 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9103 int chances;
9104 int rnd;
9105
9106 if (GetInventory().GetCargo())
9107 {
9108 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9109 rnd = Math.RandomInt(0,chances);
9110
9111 if (rnd < CHANCE_DAMAGE_CARGO)
9112 {
9114 }
9115 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9116 {
9118 }
9119 }
9120 else
9121 {
9122 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9123 rnd = Math.RandomInt(0,chances);
9124
9125 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9126 {
9128 }
9129 }
9130 }
9131 }
9132
9134 {
9135 CargoBase cargo = GetInventory().GetCargo();
9136 if (cargo)
9137 {
9139 if (item_count > 0)
9140 {
9141 int random_pick = Math.RandomInt(0, item_count);
9143 if (!item.IsExplosive())
9144 {
9145 item.AddHealth("","",damage);
9146 return true;
9147 }
9148 }
9149 }
9150 return false;
9151 }
9152
9154 {
9155 GameInventory inventory = GetInventory();
9157 if (attachment_count > 0)
9158 {
9159 int random_pick = Math.RandomInt(0, attachment_count);
9161 if (!attachment.IsExplosive())
9162 {
9163 attachment.AddHealth("","",damage);
9164 return true;
9165 }
9166 }
9167 return false;
9168 }
9169
9171 {
9173 }
9174
9176 {
9178 return GetInventory().CanRemoveEntity();
9179
9180 return false;
9181 }
9182
9184 {
9185
9187 return false;
9188
9189
9191 return false;
9192
9193
9194
9196 if (delta == 0)
9197 return false;
9198
9199
9200 return true;
9201 }
9202
9204 {
9206 {
9207 if (ScriptInputUserData.CanStoreInputUserData())
9208 {
9209 ScriptInputUserData ctx = new ScriptInputUserData;
9214 ctx.
Write(destination_entity);
9218 }
9219 }
9220 else if (!
g_Game.IsMultiplayer())
9221 {
9223 }
9224 }
9225
9227 {
9228 float split_quantity_new;
9232 InventoryLocation loc = new InventoryLocation;
9233
9234 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9235 {
9237 split_quantity_new = stack_max;
9238 else
9240
9242 {
9243 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9244 if (new_item)
9245 {
9246 new_item.SetResultOfSplit(true);
9247 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9249 new_item.
SetQuantity(split_quantity_new,
false,
true);
9250 }
9251 }
9252 }
9253 else if (destination_entity && slot_id == -1)
9254 {
9255 if (quantity > stack_max)
9256 split_quantity_new = stack_max;
9257 else
9258 split_quantity_new = quantity;
9259
9261 {
9262 GameInventory destinationInventory = destination_entity.GetInventory();
9264 {
9267 }
9268
9269 if (new_item)
9270 {
9271 new_item.SetResultOfSplit(true);
9272 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9274 new_item.
SetQuantity(split_quantity_new,
false,
true);
9275 }
9276 }
9277 }
9278 else
9279 {
9280 if (stack_max != 0)
9281 {
9283 {
9285 }
9286
9287 if (split_quantity_new == 0)
9288 {
9289 if (!
g_Game.IsMultiplayer())
9290 player.PhysicalPredictiveDropItem(this);
9291 else
9292 player.ServerDropEntity(this);
9293 return;
9294 }
9295
9297 {
9299
9300 if (new_item)
9301 {
9302 new_item.SetResultOfSplit(true);
9303 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9306 new_item.PlaceOnSurface();
9307 }
9308 }
9309 }
9310 }
9311 }
9312
9314 {
9315 float split_quantity_new;
9319 InventoryLocation loc = new InventoryLocation;
9320
9321 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9322 {
9324 split_quantity_new = stack_max;
9325 else
9327
9329 {
9330 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9331 if (new_item)
9332 {
9333 new_item.SetResultOfSplit(true);
9334 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9336 new_item.
SetQuantity(split_quantity_new,
false,
true);
9337 }
9338 }
9339 }
9340 else if (destination_entity && slot_id == -1)
9341 {
9342 if (quantity > stack_max)
9343 split_quantity_new = stack_max;
9344 else
9345 split_quantity_new = quantity;
9346
9348 {
9349 GameInventory destinationInventory = destination_entity.GetInventory();
9351 {
9354 }
9355
9356 if (new_item)
9357 {
9358 new_item.SetResultOfSplit(true);
9359 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9361 new_item.
SetQuantity(split_quantity_new,
false,
true);
9362 }
9363 }
9364 }
9365 else
9366 {
9367 if (stack_max != 0)
9368 {
9370 {
9372 }
9373
9375 {
9377
9378 if (new_item)
9379 {
9380 new_item.SetResultOfSplit(true);
9381 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9384 new_item.PlaceOnSurface();
9385 }
9386 }
9387 }
9388 }
9389 }
9390
9392 {
9394 {
9395 if (ScriptInputUserData.CanStoreInputUserData())
9396 {
9397 ScriptInputUserData ctx = new ScriptInputUserData;
9402 dst.WriteToContext(ctx);
9404 }
9405 }
9406 else if (!
g_Game.IsMultiplayer())
9407 {
9409 }
9410 }
9411
9413 {
9415 {
9416 if (ScriptInputUserData.CanStoreInputUserData())
9417 {
9418 ScriptInputUserData ctx = new ScriptInputUserData;
9423 ctx.
Write(destination_entity);
9429 }
9430 }
9431 else if (!
g_Game.IsMultiplayer())
9432 {
9434 }
9435 }
9436
9438 {
9440 }
9441
9443 {
9445 float split_quantity_new;
9447 if (dst.IsValid())
9448 {
9449 int slot_id = dst.GetSlot();
9451
9452 if (quantity > stack_max)
9453 split_quantity_new = stack_max;
9454 else
9455 split_quantity_new = quantity;
9456
9458 {
9460
9461 if (new_item)
9462 {
9463 new_item.SetResultOfSplit(true);
9464 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9466 new_item.
SetQuantity(split_quantity_new,
false,
true);
9467 }
9468
9469 return new_item;
9470 }
9471 }
9472
9473 return null;
9474 }
9475
9477 {
9479 float split_quantity_new;
9481 if (destination_entity)
9482 {
9484 if (quantity > stackable)
9485 split_quantity_new = stackable;
9486 else
9487 split_quantity_new = quantity;
9488
9490 {
9491 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9492 if (new_item)
9493 {
9494 new_item.SetResultOfSplit(true);
9495 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9497 new_item.
SetQuantity(split_quantity_new,
false,
true);
9498 }
9499 }
9500 }
9501 }
9502
9504 {
9506 {
9507 if (ScriptInputUserData.CanStoreInputUserData())
9508 {
9509 ScriptInputUserData ctx = new ScriptInputUserData;
9514 ItemBase destination_entity =
this;
9515 ctx.
Write(destination_entity);
9519 }
9520 }
9521 else if (!
g_Game.IsMultiplayer())
9522 {
9524 }
9525 }
9526
9528 {
9530 float split_quantity_new;
9532 if (player)
9533 {
9535 if (quantity > stackable)
9536 split_quantity_new = stackable;
9537 else
9538 split_quantity_new = quantity;
9539
9541 {
9542 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9543 new_item =
ItemBase.Cast(in_hands);
9544 if (new_item)
9545 {
9546 new_item.SetResultOfSplit(true);
9547 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9549 new_item.SetQuantity(split_quantity_new, false, true);
9550 }
9551 }
9552 }
9553 }
9554
9556 {
9558 float split_quantity_new = Math.Floor(quantity * 0.5);
9559
9561 return;
9562
9564
9565 if (new_item)
9566 {
9567 if (new_item.GetQuantityMax() < split_quantity_new)
9568 {
9569 split_quantity_new = new_item.GetQuantityMax();
9570 }
9571
9572 new_item.SetResultOfSplit(true);
9573 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9574
9576 {
9579 }
9580 else
9581 {
9583 new_item.
SetQuantity(split_quantity_new,
false,
true);
9584 }
9585 }
9586 }
9587
9589 {
9591 float split_quantity_new = Math.Floor(quantity / 2);
9592
9594 return;
9595
9596 InventoryLocation invloc = new InventoryLocation;
9598
9600 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9601
9602 if (new_item)
9603 {
9604 if (new_item.GetQuantityMax() < split_quantity_new)
9605 {
9606 split_quantity_new = new_item.GetQuantityMax();
9607 }
9609 {
9612 }
9613 else if (split_quantity_new > 1)
9614 {
9616 new_item.
SetQuantity(split_quantity_new,
false,
true);
9617 }
9618 }
9619 }
9620
9623 {
9624 SetWeightDirty();
9626
9627 if (parent)
9628 parent.OnAttachmentQuantityChangedEx(this, delta);
9629
9631 {
9633 {
9635 }
9637 {
9638 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9640 }
9641 }
9642 }
9643
9646 {
9647
9648 }
9649
9652 {
9654 }
9655
9657 {
9658 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9659
9661 {
9662 if (newLevel == GameConstants.STATE_RUINED)
9663 {
9665 EntityAI parent = GetHierarchyParent();
9666 if (parent && parent.IsFireplace())
9667 {
9668 CargoBase cargo = GetInventory().GetCargo();
9669 if (cargo)
9670 {
9672 {
9674 }
9675 }
9676 }
9677 }
9678
9680 {
9681
9683 return;
9684 }
9685
9686 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9687 {
9689 }
9690 }
9691 }
9692
9693
9695 {
9696 super.OnRightClick();
9697
9699 {
9701 {
9702 if (ScriptInputUserData.CanStoreInputUserData())
9703 {
9704 EntityAI root = GetHierarchyRoot();
9705 Man playerOwner = GetHierarchyRootPlayer();
9706 InventoryLocation dst = new InventoryLocation;
9707
9708
9709 if (!playerOwner && root && root == this)
9710 {
9712 }
9713 else
9714 {
9715
9716 GetInventory().GetCurrentInventoryLocation(dst);
9718 {
9719 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9721 {
9723 }
9724 else
9725 {
9727
9728
9729 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9730 {
9732 }
9733 else
9734 {
9735 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9736 }
9737 }
9738 }
9739 }
9740
9741 ScriptInputUserData ctx = new ScriptInputUserData;
9749 }
9750 }
9751 else if (!
g_Game.IsMultiplayer())
9752 {
9754 }
9755 }
9756 }
9757
9759 {
9760 if (root)
9761 {
9762 vector m4[4];
9763 root.GetTransform(m4);
9764 dst.SetGround(this, m4);
9765 }
9766 else
9767 {
9768 GetInventory().GetCurrentInventoryLocation(dst);
9769 }
9770 }
9771
9772 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9773 {
9774
9775 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9776 return false;
9777
9778 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9779 return false;
9780
9781
9783 return false;
9784
9785
9786 Magazine mag = Magazine.Cast(this);
9787 if (mag)
9788 {
9789 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9790 return false;
9791
9792 if (stack_max_limit)
9793 {
9794 Magazine other_mag = Magazine.Cast(other_item);
9795 if (other_item)
9796 {
9797 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9798 return false;
9799 }
9800
9801 }
9802 }
9803 else
9804 {
9805
9807 return false;
9808
9810 return false;
9811 }
9812
9813 PlayerBase player = null;
9814 if (CastTo(player, GetHierarchyRootPlayer()))
9815 {
9816 if (player.GetInventory().HasAttachment(this))
9817 return false;
9818
9819 if (player.IsItemsToDelete())
9820 return false;
9821 }
9822
9823 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9824 return false;
9825
9826 int slotID;
9828 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9829 return false;
9830
9831 return true;
9832 }
9833
9835 {
9837 }
9838
9840 {
9841 return m_IsResultOfSplit;
9842 }
9843
9845 {
9846 m_IsResultOfSplit = value;
9847 }
9848
9850 {
9852 }
9853
9855 {
9856 float other_item_quantity = other_item.GetQuantity();
9857 float this_free_space;
9858
9860
9862
9863 if (other_item_quantity > this_free_space)
9864 {
9865 return this_free_space;
9866 }
9867 else
9868 {
9869 return other_item_quantity;
9870 }
9871 }
9872
9874 {
9876 }
9877
9879 {
9881 return;
9882
9883 if (!IsMagazine() && other_item)
9884 {
9886 if (quantity_used != 0)
9887 {
9888 float hp1 = GetHealth01("","");
9889 float hp2 = other_item.GetHealth01("","");
9890 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9891 hpResult = hpResult / (
GetQuantity() + quantity_used);
9892
9893 hpResult *= GetMaxHealth();
9894 Math.Round(hpResult);
9895 SetHealth("", "Health", hpResult);
9896
9898 other_item.AddQuantity(-quantity_used);
9899 }
9900 }
9902 }
9903
9905 {
9906 #ifdef SERVER
9907 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9908 GetHierarchyParent().IncreaseLifetimeUp();
9909 #endif
9910 };
9911
9913 {
9914 PlayerBase p = PlayerBase.Cast(player);
9915
9916 array<int> recipesIds = p.m_Recipes;
9917 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9918 if (moduleRecipesManager)
9919 {
9920 EntityAI itemInHands = player.GetEntityInHands();
9921 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9922 }
9923
9924 for (int i = 0;i < recipesIds.Count(); i++)
9925 {
9926 int key = recipesIds.Get(i);
9927 string recipeName = moduleRecipesManager.GetRecipeName(key);
9929 }
9930 }
9931
9932
9933 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9934 {
9935 super.GetDebugActions(outputList);
9936
9937
9943
9944
9949
9954
9955
9959
9960
9962 {
9966 }
9967
9970
9971
9975
9977
9978 InventoryLocation loc = new InventoryLocation();
9979 GetInventory().GetCurrentInventoryLocation(loc);
9981 {
9982 if (Gizmo_IsSupported())
9985 }
9986
9988 }
9989
9990
9991
9992
9994 {
9995 super.OnAction(action_id, player, ctx);
9996
9998 {
9999 switch (action_id)
10000 {
10004 return true;
10008 return true;
10009 }
10010 }
10011
10013 {
10014 switch (action_id)
10015 {
10017 Delete();
10018 return true;
10019 }
10020 }
10021
10022 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10023 {
10024 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10025 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10026 PlayerBase p = PlayerBase.Cast(player);
10027 if (
EActions.RECIPES_RANGE_START < 1000)
10028 {
10029 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10030 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10031 }
10032 }
10033 #ifndef SERVER
10034 else if (action_id ==
EActions.WATCH_PLAYER)
10035 {
10036 PluginDeveloper.SetDeveloperItemClientEx(player);
10037 }
10038 #endif
10040 {
10041 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10042 {
10043 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10044 OnDebugButtonPressServer(id + 1);
10045 }
10046
10047 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10048 {
10049 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10051 }
10052
10053 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10054 {
10055 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10057 }
10058
10059 else if (action_id ==
EActions.ADD_QUANTITY)
10060 {
10061 if (IsMagazine())
10062 {
10063 Magazine mag = Magazine.Cast(this);
10064 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10065 }
10066 else
10067 {
10069 }
10070
10071 if (m_EM)
10072 {
10073 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10074 }
10075
10076 }
10077
10078 else if (action_id ==
EActions.REMOVE_QUANTITY)
10079 {
10080 if (IsMagazine())
10081 {
10082 Magazine mag2 = Magazine.Cast(this);
10083 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10084 }
10085 else
10086 {
10088 }
10089 if (m_EM)
10090 {
10091 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10092 }
10093
10094 }
10095
10096 else if (action_id ==
EActions.SET_QUANTITY_0)
10097 {
10099
10100 if (m_EM)
10101 {
10102 m_EM.SetEnergy(0);
10103 }
10104 }
10105
10106 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10107 {
10109
10110 if (m_EM)
10111 {
10112 m_EM.SetEnergy(m_EM.GetEnergyMax());
10113 }
10114 }
10115
10116 else if (action_id ==
EActions.ADD_HEALTH)
10117 {
10118 AddHealth("","",GetMaxHealth("","Health")/5);
10119 }
10120 else if (action_id ==
EActions.REMOVE_HEALTH)
10121 {
10122 AddHealth("","",-GetMaxHealth("","Health")/5);
10123 }
10124 else if (action_id ==
EActions.DESTROY_HEALTH)
10125 {
10126 SetHealth01("","",0);
10127 }
10128 else if (action_id ==
EActions.WATCH_ITEM)
10129 {
10131 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10132 #ifdef DEVELOPER
10133 SetDebugDeveloper_item(this);
10134 #endif
10135 }
10136
10137 else if (action_id ==
EActions.ADD_TEMPERATURE)
10138 {
10139 AddTemperature(20);
10140
10141 }
10142
10143 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10144 {
10145 AddTemperature(-20);
10146
10147 }
10148
10149 else if (action_id ==
EActions.FLIP_FROZEN)
10150 {
10151 SetFrozen(!GetIsFrozen());
10152
10153 }
10154
10155 else if (action_id ==
EActions.ADD_WETNESS)
10156 {
10158
10159 }
10160
10161 else if (action_id ==
EActions.REMOVE_WETNESS)
10162 {
10164
10165 }
10166
10167 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10168 {
10171
10172
10173 }
10174
10175 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10176 {
10179 }
10180
10181 else if (action_id ==
EActions.MAKE_SPECIAL)
10182 {
10183 auto debugParams = DebugSpawnParams.WithPlayer(player);
10184 OnDebugSpawnEx(debugParams);
10185 }
10186
10187 }
10188
10189
10190 return false;
10191 }
10192
10193
10194
10195
10199
10202
10203
10204
10206 {
10207 return false;
10208 }
10209
10210
10212 {
10213 return true;
10214 }
10215
10216
10218 {
10219 return true;
10220 }
10221
10222
10223
10225 {
10226 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10227 return g_Game.ConfigIsExisting(config_path);
10228 }
10229
10232 {
10233 return null;
10234 }
10235
10237 {
10238 return false;
10239 }
10240
10242 {
10243 return false;
10244 }
10245
10249
10250
10252 {
10253 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10254 return module_repairing.CanRepair(this, item_repair_kit);
10255 }
10256
10257
10258 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10259 {
10260 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10261 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10262 }
10263
10264
10266 {
10267
10268
10269
10270
10271
10272
10273
10274
10275 return 1;
10276 }
10277
10278
10279
10281 {
10283 }
10284
10285
10286
10288 {
10290 }
10291
10292
10301 {
10302 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10303
10304 if (player)
10305 {
10306 player.MessageStatus(text);
10307 }
10308 }
10309
10310
10319 {
10320 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10321
10322 if (player)
10323 {
10324 player.MessageAction(text);
10325 }
10326 }
10327
10328
10337 {
10338 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10339
10340 if (player)
10341 {
10342 player.MessageFriendly(text);
10343 }
10344 }
10345
10346
10355 {
10356 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10357
10358 if (player)
10359 {
10360 player.MessageImportant(text);
10361 }
10362 }
10363
10365 {
10366 return true;
10367 }
10368
10369
10370 override bool KindOf(
string tag)
10371 {
10372 bool found = false;
10373 string item_name = this.
GetType();
10375 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10376
10377 int array_size = item_tag_array.Count();
10378 for (int i = 0; i < array_size; i++)
10379 {
10380 if (item_tag_array.Get(i) == tag)
10381 {
10382 found = true;
10383 break;
10384 }
10385 }
10386 return found;
10387 }
10388
10389
10391 {
10392
10393 super.OnRPC(sender, rpc_type,ctx);
10394
10395
10396 switch (rpc_type)
10397 {
10398 #ifndef SERVER
10399 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10400 Param2<bool, string> p = new Param2<bool, string>(false, "");
10401
10403 return;
10404
10405 bool play = p.param1;
10406 string soundSet = p.param2;
10407
10408 if (play)
10409 {
10411 {
10413 {
10415 }
10416 }
10417 else
10418 {
10420 }
10421 }
10422 else
10423 {
10425 }
10426
10427 break;
10428 #endif
10429
10430 }
10431
10433 {
10435 }
10436 }
10437
10438
10439
10440
10442 {
10443 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10444 return plugin.GetID(
name);
10445 }
10446
10448 {
10449 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10450 return plugin.GetName(id);
10451 }
10452
10455 {
10456
10457
10458 int varFlags;
10459 if (!ctx.
Read(varFlags))
10460 return;
10461
10462 if (varFlags & ItemVariableFlags.FLOAT)
10463 {
10465 }
10466 }
10467
10469 {
10470
10471 super.SerializeNumericalVars(floats_out);
10472
10473
10474
10476 {
10478 }
10479
10481 {
10483 }
10484
10486 {
10488 }
10489
10491 {
10496 }
10497
10499 {
10501 }
10502 }
10503
10505 {
10506
10507 super.DeSerializeNumericalVars(floats);
10508
10509
10510 int index = 0;
10511 int mask = Math.Round(floats.Get(index));
10512
10513 index++;
10514
10516 {
10518 {
10520 }
10521 else
10522 {
10523 float quantity = floats.Get(index);
10524 SetQuantity(quantity,
true,
false,
false,
false);
10525 }
10526 index++;
10527 }
10528
10530 {
10531 float wet = floats.Get(index);
10533 index++;
10534 }
10535
10537 {
10538 int liquidtype = Math.Round(floats.Get(index));
10540 index++;
10541 }
10542
10544 {
10546 index++;
10548 index++;
10550 index++;
10552 index++;
10553 }
10554
10556 {
10557 int cleanness = Math.Round(floats.Get(index));
10559 index++;
10560 }
10561 }
10562
10564 {
10565 super.WriteVarsToCTX(ctx);
10566
10567
10569 {
10571 }
10572
10574 {
10576 }
10577
10579 {
10581 }
10582
10584 {
10585 int r,g,b,a;
10591 }
10592
10594 {
10596 }
10597 }
10598
10600 {
10601 if (!super.ReadVarsFromCTX(ctx,version))
10602 return false;
10603
10604 int intValue;
10605 float value;
10606
10607 if (version < 140)
10608 {
10609 if (!ctx.
Read(intValue))
10610 return false;
10611
10612 m_VariablesMask = intValue;
10613 }
10614
10616 {
10617 if (!ctx.
Read(value))
10618 return false;
10619
10621 {
10623 }
10624 else
10625 {
10627 }
10628 }
10629
10630 if (version < 140)
10631 {
10633 {
10634 if (!ctx.
Read(value))
10635 return false;
10636 SetTemperatureDirect(value);
10637 }
10638 }
10639
10641 {
10642 if (!ctx.
Read(value))
10643 return false;
10645 }
10646
10648 {
10649 if (!ctx.
Read(intValue))
10650 return false;
10652 }
10653
10655 {
10656 int r,g,b,a;
10658 return false;
10660 return false;
10662 return false;
10664 return false;
10665
10667 }
10668
10670 {
10671 if (!ctx.
Read(intValue))
10672 return false;
10674 }
10675
10676 if (version >= 138 && version < 140)
10677 {
10679 {
10680 if (!ctx.
Read(intValue))
10681 return false;
10682 SetFrozen(intValue);
10683 }
10684 }
10685
10686 return true;
10687 }
10688
10689
10691 {
10694 {
10696 }
10697
10698 if (!super.OnStoreLoad(ctx, version))
10699 {
10701 return false;
10702 }
10703
10704 if (version >= 114)
10705 {
10706 bool hasQuickBarIndexSaved;
10707
10708 if (!ctx.
Read(hasQuickBarIndexSaved))
10709 {
10711 return false;
10712 }
10713
10714 if (hasQuickBarIndexSaved)
10715 {
10716 int itmQBIndex;
10717
10718
10719 if (!ctx.
Read(itmQBIndex))
10720 {
10722 return false;
10723 }
10724
10725 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10726 if (itmQBIndex != -1 && parentPlayer)
10727 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10728 }
10729 }
10730 else
10731 {
10732
10733 PlayerBase player;
10734 int itemQBIndex;
10735 if (version ==
int.
MAX)
10736 {
10737 if (!ctx.
Read(itemQBIndex))
10738 {
10740 return false;
10741 }
10742 }
10743 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10744 {
10745
10746 if (!ctx.
Read(itemQBIndex))
10747 {
10749 return false;
10750 }
10751 if (itemQBIndex != -1 && player)
10752 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10753 }
10754 }
10755
10756 if (version < 140)
10757 {
10758
10759 if (!LoadVariables(ctx, version))
10760 {
10762 return false;
10763 }
10764 }
10765
10766
10768 {
10770 return false;
10771 }
10772 if (version >= 132)
10773 {
10775 if (raib)
10776 {
10778 {
10780 return false;
10781 }
10782 }
10783 }
10784
10786 return true;
10787 }
10788
10789
10790
10792 {
10793 super.OnStoreSave(ctx);
10794
10795 PlayerBase player;
10796 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10797 {
10799
10800 int itemQBIndex = -1;
10801 itemQBIndex = player.FindQuickBarEntityIndex(this);
10802 ctx.
Write(itemQBIndex);
10803 }
10804 else
10805 {
10807 }
10808
10810
10812 if (raib)
10813 {
10815 }
10816 }
10817
10818
10820 {
10821 super.AfterStoreLoad();
10822
10824 {
10826 }
10827
10829 {
10832 }
10833 }
10834
10836 {
10837 super.EEOnAfterLoad();
10838
10840 {
10842 }
10843
10846 }
10847
10849 {
10850 return false;
10851 }
10852
10853
10854
10856 {
10858 {
10859 #ifdef PLATFORM_CONSOLE
10860
10862 {
10864 if (menu)
10865 {
10867 }
10868 }
10869 #endif
10870 }
10871
10873 {
10876 }
10877
10879 {
10880 SetWeightDirty();
10882 }
10884 {
10887 }
10888
10890 {
10893
10896 }
10898 {
10902 }
10903
10904 super.OnVariablesSynchronized();
10905 }
10906
10907
10908
10910 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10911 {
10912 if (!IsServerCheck(allow_client))
10913 return false;
10914
10916 return false;
10917
10920
10921 if (value <= (min + 0.001))
10922 value = min;
10923
10924 if (value == min)
10925 {
10926 if (destroy_config)
10927 {
10928 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10929 if (dstr)
10930 {
10932 this.Delete();
10933 return true;
10934 }
10935 }
10936 else if (destroy_forced)
10937 {
10939 this.Delete();
10940 return true;
10941 }
10942
10944 }
10945
10948
10950 {
10951 EntityAI parent = GetHierarchyRoot();
10952 InventoryLocation iLoc = new InventoryLocation();
10953 GetInventory().GetCurrentInventoryLocation(iLoc);
10955 {
10956 int iLocSlot = iLoc.
GetSlot();
10958 {
10960 }
10962 {
10964 }
10965 }
10966 }
10967
10969 {
10971
10972 if (delta)
10974 }
10975
10977
10978 return false;
10979 }
10980
10981
10983 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10984 {
10986 }
10987
10989 {
10992 }
10993
10995 {
10998 }
10999
11001 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11002 {
11003 float value_clamped = Math.Clamp(value, 0, 1);
11005 SetQuantity(result, destroy_config, destroy_forced);
11006 }
11007
11008
11011 {
11013 }
11014
11016 {
11018 }
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11030 {
11031 int slot = -1;
11032 GameInventory inventory = GetInventory();
11033 if (inventory)
11034 {
11035 InventoryLocation il = new InventoryLocation;
11038 }
11039
11041 }
11042
11044 {
11045 float quantity_max = 0;
11046
11048 {
11049 if (attSlotID != -1)
11050 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11051
11052 if (quantity_max <= 0)
11054 }
11055
11056 if (quantity_max <= 0)
11058
11059 return quantity_max;
11060 }
11061
11063 {
11065 }
11066
11068 {
11070 }
11071
11072
11074 {
11076 }
11077
11079 {
11081 }
11082
11084 {
11086 }
11087
11088
11090 {
11091
11092 float weightEx = GetWeightEx();
11093 float special = GetInventoryAndCargoWeight();
11094 return weightEx - special;
11095 }
11096
11097
11099 {
11101 }
11102
11104 {
11106 {
11107 #ifdef DEVELOPER
11108 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11109 {
11110 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11112 }
11113 #endif
11114
11115 return GetQuantity() * GetConfigWeightModified();
11116 }
11117 else if (HasEnergyManager())
11118 {
11119 #ifdef DEVELOPER
11120 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11121 {
11122 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11123 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11124 }
11125 #endif
11126 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11127 }
11128 else
11129 {
11130 #ifdef DEVELOPER
11131 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11132 {
11133 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11134 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11135 }
11136 #endif
11137 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11138 }
11139 }
11140
11143 {
11144 int item_count = 0;
11146
11147 GameInventory inventory = GetInventory();
11148 CargoBase cargo = inventory.
GetCargo();
11149 if (cargo != NULL)
11150 {
11152 }
11153
11155 for (int i = 0; i < nAttachments; ++i)
11156 {
11158 if (item)
11159 item_count += item.GetNumberOfItems();
11160 }
11161 return item_count;
11162 }
11163
11166 {
11167 float weight = 0;
11168 float wetness = 1;
11169 if (include_wetness)
11172 {
11173 weight = wetness * m_ConfigWeight;
11174 }
11176 {
11177 weight = 1;
11178 }
11179 return weight;
11180 }
11181
11182
11183
11185 {
11186 GameInventory inventory = GetInventory();
11187 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11188 {
11189 array<EntityAI> items = new array<EntityAI>;
11191 for (int i = 0; i < items.Count(); ++i)
11192 {
11194 if (item)
11195 {
11196 g_Game.ObjectDelete(item);
11197 }
11198 }
11199 }
11200 }
11201
11202
11203
11204
11206 {
11207 float energy = 0;
11208 if (HasEnergyManager())
11209 {
11210 energy = GetCompEM().GetEnergy();
11211 }
11212 return energy;
11213 }
11214
11215
11217 {
11218 super.OnEnergyConsumed();
11219
11221 }
11222
11224 {
11225 super.OnEnergyAdded();
11226
11228 }
11229
11230
11232 {
11233 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11234 {
11236 {
11237 float energy_0to1 = GetCompEM().GetEnergy0To1();
11239 }
11240 }
11241 }
11242
11243
11245 {
11246 return ConfigGetFloat("heatIsolation");
11247 }
11248
11250 {
11252 }
11253
11255 {
11256 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11257 if (
g_Game.ConfigIsExisting(paramPath))
11258 return g_Game.ConfigGetFloat(paramPath);
11259
11260 return 0.0;
11261 }
11262
11264 {
11265 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11266 if (
g_Game.ConfigIsExisting(paramPath))
11267 return g_Game.ConfigGetFloat(paramPath);
11268
11269 return 0.0;
11270 }
11271
11272 override void SetWet(
float value,
bool allow_client =
false)
11273 {
11274 if (!IsServerCheck(allow_client))
11275 return;
11276
11279
11281
11282 m_VarWet = Math.Clamp(value, min, max);
11283
11285 {
11288 }
11289 }
11290
11291 override void AddWet(
float value)
11292 {
11294 }
11295
11297 {
11299 }
11300
11302 {
11304 }
11305
11307 {
11309 }
11310
11312 {
11314 }
11315
11317 {
11319 }
11320
11321 override void OnWetChanged(
float newVal,
float oldVal)
11322 {
11325 if (newLevel != oldLevel)
11326 {
11328 }
11329 }
11330
11332 {
11333 SetWeightDirty();
11334 }
11335
11337 {
11338 return GetWetLevelInternal(
m_VarWet);
11339 }
11340
11341
11342
11344 {
11346 }
11347
11349 {
11351 }
11352
11354 {
11356 }
11357
11359 {
11361 }
11362
11363
11364
11366 {
11367 if (ConfigIsExisting("itemModelLength"))
11368 {
11369 return ConfigGetFloat("itemModelLength");
11370 }
11371 return 0;
11372 }
11373
11375 {
11376 if (ConfigIsExisting("itemAttachOffset"))
11377 {
11378 return ConfigGetFloat("itemAttachOffset");
11379 }
11380 return 0;
11381 }
11382
11383 override void SetCleanness(
int value,
bool allow_client =
false)
11384 {
11385 if (!IsServerCheck(allow_client))
11386 return;
11387
11389
11391
11394 }
11395
11397 {
11399 }
11400
11402 {
11403 return true;
11404 }
11405
11406
11407
11408
11410 {
11412 }
11413
11415 {
11417 }
11418
11419
11420
11421
11422 override void SetColor(
int r,
int g,
int b,
int a)
11423 {
11429 }
11431 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11432 {
11437 }
11438
11440 {
11442 }
11443
11446 {
11447 int r,g,b,a;
11449 r = r/255;
11450 g = g/255;
11451 b = b/255;
11452 a = a/255;
11453 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11454 }
11455
11456
11457
11458 override void SetLiquidType(
int value,
bool allow_client =
false)
11459 {
11460 if (!IsServerCheck(allow_client))
11461 return;
11462
11467 }
11468
11470 {
11471 return ConfigGetInt("varLiquidTypeInit");
11472 }
11473
11475 {
11477 }
11478
11480 {
11482 SetFrozen(false);
11483 }
11484
11487 {
11488 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11489 }
11490
11491
11494 {
11495 PlayerBase nplayer;
11496 if (PlayerBase.CastTo(nplayer, player))
11497 {
11499 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11500 }
11501 }
11502
11503
11506 {
11507 PlayerBase nplayer;
11508 if (PlayerBase.CastTo(nplayer,player))
11509 {
11510 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11511 }
11512
11513 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11514
11515 if (HasEnergyManager())
11516 {
11517 GetCompEM().UpdatePlugState();
11518 }
11519 }
11520
11521
11523 {
11524 super.OnPlacementStarted(player);
11525
11527 }
11528
11529 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11530 {
11532 {
11533 m_AdminLog.OnPlacementComplete(player,
this);
11534 }
11535
11536 super.OnPlacementComplete(player, position, orientation);
11537 }
11538
11539
11540
11541
11542
11544 {
11546 {
11547 return true;
11548 }
11549 else
11550 {
11551 return false;
11552 }
11553 }
11554
11555
11557 {
11559 {
11561 }
11562 }
11563
11564
11566 {
11568 }
11569
11571 {
11573 }
11574
11575 override void InsertAgent(
int agent,
float count = 1)
11576 {
11577 if (count < 1)
11578 return;
11579
11581 }
11582
11585 {
11587 }
11588
11589
11591 {
11593 }
11594
11595
11596
11597
11598
11599
11600
11601
11602
11603
11604
11605
11606
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
11637 {
11639 return false;
11640 return true;
11641 }
11642
11644 {
11645
11647 }
11648
11649
11652 {
11653 super.CheckForRoofLimited(timeTresholdMS);
11654
11655 float time =
g_Game.GetTime();
11656 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11657 {
11658 m_PreviousRoofTestTime = time;
11659 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11660 }
11661 }
11662
11663
11665 {
11667 {
11668 return 0;
11669 }
11670
11671 if (GetInventory().GetAttachmentSlotsCount() != 0)
11672 {
11673 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11674 if (filter)
11675 return filter.GetProtectionLevel(type, false, system);
11676 else
11677 return 0;
11678 }
11679
11680 string subclassPath, entryName;
11681
11682 switch (type)
11683 {
11685 entryName = "biological";
11686 break;
11688 entryName = "chemical";
11689 break;
11690 default:
11691 entryName = "biological";
11692 break;
11693 }
11694
11695 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11696
11697 return g_Game.ConfigGetFloat(subclassPath + entryName);
11698 }
11699
11700
11701
11704 {
11705 if (!IsMagazine())
11707
11709 }
11710
11711
11712
11713
11714
11719 {
11720 return true;
11721 }
11722
11724 {
11726 }
11727
11728
11729
11730
11731
11733 {
11734 if (parent)
11735 {
11736 if (parent.IsInherited(DayZInfected))
11737 return true;
11738
11739 if (!parent.IsRuined())
11740 return true;
11741 }
11742
11743 return true;
11744 }
11745
11747 {
11748 if (!super.CanPutAsAttachment(parent))
11749 {
11750 return false;
11751 }
11752
11753 if (!IsRuined() && !parent.IsRuined())
11754 {
11755 return true;
11756 }
11757
11758 return false;
11759 }
11760
11762 {
11763
11764
11765
11766
11767 return super.CanReceiveItemIntoCargo(item);
11768 }
11769
11771 {
11772
11773
11774
11775
11776 GameInventory attachmentInv = attachment.GetInventory();
11778 {
11779 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11780 return false;
11781 }
11782
11783 InventoryLocation loc = new InventoryLocation();
11784 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11785 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11786 return false;
11787
11788 return super.CanReceiveAttachment(attachment, slotId);
11789 }
11790
11792 {
11793 if (!super.CanReleaseAttachment(attachment))
11794 return false;
11795
11796 return GetInventory().AreChildrenAccessible();
11797 }
11798
11799
11800
11801
11802
11803
11804
11805
11806
11807
11808
11809
11810
11811
11812
11813
11814
11815
11816
11817
11818
11820 {
11821 int id = muzzle_owner.GetMuzzleID();
11822 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11823
11824 if (WPOF_array)
11825 {
11826 for (int i = 0; i < WPOF_array.Count(); i++)
11827 {
11828 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11829
11830 if (WPOF)
11831 {
11832 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11833 }
11834 }
11835 }
11836 }
11837
11838
11840 {
11841 int id = muzzle_owner.GetMuzzleID();
11843
11844 if (WPOBE_array)
11845 {
11846 for (int i = 0; i < WPOBE_array.Count(); i++)
11847 {
11848 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11849
11850 if (WPOBE)
11851 {
11852 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11853 }
11854 }
11855 }
11856 }
11857
11858
11860 {
11861 int id = muzzle_owner.GetMuzzleID();
11862 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11863
11864 if (WPOOH_array)
11865 {
11866 for (int i = 0; i < WPOOH_array.Count(); i++)
11867 {
11868 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11869
11870 if (WPOOH)
11871 {
11872 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11873 }
11874 }
11875 }
11876 }
11877
11878
11880 {
11881 int id = muzzle_owner.GetMuzzleID();
11882 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11883
11884 if (WPOOH_array)
11885 {
11886 for (int i = 0; i < WPOOH_array.Count(); i++)
11887 {
11888 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11889
11890 if (WPOOH)
11891 {
11892 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11893 }
11894 }
11895 }
11896 }
11897
11898
11900 {
11901 int id = muzzle_owner.GetMuzzleID();
11902 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11903
11904 if (WPOOH_array)
11905 {
11906 for (int i = 0; i < WPOOH_array.Count(); i++)
11907 {
11908 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11909
11910 if (WPOOH)
11911 {
11912 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11913 }
11914 }
11915 }
11916 }
11917
11918
11919
11921 {
11923 {
11924 return true;
11925 }
11926
11927 return false;
11928 }
11929
11931 {
11933 {
11934 return true;
11935 }
11936
11937 return false;
11938 }
11939
11941 {
11943 {
11944 return true;
11945 }
11946
11947 return false;
11948 }
11949
11951 {
11952 return false;
11953 }
11954
11957 {
11958 return UATimeSpent.DEFAULT_DEPLOY;
11959 }
11960
11961
11962
11963
11965 {
11967 SetSynchDirty();
11968 }
11969
11971 {
11973 }
11974
11975
11977 {
11978 return false;
11979 }
11980
11983 {
11984 string att_type = "None";
11985
11986 if (ConfigIsExisting("soundAttType"))
11987 {
11988 att_type = ConfigGetString("soundAttType");
11989 }
11990
11992 }
11993
11995 {
11997 }
11998
11999
12000
12001
12002
12008
12010 {
12013
12015 }
12016
12017
12019 {
12021 return;
12022
12024
12027
12030
12031 SoundParameters params = new SoundParameters();
12035 }
12036
12037
12039 {
12041 {
12044
12045 SetSynchDirty();
12046
12049 }
12050 }
12051
12053 {
12055 }
12056
12057
12059 {
12061 return;
12062
12064 SetSynchDirty();
12065
12068 }
12069
12071 {
12074 }
12075
12077 {
12079 }
12080
12081 void OnApply(PlayerBase player);
12082
12084 {
12085 return 1.0;
12086 };
12087
12089 {
12091 }
12092
12094 {
12096 }
12097
12099
12101 {
12102 SetDynamicPhysicsLifeTime(0.01);
12104 }
12105
12107 {
12108 array<string> zone_names = new array<string>;
12109 GetDamageZones(zone_names);
12110 for (int i = 0; i < zone_names.Count(); i++)
12111 {
12112 SetHealthMax(zone_names.Get(i),"Health");
12113 }
12114 SetHealthMax("","Health");
12115 }
12116
12119 {
12120 float global_health = GetHealth01("","Health");
12121 array<string> zones = new array<string>;
12122 GetDamageZones(zones);
12123
12124 for (int i = 0; i < zones.Count(); i++)
12125 {
12126 SetHealth01(zones.Get(i),"Health",global_health);
12127 }
12128 }
12129
12132 {
12133 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12134 }
12135
12137 {
12138 if (!hasRootAsPlayer)
12139 {
12140 if (refParentIB)
12141 {
12142
12143 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12144 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12145
12146 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12147 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12148
12151 }
12152 else
12153 {
12154
12157 }
12158 }
12159 }
12160
12162 {
12164 {
12165 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12166 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12167 {
12168 float heatPermCoef = 1.0;
12170 while (ent)
12171 {
12172 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12173 ent = ent.GetHierarchyParent();
12174 }
12175
12176 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12177 }
12178 }
12179 }
12180
12182 {
12183
12184 EntityAI parent = GetHierarchyParent();
12185 if (!parent)
12186 {
12187 hasParent = false;
12188 hasRootAsPlayer = false;
12189 }
12190 else
12191 {
12192 hasParent = true;
12193 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12194 refParentIB =
ItemBase.Cast(parent);
12195 }
12196 }
12197
12198 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12199 {
12200
12201 }
12202
12204 {
12205
12206 return false;
12207 }
12208
12210 {
12211
12212
12213 return false;
12214 }
12215
12217 {
12218
12219 return false;
12220 }
12221
12224 {
12225 return !GetIsFrozen() &&
IsOpen();
12226 }
12227
12229 {
12230 bool hasParent = false, hasRootAsPlayer = false;
12232
12233 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12234 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12235
12236 if (wwtu || foodDecay)
12237 {
12241
12242 if (processWetness || processTemperature || processDecay)
12243 {
12245
12246 if (processWetness)
12247 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12248
12249 if (processTemperature)
12251
12252 if (processDecay)
12253 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12254 }
12255 }
12256 }
12257
12260 {
12262 }
12263
12265 {
12268
12269 return super.GetTemperatureFreezeThreshold();
12270 }
12271
12273 {
12276
12277 return super.GetTemperatureThawThreshold();
12278 }
12279
12281 {
12284
12285 return super.GetItemOverheatThreshold();
12286 }
12287
12289 {
12291 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12292
12293 return super.GetTemperatureFreezeTime();
12294 }
12295
12297 {
12299 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12300
12301 return super.GetTemperatureThawTime();
12302 }
12303
12308
12310 {
12311 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12312 }
12313
12315 {
12316 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12317 }
12318
12321 {
12323 }
12324
12326 {
12328 }
12329
12331 {
12333 }
12334
12337 {
12338 return null;
12339 }
12340
12343 {
12344 return false;
12345 }
12346
12348 {
12350 {
12353 if (!trg)
12354 {
12356 explosive = this;
12357 }
12358
12359 explosive.PairRemote(trg);
12361
12362 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12363 trg.SetPersistentPairID(persistentID);
12364 explosive.SetPersistentPairID(persistentID);
12365
12366 return true;
12367 }
12368 return false;
12369 }
12370
12373 {
12374 float ret = 1.0;
12377 ret *= GetHealth01();
12378
12379 return ret;
12380 }
12381
12382 #ifdef DEVELOPER
12383 override void SetDebugItem()
12384 {
12385 super.SetDebugItem();
12386 _itemBase = this;
12387 }
12388
12390 {
12391 string text = super.GetDebugText();
12392
12394 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12395
12396 return text;
12397 }
12398 #endif
12399
12401 {
12402 return true;
12403 }
12404
12406
12408
12410 {
12413 }
12414
12415
12423
12439
12440 [
Obsolete(
"Use ItemSoundHandler instead")]
12443 {
12444 if (!
g_Game.IsDedicatedServer())
12445 {
12446 if (ConfigIsExisting("attachSoundSet"))
12447 {
12448 string cfg_path = "";
12449 string soundset = "";
12450 string type_name =
GetType();
12451
12454 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12455 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12456
12457 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12458 {
12459 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12460 {
12461 if (cfg_slot_array[i] == slot_type)
12462 {
12463 soundset = cfg_soundset_array[i];
12464 break;
12465 }
12466 }
12467 }
12468
12469 if (soundset != "")
12470 {
12471 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12473 }
12474 }
12475 }
12476 }
12477
12479}
12480
12482{
12484 if (entity)
12485 {
12486 bool is_item = entity.IsInherited(
ItemBase);
12487 if (is_item && full_quantity)
12488 {
12491 }
12492 }
12493 else
12494 {
12496 return NULL;
12497 }
12498 return entity;
12499}
12500
12502{
12503 if (item)
12504 {
12505 if (health > 0)
12506 item.SetHealth("", "", health);
12507
12508 if (item.CanHaveTemperature())
12509 {
12511 if (item.CanFreeze())
12512 item.SetFrozen(false);
12513 }
12514
12515 if (item.HasEnergyManager())
12516 {
12517 if (quantity >= 0)
12518 {
12519 item.GetCompEM().SetEnergy0To1(quantity);
12520 }
12521 else
12522 {
12524 }
12525 }
12526 else if (item.IsMagazine())
12527 {
12528 Magazine mag = Magazine.Cast(item);
12529 if (quantity >= 0)
12530 {
12531 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12532 }
12533 else
12534 {
12536 }
12537
12538 }
12539 else
12540 {
12541 if (quantity >= 0)
12542 {
12543 item.SetQuantityNormalized(quantity, false);
12544 }
12545 else
12546 {
12548 }
12549
12550 }
12551 }
12552}
12553
12554#ifdef DEVELOPER
12556#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.