7766{
7768 {
7769 return true;
7770 }
7771};
7772
7774{
7775
7776};
7777
7778
7779
7781{
7785
7787
7790
7791
7792
7793
7794
7803
7809
7814
7819
7840 protected bool m_IsResultOfSplit
7841
7843
7848
7849
7850
7852
7856
7857
7858
7860
7863
7864
7865
7871
7872
7880
7883
7884
7886
7887
7889
7890
7895
7896
7901
7903
7904
7906
7907
7909 {
7914
7915 if (!
g_Game.IsDedicatedServer())
7916 {
7918 {
7920
7922 {
7924 }
7925 }
7926
7929 }
7930
7931 m_OldLocation = null;
7932
7934 {
7936 }
7937
7938 if (ConfigIsExisting("headSelectionsToHide"))
7939 {
7942 }
7943
7945 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7946 {
7948 }
7949
7951
7952 m_IsResultOfSplit = false;
7953
7955 }
7956
7958 {
7959 super.InitItemVariables();
7960
7966 m_Count = ConfigGetInt(
"count");
7967
7970
7975
7978
7983
7995
7999
8000
8003 if (ConfigIsExisting("canBeSplit"))
8004 {
8007 }
8008
8010 if (ConfigIsExisting("itemBehaviour"))
8012
8013
8016 RegisterNetSyncVariableInt("m_VarLiquidType");
8017 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8018
8019 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8020 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8021 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8022
8023 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8024 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8025 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8026 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8027
8028 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8029 RegisterNetSyncVariableBool("m_IsTakeable");
8030 RegisterNetSyncVariableBool("m_IsHologram");
8031
8034 {
8037 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8038 }
8039
8041
8043 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8045
8047 }
8048
8050 {
8052 }
8053
8055 {
8058 {
8063 }
8064 }
8065
8066 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8067 {
8069 {
8072 }
8073
8075 }
8076
8078 {
8084 }
8085
8087
8089 {
8091
8092 if (!action)
8093 {
8094 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8095 return;
8096 }
8097
8099 if (!ai)
8100 {
8102 return;
8103 }
8104
8106 if (!action_array)
8107 {
8108 action_array = new array<ActionBase_Basic>;
8110 }
8111 if (LogManager.IsActionLogEnable())
8112 {
8113 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8114 }
8115
8116 if (action_array.Find(action) != -1)
8117 {
8118 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8119 }
8120 else
8121 {
8122 action_array.Insert(action);
8123 }
8124 }
8125
8127 {
8128 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8129 ActionBase action = player.GetActionManager().GetAction(actionName);
8132
8133 if (action_array)
8134 {
8135 action_array.RemoveItem(action);
8136 }
8137 }
8138
8139
8140
8142 {
8143 ActionOverrideData overrideData = new ActionOverrideData();
8147
8149 if (!actionMap)
8150 {
8153 }
8154
8155 actionMap.Insert(this.
Type(), overrideData);
8156
8157 }
8158
8160
8162
8163
8165 {
8168
8171
8172 string config_to_search = "CfgVehicles";
8173 string muzzle_owner_config;
8174
8176 {
8177 if (IsInherited(Weapon))
8178 config_to_search = "CfgWeapons";
8179
8180 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8181
8182 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8183
8184 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8185
8186 if (config_OnFire_subclass_count > 0)
8187 {
8188 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8189
8190 for (int i = 0; i < config_OnFire_subclass_count; i++)
8191 {
8192 string particle_class = "";
8193 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8194 string config_OnFire_entry = config_OnFire_class + particle_class;
8195 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8196 WPOF_array.Insert(WPOF);
8197 }
8198
8199
8201 }
8202 }
8203
8205 {
8206 config_to_search = "CfgWeapons";
8207 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8208
8209 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8210
8211 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8212
8213 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8214 {
8215 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8216
8217 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8218 {
8219 string particle_class2 = "";
8220 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8221 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8222 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8223 WPOBE_array.Insert(WPOBE);
8224 }
8225
8226
8228 }
8229 }
8230 }
8231
8232
8234 {
8237
8239 {
8240 string config_to_search = "CfgVehicles";
8241
8242 if (IsInherited(Weapon))
8243 config_to_search = "CfgWeapons";
8244
8245 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8246 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8247
8248 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8249 {
8250
8252
8254 {
8256 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8258 return;
8259 }
8260
8263
8264
8265
8266 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8267 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8268
8269 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8270 {
8271 string particle_class = "";
8272 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8273 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8274 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8275
8276 if (entry_type == CT_CLASS)
8277 {
8278 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8279 WPOOH_array.Insert(WPOF);
8280 }
8281 }
8282
8283
8285 }
8286 }
8287 }
8288
8290 {
8292 }
8293
8295 {
8297 {
8299
8302
8305
8306 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8307 }
8308 }
8309
8311 {
8313 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8314
8316 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8317
8319 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8320
8322 {
8324 }
8325 }
8326
8328 {
8330 }
8331
8333 {
8336 else
8338
8340 {
8343 }
8344 else
8345 {
8348
8351 }
8352
8354 }
8355
8357 {
8359 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8360 }
8361
8363 {
8365 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8367 }
8368
8370 {
8372 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8373 }
8374
8376 {
8379
8380 OverheatingParticle OP = new OverheatingParticle();
8385
8387 }
8388
8390 {
8393
8394 return -1;
8395 }
8396
8398 {
8400 {
8403
8404 for (int i = count; i > 0; --i)
8405 {
8406 int id = i - 1;
8409
8412
8413 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8414 {
8415 if (p)
8416 {
8419 }
8420 }
8421 }
8422 }
8423 }
8424
8426 {
8428 {
8430 {
8431 int id = i - 1;
8433
8434 if (OP)
8435 {
8437
8438 if (p)
8439 {
8441 }
8442
8443 delete OP;
8444 }
8445 }
8446
8449 }
8450 }
8451
8454 {
8455 return 0.0;
8456 }
8457
8458
8460 {
8461 return 250;
8462 }
8463
8465 {
8466 return 0;
8467 }
8468
8471 {
8473 return true;
8474
8475 return false;
8476 }
8477
8480 {
8483
8485 {
8487 }
8488 else
8489 {
8490
8492 }
8493
8495 }
8496
8503 {
8504 return -1;
8505 }
8506
8507
8508
8509
8511 {
8513 {
8514 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8515 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8516
8517 if (r_index >= 0)
8518 {
8519 InventoryLocation r_il = new InventoryLocation;
8520 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8521
8522 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8525 {
8526 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8527 }
8529 {
8530 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8531 }
8532
8533 }
8534
8535 player.GetHumanInventory().ClearUserReservedLocation(this);
8536 }
8537
8540 }
8541
8542
8543
8544
8546 {
8547 return ItemBase.m_DebugActionsMask;
8548 }
8549
8551 {
8552 return ItemBase.m_DebugActionsMask & mask;
8553 }
8554
8556 {
8557 ItemBase.m_DebugActionsMask = mask;
8558 }
8559
8561 {
8562 ItemBase.m_DebugActionsMask |= mask;
8563 }
8564
8566 {
8567 ItemBase.m_DebugActionsMask &= ~mask;
8568 }
8569
8571 {
8573 {
8575 }
8576 else
8577 {
8579 }
8580 }
8581
8582
8584 {
8585 if (GetEconomyProfile())
8586 {
8587 float q_max = GetEconomyProfile().GetQuantityMax();
8588 if (q_max > 0)
8589 {
8590 float q_min = GetEconomyProfile().GetQuantityMin();
8591 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8592
8594 {
8595 ComponentEnergyManager comp = GetCompEM();
8597 {
8599 }
8600 }
8602 {
8604
8605 }
8606
8607 }
8608 }
8609 }
8610
8613 {
8614 EntityAI parent = GetHierarchyParent();
8615
8616 if (parent)
8617 {
8618 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8619 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8620 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8621 }
8622 }
8623
8626 {
8627 EntityAI parent = GetHierarchyParent();
8628
8629 if (parent)
8630 {
8631 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8632 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8633 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8634 }
8635 }
8636
8638 {
8639
8640
8641
8642
8644
8646 {
8647 if (ScriptInputUserData.CanStoreInputUserData())
8648 {
8649 ScriptInputUserData ctx = new ScriptInputUserData;
8655 ctx.
Write(use_stack_max);
8658
8660 {
8661 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8662 }
8663 }
8664 }
8665 else if (!
g_Game.IsMultiplayer())
8666 {
8668 }
8669 }
8670
8672 {
8674 }
8675
8677 {
8679 }
8680
8682 {
8684 }
8685
8687 {
8688
8689 return false;
8690 }
8691
8693 {
8694 return false;
8695 }
8696
8700 {
8701 return false;
8702 }
8703
8705 {
8706 return "";
8707 }
8708
8710
8712 {
8713 return false;
8714 }
8715
8717 {
8718 return true;
8719 }
8720
8721
8722
8724 {
8725 return true;
8726 }
8727
8729 {
8730 return true;
8731 }
8732
8734 {
8735 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8737 }
8738
8740 {
8742 }
8743
8745 {
8747 if (!is_being_placed)
8749 SetSynchDirty();
8750 }
8751
8752
8754
8756 {
8758 }
8759
8761 {
8763 }
8764
8766 {
8767 return 1;
8768 }
8769
8771 {
8772 return false;
8773 }
8774
8776 {
8778 SetSynchDirty();
8779 }
8780
8781
8782
8783
8784
8785
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8816 {
8817 super.OnMovedInsideCargo(container);
8818
8819 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8820 }
8821
8822 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8823 {
8824 super.EEItemLocationChanged(oldLoc, newLoc);
8825
8826 PlayerBase newPlayer = null;
8827 PlayerBase oldPlayer = null;
8828
8829 if (newLoc.GetParent())
8830 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8831
8832 if (oldLoc.GetParent())
8833 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8834
8836 {
8837 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8838
8839 if (rIndex >= 0)
8840 {
8841 InventoryLocation rIl = new InventoryLocation;
8842 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8843
8844 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8847 {
8848 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8849 }
8851 {
8853 }
8854
8855 }
8856 }
8857
8859 {
8860 if (newPlayer)
8861 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8862
8863 if (newPlayer == oldPlayer)
8864 {
8865 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8866 {
8868 {
8869 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8870 {
8871 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8872 }
8873 }
8874 else
8875 {
8876 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8877 }
8878 }
8879
8880 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8881 {
8882 int type = oldLoc.GetType();
8884 {
8885 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8886 }
8888 {
8889 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8890 }
8891 }
8892 if (!m_OldLocation)
8893 {
8894 m_OldLocation = new InventoryLocation;
8895 }
8896 m_OldLocation.Copy(oldLoc);
8897 }
8898 else
8899 {
8900 if (m_OldLocation)
8901 {
8902 m_OldLocation.Reset();
8903 }
8904 }
8905
8906 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8907 }
8908 else
8909 {
8910 if (newPlayer)
8911 {
8912 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8913 if (resIndex >= 0)
8914 {
8915 InventoryLocation il = new InventoryLocation;
8916 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8918 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8921 {
8922 il.
GetParent().GetOnReleaseLock().Invoke(it);
8923 }
8925 {
8927 }
8928
8929 }
8930 }
8932 {
8933
8935 }
8936
8937 if (m_OldLocation)
8938 {
8939 m_OldLocation.Reset();
8940 }
8941 }
8942
8944 {
8945 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8946 }
8947
8949 {
8950 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8951 }
8952 }
8953
8954 override void EOnContact(IEntity other, Contact extra)
8955 {
8957 {
8958 int liquidType = -1;
8960 if (impactSpeed > 0.0)
8961 {
8963 #ifndef SERVER
8965 #else
8967 SetSynchDirty();
8968 #endif
8970 }
8971 }
8972
8973 #ifdef SERVER
8974 if (GetCompEM() && GetCompEM().IsPlugged())
8975 {
8976 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8977 GetCompEM().UnplugThis();
8978 }
8979 #endif
8980 }
8981
8983
8985 {
8987 }
8988
8990 {
8991
8992 }
8993
8995 {
8996 super.OnItemLocationChanged(old_owner, new_owner);
8997
8998 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8999 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9000
9001 if (!relatedPlayer && playerNew)
9002 relatedPlayer = playerNew;
9003
9004 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9005 {
9007 if (actionMgr)
9008 {
9009 ActionBase currentAction = actionMgr.GetRunningAction();
9010 if (currentAction)
9012 }
9013 }
9014
9015 Man ownerPlayerOld = null;
9016 Man ownerPlayerNew = null;
9017
9018 if (old_owner)
9019 {
9020 if (old_owner.
IsMan())
9021 {
9022 ownerPlayerOld = Man.Cast(old_owner);
9023 }
9024 else
9025 {
9026 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9027 }
9028 }
9029 else
9030 {
9032 {
9034
9035 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9036 {
9037 GetCompEM().UnplugThis();
9038 }
9039 }
9040 }
9041
9042 if (new_owner)
9043 {
9044 if (new_owner.
IsMan())
9045 {
9046 ownerPlayerNew = Man.Cast(new_owner);
9047 }
9048 else
9049 {
9050 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9051 }
9052 }
9053
9054 if (ownerPlayerOld != ownerPlayerNew)
9055 {
9056 if (ownerPlayerOld)
9057 {
9058 array<EntityAI> subItemsExit = new array<EntityAI>;
9060 for (int i = 0; i < subItemsExit.Count(); i++)
9061 {
9064 }
9065 }
9066
9067 if (ownerPlayerNew)
9068 {
9069 array<EntityAI> subItemsEnter = new array<EntityAI>;
9071 for (int j = 0; j < subItemsEnter.Count(); j++)
9072 {
9075 }
9076 }
9077 }
9078 else if (ownerPlayerNew != null)
9079 {
9080 PlayerBase nplayer;
9081 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9082 {
9083 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9085 for (int k = 0; k < subItemsUpdate.Count(); k++)
9086 {
9088 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9089 }
9090 }
9091 }
9092
9093 if (old_owner)
9094 old_owner.OnChildItemRemoved(this);
9095 if (new_owner)
9096 new_owner.OnChildItemReceived(this);
9097 }
9098
9099
9101 {
9102 super.EEDelete(parent);
9103 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9104 if (player)
9105 {
9107
9108 if (player.IsAlive())
9109 {
9110 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9111 if (r_index >= 0)
9112 {
9113 InventoryLocation r_il = new InventoryLocation;
9114 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9115
9116 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9119 {
9120 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9121 }
9123 {
9124 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9125 }
9126
9127 }
9128
9129 player.RemoveQuickBarEntityShortcut(this);
9130 }
9131 }
9132 }
9133
9135 {
9136 super.EEKilled(killer);
9137
9140 {
9141 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9142 {
9143 if (IsMagazine())
9144 {
9145 if (Magazine.Cast(this).GetAmmoCount() > 0)
9146 {
9148 }
9149 }
9150 else
9151 {
9153 }
9154 }
9155 }
9156 }
9157
9159 {
9160 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9161
9162 super.OnWasAttached(parent, slot_id);
9163
9166
9169 }
9170
9172 {
9173 super.OnWasDetached(parent, slot_id);
9174
9177
9180 }
9181
9183 {
9184 int idx;
9187
9188 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9189 if (inventory_slots.Count() < 1)
9190 {
9191 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9192 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9193 }
9194 else
9195 {
9196 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9197 }
9198
9199 idx = inventory_slots.Find(slot);
9200 if (idx < 0)
9201 return "";
9202
9203 return attach_types.Get(idx);
9204 }
9205
9207 {
9208 int idx = -1;
9209 string slot;
9210
9213
9214 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9215 if (inventory_slots.Count() < 1)
9216 {
9217 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9218 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9219 }
9220 else
9221 {
9222 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9223 if (detach_types.Count() < 1)
9224 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9225 }
9226
9227 for (int i = 0; i < inventory_slots.Count(); i++)
9228 {
9229 slot = inventory_slots.Get(i);
9230 }
9231
9232 if (slot != "")
9233 {
9234 if (detach_types.Count() == 1)
9235 idx = 0;
9236 else
9237 idx = inventory_slots.Find(slot);
9238 }
9239 if (idx < 0)
9240 return "";
9241
9242 return detach_types.Get(idx);
9243 }
9244
9246 {
9247
9249
9250
9251 float min_time = 1;
9252 float max_time = 3;
9253 float delay = Math.RandomFloat(min_time, max_time);
9254
9255 explode_timer.Run(delay, this, "DoAmmoExplosion");
9256 }
9257
9259 {
9260 Magazine magazine = Magazine.Cast(this);
9261 int pop_sounds_count = 6;
9262 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9263
9264
9265 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9266 string sound_name = pop_sounds[ sound_idx ];
9267 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9268
9269
9270 magazine.ServerAddAmmoCount(-1);
9271
9272
9273 float min_temp_to_explode = 100;
9274
9275 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9276 {
9278 }
9279 }
9280
9281
9282 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9283 {
9284 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9285
9286 const int CHANCE_DAMAGE_CARGO = 4;
9287 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9288 const int CHANCE_DAMAGE_NOTHING = 2;
9289
9291 {
9292 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9293 int chances;
9294 int rnd;
9295
9296 if (GetInventory().GetCargo())
9297 {
9298 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9299 rnd = Math.RandomInt(0,chances);
9300
9301 if (rnd < CHANCE_DAMAGE_CARGO)
9302 {
9304 }
9305 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9306 {
9308 }
9309 }
9310 else
9311 {
9312 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9313 rnd = Math.RandomInt(0,chances);
9314
9315 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9316 {
9318 }
9319 }
9320 }
9321 }
9322
9324 {
9325 CargoBase cargo = GetInventory().GetCargo();
9326 if (cargo)
9327 {
9329 if (item_count > 0)
9330 {
9331 int random_pick = Math.RandomInt(0, item_count);
9333 if (!item.IsExplosive())
9334 {
9335 item.AddHealth("","",damage);
9336 return true;
9337 }
9338 }
9339 }
9340 return false;
9341 }
9342
9344 {
9345 GameInventory inventory = GetInventory();
9347 if (attachment_count > 0)
9348 {
9349 int random_pick = Math.RandomInt(0, attachment_count);
9351 if (!attachment.IsExplosive())
9352 {
9353 attachment.AddHealth("","",damage);
9354 return true;
9355 }
9356 }
9357 return false;
9358 }
9359
9361 {
9363 }
9364
9366 {
9368 return GetInventory().CanRemoveEntity();
9369
9370 return false;
9371 }
9372
9374 {
9375
9377 return false;
9378
9379
9381 return false;
9382
9383
9384
9386 if (delta == 0)
9387 return false;
9388
9389
9390 return true;
9391 }
9392
9394 {
9396 {
9397 if (ScriptInputUserData.CanStoreInputUserData())
9398 {
9399 ScriptInputUserData ctx = new ScriptInputUserData;
9404 ctx.
Write(destination_entity);
9408 }
9409 }
9410 else if (!
g_Game.IsMultiplayer())
9411 {
9413 }
9414 }
9415
9417 {
9418 float split_quantity_new;
9422 InventoryLocation loc = new InventoryLocation;
9423
9424 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9425 {
9427 split_quantity_new = stack_max;
9428 else
9430
9432 {
9433 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9434 if (new_item)
9435 {
9436 new_item.SetResultOfSplit(true);
9437 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9439 new_item.
SetQuantity(split_quantity_new,
false,
true);
9440 }
9441 }
9442 }
9443 else if (destination_entity && slot_id == -1)
9444 {
9445 if (quantity > stack_max)
9446 split_quantity_new = stack_max;
9447 else
9448 split_quantity_new = quantity;
9449
9451 {
9452 GameInventory destinationInventory = destination_entity.GetInventory();
9454 {
9457 }
9458
9459 if (new_item)
9460 {
9461 new_item.SetResultOfSplit(true);
9462 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9464 new_item.
SetQuantity(split_quantity_new,
false,
true);
9465 }
9466 }
9467 }
9468 else
9469 {
9470 if (stack_max != 0)
9471 {
9473 {
9475 }
9476
9477 if (split_quantity_new == 0)
9478 {
9479 if (!
g_Game.IsMultiplayer())
9480 player.PhysicalPredictiveDropItem(this);
9481 else
9482 player.ServerDropEntity(this);
9483 return;
9484 }
9485
9487 {
9489
9490 if (new_item)
9491 {
9492 new_item.SetResultOfSplit(true);
9493 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9496 new_item.PlaceOnSurface();
9497 }
9498 }
9499 }
9500 }
9501 }
9502
9504 {
9505 float split_quantity_new;
9509 InventoryLocation loc = new InventoryLocation;
9510
9511 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9512 {
9514 split_quantity_new = stack_max;
9515 else
9517
9519 {
9520 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9521 if (new_item)
9522 {
9523 new_item.SetResultOfSplit(true);
9524 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9526 new_item.
SetQuantity(split_quantity_new,
false,
true);
9527 }
9528 }
9529 }
9530 else if (destination_entity && slot_id == -1)
9531 {
9532 if (quantity > stack_max)
9533 split_quantity_new = stack_max;
9534 else
9535 split_quantity_new = quantity;
9536
9538 {
9539 GameInventory destinationInventory = destination_entity.GetInventory();
9541 {
9544 }
9545
9546 if (new_item)
9547 {
9548 new_item.SetResultOfSplit(true);
9549 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9551 new_item.
SetQuantity(split_quantity_new,
false,
true);
9552 }
9553 }
9554 }
9555 else
9556 {
9557 if (stack_max != 0)
9558 {
9560 {
9562 }
9563
9565 {
9567
9568 if (new_item)
9569 {
9570 new_item.SetResultOfSplit(true);
9571 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9574 new_item.PlaceOnSurface();
9575 }
9576 }
9577 }
9578 }
9579 }
9580
9582 {
9584 {
9585 if (ScriptInputUserData.CanStoreInputUserData())
9586 {
9587 ScriptInputUserData ctx = new ScriptInputUserData;
9592 dst.WriteToContext(ctx);
9594 }
9595 }
9596 else if (!
g_Game.IsMultiplayer())
9597 {
9599 }
9600 }
9601
9603 {
9605 {
9606 if (ScriptInputUserData.CanStoreInputUserData())
9607 {
9608 ScriptInputUserData ctx = new ScriptInputUserData;
9613 ctx.
Write(destination_entity);
9619 }
9620 }
9621 else if (!
g_Game.IsMultiplayer())
9622 {
9624 }
9625 }
9626
9628 {
9630 }
9631
9633 {
9635 float split_quantity_new;
9637 if (dst.IsValid())
9638 {
9639 int slot_id = dst.GetSlot();
9641
9642 if (quantity > stack_max)
9643 split_quantity_new = stack_max;
9644 else
9645 split_quantity_new = quantity;
9646
9648 {
9650
9651 if (new_item)
9652 {
9653 new_item.SetResultOfSplit(true);
9654 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9656 new_item.
SetQuantity(split_quantity_new,
false,
true);
9657 }
9658
9659 return new_item;
9660 }
9661 }
9662
9663 return null;
9664 }
9665
9667 {
9669 float split_quantity_new;
9671 if (destination_entity)
9672 {
9674 if (quantity > stackable)
9675 split_quantity_new = stackable;
9676 else
9677 split_quantity_new = quantity;
9678
9680 {
9681 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9682 if (new_item)
9683 {
9684 new_item.SetResultOfSplit(true);
9685 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9687 new_item.
SetQuantity(split_quantity_new,
false,
true);
9688 }
9689 }
9690 }
9691 }
9692
9694 {
9696 {
9697 if (ScriptInputUserData.CanStoreInputUserData())
9698 {
9699 ScriptInputUserData ctx = new ScriptInputUserData;
9704 ItemBase destination_entity =
this;
9705 ctx.
Write(destination_entity);
9709 }
9710 }
9711 else if (!
g_Game.IsMultiplayer())
9712 {
9714 }
9715 }
9716
9718 {
9720 float split_quantity_new;
9722 if (player)
9723 {
9725 if (quantity > stackable)
9726 split_quantity_new = stackable;
9727 else
9728 split_quantity_new = quantity;
9729
9731 {
9732 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9733 new_item =
ItemBase.Cast(in_hands);
9734 if (new_item)
9735 {
9736 new_item.SetResultOfSplit(true);
9737 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9739 new_item.SetQuantity(split_quantity_new, false, true);
9740 }
9741 }
9742 }
9743 }
9744
9746 {
9748 float split_quantity_new = Math.Floor(quantity * 0.5);
9749
9751 return;
9752
9754
9755 if (new_item)
9756 {
9757 if (new_item.GetQuantityMax() < split_quantity_new)
9758 {
9759 split_quantity_new = new_item.GetQuantityMax();
9760 }
9761
9762 new_item.SetResultOfSplit(true);
9763 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9764
9766 {
9769 }
9770 else
9771 {
9773 new_item.
SetQuantity(split_quantity_new,
false,
true);
9774 }
9775 }
9776 }
9777
9779 {
9781 float split_quantity_new = Math.Floor(quantity / 2);
9782
9784 return;
9785
9786 InventoryLocation invloc = new InventoryLocation;
9788
9790 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9791
9792 if (new_item)
9793 {
9794 if (new_item.GetQuantityMax() < split_quantity_new)
9795 {
9796 split_quantity_new = new_item.GetQuantityMax();
9797 }
9799 {
9802 }
9803 else if (split_quantity_new > 1)
9804 {
9806 new_item.
SetQuantity(split_quantity_new,
false,
true);
9807 }
9808 }
9809 }
9810
9813 {
9814 SetWeightDirty();
9816
9817 if (parent)
9818 parent.OnAttachmentQuantityChangedEx(this, delta);
9819
9821 {
9823 {
9825 }
9827 {
9828 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9830 }
9831 }
9832 }
9833
9836 {
9837
9838 }
9839
9842 {
9844 }
9845
9847 {
9848 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9849
9851 {
9852 if (newLevel == GameConstants.STATE_RUINED)
9853 {
9855 EntityAI parent = GetHierarchyParent();
9856 if (parent && parent.IsFireplace())
9857 {
9858 CargoBase cargo = GetInventory().GetCargo();
9859 if (cargo)
9860 {
9862 {
9864 }
9865 }
9866 }
9867 }
9868
9870 {
9871
9873 return;
9874 }
9875
9876 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9877 {
9879 }
9880 }
9881 }
9882
9883
9885 {
9886 super.OnRightClick();
9887
9889 {
9891 {
9892 if (ScriptInputUserData.CanStoreInputUserData())
9893 {
9894 EntityAI root = GetHierarchyRoot();
9895 Man playerOwner = GetHierarchyRootPlayer();
9896 InventoryLocation dst = new InventoryLocation;
9897
9898
9899 if (!playerOwner && root && root == this)
9900 {
9902 }
9903 else
9904 {
9905
9906 GetInventory().GetCurrentInventoryLocation(dst);
9908 {
9909 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9911 {
9913 }
9914 else
9915 {
9917
9918
9919 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9920 {
9922 }
9923 else
9924 {
9925 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9926 }
9927 }
9928 }
9929 }
9930
9931 ScriptInputUserData ctx = new ScriptInputUserData;
9939 }
9940 }
9941 else if (!
g_Game.IsMultiplayer())
9942 {
9944 }
9945 }
9946 }
9947
9949 {
9950 if (root)
9951 {
9952 vector m4[4];
9953 root.GetTransform(m4);
9954 dst.SetGround(this, m4);
9955 }
9956 else
9957 {
9958 GetInventory().GetCurrentInventoryLocation(dst);
9959 }
9960 }
9961
9962 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9963 {
9964
9965 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9966 return false;
9967
9968 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9969 return false;
9970
9971
9973 return false;
9974
9975
9976 Magazine mag = Magazine.Cast(this);
9977 if (mag)
9978 {
9979 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9980 return false;
9981
9982 if (stack_max_limit)
9983 {
9984 Magazine other_mag = Magazine.Cast(other_item);
9985 if (other_item)
9986 {
9987 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9988 return false;
9989 }
9990
9991 }
9992 }
9993 else
9994 {
9995
9997 return false;
9998
10000 return false;
10001 }
10002
10003 PlayerBase player = null;
10004 if (CastTo(player, GetHierarchyRootPlayer()))
10005 {
10006 if (player.GetInventory().HasAttachment(this))
10007 return false;
10008
10009 if (player.IsItemsToDelete())
10010 return false;
10011 }
10012
10013 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10014 return false;
10015
10016 int slotID;
10018 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10019 return false;
10020
10021 return true;
10022 }
10023
10025 {
10027 }
10028
10030 {
10031 return m_IsResultOfSplit;
10032 }
10033
10035 {
10036 m_IsResultOfSplit = value;
10037 }
10038
10040 {
10042 }
10043
10045 {
10046 float other_item_quantity = other_item.GetQuantity();
10047 float this_free_space;
10048
10050
10052
10053 if (other_item_quantity > this_free_space)
10054 {
10055 return this_free_space;
10056 }
10057 else
10058 {
10059 return other_item_quantity;
10060 }
10061 }
10062
10064 {
10066 }
10067
10069 {
10071 return;
10072
10073 if (!IsMagazine() && other_item)
10074 {
10076 if (quantity_used != 0)
10077 {
10078 float hp1 = GetHealth01("","");
10079 float hp2 = other_item.GetHealth01("","");
10080 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10081 hpResult = hpResult / (
GetQuantity() + quantity_used);
10082
10083 hpResult *= GetMaxHealth();
10084 Math.Round(hpResult);
10085 SetHealth("", "Health", hpResult);
10086
10088 other_item.AddQuantity(-quantity_used);
10089 }
10090 }
10092 }
10093
10095 {
10096 #ifdef SERVER
10097 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10098 GetHierarchyParent().IncreaseLifetimeUp();
10099 #endif
10100 };
10101
10103 {
10104 PlayerBase p = PlayerBase.Cast(player);
10105
10106 array<int> recipesIds = p.m_Recipes;
10107 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10108 if (moduleRecipesManager)
10109 {
10110 EntityAI itemInHands = player.GetEntityInHands();
10111 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10112 }
10113
10114 for (int i = 0;i < recipesIds.Count(); i++)
10115 {
10116 int key = recipesIds.Get(i);
10117 string recipeName = moduleRecipesManager.GetRecipeName(key);
10119 }
10120 }
10121
10122
10123 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10124 {
10125 super.GetDebugActions(outputList);
10126
10127
10133
10134
10139
10144
10145
10149
10150
10152 {
10156 }
10157
10160
10161
10165
10167
10168 InventoryLocation loc = new InventoryLocation();
10169 GetInventory().GetCurrentInventoryLocation(loc);
10171 {
10172 if (Gizmo_IsSupported())
10175 }
10176
10178 }
10179
10180
10181
10182
10184 {
10185 super.OnAction(action_id, player, ctx);
10186
10188 {
10189 switch (action_id)
10190 {
10194 return true;
10198 return true;
10199 }
10200 }
10201
10203 {
10204 switch (action_id)
10205 {
10207 Delete();
10208 return true;
10209 }
10210 }
10211
10212 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10213 {
10214 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10215 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10216 PlayerBase p = PlayerBase.Cast(player);
10217 if (
EActions.RECIPES_RANGE_START < 1000)
10218 {
10219 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10220 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10221 }
10222 }
10223 #ifndef SERVER
10224 else if (action_id ==
EActions.WATCH_PLAYER)
10225 {
10226 PluginDeveloper.SetDeveloperItemClientEx(player);
10227 }
10228 #endif
10230 {
10231 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10232 {
10233 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10234 OnDebugButtonPressServer(id + 1);
10235 }
10236
10237 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10238 {
10239 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10241 }
10242
10243 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10244 {
10245 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10247 }
10248
10249 else if (action_id ==
EActions.ADD_QUANTITY)
10250 {
10251 if (IsMagazine())
10252 {
10253 Magazine mag = Magazine.Cast(this);
10254 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10255 }
10256 else
10257 {
10259 }
10260
10261 if (m_EM)
10262 {
10263 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10264 }
10265
10266 }
10267
10268 else if (action_id ==
EActions.REMOVE_QUANTITY)
10269 {
10270 if (IsMagazine())
10271 {
10272 Magazine mag2 = Magazine.Cast(this);
10273 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10274 }
10275 else
10276 {
10278 }
10279 if (m_EM)
10280 {
10281 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10282 }
10283
10284 }
10285
10286 else if (action_id ==
EActions.SET_QUANTITY_0)
10287 {
10289
10290 if (m_EM)
10291 {
10292 m_EM.SetEnergy(0);
10293 }
10294 }
10295
10296 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10297 {
10299
10300 if (m_EM)
10301 {
10302 m_EM.SetEnergy(m_EM.GetEnergyMax());
10303 }
10304 }
10305
10306 else if (action_id ==
EActions.ADD_HEALTH)
10307 {
10308 AddHealth("","",GetMaxHealth("","Health")/5);
10309 }
10310 else if (action_id ==
EActions.REMOVE_HEALTH)
10311 {
10312 AddHealth("","",-GetMaxHealth("","Health")/5);
10313 }
10314 else if (action_id ==
EActions.DESTROY_HEALTH)
10315 {
10316 SetHealth01("","",0);
10317 }
10318 else if (action_id ==
EActions.WATCH_ITEM)
10319 {
10321 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10322 #ifdef DEVELOPER
10323 SetDebugDeveloper_item(this);
10324 #endif
10325 }
10326
10327 else if (action_id ==
EActions.ADD_TEMPERATURE)
10328 {
10329 AddTemperature(20);
10330
10331 }
10332
10333 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10334 {
10335 AddTemperature(-20);
10336
10337 }
10338
10339 else if (action_id ==
EActions.FLIP_FROZEN)
10340 {
10341 SetFrozen(!GetIsFrozen());
10342
10343 }
10344
10345 else if (action_id ==
EActions.ADD_WETNESS)
10346 {
10348
10349 }
10350
10351 else if (action_id ==
EActions.REMOVE_WETNESS)
10352 {
10354
10355 }
10356
10357 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10358 {
10361
10362
10363 }
10364
10365 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10366 {
10369 }
10370
10371 else if (action_id ==
EActions.MAKE_SPECIAL)
10372 {
10373 auto debugParams = DebugSpawnParams.WithPlayer(player);
10374 OnDebugSpawnEx(debugParams);
10375 }
10376
10377 }
10378
10379
10380 return false;
10381 }
10382
10383
10384
10385
10389
10392
10393
10394
10396 {
10397 return false;
10398 }
10399
10400
10402 {
10403 return true;
10404 }
10405
10406
10408 {
10409 return true;
10410 }
10411
10412
10413
10415 {
10416 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10417 return g_Game.ConfigIsExisting(config_path);
10418 }
10419
10422 {
10423 return null;
10424 }
10425
10427 {
10428 return false;
10429 }
10430
10432 {
10433 return false;
10434 }
10435
10439
10440
10442 {
10443 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10444 return module_repairing.CanRepair(this, item_repair_kit);
10445 }
10446
10447
10448 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10449 {
10450 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10451 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10452 }
10453
10454
10456 {
10457
10458
10459
10460
10461
10462
10463
10464
10465 return 1;
10466 }
10467
10468
10469
10471 {
10473 }
10474
10475
10476
10478 {
10480 }
10481
10482
10491 {
10492 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10493
10494 if (player)
10495 {
10496 player.MessageStatus(text);
10497 }
10498 }
10499
10500
10509 {
10510 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10511
10512 if (player)
10513 {
10514 player.MessageAction(text);
10515 }
10516 }
10517
10518
10527 {
10528 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10529
10530 if (player)
10531 {
10532 player.MessageFriendly(text);
10533 }
10534 }
10535
10536
10545 {
10546 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10547
10548 if (player)
10549 {
10550 player.MessageImportant(text);
10551 }
10552 }
10553
10555 {
10556 return true;
10557 }
10558
10559
10560 override bool KindOf(
string tag)
10561 {
10562 bool found = false;
10563 string item_name = this.
GetType();
10565 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10566
10567 int array_size = item_tag_array.Count();
10568 for (int i = 0; i < array_size; i++)
10569 {
10570 if (item_tag_array.Get(i) == tag)
10571 {
10572 found = true;
10573 break;
10574 }
10575 }
10576 return found;
10577 }
10578
10579
10581 {
10582
10583 super.OnRPC(sender, rpc_type,ctx);
10584
10585
10586 switch (rpc_type)
10587 {
10588 #ifndef SERVER
10589 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10590 Param2<bool, string> p = new Param2<bool, string>(false, "");
10591
10593 return;
10594
10595 bool play = p.param1;
10596 string soundSet = p.param2;
10597
10598 if (play)
10599 {
10601 {
10603 {
10605 }
10606 }
10607 else
10608 {
10610 }
10611 }
10612 else
10613 {
10615 }
10616
10617 break;
10618 #endif
10619
10620 }
10621
10623 {
10625 }
10626 }
10627
10628
10629
10630
10632 {
10633 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10634 return plugin.GetID(
name);
10635 }
10636
10638 {
10639 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10640 return plugin.GetName(id);
10641 }
10642
10645 {
10646
10647
10648 int varFlags;
10649 if (!ctx.
Read(varFlags))
10650 return;
10651
10652 if (varFlags & ItemVariableFlags.FLOAT)
10653 {
10655 }
10656 }
10657
10659 {
10660
10661 super.SerializeNumericalVars(floats_out);
10662
10663
10664
10666 {
10668 }
10669
10671 {
10673 }
10674
10676 {
10678 }
10679
10681 {
10686 }
10687
10689 {
10691 }
10692 }
10693
10695 {
10696
10697 super.DeSerializeNumericalVars(floats);
10698
10699
10700 int index = 0;
10701 int mask = Math.Round(floats.Get(index));
10702
10703 index++;
10704
10706 {
10708 {
10710 }
10711 else
10712 {
10713 float quantity = floats.Get(index);
10714 SetQuantity(quantity,
true,
false,
false,
false);
10715 }
10716 index++;
10717 }
10718
10720 {
10721 float wet = floats.Get(index);
10723 index++;
10724 }
10725
10727 {
10728 int liquidtype = Math.Round(floats.Get(index));
10730 index++;
10731 }
10732
10734 {
10736 index++;
10738 index++;
10740 index++;
10742 index++;
10743 }
10744
10746 {
10747 int cleanness = Math.Round(floats.Get(index));
10749 index++;
10750 }
10751 }
10752
10754 {
10755 super.WriteVarsToCTX(ctx);
10756
10757
10759 {
10761 }
10762
10764 {
10766 }
10767
10769 {
10771 }
10772
10774 {
10775 int r,g,b,a;
10781 }
10782
10784 {
10786 }
10787 }
10788
10790 {
10791 if (!super.ReadVarsFromCTX(ctx,version))
10792 return false;
10793
10794 int intValue;
10795 float value;
10796
10797 if (version < 140)
10798 {
10799 if (!ctx.
Read(intValue))
10800 return false;
10801
10802 m_VariablesMask = intValue;
10803 }
10804
10806 {
10807 if (!ctx.
Read(value))
10808 return false;
10809
10811 {
10813 }
10814 else
10815 {
10817 }
10818 }
10819
10820 if (version < 140)
10821 {
10823 {
10824 if (!ctx.
Read(value))
10825 return false;
10826 SetTemperatureDirect(value);
10827 }
10828 }
10829
10831 {
10832 if (!ctx.
Read(value))
10833 return false;
10835 }
10836
10838 {
10839 if (!ctx.
Read(intValue))
10840 return false;
10842 }
10843
10845 {
10846 int r,g,b,a;
10848 return false;
10850 return false;
10852 return false;
10854 return false;
10855
10857 }
10858
10860 {
10861 if (!ctx.
Read(intValue))
10862 return false;
10864 }
10865
10866 if (version >= 138 && version < 140)
10867 {
10869 {
10870 if (!ctx.
Read(intValue))
10871 return false;
10872 SetFrozen(intValue);
10873 }
10874 }
10875
10876 return true;
10877 }
10878
10879
10881 {
10884 {
10886 }
10887
10888 if (!super.OnStoreLoad(ctx, version))
10889 {
10891 return false;
10892 }
10893
10894 if (version >= 114)
10895 {
10896 bool hasQuickBarIndexSaved;
10897
10898 if (!ctx.
Read(hasQuickBarIndexSaved))
10899 {
10901 return false;
10902 }
10903
10904 if (hasQuickBarIndexSaved)
10905 {
10906 int itmQBIndex;
10907
10908
10909 if (!ctx.
Read(itmQBIndex))
10910 {
10912 return false;
10913 }
10914
10915 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10916 if (itmQBIndex != -1 && parentPlayer)
10917 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10918 }
10919 }
10920 else
10921 {
10922
10923 PlayerBase player;
10924 int itemQBIndex;
10925 if (version ==
int.
MAX)
10926 {
10927 if (!ctx.
Read(itemQBIndex))
10928 {
10930 return false;
10931 }
10932 }
10933 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10934 {
10935
10936 if (!ctx.
Read(itemQBIndex))
10937 {
10939 return false;
10940 }
10941 if (itemQBIndex != -1 && player)
10942 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10943 }
10944 }
10945
10946 if (version < 140)
10947 {
10948
10949 if (!LoadVariables(ctx, version))
10950 {
10952 return false;
10953 }
10954 }
10955
10956
10958 {
10960 return false;
10961 }
10962 if (version >= 132)
10963 {
10965 if (raib)
10966 {
10968 {
10970 return false;
10971 }
10972 }
10973 }
10974
10976 return true;
10977 }
10978
10979
10980
10982 {
10983 super.OnStoreSave(ctx);
10984
10985 PlayerBase player;
10986 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10987 {
10989
10990 int itemQBIndex = -1;
10991 itemQBIndex = player.FindQuickBarEntityIndex(this);
10992 ctx.
Write(itemQBIndex);
10993 }
10994 else
10995 {
10997 }
10998
11000
11002 if (raib)
11003 {
11005 }
11006 }
11007
11008
11010 {
11011 super.AfterStoreLoad();
11012
11014 {
11016 }
11017
11019 {
11022 }
11023 }
11024
11026 {
11027 super.EEOnAfterLoad();
11028
11030 {
11032 }
11033
11036 }
11037
11039 {
11040 return false;
11041 }
11042
11043
11044
11046 {
11048 {
11049 #ifdef PLATFORM_CONSOLE
11050
11052 {
11054 if (menu)
11055 {
11057 }
11058 }
11059 #endif
11060 }
11061
11063 {
11066 }
11067
11069 {
11070 SetWeightDirty();
11072 }
11074 {
11077 }
11078
11080 {
11083
11086 }
11088 {
11092 }
11093
11094 super.OnVariablesSynchronized();
11095 }
11096
11097
11098
11100 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11101 {
11102 if (!IsServerCheck(allow_client))
11103 return false;
11104
11106 return false;
11107
11110
11111 if (value <= (min + 0.001))
11112 value = min;
11113
11114 if (value == min)
11115 {
11116 if (destroy_config)
11117 {
11118 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11119 if (dstr)
11120 {
11122 this.Delete();
11123 return true;
11124 }
11125 }
11126 else if (destroy_forced)
11127 {
11129 this.Delete();
11130 return true;
11131 }
11132
11134 }
11135
11138
11140 {
11141 EntityAI parent = GetHierarchyRoot();
11142 InventoryLocation iLoc = new InventoryLocation();
11143 GetInventory().GetCurrentInventoryLocation(iLoc);
11145 {
11146 int iLocSlot = iLoc.
GetSlot();
11148 {
11150 }
11152 {
11154 }
11155 }
11156 }
11157
11159 {
11161
11162 if (delta)
11164 }
11165
11167
11168 return false;
11169 }
11170
11171
11173 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11174 {
11176 }
11177
11179 {
11182 }
11183
11185 {
11188 }
11189
11191 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11192 {
11193 float value_clamped = Math.Clamp(value, 0, 1);
11195 SetQuantity(result, destroy_config, destroy_forced);
11196 }
11197
11198
11201 {
11203 }
11204
11206 {
11208 }
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11220 {
11221 int slot = -1;
11222 GameInventory inventory = GetInventory();
11223 if (inventory)
11224 {
11225 InventoryLocation il = new InventoryLocation;
11228 }
11229
11231 }
11232
11234 {
11235 float quantity_max = 0;
11236
11238 {
11239 if (attSlotID != -1)
11240 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11241
11242 if (quantity_max <= 0)
11244 }
11245
11246 if (quantity_max <= 0)
11248
11249 return quantity_max;
11250 }
11251
11253 {
11255 }
11256
11258 {
11260 }
11261
11262
11264 {
11266 }
11267
11269 {
11271 }
11272
11274 {
11276 }
11277
11278
11280 {
11281
11282 float weightEx = GetWeightEx();
11283 float special = GetInventoryAndCargoWeight();
11284 return weightEx - special;
11285 }
11286
11287
11289 {
11291 }
11292
11294 {
11296 {
11297 #ifdef DEVELOPER
11298 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11299 {
11300 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11302 }
11303 #endif
11304
11305 return GetQuantity() * GetConfigWeightModified();
11306 }
11307 else if (HasEnergyManager())
11308 {
11309 #ifdef DEVELOPER
11310 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11311 {
11312 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11313 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11314 }
11315 #endif
11316 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11317 }
11318 else
11319 {
11320 #ifdef DEVELOPER
11321 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11322 {
11323 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11324 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11325 }
11326 #endif
11327 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11328 }
11329 }
11330
11333 {
11334 int item_count = 0;
11336
11337 GameInventory inventory = GetInventory();
11338 CargoBase cargo = inventory.
GetCargo();
11339 if (cargo != NULL)
11340 {
11342 }
11343
11345 for (int i = 0; i < nAttachments; ++i)
11346 {
11348 if (item)
11349 item_count += item.GetNumberOfItems();
11350 }
11351 return item_count;
11352 }
11353
11356 {
11357 float weight = 0;
11358 float wetness = 1;
11359 if (include_wetness)
11362 {
11363 weight = wetness * m_ConfigWeight;
11364 }
11366 {
11367 weight = 1;
11368 }
11369 return weight;
11370 }
11371
11372
11373
11375 {
11376 GameInventory inventory = GetInventory();
11377 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11378 {
11379 array<EntityAI> items = new array<EntityAI>;
11381 for (int i = 0; i < items.Count(); ++i)
11382 {
11384 if (item)
11385 {
11386 g_Game.ObjectDelete(item);
11387 }
11388 }
11389 }
11390 }
11391
11392
11393
11394
11396 {
11397 float energy = 0;
11398 if (HasEnergyManager())
11399 {
11400 energy = GetCompEM().GetEnergy();
11401 }
11402 return energy;
11403 }
11404
11405
11407 {
11408 super.OnEnergyConsumed();
11409
11411 }
11412
11414 {
11415 super.OnEnergyAdded();
11416
11418 }
11419
11420
11422 {
11423 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11424 {
11426 {
11427 float energy_0to1 = GetCompEM().GetEnergy0To1();
11429 }
11430 }
11431 }
11432
11433
11435 {
11436 return ConfigGetFloat("heatIsolation");
11437 }
11438
11440 {
11442 }
11443
11445 {
11446 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11447 if (
g_Game.ConfigIsExisting(paramPath))
11448 return g_Game.ConfigGetFloat(paramPath);
11449
11450 return 0.0;
11451 }
11452
11454 {
11455 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11456 if (
g_Game.ConfigIsExisting(paramPath))
11457 return g_Game.ConfigGetFloat(paramPath);
11458
11459 return 0.0;
11460 }
11461
11462 override void SetWet(
float value,
bool allow_client =
false)
11463 {
11464 if (!IsServerCheck(allow_client))
11465 return;
11466
11469
11471
11472 m_VarWet = Math.Clamp(value, min, max);
11473
11475 {
11478 }
11479 }
11480
11481 override void AddWet(
float value)
11482 {
11484 }
11485
11487 {
11489 }
11490
11492 {
11494 }
11495
11497 {
11499 }
11500
11502 {
11504 }
11505
11507 {
11509 }
11510
11511 override void OnWetChanged(
float newVal,
float oldVal)
11512 {
11515 if (newLevel != oldLevel)
11516 {
11518 }
11519 }
11520
11522 {
11523 SetWeightDirty();
11524 }
11525
11527 {
11528 return GetWetLevelInternal(
m_VarWet);
11529 }
11530
11531
11532
11534 {
11536 }
11537
11539 {
11541 }
11542
11544 {
11546 }
11547
11549 {
11551 }
11552
11553
11554
11556 {
11557 if (ConfigIsExisting("itemModelLength"))
11558 {
11559 return ConfigGetFloat("itemModelLength");
11560 }
11561 return 0;
11562 }
11563
11565 {
11566 if (ConfigIsExisting("itemAttachOffset"))
11567 {
11568 return ConfigGetFloat("itemAttachOffset");
11569 }
11570 return 0;
11571 }
11572
11573 override void SetCleanness(
int value,
bool allow_client =
false)
11574 {
11575 if (!IsServerCheck(allow_client))
11576 return;
11577
11579
11581
11584 }
11585
11587 {
11589 }
11590
11592 {
11593 return true;
11594 }
11595
11596
11597
11598
11600 {
11602 }
11603
11605 {
11607 }
11608
11609
11610
11611
11612 override void SetColor(
int r,
int g,
int b,
int a)
11613 {
11619 }
11621 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11622 {
11627 }
11628
11630 {
11632 }
11633
11636 {
11637 int r,g,b,a;
11639 r = r/255;
11640 g = g/255;
11641 b = b/255;
11642 a = a/255;
11643 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11644 }
11645
11646
11647
11648 override void SetLiquidType(
int value,
bool allow_client =
false)
11649 {
11650 if (!IsServerCheck(allow_client))
11651 return;
11652
11657 }
11658
11660 {
11661 return ConfigGetInt("varLiquidTypeInit");
11662 }
11663
11665 {
11667 }
11668
11670 {
11672 SetFrozen(false);
11673 }
11674
11677 {
11678 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11679 }
11680
11681
11684 {
11685 PlayerBase nplayer;
11686 if (PlayerBase.CastTo(nplayer, player))
11687 {
11689 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11690 }
11691 }
11692
11693
11696 {
11697 PlayerBase nplayer;
11698 if (PlayerBase.CastTo(nplayer,player))
11699 {
11700 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11701 }
11702
11703 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11704
11705 if (HasEnergyManager())
11706 {
11707 GetCompEM().UpdatePlugState();
11708 }
11709 }
11710
11711
11713 {
11714 super.OnPlacementStarted(player);
11715
11717 }
11718
11719 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11720 {
11722 {
11723 m_AdminLog.OnPlacementComplete(player,
this);
11724 }
11725
11726 super.OnPlacementComplete(player, position, orientation);
11727 }
11728
11729
11730
11731
11732
11734 {
11736 {
11737 return true;
11738 }
11739 else
11740 {
11741 return false;
11742 }
11743 }
11744
11745
11747 {
11749 {
11751 }
11752 }
11753
11754
11756 {
11758 }
11759
11761 {
11763 }
11764
11765 override void InsertAgent(
int agent,
float count = 1)
11766 {
11767 if (count < 1)
11768 return;
11769
11771 }
11772
11775 {
11777 }
11778
11779
11781 {
11783 }
11784
11785
11786
11787
11788
11789
11790
11791
11792
11793
11794
11795
11796
11797
11798
11799
11800
11801
11802
11803
11804
11805
11806
11807
11808
11809
11810
11811
11812
11813
11814
11815
11816
11817
11818
11819
11820
11821
11822
11823
11824
11825
11827 {
11829 return false;
11830 return true;
11831 }
11832
11834 {
11835
11837 }
11838
11839
11842 {
11843 super.CheckForRoofLimited(timeTresholdMS);
11844
11845 float time =
g_Game.GetTime();
11846 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11847 {
11848 m_PreviousRoofTestTime = time;
11849 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11850 }
11851 }
11852
11853
11855 {
11857 {
11858 return 0;
11859 }
11860
11861 if (GetInventory().GetAttachmentSlotsCount() != 0)
11862 {
11863 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11864 if (filter)
11865 return filter.GetProtectionLevel(type, false, system);
11866 else
11867 return 0;
11868 }
11869
11870 string subclassPath, entryName;
11871
11872 switch (type)
11873 {
11875 entryName = "biological";
11876 break;
11878 entryName = "chemical";
11879 break;
11880 default:
11881 entryName = "biological";
11882 break;
11883 }
11884
11885 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11886
11887 return g_Game.ConfigGetFloat(subclassPath + entryName);
11888 }
11889
11890
11891
11894 {
11895 if (!IsMagazine())
11897
11899 }
11900
11901
11902
11903
11904
11909 {
11910 return true;
11911 }
11912
11914 {
11916 }
11917
11918
11919
11920
11921
11923 {
11924 if (parent)
11925 {
11926 if (parent.IsInherited(DayZInfected))
11927 return true;
11928
11929 if (!parent.IsRuined())
11930 return true;
11931 }
11932
11933 return true;
11934 }
11935
11937 {
11938 if (!super.CanPutAsAttachment(parent))
11939 {
11940 return false;
11941 }
11942
11943 if (!IsRuined() && !parent.IsRuined())
11944 {
11945 return true;
11946 }
11947
11948 return false;
11949 }
11950
11952 {
11953
11954
11955
11956
11957 return super.CanReceiveItemIntoCargo(item);
11958 }
11959
11961 {
11962
11963
11964
11965
11966 GameInventory attachmentInv = attachment.GetInventory();
11968 {
11969 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11970 return false;
11971 }
11972
11973 InventoryLocation loc = new InventoryLocation();
11974 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11975 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11976 return false;
11977
11978 return super.CanReceiveAttachment(attachment, slotId);
11979 }
11980
11982 {
11983 if (!super.CanReleaseAttachment(attachment))
11984 return false;
11985
11986 return GetInventory().AreChildrenAccessible();
11987 }
11988
11989
11990
11991
11992
11993
11994
11995
11996
11997
11998
11999
12000
12001
12002
12003
12004
12005
12006
12007
12008
12010 {
12011 int id = muzzle_owner.GetMuzzleID();
12012 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12013
12014 if (WPOF_array)
12015 {
12016 for (int i = 0; i < WPOF_array.Count(); i++)
12017 {
12018 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12019
12020 if (WPOF)
12021 {
12022 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12023 }
12024 }
12025 }
12026 }
12027
12028
12030 {
12031 int id = muzzle_owner.GetMuzzleID();
12033
12034 if (WPOBE_array)
12035 {
12036 for (int i = 0; i < WPOBE_array.Count(); i++)
12037 {
12038 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12039
12040 if (WPOBE)
12041 {
12042 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12043 }
12044 }
12045 }
12046 }
12047
12048
12050 {
12051 int id = muzzle_owner.GetMuzzleID();
12052 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12053
12054 if (WPOOH_array)
12055 {
12056 for (int i = 0; i < WPOOH_array.Count(); i++)
12057 {
12058 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12059
12060 if (WPOOH)
12061 {
12062 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12063 }
12064 }
12065 }
12066 }
12067
12068
12070 {
12071 int id = muzzle_owner.GetMuzzleID();
12072 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12073
12074 if (WPOOH_array)
12075 {
12076 for (int i = 0; i < WPOOH_array.Count(); i++)
12077 {
12078 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12079
12080 if (WPOOH)
12081 {
12082 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12083 }
12084 }
12085 }
12086 }
12087
12088
12090 {
12091 int id = muzzle_owner.GetMuzzleID();
12092 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12093
12094 if (WPOOH_array)
12095 {
12096 for (int i = 0; i < WPOOH_array.Count(); i++)
12097 {
12098 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12099
12100 if (WPOOH)
12101 {
12102 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12103 }
12104 }
12105 }
12106 }
12107
12108
12109
12111 {
12113 {
12114 return true;
12115 }
12116
12117 return false;
12118 }
12119
12121 {
12123 {
12124 return true;
12125 }
12126
12127 return false;
12128 }
12129
12131 {
12133 {
12134 return true;
12135 }
12136
12137 return false;
12138 }
12139
12141 {
12142 return false;
12143 }
12144
12147 {
12148 return UATimeSpent.DEFAULT_DEPLOY;
12149 }
12150
12151
12152
12153
12155 {
12157 SetSynchDirty();
12158 }
12159
12161 {
12163 }
12164
12165
12167 {
12168 return false;
12169 }
12170
12173 {
12174 string att_type = "None";
12175
12176 if (ConfigIsExisting("soundAttType"))
12177 {
12178 att_type = ConfigGetString("soundAttType");
12179 }
12180
12182 }
12183
12185 {
12187 }
12188
12189
12190
12191
12192
12198
12200 {
12203
12205 }
12206
12207
12209 {
12211 return;
12212
12214
12217
12220
12221 SoundParameters params = new SoundParameters();
12225 }
12226
12227
12229 {
12231 {
12234
12235 SetSynchDirty();
12236
12239 }
12240 }
12241
12243 {
12245 }
12246
12247
12249 {
12251 return;
12252
12254 SetSynchDirty();
12255
12258 }
12259
12261 {
12264 }
12265
12267 {
12269 }
12270
12271 void OnApply(PlayerBase player);
12272
12274 {
12275 return 1.0;
12276 };
12277
12279 {
12281 }
12282
12284 {
12286 }
12287
12289
12291 {
12292 SetDynamicPhysicsLifeTime(0.01);
12294 }
12295
12297 {
12298 array<string> zone_names = new array<string>;
12299 GetDamageZones(zone_names);
12300 for (int i = 0; i < zone_names.Count(); i++)
12301 {
12302 SetHealthMax(zone_names.Get(i),"Health");
12303 }
12304 SetHealthMax("","Health");
12305 }
12306
12309 {
12310 float global_health = GetHealth01("","Health");
12311 array<string> zones = new array<string>;
12312 GetDamageZones(zones);
12313
12314 for (int i = 0; i < zones.Count(); i++)
12315 {
12316 SetHealth01(zones.Get(i),"Health",global_health);
12317 }
12318 }
12319
12322 {
12323 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12324 }
12325
12327 {
12328 if (!hasRootAsPlayer)
12329 {
12330 if (refParentIB)
12331 {
12332
12333 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12334 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12335
12336 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12337 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12338
12341 }
12342 else
12343 {
12344
12347 }
12348 }
12349 }
12350
12352 {
12354 {
12355 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12356 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12357 {
12358 float heatPermCoef = 1.0;
12360 while (ent)
12361 {
12362 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12363 ent = ent.GetHierarchyParent();
12364 }
12365
12366 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12367 }
12368 }
12369 }
12370
12372 {
12373
12374 EntityAI parent = GetHierarchyParent();
12375 if (!parent)
12376 {
12377 hasParent = false;
12378 hasRootAsPlayer = false;
12379 }
12380 else
12381 {
12382 hasParent = true;
12383 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12384 refParentIB =
ItemBase.Cast(parent);
12385 }
12386 }
12387
12388 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12389 {
12390
12391 }
12392
12394 {
12395
12396 return false;
12397 }
12398
12400 {
12401
12402
12403 return false;
12404 }
12405
12407 {
12408
12409 return false;
12410 }
12411
12414 {
12415 return !GetIsFrozen() &&
IsOpen();
12416 }
12417
12419 {
12420 bool hasParent = false, hasRootAsPlayer = false;
12422
12423 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12424 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12425
12426 if (wwtu || foodDecay)
12427 {
12431
12432 if (processWetness || processTemperature || processDecay)
12433 {
12435
12436 if (processWetness)
12437 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12438
12439 if (processTemperature)
12441
12442 if (processDecay)
12443 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12444 }
12445 }
12446 }
12447
12450 {
12452 }
12453
12455 {
12458
12459 return super.GetTemperatureFreezeThreshold();
12460 }
12461
12463 {
12466
12467 return super.GetTemperatureThawThreshold();
12468 }
12469
12471 {
12474
12475 return super.GetItemOverheatThreshold();
12476 }
12477
12479 {
12481 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12482
12483 return super.GetTemperatureFreezeTime();
12484 }
12485
12487 {
12489 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12490
12491 return super.GetTemperatureThawTime();
12492 }
12493
12498
12500 {
12501 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12502 }
12503
12505 {
12506 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12507 }
12508
12511 {
12513 }
12514
12516 {
12518 }
12519
12521 {
12523 }
12524
12527 {
12528 return null;
12529 }
12530
12533 {
12534 return false;
12535 }
12536
12538 {
12540 {
12543 if (!trg)
12544 {
12546 explosive = this;
12547 }
12548
12549 explosive.PairRemote(trg);
12551
12552 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12553 trg.SetPersistentPairID(persistentID);
12554 explosive.SetPersistentPairID(persistentID);
12555
12556 return true;
12557 }
12558 return false;
12559 }
12560
12563 {
12564 float ret = 1.0;
12567 ret *= GetHealth01();
12568
12569 return ret;
12570 }
12571
12572 #ifdef DEVELOPER
12573 override void SetDebugItem()
12574 {
12575 super.SetDebugItem();
12576 _itemBase = this;
12577 }
12578
12580 {
12581 string text = super.GetDebugText();
12582
12584 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12585
12586 return text;
12587 }
12588 #endif
12589
12591 {
12592 return true;
12593 }
12594
12596
12598
12600 {
12603 }
12604
12605
12613
12629
12630 [
Obsolete(
"Use ItemSoundHandler instead")]
12633 {
12634 if (!
g_Game.IsDedicatedServer())
12635 {
12636 if (ConfigIsExisting("attachSoundSet"))
12637 {
12638 string cfg_path = "";
12639 string soundset = "";
12640 string type_name =
GetType();
12641
12644 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12645 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12646
12647 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12648 {
12649 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12650 {
12651 if (cfg_slot_array[i] == slot_type)
12652 {
12653 soundset = cfg_soundset_array[i];
12654 break;
12655 }
12656 }
12657 }
12658
12659 if (soundset != "")
12660 {
12661 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12663 }
12664 }
12665 }
12666 }
12667
12669}
12670
12672{
12674 if (entity)
12675 {
12676 bool is_item = entity.IsInherited(
ItemBase);
12677 if (is_item && full_quantity)
12678 {
12681 }
12682 }
12683 else
12684 {
12686 return NULL;
12687 }
12688 return entity;
12689}
12690
12692{
12693 if (item)
12694 {
12695 if (health > 0)
12696 item.SetHealth("", "", health);
12697
12698 if (item.CanHaveTemperature())
12699 {
12701 if (item.CanFreeze())
12702 item.SetFrozen(false);
12703 }
12704
12705 if (item.HasEnergyManager())
12706 {
12707 if (quantity >= 0)
12708 {
12709 item.GetCompEM().SetEnergy0To1(quantity);
12710 }
12711 else
12712 {
12714 }
12715 }
12716 else if (item.IsMagazine())
12717 {
12718 Magazine mag = Magazine.Cast(item);
12719 if (quantity >= 0)
12720 {
12721 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12722 }
12723 else
12724 {
12726 }
12727
12728 }
12729 else
12730 {
12731 if (quantity >= 0)
12732 {
12733 item.SetQuantityNormalized(quantity, false);
12734 }
12735 else
12736 {
12738 }
12739
12740 }
12741 }
12742}
12743
12744#ifdef DEVELOPER
12746#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.