7779{
7781 {
7782 return true;
7783 }
7784};
7785
7787{
7788
7789};
7790
7791
7792
7794{
7798
7800
7803
7804
7805
7806
7807
7816
7822
7827
7832
7853 protected bool m_IsResultOfSplit
7854
7856
7861
7862
7863
7865
7869
7870
7871
7873
7876
7877
7878
7884
7885
7893
7896
7897
7899
7900
7902
7903
7908
7909
7914
7916
7917
7919
7920
7922 {
7927
7928 if (!
g_Game.IsDedicatedServer())
7929 {
7931 {
7933
7935 {
7937 }
7938 }
7939
7942 }
7943
7944 m_OldLocation = null;
7945
7947 {
7949 }
7950
7951 if (ConfigIsExisting("headSelectionsToHide"))
7952 {
7955 }
7956
7958 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7959 {
7961 }
7962
7964
7965 m_IsResultOfSplit = false;
7966
7968 }
7969
7971 {
7972 super.InitItemVariables();
7973
7979 m_Count = ConfigGetInt(
"count");
7980
7983
7988
7991
7996
8008
8012
8013
8016 if (ConfigIsExisting("canBeSplit"))
8017 {
8020 }
8021
8023 if (ConfigIsExisting("itemBehaviour"))
8025
8026
8029 RegisterNetSyncVariableInt("m_VarLiquidType");
8030 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8031
8032 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8033 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8034 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8035
8036 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8037 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8038 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8039 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8040
8041 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8042 RegisterNetSyncVariableBool("m_IsTakeable");
8043 RegisterNetSyncVariableBool("m_IsHologram");
8044
8047 {
8050 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8051 }
8052
8054
8056 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8058
8060 }
8061
8063 {
8065 }
8066
8068 {
8071 {
8076 }
8077 }
8078
8079 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8080 {
8082 {
8085 }
8086
8088 }
8089
8091 {
8097 }
8098
8100
8102 {
8104
8105 if (!action)
8106 {
8107 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8108 return;
8109 }
8110
8112 if (!ai)
8113 {
8115 return;
8116 }
8117
8119 if (!action_array)
8120 {
8121 action_array = new array<ActionBase_Basic>;
8123 }
8124 if (LogManager.IsActionLogEnable())
8125 {
8126 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8127 }
8128
8129 if (action_array.Find(action) != -1)
8130 {
8131 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8132 }
8133 else
8134 {
8135 action_array.Insert(action);
8136 }
8137 }
8138
8140 {
8141 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8142 ActionBase action = player.GetActionManager().GetAction(actionName);
8145
8146 if (action_array)
8147 {
8148 action_array.RemoveItem(action);
8149 }
8150 }
8151
8152
8153
8155 {
8156 ActionOverrideData overrideData = new ActionOverrideData();
8160
8162 if (!actionMap)
8163 {
8166 }
8167
8168 actionMap.Insert(this.
Type(), overrideData);
8169
8170 }
8171
8173
8175
8176
8178 {
8181
8184
8185 string config_to_search = "CfgVehicles";
8186 string muzzle_owner_config;
8187
8189 {
8190 if (IsInherited(Weapon))
8191 config_to_search = "CfgWeapons";
8192
8193 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8194
8195 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8196
8197 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8198
8199 if (config_OnFire_subclass_count > 0)
8200 {
8201 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8202
8203 for (int i = 0; i < config_OnFire_subclass_count; i++)
8204 {
8205 string particle_class = "";
8206 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8207 string config_OnFire_entry = config_OnFire_class + particle_class;
8208 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8209 WPOF_array.Insert(WPOF);
8210 }
8211
8212
8214 }
8215 }
8216
8218 {
8219 config_to_search = "CfgWeapons";
8220 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8221
8222 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8223
8224 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8225
8226 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8227 {
8228 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8229
8230 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8231 {
8232 string particle_class2 = "";
8233 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8234 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8235 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8236 WPOBE_array.Insert(WPOBE);
8237 }
8238
8239
8241 }
8242 }
8243 }
8244
8245
8247 {
8250
8252 {
8253 string config_to_search = "CfgVehicles";
8254
8255 if (IsInherited(Weapon))
8256 config_to_search = "CfgWeapons";
8257
8258 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8259 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8260
8261 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8262 {
8263
8265
8267 {
8269 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8271 return;
8272 }
8273
8276
8277
8278
8279 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8280 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8281
8282 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8283 {
8284 string particle_class = "";
8285 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8286 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8287 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8288
8289 if (entry_type == CT_CLASS)
8290 {
8291 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8292 WPOOH_array.Insert(WPOF);
8293 }
8294 }
8295
8296
8298 }
8299 }
8300 }
8301
8303 {
8305 }
8306
8308 {
8310 {
8312
8315
8318
8319 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8320 }
8321 }
8322
8324 {
8326 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8327
8329 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8330
8332 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8333
8335 {
8337 }
8338 }
8339
8341 {
8343 }
8344
8346 {
8349 else
8351
8353 {
8356 }
8357 else
8358 {
8361
8364 }
8365
8367 }
8368
8370 {
8372 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8373 }
8374
8376 {
8378 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8380 }
8381
8383 {
8385 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8386 }
8387
8389 {
8392
8393 OverheatingParticle OP = new OverheatingParticle();
8398
8400 }
8401
8403 {
8406
8407 return -1;
8408 }
8409
8411 {
8413 {
8416
8417 for (int i = count; i > 0; --i)
8418 {
8419 int id = i - 1;
8422
8425
8426 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8427 {
8428 if (p)
8429 {
8432 }
8433 }
8434 }
8435 }
8436 }
8437
8439 {
8441 {
8443 {
8444 int id = i - 1;
8446
8447 if (OP)
8448 {
8450
8451 if (p)
8452 {
8454 }
8455
8456 delete OP;
8457 }
8458 }
8459
8462 }
8463 }
8464
8467 {
8468 return 0.0;
8469 }
8470
8471
8473 {
8474 return 250;
8475 }
8476
8478 {
8479 return 0;
8480 }
8481
8484 {
8486 return true;
8487
8488 return false;
8489 }
8490
8493 {
8496
8498 {
8500 }
8501 else
8502 {
8503
8505 }
8506
8508 }
8509
8516 {
8517 return -1;
8518 }
8519
8520
8521
8522
8524 {
8526 {
8527 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8528 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8529
8530 if (r_index >= 0)
8531 {
8532 InventoryLocation r_il = new InventoryLocation;
8533 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8534
8535 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8538 {
8539 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8540 }
8542 {
8543 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8544 }
8545
8546 }
8547
8548 player.GetHumanInventory().ClearUserReservedLocation(this);
8549 }
8550
8553 }
8554
8555
8556
8557
8559 {
8560 return ItemBase.m_DebugActionsMask;
8561 }
8562
8564 {
8565 return ItemBase.m_DebugActionsMask & mask;
8566 }
8567
8569 {
8570 ItemBase.m_DebugActionsMask = mask;
8571 }
8572
8574 {
8575 ItemBase.m_DebugActionsMask |= mask;
8576 }
8577
8579 {
8580 ItemBase.m_DebugActionsMask &= ~mask;
8581 }
8582
8584 {
8586 {
8588 }
8589 else
8590 {
8592 }
8593 }
8594
8595
8597 {
8598 if (GetEconomyProfile())
8599 {
8600 float q_max = GetEconomyProfile().GetQuantityMax();
8601 if (q_max > 0)
8602 {
8603 float q_min = GetEconomyProfile().GetQuantityMin();
8604 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8605
8607 {
8608 ComponentEnergyManager comp = GetCompEM();
8610 {
8612 }
8613 }
8615 {
8617
8618 }
8619
8620 }
8621 }
8622 }
8623
8626 {
8627 EntityAI parent = GetHierarchyParent();
8628
8629 if (parent)
8630 {
8631 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8632 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8633 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8634 }
8635 }
8636
8639 {
8640 EntityAI parent = GetHierarchyParent();
8641
8642 if (parent)
8643 {
8644 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8645 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8646 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8647 }
8648 }
8649
8651 {
8652
8653
8654
8655
8657
8659 {
8660 if (ScriptInputUserData.CanStoreInputUserData())
8661 {
8662 ScriptInputUserData ctx = new ScriptInputUserData;
8668 ctx.
Write(use_stack_max);
8671
8673 {
8674 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8675 }
8676 }
8677 }
8678 else if (!
g_Game.IsMultiplayer())
8679 {
8681 }
8682 }
8683
8685 {
8687 }
8688
8690 {
8692 }
8693
8695 {
8697 }
8698
8700 {
8701
8702 return false;
8703 }
8704
8706 {
8707 return false;
8708 }
8709
8713 {
8714 return false;
8715 }
8716
8718 {
8719 return "";
8720 }
8721
8723
8725 {
8726 return false;
8727 }
8728
8730 {
8731 return true;
8732 }
8733
8734
8735
8737 {
8738 return true;
8739 }
8740
8742 {
8743 return true;
8744 }
8745
8747 {
8748 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8750 }
8751
8753 {
8755 }
8756
8758 {
8760 if (!is_being_placed)
8762 SetSynchDirty();
8763 }
8764
8765
8767
8769 {
8771 }
8772
8774 {
8776 }
8777
8779 {
8780 return 1;
8781 }
8782
8784 {
8785 return false;
8786 }
8787
8789 {
8791 SetSynchDirty();
8792 }
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8821
8822
8823
8824
8825
8826
8827
8829 {
8830 super.OnMovedInsideCargo(container);
8831
8832 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8833 }
8834
8835 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8836 {
8837 super.EEItemLocationChanged(oldLoc, newLoc);
8838
8839 PlayerBase newPlayer = null;
8840 PlayerBase oldPlayer = null;
8841
8842 if (newLoc.GetParent())
8843 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8844
8845 if (oldLoc.GetParent())
8846 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8847
8849 {
8850 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8851
8852 if (rIndex >= 0)
8853 {
8854 InventoryLocation rIl = new InventoryLocation;
8855 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8856
8857 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8860 {
8861 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8862 }
8864 {
8866 }
8867
8868 }
8869 }
8870
8872 {
8873 if (newPlayer)
8874 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8875
8876 if (newPlayer == oldPlayer)
8877 {
8878 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8879 {
8881 {
8882 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8883 {
8884 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8885 }
8886 }
8887 else
8888 {
8889 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8890 }
8891 }
8892
8893 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8894 {
8895 int type = oldLoc.GetType();
8897 {
8898 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8899 }
8901 {
8902 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8903 }
8904 }
8905 if (!m_OldLocation)
8906 {
8907 m_OldLocation = new InventoryLocation;
8908 }
8909 m_OldLocation.Copy(oldLoc);
8910 }
8911 else
8912 {
8913 if (m_OldLocation)
8914 {
8915 m_OldLocation.Reset();
8916 }
8917 }
8918
8919 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8920 }
8921 else
8922 {
8923 if (newPlayer)
8924 {
8925 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8926 if (resIndex >= 0)
8927 {
8928 InventoryLocation il = new InventoryLocation;
8929 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8931 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8934 {
8935 il.
GetParent().GetOnReleaseLock().Invoke(it);
8936 }
8938 {
8940 }
8941
8942 }
8943 }
8945 {
8946
8948 }
8949
8950 if (m_OldLocation)
8951 {
8952 m_OldLocation.Reset();
8953 }
8954 }
8955
8957 {
8958 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8959 }
8960
8962 {
8963 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8964 }
8965 }
8966
8967 override void EOnContact(IEntity other, Contact extra)
8968 {
8970 {
8971 int liquidType = -1;
8973 if (impactSpeed > 0.0)
8974 {
8976 #ifndef SERVER
8978 #else
8980 SetSynchDirty();
8981 #endif
8983 }
8984 }
8985
8986 #ifdef SERVER
8987 if (GetCompEM() && GetCompEM().IsPlugged())
8988 {
8989 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8990 GetCompEM().UnplugThis();
8991 }
8992 #endif
8993 }
8994
8996
8998 {
9000 }
9001
9003 {
9004
9005 }
9006
9008 {
9009 super.OnItemLocationChanged(old_owner, new_owner);
9010
9011 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9012 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9013
9014 if (!relatedPlayer && playerNew)
9015 relatedPlayer = playerNew;
9016
9017 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9018 {
9020 if (actionMgr)
9021 {
9022 ActionBase currentAction = actionMgr.GetRunningAction();
9023 if (currentAction)
9025 }
9026 }
9027
9028 Man ownerPlayerOld = null;
9029 Man ownerPlayerNew = null;
9030
9031 if (old_owner)
9032 {
9033 if (old_owner.
IsMan())
9034 {
9035 ownerPlayerOld = Man.Cast(old_owner);
9036 }
9037 else
9038 {
9039 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9040 }
9041 }
9042 else
9043 {
9045 {
9047
9048 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9049 {
9050 GetCompEM().UnplugThis();
9051 }
9052 }
9053 }
9054
9055 if (new_owner)
9056 {
9057 if (new_owner.
IsMan())
9058 {
9059 ownerPlayerNew = Man.Cast(new_owner);
9060 }
9061 else
9062 {
9063 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9064 }
9065 }
9066
9067 if (ownerPlayerOld != ownerPlayerNew)
9068 {
9069 if (ownerPlayerOld)
9070 {
9071 array<EntityAI> subItemsExit = new array<EntityAI>;
9073 for (int i = 0; i < subItemsExit.Count(); i++)
9074 {
9077 }
9078 }
9079
9080 if (ownerPlayerNew)
9081 {
9082 array<EntityAI> subItemsEnter = new array<EntityAI>;
9084 for (int j = 0; j < subItemsEnter.Count(); j++)
9085 {
9088 }
9089 }
9090 }
9091 else if (ownerPlayerNew != null)
9092 {
9093 PlayerBase nplayer;
9094 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9095 {
9096 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9098 for (int k = 0; k < subItemsUpdate.Count(); k++)
9099 {
9101 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9102 }
9103 }
9104 }
9105
9106 if (old_owner)
9107 old_owner.OnChildItemRemoved(this);
9108 if (new_owner)
9109 new_owner.OnChildItemReceived(this);
9110 }
9111
9112
9114 {
9115 super.EEDelete(parent);
9116 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9117 if (player)
9118 {
9120
9121 if (player.IsAlive())
9122 {
9123 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9124 if (r_index >= 0)
9125 {
9126 InventoryLocation r_il = new InventoryLocation;
9127 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9128
9129 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9132 {
9133 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9134 }
9136 {
9137 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9138 }
9139
9140 }
9141
9142 player.RemoveQuickBarEntityShortcut(this);
9143 }
9144 }
9145 }
9146
9148 {
9149 super.EEKilled(killer);
9150
9153 {
9154 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9155 {
9156 if (IsMagazine())
9157 {
9158 if (Magazine.Cast(this).GetAmmoCount() > 0)
9159 {
9161 }
9162 }
9163 else
9164 {
9166 }
9167 }
9168 }
9169 }
9170
9172 {
9173 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9174
9175 super.OnWasAttached(parent, slot_id);
9176
9179
9182 }
9183
9185 {
9186 super.OnWasDetached(parent, slot_id);
9187
9190
9193 }
9194
9196 {
9197 int idx;
9200
9201 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9202 if (inventory_slots.Count() < 1)
9203 {
9204 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9205 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9206 }
9207 else
9208 {
9209 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9210 }
9211
9212 idx = inventory_slots.Find(slot);
9213 if (idx < 0)
9214 return "";
9215
9216 return attach_types.Get(idx);
9217 }
9218
9220 {
9221 int idx = -1;
9222 string slot;
9223
9226
9227 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9228 if (inventory_slots.Count() < 1)
9229 {
9230 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9231 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9232 }
9233 else
9234 {
9235 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9236 if (detach_types.Count() < 1)
9237 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9238 }
9239
9240 for (int i = 0; i < inventory_slots.Count(); i++)
9241 {
9242 slot = inventory_slots.Get(i);
9243 }
9244
9245 if (slot != "")
9246 {
9247 if (detach_types.Count() == 1)
9248 idx = 0;
9249 else
9250 idx = inventory_slots.Find(slot);
9251 }
9252 if (idx < 0)
9253 return "";
9254
9255 return detach_types.Get(idx);
9256 }
9257
9259 {
9260
9262
9263
9264 float min_time = 1;
9265 float max_time = 3;
9266 float delay = Math.RandomFloat(min_time, max_time);
9267
9268 explode_timer.Run(delay, this, "DoAmmoExplosion");
9269 }
9270
9272 {
9273 Magazine magazine = Magazine.Cast(this);
9274 int pop_sounds_count = 6;
9275 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9276
9277
9278 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9279 string sound_name = pop_sounds[ sound_idx ];
9280 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9281
9282
9283 magazine.ServerAddAmmoCount(-1);
9284
9285
9286 float min_temp_to_explode = 100;
9287
9288 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9289 {
9291 }
9292 }
9293
9294
9295 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9296 {
9297 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9298
9299 const int CHANCE_DAMAGE_CARGO = 4;
9300 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9301 const int CHANCE_DAMAGE_NOTHING = 2;
9302
9304 {
9305 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9306 int chances;
9307 int rnd;
9308
9309 if (GetInventory().GetCargo())
9310 {
9311 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9312 rnd = Math.RandomInt(0,chances);
9313
9314 if (rnd < CHANCE_DAMAGE_CARGO)
9315 {
9317 }
9318 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9319 {
9321 }
9322 }
9323 else
9324 {
9325 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9326 rnd = Math.RandomInt(0,chances);
9327
9328 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9329 {
9331 }
9332 }
9333 }
9334 }
9335
9337 {
9338 CargoBase cargo = GetInventory().GetCargo();
9339 if (cargo)
9340 {
9342 if (item_count > 0)
9343 {
9344 int random_pick = Math.RandomInt(0, item_count);
9346 if (!item.IsExplosive())
9347 {
9348 item.AddHealth("","",damage);
9349 return true;
9350 }
9351 }
9352 }
9353 return false;
9354 }
9355
9357 {
9358 GameInventory inventory = GetInventory();
9360 if (attachment_count > 0)
9361 {
9362 int random_pick = Math.RandomInt(0, attachment_count);
9364 if (!attachment.IsExplosive())
9365 {
9366 attachment.AddHealth("","",damage);
9367 return true;
9368 }
9369 }
9370 return false;
9371 }
9372
9374 {
9376 }
9377
9379 {
9381 return GetInventory().CanRemoveEntity();
9382
9383 return false;
9384 }
9385
9387 {
9388
9390 return false;
9391
9392
9394 return false;
9395
9396
9397
9399 if (delta == 0)
9400 return false;
9401
9402
9403 return true;
9404 }
9405
9407 {
9409 {
9410 if (ScriptInputUserData.CanStoreInputUserData())
9411 {
9412 ScriptInputUserData ctx = new ScriptInputUserData;
9417 ctx.
Write(destination_entity);
9421 }
9422 }
9423 else if (!
g_Game.IsMultiplayer())
9424 {
9426 }
9427 }
9428
9430 {
9431 float split_quantity_new;
9435 InventoryLocation loc = new InventoryLocation;
9436
9437 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9438 {
9440 split_quantity_new = stack_max;
9441 else
9443
9445 {
9446 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9447 if (new_item)
9448 {
9449 new_item.SetResultOfSplit(true);
9450 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9452 new_item.
SetQuantity(split_quantity_new,
false,
true);
9453 }
9454 }
9455 }
9456 else if (destination_entity && slot_id == -1)
9457 {
9458 if (quantity > stack_max)
9459 split_quantity_new = stack_max;
9460 else
9461 split_quantity_new = quantity;
9462
9464 {
9465 GameInventory destinationInventory = destination_entity.GetInventory();
9467 {
9470 }
9471
9472 if (new_item)
9473 {
9474 new_item.SetResultOfSplit(true);
9475 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9477 new_item.
SetQuantity(split_quantity_new,
false,
true);
9478 }
9479 }
9480 }
9481 else
9482 {
9483 if (stack_max != 0)
9484 {
9486 {
9488 }
9489
9490 if (split_quantity_new == 0)
9491 {
9492 if (!
g_Game.IsMultiplayer())
9493 player.PhysicalPredictiveDropItem(this);
9494 else
9495 player.ServerDropEntity(this);
9496 return;
9497 }
9498
9500 {
9502
9503 if (new_item)
9504 {
9505 new_item.SetResultOfSplit(true);
9506 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9509 new_item.PlaceOnSurface();
9510 }
9511 }
9512 }
9513 }
9514 }
9515
9517 {
9518 float split_quantity_new;
9522 InventoryLocation loc = new InventoryLocation;
9523
9524 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9525 {
9527 split_quantity_new = stack_max;
9528 else
9530
9532 {
9533 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9534 if (new_item)
9535 {
9536 new_item.SetResultOfSplit(true);
9537 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9539 new_item.
SetQuantity(split_quantity_new,
false,
true);
9540 }
9541 }
9542 }
9543 else if (destination_entity && slot_id == -1)
9544 {
9545 if (quantity > stack_max)
9546 split_quantity_new = stack_max;
9547 else
9548 split_quantity_new = quantity;
9549
9551 {
9552 GameInventory destinationInventory = destination_entity.GetInventory();
9554 {
9557 }
9558
9559 if (new_item)
9560 {
9561 new_item.SetResultOfSplit(true);
9562 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9564 new_item.
SetQuantity(split_quantity_new,
false,
true);
9565 }
9566 }
9567 }
9568 else
9569 {
9570 if (stack_max != 0)
9571 {
9573 {
9575 }
9576
9578 {
9580
9581 if (new_item)
9582 {
9583 new_item.SetResultOfSplit(true);
9584 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9587 new_item.PlaceOnSurface();
9588 }
9589 }
9590 }
9591 }
9592 }
9593
9595 {
9597 {
9598 if (ScriptInputUserData.CanStoreInputUserData())
9599 {
9600 ScriptInputUserData ctx = new ScriptInputUserData;
9605 dst.WriteToContext(ctx);
9607 }
9608 }
9609 else if (!
g_Game.IsMultiplayer())
9610 {
9612 }
9613 }
9614
9616 {
9618 {
9619 if (ScriptInputUserData.CanStoreInputUserData())
9620 {
9621 ScriptInputUserData ctx = new ScriptInputUserData;
9626 ctx.
Write(destination_entity);
9632 }
9633 }
9634 else if (!
g_Game.IsMultiplayer())
9635 {
9637 }
9638 }
9639
9641 {
9643 }
9644
9646 {
9648 float split_quantity_new;
9650 if (dst.IsValid())
9651 {
9652 int slot_id = dst.GetSlot();
9654
9655 if (quantity > stack_max)
9656 split_quantity_new = stack_max;
9657 else
9658 split_quantity_new = quantity;
9659
9661 {
9663
9664 if (new_item)
9665 {
9666 new_item.SetResultOfSplit(true);
9667 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9669 new_item.
SetQuantity(split_quantity_new,
false,
true);
9670 }
9671
9672 return new_item;
9673 }
9674 }
9675
9676 return null;
9677 }
9678
9680 {
9682 float split_quantity_new;
9684 if (destination_entity)
9685 {
9687 if (quantity > stackable)
9688 split_quantity_new = stackable;
9689 else
9690 split_quantity_new = quantity;
9691
9693 {
9694 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9695 if (new_item)
9696 {
9697 new_item.SetResultOfSplit(true);
9698 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9700 new_item.
SetQuantity(split_quantity_new,
false,
true);
9701 }
9702 }
9703 }
9704 }
9705
9707 {
9709 {
9710 if (ScriptInputUserData.CanStoreInputUserData())
9711 {
9712 ScriptInputUserData ctx = new ScriptInputUserData;
9717 ItemBase destination_entity =
this;
9718 ctx.
Write(destination_entity);
9722 }
9723 }
9724 else if (!
g_Game.IsMultiplayer())
9725 {
9727 }
9728 }
9729
9731 {
9733 float split_quantity_new;
9735 if (player)
9736 {
9738 if (quantity > stackable)
9739 split_quantity_new = stackable;
9740 else
9741 split_quantity_new = quantity;
9742
9744 {
9745 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9746 new_item =
ItemBase.Cast(in_hands);
9747 if (new_item)
9748 {
9749 new_item.SetResultOfSplit(true);
9750 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9752 new_item.SetQuantity(split_quantity_new, false, true);
9753 }
9754 }
9755 }
9756 }
9757
9759 {
9761 float split_quantity_new = Math.Floor(quantity * 0.5);
9762
9764 return;
9765
9767
9768 if (new_item)
9769 {
9770 if (new_item.GetQuantityMax() < split_quantity_new)
9771 {
9772 split_quantity_new = new_item.GetQuantityMax();
9773 }
9774
9775 new_item.SetResultOfSplit(true);
9776 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9777
9779 {
9782 }
9783 else
9784 {
9786 new_item.
SetQuantity(split_quantity_new,
false,
true);
9787 }
9788 }
9789 }
9790
9792 {
9794 float split_quantity_new = Math.Floor(quantity / 2);
9795
9797 return;
9798
9799 InventoryLocation invloc = new InventoryLocation;
9801
9803 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9804
9805 if (new_item)
9806 {
9807 if (new_item.GetQuantityMax() < split_quantity_new)
9808 {
9809 split_quantity_new = new_item.GetQuantityMax();
9810 }
9812 {
9815 }
9816 else if (split_quantity_new > 1)
9817 {
9819 new_item.
SetQuantity(split_quantity_new,
false,
true);
9820 }
9821 }
9822 }
9823
9826 {
9827 SetWeightDirty();
9829
9830 if (parent)
9831 parent.OnAttachmentQuantityChangedEx(this, delta);
9832
9834 {
9836 {
9838 }
9840 {
9841 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9843 }
9844 }
9845 }
9846
9849 {
9850
9851 }
9852
9855 {
9857 }
9858
9860 {
9861 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9862
9864 {
9865 if (newLevel == GameConstants.STATE_RUINED)
9866 {
9868 EntityAI parent = GetHierarchyParent();
9869 if (parent && parent.IsFireplace())
9870 {
9871 CargoBase cargo = GetInventory().GetCargo();
9872 if (cargo)
9873 {
9875 {
9877 }
9878 }
9879 }
9880 }
9881
9883 {
9884
9886 return;
9887 }
9888
9889 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9890 {
9892 }
9893 }
9894 }
9895
9896
9898 {
9899 super.OnRightClick();
9900
9902 {
9904 {
9905 if (ScriptInputUserData.CanStoreInputUserData())
9906 {
9907 EntityAI root = GetHierarchyRoot();
9908 Man playerOwner = GetHierarchyRootPlayer();
9909 InventoryLocation dst = new InventoryLocation;
9910
9911
9912 if (!playerOwner && root && root == this)
9913 {
9915 }
9916 else
9917 {
9918
9919 GetInventory().GetCurrentInventoryLocation(dst);
9921 {
9922 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9924 {
9926 }
9927 else
9928 {
9930
9931
9932 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9933 {
9935 }
9936 else
9937 {
9938 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9939 }
9940 }
9941 }
9942 }
9943
9944 ScriptInputUserData ctx = new ScriptInputUserData;
9952 }
9953 }
9954 else if (!
g_Game.IsMultiplayer())
9955 {
9957 }
9958 }
9959 }
9960
9962 {
9963 if (root)
9964 {
9965 vector m4[4];
9966 root.GetTransform(m4);
9967 dst.SetGround(this, m4);
9968 }
9969 else
9970 {
9971 GetInventory().GetCurrentInventoryLocation(dst);
9972 }
9973 }
9974
9975 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9976 {
9977
9978 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9979 return false;
9980
9981 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9982 return false;
9983
9984
9986 return false;
9987
9988
9989 Magazine mag = Magazine.Cast(this);
9990 if (mag)
9991 {
9992 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9993 return false;
9994
9995 if (stack_max_limit)
9996 {
9997 Magazine other_mag = Magazine.Cast(other_item);
9998 if (other_item)
9999 {
10000 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
10001 return false;
10002 }
10003
10004 }
10005 }
10006 else
10007 {
10008
10010 return false;
10011
10013 return false;
10014 }
10015
10016 PlayerBase player = null;
10017 if (CastTo(player, GetHierarchyRootPlayer()))
10018 {
10019 if (player.GetInventory().HasAttachment(this))
10020 return false;
10021
10022 if (player.IsItemsToDelete())
10023 return false;
10024 }
10025
10026 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10027 return false;
10028
10029 int slotID;
10031 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10032 return false;
10033
10034 return true;
10035 }
10036
10038 {
10040 }
10041
10043 {
10044 return m_IsResultOfSplit;
10045 }
10046
10048 {
10049 m_IsResultOfSplit = value;
10050 }
10051
10053 {
10055 }
10056
10058 {
10059 float other_item_quantity = other_item.GetQuantity();
10060 float this_free_space;
10061
10063
10065
10066 if (other_item_quantity > this_free_space)
10067 {
10068 return this_free_space;
10069 }
10070 else
10071 {
10072 return other_item_quantity;
10073 }
10074 }
10075
10077 {
10079 }
10080
10082 {
10084 return;
10085
10086 if (!IsMagazine() && other_item)
10087 {
10089 if (quantity_used != 0)
10090 {
10091 float hp1 = GetHealth01("","");
10092 float hp2 = other_item.GetHealth01("","");
10093 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10094 hpResult = hpResult / (
GetQuantity() + quantity_used);
10095
10096 hpResult *= GetMaxHealth();
10097 Math.Round(hpResult);
10098 SetHealth("", "Health", hpResult);
10099
10101 other_item.AddQuantity(-quantity_used);
10102 }
10103 }
10105 }
10106
10108 {
10109 #ifdef SERVER
10110 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10111 GetHierarchyParent().IncreaseLifetimeUp();
10112 #endif
10113 };
10114
10116 {
10117 PlayerBase p = PlayerBase.Cast(player);
10118
10119 array<int> recipesIds = p.m_Recipes;
10120 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10121 if (moduleRecipesManager)
10122 {
10123 EntityAI itemInHands = player.GetEntityInHands();
10124 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10125 }
10126
10127 for (int i = 0;i < recipesIds.Count(); i++)
10128 {
10129 int key = recipesIds.Get(i);
10130 string recipeName = moduleRecipesManager.GetRecipeName(key);
10132 }
10133 }
10134
10135
10136 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10137 {
10138 super.GetDebugActions(outputList);
10139
10140
10146
10147
10152
10157
10158
10162
10163
10165 {
10169 }
10170
10173
10174
10178
10180
10181 InventoryLocation loc = new InventoryLocation();
10182 GetInventory().GetCurrentInventoryLocation(loc);
10184 {
10185 if (Gizmo_IsSupported())
10188 }
10189
10191 }
10192
10193
10194
10195
10197 {
10198 super.OnAction(action_id, player, ctx);
10199
10201 {
10202 switch (action_id)
10203 {
10207 return true;
10211 return true;
10212 }
10213 }
10214
10216 {
10217 switch (action_id)
10218 {
10220 Delete();
10221 return true;
10222 }
10223 }
10224
10225 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10226 {
10227 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10228 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10229 PlayerBase p = PlayerBase.Cast(player);
10230 if (
EActions.RECIPES_RANGE_START < 1000)
10231 {
10232 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10233 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10234 }
10235 }
10236 #ifndef SERVER
10237 else if (action_id ==
EActions.WATCH_PLAYER)
10238 {
10239 PluginDeveloper.SetDeveloperItemClientEx(player);
10240 }
10241 #endif
10243 {
10244 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10245 {
10246 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10247 OnDebugButtonPressServer(id + 1);
10248 }
10249
10250 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10251 {
10252 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10254 }
10255
10256 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10257 {
10258 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10260 }
10261
10262 else if (action_id ==
EActions.ADD_QUANTITY)
10263 {
10264 if (IsMagazine())
10265 {
10266 Magazine mag = Magazine.Cast(this);
10267 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10268 }
10269 else
10270 {
10272 }
10273
10274 if (m_EM)
10275 {
10276 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10277 }
10278
10279 }
10280
10281 else if (action_id ==
EActions.REMOVE_QUANTITY)
10282 {
10283 if (IsMagazine())
10284 {
10285 Magazine mag2 = Magazine.Cast(this);
10286 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10287 }
10288 else
10289 {
10291 }
10292 if (m_EM)
10293 {
10294 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10295 }
10296
10297 }
10298
10299 else if (action_id ==
EActions.SET_QUANTITY_0)
10300 {
10302
10303 if (m_EM)
10304 {
10305 m_EM.SetEnergy(0);
10306 }
10307 }
10308
10309 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10310 {
10312
10313 if (m_EM)
10314 {
10315 m_EM.SetEnergy(m_EM.GetEnergyMax());
10316 }
10317 }
10318
10319 else if (action_id ==
EActions.ADD_HEALTH)
10320 {
10321 AddHealth("","",GetMaxHealth("","Health")/5);
10322 }
10323 else if (action_id ==
EActions.REMOVE_HEALTH)
10324 {
10325 AddHealth("","",-GetMaxHealth("","Health")/5);
10326 }
10327 else if (action_id ==
EActions.DESTROY_HEALTH)
10328 {
10329 SetHealth01("","",0);
10330 }
10331 else if (action_id ==
EActions.WATCH_ITEM)
10332 {
10334 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10335 #ifdef DEVELOPER
10336 SetDebugDeveloper_item(this);
10337 #endif
10338 }
10339
10340 else if (action_id ==
EActions.ADD_TEMPERATURE)
10341 {
10342 AddTemperature(20);
10343
10344 }
10345
10346 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10347 {
10348 AddTemperature(-20);
10349
10350 }
10351
10352 else if (action_id ==
EActions.FLIP_FROZEN)
10353 {
10354 SetFrozen(!GetIsFrozen());
10355
10356 }
10357
10358 else if (action_id ==
EActions.ADD_WETNESS)
10359 {
10361
10362 }
10363
10364 else if (action_id ==
EActions.REMOVE_WETNESS)
10365 {
10367
10368 }
10369
10370 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10371 {
10374
10375
10376 }
10377
10378 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10379 {
10382 }
10383
10384 else if (action_id ==
EActions.MAKE_SPECIAL)
10385 {
10386 auto debugParams = DebugSpawnParams.WithPlayer(player);
10387 OnDebugSpawnEx(debugParams);
10388 }
10389
10390 }
10391
10392
10393 return false;
10394 }
10395
10396
10397
10398
10402
10405
10406
10407
10409 {
10410 return false;
10411 }
10412
10413
10415 {
10416 return true;
10417 }
10418
10419
10421 {
10422 return true;
10423 }
10424
10425
10426
10428 {
10429 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10430 return g_Game.ConfigIsExisting(config_path);
10431 }
10432
10435 {
10436 return null;
10437 }
10438
10440 {
10441 return false;
10442 }
10443
10445 {
10446 return false;
10447 }
10448
10452
10453
10455 {
10456 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10457 return module_repairing.CanRepair(this, item_repair_kit);
10458 }
10459
10460
10461 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10462 {
10463 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10464 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10465 }
10466
10467
10469 {
10470
10471
10472
10473
10474
10475
10476
10477
10478 return 1;
10479 }
10480
10481
10482
10484 {
10486 }
10487
10488
10489
10491 {
10493 }
10494
10495
10504 {
10505 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10506
10507 if (player)
10508 {
10509 player.MessageStatus(text);
10510 }
10511 }
10512
10513
10522 {
10523 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10524
10525 if (player)
10526 {
10527 player.MessageAction(text);
10528 }
10529 }
10530
10531
10540 {
10541 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10542
10543 if (player)
10544 {
10545 player.MessageFriendly(text);
10546 }
10547 }
10548
10549
10558 {
10559 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10560
10561 if (player)
10562 {
10563 player.MessageImportant(text);
10564 }
10565 }
10566
10568 {
10569 return true;
10570 }
10571
10572
10573 override bool KindOf(
string tag)
10574 {
10575 bool found = false;
10576 string item_name = this.
GetType();
10578 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10579
10580 int array_size = item_tag_array.Count();
10581 for (int i = 0; i < array_size; i++)
10582 {
10583 if (item_tag_array.Get(i) == tag)
10584 {
10585 found = true;
10586 break;
10587 }
10588 }
10589 return found;
10590 }
10591
10592
10594 {
10595
10596 super.OnRPC(sender, rpc_type,ctx);
10597
10598
10599 switch (rpc_type)
10600 {
10601 #ifndef SERVER
10602 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10603 Param2<bool, string> p = new Param2<bool, string>(false, "");
10604
10606 return;
10607
10608 bool play = p.param1;
10609 string soundSet = p.param2;
10610
10611 if (play)
10612 {
10614 {
10616 {
10618 }
10619 }
10620 else
10621 {
10623 }
10624 }
10625 else
10626 {
10628 }
10629
10630 break;
10631 #endif
10632
10633 }
10634
10636 {
10638 }
10639 }
10640
10641
10642
10643
10645 {
10646 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10647 return plugin.GetID(
name);
10648 }
10649
10651 {
10652 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10653 return plugin.GetName(id);
10654 }
10655
10658 {
10659
10660
10661 int varFlags;
10662 if (!ctx.
Read(varFlags))
10663 return;
10664
10665 if (varFlags & ItemVariableFlags.FLOAT)
10666 {
10668 }
10669 }
10670
10672 {
10673
10674 super.SerializeNumericalVars(floats_out);
10675
10676
10677
10679 {
10681 }
10682
10684 {
10686 }
10687
10689 {
10691 }
10692
10694 {
10699 }
10700
10702 {
10704 }
10705 }
10706
10708 {
10709
10710 super.DeSerializeNumericalVars(floats);
10711
10712
10713 int index = 0;
10714 int mask = Math.Round(floats.Get(index));
10715
10716 index++;
10717
10719 {
10721 {
10723 }
10724 else
10725 {
10726 float quantity = floats.Get(index);
10727 SetQuantity(quantity,
true,
false,
false,
false);
10728 }
10729 index++;
10730 }
10731
10733 {
10734 float wet = floats.Get(index);
10736 index++;
10737 }
10738
10740 {
10741 int liquidtype = Math.Round(floats.Get(index));
10743 index++;
10744 }
10745
10747 {
10749 index++;
10751 index++;
10753 index++;
10755 index++;
10756 }
10757
10759 {
10760 int cleanness = Math.Round(floats.Get(index));
10762 index++;
10763 }
10764 }
10765
10767 {
10768 super.WriteVarsToCTX(ctx);
10769
10770
10772 {
10774 }
10775
10777 {
10779 }
10780
10782 {
10784 }
10785
10787 {
10788 int r,g,b,a;
10794 }
10795
10797 {
10799 }
10800 }
10801
10803 {
10804 if (!super.ReadVarsFromCTX(ctx,version))
10805 return false;
10806
10807 int intValue;
10808 float value;
10809
10810 if (version < 140)
10811 {
10812 if (!ctx.
Read(intValue))
10813 return false;
10814
10815 m_VariablesMask = intValue;
10816 }
10817
10819 {
10820 if (!ctx.
Read(value))
10821 return false;
10822
10824 {
10826 }
10827 else
10828 {
10830 }
10831 }
10832
10833 if (version < 140)
10834 {
10836 {
10837 if (!ctx.
Read(value))
10838 return false;
10839 SetTemperatureDirect(value);
10840 }
10841 }
10842
10844 {
10845 if (!ctx.
Read(value))
10846 return false;
10848 }
10849
10851 {
10852 if (!ctx.
Read(intValue))
10853 return false;
10855 }
10856
10858 {
10859 int r,g,b,a;
10861 return false;
10863 return false;
10865 return false;
10867 return false;
10868
10870 }
10871
10873 {
10874 if (!ctx.
Read(intValue))
10875 return false;
10877 }
10878
10879 if (version >= 138 && version < 140)
10880 {
10882 {
10883 if (!ctx.
Read(intValue))
10884 return false;
10885 SetFrozen(intValue);
10886 }
10887 }
10888
10889 return true;
10890 }
10891
10892
10894 {
10897 {
10899 }
10900
10901 if (!super.OnStoreLoad(ctx, version))
10902 {
10904 return false;
10905 }
10906
10907 if (version >= 114)
10908 {
10909 bool hasQuickBarIndexSaved;
10910
10911 if (!ctx.
Read(hasQuickBarIndexSaved))
10912 {
10914 return false;
10915 }
10916
10917 if (hasQuickBarIndexSaved)
10918 {
10919 int itmQBIndex;
10920
10921
10922 if (!ctx.
Read(itmQBIndex))
10923 {
10925 return false;
10926 }
10927
10928 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10929 if (itmQBIndex != -1 && parentPlayer)
10930 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10931 }
10932 }
10933 else
10934 {
10935
10936 PlayerBase player;
10937 int itemQBIndex;
10938 if (version ==
int.
MAX)
10939 {
10940 if (!ctx.
Read(itemQBIndex))
10941 {
10943 return false;
10944 }
10945 }
10946 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10947 {
10948
10949 if (!ctx.
Read(itemQBIndex))
10950 {
10952 return false;
10953 }
10954 if (itemQBIndex != -1 && player)
10955 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10956 }
10957 }
10958
10959 if (version < 140)
10960 {
10961
10962 if (!LoadVariables(ctx, version))
10963 {
10965 return false;
10966 }
10967 }
10968
10969
10971 {
10973 return false;
10974 }
10975 if (version >= 132)
10976 {
10978 if (raib)
10979 {
10981 {
10983 return false;
10984 }
10985 }
10986 }
10987
10989 return true;
10990 }
10991
10992
10993
10995 {
10996 super.OnStoreSave(ctx);
10997
10998 PlayerBase player;
10999 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
11000 {
11002
11003 int itemQBIndex = -1;
11004 itemQBIndex = player.FindQuickBarEntityIndex(this);
11005 ctx.
Write(itemQBIndex);
11006 }
11007 else
11008 {
11010 }
11011
11013
11015 if (raib)
11016 {
11018 }
11019 }
11020
11021
11023 {
11024 super.AfterStoreLoad();
11025
11027 {
11029 }
11030
11032 {
11035 }
11036 }
11037
11039 {
11040 super.EEOnAfterLoad();
11041
11043 {
11045 }
11046
11049 }
11050
11052 {
11053 return false;
11054 }
11055
11056
11057
11059 {
11061 {
11062 #ifdef PLATFORM_CONSOLE
11063
11065 {
11067 if (menu)
11068 {
11070 }
11071 }
11072 #endif
11073 }
11074
11076 {
11079 }
11080
11082 {
11083 SetWeightDirty();
11085 }
11087 {
11090 }
11091
11093 {
11096
11099 }
11101 {
11105 }
11106
11107 super.OnVariablesSynchronized();
11108 }
11109
11110
11111
11113 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11114 {
11115 if (!IsServerCheck(allow_client))
11116 return false;
11117
11119 return false;
11120
11123
11124 if (value <= (min + 0.001))
11125 value = min;
11126
11127 if (value == min)
11128 {
11129 if (destroy_config)
11130 {
11131 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11132 if (dstr)
11133 {
11135 this.Delete();
11136 return true;
11137 }
11138 }
11139 else if (destroy_forced)
11140 {
11142 this.Delete();
11143 return true;
11144 }
11145
11147 }
11148
11151
11153 {
11154 EntityAI parent = GetHierarchyRoot();
11155 InventoryLocation iLoc = new InventoryLocation();
11156 GetInventory().GetCurrentInventoryLocation(iLoc);
11158 {
11159 int iLocSlot = iLoc.
GetSlot();
11161 {
11163 }
11165 {
11167 }
11168 }
11169 }
11170
11172 {
11174
11175 if (delta)
11177 }
11178
11180
11181 return false;
11182 }
11183
11184
11186 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11187 {
11189 }
11190
11192 {
11195 }
11196
11198 {
11201 }
11202
11204 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11205 {
11206 float value_clamped = Math.Clamp(value, 0, 1);
11208 SetQuantity(result, destroy_config, destroy_forced);
11209 }
11210
11211
11214 {
11216 }
11217
11219 {
11221 }
11222
11223
11224
11225
11226
11227
11228
11229
11230
11231
11233 {
11234 int slot = -1;
11235 GameInventory inventory = GetInventory();
11236 if (inventory)
11237 {
11238 InventoryLocation il = new InventoryLocation;
11241 }
11242
11244 }
11245
11247 {
11248 float quantity_max = 0;
11249
11251 {
11252 if (attSlotID != -1)
11253 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11254
11255 if (quantity_max <= 0)
11257 }
11258
11259 if (quantity_max <= 0)
11261
11262 return quantity_max;
11263 }
11264
11266 {
11268 }
11269
11271 {
11273 }
11274
11275
11277 {
11279 }
11280
11282 {
11284 }
11285
11287 {
11289 }
11290
11291
11293 {
11294
11295 float weightEx = GetWeightEx();
11296 float special = GetInventoryAndCargoWeight();
11297 return weightEx - special;
11298 }
11299
11300
11302 {
11304 }
11305
11307 {
11309 {
11310 #ifdef DEVELOPER
11311 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11312 {
11313 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11315 }
11316 #endif
11317
11318 return GetQuantity() * GetConfigWeightModified();
11319 }
11320 else if (HasEnergyManager())
11321 {
11322 #ifdef DEVELOPER
11323 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11324 {
11325 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11326 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11327 }
11328 #endif
11329 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11330 }
11331 else
11332 {
11333 #ifdef DEVELOPER
11334 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11335 {
11336 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11337 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11338 }
11339 #endif
11340 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11341 }
11342 }
11343
11346 {
11347 int item_count = 0;
11349
11350 GameInventory inventory = GetInventory();
11351 CargoBase cargo = inventory.
GetCargo();
11352 if (cargo != NULL)
11353 {
11355 }
11356
11358 for (int i = 0; i < nAttachments; ++i)
11359 {
11361 if (item)
11362 item_count += item.GetNumberOfItems();
11363 }
11364 return item_count;
11365 }
11366
11369 {
11370 float weight = 0;
11371 float wetness = 1;
11372 if (include_wetness)
11375 {
11376 weight = wetness * m_ConfigWeight;
11377 }
11379 {
11380 weight = 1;
11381 }
11382 return weight;
11383 }
11384
11385
11386
11388 {
11389 GameInventory inventory = GetInventory();
11390 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11391 {
11392 array<EntityAI> items = new array<EntityAI>;
11394 for (int i = 0; i < items.Count(); ++i)
11395 {
11397 if (item)
11398 {
11399 g_Game.ObjectDelete(item);
11400 }
11401 }
11402 }
11403 }
11404
11405
11406
11407
11409 {
11410 float energy = 0;
11411 if (HasEnergyManager())
11412 {
11413 energy = GetCompEM().GetEnergy();
11414 }
11415 return energy;
11416 }
11417
11418
11420 {
11421 super.OnEnergyConsumed();
11422
11424 }
11425
11427 {
11428 super.OnEnergyAdded();
11429
11431 }
11432
11433
11435 {
11436 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11437 {
11439 {
11440 float energy_0to1 = GetCompEM().GetEnergy0To1();
11442 }
11443 }
11444 }
11445
11446
11448 {
11449 return ConfigGetFloat("heatIsolation");
11450 }
11451
11453 {
11455 }
11456
11458 {
11459 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11460 if (
g_Game.ConfigIsExisting(paramPath))
11461 return g_Game.ConfigGetFloat(paramPath);
11462
11463 return 0.0;
11464 }
11465
11467 {
11468 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11469 if (
g_Game.ConfigIsExisting(paramPath))
11470 return g_Game.ConfigGetFloat(paramPath);
11471
11472 return 0.0;
11473 }
11474
11475 override void SetWet(
float value,
bool allow_client =
false)
11476 {
11477 if (!IsServerCheck(allow_client))
11478 return;
11479
11482
11484
11485 m_VarWet = Math.Clamp(value, min, max);
11486
11488 {
11491 }
11492 }
11493
11494 override void AddWet(
float value)
11495 {
11497 }
11498
11500 {
11502 }
11503
11505 {
11507 }
11508
11510 {
11512 }
11513
11515 {
11517 }
11518
11520 {
11522 }
11523
11524 override void OnWetChanged(
float newVal,
float oldVal)
11525 {
11528 if (newLevel != oldLevel)
11529 {
11531 }
11532 }
11533
11535 {
11536 SetWeightDirty();
11537 }
11538
11540 {
11541 return GetWetLevelInternal(
m_VarWet);
11542 }
11543
11544
11545
11547 {
11549 }
11550
11552 {
11554 }
11555
11557 {
11559 }
11560
11562 {
11564 }
11565
11566
11567
11569 {
11570 if (ConfigIsExisting("itemModelLength"))
11571 {
11572 return ConfigGetFloat("itemModelLength");
11573 }
11574 return 0;
11575 }
11576
11578 {
11579 if (ConfigIsExisting("itemAttachOffset"))
11580 {
11581 return ConfigGetFloat("itemAttachOffset");
11582 }
11583 return 0;
11584 }
11585
11586 override void SetCleanness(
int value,
bool allow_client =
false)
11587 {
11588 if (!IsServerCheck(allow_client))
11589 return;
11590
11592
11594
11597 }
11598
11600 {
11602 }
11603
11605 {
11606 return true;
11607 }
11608
11609
11610
11611
11613 {
11615 }
11616
11618 {
11620 }
11621
11622
11623
11624
11625 override void SetColor(
int r,
int g,
int b,
int a)
11626 {
11632 }
11634 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11635 {
11640 }
11641
11643 {
11645 }
11646
11649 {
11650 int r,g,b,a;
11652 r = r/255;
11653 g = g/255;
11654 b = b/255;
11655 a = a/255;
11656 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11657 }
11658
11659
11660
11661 override void SetLiquidType(
int value,
bool allow_client =
false)
11662 {
11663 if (!IsServerCheck(allow_client))
11664 return;
11665
11670 }
11671
11673 {
11674 return ConfigGetInt("varLiquidTypeInit");
11675 }
11676
11678 {
11680 }
11681
11683 {
11685 SetFrozen(false);
11686 }
11687
11690 {
11691 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11692 }
11693
11694
11697 {
11698 PlayerBase nplayer;
11699 if (PlayerBase.CastTo(nplayer, player))
11700 {
11702 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11703 }
11704 }
11705
11706
11709 {
11710 PlayerBase nplayer;
11711 if (PlayerBase.CastTo(nplayer,player))
11712 {
11713 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11714 }
11715
11716 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11717
11718 if (HasEnergyManager())
11719 {
11720 GetCompEM().UpdatePlugState();
11721 }
11722 }
11723
11724
11726 {
11727 super.OnPlacementStarted(player);
11728
11730 }
11731
11732 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11733 {
11735 {
11736 m_AdminLog.OnPlacementComplete(player,
this);
11737 }
11738
11739 super.OnPlacementComplete(player, position, orientation);
11740 }
11741
11742
11743
11744
11745
11747 {
11749 {
11750 return true;
11751 }
11752 else
11753 {
11754 return false;
11755 }
11756 }
11757
11758
11760 {
11762 {
11764 }
11765 }
11766
11767
11769 {
11771 }
11772
11774 {
11776 }
11777
11778 override void InsertAgent(
int agent,
float count = 1)
11779 {
11780 if (count < 1)
11781 return;
11782
11784 }
11785
11788 {
11790 }
11791
11792
11794 {
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
11826
11827
11828
11829
11830
11831
11832
11833
11834
11835
11836
11837
11838
11840 {
11842 return false;
11843 return true;
11844 }
11845
11847 {
11848
11850 }
11851
11852
11855 {
11856 super.CheckForRoofLimited(timeTresholdMS);
11857
11858 float time =
g_Game.GetTime();
11859 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11860 {
11861 m_PreviousRoofTestTime = time;
11862 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11863 }
11864 }
11865
11866
11868 {
11870 {
11871 return 0;
11872 }
11873
11874 if (GetInventory().GetAttachmentSlotsCount() != 0)
11875 {
11876 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11877 if (filter)
11878 return filter.GetProtectionLevel(type, false, system);
11879 else
11880 return 0;
11881 }
11882
11883 string subclassPath, entryName;
11884
11885 switch (type)
11886 {
11888 entryName = "biological";
11889 break;
11891 entryName = "chemical";
11892 break;
11893 default:
11894 entryName = "biological";
11895 break;
11896 }
11897
11898 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11899
11900 return g_Game.ConfigGetFloat(subclassPath + entryName);
11901 }
11902
11903
11904
11907 {
11908 if (!IsMagazine())
11910
11912 }
11913
11914
11915
11916
11917
11922 {
11923 return true;
11924 }
11925
11927 {
11929 }
11930
11931
11932
11933
11934
11936 {
11937 if (parent)
11938 {
11939 if (parent.IsInherited(DayZInfected))
11940 return true;
11941
11942 if (!parent.IsRuined())
11943 return true;
11944 }
11945
11946 return true;
11947 }
11948
11950 {
11951 if (!super.CanPutAsAttachment(parent))
11952 {
11953 return false;
11954 }
11955
11956 if (!IsRuined() && !parent.IsRuined())
11957 {
11958 return true;
11959 }
11960
11961 return false;
11962 }
11963
11965 {
11966
11967
11968
11969
11970 return super.CanReceiveItemIntoCargo(item);
11971 }
11972
11974 {
11975
11976
11977
11978
11979 GameInventory attachmentInv = attachment.GetInventory();
11981 {
11982 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11983 return false;
11984 }
11985
11986 InventoryLocation loc = new InventoryLocation();
11987 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11988 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11989 return false;
11990
11991 return super.CanReceiveAttachment(attachment, slotId);
11992 }
11993
11995 {
11996 if (!super.CanReleaseAttachment(attachment))
11997 return false;
11998
11999 return GetInventory().AreChildrenAccessible();
12000 }
12001
12002
12003
12004
12005
12006
12007
12008
12009
12010
12011
12012
12013
12014
12015
12016
12017
12018
12019
12020
12021
12023 {
12024 int id = muzzle_owner.GetMuzzleID();
12025 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12026
12027 if (WPOF_array)
12028 {
12029 for (int i = 0; i < WPOF_array.Count(); i++)
12030 {
12031 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12032
12033 if (WPOF)
12034 {
12035 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12036 }
12037 }
12038 }
12039 }
12040
12041
12043 {
12044 int id = muzzle_owner.GetMuzzleID();
12046
12047 if (WPOBE_array)
12048 {
12049 for (int i = 0; i < WPOBE_array.Count(); i++)
12050 {
12051 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12052
12053 if (WPOBE)
12054 {
12055 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12056 }
12057 }
12058 }
12059 }
12060
12061
12063 {
12064 int id = muzzle_owner.GetMuzzleID();
12065 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12066
12067 if (WPOOH_array)
12068 {
12069 for (int i = 0; i < WPOOH_array.Count(); i++)
12070 {
12071 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12072
12073 if (WPOOH)
12074 {
12075 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12076 }
12077 }
12078 }
12079 }
12080
12081
12083 {
12084 int id = muzzle_owner.GetMuzzleID();
12085 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12086
12087 if (WPOOH_array)
12088 {
12089 for (int i = 0; i < WPOOH_array.Count(); i++)
12090 {
12091 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12092
12093 if (WPOOH)
12094 {
12095 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12096 }
12097 }
12098 }
12099 }
12100
12101
12103 {
12104 int id = muzzle_owner.GetMuzzleID();
12105 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12106
12107 if (WPOOH_array)
12108 {
12109 for (int i = 0; i < WPOOH_array.Count(); i++)
12110 {
12111 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12112
12113 if (WPOOH)
12114 {
12115 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12116 }
12117 }
12118 }
12119 }
12120
12121
12122
12124 {
12126 {
12127 return true;
12128 }
12129
12130 return false;
12131 }
12132
12134 {
12136 {
12137 return true;
12138 }
12139
12140 return false;
12141 }
12142
12144 {
12146 {
12147 return true;
12148 }
12149
12150 return false;
12151 }
12152
12154 {
12155 return false;
12156 }
12157
12160 {
12161 return UATimeSpent.DEFAULT_DEPLOY;
12162 }
12163
12164
12165
12166
12168 {
12170 SetSynchDirty();
12171 }
12172
12174 {
12176 }
12177
12178
12180 {
12181 return false;
12182 }
12183
12186 {
12187 string att_type = "None";
12188
12189 if (ConfigIsExisting("soundAttType"))
12190 {
12191 att_type = ConfigGetString("soundAttType");
12192 }
12193
12195 }
12196
12198 {
12200 }
12201
12202
12203
12204
12205
12211
12213 {
12216
12218 }
12219
12220
12222 {
12224 return;
12225
12227
12230
12233
12234 SoundParameters params = new SoundParameters();
12238 }
12239
12240
12242 {
12244 {
12247
12248 SetSynchDirty();
12249
12252 }
12253 }
12254
12256 {
12258 }
12259
12260
12262 {
12264 return;
12265
12267 SetSynchDirty();
12268
12271 }
12272
12274 {
12277 }
12278
12280 {
12282 }
12283
12284 void OnApply(PlayerBase player);
12285
12287 {
12288 return 1.0;
12289 };
12290
12292 {
12294 }
12295
12297 {
12299 }
12300
12302
12304 {
12305 SetDynamicPhysicsLifeTime(0.01);
12307 }
12308
12310 {
12311 array<string> zone_names = new array<string>;
12312 GetDamageZones(zone_names);
12313 for (int i = 0; i < zone_names.Count(); i++)
12314 {
12315 SetHealthMax(zone_names.Get(i),"Health");
12316 }
12317 SetHealthMax("","Health");
12318 }
12319
12322 {
12323 float global_health = GetHealth01("","Health");
12324 array<string> zones = new array<string>;
12325 GetDamageZones(zones);
12326
12327 for (int i = 0; i < zones.Count(); i++)
12328 {
12329 SetHealth01(zones.Get(i),"Health",global_health);
12330 }
12331 }
12332
12335 {
12336 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12337 }
12338
12340 {
12341 if (!hasRootAsPlayer)
12342 {
12343 if (refParentIB)
12344 {
12345
12346 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12347 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12348
12349 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12350 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12351
12354 }
12355 else
12356 {
12357
12360 }
12361 }
12362 }
12363
12365 {
12367 {
12368 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12369 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12370 {
12371 float heatPermCoef = 1.0;
12373 while (ent)
12374 {
12375 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12376 ent = ent.GetHierarchyParent();
12377 }
12378
12379 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12380 }
12381 }
12382 }
12383
12385 {
12386
12387 EntityAI parent = GetHierarchyParent();
12388 if (!parent)
12389 {
12390 hasParent = false;
12391 hasRootAsPlayer = false;
12392 }
12393 else
12394 {
12395 hasParent = true;
12396 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12397 refParentIB =
ItemBase.Cast(parent);
12398 }
12399 }
12400
12401 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12402 {
12403
12404 }
12405
12407 {
12408
12409 return false;
12410 }
12411
12413 {
12414
12415
12416 return false;
12417 }
12418
12420 {
12421
12422 return false;
12423 }
12424
12427 {
12428 return !GetIsFrozen() &&
IsOpen();
12429 }
12430
12432 {
12433 bool hasParent = false, hasRootAsPlayer = false;
12435
12436 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12437 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12438
12439 if (wwtu || foodDecay)
12440 {
12444
12445 if (processWetness || processTemperature || processDecay)
12446 {
12448
12449 if (processWetness)
12450 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12451
12452 if (processTemperature)
12454
12455 if (processDecay)
12456 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12457 }
12458 }
12459 }
12460
12463 {
12465 }
12466
12468 {
12471
12472 return super.GetTemperatureFreezeThreshold();
12473 }
12474
12476 {
12479
12480 return super.GetTemperatureThawThreshold();
12481 }
12482
12484 {
12487
12488 return super.GetItemOverheatThreshold();
12489 }
12490
12492 {
12494 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12495
12496 return super.GetTemperatureFreezeTime();
12497 }
12498
12500 {
12502 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12503
12504 return super.GetTemperatureThawTime();
12505 }
12506
12511
12513 {
12514 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12515 }
12516
12518 {
12519 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12520 }
12521
12524 {
12526 }
12527
12529 {
12531 }
12532
12534 {
12536 }
12537
12540 {
12541 return null;
12542 }
12543
12546 {
12547 return false;
12548 }
12549
12551 {
12553 {
12556 if (!trg)
12557 {
12559 explosive = this;
12560 }
12561
12562 explosive.PairRemote(trg);
12564
12565 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12566 trg.SetPersistentPairID(persistentID);
12567 explosive.SetPersistentPairID(persistentID);
12568
12569 return true;
12570 }
12571 return false;
12572 }
12573
12576 {
12577 float ret = 1.0;
12580 ret *= GetHealth01();
12581
12582 return ret;
12583 }
12584
12585 #ifdef DEVELOPER
12586 override void SetDebugItem()
12587 {
12588 super.SetDebugItem();
12589 _itemBase = this;
12590 }
12591
12593 {
12594 string text = super.GetDebugText();
12595
12597 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12598
12599 return text;
12600 }
12601 #endif
12602
12604 {
12605 return true;
12606 }
12607
12609
12611
12613 {
12616 }
12617
12618
12626
12642
12643 [
Obsolete(
"Use ItemSoundHandler instead")]
12646 {
12647 if (!
g_Game.IsDedicatedServer())
12648 {
12649 if (ConfigIsExisting("attachSoundSet"))
12650 {
12651 string cfg_path = "";
12652 string soundset = "";
12653 string type_name =
GetType();
12654
12657 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12658 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12659
12660 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12661 {
12662 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12663 {
12664 if (cfg_slot_array[i] == slot_type)
12665 {
12666 soundset = cfg_soundset_array[i];
12667 break;
12668 }
12669 }
12670 }
12671
12672 if (soundset != "")
12673 {
12674 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12676 }
12677 }
12678 }
12679 }
12680
12682}
12683
12685{
12687 if (entity)
12688 {
12689 bool is_item = entity.IsInherited(
ItemBase);
12690 if (is_item && full_quantity)
12691 {
12694 }
12695 }
12696 else
12697 {
12699 return NULL;
12700 }
12701 return entity;
12702}
12703
12705{
12706 if (item)
12707 {
12708 if (health > 0)
12709 item.SetHealth("", "", health);
12710
12711 if (item.CanHaveTemperature())
12712 {
12714 if (item.CanFreeze())
12715 item.SetFrozen(false);
12716 }
12717
12718 if (item.HasEnergyManager())
12719 {
12720 if (quantity >= 0)
12721 {
12722 item.GetCompEM().SetEnergy0To1(quantity);
12723 }
12724 else
12725 {
12727 }
12728 }
12729 else if (item.IsMagazine())
12730 {
12731 Magazine mag = Magazine.Cast(item);
12732 if (quantity >= 0)
12733 {
12734 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12735 }
12736 else
12737 {
12739 }
12740
12741 }
12742 else
12743 {
12744 if (quantity >= 0)
12745 {
12746 item.SetQuantityNormalized(quantity, false);
12747 }
12748 else
12749 {
12751 }
12752
12753 }
12754 }
12755}
12756
12757#ifdef DEVELOPER
12759#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.