6478{
6480 {
6481 return true;
6482 }
6483};
6484
6486{
6487
6488};
6489
6490
6491
6493{
6497
6499
6502
6503
6504
6505
6506
6515
6521
6526
6531
6552 protected bool m_IsResultOfSplit
6553
6555
6560
6561
6562
6564
6568
6569
6570
6572
6575
6576
6577
6583
6584
6592
6595
6596
6598
6599
6601
6602
6607
6608
6613
6615
6616
6618
6619
6621 {
6626
6627 if (!
g_Game.IsDedicatedServer())
6628 {
6630 {
6632
6634 {
6636 }
6637 }
6638
6641 }
6642
6643 m_OldLocation = null;
6644
6646 {
6648 }
6649
6650 if (ConfigIsExisting("headSelectionsToHide"))
6651 {
6654 }
6655
6657 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6658 {
6660 }
6661
6663
6664 m_IsResultOfSplit = false;
6665
6667 }
6668
6670 {
6671 super.InitItemVariables();
6672
6678 m_Count = ConfigGetInt(
"count");
6679
6682
6687
6690
6695
6707
6711
6712
6715 if (ConfigIsExisting("canBeSplit"))
6716 {
6719 }
6720
6722 if (ConfigIsExisting("itemBehaviour"))
6724
6725
6728 RegisterNetSyncVariableInt("m_VarLiquidType");
6729 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6730
6731 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6732 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6733 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6734
6735 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6736 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6737 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6738 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6739
6740 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6741 RegisterNetSyncVariableBool("m_IsTakeable");
6742 RegisterNetSyncVariableBool("m_IsHologram");
6743
6746 {
6749 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6750 }
6751
6753
6755 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6757
6759 }
6760
6762 {
6764 }
6765
6767 {
6770 {
6775 }
6776 }
6777
6778 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6779 {
6781 {
6784 }
6785
6787 }
6788
6790 {
6796 }
6797
6799
6801 {
6803
6804 if (!action)
6805 {
6806 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6807 return;
6808 }
6809
6811 if (!ai)
6812 {
6814 return;
6815 }
6816
6818 if (!action_array)
6819 {
6820 action_array = new array<ActionBase_Basic>;
6822 }
6823 if (LogManager.IsActionLogEnable())
6824 {
6825 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6826 }
6827
6828 if (action_array.Find(action) != -1)
6829 {
6830 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6831 }
6832 else
6833 {
6834 action_array.Insert(action);
6835 }
6836 }
6837
6839 {
6840 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6841 ActionBase action = player.GetActionManager().GetAction(actionName);
6844
6845 if (action_array)
6846 {
6847 action_array.RemoveItem(action);
6848 }
6849 }
6850
6851
6852
6854 {
6855 ActionOverrideData overrideData = new ActionOverrideData();
6859
6861 if (!actionMap)
6862 {
6865 }
6866
6867 actionMap.Insert(this.
Type(), overrideData);
6868
6869 }
6870
6872
6874
6875
6877 {
6880
6883
6884 string config_to_search = "CfgVehicles";
6885 string muzzle_owner_config;
6886
6888 {
6889 if (IsInherited(Weapon))
6890 config_to_search = "CfgWeapons";
6891
6892 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6893
6894 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6895
6896 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6897
6898 if (config_OnFire_subclass_count > 0)
6899 {
6900 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6901
6902 for (int i = 0; i < config_OnFire_subclass_count; i++)
6903 {
6904 string particle_class = "";
6905 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6906 string config_OnFire_entry = config_OnFire_class + particle_class;
6907 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6908 WPOF_array.Insert(WPOF);
6909 }
6910
6911
6913 }
6914 }
6915
6917 {
6918 config_to_search = "CfgWeapons";
6919 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6920
6921 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6922
6923 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6924
6925 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6926 {
6927 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6928
6929 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6930 {
6931 string particle_class2 = "";
6932 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6933 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6934 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6935 WPOBE_array.Insert(WPOBE);
6936 }
6937
6938
6940 }
6941 }
6942 }
6943
6944
6946 {
6949
6951 {
6952 string config_to_search = "CfgVehicles";
6953
6954 if (IsInherited(Weapon))
6955 config_to_search = "CfgWeapons";
6956
6957 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6958 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6959
6960 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6961 {
6962
6964
6966 {
6968 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6970 return;
6971 }
6972
6975
6976
6977
6978 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6979 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6980
6981 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6982 {
6983 string particle_class = "";
6984 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6985 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6986 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6987
6988 if (entry_type == CT_CLASS)
6989 {
6990 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6991 WPOOH_array.Insert(WPOF);
6992 }
6993 }
6994
6995
6997 }
6998 }
6999 }
7000
7002 {
7004 }
7005
7007 {
7009 {
7011
7014
7017
7018 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7019 }
7020 }
7021
7023 {
7025 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7026
7028 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7029
7031 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7032
7034 {
7036 }
7037 }
7038
7040 {
7042 }
7043
7045 {
7048 else
7050
7052 {
7055 }
7056 else
7057 {
7060
7063 }
7064
7066 }
7067
7069 {
7071 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7072 }
7073
7075 {
7077 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7079 }
7080
7082 {
7084 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7085 }
7086
7088 {
7091
7092 OverheatingParticle OP = new OverheatingParticle();
7097
7099 }
7100
7102 {
7105
7106 return -1;
7107 }
7108
7110 {
7112 {
7115
7116 for (int i = count; i > 0; --i)
7117 {
7118 int id = i - 1;
7121
7124
7125 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7126 {
7127 if (p)
7128 {
7131 }
7132 }
7133 }
7134 }
7135 }
7136
7138 {
7140 {
7142 {
7143 int id = i - 1;
7145
7146 if (OP)
7147 {
7149
7150 if (p)
7151 {
7153 }
7154
7155 delete OP;
7156 }
7157 }
7158
7161 }
7162 }
7163
7166 {
7167 return 0.0;
7168 }
7169
7170
7172 {
7173 return 250;
7174 }
7175
7177 {
7178 return 0;
7179 }
7180
7183 {
7185 return true;
7186
7187 return false;
7188 }
7189
7192 {
7195
7197 {
7199 }
7200 else
7201 {
7202
7204 }
7205
7207 }
7208
7215 {
7216 return -1;
7217 }
7218
7219
7220
7221
7223 {
7225 {
7226 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7227 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7228
7229 if (r_index >= 0)
7230 {
7231 InventoryLocation r_il = new InventoryLocation;
7232 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7233
7234 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7237 {
7238 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7239 }
7241 {
7242 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7243 }
7244
7245 }
7246
7247 player.GetHumanInventory().ClearUserReservedLocation(this);
7248 }
7249
7252 }
7253
7254
7255
7256
7258 {
7259 return ItemBase.m_DebugActionsMask;
7260 }
7261
7263 {
7264 return ItemBase.m_DebugActionsMask & mask;
7265 }
7266
7268 {
7269 ItemBase.m_DebugActionsMask = mask;
7270 }
7271
7273 {
7274 ItemBase.m_DebugActionsMask |= mask;
7275 }
7276
7278 {
7279 ItemBase.m_DebugActionsMask &= ~mask;
7280 }
7281
7283 {
7285 {
7287 }
7288 else
7289 {
7291 }
7292 }
7293
7294
7296 {
7297 if (GetEconomyProfile())
7298 {
7299 float q_max = GetEconomyProfile().GetQuantityMax();
7300 if (q_max > 0)
7301 {
7302 float q_min = GetEconomyProfile().GetQuantityMin();
7303 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7304
7306 {
7307 ComponentEnergyManager comp = GetCompEM();
7309 {
7311 }
7312 }
7314 {
7316
7317 }
7318
7319 }
7320 }
7321 }
7322
7325 {
7326 EntityAI parent = GetHierarchyParent();
7327
7328 if (parent)
7329 {
7330 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7331 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7332 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7333 }
7334 }
7335
7338 {
7339 EntityAI parent = GetHierarchyParent();
7340
7341 if (parent)
7342 {
7343 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7344 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7345 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7346 }
7347 }
7348
7350 {
7351
7352
7353
7354
7356
7358 {
7359 if (ScriptInputUserData.CanStoreInputUserData())
7360 {
7361 ScriptInputUserData ctx = new ScriptInputUserData;
7367 ctx.
Write(use_stack_max);
7370
7372 {
7373 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7374 }
7375 }
7376 }
7377 else if (!
g_Game.IsMultiplayer())
7378 {
7380 }
7381 }
7382
7384 {
7386 }
7387
7389 {
7391 }
7392
7394 {
7396 }
7397
7399 {
7400
7401 return false;
7402 }
7403
7405 {
7406 return false;
7407 }
7408
7412 {
7413 return false;
7414 }
7415
7417 {
7418 return "";
7419 }
7420
7422
7424 {
7425 return false;
7426 }
7427
7429 {
7430 return true;
7431 }
7432
7433
7434
7436 {
7437 return true;
7438 }
7439
7441 {
7442 return true;
7443 }
7444
7446 {
7447 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7449 }
7450
7452 {
7454 }
7455
7457 {
7459 if (!is_being_placed)
7461 SetSynchDirty();
7462 }
7463
7464
7466
7468 {
7470 }
7471
7473 {
7475 }
7476
7478 {
7479 return 1;
7480 }
7481
7483 {
7484 return false;
7485 }
7486
7488 {
7490 SetSynchDirty();
7491 }
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7507
7508
7509
7510
7511
7512
7513
7514
7515
7516
7517
7518
7519
7520
7521
7522
7523
7524
7525
7526
7528 {
7529 super.OnMovedInsideCargo(container);
7530
7531 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7532 }
7533
7534 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7535 {
7536 super.EEItemLocationChanged(oldLoc, newLoc);
7537
7538 PlayerBase newPlayer = null;
7539 PlayerBase oldPlayer = null;
7540
7541 if (newLoc.GetParent())
7542 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7543
7544 if (oldLoc.GetParent())
7545 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7546
7548 {
7549 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7550
7551 if (rIndex >= 0)
7552 {
7553 InventoryLocation rIl = new InventoryLocation;
7554 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7555
7556 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7559 {
7560 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7561 }
7563 {
7565 }
7566
7567 }
7568 }
7569
7571 {
7572 if (newPlayer)
7573 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7574
7575 if (newPlayer == oldPlayer)
7576 {
7577 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7578 {
7580 {
7581 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7582 {
7583 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7584 }
7585 }
7586 else
7587 {
7588 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7589 }
7590 }
7591
7592 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7593 {
7594 int type = oldLoc.GetType();
7596 {
7597 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7598 }
7600 {
7601 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7602 }
7603 }
7604 if (!m_OldLocation)
7605 {
7606 m_OldLocation = new InventoryLocation;
7607 }
7608 m_OldLocation.Copy(oldLoc);
7609 }
7610 else
7611 {
7612 if (m_OldLocation)
7613 {
7614 m_OldLocation.Reset();
7615 }
7616 }
7617
7618 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7619 }
7620 else
7621 {
7622 if (newPlayer)
7623 {
7624 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7625 if (resIndex >= 0)
7626 {
7627 InventoryLocation il = new InventoryLocation;
7628 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7630 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7633 {
7634 il.
GetParent().GetOnReleaseLock().Invoke(it);
7635 }
7637 {
7639 }
7640
7641 }
7642 }
7644 {
7645
7647 }
7648
7649 if (m_OldLocation)
7650 {
7651 m_OldLocation.Reset();
7652 }
7653 }
7654
7656 {
7657 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7658 }
7659
7661 {
7662 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7663 }
7664 }
7665
7666 override void EOnContact(IEntity other, Contact extra)
7667 {
7669 {
7670 int liquidType = -1;
7672 if (impactSpeed > 0.0)
7673 {
7675 #ifndef SERVER
7677 #else
7679 SetSynchDirty();
7680 #endif
7682 }
7683 }
7684
7685 #ifdef SERVER
7686 if (GetCompEM() && GetCompEM().IsPlugged())
7687 {
7688 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7689 GetCompEM().UnplugThis();
7690 }
7691 #endif
7692 }
7693
7695
7697 {
7699 }
7700
7702 {
7703
7704 }
7705
7707 {
7708 super.OnItemLocationChanged(old_owner, new_owner);
7709
7710 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7711 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7712
7713 if (!relatedPlayer && playerNew)
7714 relatedPlayer = playerNew;
7715
7716 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7717 {
7719 if (actionMgr)
7720 {
7721 ActionBase currentAction = actionMgr.GetRunningAction();
7722 if (currentAction)
7724 }
7725 }
7726
7727 Man ownerPlayerOld = null;
7728 Man ownerPlayerNew = null;
7729
7730 if (old_owner)
7731 {
7732 if (old_owner.
IsMan())
7733 {
7734 ownerPlayerOld = Man.Cast(old_owner);
7735 }
7736 else
7737 {
7738 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7739 }
7740 }
7741 else
7742 {
7744 {
7746
7747 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7748 {
7749 GetCompEM().UnplugThis();
7750 }
7751 }
7752 }
7753
7754 if (new_owner)
7755 {
7756 if (new_owner.
IsMan())
7757 {
7758 ownerPlayerNew = Man.Cast(new_owner);
7759 }
7760 else
7761 {
7762 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7763 }
7764 }
7765
7766 if (ownerPlayerOld != ownerPlayerNew)
7767 {
7768 if (ownerPlayerOld)
7769 {
7770 array<EntityAI> subItemsExit = new array<EntityAI>;
7772 for (int i = 0; i < subItemsExit.Count(); i++)
7773 {
7776 }
7777 }
7778
7779 if (ownerPlayerNew)
7780 {
7781 array<EntityAI> subItemsEnter = new array<EntityAI>;
7783 for (int j = 0; j < subItemsEnter.Count(); j++)
7784 {
7787 }
7788 }
7789 }
7790 else if (ownerPlayerNew != null)
7791 {
7792 PlayerBase nplayer;
7793 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7794 {
7795 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7797 for (int k = 0; k < subItemsUpdate.Count(); k++)
7798 {
7800 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7801 }
7802 }
7803 }
7804
7805 if (old_owner)
7806 old_owner.OnChildItemRemoved(this);
7807 if (new_owner)
7808 new_owner.OnChildItemReceived(this);
7809 }
7810
7811
7813 {
7814 super.EEDelete(parent);
7815 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7816 if (player)
7817 {
7819
7820 if (player.IsAlive())
7821 {
7822 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7823 if (r_index >= 0)
7824 {
7825 InventoryLocation r_il = new InventoryLocation;
7826 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7827
7828 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7831 {
7832 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7833 }
7835 {
7836 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7837 }
7838
7839 }
7840
7841 player.RemoveQuickBarEntityShortcut(this);
7842 }
7843 }
7844 }
7845
7847 {
7848 super.EEKilled(killer);
7849
7852 {
7853 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7854 {
7855 if (IsMagazine())
7856 {
7857 if (Magazine.Cast(this).GetAmmoCount() > 0)
7858 {
7860 }
7861 }
7862 else
7863 {
7865 }
7866 }
7867 }
7868 }
7869
7871 {
7872 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7873
7874 super.OnWasAttached(parent, slot_id);
7875
7878
7881 }
7882
7884 {
7885 super.OnWasDetached(parent, slot_id);
7886
7889
7892 }
7893
7895 {
7896 int idx;
7899
7900 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7901 if (inventory_slots.Count() < 1)
7902 {
7903 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7904 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7905 }
7906 else
7907 {
7908 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7909 }
7910
7911 idx = inventory_slots.Find(slot);
7912 if (idx < 0)
7913 return "";
7914
7915 return attach_types.Get(idx);
7916 }
7917
7919 {
7920 int idx = -1;
7921 string slot;
7922
7925
7926 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7927 if (inventory_slots.Count() < 1)
7928 {
7929 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7930 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7931 }
7932 else
7933 {
7934 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7935 if (detach_types.Count() < 1)
7936 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7937 }
7938
7939 for (int i = 0; i < inventory_slots.Count(); i++)
7940 {
7941 slot = inventory_slots.Get(i);
7942 }
7943
7944 if (slot != "")
7945 {
7946 if (detach_types.Count() == 1)
7947 idx = 0;
7948 else
7949 idx = inventory_slots.Find(slot);
7950 }
7951 if (idx < 0)
7952 return "";
7953
7954 return detach_types.Get(idx);
7955 }
7956
7958 {
7959
7961
7962
7963 float min_time = 1;
7964 float max_time = 3;
7965 float delay = Math.RandomFloat(min_time, max_time);
7966
7967 explode_timer.Run(delay, this, "DoAmmoExplosion");
7968 }
7969
7971 {
7972 Magazine magazine = Magazine.Cast(this);
7973 int pop_sounds_count = 6;
7974 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7975
7976
7977 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7978 string sound_name = pop_sounds[ sound_idx ];
7979 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7980
7981
7982 magazine.ServerAddAmmoCount(-1);
7983
7984
7985 float min_temp_to_explode = 100;
7986
7987 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7988 {
7990 }
7991 }
7992
7993
7994 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7995 {
7996 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7997
7998 const int CHANCE_DAMAGE_CARGO = 4;
7999 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8000 const int CHANCE_DAMAGE_NOTHING = 2;
8001
8003 {
8004 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8005 int chances;
8006 int rnd;
8007
8008 if (GetInventory().GetCargo())
8009 {
8010 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8011 rnd = Math.RandomInt(0,chances);
8012
8013 if (rnd < CHANCE_DAMAGE_CARGO)
8014 {
8016 }
8017 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8018 {
8020 }
8021 }
8022 else
8023 {
8024 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8025 rnd = Math.RandomInt(0,chances);
8026
8027 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8028 {
8030 }
8031 }
8032 }
8033 }
8034
8036 {
8037 CargoBase cargo = GetInventory().GetCargo();
8038 if (cargo)
8039 {
8041 if (item_count > 0)
8042 {
8043 int random_pick = Math.RandomInt(0, item_count);
8045 if (!item.IsExplosive())
8046 {
8047 item.AddHealth("","",damage);
8048 return true;
8049 }
8050 }
8051 }
8052 return false;
8053 }
8054
8056 {
8057 GameInventory inventory = GetInventory();
8059 if (attachment_count > 0)
8060 {
8061 int random_pick = Math.RandomInt(0, attachment_count);
8063 if (!attachment.IsExplosive())
8064 {
8065 attachment.AddHealth("","",damage);
8066 return true;
8067 }
8068 }
8069 return false;
8070 }
8071
8073 {
8075 }
8076
8078 {
8080 return GetInventory().CanRemoveEntity();
8081
8082 return false;
8083 }
8084
8086 {
8087
8089 return false;
8090
8091
8093 return false;
8094
8095
8096
8098 if (delta == 0)
8099 return false;
8100
8101
8102 return true;
8103 }
8104
8106 {
8108 {
8109 if (ScriptInputUserData.CanStoreInputUserData())
8110 {
8111 ScriptInputUserData ctx = new ScriptInputUserData;
8116 ctx.
Write(destination_entity);
8120 }
8121 }
8122 else if (!
g_Game.IsMultiplayer())
8123 {
8125 }
8126 }
8127
8129 {
8130 float split_quantity_new;
8134 InventoryLocation loc = new InventoryLocation;
8135
8136 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8137 {
8139 split_quantity_new = stack_max;
8140 else
8142
8144 {
8145 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8146 if (new_item)
8147 {
8148 new_item.SetResultOfSplit(true);
8149 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8151 new_item.
SetQuantity(split_quantity_new,
false,
true);
8152 }
8153 }
8154 }
8155 else if (destination_entity && slot_id == -1)
8156 {
8157 if (quantity > stack_max)
8158 split_quantity_new = stack_max;
8159 else
8160 split_quantity_new = quantity;
8161
8163 {
8164 GameInventory destinationInventory = destination_entity.GetInventory();
8166 {
8169 }
8170
8171 if (new_item)
8172 {
8173 new_item.SetResultOfSplit(true);
8174 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8176 new_item.
SetQuantity(split_quantity_new,
false,
true);
8177 }
8178 }
8179 }
8180 else
8181 {
8182 if (stack_max != 0)
8183 {
8185 {
8187 }
8188
8189 if (split_quantity_new == 0)
8190 {
8191 if (!
g_Game.IsMultiplayer())
8192 player.PhysicalPredictiveDropItem(this);
8193 else
8194 player.ServerDropEntity(this);
8195 return;
8196 }
8197
8199 {
8201
8202 if (new_item)
8203 {
8204 new_item.SetResultOfSplit(true);
8205 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8208 new_item.PlaceOnSurface();
8209 }
8210 }
8211 }
8212 }
8213 }
8214
8216 {
8217 float split_quantity_new;
8221 InventoryLocation loc = new InventoryLocation;
8222
8223 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8224 {
8226 split_quantity_new = stack_max;
8227 else
8229
8231 {
8232 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8233 if (new_item)
8234 {
8235 new_item.SetResultOfSplit(true);
8236 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8238 new_item.
SetQuantity(split_quantity_new,
false,
true);
8239 }
8240 }
8241 }
8242 else if (destination_entity && slot_id == -1)
8243 {
8244 if (quantity > stack_max)
8245 split_quantity_new = stack_max;
8246 else
8247 split_quantity_new = quantity;
8248
8250 {
8251 GameInventory destinationInventory = destination_entity.GetInventory();
8253 {
8256 }
8257
8258 if (new_item)
8259 {
8260 new_item.SetResultOfSplit(true);
8261 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8263 new_item.
SetQuantity(split_quantity_new,
false,
true);
8264 }
8265 }
8266 }
8267 else
8268 {
8269 if (stack_max != 0)
8270 {
8272 {
8274 }
8275
8277 {
8279
8280 if (new_item)
8281 {
8282 new_item.SetResultOfSplit(true);
8283 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8286 new_item.PlaceOnSurface();
8287 }
8288 }
8289 }
8290 }
8291 }
8292
8294 {
8296 {
8297 if (ScriptInputUserData.CanStoreInputUserData())
8298 {
8299 ScriptInputUserData ctx = new ScriptInputUserData;
8304 dst.WriteToContext(ctx);
8306 }
8307 }
8308 else if (!
g_Game.IsMultiplayer())
8309 {
8311 }
8312 }
8313
8315 {
8317 {
8318 if (ScriptInputUserData.CanStoreInputUserData())
8319 {
8320 ScriptInputUserData ctx = new ScriptInputUserData;
8325 ctx.
Write(destination_entity);
8331 }
8332 }
8333 else if (!
g_Game.IsMultiplayer())
8334 {
8336 }
8337 }
8338
8340 {
8342 }
8343
8345 {
8347 float split_quantity_new;
8349 if (dst.IsValid())
8350 {
8351 int slot_id = dst.GetSlot();
8353
8354 if (quantity > stack_max)
8355 split_quantity_new = stack_max;
8356 else
8357 split_quantity_new = quantity;
8358
8360 {
8362
8363 if (new_item)
8364 {
8365 new_item.SetResultOfSplit(true);
8366 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8368 new_item.
SetQuantity(split_quantity_new,
false,
true);
8369 }
8370
8371 return new_item;
8372 }
8373 }
8374
8375 return null;
8376 }
8377
8379 {
8381 float split_quantity_new;
8383 if (destination_entity)
8384 {
8386 if (quantity > stackable)
8387 split_quantity_new = stackable;
8388 else
8389 split_quantity_new = quantity;
8390
8392 {
8393 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8394 if (new_item)
8395 {
8396 new_item.SetResultOfSplit(true);
8397 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8399 new_item.
SetQuantity(split_quantity_new,
false,
true);
8400 }
8401 }
8402 }
8403 }
8404
8406 {
8408 {
8409 if (ScriptInputUserData.CanStoreInputUserData())
8410 {
8411 ScriptInputUserData ctx = new ScriptInputUserData;
8416 ItemBase destination_entity =
this;
8417 ctx.
Write(destination_entity);
8421 }
8422 }
8423 else if (!
g_Game.IsMultiplayer())
8424 {
8426 }
8427 }
8428
8430 {
8432 float split_quantity_new;
8434 if (player)
8435 {
8437 if (quantity > stackable)
8438 split_quantity_new = stackable;
8439 else
8440 split_quantity_new = quantity;
8441
8443 {
8444 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8445 new_item =
ItemBase.Cast(in_hands);
8446 if (new_item)
8447 {
8448 new_item.SetResultOfSplit(true);
8449 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8451 new_item.SetQuantity(split_quantity_new, false, true);
8452 }
8453 }
8454 }
8455 }
8456
8458 {
8460 float split_quantity_new = Math.Floor(quantity * 0.5);
8461
8463 return;
8464
8466
8467 if (new_item)
8468 {
8469 if (new_item.GetQuantityMax() < split_quantity_new)
8470 {
8471 split_quantity_new = new_item.GetQuantityMax();
8472 }
8473
8474 new_item.SetResultOfSplit(true);
8475 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8476
8478 {
8481 }
8482 else
8483 {
8485 new_item.
SetQuantity(split_quantity_new,
false,
true);
8486 }
8487 }
8488 }
8489
8491 {
8493 float split_quantity_new = Math.Floor(quantity / 2);
8494
8496 return;
8497
8498 InventoryLocation invloc = new InventoryLocation;
8500
8502 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8503
8504 if (new_item)
8505 {
8506 if (new_item.GetQuantityMax() < split_quantity_new)
8507 {
8508 split_quantity_new = new_item.GetQuantityMax();
8509 }
8511 {
8514 }
8515 else if (split_quantity_new > 1)
8516 {
8518 new_item.
SetQuantity(split_quantity_new,
false,
true);
8519 }
8520 }
8521 }
8522
8525 {
8526 SetWeightDirty();
8528
8529 if (parent)
8530 parent.OnAttachmentQuantityChangedEx(this, delta);
8531
8533 {
8535 {
8537 }
8539 {
8540 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8542 }
8543 }
8544 }
8545
8548 {
8549
8550 }
8551
8554 {
8556 }
8557
8559 {
8560 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8561
8563 {
8564 if (newLevel == GameConstants.STATE_RUINED)
8565 {
8567 EntityAI parent = GetHierarchyParent();
8568 if (parent && parent.IsFireplace())
8569 {
8570 CargoBase cargo = GetInventory().GetCargo();
8571 if (cargo)
8572 {
8574 {
8576 }
8577 }
8578 }
8579 }
8580
8582 {
8583
8585 return;
8586 }
8587
8588 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8589 {
8591 }
8592 }
8593 }
8594
8595
8597 {
8598 super.OnRightClick();
8599
8601 {
8603 {
8604 if (ScriptInputUserData.CanStoreInputUserData())
8605 {
8606 EntityAI root = GetHierarchyRoot();
8607 Man playerOwner = GetHierarchyRootPlayer();
8608 InventoryLocation dst = new InventoryLocation;
8609
8610
8611 if (!playerOwner && root && root == this)
8612 {
8614 }
8615 else
8616 {
8617
8618 GetInventory().GetCurrentInventoryLocation(dst);
8620 {
8621 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8623 {
8625 }
8626 else
8627 {
8629
8630
8631 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8632 {
8634 }
8635 else
8636 {
8637 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8638 }
8639 }
8640 }
8641 }
8642
8643 ScriptInputUserData ctx = new ScriptInputUserData;
8651 }
8652 }
8653 else if (!
g_Game.IsMultiplayer())
8654 {
8656 }
8657 }
8658 }
8659
8661 {
8662 if (root)
8663 {
8664 vector m4[4];
8665 root.GetTransform(m4);
8666 dst.SetGround(this, m4);
8667 }
8668 else
8669 {
8670 GetInventory().GetCurrentInventoryLocation(dst);
8671 }
8672 }
8673
8674 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8675 {
8676
8677 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8678 return false;
8679
8680 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8681 return false;
8682
8683
8685 return false;
8686
8687
8688 Magazine mag = Magazine.Cast(this);
8689 if (mag)
8690 {
8691 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8692 return false;
8693
8694 if (stack_max_limit)
8695 {
8696 Magazine other_mag = Magazine.Cast(other_item);
8697 if (other_item)
8698 {
8699 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8700 return false;
8701 }
8702
8703 }
8704 }
8705 else
8706 {
8707
8709 return false;
8710
8712 return false;
8713 }
8714
8715 PlayerBase player = null;
8716 if (CastTo(player, GetHierarchyRootPlayer()))
8717 {
8718 if (player.GetInventory().HasAttachment(this))
8719 return false;
8720
8721 if (player.IsItemsToDelete())
8722 return false;
8723 }
8724
8725 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8726 return false;
8727
8728 int slotID;
8730 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8731 return false;
8732
8733 return true;
8734 }
8735
8737 {
8739 }
8740
8742 {
8743 return m_IsResultOfSplit;
8744 }
8745
8747 {
8748 m_IsResultOfSplit = value;
8749 }
8750
8752 {
8754 }
8755
8757 {
8758 float other_item_quantity = other_item.GetQuantity();
8759 float this_free_space;
8760
8762
8764
8765 if (other_item_quantity > this_free_space)
8766 {
8767 return this_free_space;
8768 }
8769 else
8770 {
8771 return other_item_quantity;
8772 }
8773 }
8774
8776 {
8778 }
8779
8781 {
8783 return;
8784
8785 if (!IsMagazine() && other_item)
8786 {
8788 if (quantity_used != 0)
8789 {
8790 float hp1 = GetHealth01("","");
8791 float hp2 = other_item.GetHealth01("","");
8792 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8793 hpResult = hpResult / (
GetQuantity() + quantity_used);
8794
8795 hpResult *= GetMaxHealth();
8796 Math.Round(hpResult);
8797 SetHealth("", "Health", hpResult);
8798
8800 other_item.AddQuantity(-quantity_used);
8801 }
8802 }
8804 }
8805
8807 {
8808 #ifdef SERVER
8809 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8810 GetHierarchyParent().IncreaseLifetimeUp();
8811 #endif
8812 };
8813
8815 {
8816 PlayerBase p = PlayerBase.Cast(player);
8817
8818 array<int> recipesIds = p.m_Recipes;
8819 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8820 if (moduleRecipesManager)
8821 {
8822 EntityAI itemInHands = player.GetEntityInHands();
8823 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8824 }
8825
8826 for (int i = 0;i < recipesIds.Count(); i++)
8827 {
8828 int key = recipesIds.Get(i);
8829 string recipeName = moduleRecipesManager.GetRecipeName(key);
8831 }
8832 }
8833
8834
8835 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8836 {
8837 super.GetDebugActions(outputList);
8838
8839
8845
8846
8851
8856
8857
8861
8862
8864 {
8868 }
8869
8872
8873
8877
8879
8880 InventoryLocation loc = new InventoryLocation();
8881 GetInventory().GetCurrentInventoryLocation(loc);
8883 {
8884 if (Gizmo_IsSupported())
8887 }
8888
8890 }
8891
8892
8893
8894
8896 {
8897 super.OnAction(action_id, player, ctx);
8898
8900 {
8901 switch (action_id)
8902 {
8906 return true;
8910 return true;
8911 }
8912 }
8913
8915 {
8916 switch (action_id)
8917 {
8919 Delete();
8920 return true;
8921 }
8922 }
8923
8924 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8925 {
8926 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8927 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8928 PlayerBase p = PlayerBase.Cast(player);
8929 if (
EActions.RECIPES_RANGE_START < 1000)
8930 {
8931 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8932 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8933 }
8934 }
8935 #ifndef SERVER
8936 else if (action_id ==
EActions.WATCH_PLAYER)
8937 {
8938 PluginDeveloper.SetDeveloperItemClientEx(player);
8939 }
8940 #endif
8942 {
8943 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8944 {
8945 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8946 OnDebugButtonPressServer(id + 1);
8947 }
8948
8949 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8950 {
8951 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8953 }
8954
8955 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8956 {
8957 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8959 }
8960
8961 else if (action_id ==
EActions.ADD_QUANTITY)
8962 {
8963 if (IsMagazine())
8964 {
8965 Magazine mag = Magazine.Cast(this);
8966 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8967 }
8968 else
8969 {
8971 }
8972
8973 if (m_EM)
8974 {
8975 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8976 }
8977
8978 }
8979
8980 else if (action_id ==
EActions.REMOVE_QUANTITY)
8981 {
8982 if (IsMagazine())
8983 {
8984 Magazine mag2 = Magazine.Cast(this);
8985 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8986 }
8987 else
8988 {
8990 }
8991 if (m_EM)
8992 {
8993 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8994 }
8995
8996 }
8997
8998 else if (action_id ==
EActions.SET_QUANTITY_0)
8999 {
9001
9002 if (m_EM)
9003 {
9004 m_EM.SetEnergy(0);
9005 }
9006 }
9007
9008 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9009 {
9011
9012 if (m_EM)
9013 {
9014 m_EM.SetEnergy(m_EM.GetEnergyMax());
9015 }
9016 }
9017
9018 else if (action_id ==
EActions.ADD_HEALTH)
9019 {
9020 AddHealth("","",GetMaxHealth("","Health")/5);
9021 }
9022 else if (action_id ==
EActions.REMOVE_HEALTH)
9023 {
9024 AddHealth("","",-GetMaxHealth("","Health")/5);
9025 }
9026 else if (action_id ==
EActions.DESTROY_HEALTH)
9027 {
9028 SetHealth01("","",0);
9029 }
9030 else if (action_id ==
EActions.WATCH_ITEM)
9031 {
9033 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9034 #ifdef DEVELOPER
9035 SetDebugDeveloper_item(this);
9036 #endif
9037 }
9038
9039 else if (action_id ==
EActions.ADD_TEMPERATURE)
9040 {
9041 AddTemperature(20);
9042
9043 }
9044
9045 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9046 {
9047 AddTemperature(-20);
9048
9049 }
9050
9051 else if (action_id ==
EActions.FLIP_FROZEN)
9052 {
9053 SetFrozen(!GetIsFrozen());
9054
9055 }
9056
9057 else if (action_id ==
EActions.ADD_WETNESS)
9058 {
9060
9061 }
9062
9063 else if (action_id ==
EActions.REMOVE_WETNESS)
9064 {
9066
9067 }
9068
9069 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9070 {
9073
9074
9075 }
9076
9077 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9078 {
9081 }
9082
9083 else if (action_id ==
EActions.MAKE_SPECIAL)
9084 {
9085 auto debugParams = DebugSpawnParams.WithPlayer(player);
9086 OnDebugSpawnEx(debugParams);
9087 }
9088
9089 }
9090
9091
9092 return false;
9093 }
9094
9095
9096
9097
9101
9104
9105
9106
9108 {
9109 return false;
9110 }
9111
9112
9114 {
9115 return true;
9116 }
9117
9118
9120 {
9121 return true;
9122 }
9123
9124
9125
9127 {
9128 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9129 return g_Game.ConfigIsExisting(config_path);
9130 }
9131
9134 {
9135 return null;
9136 }
9137
9139 {
9140 return false;
9141 }
9142
9144 {
9145 return false;
9146 }
9147
9151
9152
9154 {
9155 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9156 return module_repairing.CanRepair(this, item_repair_kit);
9157 }
9158
9159
9160 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9161 {
9162 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9163 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9164 }
9165
9166
9168 {
9169
9170
9171
9172
9173
9174
9175
9176
9177 return 1;
9178 }
9179
9180
9181
9183 {
9185 }
9186
9187
9188
9190 {
9192 }
9193
9194
9203 {
9204 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9205
9206 if (player)
9207 {
9208 player.MessageStatus(text);
9209 }
9210 }
9211
9212
9221 {
9222 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9223
9224 if (player)
9225 {
9226 player.MessageAction(text);
9227 }
9228 }
9229
9230
9239 {
9240 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9241
9242 if (player)
9243 {
9244 player.MessageFriendly(text);
9245 }
9246 }
9247
9248
9257 {
9258 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9259
9260 if (player)
9261 {
9262 player.MessageImportant(text);
9263 }
9264 }
9265
9267 {
9268 return true;
9269 }
9270
9271
9272 override bool KindOf(
string tag)
9273 {
9274 bool found = false;
9275 string item_name = this.
GetType();
9277 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9278
9279 int array_size = item_tag_array.Count();
9280 for (int i = 0; i < array_size; i++)
9281 {
9282 if (item_tag_array.Get(i) == tag)
9283 {
9284 found = true;
9285 break;
9286 }
9287 }
9288 return found;
9289 }
9290
9291
9293 {
9294
9295 super.OnRPC(sender, rpc_type,ctx);
9296
9297
9298 switch (rpc_type)
9299 {
9300 #ifndef SERVER
9301 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9302 Param2<bool, string> p = new Param2<bool, string>(false, "");
9303
9305 return;
9306
9307 bool play = p.param1;
9308 string soundSet = p.param2;
9309
9310 if (play)
9311 {
9313 {
9315 {
9317 }
9318 }
9319 else
9320 {
9322 }
9323 }
9324 else
9325 {
9327 }
9328
9329 break;
9330 #endif
9331
9332 }
9333
9335 {
9337 }
9338 }
9339
9340
9341
9342
9344 {
9345 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9346 return plugin.GetID(
name);
9347 }
9348
9350 {
9351 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9352 return plugin.GetName(id);
9353 }
9354
9357 {
9358
9359
9360 int varFlags;
9361 if (!ctx.
Read(varFlags))
9362 return;
9363
9364 if (varFlags & ItemVariableFlags.FLOAT)
9365 {
9367 }
9368 }
9369
9371 {
9372
9373 super.SerializeNumericalVars(floats_out);
9374
9375
9376
9378 {
9380 }
9381
9383 {
9385 }
9386
9388 {
9390 }
9391
9393 {
9398 }
9399
9401 {
9403 }
9404 }
9405
9407 {
9408
9409 super.DeSerializeNumericalVars(floats);
9410
9411
9412 int index = 0;
9413 int mask = Math.Round(floats.Get(index));
9414
9415 index++;
9416
9418 {
9420 {
9422 }
9423 else
9424 {
9425 float quantity = floats.Get(index);
9427 }
9428 index++;
9429 }
9430
9432 {
9433 float wet = floats.Get(index);
9435 index++;
9436 }
9437
9439 {
9440 int liquidtype = Math.Round(floats.Get(index));
9442 index++;
9443 }
9444
9446 {
9448 index++;
9450 index++;
9452 index++;
9454 index++;
9455 }
9456
9458 {
9459 int cleanness = Math.Round(floats.Get(index));
9461 index++;
9462 }
9463 }
9464
9466 {
9467 super.WriteVarsToCTX(ctx);
9468
9469
9471 {
9473 }
9474
9476 {
9478 }
9479
9481 {
9483 }
9484
9486 {
9487 int r,g,b,a;
9493 }
9494
9496 {
9498 }
9499 }
9500
9502 {
9503 if (!super.ReadVarsFromCTX(ctx,version))
9504 return false;
9505
9506 int intValue;
9507 float value;
9508
9509 if (version < 140)
9510 {
9511 if (!ctx.
Read(intValue))
9512 return false;
9513
9514 m_VariablesMask = intValue;
9515 }
9516
9518 {
9519 if (!ctx.
Read(value))
9520 return false;
9521
9523 {
9525 }
9526 else
9527 {
9529 }
9530 }
9531
9532 if (version < 140)
9533 {
9535 {
9536 if (!ctx.
Read(value))
9537 return false;
9538 SetTemperatureDirect(value);
9539 }
9540 }
9541
9543 {
9544 if (!ctx.
Read(value))
9545 return false;
9547 }
9548
9550 {
9551 if (!ctx.
Read(intValue))
9552 return false;
9554 }
9555
9557 {
9558 int r,g,b,a;
9560 return false;
9562 return false;
9564 return false;
9566 return false;
9567
9569 }
9570
9572 {
9573 if (!ctx.
Read(intValue))
9574 return false;
9576 }
9577
9578 if (version >= 138 && version < 140)
9579 {
9581 {
9582 if (!ctx.
Read(intValue))
9583 return false;
9584 SetFrozen(intValue);
9585 }
9586 }
9587
9588 return true;
9589 }
9590
9591
9593 {
9596 {
9598 }
9599
9600 if (!super.OnStoreLoad(ctx, version))
9601 {
9603 return false;
9604 }
9605
9606 if (version >= 114)
9607 {
9608 bool hasQuickBarIndexSaved;
9609
9610 if (!ctx.
Read(hasQuickBarIndexSaved))
9611 {
9613 return false;
9614 }
9615
9616 if (hasQuickBarIndexSaved)
9617 {
9618 int itmQBIndex;
9619
9620
9621 if (!ctx.
Read(itmQBIndex))
9622 {
9624 return false;
9625 }
9626
9627 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9628 if (itmQBIndex != -1 && parentPlayer)
9629 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9630 }
9631 }
9632 else
9633 {
9634
9635 PlayerBase player;
9636 int itemQBIndex;
9637 if (version ==
int.
MAX)
9638 {
9639 if (!ctx.
Read(itemQBIndex))
9640 {
9642 return false;
9643 }
9644 }
9645 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9646 {
9647
9648 if (!ctx.
Read(itemQBIndex))
9649 {
9651 return false;
9652 }
9653 if (itemQBIndex != -1 && player)
9654 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9655 }
9656 }
9657
9658 if (version < 140)
9659 {
9660
9661 if (!LoadVariables(ctx, version))
9662 {
9664 return false;
9665 }
9666 }
9667
9668
9670 {
9672 return false;
9673 }
9674 if (version >= 132)
9675 {
9677 if (raib)
9678 {
9680 {
9682 return false;
9683 }
9684 }
9685 }
9686
9688 return true;
9689 }
9690
9691
9692
9694 {
9695 super.OnStoreSave(ctx);
9696
9697 PlayerBase player;
9698 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9699 {
9701
9702 int itemQBIndex = -1;
9703 itemQBIndex = player.FindQuickBarEntityIndex(this);
9704 ctx.
Write(itemQBIndex);
9705 }
9706 else
9707 {
9709 }
9710
9712
9714 if (raib)
9715 {
9717 }
9718 }
9719
9720
9722 {
9723 super.AfterStoreLoad();
9724
9726 {
9728 }
9729
9731 {
9734 }
9735 }
9736
9738 {
9739 super.EEOnAfterLoad();
9740
9742 {
9744 }
9745
9748 }
9749
9751 {
9752 return false;
9753 }
9754
9755
9756
9758 {
9760 {
9761 #ifdef PLATFORM_CONSOLE
9762
9764 {
9766 if (menu)
9767 {
9769 }
9770 }
9771 #endif
9772 }
9773
9775 {
9778 }
9779
9781 {
9782 SetWeightDirty();
9784 }
9786 {
9789 }
9790
9792 {
9795
9798 }
9800 {
9804 }
9805
9806 super.OnVariablesSynchronized();
9807 }
9808
9809
9810
9812 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9813 {
9814 if (!IsServerCheck(allow_client))
9815 return false;
9816
9818 return false;
9819
9822
9823 if (value <= (min + 0.001))
9824 value = min;
9825
9826 if (value == min)
9827 {
9828 if (destroy_config)
9829 {
9830 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9831 if (dstr)
9832 {
9834 this.Delete();
9835 return true;
9836 }
9837 }
9838 else if (destroy_forced)
9839 {
9841 this.Delete();
9842 return true;
9843 }
9844
9846 }
9847
9850
9852 {
9853 EntityAI parent = GetHierarchyRoot();
9854 InventoryLocation iLoc = new InventoryLocation();
9855 GetInventory().GetCurrentInventoryLocation(iLoc);
9857 {
9858 int iLocSlot = iLoc.
GetSlot();
9860 {
9862 }
9864 {
9866 }
9867 }
9868 }
9869
9871 {
9873
9874 if (delta)
9876 }
9877
9879
9880 return false;
9881 }
9882
9883
9885 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9886 {
9888 }
9889
9891 {
9894 }
9895
9897 {
9900 }
9901
9903 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9904 {
9905 float value_clamped = Math.Clamp(value, 0, 1);
9907 SetQuantity(result, destroy_config, destroy_forced);
9908 }
9909
9910
9913 {
9915 }
9916
9918 {
9920 }
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9932 {
9933 int slot = -1;
9934 GameInventory inventory = GetInventory();
9935 if (inventory)
9936 {
9937 InventoryLocation il = new InventoryLocation;
9940 }
9941
9943 }
9944
9946 {
9947 float quantity_max = 0;
9948
9950 {
9951 if (attSlotID != -1)
9952 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9953
9954 if (quantity_max <= 0)
9956 }
9957
9958 if (quantity_max <= 0)
9960
9961 return quantity_max;
9962 }
9963
9965 {
9967 }
9968
9970 {
9972 }
9973
9974
9976 {
9978 }
9979
9981 {
9983 }
9984
9986 {
9988 }
9989
9990
9992 {
9993
9994 float weightEx = GetWeightEx();
9995 float special = GetInventoryAndCargoWeight();
9996 return weightEx - special;
9997 }
9998
9999
10001 {
10003 }
10004
10006 {
10008 {
10009 #ifdef DEVELOPER
10010 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10011 {
10012 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10014 }
10015 #endif
10016
10017 return GetQuantity() * GetConfigWeightModified();
10018 }
10019 else if (HasEnergyManager())
10020 {
10021 #ifdef DEVELOPER
10022 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10023 {
10024 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10025 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10026 }
10027 #endif
10028 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10029 }
10030 else
10031 {
10032 #ifdef DEVELOPER
10033 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10034 {
10035 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10036 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10037 }
10038 #endif
10039 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10040 }
10041 }
10042
10045 {
10046 int item_count = 0;
10048
10049 GameInventory inventory = GetInventory();
10050 CargoBase cargo = inventory.
GetCargo();
10051 if (cargo != NULL)
10052 {
10054 }
10055
10057 for (int i = 0; i < nAttachments; ++i)
10058 {
10060 if (item)
10061 item_count += item.GetNumberOfItems();
10062 }
10063 return item_count;
10064 }
10065
10068 {
10069 float weight = 0;
10070 float wetness = 1;
10071 if (include_wetness)
10074 {
10075 weight = wetness * m_ConfigWeight;
10076 }
10078 {
10079 weight = 1;
10080 }
10081 return weight;
10082 }
10083
10084
10085
10087 {
10088 GameInventory inventory = GetInventory();
10089 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10090 {
10091 array<EntityAI> items = new array<EntityAI>;
10093 for (int i = 0; i < items.Count(); ++i)
10094 {
10096 if (item)
10097 {
10098 g_Game.ObjectDelete(item);
10099 }
10100 }
10101 }
10102 }
10103
10104
10105
10106
10108 {
10109 float energy = 0;
10110 if (HasEnergyManager())
10111 {
10112 energy = GetCompEM().GetEnergy();
10113 }
10114 return energy;
10115 }
10116
10117
10119 {
10120 super.OnEnergyConsumed();
10121
10123 }
10124
10126 {
10127 super.OnEnergyAdded();
10128
10130 }
10131
10132
10134 {
10135 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10136 {
10138 {
10139 float energy_0to1 = GetCompEM().GetEnergy0To1();
10141 }
10142 }
10143 }
10144
10145
10147 {
10148 return ConfigGetFloat("heatIsolation");
10149 }
10150
10152 {
10154 }
10155
10157 {
10158 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10159 if (
g_Game.ConfigIsExisting(paramPath))
10160 return g_Game.ConfigGetFloat(paramPath);
10161
10162 return 0.0;
10163 }
10164
10166 {
10167 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10168 if (
g_Game.ConfigIsExisting(paramPath))
10169 return g_Game.ConfigGetFloat(paramPath);
10170
10171 return 0.0;
10172 }
10173
10174 override void SetWet(
float value,
bool allow_client =
false)
10175 {
10176 if (!IsServerCheck(allow_client))
10177 return;
10178
10181
10183
10184 m_VarWet = Math.Clamp(value, min, max);
10185
10187 {
10190 }
10191 }
10192
10193 override void AddWet(
float value)
10194 {
10196 }
10197
10199 {
10201 }
10202
10204 {
10206 }
10207
10209 {
10211 }
10212
10214 {
10216 }
10217
10219 {
10221 }
10222
10223 override void OnWetChanged(
float newVal,
float oldVal)
10224 {
10227 if (newLevel != oldLevel)
10228 {
10230 }
10231 }
10232
10234 {
10235 SetWeightDirty();
10236 }
10237
10239 {
10240 return GetWetLevelInternal(
m_VarWet);
10241 }
10242
10243
10244
10246 {
10248 }
10249
10251 {
10253 }
10254
10256 {
10258 }
10259
10261 {
10263 }
10264
10265
10266
10268 {
10269 if (ConfigIsExisting("itemModelLength"))
10270 {
10271 return ConfigGetFloat("itemModelLength");
10272 }
10273 return 0;
10274 }
10275
10277 {
10278 if (ConfigIsExisting("itemAttachOffset"))
10279 {
10280 return ConfigGetFloat("itemAttachOffset");
10281 }
10282 return 0;
10283 }
10284
10285 override void SetCleanness(
int value,
bool allow_client =
false)
10286 {
10287 if (!IsServerCheck(allow_client))
10288 return;
10289
10291
10293
10296 }
10297
10299 {
10301 }
10302
10304 {
10305 return true;
10306 }
10307
10308
10309
10310
10312 {
10314 }
10315
10317 {
10319 }
10320
10321
10322
10323
10324 override void SetColor(
int r,
int g,
int b,
int a)
10325 {
10331 }
10333 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10334 {
10339 }
10340
10342 {
10344 }
10345
10348 {
10349 int r,g,b,a;
10351 r = r/255;
10352 g = g/255;
10353 b = b/255;
10354 a = a/255;
10355 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10356 }
10357
10358
10359
10360 override void SetLiquidType(
int value,
bool allow_client =
false)
10361 {
10362 if (!IsServerCheck(allow_client))
10363 return;
10364
10369 }
10370
10372 {
10373 return ConfigGetInt("varLiquidTypeInit");
10374 }
10375
10377 {
10379 }
10380
10382 {
10384 SetFrozen(false);
10385 }
10386
10389 {
10390 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10391 }
10392
10393
10396 {
10397 PlayerBase nplayer;
10398 if (PlayerBase.CastTo(nplayer, player))
10399 {
10401 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10402 }
10403 }
10404
10405
10408 {
10409 PlayerBase nplayer;
10410 if (PlayerBase.CastTo(nplayer,player))
10411 {
10412 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10413 }
10414
10415 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10416
10417 if (HasEnergyManager())
10418 {
10419 GetCompEM().UpdatePlugState();
10420 }
10421 }
10422
10423
10425 {
10426 super.OnPlacementStarted(player);
10427
10429 }
10430
10431 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10432 {
10434 {
10435 m_AdminLog.OnPlacementComplete(player,
this);
10436 }
10437
10438 super.OnPlacementComplete(player, position, orientation);
10439 }
10440
10441
10442
10443
10444
10446 {
10448 {
10449 return true;
10450 }
10451 else
10452 {
10453 return false;
10454 }
10455 }
10456
10457
10459 {
10461 {
10463 }
10464 }
10465
10466
10468 {
10470 }
10471
10473 {
10475 }
10476
10477 override void InsertAgent(
int agent,
float count = 1)
10478 {
10479 if (count < 1)
10480 return;
10481
10483 }
10484
10487 {
10489 }
10490
10491
10493 {
10495 }
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10539 {
10541 return false;
10542 return true;
10543 }
10544
10546 {
10547
10549 }
10550
10551
10554 {
10555 super.CheckForRoofLimited(timeTresholdMS);
10556
10557 float time =
g_Game.GetTime();
10558 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10559 {
10560 m_PreviousRoofTestTime = time;
10561 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10562 }
10563 }
10564
10565
10567 {
10569 {
10570 return 0;
10571 }
10572
10573 if (GetInventory().GetAttachmentSlotsCount() != 0)
10574 {
10575 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10576 if (filter)
10577 return filter.GetProtectionLevel(type, false, system);
10578 else
10579 return 0;
10580 }
10581
10582 string subclassPath, entryName;
10583
10584 switch (type)
10585 {
10587 entryName = "biological";
10588 break;
10590 entryName = "chemical";
10591 break;
10592 default:
10593 entryName = "biological";
10594 break;
10595 }
10596
10597 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10598
10599 return g_Game.ConfigGetFloat(subclassPath + entryName);
10600 }
10601
10602
10603
10606 {
10607 if (!IsMagazine())
10609
10611 }
10612
10613
10614
10615
10616
10621 {
10622 return true;
10623 }
10624
10626 {
10628 }
10629
10630
10631
10632
10633
10635 {
10636 if (parent)
10637 {
10638 if (parent.IsInherited(DayZInfected))
10639 return true;
10640
10641 if (!parent.IsRuined())
10642 return true;
10643 }
10644
10645 return true;
10646 }
10647
10649 {
10650 if (!super.CanPutAsAttachment(parent))
10651 {
10652 return false;
10653 }
10654
10655 if (!IsRuined() && !parent.IsRuined())
10656 {
10657 return true;
10658 }
10659
10660 return false;
10661 }
10662
10664 {
10665
10666
10667
10668
10669 return super.CanReceiveItemIntoCargo(item);
10670 }
10671
10673 {
10674
10675
10676
10677
10678 GameInventory attachmentInv = attachment.GetInventory();
10680 {
10681 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10682 return false;
10683 }
10684
10685 InventoryLocation loc = new InventoryLocation();
10686 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10687 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10688 return false;
10689
10690 return super.CanReceiveAttachment(attachment, slotId);
10691 }
10692
10694 {
10695 if (!super.CanReleaseAttachment(attachment))
10696 return false;
10697
10698 return GetInventory().AreChildrenAccessible();
10699 }
10700
10701
10702
10703
10704
10705
10706
10707
10708
10709
10710
10711
10712
10713
10714
10715
10716
10717
10718
10719
10720
10722 {
10723 int id = muzzle_owner.GetMuzzleID();
10724 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10725
10726 if (WPOF_array)
10727 {
10728 for (int i = 0; i < WPOF_array.Count(); i++)
10729 {
10730 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10731
10732 if (WPOF)
10733 {
10734 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10735 }
10736 }
10737 }
10738 }
10739
10740
10742 {
10743 int id = muzzle_owner.GetMuzzleID();
10745
10746 if (WPOBE_array)
10747 {
10748 for (int i = 0; i < WPOBE_array.Count(); i++)
10749 {
10750 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10751
10752 if (WPOBE)
10753 {
10754 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10755 }
10756 }
10757 }
10758 }
10759
10760
10762 {
10763 int id = muzzle_owner.GetMuzzleID();
10764 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10765
10766 if (WPOOH_array)
10767 {
10768 for (int i = 0; i < WPOOH_array.Count(); i++)
10769 {
10770 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10771
10772 if (WPOOH)
10773 {
10774 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10775 }
10776 }
10777 }
10778 }
10779
10780
10782 {
10783 int id = muzzle_owner.GetMuzzleID();
10784 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10785
10786 if (WPOOH_array)
10787 {
10788 for (int i = 0; i < WPOOH_array.Count(); i++)
10789 {
10790 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10791
10792 if (WPOOH)
10793 {
10794 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10795 }
10796 }
10797 }
10798 }
10799
10800
10802 {
10803 int id = muzzle_owner.GetMuzzleID();
10804 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10805
10806 if (WPOOH_array)
10807 {
10808 for (int i = 0; i < WPOOH_array.Count(); i++)
10809 {
10810 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10811
10812 if (WPOOH)
10813 {
10814 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10815 }
10816 }
10817 }
10818 }
10819
10820
10821
10823 {
10825 {
10826 return true;
10827 }
10828
10829 return false;
10830 }
10831
10833 {
10835 {
10836 return true;
10837 }
10838
10839 return false;
10840 }
10841
10843 {
10845 {
10846 return true;
10847 }
10848
10849 return false;
10850 }
10851
10853 {
10854 return false;
10855 }
10856
10859 {
10860 return UATimeSpent.DEFAULT_DEPLOY;
10861 }
10862
10863
10864
10865
10867 {
10869 SetSynchDirty();
10870 }
10871
10873 {
10875 }
10876
10877
10879 {
10880 return false;
10881 }
10882
10885 {
10886 string att_type = "None";
10887
10888 if (ConfigIsExisting("soundAttType"))
10889 {
10890 att_type = ConfigGetString("soundAttType");
10891 }
10892
10894 }
10895
10897 {
10899 }
10900
10901
10902
10903
10904
10910
10912 {
10915
10917 }
10918
10919
10921 {
10923 return;
10924
10926
10929
10932
10933 SoundParameters params = new SoundParameters();
10937 }
10938
10939
10941 {
10943 {
10946
10947 SetSynchDirty();
10948
10951 }
10952 }
10953
10955 {
10957 }
10958
10959
10961 {
10963 return;
10964
10966 SetSynchDirty();
10967
10970 }
10971
10973 {
10976 }
10977
10979 {
10981 }
10982
10983 void OnApply(PlayerBase player);
10984
10986 {
10987 return 1.0;
10988 };
10989
10991 {
10993 }
10994
10996 {
10998 }
10999
11001
11003 {
11004 SetDynamicPhysicsLifeTime(0.01);
11006 }
11007
11009 {
11010 array<string> zone_names = new array<string>;
11011 GetDamageZones(zone_names);
11012 for (int i = 0; i < zone_names.Count(); i++)
11013 {
11014 SetHealthMax(zone_names.Get(i),"Health");
11015 }
11016 SetHealthMax("","Health");
11017 }
11018
11021 {
11022 float global_health = GetHealth01("","Health");
11023 array<string> zones = new array<string>;
11024 GetDamageZones(zones);
11025
11026 for (int i = 0; i < zones.Count(); i++)
11027 {
11028 SetHealth01(zones.Get(i),"Health",global_health);
11029 }
11030 }
11031
11034 {
11035 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11036 }
11037
11039 {
11040 if (!hasRootAsPlayer)
11041 {
11042 if (refParentIB)
11043 {
11044
11045 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11046 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11047
11048 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11049 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11050
11053 }
11054 else
11055 {
11056
11059 }
11060 }
11061 }
11062
11064 {
11066 {
11067 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11068 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11069 {
11070 float heatPermCoef = 1.0;
11072 while (ent)
11073 {
11074 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11075 ent = ent.GetHierarchyParent();
11076 }
11077
11078 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11079 }
11080 }
11081 }
11082
11084 {
11085
11086 EntityAI parent = GetHierarchyParent();
11087 if (!parent)
11088 {
11089 hasParent = false;
11090 hasRootAsPlayer = false;
11091 }
11092 else
11093 {
11094 hasParent = true;
11095 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11096 refParentIB =
ItemBase.Cast(parent);
11097 }
11098 }
11099
11100 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11101 {
11102
11103 }
11104
11106 {
11107
11108 return false;
11109 }
11110
11112 {
11113
11114
11115 return false;
11116 }
11117
11119 {
11120
11121 return false;
11122 }
11123
11126 {
11127 return !GetIsFrozen() &&
IsOpen();
11128 }
11129
11131 {
11132 bool hasParent = false, hasRootAsPlayer = false;
11134
11135 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11136 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11137
11138 if (wwtu || foodDecay)
11139 {
11143
11144 if (processWetness || processTemperature || processDecay)
11145 {
11147
11148 if (processWetness)
11149 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11150
11151 if (processTemperature)
11153
11154 if (processDecay)
11155 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11156 }
11157 }
11158 }
11159
11162 {
11164 }
11165
11167 {
11170
11171 return super.GetTemperatureFreezeThreshold();
11172 }
11173
11175 {
11178
11179 return super.GetTemperatureThawThreshold();
11180 }
11181
11183 {
11186
11187 return super.GetItemOverheatThreshold();
11188 }
11189
11191 {
11193 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11194
11195 return super.GetTemperatureFreezeTime();
11196 }
11197
11199 {
11201 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11202
11203 return super.GetTemperatureThawTime();
11204 }
11205
11210
11212 {
11213 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11214 }
11215
11217 {
11218 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11219 }
11220
11223 {
11225 }
11226
11228 {
11230 }
11231
11233 {
11235 }
11236
11239 {
11240 return null;
11241 }
11242
11245 {
11246 return false;
11247 }
11248
11250 {
11252 {
11255 if (!trg)
11256 {
11258 explosive = this;
11259 }
11260
11261 explosive.PairRemote(trg);
11263
11264 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11265 trg.SetPersistentPairID(persistentID);
11266 explosive.SetPersistentPairID(persistentID);
11267
11268 return true;
11269 }
11270 return false;
11271 }
11272
11275 {
11276 float ret = 1.0;
11279 ret *= GetHealth01();
11280
11281 return ret;
11282 }
11283
11284 #ifdef DEVELOPER
11285 override void SetDebugItem()
11286 {
11287 super.SetDebugItem();
11288 _itemBase = this;
11289 }
11290
11292 {
11293 string text = super.GetDebugText();
11294
11296 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11297
11298 return text;
11299 }
11300 #endif
11301
11303 {
11304 return true;
11305 }
11306
11308
11310
11312 {
11315 }
11316
11317
11325
11341
11342 [
Obsolete(
"Use ItemSoundHandler instead")]
11345 {
11346 if (!
g_Game.IsDedicatedServer())
11347 {
11348 if (ConfigIsExisting("attachSoundSet"))
11349 {
11350 string cfg_path = "";
11351 string soundset = "";
11352 string type_name =
GetType();
11353
11356 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11357 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11358
11359 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11360 {
11361 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11362 {
11363 if (cfg_slot_array[i] == slot_type)
11364 {
11365 soundset = cfg_soundset_array[i];
11366 break;
11367 }
11368 }
11369 }
11370
11371 if (soundset != "")
11372 {
11373 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11375 }
11376 }
11377 }
11378 }
11379
11381}
11382
11384{
11386 if (entity)
11387 {
11388 bool is_item = entity.IsInherited(
ItemBase);
11389 if (is_item && full_quantity)
11390 {
11393 }
11394 }
11395 else
11396 {
11398 return NULL;
11399 }
11400 return entity;
11401}
11402
11404{
11405 if (item)
11406 {
11407 if (health > 0)
11408 item.SetHealth("", "", health);
11409
11410 if (item.CanHaveTemperature())
11411 {
11413 if (item.CanFreeze())
11414 item.SetFrozen(false);
11415 }
11416
11417 if (item.HasEnergyManager())
11418 {
11419 if (quantity >= 0)
11420 {
11421 item.GetCompEM().SetEnergy0To1(quantity);
11422 }
11423 else
11424 {
11426 }
11427 }
11428 else if (item.IsMagazine())
11429 {
11430 Magazine mag = Magazine.Cast(item);
11431 if (quantity >= 0)
11432 {
11433 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11434 }
11435 else
11436 {
11438 }
11439
11440 }
11441 else
11442 {
11443 if (quantity >= 0)
11444 {
11445 item.SetQuantityNormalized(quantity, false);
11446 }
11447 else
11448 {
11450 }
11451
11452 }
11453 }
11454}
11455
11456#ifdef DEVELOPER
11458#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.