6528{
6530 {
6531 return true;
6532 }
6533};
6534
6536{
6537
6538};
6539
6540
6541
6543{
6547
6549
6552
6553
6554
6555
6556
6565
6571
6576
6581
6602 protected bool m_IsResultOfSplit
6603
6605
6610
6611
6612
6614
6618
6619
6620
6622
6625
6626
6627
6633
6634
6642
6645
6646
6648
6649
6651
6652
6657
6658
6663
6665
6666
6668
6669
6671 {
6676
6677 if (!
g_Game.IsDedicatedServer())
6678 {
6680 {
6682
6684 {
6686 }
6687 }
6688
6691 }
6692
6693 m_OldLocation = null;
6694
6696 {
6698 }
6699
6700 if (ConfigIsExisting("headSelectionsToHide"))
6701 {
6704 }
6705
6707 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6708 {
6710 }
6711
6713
6714 m_IsResultOfSplit = false;
6715
6717 }
6718
6720 {
6721 super.InitItemVariables();
6722
6728 m_Count = ConfigGetInt(
"count");
6729
6732
6737
6740
6745
6757
6761
6762
6765 if (ConfigIsExisting("canBeSplit"))
6766 {
6769 }
6770
6772 if (ConfigIsExisting("itemBehaviour"))
6774
6775
6778 RegisterNetSyncVariableInt("m_VarLiquidType");
6779 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6780
6781 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6782 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6783 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6784
6785 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6786 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6787 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6788 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6789
6790 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6791 RegisterNetSyncVariableBool("m_IsTakeable");
6792 RegisterNetSyncVariableBool("m_IsHologram");
6793
6796 {
6799 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6800 }
6801
6803
6805 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6807
6809 }
6810
6812 {
6814 }
6815
6817 {
6820 {
6825 }
6826 }
6827
6828 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6829 {
6831 {
6834 }
6835
6837 }
6838
6840 {
6846 }
6847
6849
6851 {
6853
6854 if (!action)
6855 {
6856 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6857 return;
6858 }
6859
6861 if (!ai)
6862 {
6864 return;
6865 }
6866
6868 if (!action_array)
6869 {
6870 action_array = new array<ActionBase_Basic>;
6872 }
6873 if (LogManager.IsActionLogEnable())
6874 {
6875 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6876 }
6877
6878 if (action_array.Find(action) != -1)
6879 {
6880 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6881 }
6882 else
6883 {
6884 action_array.Insert(action);
6885 }
6886 }
6887
6889 {
6890 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6891 ActionBase action = player.GetActionManager().GetAction(actionName);
6894
6895 if (action_array)
6896 {
6897 action_array.RemoveItem(action);
6898 }
6899 }
6900
6901
6902
6904 {
6905 ActionOverrideData overrideData = new ActionOverrideData();
6909
6911 if (!actionMap)
6912 {
6915 }
6916
6917 actionMap.Insert(this.
Type(), overrideData);
6918
6919 }
6920
6922
6924
6925
6927 {
6930
6933
6934 string config_to_search = "CfgVehicles";
6935 string muzzle_owner_config;
6936
6938 {
6939 if (IsInherited(Weapon))
6940 config_to_search = "CfgWeapons";
6941
6942 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6943
6944 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6945
6946 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6947
6948 if (config_OnFire_subclass_count > 0)
6949 {
6950 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6951
6952 for (int i = 0; i < config_OnFire_subclass_count; i++)
6953 {
6954 string particle_class = "";
6955 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6956 string config_OnFire_entry = config_OnFire_class + particle_class;
6957 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6958 WPOF_array.Insert(WPOF);
6959 }
6960
6961
6963 }
6964 }
6965
6967 {
6968 config_to_search = "CfgWeapons";
6969 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6970
6971 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6972
6973 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6974
6975 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6976 {
6977 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6978
6979 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6980 {
6981 string particle_class2 = "";
6982 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6983 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6984 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6985 WPOBE_array.Insert(WPOBE);
6986 }
6987
6988
6990 }
6991 }
6992 }
6993
6994
6996 {
6999
7001 {
7002 string config_to_search = "CfgVehicles";
7003
7004 if (IsInherited(Weapon))
7005 config_to_search = "CfgWeapons";
7006
7007 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7008 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7009
7010 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7011 {
7012
7014
7016 {
7018 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7020 return;
7021 }
7022
7025
7026
7027
7028 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7029 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7030
7031 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7032 {
7033 string particle_class = "";
7034 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7035 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7036 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7037
7038 if (entry_type == CT_CLASS)
7039 {
7040 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7041 WPOOH_array.Insert(WPOF);
7042 }
7043 }
7044
7045
7047 }
7048 }
7049 }
7050
7052 {
7054 }
7055
7057 {
7059 {
7061
7064
7067
7068 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7069 }
7070 }
7071
7073 {
7075 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7076
7078 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7079
7081 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7082
7084 {
7086 }
7087 }
7088
7090 {
7092 }
7093
7095 {
7098 else
7100
7102 {
7105 }
7106 else
7107 {
7110
7113 }
7114
7116 }
7117
7119 {
7121 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7122 }
7123
7125 {
7127 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7129 }
7130
7132 {
7134 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7135 }
7136
7138 {
7141
7142 OverheatingParticle OP = new OverheatingParticle();
7147
7149 }
7150
7152 {
7155
7156 return -1;
7157 }
7158
7160 {
7162 {
7165
7166 for (int i = count; i > 0; --i)
7167 {
7168 int id = i - 1;
7171
7174
7175 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7176 {
7177 if (p)
7178 {
7181 }
7182 }
7183 }
7184 }
7185 }
7186
7188 {
7190 {
7192 {
7193 int id = i - 1;
7195
7196 if (OP)
7197 {
7199
7200 if (p)
7201 {
7203 }
7204
7205 delete OP;
7206 }
7207 }
7208
7211 }
7212 }
7213
7216 {
7217 return 0.0;
7218 }
7219
7220
7222 {
7223 return 250;
7224 }
7225
7227 {
7228 return 0;
7229 }
7230
7233 {
7235 return true;
7236
7237 return false;
7238 }
7239
7242 {
7245
7247 {
7249 }
7250 else
7251 {
7252
7254 }
7255
7257 }
7258
7265 {
7266 return -1;
7267 }
7268
7269
7270
7271
7273 {
7275 {
7276 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7277 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7278
7279 if (r_index >= 0)
7280 {
7281 InventoryLocation r_il = new InventoryLocation;
7282 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7283
7284 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7287 {
7288 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7289 }
7291 {
7292 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7293 }
7294
7295 }
7296
7297 player.GetHumanInventory().ClearUserReservedLocation(this);
7298 }
7299
7302 }
7303
7304
7305
7306
7308 {
7309 return ItemBase.m_DebugActionsMask;
7310 }
7311
7313 {
7314 return ItemBase.m_DebugActionsMask & mask;
7315 }
7316
7318 {
7319 ItemBase.m_DebugActionsMask = mask;
7320 }
7321
7323 {
7324 ItemBase.m_DebugActionsMask |= mask;
7325 }
7326
7328 {
7329 ItemBase.m_DebugActionsMask &= ~mask;
7330 }
7331
7333 {
7335 {
7337 }
7338 else
7339 {
7341 }
7342 }
7343
7344
7346 {
7347 if (GetEconomyProfile())
7348 {
7349 float q_max = GetEconomyProfile().GetQuantityMax();
7350 if (q_max > 0)
7351 {
7352 float q_min = GetEconomyProfile().GetQuantityMin();
7353 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7354
7356 {
7357 ComponentEnergyManager comp = GetCompEM();
7359 {
7361 }
7362 }
7364 {
7366
7367 }
7368
7369 }
7370 }
7371 }
7372
7375 {
7376 EntityAI parent = GetHierarchyParent();
7377
7378 if (parent)
7379 {
7380 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7381 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7382 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7383 }
7384 }
7385
7388 {
7389 EntityAI parent = GetHierarchyParent();
7390
7391 if (parent)
7392 {
7393 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7394 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7395 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7396 }
7397 }
7398
7400 {
7401
7402
7403
7404
7406
7408 {
7409 if (ScriptInputUserData.CanStoreInputUserData())
7410 {
7411 ScriptInputUserData ctx = new ScriptInputUserData;
7417 ctx.
Write(use_stack_max);
7420
7422 {
7423 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7424 }
7425 }
7426 }
7427 else if (!
g_Game.IsMultiplayer())
7428 {
7430 }
7431 }
7432
7434 {
7436 }
7437
7439 {
7441 }
7442
7444 {
7446 }
7447
7449 {
7450
7451 return false;
7452 }
7453
7455 {
7456 return false;
7457 }
7458
7462 {
7463 return false;
7464 }
7465
7467 {
7468 return "";
7469 }
7470
7472
7474 {
7475 return false;
7476 }
7477
7479 {
7480 return true;
7481 }
7482
7483
7484
7486 {
7487 return true;
7488 }
7489
7491 {
7492 return true;
7493 }
7494
7496 {
7497 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7499 }
7500
7502 {
7504 }
7505
7507 {
7509 if (!is_being_placed)
7511 SetSynchDirty();
7512 }
7513
7514
7516
7518 {
7520 }
7521
7523 {
7525 }
7526
7528 {
7529 return 1;
7530 }
7531
7533 {
7534 return false;
7535 }
7536
7538 {
7540 SetSynchDirty();
7541 }
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7557
7558
7559
7560
7561
7562
7563
7564
7565
7566
7567
7568
7569
7570
7571
7572
7573
7574
7575
7576
7578 {
7579 super.OnMovedInsideCargo(container);
7580
7581 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7582 }
7583
7584 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7585 {
7586 super.EEItemLocationChanged(oldLoc, newLoc);
7587
7588 PlayerBase newPlayer = null;
7589 PlayerBase oldPlayer = null;
7590
7591 if (newLoc.GetParent())
7592 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7593
7594 if (oldLoc.GetParent())
7595 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7596
7598 {
7599 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7600
7601 if (rIndex >= 0)
7602 {
7603 InventoryLocation rIl = new InventoryLocation;
7604 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7605
7606 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7609 {
7610 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7611 }
7613 {
7615 }
7616
7617 }
7618 }
7619
7621 {
7622 if (newPlayer)
7623 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7624
7625 if (newPlayer == oldPlayer)
7626 {
7627 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7628 {
7630 {
7631 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7632 {
7633 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7634 }
7635 }
7636 else
7637 {
7638 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7639 }
7640 }
7641
7642 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7643 {
7644 int type = oldLoc.GetType();
7646 {
7647 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7648 }
7650 {
7651 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7652 }
7653 }
7654 if (!m_OldLocation)
7655 {
7656 m_OldLocation = new InventoryLocation;
7657 }
7658 m_OldLocation.Copy(oldLoc);
7659 }
7660 else
7661 {
7662 if (m_OldLocation)
7663 {
7664 m_OldLocation.Reset();
7665 }
7666 }
7667
7668 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7669 }
7670 else
7671 {
7672 if (newPlayer)
7673 {
7674 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7675 if (resIndex >= 0)
7676 {
7677 InventoryLocation il = new InventoryLocation;
7678 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7680 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7683 {
7684 il.
GetParent().GetOnReleaseLock().Invoke(it);
7685 }
7687 {
7689 }
7690
7691 }
7692 }
7694 {
7695
7697 }
7698
7699 if (m_OldLocation)
7700 {
7701 m_OldLocation.Reset();
7702 }
7703 }
7704
7706 {
7707 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7708 }
7709
7711 {
7712 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7713 }
7714 }
7715
7716 override void EOnContact(IEntity other, Contact extra)
7717 {
7719 {
7720 int liquidType = -1;
7722 if (impactSpeed > 0.0)
7723 {
7725 #ifndef SERVER
7727 #else
7729 SetSynchDirty();
7730 #endif
7732 }
7733 }
7734
7735 #ifdef SERVER
7736 if (GetCompEM() && GetCompEM().IsPlugged())
7737 {
7738 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7739 GetCompEM().UnplugThis();
7740 }
7741 #endif
7742 }
7743
7745
7747 {
7749 }
7750
7752 {
7753
7754 }
7755
7757 {
7758 super.OnItemLocationChanged(old_owner, new_owner);
7759
7760 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7761 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7762
7763 if (!relatedPlayer && playerNew)
7764 relatedPlayer = playerNew;
7765
7766 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7767 {
7769 if (actionMgr)
7770 {
7771 ActionBase currentAction = actionMgr.GetRunningAction();
7772 if (currentAction)
7774 }
7775 }
7776
7777 Man ownerPlayerOld = null;
7778 Man ownerPlayerNew = null;
7779
7780 if (old_owner)
7781 {
7782 if (old_owner.
IsMan())
7783 {
7784 ownerPlayerOld = Man.Cast(old_owner);
7785 }
7786 else
7787 {
7788 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7789 }
7790 }
7791 else
7792 {
7794 {
7796
7797 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7798 {
7799 GetCompEM().UnplugThis();
7800 }
7801 }
7802 }
7803
7804 if (new_owner)
7805 {
7806 if (new_owner.
IsMan())
7807 {
7808 ownerPlayerNew = Man.Cast(new_owner);
7809 }
7810 else
7811 {
7812 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7813 }
7814 }
7815
7816 if (ownerPlayerOld != ownerPlayerNew)
7817 {
7818 if (ownerPlayerOld)
7819 {
7820 array<EntityAI> subItemsExit = new array<EntityAI>;
7822 for (int i = 0; i < subItemsExit.Count(); i++)
7823 {
7826 }
7827 }
7828
7829 if (ownerPlayerNew)
7830 {
7831 array<EntityAI> subItemsEnter = new array<EntityAI>;
7833 for (int j = 0; j < subItemsEnter.Count(); j++)
7834 {
7837 }
7838 }
7839 }
7840 else if (ownerPlayerNew != null)
7841 {
7842 PlayerBase nplayer;
7843 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7844 {
7845 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7847 for (int k = 0; k < subItemsUpdate.Count(); k++)
7848 {
7850 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7851 }
7852 }
7853 }
7854
7855 if (old_owner)
7856 old_owner.OnChildItemRemoved(this);
7857 if (new_owner)
7858 new_owner.OnChildItemReceived(this);
7859 }
7860
7861
7863 {
7864 super.EEDelete(parent);
7865 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7866 if (player)
7867 {
7869
7870 if (player.IsAlive())
7871 {
7872 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7873 if (r_index >= 0)
7874 {
7875 InventoryLocation r_il = new InventoryLocation;
7876 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7877
7878 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7881 {
7882 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7883 }
7885 {
7886 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7887 }
7888
7889 }
7890
7891 player.RemoveQuickBarEntityShortcut(this);
7892 }
7893 }
7894 }
7895
7897 {
7898 super.EEKilled(killer);
7899
7902 {
7903 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7904 {
7905 if (IsMagazine())
7906 {
7907 if (Magazine.Cast(this).GetAmmoCount() > 0)
7908 {
7910 }
7911 }
7912 else
7913 {
7915 }
7916 }
7917 }
7918 }
7919
7921 {
7922 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7923
7924 super.OnWasAttached(parent, slot_id);
7925
7928
7931 }
7932
7934 {
7935 super.OnWasDetached(parent, slot_id);
7936
7939
7942 }
7943
7945 {
7946 int idx;
7949
7950 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7951 if (inventory_slots.Count() < 1)
7952 {
7953 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7954 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7955 }
7956 else
7957 {
7958 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7959 }
7960
7961 idx = inventory_slots.Find(slot);
7962 if (idx < 0)
7963 return "";
7964
7965 return attach_types.Get(idx);
7966 }
7967
7969 {
7970 int idx = -1;
7971 string slot;
7972
7975
7976 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7977 if (inventory_slots.Count() < 1)
7978 {
7979 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7980 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7981 }
7982 else
7983 {
7984 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7985 if (detach_types.Count() < 1)
7986 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7987 }
7988
7989 for (int i = 0; i < inventory_slots.Count(); i++)
7990 {
7991 slot = inventory_slots.Get(i);
7992 }
7993
7994 if (slot != "")
7995 {
7996 if (detach_types.Count() == 1)
7997 idx = 0;
7998 else
7999 idx = inventory_slots.Find(slot);
8000 }
8001 if (idx < 0)
8002 return "";
8003
8004 return detach_types.Get(idx);
8005 }
8006
8008 {
8009
8011
8012
8013 float min_time = 1;
8014 float max_time = 3;
8015 float delay = Math.RandomFloat(min_time, max_time);
8016
8017 explode_timer.Run(delay, this, "DoAmmoExplosion");
8018 }
8019
8021 {
8022 Magazine magazine = Magazine.Cast(this);
8023 int pop_sounds_count = 6;
8024 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8025
8026
8027 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8028 string sound_name = pop_sounds[ sound_idx ];
8029 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8030
8031
8032 magazine.ServerAddAmmoCount(-1);
8033
8034
8035 float min_temp_to_explode = 100;
8036
8037 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8038 {
8040 }
8041 }
8042
8043
8044 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8045 {
8046 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8047
8048 const int CHANCE_DAMAGE_CARGO = 4;
8049 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8050 const int CHANCE_DAMAGE_NOTHING = 2;
8051
8053 {
8054 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8055 int chances;
8056 int rnd;
8057
8058 if (GetInventory().GetCargo())
8059 {
8060 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8061 rnd = Math.RandomInt(0,chances);
8062
8063 if (rnd < CHANCE_DAMAGE_CARGO)
8064 {
8066 }
8067 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8068 {
8070 }
8071 }
8072 else
8073 {
8074 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8075 rnd = Math.RandomInt(0,chances);
8076
8077 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8078 {
8080 }
8081 }
8082 }
8083 }
8084
8086 {
8087 CargoBase cargo = GetInventory().GetCargo();
8088 if (cargo)
8089 {
8091 if (item_count > 0)
8092 {
8093 int random_pick = Math.RandomInt(0, item_count);
8095 if (!item.IsExplosive())
8096 {
8097 item.AddHealth("","",damage);
8098 return true;
8099 }
8100 }
8101 }
8102 return false;
8103 }
8104
8106 {
8107 GameInventory inventory = GetInventory();
8109 if (attachment_count > 0)
8110 {
8111 int random_pick = Math.RandomInt(0, attachment_count);
8113 if (!attachment.IsExplosive())
8114 {
8115 attachment.AddHealth("","",damage);
8116 return true;
8117 }
8118 }
8119 return false;
8120 }
8121
8123 {
8125 }
8126
8128 {
8130 return GetInventory().CanRemoveEntity();
8131
8132 return false;
8133 }
8134
8136 {
8137
8139 return false;
8140
8141
8143 return false;
8144
8145
8146
8148 if (delta == 0)
8149 return false;
8150
8151
8152 return true;
8153 }
8154
8156 {
8158 {
8159 if (ScriptInputUserData.CanStoreInputUserData())
8160 {
8161 ScriptInputUserData ctx = new ScriptInputUserData;
8166 ctx.
Write(destination_entity);
8170 }
8171 }
8172 else if (!
g_Game.IsMultiplayer())
8173 {
8175 }
8176 }
8177
8179 {
8180 float split_quantity_new;
8184 InventoryLocation loc = new InventoryLocation;
8185
8186 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8187 {
8189 split_quantity_new = stack_max;
8190 else
8192
8194 {
8195 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8196 if (new_item)
8197 {
8198 new_item.SetResultOfSplit(true);
8199 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8201 new_item.
SetQuantity(split_quantity_new,
false,
true);
8202 }
8203 }
8204 }
8205 else if (destination_entity && slot_id == -1)
8206 {
8207 if (quantity > stack_max)
8208 split_quantity_new = stack_max;
8209 else
8210 split_quantity_new = quantity;
8211
8213 {
8214 GameInventory destinationInventory = destination_entity.GetInventory();
8216 {
8219 }
8220
8221 if (new_item)
8222 {
8223 new_item.SetResultOfSplit(true);
8224 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8226 new_item.
SetQuantity(split_quantity_new,
false,
true);
8227 }
8228 }
8229 }
8230 else
8231 {
8232 if (stack_max != 0)
8233 {
8235 {
8237 }
8238
8239 if (split_quantity_new == 0)
8240 {
8241 if (!
g_Game.IsMultiplayer())
8242 player.PhysicalPredictiveDropItem(this);
8243 else
8244 player.ServerDropEntity(this);
8245 return;
8246 }
8247
8249 {
8251
8252 if (new_item)
8253 {
8254 new_item.SetResultOfSplit(true);
8255 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8258 new_item.PlaceOnSurface();
8259 }
8260 }
8261 }
8262 }
8263 }
8264
8266 {
8267 float split_quantity_new;
8271 InventoryLocation loc = new InventoryLocation;
8272
8273 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8274 {
8276 split_quantity_new = stack_max;
8277 else
8279
8281 {
8282 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8283 if (new_item)
8284 {
8285 new_item.SetResultOfSplit(true);
8286 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8288 new_item.
SetQuantity(split_quantity_new,
false,
true);
8289 }
8290 }
8291 }
8292 else if (destination_entity && slot_id == -1)
8293 {
8294 if (quantity > stack_max)
8295 split_quantity_new = stack_max;
8296 else
8297 split_quantity_new = quantity;
8298
8300 {
8301 GameInventory destinationInventory = destination_entity.GetInventory();
8303 {
8306 }
8307
8308 if (new_item)
8309 {
8310 new_item.SetResultOfSplit(true);
8311 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8313 new_item.
SetQuantity(split_quantity_new,
false,
true);
8314 }
8315 }
8316 }
8317 else
8318 {
8319 if (stack_max != 0)
8320 {
8322 {
8324 }
8325
8327 {
8329
8330 if (new_item)
8331 {
8332 new_item.SetResultOfSplit(true);
8333 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8336 new_item.PlaceOnSurface();
8337 }
8338 }
8339 }
8340 }
8341 }
8342
8344 {
8346 {
8347 if (ScriptInputUserData.CanStoreInputUserData())
8348 {
8349 ScriptInputUserData ctx = new ScriptInputUserData;
8354 dst.WriteToContext(ctx);
8356 }
8357 }
8358 else if (!
g_Game.IsMultiplayer())
8359 {
8361 }
8362 }
8363
8365 {
8367 {
8368 if (ScriptInputUserData.CanStoreInputUserData())
8369 {
8370 ScriptInputUserData ctx = new ScriptInputUserData;
8375 ctx.
Write(destination_entity);
8381 }
8382 }
8383 else if (!
g_Game.IsMultiplayer())
8384 {
8386 }
8387 }
8388
8390 {
8392 }
8393
8395 {
8397 float split_quantity_new;
8399 if (dst.IsValid())
8400 {
8401 int slot_id = dst.GetSlot();
8403
8404 if (quantity > stack_max)
8405 split_quantity_new = stack_max;
8406 else
8407 split_quantity_new = quantity;
8408
8410 {
8412
8413 if (new_item)
8414 {
8415 new_item.SetResultOfSplit(true);
8416 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8418 new_item.
SetQuantity(split_quantity_new,
false,
true);
8419 }
8420
8421 return new_item;
8422 }
8423 }
8424
8425 return null;
8426 }
8427
8429 {
8431 float split_quantity_new;
8433 if (destination_entity)
8434 {
8436 if (quantity > stackable)
8437 split_quantity_new = stackable;
8438 else
8439 split_quantity_new = quantity;
8440
8442 {
8443 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8444 if (new_item)
8445 {
8446 new_item.SetResultOfSplit(true);
8447 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8449 new_item.
SetQuantity(split_quantity_new,
false,
true);
8450 }
8451 }
8452 }
8453 }
8454
8456 {
8458 {
8459 if (ScriptInputUserData.CanStoreInputUserData())
8460 {
8461 ScriptInputUserData ctx = new ScriptInputUserData;
8466 ItemBase destination_entity =
this;
8467 ctx.
Write(destination_entity);
8471 }
8472 }
8473 else if (!
g_Game.IsMultiplayer())
8474 {
8476 }
8477 }
8478
8480 {
8482 float split_quantity_new;
8484 if (player)
8485 {
8487 if (quantity > stackable)
8488 split_quantity_new = stackable;
8489 else
8490 split_quantity_new = quantity;
8491
8493 {
8494 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8495 new_item =
ItemBase.Cast(in_hands);
8496 if (new_item)
8497 {
8498 new_item.SetResultOfSplit(true);
8499 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8501 new_item.SetQuantity(split_quantity_new, false, true);
8502 }
8503 }
8504 }
8505 }
8506
8508 {
8510 float split_quantity_new = Math.Floor(quantity * 0.5);
8511
8513 return;
8514
8516
8517 if (new_item)
8518 {
8519 if (new_item.GetQuantityMax() < split_quantity_new)
8520 {
8521 split_quantity_new = new_item.GetQuantityMax();
8522 }
8523
8524 new_item.SetResultOfSplit(true);
8525 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8526
8528 {
8531 }
8532 else
8533 {
8535 new_item.
SetQuantity(split_quantity_new,
false,
true);
8536 }
8537 }
8538 }
8539
8541 {
8543 float split_quantity_new = Math.Floor(quantity / 2);
8544
8546 return;
8547
8548 InventoryLocation invloc = new InventoryLocation;
8550
8552 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8553
8554 if (new_item)
8555 {
8556 if (new_item.GetQuantityMax() < split_quantity_new)
8557 {
8558 split_quantity_new = new_item.GetQuantityMax();
8559 }
8561 {
8564 }
8565 else if (split_quantity_new > 1)
8566 {
8568 new_item.
SetQuantity(split_quantity_new,
false,
true);
8569 }
8570 }
8571 }
8572
8575 {
8576 SetWeightDirty();
8578
8579 if (parent)
8580 parent.OnAttachmentQuantityChangedEx(this, delta);
8581
8583 {
8585 {
8587 }
8589 {
8590 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8592 }
8593 }
8594 }
8595
8598 {
8599
8600 }
8601
8604 {
8606 }
8607
8609 {
8610 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8611
8613 {
8614 if (newLevel == GameConstants.STATE_RUINED)
8615 {
8617 EntityAI parent = GetHierarchyParent();
8618 if (parent && parent.IsFireplace())
8619 {
8620 CargoBase cargo = GetInventory().GetCargo();
8621 if (cargo)
8622 {
8624 {
8626 }
8627 }
8628 }
8629 }
8630
8632 {
8633
8635 return;
8636 }
8637
8638 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8639 {
8641 }
8642 }
8643 }
8644
8645
8647 {
8648 super.OnRightClick();
8649
8651 {
8653 {
8654 if (ScriptInputUserData.CanStoreInputUserData())
8655 {
8656 EntityAI root = GetHierarchyRoot();
8657 Man playerOwner = GetHierarchyRootPlayer();
8658 InventoryLocation dst = new InventoryLocation;
8659
8660
8661 if (!playerOwner && root && root == this)
8662 {
8664 }
8665 else
8666 {
8667
8668 GetInventory().GetCurrentInventoryLocation(dst);
8670 {
8671 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8673 {
8675 }
8676 else
8677 {
8679
8680
8681 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8682 {
8684 }
8685 else
8686 {
8687 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8688 }
8689 }
8690 }
8691 }
8692
8693 ScriptInputUserData ctx = new ScriptInputUserData;
8701 }
8702 }
8703 else if (!
g_Game.IsMultiplayer())
8704 {
8706 }
8707 }
8708 }
8709
8711 {
8712 if (root)
8713 {
8714 vector m4[4];
8715 root.GetTransform(m4);
8716 dst.SetGround(this, m4);
8717 }
8718 else
8719 {
8720 GetInventory().GetCurrentInventoryLocation(dst);
8721 }
8722 }
8723
8724 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8725 {
8726
8727 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8728 return false;
8729
8730 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8731 return false;
8732
8733
8735 return false;
8736
8737
8738 Magazine mag = Magazine.Cast(this);
8739 if (mag)
8740 {
8741 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8742 return false;
8743
8744 if (stack_max_limit)
8745 {
8746 Magazine other_mag = Magazine.Cast(other_item);
8747 if (other_item)
8748 {
8749 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8750 return false;
8751 }
8752
8753 }
8754 }
8755 else
8756 {
8757
8759 return false;
8760
8762 return false;
8763 }
8764
8765 PlayerBase player = null;
8766 if (CastTo(player, GetHierarchyRootPlayer()))
8767 {
8768 if (player.GetInventory().HasAttachment(this))
8769 return false;
8770
8771 if (player.IsItemsToDelete())
8772 return false;
8773 }
8774
8775 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8776 return false;
8777
8778 int slotID;
8780 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8781 return false;
8782
8783 return true;
8784 }
8785
8787 {
8789 }
8790
8792 {
8793 return m_IsResultOfSplit;
8794 }
8795
8797 {
8798 m_IsResultOfSplit = value;
8799 }
8800
8802 {
8804 }
8805
8807 {
8808 float other_item_quantity = other_item.GetQuantity();
8809 float this_free_space;
8810
8812
8814
8815 if (other_item_quantity > this_free_space)
8816 {
8817 return this_free_space;
8818 }
8819 else
8820 {
8821 return other_item_quantity;
8822 }
8823 }
8824
8826 {
8828 }
8829
8831 {
8833 return;
8834
8835 if (!IsMagazine() && other_item)
8836 {
8838 if (quantity_used != 0)
8839 {
8840 float hp1 = GetHealth01("","");
8841 float hp2 = other_item.GetHealth01("","");
8842 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8843 hpResult = hpResult / (
GetQuantity() + quantity_used);
8844
8845 hpResult *= GetMaxHealth();
8846 Math.Round(hpResult);
8847 SetHealth("", "Health", hpResult);
8848
8850 other_item.AddQuantity(-quantity_used);
8851 }
8852 }
8854 }
8855
8857 {
8858 #ifdef SERVER
8859 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8860 GetHierarchyParent().IncreaseLifetimeUp();
8861 #endif
8862 };
8863
8865 {
8866 PlayerBase p = PlayerBase.Cast(player);
8867
8868 array<int> recipesIds = p.m_Recipes;
8869 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8870 if (moduleRecipesManager)
8871 {
8872 EntityAI itemInHands = player.GetEntityInHands();
8873 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8874 }
8875
8876 for (int i = 0;i < recipesIds.Count(); i++)
8877 {
8878 int key = recipesIds.Get(i);
8879 string recipeName = moduleRecipesManager.GetRecipeName(key);
8881 }
8882 }
8883
8884
8885 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8886 {
8887 super.GetDebugActions(outputList);
8888
8889
8895
8896
8901
8906
8907
8911
8912
8914 {
8918 }
8919
8922
8923
8927
8929
8930 InventoryLocation loc = new InventoryLocation();
8931 GetInventory().GetCurrentInventoryLocation(loc);
8933 {
8934 if (Gizmo_IsSupported())
8937 }
8938
8940 }
8941
8942
8943
8944
8946 {
8947 super.OnAction(action_id, player, ctx);
8948
8950 {
8951 switch (action_id)
8952 {
8956 return true;
8960 return true;
8961 }
8962 }
8963
8965 {
8966 switch (action_id)
8967 {
8969 Delete();
8970 return true;
8971 }
8972 }
8973
8974 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8975 {
8976 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8977 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8978 PlayerBase p = PlayerBase.Cast(player);
8979 if (
EActions.RECIPES_RANGE_START < 1000)
8980 {
8981 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8982 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8983 }
8984 }
8985 #ifndef SERVER
8986 else if (action_id ==
EActions.WATCH_PLAYER)
8987 {
8988 PluginDeveloper.SetDeveloperItemClientEx(player);
8989 }
8990 #endif
8992 {
8993 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8994 {
8995 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8996 OnDebugButtonPressServer(id + 1);
8997 }
8998
8999 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9000 {
9001 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9003 }
9004
9005 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9006 {
9007 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9009 }
9010
9011 else if (action_id ==
EActions.ADD_QUANTITY)
9012 {
9013 if (IsMagazine())
9014 {
9015 Magazine mag = Magazine.Cast(this);
9016 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9017 }
9018 else
9019 {
9021 }
9022
9023 if (m_EM)
9024 {
9025 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9026 }
9027
9028 }
9029
9030 else if (action_id ==
EActions.REMOVE_QUANTITY)
9031 {
9032 if (IsMagazine())
9033 {
9034 Magazine mag2 = Magazine.Cast(this);
9035 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9036 }
9037 else
9038 {
9040 }
9041 if (m_EM)
9042 {
9043 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9044 }
9045
9046 }
9047
9048 else if (action_id ==
EActions.SET_QUANTITY_0)
9049 {
9051
9052 if (m_EM)
9053 {
9054 m_EM.SetEnergy(0);
9055 }
9056 }
9057
9058 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9059 {
9061
9062 if (m_EM)
9063 {
9064 m_EM.SetEnergy(m_EM.GetEnergyMax());
9065 }
9066 }
9067
9068 else if (action_id ==
EActions.ADD_HEALTH)
9069 {
9070 AddHealth("","",GetMaxHealth("","Health")/5);
9071 }
9072 else if (action_id ==
EActions.REMOVE_HEALTH)
9073 {
9074 AddHealth("","",-GetMaxHealth("","Health")/5);
9075 }
9076 else if (action_id ==
EActions.DESTROY_HEALTH)
9077 {
9078 SetHealth01("","",0);
9079 }
9080 else if (action_id ==
EActions.WATCH_ITEM)
9081 {
9083 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9084 #ifdef DEVELOPER
9085 SetDebugDeveloper_item(this);
9086 #endif
9087 }
9088
9089 else if (action_id ==
EActions.ADD_TEMPERATURE)
9090 {
9091 AddTemperature(20);
9092
9093 }
9094
9095 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9096 {
9097 AddTemperature(-20);
9098
9099 }
9100
9101 else if (action_id ==
EActions.FLIP_FROZEN)
9102 {
9103 SetFrozen(!GetIsFrozen());
9104
9105 }
9106
9107 else if (action_id ==
EActions.ADD_WETNESS)
9108 {
9110
9111 }
9112
9113 else if (action_id ==
EActions.REMOVE_WETNESS)
9114 {
9116
9117 }
9118
9119 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9120 {
9123
9124
9125 }
9126
9127 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9128 {
9131 }
9132
9133 else if (action_id ==
EActions.MAKE_SPECIAL)
9134 {
9135 auto debugParams = DebugSpawnParams.WithPlayer(player);
9136 OnDebugSpawnEx(debugParams);
9137 }
9138
9139 }
9140
9141
9142 return false;
9143 }
9144
9145
9146
9147
9151
9154
9155
9156
9158 {
9159 return false;
9160 }
9161
9162
9164 {
9165 return true;
9166 }
9167
9168
9170 {
9171 return true;
9172 }
9173
9174
9175
9177 {
9178 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9179 return g_Game.ConfigIsExisting(config_path);
9180 }
9181
9184 {
9185 return null;
9186 }
9187
9189 {
9190 return false;
9191 }
9192
9194 {
9195 return false;
9196 }
9197
9201
9202
9204 {
9205 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9206 return module_repairing.CanRepair(this, item_repair_kit);
9207 }
9208
9209
9210 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9211 {
9212 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9213 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9214 }
9215
9216
9218 {
9219
9220
9221
9222
9223
9224
9225
9226
9227 return 1;
9228 }
9229
9230
9231
9233 {
9235 }
9236
9237
9238
9240 {
9242 }
9243
9244
9253 {
9254 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9255
9256 if (player)
9257 {
9258 player.MessageStatus(text);
9259 }
9260 }
9261
9262
9271 {
9272 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9273
9274 if (player)
9275 {
9276 player.MessageAction(text);
9277 }
9278 }
9279
9280
9289 {
9290 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9291
9292 if (player)
9293 {
9294 player.MessageFriendly(text);
9295 }
9296 }
9297
9298
9307 {
9308 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9309
9310 if (player)
9311 {
9312 player.MessageImportant(text);
9313 }
9314 }
9315
9317 {
9318 return true;
9319 }
9320
9321
9322 override bool KindOf(
string tag)
9323 {
9324 bool found = false;
9325 string item_name = this.
GetType();
9327 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9328
9329 int array_size = item_tag_array.Count();
9330 for (int i = 0; i < array_size; i++)
9331 {
9332 if (item_tag_array.Get(i) == tag)
9333 {
9334 found = true;
9335 break;
9336 }
9337 }
9338 return found;
9339 }
9340
9341
9343 {
9344
9345 super.OnRPC(sender, rpc_type,ctx);
9346
9347
9348 switch (rpc_type)
9349 {
9350 #ifndef SERVER
9351 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9352 Param2<bool, string> p = new Param2<bool, string>(false, "");
9353
9355 return;
9356
9357 bool play = p.param1;
9358 string soundSet = p.param2;
9359
9360 if (play)
9361 {
9363 {
9365 {
9367 }
9368 }
9369 else
9370 {
9372 }
9373 }
9374 else
9375 {
9377 }
9378
9379 break;
9380 #endif
9381
9382 }
9383
9385 {
9387 }
9388 }
9389
9390
9391
9392
9394 {
9395 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9396 return plugin.GetID(
name);
9397 }
9398
9400 {
9401 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9402 return plugin.GetName(id);
9403 }
9404
9407 {
9408
9409
9410 int varFlags;
9411 if (!ctx.
Read(varFlags))
9412 return;
9413
9414 if (varFlags & ItemVariableFlags.FLOAT)
9415 {
9417 }
9418 }
9419
9421 {
9422
9423 super.SerializeNumericalVars(floats_out);
9424
9425
9426
9428 {
9430 }
9431
9433 {
9435 }
9436
9438 {
9440 }
9441
9443 {
9448 }
9449
9451 {
9453 }
9454 }
9455
9457 {
9458
9459 super.DeSerializeNumericalVars(floats);
9460
9461
9462 int index = 0;
9463 int mask = Math.Round(floats.Get(index));
9464
9465 index++;
9466
9468 {
9470 {
9472 }
9473 else
9474 {
9475 float quantity = floats.Get(index);
9477 }
9478 index++;
9479 }
9480
9482 {
9483 float wet = floats.Get(index);
9485 index++;
9486 }
9487
9489 {
9490 int liquidtype = Math.Round(floats.Get(index));
9492 index++;
9493 }
9494
9496 {
9498 index++;
9500 index++;
9502 index++;
9504 index++;
9505 }
9506
9508 {
9509 int cleanness = Math.Round(floats.Get(index));
9511 index++;
9512 }
9513 }
9514
9516 {
9517 super.WriteVarsToCTX(ctx);
9518
9519
9521 {
9523 }
9524
9526 {
9528 }
9529
9531 {
9533 }
9534
9536 {
9537 int r,g,b,a;
9543 }
9544
9546 {
9548 }
9549 }
9550
9552 {
9553 if (!super.ReadVarsFromCTX(ctx,version))
9554 return false;
9555
9556 int intValue;
9557 float value;
9558
9559 if (version < 140)
9560 {
9561 if (!ctx.
Read(intValue))
9562 return false;
9563
9564 m_VariablesMask = intValue;
9565 }
9566
9568 {
9569 if (!ctx.
Read(value))
9570 return false;
9571
9573 {
9575 }
9576 else
9577 {
9579 }
9580 }
9581
9582 if (version < 140)
9583 {
9585 {
9586 if (!ctx.
Read(value))
9587 return false;
9588 SetTemperatureDirect(value);
9589 }
9590 }
9591
9593 {
9594 if (!ctx.
Read(value))
9595 return false;
9597 }
9598
9600 {
9601 if (!ctx.
Read(intValue))
9602 return false;
9604 }
9605
9607 {
9608 int r,g,b,a;
9610 return false;
9612 return false;
9614 return false;
9616 return false;
9617
9619 }
9620
9622 {
9623 if (!ctx.
Read(intValue))
9624 return false;
9626 }
9627
9628 if (version >= 138 && version < 140)
9629 {
9631 {
9632 if (!ctx.
Read(intValue))
9633 return false;
9634 SetFrozen(intValue);
9635 }
9636 }
9637
9638 return true;
9639 }
9640
9641
9643 {
9646 {
9648 }
9649
9650 if (!super.OnStoreLoad(ctx, version))
9651 {
9653 return false;
9654 }
9655
9656 if (version >= 114)
9657 {
9658 bool hasQuickBarIndexSaved;
9659
9660 if (!ctx.
Read(hasQuickBarIndexSaved))
9661 {
9663 return false;
9664 }
9665
9666 if (hasQuickBarIndexSaved)
9667 {
9668 int itmQBIndex;
9669
9670
9671 if (!ctx.
Read(itmQBIndex))
9672 {
9674 return false;
9675 }
9676
9677 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9678 if (itmQBIndex != -1 && parentPlayer)
9679 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9680 }
9681 }
9682 else
9683 {
9684
9685 PlayerBase player;
9686 int itemQBIndex;
9687 if (version ==
int.
MAX)
9688 {
9689 if (!ctx.
Read(itemQBIndex))
9690 {
9692 return false;
9693 }
9694 }
9695 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9696 {
9697
9698 if (!ctx.
Read(itemQBIndex))
9699 {
9701 return false;
9702 }
9703 if (itemQBIndex != -1 && player)
9704 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9705 }
9706 }
9707
9708 if (version < 140)
9709 {
9710
9711 if (!LoadVariables(ctx, version))
9712 {
9714 return false;
9715 }
9716 }
9717
9718
9720 {
9722 return false;
9723 }
9724 if (version >= 132)
9725 {
9727 if (raib)
9728 {
9730 {
9732 return false;
9733 }
9734 }
9735 }
9736
9738 return true;
9739 }
9740
9741
9742
9744 {
9745 super.OnStoreSave(ctx);
9746
9747 PlayerBase player;
9748 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9749 {
9751
9752 int itemQBIndex = -1;
9753 itemQBIndex = player.FindQuickBarEntityIndex(this);
9754 ctx.
Write(itemQBIndex);
9755 }
9756 else
9757 {
9759 }
9760
9762
9764 if (raib)
9765 {
9767 }
9768 }
9769
9770
9772 {
9773 super.AfterStoreLoad();
9774
9776 {
9778 }
9779
9781 {
9784 }
9785 }
9786
9788 {
9789 super.EEOnAfterLoad();
9790
9792 {
9794 }
9795
9798 }
9799
9801 {
9802 return false;
9803 }
9804
9805
9806
9808 {
9810 {
9811 #ifdef PLATFORM_CONSOLE
9812
9814 {
9816 if (menu)
9817 {
9819 }
9820 }
9821 #endif
9822 }
9823
9825 {
9828 }
9829
9831 {
9832 SetWeightDirty();
9834 }
9836 {
9839 }
9840
9842 {
9845
9848 }
9850 {
9854 }
9855
9856 super.OnVariablesSynchronized();
9857 }
9858
9859
9860
9862 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9863 {
9864 if (!IsServerCheck(allow_client))
9865 return false;
9866
9868 return false;
9869
9872
9873 if (value <= (min + 0.001))
9874 value = min;
9875
9876 if (value == min)
9877 {
9878 if (destroy_config)
9879 {
9880 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9881 if (dstr)
9882 {
9884 this.Delete();
9885 return true;
9886 }
9887 }
9888 else if (destroy_forced)
9889 {
9891 this.Delete();
9892 return true;
9893 }
9894
9896 }
9897
9900
9902 {
9903 EntityAI parent = GetHierarchyRoot();
9904 InventoryLocation iLoc = new InventoryLocation();
9905 GetInventory().GetCurrentInventoryLocation(iLoc);
9907 {
9908 int iLocSlot = iLoc.
GetSlot();
9910 {
9912 }
9914 {
9916 }
9917 }
9918 }
9919
9921 {
9923
9924 if (delta)
9926 }
9927
9929
9930 return false;
9931 }
9932
9933
9935 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9936 {
9938 }
9939
9941 {
9944 }
9945
9947 {
9950 }
9951
9953 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9954 {
9955 float value_clamped = Math.Clamp(value, 0, 1);
9957 SetQuantity(result, destroy_config, destroy_forced);
9958 }
9959
9960
9963 {
9965 }
9966
9968 {
9970 }
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9982 {
9983 int slot = -1;
9984 GameInventory inventory = GetInventory();
9985 if (inventory)
9986 {
9987 InventoryLocation il = new InventoryLocation;
9990 }
9991
9993 }
9994
9996 {
9997 float quantity_max = 0;
9998
10000 {
10001 if (attSlotID != -1)
10002 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10003
10004 if (quantity_max <= 0)
10006 }
10007
10008 if (quantity_max <= 0)
10010
10011 return quantity_max;
10012 }
10013
10015 {
10017 }
10018
10020 {
10022 }
10023
10024
10026 {
10028 }
10029
10031 {
10033 }
10034
10036 {
10038 }
10039
10040
10042 {
10043
10044 float weightEx = GetWeightEx();
10045 float special = GetInventoryAndCargoWeight();
10046 return weightEx - special;
10047 }
10048
10049
10051 {
10053 }
10054
10056 {
10058 {
10059 #ifdef DEVELOPER
10060 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10061 {
10062 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10064 }
10065 #endif
10066
10067 return GetQuantity() * GetConfigWeightModified();
10068 }
10069 else if (HasEnergyManager())
10070 {
10071 #ifdef DEVELOPER
10072 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10073 {
10074 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10075 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10076 }
10077 #endif
10078 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10079 }
10080 else
10081 {
10082 #ifdef DEVELOPER
10083 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10084 {
10085 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10086 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10087 }
10088 #endif
10089 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10090 }
10091 }
10092
10095 {
10096 int item_count = 0;
10098
10099 GameInventory inventory = GetInventory();
10100 CargoBase cargo = inventory.
GetCargo();
10101 if (cargo != NULL)
10102 {
10104 }
10105
10107 for (int i = 0; i < nAttachments; ++i)
10108 {
10110 if (item)
10111 item_count += item.GetNumberOfItems();
10112 }
10113 return item_count;
10114 }
10115
10118 {
10119 float weight = 0;
10120 float wetness = 1;
10121 if (include_wetness)
10124 {
10125 weight = wetness * m_ConfigWeight;
10126 }
10128 {
10129 weight = 1;
10130 }
10131 return weight;
10132 }
10133
10134
10135
10137 {
10138 GameInventory inventory = GetInventory();
10139 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10140 {
10141 array<EntityAI> items = new array<EntityAI>;
10143 for (int i = 0; i < items.Count(); ++i)
10144 {
10146 if (item)
10147 {
10148 g_Game.ObjectDelete(item);
10149 }
10150 }
10151 }
10152 }
10153
10154
10155
10156
10158 {
10159 float energy = 0;
10160 if (HasEnergyManager())
10161 {
10162 energy = GetCompEM().GetEnergy();
10163 }
10164 return energy;
10165 }
10166
10167
10169 {
10170 super.OnEnergyConsumed();
10171
10173 }
10174
10176 {
10177 super.OnEnergyAdded();
10178
10180 }
10181
10182
10184 {
10185 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10186 {
10188 {
10189 float energy_0to1 = GetCompEM().GetEnergy0To1();
10191 }
10192 }
10193 }
10194
10195
10197 {
10198 return ConfigGetFloat("heatIsolation");
10199 }
10200
10202 {
10204 }
10205
10207 {
10208 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10209 if (
g_Game.ConfigIsExisting(paramPath))
10210 return g_Game.ConfigGetFloat(paramPath);
10211
10212 return 0.0;
10213 }
10214
10216 {
10217 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10218 if (
g_Game.ConfigIsExisting(paramPath))
10219 return g_Game.ConfigGetFloat(paramPath);
10220
10221 return 0.0;
10222 }
10223
10224 override void SetWet(
float value,
bool allow_client =
false)
10225 {
10226 if (!IsServerCheck(allow_client))
10227 return;
10228
10231
10233
10234 m_VarWet = Math.Clamp(value, min, max);
10235
10237 {
10240 }
10241 }
10242
10243 override void AddWet(
float value)
10244 {
10246 }
10247
10249 {
10251 }
10252
10254 {
10256 }
10257
10259 {
10261 }
10262
10264 {
10266 }
10267
10269 {
10271 }
10272
10273 override void OnWetChanged(
float newVal,
float oldVal)
10274 {
10277 if (newLevel != oldLevel)
10278 {
10280 }
10281 }
10282
10284 {
10285 SetWeightDirty();
10286 }
10287
10289 {
10290 return GetWetLevelInternal(
m_VarWet);
10291 }
10292
10293
10294
10296 {
10298 }
10299
10301 {
10303 }
10304
10306 {
10308 }
10309
10311 {
10313 }
10314
10315
10316
10318 {
10319 if (ConfigIsExisting("itemModelLength"))
10320 {
10321 return ConfigGetFloat("itemModelLength");
10322 }
10323 return 0;
10324 }
10325
10327 {
10328 if (ConfigIsExisting("itemAttachOffset"))
10329 {
10330 return ConfigGetFloat("itemAttachOffset");
10331 }
10332 return 0;
10333 }
10334
10335 override void SetCleanness(
int value,
bool allow_client =
false)
10336 {
10337 if (!IsServerCheck(allow_client))
10338 return;
10339
10341
10343
10346 }
10347
10349 {
10351 }
10352
10354 {
10355 return true;
10356 }
10357
10358
10359
10360
10362 {
10364 }
10365
10367 {
10369 }
10370
10371
10372
10373
10374 override void SetColor(
int r,
int g,
int b,
int a)
10375 {
10381 }
10383 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10384 {
10389 }
10390
10392 {
10394 }
10395
10398 {
10399 int r,g,b,a;
10401 r = r/255;
10402 g = g/255;
10403 b = b/255;
10404 a = a/255;
10405 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10406 }
10407
10408
10409
10410 override void SetLiquidType(
int value,
bool allow_client =
false)
10411 {
10412 if (!IsServerCheck(allow_client))
10413 return;
10414
10419 }
10420
10422 {
10423 return ConfigGetInt("varLiquidTypeInit");
10424 }
10425
10427 {
10429 }
10430
10432 {
10434 SetFrozen(false);
10435 }
10436
10439 {
10440 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10441 }
10442
10443
10446 {
10447 PlayerBase nplayer;
10448 if (PlayerBase.CastTo(nplayer, player))
10449 {
10451 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10452 }
10453 }
10454
10455
10458 {
10459 PlayerBase nplayer;
10460 if (PlayerBase.CastTo(nplayer,player))
10461 {
10462 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10463 }
10464
10465 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10466
10467 if (HasEnergyManager())
10468 {
10469 GetCompEM().UpdatePlugState();
10470 }
10471 }
10472
10473
10475 {
10476 super.OnPlacementStarted(player);
10477
10479 }
10480
10481 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10482 {
10484 {
10485 m_AdminLog.OnPlacementComplete(player,
this);
10486 }
10487
10488 super.OnPlacementComplete(player, position, orientation);
10489 }
10490
10491
10492
10493
10494
10496 {
10498 {
10499 return true;
10500 }
10501 else
10502 {
10503 return false;
10504 }
10505 }
10506
10507
10509 {
10511 {
10513 }
10514 }
10515
10516
10518 {
10520 }
10521
10523 {
10525 }
10526
10527 override void InsertAgent(
int agent,
float count = 1)
10528 {
10529 if (count < 1)
10530 return;
10531
10533 }
10534
10537 {
10539 }
10540
10541
10543 {
10545 }
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10589 {
10591 return false;
10592 return true;
10593 }
10594
10596 {
10597
10599 }
10600
10601
10604 {
10605 super.CheckForRoofLimited(timeTresholdMS);
10606
10607 float time =
g_Game.GetTime();
10608 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10609 {
10610 m_PreviousRoofTestTime = time;
10611 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10612 }
10613 }
10614
10615
10617 {
10619 {
10620 return 0;
10621 }
10622
10623 if (GetInventory().GetAttachmentSlotsCount() != 0)
10624 {
10625 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10626 if (filter)
10627 return filter.GetProtectionLevel(type, false, system);
10628 else
10629 return 0;
10630 }
10631
10632 string subclassPath, entryName;
10633
10634 switch (type)
10635 {
10637 entryName = "biological";
10638 break;
10640 entryName = "chemical";
10641 break;
10642 default:
10643 entryName = "biological";
10644 break;
10645 }
10646
10647 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10648
10649 return g_Game.ConfigGetFloat(subclassPath + entryName);
10650 }
10651
10652
10653
10656 {
10657 if (!IsMagazine())
10659
10661 }
10662
10663
10664
10665
10666
10671 {
10672 return true;
10673 }
10674
10676 {
10678 }
10679
10680
10681
10682
10683
10685 {
10686 if (parent)
10687 {
10688 if (parent.IsInherited(DayZInfected))
10689 return true;
10690
10691 if (!parent.IsRuined())
10692 return true;
10693 }
10694
10695 return true;
10696 }
10697
10699 {
10700 if (!super.CanPutAsAttachment(parent))
10701 {
10702 return false;
10703 }
10704
10705 if (!IsRuined() && !parent.IsRuined())
10706 {
10707 return true;
10708 }
10709
10710 return false;
10711 }
10712
10714 {
10715
10716
10717
10718
10719 return super.CanReceiveItemIntoCargo(item);
10720 }
10721
10723 {
10724
10725
10726
10727
10728 GameInventory attachmentInv = attachment.GetInventory();
10730 {
10731 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10732 return false;
10733 }
10734
10735 InventoryLocation loc = new InventoryLocation();
10736 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10737 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10738 return false;
10739
10740 return super.CanReceiveAttachment(attachment, slotId);
10741 }
10742
10744 {
10745 if (!super.CanReleaseAttachment(attachment))
10746 return false;
10747
10748 return GetInventory().AreChildrenAccessible();
10749 }
10750
10751
10752
10753
10754
10755
10756
10757
10758
10759
10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
10770
10772 {
10773 int id = muzzle_owner.GetMuzzleID();
10774 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10775
10776 if (WPOF_array)
10777 {
10778 for (int i = 0; i < WPOF_array.Count(); i++)
10779 {
10780 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10781
10782 if (WPOF)
10783 {
10784 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10785 }
10786 }
10787 }
10788 }
10789
10790
10792 {
10793 int id = muzzle_owner.GetMuzzleID();
10795
10796 if (WPOBE_array)
10797 {
10798 for (int i = 0; i < WPOBE_array.Count(); i++)
10799 {
10800 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10801
10802 if (WPOBE)
10803 {
10804 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10805 }
10806 }
10807 }
10808 }
10809
10810
10812 {
10813 int id = muzzle_owner.GetMuzzleID();
10814 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10815
10816 if (WPOOH_array)
10817 {
10818 for (int i = 0; i < WPOOH_array.Count(); i++)
10819 {
10820 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10821
10822 if (WPOOH)
10823 {
10824 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10825 }
10826 }
10827 }
10828 }
10829
10830
10832 {
10833 int id = muzzle_owner.GetMuzzleID();
10834 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10835
10836 if (WPOOH_array)
10837 {
10838 for (int i = 0; i < WPOOH_array.Count(); i++)
10839 {
10840 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10841
10842 if (WPOOH)
10843 {
10844 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10845 }
10846 }
10847 }
10848 }
10849
10850
10852 {
10853 int id = muzzle_owner.GetMuzzleID();
10854 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10855
10856 if (WPOOH_array)
10857 {
10858 for (int i = 0; i < WPOOH_array.Count(); i++)
10859 {
10860 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10861
10862 if (WPOOH)
10863 {
10864 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10865 }
10866 }
10867 }
10868 }
10869
10870
10871
10873 {
10875 {
10876 return true;
10877 }
10878
10879 return false;
10880 }
10881
10883 {
10885 {
10886 return true;
10887 }
10888
10889 return false;
10890 }
10891
10893 {
10895 {
10896 return true;
10897 }
10898
10899 return false;
10900 }
10901
10903 {
10904 return false;
10905 }
10906
10909 {
10910 return UATimeSpent.DEFAULT_DEPLOY;
10911 }
10912
10913
10914
10915
10917 {
10919 SetSynchDirty();
10920 }
10921
10923 {
10925 }
10926
10927
10929 {
10930 return false;
10931 }
10932
10935 {
10936 string att_type = "None";
10937
10938 if (ConfigIsExisting("soundAttType"))
10939 {
10940 att_type = ConfigGetString("soundAttType");
10941 }
10942
10944 }
10945
10947 {
10949 }
10950
10951
10952
10953
10954
10960
10962 {
10965
10967 }
10968
10969
10971 {
10973 return;
10974
10976
10979
10982
10983 SoundParameters params = new SoundParameters();
10987 }
10988
10989
10991 {
10993 {
10996
10997 SetSynchDirty();
10998
11001 }
11002 }
11003
11005 {
11007 }
11008
11009
11011 {
11013 return;
11014
11016 SetSynchDirty();
11017
11020 }
11021
11023 {
11026 }
11027
11029 {
11031 }
11032
11033 void OnApply(PlayerBase player);
11034
11036 {
11037 return 1.0;
11038 };
11039
11041 {
11043 }
11044
11046 {
11048 }
11049
11051
11053 {
11054 SetDynamicPhysicsLifeTime(0.01);
11056 }
11057
11059 {
11060 array<string> zone_names = new array<string>;
11061 GetDamageZones(zone_names);
11062 for (int i = 0; i < zone_names.Count(); i++)
11063 {
11064 SetHealthMax(zone_names.Get(i),"Health");
11065 }
11066 SetHealthMax("","Health");
11067 }
11068
11071 {
11072 float global_health = GetHealth01("","Health");
11073 array<string> zones = new array<string>;
11074 GetDamageZones(zones);
11075
11076 for (int i = 0; i < zones.Count(); i++)
11077 {
11078 SetHealth01(zones.Get(i),"Health",global_health);
11079 }
11080 }
11081
11084 {
11085 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11086 }
11087
11089 {
11090 if (!hasRootAsPlayer)
11091 {
11092 if (refParentIB)
11093 {
11094
11095 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11096 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11097
11098 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11099 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11100
11103 }
11104 else
11105 {
11106
11109 }
11110 }
11111 }
11112
11114 {
11116 {
11117 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11118 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11119 {
11120 float heatPermCoef = 1.0;
11122 while (ent)
11123 {
11124 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11125 ent = ent.GetHierarchyParent();
11126 }
11127
11128 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11129 }
11130 }
11131 }
11132
11134 {
11135
11136 EntityAI parent = GetHierarchyParent();
11137 if (!parent)
11138 {
11139 hasParent = false;
11140 hasRootAsPlayer = false;
11141 }
11142 else
11143 {
11144 hasParent = true;
11145 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11146 refParentIB =
ItemBase.Cast(parent);
11147 }
11148 }
11149
11150 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11151 {
11152
11153 }
11154
11156 {
11157
11158 return false;
11159 }
11160
11162 {
11163
11164
11165 return false;
11166 }
11167
11169 {
11170
11171 return false;
11172 }
11173
11176 {
11177 return !GetIsFrozen() &&
IsOpen();
11178 }
11179
11181 {
11182 bool hasParent = false, hasRootAsPlayer = false;
11184
11185 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11186 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11187
11188 if (wwtu || foodDecay)
11189 {
11193
11194 if (processWetness || processTemperature || processDecay)
11195 {
11197
11198 if (processWetness)
11199 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11200
11201 if (processTemperature)
11203
11204 if (processDecay)
11205 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11206 }
11207 }
11208 }
11209
11212 {
11214 }
11215
11217 {
11220
11221 return super.GetTemperatureFreezeThreshold();
11222 }
11223
11225 {
11228
11229 return super.GetTemperatureThawThreshold();
11230 }
11231
11233 {
11236
11237 return super.GetItemOverheatThreshold();
11238 }
11239
11241 {
11243 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11244
11245 return super.GetTemperatureFreezeTime();
11246 }
11247
11249 {
11251 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11252
11253 return super.GetTemperatureThawTime();
11254 }
11255
11260
11262 {
11263 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11264 }
11265
11267 {
11268 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11269 }
11270
11273 {
11275 }
11276
11278 {
11280 }
11281
11283 {
11285 }
11286
11289 {
11290 return null;
11291 }
11292
11295 {
11296 return false;
11297 }
11298
11300 {
11302 {
11305 if (!trg)
11306 {
11308 explosive = this;
11309 }
11310
11311 explosive.PairRemote(trg);
11313
11314 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11315 trg.SetPersistentPairID(persistentID);
11316 explosive.SetPersistentPairID(persistentID);
11317
11318 return true;
11319 }
11320 return false;
11321 }
11322
11325 {
11326 float ret = 1.0;
11329 ret *= GetHealth01();
11330
11331 return ret;
11332 }
11333
11334 #ifdef DEVELOPER
11335 override void SetDebugItem()
11336 {
11337 super.SetDebugItem();
11338 _itemBase = this;
11339 }
11340
11342 {
11343 string text = super.GetDebugText();
11344
11346 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11347
11348 return text;
11349 }
11350 #endif
11351
11353 {
11354 return true;
11355 }
11356
11358
11360
11362 {
11365 }
11366
11367
11375
11391
11392 [
Obsolete(
"Use ItemSoundHandler instead")]
11395 {
11396 if (!
g_Game.IsDedicatedServer())
11397 {
11398 if (ConfigIsExisting("attachSoundSet"))
11399 {
11400 string cfg_path = "";
11401 string soundset = "";
11402 string type_name =
GetType();
11403
11406 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11407 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11408
11409 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11410 {
11411 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11412 {
11413 if (cfg_slot_array[i] == slot_type)
11414 {
11415 soundset = cfg_soundset_array[i];
11416 break;
11417 }
11418 }
11419 }
11420
11421 if (soundset != "")
11422 {
11423 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11425 }
11426 }
11427 }
11428 }
11429
11431}
11432
11434{
11436 if (entity)
11437 {
11438 bool is_item = entity.IsInherited(
ItemBase);
11439 if (is_item && full_quantity)
11440 {
11443 }
11444 }
11445 else
11446 {
11448 return NULL;
11449 }
11450 return entity;
11451}
11452
11454{
11455 if (item)
11456 {
11457 if (health > 0)
11458 item.SetHealth("", "", health);
11459
11460 if (item.CanHaveTemperature())
11461 {
11463 if (item.CanFreeze())
11464 item.SetFrozen(false);
11465 }
11466
11467 if (item.HasEnergyManager())
11468 {
11469 if (quantity >= 0)
11470 {
11471 item.GetCompEM().SetEnergy0To1(quantity);
11472 }
11473 else
11474 {
11476 }
11477 }
11478 else if (item.IsMagazine())
11479 {
11480 Magazine mag = Magazine.Cast(item);
11481 if (quantity >= 0)
11482 {
11483 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11484 }
11485 else
11486 {
11488 }
11489
11490 }
11491 else
11492 {
11493 if (quantity >= 0)
11494 {
11495 item.SetQuantityNormalized(quantity, false);
11496 }
11497 else
11498 {
11500 }
11501
11502 }
11503 }
11504}
11505
11506#ifdef DEVELOPER
11508#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.