7542{
7544 {
7545 return true;
7546 }
7547};
7548
7550{
7551
7552};
7553
7554
7555
7557{
7561
7563
7566
7567
7568
7569
7570
7579
7585
7590
7595
7616 protected bool m_IsResultOfSplit
7617
7619
7624
7625
7626
7628
7632
7633
7634
7636
7639
7640
7641
7647
7648
7656
7659
7660
7662
7663
7665
7666
7671
7672
7677
7679
7680
7682
7683
7685 {
7690
7691 if (!
g_Game.IsDedicatedServer())
7692 {
7694 {
7696
7698 {
7700 }
7701 }
7702
7705 }
7706
7707 m_OldLocation = null;
7708
7710 {
7712 }
7713
7714 if (ConfigIsExisting("headSelectionsToHide"))
7715 {
7718 }
7719
7721 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7722 {
7724 }
7725
7727
7728 m_IsResultOfSplit = false;
7729
7731 }
7732
7734 {
7735 super.InitItemVariables();
7736
7742 m_Count = ConfigGetInt(
"count");
7743
7746
7751
7754
7759
7771
7775
7776
7779 if (ConfigIsExisting("canBeSplit"))
7780 {
7783 }
7784
7786 if (ConfigIsExisting("itemBehaviour"))
7788
7789
7792 RegisterNetSyncVariableInt("m_VarLiquidType");
7793 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7794
7795 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7796 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7797 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7798
7799 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7800 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7801 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7802 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7803
7804 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7805 RegisterNetSyncVariableBool("m_IsTakeable");
7806 RegisterNetSyncVariableBool("m_IsHologram");
7807
7810 {
7813 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7814 }
7815
7817
7819 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7821
7823 }
7824
7826 {
7828 }
7829
7831 {
7834 {
7839 }
7840 }
7841
7842 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7843 {
7845 {
7848 }
7849
7851 }
7852
7854 {
7860 }
7861
7863
7865 {
7867
7868 if (!action)
7869 {
7870 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7871 return;
7872 }
7873
7875 if (!ai)
7876 {
7878 return;
7879 }
7880
7882 if (!action_array)
7883 {
7884 action_array = new array<ActionBase_Basic>;
7886 }
7887 if (LogManager.IsActionLogEnable())
7888 {
7889 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7890 }
7891
7892 if (action_array.Find(action) != -1)
7893 {
7894 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7895 }
7896 else
7897 {
7898 action_array.Insert(action);
7899 }
7900 }
7901
7903 {
7904 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7905 ActionBase action = player.GetActionManager().GetAction(actionName);
7908
7909 if (action_array)
7910 {
7911 action_array.RemoveItem(action);
7912 }
7913 }
7914
7915
7916
7918 {
7919 ActionOverrideData overrideData = new ActionOverrideData();
7923
7925 if (!actionMap)
7926 {
7929 }
7930
7931 actionMap.Insert(this.
Type(), overrideData);
7932
7933 }
7934
7936
7938
7939
7941 {
7944
7947
7948 string config_to_search = "CfgVehicles";
7949 string muzzle_owner_config;
7950
7952 {
7953 if (IsInherited(Weapon))
7954 config_to_search = "CfgWeapons";
7955
7956 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7957
7958 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7959
7960 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7961
7962 if (config_OnFire_subclass_count > 0)
7963 {
7964 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7965
7966 for (int i = 0; i < config_OnFire_subclass_count; i++)
7967 {
7968 string particle_class = "";
7969 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7970 string config_OnFire_entry = config_OnFire_class + particle_class;
7971 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7972 WPOF_array.Insert(WPOF);
7973 }
7974
7975
7977 }
7978 }
7979
7981 {
7982 config_to_search = "CfgWeapons";
7983 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7984
7985 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7986
7987 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7988
7989 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7990 {
7991 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7992
7993 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7994 {
7995 string particle_class2 = "";
7996 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7997 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7998 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7999 WPOBE_array.Insert(WPOBE);
8000 }
8001
8002
8004 }
8005 }
8006 }
8007
8008
8010 {
8013
8015 {
8016 string config_to_search = "CfgVehicles";
8017
8018 if (IsInherited(Weapon))
8019 config_to_search = "CfgWeapons";
8020
8021 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8022 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8023
8024 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8025 {
8026
8028
8030 {
8032 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8034 return;
8035 }
8036
8039
8040
8041
8042 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8043 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8044
8045 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8046 {
8047 string particle_class = "";
8048 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8049 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8050 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8051
8052 if (entry_type == CT_CLASS)
8053 {
8054 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8055 WPOOH_array.Insert(WPOF);
8056 }
8057 }
8058
8059
8061 }
8062 }
8063 }
8064
8066 {
8068 }
8069
8071 {
8073 {
8075
8078
8081
8082 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8083 }
8084 }
8085
8087 {
8089 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8090
8092 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8093
8095 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8096
8098 {
8100 }
8101 }
8102
8104 {
8106 }
8107
8109 {
8112 else
8114
8116 {
8119 }
8120 else
8121 {
8124
8127 }
8128
8130 }
8131
8133 {
8135 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8136 }
8137
8139 {
8141 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8143 }
8144
8146 {
8148 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8149 }
8150
8152 {
8155
8156 OverheatingParticle OP = new OverheatingParticle();
8161
8163 }
8164
8166 {
8169
8170 return -1;
8171 }
8172
8174 {
8176 {
8179
8180 for (int i = count; i > 0; --i)
8181 {
8182 int id = i - 1;
8185
8188
8189 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8190 {
8191 if (p)
8192 {
8195 }
8196 }
8197 }
8198 }
8199 }
8200
8202 {
8204 {
8206 {
8207 int id = i - 1;
8209
8210 if (OP)
8211 {
8213
8214 if (p)
8215 {
8217 }
8218
8219 delete OP;
8220 }
8221 }
8222
8225 }
8226 }
8227
8230 {
8231 return 0.0;
8232 }
8233
8234
8236 {
8237 return 250;
8238 }
8239
8241 {
8242 return 0;
8243 }
8244
8247 {
8249 return true;
8250
8251 return false;
8252 }
8253
8256 {
8259
8261 {
8263 }
8264 else
8265 {
8266
8268 }
8269
8271 }
8272
8279 {
8280 return -1;
8281 }
8282
8283
8284
8285
8287 {
8289 {
8290 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8291 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8292
8293 if (r_index >= 0)
8294 {
8295 InventoryLocation r_il = new InventoryLocation;
8296 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8297
8298 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8301 {
8302 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8303 }
8305 {
8306 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8307 }
8308
8309 }
8310
8311 player.GetHumanInventory().ClearUserReservedLocation(this);
8312 }
8313
8316 }
8317
8318
8319
8320
8322 {
8323 return ItemBase.m_DebugActionsMask;
8324 }
8325
8327 {
8328 return ItemBase.m_DebugActionsMask & mask;
8329 }
8330
8332 {
8333 ItemBase.m_DebugActionsMask = mask;
8334 }
8335
8337 {
8338 ItemBase.m_DebugActionsMask |= mask;
8339 }
8340
8342 {
8343 ItemBase.m_DebugActionsMask &= ~mask;
8344 }
8345
8347 {
8349 {
8351 }
8352 else
8353 {
8355 }
8356 }
8357
8358
8360 {
8361 if (GetEconomyProfile())
8362 {
8363 float q_max = GetEconomyProfile().GetQuantityMax();
8364 if (q_max > 0)
8365 {
8366 float q_min = GetEconomyProfile().GetQuantityMin();
8367 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8368
8370 {
8371 ComponentEnergyManager comp = GetCompEM();
8373 {
8375 }
8376 }
8378 {
8380
8381 }
8382
8383 }
8384 }
8385 }
8386
8389 {
8390 EntityAI parent = GetHierarchyParent();
8391
8392 if (parent)
8393 {
8394 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8395 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8396 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8397 }
8398 }
8399
8402 {
8403 EntityAI parent = GetHierarchyParent();
8404
8405 if (parent)
8406 {
8407 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8408 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8409 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8410 }
8411 }
8412
8414 {
8415
8416
8417
8418
8420
8422 {
8423 if (ScriptInputUserData.CanStoreInputUserData())
8424 {
8425 ScriptInputUserData ctx = new ScriptInputUserData;
8431 ctx.
Write(use_stack_max);
8434
8436 {
8437 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8438 }
8439 }
8440 }
8441 else if (!
g_Game.IsMultiplayer())
8442 {
8444 }
8445 }
8446
8448 {
8450 }
8451
8453 {
8455 }
8456
8458 {
8460 }
8461
8463 {
8464
8465 return false;
8466 }
8467
8469 {
8470 return false;
8471 }
8472
8476 {
8477 return false;
8478 }
8479
8481 {
8482 return "";
8483 }
8484
8486
8488 {
8489 return false;
8490 }
8491
8493 {
8494 return true;
8495 }
8496
8497
8498
8500 {
8501 return true;
8502 }
8503
8505 {
8506 return true;
8507 }
8508
8510 {
8511 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8513 }
8514
8516 {
8518 }
8519
8521 {
8523 if (!is_being_placed)
8525 SetSynchDirty();
8526 }
8527
8528
8530
8532 {
8534 }
8535
8537 {
8539 }
8540
8542 {
8543 return 1;
8544 }
8545
8547 {
8548 return false;
8549 }
8550
8552 {
8554 SetSynchDirty();
8555 }
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8592 {
8593 super.OnMovedInsideCargo(container);
8594
8595 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8596 }
8597
8598 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8599 {
8600 super.EEItemLocationChanged(oldLoc, newLoc);
8601
8602 PlayerBase newPlayer = null;
8603 PlayerBase oldPlayer = null;
8604
8605 if (newLoc.GetParent())
8606 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8607
8608 if (oldLoc.GetParent())
8609 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8610
8612 {
8613 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8614
8615 if (rIndex >= 0)
8616 {
8617 InventoryLocation rIl = new InventoryLocation;
8618 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8619
8620 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8623 {
8624 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8625 }
8627 {
8629 }
8630
8631 }
8632 }
8633
8635 {
8636 if (newPlayer)
8637 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8638
8639 if (newPlayer == oldPlayer)
8640 {
8641 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8642 {
8644 {
8645 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8646 {
8647 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8648 }
8649 }
8650 else
8651 {
8652 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8653 }
8654 }
8655
8656 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8657 {
8658 int type = oldLoc.GetType();
8660 {
8661 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8662 }
8664 {
8665 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8666 }
8667 }
8668 if (!m_OldLocation)
8669 {
8670 m_OldLocation = new InventoryLocation;
8671 }
8672 m_OldLocation.Copy(oldLoc);
8673 }
8674 else
8675 {
8676 if (m_OldLocation)
8677 {
8678 m_OldLocation.Reset();
8679 }
8680 }
8681
8682 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8683 }
8684 else
8685 {
8686 if (newPlayer)
8687 {
8688 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8689 if (resIndex >= 0)
8690 {
8691 InventoryLocation il = new InventoryLocation;
8692 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8694 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8697 {
8698 il.
GetParent().GetOnReleaseLock().Invoke(it);
8699 }
8701 {
8703 }
8704
8705 }
8706 }
8708 {
8709
8711 }
8712
8713 if (m_OldLocation)
8714 {
8715 m_OldLocation.Reset();
8716 }
8717 }
8718
8720 {
8721 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8722 }
8723
8725 {
8726 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8727 }
8728 }
8729
8730 override void EOnContact(IEntity other, Contact extra)
8731 {
8733 {
8734 int liquidType = -1;
8736 if (impactSpeed > 0.0)
8737 {
8739 #ifndef SERVER
8741 #else
8743 SetSynchDirty();
8744 #endif
8746 }
8747 }
8748
8749 #ifdef SERVER
8750 if (GetCompEM() && GetCompEM().IsPlugged())
8751 {
8752 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8753 GetCompEM().UnplugThis();
8754 }
8755 #endif
8756 }
8757
8759
8761 {
8763 }
8764
8766 {
8767
8768 }
8769
8771 {
8772 super.OnItemLocationChanged(old_owner, new_owner);
8773
8774 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8775 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8776
8777 if (!relatedPlayer && playerNew)
8778 relatedPlayer = playerNew;
8779
8780 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8781 {
8783 if (actionMgr)
8784 {
8785 ActionBase currentAction = actionMgr.GetRunningAction();
8786 if (currentAction)
8788 }
8789 }
8790
8791 Man ownerPlayerOld = null;
8792 Man ownerPlayerNew = null;
8793
8794 if (old_owner)
8795 {
8796 if (old_owner.
IsMan())
8797 {
8798 ownerPlayerOld = Man.Cast(old_owner);
8799 }
8800 else
8801 {
8802 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8803 }
8804 }
8805 else
8806 {
8808 {
8810
8811 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8812 {
8813 GetCompEM().UnplugThis();
8814 }
8815 }
8816 }
8817
8818 if (new_owner)
8819 {
8820 if (new_owner.
IsMan())
8821 {
8822 ownerPlayerNew = Man.Cast(new_owner);
8823 }
8824 else
8825 {
8826 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8827 }
8828 }
8829
8830 if (ownerPlayerOld != ownerPlayerNew)
8831 {
8832 if (ownerPlayerOld)
8833 {
8834 array<EntityAI> subItemsExit = new array<EntityAI>;
8836 for (int i = 0; i < subItemsExit.Count(); i++)
8837 {
8840 }
8841 }
8842
8843 if (ownerPlayerNew)
8844 {
8845 array<EntityAI> subItemsEnter = new array<EntityAI>;
8847 for (int j = 0; j < subItemsEnter.Count(); j++)
8848 {
8851 }
8852 }
8853 }
8854 else if (ownerPlayerNew != null)
8855 {
8856 PlayerBase nplayer;
8857 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8858 {
8859 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8861 for (int k = 0; k < subItemsUpdate.Count(); k++)
8862 {
8864 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8865 }
8866 }
8867 }
8868
8869 if (old_owner)
8870 old_owner.OnChildItemRemoved(this);
8871 if (new_owner)
8872 new_owner.OnChildItemReceived(this);
8873 }
8874
8875
8877 {
8878 super.EEDelete(parent);
8879 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8880 if (player)
8881 {
8883
8884 if (player.IsAlive())
8885 {
8886 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8887 if (r_index >= 0)
8888 {
8889 InventoryLocation r_il = new InventoryLocation;
8890 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8891
8892 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8895 {
8896 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8897 }
8899 {
8900 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8901 }
8902
8903 }
8904
8905 player.RemoveQuickBarEntityShortcut(this);
8906 }
8907 }
8908 }
8909
8911 {
8912 super.EEKilled(killer);
8913
8916 {
8917 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8918 {
8919 if (IsMagazine())
8920 {
8921 if (Magazine.Cast(this).GetAmmoCount() > 0)
8922 {
8924 }
8925 }
8926 else
8927 {
8929 }
8930 }
8931 }
8932 }
8933
8935 {
8936 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8937
8938 super.OnWasAttached(parent, slot_id);
8939
8942
8945 }
8946
8948 {
8949 super.OnWasDetached(parent, slot_id);
8950
8953
8956 }
8957
8959 {
8960 int idx;
8963
8964 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8965 if (inventory_slots.Count() < 1)
8966 {
8967 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8968 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8969 }
8970 else
8971 {
8972 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8973 }
8974
8975 idx = inventory_slots.Find(slot);
8976 if (idx < 0)
8977 return "";
8978
8979 return attach_types.Get(idx);
8980 }
8981
8983 {
8984 int idx = -1;
8985 string slot;
8986
8989
8990 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8991 if (inventory_slots.Count() < 1)
8992 {
8993 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8994 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8995 }
8996 else
8997 {
8998 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8999 if (detach_types.Count() < 1)
9000 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9001 }
9002
9003 for (int i = 0; i < inventory_slots.Count(); i++)
9004 {
9005 slot = inventory_slots.Get(i);
9006 }
9007
9008 if (slot != "")
9009 {
9010 if (detach_types.Count() == 1)
9011 idx = 0;
9012 else
9013 idx = inventory_slots.Find(slot);
9014 }
9015 if (idx < 0)
9016 return "";
9017
9018 return detach_types.Get(idx);
9019 }
9020
9022 {
9023
9025
9026
9027 float min_time = 1;
9028 float max_time = 3;
9029 float delay = Math.RandomFloat(min_time, max_time);
9030
9031 explode_timer.Run(delay, this, "DoAmmoExplosion");
9032 }
9033
9035 {
9036 Magazine magazine = Magazine.Cast(this);
9037 int pop_sounds_count = 6;
9038 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9039
9040
9041 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9042 string sound_name = pop_sounds[ sound_idx ];
9043 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9044
9045
9046 magazine.ServerAddAmmoCount(-1);
9047
9048
9049 float min_temp_to_explode = 100;
9050
9051 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9052 {
9054 }
9055 }
9056
9057
9058 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9059 {
9060 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9061
9062 const int CHANCE_DAMAGE_CARGO = 4;
9063 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9064 const int CHANCE_DAMAGE_NOTHING = 2;
9065
9067 {
9068 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9069 int chances;
9070 int rnd;
9071
9072 if (GetInventory().GetCargo())
9073 {
9074 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9075 rnd = Math.RandomInt(0,chances);
9076
9077 if (rnd < CHANCE_DAMAGE_CARGO)
9078 {
9080 }
9081 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9082 {
9084 }
9085 }
9086 else
9087 {
9088 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9089 rnd = Math.RandomInt(0,chances);
9090
9091 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9092 {
9094 }
9095 }
9096 }
9097 }
9098
9100 {
9101 CargoBase cargo = GetInventory().GetCargo();
9102 if (cargo)
9103 {
9105 if (item_count > 0)
9106 {
9107 int random_pick = Math.RandomInt(0, item_count);
9109 if (!item.IsExplosive())
9110 {
9111 item.AddHealth("","",damage);
9112 return true;
9113 }
9114 }
9115 }
9116 return false;
9117 }
9118
9120 {
9121 GameInventory inventory = GetInventory();
9123 if (attachment_count > 0)
9124 {
9125 int random_pick = Math.RandomInt(0, attachment_count);
9127 if (!attachment.IsExplosive())
9128 {
9129 attachment.AddHealth("","",damage);
9130 return true;
9131 }
9132 }
9133 return false;
9134 }
9135
9137 {
9139 }
9140
9142 {
9144 return GetInventory().CanRemoveEntity();
9145
9146 return false;
9147 }
9148
9150 {
9151
9153 return false;
9154
9155
9157 return false;
9158
9159
9160
9162 if (delta == 0)
9163 return false;
9164
9165
9166 return true;
9167 }
9168
9170 {
9172 {
9173 if (ScriptInputUserData.CanStoreInputUserData())
9174 {
9175 ScriptInputUserData ctx = new ScriptInputUserData;
9180 ctx.
Write(destination_entity);
9184 }
9185 }
9186 else if (!
g_Game.IsMultiplayer())
9187 {
9189 }
9190 }
9191
9193 {
9194 float split_quantity_new;
9198 InventoryLocation loc = new InventoryLocation;
9199
9200 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9201 {
9203 split_quantity_new = stack_max;
9204 else
9206
9208 {
9209 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9210 if (new_item)
9211 {
9212 new_item.SetResultOfSplit(true);
9213 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9215 new_item.
SetQuantity(split_quantity_new,
false,
true);
9216 }
9217 }
9218 }
9219 else if (destination_entity && slot_id == -1)
9220 {
9221 if (quantity > stack_max)
9222 split_quantity_new = stack_max;
9223 else
9224 split_quantity_new = quantity;
9225
9227 {
9228 GameInventory destinationInventory = destination_entity.GetInventory();
9230 {
9233 }
9234
9235 if (new_item)
9236 {
9237 new_item.SetResultOfSplit(true);
9238 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9240 new_item.
SetQuantity(split_quantity_new,
false,
true);
9241 }
9242 }
9243 }
9244 else
9245 {
9246 if (stack_max != 0)
9247 {
9249 {
9251 }
9252
9253 if (split_quantity_new == 0)
9254 {
9255 if (!
g_Game.IsMultiplayer())
9256 player.PhysicalPredictiveDropItem(this);
9257 else
9258 player.ServerDropEntity(this);
9259 return;
9260 }
9261
9263 {
9265
9266 if (new_item)
9267 {
9268 new_item.SetResultOfSplit(true);
9269 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9272 new_item.PlaceOnSurface();
9273 }
9274 }
9275 }
9276 }
9277 }
9278
9280 {
9281 float split_quantity_new;
9285 InventoryLocation loc = new InventoryLocation;
9286
9287 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9288 {
9290 split_quantity_new = stack_max;
9291 else
9293
9295 {
9296 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9297 if (new_item)
9298 {
9299 new_item.SetResultOfSplit(true);
9300 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9302 new_item.
SetQuantity(split_quantity_new,
false,
true);
9303 }
9304 }
9305 }
9306 else if (destination_entity && slot_id == -1)
9307 {
9308 if (quantity > stack_max)
9309 split_quantity_new = stack_max;
9310 else
9311 split_quantity_new = quantity;
9312
9314 {
9315 GameInventory destinationInventory = destination_entity.GetInventory();
9317 {
9320 }
9321
9322 if (new_item)
9323 {
9324 new_item.SetResultOfSplit(true);
9325 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9327 new_item.
SetQuantity(split_quantity_new,
false,
true);
9328 }
9329 }
9330 }
9331 else
9332 {
9333 if (stack_max != 0)
9334 {
9336 {
9338 }
9339
9341 {
9343
9344 if (new_item)
9345 {
9346 new_item.SetResultOfSplit(true);
9347 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9350 new_item.PlaceOnSurface();
9351 }
9352 }
9353 }
9354 }
9355 }
9356
9358 {
9360 {
9361 if (ScriptInputUserData.CanStoreInputUserData())
9362 {
9363 ScriptInputUserData ctx = new ScriptInputUserData;
9368 dst.WriteToContext(ctx);
9370 }
9371 }
9372 else if (!
g_Game.IsMultiplayer())
9373 {
9375 }
9376 }
9377
9379 {
9381 {
9382 if (ScriptInputUserData.CanStoreInputUserData())
9383 {
9384 ScriptInputUserData ctx = new ScriptInputUserData;
9389 ctx.
Write(destination_entity);
9395 }
9396 }
9397 else if (!
g_Game.IsMultiplayer())
9398 {
9400 }
9401 }
9402
9404 {
9406 }
9407
9409 {
9411 float split_quantity_new;
9413 if (dst.IsValid())
9414 {
9415 int slot_id = dst.GetSlot();
9417
9418 if (quantity > stack_max)
9419 split_quantity_new = stack_max;
9420 else
9421 split_quantity_new = quantity;
9422
9424 {
9426
9427 if (new_item)
9428 {
9429 new_item.SetResultOfSplit(true);
9430 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9432 new_item.
SetQuantity(split_quantity_new,
false,
true);
9433 }
9434
9435 return new_item;
9436 }
9437 }
9438
9439 return null;
9440 }
9441
9443 {
9445 float split_quantity_new;
9447 if (destination_entity)
9448 {
9450 if (quantity > stackable)
9451 split_quantity_new = stackable;
9452 else
9453 split_quantity_new = quantity;
9454
9456 {
9457 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9458 if (new_item)
9459 {
9460 new_item.SetResultOfSplit(true);
9461 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9463 new_item.
SetQuantity(split_quantity_new,
false,
true);
9464 }
9465 }
9466 }
9467 }
9468
9470 {
9472 {
9473 if (ScriptInputUserData.CanStoreInputUserData())
9474 {
9475 ScriptInputUserData ctx = new ScriptInputUserData;
9480 ItemBase destination_entity =
this;
9481 ctx.
Write(destination_entity);
9485 }
9486 }
9487 else if (!
g_Game.IsMultiplayer())
9488 {
9490 }
9491 }
9492
9494 {
9496 float split_quantity_new;
9498 if (player)
9499 {
9501 if (quantity > stackable)
9502 split_quantity_new = stackable;
9503 else
9504 split_quantity_new = quantity;
9505
9507 {
9508 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9509 new_item =
ItemBase.Cast(in_hands);
9510 if (new_item)
9511 {
9512 new_item.SetResultOfSplit(true);
9513 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9515 new_item.SetQuantity(split_quantity_new, false, true);
9516 }
9517 }
9518 }
9519 }
9520
9522 {
9524 float split_quantity_new = Math.Floor(quantity * 0.5);
9525
9527 return;
9528
9530
9531 if (new_item)
9532 {
9533 if (new_item.GetQuantityMax() < split_quantity_new)
9534 {
9535 split_quantity_new = new_item.GetQuantityMax();
9536 }
9537
9538 new_item.SetResultOfSplit(true);
9539 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9540
9542 {
9545 }
9546 else
9547 {
9549 new_item.
SetQuantity(split_quantity_new,
false,
true);
9550 }
9551 }
9552 }
9553
9555 {
9557 float split_quantity_new = Math.Floor(quantity / 2);
9558
9560 return;
9561
9562 InventoryLocation invloc = new InventoryLocation;
9564
9566 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9567
9568 if (new_item)
9569 {
9570 if (new_item.GetQuantityMax() < split_quantity_new)
9571 {
9572 split_quantity_new = new_item.GetQuantityMax();
9573 }
9575 {
9578 }
9579 else if (split_quantity_new > 1)
9580 {
9582 new_item.
SetQuantity(split_quantity_new,
false,
true);
9583 }
9584 }
9585 }
9586
9589 {
9590 SetWeightDirty();
9592
9593 if (parent)
9594 parent.OnAttachmentQuantityChangedEx(this, delta);
9595
9597 {
9599 {
9601 }
9603 {
9604 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9606 }
9607 }
9608 }
9609
9612 {
9613
9614 }
9615
9618 {
9620 }
9621
9623 {
9624 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9625
9627 {
9628 if (newLevel == GameConstants.STATE_RUINED)
9629 {
9631 EntityAI parent = GetHierarchyParent();
9632 if (parent && parent.IsFireplace())
9633 {
9634 CargoBase cargo = GetInventory().GetCargo();
9635 if (cargo)
9636 {
9638 {
9640 }
9641 }
9642 }
9643 }
9644
9646 {
9647
9649 return;
9650 }
9651
9652 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9653 {
9655 }
9656 }
9657 }
9658
9659
9661 {
9662 super.OnRightClick();
9663
9665 {
9667 {
9668 if (ScriptInputUserData.CanStoreInputUserData())
9669 {
9670 EntityAI root = GetHierarchyRoot();
9671 Man playerOwner = GetHierarchyRootPlayer();
9672 InventoryLocation dst = new InventoryLocation;
9673
9674
9675 if (!playerOwner && root && root == this)
9676 {
9678 }
9679 else
9680 {
9681
9682 GetInventory().GetCurrentInventoryLocation(dst);
9684 {
9685 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9687 {
9689 }
9690 else
9691 {
9693
9694
9695 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9696 {
9698 }
9699 else
9700 {
9701 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9702 }
9703 }
9704 }
9705 }
9706
9707 ScriptInputUserData ctx = new ScriptInputUserData;
9715 }
9716 }
9717 else if (!
g_Game.IsMultiplayer())
9718 {
9720 }
9721 }
9722 }
9723
9725 {
9726 if (root)
9727 {
9728 vector m4[4];
9729 root.GetTransform(m4);
9730 dst.SetGround(this, m4);
9731 }
9732 else
9733 {
9734 GetInventory().GetCurrentInventoryLocation(dst);
9735 }
9736 }
9737
9738 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9739 {
9740
9741 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9742 return false;
9743
9744 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9745 return false;
9746
9747
9749 return false;
9750
9751
9752 Magazine mag = Magazine.Cast(this);
9753 if (mag)
9754 {
9755 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9756 return false;
9757
9758 if (stack_max_limit)
9759 {
9760 Magazine other_mag = Magazine.Cast(other_item);
9761 if (other_item)
9762 {
9763 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9764 return false;
9765 }
9766
9767 }
9768 }
9769 else
9770 {
9771
9773 return false;
9774
9776 return false;
9777 }
9778
9779 PlayerBase player = null;
9780 if (CastTo(player, GetHierarchyRootPlayer()))
9781 {
9782 if (player.GetInventory().HasAttachment(this))
9783 return false;
9784
9785 if (player.IsItemsToDelete())
9786 return false;
9787 }
9788
9789 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9790 return false;
9791
9792 int slotID;
9794 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9795 return false;
9796
9797 return true;
9798 }
9799
9801 {
9803 }
9804
9806 {
9807 return m_IsResultOfSplit;
9808 }
9809
9811 {
9812 m_IsResultOfSplit = value;
9813 }
9814
9816 {
9818 }
9819
9821 {
9822 float other_item_quantity = other_item.GetQuantity();
9823 float this_free_space;
9824
9826
9828
9829 if (other_item_quantity > this_free_space)
9830 {
9831 return this_free_space;
9832 }
9833 else
9834 {
9835 return other_item_quantity;
9836 }
9837 }
9838
9840 {
9842 }
9843
9845 {
9847 return;
9848
9849 if (!IsMagazine() && other_item)
9850 {
9852 if (quantity_used != 0)
9853 {
9854 float hp1 = GetHealth01("","");
9855 float hp2 = other_item.GetHealth01("","");
9856 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9857 hpResult = hpResult / (
GetQuantity() + quantity_used);
9858
9859 hpResult *= GetMaxHealth();
9860 Math.Round(hpResult);
9861 SetHealth("", "Health", hpResult);
9862
9864 other_item.AddQuantity(-quantity_used);
9865 }
9866 }
9868 }
9869
9871 {
9872 #ifdef SERVER
9873 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9874 GetHierarchyParent().IncreaseLifetimeUp();
9875 #endif
9876 };
9877
9879 {
9880 PlayerBase p = PlayerBase.Cast(player);
9881
9882 array<int> recipesIds = p.m_Recipes;
9883 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9884 if (moduleRecipesManager)
9885 {
9886 EntityAI itemInHands = player.GetEntityInHands();
9887 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9888 }
9889
9890 for (int i = 0;i < recipesIds.Count(); i++)
9891 {
9892 int key = recipesIds.Get(i);
9893 string recipeName = moduleRecipesManager.GetRecipeName(key);
9895 }
9896 }
9897
9898
9899 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9900 {
9901 super.GetDebugActions(outputList);
9902
9903
9909
9910
9915
9920
9921
9925
9926
9928 {
9932 }
9933
9936
9937
9941
9943
9944 InventoryLocation loc = new InventoryLocation();
9945 GetInventory().GetCurrentInventoryLocation(loc);
9947 {
9948 if (Gizmo_IsSupported())
9951 }
9952
9954 }
9955
9956
9957
9958
9960 {
9961 super.OnAction(action_id, player, ctx);
9962
9964 {
9965 switch (action_id)
9966 {
9970 return true;
9974 return true;
9975 }
9976 }
9977
9979 {
9980 switch (action_id)
9981 {
9983 Delete();
9984 return true;
9985 }
9986 }
9987
9988 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9989 {
9990 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9991 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9992 PlayerBase p = PlayerBase.Cast(player);
9993 if (
EActions.RECIPES_RANGE_START < 1000)
9994 {
9995 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9996 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9997 }
9998 }
9999 #ifndef SERVER
10000 else if (action_id ==
EActions.WATCH_PLAYER)
10001 {
10002 PluginDeveloper.SetDeveloperItemClientEx(player);
10003 }
10004 #endif
10006 {
10007 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10008 {
10009 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10010 OnDebugButtonPressServer(id + 1);
10011 }
10012
10013 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10014 {
10015 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10017 }
10018
10019 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10020 {
10021 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10023 }
10024
10025 else if (action_id ==
EActions.ADD_QUANTITY)
10026 {
10027 if (IsMagazine())
10028 {
10029 Magazine mag = Magazine.Cast(this);
10030 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10031 }
10032 else
10033 {
10035 }
10036
10037 if (m_EM)
10038 {
10039 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10040 }
10041
10042 }
10043
10044 else if (action_id ==
EActions.REMOVE_QUANTITY)
10045 {
10046 if (IsMagazine())
10047 {
10048 Magazine mag2 = Magazine.Cast(this);
10049 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10050 }
10051 else
10052 {
10054 }
10055 if (m_EM)
10056 {
10057 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10058 }
10059
10060 }
10061
10062 else if (action_id ==
EActions.SET_QUANTITY_0)
10063 {
10065
10066 if (m_EM)
10067 {
10068 m_EM.SetEnergy(0);
10069 }
10070 }
10071
10072 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10073 {
10075
10076 if (m_EM)
10077 {
10078 m_EM.SetEnergy(m_EM.GetEnergyMax());
10079 }
10080 }
10081
10082 else if (action_id ==
EActions.ADD_HEALTH)
10083 {
10084 AddHealth("","",GetMaxHealth("","Health")/5);
10085 }
10086 else if (action_id ==
EActions.REMOVE_HEALTH)
10087 {
10088 AddHealth("","",-GetMaxHealth("","Health")/5);
10089 }
10090 else if (action_id ==
EActions.DESTROY_HEALTH)
10091 {
10092 SetHealth01("","",0);
10093 }
10094 else if (action_id ==
EActions.WATCH_ITEM)
10095 {
10097 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10098 #ifdef DEVELOPER
10099 SetDebugDeveloper_item(this);
10100 #endif
10101 }
10102
10103 else if (action_id ==
EActions.ADD_TEMPERATURE)
10104 {
10105 AddTemperature(20);
10106
10107 }
10108
10109 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10110 {
10111 AddTemperature(-20);
10112
10113 }
10114
10115 else if (action_id ==
EActions.FLIP_FROZEN)
10116 {
10117 SetFrozen(!GetIsFrozen());
10118
10119 }
10120
10121 else if (action_id ==
EActions.ADD_WETNESS)
10122 {
10124
10125 }
10126
10127 else if (action_id ==
EActions.REMOVE_WETNESS)
10128 {
10130
10131 }
10132
10133 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10134 {
10137
10138
10139 }
10140
10141 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10142 {
10145 }
10146
10147 else if (action_id ==
EActions.MAKE_SPECIAL)
10148 {
10149 auto debugParams = DebugSpawnParams.WithPlayer(player);
10150 OnDebugSpawnEx(debugParams);
10151 }
10152
10153 }
10154
10155
10156 return false;
10157 }
10158
10159
10160
10161
10165
10168
10169
10170
10172 {
10173 return false;
10174 }
10175
10176
10178 {
10179 return true;
10180 }
10181
10182
10184 {
10185 return true;
10186 }
10187
10188
10189
10191 {
10192 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10193 return g_Game.ConfigIsExisting(config_path);
10194 }
10195
10198 {
10199 return null;
10200 }
10201
10203 {
10204 return false;
10205 }
10206
10208 {
10209 return false;
10210 }
10211
10215
10216
10218 {
10219 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10220 return module_repairing.CanRepair(this, item_repair_kit);
10221 }
10222
10223
10224 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10225 {
10226 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10227 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10228 }
10229
10230
10232 {
10233
10234
10235
10236
10237
10238
10239
10240
10241 return 1;
10242 }
10243
10244
10245
10247 {
10249 }
10250
10251
10252
10254 {
10256 }
10257
10258
10267 {
10268 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10269
10270 if (player)
10271 {
10272 player.MessageStatus(text);
10273 }
10274 }
10275
10276
10285 {
10286 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10287
10288 if (player)
10289 {
10290 player.MessageAction(text);
10291 }
10292 }
10293
10294
10303 {
10304 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10305
10306 if (player)
10307 {
10308 player.MessageFriendly(text);
10309 }
10310 }
10311
10312
10321 {
10322 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10323
10324 if (player)
10325 {
10326 player.MessageImportant(text);
10327 }
10328 }
10329
10331 {
10332 return true;
10333 }
10334
10335
10336 override bool KindOf(
string tag)
10337 {
10338 bool found = false;
10339 string item_name = this.
GetType();
10341 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10342
10343 int array_size = item_tag_array.Count();
10344 for (int i = 0; i < array_size; i++)
10345 {
10346 if (item_tag_array.Get(i) == tag)
10347 {
10348 found = true;
10349 break;
10350 }
10351 }
10352 return found;
10353 }
10354
10355
10357 {
10358
10359 super.OnRPC(sender, rpc_type,ctx);
10360
10361
10362 switch (rpc_type)
10363 {
10364 #ifndef SERVER
10365 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10366 Param2<bool, string> p = new Param2<bool, string>(false, "");
10367
10369 return;
10370
10371 bool play = p.param1;
10372 string soundSet = p.param2;
10373
10374 if (play)
10375 {
10377 {
10379 {
10381 }
10382 }
10383 else
10384 {
10386 }
10387 }
10388 else
10389 {
10391 }
10392
10393 break;
10394 #endif
10395
10396 }
10397
10399 {
10401 }
10402 }
10403
10404
10405
10406
10408 {
10409 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10410 return plugin.GetID(
name);
10411 }
10412
10414 {
10415 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10416 return plugin.GetName(id);
10417 }
10418
10421 {
10422
10423
10424 int varFlags;
10425 if (!ctx.
Read(varFlags))
10426 return;
10427
10428 if (varFlags & ItemVariableFlags.FLOAT)
10429 {
10431 }
10432 }
10433
10435 {
10436
10437 super.SerializeNumericalVars(floats_out);
10438
10439
10440
10442 {
10444 }
10445
10447 {
10449 }
10450
10452 {
10454 }
10455
10457 {
10462 }
10463
10465 {
10467 }
10468 }
10469
10471 {
10472
10473 super.DeSerializeNumericalVars(floats);
10474
10475
10476 int index = 0;
10477 int mask = Math.Round(floats.Get(index));
10478
10479 index++;
10480
10482 {
10484 {
10486 }
10487 else
10488 {
10489 float quantity = floats.Get(index);
10490 SetQuantity(quantity,
true,
false,
false,
false);
10491 }
10492 index++;
10493 }
10494
10496 {
10497 float wet = floats.Get(index);
10499 index++;
10500 }
10501
10503 {
10504 int liquidtype = Math.Round(floats.Get(index));
10506 index++;
10507 }
10508
10510 {
10512 index++;
10514 index++;
10516 index++;
10518 index++;
10519 }
10520
10522 {
10523 int cleanness = Math.Round(floats.Get(index));
10525 index++;
10526 }
10527 }
10528
10530 {
10531 super.WriteVarsToCTX(ctx);
10532
10533
10535 {
10537 }
10538
10540 {
10542 }
10543
10545 {
10547 }
10548
10550 {
10551 int r,g,b,a;
10557 }
10558
10560 {
10562 }
10563 }
10564
10566 {
10567 if (!super.ReadVarsFromCTX(ctx,version))
10568 return false;
10569
10570 int intValue;
10571 float value;
10572
10573 if (version < 140)
10574 {
10575 if (!ctx.
Read(intValue))
10576 return false;
10577
10578 m_VariablesMask = intValue;
10579 }
10580
10582 {
10583 if (!ctx.
Read(value))
10584 return false;
10585
10587 {
10589 }
10590 else
10591 {
10593 }
10594 }
10595
10596 if (version < 140)
10597 {
10599 {
10600 if (!ctx.
Read(value))
10601 return false;
10602 SetTemperatureDirect(value);
10603 }
10604 }
10605
10607 {
10608 if (!ctx.
Read(value))
10609 return false;
10611 }
10612
10614 {
10615 if (!ctx.
Read(intValue))
10616 return false;
10618 }
10619
10621 {
10622 int r,g,b,a;
10624 return false;
10626 return false;
10628 return false;
10630 return false;
10631
10633 }
10634
10636 {
10637 if (!ctx.
Read(intValue))
10638 return false;
10640 }
10641
10642 if (version >= 138 && version < 140)
10643 {
10645 {
10646 if (!ctx.
Read(intValue))
10647 return false;
10648 SetFrozen(intValue);
10649 }
10650 }
10651
10652 return true;
10653 }
10654
10655
10657 {
10660 {
10662 }
10663
10664 if (!super.OnStoreLoad(ctx, version))
10665 {
10667 return false;
10668 }
10669
10670 if (version >= 114)
10671 {
10672 bool hasQuickBarIndexSaved;
10673
10674 if (!ctx.
Read(hasQuickBarIndexSaved))
10675 {
10677 return false;
10678 }
10679
10680 if (hasQuickBarIndexSaved)
10681 {
10682 int itmQBIndex;
10683
10684
10685 if (!ctx.
Read(itmQBIndex))
10686 {
10688 return false;
10689 }
10690
10691 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10692 if (itmQBIndex != -1 && parentPlayer)
10693 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10694 }
10695 }
10696 else
10697 {
10698
10699 PlayerBase player;
10700 int itemQBIndex;
10701 if (version ==
int.
MAX)
10702 {
10703 if (!ctx.
Read(itemQBIndex))
10704 {
10706 return false;
10707 }
10708 }
10709 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10710 {
10711
10712 if (!ctx.
Read(itemQBIndex))
10713 {
10715 return false;
10716 }
10717 if (itemQBIndex != -1 && player)
10718 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10719 }
10720 }
10721
10722 if (version < 140)
10723 {
10724
10725 if (!LoadVariables(ctx, version))
10726 {
10728 return false;
10729 }
10730 }
10731
10732
10734 {
10736 return false;
10737 }
10738 if (version >= 132)
10739 {
10741 if (raib)
10742 {
10744 {
10746 return false;
10747 }
10748 }
10749 }
10750
10752 return true;
10753 }
10754
10755
10756
10758 {
10759 super.OnStoreSave(ctx);
10760
10761 PlayerBase player;
10762 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10763 {
10765
10766 int itemQBIndex = -1;
10767 itemQBIndex = player.FindQuickBarEntityIndex(this);
10768 ctx.
Write(itemQBIndex);
10769 }
10770 else
10771 {
10773 }
10774
10776
10778 if (raib)
10779 {
10781 }
10782 }
10783
10784
10786 {
10787 super.AfterStoreLoad();
10788
10790 {
10792 }
10793
10795 {
10798 }
10799 }
10800
10802 {
10803 super.EEOnAfterLoad();
10804
10806 {
10808 }
10809
10812 }
10813
10815 {
10816 return false;
10817 }
10818
10819
10820
10822 {
10824 {
10825 #ifdef PLATFORM_CONSOLE
10826
10828 {
10830 if (menu)
10831 {
10833 }
10834 }
10835 #endif
10836 }
10837
10839 {
10842 }
10843
10845 {
10846 SetWeightDirty();
10848 }
10850 {
10853 }
10854
10856 {
10859
10862 }
10864 {
10868 }
10869
10870 super.OnVariablesSynchronized();
10871 }
10872
10873
10874
10876 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10877 {
10878 if (!IsServerCheck(allow_client))
10879 return false;
10880
10882 return false;
10883
10886
10887 if (value <= (min + 0.001))
10888 value = min;
10889
10890 if (value == min)
10891 {
10892 if (destroy_config)
10893 {
10894 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10895 if (dstr)
10896 {
10898 this.Delete();
10899 return true;
10900 }
10901 }
10902 else if (destroy_forced)
10903 {
10905 this.Delete();
10906 return true;
10907 }
10908
10910 }
10911
10914
10916 {
10917 EntityAI parent = GetHierarchyRoot();
10918 InventoryLocation iLoc = new InventoryLocation();
10919 GetInventory().GetCurrentInventoryLocation(iLoc);
10921 {
10922 int iLocSlot = iLoc.
GetSlot();
10924 {
10926 }
10928 {
10930 }
10931 }
10932 }
10933
10935 {
10937
10938 if (delta)
10940 }
10941
10943
10944 return false;
10945 }
10946
10947
10949 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10950 {
10952 }
10953
10955 {
10958 }
10959
10961 {
10964 }
10965
10967 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10968 {
10969 float value_clamped = Math.Clamp(value, 0, 1);
10971 SetQuantity(result, destroy_config, destroy_forced);
10972 }
10973
10974
10977 {
10979 }
10980
10982 {
10984 }
10985
10986
10987
10988
10989
10990
10991
10992
10993
10994
10996 {
10997 int slot = -1;
10998 GameInventory inventory = GetInventory();
10999 if (inventory)
11000 {
11001 InventoryLocation il = new InventoryLocation;
11004 }
11005
11007 }
11008
11010 {
11011 float quantity_max = 0;
11012
11014 {
11015 if (attSlotID != -1)
11016 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11017
11018 if (quantity_max <= 0)
11020 }
11021
11022 if (quantity_max <= 0)
11024
11025 return quantity_max;
11026 }
11027
11029 {
11031 }
11032
11034 {
11036 }
11037
11038
11040 {
11042 }
11043
11045 {
11047 }
11048
11050 {
11052 }
11053
11054
11056 {
11057
11058 float weightEx = GetWeightEx();
11059 float special = GetInventoryAndCargoWeight();
11060 return weightEx - special;
11061 }
11062
11063
11065 {
11067 }
11068
11070 {
11072 {
11073 #ifdef DEVELOPER
11074 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11075 {
11076 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11078 }
11079 #endif
11080
11081 return GetQuantity() * GetConfigWeightModified();
11082 }
11083 else if (HasEnergyManager())
11084 {
11085 #ifdef DEVELOPER
11086 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11087 {
11088 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11089 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11090 }
11091 #endif
11092 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11093 }
11094 else
11095 {
11096 #ifdef DEVELOPER
11097 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11098 {
11099 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11100 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11101 }
11102 #endif
11103 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11104 }
11105 }
11106
11109 {
11110 int item_count = 0;
11112
11113 GameInventory inventory = GetInventory();
11114 CargoBase cargo = inventory.
GetCargo();
11115 if (cargo != NULL)
11116 {
11118 }
11119
11121 for (int i = 0; i < nAttachments; ++i)
11122 {
11124 if (item)
11125 item_count += item.GetNumberOfItems();
11126 }
11127 return item_count;
11128 }
11129
11132 {
11133 float weight = 0;
11134 float wetness = 1;
11135 if (include_wetness)
11138 {
11139 weight = wetness * m_ConfigWeight;
11140 }
11142 {
11143 weight = 1;
11144 }
11145 return weight;
11146 }
11147
11148
11149
11151 {
11152 GameInventory inventory = GetInventory();
11153 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11154 {
11155 array<EntityAI> items = new array<EntityAI>;
11157 for (int i = 0; i < items.Count(); ++i)
11158 {
11160 if (item)
11161 {
11162 g_Game.ObjectDelete(item);
11163 }
11164 }
11165 }
11166 }
11167
11168
11169
11170
11172 {
11173 float energy = 0;
11174 if (HasEnergyManager())
11175 {
11176 energy = GetCompEM().GetEnergy();
11177 }
11178 return energy;
11179 }
11180
11181
11183 {
11184 super.OnEnergyConsumed();
11185
11187 }
11188
11190 {
11191 super.OnEnergyAdded();
11192
11194 }
11195
11196
11198 {
11199 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11200 {
11202 {
11203 float energy_0to1 = GetCompEM().GetEnergy0To1();
11205 }
11206 }
11207 }
11208
11209
11211 {
11212 return ConfigGetFloat("heatIsolation");
11213 }
11214
11216 {
11218 }
11219
11221 {
11222 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11223 if (
g_Game.ConfigIsExisting(paramPath))
11224 return g_Game.ConfigGetFloat(paramPath);
11225
11226 return 0.0;
11227 }
11228
11230 {
11231 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11232 if (
g_Game.ConfigIsExisting(paramPath))
11233 return g_Game.ConfigGetFloat(paramPath);
11234
11235 return 0.0;
11236 }
11237
11238 override void SetWet(
float value,
bool allow_client =
false)
11239 {
11240 if (!IsServerCheck(allow_client))
11241 return;
11242
11245
11247
11248 m_VarWet = Math.Clamp(value, min, max);
11249
11251 {
11254 }
11255 }
11256
11257 override void AddWet(
float value)
11258 {
11260 }
11261
11263 {
11265 }
11266
11268 {
11270 }
11271
11273 {
11275 }
11276
11278 {
11280 }
11281
11283 {
11285 }
11286
11287 override void OnWetChanged(
float newVal,
float oldVal)
11288 {
11291 if (newLevel != oldLevel)
11292 {
11294 }
11295 }
11296
11298 {
11299 SetWeightDirty();
11300 }
11301
11303 {
11304 return GetWetLevelInternal(
m_VarWet);
11305 }
11306
11307
11308
11310 {
11312 }
11313
11315 {
11317 }
11318
11320 {
11322 }
11323
11325 {
11327 }
11328
11329
11330
11332 {
11333 if (ConfigIsExisting("itemModelLength"))
11334 {
11335 return ConfigGetFloat("itemModelLength");
11336 }
11337 return 0;
11338 }
11339
11341 {
11342 if (ConfigIsExisting("itemAttachOffset"))
11343 {
11344 return ConfigGetFloat("itemAttachOffset");
11345 }
11346 return 0;
11347 }
11348
11349 override void SetCleanness(
int value,
bool allow_client =
false)
11350 {
11351 if (!IsServerCheck(allow_client))
11352 return;
11353
11355
11357
11360 }
11361
11363 {
11365 }
11366
11368 {
11369 return true;
11370 }
11371
11372
11373
11374
11376 {
11378 }
11379
11381 {
11383 }
11384
11385
11386
11387
11388 override void SetColor(
int r,
int g,
int b,
int a)
11389 {
11395 }
11397 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11398 {
11403 }
11404
11406 {
11408 }
11409
11412 {
11413 int r,g,b,a;
11415 r = r/255;
11416 g = g/255;
11417 b = b/255;
11418 a = a/255;
11419 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11420 }
11421
11422
11423
11424 override void SetLiquidType(
int value,
bool allow_client =
false)
11425 {
11426 if (!IsServerCheck(allow_client))
11427 return;
11428
11433 }
11434
11436 {
11437 return ConfigGetInt("varLiquidTypeInit");
11438 }
11439
11441 {
11443 }
11444
11446 {
11448 SetFrozen(false);
11449 }
11450
11453 {
11454 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11455 }
11456
11457
11460 {
11461 PlayerBase nplayer;
11462 if (PlayerBase.CastTo(nplayer, player))
11463 {
11465 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11466 }
11467 }
11468
11469
11472 {
11473 PlayerBase nplayer;
11474 if (PlayerBase.CastTo(nplayer,player))
11475 {
11476 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11477 }
11478
11479 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11480
11481 if (HasEnergyManager())
11482 {
11483 GetCompEM().UpdatePlugState();
11484 }
11485 }
11486
11487
11489 {
11490 super.OnPlacementStarted(player);
11491
11493 }
11494
11495 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11496 {
11498 {
11499 m_AdminLog.OnPlacementComplete(player,
this);
11500 }
11501
11502 super.OnPlacementComplete(player, position, orientation);
11503 }
11504
11505
11506
11507
11508
11510 {
11512 {
11513 return true;
11514 }
11515 else
11516 {
11517 return false;
11518 }
11519 }
11520
11521
11523 {
11525 {
11527 }
11528 }
11529
11530
11532 {
11534 }
11535
11537 {
11539 }
11540
11541 override void InsertAgent(
int agent,
float count = 1)
11542 {
11543 if (count < 1)
11544 return;
11545
11547 }
11548
11551 {
11553 }
11554
11555
11557 {
11559 }
11560
11561
11562
11563
11564
11565
11566
11567
11568
11569
11570
11571
11572
11573
11574
11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585
11586
11587
11588
11589
11590
11591
11592
11593
11594
11595
11596
11597
11598
11599
11600
11601
11603 {
11605 return false;
11606 return true;
11607 }
11608
11610 {
11611
11613 }
11614
11615
11618 {
11619 super.CheckForRoofLimited(timeTresholdMS);
11620
11621 float time =
g_Game.GetTime();
11622 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11623 {
11624 m_PreviousRoofTestTime = time;
11625 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11626 }
11627 }
11628
11629
11631 {
11633 {
11634 return 0;
11635 }
11636
11637 if (GetInventory().GetAttachmentSlotsCount() != 0)
11638 {
11639 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11640 if (filter)
11641 return filter.GetProtectionLevel(type, false, system);
11642 else
11643 return 0;
11644 }
11645
11646 string subclassPath, entryName;
11647
11648 switch (type)
11649 {
11651 entryName = "biological";
11652 break;
11654 entryName = "chemical";
11655 break;
11656 default:
11657 entryName = "biological";
11658 break;
11659 }
11660
11661 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11662
11663 return g_Game.ConfigGetFloat(subclassPath + entryName);
11664 }
11665
11666
11667
11670 {
11671 if (!IsMagazine())
11673
11675 }
11676
11677
11678
11679
11680
11685 {
11686 return true;
11687 }
11688
11690 {
11692 }
11693
11694
11695
11696
11697
11699 {
11700 if (parent)
11701 {
11702 if (parent.IsInherited(DayZInfected))
11703 return true;
11704
11705 if (!parent.IsRuined())
11706 return true;
11707 }
11708
11709 return true;
11710 }
11711
11713 {
11714 if (!super.CanPutAsAttachment(parent))
11715 {
11716 return false;
11717 }
11718
11719 if (!IsRuined() && !parent.IsRuined())
11720 {
11721 return true;
11722 }
11723
11724 return false;
11725 }
11726
11728 {
11729
11730
11731
11732
11733 return super.CanReceiveItemIntoCargo(item);
11734 }
11735
11737 {
11738
11739
11740
11741
11742 GameInventory attachmentInv = attachment.GetInventory();
11744 {
11745 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11746 return false;
11747 }
11748
11749 InventoryLocation loc = new InventoryLocation();
11750 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11751 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11752 return false;
11753
11754 return super.CanReceiveAttachment(attachment, slotId);
11755 }
11756
11758 {
11759 if (!super.CanReleaseAttachment(attachment))
11760 return false;
11761
11762 return GetInventory().AreChildrenAccessible();
11763 }
11764
11765
11766
11767
11768
11769
11770
11771
11772
11773
11774
11775
11776
11777
11778
11779
11780
11781
11782
11783
11784
11786 {
11787 int id = muzzle_owner.GetMuzzleID();
11788 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11789
11790 if (WPOF_array)
11791 {
11792 for (int i = 0; i < WPOF_array.Count(); i++)
11793 {
11794 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11795
11796 if (WPOF)
11797 {
11798 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11799 }
11800 }
11801 }
11802 }
11803
11804
11806 {
11807 int id = muzzle_owner.GetMuzzleID();
11809
11810 if (WPOBE_array)
11811 {
11812 for (int i = 0; i < WPOBE_array.Count(); i++)
11813 {
11814 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11815
11816 if (WPOBE)
11817 {
11818 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11819 }
11820 }
11821 }
11822 }
11823
11824
11826 {
11827 int id = muzzle_owner.GetMuzzleID();
11828 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11829
11830 if (WPOOH_array)
11831 {
11832 for (int i = 0; i < WPOOH_array.Count(); i++)
11833 {
11834 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11835
11836 if (WPOOH)
11837 {
11838 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11839 }
11840 }
11841 }
11842 }
11843
11844
11846 {
11847 int id = muzzle_owner.GetMuzzleID();
11848 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11849
11850 if (WPOOH_array)
11851 {
11852 for (int i = 0; i < WPOOH_array.Count(); i++)
11853 {
11854 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11855
11856 if (WPOOH)
11857 {
11858 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11859 }
11860 }
11861 }
11862 }
11863
11864
11866 {
11867 int id = muzzle_owner.GetMuzzleID();
11868 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11869
11870 if (WPOOH_array)
11871 {
11872 for (int i = 0; i < WPOOH_array.Count(); i++)
11873 {
11874 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11875
11876 if (WPOOH)
11877 {
11878 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11879 }
11880 }
11881 }
11882 }
11883
11884
11885
11887 {
11889 {
11890 return true;
11891 }
11892
11893 return false;
11894 }
11895
11897 {
11899 {
11900 return true;
11901 }
11902
11903 return false;
11904 }
11905
11907 {
11909 {
11910 return true;
11911 }
11912
11913 return false;
11914 }
11915
11917 {
11918 return false;
11919 }
11920
11923 {
11924 return UATimeSpent.DEFAULT_DEPLOY;
11925 }
11926
11927
11928
11929
11931 {
11933 SetSynchDirty();
11934 }
11935
11937 {
11939 }
11940
11941
11943 {
11944 return false;
11945 }
11946
11949 {
11950 string att_type = "None";
11951
11952 if (ConfigIsExisting("soundAttType"))
11953 {
11954 att_type = ConfigGetString("soundAttType");
11955 }
11956
11958 }
11959
11961 {
11963 }
11964
11965
11966
11967
11968
11974
11976 {
11979
11981 }
11982
11983
11985 {
11987 return;
11988
11990
11993
11996
11997 SoundParameters params = new SoundParameters();
12001 }
12002
12003
12005 {
12007 {
12010
12011 SetSynchDirty();
12012
12015 }
12016 }
12017
12019 {
12021 }
12022
12023
12025 {
12027 return;
12028
12030 SetSynchDirty();
12031
12034 }
12035
12037 {
12040 }
12041
12043 {
12045 }
12046
12047 void OnApply(PlayerBase player);
12048
12050 {
12051 return 1.0;
12052 };
12053
12055 {
12057 }
12058
12060 {
12062 }
12063
12065
12067 {
12068 SetDynamicPhysicsLifeTime(0.01);
12070 }
12071
12073 {
12074 array<string> zone_names = new array<string>;
12075 GetDamageZones(zone_names);
12076 for (int i = 0; i < zone_names.Count(); i++)
12077 {
12078 SetHealthMax(zone_names.Get(i),"Health");
12079 }
12080 SetHealthMax("","Health");
12081 }
12082
12085 {
12086 float global_health = GetHealth01("","Health");
12087 array<string> zones = new array<string>;
12088 GetDamageZones(zones);
12089
12090 for (int i = 0; i < zones.Count(); i++)
12091 {
12092 SetHealth01(zones.Get(i),"Health",global_health);
12093 }
12094 }
12095
12098 {
12099 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12100 }
12101
12103 {
12104 if (!hasRootAsPlayer)
12105 {
12106 if (refParentIB)
12107 {
12108
12109 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12110 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12111
12112 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12113 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12114
12117 }
12118 else
12119 {
12120
12123 }
12124 }
12125 }
12126
12128 {
12130 {
12131 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12132 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12133 {
12134 float heatPermCoef = 1.0;
12136 while (ent)
12137 {
12138 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12139 ent = ent.GetHierarchyParent();
12140 }
12141
12142 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12143 }
12144 }
12145 }
12146
12148 {
12149
12150 EntityAI parent = GetHierarchyParent();
12151 if (!parent)
12152 {
12153 hasParent = false;
12154 hasRootAsPlayer = false;
12155 }
12156 else
12157 {
12158 hasParent = true;
12159 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12160 refParentIB =
ItemBase.Cast(parent);
12161 }
12162 }
12163
12164 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12165 {
12166
12167 }
12168
12170 {
12171
12172 return false;
12173 }
12174
12176 {
12177
12178
12179 return false;
12180 }
12181
12183 {
12184
12185 return false;
12186 }
12187
12190 {
12191 return !GetIsFrozen() &&
IsOpen();
12192 }
12193
12195 {
12196 bool hasParent = false, hasRootAsPlayer = false;
12198
12199 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12200 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12201
12202 if (wwtu || foodDecay)
12203 {
12207
12208 if (processWetness || processTemperature || processDecay)
12209 {
12211
12212 if (processWetness)
12213 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12214
12215 if (processTemperature)
12217
12218 if (processDecay)
12219 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12220 }
12221 }
12222 }
12223
12226 {
12228 }
12229
12231 {
12234
12235 return super.GetTemperatureFreezeThreshold();
12236 }
12237
12239 {
12242
12243 return super.GetTemperatureThawThreshold();
12244 }
12245
12247 {
12250
12251 return super.GetItemOverheatThreshold();
12252 }
12253
12255 {
12257 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12258
12259 return super.GetTemperatureFreezeTime();
12260 }
12261
12263 {
12265 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12266
12267 return super.GetTemperatureThawTime();
12268 }
12269
12274
12276 {
12277 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12278 }
12279
12281 {
12282 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12283 }
12284
12287 {
12289 }
12290
12292 {
12294 }
12295
12297 {
12299 }
12300
12303 {
12304 return null;
12305 }
12306
12309 {
12310 return false;
12311 }
12312
12314 {
12316 {
12319 if (!trg)
12320 {
12322 explosive = this;
12323 }
12324
12325 explosive.PairRemote(trg);
12327
12328 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12329 trg.SetPersistentPairID(persistentID);
12330 explosive.SetPersistentPairID(persistentID);
12331
12332 return true;
12333 }
12334 return false;
12335 }
12336
12339 {
12340 float ret = 1.0;
12343 ret *= GetHealth01();
12344
12345 return ret;
12346 }
12347
12348 #ifdef DEVELOPER
12349 override void SetDebugItem()
12350 {
12351 super.SetDebugItem();
12352 _itemBase = this;
12353 }
12354
12356 {
12357 string text = super.GetDebugText();
12358
12360 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12361
12362 return text;
12363 }
12364 #endif
12365
12367 {
12368 return true;
12369 }
12370
12372
12374
12376 {
12379 }
12380
12381
12389
12405
12406 [
Obsolete(
"Use ItemSoundHandler instead")]
12409 {
12410 if (!
g_Game.IsDedicatedServer())
12411 {
12412 if (ConfigIsExisting("attachSoundSet"))
12413 {
12414 string cfg_path = "";
12415 string soundset = "";
12416 string type_name =
GetType();
12417
12420 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12421 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12422
12423 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12424 {
12425 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12426 {
12427 if (cfg_slot_array[i] == slot_type)
12428 {
12429 soundset = cfg_soundset_array[i];
12430 break;
12431 }
12432 }
12433 }
12434
12435 if (soundset != "")
12436 {
12437 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12439 }
12440 }
12441 }
12442 }
12443
12445}
12446
12448{
12450 if (entity)
12451 {
12452 bool is_item = entity.IsInherited(
ItemBase);
12453 if (is_item && full_quantity)
12454 {
12457 }
12458 }
12459 else
12460 {
12462 return NULL;
12463 }
12464 return entity;
12465}
12466
12468{
12469 if (item)
12470 {
12471 if (health > 0)
12472 item.SetHealth("", "", health);
12473
12474 if (item.CanHaveTemperature())
12475 {
12477 if (item.CanFreeze())
12478 item.SetFrozen(false);
12479 }
12480
12481 if (item.HasEnergyManager())
12482 {
12483 if (quantity >= 0)
12484 {
12485 item.GetCompEM().SetEnergy0To1(quantity);
12486 }
12487 else
12488 {
12490 }
12491 }
12492 else if (item.IsMagazine())
12493 {
12494 Magazine mag = Magazine.Cast(item);
12495 if (quantity >= 0)
12496 {
12497 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12498 }
12499 else
12500 {
12502 }
12503
12504 }
12505 else
12506 {
12507 if (quantity >= 0)
12508 {
12509 item.SetQuantityNormalized(quantity, false);
12510 }
12511 else
12512 {
12514 }
12515
12516 }
12517 }
12518}
12519
12520#ifdef DEVELOPER
12522#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.