7689{
7691 {
7692 return true;
7693 }
7694};
7695
7697{
7698
7699};
7700
7701
7702
7704{
7708
7710
7713
7714
7715
7716
7717
7726
7732
7737
7742
7763 protected bool m_IsResultOfSplit
7764
7766
7771
7772
7773
7775
7779
7780
7781
7783
7786
7787
7788
7794
7795
7803
7806
7807
7809
7810
7812
7813
7818
7819
7824
7826
7827
7829
7830
7832 {
7837
7838 if (!
g_Game.IsDedicatedServer())
7839 {
7841 {
7843
7845 {
7847 }
7848 }
7849
7852 }
7853
7854 m_OldLocation = null;
7855
7857 {
7859 }
7860
7861 if (ConfigIsExisting("headSelectionsToHide"))
7862 {
7865 }
7866
7868 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7869 {
7871 }
7872
7874
7875 m_IsResultOfSplit = false;
7876
7878 }
7879
7881 {
7882 super.InitItemVariables();
7883
7889 m_Count = ConfigGetInt(
"count");
7890
7893
7898
7901
7906
7918
7922
7923
7926 if (ConfigIsExisting("canBeSplit"))
7927 {
7930 }
7931
7933 if (ConfigIsExisting("itemBehaviour"))
7935
7936
7939 RegisterNetSyncVariableInt("m_VarLiquidType");
7940 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7941
7942 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7943 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7944 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7945
7946 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7947 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7948 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7949 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7950
7951 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7952 RegisterNetSyncVariableBool("m_IsTakeable");
7953 RegisterNetSyncVariableBool("m_IsHologram");
7954
7957 {
7960 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7961 }
7962
7964
7966 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7968
7970 }
7971
7973 {
7975 }
7976
7978 {
7981 {
7986 }
7987 }
7988
7989 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7990 {
7992 {
7995 }
7996
7998 }
7999
8001 {
8007 }
8008
8010
8012 {
8014
8015 if (!action)
8016 {
8017 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8018 return;
8019 }
8020
8022 if (!ai)
8023 {
8025 return;
8026 }
8027
8029 if (!action_array)
8030 {
8031 action_array = new array<ActionBase_Basic>;
8033 }
8034 if (LogManager.IsActionLogEnable())
8035 {
8036 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8037 }
8038
8039 if (action_array.Find(action) != -1)
8040 {
8041 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8042 }
8043 else
8044 {
8045 action_array.Insert(action);
8046 }
8047 }
8048
8050 {
8051 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8052 ActionBase action = player.GetActionManager().GetAction(actionName);
8055
8056 if (action_array)
8057 {
8058 action_array.RemoveItem(action);
8059 }
8060 }
8061
8062
8063
8065 {
8066 ActionOverrideData overrideData = new ActionOverrideData();
8070
8072 if (!actionMap)
8073 {
8076 }
8077
8078 actionMap.Insert(this.
Type(), overrideData);
8079
8080 }
8081
8083
8085
8086
8088 {
8091
8094
8095 string config_to_search = "CfgVehicles";
8096 string muzzle_owner_config;
8097
8099 {
8100 if (IsInherited(Weapon))
8101 config_to_search = "CfgWeapons";
8102
8103 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8104
8105 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8106
8107 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8108
8109 if (config_OnFire_subclass_count > 0)
8110 {
8111 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8112
8113 for (int i = 0; i < config_OnFire_subclass_count; i++)
8114 {
8115 string particle_class = "";
8116 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8117 string config_OnFire_entry = config_OnFire_class + particle_class;
8118 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8119 WPOF_array.Insert(WPOF);
8120 }
8121
8122
8124 }
8125 }
8126
8128 {
8129 config_to_search = "CfgWeapons";
8130 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8131
8132 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8133
8134 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8135
8136 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8137 {
8138 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8139
8140 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8141 {
8142 string particle_class2 = "";
8143 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8144 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8145 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8146 WPOBE_array.Insert(WPOBE);
8147 }
8148
8149
8151 }
8152 }
8153 }
8154
8155
8157 {
8160
8162 {
8163 string config_to_search = "CfgVehicles";
8164
8165 if (IsInherited(Weapon))
8166 config_to_search = "CfgWeapons";
8167
8168 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8169 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8170
8171 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8172 {
8173
8175
8177 {
8179 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8181 return;
8182 }
8183
8186
8187
8188
8189 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8190 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8191
8192 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8193 {
8194 string particle_class = "";
8195 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8196 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8197 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8198
8199 if (entry_type == CT_CLASS)
8200 {
8201 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8202 WPOOH_array.Insert(WPOF);
8203 }
8204 }
8205
8206
8208 }
8209 }
8210 }
8211
8213 {
8215 }
8216
8218 {
8220 {
8222
8225
8228
8229 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8230 }
8231 }
8232
8234 {
8236 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8237
8239 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8240
8242 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8243
8245 {
8247 }
8248 }
8249
8251 {
8253 }
8254
8256 {
8259 else
8261
8263 {
8266 }
8267 else
8268 {
8271
8274 }
8275
8277 }
8278
8280 {
8282 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8283 }
8284
8286 {
8288 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8290 }
8291
8293 {
8295 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8296 }
8297
8299 {
8302
8303 OverheatingParticle OP = new OverheatingParticle();
8308
8310 }
8311
8313 {
8316
8317 return -1;
8318 }
8319
8321 {
8323 {
8326
8327 for (int i = count; i > 0; --i)
8328 {
8329 int id = i - 1;
8332
8335
8336 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8337 {
8338 if (p)
8339 {
8342 }
8343 }
8344 }
8345 }
8346 }
8347
8349 {
8351 {
8353 {
8354 int id = i - 1;
8356
8357 if (OP)
8358 {
8360
8361 if (p)
8362 {
8364 }
8365
8366 delete OP;
8367 }
8368 }
8369
8372 }
8373 }
8374
8377 {
8378 return 0.0;
8379 }
8380
8381
8383 {
8384 return 250;
8385 }
8386
8388 {
8389 return 0;
8390 }
8391
8394 {
8396 return true;
8397
8398 return false;
8399 }
8400
8403 {
8406
8408 {
8410 }
8411 else
8412 {
8413
8415 }
8416
8418 }
8419
8426 {
8427 return -1;
8428 }
8429
8430
8431
8432
8434 {
8436 {
8437 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8438 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8439
8440 if (r_index >= 0)
8441 {
8442 InventoryLocation r_il = new InventoryLocation;
8443 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8444
8445 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8448 {
8449 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8450 }
8452 {
8453 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8454 }
8455
8456 }
8457
8458 player.GetHumanInventory().ClearUserReservedLocation(this);
8459 }
8460
8463 }
8464
8465
8466
8467
8469 {
8470 return ItemBase.m_DebugActionsMask;
8471 }
8472
8474 {
8475 return ItemBase.m_DebugActionsMask & mask;
8476 }
8477
8479 {
8480 ItemBase.m_DebugActionsMask = mask;
8481 }
8482
8484 {
8485 ItemBase.m_DebugActionsMask |= mask;
8486 }
8487
8489 {
8490 ItemBase.m_DebugActionsMask &= ~mask;
8491 }
8492
8494 {
8496 {
8498 }
8499 else
8500 {
8502 }
8503 }
8504
8505
8507 {
8508 if (GetEconomyProfile())
8509 {
8510 float q_max = GetEconomyProfile().GetQuantityMax();
8511 if (q_max > 0)
8512 {
8513 float q_min = GetEconomyProfile().GetQuantityMin();
8514 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8515
8517 {
8518 ComponentEnergyManager comp = GetCompEM();
8520 {
8522 }
8523 }
8525 {
8527
8528 }
8529
8530 }
8531 }
8532 }
8533
8536 {
8537 EntityAI parent = GetHierarchyParent();
8538
8539 if (parent)
8540 {
8541 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8542 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8543 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8544 }
8545 }
8546
8549 {
8550 EntityAI parent = GetHierarchyParent();
8551
8552 if (parent)
8553 {
8554 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8555 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8556 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8557 }
8558 }
8559
8561 {
8562
8563
8564
8565
8567
8569 {
8570 if (ScriptInputUserData.CanStoreInputUserData())
8571 {
8572 ScriptInputUserData ctx = new ScriptInputUserData;
8578 ctx.
Write(use_stack_max);
8581
8583 {
8584 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8585 }
8586 }
8587 }
8588 else if (!
g_Game.IsMultiplayer())
8589 {
8591 }
8592 }
8593
8595 {
8597 }
8598
8600 {
8602 }
8603
8605 {
8607 }
8608
8610 {
8611
8612 return false;
8613 }
8614
8616 {
8617 return false;
8618 }
8619
8623 {
8624 return false;
8625 }
8626
8628 {
8629 return "";
8630 }
8631
8633
8635 {
8636 return false;
8637 }
8638
8640 {
8641 return true;
8642 }
8643
8644
8645
8647 {
8648 return true;
8649 }
8650
8652 {
8653 return true;
8654 }
8655
8657 {
8658 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8660 }
8661
8663 {
8665 }
8666
8668 {
8670 if (!is_being_placed)
8672 SetSynchDirty();
8673 }
8674
8675
8677
8679 {
8681 }
8682
8684 {
8686 }
8687
8689 {
8690 return 1;
8691 }
8692
8694 {
8695 return false;
8696 }
8697
8699 {
8701 SetSynchDirty();
8702 }
8703
8704
8705
8706
8707
8708
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8739 {
8740 super.OnMovedInsideCargo(container);
8741
8742 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8743 }
8744
8745 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8746 {
8747 super.EEItemLocationChanged(oldLoc, newLoc);
8748
8749 PlayerBase newPlayer = null;
8750 PlayerBase oldPlayer = null;
8751
8752 if (newLoc.GetParent())
8753 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8754
8755 if (oldLoc.GetParent())
8756 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8757
8759 {
8760 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8761
8762 if (rIndex >= 0)
8763 {
8764 InventoryLocation rIl = new InventoryLocation;
8765 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8766
8767 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8770 {
8771 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8772 }
8774 {
8776 }
8777
8778 }
8779 }
8780
8782 {
8783 if (newPlayer)
8784 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8785
8786 if (newPlayer == oldPlayer)
8787 {
8788 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8789 {
8791 {
8792 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8793 {
8794 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8795 }
8796 }
8797 else
8798 {
8799 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8800 }
8801 }
8802
8803 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8804 {
8805 int type = oldLoc.GetType();
8807 {
8808 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8809 }
8811 {
8812 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8813 }
8814 }
8815 if (!m_OldLocation)
8816 {
8817 m_OldLocation = new InventoryLocation;
8818 }
8819 m_OldLocation.Copy(oldLoc);
8820 }
8821 else
8822 {
8823 if (m_OldLocation)
8824 {
8825 m_OldLocation.Reset();
8826 }
8827 }
8828
8829 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8830 }
8831 else
8832 {
8833 if (newPlayer)
8834 {
8835 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8836 if (resIndex >= 0)
8837 {
8838 InventoryLocation il = new InventoryLocation;
8839 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8841 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8844 {
8845 il.
GetParent().GetOnReleaseLock().Invoke(it);
8846 }
8848 {
8850 }
8851
8852 }
8853 }
8855 {
8856
8858 }
8859
8860 if (m_OldLocation)
8861 {
8862 m_OldLocation.Reset();
8863 }
8864 }
8865
8867 {
8868 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8869 }
8870
8872 {
8873 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8874 }
8875 }
8876
8877 override void EOnContact(IEntity other, Contact extra)
8878 {
8880 {
8881 int liquidType = -1;
8883 if (impactSpeed > 0.0)
8884 {
8886 #ifndef SERVER
8888 #else
8890 SetSynchDirty();
8891 #endif
8893 }
8894 }
8895
8896 #ifdef SERVER
8897 if (GetCompEM() && GetCompEM().IsPlugged())
8898 {
8899 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8900 GetCompEM().UnplugThis();
8901 }
8902 #endif
8903 }
8904
8906
8908 {
8910 }
8911
8913 {
8914
8915 }
8916
8918 {
8919 super.OnItemLocationChanged(old_owner, new_owner);
8920
8921 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8922 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8923
8924 if (!relatedPlayer && playerNew)
8925 relatedPlayer = playerNew;
8926
8927 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8928 {
8930 if (actionMgr)
8931 {
8932 ActionBase currentAction = actionMgr.GetRunningAction();
8933 if (currentAction)
8935 }
8936 }
8937
8938 Man ownerPlayerOld = null;
8939 Man ownerPlayerNew = null;
8940
8941 if (old_owner)
8942 {
8943 if (old_owner.
IsMan())
8944 {
8945 ownerPlayerOld = Man.Cast(old_owner);
8946 }
8947 else
8948 {
8949 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8950 }
8951 }
8952 else
8953 {
8955 {
8957
8958 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8959 {
8960 GetCompEM().UnplugThis();
8961 }
8962 }
8963 }
8964
8965 if (new_owner)
8966 {
8967 if (new_owner.
IsMan())
8968 {
8969 ownerPlayerNew = Man.Cast(new_owner);
8970 }
8971 else
8972 {
8973 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8974 }
8975 }
8976
8977 if (ownerPlayerOld != ownerPlayerNew)
8978 {
8979 if (ownerPlayerOld)
8980 {
8981 array<EntityAI> subItemsExit = new array<EntityAI>;
8983 for (int i = 0; i < subItemsExit.Count(); i++)
8984 {
8987 }
8988 }
8989
8990 if (ownerPlayerNew)
8991 {
8992 array<EntityAI> subItemsEnter = new array<EntityAI>;
8994 for (int j = 0; j < subItemsEnter.Count(); j++)
8995 {
8998 }
8999 }
9000 }
9001 else if (ownerPlayerNew != null)
9002 {
9003 PlayerBase nplayer;
9004 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9005 {
9006 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9008 for (int k = 0; k < subItemsUpdate.Count(); k++)
9009 {
9011 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9012 }
9013 }
9014 }
9015
9016 if (old_owner)
9017 old_owner.OnChildItemRemoved(this);
9018 if (new_owner)
9019 new_owner.OnChildItemReceived(this);
9020 }
9021
9022
9024 {
9025 super.EEDelete(parent);
9026 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9027 if (player)
9028 {
9030
9031 if (player.IsAlive())
9032 {
9033 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9034 if (r_index >= 0)
9035 {
9036 InventoryLocation r_il = new InventoryLocation;
9037 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9038
9039 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9042 {
9043 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9044 }
9046 {
9047 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9048 }
9049
9050 }
9051
9052 player.RemoveQuickBarEntityShortcut(this);
9053 }
9054 }
9055 }
9056
9058 {
9059 super.EEKilled(killer);
9060
9063 {
9064 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9065 {
9066 if (IsMagazine())
9067 {
9068 if (Magazine.Cast(this).GetAmmoCount() > 0)
9069 {
9071 }
9072 }
9073 else
9074 {
9076 }
9077 }
9078 }
9079 }
9080
9082 {
9083 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9084
9085 super.OnWasAttached(parent, slot_id);
9086
9089
9092 }
9093
9095 {
9096 super.OnWasDetached(parent, slot_id);
9097
9100
9103 }
9104
9106 {
9107 int idx;
9110
9111 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9112 if (inventory_slots.Count() < 1)
9113 {
9114 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9115 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9116 }
9117 else
9118 {
9119 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9120 }
9121
9122 idx = inventory_slots.Find(slot);
9123 if (idx < 0)
9124 return "";
9125
9126 return attach_types.Get(idx);
9127 }
9128
9130 {
9131 int idx = -1;
9132 string slot;
9133
9136
9137 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9138 if (inventory_slots.Count() < 1)
9139 {
9140 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9141 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9142 }
9143 else
9144 {
9145 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9146 if (detach_types.Count() < 1)
9147 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9148 }
9149
9150 for (int i = 0; i < inventory_slots.Count(); i++)
9151 {
9152 slot = inventory_slots.Get(i);
9153 }
9154
9155 if (slot != "")
9156 {
9157 if (detach_types.Count() == 1)
9158 idx = 0;
9159 else
9160 idx = inventory_slots.Find(slot);
9161 }
9162 if (idx < 0)
9163 return "";
9164
9165 return detach_types.Get(idx);
9166 }
9167
9169 {
9170
9172
9173
9174 float min_time = 1;
9175 float max_time = 3;
9176 float delay = Math.RandomFloat(min_time, max_time);
9177
9178 explode_timer.Run(delay, this, "DoAmmoExplosion");
9179 }
9180
9182 {
9183 Magazine magazine = Magazine.Cast(this);
9184 int pop_sounds_count = 6;
9185 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9186
9187
9188 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9189 string sound_name = pop_sounds[ sound_idx ];
9190 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9191
9192
9193 magazine.ServerAddAmmoCount(-1);
9194
9195
9196 float min_temp_to_explode = 100;
9197
9198 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9199 {
9201 }
9202 }
9203
9204
9205 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9206 {
9207 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9208
9209 const int CHANCE_DAMAGE_CARGO = 4;
9210 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9211 const int CHANCE_DAMAGE_NOTHING = 2;
9212
9214 {
9215 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9216 int chances;
9217 int rnd;
9218
9219 if (GetInventory().GetCargo())
9220 {
9221 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9222 rnd = Math.RandomInt(0,chances);
9223
9224 if (rnd < CHANCE_DAMAGE_CARGO)
9225 {
9227 }
9228 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9229 {
9231 }
9232 }
9233 else
9234 {
9235 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9236 rnd = Math.RandomInt(0,chances);
9237
9238 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9239 {
9241 }
9242 }
9243 }
9244 }
9245
9247 {
9248 CargoBase cargo = GetInventory().GetCargo();
9249 if (cargo)
9250 {
9252 if (item_count > 0)
9253 {
9254 int random_pick = Math.RandomInt(0, item_count);
9256 if (!item.IsExplosive())
9257 {
9258 item.AddHealth("","",damage);
9259 return true;
9260 }
9261 }
9262 }
9263 return false;
9264 }
9265
9267 {
9268 GameInventory inventory = GetInventory();
9270 if (attachment_count > 0)
9271 {
9272 int random_pick = Math.RandomInt(0, attachment_count);
9274 if (!attachment.IsExplosive())
9275 {
9276 attachment.AddHealth("","",damage);
9277 return true;
9278 }
9279 }
9280 return false;
9281 }
9282
9284 {
9286 }
9287
9289 {
9291 return GetInventory().CanRemoveEntity();
9292
9293 return false;
9294 }
9295
9297 {
9298
9300 return false;
9301
9302
9304 return false;
9305
9306
9307
9309 if (delta == 0)
9310 return false;
9311
9312
9313 return true;
9314 }
9315
9317 {
9319 {
9320 if (ScriptInputUserData.CanStoreInputUserData())
9321 {
9322 ScriptInputUserData ctx = new ScriptInputUserData;
9327 ctx.
Write(destination_entity);
9331 }
9332 }
9333 else if (!
g_Game.IsMultiplayer())
9334 {
9336 }
9337 }
9338
9340 {
9341 float split_quantity_new;
9345 InventoryLocation loc = new InventoryLocation;
9346
9347 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9348 {
9350 split_quantity_new = stack_max;
9351 else
9353
9355 {
9356 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9357 if (new_item)
9358 {
9359 new_item.SetResultOfSplit(true);
9360 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9362 new_item.
SetQuantity(split_quantity_new,
false,
true);
9363 }
9364 }
9365 }
9366 else if (destination_entity && slot_id == -1)
9367 {
9368 if (quantity > stack_max)
9369 split_quantity_new = stack_max;
9370 else
9371 split_quantity_new = quantity;
9372
9374 {
9375 GameInventory destinationInventory = destination_entity.GetInventory();
9377 {
9380 }
9381
9382 if (new_item)
9383 {
9384 new_item.SetResultOfSplit(true);
9385 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9387 new_item.
SetQuantity(split_quantity_new,
false,
true);
9388 }
9389 }
9390 }
9391 else
9392 {
9393 if (stack_max != 0)
9394 {
9396 {
9398 }
9399
9400 if (split_quantity_new == 0)
9401 {
9402 if (!
g_Game.IsMultiplayer())
9403 player.PhysicalPredictiveDropItem(this);
9404 else
9405 player.ServerDropEntity(this);
9406 return;
9407 }
9408
9410 {
9412
9413 if (new_item)
9414 {
9415 new_item.SetResultOfSplit(true);
9416 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9419 new_item.PlaceOnSurface();
9420 }
9421 }
9422 }
9423 }
9424 }
9425
9427 {
9428 float split_quantity_new;
9432 InventoryLocation loc = new InventoryLocation;
9433
9434 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9435 {
9437 split_quantity_new = stack_max;
9438 else
9440
9442 {
9443 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9444 if (new_item)
9445 {
9446 new_item.SetResultOfSplit(true);
9447 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9449 new_item.
SetQuantity(split_quantity_new,
false,
true);
9450 }
9451 }
9452 }
9453 else if (destination_entity && slot_id == -1)
9454 {
9455 if (quantity > stack_max)
9456 split_quantity_new = stack_max;
9457 else
9458 split_quantity_new = quantity;
9459
9461 {
9462 GameInventory destinationInventory = destination_entity.GetInventory();
9464 {
9467 }
9468
9469 if (new_item)
9470 {
9471 new_item.SetResultOfSplit(true);
9472 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9474 new_item.
SetQuantity(split_quantity_new,
false,
true);
9475 }
9476 }
9477 }
9478 else
9479 {
9480 if (stack_max != 0)
9481 {
9483 {
9485 }
9486
9488 {
9490
9491 if (new_item)
9492 {
9493 new_item.SetResultOfSplit(true);
9494 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9497 new_item.PlaceOnSurface();
9498 }
9499 }
9500 }
9501 }
9502 }
9503
9505 {
9507 {
9508 if (ScriptInputUserData.CanStoreInputUserData())
9509 {
9510 ScriptInputUserData ctx = new ScriptInputUserData;
9515 dst.WriteToContext(ctx);
9517 }
9518 }
9519 else if (!
g_Game.IsMultiplayer())
9520 {
9522 }
9523 }
9524
9526 {
9528 {
9529 if (ScriptInputUserData.CanStoreInputUserData())
9530 {
9531 ScriptInputUserData ctx = new ScriptInputUserData;
9536 ctx.
Write(destination_entity);
9542 }
9543 }
9544 else if (!
g_Game.IsMultiplayer())
9545 {
9547 }
9548 }
9549
9551 {
9553 }
9554
9556 {
9558 float split_quantity_new;
9560 if (dst.IsValid())
9561 {
9562 int slot_id = dst.GetSlot();
9564
9565 if (quantity > stack_max)
9566 split_quantity_new = stack_max;
9567 else
9568 split_quantity_new = quantity;
9569
9571 {
9573
9574 if (new_item)
9575 {
9576 new_item.SetResultOfSplit(true);
9577 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9579 new_item.
SetQuantity(split_quantity_new,
false,
true);
9580 }
9581
9582 return new_item;
9583 }
9584 }
9585
9586 return null;
9587 }
9588
9590 {
9592 float split_quantity_new;
9594 if (destination_entity)
9595 {
9597 if (quantity > stackable)
9598 split_quantity_new = stackable;
9599 else
9600 split_quantity_new = quantity;
9601
9603 {
9604 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9605 if (new_item)
9606 {
9607 new_item.SetResultOfSplit(true);
9608 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9610 new_item.
SetQuantity(split_quantity_new,
false,
true);
9611 }
9612 }
9613 }
9614 }
9615
9617 {
9619 {
9620 if (ScriptInputUserData.CanStoreInputUserData())
9621 {
9622 ScriptInputUserData ctx = new ScriptInputUserData;
9627 ItemBase destination_entity =
this;
9628 ctx.
Write(destination_entity);
9632 }
9633 }
9634 else if (!
g_Game.IsMultiplayer())
9635 {
9637 }
9638 }
9639
9641 {
9643 float split_quantity_new;
9645 if (player)
9646 {
9648 if (quantity > stackable)
9649 split_quantity_new = stackable;
9650 else
9651 split_quantity_new = quantity;
9652
9654 {
9655 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9656 new_item =
ItemBase.Cast(in_hands);
9657 if (new_item)
9658 {
9659 new_item.SetResultOfSplit(true);
9660 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9662 new_item.SetQuantity(split_quantity_new, false, true);
9663 }
9664 }
9665 }
9666 }
9667
9669 {
9671 float split_quantity_new = Math.Floor(quantity * 0.5);
9672
9674 return;
9675
9677
9678 if (new_item)
9679 {
9680 if (new_item.GetQuantityMax() < split_quantity_new)
9681 {
9682 split_quantity_new = new_item.GetQuantityMax();
9683 }
9684
9685 new_item.SetResultOfSplit(true);
9686 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9687
9689 {
9692 }
9693 else
9694 {
9696 new_item.
SetQuantity(split_quantity_new,
false,
true);
9697 }
9698 }
9699 }
9700
9702 {
9704 float split_quantity_new = Math.Floor(quantity / 2);
9705
9707 return;
9708
9709 InventoryLocation invloc = new InventoryLocation;
9711
9713 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9714
9715 if (new_item)
9716 {
9717 if (new_item.GetQuantityMax() < split_quantity_new)
9718 {
9719 split_quantity_new = new_item.GetQuantityMax();
9720 }
9722 {
9725 }
9726 else if (split_quantity_new > 1)
9727 {
9729 new_item.
SetQuantity(split_quantity_new,
false,
true);
9730 }
9731 }
9732 }
9733
9736 {
9737 SetWeightDirty();
9739
9740 if (parent)
9741 parent.OnAttachmentQuantityChangedEx(this, delta);
9742
9744 {
9746 {
9748 }
9750 {
9751 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9753 }
9754 }
9755 }
9756
9759 {
9760
9761 }
9762
9765 {
9767 }
9768
9770 {
9771 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9772
9774 {
9775 if (newLevel == GameConstants.STATE_RUINED)
9776 {
9778 EntityAI parent = GetHierarchyParent();
9779 if (parent && parent.IsFireplace())
9780 {
9781 CargoBase cargo = GetInventory().GetCargo();
9782 if (cargo)
9783 {
9785 {
9787 }
9788 }
9789 }
9790 }
9791
9793 {
9794
9796 return;
9797 }
9798
9799 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9800 {
9802 }
9803 }
9804 }
9805
9806
9808 {
9809 super.OnRightClick();
9810
9812 {
9814 {
9815 if (ScriptInputUserData.CanStoreInputUserData())
9816 {
9817 EntityAI root = GetHierarchyRoot();
9818 Man playerOwner = GetHierarchyRootPlayer();
9819 InventoryLocation dst = new InventoryLocation;
9820
9821
9822 if (!playerOwner && root && root == this)
9823 {
9825 }
9826 else
9827 {
9828
9829 GetInventory().GetCurrentInventoryLocation(dst);
9831 {
9832 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9834 {
9836 }
9837 else
9838 {
9840
9841
9842 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9843 {
9845 }
9846 else
9847 {
9848 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9849 }
9850 }
9851 }
9852 }
9853
9854 ScriptInputUserData ctx = new ScriptInputUserData;
9862 }
9863 }
9864 else if (!
g_Game.IsMultiplayer())
9865 {
9867 }
9868 }
9869 }
9870
9872 {
9873 if (root)
9874 {
9875 vector m4[4];
9876 root.GetTransform(m4);
9877 dst.SetGround(this, m4);
9878 }
9879 else
9880 {
9881 GetInventory().GetCurrentInventoryLocation(dst);
9882 }
9883 }
9884
9885 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9886 {
9887
9888 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9889 return false;
9890
9891 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9892 return false;
9893
9894
9896 return false;
9897
9898
9899 Magazine mag = Magazine.Cast(this);
9900 if (mag)
9901 {
9902 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9903 return false;
9904
9905 if (stack_max_limit)
9906 {
9907 Magazine other_mag = Magazine.Cast(other_item);
9908 if (other_item)
9909 {
9910 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9911 return false;
9912 }
9913
9914 }
9915 }
9916 else
9917 {
9918
9920 return false;
9921
9923 return false;
9924 }
9925
9926 PlayerBase player = null;
9927 if (CastTo(player, GetHierarchyRootPlayer()))
9928 {
9929 if (player.GetInventory().HasAttachment(this))
9930 return false;
9931
9932 if (player.IsItemsToDelete())
9933 return false;
9934 }
9935
9936 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9937 return false;
9938
9939 int slotID;
9941 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9942 return false;
9943
9944 return true;
9945 }
9946
9948 {
9950 }
9951
9953 {
9954 return m_IsResultOfSplit;
9955 }
9956
9958 {
9959 m_IsResultOfSplit = value;
9960 }
9961
9963 {
9965 }
9966
9968 {
9969 float other_item_quantity = other_item.GetQuantity();
9970 float this_free_space;
9971
9973
9975
9976 if (other_item_quantity > this_free_space)
9977 {
9978 return this_free_space;
9979 }
9980 else
9981 {
9982 return other_item_quantity;
9983 }
9984 }
9985
9987 {
9989 }
9990
9992 {
9994 return;
9995
9996 if (!IsMagazine() && other_item)
9997 {
9999 if (quantity_used != 0)
10000 {
10001 float hp1 = GetHealth01("","");
10002 float hp2 = other_item.GetHealth01("","");
10003 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10004 hpResult = hpResult / (
GetQuantity() + quantity_used);
10005
10006 hpResult *= GetMaxHealth();
10007 Math.Round(hpResult);
10008 SetHealth("", "Health", hpResult);
10009
10011 other_item.AddQuantity(-quantity_used);
10012 }
10013 }
10015 }
10016
10018 {
10019 #ifdef SERVER
10020 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10021 GetHierarchyParent().IncreaseLifetimeUp();
10022 #endif
10023 };
10024
10026 {
10027 PlayerBase p = PlayerBase.Cast(player);
10028
10029 array<int> recipesIds = p.m_Recipes;
10030 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10031 if (moduleRecipesManager)
10032 {
10033 EntityAI itemInHands = player.GetEntityInHands();
10034 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10035 }
10036
10037 for (int i = 0;i < recipesIds.Count(); i++)
10038 {
10039 int key = recipesIds.Get(i);
10040 string recipeName = moduleRecipesManager.GetRecipeName(key);
10042 }
10043 }
10044
10045
10046 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10047 {
10048 super.GetDebugActions(outputList);
10049
10050
10056
10057
10062
10067
10068
10072
10073
10075 {
10079 }
10080
10083
10084
10088
10090
10091 InventoryLocation loc = new InventoryLocation();
10092 GetInventory().GetCurrentInventoryLocation(loc);
10094 {
10095 if (Gizmo_IsSupported())
10098 }
10099
10101 }
10102
10103
10104
10105
10107 {
10108 super.OnAction(action_id, player, ctx);
10109
10111 {
10112 switch (action_id)
10113 {
10117 return true;
10121 return true;
10122 }
10123 }
10124
10126 {
10127 switch (action_id)
10128 {
10130 Delete();
10131 return true;
10132 }
10133 }
10134
10135 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10136 {
10137 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10138 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10139 PlayerBase p = PlayerBase.Cast(player);
10140 if (
EActions.RECIPES_RANGE_START < 1000)
10141 {
10142 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10143 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10144 }
10145 }
10146 #ifndef SERVER
10147 else if (action_id ==
EActions.WATCH_PLAYER)
10148 {
10149 PluginDeveloper.SetDeveloperItemClientEx(player);
10150 }
10151 #endif
10153 {
10154 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10155 {
10156 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10157 OnDebugButtonPressServer(id + 1);
10158 }
10159
10160 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10161 {
10162 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10164 }
10165
10166 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10167 {
10168 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10170 }
10171
10172 else if (action_id ==
EActions.ADD_QUANTITY)
10173 {
10174 if (IsMagazine())
10175 {
10176 Magazine mag = Magazine.Cast(this);
10177 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10178 }
10179 else
10180 {
10182 }
10183
10184 if (m_EM)
10185 {
10186 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10187 }
10188
10189 }
10190
10191 else if (action_id ==
EActions.REMOVE_QUANTITY)
10192 {
10193 if (IsMagazine())
10194 {
10195 Magazine mag2 = Magazine.Cast(this);
10196 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10197 }
10198 else
10199 {
10201 }
10202 if (m_EM)
10203 {
10204 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10205 }
10206
10207 }
10208
10209 else if (action_id ==
EActions.SET_QUANTITY_0)
10210 {
10212
10213 if (m_EM)
10214 {
10215 m_EM.SetEnergy(0);
10216 }
10217 }
10218
10219 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10220 {
10222
10223 if (m_EM)
10224 {
10225 m_EM.SetEnergy(m_EM.GetEnergyMax());
10226 }
10227 }
10228
10229 else if (action_id ==
EActions.ADD_HEALTH)
10230 {
10231 AddHealth("","",GetMaxHealth("","Health")/5);
10232 }
10233 else if (action_id ==
EActions.REMOVE_HEALTH)
10234 {
10235 AddHealth("","",-GetMaxHealth("","Health")/5);
10236 }
10237 else if (action_id ==
EActions.DESTROY_HEALTH)
10238 {
10239 SetHealth01("","",0);
10240 }
10241 else if (action_id ==
EActions.WATCH_ITEM)
10242 {
10244 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10245 #ifdef DEVELOPER
10246 SetDebugDeveloper_item(this);
10247 #endif
10248 }
10249
10250 else if (action_id ==
EActions.ADD_TEMPERATURE)
10251 {
10252 AddTemperature(20);
10253
10254 }
10255
10256 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10257 {
10258 AddTemperature(-20);
10259
10260 }
10261
10262 else if (action_id ==
EActions.FLIP_FROZEN)
10263 {
10264 SetFrozen(!GetIsFrozen());
10265
10266 }
10267
10268 else if (action_id ==
EActions.ADD_WETNESS)
10269 {
10271
10272 }
10273
10274 else if (action_id ==
EActions.REMOVE_WETNESS)
10275 {
10277
10278 }
10279
10280 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10281 {
10284
10285
10286 }
10287
10288 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10289 {
10292 }
10293
10294 else if (action_id ==
EActions.MAKE_SPECIAL)
10295 {
10296 auto debugParams = DebugSpawnParams.WithPlayer(player);
10297 OnDebugSpawnEx(debugParams);
10298 }
10299
10300 }
10301
10302
10303 return false;
10304 }
10305
10306
10307
10308
10312
10315
10316
10317
10319 {
10320 return false;
10321 }
10322
10323
10325 {
10326 return true;
10327 }
10328
10329
10331 {
10332 return true;
10333 }
10334
10335
10336
10338 {
10339 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10340 return g_Game.ConfigIsExisting(config_path);
10341 }
10342
10345 {
10346 return null;
10347 }
10348
10350 {
10351 return false;
10352 }
10353
10355 {
10356 return false;
10357 }
10358
10362
10363
10365 {
10366 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10367 return module_repairing.CanRepair(this, item_repair_kit);
10368 }
10369
10370
10371 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10372 {
10373 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10374 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10375 }
10376
10377
10379 {
10380
10381
10382
10383
10384
10385
10386
10387
10388 return 1;
10389 }
10390
10391
10392
10394 {
10396 }
10397
10398
10399
10401 {
10403 }
10404
10405
10414 {
10415 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10416
10417 if (player)
10418 {
10419 player.MessageStatus(text);
10420 }
10421 }
10422
10423
10432 {
10433 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10434
10435 if (player)
10436 {
10437 player.MessageAction(text);
10438 }
10439 }
10440
10441
10450 {
10451 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10452
10453 if (player)
10454 {
10455 player.MessageFriendly(text);
10456 }
10457 }
10458
10459
10468 {
10469 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10470
10471 if (player)
10472 {
10473 player.MessageImportant(text);
10474 }
10475 }
10476
10478 {
10479 return true;
10480 }
10481
10482
10483 override bool KindOf(
string tag)
10484 {
10485 bool found = false;
10486 string item_name = this.
GetType();
10488 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10489
10490 int array_size = item_tag_array.Count();
10491 for (int i = 0; i < array_size; i++)
10492 {
10493 if (item_tag_array.Get(i) == tag)
10494 {
10495 found = true;
10496 break;
10497 }
10498 }
10499 return found;
10500 }
10501
10502
10504 {
10505
10506 super.OnRPC(sender, rpc_type,ctx);
10507
10508
10509 switch (rpc_type)
10510 {
10511 #ifndef SERVER
10512 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10513 Param2<bool, string> p = new Param2<bool, string>(false, "");
10514
10516 return;
10517
10518 bool play = p.param1;
10519 string soundSet = p.param2;
10520
10521 if (play)
10522 {
10524 {
10526 {
10528 }
10529 }
10530 else
10531 {
10533 }
10534 }
10535 else
10536 {
10538 }
10539
10540 break;
10541 #endif
10542
10543 }
10544
10546 {
10548 }
10549 }
10550
10551
10552
10553
10555 {
10556 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10557 return plugin.GetID(
name);
10558 }
10559
10561 {
10562 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10563 return plugin.GetName(id);
10564 }
10565
10568 {
10569
10570
10571 int varFlags;
10572 if (!ctx.
Read(varFlags))
10573 return;
10574
10575 if (varFlags & ItemVariableFlags.FLOAT)
10576 {
10578 }
10579 }
10580
10582 {
10583
10584 super.SerializeNumericalVars(floats_out);
10585
10586
10587
10589 {
10591 }
10592
10594 {
10596 }
10597
10599 {
10601 }
10602
10604 {
10609 }
10610
10612 {
10614 }
10615 }
10616
10618 {
10619
10620 super.DeSerializeNumericalVars(floats);
10621
10622
10623 int index = 0;
10624 int mask = Math.Round(floats.Get(index));
10625
10626 index++;
10627
10629 {
10631 {
10633 }
10634 else
10635 {
10636 float quantity = floats.Get(index);
10637 SetQuantity(quantity,
true,
false,
false,
false);
10638 }
10639 index++;
10640 }
10641
10643 {
10644 float wet = floats.Get(index);
10646 index++;
10647 }
10648
10650 {
10651 int liquidtype = Math.Round(floats.Get(index));
10653 index++;
10654 }
10655
10657 {
10659 index++;
10661 index++;
10663 index++;
10665 index++;
10666 }
10667
10669 {
10670 int cleanness = Math.Round(floats.Get(index));
10672 index++;
10673 }
10674 }
10675
10677 {
10678 super.WriteVarsToCTX(ctx);
10679
10680
10682 {
10684 }
10685
10687 {
10689 }
10690
10692 {
10694 }
10695
10697 {
10698 int r,g,b,a;
10704 }
10705
10707 {
10709 }
10710 }
10711
10713 {
10714 if (!super.ReadVarsFromCTX(ctx,version))
10715 return false;
10716
10717 int intValue;
10718 float value;
10719
10720 if (version < 140)
10721 {
10722 if (!ctx.
Read(intValue))
10723 return false;
10724
10725 m_VariablesMask = intValue;
10726 }
10727
10729 {
10730 if (!ctx.
Read(value))
10731 return false;
10732
10734 {
10736 }
10737 else
10738 {
10740 }
10741 }
10742
10743 if (version < 140)
10744 {
10746 {
10747 if (!ctx.
Read(value))
10748 return false;
10749 SetTemperatureDirect(value);
10750 }
10751 }
10752
10754 {
10755 if (!ctx.
Read(value))
10756 return false;
10758 }
10759
10761 {
10762 if (!ctx.
Read(intValue))
10763 return false;
10765 }
10766
10768 {
10769 int r,g,b,a;
10771 return false;
10773 return false;
10775 return false;
10777 return false;
10778
10780 }
10781
10783 {
10784 if (!ctx.
Read(intValue))
10785 return false;
10787 }
10788
10789 if (version >= 138 && version < 140)
10790 {
10792 {
10793 if (!ctx.
Read(intValue))
10794 return false;
10795 SetFrozen(intValue);
10796 }
10797 }
10798
10799 return true;
10800 }
10801
10802
10804 {
10807 {
10809 }
10810
10811 if (!super.OnStoreLoad(ctx, version))
10812 {
10814 return false;
10815 }
10816
10817 if (version >= 114)
10818 {
10819 bool hasQuickBarIndexSaved;
10820
10821 if (!ctx.
Read(hasQuickBarIndexSaved))
10822 {
10824 return false;
10825 }
10826
10827 if (hasQuickBarIndexSaved)
10828 {
10829 int itmQBIndex;
10830
10831
10832 if (!ctx.
Read(itmQBIndex))
10833 {
10835 return false;
10836 }
10837
10838 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10839 if (itmQBIndex != -1 && parentPlayer)
10840 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10841 }
10842 }
10843 else
10844 {
10845
10846 PlayerBase player;
10847 int itemQBIndex;
10848 if (version ==
int.
MAX)
10849 {
10850 if (!ctx.
Read(itemQBIndex))
10851 {
10853 return false;
10854 }
10855 }
10856 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10857 {
10858
10859 if (!ctx.
Read(itemQBIndex))
10860 {
10862 return false;
10863 }
10864 if (itemQBIndex != -1 && player)
10865 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10866 }
10867 }
10868
10869 if (version < 140)
10870 {
10871
10872 if (!LoadVariables(ctx, version))
10873 {
10875 return false;
10876 }
10877 }
10878
10879
10881 {
10883 return false;
10884 }
10885 if (version >= 132)
10886 {
10888 if (raib)
10889 {
10891 {
10893 return false;
10894 }
10895 }
10896 }
10897
10899 return true;
10900 }
10901
10902
10903
10905 {
10906 super.OnStoreSave(ctx);
10907
10908 PlayerBase player;
10909 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10910 {
10912
10913 int itemQBIndex = -1;
10914 itemQBIndex = player.FindQuickBarEntityIndex(this);
10915 ctx.
Write(itemQBIndex);
10916 }
10917 else
10918 {
10920 }
10921
10923
10925 if (raib)
10926 {
10928 }
10929 }
10930
10931
10933 {
10934 super.AfterStoreLoad();
10935
10937 {
10939 }
10940
10942 {
10945 }
10946 }
10947
10949 {
10950 super.EEOnAfterLoad();
10951
10953 {
10955 }
10956
10959 }
10960
10962 {
10963 return false;
10964 }
10965
10966
10967
10969 {
10971 {
10972 #ifdef PLATFORM_CONSOLE
10973
10975 {
10977 if (menu)
10978 {
10980 }
10981 }
10982 #endif
10983 }
10984
10986 {
10989 }
10990
10992 {
10993 SetWeightDirty();
10995 }
10997 {
11000 }
11001
11003 {
11006
11009 }
11011 {
11015 }
11016
11017 super.OnVariablesSynchronized();
11018 }
11019
11020
11021
11023 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11024 {
11025 if (!IsServerCheck(allow_client))
11026 return false;
11027
11029 return false;
11030
11033
11034 if (value <= (min + 0.001))
11035 value = min;
11036
11037 if (value == min)
11038 {
11039 if (destroy_config)
11040 {
11041 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11042 if (dstr)
11043 {
11045 this.Delete();
11046 return true;
11047 }
11048 }
11049 else if (destroy_forced)
11050 {
11052 this.Delete();
11053 return true;
11054 }
11055
11057 }
11058
11061
11063 {
11064 EntityAI parent = GetHierarchyRoot();
11065 InventoryLocation iLoc = new InventoryLocation();
11066 GetInventory().GetCurrentInventoryLocation(iLoc);
11068 {
11069 int iLocSlot = iLoc.
GetSlot();
11071 {
11073 }
11075 {
11077 }
11078 }
11079 }
11080
11082 {
11084
11085 if (delta)
11087 }
11088
11090
11091 return false;
11092 }
11093
11094
11096 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11097 {
11099 }
11100
11102 {
11105 }
11106
11108 {
11111 }
11112
11114 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11115 {
11116 float value_clamped = Math.Clamp(value, 0, 1);
11118 SetQuantity(result, destroy_config, destroy_forced);
11119 }
11120
11121
11124 {
11126 }
11127
11129 {
11131 }
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11143 {
11144 int slot = -1;
11145 GameInventory inventory = GetInventory();
11146 if (inventory)
11147 {
11148 InventoryLocation il = new InventoryLocation;
11151 }
11152
11154 }
11155
11157 {
11158 float quantity_max = 0;
11159
11161 {
11162 if (attSlotID != -1)
11163 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11164
11165 if (quantity_max <= 0)
11167 }
11168
11169 if (quantity_max <= 0)
11171
11172 return quantity_max;
11173 }
11174
11176 {
11178 }
11179
11181 {
11183 }
11184
11185
11187 {
11189 }
11190
11192 {
11194 }
11195
11197 {
11199 }
11200
11201
11203 {
11204
11205 float weightEx = GetWeightEx();
11206 float special = GetInventoryAndCargoWeight();
11207 return weightEx - special;
11208 }
11209
11210
11212 {
11214 }
11215
11217 {
11219 {
11220 #ifdef DEVELOPER
11221 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11222 {
11223 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11225 }
11226 #endif
11227
11228 return GetQuantity() * GetConfigWeightModified();
11229 }
11230 else if (HasEnergyManager())
11231 {
11232 #ifdef DEVELOPER
11233 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11234 {
11235 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11236 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11237 }
11238 #endif
11239 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11240 }
11241 else
11242 {
11243 #ifdef DEVELOPER
11244 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11245 {
11246 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11247 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11248 }
11249 #endif
11250 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11251 }
11252 }
11253
11256 {
11257 int item_count = 0;
11259
11260 GameInventory inventory = GetInventory();
11261 CargoBase cargo = inventory.
GetCargo();
11262 if (cargo != NULL)
11263 {
11265 }
11266
11268 for (int i = 0; i < nAttachments; ++i)
11269 {
11271 if (item)
11272 item_count += item.GetNumberOfItems();
11273 }
11274 return item_count;
11275 }
11276
11279 {
11280 float weight = 0;
11281 float wetness = 1;
11282 if (include_wetness)
11285 {
11286 weight = wetness * m_ConfigWeight;
11287 }
11289 {
11290 weight = 1;
11291 }
11292 return weight;
11293 }
11294
11295
11296
11298 {
11299 GameInventory inventory = GetInventory();
11300 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11301 {
11302 array<EntityAI> items = new array<EntityAI>;
11304 for (int i = 0; i < items.Count(); ++i)
11305 {
11307 if (item)
11308 {
11309 g_Game.ObjectDelete(item);
11310 }
11311 }
11312 }
11313 }
11314
11315
11316
11317
11319 {
11320 float energy = 0;
11321 if (HasEnergyManager())
11322 {
11323 energy = GetCompEM().GetEnergy();
11324 }
11325 return energy;
11326 }
11327
11328
11330 {
11331 super.OnEnergyConsumed();
11332
11334 }
11335
11337 {
11338 super.OnEnergyAdded();
11339
11341 }
11342
11343
11345 {
11346 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11347 {
11349 {
11350 float energy_0to1 = GetCompEM().GetEnergy0To1();
11352 }
11353 }
11354 }
11355
11356
11358 {
11359 return ConfigGetFloat("heatIsolation");
11360 }
11361
11363 {
11365 }
11366
11368 {
11369 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11370 if (
g_Game.ConfigIsExisting(paramPath))
11371 return g_Game.ConfigGetFloat(paramPath);
11372
11373 return 0.0;
11374 }
11375
11377 {
11378 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11379 if (
g_Game.ConfigIsExisting(paramPath))
11380 return g_Game.ConfigGetFloat(paramPath);
11381
11382 return 0.0;
11383 }
11384
11385 override void SetWet(
float value,
bool allow_client =
false)
11386 {
11387 if (!IsServerCheck(allow_client))
11388 return;
11389
11392
11394
11395 m_VarWet = Math.Clamp(value, min, max);
11396
11398 {
11401 }
11402 }
11403
11404 override void AddWet(
float value)
11405 {
11407 }
11408
11410 {
11412 }
11413
11415 {
11417 }
11418
11420 {
11422 }
11423
11425 {
11427 }
11428
11430 {
11432 }
11433
11434 override void OnWetChanged(
float newVal,
float oldVal)
11435 {
11438 if (newLevel != oldLevel)
11439 {
11441 }
11442 }
11443
11445 {
11446 SetWeightDirty();
11447 }
11448
11450 {
11451 return GetWetLevelInternal(
m_VarWet);
11452 }
11453
11454
11455
11457 {
11459 }
11460
11462 {
11464 }
11465
11467 {
11469 }
11470
11472 {
11474 }
11475
11476
11477
11479 {
11480 if (ConfigIsExisting("itemModelLength"))
11481 {
11482 return ConfigGetFloat("itemModelLength");
11483 }
11484 return 0;
11485 }
11486
11488 {
11489 if (ConfigIsExisting("itemAttachOffset"))
11490 {
11491 return ConfigGetFloat("itemAttachOffset");
11492 }
11493 return 0;
11494 }
11495
11496 override void SetCleanness(
int value,
bool allow_client =
false)
11497 {
11498 if (!IsServerCheck(allow_client))
11499 return;
11500
11502
11504
11507 }
11508
11510 {
11512 }
11513
11515 {
11516 return true;
11517 }
11518
11519
11520
11521
11523 {
11525 }
11526
11528 {
11530 }
11531
11532
11533
11534
11535 override void SetColor(
int r,
int g,
int b,
int a)
11536 {
11542 }
11544 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11545 {
11550 }
11551
11553 {
11555 }
11556
11559 {
11560 int r,g,b,a;
11562 r = r/255;
11563 g = g/255;
11564 b = b/255;
11565 a = a/255;
11566 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11567 }
11568
11569
11570
11571 override void SetLiquidType(
int value,
bool allow_client =
false)
11572 {
11573 if (!IsServerCheck(allow_client))
11574 return;
11575
11580 }
11581
11583 {
11584 return ConfigGetInt("varLiquidTypeInit");
11585 }
11586
11588 {
11590 }
11591
11593 {
11595 SetFrozen(false);
11596 }
11597
11600 {
11601 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11602 }
11603
11604
11607 {
11608 PlayerBase nplayer;
11609 if (PlayerBase.CastTo(nplayer, player))
11610 {
11612 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11613 }
11614 }
11615
11616
11619 {
11620 PlayerBase nplayer;
11621 if (PlayerBase.CastTo(nplayer,player))
11622 {
11623 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11624 }
11625
11626 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11627
11628 if (HasEnergyManager())
11629 {
11630 GetCompEM().UpdatePlugState();
11631 }
11632 }
11633
11634
11636 {
11637 super.OnPlacementStarted(player);
11638
11640 }
11641
11642 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11643 {
11645 {
11646 m_AdminLog.OnPlacementComplete(player,
this);
11647 }
11648
11649 super.OnPlacementComplete(player, position, orientation);
11650 }
11651
11652
11653
11654
11655
11657 {
11659 {
11660 return true;
11661 }
11662 else
11663 {
11664 return false;
11665 }
11666 }
11667
11668
11670 {
11672 {
11674 }
11675 }
11676
11677
11679 {
11681 }
11682
11684 {
11686 }
11687
11688 override void InsertAgent(
int agent,
float count = 1)
11689 {
11690 if (count < 1)
11691 return;
11692
11694 }
11695
11698 {
11700 }
11701
11702
11704 {
11706 }
11707
11708
11709
11710
11711
11712
11713
11714
11715
11716
11717
11718
11719
11720
11721
11722
11723
11724
11725
11726
11727
11728
11729
11730
11731
11732
11733
11734
11735
11736
11737
11738
11739
11740
11741
11742
11743
11744
11745
11746
11747
11748
11750 {
11752 return false;
11753 return true;
11754 }
11755
11757 {
11758
11760 }
11761
11762
11765 {
11766 super.CheckForRoofLimited(timeTresholdMS);
11767
11768 float time =
g_Game.GetTime();
11769 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11770 {
11771 m_PreviousRoofTestTime = time;
11772 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11773 }
11774 }
11775
11776
11778 {
11780 {
11781 return 0;
11782 }
11783
11784 if (GetInventory().GetAttachmentSlotsCount() != 0)
11785 {
11786 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11787 if (filter)
11788 return filter.GetProtectionLevel(type, false, system);
11789 else
11790 return 0;
11791 }
11792
11793 string subclassPath, entryName;
11794
11795 switch (type)
11796 {
11798 entryName = "biological";
11799 break;
11801 entryName = "chemical";
11802 break;
11803 default:
11804 entryName = "biological";
11805 break;
11806 }
11807
11808 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11809
11810 return g_Game.ConfigGetFloat(subclassPath + entryName);
11811 }
11812
11813
11814
11817 {
11818 if (!IsMagazine())
11820
11822 }
11823
11824
11825
11826
11827
11832 {
11833 return true;
11834 }
11835
11837 {
11839 }
11840
11841
11842
11843
11844
11846 {
11847 if (parent)
11848 {
11849 if (parent.IsInherited(DayZInfected))
11850 return true;
11851
11852 if (!parent.IsRuined())
11853 return true;
11854 }
11855
11856 return true;
11857 }
11858
11860 {
11861 if (!super.CanPutAsAttachment(parent))
11862 {
11863 return false;
11864 }
11865
11866 if (!IsRuined() && !parent.IsRuined())
11867 {
11868 return true;
11869 }
11870
11871 return false;
11872 }
11873
11875 {
11876
11877
11878
11879
11880 return super.CanReceiveItemIntoCargo(item);
11881 }
11882
11884 {
11885
11886
11887
11888
11889 GameInventory attachmentInv = attachment.GetInventory();
11891 {
11892 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11893 return false;
11894 }
11895
11896 InventoryLocation loc = new InventoryLocation();
11897 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11898 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11899 return false;
11900
11901 return super.CanReceiveAttachment(attachment, slotId);
11902 }
11903
11905 {
11906 if (!super.CanReleaseAttachment(attachment))
11907 return false;
11908
11909 return GetInventory().AreChildrenAccessible();
11910 }
11911
11912
11913
11914
11915
11916
11917
11918
11919
11920
11921
11922
11923
11924
11925
11926
11927
11928
11929
11930
11931
11933 {
11934 int id = muzzle_owner.GetMuzzleID();
11935 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11936
11937 if (WPOF_array)
11938 {
11939 for (int i = 0; i < WPOF_array.Count(); i++)
11940 {
11941 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11942
11943 if (WPOF)
11944 {
11945 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11946 }
11947 }
11948 }
11949 }
11950
11951
11953 {
11954 int id = muzzle_owner.GetMuzzleID();
11956
11957 if (WPOBE_array)
11958 {
11959 for (int i = 0; i < WPOBE_array.Count(); i++)
11960 {
11961 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11962
11963 if (WPOBE)
11964 {
11965 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11966 }
11967 }
11968 }
11969 }
11970
11971
11973 {
11974 int id = muzzle_owner.GetMuzzleID();
11975 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11976
11977 if (WPOOH_array)
11978 {
11979 for (int i = 0; i < WPOOH_array.Count(); i++)
11980 {
11981 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11982
11983 if (WPOOH)
11984 {
11985 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11986 }
11987 }
11988 }
11989 }
11990
11991
11993 {
11994 int id = muzzle_owner.GetMuzzleID();
11995 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11996
11997 if (WPOOH_array)
11998 {
11999 for (int i = 0; i < WPOOH_array.Count(); i++)
12000 {
12001 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12002
12003 if (WPOOH)
12004 {
12005 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12006 }
12007 }
12008 }
12009 }
12010
12011
12013 {
12014 int id = muzzle_owner.GetMuzzleID();
12015 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12016
12017 if (WPOOH_array)
12018 {
12019 for (int i = 0; i < WPOOH_array.Count(); i++)
12020 {
12021 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12022
12023 if (WPOOH)
12024 {
12025 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12026 }
12027 }
12028 }
12029 }
12030
12031
12032
12034 {
12036 {
12037 return true;
12038 }
12039
12040 return false;
12041 }
12042
12044 {
12046 {
12047 return true;
12048 }
12049
12050 return false;
12051 }
12052
12054 {
12056 {
12057 return true;
12058 }
12059
12060 return false;
12061 }
12062
12064 {
12065 return false;
12066 }
12067
12070 {
12071 return UATimeSpent.DEFAULT_DEPLOY;
12072 }
12073
12074
12075
12076
12078 {
12080 SetSynchDirty();
12081 }
12082
12084 {
12086 }
12087
12088
12090 {
12091 return false;
12092 }
12093
12096 {
12097 string att_type = "None";
12098
12099 if (ConfigIsExisting("soundAttType"))
12100 {
12101 att_type = ConfigGetString("soundAttType");
12102 }
12103
12105 }
12106
12108 {
12110 }
12111
12112
12113
12114
12115
12121
12123 {
12126
12128 }
12129
12130
12132 {
12134 return;
12135
12137
12140
12143
12144 SoundParameters params = new SoundParameters();
12148 }
12149
12150
12152 {
12154 {
12157
12158 SetSynchDirty();
12159
12162 }
12163 }
12164
12166 {
12168 }
12169
12170
12172 {
12174 return;
12175
12177 SetSynchDirty();
12178
12181 }
12182
12184 {
12187 }
12188
12190 {
12192 }
12193
12194 void OnApply(PlayerBase player);
12195
12197 {
12198 return 1.0;
12199 };
12200
12202 {
12204 }
12205
12207 {
12209 }
12210
12212
12214 {
12215 SetDynamicPhysicsLifeTime(0.01);
12217 }
12218
12220 {
12221 array<string> zone_names = new array<string>;
12222 GetDamageZones(zone_names);
12223 for (int i = 0; i < zone_names.Count(); i++)
12224 {
12225 SetHealthMax(zone_names.Get(i),"Health");
12226 }
12227 SetHealthMax("","Health");
12228 }
12229
12232 {
12233 float global_health = GetHealth01("","Health");
12234 array<string> zones = new array<string>;
12235 GetDamageZones(zones);
12236
12237 for (int i = 0; i < zones.Count(); i++)
12238 {
12239 SetHealth01(zones.Get(i),"Health",global_health);
12240 }
12241 }
12242
12245 {
12246 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12247 }
12248
12250 {
12251 if (!hasRootAsPlayer)
12252 {
12253 if (refParentIB)
12254 {
12255
12256 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12257 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12258
12259 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12260 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12261
12264 }
12265 else
12266 {
12267
12270 }
12271 }
12272 }
12273
12275 {
12277 {
12278 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12279 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12280 {
12281 float heatPermCoef = 1.0;
12283 while (ent)
12284 {
12285 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12286 ent = ent.GetHierarchyParent();
12287 }
12288
12289 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12290 }
12291 }
12292 }
12293
12295 {
12296
12297 EntityAI parent = GetHierarchyParent();
12298 if (!parent)
12299 {
12300 hasParent = false;
12301 hasRootAsPlayer = false;
12302 }
12303 else
12304 {
12305 hasParent = true;
12306 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12307 refParentIB =
ItemBase.Cast(parent);
12308 }
12309 }
12310
12311 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12312 {
12313
12314 }
12315
12317 {
12318
12319 return false;
12320 }
12321
12323 {
12324
12325
12326 return false;
12327 }
12328
12330 {
12331
12332 return false;
12333 }
12334
12337 {
12338 return !GetIsFrozen() &&
IsOpen();
12339 }
12340
12342 {
12343 bool hasParent = false, hasRootAsPlayer = false;
12345
12346 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12347 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12348
12349 if (wwtu || foodDecay)
12350 {
12354
12355 if (processWetness || processTemperature || processDecay)
12356 {
12358
12359 if (processWetness)
12360 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12361
12362 if (processTemperature)
12364
12365 if (processDecay)
12366 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12367 }
12368 }
12369 }
12370
12373 {
12375 }
12376
12378 {
12381
12382 return super.GetTemperatureFreezeThreshold();
12383 }
12384
12386 {
12389
12390 return super.GetTemperatureThawThreshold();
12391 }
12392
12394 {
12397
12398 return super.GetItemOverheatThreshold();
12399 }
12400
12402 {
12404 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12405
12406 return super.GetTemperatureFreezeTime();
12407 }
12408
12410 {
12412 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12413
12414 return super.GetTemperatureThawTime();
12415 }
12416
12421
12423 {
12424 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12425 }
12426
12428 {
12429 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12430 }
12431
12434 {
12436 }
12437
12439 {
12441 }
12442
12444 {
12446 }
12447
12450 {
12451 return null;
12452 }
12453
12456 {
12457 return false;
12458 }
12459
12461 {
12463 {
12466 if (!trg)
12467 {
12469 explosive = this;
12470 }
12471
12472 explosive.PairRemote(trg);
12474
12475 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12476 trg.SetPersistentPairID(persistentID);
12477 explosive.SetPersistentPairID(persistentID);
12478
12479 return true;
12480 }
12481 return false;
12482 }
12483
12486 {
12487 float ret = 1.0;
12490 ret *= GetHealth01();
12491
12492 return ret;
12493 }
12494
12495 #ifdef DEVELOPER
12496 override void SetDebugItem()
12497 {
12498 super.SetDebugItem();
12499 _itemBase = this;
12500 }
12501
12503 {
12504 string text = super.GetDebugText();
12505
12507 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12508
12509 return text;
12510 }
12511 #endif
12512
12514 {
12515 return true;
12516 }
12517
12519
12521
12523 {
12526 }
12527
12528
12536
12552
12553 [
Obsolete(
"Use ItemSoundHandler instead")]
12556 {
12557 if (!
g_Game.IsDedicatedServer())
12558 {
12559 if (ConfigIsExisting("attachSoundSet"))
12560 {
12561 string cfg_path = "";
12562 string soundset = "";
12563 string type_name =
GetType();
12564
12567 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12568 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12569
12570 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12571 {
12572 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12573 {
12574 if (cfg_slot_array[i] == slot_type)
12575 {
12576 soundset = cfg_soundset_array[i];
12577 break;
12578 }
12579 }
12580 }
12581
12582 if (soundset != "")
12583 {
12584 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12586 }
12587 }
12588 }
12589 }
12590
12592}
12593
12595{
12597 if (entity)
12598 {
12599 bool is_item = entity.IsInherited(
ItemBase);
12600 if (is_item && full_quantity)
12601 {
12604 }
12605 }
12606 else
12607 {
12609 return NULL;
12610 }
12611 return entity;
12612}
12613
12615{
12616 if (item)
12617 {
12618 if (health > 0)
12619 item.SetHealth("", "", health);
12620
12621 if (item.CanHaveTemperature())
12622 {
12624 if (item.CanFreeze())
12625 item.SetFrozen(false);
12626 }
12627
12628 if (item.HasEnergyManager())
12629 {
12630 if (quantity >= 0)
12631 {
12632 item.GetCompEM().SetEnergy0To1(quantity);
12633 }
12634 else
12635 {
12637 }
12638 }
12639 else if (item.IsMagazine())
12640 {
12641 Magazine mag = Magazine.Cast(item);
12642 if (quantity >= 0)
12643 {
12644 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12645 }
12646 else
12647 {
12649 }
12650
12651 }
12652 else
12653 {
12654 if (quantity >= 0)
12655 {
12656 item.SetQuantityNormalized(quantity, false);
12657 }
12658 else
12659 {
12661 }
12662
12663 }
12664 }
12665}
12666
12667#ifdef DEVELOPER
12669#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.