7772{
7774 {
7775 return true;
7776 }
7777};
7778
7780{
7781
7782};
7783
7784
7785
7787{
7791
7793
7796
7797
7798
7799
7800
7809
7815
7820
7825
7846 protected bool m_IsResultOfSplit
7847
7849
7854
7855
7856
7858
7862
7863
7864
7866
7869
7870
7871
7877
7878
7886
7889
7890
7892
7893
7895
7896
7901
7902
7907
7909
7910
7912
7913
7915 {
7920
7921 if (!
g_Game.IsDedicatedServer())
7922 {
7924 {
7926
7928 {
7930 }
7931 }
7932
7935 }
7936
7937 m_OldLocation = null;
7938
7940 {
7942 }
7943
7944 if (ConfigIsExisting("headSelectionsToHide"))
7945 {
7948 }
7949
7951 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7952 {
7954 }
7955
7957
7958 m_IsResultOfSplit = false;
7959
7961 }
7962
7964 {
7965 super.InitItemVariables();
7966
7972 m_Count = ConfigGetInt(
"count");
7973
7976
7981
7984
7989
8001
8005
8006
8009 if (ConfigIsExisting("canBeSplit"))
8010 {
8013 }
8014
8016 if (ConfigIsExisting("itemBehaviour"))
8018
8019
8022 RegisterNetSyncVariableInt("m_VarLiquidType");
8023 RegisterNetSyncVariableInt("m_Cleanness",0,1);
8024
8025 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
8026 RegisterNetSyncVariableFloat("m_ImpactSpeed");
8027 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
8028
8029 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
8030 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
8031 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
8032 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
8033
8034 RegisterNetSyncVariableBool("m_IsBeingPlaced");
8035 RegisterNetSyncVariableBool("m_IsTakeable");
8036 RegisterNetSyncVariableBool("m_IsHologram");
8037
8040 {
8043 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
8044 }
8045
8047
8049 if (ConfigIsExisting("temperaturePerQuantityWeight"))
8051
8053 }
8054
8056 {
8058 }
8059
8061 {
8064 {
8069 }
8070 }
8071
8072 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
8073 {
8075 {
8078 }
8079
8081 }
8082
8084 {
8090 }
8091
8093
8095 {
8097
8098 if (!action)
8099 {
8100 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8101 return;
8102 }
8103
8105 if (!ai)
8106 {
8108 return;
8109 }
8110
8112 if (!action_array)
8113 {
8114 action_array = new array<ActionBase_Basic>;
8116 }
8117 if (LogManager.IsActionLogEnable())
8118 {
8119 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8120 }
8121
8122 if (action_array.Find(action) != -1)
8123 {
8124 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8125 }
8126 else
8127 {
8128 action_array.Insert(action);
8129 }
8130 }
8131
8133 {
8134 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8135 ActionBase action = player.GetActionManager().GetAction(actionName);
8138
8139 if (action_array)
8140 {
8141 action_array.RemoveItem(action);
8142 }
8143 }
8144
8145
8146
8148 {
8149 ActionOverrideData overrideData = new ActionOverrideData();
8153
8155 if (!actionMap)
8156 {
8159 }
8160
8161 actionMap.Insert(this.
Type(), overrideData);
8162
8163 }
8164
8166
8168
8169
8171 {
8174
8177
8178 string config_to_search = "CfgVehicles";
8179 string muzzle_owner_config;
8180
8182 {
8183 if (IsInherited(Weapon))
8184 config_to_search = "CfgWeapons";
8185
8186 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8187
8188 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8189
8190 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8191
8192 if (config_OnFire_subclass_count > 0)
8193 {
8194 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8195
8196 for (int i = 0; i < config_OnFire_subclass_count; i++)
8197 {
8198 string particle_class = "";
8199 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8200 string config_OnFire_entry = config_OnFire_class + particle_class;
8201 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8202 WPOF_array.Insert(WPOF);
8203 }
8204
8205
8207 }
8208 }
8209
8211 {
8212 config_to_search = "CfgWeapons";
8213 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8214
8215 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8216
8217 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8218
8219 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8220 {
8221 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8222
8223 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8224 {
8225 string particle_class2 = "";
8226 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8227 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8228 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8229 WPOBE_array.Insert(WPOBE);
8230 }
8231
8232
8234 }
8235 }
8236 }
8237
8238
8240 {
8243
8245 {
8246 string config_to_search = "CfgVehicles";
8247
8248 if (IsInherited(Weapon))
8249 config_to_search = "CfgWeapons";
8250
8251 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8252 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8253
8254 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8255 {
8256
8258
8260 {
8262 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8264 return;
8265 }
8266
8269
8270
8271
8272 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8273 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8274
8275 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8276 {
8277 string particle_class = "";
8278 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8279 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8280 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8281
8282 if (entry_type == CT_CLASS)
8283 {
8284 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8285 WPOOH_array.Insert(WPOF);
8286 }
8287 }
8288
8289
8291 }
8292 }
8293 }
8294
8296 {
8298 }
8299
8301 {
8303 {
8305
8308
8311
8312 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8313 }
8314 }
8315
8317 {
8319 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8320
8322 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8323
8325 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8326
8328 {
8330 }
8331 }
8332
8334 {
8336 }
8337
8339 {
8342 else
8344
8346 {
8349 }
8350 else
8351 {
8354
8357 }
8358
8360 }
8361
8363 {
8365 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8366 }
8367
8369 {
8371 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8373 }
8374
8376 {
8378 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8379 }
8380
8382 {
8385
8386 OverheatingParticle OP = new OverheatingParticle();
8391
8393 }
8394
8396 {
8399
8400 return -1;
8401 }
8402
8404 {
8406 {
8409
8410 for (int i = count; i > 0; --i)
8411 {
8412 int id = i - 1;
8415
8418
8419 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8420 {
8421 if (p)
8422 {
8425 }
8426 }
8427 }
8428 }
8429 }
8430
8432 {
8434 {
8436 {
8437 int id = i - 1;
8439
8440 if (OP)
8441 {
8443
8444 if (p)
8445 {
8447 }
8448
8449 delete OP;
8450 }
8451 }
8452
8455 }
8456 }
8457
8460 {
8461 return 0.0;
8462 }
8463
8464
8466 {
8467 return 250;
8468 }
8469
8471 {
8472 return 0;
8473 }
8474
8477 {
8479 return true;
8480
8481 return false;
8482 }
8483
8486 {
8489
8491 {
8493 }
8494 else
8495 {
8496
8498 }
8499
8501 }
8502
8509 {
8510 return -1;
8511 }
8512
8513
8514
8515
8517 {
8519 {
8520 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8521 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8522
8523 if (r_index >= 0)
8524 {
8525 InventoryLocation r_il = new InventoryLocation;
8526 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8527
8528 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8531 {
8532 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8533 }
8535 {
8536 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8537 }
8538
8539 }
8540
8541 player.GetHumanInventory().ClearUserReservedLocation(this);
8542 }
8543
8546 }
8547
8548
8549
8550
8552 {
8553 return ItemBase.m_DebugActionsMask;
8554 }
8555
8557 {
8558 return ItemBase.m_DebugActionsMask & mask;
8559 }
8560
8562 {
8563 ItemBase.m_DebugActionsMask = mask;
8564 }
8565
8567 {
8568 ItemBase.m_DebugActionsMask |= mask;
8569 }
8570
8572 {
8573 ItemBase.m_DebugActionsMask &= ~mask;
8574 }
8575
8577 {
8579 {
8581 }
8582 else
8583 {
8585 }
8586 }
8587
8588
8590 {
8591 if (GetEconomyProfile())
8592 {
8593 float q_max = GetEconomyProfile().GetQuantityMax();
8594 if (q_max > 0)
8595 {
8596 float q_min = GetEconomyProfile().GetQuantityMin();
8597 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8598
8600 {
8601 ComponentEnergyManager comp = GetCompEM();
8603 {
8605 }
8606 }
8608 {
8610
8611 }
8612
8613 }
8614 }
8615 }
8616
8619 {
8620 EntityAI parent = GetHierarchyParent();
8621
8622 if (parent)
8623 {
8624 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8625 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8626 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8627 }
8628 }
8629
8632 {
8633 EntityAI parent = GetHierarchyParent();
8634
8635 if (parent)
8636 {
8637 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8638 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8639 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8640 }
8641 }
8642
8644 {
8645
8646
8647
8648
8650
8652 {
8653 if (ScriptInputUserData.CanStoreInputUserData())
8654 {
8655 ScriptInputUserData ctx = new ScriptInputUserData;
8661 ctx.
Write(use_stack_max);
8664
8666 {
8667 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8668 }
8669 }
8670 }
8671 else if (!
g_Game.IsMultiplayer())
8672 {
8674 }
8675 }
8676
8678 {
8680 }
8681
8683 {
8685 }
8686
8688 {
8690 }
8691
8693 {
8694
8695 return false;
8696 }
8697
8699 {
8700 return false;
8701 }
8702
8706 {
8707 return false;
8708 }
8709
8711 {
8712 return "";
8713 }
8714
8716
8718 {
8719 return false;
8720 }
8721
8723 {
8724 return true;
8725 }
8726
8727
8728
8730 {
8731 return true;
8732 }
8733
8735 {
8736 return true;
8737 }
8738
8740 {
8741 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8743 }
8744
8746 {
8748 }
8749
8751 {
8753 if (!is_being_placed)
8755 SetSynchDirty();
8756 }
8757
8758
8760
8762 {
8764 }
8765
8767 {
8769 }
8770
8772 {
8773 return 1;
8774 }
8775
8777 {
8778 return false;
8779 }
8780
8782 {
8784 SetSynchDirty();
8785 }
8786
8787
8788
8789
8790
8791
8792
8793
8794
8795
8796
8797
8798
8799
8800
8801
8802
8803
8804
8805
8806
8807
8808
8809
8810
8811
8812
8813
8814
8815
8816
8817
8818
8819
8820
8822 {
8823 super.OnMovedInsideCargo(container);
8824
8825 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8826 }
8827
8828 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8829 {
8830 super.EEItemLocationChanged(oldLoc, newLoc);
8831
8832 PlayerBase newPlayer = null;
8833 PlayerBase oldPlayer = null;
8834
8835 if (newLoc.GetParent())
8836 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8837
8838 if (oldLoc.GetParent())
8839 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8840
8842 {
8843 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8844
8845 if (rIndex >= 0)
8846 {
8847 InventoryLocation rIl = new InventoryLocation;
8848 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8849
8850 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8853 {
8854 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8855 }
8857 {
8859 }
8860
8861 }
8862 }
8863
8865 {
8866 if (newPlayer)
8867 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8868
8869 if (newPlayer == oldPlayer)
8870 {
8871 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8872 {
8874 {
8875 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8876 {
8877 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8878 }
8879 }
8880 else
8881 {
8882 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8883 }
8884 }
8885
8886 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8887 {
8888 int type = oldLoc.GetType();
8890 {
8891 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8892 }
8894 {
8895 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8896 }
8897 }
8898 if (!m_OldLocation)
8899 {
8900 m_OldLocation = new InventoryLocation;
8901 }
8902 m_OldLocation.Copy(oldLoc);
8903 }
8904 else
8905 {
8906 if (m_OldLocation)
8907 {
8908 m_OldLocation.Reset();
8909 }
8910 }
8911
8912 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8913 }
8914 else
8915 {
8916 if (newPlayer)
8917 {
8918 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8919 if (resIndex >= 0)
8920 {
8921 InventoryLocation il = new InventoryLocation;
8922 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8924 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8927 {
8928 il.
GetParent().GetOnReleaseLock().Invoke(it);
8929 }
8931 {
8933 }
8934
8935 }
8936 }
8938 {
8939
8941 }
8942
8943 if (m_OldLocation)
8944 {
8945 m_OldLocation.Reset();
8946 }
8947 }
8948
8950 {
8951 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8952 }
8953
8955 {
8956 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8957 }
8958 }
8959
8960 override void EOnContact(IEntity other, Contact extra)
8961 {
8963 {
8964 int liquidType = -1;
8966 if (impactSpeed > 0.0)
8967 {
8969 #ifndef SERVER
8971 #else
8973 SetSynchDirty();
8974 #endif
8976 }
8977 }
8978
8979 #ifdef SERVER
8980 if (GetCompEM() && GetCompEM().IsPlugged())
8981 {
8982 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8983 GetCompEM().UnplugThis();
8984 }
8985 #endif
8986 }
8987
8989
8991 {
8993 }
8994
8996 {
8997
8998 }
8999
9001 {
9002 super.OnItemLocationChanged(old_owner, new_owner);
9003
9004 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
9005 PlayerBase playerNew = PlayerBase.Cast(new_owner);
9006
9007 if (!relatedPlayer && playerNew)
9008 relatedPlayer = playerNew;
9009
9010 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
9011 {
9013 if (actionMgr)
9014 {
9015 ActionBase currentAction = actionMgr.GetRunningAction();
9016 if (currentAction)
9018 }
9019 }
9020
9021 Man ownerPlayerOld = null;
9022 Man ownerPlayerNew = null;
9023
9024 if (old_owner)
9025 {
9026 if (old_owner.
IsMan())
9027 {
9028 ownerPlayerOld = Man.Cast(old_owner);
9029 }
9030 else
9031 {
9032 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
9033 }
9034 }
9035 else
9036 {
9038 {
9040
9041 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
9042 {
9043 GetCompEM().UnplugThis();
9044 }
9045 }
9046 }
9047
9048 if (new_owner)
9049 {
9050 if (new_owner.
IsMan())
9051 {
9052 ownerPlayerNew = Man.Cast(new_owner);
9053 }
9054 else
9055 {
9056 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
9057 }
9058 }
9059
9060 if (ownerPlayerOld != ownerPlayerNew)
9061 {
9062 if (ownerPlayerOld)
9063 {
9064 array<EntityAI> subItemsExit = new array<EntityAI>;
9066 for (int i = 0; i < subItemsExit.Count(); i++)
9067 {
9070 }
9071 }
9072
9073 if (ownerPlayerNew)
9074 {
9075 array<EntityAI> subItemsEnter = new array<EntityAI>;
9077 for (int j = 0; j < subItemsEnter.Count(); j++)
9078 {
9081 }
9082 }
9083 }
9084 else if (ownerPlayerNew != null)
9085 {
9086 PlayerBase nplayer;
9087 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9088 {
9089 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9091 for (int k = 0; k < subItemsUpdate.Count(); k++)
9092 {
9094 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9095 }
9096 }
9097 }
9098
9099 if (old_owner)
9100 old_owner.OnChildItemRemoved(this);
9101 if (new_owner)
9102 new_owner.OnChildItemReceived(this);
9103 }
9104
9105
9107 {
9108 super.EEDelete(parent);
9109 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9110 if (player)
9111 {
9113
9114 if (player.IsAlive())
9115 {
9116 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9117 if (r_index >= 0)
9118 {
9119 InventoryLocation r_il = new InventoryLocation;
9120 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9121
9122 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9125 {
9126 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9127 }
9129 {
9130 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9131 }
9132
9133 }
9134
9135 player.RemoveQuickBarEntityShortcut(this);
9136 }
9137 }
9138 }
9139
9141 {
9142 super.EEKilled(killer);
9143
9146 {
9147 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9148 {
9149 if (IsMagazine())
9150 {
9151 if (Magazine.Cast(this).GetAmmoCount() > 0)
9152 {
9154 }
9155 }
9156 else
9157 {
9159 }
9160 }
9161 }
9162 }
9163
9165 {
9166 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9167
9168 super.OnWasAttached(parent, slot_id);
9169
9172
9175 }
9176
9178 {
9179 super.OnWasDetached(parent, slot_id);
9180
9183
9186 }
9187
9189 {
9190 int idx;
9193
9194 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9195 if (inventory_slots.Count() < 1)
9196 {
9197 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9198 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9199 }
9200 else
9201 {
9202 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9203 }
9204
9205 idx = inventory_slots.Find(slot);
9206 if (idx < 0)
9207 return "";
9208
9209 return attach_types.Get(idx);
9210 }
9211
9213 {
9214 int idx = -1;
9215 string slot;
9216
9219
9220 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9221 if (inventory_slots.Count() < 1)
9222 {
9223 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9224 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9225 }
9226 else
9227 {
9228 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9229 if (detach_types.Count() < 1)
9230 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9231 }
9232
9233 for (int i = 0; i < inventory_slots.Count(); i++)
9234 {
9235 slot = inventory_slots.Get(i);
9236 }
9237
9238 if (slot != "")
9239 {
9240 if (detach_types.Count() == 1)
9241 idx = 0;
9242 else
9243 idx = inventory_slots.Find(slot);
9244 }
9245 if (idx < 0)
9246 return "";
9247
9248 return detach_types.Get(idx);
9249 }
9250
9252 {
9253
9255
9256
9257 float min_time = 1;
9258 float max_time = 3;
9259 float delay = Math.RandomFloat(min_time, max_time);
9260
9261 explode_timer.Run(delay, this, "DoAmmoExplosion");
9262 }
9263
9265 {
9266 Magazine magazine = Magazine.Cast(this);
9267 int pop_sounds_count = 6;
9268 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9269
9270
9271 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9272 string sound_name = pop_sounds[ sound_idx ];
9273 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9274
9275
9276 magazine.ServerAddAmmoCount(-1);
9277
9278
9279 float min_temp_to_explode = 100;
9280
9281 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9282 {
9284 }
9285 }
9286
9287
9288 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9289 {
9290 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9291
9292 const int CHANCE_DAMAGE_CARGO = 4;
9293 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9294 const int CHANCE_DAMAGE_NOTHING = 2;
9295
9297 {
9298 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9299 int chances;
9300 int rnd;
9301
9302 if (GetInventory().GetCargo())
9303 {
9304 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9305 rnd = Math.RandomInt(0,chances);
9306
9307 if (rnd < CHANCE_DAMAGE_CARGO)
9308 {
9310 }
9311 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9312 {
9314 }
9315 }
9316 else
9317 {
9318 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9319 rnd = Math.RandomInt(0,chances);
9320
9321 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9322 {
9324 }
9325 }
9326 }
9327 }
9328
9330 {
9331 CargoBase cargo = GetInventory().GetCargo();
9332 if (cargo)
9333 {
9335 if (item_count > 0)
9336 {
9337 int random_pick = Math.RandomInt(0, item_count);
9339 if (!item.IsExplosive())
9340 {
9341 item.AddHealth("","",damage);
9342 return true;
9343 }
9344 }
9345 }
9346 return false;
9347 }
9348
9350 {
9351 GameInventory inventory = GetInventory();
9353 if (attachment_count > 0)
9354 {
9355 int random_pick = Math.RandomInt(0, attachment_count);
9357 if (!attachment.IsExplosive())
9358 {
9359 attachment.AddHealth("","",damage);
9360 return true;
9361 }
9362 }
9363 return false;
9364 }
9365
9367 {
9369 }
9370
9372 {
9374 return GetInventory().CanRemoveEntity();
9375
9376 return false;
9377 }
9378
9380 {
9381
9383 return false;
9384
9385
9387 return false;
9388
9389
9390
9392 if (delta == 0)
9393 return false;
9394
9395
9396 return true;
9397 }
9398
9400 {
9402 {
9403 if (ScriptInputUserData.CanStoreInputUserData())
9404 {
9405 ScriptInputUserData ctx = new ScriptInputUserData;
9410 ctx.
Write(destination_entity);
9414 }
9415 }
9416 else if (!
g_Game.IsMultiplayer())
9417 {
9419 }
9420 }
9421
9423 {
9424 float split_quantity_new;
9428 InventoryLocation loc = new InventoryLocation;
9429
9430 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9431 {
9433 split_quantity_new = stack_max;
9434 else
9436
9438 {
9439 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9440 if (new_item)
9441 {
9442 new_item.SetResultOfSplit(true);
9443 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9445 new_item.
SetQuantity(split_quantity_new,
false,
true);
9446 }
9447 }
9448 }
9449 else if (destination_entity && slot_id == -1)
9450 {
9451 if (quantity > stack_max)
9452 split_quantity_new = stack_max;
9453 else
9454 split_quantity_new = quantity;
9455
9457 {
9458 GameInventory destinationInventory = destination_entity.GetInventory();
9460 {
9463 }
9464
9465 if (new_item)
9466 {
9467 new_item.SetResultOfSplit(true);
9468 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9470 new_item.
SetQuantity(split_quantity_new,
false,
true);
9471 }
9472 }
9473 }
9474 else
9475 {
9476 if (stack_max != 0)
9477 {
9479 {
9481 }
9482
9483 if (split_quantity_new == 0)
9484 {
9485 if (!
g_Game.IsMultiplayer())
9486 player.PhysicalPredictiveDropItem(this);
9487 else
9488 player.ServerDropEntity(this);
9489 return;
9490 }
9491
9493 {
9495
9496 if (new_item)
9497 {
9498 new_item.SetResultOfSplit(true);
9499 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9502 new_item.PlaceOnSurface();
9503 }
9504 }
9505 }
9506 }
9507 }
9508
9510 {
9511 float split_quantity_new;
9515 InventoryLocation loc = new InventoryLocation;
9516
9517 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9518 {
9520 split_quantity_new = stack_max;
9521 else
9523
9525 {
9526 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9527 if (new_item)
9528 {
9529 new_item.SetResultOfSplit(true);
9530 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9532 new_item.
SetQuantity(split_quantity_new,
false,
true);
9533 }
9534 }
9535 }
9536 else if (destination_entity && slot_id == -1)
9537 {
9538 if (quantity > stack_max)
9539 split_quantity_new = stack_max;
9540 else
9541 split_quantity_new = quantity;
9542
9544 {
9545 GameInventory destinationInventory = destination_entity.GetInventory();
9547 {
9550 }
9551
9552 if (new_item)
9553 {
9554 new_item.SetResultOfSplit(true);
9555 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9557 new_item.
SetQuantity(split_quantity_new,
false,
true);
9558 }
9559 }
9560 }
9561 else
9562 {
9563 if (stack_max != 0)
9564 {
9566 {
9568 }
9569
9571 {
9573
9574 if (new_item)
9575 {
9576 new_item.SetResultOfSplit(true);
9577 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9580 new_item.PlaceOnSurface();
9581 }
9582 }
9583 }
9584 }
9585 }
9586
9588 {
9590 {
9591 if (ScriptInputUserData.CanStoreInputUserData())
9592 {
9593 ScriptInputUserData ctx = new ScriptInputUserData;
9598 dst.WriteToContext(ctx);
9600 }
9601 }
9602 else if (!
g_Game.IsMultiplayer())
9603 {
9605 }
9606 }
9607
9609 {
9611 {
9612 if (ScriptInputUserData.CanStoreInputUserData())
9613 {
9614 ScriptInputUserData ctx = new ScriptInputUserData;
9619 ctx.
Write(destination_entity);
9625 }
9626 }
9627 else if (!
g_Game.IsMultiplayer())
9628 {
9630 }
9631 }
9632
9634 {
9636 }
9637
9639 {
9641 float split_quantity_new;
9643 if (dst.IsValid())
9644 {
9645 int slot_id = dst.GetSlot();
9647
9648 if (quantity > stack_max)
9649 split_quantity_new = stack_max;
9650 else
9651 split_quantity_new = quantity;
9652
9654 {
9656
9657 if (new_item)
9658 {
9659 new_item.SetResultOfSplit(true);
9660 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9662 new_item.
SetQuantity(split_quantity_new,
false,
true);
9663 }
9664
9665 return new_item;
9666 }
9667 }
9668
9669 return null;
9670 }
9671
9673 {
9675 float split_quantity_new;
9677 if (destination_entity)
9678 {
9680 if (quantity > stackable)
9681 split_quantity_new = stackable;
9682 else
9683 split_quantity_new = quantity;
9684
9686 {
9687 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9688 if (new_item)
9689 {
9690 new_item.SetResultOfSplit(true);
9691 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9693 new_item.
SetQuantity(split_quantity_new,
false,
true);
9694 }
9695 }
9696 }
9697 }
9698
9700 {
9702 {
9703 if (ScriptInputUserData.CanStoreInputUserData())
9704 {
9705 ScriptInputUserData ctx = new ScriptInputUserData;
9710 ItemBase destination_entity =
this;
9711 ctx.
Write(destination_entity);
9715 }
9716 }
9717 else if (!
g_Game.IsMultiplayer())
9718 {
9720 }
9721 }
9722
9724 {
9726 float split_quantity_new;
9728 if (player)
9729 {
9731 if (quantity > stackable)
9732 split_quantity_new = stackable;
9733 else
9734 split_quantity_new = quantity;
9735
9737 {
9738 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9739 new_item =
ItemBase.Cast(in_hands);
9740 if (new_item)
9741 {
9742 new_item.SetResultOfSplit(true);
9743 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9745 new_item.SetQuantity(split_quantity_new, false, true);
9746 }
9747 }
9748 }
9749 }
9750
9752 {
9754 float split_quantity_new = Math.Floor(quantity * 0.5);
9755
9757 return;
9758
9760
9761 if (new_item)
9762 {
9763 if (new_item.GetQuantityMax() < split_quantity_new)
9764 {
9765 split_quantity_new = new_item.GetQuantityMax();
9766 }
9767
9768 new_item.SetResultOfSplit(true);
9769 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9770
9772 {
9775 }
9776 else
9777 {
9779 new_item.
SetQuantity(split_quantity_new,
false,
true);
9780 }
9781 }
9782 }
9783
9785 {
9787 float split_quantity_new = Math.Floor(quantity / 2);
9788
9790 return;
9791
9792 InventoryLocation invloc = new InventoryLocation;
9794
9796 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9797
9798 if (new_item)
9799 {
9800 if (new_item.GetQuantityMax() < split_quantity_new)
9801 {
9802 split_quantity_new = new_item.GetQuantityMax();
9803 }
9805 {
9808 }
9809 else if (split_quantity_new > 1)
9810 {
9812 new_item.
SetQuantity(split_quantity_new,
false,
true);
9813 }
9814 }
9815 }
9816
9819 {
9820 SetWeightDirty();
9822
9823 if (parent)
9824 parent.OnAttachmentQuantityChangedEx(this, delta);
9825
9827 {
9829 {
9831 }
9833 {
9834 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9836 }
9837 }
9838 }
9839
9842 {
9843
9844 }
9845
9848 {
9850 }
9851
9853 {
9854 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9855
9857 {
9858 if (newLevel == GameConstants.STATE_RUINED)
9859 {
9861 EntityAI parent = GetHierarchyParent();
9862 if (parent && parent.IsFireplace())
9863 {
9864 CargoBase cargo = GetInventory().GetCargo();
9865 if (cargo)
9866 {
9868 {
9870 }
9871 }
9872 }
9873 }
9874
9876 {
9877
9879 return;
9880 }
9881
9882 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9883 {
9885 }
9886 }
9887 }
9888
9889
9891 {
9892 super.OnRightClick();
9893
9895 {
9897 {
9898 if (ScriptInputUserData.CanStoreInputUserData())
9899 {
9900 EntityAI root = GetHierarchyRoot();
9901 Man playerOwner = GetHierarchyRootPlayer();
9902 InventoryLocation dst = new InventoryLocation;
9903
9904
9905 if (!playerOwner && root && root == this)
9906 {
9908 }
9909 else
9910 {
9911
9912 GetInventory().GetCurrentInventoryLocation(dst);
9914 {
9915 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9917 {
9919 }
9920 else
9921 {
9923
9924
9925 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9926 {
9928 }
9929 else
9930 {
9931 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9932 }
9933 }
9934 }
9935 }
9936
9937 ScriptInputUserData ctx = new ScriptInputUserData;
9945 }
9946 }
9947 else if (!
g_Game.IsMultiplayer())
9948 {
9950 }
9951 }
9952 }
9953
9955 {
9956 if (root)
9957 {
9958 vector m4[4];
9959 root.GetTransform(m4);
9960 dst.SetGround(this, m4);
9961 }
9962 else
9963 {
9964 GetInventory().GetCurrentInventoryLocation(dst);
9965 }
9966 }
9967
9968 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9969 {
9970
9971 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9972 return false;
9973
9974 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9975 return false;
9976
9977
9979 return false;
9980
9981
9982 Magazine mag = Magazine.Cast(this);
9983 if (mag)
9984 {
9985 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9986 return false;
9987
9988 if (stack_max_limit)
9989 {
9990 Magazine other_mag = Magazine.Cast(other_item);
9991 if (other_item)
9992 {
9993 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9994 return false;
9995 }
9996
9997 }
9998 }
9999 else
10000 {
10001
10003 return false;
10004
10006 return false;
10007 }
10008
10009 PlayerBase player = null;
10010 if (CastTo(player, GetHierarchyRootPlayer()))
10011 {
10012 if (player.GetInventory().HasAttachment(this))
10013 return false;
10014
10015 if (player.IsItemsToDelete())
10016 return false;
10017 }
10018
10019 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
10020 return false;
10021
10022 int slotID;
10024 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
10025 return false;
10026
10027 return true;
10028 }
10029
10031 {
10033 }
10034
10036 {
10037 return m_IsResultOfSplit;
10038 }
10039
10041 {
10042 m_IsResultOfSplit = value;
10043 }
10044
10046 {
10048 }
10049
10051 {
10052 float other_item_quantity = other_item.GetQuantity();
10053 float this_free_space;
10054
10056
10058
10059 if (other_item_quantity > this_free_space)
10060 {
10061 return this_free_space;
10062 }
10063 else
10064 {
10065 return other_item_quantity;
10066 }
10067 }
10068
10070 {
10072 }
10073
10075 {
10077 return;
10078
10079 if (!IsMagazine() && other_item)
10080 {
10082 if (quantity_used != 0)
10083 {
10084 float hp1 = GetHealth01("","");
10085 float hp2 = other_item.GetHealth01("","");
10086 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10087 hpResult = hpResult / (
GetQuantity() + quantity_used);
10088
10089 hpResult *= GetMaxHealth();
10090 Math.Round(hpResult);
10091 SetHealth("", "Health", hpResult);
10092
10094 other_item.AddQuantity(-quantity_used);
10095 }
10096 }
10098 }
10099
10101 {
10102 #ifdef SERVER
10103 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10104 GetHierarchyParent().IncreaseLifetimeUp();
10105 #endif
10106 };
10107
10109 {
10110 PlayerBase p = PlayerBase.Cast(player);
10111
10112 array<int> recipesIds = p.m_Recipes;
10113 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10114 if (moduleRecipesManager)
10115 {
10116 EntityAI itemInHands = player.GetEntityInHands();
10117 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10118 }
10119
10120 for (int i = 0;i < recipesIds.Count(); i++)
10121 {
10122 int key = recipesIds.Get(i);
10123 string recipeName = moduleRecipesManager.GetRecipeName(key);
10125 }
10126 }
10127
10128
10129 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10130 {
10131 super.GetDebugActions(outputList);
10132
10133
10139
10140
10145
10150
10151
10155
10156
10158 {
10162 }
10163
10166
10167
10171
10173
10174 InventoryLocation loc = new InventoryLocation();
10175 GetInventory().GetCurrentInventoryLocation(loc);
10177 {
10178 if (Gizmo_IsSupported())
10181 }
10182
10184 }
10185
10186
10187
10188
10190 {
10191 super.OnAction(action_id, player, ctx);
10192
10194 {
10195 switch (action_id)
10196 {
10200 return true;
10204 return true;
10205 }
10206 }
10207
10209 {
10210 switch (action_id)
10211 {
10213 Delete();
10214 return true;
10215 }
10216 }
10217
10218 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10219 {
10220 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10221 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10222 PlayerBase p = PlayerBase.Cast(player);
10223 if (
EActions.RECIPES_RANGE_START < 1000)
10224 {
10225 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10226 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10227 }
10228 }
10229 #ifndef SERVER
10230 else if (action_id ==
EActions.WATCH_PLAYER)
10231 {
10232 PluginDeveloper.SetDeveloperItemClientEx(player);
10233 }
10234 #endif
10236 {
10237 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10238 {
10239 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10240 OnDebugButtonPressServer(id + 1);
10241 }
10242
10243 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10244 {
10245 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10247 }
10248
10249 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10250 {
10251 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10253 }
10254
10255 else if (action_id ==
EActions.ADD_QUANTITY)
10256 {
10257 if (IsMagazine())
10258 {
10259 Magazine mag = Magazine.Cast(this);
10260 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10261 }
10262 else
10263 {
10265 }
10266
10267 if (m_EM)
10268 {
10269 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10270 }
10271
10272 }
10273
10274 else if (action_id ==
EActions.REMOVE_QUANTITY)
10275 {
10276 if (IsMagazine())
10277 {
10278 Magazine mag2 = Magazine.Cast(this);
10279 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10280 }
10281 else
10282 {
10284 }
10285 if (m_EM)
10286 {
10287 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10288 }
10289
10290 }
10291
10292 else if (action_id ==
EActions.SET_QUANTITY_0)
10293 {
10295
10296 if (m_EM)
10297 {
10298 m_EM.SetEnergy(0);
10299 }
10300 }
10301
10302 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10303 {
10305
10306 if (m_EM)
10307 {
10308 m_EM.SetEnergy(m_EM.GetEnergyMax());
10309 }
10310 }
10311
10312 else if (action_id ==
EActions.ADD_HEALTH)
10313 {
10314 AddHealth("","",GetMaxHealth("","Health")/5);
10315 }
10316 else if (action_id ==
EActions.REMOVE_HEALTH)
10317 {
10318 AddHealth("","",-GetMaxHealth("","Health")/5);
10319 }
10320 else if (action_id ==
EActions.DESTROY_HEALTH)
10321 {
10322 SetHealth01("","",0);
10323 }
10324 else if (action_id ==
EActions.WATCH_ITEM)
10325 {
10327 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10328 #ifdef DEVELOPER
10329 SetDebugDeveloper_item(this);
10330 #endif
10331 }
10332
10333 else if (action_id ==
EActions.ADD_TEMPERATURE)
10334 {
10335 AddTemperature(20);
10336
10337 }
10338
10339 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10340 {
10341 AddTemperature(-20);
10342
10343 }
10344
10345 else if (action_id ==
EActions.FLIP_FROZEN)
10346 {
10347 SetFrozen(!GetIsFrozen());
10348
10349 }
10350
10351 else if (action_id ==
EActions.ADD_WETNESS)
10352 {
10354
10355 }
10356
10357 else if (action_id ==
EActions.REMOVE_WETNESS)
10358 {
10360
10361 }
10362
10363 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10364 {
10367
10368
10369 }
10370
10371 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10372 {
10375 }
10376
10377 else if (action_id ==
EActions.MAKE_SPECIAL)
10378 {
10379 auto debugParams = DebugSpawnParams.WithPlayer(player);
10380 OnDebugSpawnEx(debugParams);
10381 }
10382
10383 }
10384
10385
10386 return false;
10387 }
10388
10389
10390
10391
10395
10398
10399
10400
10402 {
10403 return false;
10404 }
10405
10406
10408 {
10409 return true;
10410 }
10411
10412
10414 {
10415 return true;
10416 }
10417
10418
10419
10421 {
10422 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10423 return g_Game.ConfigIsExisting(config_path);
10424 }
10425
10428 {
10429 return null;
10430 }
10431
10433 {
10434 return false;
10435 }
10436
10438 {
10439 return false;
10440 }
10441
10445
10446
10448 {
10449 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10450 return module_repairing.CanRepair(this, item_repair_kit);
10451 }
10452
10453
10454 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10455 {
10456 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10457 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10458 }
10459
10460
10462 {
10463
10464
10465
10466
10467
10468
10469
10470
10471 return 1;
10472 }
10473
10474
10475
10477 {
10479 }
10480
10481
10482
10484 {
10486 }
10487
10488
10497 {
10498 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10499
10500 if (player)
10501 {
10502 player.MessageStatus(text);
10503 }
10504 }
10505
10506
10515 {
10516 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10517
10518 if (player)
10519 {
10520 player.MessageAction(text);
10521 }
10522 }
10523
10524
10533 {
10534 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10535
10536 if (player)
10537 {
10538 player.MessageFriendly(text);
10539 }
10540 }
10541
10542
10551 {
10552 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10553
10554 if (player)
10555 {
10556 player.MessageImportant(text);
10557 }
10558 }
10559
10561 {
10562 return true;
10563 }
10564
10565
10566 override bool KindOf(
string tag)
10567 {
10568 bool found = false;
10569 string item_name = this.
GetType();
10571 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10572
10573 int array_size = item_tag_array.Count();
10574 for (int i = 0; i < array_size; i++)
10575 {
10576 if (item_tag_array.Get(i) == tag)
10577 {
10578 found = true;
10579 break;
10580 }
10581 }
10582 return found;
10583 }
10584
10585
10587 {
10588
10589 super.OnRPC(sender, rpc_type,ctx);
10590
10591
10592 switch (rpc_type)
10593 {
10594 #ifndef SERVER
10595 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10596 Param2<bool, string> p = new Param2<bool, string>(false, "");
10597
10599 return;
10600
10601 bool play = p.param1;
10602 string soundSet = p.param2;
10603
10604 if (play)
10605 {
10607 {
10609 {
10611 }
10612 }
10613 else
10614 {
10616 }
10617 }
10618 else
10619 {
10621 }
10622
10623 break;
10624 #endif
10625
10626 }
10627
10629 {
10631 }
10632 }
10633
10634
10635
10636
10638 {
10639 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10640 return plugin.GetID(
name);
10641 }
10642
10644 {
10645 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10646 return plugin.GetName(id);
10647 }
10648
10651 {
10652
10653
10654 int varFlags;
10655 if (!ctx.
Read(varFlags))
10656 return;
10657
10658 if (varFlags & ItemVariableFlags.FLOAT)
10659 {
10661 }
10662 }
10663
10665 {
10666
10667 super.SerializeNumericalVars(floats_out);
10668
10669
10670
10672 {
10674 }
10675
10677 {
10679 }
10680
10682 {
10684 }
10685
10687 {
10692 }
10693
10695 {
10697 }
10698 }
10699
10701 {
10702
10703 super.DeSerializeNumericalVars(floats);
10704
10705
10706 int index = 0;
10707 int mask = Math.Round(floats.Get(index));
10708
10709 index++;
10710
10712 {
10714 {
10716 }
10717 else
10718 {
10719 float quantity = floats.Get(index);
10720 SetQuantity(quantity,
true,
false,
false,
false);
10721 }
10722 index++;
10723 }
10724
10726 {
10727 float wet = floats.Get(index);
10729 index++;
10730 }
10731
10733 {
10734 int liquidtype = Math.Round(floats.Get(index));
10736 index++;
10737 }
10738
10740 {
10742 index++;
10744 index++;
10746 index++;
10748 index++;
10749 }
10750
10752 {
10753 int cleanness = Math.Round(floats.Get(index));
10755 index++;
10756 }
10757 }
10758
10760 {
10761 super.WriteVarsToCTX(ctx);
10762
10763
10765 {
10767 }
10768
10770 {
10772 }
10773
10775 {
10777 }
10778
10780 {
10781 int r,g,b,a;
10787 }
10788
10790 {
10792 }
10793 }
10794
10796 {
10797 if (!super.ReadVarsFromCTX(ctx,version))
10798 return false;
10799
10800 int intValue;
10801 float value;
10802
10803 if (version < 140)
10804 {
10805 if (!ctx.
Read(intValue))
10806 return false;
10807
10808 m_VariablesMask = intValue;
10809 }
10810
10812 {
10813 if (!ctx.
Read(value))
10814 return false;
10815
10817 {
10819 }
10820 else
10821 {
10823 }
10824 }
10825
10826 if (version < 140)
10827 {
10829 {
10830 if (!ctx.
Read(value))
10831 return false;
10832 SetTemperatureDirect(value);
10833 }
10834 }
10835
10837 {
10838 if (!ctx.
Read(value))
10839 return false;
10841 }
10842
10844 {
10845 if (!ctx.
Read(intValue))
10846 return false;
10848 }
10849
10851 {
10852 int r,g,b,a;
10854 return false;
10856 return false;
10858 return false;
10860 return false;
10861
10863 }
10864
10866 {
10867 if (!ctx.
Read(intValue))
10868 return false;
10870 }
10871
10872 if (version >= 138 && version < 140)
10873 {
10875 {
10876 if (!ctx.
Read(intValue))
10877 return false;
10878 SetFrozen(intValue);
10879 }
10880 }
10881
10882 return true;
10883 }
10884
10885
10887 {
10890 {
10892 }
10893
10894 if (!super.OnStoreLoad(ctx, version))
10895 {
10897 return false;
10898 }
10899
10900 if (version >= 114)
10901 {
10902 bool hasQuickBarIndexSaved;
10903
10904 if (!ctx.
Read(hasQuickBarIndexSaved))
10905 {
10907 return false;
10908 }
10909
10910 if (hasQuickBarIndexSaved)
10911 {
10912 int itmQBIndex;
10913
10914
10915 if (!ctx.
Read(itmQBIndex))
10916 {
10918 return false;
10919 }
10920
10921 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10922 if (itmQBIndex != -1 && parentPlayer)
10923 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10924 }
10925 }
10926 else
10927 {
10928
10929 PlayerBase player;
10930 int itemQBIndex;
10931 if (version ==
int.
MAX)
10932 {
10933 if (!ctx.
Read(itemQBIndex))
10934 {
10936 return false;
10937 }
10938 }
10939 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10940 {
10941
10942 if (!ctx.
Read(itemQBIndex))
10943 {
10945 return false;
10946 }
10947 if (itemQBIndex != -1 && player)
10948 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10949 }
10950 }
10951
10952 if (version < 140)
10953 {
10954
10955 if (!LoadVariables(ctx, version))
10956 {
10958 return false;
10959 }
10960 }
10961
10962
10964 {
10966 return false;
10967 }
10968 if (version >= 132)
10969 {
10971 if (raib)
10972 {
10974 {
10976 return false;
10977 }
10978 }
10979 }
10980
10982 return true;
10983 }
10984
10985
10986
10988 {
10989 super.OnStoreSave(ctx);
10990
10991 PlayerBase player;
10992 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10993 {
10995
10996 int itemQBIndex = -1;
10997 itemQBIndex = player.FindQuickBarEntityIndex(this);
10998 ctx.
Write(itemQBIndex);
10999 }
11000 else
11001 {
11003 }
11004
11006
11008 if (raib)
11009 {
11011 }
11012 }
11013
11014
11016 {
11017 super.AfterStoreLoad();
11018
11020 {
11022 }
11023
11025 {
11028 }
11029 }
11030
11032 {
11033 super.EEOnAfterLoad();
11034
11036 {
11038 }
11039
11042 }
11043
11045 {
11046 return false;
11047 }
11048
11049
11050
11052 {
11054 {
11055 #ifdef PLATFORM_CONSOLE
11056
11058 {
11060 if (menu)
11061 {
11063 }
11064 }
11065 #endif
11066 }
11067
11069 {
11072 }
11073
11075 {
11076 SetWeightDirty();
11078 }
11080 {
11083 }
11084
11086 {
11089
11092 }
11094 {
11098 }
11099
11100 super.OnVariablesSynchronized();
11101 }
11102
11103
11104
11106 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11107 {
11108 if (!IsServerCheck(allow_client))
11109 return false;
11110
11112 return false;
11113
11116
11117 if (value <= (min + 0.001))
11118 value = min;
11119
11120 if (value == min)
11121 {
11122 if (destroy_config)
11123 {
11124 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11125 if (dstr)
11126 {
11128 this.Delete();
11129 return true;
11130 }
11131 }
11132 else if (destroy_forced)
11133 {
11135 this.Delete();
11136 return true;
11137 }
11138
11140 }
11141
11144
11146 {
11147 EntityAI parent = GetHierarchyRoot();
11148 InventoryLocation iLoc = new InventoryLocation();
11149 GetInventory().GetCurrentInventoryLocation(iLoc);
11151 {
11152 int iLocSlot = iLoc.
GetSlot();
11154 {
11156 }
11158 {
11160 }
11161 }
11162 }
11163
11165 {
11167
11168 if (delta)
11170 }
11171
11173
11174 return false;
11175 }
11176
11177
11179 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11180 {
11182 }
11183
11185 {
11188 }
11189
11191 {
11194 }
11195
11197 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11198 {
11199 float value_clamped = Math.Clamp(value, 0, 1);
11201 SetQuantity(result, destroy_config, destroy_forced);
11202 }
11203
11204
11207 {
11209 }
11210
11212 {
11214 }
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224
11226 {
11227 int slot = -1;
11228 GameInventory inventory = GetInventory();
11229 if (inventory)
11230 {
11231 InventoryLocation il = new InventoryLocation;
11234 }
11235
11237 }
11238
11240 {
11241 float quantity_max = 0;
11242
11244 {
11245 if (attSlotID != -1)
11246 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11247
11248 if (quantity_max <= 0)
11250 }
11251
11252 if (quantity_max <= 0)
11254
11255 return quantity_max;
11256 }
11257
11259 {
11261 }
11262
11264 {
11266 }
11267
11268
11270 {
11272 }
11273
11275 {
11277 }
11278
11280 {
11282 }
11283
11284
11286 {
11287
11288 float weightEx = GetWeightEx();
11289 float special = GetInventoryAndCargoWeight();
11290 return weightEx - special;
11291 }
11292
11293
11295 {
11297 }
11298
11300 {
11302 {
11303 #ifdef DEVELOPER
11304 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11305 {
11306 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11308 }
11309 #endif
11310
11311 return GetQuantity() * GetConfigWeightModified();
11312 }
11313 else if (HasEnergyManager())
11314 {
11315 #ifdef DEVELOPER
11316 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11317 {
11318 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11319 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11320 }
11321 #endif
11322 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11323 }
11324 else
11325 {
11326 #ifdef DEVELOPER
11327 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11328 {
11329 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11330 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11331 }
11332 #endif
11333 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11334 }
11335 }
11336
11339 {
11340 int item_count = 0;
11342
11343 GameInventory inventory = GetInventory();
11344 CargoBase cargo = inventory.
GetCargo();
11345 if (cargo != NULL)
11346 {
11348 }
11349
11351 for (int i = 0; i < nAttachments; ++i)
11352 {
11354 if (item)
11355 item_count += item.GetNumberOfItems();
11356 }
11357 return item_count;
11358 }
11359
11362 {
11363 float weight = 0;
11364 float wetness = 1;
11365 if (include_wetness)
11368 {
11369 weight = wetness * m_ConfigWeight;
11370 }
11372 {
11373 weight = 1;
11374 }
11375 return weight;
11376 }
11377
11378
11379
11381 {
11382 GameInventory inventory = GetInventory();
11383 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11384 {
11385 array<EntityAI> items = new array<EntityAI>;
11387 for (int i = 0; i < items.Count(); ++i)
11388 {
11390 if (item)
11391 {
11392 g_Game.ObjectDelete(item);
11393 }
11394 }
11395 }
11396 }
11397
11398
11399
11400
11402 {
11403 float energy = 0;
11404 if (HasEnergyManager())
11405 {
11406 energy = GetCompEM().GetEnergy();
11407 }
11408 return energy;
11409 }
11410
11411
11413 {
11414 super.OnEnergyConsumed();
11415
11417 }
11418
11420 {
11421 super.OnEnergyAdded();
11422
11424 }
11425
11426
11428 {
11429 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11430 {
11432 {
11433 float energy_0to1 = GetCompEM().GetEnergy0To1();
11435 }
11436 }
11437 }
11438
11439
11441 {
11442 return ConfigGetFloat("heatIsolation");
11443 }
11444
11446 {
11448 }
11449
11451 {
11452 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11453 if (
g_Game.ConfigIsExisting(paramPath))
11454 return g_Game.ConfigGetFloat(paramPath);
11455
11456 return 0.0;
11457 }
11458
11460 {
11461 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11462 if (
g_Game.ConfigIsExisting(paramPath))
11463 return g_Game.ConfigGetFloat(paramPath);
11464
11465 return 0.0;
11466 }
11467
11468 override void SetWet(
float value,
bool allow_client =
false)
11469 {
11470 if (!IsServerCheck(allow_client))
11471 return;
11472
11475
11477
11478 m_VarWet = Math.Clamp(value, min, max);
11479
11481 {
11484 }
11485 }
11486
11487 override void AddWet(
float value)
11488 {
11490 }
11491
11493 {
11495 }
11496
11498 {
11500 }
11501
11503 {
11505 }
11506
11508 {
11510 }
11511
11513 {
11515 }
11516
11517 override void OnWetChanged(
float newVal,
float oldVal)
11518 {
11521 if (newLevel != oldLevel)
11522 {
11524 }
11525 }
11526
11528 {
11529 SetWeightDirty();
11530 }
11531
11533 {
11534 return GetWetLevelInternal(
m_VarWet);
11535 }
11536
11537
11538
11540 {
11542 }
11543
11545 {
11547 }
11548
11550 {
11552 }
11553
11555 {
11557 }
11558
11559
11560
11562 {
11563 if (ConfigIsExisting("itemModelLength"))
11564 {
11565 return ConfigGetFloat("itemModelLength");
11566 }
11567 return 0;
11568 }
11569
11571 {
11572 if (ConfigIsExisting("itemAttachOffset"))
11573 {
11574 return ConfigGetFloat("itemAttachOffset");
11575 }
11576 return 0;
11577 }
11578
11579 override void SetCleanness(
int value,
bool allow_client =
false)
11580 {
11581 if (!IsServerCheck(allow_client))
11582 return;
11583
11585
11587
11590 }
11591
11593 {
11595 }
11596
11598 {
11599 return true;
11600 }
11601
11602
11603
11604
11606 {
11608 }
11609
11611 {
11613 }
11614
11615
11616
11617
11618 override void SetColor(
int r,
int g,
int b,
int a)
11619 {
11625 }
11627 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11628 {
11633 }
11634
11636 {
11638 }
11639
11642 {
11643 int r,g,b,a;
11645 r = r/255;
11646 g = g/255;
11647 b = b/255;
11648 a = a/255;
11649 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11650 }
11651
11652
11653
11654 override void SetLiquidType(
int value,
bool allow_client =
false)
11655 {
11656 if (!IsServerCheck(allow_client))
11657 return;
11658
11663 }
11664
11666 {
11667 return ConfigGetInt("varLiquidTypeInit");
11668 }
11669
11671 {
11673 }
11674
11676 {
11678 SetFrozen(false);
11679 }
11680
11683 {
11684 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11685 }
11686
11687
11690 {
11691 PlayerBase nplayer;
11692 if (PlayerBase.CastTo(nplayer, player))
11693 {
11695 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11696 }
11697 }
11698
11699
11702 {
11703 PlayerBase nplayer;
11704 if (PlayerBase.CastTo(nplayer,player))
11705 {
11706 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11707 }
11708
11709 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11710
11711 if (HasEnergyManager())
11712 {
11713 GetCompEM().UpdatePlugState();
11714 }
11715 }
11716
11717
11719 {
11720 super.OnPlacementStarted(player);
11721
11723 }
11724
11725 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11726 {
11728 {
11729 m_AdminLog.OnPlacementComplete(player,
this);
11730 }
11731
11732 super.OnPlacementComplete(player, position, orientation);
11733 }
11734
11735
11736
11737
11738
11740 {
11742 {
11743 return true;
11744 }
11745 else
11746 {
11747 return false;
11748 }
11749 }
11750
11751
11753 {
11755 {
11757 }
11758 }
11759
11760
11762 {
11764 }
11765
11767 {
11769 }
11770
11771 override void InsertAgent(
int agent,
float count = 1)
11772 {
11773 if (count < 1)
11774 return;
11775
11777 }
11778
11781 {
11783 }
11784
11785
11787 {
11789 }
11790
11791
11792
11793
11794
11795
11796
11797
11798
11799
11800
11801
11802
11803
11804
11805
11806
11807
11808
11809
11810
11811
11812
11813
11814
11815
11816
11817
11818
11819
11820
11821
11822
11823
11824
11825
11826
11827
11828
11829
11830
11831
11833 {
11835 return false;
11836 return true;
11837 }
11838
11840 {
11841
11843 }
11844
11845
11848 {
11849 super.CheckForRoofLimited(timeTresholdMS);
11850
11851 float time =
g_Game.GetTime();
11852 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11853 {
11854 m_PreviousRoofTestTime = time;
11855 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11856 }
11857 }
11858
11859
11861 {
11863 {
11864 return 0;
11865 }
11866
11867 if (GetInventory().GetAttachmentSlotsCount() != 0)
11868 {
11869 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11870 if (filter)
11871 return filter.GetProtectionLevel(type, false, system);
11872 else
11873 return 0;
11874 }
11875
11876 string subclassPath, entryName;
11877
11878 switch (type)
11879 {
11881 entryName = "biological";
11882 break;
11884 entryName = "chemical";
11885 break;
11886 default:
11887 entryName = "biological";
11888 break;
11889 }
11890
11891 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11892
11893 return g_Game.ConfigGetFloat(subclassPath + entryName);
11894 }
11895
11896
11897
11900 {
11901 if (!IsMagazine())
11903
11905 }
11906
11907
11908
11909
11910
11915 {
11916 return true;
11917 }
11918
11920 {
11922 }
11923
11924
11925
11926
11927
11929 {
11930 if (parent)
11931 {
11932 if (parent.IsInherited(DayZInfected))
11933 return true;
11934
11935 if (!parent.IsRuined())
11936 return true;
11937 }
11938
11939 return true;
11940 }
11941
11943 {
11944 if (!super.CanPutAsAttachment(parent))
11945 {
11946 return false;
11947 }
11948
11949 if (!IsRuined() && !parent.IsRuined())
11950 {
11951 return true;
11952 }
11953
11954 return false;
11955 }
11956
11958 {
11959
11960
11961
11962
11963 return super.CanReceiveItemIntoCargo(item);
11964 }
11965
11967 {
11968
11969
11970
11971
11972 GameInventory attachmentInv = attachment.GetInventory();
11974 {
11975 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11976 return false;
11977 }
11978
11979 InventoryLocation loc = new InventoryLocation();
11980 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11981 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11982 return false;
11983
11984 return super.CanReceiveAttachment(attachment, slotId);
11985 }
11986
11988 {
11989 if (!super.CanReleaseAttachment(attachment))
11990 return false;
11991
11992 return GetInventory().AreChildrenAccessible();
11993 }
11994
11995
11996
11997
11998
11999
12000
12001
12002
12003
12004
12005
12006
12007
12008
12009
12010
12011
12012
12013
12014
12016 {
12017 int id = muzzle_owner.GetMuzzleID();
12018 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
12019
12020 if (WPOF_array)
12021 {
12022 for (int i = 0; i < WPOF_array.Count(); i++)
12023 {
12024 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
12025
12026 if (WPOF)
12027 {
12028 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
12029 }
12030 }
12031 }
12032 }
12033
12034
12036 {
12037 int id = muzzle_owner.GetMuzzleID();
12039
12040 if (WPOBE_array)
12041 {
12042 for (int i = 0; i < WPOBE_array.Count(); i++)
12043 {
12044 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
12045
12046 if (WPOBE)
12047 {
12048 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12049 }
12050 }
12051 }
12052 }
12053
12054
12056 {
12057 int id = muzzle_owner.GetMuzzleID();
12058 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12059
12060 if (WPOOH_array)
12061 {
12062 for (int i = 0; i < WPOOH_array.Count(); i++)
12063 {
12064 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12065
12066 if (WPOOH)
12067 {
12068 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
12069 }
12070 }
12071 }
12072 }
12073
12074
12076 {
12077 int id = muzzle_owner.GetMuzzleID();
12078 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12079
12080 if (WPOOH_array)
12081 {
12082 for (int i = 0; i < WPOOH_array.Count(); i++)
12083 {
12084 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12085
12086 if (WPOOH)
12087 {
12088 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12089 }
12090 }
12091 }
12092 }
12093
12094
12096 {
12097 int id = muzzle_owner.GetMuzzleID();
12098 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12099
12100 if (WPOOH_array)
12101 {
12102 for (int i = 0; i < WPOOH_array.Count(); i++)
12103 {
12104 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12105
12106 if (WPOOH)
12107 {
12108 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12109 }
12110 }
12111 }
12112 }
12113
12114
12115
12117 {
12119 {
12120 return true;
12121 }
12122
12123 return false;
12124 }
12125
12127 {
12129 {
12130 return true;
12131 }
12132
12133 return false;
12134 }
12135
12137 {
12139 {
12140 return true;
12141 }
12142
12143 return false;
12144 }
12145
12147 {
12148 return false;
12149 }
12150
12153 {
12154 return UATimeSpent.DEFAULT_DEPLOY;
12155 }
12156
12157
12158
12159
12161 {
12163 SetSynchDirty();
12164 }
12165
12167 {
12169 }
12170
12171
12173 {
12174 return false;
12175 }
12176
12179 {
12180 string att_type = "None";
12181
12182 if (ConfigIsExisting("soundAttType"))
12183 {
12184 att_type = ConfigGetString("soundAttType");
12185 }
12186
12188 }
12189
12191 {
12193 }
12194
12195
12196
12197
12198
12204
12206 {
12209
12211 }
12212
12213
12215 {
12217 return;
12218
12220
12223
12226
12227 SoundParameters params = new SoundParameters();
12231 }
12232
12233
12235 {
12237 {
12240
12241 SetSynchDirty();
12242
12245 }
12246 }
12247
12249 {
12251 }
12252
12253
12255 {
12257 return;
12258
12260 SetSynchDirty();
12261
12264 }
12265
12267 {
12270 }
12271
12273 {
12275 }
12276
12277 void OnApply(PlayerBase player);
12278
12280 {
12281 return 1.0;
12282 };
12283
12285 {
12287 }
12288
12290 {
12292 }
12293
12295
12297 {
12298 SetDynamicPhysicsLifeTime(0.01);
12300 }
12301
12303 {
12304 array<string> zone_names = new array<string>;
12305 GetDamageZones(zone_names);
12306 for (int i = 0; i < zone_names.Count(); i++)
12307 {
12308 SetHealthMax(zone_names.Get(i),"Health");
12309 }
12310 SetHealthMax("","Health");
12311 }
12312
12315 {
12316 float global_health = GetHealth01("","Health");
12317 array<string> zones = new array<string>;
12318 GetDamageZones(zones);
12319
12320 for (int i = 0; i < zones.Count(); i++)
12321 {
12322 SetHealth01(zones.Get(i),"Health",global_health);
12323 }
12324 }
12325
12328 {
12329 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12330 }
12331
12333 {
12334 if (!hasRootAsPlayer)
12335 {
12336 if (refParentIB)
12337 {
12338
12339 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12340 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12341
12342 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12343 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12344
12347 }
12348 else
12349 {
12350
12353 }
12354 }
12355 }
12356
12358 {
12360 {
12361 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12362 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12363 {
12364 float heatPermCoef = 1.0;
12366 while (ent)
12367 {
12368 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12369 ent = ent.GetHierarchyParent();
12370 }
12371
12372 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12373 }
12374 }
12375 }
12376
12378 {
12379
12380 EntityAI parent = GetHierarchyParent();
12381 if (!parent)
12382 {
12383 hasParent = false;
12384 hasRootAsPlayer = false;
12385 }
12386 else
12387 {
12388 hasParent = true;
12389 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12390 refParentIB =
ItemBase.Cast(parent);
12391 }
12392 }
12393
12394 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12395 {
12396
12397 }
12398
12400 {
12401
12402 return false;
12403 }
12404
12406 {
12407
12408
12409 return false;
12410 }
12411
12413 {
12414
12415 return false;
12416 }
12417
12420 {
12421 return !GetIsFrozen() &&
IsOpen();
12422 }
12423
12425 {
12426 bool hasParent = false, hasRootAsPlayer = false;
12428
12429 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12430 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12431
12432 if (wwtu || foodDecay)
12433 {
12437
12438 if (processWetness || processTemperature || processDecay)
12439 {
12441
12442 if (processWetness)
12443 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12444
12445 if (processTemperature)
12447
12448 if (processDecay)
12449 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12450 }
12451 }
12452 }
12453
12456 {
12458 }
12459
12461 {
12464
12465 return super.GetTemperatureFreezeThreshold();
12466 }
12467
12469 {
12472
12473 return super.GetTemperatureThawThreshold();
12474 }
12475
12477 {
12480
12481 return super.GetItemOverheatThreshold();
12482 }
12483
12485 {
12487 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12488
12489 return super.GetTemperatureFreezeTime();
12490 }
12491
12493 {
12495 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12496
12497 return super.GetTemperatureThawTime();
12498 }
12499
12504
12506 {
12507 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12508 }
12509
12511 {
12512 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12513 }
12514
12517 {
12519 }
12520
12522 {
12524 }
12525
12527 {
12529 }
12530
12533 {
12534 return null;
12535 }
12536
12539 {
12540 return false;
12541 }
12542
12544 {
12546 {
12549 if (!trg)
12550 {
12552 explosive = this;
12553 }
12554
12555 explosive.PairRemote(trg);
12557
12558 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12559 trg.SetPersistentPairID(persistentID);
12560 explosive.SetPersistentPairID(persistentID);
12561
12562 return true;
12563 }
12564 return false;
12565 }
12566
12569 {
12570 float ret = 1.0;
12573 ret *= GetHealth01();
12574
12575 return ret;
12576 }
12577
12578 #ifdef DEVELOPER
12579 override void SetDebugItem()
12580 {
12581 super.SetDebugItem();
12582 _itemBase = this;
12583 }
12584
12586 {
12587 string text = super.GetDebugText();
12588
12590 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12591
12592 return text;
12593 }
12594 #endif
12595
12597 {
12598 return true;
12599 }
12600
12602
12604
12606 {
12609 }
12610
12611
12619
12635
12636 [
Obsolete(
"Use ItemSoundHandler instead")]
12639 {
12640 if (!
g_Game.IsDedicatedServer())
12641 {
12642 if (ConfigIsExisting("attachSoundSet"))
12643 {
12644 string cfg_path = "";
12645 string soundset = "";
12646 string type_name =
GetType();
12647
12650 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12651 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12652
12653 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12654 {
12655 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12656 {
12657 if (cfg_slot_array[i] == slot_type)
12658 {
12659 soundset = cfg_soundset_array[i];
12660 break;
12661 }
12662 }
12663 }
12664
12665 if (soundset != "")
12666 {
12667 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12669 }
12670 }
12671 }
12672 }
12673
12675}
12676
12678{
12680 if (entity)
12681 {
12682 bool is_item = entity.IsInherited(
ItemBase);
12683 if (is_item && full_quantity)
12684 {
12687 }
12688 }
12689 else
12690 {
12692 return NULL;
12693 }
12694 return entity;
12695}
12696
12698{
12699 if (item)
12700 {
12701 if (health > 0)
12702 item.SetHealth("", "", health);
12703
12704 if (item.CanHaveTemperature())
12705 {
12707 if (item.CanFreeze())
12708 item.SetFrozen(false);
12709 }
12710
12711 if (item.HasEnergyManager())
12712 {
12713 if (quantity >= 0)
12714 {
12715 item.GetCompEM().SetEnergy0To1(quantity);
12716 }
12717 else
12718 {
12720 }
12721 }
12722 else if (item.IsMagazine())
12723 {
12724 Magazine mag = Magazine.Cast(item);
12725 if (quantity >= 0)
12726 {
12727 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12728 }
12729 else
12730 {
12732 }
12733
12734 }
12735 else
12736 {
12737 if (quantity >= 0)
12738 {
12739 item.SetQuantityNormalized(quantity, false);
12740 }
12741 else
12742 {
12744 }
12745
12746 }
12747 }
12748}
12749
12750#ifdef DEVELOPER
12752#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.