7695{
7697 {
7698 return true;
7699 }
7700};
7701
7703{
7704
7705};
7706
7707
7708
7710{
7714
7716
7719
7720
7721
7722
7723
7732
7738
7743
7748
7769 protected bool m_IsResultOfSplit
7770
7772
7777
7778
7779
7781
7785
7786
7787
7789
7792
7793
7794
7800
7801
7809
7812
7813
7815
7816
7818
7819
7824
7825
7830
7832
7833
7835
7836
7838 {
7843
7844 if (!
g_Game.IsDedicatedServer())
7845 {
7847 {
7849
7851 {
7853 }
7854 }
7855
7858 }
7859
7860 m_OldLocation = null;
7861
7863 {
7865 }
7866
7867 if (ConfigIsExisting("headSelectionsToHide"))
7868 {
7871 }
7872
7874 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7875 {
7877 }
7878
7880
7881 m_IsResultOfSplit = false;
7882
7884 }
7885
7887 {
7888 super.InitItemVariables();
7889
7895 m_Count = ConfigGetInt(
"count");
7896
7899
7904
7907
7912
7924
7928
7929
7932 if (ConfigIsExisting("canBeSplit"))
7933 {
7936 }
7937
7939 if (ConfigIsExisting("itemBehaviour"))
7941
7942
7945 RegisterNetSyncVariableInt("m_VarLiquidType");
7946 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7947
7948 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7949 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7950 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7951
7952 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7953 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7954 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7955 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7956
7957 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7958 RegisterNetSyncVariableBool("m_IsTakeable");
7959 RegisterNetSyncVariableBool("m_IsHologram");
7960
7963 {
7966 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7967 }
7968
7970
7972 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7974
7976 }
7977
7979 {
7981 }
7982
7984 {
7987 {
7992 }
7993 }
7994
7995 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7996 {
7998 {
8001 }
8002
8004 }
8005
8007 {
8013 }
8014
8016
8018 {
8020
8021 if (!action)
8022 {
8023 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
8024 return;
8025 }
8026
8028 if (!ai)
8029 {
8031 return;
8032 }
8033
8035 if (!action_array)
8036 {
8037 action_array = new array<ActionBase_Basic>;
8039 }
8040 if (LogManager.IsActionLogEnable())
8041 {
8042 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
8043 }
8044
8045 if (action_array.Find(action) != -1)
8046 {
8047 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
8048 }
8049 else
8050 {
8051 action_array.Insert(action);
8052 }
8053 }
8054
8056 {
8057 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8058 ActionBase action = player.GetActionManager().GetAction(actionName);
8061
8062 if (action_array)
8063 {
8064 action_array.RemoveItem(action);
8065 }
8066 }
8067
8068
8069
8071 {
8072 ActionOverrideData overrideData = new ActionOverrideData();
8076
8078 if (!actionMap)
8079 {
8082 }
8083
8084 actionMap.Insert(this.
Type(), overrideData);
8085
8086 }
8087
8089
8091
8092
8094 {
8097
8100
8101 string config_to_search = "CfgVehicles";
8102 string muzzle_owner_config;
8103
8105 {
8106 if (IsInherited(Weapon))
8107 config_to_search = "CfgWeapons";
8108
8109 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8110
8111 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8112
8113 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8114
8115 if (config_OnFire_subclass_count > 0)
8116 {
8117 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8118
8119 for (int i = 0; i < config_OnFire_subclass_count; i++)
8120 {
8121 string particle_class = "";
8122 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8123 string config_OnFire_entry = config_OnFire_class + particle_class;
8124 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8125 WPOF_array.Insert(WPOF);
8126 }
8127
8128
8130 }
8131 }
8132
8134 {
8135 config_to_search = "CfgWeapons";
8136 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8137
8138 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8139
8140 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8141
8142 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8143 {
8144 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8145
8146 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8147 {
8148 string particle_class2 = "";
8149 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8150 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8151 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8152 WPOBE_array.Insert(WPOBE);
8153 }
8154
8155
8157 }
8158 }
8159 }
8160
8161
8163 {
8166
8168 {
8169 string config_to_search = "CfgVehicles";
8170
8171 if (IsInherited(Weapon))
8172 config_to_search = "CfgWeapons";
8173
8174 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8175 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8176
8177 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8178 {
8179
8181
8183 {
8185 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8187 return;
8188 }
8189
8192
8193
8194
8195 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8196 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8197
8198 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8199 {
8200 string particle_class = "";
8201 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8202 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8203 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8204
8205 if (entry_type == CT_CLASS)
8206 {
8207 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8208 WPOOH_array.Insert(WPOF);
8209 }
8210 }
8211
8212
8214 }
8215 }
8216 }
8217
8219 {
8221 }
8222
8224 {
8226 {
8228
8231
8234
8235 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8236 }
8237 }
8238
8240 {
8242 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8243
8245 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8246
8248 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8249
8251 {
8253 }
8254 }
8255
8257 {
8259 }
8260
8262 {
8265 else
8267
8269 {
8272 }
8273 else
8274 {
8277
8280 }
8281
8283 }
8284
8286 {
8288 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8289 }
8290
8292 {
8294 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8296 }
8297
8299 {
8301 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8302 }
8303
8305 {
8308
8309 OverheatingParticle OP = new OverheatingParticle();
8314
8316 }
8317
8319 {
8322
8323 return -1;
8324 }
8325
8327 {
8329 {
8332
8333 for (int i = count; i > 0; --i)
8334 {
8335 int id = i - 1;
8338
8341
8342 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8343 {
8344 if (p)
8345 {
8348 }
8349 }
8350 }
8351 }
8352 }
8353
8355 {
8357 {
8359 {
8360 int id = i - 1;
8362
8363 if (OP)
8364 {
8366
8367 if (p)
8368 {
8370 }
8371
8372 delete OP;
8373 }
8374 }
8375
8378 }
8379 }
8380
8383 {
8384 return 0.0;
8385 }
8386
8387
8389 {
8390 return 250;
8391 }
8392
8394 {
8395 return 0;
8396 }
8397
8400 {
8402 return true;
8403
8404 return false;
8405 }
8406
8409 {
8412
8414 {
8416 }
8417 else
8418 {
8419
8421 }
8422
8424 }
8425
8432 {
8433 return -1;
8434 }
8435
8436
8437
8438
8440 {
8442 {
8443 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8444 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8445
8446 if (r_index >= 0)
8447 {
8448 InventoryLocation r_il = new InventoryLocation;
8449 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8450
8451 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8454 {
8455 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8456 }
8458 {
8459 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8460 }
8461
8462 }
8463
8464 player.GetHumanInventory().ClearUserReservedLocation(this);
8465 }
8466
8469 }
8470
8471
8472
8473
8475 {
8476 return ItemBase.m_DebugActionsMask;
8477 }
8478
8480 {
8481 return ItemBase.m_DebugActionsMask & mask;
8482 }
8483
8485 {
8486 ItemBase.m_DebugActionsMask = mask;
8487 }
8488
8490 {
8491 ItemBase.m_DebugActionsMask |= mask;
8492 }
8493
8495 {
8496 ItemBase.m_DebugActionsMask &= ~mask;
8497 }
8498
8500 {
8502 {
8504 }
8505 else
8506 {
8508 }
8509 }
8510
8511
8513 {
8514 if (GetEconomyProfile())
8515 {
8516 float q_max = GetEconomyProfile().GetQuantityMax();
8517 if (q_max > 0)
8518 {
8519 float q_min = GetEconomyProfile().GetQuantityMin();
8520 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8521
8523 {
8524 ComponentEnergyManager comp = GetCompEM();
8526 {
8528 }
8529 }
8531 {
8533
8534 }
8535
8536 }
8537 }
8538 }
8539
8542 {
8543 EntityAI parent = GetHierarchyParent();
8544
8545 if (parent)
8546 {
8547 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8548 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8549 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8550 }
8551 }
8552
8555 {
8556 EntityAI parent = GetHierarchyParent();
8557
8558 if (parent)
8559 {
8560 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8561 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8562 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8563 }
8564 }
8565
8567 {
8568
8569
8570
8571
8573
8575 {
8576 if (ScriptInputUserData.CanStoreInputUserData())
8577 {
8578 ScriptInputUserData ctx = new ScriptInputUserData;
8584 ctx.
Write(use_stack_max);
8587
8589 {
8590 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8591 }
8592 }
8593 }
8594 else if (!
g_Game.IsMultiplayer())
8595 {
8597 }
8598 }
8599
8601 {
8603 }
8604
8606 {
8608 }
8609
8611 {
8613 }
8614
8616 {
8617
8618 return false;
8619 }
8620
8622 {
8623 return false;
8624 }
8625
8629 {
8630 return false;
8631 }
8632
8634 {
8635 return "";
8636 }
8637
8639
8641 {
8642 return false;
8643 }
8644
8646 {
8647 return true;
8648 }
8649
8650
8651
8653 {
8654 return true;
8655 }
8656
8658 {
8659 return true;
8660 }
8661
8663 {
8664 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8666 }
8667
8669 {
8671 }
8672
8674 {
8676 if (!is_being_placed)
8678 SetSynchDirty();
8679 }
8680
8681
8683
8685 {
8687 }
8688
8690 {
8692 }
8693
8695 {
8696 return 1;
8697 }
8698
8700 {
8701 return false;
8702 }
8703
8705 {
8707 SetSynchDirty();
8708 }
8709
8710
8711
8712
8713
8714
8715
8716
8717
8718
8719
8720
8721
8722
8723
8724
8725
8726
8727
8728
8729
8730
8731
8732
8733
8734
8735
8736
8737
8738
8739
8740
8741
8742
8743
8745 {
8746 super.OnMovedInsideCargo(container);
8747
8748 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8749 }
8750
8751 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8752 {
8753 super.EEItemLocationChanged(oldLoc, newLoc);
8754
8755 PlayerBase newPlayer = null;
8756 PlayerBase oldPlayer = null;
8757
8758 if (newLoc.GetParent())
8759 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8760
8761 if (oldLoc.GetParent())
8762 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8763
8765 {
8766 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8767
8768 if (rIndex >= 0)
8769 {
8770 InventoryLocation rIl = new InventoryLocation;
8771 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8772
8773 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8776 {
8777 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8778 }
8780 {
8782 }
8783
8784 }
8785 }
8786
8788 {
8789 if (newPlayer)
8790 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8791
8792 if (newPlayer == oldPlayer)
8793 {
8794 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8795 {
8797 {
8798 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8799 {
8800 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8801 }
8802 }
8803 else
8804 {
8805 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8806 }
8807 }
8808
8809 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8810 {
8811 int type = oldLoc.GetType();
8813 {
8814 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8815 }
8817 {
8818 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8819 }
8820 }
8821 if (!m_OldLocation)
8822 {
8823 m_OldLocation = new InventoryLocation;
8824 }
8825 m_OldLocation.Copy(oldLoc);
8826 }
8827 else
8828 {
8829 if (m_OldLocation)
8830 {
8831 m_OldLocation.Reset();
8832 }
8833 }
8834
8835 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8836 }
8837 else
8838 {
8839 if (newPlayer)
8840 {
8841 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8842 if (resIndex >= 0)
8843 {
8844 InventoryLocation il = new InventoryLocation;
8845 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8847 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8850 {
8851 il.
GetParent().GetOnReleaseLock().Invoke(it);
8852 }
8854 {
8856 }
8857
8858 }
8859 }
8861 {
8862
8864 }
8865
8866 if (m_OldLocation)
8867 {
8868 m_OldLocation.Reset();
8869 }
8870 }
8871
8873 {
8874 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8875 }
8876
8878 {
8879 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8880 }
8881 }
8882
8883 override void EOnContact(IEntity other, Contact extra)
8884 {
8886 {
8887 int liquidType = -1;
8889 if (impactSpeed > 0.0)
8890 {
8892 #ifndef SERVER
8894 #else
8896 SetSynchDirty();
8897 #endif
8899 }
8900 }
8901
8902 #ifdef SERVER
8903 if (GetCompEM() && GetCompEM().IsPlugged())
8904 {
8905 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8906 GetCompEM().UnplugThis();
8907 }
8908 #endif
8909 }
8910
8912
8914 {
8916 }
8917
8919 {
8920
8921 }
8922
8924 {
8925 super.OnItemLocationChanged(old_owner, new_owner);
8926
8927 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8928 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8929
8930 if (!relatedPlayer && playerNew)
8931 relatedPlayer = playerNew;
8932
8933 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8934 {
8936 if (actionMgr)
8937 {
8938 ActionBase currentAction = actionMgr.GetRunningAction();
8939 if (currentAction)
8941 }
8942 }
8943
8944 Man ownerPlayerOld = null;
8945 Man ownerPlayerNew = null;
8946
8947 if (old_owner)
8948 {
8949 if (old_owner.
IsMan())
8950 {
8951 ownerPlayerOld = Man.Cast(old_owner);
8952 }
8953 else
8954 {
8955 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8956 }
8957 }
8958 else
8959 {
8961 {
8963
8964 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8965 {
8966 GetCompEM().UnplugThis();
8967 }
8968 }
8969 }
8970
8971 if (new_owner)
8972 {
8973 if (new_owner.
IsMan())
8974 {
8975 ownerPlayerNew = Man.Cast(new_owner);
8976 }
8977 else
8978 {
8979 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8980 }
8981 }
8982
8983 if (ownerPlayerOld != ownerPlayerNew)
8984 {
8985 if (ownerPlayerOld)
8986 {
8987 array<EntityAI> subItemsExit = new array<EntityAI>;
8989 for (int i = 0; i < subItemsExit.Count(); i++)
8990 {
8993 }
8994 }
8995
8996 if (ownerPlayerNew)
8997 {
8998 array<EntityAI> subItemsEnter = new array<EntityAI>;
9000 for (int j = 0; j < subItemsEnter.Count(); j++)
9001 {
9004 }
9005 }
9006 }
9007 else if (ownerPlayerNew != null)
9008 {
9009 PlayerBase nplayer;
9010 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
9011 {
9012 array<EntityAI> subItemsUpdate = new array<EntityAI>;
9014 for (int k = 0; k < subItemsUpdate.Count(); k++)
9015 {
9017 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
9018 }
9019 }
9020 }
9021
9022 if (old_owner)
9023 old_owner.OnChildItemRemoved(this);
9024 if (new_owner)
9025 new_owner.OnChildItemReceived(this);
9026 }
9027
9028
9030 {
9031 super.EEDelete(parent);
9032 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
9033 if (player)
9034 {
9036
9037 if (player.IsAlive())
9038 {
9039 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
9040 if (r_index >= 0)
9041 {
9042 InventoryLocation r_il = new InventoryLocation;
9043 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
9044
9045 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
9048 {
9049 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
9050 }
9052 {
9053 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9054 }
9055
9056 }
9057
9058 player.RemoveQuickBarEntityShortcut(this);
9059 }
9060 }
9061 }
9062
9064 {
9065 super.EEKilled(killer);
9066
9069 {
9070 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9071 {
9072 if (IsMagazine())
9073 {
9074 if (Magazine.Cast(this).GetAmmoCount() > 0)
9075 {
9077 }
9078 }
9079 else
9080 {
9082 }
9083 }
9084 }
9085 }
9086
9088 {
9089 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9090
9091 super.OnWasAttached(parent, slot_id);
9092
9095
9098 }
9099
9101 {
9102 super.OnWasDetached(parent, slot_id);
9103
9106
9109 }
9110
9112 {
9113 int idx;
9116
9117 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9118 if (inventory_slots.Count() < 1)
9119 {
9120 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9121 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9122 }
9123 else
9124 {
9125 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9126 }
9127
9128 idx = inventory_slots.Find(slot);
9129 if (idx < 0)
9130 return "";
9131
9132 return attach_types.Get(idx);
9133 }
9134
9136 {
9137 int idx = -1;
9138 string slot;
9139
9142
9143 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9144 if (inventory_slots.Count() < 1)
9145 {
9146 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9147 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9148 }
9149 else
9150 {
9151 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9152 if (detach_types.Count() < 1)
9153 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9154 }
9155
9156 for (int i = 0; i < inventory_slots.Count(); i++)
9157 {
9158 slot = inventory_slots.Get(i);
9159 }
9160
9161 if (slot != "")
9162 {
9163 if (detach_types.Count() == 1)
9164 idx = 0;
9165 else
9166 idx = inventory_slots.Find(slot);
9167 }
9168 if (idx < 0)
9169 return "";
9170
9171 return detach_types.Get(idx);
9172 }
9173
9175 {
9176
9178
9179
9180 float min_time = 1;
9181 float max_time = 3;
9182 float delay = Math.RandomFloat(min_time, max_time);
9183
9184 explode_timer.Run(delay, this, "DoAmmoExplosion");
9185 }
9186
9188 {
9189 Magazine magazine = Magazine.Cast(this);
9190 int pop_sounds_count = 6;
9191 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9192
9193
9194 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9195 string sound_name = pop_sounds[ sound_idx ];
9196 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9197
9198
9199 magazine.ServerAddAmmoCount(-1);
9200
9201
9202 float min_temp_to_explode = 100;
9203
9204 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9205 {
9207 }
9208 }
9209
9210
9211 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9212 {
9213 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9214
9215 const int CHANCE_DAMAGE_CARGO = 4;
9216 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9217 const int CHANCE_DAMAGE_NOTHING = 2;
9218
9220 {
9221 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9222 int chances;
9223 int rnd;
9224
9225 if (GetInventory().GetCargo())
9226 {
9227 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9228 rnd = Math.RandomInt(0,chances);
9229
9230 if (rnd < CHANCE_DAMAGE_CARGO)
9231 {
9233 }
9234 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9235 {
9237 }
9238 }
9239 else
9240 {
9241 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9242 rnd = Math.RandomInt(0,chances);
9243
9244 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9245 {
9247 }
9248 }
9249 }
9250 }
9251
9253 {
9254 CargoBase cargo = GetInventory().GetCargo();
9255 if (cargo)
9256 {
9258 if (item_count > 0)
9259 {
9260 int random_pick = Math.RandomInt(0, item_count);
9262 if (!item.IsExplosive())
9263 {
9264 item.AddHealth("","",damage);
9265 return true;
9266 }
9267 }
9268 }
9269 return false;
9270 }
9271
9273 {
9274 GameInventory inventory = GetInventory();
9276 if (attachment_count > 0)
9277 {
9278 int random_pick = Math.RandomInt(0, attachment_count);
9280 if (!attachment.IsExplosive())
9281 {
9282 attachment.AddHealth("","",damage);
9283 return true;
9284 }
9285 }
9286 return false;
9287 }
9288
9290 {
9292 }
9293
9295 {
9297 return GetInventory().CanRemoveEntity();
9298
9299 return false;
9300 }
9301
9303 {
9304
9306 return false;
9307
9308
9310 return false;
9311
9312
9313
9315 if (delta == 0)
9316 return false;
9317
9318
9319 return true;
9320 }
9321
9323 {
9325 {
9326 if (ScriptInputUserData.CanStoreInputUserData())
9327 {
9328 ScriptInputUserData ctx = new ScriptInputUserData;
9333 ctx.
Write(destination_entity);
9337 }
9338 }
9339 else if (!
g_Game.IsMultiplayer())
9340 {
9342 }
9343 }
9344
9346 {
9347 float split_quantity_new;
9351 InventoryLocation loc = new InventoryLocation;
9352
9353 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9354 {
9356 split_quantity_new = stack_max;
9357 else
9359
9361 {
9362 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9363 if (new_item)
9364 {
9365 new_item.SetResultOfSplit(true);
9366 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9368 new_item.
SetQuantity(split_quantity_new,
false,
true);
9369 }
9370 }
9371 }
9372 else if (destination_entity && slot_id == -1)
9373 {
9374 if (quantity > stack_max)
9375 split_quantity_new = stack_max;
9376 else
9377 split_quantity_new = quantity;
9378
9380 {
9381 GameInventory destinationInventory = destination_entity.GetInventory();
9383 {
9386 }
9387
9388 if (new_item)
9389 {
9390 new_item.SetResultOfSplit(true);
9391 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9393 new_item.
SetQuantity(split_quantity_new,
false,
true);
9394 }
9395 }
9396 }
9397 else
9398 {
9399 if (stack_max != 0)
9400 {
9402 {
9404 }
9405
9406 if (split_quantity_new == 0)
9407 {
9408 if (!
g_Game.IsMultiplayer())
9409 player.PhysicalPredictiveDropItem(this);
9410 else
9411 player.ServerDropEntity(this);
9412 return;
9413 }
9414
9416 {
9418
9419 if (new_item)
9420 {
9421 new_item.SetResultOfSplit(true);
9422 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9425 new_item.PlaceOnSurface();
9426 }
9427 }
9428 }
9429 }
9430 }
9431
9433 {
9434 float split_quantity_new;
9438 InventoryLocation loc = new InventoryLocation;
9439
9440 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9441 {
9443 split_quantity_new = stack_max;
9444 else
9446
9448 {
9449 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9450 if (new_item)
9451 {
9452 new_item.SetResultOfSplit(true);
9453 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9455 new_item.
SetQuantity(split_quantity_new,
false,
true);
9456 }
9457 }
9458 }
9459 else if (destination_entity && slot_id == -1)
9460 {
9461 if (quantity > stack_max)
9462 split_quantity_new = stack_max;
9463 else
9464 split_quantity_new = quantity;
9465
9467 {
9468 GameInventory destinationInventory = destination_entity.GetInventory();
9470 {
9473 }
9474
9475 if (new_item)
9476 {
9477 new_item.SetResultOfSplit(true);
9478 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9480 new_item.
SetQuantity(split_quantity_new,
false,
true);
9481 }
9482 }
9483 }
9484 else
9485 {
9486 if (stack_max != 0)
9487 {
9489 {
9491 }
9492
9494 {
9496
9497 if (new_item)
9498 {
9499 new_item.SetResultOfSplit(true);
9500 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9503 new_item.PlaceOnSurface();
9504 }
9505 }
9506 }
9507 }
9508 }
9509
9511 {
9513 {
9514 if (ScriptInputUserData.CanStoreInputUserData())
9515 {
9516 ScriptInputUserData ctx = new ScriptInputUserData;
9521 dst.WriteToContext(ctx);
9523 }
9524 }
9525 else if (!
g_Game.IsMultiplayer())
9526 {
9528 }
9529 }
9530
9532 {
9534 {
9535 if (ScriptInputUserData.CanStoreInputUserData())
9536 {
9537 ScriptInputUserData ctx = new ScriptInputUserData;
9542 ctx.
Write(destination_entity);
9548 }
9549 }
9550 else if (!
g_Game.IsMultiplayer())
9551 {
9553 }
9554 }
9555
9557 {
9559 }
9560
9562 {
9564 float split_quantity_new;
9566 if (dst.IsValid())
9567 {
9568 int slot_id = dst.GetSlot();
9570
9571 if (quantity > stack_max)
9572 split_quantity_new = stack_max;
9573 else
9574 split_quantity_new = quantity;
9575
9577 {
9579
9580 if (new_item)
9581 {
9582 new_item.SetResultOfSplit(true);
9583 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9585 new_item.
SetQuantity(split_quantity_new,
false,
true);
9586 }
9587
9588 return new_item;
9589 }
9590 }
9591
9592 return null;
9593 }
9594
9596 {
9598 float split_quantity_new;
9600 if (destination_entity)
9601 {
9603 if (quantity > stackable)
9604 split_quantity_new = stackable;
9605 else
9606 split_quantity_new = quantity;
9607
9609 {
9610 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9611 if (new_item)
9612 {
9613 new_item.SetResultOfSplit(true);
9614 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9616 new_item.
SetQuantity(split_quantity_new,
false,
true);
9617 }
9618 }
9619 }
9620 }
9621
9623 {
9625 {
9626 if (ScriptInputUserData.CanStoreInputUserData())
9627 {
9628 ScriptInputUserData ctx = new ScriptInputUserData;
9633 ItemBase destination_entity =
this;
9634 ctx.
Write(destination_entity);
9638 }
9639 }
9640 else if (!
g_Game.IsMultiplayer())
9641 {
9643 }
9644 }
9645
9647 {
9649 float split_quantity_new;
9651 if (player)
9652 {
9654 if (quantity > stackable)
9655 split_quantity_new = stackable;
9656 else
9657 split_quantity_new = quantity;
9658
9660 {
9661 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9662 new_item =
ItemBase.Cast(in_hands);
9663 if (new_item)
9664 {
9665 new_item.SetResultOfSplit(true);
9666 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9668 new_item.SetQuantity(split_quantity_new, false, true);
9669 }
9670 }
9671 }
9672 }
9673
9675 {
9677 float split_quantity_new = Math.Floor(quantity * 0.5);
9678
9680 return;
9681
9683
9684 if (new_item)
9685 {
9686 if (new_item.GetQuantityMax() < split_quantity_new)
9687 {
9688 split_quantity_new = new_item.GetQuantityMax();
9689 }
9690
9691 new_item.SetResultOfSplit(true);
9692 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9693
9695 {
9698 }
9699 else
9700 {
9702 new_item.
SetQuantity(split_quantity_new,
false,
true);
9703 }
9704 }
9705 }
9706
9708 {
9710 float split_quantity_new = Math.Floor(quantity / 2);
9711
9713 return;
9714
9715 InventoryLocation invloc = new InventoryLocation;
9717
9719 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9720
9721 if (new_item)
9722 {
9723 if (new_item.GetQuantityMax() < split_quantity_new)
9724 {
9725 split_quantity_new = new_item.GetQuantityMax();
9726 }
9728 {
9731 }
9732 else if (split_quantity_new > 1)
9733 {
9735 new_item.
SetQuantity(split_quantity_new,
false,
true);
9736 }
9737 }
9738 }
9739
9742 {
9743 SetWeightDirty();
9745
9746 if (parent)
9747 parent.OnAttachmentQuantityChangedEx(this, delta);
9748
9750 {
9752 {
9754 }
9756 {
9757 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9759 }
9760 }
9761 }
9762
9765 {
9766
9767 }
9768
9771 {
9773 }
9774
9776 {
9777 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9778
9780 {
9781 if (newLevel == GameConstants.STATE_RUINED)
9782 {
9784 EntityAI parent = GetHierarchyParent();
9785 if (parent && parent.IsFireplace())
9786 {
9787 CargoBase cargo = GetInventory().GetCargo();
9788 if (cargo)
9789 {
9791 {
9793 }
9794 }
9795 }
9796 }
9797
9799 {
9800
9802 return;
9803 }
9804
9805 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9806 {
9808 }
9809 }
9810 }
9811
9812
9814 {
9815 super.OnRightClick();
9816
9818 {
9820 {
9821 if (ScriptInputUserData.CanStoreInputUserData())
9822 {
9823 EntityAI root = GetHierarchyRoot();
9824 Man playerOwner = GetHierarchyRootPlayer();
9825 InventoryLocation dst = new InventoryLocation;
9826
9827
9828 if (!playerOwner && root && root == this)
9829 {
9831 }
9832 else
9833 {
9834
9835 GetInventory().GetCurrentInventoryLocation(dst);
9837 {
9838 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9840 {
9842 }
9843 else
9844 {
9846
9847
9848 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9849 {
9851 }
9852 else
9853 {
9854 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9855 }
9856 }
9857 }
9858 }
9859
9860 ScriptInputUserData ctx = new ScriptInputUserData;
9868 }
9869 }
9870 else if (!
g_Game.IsMultiplayer())
9871 {
9873 }
9874 }
9875 }
9876
9878 {
9879 if (root)
9880 {
9881 vector m4[4];
9882 root.GetTransform(m4);
9883 dst.SetGround(this, m4);
9884 }
9885 else
9886 {
9887 GetInventory().GetCurrentInventoryLocation(dst);
9888 }
9889 }
9890
9891 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9892 {
9893
9894 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9895 return false;
9896
9897 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9898 return false;
9899
9900
9902 return false;
9903
9904
9905 Magazine mag = Magazine.Cast(this);
9906 if (mag)
9907 {
9908 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9909 return false;
9910
9911 if (stack_max_limit)
9912 {
9913 Magazine other_mag = Magazine.Cast(other_item);
9914 if (other_item)
9915 {
9916 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9917 return false;
9918 }
9919
9920 }
9921 }
9922 else
9923 {
9924
9926 return false;
9927
9929 return false;
9930 }
9931
9932 PlayerBase player = null;
9933 if (CastTo(player, GetHierarchyRootPlayer()))
9934 {
9935 if (player.GetInventory().HasAttachment(this))
9936 return false;
9937
9938 if (player.IsItemsToDelete())
9939 return false;
9940 }
9941
9942 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9943 return false;
9944
9945 int slotID;
9947 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9948 return false;
9949
9950 return true;
9951 }
9952
9954 {
9956 }
9957
9959 {
9960 return m_IsResultOfSplit;
9961 }
9962
9964 {
9965 m_IsResultOfSplit = value;
9966 }
9967
9969 {
9971 }
9972
9974 {
9975 float other_item_quantity = other_item.GetQuantity();
9976 float this_free_space;
9977
9979
9981
9982 if (other_item_quantity > this_free_space)
9983 {
9984 return this_free_space;
9985 }
9986 else
9987 {
9988 return other_item_quantity;
9989 }
9990 }
9991
9993 {
9995 }
9996
9998 {
10000 return;
10001
10002 if (!IsMagazine() && other_item)
10003 {
10005 if (quantity_used != 0)
10006 {
10007 float hp1 = GetHealth01("","");
10008 float hp2 = other_item.GetHealth01("","");
10009 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
10010 hpResult = hpResult / (
GetQuantity() + quantity_used);
10011
10012 hpResult *= GetMaxHealth();
10013 Math.Round(hpResult);
10014 SetHealth("", "Health", hpResult);
10015
10017 other_item.AddQuantity(-quantity_used);
10018 }
10019 }
10021 }
10022
10024 {
10025 #ifdef SERVER
10026 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
10027 GetHierarchyParent().IncreaseLifetimeUp();
10028 #endif
10029 };
10030
10032 {
10033 PlayerBase p = PlayerBase.Cast(player);
10034
10035 array<int> recipesIds = p.m_Recipes;
10036 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10037 if (moduleRecipesManager)
10038 {
10039 EntityAI itemInHands = player.GetEntityInHands();
10040 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
10041 }
10042
10043 for (int i = 0;i < recipesIds.Count(); i++)
10044 {
10045 int key = recipesIds.Get(i);
10046 string recipeName = moduleRecipesManager.GetRecipeName(key);
10048 }
10049 }
10050
10051
10052 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10053 {
10054 super.GetDebugActions(outputList);
10055
10056
10062
10063
10068
10073
10074
10078
10079
10081 {
10085 }
10086
10089
10090
10094
10096
10097 InventoryLocation loc = new InventoryLocation();
10098 GetInventory().GetCurrentInventoryLocation(loc);
10100 {
10101 if (Gizmo_IsSupported())
10104 }
10105
10107 }
10108
10109
10110
10111
10113 {
10114 super.OnAction(action_id, player, ctx);
10115
10117 {
10118 switch (action_id)
10119 {
10123 return true;
10127 return true;
10128 }
10129 }
10130
10132 {
10133 switch (action_id)
10134 {
10136 Delete();
10137 return true;
10138 }
10139 }
10140
10141 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10142 {
10143 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10144 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10145 PlayerBase p = PlayerBase.Cast(player);
10146 if (
EActions.RECIPES_RANGE_START < 1000)
10147 {
10148 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10149 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10150 }
10151 }
10152 #ifndef SERVER
10153 else if (action_id ==
EActions.WATCH_PLAYER)
10154 {
10155 PluginDeveloper.SetDeveloperItemClientEx(player);
10156 }
10157 #endif
10159 {
10160 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10161 {
10162 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10163 OnDebugButtonPressServer(id + 1);
10164 }
10165
10166 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10167 {
10168 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10170 }
10171
10172 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10173 {
10174 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10176 }
10177
10178 else if (action_id ==
EActions.ADD_QUANTITY)
10179 {
10180 if (IsMagazine())
10181 {
10182 Magazine mag = Magazine.Cast(this);
10183 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10184 }
10185 else
10186 {
10188 }
10189
10190 if (m_EM)
10191 {
10192 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10193 }
10194
10195 }
10196
10197 else if (action_id ==
EActions.REMOVE_QUANTITY)
10198 {
10199 if (IsMagazine())
10200 {
10201 Magazine mag2 = Magazine.Cast(this);
10202 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10203 }
10204 else
10205 {
10207 }
10208 if (m_EM)
10209 {
10210 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10211 }
10212
10213 }
10214
10215 else if (action_id ==
EActions.SET_QUANTITY_0)
10216 {
10218
10219 if (m_EM)
10220 {
10221 m_EM.SetEnergy(0);
10222 }
10223 }
10224
10225 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10226 {
10228
10229 if (m_EM)
10230 {
10231 m_EM.SetEnergy(m_EM.GetEnergyMax());
10232 }
10233 }
10234
10235 else if (action_id ==
EActions.ADD_HEALTH)
10236 {
10237 AddHealth("","",GetMaxHealth("","Health")/5);
10238 }
10239 else if (action_id ==
EActions.REMOVE_HEALTH)
10240 {
10241 AddHealth("","",-GetMaxHealth("","Health")/5);
10242 }
10243 else if (action_id ==
EActions.DESTROY_HEALTH)
10244 {
10245 SetHealth01("","",0);
10246 }
10247 else if (action_id ==
EActions.WATCH_ITEM)
10248 {
10250 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10251 #ifdef DEVELOPER
10252 SetDebugDeveloper_item(this);
10253 #endif
10254 }
10255
10256 else if (action_id ==
EActions.ADD_TEMPERATURE)
10257 {
10258 AddTemperature(20);
10259
10260 }
10261
10262 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10263 {
10264 AddTemperature(-20);
10265
10266 }
10267
10268 else if (action_id ==
EActions.FLIP_FROZEN)
10269 {
10270 SetFrozen(!GetIsFrozen());
10271
10272 }
10273
10274 else if (action_id ==
EActions.ADD_WETNESS)
10275 {
10277
10278 }
10279
10280 else if (action_id ==
EActions.REMOVE_WETNESS)
10281 {
10283
10284 }
10285
10286 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10287 {
10290
10291
10292 }
10293
10294 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10295 {
10298 }
10299
10300 else if (action_id ==
EActions.MAKE_SPECIAL)
10301 {
10302 auto debugParams = DebugSpawnParams.WithPlayer(player);
10303 OnDebugSpawnEx(debugParams);
10304 }
10305
10306 }
10307
10308
10309 return false;
10310 }
10311
10312
10313
10314
10318
10321
10322
10323
10325 {
10326 return false;
10327 }
10328
10329
10331 {
10332 return true;
10333 }
10334
10335
10337 {
10338 return true;
10339 }
10340
10341
10342
10344 {
10345 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10346 return g_Game.ConfigIsExisting(config_path);
10347 }
10348
10351 {
10352 return null;
10353 }
10354
10356 {
10357 return false;
10358 }
10359
10361 {
10362 return false;
10363 }
10364
10368
10369
10371 {
10372 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10373 return module_repairing.CanRepair(this, item_repair_kit);
10374 }
10375
10376
10377 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10378 {
10379 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10380 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10381 }
10382
10383
10385 {
10386
10387
10388
10389
10390
10391
10392
10393
10394 return 1;
10395 }
10396
10397
10398
10400 {
10402 }
10403
10404
10405
10407 {
10409 }
10410
10411
10420 {
10421 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10422
10423 if (player)
10424 {
10425 player.MessageStatus(text);
10426 }
10427 }
10428
10429
10438 {
10439 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10440
10441 if (player)
10442 {
10443 player.MessageAction(text);
10444 }
10445 }
10446
10447
10456 {
10457 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10458
10459 if (player)
10460 {
10461 player.MessageFriendly(text);
10462 }
10463 }
10464
10465
10474 {
10475 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10476
10477 if (player)
10478 {
10479 player.MessageImportant(text);
10480 }
10481 }
10482
10484 {
10485 return true;
10486 }
10487
10488
10489 override bool KindOf(
string tag)
10490 {
10491 bool found = false;
10492 string item_name = this.
GetType();
10494 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10495
10496 int array_size = item_tag_array.Count();
10497 for (int i = 0; i < array_size; i++)
10498 {
10499 if (item_tag_array.Get(i) == tag)
10500 {
10501 found = true;
10502 break;
10503 }
10504 }
10505 return found;
10506 }
10507
10508
10510 {
10511
10512 super.OnRPC(sender, rpc_type,ctx);
10513
10514
10515 switch (rpc_type)
10516 {
10517 #ifndef SERVER
10518 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10519 Param2<bool, string> p = new Param2<bool, string>(false, "");
10520
10522 return;
10523
10524 bool play = p.param1;
10525 string soundSet = p.param2;
10526
10527 if (play)
10528 {
10530 {
10532 {
10534 }
10535 }
10536 else
10537 {
10539 }
10540 }
10541 else
10542 {
10544 }
10545
10546 break;
10547 #endif
10548
10549 }
10550
10552 {
10554 }
10555 }
10556
10557
10558
10559
10561 {
10562 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10563 return plugin.GetID(
name);
10564 }
10565
10567 {
10568 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10569 return plugin.GetName(id);
10570 }
10571
10574 {
10575
10576
10577 int varFlags;
10578 if (!ctx.
Read(varFlags))
10579 return;
10580
10581 if (varFlags & ItemVariableFlags.FLOAT)
10582 {
10584 }
10585 }
10586
10588 {
10589
10590 super.SerializeNumericalVars(floats_out);
10591
10592
10593
10595 {
10597 }
10598
10600 {
10602 }
10603
10605 {
10607 }
10608
10610 {
10615 }
10616
10618 {
10620 }
10621 }
10622
10624 {
10625
10626 super.DeSerializeNumericalVars(floats);
10627
10628
10629 int index = 0;
10630 int mask = Math.Round(floats.Get(index));
10631
10632 index++;
10633
10635 {
10637 {
10639 }
10640 else
10641 {
10642 float quantity = floats.Get(index);
10643 SetQuantity(quantity,
true,
false,
false,
false);
10644 }
10645 index++;
10646 }
10647
10649 {
10650 float wet = floats.Get(index);
10652 index++;
10653 }
10654
10656 {
10657 int liquidtype = Math.Round(floats.Get(index));
10659 index++;
10660 }
10661
10663 {
10665 index++;
10667 index++;
10669 index++;
10671 index++;
10672 }
10673
10675 {
10676 int cleanness = Math.Round(floats.Get(index));
10678 index++;
10679 }
10680 }
10681
10683 {
10684 super.WriteVarsToCTX(ctx);
10685
10686
10688 {
10690 }
10691
10693 {
10695 }
10696
10698 {
10700 }
10701
10703 {
10704 int r,g,b,a;
10710 }
10711
10713 {
10715 }
10716 }
10717
10719 {
10720 if (!super.ReadVarsFromCTX(ctx,version))
10721 return false;
10722
10723 int intValue;
10724 float value;
10725
10726 if (version < 140)
10727 {
10728 if (!ctx.
Read(intValue))
10729 return false;
10730
10731 m_VariablesMask = intValue;
10732 }
10733
10735 {
10736 if (!ctx.
Read(value))
10737 return false;
10738
10740 {
10742 }
10743 else
10744 {
10746 }
10747 }
10748
10749 if (version < 140)
10750 {
10752 {
10753 if (!ctx.
Read(value))
10754 return false;
10755 SetTemperatureDirect(value);
10756 }
10757 }
10758
10760 {
10761 if (!ctx.
Read(value))
10762 return false;
10764 }
10765
10767 {
10768 if (!ctx.
Read(intValue))
10769 return false;
10771 }
10772
10774 {
10775 int r,g,b,a;
10777 return false;
10779 return false;
10781 return false;
10783 return false;
10784
10786 }
10787
10789 {
10790 if (!ctx.
Read(intValue))
10791 return false;
10793 }
10794
10795 if (version >= 138 && version < 140)
10796 {
10798 {
10799 if (!ctx.
Read(intValue))
10800 return false;
10801 SetFrozen(intValue);
10802 }
10803 }
10804
10805 return true;
10806 }
10807
10808
10810 {
10813 {
10815 }
10816
10817 if (!super.OnStoreLoad(ctx, version))
10818 {
10820 return false;
10821 }
10822
10823 if (version >= 114)
10824 {
10825 bool hasQuickBarIndexSaved;
10826
10827 if (!ctx.
Read(hasQuickBarIndexSaved))
10828 {
10830 return false;
10831 }
10832
10833 if (hasQuickBarIndexSaved)
10834 {
10835 int itmQBIndex;
10836
10837
10838 if (!ctx.
Read(itmQBIndex))
10839 {
10841 return false;
10842 }
10843
10844 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10845 if (itmQBIndex != -1 && parentPlayer)
10846 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10847 }
10848 }
10849 else
10850 {
10851
10852 PlayerBase player;
10853 int itemQBIndex;
10854 if (version ==
int.
MAX)
10855 {
10856 if (!ctx.
Read(itemQBIndex))
10857 {
10859 return false;
10860 }
10861 }
10862 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10863 {
10864
10865 if (!ctx.
Read(itemQBIndex))
10866 {
10868 return false;
10869 }
10870 if (itemQBIndex != -1 && player)
10871 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10872 }
10873 }
10874
10875 if (version < 140)
10876 {
10877
10878 if (!LoadVariables(ctx, version))
10879 {
10881 return false;
10882 }
10883 }
10884
10885
10887 {
10889 return false;
10890 }
10891 if (version >= 132)
10892 {
10894 if (raib)
10895 {
10897 {
10899 return false;
10900 }
10901 }
10902 }
10903
10905 return true;
10906 }
10907
10908
10909
10911 {
10912 super.OnStoreSave(ctx);
10913
10914 PlayerBase player;
10915 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10916 {
10918
10919 int itemQBIndex = -1;
10920 itemQBIndex = player.FindQuickBarEntityIndex(this);
10921 ctx.
Write(itemQBIndex);
10922 }
10923 else
10924 {
10926 }
10927
10929
10931 if (raib)
10932 {
10934 }
10935 }
10936
10937
10939 {
10940 super.AfterStoreLoad();
10941
10943 {
10945 }
10946
10948 {
10951 }
10952 }
10953
10955 {
10956 super.EEOnAfterLoad();
10957
10959 {
10961 }
10962
10965 }
10966
10968 {
10969 return false;
10970 }
10971
10972
10973
10975 {
10977 {
10978 #ifdef PLATFORM_CONSOLE
10979
10981 {
10983 if (menu)
10984 {
10986 }
10987 }
10988 #endif
10989 }
10990
10992 {
10995 }
10996
10998 {
10999 SetWeightDirty();
11001 }
11003 {
11006 }
11007
11009 {
11012
11015 }
11017 {
11021 }
11022
11023 super.OnVariablesSynchronized();
11024 }
11025
11026
11027
11029 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
11030 {
11031 if (!IsServerCheck(allow_client))
11032 return false;
11033
11035 return false;
11036
11039
11040 if (value <= (min + 0.001))
11041 value = min;
11042
11043 if (value == min)
11044 {
11045 if (destroy_config)
11046 {
11047 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
11048 if (dstr)
11049 {
11051 this.Delete();
11052 return true;
11053 }
11054 }
11055 else if (destroy_forced)
11056 {
11058 this.Delete();
11059 return true;
11060 }
11061
11063 }
11064
11067
11069 {
11070 EntityAI parent = GetHierarchyRoot();
11071 InventoryLocation iLoc = new InventoryLocation();
11072 GetInventory().GetCurrentInventoryLocation(iLoc);
11074 {
11075 int iLocSlot = iLoc.
GetSlot();
11077 {
11079 }
11081 {
11083 }
11084 }
11085 }
11086
11088 {
11090
11091 if (delta)
11093 }
11094
11096
11097 return false;
11098 }
11099
11100
11102 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11103 {
11105 }
11106
11108 {
11111 }
11112
11114 {
11117 }
11118
11120 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11121 {
11122 float value_clamped = Math.Clamp(value, 0, 1);
11124 SetQuantity(result, destroy_config, destroy_forced);
11125 }
11126
11127
11130 {
11132 }
11133
11135 {
11137 }
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11149 {
11150 int slot = -1;
11151 GameInventory inventory = GetInventory();
11152 if (inventory)
11153 {
11154 InventoryLocation il = new InventoryLocation;
11157 }
11158
11160 }
11161
11163 {
11164 float quantity_max = 0;
11165
11167 {
11168 if (attSlotID != -1)
11169 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11170
11171 if (quantity_max <= 0)
11173 }
11174
11175 if (quantity_max <= 0)
11177
11178 return quantity_max;
11179 }
11180
11182 {
11184 }
11185
11187 {
11189 }
11190
11191
11193 {
11195 }
11196
11198 {
11200 }
11201
11203 {
11205 }
11206
11207
11209 {
11210
11211 float weightEx = GetWeightEx();
11212 float special = GetInventoryAndCargoWeight();
11213 return weightEx - special;
11214 }
11215
11216
11218 {
11220 }
11221
11223 {
11225 {
11226 #ifdef DEVELOPER
11227 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11228 {
11229 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11231 }
11232 #endif
11233
11234 return GetQuantity() * GetConfigWeightModified();
11235 }
11236 else if (HasEnergyManager())
11237 {
11238 #ifdef DEVELOPER
11239 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11240 {
11241 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11242 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11243 }
11244 #endif
11245 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11246 }
11247 else
11248 {
11249 #ifdef DEVELOPER
11250 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11251 {
11252 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11253 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11254 }
11255 #endif
11256 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11257 }
11258 }
11259
11262 {
11263 int item_count = 0;
11265
11266 GameInventory inventory = GetInventory();
11267 CargoBase cargo = inventory.
GetCargo();
11268 if (cargo != NULL)
11269 {
11271 }
11272
11274 for (int i = 0; i < nAttachments; ++i)
11275 {
11277 if (item)
11278 item_count += item.GetNumberOfItems();
11279 }
11280 return item_count;
11281 }
11282
11285 {
11286 float weight = 0;
11287 float wetness = 1;
11288 if (include_wetness)
11291 {
11292 weight = wetness * m_ConfigWeight;
11293 }
11295 {
11296 weight = 1;
11297 }
11298 return weight;
11299 }
11300
11301
11302
11304 {
11305 GameInventory inventory = GetInventory();
11306 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11307 {
11308 array<EntityAI> items = new array<EntityAI>;
11310 for (int i = 0; i < items.Count(); ++i)
11311 {
11313 if (item)
11314 {
11315 g_Game.ObjectDelete(item);
11316 }
11317 }
11318 }
11319 }
11320
11321
11322
11323
11325 {
11326 float energy = 0;
11327 if (HasEnergyManager())
11328 {
11329 energy = GetCompEM().GetEnergy();
11330 }
11331 return energy;
11332 }
11333
11334
11336 {
11337 super.OnEnergyConsumed();
11338
11340 }
11341
11343 {
11344 super.OnEnergyAdded();
11345
11347 }
11348
11349
11351 {
11352 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11353 {
11355 {
11356 float energy_0to1 = GetCompEM().GetEnergy0To1();
11358 }
11359 }
11360 }
11361
11362
11364 {
11365 return ConfigGetFloat("heatIsolation");
11366 }
11367
11369 {
11371 }
11372
11374 {
11375 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11376 if (
g_Game.ConfigIsExisting(paramPath))
11377 return g_Game.ConfigGetFloat(paramPath);
11378
11379 return 0.0;
11380 }
11381
11383 {
11384 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11385 if (
g_Game.ConfigIsExisting(paramPath))
11386 return g_Game.ConfigGetFloat(paramPath);
11387
11388 return 0.0;
11389 }
11390
11391 override void SetWet(
float value,
bool allow_client =
false)
11392 {
11393 if (!IsServerCheck(allow_client))
11394 return;
11395
11398
11400
11401 m_VarWet = Math.Clamp(value, min, max);
11402
11404 {
11407 }
11408 }
11409
11410 override void AddWet(
float value)
11411 {
11413 }
11414
11416 {
11418 }
11419
11421 {
11423 }
11424
11426 {
11428 }
11429
11431 {
11433 }
11434
11436 {
11438 }
11439
11440 override void OnWetChanged(
float newVal,
float oldVal)
11441 {
11444 if (newLevel != oldLevel)
11445 {
11447 }
11448 }
11449
11451 {
11452 SetWeightDirty();
11453 }
11454
11456 {
11457 return GetWetLevelInternal(
m_VarWet);
11458 }
11459
11460
11461
11463 {
11465 }
11466
11468 {
11470 }
11471
11473 {
11475 }
11476
11478 {
11480 }
11481
11482
11483
11485 {
11486 if (ConfigIsExisting("itemModelLength"))
11487 {
11488 return ConfigGetFloat("itemModelLength");
11489 }
11490 return 0;
11491 }
11492
11494 {
11495 if (ConfigIsExisting("itemAttachOffset"))
11496 {
11497 return ConfigGetFloat("itemAttachOffset");
11498 }
11499 return 0;
11500 }
11501
11502 override void SetCleanness(
int value,
bool allow_client =
false)
11503 {
11504 if (!IsServerCheck(allow_client))
11505 return;
11506
11508
11510
11513 }
11514
11516 {
11518 }
11519
11521 {
11522 return true;
11523 }
11524
11525
11526
11527
11529 {
11531 }
11532
11534 {
11536 }
11537
11538
11539
11540
11541 override void SetColor(
int r,
int g,
int b,
int a)
11542 {
11548 }
11550 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11551 {
11556 }
11557
11559 {
11561 }
11562
11565 {
11566 int r,g,b,a;
11568 r = r/255;
11569 g = g/255;
11570 b = b/255;
11571 a = a/255;
11572 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11573 }
11574
11575
11576
11577 override void SetLiquidType(
int value,
bool allow_client =
false)
11578 {
11579 if (!IsServerCheck(allow_client))
11580 return;
11581
11586 }
11587
11589 {
11590 return ConfigGetInt("varLiquidTypeInit");
11591 }
11592
11594 {
11596 }
11597
11599 {
11601 SetFrozen(false);
11602 }
11603
11606 {
11607 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11608 }
11609
11610
11613 {
11614 PlayerBase nplayer;
11615 if (PlayerBase.CastTo(nplayer, player))
11616 {
11618 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11619 }
11620 }
11621
11622
11625 {
11626 PlayerBase nplayer;
11627 if (PlayerBase.CastTo(nplayer,player))
11628 {
11629 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11630 }
11631
11632 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11633
11634 if (HasEnergyManager())
11635 {
11636 GetCompEM().UpdatePlugState();
11637 }
11638 }
11639
11640
11642 {
11643 super.OnPlacementStarted(player);
11644
11646 }
11647
11648 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11649 {
11651 {
11652 m_AdminLog.OnPlacementComplete(player,
this);
11653 }
11654
11655 super.OnPlacementComplete(player, position, orientation);
11656 }
11657
11658
11659
11660
11661
11663 {
11665 {
11666 return true;
11667 }
11668 else
11669 {
11670 return false;
11671 }
11672 }
11673
11674
11676 {
11678 {
11680 }
11681 }
11682
11683
11685 {
11687 }
11688
11690 {
11692 }
11693
11694 override void InsertAgent(
int agent,
float count = 1)
11695 {
11696 if (count < 1)
11697 return;
11698
11700 }
11701
11704 {
11706 }
11707
11708
11710 {
11712 }
11713
11714
11715
11716
11717
11718
11719
11720
11721
11722
11723
11724
11725
11726
11727
11728
11729
11730
11731
11732
11733
11734
11735
11736
11737
11738
11739
11740
11741
11742
11743
11744
11745
11746
11747
11748
11749
11750
11751
11752
11753
11754
11756 {
11758 return false;
11759 return true;
11760 }
11761
11763 {
11764
11766 }
11767
11768
11771 {
11772 super.CheckForRoofLimited(timeTresholdMS);
11773
11774 float time =
g_Game.GetTime();
11775 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11776 {
11777 m_PreviousRoofTestTime = time;
11778 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11779 }
11780 }
11781
11782
11784 {
11786 {
11787 return 0;
11788 }
11789
11790 if (GetInventory().GetAttachmentSlotsCount() != 0)
11791 {
11792 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11793 if (filter)
11794 return filter.GetProtectionLevel(type, false, system);
11795 else
11796 return 0;
11797 }
11798
11799 string subclassPath, entryName;
11800
11801 switch (type)
11802 {
11804 entryName = "biological";
11805 break;
11807 entryName = "chemical";
11808 break;
11809 default:
11810 entryName = "biological";
11811 break;
11812 }
11813
11814 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11815
11816 return g_Game.ConfigGetFloat(subclassPath + entryName);
11817 }
11818
11819
11820
11823 {
11824 if (!IsMagazine())
11826
11828 }
11829
11830
11831
11832
11833
11838 {
11839 return true;
11840 }
11841
11843 {
11845 }
11846
11847
11848
11849
11850
11852 {
11853 if (parent)
11854 {
11855 if (parent.IsInherited(DayZInfected))
11856 return true;
11857
11858 if (!parent.IsRuined())
11859 return true;
11860 }
11861
11862 return true;
11863 }
11864
11866 {
11867 if (!super.CanPutAsAttachment(parent))
11868 {
11869 return false;
11870 }
11871
11872 if (!IsRuined() && !parent.IsRuined())
11873 {
11874 return true;
11875 }
11876
11877 return false;
11878 }
11879
11881 {
11882
11883
11884
11885
11886 return super.CanReceiveItemIntoCargo(item);
11887 }
11888
11890 {
11891
11892
11893
11894
11895 GameInventory attachmentInv = attachment.GetInventory();
11897 {
11898 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11899 return false;
11900 }
11901
11902 InventoryLocation loc = new InventoryLocation();
11903 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11904 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11905 return false;
11906
11907 return super.CanReceiveAttachment(attachment, slotId);
11908 }
11909
11911 {
11912 if (!super.CanReleaseAttachment(attachment))
11913 return false;
11914
11915 return GetInventory().AreChildrenAccessible();
11916 }
11917
11918
11919
11920
11921
11922
11923
11924
11925
11926
11927
11928
11929
11930
11931
11932
11933
11934
11935
11936
11937
11939 {
11940 int id = muzzle_owner.GetMuzzleID();
11941 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11942
11943 if (WPOF_array)
11944 {
11945 for (int i = 0; i < WPOF_array.Count(); i++)
11946 {
11947 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11948
11949 if (WPOF)
11950 {
11951 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11952 }
11953 }
11954 }
11955 }
11956
11957
11959 {
11960 int id = muzzle_owner.GetMuzzleID();
11962
11963 if (WPOBE_array)
11964 {
11965 for (int i = 0; i < WPOBE_array.Count(); i++)
11966 {
11967 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11968
11969 if (WPOBE)
11970 {
11971 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11972 }
11973 }
11974 }
11975 }
11976
11977
11979 {
11980 int id = muzzle_owner.GetMuzzleID();
11981 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11982
11983 if (WPOOH_array)
11984 {
11985 for (int i = 0; i < WPOOH_array.Count(); i++)
11986 {
11987 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11988
11989 if (WPOOH)
11990 {
11991 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11992 }
11993 }
11994 }
11995 }
11996
11997
11999 {
12000 int id = muzzle_owner.GetMuzzleID();
12001 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12002
12003 if (WPOOH_array)
12004 {
12005 for (int i = 0; i < WPOOH_array.Count(); i++)
12006 {
12007 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12008
12009 if (WPOOH)
12010 {
12011 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12012 }
12013 }
12014 }
12015 }
12016
12017
12019 {
12020 int id = muzzle_owner.GetMuzzleID();
12021 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
12022
12023 if (WPOOH_array)
12024 {
12025 for (int i = 0; i < WPOOH_array.Count(); i++)
12026 {
12027 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
12028
12029 if (WPOOH)
12030 {
12031 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
12032 }
12033 }
12034 }
12035 }
12036
12037
12038
12040 {
12042 {
12043 return true;
12044 }
12045
12046 return false;
12047 }
12048
12050 {
12052 {
12053 return true;
12054 }
12055
12056 return false;
12057 }
12058
12060 {
12062 {
12063 return true;
12064 }
12065
12066 return false;
12067 }
12068
12070 {
12071 return false;
12072 }
12073
12076 {
12077 return UATimeSpent.DEFAULT_DEPLOY;
12078 }
12079
12080
12081
12082
12084 {
12086 SetSynchDirty();
12087 }
12088
12090 {
12092 }
12093
12094
12096 {
12097 return false;
12098 }
12099
12102 {
12103 string att_type = "None";
12104
12105 if (ConfigIsExisting("soundAttType"))
12106 {
12107 att_type = ConfigGetString("soundAttType");
12108 }
12109
12111 }
12112
12114 {
12116 }
12117
12118
12119
12120
12121
12127
12129 {
12132
12134 }
12135
12136
12138 {
12140 return;
12141
12143
12146
12149
12150 SoundParameters params = new SoundParameters();
12154 }
12155
12156
12158 {
12160 {
12163
12164 SetSynchDirty();
12165
12168 }
12169 }
12170
12172 {
12174 }
12175
12176
12178 {
12180 return;
12181
12183 SetSynchDirty();
12184
12187 }
12188
12190 {
12193 }
12194
12196 {
12198 }
12199
12200 void OnApply(PlayerBase player);
12201
12203 {
12204 return 1.0;
12205 };
12206
12208 {
12210 }
12211
12213 {
12215 }
12216
12218
12220 {
12221 SetDynamicPhysicsLifeTime(0.01);
12223 }
12224
12226 {
12227 array<string> zone_names = new array<string>;
12228 GetDamageZones(zone_names);
12229 for (int i = 0; i < zone_names.Count(); i++)
12230 {
12231 SetHealthMax(zone_names.Get(i),"Health");
12232 }
12233 SetHealthMax("","Health");
12234 }
12235
12238 {
12239 float global_health = GetHealth01("","Health");
12240 array<string> zones = new array<string>;
12241 GetDamageZones(zones);
12242
12243 for (int i = 0; i < zones.Count(); i++)
12244 {
12245 SetHealth01(zones.Get(i),"Health",global_health);
12246 }
12247 }
12248
12251 {
12252 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12253 }
12254
12256 {
12257 if (!hasRootAsPlayer)
12258 {
12259 if (refParentIB)
12260 {
12261
12262 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12263 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12264
12265 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12266 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12267
12270 }
12271 else
12272 {
12273
12276 }
12277 }
12278 }
12279
12281 {
12283 {
12284 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12285 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12286 {
12287 float heatPermCoef = 1.0;
12289 while (ent)
12290 {
12291 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12292 ent = ent.GetHierarchyParent();
12293 }
12294
12295 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12296 }
12297 }
12298 }
12299
12301 {
12302
12303 EntityAI parent = GetHierarchyParent();
12304 if (!parent)
12305 {
12306 hasParent = false;
12307 hasRootAsPlayer = false;
12308 }
12309 else
12310 {
12311 hasParent = true;
12312 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12313 refParentIB =
ItemBase.Cast(parent);
12314 }
12315 }
12316
12317 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12318 {
12319
12320 }
12321
12323 {
12324
12325 return false;
12326 }
12327
12329 {
12330
12331
12332 return false;
12333 }
12334
12336 {
12337
12338 return false;
12339 }
12340
12343 {
12344 return !GetIsFrozen() &&
IsOpen();
12345 }
12346
12348 {
12349 bool hasParent = false, hasRootAsPlayer = false;
12351
12352 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12353 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12354
12355 if (wwtu || foodDecay)
12356 {
12360
12361 if (processWetness || processTemperature || processDecay)
12362 {
12364
12365 if (processWetness)
12366 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12367
12368 if (processTemperature)
12370
12371 if (processDecay)
12372 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12373 }
12374 }
12375 }
12376
12379 {
12381 }
12382
12384 {
12387
12388 return super.GetTemperatureFreezeThreshold();
12389 }
12390
12392 {
12395
12396 return super.GetTemperatureThawThreshold();
12397 }
12398
12400 {
12403
12404 return super.GetItemOverheatThreshold();
12405 }
12406
12408 {
12410 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12411
12412 return super.GetTemperatureFreezeTime();
12413 }
12414
12416 {
12418 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12419
12420 return super.GetTemperatureThawTime();
12421 }
12422
12427
12429 {
12430 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12431 }
12432
12434 {
12435 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12436 }
12437
12440 {
12442 }
12443
12445 {
12447 }
12448
12450 {
12452 }
12453
12456 {
12457 return null;
12458 }
12459
12462 {
12463 return false;
12464 }
12465
12467 {
12469 {
12472 if (!trg)
12473 {
12475 explosive = this;
12476 }
12477
12478 explosive.PairRemote(trg);
12480
12481 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12482 trg.SetPersistentPairID(persistentID);
12483 explosive.SetPersistentPairID(persistentID);
12484
12485 return true;
12486 }
12487 return false;
12488 }
12489
12492 {
12493 float ret = 1.0;
12496 ret *= GetHealth01();
12497
12498 return ret;
12499 }
12500
12501 #ifdef DEVELOPER
12502 override void SetDebugItem()
12503 {
12504 super.SetDebugItem();
12505 _itemBase = this;
12506 }
12507
12509 {
12510 string text = super.GetDebugText();
12511
12513 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12514
12515 return text;
12516 }
12517 #endif
12518
12520 {
12521 return true;
12522 }
12523
12525
12527
12529 {
12532 }
12533
12534
12542
12558
12559 [
Obsolete(
"Use ItemSoundHandler instead")]
12562 {
12563 if (!
g_Game.IsDedicatedServer())
12564 {
12565 if (ConfigIsExisting("attachSoundSet"))
12566 {
12567 string cfg_path = "";
12568 string soundset = "";
12569 string type_name =
GetType();
12570
12573 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12574 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12575
12576 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12577 {
12578 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12579 {
12580 if (cfg_slot_array[i] == slot_type)
12581 {
12582 soundset = cfg_soundset_array[i];
12583 break;
12584 }
12585 }
12586 }
12587
12588 if (soundset != "")
12589 {
12590 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12592 }
12593 }
12594 }
12595 }
12596
12598}
12599
12601{
12603 if (entity)
12604 {
12605 bool is_item = entity.IsInherited(
ItemBase);
12606 if (is_item && full_quantity)
12607 {
12610 }
12611 }
12612 else
12613 {
12615 return NULL;
12616 }
12617 return entity;
12618}
12619
12621{
12622 if (item)
12623 {
12624 if (health > 0)
12625 item.SetHealth("", "", health);
12626
12627 if (item.CanHaveTemperature())
12628 {
12630 if (item.CanFreeze())
12631 item.SetFrozen(false);
12632 }
12633
12634 if (item.HasEnergyManager())
12635 {
12636 if (quantity >= 0)
12637 {
12638 item.GetCompEM().SetEnergy0To1(quantity);
12639 }
12640 else
12641 {
12643 }
12644 }
12645 else if (item.IsMagazine())
12646 {
12647 Magazine mag = Magazine.Cast(item);
12648 if (quantity >= 0)
12649 {
12650 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12651 }
12652 else
12653 {
12655 }
12656
12657 }
12658 else
12659 {
12660 if (quantity >= 0)
12661 {
12662 item.SetQuantityNormalized(quantity, false);
12663 }
12664 else
12665 {
12667 }
12668
12669 }
12670 }
12671}
12672
12673#ifdef DEVELOPER
12675#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.