6638{
6640 {
6641 return true;
6642 }
6643};
6644
6646{
6647
6648};
6649
6650
6651
6653{
6657
6659
6662
6663
6664
6665
6666
6675
6681
6686
6691
6712 protected bool m_IsResultOfSplit
6713
6715
6720
6721
6722
6724
6728
6729
6730
6732
6735
6736
6737
6743
6744
6752
6755
6756
6758
6759
6761
6762
6767
6768
6773
6775
6776
6778
6779
6781 {
6786
6787 if (!
g_Game.IsDedicatedServer())
6788 {
6790 {
6792
6794 {
6796 }
6797 }
6798
6801 }
6802
6803 m_OldLocation = null;
6804
6806 {
6808 }
6809
6810 if (ConfigIsExisting("headSelectionsToHide"))
6811 {
6814 }
6815
6817 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6818 {
6820 }
6821
6823
6824 m_IsResultOfSplit = false;
6825
6827 }
6828
6830 {
6831 super.InitItemVariables();
6832
6838 m_Count = ConfigGetInt(
"count");
6839
6842
6847
6850
6855
6867
6871
6872
6875 if (ConfigIsExisting("canBeSplit"))
6876 {
6879 }
6880
6882 if (ConfigIsExisting("itemBehaviour"))
6884
6885
6888 RegisterNetSyncVariableInt("m_VarLiquidType");
6889 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6890
6891 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6892 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6893 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6894
6895 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6896 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6897 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6898 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6899
6900 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6901 RegisterNetSyncVariableBool("m_IsTakeable");
6902 RegisterNetSyncVariableBool("m_IsHologram");
6903
6906 {
6909 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6910 }
6911
6913
6915 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6917
6919 }
6920
6922 {
6924 }
6925
6927 {
6930 {
6935 }
6936 }
6937
6938 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6939 {
6941 {
6944 }
6945
6947 }
6948
6950 {
6956 }
6957
6959
6961 {
6963
6964 if (!action)
6965 {
6966 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6967 return;
6968 }
6969
6971 if (!ai)
6972 {
6974 return;
6975 }
6976
6978 if (!action_array)
6979 {
6980 action_array = new array<ActionBase_Basic>;
6982 }
6983 if (LogManager.IsActionLogEnable())
6984 {
6985 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6986 }
6987
6988 if (action_array.Find(action) != -1)
6989 {
6990 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6991 }
6992 else
6993 {
6994 action_array.Insert(action);
6995 }
6996 }
6997
6999 {
7000 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7001 ActionBase action = player.GetActionManager().GetAction(actionName);
7004
7005 if (action_array)
7006 {
7007 action_array.RemoveItem(action);
7008 }
7009 }
7010
7011
7012
7014 {
7015 ActionOverrideData overrideData = new ActionOverrideData();
7019
7021 if (!actionMap)
7022 {
7025 }
7026
7027 actionMap.Insert(this.
Type(), overrideData);
7028
7029 }
7030
7032
7034
7035
7037 {
7040
7043
7044 string config_to_search = "CfgVehicles";
7045 string muzzle_owner_config;
7046
7048 {
7049 if (IsInherited(Weapon))
7050 config_to_search = "CfgWeapons";
7051
7052 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7053
7054 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7055
7056 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7057
7058 if (config_OnFire_subclass_count > 0)
7059 {
7060 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7061
7062 for (int i = 0; i < config_OnFire_subclass_count; i++)
7063 {
7064 string particle_class = "";
7065 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7066 string config_OnFire_entry = config_OnFire_class + particle_class;
7067 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7068 WPOF_array.Insert(WPOF);
7069 }
7070
7071
7073 }
7074 }
7075
7077 {
7078 config_to_search = "CfgWeapons";
7079 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7080
7081 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7082
7083 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7084
7085 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7086 {
7087 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7088
7089 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7090 {
7091 string particle_class2 = "";
7092 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7093 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7094 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7095 WPOBE_array.Insert(WPOBE);
7096 }
7097
7098
7100 }
7101 }
7102 }
7103
7104
7106 {
7109
7111 {
7112 string config_to_search = "CfgVehicles";
7113
7114 if (IsInherited(Weapon))
7115 config_to_search = "CfgWeapons";
7116
7117 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7118 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7119
7120 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7121 {
7122
7124
7126 {
7128 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7130 return;
7131 }
7132
7135
7136
7137
7138 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7139 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7140
7141 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7142 {
7143 string particle_class = "";
7144 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7145 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7146 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7147
7148 if (entry_type == CT_CLASS)
7149 {
7150 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7151 WPOOH_array.Insert(WPOF);
7152 }
7153 }
7154
7155
7157 }
7158 }
7159 }
7160
7162 {
7164 }
7165
7167 {
7169 {
7171
7174
7177
7178 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7179 }
7180 }
7181
7183 {
7185 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7186
7188 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7189
7191 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7192
7194 {
7196 }
7197 }
7198
7200 {
7202 }
7203
7205 {
7208 else
7210
7212 {
7215 }
7216 else
7217 {
7220
7223 }
7224
7226 }
7227
7229 {
7231 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7232 }
7233
7235 {
7237 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7239 }
7240
7242 {
7244 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7245 }
7246
7248 {
7251
7252 OverheatingParticle OP = new OverheatingParticle();
7257
7259 }
7260
7262 {
7265
7266 return -1;
7267 }
7268
7270 {
7272 {
7275
7276 for (int i = count; i > 0; --i)
7277 {
7278 int id = i - 1;
7281
7284
7285 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7286 {
7287 if (p)
7288 {
7291 }
7292 }
7293 }
7294 }
7295 }
7296
7298 {
7300 {
7302 {
7303 int id = i - 1;
7305
7306 if (OP)
7307 {
7309
7310 if (p)
7311 {
7313 }
7314
7315 delete OP;
7316 }
7317 }
7318
7321 }
7322 }
7323
7326 {
7327 return 0.0;
7328 }
7329
7330
7332 {
7333 return 250;
7334 }
7335
7337 {
7338 return 0;
7339 }
7340
7343 {
7345 return true;
7346
7347 return false;
7348 }
7349
7352 {
7355
7357 {
7359 }
7360 else
7361 {
7362
7364 }
7365
7367 }
7368
7375 {
7376 return -1;
7377 }
7378
7379
7380
7381
7383 {
7385 {
7386 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7387 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7388
7389 if (r_index >= 0)
7390 {
7391 InventoryLocation r_il = new InventoryLocation;
7392 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7393
7394 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7397 {
7398 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7399 }
7401 {
7402 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7403 }
7404
7405 }
7406
7407 player.GetHumanInventory().ClearUserReservedLocation(this);
7408 }
7409
7412 }
7413
7414
7415
7416
7418 {
7419 return ItemBase.m_DebugActionsMask;
7420 }
7421
7423 {
7424 return ItemBase.m_DebugActionsMask & mask;
7425 }
7426
7428 {
7429 ItemBase.m_DebugActionsMask = mask;
7430 }
7431
7433 {
7434 ItemBase.m_DebugActionsMask |= mask;
7435 }
7436
7438 {
7439 ItemBase.m_DebugActionsMask &= ~mask;
7440 }
7441
7443 {
7445 {
7447 }
7448 else
7449 {
7451 }
7452 }
7453
7454
7456 {
7457 if (GetEconomyProfile())
7458 {
7459 float q_max = GetEconomyProfile().GetQuantityMax();
7460 if (q_max > 0)
7461 {
7462 float q_min = GetEconomyProfile().GetQuantityMin();
7463 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7464
7466 {
7467 ComponentEnergyManager comp = GetCompEM();
7469 {
7471 }
7472 }
7474 {
7476
7477 }
7478
7479 }
7480 }
7481 }
7482
7485 {
7486 EntityAI parent = GetHierarchyParent();
7487
7488 if (parent)
7489 {
7490 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7491 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7492 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7493 }
7494 }
7495
7498 {
7499 EntityAI parent = GetHierarchyParent();
7500
7501 if (parent)
7502 {
7503 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7504 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7505 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7506 }
7507 }
7508
7510 {
7511
7512
7513
7514
7516
7518 {
7519 if (ScriptInputUserData.CanStoreInputUserData())
7520 {
7521 ScriptInputUserData ctx = new ScriptInputUserData;
7527 ctx.
Write(use_stack_max);
7530
7532 {
7533 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7534 }
7535 }
7536 }
7537 else if (!
g_Game.IsMultiplayer())
7538 {
7540 }
7541 }
7542
7544 {
7546 }
7547
7549 {
7551 }
7552
7554 {
7556 }
7557
7559 {
7560
7561 return false;
7562 }
7563
7565 {
7566 return false;
7567 }
7568
7572 {
7573 return false;
7574 }
7575
7577 {
7578 return "";
7579 }
7580
7582
7584 {
7585 return false;
7586 }
7587
7589 {
7590 return true;
7591 }
7592
7593
7594
7596 {
7597 return true;
7598 }
7599
7601 {
7602 return true;
7603 }
7604
7606 {
7607 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7609 }
7610
7612 {
7614 }
7615
7617 {
7619 if (!is_being_placed)
7621 SetSynchDirty();
7622 }
7623
7624
7626
7628 {
7630 }
7631
7633 {
7635 }
7636
7638 {
7639 return 1;
7640 }
7641
7643 {
7644 return false;
7645 }
7646
7648 {
7650 SetSynchDirty();
7651 }
7652
7653
7654
7655
7656
7657
7658
7659
7660
7661
7662
7663
7664
7665
7666
7667
7668
7669
7670
7671
7672
7673
7674
7675
7676
7677
7678
7679
7680
7681
7682
7683
7684
7685
7686
7688 {
7689 super.OnMovedInsideCargo(container);
7690
7691 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7692 }
7693
7694 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7695 {
7696 super.EEItemLocationChanged(oldLoc, newLoc);
7697
7698 PlayerBase newPlayer = null;
7699 PlayerBase oldPlayer = null;
7700
7701 if (newLoc.GetParent())
7702 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7703
7704 if (oldLoc.GetParent())
7705 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7706
7708 {
7709 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7710
7711 if (rIndex >= 0)
7712 {
7713 InventoryLocation rIl = new InventoryLocation;
7714 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7715
7716 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7719 {
7720 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7721 }
7723 {
7725 }
7726
7727 }
7728 }
7729
7731 {
7732 if (newPlayer)
7733 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7734
7735 if (newPlayer == oldPlayer)
7736 {
7737 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7738 {
7740 {
7741 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7742 {
7743 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7744 }
7745 }
7746 else
7747 {
7748 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7749 }
7750 }
7751
7752 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7753 {
7754 int type = oldLoc.GetType();
7756 {
7757 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7758 }
7760 {
7761 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7762 }
7763 }
7764 if (!m_OldLocation)
7765 {
7766 m_OldLocation = new InventoryLocation;
7767 }
7768 m_OldLocation.Copy(oldLoc);
7769 }
7770 else
7771 {
7772 if (m_OldLocation)
7773 {
7774 m_OldLocation.Reset();
7775 }
7776 }
7777
7778 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7779 }
7780 else
7781 {
7782 if (newPlayer)
7783 {
7784 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7785 if (resIndex >= 0)
7786 {
7787 InventoryLocation il = new InventoryLocation;
7788 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7790 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7793 {
7794 il.
GetParent().GetOnReleaseLock().Invoke(it);
7795 }
7797 {
7799 }
7800
7801 }
7802 }
7804 {
7805
7807 }
7808
7809 if (m_OldLocation)
7810 {
7811 m_OldLocation.Reset();
7812 }
7813 }
7814
7816 {
7817 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7818 }
7819
7821 {
7822 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7823 }
7824 }
7825
7826 override void EOnContact(IEntity other, Contact extra)
7827 {
7829 {
7830 int liquidType = -1;
7832 if (impactSpeed > 0.0)
7833 {
7835 #ifndef SERVER
7837 #else
7839 SetSynchDirty();
7840 #endif
7842 }
7843 }
7844
7845 #ifdef SERVER
7846 if (GetCompEM() && GetCompEM().IsPlugged())
7847 {
7848 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7849 GetCompEM().UnplugThis();
7850 }
7851 #endif
7852 }
7853
7855
7857 {
7859 }
7860
7862 {
7863
7864 }
7865
7867 {
7868 super.OnItemLocationChanged(old_owner, new_owner);
7869
7870 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7871 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7872
7873 if (!relatedPlayer && playerNew)
7874 relatedPlayer = playerNew;
7875
7876 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7877 {
7879 if (actionMgr)
7880 {
7881 ActionBase currentAction = actionMgr.GetRunningAction();
7882 if (currentAction)
7884 }
7885 }
7886
7887 Man ownerPlayerOld = null;
7888 Man ownerPlayerNew = null;
7889
7890 if (old_owner)
7891 {
7892 if (old_owner.
IsMan())
7893 {
7894 ownerPlayerOld = Man.Cast(old_owner);
7895 }
7896 else
7897 {
7898 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7899 }
7900 }
7901 else
7902 {
7904 {
7906
7907 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7908 {
7909 GetCompEM().UnplugThis();
7910 }
7911 }
7912 }
7913
7914 if (new_owner)
7915 {
7916 if (new_owner.
IsMan())
7917 {
7918 ownerPlayerNew = Man.Cast(new_owner);
7919 }
7920 else
7921 {
7922 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7923 }
7924 }
7925
7926 if (ownerPlayerOld != ownerPlayerNew)
7927 {
7928 if (ownerPlayerOld)
7929 {
7930 array<EntityAI> subItemsExit = new array<EntityAI>;
7932 for (int i = 0; i < subItemsExit.Count(); i++)
7933 {
7936 }
7937 }
7938
7939 if (ownerPlayerNew)
7940 {
7941 array<EntityAI> subItemsEnter = new array<EntityAI>;
7943 for (int j = 0; j < subItemsEnter.Count(); j++)
7944 {
7947 }
7948 }
7949 }
7950 else if (ownerPlayerNew != null)
7951 {
7952 PlayerBase nplayer;
7953 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7954 {
7955 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7957 for (int k = 0; k < subItemsUpdate.Count(); k++)
7958 {
7960 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7961 }
7962 }
7963 }
7964
7965 if (old_owner)
7966 old_owner.OnChildItemRemoved(this);
7967 if (new_owner)
7968 new_owner.OnChildItemReceived(this);
7969 }
7970
7971
7973 {
7974 super.EEDelete(parent);
7975 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7976 if (player)
7977 {
7979
7980 if (player.IsAlive())
7981 {
7982 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7983 if (r_index >= 0)
7984 {
7985 InventoryLocation r_il = new InventoryLocation;
7986 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7987
7988 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7991 {
7992 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7993 }
7995 {
7996 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7997 }
7998
7999 }
8000
8001 player.RemoveQuickBarEntityShortcut(this);
8002 }
8003 }
8004 }
8005
8007 {
8008 super.EEKilled(killer);
8009
8012 {
8013 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8014 {
8015 if (IsMagazine())
8016 {
8017 if (Magazine.Cast(this).GetAmmoCount() > 0)
8018 {
8020 }
8021 }
8022 else
8023 {
8025 }
8026 }
8027 }
8028 }
8029
8031 {
8032 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8033
8034 super.OnWasAttached(parent, slot_id);
8035
8038
8041 }
8042
8044 {
8045 super.OnWasDetached(parent, slot_id);
8046
8049
8052 }
8053
8055 {
8056 int idx;
8059
8060 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8061 if (inventory_slots.Count() < 1)
8062 {
8063 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8064 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8065 }
8066 else
8067 {
8068 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8069 }
8070
8071 idx = inventory_slots.Find(slot);
8072 if (idx < 0)
8073 return "";
8074
8075 return attach_types.Get(idx);
8076 }
8077
8079 {
8080 int idx = -1;
8081 string slot;
8082
8085
8086 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8087 if (inventory_slots.Count() < 1)
8088 {
8089 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8090 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8091 }
8092 else
8093 {
8094 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8095 if (detach_types.Count() < 1)
8096 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8097 }
8098
8099 for (int i = 0; i < inventory_slots.Count(); i++)
8100 {
8101 slot = inventory_slots.Get(i);
8102 }
8103
8104 if (slot != "")
8105 {
8106 if (detach_types.Count() == 1)
8107 idx = 0;
8108 else
8109 idx = inventory_slots.Find(slot);
8110 }
8111 if (idx < 0)
8112 return "";
8113
8114 return detach_types.Get(idx);
8115 }
8116
8118 {
8119
8121
8122
8123 float min_time = 1;
8124 float max_time = 3;
8125 float delay = Math.RandomFloat(min_time, max_time);
8126
8127 explode_timer.Run(delay, this, "DoAmmoExplosion");
8128 }
8129
8131 {
8132 Magazine magazine = Magazine.Cast(this);
8133 int pop_sounds_count = 6;
8134 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8135
8136
8137 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8138 string sound_name = pop_sounds[ sound_idx ];
8139 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8140
8141
8142 magazine.ServerAddAmmoCount(-1);
8143
8144
8145 float min_temp_to_explode = 100;
8146
8147 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8148 {
8150 }
8151 }
8152
8153
8154 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8155 {
8156 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8157
8158 const int CHANCE_DAMAGE_CARGO = 4;
8159 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8160 const int CHANCE_DAMAGE_NOTHING = 2;
8161
8163 {
8164 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8165 int chances;
8166 int rnd;
8167
8168 if (GetInventory().GetCargo())
8169 {
8170 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8171 rnd = Math.RandomInt(0,chances);
8172
8173 if (rnd < CHANCE_DAMAGE_CARGO)
8174 {
8176 }
8177 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8178 {
8180 }
8181 }
8182 else
8183 {
8184 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8185 rnd = Math.RandomInt(0,chances);
8186
8187 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8188 {
8190 }
8191 }
8192 }
8193 }
8194
8196 {
8197 CargoBase cargo = GetInventory().GetCargo();
8198 if (cargo)
8199 {
8201 if (item_count > 0)
8202 {
8203 int random_pick = Math.RandomInt(0, item_count);
8205 if (!item.IsExplosive())
8206 {
8207 item.AddHealth("","",damage);
8208 return true;
8209 }
8210 }
8211 }
8212 return false;
8213 }
8214
8216 {
8217 GameInventory inventory = GetInventory();
8219 if (attachment_count > 0)
8220 {
8221 int random_pick = Math.RandomInt(0, attachment_count);
8223 if (!attachment.IsExplosive())
8224 {
8225 attachment.AddHealth("","",damage);
8226 return true;
8227 }
8228 }
8229 return false;
8230 }
8231
8233 {
8235 }
8236
8238 {
8240 return GetInventory().CanRemoveEntity();
8241
8242 return false;
8243 }
8244
8246 {
8247
8249 return false;
8250
8251
8253 return false;
8254
8255
8256
8258 if (delta == 0)
8259 return false;
8260
8261
8262 return true;
8263 }
8264
8266 {
8268 {
8269 if (ScriptInputUserData.CanStoreInputUserData())
8270 {
8271 ScriptInputUserData ctx = new ScriptInputUserData;
8276 ctx.
Write(destination_entity);
8280 }
8281 }
8282 else if (!
g_Game.IsMultiplayer())
8283 {
8285 }
8286 }
8287
8289 {
8290 float split_quantity_new;
8294 InventoryLocation loc = new InventoryLocation;
8295
8296 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8297 {
8299 split_quantity_new = stack_max;
8300 else
8302
8304 {
8305 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8306 if (new_item)
8307 {
8308 new_item.SetResultOfSplit(true);
8309 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8311 new_item.
SetQuantity(split_quantity_new,
false,
true);
8312 }
8313 }
8314 }
8315 else if (destination_entity && slot_id == -1)
8316 {
8317 if (quantity > stack_max)
8318 split_quantity_new = stack_max;
8319 else
8320 split_quantity_new = quantity;
8321
8323 {
8324 GameInventory destinationInventory = destination_entity.GetInventory();
8326 {
8329 }
8330
8331 if (new_item)
8332 {
8333 new_item.SetResultOfSplit(true);
8334 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8336 new_item.
SetQuantity(split_quantity_new,
false,
true);
8337 }
8338 }
8339 }
8340 else
8341 {
8342 if (stack_max != 0)
8343 {
8345 {
8347 }
8348
8349 if (split_quantity_new == 0)
8350 {
8351 if (!
g_Game.IsMultiplayer())
8352 player.PhysicalPredictiveDropItem(this);
8353 else
8354 player.ServerDropEntity(this);
8355 return;
8356 }
8357
8359 {
8361
8362 if (new_item)
8363 {
8364 new_item.SetResultOfSplit(true);
8365 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8368 new_item.PlaceOnSurface();
8369 }
8370 }
8371 }
8372 }
8373 }
8374
8376 {
8377 float split_quantity_new;
8381 InventoryLocation loc = new InventoryLocation;
8382
8383 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8384 {
8386 split_quantity_new = stack_max;
8387 else
8389
8391 {
8392 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8393 if (new_item)
8394 {
8395 new_item.SetResultOfSplit(true);
8396 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8398 new_item.
SetQuantity(split_quantity_new,
false,
true);
8399 }
8400 }
8401 }
8402 else if (destination_entity && slot_id == -1)
8403 {
8404 if (quantity > stack_max)
8405 split_quantity_new = stack_max;
8406 else
8407 split_quantity_new = quantity;
8408
8410 {
8411 GameInventory destinationInventory = destination_entity.GetInventory();
8413 {
8416 }
8417
8418 if (new_item)
8419 {
8420 new_item.SetResultOfSplit(true);
8421 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8423 new_item.
SetQuantity(split_quantity_new,
false,
true);
8424 }
8425 }
8426 }
8427 else
8428 {
8429 if (stack_max != 0)
8430 {
8432 {
8434 }
8435
8437 {
8439
8440 if (new_item)
8441 {
8442 new_item.SetResultOfSplit(true);
8443 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8446 new_item.PlaceOnSurface();
8447 }
8448 }
8449 }
8450 }
8451 }
8452
8454 {
8456 {
8457 if (ScriptInputUserData.CanStoreInputUserData())
8458 {
8459 ScriptInputUserData ctx = new ScriptInputUserData;
8464 dst.WriteToContext(ctx);
8466 }
8467 }
8468 else if (!
g_Game.IsMultiplayer())
8469 {
8471 }
8472 }
8473
8475 {
8477 {
8478 if (ScriptInputUserData.CanStoreInputUserData())
8479 {
8480 ScriptInputUserData ctx = new ScriptInputUserData;
8485 ctx.
Write(destination_entity);
8491 }
8492 }
8493 else if (!
g_Game.IsMultiplayer())
8494 {
8496 }
8497 }
8498
8500 {
8502 }
8503
8505 {
8507 float split_quantity_new;
8509 if (dst.IsValid())
8510 {
8511 int slot_id = dst.GetSlot();
8513
8514 if (quantity > stack_max)
8515 split_quantity_new = stack_max;
8516 else
8517 split_quantity_new = quantity;
8518
8520 {
8522
8523 if (new_item)
8524 {
8525 new_item.SetResultOfSplit(true);
8526 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8528 new_item.
SetQuantity(split_quantity_new,
false,
true);
8529 }
8530
8531 return new_item;
8532 }
8533 }
8534
8535 return null;
8536 }
8537
8539 {
8541 float split_quantity_new;
8543 if (destination_entity)
8544 {
8546 if (quantity > stackable)
8547 split_quantity_new = stackable;
8548 else
8549 split_quantity_new = quantity;
8550
8552 {
8553 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8554 if (new_item)
8555 {
8556 new_item.SetResultOfSplit(true);
8557 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8559 new_item.
SetQuantity(split_quantity_new,
false,
true);
8560 }
8561 }
8562 }
8563 }
8564
8566 {
8568 {
8569 if (ScriptInputUserData.CanStoreInputUserData())
8570 {
8571 ScriptInputUserData ctx = new ScriptInputUserData;
8576 ItemBase destination_entity =
this;
8577 ctx.
Write(destination_entity);
8581 }
8582 }
8583 else if (!
g_Game.IsMultiplayer())
8584 {
8586 }
8587 }
8588
8590 {
8592 float split_quantity_new;
8594 if (player)
8595 {
8597 if (quantity > stackable)
8598 split_quantity_new = stackable;
8599 else
8600 split_quantity_new = quantity;
8601
8603 {
8604 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8605 new_item =
ItemBase.Cast(in_hands);
8606 if (new_item)
8607 {
8608 new_item.SetResultOfSplit(true);
8609 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8611 new_item.SetQuantity(split_quantity_new, false, true);
8612 }
8613 }
8614 }
8615 }
8616
8618 {
8620 float split_quantity_new = Math.Floor(quantity * 0.5);
8621
8623 return;
8624
8626
8627 if (new_item)
8628 {
8629 if (new_item.GetQuantityMax() < split_quantity_new)
8630 {
8631 split_quantity_new = new_item.GetQuantityMax();
8632 }
8633
8634 new_item.SetResultOfSplit(true);
8635 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8636
8638 {
8641 }
8642 else
8643 {
8645 new_item.
SetQuantity(split_quantity_new,
false,
true);
8646 }
8647 }
8648 }
8649
8651 {
8653 float split_quantity_new = Math.Floor(quantity / 2);
8654
8656 return;
8657
8658 InventoryLocation invloc = new InventoryLocation;
8660
8662 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8663
8664 if (new_item)
8665 {
8666 if (new_item.GetQuantityMax() < split_quantity_new)
8667 {
8668 split_quantity_new = new_item.GetQuantityMax();
8669 }
8671 {
8674 }
8675 else if (split_quantity_new > 1)
8676 {
8678 new_item.
SetQuantity(split_quantity_new,
false,
true);
8679 }
8680 }
8681 }
8682
8685 {
8686 SetWeightDirty();
8688
8689 if (parent)
8690 parent.OnAttachmentQuantityChangedEx(this, delta);
8691
8693 {
8695 {
8697 }
8699 {
8700 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8702 }
8703 }
8704 }
8705
8708 {
8709
8710 }
8711
8714 {
8716 }
8717
8719 {
8720 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8721
8723 {
8724 if (newLevel == GameConstants.STATE_RUINED)
8725 {
8727 EntityAI parent = GetHierarchyParent();
8728 if (parent && parent.IsFireplace())
8729 {
8730 CargoBase cargo = GetInventory().GetCargo();
8731 if (cargo)
8732 {
8734 {
8736 }
8737 }
8738 }
8739 }
8740
8742 {
8743
8745 return;
8746 }
8747
8748 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8749 {
8751 }
8752 }
8753 }
8754
8755
8757 {
8758 super.OnRightClick();
8759
8761 {
8763 {
8764 if (ScriptInputUserData.CanStoreInputUserData())
8765 {
8766 EntityAI root = GetHierarchyRoot();
8767 Man playerOwner = GetHierarchyRootPlayer();
8768 InventoryLocation dst = new InventoryLocation;
8769
8770
8771 if (!playerOwner && root && root == this)
8772 {
8774 }
8775 else
8776 {
8777
8778 GetInventory().GetCurrentInventoryLocation(dst);
8780 {
8781 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8783 {
8785 }
8786 else
8787 {
8789
8790
8791 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8792 {
8794 }
8795 else
8796 {
8797 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8798 }
8799 }
8800 }
8801 }
8802
8803 ScriptInputUserData ctx = new ScriptInputUserData;
8811 }
8812 }
8813 else if (!
g_Game.IsMultiplayer())
8814 {
8816 }
8817 }
8818 }
8819
8821 {
8822 if (root)
8823 {
8824 vector m4[4];
8825 root.GetTransform(m4);
8826 dst.SetGround(this, m4);
8827 }
8828 else
8829 {
8830 GetInventory().GetCurrentInventoryLocation(dst);
8831 }
8832 }
8833
8834 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8835 {
8836
8837 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8838 return false;
8839
8840 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8841 return false;
8842
8843
8845 return false;
8846
8847
8848 Magazine mag = Magazine.Cast(this);
8849 if (mag)
8850 {
8851 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8852 return false;
8853
8854 if (stack_max_limit)
8855 {
8856 Magazine other_mag = Magazine.Cast(other_item);
8857 if (other_item)
8858 {
8859 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8860 return false;
8861 }
8862
8863 }
8864 }
8865 else
8866 {
8867
8869 return false;
8870
8872 return false;
8873 }
8874
8875 PlayerBase player = null;
8876 if (CastTo(player, GetHierarchyRootPlayer()))
8877 {
8878 if (player.GetInventory().HasAttachment(this))
8879 return false;
8880
8881 if (player.IsItemsToDelete())
8882 return false;
8883 }
8884
8885 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8886 return false;
8887
8888 int slotID;
8890 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8891 return false;
8892
8893 return true;
8894 }
8895
8897 {
8899 }
8900
8902 {
8903 return m_IsResultOfSplit;
8904 }
8905
8907 {
8908 m_IsResultOfSplit = value;
8909 }
8910
8912 {
8914 }
8915
8917 {
8918 float other_item_quantity = other_item.GetQuantity();
8919 float this_free_space;
8920
8922
8924
8925 if (other_item_quantity > this_free_space)
8926 {
8927 return this_free_space;
8928 }
8929 else
8930 {
8931 return other_item_quantity;
8932 }
8933 }
8934
8936 {
8938 }
8939
8941 {
8943 return;
8944
8945 if (!IsMagazine() && other_item)
8946 {
8948 if (quantity_used != 0)
8949 {
8950 float hp1 = GetHealth01("","");
8951 float hp2 = other_item.GetHealth01("","");
8952 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8953 hpResult = hpResult / (
GetQuantity() + quantity_used);
8954
8955 hpResult *= GetMaxHealth();
8956 Math.Round(hpResult);
8957 SetHealth("", "Health", hpResult);
8958
8960 other_item.AddQuantity(-quantity_used);
8961 }
8962 }
8964 }
8965
8967 {
8968 #ifdef SERVER
8969 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8970 GetHierarchyParent().IncreaseLifetimeUp();
8971 #endif
8972 };
8973
8975 {
8976 PlayerBase p = PlayerBase.Cast(player);
8977
8978 array<int> recipesIds = p.m_Recipes;
8979 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8980 if (moduleRecipesManager)
8981 {
8982 EntityAI itemInHands = player.GetEntityInHands();
8983 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8984 }
8985
8986 for (int i = 0;i < recipesIds.Count(); i++)
8987 {
8988 int key = recipesIds.Get(i);
8989 string recipeName = moduleRecipesManager.GetRecipeName(key);
8991 }
8992 }
8993
8994
8995 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8996 {
8997 super.GetDebugActions(outputList);
8998
8999
9005
9006
9011
9016
9017
9021
9022
9024 {
9028 }
9029
9032
9033
9037
9039
9040 InventoryLocation loc = new InventoryLocation();
9041 GetInventory().GetCurrentInventoryLocation(loc);
9043 {
9044 if (Gizmo_IsSupported())
9047 }
9048
9050 }
9051
9052
9053
9054
9056 {
9057 super.OnAction(action_id, player, ctx);
9058
9060 {
9061 switch (action_id)
9062 {
9066 return true;
9070 return true;
9071 }
9072 }
9073
9075 {
9076 switch (action_id)
9077 {
9079 Delete();
9080 return true;
9081 }
9082 }
9083
9084 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9085 {
9086 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9087 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9088 PlayerBase p = PlayerBase.Cast(player);
9089 if (
EActions.RECIPES_RANGE_START < 1000)
9090 {
9091 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9092 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9093 }
9094 }
9095 #ifndef SERVER
9096 else if (action_id ==
EActions.WATCH_PLAYER)
9097 {
9098 PluginDeveloper.SetDeveloperItemClientEx(player);
9099 }
9100 #endif
9102 {
9103 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9104 {
9105 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9106 OnDebugButtonPressServer(id + 1);
9107 }
9108
9109 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9110 {
9111 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9113 }
9114
9115 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9116 {
9117 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9119 }
9120
9121 else if (action_id ==
EActions.ADD_QUANTITY)
9122 {
9123 if (IsMagazine())
9124 {
9125 Magazine mag = Magazine.Cast(this);
9126 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9127 }
9128 else
9129 {
9131 }
9132
9133 if (m_EM)
9134 {
9135 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9136 }
9137
9138 }
9139
9140 else if (action_id ==
EActions.REMOVE_QUANTITY)
9141 {
9142 if (IsMagazine())
9143 {
9144 Magazine mag2 = Magazine.Cast(this);
9145 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9146 }
9147 else
9148 {
9150 }
9151 if (m_EM)
9152 {
9153 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9154 }
9155
9156 }
9157
9158 else if (action_id ==
EActions.SET_QUANTITY_0)
9159 {
9161
9162 if (m_EM)
9163 {
9164 m_EM.SetEnergy(0);
9165 }
9166 }
9167
9168 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9169 {
9171
9172 if (m_EM)
9173 {
9174 m_EM.SetEnergy(m_EM.GetEnergyMax());
9175 }
9176 }
9177
9178 else if (action_id ==
EActions.ADD_HEALTH)
9179 {
9180 AddHealth("","",GetMaxHealth("","Health")/5);
9181 }
9182 else if (action_id ==
EActions.REMOVE_HEALTH)
9183 {
9184 AddHealth("","",-GetMaxHealth("","Health")/5);
9185 }
9186 else if (action_id ==
EActions.DESTROY_HEALTH)
9187 {
9188 SetHealth01("","",0);
9189 }
9190 else if (action_id ==
EActions.WATCH_ITEM)
9191 {
9193 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9194 #ifdef DEVELOPER
9195 SetDebugDeveloper_item(this);
9196 #endif
9197 }
9198
9199 else if (action_id ==
EActions.ADD_TEMPERATURE)
9200 {
9201 AddTemperature(20);
9202
9203 }
9204
9205 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9206 {
9207 AddTemperature(-20);
9208
9209 }
9210
9211 else if (action_id ==
EActions.FLIP_FROZEN)
9212 {
9213 SetFrozen(!GetIsFrozen());
9214
9215 }
9216
9217 else if (action_id ==
EActions.ADD_WETNESS)
9218 {
9220
9221 }
9222
9223 else if (action_id ==
EActions.REMOVE_WETNESS)
9224 {
9226
9227 }
9228
9229 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9230 {
9233
9234
9235 }
9236
9237 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9238 {
9241 }
9242
9243 else if (action_id ==
EActions.MAKE_SPECIAL)
9244 {
9245 auto debugParams = DebugSpawnParams.WithPlayer(player);
9246 OnDebugSpawnEx(debugParams);
9247 }
9248
9249 }
9250
9251
9252 return false;
9253 }
9254
9255
9256
9257
9261
9264
9265
9266
9268 {
9269 return false;
9270 }
9271
9272
9274 {
9275 return true;
9276 }
9277
9278
9280 {
9281 return true;
9282 }
9283
9284
9285
9287 {
9288 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9289 return g_Game.ConfigIsExisting(config_path);
9290 }
9291
9294 {
9295 return null;
9296 }
9297
9299 {
9300 return false;
9301 }
9302
9304 {
9305 return false;
9306 }
9307
9311
9312
9314 {
9315 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9316 return module_repairing.CanRepair(this, item_repair_kit);
9317 }
9318
9319
9320 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9321 {
9322 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9323 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9324 }
9325
9326
9328 {
9329
9330
9331
9332
9333
9334
9335
9336
9337 return 1;
9338 }
9339
9340
9341
9343 {
9345 }
9346
9347
9348
9350 {
9352 }
9353
9354
9363 {
9364 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9365
9366 if (player)
9367 {
9368 player.MessageStatus(text);
9369 }
9370 }
9371
9372
9381 {
9382 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9383
9384 if (player)
9385 {
9386 player.MessageAction(text);
9387 }
9388 }
9389
9390
9399 {
9400 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9401
9402 if (player)
9403 {
9404 player.MessageFriendly(text);
9405 }
9406 }
9407
9408
9417 {
9418 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9419
9420 if (player)
9421 {
9422 player.MessageImportant(text);
9423 }
9424 }
9425
9427 {
9428 return true;
9429 }
9430
9431
9432 override bool KindOf(
string tag)
9433 {
9434 bool found = false;
9435 string item_name = this.
GetType();
9437 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9438
9439 int array_size = item_tag_array.Count();
9440 for (int i = 0; i < array_size; i++)
9441 {
9442 if (item_tag_array.Get(i) == tag)
9443 {
9444 found = true;
9445 break;
9446 }
9447 }
9448 return found;
9449 }
9450
9451
9453 {
9454
9455 super.OnRPC(sender, rpc_type,ctx);
9456
9457
9458 switch (rpc_type)
9459 {
9460 #ifndef SERVER
9461 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9462 Param2<bool, string> p = new Param2<bool, string>(false, "");
9463
9465 return;
9466
9467 bool play = p.param1;
9468 string soundSet = p.param2;
9469
9470 if (play)
9471 {
9473 {
9475 {
9477 }
9478 }
9479 else
9480 {
9482 }
9483 }
9484 else
9485 {
9487 }
9488
9489 break;
9490 #endif
9491
9492 }
9493
9495 {
9497 }
9498 }
9499
9500
9501
9502
9504 {
9505 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9506 return plugin.GetID(
name);
9507 }
9508
9510 {
9511 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9512 return plugin.GetName(id);
9513 }
9514
9517 {
9518
9519
9520 int varFlags;
9521 if (!ctx.
Read(varFlags))
9522 return;
9523
9524 if (varFlags & ItemVariableFlags.FLOAT)
9525 {
9527 }
9528 }
9529
9531 {
9532
9533 super.SerializeNumericalVars(floats_out);
9534
9535
9536
9538 {
9540 }
9541
9543 {
9545 }
9546
9548 {
9550 }
9551
9553 {
9558 }
9559
9561 {
9563 }
9564 }
9565
9567 {
9568
9569 super.DeSerializeNumericalVars(floats);
9570
9571
9572 int index = 0;
9573 int mask = Math.Round(floats.Get(index));
9574
9575 index++;
9576
9578 {
9580 {
9582 }
9583 else
9584 {
9585 float quantity = floats.Get(index);
9587 }
9588 index++;
9589 }
9590
9592 {
9593 float wet = floats.Get(index);
9595 index++;
9596 }
9597
9599 {
9600 int liquidtype = Math.Round(floats.Get(index));
9602 index++;
9603 }
9604
9606 {
9608 index++;
9610 index++;
9612 index++;
9614 index++;
9615 }
9616
9618 {
9619 int cleanness = Math.Round(floats.Get(index));
9621 index++;
9622 }
9623 }
9624
9626 {
9627 super.WriteVarsToCTX(ctx);
9628
9629
9631 {
9633 }
9634
9636 {
9638 }
9639
9641 {
9643 }
9644
9646 {
9647 int r,g,b,a;
9653 }
9654
9656 {
9658 }
9659 }
9660
9662 {
9663 if (!super.ReadVarsFromCTX(ctx,version))
9664 return false;
9665
9666 int intValue;
9667 float value;
9668
9669 if (version < 140)
9670 {
9671 if (!ctx.
Read(intValue))
9672 return false;
9673
9674 m_VariablesMask = intValue;
9675 }
9676
9678 {
9679 if (!ctx.
Read(value))
9680 return false;
9681
9683 {
9685 }
9686 else
9687 {
9689 }
9690 }
9691
9692 if (version < 140)
9693 {
9695 {
9696 if (!ctx.
Read(value))
9697 return false;
9698 SetTemperatureDirect(value);
9699 }
9700 }
9701
9703 {
9704 if (!ctx.
Read(value))
9705 return false;
9707 }
9708
9710 {
9711 if (!ctx.
Read(intValue))
9712 return false;
9714 }
9715
9717 {
9718 int r,g,b,a;
9720 return false;
9722 return false;
9724 return false;
9726 return false;
9727
9729 }
9730
9732 {
9733 if (!ctx.
Read(intValue))
9734 return false;
9736 }
9737
9738 if (version >= 138 && version < 140)
9739 {
9741 {
9742 if (!ctx.
Read(intValue))
9743 return false;
9744 SetFrozen(intValue);
9745 }
9746 }
9747
9748 return true;
9749 }
9750
9751
9753 {
9756 {
9758 }
9759
9760 if (!super.OnStoreLoad(ctx, version))
9761 {
9763 return false;
9764 }
9765
9766 if (version >= 114)
9767 {
9768 bool hasQuickBarIndexSaved;
9769
9770 if (!ctx.
Read(hasQuickBarIndexSaved))
9771 {
9773 return false;
9774 }
9775
9776 if (hasQuickBarIndexSaved)
9777 {
9778 int itmQBIndex;
9779
9780
9781 if (!ctx.
Read(itmQBIndex))
9782 {
9784 return false;
9785 }
9786
9787 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9788 if (itmQBIndex != -1 && parentPlayer)
9789 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9790 }
9791 }
9792 else
9793 {
9794
9795 PlayerBase player;
9796 int itemQBIndex;
9797 if (version ==
int.
MAX)
9798 {
9799 if (!ctx.
Read(itemQBIndex))
9800 {
9802 return false;
9803 }
9804 }
9805 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9806 {
9807
9808 if (!ctx.
Read(itemQBIndex))
9809 {
9811 return false;
9812 }
9813 if (itemQBIndex != -1 && player)
9814 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9815 }
9816 }
9817
9818 if (version < 140)
9819 {
9820
9821 if (!LoadVariables(ctx, version))
9822 {
9824 return false;
9825 }
9826 }
9827
9828
9830 {
9832 return false;
9833 }
9834 if (version >= 132)
9835 {
9837 if (raib)
9838 {
9840 {
9842 return false;
9843 }
9844 }
9845 }
9846
9848 return true;
9849 }
9850
9851
9852
9854 {
9855 super.OnStoreSave(ctx);
9856
9857 PlayerBase player;
9858 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9859 {
9861
9862 int itemQBIndex = -1;
9863 itemQBIndex = player.FindQuickBarEntityIndex(this);
9864 ctx.
Write(itemQBIndex);
9865 }
9866 else
9867 {
9869 }
9870
9872
9874 if (raib)
9875 {
9877 }
9878 }
9879
9880
9882 {
9883 super.AfterStoreLoad();
9884
9886 {
9888 }
9889
9891 {
9894 }
9895 }
9896
9898 {
9899 super.EEOnAfterLoad();
9900
9902 {
9904 }
9905
9908 }
9909
9911 {
9912 return false;
9913 }
9914
9915
9916
9918 {
9920 {
9921 #ifdef PLATFORM_CONSOLE
9922
9924 {
9926 if (menu)
9927 {
9929 }
9930 }
9931 #endif
9932 }
9933
9935 {
9938 }
9939
9941 {
9942 SetWeightDirty();
9944 }
9946 {
9949 }
9950
9952 {
9955
9958 }
9960 {
9964 }
9965
9966 super.OnVariablesSynchronized();
9967 }
9968
9969
9970
9972 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9973 {
9974 if (!IsServerCheck(allow_client))
9975 return false;
9976
9978 return false;
9979
9982
9983 if (value <= (min + 0.001))
9984 value = min;
9985
9986 if (value == min)
9987 {
9988 if (destroy_config)
9989 {
9990 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9991 if (dstr)
9992 {
9994 this.Delete();
9995 return true;
9996 }
9997 }
9998 else if (destroy_forced)
9999 {
10001 this.Delete();
10002 return true;
10003 }
10004
10006 }
10007
10010
10012 {
10013 EntityAI parent = GetHierarchyRoot();
10014 InventoryLocation iLoc = new InventoryLocation();
10015 GetInventory().GetCurrentInventoryLocation(iLoc);
10017 {
10018 int iLocSlot = iLoc.
GetSlot();
10020 {
10022 }
10024 {
10026 }
10027 }
10028 }
10029
10031 {
10033
10034 if (delta)
10036 }
10037
10039
10040 return false;
10041 }
10042
10043
10045 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10046 {
10048 }
10049
10051 {
10054 }
10055
10057 {
10060 }
10061
10063 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10064 {
10065 float value_clamped = Math.Clamp(value, 0, 1);
10067 SetQuantity(result, destroy_config, destroy_forced);
10068 }
10069
10070
10073 {
10075 }
10076
10078 {
10080 }
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10092 {
10093 int slot = -1;
10094 GameInventory inventory = GetInventory();
10095 if (inventory)
10096 {
10097 InventoryLocation il = new InventoryLocation;
10100 }
10101
10103 }
10104
10106 {
10107 float quantity_max = 0;
10108
10110 {
10111 if (attSlotID != -1)
10112 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10113
10114 if (quantity_max <= 0)
10116 }
10117
10118 if (quantity_max <= 0)
10120
10121 return quantity_max;
10122 }
10123
10125 {
10127 }
10128
10130 {
10132 }
10133
10134
10136 {
10138 }
10139
10141 {
10143 }
10144
10146 {
10148 }
10149
10150
10152 {
10153
10154 float weightEx = GetWeightEx();
10155 float special = GetInventoryAndCargoWeight();
10156 return weightEx - special;
10157 }
10158
10159
10161 {
10163 }
10164
10166 {
10168 {
10169 #ifdef DEVELOPER
10170 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10171 {
10172 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10174 }
10175 #endif
10176
10177 return GetQuantity() * GetConfigWeightModified();
10178 }
10179 else if (HasEnergyManager())
10180 {
10181 #ifdef DEVELOPER
10182 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10183 {
10184 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10185 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10186 }
10187 #endif
10188 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10189 }
10190 else
10191 {
10192 #ifdef DEVELOPER
10193 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10194 {
10195 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10196 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10197 }
10198 #endif
10199 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10200 }
10201 }
10202
10205 {
10206 int item_count = 0;
10208
10209 GameInventory inventory = GetInventory();
10210 CargoBase cargo = inventory.
GetCargo();
10211 if (cargo != NULL)
10212 {
10214 }
10215
10217 for (int i = 0; i < nAttachments; ++i)
10218 {
10220 if (item)
10221 item_count += item.GetNumberOfItems();
10222 }
10223 return item_count;
10224 }
10225
10228 {
10229 float weight = 0;
10230 float wetness = 1;
10231 if (include_wetness)
10234 {
10235 weight = wetness * m_ConfigWeight;
10236 }
10238 {
10239 weight = 1;
10240 }
10241 return weight;
10242 }
10243
10244
10245
10247 {
10248 GameInventory inventory = GetInventory();
10249 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10250 {
10251 array<EntityAI> items = new array<EntityAI>;
10253 for (int i = 0; i < items.Count(); ++i)
10254 {
10256 if (item)
10257 {
10258 g_Game.ObjectDelete(item);
10259 }
10260 }
10261 }
10262 }
10263
10264
10265
10266
10268 {
10269 float energy = 0;
10270 if (HasEnergyManager())
10271 {
10272 energy = GetCompEM().GetEnergy();
10273 }
10274 return energy;
10275 }
10276
10277
10279 {
10280 super.OnEnergyConsumed();
10281
10283 }
10284
10286 {
10287 super.OnEnergyAdded();
10288
10290 }
10291
10292
10294 {
10295 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10296 {
10298 {
10299 float energy_0to1 = GetCompEM().GetEnergy0To1();
10301 }
10302 }
10303 }
10304
10305
10307 {
10308 return ConfigGetFloat("heatIsolation");
10309 }
10310
10312 {
10314 }
10315
10317 {
10318 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10319 if (
g_Game.ConfigIsExisting(paramPath))
10320 return g_Game.ConfigGetFloat(paramPath);
10321
10322 return 0.0;
10323 }
10324
10326 {
10327 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10328 if (
g_Game.ConfigIsExisting(paramPath))
10329 return g_Game.ConfigGetFloat(paramPath);
10330
10331 return 0.0;
10332 }
10333
10334 override void SetWet(
float value,
bool allow_client =
false)
10335 {
10336 if (!IsServerCheck(allow_client))
10337 return;
10338
10341
10343
10344 m_VarWet = Math.Clamp(value, min, max);
10345
10347 {
10350 }
10351 }
10352
10353 override void AddWet(
float value)
10354 {
10356 }
10357
10359 {
10361 }
10362
10364 {
10366 }
10367
10369 {
10371 }
10372
10374 {
10376 }
10377
10379 {
10381 }
10382
10383 override void OnWetChanged(
float newVal,
float oldVal)
10384 {
10387 if (newLevel != oldLevel)
10388 {
10390 }
10391 }
10392
10394 {
10395 SetWeightDirty();
10396 }
10397
10399 {
10400 return GetWetLevelInternal(
m_VarWet);
10401 }
10402
10403
10404
10406 {
10408 }
10409
10411 {
10413 }
10414
10416 {
10418 }
10419
10421 {
10423 }
10424
10425
10426
10428 {
10429 if (ConfigIsExisting("itemModelLength"))
10430 {
10431 return ConfigGetFloat("itemModelLength");
10432 }
10433 return 0;
10434 }
10435
10437 {
10438 if (ConfigIsExisting("itemAttachOffset"))
10439 {
10440 return ConfigGetFloat("itemAttachOffset");
10441 }
10442 return 0;
10443 }
10444
10445 override void SetCleanness(
int value,
bool allow_client =
false)
10446 {
10447 if (!IsServerCheck(allow_client))
10448 return;
10449
10451
10453
10456 }
10457
10459 {
10461 }
10462
10464 {
10465 return true;
10466 }
10467
10468
10469
10470
10472 {
10474 }
10475
10477 {
10479 }
10480
10481
10482
10483
10484 override void SetColor(
int r,
int g,
int b,
int a)
10485 {
10491 }
10493 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10494 {
10499 }
10500
10502 {
10504 }
10505
10508 {
10509 int r,g,b,a;
10511 r = r/255;
10512 g = g/255;
10513 b = b/255;
10514 a = a/255;
10515 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10516 }
10517
10518
10519
10520 override void SetLiquidType(
int value,
bool allow_client =
false)
10521 {
10522 if (!IsServerCheck(allow_client))
10523 return;
10524
10529 }
10530
10532 {
10533 return ConfigGetInt("varLiquidTypeInit");
10534 }
10535
10537 {
10539 }
10540
10542 {
10544 SetFrozen(false);
10545 }
10546
10549 {
10550 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10551 }
10552
10553
10556 {
10557 PlayerBase nplayer;
10558 if (PlayerBase.CastTo(nplayer, player))
10559 {
10561 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10562 }
10563 }
10564
10565
10568 {
10569 PlayerBase nplayer;
10570 if (PlayerBase.CastTo(nplayer,player))
10571 {
10572 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10573 }
10574
10575 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10576
10577 if (HasEnergyManager())
10578 {
10579 GetCompEM().UpdatePlugState();
10580 }
10581 }
10582
10583
10585 {
10586 super.OnPlacementStarted(player);
10587
10589 }
10590
10591 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10592 {
10594 {
10595 m_AdminLog.OnPlacementComplete(player,
this);
10596 }
10597
10598 super.OnPlacementComplete(player, position, orientation);
10599 }
10600
10601
10602
10603
10604
10606 {
10608 {
10609 return true;
10610 }
10611 else
10612 {
10613 return false;
10614 }
10615 }
10616
10617
10619 {
10621 {
10623 }
10624 }
10625
10626
10628 {
10630 }
10631
10633 {
10635 }
10636
10637 override void InsertAgent(
int agent,
float count = 1)
10638 {
10639 if (count < 1)
10640 return;
10641
10643 }
10644
10647 {
10649 }
10650
10651
10653 {
10655 }
10656
10657
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10699 {
10701 return false;
10702 return true;
10703 }
10704
10706 {
10707
10709 }
10710
10711
10714 {
10715 super.CheckForRoofLimited(timeTresholdMS);
10716
10717 float time =
g_Game.GetTime();
10718 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10719 {
10720 m_PreviousRoofTestTime = time;
10721 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10722 }
10723 }
10724
10725
10727 {
10729 {
10730 return 0;
10731 }
10732
10733 if (GetInventory().GetAttachmentSlotsCount() != 0)
10734 {
10735 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10736 if (filter)
10737 return filter.GetProtectionLevel(type, false, system);
10738 else
10739 return 0;
10740 }
10741
10742 string subclassPath, entryName;
10743
10744 switch (type)
10745 {
10747 entryName = "biological";
10748 break;
10750 entryName = "chemical";
10751 break;
10752 default:
10753 entryName = "biological";
10754 break;
10755 }
10756
10757 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10758
10759 return g_Game.ConfigGetFloat(subclassPath + entryName);
10760 }
10761
10762
10763
10766 {
10767 if (!IsMagazine())
10769
10771 }
10772
10773
10774
10775
10776
10781 {
10782 return true;
10783 }
10784
10786 {
10788 }
10789
10790
10791
10792
10793
10795 {
10796 if (parent)
10797 {
10798 if (parent.IsInherited(DayZInfected))
10799 return true;
10800
10801 if (!parent.IsRuined())
10802 return true;
10803 }
10804
10805 return true;
10806 }
10807
10809 {
10810 if (!super.CanPutAsAttachment(parent))
10811 {
10812 return false;
10813 }
10814
10815 if (!IsRuined() && !parent.IsRuined())
10816 {
10817 return true;
10818 }
10819
10820 return false;
10821 }
10822
10824 {
10825
10826
10827
10828
10829 return super.CanReceiveItemIntoCargo(item);
10830 }
10831
10833 {
10834
10835
10836
10837
10838 GameInventory attachmentInv = attachment.GetInventory();
10840 {
10841 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10842 return false;
10843 }
10844
10845 InventoryLocation loc = new InventoryLocation();
10846 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10847 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10848 return false;
10849
10850 return super.CanReceiveAttachment(attachment, slotId);
10851 }
10852
10854 {
10855 if (!super.CanReleaseAttachment(attachment))
10856 return false;
10857
10858 return GetInventory().AreChildrenAccessible();
10859 }
10860
10861
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10882 {
10883 int id = muzzle_owner.GetMuzzleID();
10884 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10885
10886 if (WPOF_array)
10887 {
10888 for (int i = 0; i < WPOF_array.Count(); i++)
10889 {
10890 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10891
10892 if (WPOF)
10893 {
10894 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10895 }
10896 }
10897 }
10898 }
10899
10900
10902 {
10903 int id = muzzle_owner.GetMuzzleID();
10905
10906 if (WPOBE_array)
10907 {
10908 for (int i = 0; i < WPOBE_array.Count(); i++)
10909 {
10910 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10911
10912 if (WPOBE)
10913 {
10914 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10915 }
10916 }
10917 }
10918 }
10919
10920
10922 {
10923 int id = muzzle_owner.GetMuzzleID();
10924 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10925
10926 if (WPOOH_array)
10927 {
10928 for (int i = 0; i < WPOOH_array.Count(); i++)
10929 {
10930 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10931
10932 if (WPOOH)
10933 {
10934 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10935 }
10936 }
10937 }
10938 }
10939
10940
10942 {
10943 int id = muzzle_owner.GetMuzzleID();
10944 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10945
10946 if (WPOOH_array)
10947 {
10948 for (int i = 0; i < WPOOH_array.Count(); i++)
10949 {
10950 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10951
10952 if (WPOOH)
10953 {
10954 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10955 }
10956 }
10957 }
10958 }
10959
10960
10962 {
10963 int id = muzzle_owner.GetMuzzleID();
10964 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10965
10966 if (WPOOH_array)
10967 {
10968 for (int i = 0; i < WPOOH_array.Count(); i++)
10969 {
10970 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10971
10972 if (WPOOH)
10973 {
10974 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10975 }
10976 }
10977 }
10978 }
10979
10980
10981
10983 {
10985 {
10986 return true;
10987 }
10988
10989 return false;
10990 }
10991
10993 {
10995 {
10996 return true;
10997 }
10998
10999 return false;
11000 }
11001
11003 {
11005 {
11006 return true;
11007 }
11008
11009 return false;
11010 }
11011
11013 {
11014 return false;
11015 }
11016
11019 {
11020 return UATimeSpent.DEFAULT_DEPLOY;
11021 }
11022
11023
11024
11025
11027 {
11029 SetSynchDirty();
11030 }
11031
11033 {
11035 }
11036
11037
11039 {
11040 return false;
11041 }
11042
11045 {
11046 string att_type = "None";
11047
11048 if (ConfigIsExisting("soundAttType"))
11049 {
11050 att_type = ConfigGetString("soundAttType");
11051 }
11052
11054 }
11055
11057 {
11059 }
11060
11061
11062
11063
11064
11070
11072 {
11075
11077 }
11078
11079
11081 {
11083 return;
11084
11086
11089
11092
11093 SoundParameters params = new SoundParameters();
11097 }
11098
11099
11101 {
11103 {
11106
11107 SetSynchDirty();
11108
11111 }
11112 }
11113
11115 {
11117 }
11118
11119
11121 {
11123 return;
11124
11126 SetSynchDirty();
11127
11130 }
11131
11133 {
11136 }
11137
11139 {
11141 }
11142
11143 void OnApply(PlayerBase player);
11144
11146 {
11147 return 1.0;
11148 };
11149
11151 {
11153 }
11154
11156 {
11158 }
11159
11161
11163 {
11164 SetDynamicPhysicsLifeTime(0.01);
11166 }
11167
11169 {
11170 array<string> zone_names = new array<string>;
11171 GetDamageZones(zone_names);
11172 for (int i = 0; i < zone_names.Count(); i++)
11173 {
11174 SetHealthMax(zone_names.Get(i),"Health");
11175 }
11176 SetHealthMax("","Health");
11177 }
11178
11181 {
11182 float global_health = GetHealth01("","Health");
11183 array<string> zones = new array<string>;
11184 GetDamageZones(zones);
11185
11186 for (int i = 0; i < zones.Count(); i++)
11187 {
11188 SetHealth01(zones.Get(i),"Health",global_health);
11189 }
11190 }
11191
11194 {
11195 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11196 }
11197
11199 {
11200 if (!hasRootAsPlayer)
11201 {
11202 if (refParentIB)
11203 {
11204
11205 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11206 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11207
11208 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11209 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11210
11213 }
11214 else
11215 {
11216
11219 }
11220 }
11221 }
11222
11224 {
11226 {
11227 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11228 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11229 {
11230 float heatPermCoef = 1.0;
11232 while (ent)
11233 {
11234 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11235 ent = ent.GetHierarchyParent();
11236 }
11237
11238 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11239 }
11240 }
11241 }
11242
11244 {
11245
11246 EntityAI parent = GetHierarchyParent();
11247 if (!parent)
11248 {
11249 hasParent = false;
11250 hasRootAsPlayer = false;
11251 }
11252 else
11253 {
11254 hasParent = true;
11255 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11256 refParentIB =
ItemBase.Cast(parent);
11257 }
11258 }
11259
11260 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11261 {
11262
11263 }
11264
11266 {
11267
11268 return false;
11269 }
11270
11272 {
11273
11274
11275 return false;
11276 }
11277
11279 {
11280
11281 return false;
11282 }
11283
11286 {
11287 return !GetIsFrozen() &&
IsOpen();
11288 }
11289
11291 {
11292 bool hasParent = false, hasRootAsPlayer = false;
11294
11295 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11296 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11297
11298 if (wwtu || foodDecay)
11299 {
11303
11304 if (processWetness || processTemperature || processDecay)
11305 {
11307
11308 if (processWetness)
11309 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11310
11311 if (processTemperature)
11313
11314 if (processDecay)
11315 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11316 }
11317 }
11318 }
11319
11322 {
11324 }
11325
11327 {
11330
11331 return super.GetTemperatureFreezeThreshold();
11332 }
11333
11335 {
11338
11339 return super.GetTemperatureThawThreshold();
11340 }
11341
11343 {
11346
11347 return super.GetItemOverheatThreshold();
11348 }
11349
11351 {
11353 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11354
11355 return super.GetTemperatureFreezeTime();
11356 }
11357
11359 {
11361 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11362
11363 return super.GetTemperatureThawTime();
11364 }
11365
11370
11372 {
11373 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11374 }
11375
11377 {
11378 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11379 }
11380
11383 {
11385 }
11386
11388 {
11390 }
11391
11393 {
11395 }
11396
11399 {
11400 return null;
11401 }
11402
11405 {
11406 return false;
11407 }
11408
11410 {
11412 {
11415 if (!trg)
11416 {
11418 explosive = this;
11419 }
11420
11421 explosive.PairRemote(trg);
11423
11424 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11425 trg.SetPersistentPairID(persistentID);
11426 explosive.SetPersistentPairID(persistentID);
11427
11428 return true;
11429 }
11430 return false;
11431 }
11432
11435 {
11436 float ret = 1.0;
11439 ret *= GetHealth01();
11440
11441 return ret;
11442 }
11443
11444 #ifdef DEVELOPER
11445 override void SetDebugItem()
11446 {
11447 super.SetDebugItem();
11448 _itemBase = this;
11449 }
11450
11452 {
11453 string text = super.GetDebugText();
11454
11456 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11457
11458 return text;
11459 }
11460 #endif
11461
11463 {
11464 return true;
11465 }
11466
11468
11470
11472 {
11475 }
11476
11477
11485
11501
11502 [
Obsolete(
"Use ItemSoundHandler instead")]
11505 {
11506 if (!
g_Game.IsDedicatedServer())
11507 {
11508 if (ConfigIsExisting("attachSoundSet"))
11509 {
11510 string cfg_path = "";
11511 string soundset = "";
11512 string type_name =
GetType();
11513
11516 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11517 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11518
11519 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11520 {
11521 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11522 {
11523 if (cfg_slot_array[i] == slot_type)
11524 {
11525 soundset = cfg_soundset_array[i];
11526 break;
11527 }
11528 }
11529 }
11530
11531 if (soundset != "")
11532 {
11533 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11535 }
11536 }
11537 }
11538 }
11539
11541}
11542
11544{
11546 if (entity)
11547 {
11548 bool is_item = entity.IsInherited(
ItemBase);
11549 if (is_item && full_quantity)
11550 {
11553 }
11554 }
11555 else
11556 {
11558 return NULL;
11559 }
11560 return entity;
11561}
11562
11564{
11565 if (item)
11566 {
11567 if (health > 0)
11568 item.SetHealth("", "", health);
11569
11570 if (item.CanHaveTemperature())
11571 {
11573 if (item.CanFreeze())
11574 item.SetFrozen(false);
11575 }
11576
11577 if (item.HasEnergyManager())
11578 {
11579 if (quantity >= 0)
11580 {
11581 item.GetCompEM().SetEnergy0To1(quantity);
11582 }
11583 else
11584 {
11586 }
11587 }
11588 else if (item.IsMagazine())
11589 {
11590 Magazine mag = Magazine.Cast(item);
11591 if (quantity >= 0)
11592 {
11593 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11594 }
11595 else
11596 {
11598 }
11599
11600 }
11601 else
11602 {
11603 if (quantity >= 0)
11604 {
11605 item.SetQuantityNormalized(quantity, false);
11606 }
11607 else
11608 {
11610 }
11611
11612 }
11613 }
11614}
11615
11616#ifdef DEVELOPER
11618#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.