Send message to owner player in green color.
7661{
7663 {
7664 return true;
7665 }
7666};
7667
7669{
7670
7671};
7672
7673
7674
7676{
7680
7682
7685
7686
7687
7688
7689
7698
7704
7709
7714
7735 protected bool m_IsResultOfSplit
7736
7738
7743
7744
7745
7747
7751
7752
7753
7755
7758
7759
7760
7766
7767
7775
7778
7779
7781
7782
7784
7785
7790
7791
7796
7798
7799
7801
7802
7804 {
7809
7810 if (!
g_Game.IsDedicatedServer())
7811 {
7813 {
7815
7817 {
7819 }
7820 }
7821
7824 }
7825
7826 m_OldLocation = null;
7827
7829 {
7831 }
7832
7833 if (ConfigIsExisting("headSelectionsToHide"))
7834 {
7837 }
7838
7840 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7841 {
7843 }
7844
7846
7847 m_IsResultOfSplit = false;
7848
7850 }
7851
7853 {
7854 super.InitItemVariables();
7855
7861 m_Count = ConfigGetInt(
"count");
7862
7865
7870
7873
7878
7890
7894
7895
7898 if (ConfigIsExisting("canBeSplit"))
7899 {
7902 }
7903
7905 if (ConfigIsExisting("itemBehaviour"))
7907
7908
7911 RegisterNetSyncVariableInt("m_VarLiquidType");
7912 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7913
7914 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7915 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7916 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7917
7918 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7919 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7920 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7921 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7922
7923 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7924 RegisterNetSyncVariableBool("m_IsTakeable");
7925 RegisterNetSyncVariableBool("m_IsHologram");
7926
7929 {
7932 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7933 }
7934
7936
7938 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7940
7942 }
7943
7945 {
7947 }
7948
7950 {
7953 {
7958 }
7959 }
7960
7961 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7962 {
7964 {
7967 }
7968
7970 }
7971
7973 {
7979 }
7980
7982
7984 {
7986
7987 if (!action)
7988 {
7989 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7990 return;
7991 }
7992
7994 if (!ai)
7995 {
7997 return;
7998 }
7999
8001 if (!action_array)
8002 {
8003 action_array = new array<ActionBase_Basic>;
8005 }
8006 if (LogManager.IsActionLogEnable())
8007 {
8008 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8009 }
8010
8011 if (action_array.Find(action) != -1)
8012 {
8013 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8014 }
8015 else
8016 {
8017 action_array.Insert(action);
8018 }
8019 }
8020
8022 {
8023 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8024 ActionBase action = player.GetActionManager().GetAction(actionName);
8027
8028 if (action_array)
8029 {
8030 action_array.RemoveItem(action);
8031 }
8032 }
8033
8034
8035
8037 {
8038 ActionOverrideData overrideData = new ActionOverrideData();
8042
8044 if (!actionMap)
8045 {
8048 }
8049
8050 actionMap.Insert(this.
Type(), overrideData);
8051
8052 }
8053
8055
8057
8058
8060 {
8063
8066
8067 string config_to_search = "CfgVehicles";
8068 string muzzle_owner_config;
8069
8071 {
8072 if (IsInherited(Weapon))
8073 config_to_search = "CfgWeapons";
8074
8075 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8076
8077 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8078
8079 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8080
8081 if (config_OnFire_subclass_count > 0)
8082 {
8083 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8084
8085 for (int i = 0; i < config_OnFire_subclass_count; i++)
8086 {
8087 string particle_class = "";
8088 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8089 string config_OnFire_entry = config_OnFire_class + particle_class;
8090 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8091 WPOF_array.Insert(WPOF);
8092 }
8093
8094
8096 }
8097 }
8098
8100 {
8101 config_to_search = "CfgWeapons";
8102 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8103
8104 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8105
8106 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8107
8108 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8109 {
8110 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8111
8112 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8113 {
8114 string particle_class2 = "";
8115 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8116 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8117 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8118 WPOBE_array.Insert(WPOBE);
8119 }
8120
8121
8123 }
8124 }
8125 }
8126
8127
8129 {
8132
8134 {
8135 string config_to_search = "CfgVehicles";
8136
8137 if (IsInherited(Weapon))
8138 config_to_search = "CfgWeapons";
8139
8140 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8141 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8142
8143 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8144 {
8145
8147
8149 {
8151 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8153 return;
8154 }
8155
8158
8159
8160
8161 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8162 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8163
8164 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8165 {
8166 string particle_class = "";
8167 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8168 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8169 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8170
8171 if (entry_type == CT_CLASS)
8172 {
8173 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8174 WPOOH_array.Insert(WPOF);
8175 }
8176 }
8177
8178
8180 }
8181 }
8182 }
8183
8185 {
8187 }
8188
8190 {
8192 {
8194
8197
8200
8201 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8202 }
8203 }
8204
8206 {
8208 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8209
8211 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8212
8214 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8215
8217 {
8219 }
8220 }
8221
8223 {
8225 }
8226
8228 {
8231 else
8233
8235 {
8238 }
8239 else
8240 {
8243
8246 }
8247
8249 }
8250
8252 {
8254 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8255 }
8256
8258 {
8260 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8262 }
8263
8265 {
8267 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8268 }
8269
8271 {
8274
8275 OverheatingParticle OP = new OverheatingParticle();
8280
8282 }
8283
8285 {
8288
8289 return -1;
8290 }
8291
8293 {
8295 {
8298
8299 for (int i = count; i > 0; --i)
8300 {
8301 int id = i - 1;
8304
8307
8308 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8309 {
8310 if (p)
8311 {
8314 }
8315 }
8316 }
8317 }
8318 }
8319
8321 {
8323 {
8325 {
8326 int id = i - 1;
8328
8329 if (OP)
8330 {
8332
8333 if (p)
8334 {
8336 }
8337
8338 delete OP;
8339 }
8340 }
8341
8344 }
8345 }
8346
8349 {
8350 return 0.0;
8351 }
8352
8353
8355 {
8356 return 250;
8357 }
8358
8360 {
8361 return 0;
8362 }
8363
8366 {
8368 return true;
8369
8370 return false;
8371 }
8372
8375 {
8378
8380 {
8382 }
8383 else
8384 {
8385
8387 }
8388
8390 }
8391
8398 {
8399 return -1;
8400 }
8401
8402
8403
8404
8406 {
8408 {
8409 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8410 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8411
8412 if (r_index >= 0)
8413 {
8414 InventoryLocation r_il = new InventoryLocation;
8415 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8416
8417 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8420 {
8421 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8422 }
8424 {
8425 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8426 }
8427
8428 }
8429
8430 player.GetHumanInventory().ClearUserReservedLocation(this);
8431 }
8432
8435 }
8436
8437
8438
8439
8441 {
8442 return ItemBase.m_DebugActionsMask;
8443 }
8444
8446 {
8447 return ItemBase.m_DebugActionsMask & mask;
8448 }
8449
8451 {
8452 ItemBase.m_DebugActionsMask = mask;
8453 }
8454
8456 {
8457 ItemBase.m_DebugActionsMask |= mask;
8458 }
8459
8461 {
8462 ItemBase.m_DebugActionsMask &= ~mask;
8463 }
8464
8466 {
8468 {
8470 }
8471 else
8472 {
8474 }
8475 }
8476
8477
8479 {
8480 if (GetEconomyProfile())
8481 {
8482 float q_max = GetEconomyProfile().GetQuantityMax();
8483 if (q_max > 0)
8484 {
8485 float q_min = GetEconomyProfile().GetQuantityMin();
8486 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8487
8489 {
8490 ComponentEnergyManager comp = GetCompEM();
8492 {
8494 }
8495 }
8497 {
8499
8500 }
8501
8502 }
8503 }
8504 }
8505
8508 {
8509 EntityAI parent = GetHierarchyParent();
8510
8511 if (parent)
8512 {
8513 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8514 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8515 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8516 }
8517 }
8518
8521 {
8522 EntityAI parent = GetHierarchyParent();
8523
8524 if (parent)
8525 {
8526 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8527 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8528 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8529 }
8530 }
8531
8533 {
8534
8535
8536
8537
8539
8541 {
8542 if (ScriptInputUserData.CanStoreInputUserData())
8543 {
8544 ScriptInputUserData ctx = new ScriptInputUserData;
8550 ctx.
Write(use_stack_max);
8553
8555 {
8556 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8557 }
8558 }
8559 }
8560 else if (!
g_Game.IsMultiplayer())
8561 {
8563 }
8564 }
8565
8567 {
8569 }
8570
8572 {
8574 }
8575
8577 {
8579 }
8580
8582 {
8583
8584 return false;
8585 }
8586
8588 {
8589 return false;
8590 }
8591
8595 {
8596 return false;
8597 }
8598
8600 {
8601 return "";
8602 }
8603
8605
8607 {
8608 return false;
8609 }
8610
8612 {
8613 return true;
8614 }
8615
8616
8617
8619 {
8620 return true;
8621 }
8622
8624 {
8625 return true;
8626 }
8627
8629 {
8630 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8632 }
8633
8635 {
8637 }
8638
8640 {
8642 if (!is_being_placed)
8644 SetSynchDirty();
8645 }
8646
8647
8649
8651 {
8653 }
8654
8656 {
8658 }
8659
8661 {
8662 return 1;
8663 }
8664
8666 {
8667 return false;
8668 }
8669
8671 {
8673 SetSynchDirty();
8674 }
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8692
8693
8694
8695
8696
8697
8698
8699
8700
8701
8702
8703
8704
8705
8706
8707
8708
8709
8711 {
8712 super.OnMovedInsideCargo(container);
8713
8714 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8715 }
8716
8717 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8718 {
8719 super.EEItemLocationChanged(oldLoc, newLoc);
8720
8721 PlayerBase newPlayer = null;
8722 PlayerBase oldPlayer = null;
8723
8724 if (newLoc.GetParent())
8725 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8726
8727 if (oldLoc.GetParent())
8728 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8729
8731 {
8732 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8733
8734 if (rIndex >= 0)
8735 {
8736 InventoryLocation rIl = new InventoryLocation;
8737 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8738
8739 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8742 {
8743 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8744 }
8746 {
8748 }
8749
8750 }
8751 }
8752
8754 {
8755 if (newPlayer)
8756 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8757
8758 if (newPlayer == oldPlayer)
8759 {
8760 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8761 {
8763 {
8764 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8765 {
8766 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8767 }
8768 }
8769 else
8770 {
8771 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8772 }
8773 }
8774
8775 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8776 {
8777 int type = oldLoc.GetType();
8779 {
8780 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8781 }
8783 {
8784 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8785 }
8786 }
8787 if (!m_OldLocation)
8788 {
8789 m_OldLocation = new InventoryLocation;
8790 }
8791 m_OldLocation.Copy(oldLoc);
8792 }
8793 else
8794 {
8795 if (m_OldLocation)
8796 {
8797 m_OldLocation.Reset();
8798 }
8799 }
8800
8801 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8802 }
8803 else
8804 {
8805 if (newPlayer)
8806 {
8807 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8808 if (resIndex >= 0)
8809 {
8810 InventoryLocation il = new InventoryLocation;
8811 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8813 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8816 {
8817 il.
GetParent().GetOnReleaseLock().Invoke(it);
8818 }
8820 {
8822 }
8823
8824 }
8825 }
8827 {
8828
8830 }
8831
8832 if (m_OldLocation)
8833 {
8834 m_OldLocation.Reset();
8835 }
8836 }
8837
8839 {
8840 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8841 }
8842
8844 {
8845 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8846 }
8847 }
8848
8849 override void EOnContact(IEntity other, Contact extra)
8850 {
8852 {
8853 int liquidType = -1;
8855 if (impactSpeed > 0.0)
8856 {
8858 #ifndef SERVER
8860 #else
8862 SetSynchDirty();
8863 #endif
8865 }
8866 }
8867
8868 #ifdef SERVER
8869 if (GetCompEM() && GetCompEM().IsPlugged())
8870 {
8871 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8872 GetCompEM().UnplugThis();
8873 }
8874 #endif
8875 }
8876
8878
8880 {
8882 }
8883
8885 {
8886
8887 }
8888
8890 {
8891 super.OnItemLocationChanged(old_owner, new_owner);
8892
8893 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8894 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8895
8896 if (!relatedPlayer && playerNew)
8897 relatedPlayer = playerNew;
8898
8899 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8900 {
8902 if (actionMgr)
8903 {
8904 ActionBase currentAction = actionMgr.GetRunningAction();
8905 if (currentAction)
8907 }
8908 }
8909
8910 Man ownerPlayerOld = null;
8911 Man ownerPlayerNew = null;
8912
8913 if (old_owner)
8914 {
8915 if (old_owner.
IsMan())
8916 {
8917 ownerPlayerOld = Man.Cast(old_owner);
8918 }
8919 else
8920 {
8921 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8922 }
8923 }
8924 else
8925 {
8927 {
8929
8930 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8931 {
8932 GetCompEM().UnplugThis();
8933 }
8934 }
8935 }
8936
8937 if (new_owner)
8938 {
8939 if (new_owner.
IsMan())
8940 {
8941 ownerPlayerNew = Man.Cast(new_owner);
8942 }
8943 else
8944 {
8945 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8946 }
8947 }
8948
8949 if (ownerPlayerOld != ownerPlayerNew)
8950 {
8951 if (ownerPlayerOld)
8952 {
8953 array<EntityAI> subItemsExit = new array<EntityAI>;
8955 for (int i = 0; i < subItemsExit.Count(); i++)
8956 {
8959 }
8960 }
8961
8962 if (ownerPlayerNew)
8963 {
8964 array<EntityAI> subItemsEnter = new array<EntityAI>;
8966 for (int j = 0; j < subItemsEnter.Count(); j++)
8967 {
8970 }
8971 }
8972 }
8973 else if (ownerPlayerNew != null)
8974 {
8975 PlayerBase nplayer;
8976 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8977 {
8978 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8980 for (int k = 0; k < subItemsUpdate.Count(); k++)
8981 {
8983 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8984 }
8985 }
8986 }
8987
8988 if (old_owner)
8989 old_owner.OnChildItemRemoved(this);
8990 if (new_owner)
8991 new_owner.OnChildItemReceived(this);
8992 }
8993
8994
8996 {
8997 super.EEDelete(parent);
8998 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8999 if (player)
9000 {
9002
9003 if (player.IsAlive())
9004 {
9005 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9006 if (r_index >= 0)
9007 {
9008 InventoryLocation r_il = new InventoryLocation;
9009 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9010
9011 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9014 {
9015 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9016 }
9018 {
9019 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9020 }
9021
9022 }
9023
9024 player.RemoveQuickBarEntityShortcut(this);
9025 }
9026 }
9027 }
9028
9030 {
9031 super.EEKilled(killer);
9032
9035 {
9036 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9037 {
9038 if (IsMagazine())
9039 {
9040 if (Magazine.Cast(this).GetAmmoCount() > 0)
9041 {
9043 }
9044 }
9045 else
9046 {
9048 }
9049 }
9050 }
9051 }
9052
9054 {
9055 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9056
9057 super.OnWasAttached(parent, slot_id);
9058
9061
9064 }
9065
9067 {
9068 super.OnWasDetached(parent, slot_id);
9069
9072
9075 }
9076
9078 {
9079 int idx;
9082
9083 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9084 if (inventory_slots.Count() < 1)
9085 {
9086 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9087 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9088 }
9089 else
9090 {
9091 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9092 }
9093
9094 idx = inventory_slots.Find(slot);
9095 if (idx < 0)
9096 return "";
9097
9098 return attach_types.Get(idx);
9099 }
9100
9102 {
9103 int idx = -1;
9104 string slot;
9105
9108
9109 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9110 if (inventory_slots.Count() < 1)
9111 {
9112 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9113 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9114 }
9115 else
9116 {
9117 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9118 if (detach_types.Count() < 1)
9119 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9120 }
9121
9122 for (int i = 0; i < inventory_slots.Count(); i++)
9123 {
9124 slot = inventory_slots.Get(i);
9125 }
9126
9127 if (slot != "")
9128 {
9129 if (detach_types.Count() == 1)
9130 idx = 0;
9131 else
9132 idx = inventory_slots.Find(slot);
9133 }
9134 if (idx < 0)
9135 return "";
9136
9137 return detach_types.Get(idx);
9138 }
9139
9141 {
9142
9144
9145
9146 float min_time = 1;
9147 float max_time = 3;
9148 float delay = Math.RandomFloat(min_time, max_time);
9149
9150 explode_timer.Run(delay, this, "DoAmmoExplosion");
9151 }
9152
9154 {
9155 Magazine magazine = Magazine.Cast(this);
9156 int pop_sounds_count = 6;
9157 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9158
9159
9160 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9161 string sound_name = pop_sounds[ sound_idx ];
9162 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9163
9164
9165 magazine.ServerAddAmmoCount(-1);
9166
9167
9168 float min_temp_to_explode = 100;
9169
9170 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9171 {
9173 }
9174 }
9175
9176
9177 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9178 {
9179 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9180
9181 const int CHANCE_DAMAGE_CARGO = 4;
9182 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9183 const int CHANCE_DAMAGE_NOTHING = 2;
9184
9186 {
9187 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9188 int chances;
9189 int rnd;
9190
9191 if (GetInventory().GetCargo())
9192 {
9193 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9194 rnd = Math.RandomInt(0,chances);
9195
9196 if (rnd < CHANCE_DAMAGE_CARGO)
9197 {
9199 }
9200 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9201 {
9203 }
9204 }
9205 else
9206 {
9207 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9208 rnd = Math.RandomInt(0,chances);
9209
9210 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9211 {
9213 }
9214 }
9215 }
9216 }
9217
9219 {
9220 CargoBase cargo = GetInventory().GetCargo();
9221 if (cargo)
9222 {
9224 if (item_count > 0)
9225 {
9226 int random_pick = Math.RandomInt(0, item_count);
9228 if (!item.IsExplosive())
9229 {
9230 item.AddHealth("","",damage);
9231 return true;
9232 }
9233 }
9234 }
9235 return false;
9236 }
9237
9239 {
9240 GameInventory inventory = GetInventory();
9242 if (attachment_count > 0)
9243 {
9244 int random_pick = Math.RandomInt(0, attachment_count);
9246 if (!attachment.IsExplosive())
9247 {
9248 attachment.AddHealth("","",damage);
9249 return true;
9250 }
9251 }
9252 return false;
9253 }
9254
9256 {
9258 }
9259
9261 {
9263 return GetInventory().CanRemoveEntity();
9264
9265 return false;
9266 }
9267
9269 {
9270
9272 return false;
9273
9274
9276 return false;
9277
9278
9279
9281 if (delta == 0)
9282 return false;
9283
9284
9285 return true;
9286 }
9287
9289 {
9291 {
9292 if (ScriptInputUserData.CanStoreInputUserData())
9293 {
9294 ScriptInputUserData ctx = new ScriptInputUserData;
9299 ctx.
Write(destination_entity);
9303 }
9304 }
9305 else if (!
g_Game.IsMultiplayer())
9306 {
9308 }
9309 }
9310
9312 {
9313 float split_quantity_new;
9317 InventoryLocation loc = new InventoryLocation;
9318
9319 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9320 {
9322 split_quantity_new = stack_max;
9323 else
9325
9327 {
9328 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9329 if (new_item)
9330 {
9331 new_item.SetResultOfSplit(true);
9332 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9334 new_item.
SetQuantity(split_quantity_new,
false,
true);
9335 }
9336 }
9337 }
9338 else if (destination_entity && slot_id == -1)
9339 {
9340 if (quantity > stack_max)
9341 split_quantity_new = stack_max;
9342 else
9343 split_quantity_new = quantity;
9344
9346 {
9347 GameInventory destinationInventory = destination_entity.GetInventory();
9349 {
9352 }
9353
9354 if (new_item)
9355 {
9356 new_item.SetResultOfSplit(true);
9357 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9359 new_item.
SetQuantity(split_quantity_new,
false,
true);
9360 }
9361 }
9362 }
9363 else
9364 {
9365 if (stack_max != 0)
9366 {
9368 {
9370 }
9371
9372 if (split_quantity_new == 0)
9373 {
9374 if (!
g_Game.IsMultiplayer())
9375 player.PhysicalPredictiveDropItem(this);
9376 else
9377 player.ServerDropEntity(this);
9378 return;
9379 }
9380
9382 {
9384
9385 if (new_item)
9386 {
9387 new_item.SetResultOfSplit(true);
9388 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9391 new_item.PlaceOnSurface();
9392 }
9393 }
9394 }
9395 }
9396 }
9397
9399 {
9400 float split_quantity_new;
9404 InventoryLocation loc = new InventoryLocation;
9405
9406 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9407 {
9409 split_quantity_new = stack_max;
9410 else
9412
9414 {
9415 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9416 if (new_item)
9417 {
9418 new_item.SetResultOfSplit(true);
9419 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9421 new_item.
SetQuantity(split_quantity_new,
false,
true);
9422 }
9423 }
9424 }
9425 else if (destination_entity && slot_id == -1)
9426 {
9427 if (quantity > stack_max)
9428 split_quantity_new = stack_max;
9429 else
9430 split_quantity_new = quantity;
9431
9433 {
9434 GameInventory destinationInventory = destination_entity.GetInventory();
9436 {
9439 }
9440
9441 if (new_item)
9442 {
9443 new_item.SetResultOfSplit(true);
9444 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9446 new_item.
SetQuantity(split_quantity_new,
false,
true);
9447 }
9448 }
9449 }
9450 else
9451 {
9452 if (stack_max != 0)
9453 {
9455 {
9457 }
9458
9460 {
9462
9463 if (new_item)
9464 {
9465 new_item.SetResultOfSplit(true);
9466 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9469 new_item.PlaceOnSurface();
9470 }
9471 }
9472 }
9473 }
9474 }
9475
9477 {
9479 {
9480 if (ScriptInputUserData.CanStoreInputUserData())
9481 {
9482 ScriptInputUserData ctx = new ScriptInputUserData;
9487 dst.WriteToContext(ctx);
9489 }
9490 }
9491 else if (!
g_Game.IsMultiplayer())
9492 {
9494 }
9495 }
9496
9498 {
9500 {
9501 if (ScriptInputUserData.CanStoreInputUserData())
9502 {
9503 ScriptInputUserData ctx = new ScriptInputUserData;
9508 ctx.
Write(destination_entity);
9514 }
9515 }
9516 else if (!
g_Game.IsMultiplayer())
9517 {
9519 }
9520 }
9521
9523 {
9525 }
9526
9528 {
9530 float split_quantity_new;
9532 if (dst.IsValid())
9533 {
9534 int slot_id = dst.GetSlot();
9536
9537 if (quantity > stack_max)
9538 split_quantity_new = stack_max;
9539 else
9540 split_quantity_new = quantity;
9541
9543 {
9545
9546 if (new_item)
9547 {
9548 new_item.SetResultOfSplit(true);
9549 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9551 new_item.
SetQuantity(split_quantity_new,
false,
true);
9552 }
9553
9554 return new_item;
9555 }
9556 }
9557
9558 return null;
9559 }
9560
9562 {
9564 float split_quantity_new;
9566 if (destination_entity)
9567 {
9569 if (quantity > stackable)
9570 split_quantity_new = stackable;
9571 else
9572 split_quantity_new = quantity;
9573
9575 {
9576 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9577 if (new_item)
9578 {
9579 new_item.SetResultOfSplit(true);
9580 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9582 new_item.
SetQuantity(split_quantity_new,
false,
true);
9583 }
9584 }
9585 }
9586 }
9587
9589 {
9591 {
9592 if (ScriptInputUserData.CanStoreInputUserData())
9593 {
9594 ScriptInputUserData ctx = new ScriptInputUserData;
9599 ItemBase destination_entity =
this;
9600 ctx.
Write(destination_entity);
9604 }
9605 }
9606 else if (!
g_Game.IsMultiplayer())
9607 {
9609 }
9610 }
9611
9613 {
9615 float split_quantity_new;
9617 if (player)
9618 {
9620 if (quantity > stackable)
9621 split_quantity_new = stackable;
9622 else
9623 split_quantity_new = quantity;
9624
9626 {
9627 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9628 new_item =
ItemBase.Cast(in_hands);
9629 if (new_item)
9630 {
9631 new_item.SetResultOfSplit(true);
9632 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9634 new_item.SetQuantity(split_quantity_new, false, true);
9635 }
9636 }
9637 }
9638 }
9639
9641 {
9643 float split_quantity_new = Math.Floor(quantity * 0.5);
9644
9646 return;
9647
9649
9650 if (new_item)
9651 {
9652 if (new_item.GetQuantityMax() < split_quantity_new)
9653 {
9654 split_quantity_new = new_item.GetQuantityMax();
9655 }
9656
9657 new_item.SetResultOfSplit(true);
9658 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9659
9661 {
9664 }
9665 else
9666 {
9668 new_item.
SetQuantity(split_quantity_new,
false,
true);
9669 }
9670 }
9671 }
9672
9674 {
9676 float split_quantity_new = Math.Floor(quantity / 2);
9677
9679 return;
9680
9681 InventoryLocation invloc = new InventoryLocation;
9683
9685 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9686
9687 if (new_item)
9688 {
9689 if (new_item.GetQuantityMax() < split_quantity_new)
9690 {
9691 split_quantity_new = new_item.GetQuantityMax();
9692 }
9694 {
9697 }
9698 else if (split_quantity_new > 1)
9699 {
9701 new_item.
SetQuantity(split_quantity_new,
false,
true);
9702 }
9703 }
9704 }
9705
9708 {
9709 SetWeightDirty();
9711
9712 if (parent)
9713 parent.OnAttachmentQuantityChangedEx(this, delta);
9714
9716 {
9718 {
9720 }
9722 {
9723 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9725 }
9726 }
9727 }
9728
9731 {
9732
9733 }
9734
9737 {
9739 }
9740
9742 {
9743 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9744
9746 {
9747 if (newLevel == GameConstants.STATE_RUINED)
9748 {
9750 EntityAI parent = GetHierarchyParent();
9751 if (parent && parent.IsFireplace())
9752 {
9753 CargoBase cargo = GetInventory().GetCargo();
9754 if (cargo)
9755 {
9757 {
9759 }
9760 }
9761 }
9762 }
9763
9765 {
9766
9768 return;
9769 }
9770
9771 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9772 {
9774 }
9775 }
9776 }
9777
9778
9780 {
9781 super.OnRightClick();
9782
9784 {
9786 {
9787 if (ScriptInputUserData.CanStoreInputUserData())
9788 {
9789 EntityAI root = GetHierarchyRoot();
9790 Man playerOwner = GetHierarchyRootPlayer();
9791 InventoryLocation dst = new InventoryLocation;
9792
9793
9794 if (!playerOwner && root && root == this)
9795 {
9797 }
9798 else
9799 {
9800
9801 GetInventory().GetCurrentInventoryLocation(dst);
9803 {
9804 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9806 {
9808 }
9809 else
9810 {
9812
9813
9814 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9815 {
9817 }
9818 else
9819 {
9820 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9821 }
9822 }
9823 }
9824 }
9825
9826 ScriptInputUserData ctx = new ScriptInputUserData;
9834 }
9835 }
9836 else if (!
g_Game.IsMultiplayer())
9837 {
9839 }
9840 }
9841 }
9842
9844 {
9845 if (root)
9846 {
9847 vector m4[4];
9848 root.GetTransform(m4);
9849 dst.SetGround(this, m4);
9850 }
9851 else
9852 {
9853 GetInventory().GetCurrentInventoryLocation(dst);
9854 }
9855 }
9856
9857 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9858 {
9859
9860 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9861 return false;
9862
9863 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9864 return false;
9865
9866
9868 return false;
9869
9870
9871 Magazine mag = Magazine.Cast(this);
9872 if (mag)
9873 {
9874 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9875 return false;
9876
9877 if (stack_max_limit)
9878 {
9879 Magazine other_mag = Magazine.Cast(other_item);
9880 if (other_item)
9881 {
9882 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9883 return false;
9884 }
9885
9886 }
9887 }
9888 else
9889 {
9890
9892 return false;
9893
9895 return false;
9896 }
9897
9898 PlayerBase player = null;
9899 if (CastTo(player, GetHierarchyRootPlayer()))
9900 {
9901 if (player.GetInventory().HasAttachment(this))
9902 return false;
9903
9904 if (player.IsItemsToDelete())
9905 return false;
9906 }
9907
9908 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9909 return false;
9910
9911 int slotID;
9913 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9914 return false;
9915
9916 return true;
9917 }
9918
9920 {
9922 }
9923
9925 {
9926 return m_IsResultOfSplit;
9927 }
9928
9930 {
9931 m_IsResultOfSplit = value;
9932 }
9933
9935 {
9937 }
9938
9940 {
9941 float other_item_quantity = other_item.GetQuantity();
9942 float this_free_space;
9943
9945
9947
9948 if (other_item_quantity > this_free_space)
9949 {
9950 return this_free_space;
9951 }
9952 else
9953 {
9954 return other_item_quantity;
9955 }
9956 }
9957
9959 {
9961 }
9962
9964 {
9966 return;
9967
9968 if (!IsMagazine() && other_item)
9969 {
9971 if (quantity_used != 0)
9972 {
9973 float hp1 = GetHealth01("","");
9974 float hp2 = other_item.GetHealth01("","");
9975 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9976 hpResult = hpResult / (
GetQuantity() + quantity_used);
9977
9978 hpResult *= GetMaxHealth();
9979 Math.Round(hpResult);
9980 SetHealth("", "Health", hpResult);
9981
9983 other_item.AddQuantity(-quantity_used);
9984 }
9985 }
9987 }
9988
9990 {
9991 #ifdef SERVER
9992 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9993 GetHierarchyParent().IncreaseLifetimeUp();
9994 #endif
9995 };
9996
9998 {
9999 PlayerBase p = PlayerBase.Cast(player);
10000
10001 array<int> recipesIds = p.m_Recipes;
10002 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10003 if (moduleRecipesManager)
10004 {
10005 EntityAI itemInHands = player.GetEntityInHands();
10006 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10007 }
10008
10009 for (int i = 0;i < recipesIds.Count(); i++)
10010 {
10011 int key = recipesIds.Get(i);
10012 string recipeName = moduleRecipesManager.GetRecipeName(key);
10014 }
10015 }
10016
10017
10018 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10019 {
10020 super.GetDebugActions(outputList);
10021
10022
10028
10029
10034
10039
10040
10044
10045
10047 {
10051 }
10052
10055
10056
10060
10062
10063 InventoryLocation loc = new InventoryLocation();
10064 GetInventory().GetCurrentInventoryLocation(loc);
10066 {
10067 if (Gizmo_IsSupported())
10070 }
10071
10073 }
10074
10075
10076
10077
10079 {
10080 super.OnAction(action_id, player, ctx);
10081
10083 {
10084 switch (action_id)
10085 {
10089 return true;
10093 return true;
10094 }
10095 }
10096
10098 {
10099 switch (action_id)
10100 {
10102 Delete();
10103 return true;
10104 }
10105 }
10106
10107 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10108 {
10109 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10110 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10111 PlayerBase p = PlayerBase.Cast(player);
10112 if (
EActions.RECIPES_RANGE_START < 1000)
10113 {
10114 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10115 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10116 }
10117 }
10118 #ifndef SERVER
10119 else if (action_id ==
EActions.WATCH_PLAYER)
10120 {
10121 PluginDeveloper.SetDeveloperItemClientEx(player);
10122 }
10123 #endif
10125 {
10126 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10127 {
10128 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10129 OnDebugButtonPressServer(id + 1);
10130 }
10131
10132 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10133 {
10134 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10136 }
10137
10138 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10139 {
10140 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10142 }
10143
10144 else if (action_id ==
EActions.ADD_QUANTITY)
10145 {
10146 if (IsMagazine())
10147 {
10148 Magazine mag = Magazine.Cast(this);
10149 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10150 }
10151 else
10152 {
10154 }
10155
10156 if (m_EM)
10157 {
10158 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10159 }
10160
10161 }
10162
10163 else if (action_id ==
EActions.REMOVE_QUANTITY)
10164 {
10165 if (IsMagazine())
10166 {
10167 Magazine mag2 = Magazine.Cast(this);
10168 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10169 }
10170 else
10171 {
10173 }
10174 if (m_EM)
10175 {
10176 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10177 }
10178
10179 }
10180
10181 else if (action_id ==
EActions.SET_QUANTITY_0)
10182 {
10184
10185 if (m_EM)
10186 {
10187 m_EM.SetEnergy(0);
10188 }
10189 }
10190
10191 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10192 {
10194
10195 if (m_EM)
10196 {
10197 m_EM.SetEnergy(m_EM.GetEnergyMax());
10198 }
10199 }
10200
10201 else if (action_id ==
EActions.ADD_HEALTH)
10202 {
10203 AddHealth("","",GetMaxHealth("","Health")/5);
10204 }
10205 else if (action_id ==
EActions.REMOVE_HEALTH)
10206 {
10207 AddHealth("","",-GetMaxHealth("","Health")/5);
10208 }
10209 else if (action_id ==
EActions.DESTROY_HEALTH)
10210 {
10211 SetHealth01("","",0);
10212 }
10213 else if (action_id ==
EActions.WATCH_ITEM)
10214 {
10216 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10217 #ifdef DEVELOPER
10218 SetDebugDeveloper_item(this);
10219 #endif
10220 }
10221
10222 else if (action_id ==
EActions.ADD_TEMPERATURE)
10223 {
10224 AddTemperature(20);
10225
10226 }
10227
10228 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10229 {
10230 AddTemperature(-20);
10231
10232 }
10233
10234 else if (action_id ==
EActions.FLIP_FROZEN)
10235 {
10236 SetFrozen(!GetIsFrozen());
10237
10238 }
10239
10240 else if (action_id ==
EActions.ADD_WETNESS)
10241 {
10243
10244 }
10245
10246 else if (action_id ==
EActions.REMOVE_WETNESS)
10247 {
10249
10250 }
10251
10252 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10253 {
10256
10257
10258 }
10259
10260 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10261 {
10264 }
10265
10266 else if (action_id ==
EActions.MAKE_SPECIAL)
10267 {
10268 auto debugParams = DebugSpawnParams.WithPlayer(player);
10269 OnDebugSpawnEx(debugParams);
10270 }
10271
10272 }
10273
10274
10275 return false;
10276 }
10277
10278
10279
10280
10284
10287
10288
10289
10291 {
10292 return false;
10293 }
10294
10295
10297 {
10298 return true;
10299 }
10300
10301
10303 {
10304 return true;
10305 }
10306
10307
10308
10310 {
10311 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10312 return g_Game.ConfigIsExisting(config_path);
10313 }
10314
10317 {
10318 return null;
10319 }
10320
10322 {
10323 return false;
10324 }
10325
10327 {
10328 return false;
10329 }
10330
10334
10335
10337 {
10338 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10339 return module_repairing.CanRepair(this, item_repair_kit);
10340 }
10341
10342
10343 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10344 {
10345 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10346 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10347 }
10348
10349
10351 {
10352
10353
10354
10355
10356
10357
10358
10359
10360 return 1;
10361 }
10362
10363
10364
10366 {
10368 }
10369
10370
10371
10373 {
10375 }
10376
10377
10386 {
10387 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10388
10389 if (player)
10390 {
10391 player.MessageStatus(text);
10392 }
10393 }
10394
10395
10404 {
10405 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10406
10407 if (player)
10408 {
10409 player.MessageAction(text);
10410 }
10411 }
10412
10413
10422 {
10423 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10424
10425 if (player)
10426 {
10427 player.MessageFriendly(text);
10428 }
10429 }
10430
10431
10440 {
10441 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10442
10443 if (player)
10444 {
10445 player.MessageImportant(text);
10446 }
10447 }
10448
10450 {
10451 return true;
10452 }
10453
10454
10455 override bool KindOf(
string tag)
10456 {
10457 bool found = false;
10458 string item_name = this.
GetType();
10460 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10461
10462 int array_size = item_tag_array.Count();
10463 for (int i = 0; i < array_size; i++)
10464 {
10465 if (item_tag_array.Get(i) == tag)
10466 {
10467 found = true;
10468 break;
10469 }
10470 }
10471 return found;
10472 }
10473
10474
10476 {
10477
10478 super.OnRPC(sender, rpc_type,ctx);
10479
10480
10481 switch (rpc_type)
10482 {
10483 #ifndef SERVER
10484 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10485 Param2<bool, string> p = new Param2<bool, string>(false, "");
10486
10488 return;
10489
10490 bool play = p.param1;
10491 string soundSet = p.param2;
10492
10493 if (play)
10494 {
10496 {
10498 {
10500 }
10501 }
10502 else
10503 {
10505 }
10506 }
10507 else
10508 {
10510 }
10511
10512 break;
10513 #endif
10514
10515 }
10516
10518 {
10520 }
10521 }
10522
10523
10524
10525
10527 {
10528 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10529 return plugin.GetID(
name);
10530 }
10531
10533 {
10534 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10535 return plugin.GetName(id);
10536 }
10537
10540 {
10541
10542
10543 int varFlags;
10544 if (!ctx.
Read(varFlags))
10545 return;
10546
10547 if (varFlags & ItemVariableFlags.FLOAT)
10548 {
10550 }
10551 }
10552
10554 {
10555
10556 super.SerializeNumericalVars(floats_out);
10557
10558
10559
10561 {
10563 }
10564
10566 {
10568 }
10569
10571 {
10573 }
10574
10576 {
10581 }
10582
10584 {
10586 }
10587 }
10588
10590 {
10591
10592 super.DeSerializeNumericalVars(floats);
10593
10594
10595 int index = 0;
10596 int mask = Math.Round(floats.Get(index));
10597
10598 index++;
10599
10601 {
10603 {
10605 }
10606 else
10607 {
10608 float quantity = floats.Get(index);
10609 SetQuantity(quantity,
true,
false,
false,
false);
10610 }
10611 index++;
10612 }
10613
10615 {
10616 float wet = floats.Get(index);
10618 index++;
10619 }
10620
10622 {
10623 int liquidtype = Math.Round(floats.Get(index));
10625 index++;
10626 }
10627
10629 {
10631 index++;
10633 index++;
10635 index++;
10637 index++;
10638 }
10639
10641 {
10642 int cleanness = Math.Round(floats.Get(index));
10644 index++;
10645 }
10646 }
10647
10649 {
10650 super.WriteVarsToCTX(ctx);
10651
10652
10654 {
10656 }
10657
10659 {
10661 }
10662
10664 {
10666 }
10667
10669 {
10670 int r,g,b,a;
10676 }
10677
10679 {
10681 }
10682 }
10683
10685 {
10686 if (!super.ReadVarsFromCTX(ctx,version))
10687 return false;
10688
10689 int intValue;
10690 float value;
10691
10692 if (version < 140)
10693 {
10694 if (!ctx.
Read(intValue))
10695 return false;
10696
10697 m_VariablesMask = intValue;
10698 }
10699
10701 {
10702 if (!ctx.
Read(value))
10703 return false;
10704
10706 {
10708 }
10709 else
10710 {
10712 }
10713 }
10714
10715 if (version < 140)
10716 {
10718 {
10719 if (!ctx.
Read(value))
10720 return false;
10721 SetTemperatureDirect(value);
10722 }
10723 }
10724
10726 {
10727 if (!ctx.
Read(value))
10728 return false;
10730 }
10731
10733 {
10734 if (!ctx.
Read(intValue))
10735 return false;
10737 }
10738
10740 {
10741 int r,g,b,a;
10743 return false;
10745 return false;
10747 return false;
10749 return false;
10750
10752 }
10753
10755 {
10756 if (!ctx.
Read(intValue))
10757 return false;
10759 }
10760
10761 if (version >= 138 && version < 140)
10762 {
10764 {
10765 if (!ctx.
Read(intValue))
10766 return false;
10767 SetFrozen(intValue);
10768 }
10769 }
10770
10771 return true;
10772 }
10773
10774
10776 {
10779 {
10781 }
10782
10783 if (!super.OnStoreLoad(ctx, version))
10784 {
10786 return false;
10787 }
10788
10789 if (version >= 114)
10790 {
10791 bool hasQuickBarIndexSaved;
10792
10793 if (!ctx.
Read(hasQuickBarIndexSaved))
10794 {
10796 return false;
10797 }
10798
10799 if (hasQuickBarIndexSaved)
10800 {
10801 int itmQBIndex;
10802
10803
10804 if (!ctx.
Read(itmQBIndex))
10805 {
10807 return false;
10808 }
10809
10810 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10811 if (itmQBIndex != -1 && parentPlayer)
10812 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10813 }
10814 }
10815 else
10816 {
10817
10818 PlayerBase player;
10819 int itemQBIndex;
10820 if (version ==
int.
MAX)
10821 {
10822 if (!ctx.
Read(itemQBIndex))
10823 {
10825 return false;
10826 }
10827 }
10828 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10829 {
10830
10831 if (!ctx.
Read(itemQBIndex))
10832 {
10834 return false;
10835 }
10836 if (itemQBIndex != -1 && player)
10837 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10838 }
10839 }
10840
10841 if (version < 140)
10842 {
10843
10844 if (!LoadVariables(ctx, version))
10845 {
10847 return false;
10848 }
10849 }
10850
10851
10853 {
10855 return false;
10856 }
10857 if (version >= 132)
10858 {
10860 if (raib)
10861 {
10863 {
10865 return false;
10866 }
10867 }
10868 }
10869
10871 return true;
10872 }
10873
10874
10875
10877 {
10878 super.OnStoreSave(ctx);
10879
10880 PlayerBase player;
10881 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10882 {
10884
10885 int itemQBIndex = -1;
10886 itemQBIndex = player.FindQuickBarEntityIndex(this);
10887 ctx.
Write(itemQBIndex);
10888 }
10889 else
10890 {
10892 }
10893
10895
10897 if (raib)
10898 {
10900 }
10901 }
10902
10903
10905 {
10906 super.AfterStoreLoad();
10907
10909 {
10911 }
10912
10914 {
10917 }
10918 }
10919
10921 {
10922 super.EEOnAfterLoad();
10923
10925 {
10927 }
10928
10931 }
10932
10934 {
10935 return false;
10936 }
10937
10938
10939
10941 {
10943 {
10944 #ifdef PLATFORM_CONSOLE
10945
10947 {
10949 if (menu)
10950 {
10952 }
10953 }
10954 #endif
10955 }
10956
10958 {
10961 }
10962
10964 {
10965 SetWeightDirty();
10967 }
10969 {
10972 }
10973
10975 {
10978
10981 }
10983 {
10987 }
10988
10989 super.OnVariablesSynchronized();
10990 }
10991
10992
10993
10995 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10996 {
10997 if (!IsServerCheck(allow_client))
10998 return false;
10999
11001 return false;
11002
11005
11006 if (value <= (min + 0.001))
11007 value = min;
11008
11009 if (value == min)
11010 {
11011 if (destroy_config)
11012 {
11013 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11014 if (dstr)
11015 {
11017 this.Delete();
11018 return true;
11019 }
11020 }
11021 else if (destroy_forced)
11022 {
11024 this.Delete();
11025 return true;
11026 }
11027
11029 }
11030
11033
11035 {
11036 EntityAI parent = GetHierarchyRoot();
11037 InventoryLocation iLoc = new InventoryLocation();
11038 GetInventory().GetCurrentInventoryLocation(iLoc);
11040 {
11041 int iLocSlot = iLoc.
GetSlot();
11043 {
11045 }
11047 {
11049 }
11050 }
11051 }
11052
11054 {
11056
11057 if (delta)
11059 }
11060
11062
11063 return false;
11064 }
11065
11066
11068 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11069 {
11071 }
11072
11074 {
11077 }
11078
11080 {
11083 }
11084
11086 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11087 {
11088 float value_clamped = Math.Clamp(value, 0, 1);
11090 SetQuantity(result, destroy_config, destroy_forced);
11091 }
11092
11093
11096 {
11098 }
11099
11101 {
11103 }
11104
11105
11106
11107
11108
11109
11110
11111
11112
11113
11115 {
11116 int slot = -1;
11117 GameInventory inventory = GetInventory();
11118 if (inventory)
11119 {
11120 InventoryLocation il = new InventoryLocation;
11123 }
11124
11126 }
11127
11129 {
11130 float quantity_max = 0;
11131
11133 {
11134 if (attSlotID != -1)
11135 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11136
11137 if (quantity_max <= 0)
11139 }
11140
11141 if (quantity_max <= 0)
11143
11144 return quantity_max;
11145 }
11146
11148 {
11150 }
11151
11153 {
11155 }
11156
11157
11159 {
11161 }
11162
11164 {
11166 }
11167
11169 {
11171 }
11172
11173
11175 {
11176
11177 float weightEx = GetWeightEx();
11178 float special = GetInventoryAndCargoWeight();
11179 return weightEx - special;
11180 }
11181
11182
11184 {
11186 }
11187
11189 {
11191 {
11192 #ifdef DEVELOPER
11193 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11194 {
11195 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11197 }
11198 #endif
11199
11200 return GetQuantity() * GetConfigWeightModified();
11201 }
11202 else if (HasEnergyManager())
11203 {
11204 #ifdef DEVELOPER
11205 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11206 {
11207 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11208 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11209 }
11210 #endif
11211 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11212 }
11213 else
11214 {
11215 #ifdef DEVELOPER
11216 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11217 {
11218 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11219 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11220 }
11221 #endif
11222 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11223 }
11224 }
11225
11228 {
11229 int item_count = 0;
11231
11232 GameInventory inventory = GetInventory();
11233 CargoBase cargo = inventory.
GetCargo();
11234 if (cargo != NULL)
11235 {
11237 }
11238
11240 for (int i = 0; i < nAttachments; ++i)
11241 {
11243 if (item)
11244 item_count += item.GetNumberOfItems();
11245 }
11246 return item_count;
11247 }
11248
11251 {
11252 float weight = 0;
11253 float wetness = 1;
11254 if (include_wetness)
11257 {
11258 weight = wetness * m_ConfigWeight;
11259 }
11261 {
11262 weight = 1;
11263 }
11264 return weight;
11265 }
11266
11267
11268
11270 {
11271 GameInventory inventory = GetInventory();
11272 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11273 {
11274 array<EntityAI> items = new array<EntityAI>;
11276 for (int i = 0; i < items.Count(); ++i)
11277 {
11279 if (item)
11280 {
11281 g_Game.ObjectDelete(item);
11282 }
11283 }
11284 }
11285 }
11286
11287
11288
11289
11291 {
11292 float energy = 0;
11293 if (HasEnergyManager())
11294 {
11295 energy = GetCompEM().GetEnergy();
11296 }
11297 return energy;
11298 }
11299
11300
11302 {
11303 super.OnEnergyConsumed();
11304
11306 }
11307
11309 {
11310 super.OnEnergyAdded();
11311
11313 }
11314
11315
11317 {
11318 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11319 {
11321 {
11322 float energy_0to1 = GetCompEM().GetEnergy0To1();
11324 }
11325 }
11326 }
11327
11328
11330 {
11331 return ConfigGetFloat("heatIsolation");
11332 }
11333
11335 {
11337 }
11338
11340 {
11341 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11342 if (
g_Game.ConfigIsExisting(paramPath))
11343 return g_Game.ConfigGetFloat(paramPath);
11344
11345 return 0.0;
11346 }
11347
11349 {
11350 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11351 if (
g_Game.ConfigIsExisting(paramPath))
11352 return g_Game.ConfigGetFloat(paramPath);
11353
11354 return 0.0;
11355 }
11356
11357 override void SetWet(
float value,
bool allow_client =
false)
11358 {
11359 if (!IsServerCheck(allow_client))
11360 return;
11361
11364
11366
11367 m_VarWet = Math.Clamp(value, min, max);
11368
11370 {
11373 }
11374 }
11375
11376 override void AddWet(
float value)
11377 {
11379 }
11380
11382 {
11384 }
11385
11387 {
11389 }
11390
11392 {
11394 }
11395
11397 {
11399 }
11400
11402 {
11404 }
11405
11406 override void OnWetChanged(
float newVal,
float oldVal)
11407 {
11410 if (newLevel != oldLevel)
11411 {
11413 }
11414 }
11415
11417 {
11418 SetWeightDirty();
11419 }
11420
11422 {
11423 return GetWetLevelInternal(
m_VarWet);
11424 }
11425
11426
11427
11429 {
11431 }
11432
11434 {
11436 }
11437
11439 {
11441 }
11442
11444 {
11446 }
11447
11448
11449
11451 {
11452 if (ConfigIsExisting("itemModelLength"))
11453 {
11454 return ConfigGetFloat("itemModelLength");
11455 }
11456 return 0;
11457 }
11458
11460 {
11461 if (ConfigIsExisting("itemAttachOffset"))
11462 {
11463 return ConfigGetFloat("itemAttachOffset");
11464 }
11465 return 0;
11466 }
11467
11468 override void SetCleanness(
int value,
bool allow_client =
false)
11469 {
11470 if (!IsServerCheck(allow_client))
11471 return;
11472
11474
11476
11479 }
11480
11482 {
11484 }
11485
11487 {
11488 return true;
11489 }
11490
11491
11492
11493
11495 {
11497 }
11498
11500 {
11502 }
11503
11504
11505
11506
11507 override void SetColor(
int r,
int g,
int b,
int a)
11508 {
11514 }
11516 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11517 {
11522 }
11523
11525 {
11527 }
11528
11531 {
11532 int r,g,b,a;
11534 r = r/255;
11535 g = g/255;
11536 b = b/255;
11537 a = a/255;
11538 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11539 }
11540
11541
11542
11543 override void SetLiquidType(
int value,
bool allow_client =
false)
11544 {
11545 if (!IsServerCheck(allow_client))
11546 return;
11547
11552 }
11553
11555 {
11556 return ConfigGetInt("varLiquidTypeInit");
11557 }
11558
11560 {
11562 }
11563
11565 {
11567 SetFrozen(false);
11568 }
11569
11572 {
11573 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11574 }
11575
11576
11579 {
11580 PlayerBase nplayer;
11581 if (PlayerBase.CastTo(nplayer, player))
11582 {
11584 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11585 }
11586 }
11587
11588
11591 {
11592 PlayerBase nplayer;
11593 if (PlayerBase.CastTo(nplayer,player))
11594 {
11595 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11596 }
11597
11598 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11599
11600 if (HasEnergyManager())
11601 {
11602 GetCompEM().UpdatePlugState();
11603 }
11604 }
11605
11606
11608 {
11609 super.OnPlacementStarted(player);
11610
11612 }
11613
11614 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11615 {
11617 {
11618 m_AdminLog.OnPlacementComplete(player,
this);
11619 }
11620
11621 super.OnPlacementComplete(player, position, orientation);
11622 }
11623
11624
11625
11626
11627
11629 {
11631 {
11632 return true;
11633 }
11634 else
11635 {
11636 return false;
11637 }
11638 }
11639
11640
11642 {
11644 {
11646 }
11647 }
11648
11649
11651 {
11653 }
11654
11656 {
11658 }
11659
11660 override void InsertAgent(
int agent,
float count = 1)
11661 {
11662 if (count < 1)
11663 return;
11664
11666 }
11667
11670 {
11672 }
11673
11674
11676 {
11678 }
11679
11680
11681
11682
11683
11684
11685
11686
11687
11688
11689
11690
11691
11692
11693
11694
11695
11696
11697
11698
11699
11700
11701
11702
11703
11704
11705
11706
11707
11708
11709
11710
11711
11712
11713
11714
11715
11716
11717
11718
11719
11720
11722 {
11724 return false;
11725 return true;
11726 }
11727
11729 {
11730
11732 }
11733
11734
11737 {
11738 super.CheckForRoofLimited(timeTresholdMS);
11739
11740 float time =
g_Game.GetTime();
11741 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11742 {
11743 m_PreviousRoofTestTime = time;
11744 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11745 }
11746 }
11747
11748
11750 {
11752 {
11753 return 0;
11754 }
11755
11756 if (GetInventory().GetAttachmentSlotsCount() != 0)
11757 {
11758 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11759 if (filter)
11760 return filter.GetProtectionLevel(type, false, system);
11761 else
11762 return 0;
11763 }
11764
11765 string subclassPath, entryName;
11766
11767 switch (type)
11768 {
11770 entryName = "biological";
11771 break;
11773 entryName = "chemical";
11774 break;
11775 default:
11776 entryName = "biological";
11777 break;
11778 }
11779
11780 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11781
11782 return g_Game.ConfigGetFloat(subclassPath + entryName);
11783 }
11784
11785
11786
11789 {
11790 if (!IsMagazine())
11792
11794 }
11795
11796
11797
11798
11799
11804 {
11805 return true;
11806 }
11807
11809 {
11811 }
11812
11813
11814
11815
11816
11818 {
11819 if (parent)
11820 {
11821 if (parent.IsInherited(DayZInfected))
11822 return true;
11823
11824 if (!parent.IsRuined())
11825 return true;
11826 }
11827
11828 return true;
11829 }
11830
11832 {
11833 if (!super.CanPutAsAttachment(parent))
11834 {
11835 return false;
11836 }
11837
11838 if (!IsRuined() && !parent.IsRuined())
11839 {
11840 return true;
11841 }
11842
11843 return false;
11844 }
11845
11847 {
11848
11849
11850
11851
11852 return super.CanReceiveItemIntoCargo(item);
11853 }
11854
11856 {
11857
11858
11859
11860
11861 GameInventory attachmentInv = attachment.GetInventory();
11863 {
11864 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11865 return false;
11866 }
11867
11868 InventoryLocation loc = new InventoryLocation();
11869 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11870 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11871 return false;
11872
11873 return super.CanReceiveAttachment(attachment, slotId);
11874 }
11875
11877 {
11878 if (!super.CanReleaseAttachment(attachment))
11879 return false;
11880
11881 return GetInventory().AreChildrenAccessible();
11882 }
11883
11884
11885
11886
11887
11888
11889
11890
11891
11892
11893
11894
11895
11896
11897
11898
11899
11900
11901
11902
11903
11905 {
11906 int id = muzzle_owner.GetMuzzleID();
11907 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11908
11909 if (WPOF_array)
11910 {
11911 for (int i = 0; i < WPOF_array.Count(); i++)
11912 {
11913 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11914
11915 if (WPOF)
11916 {
11917 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11918 }
11919 }
11920 }
11921 }
11922
11923
11925 {
11926 int id = muzzle_owner.GetMuzzleID();
11928
11929 if (WPOBE_array)
11930 {
11931 for (int i = 0; i < WPOBE_array.Count(); i++)
11932 {
11933 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11934
11935 if (WPOBE)
11936 {
11937 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11938 }
11939 }
11940 }
11941 }
11942
11943
11945 {
11946 int id = muzzle_owner.GetMuzzleID();
11947 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11948
11949 if (WPOOH_array)
11950 {
11951 for (int i = 0; i < WPOOH_array.Count(); i++)
11952 {
11953 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11954
11955 if (WPOOH)
11956 {
11957 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11958 }
11959 }
11960 }
11961 }
11962
11963
11965 {
11966 int id = muzzle_owner.GetMuzzleID();
11967 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11968
11969 if (WPOOH_array)
11970 {
11971 for (int i = 0; i < WPOOH_array.Count(); i++)
11972 {
11973 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11974
11975 if (WPOOH)
11976 {
11977 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11978 }
11979 }
11980 }
11981 }
11982
11983
11985 {
11986 int id = muzzle_owner.GetMuzzleID();
11987 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11988
11989 if (WPOOH_array)
11990 {
11991 for (int i = 0; i < WPOOH_array.Count(); i++)
11992 {
11993 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11994
11995 if (WPOOH)
11996 {
11997 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11998 }
11999 }
12000 }
12001 }
12002
12003
12004
12006 {
12008 {
12009 return true;
12010 }
12011
12012 return false;
12013 }
12014
12016 {
12018 {
12019 return true;
12020 }
12021
12022 return false;
12023 }
12024
12026 {
12028 {
12029 return true;
12030 }
12031
12032 return false;
12033 }
12034
12036 {
12037 return false;
12038 }
12039
12042 {
12043 return UATimeSpent.DEFAULT_DEPLOY;
12044 }
12045
12046
12047
12048
12050 {
12052 SetSynchDirty();
12053 }
12054
12056 {
12058 }
12059
12060
12062 {
12063 return false;
12064 }
12065
12068 {
12069 string att_type = "None";
12070
12071 if (ConfigIsExisting("soundAttType"))
12072 {
12073 att_type = ConfigGetString("soundAttType");
12074 }
12075
12077 }
12078
12080 {
12082 }
12083
12084
12085
12086
12087
12093
12095 {
12098
12100 }
12101
12102
12104 {
12106 return;
12107
12109
12112
12115
12116 SoundParameters params = new SoundParameters();
12120 }
12121
12122
12124 {
12126 {
12129
12130 SetSynchDirty();
12131
12134 }
12135 }
12136
12138 {
12140 }
12141
12142
12144 {
12146 return;
12147
12149 SetSynchDirty();
12150
12153 }
12154
12156 {
12159 }
12160
12162 {
12164 }
12165
12166 void OnApply(PlayerBase player);
12167
12169 {
12170 return 1.0;
12171 };
12172
12174 {
12176 }
12177
12179 {
12181 }
12182
12184
12186 {
12187 SetDynamicPhysicsLifeTime(0.01);
12189 }
12190
12192 {
12193 array<string> zone_names = new array<string>;
12194 GetDamageZones(zone_names);
12195 for (int i = 0; i < zone_names.Count(); i++)
12196 {
12197 SetHealthMax(zone_names.Get(i),"Health");
12198 }
12199 SetHealthMax("","Health");
12200 }
12201
12204 {
12205 float global_health = GetHealth01("","Health");
12206 array<string> zones = new array<string>;
12207 GetDamageZones(zones);
12208
12209 for (int i = 0; i < zones.Count(); i++)
12210 {
12211 SetHealth01(zones.Get(i),"Health",global_health);
12212 }
12213 }
12214
12217 {
12218 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12219 }
12220
12222 {
12223 if (!hasRootAsPlayer)
12224 {
12225 if (refParentIB)
12226 {
12227
12228 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12229 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12230
12231 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12232 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12233
12236 }
12237 else
12238 {
12239
12242 }
12243 }
12244 }
12245
12247 {
12249 {
12250 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12251 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12252 {
12253 float heatPermCoef = 1.0;
12255 while (ent)
12256 {
12257 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12258 ent = ent.GetHierarchyParent();
12259 }
12260
12261 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12262 }
12263 }
12264 }
12265
12267 {
12268
12269 EntityAI parent = GetHierarchyParent();
12270 if (!parent)
12271 {
12272 hasParent = false;
12273 hasRootAsPlayer = false;
12274 }
12275 else
12276 {
12277 hasParent = true;
12278 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12279 refParentIB =
ItemBase.Cast(parent);
12280 }
12281 }
12282
12283 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12284 {
12285
12286 }
12287
12289 {
12290
12291 return false;
12292 }
12293
12295 {
12296
12297
12298 return false;
12299 }
12300
12302 {
12303
12304 return false;
12305 }
12306
12309 {
12310 return !GetIsFrozen() &&
IsOpen();
12311 }
12312
12314 {
12315 bool hasParent = false, hasRootAsPlayer = false;
12317
12318 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12319 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12320
12321 if (wwtu || foodDecay)
12322 {
12326
12327 if (processWetness || processTemperature || processDecay)
12328 {
12330
12331 if (processWetness)
12332 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12333
12334 if (processTemperature)
12336
12337 if (processDecay)
12338 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12339 }
12340 }
12341 }
12342
12345 {
12347 }
12348
12350 {
12353
12354 return super.GetTemperatureFreezeThreshold();
12355 }
12356
12358 {
12361
12362 return super.GetTemperatureThawThreshold();
12363 }
12364
12366 {
12369
12370 return super.GetItemOverheatThreshold();
12371 }
12372
12374 {
12376 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12377
12378 return super.GetTemperatureFreezeTime();
12379 }
12380
12382 {
12384 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12385
12386 return super.GetTemperatureThawTime();
12387 }
12388
12393
12395 {
12396 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12397 }
12398
12400 {
12401 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12402 }
12403
12406 {
12408 }
12409
12411 {
12413 }
12414
12416 {
12418 }
12419
12422 {
12423 return null;
12424 }
12425
12428 {
12429 return false;
12430 }
12431
12433 {
12435 {
12438 if (!trg)
12439 {
12441 explosive = this;
12442 }
12443
12444 explosive.PairRemote(trg);
12446
12447 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12448 trg.SetPersistentPairID(persistentID);
12449 explosive.SetPersistentPairID(persistentID);
12450
12451 return true;
12452 }
12453 return false;
12454 }
12455
12458 {
12459 float ret = 1.0;
12462 ret *= GetHealth01();
12463
12464 return ret;
12465 }
12466
12467 #ifdef DEVELOPER
12468 override void SetDebugItem()
12469 {
12470 super.SetDebugItem();
12471 _itemBase = this;
12472 }
12473
12475 {
12476 string text = super.GetDebugText();
12477
12479 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12480
12481 return text;
12482 }
12483 #endif
12484
12486 {
12487 return true;
12488 }
12489
12491
12493
12495 {
12498 }
12499
12500
12508
12524
12525 [
Obsolete(
"Use ItemSoundHandler instead")]
12528 {
12529 if (!
g_Game.IsDedicatedServer())
12530 {
12531 if (ConfigIsExisting("attachSoundSet"))
12532 {
12533 string cfg_path = "";
12534 string soundset = "";
12535 string type_name =
GetType();
12536
12539 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12540 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12541
12542 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12543 {
12544 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12545 {
12546 if (cfg_slot_array[i] == slot_type)
12547 {
12548 soundset = cfg_soundset_array[i];
12549 break;
12550 }
12551 }
12552 }
12553
12554 if (soundset != "")
12555 {
12556 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12558 }
12559 }
12560 }
12561 }
12562
12564}
12565
12567{
12569 if (entity)
12570 {
12571 bool is_item = entity.IsInherited(
ItemBase);
12572 if (is_item && full_quantity)
12573 {
12576 }
12577 }
12578 else
12579 {
12581 return NULL;
12582 }
12583 return entity;
12584}
12585
12587{
12588 if (item)
12589 {
12590 if (health > 0)
12591 item.SetHealth("", "", health);
12592
12593 if (item.CanHaveTemperature())
12594 {
12596 if (item.CanFreeze())
12597 item.SetFrozen(false);
12598 }
12599
12600 if (item.HasEnergyManager())
12601 {
12602 if (quantity >= 0)
12603 {
12604 item.GetCompEM().SetEnergy0To1(quantity);
12605 }
12606 else
12607 {
12609 }
12610 }
12611 else if (item.IsMagazine())
12612 {
12613 Magazine mag = Magazine.Cast(item);
12614 if (quantity >= 0)
12615 {
12616 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12617 }
12618 else
12619 {
12621 }
12622
12623 }
12624 else
12625 {
12626 if (quantity >= 0)
12627 {
12628 item.SetQuantityNormalized(quantity, false);
12629 }
12630 else
12631 {
12633 }
12634
12635 }
12636 }
12637}
12638
12639#ifdef DEVELOPER
12641#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.