6508{
6510 {
6511 return true;
6512 }
6513};
6514
6516{
6517
6518};
6519
6520
6521
6523{
6527
6529
6532
6533
6534
6535
6536
6545
6551
6556
6561
6582 protected bool m_IsResultOfSplit
6583
6585
6590
6591
6592
6594
6598
6599
6600
6602
6605
6606
6607
6613
6614
6622
6625
6626
6628
6629
6631
6632
6637
6638
6643
6645
6646
6648
6649
6651 {
6656
6657 if (!
g_Game.IsDedicatedServer())
6658 {
6660 {
6662
6664 {
6666 }
6667 }
6668
6671 }
6672
6673 m_OldLocation = null;
6674
6676 {
6678 }
6679
6680 if (ConfigIsExisting("headSelectionsToHide"))
6681 {
6684 }
6685
6687 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6688 {
6690 }
6691
6693
6694 m_IsResultOfSplit = false;
6695
6697 }
6698
6700 {
6701 super.InitItemVariables();
6702
6708 m_Count = ConfigGetInt(
"count");
6709
6712
6717
6720
6725
6737
6741
6742
6745 if (ConfigIsExisting("canBeSplit"))
6746 {
6749 }
6750
6752 if (ConfigIsExisting("itemBehaviour"))
6754
6755
6758 RegisterNetSyncVariableInt("m_VarLiquidType");
6759 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6760
6761 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6762 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6763 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6764
6765 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6766 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6767 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6768 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6769
6770 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6771 RegisterNetSyncVariableBool("m_IsTakeable");
6772 RegisterNetSyncVariableBool("m_IsHologram");
6773
6776 {
6779 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6780 }
6781
6783
6785 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6787
6789 }
6790
6792 {
6794 }
6795
6797 {
6800 {
6805 }
6806 }
6807
6808 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6809 {
6811 {
6814 }
6815
6817 }
6818
6820 {
6826 }
6827
6829
6831 {
6833
6834 if (!action)
6835 {
6836 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6837 return;
6838 }
6839
6841 if (!ai)
6842 {
6844 return;
6845 }
6846
6848 if (!action_array)
6849 {
6850 action_array = new array<ActionBase_Basic>;
6852 }
6853 if (LogManager.IsActionLogEnable())
6854 {
6855 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6856 }
6857
6858 if (action_array.Find(action) != -1)
6859 {
6860 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6861 }
6862 else
6863 {
6864 action_array.Insert(action);
6865 }
6866 }
6867
6869 {
6870 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6871 ActionBase action = player.GetActionManager().GetAction(actionName);
6874
6875 if (action_array)
6876 {
6877 action_array.RemoveItem(action);
6878 }
6879 }
6880
6881
6882
6884 {
6885 ActionOverrideData overrideData = new ActionOverrideData();
6889
6891 if (!actionMap)
6892 {
6895 }
6896
6897 actionMap.Insert(this.
Type(), overrideData);
6898
6899 }
6900
6902
6904
6905
6907 {
6910
6913
6914 string config_to_search = "CfgVehicles";
6915 string muzzle_owner_config;
6916
6918 {
6919 if (IsInherited(Weapon))
6920 config_to_search = "CfgWeapons";
6921
6922 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6923
6924 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6925
6926 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6927
6928 if (config_OnFire_subclass_count > 0)
6929 {
6930 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6931
6932 for (int i = 0; i < config_OnFire_subclass_count; i++)
6933 {
6934 string particle_class = "";
6935 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6936 string config_OnFire_entry = config_OnFire_class + particle_class;
6937 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6938 WPOF_array.Insert(WPOF);
6939 }
6940
6941
6943 }
6944 }
6945
6947 {
6948 config_to_search = "CfgWeapons";
6949 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6950
6951 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6952
6953 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6954
6955 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6956 {
6957 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6958
6959 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6960 {
6961 string particle_class2 = "";
6962 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6963 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6964 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6965 WPOBE_array.Insert(WPOBE);
6966 }
6967
6968
6970 }
6971 }
6972 }
6973
6974
6976 {
6979
6981 {
6982 string config_to_search = "CfgVehicles";
6983
6984 if (IsInherited(Weapon))
6985 config_to_search = "CfgWeapons";
6986
6987 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6988 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6989
6990 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6991 {
6992
6994
6996 {
6998 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7000 return;
7001 }
7002
7005
7006
7007
7008 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7009 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7010
7011 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7012 {
7013 string particle_class = "";
7014 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7015 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7016 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7017
7018 if (entry_type == CT_CLASS)
7019 {
7020 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7021 WPOOH_array.Insert(WPOF);
7022 }
7023 }
7024
7025
7027 }
7028 }
7029 }
7030
7032 {
7034 }
7035
7037 {
7039 {
7041
7044
7047
7048 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7049 }
7050 }
7051
7053 {
7055 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7056
7058 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7059
7061 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7062
7064 {
7066 }
7067 }
7068
7070 {
7072 }
7073
7075 {
7078 else
7080
7082 {
7085 }
7086 else
7087 {
7090
7093 }
7094
7096 }
7097
7099 {
7101 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7102 }
7103
7105 {
7107 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7109 }
7110
7112 {
7114 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7115 }
7116
7118 {
7121
7122 OverheatingParticle OP = new OverheatingParticle();
7127
7129 }
7130
7132 {
7135
7136 return -1;
7137 }
7138
7140 {
7142 {
7145
7146 for (int i = count; i > 0; --i)
7147 {
7148 int id = i - 1;
7151
7154
7155 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7156 {
7157 if (p)
7158 {
7161 }
7162 }
7163 }
7164 }
7165 }
7166
7168 {
7170 {
7172 {
7173 int id = i - 1;
7175
7176 if (OP)
7177 {
7179
7180 if (p)
7181 {
7183 }
7184
7185 delete OP;
7186 }
7187 }
7188
7191 }
7192 }
7193
7196 {
7197 return 0.0;
7198 }
7199
7200
7202 {
7203 return 250;
7204 }
7205
7207 {
7208 return 0;
7209 }
7210
7213 {
7215 return true;
7216
7217 return false;
7218 }
7219
7222 {
7225
7227 {
7229 }
7230 else
7231 {
7232
7234 }
7235
7237 }
7238
7245 {
7246 return -1;
7247 }
7248
7249
7250
7251
7253 {
7255 {
7256 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7257 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7258
7259 if (r_index >= 0)
7260 {
7261 InventoryLocation r_il = new InventoryLocation;
7262 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7263
7264 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7267 {
7268 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7269 }
7271 {
7272 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7273 }
7274
7275 }
7276
7277 player.GetHumanInventory().ClearUserReservedLocation(this);
7278 }
7279
7282 }
7283
7284
7285
7286
7288 {
7289 return ItemBase.m_DebugActionsMask;
7290 }
7291
7293 {
7294 return ItemBase.m_DebugActionsMask & mask;
7295 }
7296
7298 {
7299 ItemBase.m_DebugActionsMask = mask;
7300 }
7301
7303 {
7304 ItemBase.m_DebugActionsMask |= mask;
7305 }
7306
7308 {
7309 ItemBase.m_DebugActionsMask &= ~mask;
7310 }
7311
7313 {
7315 {
7317 }
7318 else
7319 {
7321 }
7322 }
7323
7324
7326 {
7327 if (GetEconomyProfile())
7328 {
7329 float q_max = GetEconomyProfile().GetQuantityMax();
7330 if (q_max > 0)
7331 {
7332 float q_min = GetEconomyProfile().GetQuantityMin();
7333 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7334
7336 {
7337 ComponentEnergyManager comp = GetCompEM();
7339 {
7341 }
7342 }
7344 {
7346
7347 }
7348
7349 }
7350 }
7351 }
7352
7355 {
7356 EntityAI parent = GetHierarchyParent();
7357
7358 if (parent)
7359 {
7360 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7361 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7362 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7363 }
7364 }
7365
7368 {
7369 EntityAI parent = GetHierarchyParent();
7370
7371 if (parent)
7372 {
7373 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7374 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7375 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7376 }
7377 }
7378
7380 {
7381
7382
7383
7384
7386
7388 {
7389 if (ScriptInputUserData.CanStoreInputUserData())
7390 {
7391 ScriptInputUserData ctx = new ScriptInputUserData;
7397 ctx.
Write(use_stack_max);
7400
7402 {
7403 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7404 }
7405 }
7406 }
7407 else if (!
g_Game.IsMultiplayer())
7408 {
7410 }
7411 }
7412
7414 {
7416 }
7417
7419 {
7421 }
7422
7424 {
7426 }
7427
7429 {
7430
7431 return false;
7432 }
7433
7435 {
7436 return false;
7437 }
7438
7442 {
7443 return false;
7444 }
7445
7447 {
7448 return "";
7449 }
7450
7452
7454 {
7455 return false;
7456 }
7457
7459 {
7460 return true;
7461 }
7462
7463
7464
7466 {
7467 return true;
7468 }
7469
7471 {
7472 return true;
7473 }
7474
7476 {
7477 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7479 }
7480
7482 {
7484 }
7485
7487 {
7489 if (!is_being_placed)
7491 SetSynchDirty();
7492 }
7493
7494
7496
7498 {
7500 }
7501
7503 {
7505 }
7506
7508 {
7509 return 1;
7510 }
7511
7513 {
7514 return false;
7515 }
7516
7518 {
7520 SetSynchDirty();
7521 }
7522
7523
7524
7525
7526
7527
7528
7529
7530
7531
7532
7533
7534
7535
7536
7537
7538
7539
7540
7541
7542
7543
7544
7545
7546
7547
7548
7549
7550
7551
7552
7553
7554
7555
7556
7558 {
7559 super.OnMovedInsideCargo(container);
7560
7561 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7562 }
7563
7564 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7565 {
7566 super.EEItemLocationChanged(oldLoc, newLoc);
7567
7568 PlayerBase newPlayer = null;
7569 PlayerBase oldPlayer = null;
7570
7571 if (newLoc.GetParent())
7572 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7573
7574 if (oldLoc.GetParent())
7575 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7576
7578 {
7579 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7580
7581 if (rIndex >= 0)
7582 {
7583 InventoryLocation rIl = new InventoryLocation;
7584 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7585
7586 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7589 {
7590 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7591 }
7593 {
7595 }
7596
7597 }
7598 }
7599
7601 {
7602 if (newPlayer)
7603 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7604
7605 if (newPlayer == oldPlayer)
7606 {
7607 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7608 {
7610 {
7611 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7612 {
7613 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7614 }
7615 }
7616 else
7617 {
7618 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7619 }
7620 }
7621
7622 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7623 {
7624 int type = oldLoc.GetType();
7626 {
7627 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7628 }
7630 {
7631 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7632 }
7633 }
7634 if (!m_OldLocation)
7635 {
7636 m_OldLocation = new InventoryLocation;
7637 }
7638 m_OldLocation.Copy(oldLoc);
7639 }
7640 else
7641 {
7642 if (m_OldLocation)
7643 {
7644 m_OldLocation.Reset();
7645 }
7646 }
7647
7648 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7649 }
7650 else
7651 {
7652 if (newPlayer)
7653 {
7654 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7655 if (resIndex >= 0)
7656 {
7657 InventoryLocation il = new InventoryLocation;
7658 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7660 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7663 {
7664 il.
GetParent().GetOnReleaseLock().Invoke(it);
7665 }
7667 {
7669 }
7670
7671 }
7672 }
7674 {
7675
7677 }
7678
7679 if (m_OldLocation)
7680 {
7681 m_OldLocation.Reset();
7682 }
7683 }
7684
7686 {
7687 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7688 }
7689
7691 {
7692 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7693 }
7694 }
7695
7696 override void EOnContact(IEntity other, Contact extra)
7697 {
7699 {
7700 int liquidType = -1;
7702 if (impactSpeed > 0.0)
7703 {
7705 #ifndef SERVER
7707 #else
7709 SetSynchDirty();
7710 #endif
7712 }
7713 }
7714
7715 #ifdef SERVER
7716 if (GetCompEM() && GetCompEM().IsPlugged())
7717 {
7718 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7719 GetCompEM().UnplugThis();
7720 }
7721 #endif
7722 }
7723
7725
7727 {
7729 }
7730
7732 {
7733
7734 }
7735
7737 {
7738 super.OnItemLocationChanged(old_owner, new_owner);
7739
7740 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7741 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7742
7743 if (!relatedPlayer && playerNew)
7744 relatedPlayer = playerNew;
7745
7746 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7747 {
7749 if (actionMgr)
7750 {
7751 ActionBase currentAction = actionMgr.GetRunningAction();
7752 if (currentAction)
7754 }
7755 }
7756
7757 Man ownerPlayerOld = null;
7758 Man ownerPlayerNew = null;
7759
7760 if (old_owner)
7761 {
7762 if (old_owner.
IsMan())
7763 {
7764 ownerPlayerOld = Man.Cast(old_owner);
7765 }
7766 else
7767 {
7768 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7769 }
7770 }
7771 else
7772 {
7774 {
7776
7777 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7778 {
7779 GetCompEM().UnplugThis();
7780 }
7781 }
7782 }
7783
7784 if (new_owner)
7785 {
7786 if (new_owner.
IsMan())
7787 {
7788 ownerPlayerNew = Man.Cast(new_owner);
7789 }
7790 else
7791 {
7792 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7793 }
7794 }
7795
7796 if (ownerPlayerOld != ownerPlayerNew)
7797 {
7798 if (ownerPlayerOld)
7799 {
7800 array<EntityAI> subItemsExit = new array<EntityAI>;
7802 for (int i = 0; i < subItemsExit.Count(); i++)
7803 {
7806 }
7807 }
7808
7809 if (ownerPlayerNew)
7810 {
7811 array<EntityAI> subItemsEnter = new array<EntityAI>;
7813 for (int j = 0; j < subItemsEnter.Count(); j++)
7814 {
7817 }
7818 }
7819 }
7820 else if (ownerPlayerNew != null)
7821 {
7822 PlayerBase nplayer;
7823 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7824 {
7825 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7827 for (int k = 0; k < subItemsUpdate.Count(); k++)
7828 {
7830 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7831 }
7832 }
7833 }
7834
7835 if (old_owner)
7836 old_owner.OnChildItemRemoved(this);
7837 if (new_owner)
7838 new_owner.OnChildItemReceived(this);
7839 }
7840
7841
7843 {
7844 super.EEDelete(parent);
7845 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7846 if (player)
7847 {
7849
7850 if (player.IsAlive())
7851 {
7852 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7853 if (r_index >= 0)
7854 {
7855 InventoryLocation r_il = new InventoryLocation;
7856 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7857
7858 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7861 {
7862 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7863 }
7865 {
7866 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7867 }
7868
7869 }
7870
7871 player.RemoveQuickBarEntityShortcut(this);
7872 }
7873 }
7874 }
7875
7877 {
7878 super.EEKilled(killer);
7879
7882 {
7883 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7884 {
7885 if (IsMagazine())
7886 {
7887 if (Magazine.Cast(this).GetAmmoCount() > 0)
7888 {
7890 }
7891 }
7892 else
7893 {
7895 }
7896 }
7897 }
7898 }
7899
7901 {
7902 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7903
7904 super.OnWasAttached(parent, slot_id);
7905
7908
7911 }
7912
7914 {
7915 super.OnWasDetached(parent, slot_id);
7916
7919
7922 }
7923
7925 {
7926 int idx;
7929
7930 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7931 if (inventory_slots.Count() < 1)
7932 {
7933 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7934 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7935 }
7936 else
7937 {
7938 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7939 }
7940
7941 idx = inventory_slots.Find(slot);
7942 if (idx < 0)
7943 return "";
7944
7945 return attach_types.Get(idx);
7946 }
7947
7949 {
7950 int idx = -1;
7951 string slot;
7952
7955
7956 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7957 if (inventory_slots.Count() < 1)
7958 {
7959 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7960 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7961 }
7962 else
7963 {
7964 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7965 if (detach_types.Count() < 1)
7966 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7967 }
7968
7969 for (int i = 0; i < inventory_slots.Count(); i++)
7970 {
7971 slot = inventory_slots.Get(i);
7972 }
7973
7974 if (slot != "")
7975 {
7976 if (detach_types.Count() == 1)
7977 idx = 0;
7978 else
7979 idx = inventory_slots.Find(slot);
7980 }
7981 if (idx < 0)
7982 return "";
7983
7984 return detach_types.Get(idx);
7985 }
7986
7988 {
7989
7991
7992
7993 float min_time = 1;
7994 float max_time = 3;
7995 float delay = Math.RandomFloat(min_time, max_time);
7996
7997 explode_timer.Run(delay, this, "DoAmmoExplosion");
7998 }
7999
8001 {
8002 Magazine magazine = Magazine.Cast(this);
8003 int pop_sounds_count = 6;
8004 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8005
8006
8007 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8008 string sound_name = pop_sounds[ sound_idx ];
8009 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8010
8011
8012 magazine.ServerAddAmmoCount(-1);
8013
8014
8015 float min_temp_to_explode = 100;
8016
8017 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8018 {
8020 }
8021 }
8022
8023
8024 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8025 {
8026 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8027
8028 const int CHANCE_DAMAGE_CARGO = 4;
8029 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8030 const int CHANCE_DAMAGE_NOTHING = 2;
8031
8033 {
8034 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8035 int chances;
8036 int rnd;
8037
8038 if (GetInventory().GetCargo())
8039 {
8040 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8041 rnd = Math.RandomInt(0,chances);
8042
8043 if (rnd < CHANCE_DAMAGE_CARGO)
8044 {
8046 }
8047 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8048 {
8050 }
8051 }
8052 else
8053 {
8054 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8055 rnd = Math.RandomInt(0,chances);
8056
8057 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8058 {
8060 }
8061 }
8062 }
8063 }
8064
8066 {
8067 CargoBase cargo = GetInventory().GetCargo();
8068 if (cargo)
8069 {
8071 if (item_count > 0)
8072 {
8073 int random_pick = Math.RandomInt(0, item_count);
8075 if (!item.IsExplosive())
8076 {
8077 item.AddHealth("","",damage);
8078 return true;
8079 }
8080 }
8081 }
8082 return false;
8083 }
8084
8086 {
8087 GameInventory inventory = GetInventory();
8089 if (attachment_count > 0)
8090 {
8091 int random_pick = Math.RandomInt(0, attachment_count);
8093 if (!attachment.IsExplosive())
8094 {
8095 attachment.AddHealth("","",damage);
8096 return true;
8097 }
8098 }
8099 return false;
8100 }
8101
8103 {
8105 }
8106
8108 {
8110 return GetInventory().CanRemoveEntity();
8111
8112 return false;
8113 }
8114
8116 {
8117
8119 return false;
8120
8121
8123 return false;
8124
8125
8126
8128 if (delta == 0)
8129 return false;
8130
8131
8132 return true;
8133 }
8134
8136 {
8138 {
8139 if (ScriptInputUserData.CanStoreInputUserData())
8140 {
8141 ScriptInputUserData ctx = new ScriptInputUserData;
8146 ctx.
Write(destination_entity);
8150 }
8151 }
8152 else if (!
g_Game.IsMultiplayer())
8153 {
8155 }
8156 }
8157
8159 {
8160 float split_quantity_new;
8164 InventoryLocation loc = new InventoryLocation;
8165
8166 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8167 {
8169 split_quantity_new = stack_max;
8170 else
8172
8174 {
8175 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8176 if (new_item)
8177 {
8178 new_item.SetResultOfSplit(true);
8179 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8181 new_item.
SetQuantity(split_quantity_new,
false,
true);
8182 }
8183 }
8184 }
8185 else if (destination_entity && slot_id == -1)
8186 {
8187 if (quantity > stack_max)
8188 split_quantity_new = stack_max;
8189 else
8190 split_quantity_new = quantity;
8191
8193 {
8194 GameInventory destinationInventory = destination_entity.GetInventory();
8196 {
8199 }
8200
8201 if (new_item)
8202 {
8203 new_item.SetResultOfSplit(true);
8204 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8206 new_item.
SetQuantity(split_quantity_new,
false,
true);
8207 }
8208 }
8209 }
8210 else
8211 {
8212 if (stack_max != 0)
8213 {
8215 {
8217 }
8218
8219 if (split_quantity_new == 0)
8220 {
8221 if (!
g_Game.IsMultiplayer())
8222 player.PhysicalPredictiveDropItem(this);
8223 else
8224 player.ServerDropEntity(this);
8225 return;
8226 }
8227
8229 {
8231
8232 if (new_item)
8233 {
8234 new_item.SetResultOfSplit(true);
8235 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8238 new_item.PlaceOnSurface();
8239 }
8240 }
8241 }
8242 }
8243 }
8244
8246 {
8247 float split_quantity_new;
8251 InventoryLocation loc = new InventoryLocation;
8252
8253 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8254 {
8256 split_quantity_new = stack_max;
8257 else
8259
8261 {
8262 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8263 if (new_item)
8264 {
8265 new_item.SetResultOfSplit(true);
8266 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8268 new_item.
SetQuantity(split_quantity_new,
false,
true);
8269 }
8270 }
8271 }
8272 else if (destination_entity && slot_id == -1)
8273 {
8274 if (quantity > stack_max)
8275 split_quantity_new = stack_max;
8276 else
8277 split_quantity_new = quantity;
8278
8280 {
8281 GameInventory destinationInventory = destination_entity.GetInventory();
8283 {
8286 }
8287
8288 if (new_item)
8289 {
8290 new_item.SetResultOfSplit(true);
8291 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8293 new_item.
SetQuantity(split_quantity_new,
false,
true);
8294 }
8295 }
8296 }
8297 else
8298 {
8299 if (stack_max != 0)
8300 {
8302 {
8304 }
8305
8307 {
8309
8310 if (new_item)
8311 {
8312 new_item.SetResultOfSplit(true);
8313 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8316 new_item.PlaceOnSurface();
8317 }
8318 }
8319 }
8320 }
8321 }
8322
8324 {
8326 {
8327 if (ScriptInputUserData.CanStoreInputUserData())
8328 {
8329 ScriptInputUserData ctx = new ScriptInputUserData;
8334 dst.WriteToContext(ctx);
8336 }
8337 }
8338 else if (!
g_Game.IsMultiplayer())
8339 {
8341 }
8342 }
8343
8345 {
8347 {
8348 if (ScriptInputUserData.CanStoreInputUserData())
8349 {
8350 ScriptInputUserData ctx = new ScriptInputUserData;
8355 ctx.
Write(destination_entity);
8361 }
8362 }
8363 else if (!
g_Game.IsMultiplayer())
8364 {
8366 }
8367 }
8368
8370 {
8372 }
8373
8375 {
8377 float split_quantity_new;
8379 if (dst.IsValid())
8380 {
8381 int slot_id = dst.GetSlot();
8383
8384 if (quantity > stack_max)
8385 split_quantity_new = stack_max;
8386 else
8387 split_quantity_new = quantity;
8388
8390 {
8392
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 return new_item;
8402 }
8403 }
8404
8405 return null;
8406 }
8407
8409 {
8411 float split_quantity_new;
8413 if (destination_entity)
8414 {
8416 if (quantity > stackable)
8417 split_quantity_new = stackable;
8418 else
8419 split_quantity_new = quantity;
8420
8422 {
8423 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8424 if (new_item)
8425 {
8426 new_item.SetResultOfSplit(true);
8427 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8429 new_item.
SetQuantity(split_quantity_new,
false,
true);
8430 }
8431 }
8432 }
8433 }
8434
8436 {
8438 {
8439 if (ScriptInputUserData.CanStoreInputUserData())
8440 {
8441 ScriptInputUserData ctx = new ScriptInputUserData;
8446 ItemBase destination_entity =
this;
8447 ctx.
Write(destination_entity);
8451 }
8452 }
8453 else if (!
g_Game.IsMultiplayer())
8454 {
8456 }
8457 }
8458
8460 {
8462 float split_quantity_new;
8464 if (player)
8465 {
8467 if (quantity > stackable)
8468 split_quantity_new = stackable;
8469 else
8470 split_quantity_new = quantity;
8471
8473 {
8474 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8475 new_item =
ItemBase.Cast(in_hands);
8476 if (new_item)
8477 {
8478 new_item.SetResultOfSplit(true);
8479 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8481 new_item.SetQuantity(split_quantity_new, false, true);
8482 }
8483 }
8484 }
8485 }
8486
8488 {
8490 float split_quantity_new = Math.Floor(quantity * 0.5);
8491
8493 return;
8494
8496
8497 if (new_item)
8498 {
8499 if (new_item.GetQuantityMax() < split_quantity_new)
8500 {
8501 split_quantity_new = new_item.GetQuantityMax();
8502 }
8503
8504 new_item.SetResultOfSplit(true);
8505 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8506
8508 {
8511 }
8512 else
8513 {
8515 new_item.
SetQuantity(split_quantity_new,
false,
true);
8516 }
8517 }
8518 }
8519
8521 {
8523 float split_quantity_new = Math.Floor(quantity / 2);
8524
8526 return;
8527
8528 InventoryLocation invloc = new InventoryLocation;
8530
8532 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8533
8534 if (new_item)
8535 {
8536 if (new_item.GetQuantityMax() < split_quantity_new)
8537 {
8538 split_quantity_new = new_item.GetQuantityMax();
8539 }
8541 {
8544 }
8545 else if (split_quantity_new > 1)
8546 {
8548 new_item.
SetQuantity(split_quantity_new,
false,
true);
8549 }
8550 }
8551 }
8552
8555 {
8556 SetWeightDirty();
8558
8559 if (parent)
8560 parent.OnAttachmentQuantityChangedEx(this, delta);
8561
8563 {
8565 {
8567 }
8569 {
8570 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8572 }
8573 }
8574 }
8575
8578 {
8579
8580 }
8581
8584 {
8586 }
8587
8589 {
8590 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8591
8593 {
8594 if (newLevel == GameConstants.STATE_RUINED)
8595 {
8597 EntityAI parent = GetHierarchyParent();
8598 if (parent && parent.IsFireplace())
8599 {
8600 CargoBase cargo = GetInventory().GetCargo();
8601 if (cargo)
8602 {
8604 {
8606 }
8607 }
8608 }
8609 }
8610
8612 {
8613
8615 return;
8616 }
8617
8618 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8619 {
8621 }
8622 }
8623 }
8624
8625
8627 {
8628 super.OnRightClick();
8629
8631 {
8633 {
8634 if (ScriptInputUserData.CanStoreInputUserData())
8635 {
8636 EntityAI root = GetHierarchyRoot();
8637 Man playerOwner = GetHierarchyRootPlayer();
8638 InventoryLocation dst = new InventoryLocation;
8639
8640
8641 if (!playerOwner && root && root == this)
8642 {
8644 }
8645 else
8646 {
8647
8648 GetInventory().GetCurrentInventoryLocation(dst);
8650 {
8651 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8653 {
8655 }
8656 else
8657 {
8659
8660
8661 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8662 {
8664 }
8665 else
8666 {
8667 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8668 }
8669 }
8670 }
8671 }
8672
8673 ScriptInputUserData ctx = new ScriptInputUserData;
8681 }
8682 }
8683 else if (!
g_Game.IsMultiplayer())
8684 {
8686 }
8687 }
8688 }
8689
8691 {
8692 if (root)
8693 {
8694 vector m4[4];
8695 root.GetTransform(m4);
8696 dst.SetGround(this, m4);
8697 }
8698 else
8699 {
8700 GetInventory().GetCurrentInventoryLocation(dst);
8701 }
8702 }
8703
8704 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8705 {
8706
8707 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8708 return false;
8709
8710 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8711 return false;
8712
8713
8715 return false;
8716
8717
8718 Magazine mag = Magazine.Cast(this);
8719 if (mag)
8720 {
8721 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8722 return false;
8723
8724 if (stack_max_limit)
8725 {
8726 Magazine other_mag = Magazine.Cast(other_item);
8727 if (other_item)
8728 {
8729 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8730 return false;
8731 }
8732
8733 }
8734 }
8735 else
8736 {
8737
8739 return false;
8740
8742 return false;
8743 }
8744
8745 PlayerBase player = null;
8746 if (CastTo(player, GetHierarchyRootPlayer()))
8747 {
8748 if (player.GetInventory().HasAttachment(this))
8749 return false;
8750
8751 if (player.IsItemsToDelete())
8752 return false;
8753 }
8754
8755 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8756 return false;
8757
8758 int slotID;
8760 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8761 return false;
8762
8763 return true;
8764 }
8765
8767 {
8769 }
8770
8772 {
8773 return m_IsResultOfSplit;
8774 }
8775
8777 {
8778 m_IsResultOfSplit = value;
8779 }
8780
8782 {
8784 }
8785
8787 {
8788 float other_item_quantity = other_item.GetQuantity();
8789 float this_free_space;
8790
8792
8794
8795 if (other_item_quantity > this_free_space)
8796 {
8797 return this_free_space;
8798 }
8799 else
8800 {
8801 return other_item_quantity;
8802 }
8803 }
8804
8806 {
8808 }
8809
8811 {
8813 return;
8814
8815 if (!IsMagazine() && other_item)
8816 {
8818 if (quantity_used != 0)
8819 {
8820 float hp1 = GetHealth01("","");
8821 float hp2 = other_item.GetHealth01("","");
8822 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8823 hpResult = hpResult / (
GetQuantity() + quantity_used);
8824
8825 hpResult *= GetMaxHealth();
8826 Math.Round(hpResult);
8827 SetHealth("", "Health", hpResult);
8828
8830 other_item.AddQuantity(-quantity_used);
8831 }
8832 }
8834 }
8835
8837 {
8838 #ifdef SERVER
8839 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8840 GetHierarchyParent().IncreaseLifetimeUp();
8841 #endif
8842 };
8843
8845 {
8846 PlayerBase p = PlayerBase.Cast(player);
8847
8848 array<int> recipesIds = p.m_Recipes;
8849 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8850 if (moduleRecipesManager)
8851 {
8852 EntityAI itemInHands = player.GetEntityInHands();
8853 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8854 }
8855
8856 for (int i = 0;i < recipesIds.Count(); i++)
8857 {
8858 int key = recipesIds.Get(i);
8859 string recipeName = moduleRecipesManager.GetRecipeName(key);
8861 }
8862 }
8863
8864
8865 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8866 {
8867 super.GetDebugActions(outputList);
8868
8869
8875
8876
8881
8886
8887
8891
8892
8894 {
8898 }
8899
8902
8903
8907
8909
8910 InventoryLocation loc = new InventoryLocation();
8911 GetInventory().GetCurrentInventoryLocation(loc);
8913 {
8914 if (Gizmo_IsSupported())
8917 }
8918
8920 }
8921
8922
8923
8924
8926 {
8927 super.OnAction(action_id, player, ctx);
8928
8930 {
8931 switch (action_id)
8932 {
8936 return true;
8940 return true;
8941 }
8942 }
8943
8945 {
8946 switch (action_id)
8947 {
8949 Delete();
8950 return true;
8951 }
8952 }
8953
8954 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8955 {
8956 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8957 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8958 PlayerBase p = PlayerBase.Cast(player);
8959 if (
EActions.RECIPES_RANGE_START < 1000)
8960 {
8961 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8962 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8963 }
8964 }
8965 #ifndef SERVER
8966 else if (action_id ==
EActions.WATCH_PLAYER)
8967 {
8968 PluginDeveloper.SetDeveloperItemClientEx(player);
8969 }
8970 #endif
8972 {
8973 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8974 {
8975 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8976 OnDebugButtonPressServer(id + 1);
8977 }
8978
8979 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8980 {
8981 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8983 }
8984
8985 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8986 {
8987 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8989 }
8990
8991 else if (action_id ==
EActions.ADD_QUANTITY)
8992 {
8993 if (IsMagazine())
8994 {
8995 Magazine mag = Magazine.Cast(this);
8996 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8997 }
8998 else
8999 {
9001 }
9002
9003 if (m_EM)
9004 {
9005 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9006 }
9007
9008 }
9009
9010 else if (action_id ==
EActions.REMOVE_QUANTITY)
9011 {
9012 if (IsMagazine())
9013 {
9014 Magazine mag2 = Magazine.Cast(this);
9015 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9016 }
9017 else
9018 {
9020 }
9021 if (m_EM)
9022 {
9023 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9024 }
9025
9026 }
9027
9028 else if (action_id ==
EActions.SET_QUANTITY_0)
9029 {
9031
9032 if (m_EM)
9033 {
9034 m_EM.SetEnergy(0);
9035 }
9036 }
9037
9038 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9039 {
9041
9042 if (m_EM)
9043 {
9044 m_EM.SetEnergy(m_EM.GetEnergyMax());
9045 }
9046 }
9047
9048 else if (action_id ==
EActions.ADD_HEALTH)
9049 {
9050 AddHealth("","",GetMaxHealth("","Health")/5);
9051 }
9052 else if (action_id ==
EActions.REMOVE_HEALTH)
9053 {
9054 AddHealth("","",-GetMaxHealth("","Health")/5);
9055 }
9056 else if (action_id ==
EActions.DESTROY_HEALTH)
9057 {
9058 SetHealth01("","",0);
9059 }
9060 else if (action_id ==
EActions.WATCH_ITEM)
9061 {
9063 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9064 #ifdef DEVELOPER
9065 SetDebugDeveloper_item(this);
9066 #endif
9067 }
9068
9069 else if (action_id ==
EActions.ADD_TEMPERATURE)
9070 {
9071 AddTemperature(20);
9072
9073 }
9074
9075 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9076 {
9077 AddTemperature(-20);
9078
9079 }
9080
9081 else if (action_id ==
EActions.FLIP_FROZEN)
9082 {
9083 SetFrozen(!GetIsFrozen());
9084
9085 }
9086
9087 else if (action_id ==
EActions.ADD_WETNESS)
9088 {
9090
9091 }
9092
9093 else if (action_id ==
EActions.REMOVE_WETNESS)
9094 {
9096
9097 }
9098
9099 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9100 {
9103
9104
9105 }
9106
9107 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9108 {
9111 }
9112
9113 else if (action_id ==
EActions.MAKE_SPECIAL)
9114 {
9115 auto debugParams = DebugSpawnParams.WithPlayer(player);
9116 OnDebugSpawnEx(debugParams);
9117 }
9118
9119 }
9120
9121
9122 return false;
9123 }
9124
9125
9126
9127
9131
9134
9135
9136
9138 {
9139 return false;
9140 }
9141
9142
9144 {
9145 return true;
9146 }
9147
9148
9150 {
9151 return true;
9152 }
9153
9154
9155
9157 {
9158 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9159 return g_Game.ConfigIsExisting(config_path);
9160 }
9161
9164 {
9165 return null;
9166 }
9167
9169 {
9170 return false;
9171 }
9172
9174 {
9175 return false;
9176 }
9177
9181
9182
9184 {
9185 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9186 return module_repairing.CanRepair(this, item_repair_kit);
9187 }
9188
9189
9190 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9191 {
9192 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9193 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9194 }
9195
9196
9198 {
9199
9200
9201
9202
9203
9204
9205
9206
9207 return 1;
9208 }
9209
9210
9211
9213 {
9215 }
9216
9217
9218
9220 {
9222 }
9223
9224
9233 {
9234 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9235
9236 if (player)
9237 {
9238 player.MessageStatus(text);
9239 }
9240 }
9241
9242
9251 {
9252 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9253
9254 if (player)
9255 {
9256 player.MessageAction(text);
9257 }
9258 }
9259
9260
9269 {
9270 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9271
9272 if (player)
9273 {
9274 player.MessageFriendly(text);
9275 }
9276 }
9277
9278
9287 {
9288 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9289
9290 if (player)
9291 {
9292 player.MessageImportant(text);
9293 }
9294 }
9295
9297 {
9298 return true;
9299 }
9300
9301
9302 override bool KindOf(
string tag)
9303 {
9304 bool found = false;
9305 string item_name = this.
GetType();
9307 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9308
9309 int array_size = item_tag_array.Count();
9310 for (int i = 0; i < array_size; i++)
9311 {
9312 if (item_tag_array.Get(i) == tag)
9313 {
9314 found = true;
9315 break;
9316 }
9317 }
9318 return found;
9319 }
9320
9321
9323 {
9324
9325 super.OnRPC(sender, rpc_type,ctx);
9326
9327
9328 switch (rpc_type)
9329 {
9330 #ifndef SERVER
9331 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9332 Param2<bool, string> p = new Param2<bool, string>(false, "");
9333
9335 return;
9336
9337 bool play = p.param1;
9338 string soundSet = p.param2;
9339
9340 if (play)
9341 {
9343 {
9345 {
9347 }
9348 }
9349 else
9350 {
9352 }
9353 }
9354 else
9355 {
9357 }
9358
9359 break;
9360 #endif
9361
9362 }
9363
9365 {
9367 }
9368 }
9369
9370
9371
9372
9374 {
9375 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9376 return plugin.GetID(
name);
9377 }
9378
9380 {
9381 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9382 return plugin.GetName(id);
9383 }
9384
9387 {
9388
9389
9390 int varFlags;
9391 if (!ctx.
Read(varFlags))
9392 return;
9393
9394 if (varFlags & ItemVariableFlags.FLOAT)
9395 {
9397 }
9398 }
9399
9401 {
9402
9403 super.SerializeNumericalVars(floats_out);
9404
9405
9406
9408 {
9410 }
9411
9413 {
9415 }
9416
9418 {
9420 }
9421
9423 {
9428 }
9429
9431 {
9433 }
9434 }
9435
9437 {
9438
9439 super.DeSerializeNumericalVars(floats);
9440
9441
9442 int index = 0;
9443 int mask = Math.Round(floats.Get(index));
9444
9445 index++;
9446
9448 {
9450 {
9452 }
9453 else
9454 {
9455 float quantity = floats.Get(index);
9457 }
9458 index++;
9459 }
9460
9462 {
9463 float wet = floats.Get(index);
9465 index++;
9466 }
9467
9469 {
9470 int liquidtype = Math.Round(floats.Get(index));
9472 index++;
9473 }
9474
9476 {
9478 index++;
9480 index++;
9482 index++;
9484 index++;
9485 }
9486
9488 {
9489 int cleanness = Math.Round(floats.Get(index));
9491 index++;
9492 }
9493 }
9494
9496 {
9497 super.WriteVarsToCTX(ctx);
9498
9499
9501 {
9503 }
9504
9506 {
9508 }
9509
9511 {
9513 }
9514
9516 {
9517 int r,g,b,a;
9523 }
9524
9526 {
9528 }
9529 }
9530
9532 {
9533 if (!super.ReadVarsFromCTX(ctx,version))
9534 return false;
9535
9536 int intValue;
9537 float value;
9538
9539 if (version < 140)
9540 {
9541 if (!ctx.
Read(intValue))
9542 return false;
9543
9544 m_VariablesMask = intValue;
9545 }
9546
9548 {
9549 if (!ctx.
Read(value))
9550 return false;
9551
9553 {
9555 }
9556 else
9557 {
9559 }
9560 }
9561
9562 if (version < 140)
9563 {
9565 {
9566 if (!ctx.
Read(value))
9567 return false;
9568 SetTemperatureDirect(value);
9569 }
9570 }
9571
9573 {
9574 if (!ctx.
Read(value))
9575 return false;
9577 }
9578
9580 {
9581 if (!ctx.
Read(intValue))
9582 return false;
9584 }
9585
9587 {
9588 int r,g,b,a;
9590 return false;
9592 return false;
9594 return false;
9596 return false;
9597
9599 }
9600
9602 {
9603 if (!ctx.
Read(intValue))
9604 return false;
9606 }
9607
9608 if (version >= 138 && version < 140)
9609 {
9611 {
9612 if (!ctx.
Read(intValue))
9613 return false;
9614 SetFrozen(intValue);
9615 }
9616 }
9617
9618 return true;
9619 }
9620
9621
9623 {
9626 {
9628 }
9629
9630 if (!super.OnStoreLoad(ctx, version))
9631 {
9633 return false;
9634 }
9635
9636 if (version >= 114)
9637 {
9638 bool hasQuickBarIndexSaved;
9639
9640 if (!ctx.
Read(hasQuickBarIndexSaved))
9641 {
9643 return false;
9644 }
9645
9646 if (hasQuickBarIndexSaved)
9647 {
9648 int itmQBIndex;
9649
9650
9651 if (!ctx.
Read(itmQBIndex))
9652 {
9654 return false;
9655 }
9656
9657 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9658 if (itmQBIndex != -1 && parentPlayer)
9659 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9660 }
9661 }
9662 else
9663 {
9664
9665 PlayerBase player;
9666 int itemQBIndex;
9667 if (version ==
int.
MAX)
9668 {
9669 if (!ctx.
Read(itemQBIndex))
9670 {
9672 return false;
9673 }
9674 }
9675 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9676 {
9677
9678 if (!ctx.
Read(itemQBIndex))
9679 {
9681 return false;
9682 }
9683 if (itemQBIndex != -1 && player)
9684 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9685 }
9686 }
9687
9688 if (version < 140)
9689 {
9690
9691 if (!LoadVariables(ctx, version))
9692 {
9694 return false;
9695 }
9696 }
9697
9698
9700 {
9702 return false;
9703 }
9704 if (version >= 132)
9705 {
9707 if (raib)
9708 {
9710 {
9712 return false;
9713 }
9714 }
9715 }
9716
9718 return true;
9719 }
9720
9721
9722
9724 {
9725 super.OnStoreSave(ctx);
9726
9727 PlayerBase player;
9728 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9729 {
9731
9732 int itemQBIndex = -1;
9733 itemQBIndex = player.FindQuickBarEntityIndex(this);
9734 ctx.
Write(itemQBIndex);
9735 }
9736 else
9737 {
9739 }
9740
9742
9744 if (raib)
9745 {
9747 }
9748 }
9749
9750
9752 {
9753 super.AfterStoreLoad();
9754
9756 {
9758 }
9759
9761 {
9764 }
9765 }
9766
9768 {
9769 super.EEOnAfterLoad();
9770
9772 {
9774 }
9775
9778 }
9779
9781 {
9782 return false;
9783 }
9784
9785
9786
9788 {
9790 {
9791 #ifdef PLATFORM_CONSOLE
9792
9794 {
9796 if (menu)
9797 {
9799 }
9800 }
9801 #endif
9802 }
9803
9805 {
9808 }
9809
9811 {
9812 SetWeightDirty();
9814 }
9816 {
9819 }
9820
9822 {
9825
9828 }
9830 {
9834 }
9835
9836 super.OnVariablesSynchronized();
9837 }
9838
9839
9840
9842 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9843 {
9844 if (!IsServerCheck(allow_client))
9845 return false;
9846
9848 return false;
9849
9852
9853 if (value <= (min + 0.001))
9854 value = min;
9855
9856 if (value == min)
9857 {
9858 if (destroy_config)
9859 {
9860 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9861 if (dstr)
9862 {
9864 this.Delete();
9865 return true;
9866 }
9867 }
9868 else if (destroy_forced)
9869 {
9871 this.Delete();
9872 return true;
9873 }
9874
9876 }
9877
9880
9882 {
9883 EntityAI parent = GetHierarchyRoot();
9884 InventoryLocation iLoc = new InventoryLocation();
9885 GetInventory().GetCurrentInventoryLocation(iLoc);
9887 {
9888 int iLocSlot = iLoc.
GetSlot();
9890 {
9892 }
9894 {
9896 }
9897 }
9898 }
9899
9901 {
9903
9904 if (delta)
9906 }
9907
9909
9910 return false;
9911 }
9912
9913
9915 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9916 {
9918 }
9919
9921 {
9924 }
9925
9927 {
9930 }
9931
9933 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9934 {
9935 float value_clamped = Math.Clamp(value, 0, 1);
9937 SetQuantity(result, destroy_config, destroy_forced);
9938 }
9939
9940
9943 {
9945 }
9946
9948 {
9950 }
9951
9952
9953
9954
9955
9956
9957
9958
9959
9960
9962 {
9963 int slot = -1;
9964 GameInventory inventory = GetInventory();
9965 if (inventory)
9966 {
9967 InventoryLocation il = new InventoryLocation;
9970 }
9971
9973 }
9974
9976 {
9977 float quantity_max = 0;
9978
9980 {
9981 if (attSlotID != -1)
9982 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9983
9984 if (quantity_max <= 0)
9986 }
9987
9988 if (quantity_max <= 0)
9990
9991 return quantity_max;
9992 }
9993
9995 {
9997 }
9998
10000 {
10002 }
10003
10004
10006 {
10008 }
10009
10011 {
10013 }
10014
10016 {
10018 }
10019
10020
10022 {
10023
10024 float weightEx = GetWeightEx();
10025 float special = GetInventoryAndCargoWeight();
10026 return weightEx - special;
10027 }
10028
10029
10031 {
10033 }
10034
10036 {
10038 {
10039 #ifdef DEVELOPER
10040 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10041 {
10042 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10044 }
10045 #endif
10046
10047 return GetQuantity() * GetConfigWeightModified();
10048 }
10049 else if (HasEnergyManager())
10050 {
10051 #ifdef DEVELOPER
10052 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10053 {
10054 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10055 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10056 }
10057 #endif
10058 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10059 }
10060 else
10061 {
10062 #ifdef DEVELOPER
10063 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10064 {
10065 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10066 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10067 }
10068 #endif
10069 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10070 }
10071 }
10072
10075 {
10076 int item_count = 0;
10078
10079 GameInventory inventory = GetInventory();
10080 CargoBase cargo = inventory.
GetCargo();
10081 if (cargo != NULL)
10082 {
10084 }
10085
10087 for (int i = 0; i < nAttachments; ++i)
10088 {
10090 if (item)
10091 item_count += item.GetNumberOfItems();
10092 }
10093 return item_count;
10094 }
10095
10098 {
10099 float weight = 0;
10100 float wetness = 1;
10101 if (include_wetness)
10104 {
10105 weight = wetness * m_ConfigWeight;
10106 }
10108 {
10109 weight = 1;
10110 }
10111 return weight;
10112 }
10113
10114
10115
10117 {
10118 GameInventory inventory = GetInventory();
10119 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10120 {
10121 array<EntityAI> items = new array<EntityAI>;
10123 for (int i = 0; i < items.Count(); ++i)
10124 {
10126 if (item)
10127 {
10128 g_Game.ObjectDelete(item);
10129 }
10130 }
10131 }
10132 }
10133
10134
10135
10136
10138 {
10139 float energy = 0;
10140 if (HasEnergyManager())
10141 {
10142 energy = GetCompEM().GetEnergy();
10143 }
10144 return energy;
10145 }
10146
10147
10149 {
10150 super.OnEnergyConsumed();
10151
10153 }
10154
10156 {
10157 super.OnEnergyAdded();
10158
10160 }
10161
10162
10164 {
10165 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10166 {
10168 {
10169 float energy_0to1 = GetCompEM().GetEnergy0To1();
10171 }
10172 }
10173 }
10174
10175
10177 {
10178 return ConfigGetFloat("heatIsolation");
10179 }
10180
10182 {
10184 }
10185
10187 {
10188 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10189 if (
g_Game.ConfigIsExisting(paramPath))
10190 return g_Game.ConfigGetFloat(paramPath);
10191
10192 return 0.0;
10193 }
10194
10196 {
10197 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10198 if (
g_Game.ConfigIsExisting(paramPath))
10199 return g_Game.ConfigGetFloat(paramPath);
10200
10201 return 0.0;
10202 }
10203
10204 override void SetWet(
float value,
bool allow_client =
false)
10205 {
10206 if (!IsServerCheck(allow_client))
10207 return;
10208
10211
10213
10214 m_VarWet = Math.Clamp(value, min, max);
10215
10217 {
10220 }
10221 }
10222
10223 override void AddWet(
float value)
10224 {
10226 }
10227
10229 {
10231 }
10232
10234 {
10236 }
10237
10239 {
10241 }
10242
10244 {
10246 }
10247
10249 {
10251 }
10252
10253 override void OnWetChanged(
float newVal,
float oldVal)
10254 {
10257 if (newLevel != oldLevel)
10258 {
10260 }
10261 }
10262
10264 {
10265 SetWeightDirty();
10266 }
10267
10269 {
10270 return GetWetLevelInternal(
m_VarWet);
10271 }
10272
10273
10274
10276 {
10278 }
10279
10281 {
10283 }
10284
10286 {
10288 }
10289
10291 {
10293 }
10294
10295
10296
10298 {
10299 if (ConfigIsExisting("itemModelLength"))
10300 {
10301 return ConfigGetFloat("itemModelLength");
10302 }
10303 return 0;
10304 }
10305
10307 {
10308 if (ConfigIsExisting("itemAttachOffset"))
10309 {
10310 return ConfigGetFloat("itemAttachOffset");
10311 }
10312 return 0;
10313 }
10314
10315 override void SetCleanness(
int value,
bool allow_client =
false)
10316 {
10317 if (!IsServerCheck(allow_client))
10318 return;
10319
10321
10323
10326 }
10327
10329 {
10331 }
10332
10334 {
10335 return true;
10336 }
10337
10338
10339
10340
10342 {
10344 }
10345
10347 {
10349 }
10350
10351
10352
10353
10354 override void SetColor(
int r,
int g,
int b,
int a)
10355 {
10361 }
10363 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10364 {
10369 }
10370
10372 {
10374 }
10375
10378 {
10379 int r,g,b,a;
10381 r = r/255;
10382 g = g/255;
10383 b = b/255;
10384 a = a/255;
10385 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10386 }
10387
10388
10389
10390 override void SetLiquidType(
int value,
bool allow_client =
false)
10391 {
10392 if (!IsServerCheck(allow_client))
10393 return;
10394
10399 }
10400
10402 {
10403 return ConfigGetInt("varLiquidTypeInit");
10404 }
10405
10407 {
10409 }
10410
10412 {
10414 SetFrozen(false);
10415 }
10416
10419 {
10420 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10421 }
10422
10423
10426 {
10427 PlayerBase nplayer;
10428 if (PlayerBase.CastTo(nplayer, player))
10429 {
10431 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10432 }
10433 }
10434
10435
10438 {
10439 PlayerBase nplayer;
10440 if (PlayerBase.CastTo(nplayer,player))
10441 {
10442 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10443 }
10444
10445 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10446
10447 if (HasEnergyManager())
10448 {
10449 GetCompEM().UpdatePlugState();
10450 }
10451 }
10452
10453
10455 {
10456 super.OnPlacementStarted(player);
10457
10459 }
10460
10461 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10462 {
10464 {
10465 m_AdminLog.OnPlacementComplete(player,
this);
10466 }
10467
10468 super.OnPlacementComplete(player, position, orientation);
10469 }
10470
10471
10472
10473
10474
10476 {
10478 {
10479 return true;
10480 }
10481 else
10482 {
10483 return false;
10484 }
10485 }
10486
10487
10489 {
10491 {
10493 }
10494 }
10495
10496
10498 {
10500 }
10501
10503 {
10505 }
10506
10507 override void InsertAgent(
int agent,
float count = 1)
10508 {
10509 if (count < 1)
10510 return;
10511
10513 }
10514
10517 {
10519 }
10520
10521
10523 {
10525 }
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10569 {
10571 return false;
10572 return true;
10573 }
10574
10576 {
10577
10579 }
10580
10581
10584 {
10585 super.CheckForRoofLimited(timeTresholdMS);
10586
10587 float time =
g_Game.GetTime();
10588 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10589 {
10590 m_PreviousRoofTestTime = time;
10591 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10592 }
10593 }
10594
10595
10597 {
10599 {
10600 return 0;
10601 }
10602
10603 if (GetInventory().GetAttachmentSlotsCount() != 0)
10604 {
10605 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10606 if (filter)
10607 return filter.GetProtectionLevel(type, false, system);
10608 else
10609 return 0;
10610 }
10611
10612 string subclassPath, entryName;
10613
10614 switch (type)
10615 {
10617 entryName = "biological";
10618 break;
10620 entryName = "chemical";
10621 break;
10622 default:
10623 entryName = "biological";
10624 break;
10625 }
10626
10627 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10628
10629 return g_Game.ConfigGetFloat(subclassPath + entryName);
10630 }
10631
10632
10633
10636 {
10637 if (!IsMagazine())
10639
10641 }
10642
10643
10644
10645
10646
10651 {
10652 return true;
10653 }
10654
10656 {
10658 }
10659
10660
10661
10662
10663
10665 {
10666 if (parent)
10667 {
10668 if (parent.IsInherited(DayZInfected))
10669 return true;
10670
10671 if (!parent.IsRuined())
10672 return true;
10673 }
10674
10675 return true;
10676 }
10677
10679 {
10680 if (!super.CanPutAsAttachment(parent))
10681 {
10682 return false;
10683 }
10684
10685 if (!IsRuined() && !parent.IsRuined())
10686 {
10687 return true;
10688 }
10689
10690 return false;
10691 }
10692
10694 {
10695
10696
10697
10698
10699 return super.CanReceiveItemIntoCargo(item);
10700 }
10701
10703 {
10704
10705
10706
10707
10708 GameInventory attachmentInv = attachment.GetInventory();
10710 {
10711 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10712 return false;
10713 }
10714
10715 InventoryLocation loc = new InventoryLocation();
10716 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10717 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10718 return false;
10719
10720 return super.CanReceiveAttachment(attachment, slotId);
10721 }
10722
10724 {
10725 if (!super.CanReleaseAttachment(attachment))
10726 return false;
10727
10728 return GetInventory().AreChildrenAccessible();
10729 }
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10743
10744
10745
10746
10747
10748
10749
10750
10752 {
10753 int id = muzzle_owner.GetMuzzleID();
10754 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10755
10756 if (WPOF_array)
10757 {
10758 for (int i = 0; i < WPOF_array.Count(); i++)
10759 {
10760 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10761
10762 if (WPOF)
10763 {
10764 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10765 }
10766 }
10767 }
10768 }
10769
10770
10772 {
10773 int id = muzzle_owner.GetMuzzleID();
10775
10776 if (WPOBE_array)
10777 {
10778 for (int i = 0; i < WPOBE_array.Count(); i++)
10779 {
10780 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10781
10782 if (WPOBE)
10783 {
10784 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10785 }
10786 }
10787 }
10788 }
10789
10790
10792 {
10793 int id = muzzle_owner.GetMuzzleID();
10794 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10795
10796 if (WPOOH_array)
10797 {
10798 for (int i = 0; i < WPOOH_array.Count(); i++)
10799 {
10800 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10801
10802 if (WPOOH)
10803 {
10804 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10805 }
10806 }
10807 }
10808 }
10809
10810
10812 {
10813 int id = muzzle_owner.GetMuzzleID();
10814 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10815
10816 if (WPOOH_array)
10817 {
10818 for (int i = 0; i < WPOOH_array.Count(); i++)
10819 {
10820 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10821
10822 if (WPOOH)
10823 {
10824 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10825 }
10826 }
10827 }
10828 }
10829
10830
10832 {
10833 int id = muzzle_owner.GetMuzzleID();
10834 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10835
10836 if (WPOOH_array)
10837 {
10838 for (int i = 0; i < WPOOH_array.Count(); i++)
10839 {
10840 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10841
10842 if (WPOOH)
10843 {
10844 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10845 }
10846 }
10847 }
10848 }
10849
10850
10851
10853 {
10855 {
10856 return true;
10857 }
10858
10859 return false;
10860 }
10861
10863 {
10865 {
10866 return true;
10867 }
10868
10869 return false;
10870 }
10871
10873 {
10875 {
10876 return true;
10877 }
10878
10879 return false;
10880 }
10881
10883 {
10884 return false;
10885 }
10886
10889 {
10890 return UATimeSpent.DEFAULT_DEPLOY;
10891 }
10892
10893
10894
10895
10897 {
10899 SetSynchDirty();
10900 }
10901
10903 {
10905 }
10906
10907
10909 {
10910 return false;
10911 }
10912
10915 {
10916 string att_type = "None";
10917
10918 if (ConfigIsExisting("soundAttType"))
10919 {
10920 att_type = ConfigGetString("soundAttType");
10921 }
10922
10924 }
10925
10927 {
10929 }
10930
10931
10932
10933
10934
10940
10942 {
10945
10947 }
10948
10949
10951 {
10953 return;
10954
10956
10959
10962
10963 SoundParameters params = new SoundParameters();
10967 }
10968
10969
10971 {
10973 {
10976
10977 SetSynchDirty();
10978
10981 }
10982 }
10983
10985 {
10987 }
10988
10989
10991 {
10993 return;
10994
10996 SetSynchDirty();
10997
11000 }
11001
11003 {
11006 }
11007
11009 {
11011 }
11012
11013 void OnApply(PlayerBase player);
11014
11016 {
11017 return 1.0;
11018 };
11019
11021 {
11023 }
11024
11026 {
11028 }
11029
11031
11033 {
11034 SetDynamicPhysicsLifeTime(0.01);
11036 }
11037
11039 {
11040 array<string> zone_names = new array<string>;
11041 GetDamageZones(zone_names);
11042 for (int i = 0; i < zone_names.Count(); i++)
11043 {
11044 SetHealthMax(zone_names.Get(i),"Health");
11045 }
11046 SetHealthMax("","Health");
11047 }
11048
11051 {
11052 float global_health = GetHealth01("","Health");
11053 array<string> zones = new array<string>;
11054 GetDamageZones(zones);
11055
11056 for (int i = 0; i < zones.Count(); i++)
11057 {
11058 SetHealth01(zones.Get(i),"Health",global_health);
11059 }
11060 }
11061
11064 {
11065 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11066 }
11067
11069 {
11070 if (!hasRootAsPlayer)
11071 {
11072 if (refParentIB)
11073 {
11074
11075 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11076 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11077
11078 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11079 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11080
11083 }
11084 else
11085 {
11086
11089 }
11090 }
11091 }
11092
11094 {
11096 {
11097 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11098 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11099 {
11100 float heatPermCoef = 1.0;
11102 while (ent)
11103 {
11104 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11105 ent = ent.GetHierarchyParent();
11106 }
11107
11108 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11109 }
11110 }
11111 }
11112
11114 {
11115
11116 EntityAI parent = GetHierarchyParent();
11117 if (!parent)
11118 {
11119 hasParent = false;
11120 hasRootAsPlayer = false;
11121 }
11122 else
11123 {
11124 hasParent = true;
11125 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11126 refParentIB =
ItemBase.Cast(parent);
11127 }
11128 }
11129
11130 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11131 {
11132
11133 }
11134
11136 {
11137
11138 return false;
11139 }
11140
11142 {
11143
11144
11145 return false;
11146 }
11147
11149 {
11150
11151 return false;
11152 }
11153
11156 {
11157 return !GetIsFrozen() &&
IsOpen();
11158 }
11159
11161 {
11162 bool hasParent = false, hasRootAsPlayer = false;
11164
11165 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11166 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11167
11168 if (wwtu || foodDecay)
11169 {
11173
11174 if (processWetness || processTemperature || processDecay)
11175 {
11177
11178 if (processWetness)
11179 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11180
11181 if (processTemperature)
11183
11184 if (processDecay)
11185 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11186 }
11187 }
11188 }
11189
11192 {
11194 }
11195
11197 {
11200
11201 return super.GetTemperatureFreezeThreshold();
11202 }
11203
11205 {
11208
11209 return super.GetTemperatureThawThreshold();
11210 }
11211
11213 {
11216
11217 return super.GetItemOverheatThreshold();
11218 }
11219
11221 {
11223 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11224
11225 return super.GetTemperatureFreezeTime();
11226 }
11227
11229 {
11231 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11232
11233 return super.GetTemperatureThawTime();
11234 }
11235
11240
11242 {
11243 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11244 }
11245
11247 {
11248 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11249 }
11250
11253 {
11255 }
11256
11258 {
11260 }
11261
11263 {
11265 }
11266
11269 {
11270 return null;
11271 }
11272
11275 {
11276 return false;
11277 }
11278
11280 {
11282 {
11285 if (!trg)
11286 {
11288 explosive = this;
11289 }
11290
11291 explosive.PairRemote(trg);
11293
11294 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11295 trg.SetPersistentPairID(persistentID);
11296 explosive.SetPersistentPairID(persistentID);
11297
11298 return true;
11299 }
11300 return false;
11301 }
11302
11305 {
11306 float ret = 1.0;
11309 ret *= GetHealth01();
11310
11311 return ret;
11312 }
11313
11314 #ifdef DEVELOPER
11315 override void SetDebugItem()
11316 {
11317 super.SetDebugItem();
11318 _itemBase = this;
11319 }
11320
11322 {
11323 string text = super.GetDebugText();
11324
11326 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11327
11328 return text;
11329 }
11330 #endif
11331
11333 {
11334 return true;
11335 }
11336
11338
11340
11342 {
11345 }
11346
11347
11355
11371
11372 [
Obsolete(
"Use ItemSoundHandler instead")]
11375 {
11376 if (!
g_Game.IsDedicatedServer())
11377 {
11378 if (ConfigIsExisting("attachSoundSet"))
11379 {
11380 string cfg_path = "";
11381 string soundset = "";
11382 string type_name =
GetType();
11383
11386 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11387 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11388
11389 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11390 {
11391 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11392 {
11393 if (cfg_slot_array[i] == slot_type)
11394 {
11395 soundset = cfg_soundset_array[i];
11396 break;
11397 }
11398 }
11399 }
11400
11401 if (soundset != "")
11402 {
11403 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11405 }
11406 }
11407 }
11408 }
11409
11411}
11412
11414{
11416 if (entity)
11417 {
11418 bool is_item = entity.IsInherited(
ItemBase);
11419 if (is_item && full_quantity)
11420 {
11423 }
11424 }
11425 else
11426 {
11428 return NULL;
11429 }
11430 return entity;
11431}
11432
11434{
11435 if (item)
11436 {
11437 if (health > 0)
11438 item.SetHealth("", "", health);
11439
11440 if (item.CanHaveTemperature())
11441 {
11443 if (item.CanFreeze())
11444 item.SetFrozen(false);
11445 }
11446
11447 if (item.HasEnergyManager())
11448 {
11449 if (quantity >= 0)
11450 {
11451 item.GetCompEM().SetEnergy0To1(quantity);
11452 }
11453 else
11454 {
11456 }
11457 }
11458 else if (item.IsMagazine())
11459 {
11460 Magazine mag = Magazine.Cast(item);
11461 if (quantity >= 0)
11462 {
11463 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11464 }
11465 else
11466 {
11468 }
11469
11470 }
11471 else
11472 {
11473 if (quantity >= 0)
11474 {
11475 item.SetQuantityNormalized(quantity, false);
11476 }
11477 else
11478 {
11480 }
11481
11482 }
11483 }
11484}
11485
11486#ifdef DEVELOPER
11488#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.