6500{
6502 {
6503 return true;
6504 }
6505};
6506
6508{
6509
6510};
6511
6512
6513
6515{
6519
6521
6524
6525
6526
6527
6528
6537
6543
6548
6553
6574 protected bool m_IsResultOfSplit
6575
6577
6582
6583
6584
6586
6590
6591
6592
6594
6597
6598
6599
6605
6606
6614
6617
6618
6620
6621
6623
6624
6629
6630
6635
6637
6638
6640
6641
6643 {
6648
6649 if (!
g_Game.IsDedicatedServer())
6650 {
6652 {
6654
6656 {
6658 }
6659 }
6660
6663 }
6664
6665 m_OldLocation = null;
6666
6668 {
6670 }
6671
6672 if (ConfigIsExisting("headSelectionsToHide"))
6673 {
6676 }
6677
6679 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6680 {
6682 }
6683
6685
6686 m_IsResultOfSplit = false;
6687
6689 }
6690
6692 {
6693 super.InitItemVariables();
6694
6700 m_Count = ConfigGetInt(
"count");
6701
6704
6709
6712
6717
6729
6733
6734
6737 if (ConfigIsExisting("canBeSplit"))
6738 {
6741 }
6742
6744 if (ConfigIsExisting("itemBehaviour"))
6746
6747
6750 RegisterNetSyncVariableInt("m_VarLiquidType");
6751 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6752
6753 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6754 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6755 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6756
6757 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6758 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6759 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6760 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6761
6762 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6763 RegisterNetSyncVariableBool("m_IsTakeable");
6764 RegisterNetSyncVariableBool("m_IsHologram");
6765
6768 {
6771 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6772 }
6773
6775
6777 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6779
6781 }
6782
6784 {
6786 }
6787
6789 {
6792 {
6797 }
6798 }
6799
6800 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6801 {
6803 {
6806 }
6807
6809 }
6810
6812 {
6818 }
6819
6821
6823 {
6825
6826 if (!action)
6827 {
6828 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6829 return;
6830 }
6831
6833 if (!ai)
6834 {
6836 return;
6837 }
6838
6840 if (!action_array)
6841 {
6842 action_array = new array<ActionBase_Basic>;
6844 }
6845 if (LogManager.IsActionLogEnable())
6846 {
6847 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6848 }
6849
6850 if (action_array.Find(action) != -1)
6851 {
6852 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6853 }
6854 else
6855 {
6856 action_array.Insert(action);
6857 }
6858 }
6859
6861 {
6862 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6863 ActionBase action = player.GetActionManager().GetAction(actionName);
6866
6867 if (action_array)
6868 {
6869 action_array.RemoveItem(action);
6870 }
6871 }
6872
6873
6874
6876 {
6877 ActionOverrideData overrideData = new ActionOverrideData();
6881
6883 if (!actionMap)
6884 {
6887 }
6888
6889 actionMap.Insert(this.
Type(), overrideData);
6890
6891 }
6892
6894
6896
6897
6899 {
6902
6905
6906 string config_to_search = "CfgVehicles";
6907 string muzzle_owner_config;
6908
6910 {
6911 if (IsInherited(Weapon))
6912 config_to_search = "CfgWeapons";
6913
6914 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6915
6916 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6917
6918 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6919
6920 if (config_OnFire_subclass_count > 0)
6921 {
6922 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6923
6924 for (int i = 0; i < config_OnFire_subclass_count; i++)
6925 {
6926 string particle_class = "";
6927 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6928 string config_OnFire_entry = config_OnFire_class + particle_class;
6929 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6930 WPOF_array.Insert(WPOF);
6931 }
6932
6933
6935 }
6936 }
6937
6939 {
6940 config_to_search = "CfgWeapons";
6941 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6942
6943 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6944
6945 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6946
6947 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6948 {
6949 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6950
6951 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6952 {
6953 string particle_class2 = "";
6954 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6955 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6956 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6957 WPOBE_array.Insert(WPOBE);
6958 }
6959
6960
6962 }
6963 }
6964 }
6965
6966
6968 {
6971
6973 {
6974 string config_to_search = "CfgVehicles";
6975
6976 if (IsInherited(Weapon))
6977 config_to_search = "CfgWeapons";
6978
6979 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6980 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6981
6982 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6983 {
6984
6986
6988 {
6990 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6992 return;
6993 }
6994
6997
6998
6999
7000 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7001 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7002
7003 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7004 {
7005 string particle_class = "";
7006 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7007 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7008 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7009
7010 if (entry_type == CT_CLASS)
7011 {
7012 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7013 WPOOH_array.Insert(WPOF);
7014 }
7015 }
7016
7017
7019 }
7020 }
7021 }
7022
7024 {
7026 }
7027
7029 {
7031 {
7033
7036
7039
7040 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7041 }
7042 }
7043
7045 {
7047 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7048
7050 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7051
7053 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7054
7056 {
7058 }
7059 }
7060
7062 {
7064 }
7065
7067 {
7070 else
7072
7074 {
7077 }
7078 else
7079 {
7082
7085 }
7086
7088 }
7089
7091 {
7093 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7094 }
7095
7097 {
7099 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7101 }
7102
7104 {
7106 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7107 }
7108
7110 {
7113
7114 OverheatingParticle OP = new OverheatingParticle();
7119
7121 }
7122
7124 {
7127
7128 return -1;
7129 }
7130
7132 {
7134 {
7137
7138 for (int i = count; i > 0; --i)
7139 {
7140 int id = i - 1;
7143
7146
7147 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7148 {
7149 if (p)
7150 {
7153 }
7154 }
7155 }
7156 }
7157 }
7158
7160 {
7162 {
7164 {
7165 int id = i - 1;
7167
7168 if (OP)
7169 {
7171
7172 if (p)
7173 {
7175 }
7176
7177 delete OP;
7178 }
7179 }
7180
7183 }
7184 }
7185
7188 {
7189 return 0.0;
7190 }
7191
7192
7194 {
7195 return 250;
7196 }
7197
7199 {
7200 return 0;
7201 }
7202
7205 {
7207 return true;
7208
7209 return false;
7210 }
7211
7214 {
7217
7219 {
7221 }
7222 else
7223 {
7224
7226 }
7227
7229 }
7230
7237 {
7238 return -1;
7239 }
7240
7241
7242
7243
7245 {
7247 {
7248 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7249 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7250
7251 if (r_index >= 0)
7252 {
7253 InventoryLocation r_il = new InventoryLocation;
7254 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7255
7256 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7259 {
7260 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7261 }
7263 {
7264 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7265 }
7266
7267 }
7268
7269 player.GetHumanInventory().ClearUserReservedLocation(this);
7270 }
7271
7274 }
7275
7276
7277
7278
7280 {
7281 return ItemBase.m_DebugActionsMask;
7282 }
7283
7285 {
7286 return ItemBase.m_DebugActionsMask & mask;
7287 }
7288
7290 {
7291 ItemBase.m_DebugActionsMask = mask;
7292 }
7293
7295 {
7296 ItemBase.m_DebugActionsMask |= mask;
7297 }
7298
7300 {
7301 ItemBase.m_DebugActionsMask &= ~mask;
7302 }
7303
7305 {
7307 {
7309 }
7310 else
7311 {
7313 }
7314 }
7315
7316
7318 {
7319 if (GetEconomyProfile())
7320 {
7321 float q_max = GetEconomyProfile().GetQuantityMax();
7322 if (q_max > 0)
7323 {
7324 float q_min = GetEconomyProfile().GetQuantityMin();
7325 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7326
7328 {
7329 ComponentEnergyManager comp = GetCompEM();
7331 {
7333 }
7334 }
7336 {
7338
7339 }
7340
7341 }
7342 }
7343 }
7344
7347 {
7348 EntityAI parent = GetHierarchyParent();
7349
7350 if (parent)
7351 {
7352 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7353 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7354 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7355 }
7356 }
7357
7360 {
7361 EntityAI parent = GetHierarchyParent();
7362
7363 if (parent)
7364 {
7365 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7366 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7367 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7368 }
7369 }
7370
7372 {
7373
7374
7375
7376
7378
7380 {
7381 if (ScriptInputUserData.CanStoreInputUserData())
7382 {
7383 ScriptInputUserData ctx = new ScriptInputUserData;
7389 ctx.
Write(use_stack_max);
7392
7394 {
7395 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7396 }
7397 }
7398 }
7399 else if (!
g_Game.IsMultiplayer())
7400 {
7402 }
7403 }
7404
7406 {
7408 }
7409
7411 {
7413 }
7414
7416 {
7418 }
7419
7421 {
7422
7423 return false;
7424 }
7425
7427 {
7428 return false;
7429 }
7430
7434 {
7435 return false;
7436 }
7437
7439 {
7440 return "";
7441 }
7442
7444
7446 {
7447 return false;
7448 }
7449
7451 {
7452 return true;
7453 }
7454
7455
7456
7458 {
7459 return true;
7460 }
7461
7463 {
7464 return true;
7465 }
7466
7468 {
7469 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7471 }
7472
7474 {
7476 }
7477
7479 {
7481 if (!is_being_placed)
7483 SetSynchDirty();
7484 }
7485
7486
7488
7490 {
7492 }
7493
7495 {
7497 }
7498
7500 {
7501 return 1;
7502 }
7503
7505 {
7506 return false;
7507 }
7508
7510 {
7512 SetSynchDirty();
7513 }
7514
7515
7516
7517
7518
7519
7520
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
7550 {
7551 super.OnMovedInsideCargo(container);
7552
7553 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7554 }
7555
7556 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7557 {
7558 super.EEItemLocationChanged(oldLoc, newLoc);
7559
7560 PlayerBase newPlayer = null;
7561 PlayerBase oldPlayer = null;
7562
7563 if (newLoc.GetParent())
7564 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7565
7566 if (oldLoc.GetParent())
7567 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7568
7570 {
7571 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7572
7573 if (rIndex >= 0)
7574 {
7575 InventoryLocation rIl = new InventoryLocation;
7576 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7577
7578 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7581 {
7582 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7583 }
7585 {
7587 }
7588
7589 }
7590 }
7591
7593 {
7594 if (newPlayer)
7595 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7596
7597 if (newPlayer == oldPlayer)
7598 {
7599 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7600 {
7602 {
7603 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7604 {
7605 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7606 }
7607 }
7608 else
7609 {
7610 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7611 }
7612 }
7613
7614 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7615 {
7616 int type = oldLoc.GetType();
7618 {
7619 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7620 }
7622 {
7623 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7624 }
7625 }
7626 if (!m_OldLocation)
7627 {
7628 m_OldLocation = new InventoryLocation;
7629 }
7630 m_OldLocation.Copy(oldLoc);
7631 }
7632 else
7633 {
7634 if (m_OldLocation)
7635 {
7636 m_OldLocation.Reset();
7637 }
7638 }
7639
7640 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7641 }
7642 else
7643 {
7644 if (newPlayer)
7645 {
7646 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7647 if (resIndex >= 0)
7648 {
7649 InventoryLocation il = new InventoryLocation;
7650 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7652 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7655 {
7656 il.
GetParent().GetOnReleaseLock().Invoke(it);
7657 }
7659 {
7661 }
7662
7663 }
7664 }
7666 {
7667
7669 }
7670
7671 if (m_OldLocation)
7672 {
7673 m_OldLocation.Reset();
7674 }
7675 }
7676
7678 {
7679 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7680 }
7681
7683 {
7684 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7685 }
7686 }
7687
7688 override void EOnContact(IEntity other, Contact extra)
7689 {
7691 {
7692 int liquidType = -1;
7694 if (impactSpeed > 0.0)
7695 {
7697 #ifndef SERVER
7699 #else
7701 SetSynchDirty();
7702 #endif
7704 }
7705 }
7706
7707 #ifdef SERVER
7708 if (GetCompEM() && GetCompEM().IsPlugged())
7709 {
7710 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7711 GetCompEM().UnplugThis();
7712 }
7713 #endif
7714 }
7715
7717
7719 {
7721 }
7722
7724 {
7725
7726 }
7727
7729 {
7730 super.OnItemLocationChanged(old_owner, new_owner);
7731
7732 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7733 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7734
7735 if (!relatedPlayer && playerNew)
7736 relatedPlayer = playerNew;
7737
7738 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7739 {
7741 if (actionMgr)
7742 {
7743 ActionBase currentAction = actionMgr.GetRunningAction();
7744 if (currentAction)
7746 }
7747 }
7748
7749 Man ownerPlayerOld = null;
7750 Man ownerPlayerNew = null;
7751
7752 if (old_owner)
7753 {
7754 if (old_owner.
IsMan())
7755 {
7756 ownerPlayerOld = Man.Cast(old_owner);
7757 }
7758 else
7759 {
7760 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7761 }
7762 }
7763 else
7764 {
7766 {
7768
7769 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7770 {
7771 GetCompEM().UnplugThis();
7772 }
7773 }
7774 }
7775
7776 if (new_owner)
7777 {
7778 if (new_owner.
IsMan())
7779 {
7780 ownerPlayerNew = Man.Cast(new_owner);
7781 }
7782 else
7783 {
7784 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7785 }
7786 }
7787
7788 if (ownerPlayerOld != ownerPlayerNew)
7789 {
7790 if (ownerPlayerOld)
7791 {
7792 array<EntityAI> subItemsExit = new array<EntityAI>;
7794 for (int i = 0; i < subItemsExit.Count(); i++)
7795 {
7798 }
7799 }
7800
7801 if (ownerPlayerNew)
7802 {
7803 array<EntityAI> subItemsEnter = new array<EntityAI>;
7805 for (int j = 0; j < subItemsEnter.Count(); j++)
7806 {
7809 }
7810 }
7811 }
7812 else if (ownerPlayerNew != null)
7813 {
7814 PlayerBase nplayer;
7815 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7816 {
7817 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7819 for (int k = 0; k < subItemsUpdate.Count(); k++)
7820 {
7822 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7823 }
7824 }
7825 }
7826
7827 if (old_owner)
7828 old_owner.OnChildItemRemoved(this);
7829 if (new_owner)
7830 new_owner.OnChildItemReceived(this);
7831 }
7832
7833
7835 {
7836 super.EEDelete(parent);
7837 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7838 if (player)
7839 {
7841
7842 if (player.IsAlive())
7843 {
7844 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7845 if (r_index >= 0)
7846 {
7847 InventoryLocation r_il = new InventoryLocation;
7848 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7849
7850 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7853 {
7854 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7855 }
7857 {
7858 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7859 }
7860
7861 }
7862
7863 player.RemoveQuickBarEntityShortcut(this);
7864 }
7865 }
7866 }
7867
7869 {
7870 super.EEKilled(killer);
7871
7874 {
7875 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7876 {
7877 if (IsMagazine())
7878 {
7879 if (Magazine.Cast(this).GetAmmoCount() > 0)
7880 {
7882 }
7883 }
7884 else
7885 {
7887 }
7888 }
7889 }
7890 }
7891
7893 {
7894 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7895
7896 super.OnWasAttached(parent, slot_id);
7897
7900
7903 }
7904
7906 {
7907 super.OnWasDetached(parent, slot_id);
7908
7911
7914 }
7915
7917 {
7918 int idx;
7921
7922 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7923 if (inventory_slots.Count() < 1)
7924 {
7925 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7926 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7927 }
7928 else
7929 {
7930 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7931 }
7932
7933 idx = inventory_slots.Find(slot);
7934 if (idx < 0)
7935 return "";
7936
7937 return attach_types.Get(idx);
7938 }
7939
7941 {
7942 int idx = -1;
7943 string slot;
7944
7947
7948 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7949 if (inventory_slots.Count() < 1)
7950 {
7951 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7952 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7953 }
7954 else
7955 {
7956 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7957 if (detach_types.Count() < 1)
7958 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7959 }
7960
7961 for (int i = 0; i < inventory_slots.Count(); i++)
7962 {
7963 slot = inventory_slots.Get(i);
7964 }
7965
7966 if (slot != "")
7967 {
7968 if (detach_types.Count() == 1)
7969 idx = 0;
7970 else
7971 idx = inventory_slots.Find(slot);
7972 }
7973 if (idx < 0)
7974 return "";
7975
7976 return detach_types.Get(idx);
7977 }
7978
7980 {
7981
7983
7984
7985 float min_time = 1;
7986 float max_time = 3;
7987 float delay = Math.RandomFloat(min_time, max_time);
7988
7989 explode_timer.Run(delay, this, "DoAmmoExplosion");
7990 }
7991
7993 {
7994 Magazine magazine = Magazine.Cast(this);
7995 int pop_sounds_count = 6;
7996 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7997
7998
7999 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8000 string sound_name = pop_sounds[ sound_idx ];
8001 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8002
8003
8004 magazine.ServerAddAmmoCount(-1);
8005
8006
8007 float min_temp_to_explode = 100;
8008
8009 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8010 {
8012 }
8013 }
8014
8015
8016 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8017 {
8018 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8019
8020 const int CHANCE_DAMAGE_CARGO = 4;
8021 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8022 const int CHANCE_DAMAGE_NOTHING = 2;
8023
8025 {
8026 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8027 int chances;
8028 int rnd;
8029
8030 if (GetInventory().GetCargo())
8031 {
8032 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8033 rnd = Math.RandomInt(0,chances);
8034
8035 if (rnd < CHANCE_DAMAGE_CARGO)
8036 {
8038 }
8039 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8040 {
8042 }
8043 }
8044 else
8045 {
8046 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8047 rnd = Math.RandomInt(0,chances);
8048
8049 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8050 {
8052 }
8053 }
8054 }
8055 }
8056
8058 {
8059 CargoBase cargo = GetInventory().GetCargo();
8060 if (cargo)
8061 {
8063 if (item_count > 0)
8064 {
8065 int random_pick = Math.RandomInt(0, item_count);
8067 if (!item.IsExplosive())
8068 {
8069 item.AddHealth("","",damage);
8070 return true;
8071 }
8072 }
8073 }
8074 return false;
8075 }
8076
8078 {
8079 GameInventory inventory = GetInventory();
8081 if (attachment_count > 0)
8082 {
8083 int random_pick = Math.RandomInt(0, attachment_count);
8085 if (!attachment.IsExplosive())
8086 {
8087 attachment.AddHealth("","",damage);
8088 return true;
8089 }
8090 }
8091 return false;
8092 }
8093
8095 {
8097 }
8098
8100 {
8102 return GetInventory().CanRemoveEntity();
8103
8104 return false;
8105 }
8106
8108 {
8109
8111 return false;
8112
8113
8115 return false;
8116
8117
8118
8120 if (delta == 0)
8121 return false;
8122
8123
8124 return true;
8125 }
8126
8128 {
8130 {
8131 if (ScriptInputUserData.CanStoreInputUserData())
8132 {
8133 ScriptInputUserData ctx = new ScriptInputUserData;
8138 ctx.
Write(destination_entity);
8142 }
8143 }
8144 else if (!
g_Game.IsMultiplayer())
8145 {
8147 }
8148 }
8149
8151 {
8152 float split_quantity_new;
8156 InventoryLocation loc = new InventoryLocation;
8157
8158 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8159 {
8161 split_quantity_new = stack_max;
8162 else
8164
8166 {
8167 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8168 if (new_item)
8169 {
8170 new_item.SetResultOfSplit(true);
8171 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8173 new_item.
SetQuantity(split_quantity_new,
false,
true);
8174 }
8175 }
8176 }
8177 else if (destination_entity && slot_id == -1)
8178 {
8179 if (quantity > stack_max)
8180 split_quantity_new = stack_max;
8181 else
8182 split_quantity_new = quantity;
8183
8185 {
8186 GameInventory destinationInventory = destination_entity.GetInventory();
8188 {
8191 }
8192
8193 if (new_item)
8194 {
8195 new_item.SetResultOfSplit(true);
8196 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8198 new_item.
SetQuantity(split_quantity_new,
false,
true);
8199 }
8200 }
8201 }
8202 else
8203 {
8204 if (stack_max != 0)
8205 {
8207 {
8209 }
8210
8211 if (split_quantity_new == 0)
8212 {
8213 if (!
g_Game.IsMultiplayer())
8214 player.PhysicalPredictiveDropItem(this);
8215 else
8216 player.ServerDropEntity(this);
8217 return;
8218 }
8219
8221 {
8223
8224 if (new_item)
8225 {
8226 new_item.SetResultOfSplit(true);
8227 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8230 new_item.PlaceOnSurface();
8231 }
8232 }
8233 }
8234 }
8235 }
8236
8238 {
8239 float split_quantity_new;
8243 InventoryLocation loc = new InventoryLocation;
8244
8245 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8246 {
8248 split_quantity_new = stack_max;
8249 else
8251
8253 {
8254 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8255 if (new_item)
8256 {
8257 new_item.SetResultOfSplit(true);
8258 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8260 new_item.
SetQuantity(split_quantity_new,
false,
true);
8261 }
8262 }
8263 }
8264 else if (destination_entity && slot_id == -1)
8265 {
8266 if (quantity > stack_max)
8267 split_quantity_new = stack_max;
8268 else
8269 split_quantity_new = quantity;
8270
8272 {
8273 GameInventory destinationInventory = destination_entity.GetInventory();
8275 {
8278 }
8279
8280 if (new_item)
8281 {
8282 new_item.SetResultOfSplit(true);
8283 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8285 new_item.
SetQuantity(split_quantity_new,
false,
true);
8286 }
8287 }
8288 }
8289 else
8290 {
8291 if (stack_max != 0)
8292 {
8294 {
8296 }
8297
8299 {
8301
8302 if (new_item)
8303 {
8304 new_item.SetResultOfSplit(true);
8305 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8308 new_item.PlaceOnSurface();
8309 }
8310 }
8311 }
8312 }
8313 }
8314
8316 {
8318 {
8319 if (ScriptInputUserData.CanStoreInputUserData())
8320 {
8321 ScriptInputUserData ctx = new ScriptInputUserData;
8326 dst.WriteToContext(ctx);
8328 }
8329 }
8330 else if (!
g_Game.IsMultiplayer())
8331 {
8333 }
8334 }
8335
8337 {
8339 {
8340 if (ScriptInputUserData.CanStoreInputUserData())
8341 {
8342 ScriptInputUserData ctx = new ScriptInputUserData;
8347 ctx.
Write(destination_entity);
8353 }
8354 }
8355 else if (!
g_Game.IsMultiplayer())
8356 {
8358 }
8359 }
8360
8362 {
8364 }
8365
8367 {
8369 float split_quantity_new;
8371 if (dst.IsValid())
8372 {
8373 int slot_id = dst.GetSlot();
8375
8376 if (quantity > stack_max)
8377 split_quantity_new = stack_max;
8378 else
8379 split_quantity_new = quantity;
8380
8382 {
8384
8385 if (new_item)
8386 {
8387 new_item.SetResultOfSplit(true);
8388 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8390 new_item.
SetQuantity(split_quantity_new,
false,
true);
8391 }
8392
8393 return new_item;
8394 }
8395 }
8396
8397 return null;
8398 }
8399
8401 {
8403 float split_quantity_new;
8405 if (destination_entity)
8406 {
8408 if (quantity > stackable)
8409 split_quantity_new = stackable;
8410 else
8411 split_quantity_new = quantity;
8412
8414 {
8415 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8416 if (new_item)
8417 {
8418 new_item.SetResultOfSplit(true);
8419 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8421 new_item.
SetQuantity(split_quantity_new,
false,
true);
8422 }
8423 }
8424 }
8425 }
8426
8428 {
8430 {
8431 if (ScriptInputUserData.CanStoreInputUserData())
8432 {
8433 ScriptInputUserData ctx = new ScriptInputUserData;
8438 ItemBase destination_entity =
this;
8439 ctx.
Write(destination_entity);
8443 }
8444 }
8445 else if (!
g_Game.IsMultiplayer())
8446 {
8448 }
8449 }
8450
8452 {
8454 float split_quantity_new;
8456 if (player)
8457 {
8459 if (quantity > stackable)
8460 split_quantity_new = stackable;
8461 else
8462 split_quantity_new = quantity;
8463
8465 {
8466 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8467 new_item =
ItemBase.Cast(in_hands);
8468 if (new_item)
8469 {
8470 new_item.SetResultOfSplit(true);
8471 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8473 new_item.SetQuantity(split_quantity_new, false, true);
8474 }
8475 }
8476 }
8477 }
8478
8480 {
8482 float split_quantity_new = Math.Floor(quantity * 0.5);
8483
8485 return;
8486
8488
8489 if (new_item)
8490 {
8491 if (new_item.GetQuantityMax() < split_quantity_new)
8492 {
8493 split_quantity_new = new_item.GetQuantityMax();
8494 }
8495
8496 new_item.SetResultOfSplit(true);
8497 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8498
8500 {
8503 }
8504 else
8505 {
8507 new_item.
SetQuantity(split_quantity_new,
false,
true);
8508 }
8509 }
8510 }
8511
8513 {
8515 float split_quantity_new = Math.Floor(quantity / 2);
8516
8518 return;
8519
8520 InventoryLocation invloc = new InventoryLocation;
8522
8524 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8525
8526 if (new_item)
8527 {
8528 if (new_item.GetQuantityMax() < split_quantity_new)
8529 {
8530 split_quantity_new = new_item.GetQuantityMax();
8531 }
8533 {
8536 }
8537 else if (split_quantity_new > 1)
8538 {
8540 new_item.
SetQuantity(split_quantity_new,
false,
true);
8541 }
8542 }
8543 }
8544
8547 {
8548 SetWeightDirty();
8550
8551 if (parent)
8552 parent.OnAttachmentQuantityChangedEx(this, delta);
8553
8555 {
8557 {
8559 }
8561 {
8562 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8564 }
8565 }
8566 }
8567
8570 {
8571
8572 }
8573
8576 {
8578 }
8579
8581 {
8582 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8583
8585 {
8586 if (newLevel == GameConstants.STATE_RUINED)
8587 {
8589 EntityAI parent = GetHierarchyParent();
8590 if (parent && parent.IsFireplace())
8591 {
8592 CargoBase cargo = GetInventory().GetCargo();
8593 if (cargo)
8594 {
8596 {
8598 }
8599 }
8600 }
8601 }
8602
8604 {
8605
8607 return;
8608 }
8609
8610 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8611 {
8613 }
8614 }
8615 }
8616
8617
8619 {
8620 super.OnRightClick();
8621
8623 {
8625 {
8626 if (ScriptInputUserData.CanStoreInputUserData())
8627 {
8628 EntityAI root = GetHierarchyRoot();
8629 Man playerOwner = GetHierarchyRootPlayer();
8630 InventoryLocation dst = new InventoryLocation;
8631
8632
8633 if (!playerOwner && root && root == this)
8634 {
8636 }
8637 else
8638 {
8639
8640 GetInventory().GetCurrentInventoryLocation(dst);
8642 {
8643 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8645 {
8647 }
8648 else
8649 {
8651
8652
8653 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8654 {
8656 }
8657 else
8658 {
8659 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8660 }
8661 }
8662 }
8663 }
8664
8665 ScriptInputUserData ctx = new ScriptInputUserData;
8673 }
8674 }
8675 else if (!
g_Game.IsMultiplayer())
8676 {
8678 }
8679 }
8680 }
8681
8683 {
8684 if (root)
8685 {
8686 vector m4[4];
8687 root.GetTransform(m4);
8688 dst.SetGround(this, m4);
8689 }
8690 else
8691 {
8692 GetInventory().GetCurrentInventoryLocation(dst);
8693 }
8694 }
8695
8696 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8697 {
8698
8699 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8700 return false;
8701
8702 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8703 return false;
8704
8705
8707 return false;
8708
8709
8710 Magazine mag = Magazine.Cast(this);
8711 if (mag)
8712 {
8713 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8714 return false;
8715
8716 if (stack_max_limit)
8717 {
8718 Magazine other_mag = Magazine.Cast(other_item);
8719 if (other_item)
8720 {
8721 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8722 return false;
8723 }
8724
8725 }
8726 }
8727 else
8728 {
8729
8731 return false;
8732
8734 return false;
8735 }
8736
8737 PlayerBase player = null;
8738 if (CastTo(player, GetHierarchyRootPlayer()))
8739 {
8740 if (player.GetInventory().HasAttachment(this))
8741 return false;
8742
8743 if (player.IsItemsToDelete())
8744 return false;
8745 }
8746
8747 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8748 return false;
8749
8750 int slotID;
8752 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8753 return false;
8754
8755 return true;
8756 }
8757
8759 {
8761 }
8762
8764 {
8765 return m_IsResultOfSplit;
8766 }
8767
8769 {
8770 m_IsResultOfSplit = value;
8771 }
8772
8774 {
8776 }
8777
8779 {
8780 float other_item_quantity = other_item.GetQuantity();
8781 float this_free_space;
8782
8784
8786
8787 if (other_item_quantity > this_free_space)
8788 {
8789 return this_free_space;
8790 }
8791 else
8792 {
8793 return other_item_quantity;
8794 }
8795 }
8796
8798 {
8800 }
8801
8803 {
8805 return;
8806
8807 if (!IsMagazine() && other_item)
8808 {
8810 if (quantity_used != 0)
8811 {
8812 float hp1 = GetHealth01("","");
8813 float hp2 = other_item.GetHealth01("","");
8814 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8815 hpResult = hpResult / (
GetQuantity() + quantity_used);
8816
8817 hpResult *= GetMaxHealth();
8818 Math.Round(hpResult);
8819 SetHealth("", "Health", hpResult);
8820
8822 other_item.AddQuantity(-quantity_used);
8823 }
8824 }
8826 }
8827
8829 {
8830 #ifdef SERVER
8831 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8832 GetHierarchyParent().IncreaseLifetimeUp();
8833 #endif
8834 };
8835
8837 {
8838 PlayerBase p = PlayerBase.Cast(player);
8839
8840 array<int> recipesIds = p.m_Recipes;
8841 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8842 if (moduleRecipesManager)
8843 {
8844 EntityAI itemInHands = player.GetEntityInHands();
8845 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8846 }
8847
8848 for (int i = 0;i < recipesIds.Count(); i++)
8849 {
8850 int key = recipesIds.Get(i);
8851 string recipeName = moduleRecipesManager.GetRecipeName(key);
8853 }
8854 }
8855
8856
8857 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8858 {
8859 super.GetDebugActions(outputList);
8860
8861
8867
8868
8873
8878
8879
8883
8884
8886 {
8890 }
8891
8894
8895
8899
8901
8902 InventoryLocation loc = new InventoryLocation();
8903 GetInventory().GetCurrentInventoryLocation(loc);
8905 {
8906 if (Gizmo_IsSupported())
8909 }
8910
8912 }
8913
8914
8915
8916
8918 {
8919 super.OnAction(action_id, player, ctx);
8920
8922 {
8923 switch (action_id)
8924 {
8928 return true;
8932 return true;
8933 }
8934 }
8935
8937 {
8938 switch (action_id)
8939 {
8941 Delete();
8942 return true;
8943 }
8944 }
8945
8946 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8947 {
8948 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8949 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8950 PlayerBase p = PlayerBase.Cast(player);
8951 if (
EActions.RECIPES_RANGE_START < 1000)
8952 {
8953 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8954 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8955 }
8956 }
8957 #ifndef SERVER
8958 else if (action_id ==
EActions.WATCH_PLAYER)
8959 {
8960 PluginDeveloper.SetDeveloperItemClientEx(player);
8961 }
8962 #endif
8964 {
8965 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8966 {
8967 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8968 OnDebugButtonPressServer(id + 1);
8969 }
8970
8971 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8972 {
8973 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8975 }
8976
8977 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8978 {
8979 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8981 }
8982
8983 else if (action_id ==
EActions.ADD_QUANTITY)
8984 {
8985 if (IsMagazine())
8986 {
8987 Magazine mag = Magazine.Cast(this);
8988 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8989 }
8990 else
8991 {
8993 }
8994
8995 if (m_EM)
8996 {
8997 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8998 }
8999
9000 }
9001
9002 else if (action_id ==
EActions.REMOVE_QUANTITY)
9003 {
9004 if (IsMagazine())
9005 {
9006 Magazine mag2 = Magazine.Cast(this);
9007 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9008 }
9009 else
9010 {
9012 }
9013 if (m_EM)
9014 {
9015 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9016 }
9017
9018 }
9019
9020 else if (action_id ==
EActions.SET_QUANTITY_0)
9021 {
9023
9024 if (m_EM)
9025 {
9026 m_EM.SetEnergy(0);
9027 }
9028 }
9029
9030 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9031 {
9033
9034 if (m_EM)
9035 {
9036 m_EM.SetEnergy(m_EM.GetEnergyMax());
9037 }
9038 }
9039
9040 else if (action_id ==
EActions.ADD_HEALTH)
9041 {
9042 AddHealth("","",GetMaxHealth("","Health")/5);
9043 }
9044 else if (action_id ==
EActions.REMOVE_HEALTH)
9045 {
9046 AddHealth("","",-GetMaxHealth("","Health")/5);
9047 }
9048 else if (action_id ==
EActions.DESTROY_HEALTH)
9049 {
9050 SetHealth01("","",0);
9051 }
9052 else if (action_id ==
EActions.WATCH_ITEM)
9053 {
9055 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9056 #ifdef DEVELOPER
9057 SetDebugDeveloper_item(this);
9058 #endif
9059 }
9060
9061 else if (action_id ==
EActions.ADD_TEMPERATURE)
9062 {
9063 AddTemperature(20);
9064
9065 }
9066
9067 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9068 {
9069 AddTemperature(-20);
9070
9071 }
9072
9073 else if (action_id ==
EActions.FLIP_FROZEN)
9074 {
9075 SetFrozen(!GetIsFrozen());
9076
9077 }
9078
9079 else if (action_id ==
EActions.ADD_WETNESS)
9080 {
9082
9083 }
9084
9085 else if (action_id ==
EActions.REMOVE_WETNESS)
9086 {
9088
9089 }
9090
9091 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9092 {
9095
9096
9097 }
9098
9099 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9100 {
9103 }
9104
9105 else if (action_id ==
EActions.MAKE_SPECIAL)
9106 {
9107 auto debugParams = DebugSpawnParams.WithPlayer(player);
9108 OnDebugSpawnEx(debugParams);
9109 }
9110
9111 }
9112
9113
9114 return false;
9115 }
9116
9117
9118
9119
9123
9126
9127
9128
9130 {
9131 return false;
9132 }
9133
9134
9136 {
9137 return true;
9138 }
9139
9140
9142 {
9143 return true;
9144 }
9145
9146
9147
9149 {
9150 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9151 return g_Game.ConfigIsExisting(config_path);
9152 }
9153
9156 {
9157 return null;
9158 }
9159
9161 {
9162 return false;
9163 }
9164
9166 {
9167 return false;
9168 }
9169
9173
9174
9176 {
9177 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9178 return module_repairing.CanRepair(this, item_repair_kit);
9179 }
9180
9181
9182 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9183 {
9184 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9185 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9186 }
9187
9188
9190 {
9191
9192
9193
9194
9195
9196
9197
9198
9199 return 1;
9200 }
9201
9202
9203
9205 {
9207 }
9208
9209
9210
9212 {
9214 }
9215
9216
9225 {
9226 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9227
9228 if (player)
9229 {
9230 player.MessageStatus(text);
9231 }
9232 }
9233
9234
9243 {
9244 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9245
9246 if (player)
9247 {
9248 player.MessageAction(text);
9249 }
9250 }
9251
9252
9261 {
9262 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9263
9264 if (player)
9265 {
9266 player.MessageFriendly(text);
9267 }
9268 }
9269
9270
9279 {
9280 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9281
9282 if (player)
9283 {
9284 player.MessageImportant(text);
9285 }
9286 }
9287
9289 {
9290 return true;
9291 }
9292
9293
9294 override bool KindOf(
string tag)
9295 {
9296 bool found = false;
9297 string item_name = this.
GetType();
9299 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9300
9301 int array_size = item_tag_array.Count();
9302 for (int i = 0; i < array_size; i++)
9303 {
9304 if (item_tag_array.Get(i) == tag)
9305 {
9306 found = true;
9307 break;
9308 }
9309 }
9310 return found;
9311 }
9312
9313
9315 {
9316
9317 super.OnRPC(sender, rpc_type,ctx);
9318
9319
9320 switch (rpc_type)
9321 {
9322 #ifndef SERVER
9323 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9324 Param2<bool, string> p = new Param2<bool, string>(false, "");
9325
9327 return;
9328
9329 bool play = p.param1;
9330 string soundSet = p.param2;
9331
9332 if (play)
9333 {
9335 {
9337 {
9339 }
9340 }
9341 else
9342 {
9344 }
9345 }
9346 else
9347 {
9349 }
9350
9351 break;
9352 #endif
9353
9354 }
9355
9357 {
9359 }
9360 }
9361
9362
9363
9364
9366 {
9367 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9368 return plugin.GetID(
name);
9369 }
9370
9372 {
9373 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9374 return plugin.GetName(id);
9375 }
9376
9379 {
9380
9381
9382 int varFlags;
9383 if (!ctx.
Read(varFlags))
9384 return;
9385
9386 if (varFlags & ItemVariableFlags.FLOAT)
9387 {
9389 }
9390 }
9391
9393 {
9394
9395 super.SerializeNumericalVars(floats_out);
9396
9397
9398
9400 {
9402 }
9403
9405 {
9407 }
9408
9410 {
9412 }
9413
9415 {
9420 }
9421
9423 {
9425 }
9426 }
9427
9429 {
9430
9431 super.DeSerializeNumericalVars(floats);
9432
9433
9434 int index = 0;
9435 int mask = Math.Round(floats.Get(index));
9436
9437 index++;
9438
9440 {
9442 {
9444 }
9445 else
9446 {
9447 float quantity = floats.Get(index);
9449 }
9450 index++;
9451 }
9452
9454 {
9455 float wet = floats.Get(index);
9457 index++;
9458 }
9459
9461 {
9462 int liquidtype = Math.Round(floats.Get(index));
9464 index++;
9465 }
9466
9468 {
9470 index++;
9472 index++;
9474 index++;
9476 index++;
9477 }
9478
9480 {
9481 int cleanness = Math.Round(floats.Get(index));
9483 index++;
9484 }
9485 }
9486
9488 {
9489 super.WriteVarsToCTX(ctx);
9490
9491
9493 {
9495 }
9496
9498 {
9500 }
9501
9503 {
9505 }
9506
9508 {
9509 int r,g,b,a;
9515 }
9516
9518 {
9520 }
9521 }
9522
9524 {
9525 if (!super.ReadVarsFromCTX(ctx,version))
9526 return false;
9527
9528 int intValue;
9529 float value;
9530
9531 if (version < 140)
9532 {
9533 if (!ctx.
Read(intValue))
9534 return false;
9535
9536 m_VariablesMask = intValue;
9537 }
9538
9540 {
9541 if (!ctx.
Read(value))
9542 return false;
9543
9545 {
9547 }
9548 else
9549 {
9551 }
9552 }
9553
9554 if (version < 140)
9555 {
9557 {
9558 if (!ctx.
Read(value))
9559 return false;
9560 SetTemperatureDirect(value);
9561 }
9562 }
9563
9565 {
9566 if (!ctx.
Read(value))
9567 return false;
9569 }
9570
9572 {
9573 if (!ctx.
Read(intValue))
9574 return false;
9576 }
9577
9579 {
9580 int r,g,b,a;
9582 return false;
9584 return false;
9586 return false;
9588 return false;
9589
9591 }
9592
9594 {
9595 if (!ctx.
Read(intValue))
9596 return false;
9598 }
9599
9600 if (version >= 138 && version < 140)
9601 {
9603 {
9604 if (!ctx.
Read(intValue))
9605 return false;
9606 SetFrozen(intValue);
9607 }
9608 }
9609
9610 return true;
9611 }
9612
9613
9615 {
9618 {
9620 }
9621
9622 if (!super.OnStoreLoad(ctx, version))
9623 {
9625 return false;
9626 }
9627
9628 if (version >= 114)
9629 {
9630 bool hasQuickBarIndexSaved;
9631
9632 if (!ctx.
Read(hasQuickBarIndexSaved))
9633 {
9635 return false;
9636 }
9637
9638 if (hasQuickBarIndexSaved)
9639 {
9640 int itmQBIndex;
9641
9642
9643 if (!ctx.
Read(itmQBIndex))
9644 {
9646 return false;
9647 }
9648
9649 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9650 if (itmQBIndex != -1 && parentPlayer)
9651 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9652 }
9653 }
9654 else
9655 {
9656
9657 PlayerBase player;
9658 int itemQBIndex;
9659 if (version ==
int.
MAX)
9660 {
9661 if (!ctx.
Read(itemQBIndex))
9662 {
9664 return false;
9665 }
9666 }
9667 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9668 {
9669
9670 if (!ctx.
Read(itemQBIndex))
9671 {
9673 return false;
9674 }
9675 if (itemQBIndex != -1 && player)
9676 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9677 }
9678 }
9679
9680 if (version < 140)
9681 {
9682
9683 if (!LoadVariables(ctx, version))
9684 {
9686 return false;
9687 }
9688 }
9689
9690
9692 {
9694 return false;
9695 }
9696 if (version >= 132)
9697 {
9699 if (raib)
9700 {
9702 {
9704 return false;
9705 }
9706 }
9707 }
9708
9710 return true;
9711 }
9712
9713
9714
9716 {
9717 super.OnStoreSave(ctx);
9718
9719 PlayerBase player;
9720 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9721 {
9723
9724 int itemQBIndex = -1;
9725 itemQBIndex = player.FindQuickBarEntityIndex(this);
9726 ctx.
Write(itemQBIndex);
9727 }
9728 else
9729 {
9731 }
9732
9734
9736 if (raib)
9737 {
9739 }
9740 }
9741
9742
9744 {
9745 super.AfterStoreLoad();
9746
9748 {
9750 }
9751
9753 {
9756 }
9757 }
9758
9760 {
9761 super.EEOnAfterLoad();
9762
9764 {
9766 }
9767
9770 }
9771
9773 {
9774 return false;
9775 }
9776
9777
9778
9780 {
9782 {
9783 #ifdef PLATFORM_CONSOLE
9784
9786 {
9788 if (menu)
9789 {
9791 }
9792 }
9793 #endif
9794 }
9795
9797 {
9800 }
9801
9803 {
9804 SetWeightDirty();
9806 }
9808 {
9811 }
9812
9814 {
9817
9820 }
9822 {
9826 }
9827
9828 super.OnVariablesSynchronized();
9829 }
9830
9831
9832
9834 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9835 {
9836 if (!IsServerCheck(allow_client))
9837 return false;
9838
9840 return false;
9841
9844
9845 if (value <= (min + 0.001))
9846 value = min;
9847
9848 if (value == min)
9849 {
9850 if (destroy_config)
9851 {
9852 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9853 if (dstr)
9854 {
9856 this.Delete();
9857 return true;
9858 }
9859 }
9860 else if (destroy_forced)
9861 {
9863 this.Delete();
9864 return true;
9865 }
9866
9868 }
9869
9872
9874 {
9875 EntityAI parent = GetHierarchyRoot();
9876 InventoryLocation iLoc = new InventoryLocation();
9877 GetInventory().GetCurrentInventoryLocation(iLoc);
9879 {
9880 int iLocSlot = iLoc.
GetSlot();
9882 {
9884 }
9886 {
9888 }
9889 }
9890 }
9891
9893 {
9895
9896 if (delta)
9898 }
9899
9901
9902 return false;
9903 }
9904
9905
9907 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9908 {
9910 }
9911
9913 {
9916 }
9917
9919 {
9922 }
9923
9925 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9926 {
9927 float value_clamped = Math.Clamp(value, 0, 1);
9929 SetQuantity(result, destroy_config, destroy_forced);
9930 }
9931
9932
9935 {
9937 }
9938
9940 {
9942 }
9943
9944
9945
9946
9947
9948
9949
9950
9951
9952
9954 {
9955 int slot = -1;
9956 GameInventory inventory = GetInventory();
9957 if (inventory)
9958 {
9959 InventoryLocation il = new InventoryLocation;
9962 }
9963
9965 }
9966
9968 {
9969 float quantity_max = 0;
9970
9972 {
9973 if (attSlotID != -1)
9974 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9975
9976 if (quantity_max <= 0)
9978 }
9979
9980 if (quantity_max <= 0)
9982
9983 return quantity_max;
9984 }
9985
9987 {
9989 }
9990
9992 {
9994 }
9995
9996
9998 {
10000 }
10001
10003 {
10005 }
10006
10008 {
10010 }
10011
10012
10014 {
10015
10016 float weightEx = GetWeightEx();
10017 float special = GetInventoryAndCargoWeight();
10018 return weightEx - special;
10019 }
10020
10021
10023 {
10025 }
10026
10028 {
10030 {
10031 #ifdef DEVELOPER
10032 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10033 {
10034 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10036 }
10037 #endif
10038
10039 return GetQuantity() * GetConfigWeightModified();
10040 }
10041 else if (HasEnergyManager())
10042 {
10043 #ifdef DEVELOPER
10044 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10045 {
10046 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10047 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10048 }
10049 #endif
10050 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10051 }
10052 else
10053 {
10054 #ifdef DEVELOPER
10055 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10056 {
10057 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10058 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10059 }
10060 #endif
10061 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10062 }
10063 }
10064
10067 {
10068 int item_count = 0;
10070
10071 GameInventory inventory = GetInventory();
10072 CargoBase cargo = inventory.
GetCargo();
10073 if (cargo != NULL)
10074 {
10076 }
10077
10079 for (int i = 0; i < nAttachments; ++i)
10080 {
10082 if (item)
10083 item_count += item.GetNumberOfItems();
10084 }
10085 return item_count;
10086 }
10087
10090 {
10091 float weight = 0;
10092 float wetness = 1;
10093 if (include_wetness)
10096 {
10097 weight = wetness * m_ConfigWeight;
10098 }
10100 {
10101 weight = 1;
10102 }
10103 return weight;
10104 }
10105
10106
10107
10109 {
10110 GameInventory inventory = GetInventory();
10111 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10112 {
10113 array<EntityAI> items = new array<EntityAI>;
10115 for (int i = 0; i < items.Count(); ++i)
10116 {
10118 if (item)
10119 {
10120 g_Game.ObjectDelete(item);
10121 }
10122 }
10123 }
10124 }
10125
10126
10127
10128
10130 {
10131 float energy = 0;
10132 if (HasEnergyManager())
10133 {
10134 energy = GetCompEM().GetEnergy();
10135 }
10136 return energy;
10137 }
10138
10139
10141 {
10142 super.OnEnergyConsumed();
10143
10145 }
10146
10148 {
10149 super.OnEnergyAdded();
10150
10152 }
10153
10154
10156 {
10157 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10158 {
10160 {
10161 float energy_0to1 = GetCompEM().GetEnergy0To1();
10163 }
10164 }
10165 }
10166
10167
10169 {
10170 return ConfigGetFloat("heatIsolation");
10171 }
10172
10174 {
10176 }
10177
10179 {
10180 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10181 if (
g_Game.ConfigIsExisting(paramPath))
10182 return g_Game.ConfigGetFloat(paramPath);
10183
10184 return 0.0;
10185 }
10186
10188 {
10189 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10190 if (
g_Game.ConfigIsExisting(paramPath))
10191 return g_Game.ConfigGetFloat(paramPath);
10192
10193 return 0.0;
10194 }
10195
10196 override void SetWet(
float value,
bool allow_client =
false)
10197 {
10198 if (!IsServerCheck(allow_client))
10199 return;
10200
10203
10205
10206 m_VarWet = Math.Clamp(value, min, max);
10207
10209 {
10212 }
10213 }
10214
10215 override void AddWet(
float value)
10216 {
10218 }
10219
10221 {
10223 }
10224
10226 {
10228 }
10229
10231 {
10233 }
10234
10236 {
10238 }
10239
10241 {
10243 }
10244
10245 override void OnWetChanged(
float newVal,
float oldVal)
10246 {
10249 if (newLevel != oldLevel)
10250 {
10252 }
10253 }
10254
10256 {
10257 SetWeightDirty();
10258 }
10259
10261 {
10262 return GetWetLevelInternal(
m_VarWet);
10263 }
10264
10265
10266
10268 {
10270 }
10271
10273 {
10275 }
10276
10278 {
10280 }
10281
10283 {
10285 }
10286
10287
10288
10290 {
10291 if (ConfigIsExisting("itemModelLength"))
10292 {
10293 return ConfigGetFloat("itemModelLength");
10294 }
10295 return 0;
10296 }
10297
10299 {
10300 if (ConfigIsExisting("itemAttachOffset"))
10301 {
10302 return ConfigGetFloat("itemAttachOffset");
10303 }
10304 return 0;
10305 }
10306
10307 override void SetCleanness(
int value,
bool allow_client =
false)
10308 {
10309 if (!IsServerCheck(allow_client))
10310 return;
10311
10313
10315
10318 }
10319
10321 {
10323 }
10324
10326 {
10327 return true;
10328 }
10329
10330
10331
10332
10334 {
10336 }
10337
10339 {
10341 }
10342
10343
10344
10345
10346 override void SetColor(
int r,
int g,
int b,
int a)
10347 {
10353 }
10355 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10356 {
10361 }
10362
10364 {
10366 }
10367
10370 {
10371 int r,g,b,a;
10373 r = r/255;
10374 g = g/255;
10375 b = b/255;
10376 a = a/255;
10377 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10378 }
10379
10380
10381
10382 override void SetLiquidType(
int value,
bool allow_client =
false)
10383 {
10384 if (!IsServerCheck(allow_client))
10385 return;
10386
10391 }
10392
10394 {
10395 return ConfigGetInt("varLiquidTypeInit");
10396 }
10397
10399 {
10401 }
10402
10404 {
10406 SetFrozen(false);
10407 }
10408
10411 {
10412 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10413 }
10414
10415
10418 {
10419 PlayerBase nplayer;
10420 if (PlayerBase.CastTo(nplayer, player))
10421 {
10423 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10424 }
10425 }
10426
10427
10430 {
10431 PlayerBase nplayer;
10432 if (PlayerBase.CastTo(nplayer,player))
10433 {
10434 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10435 }
10436
10437 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10438
10439 if (HasEnergyManager())
10440 {
10441 GetCompEM().UpdatePlugState();
10442 }
10443 }
10444
10445
10447 {
10448 super.OnPlacementStarted(player);
10449
10451 }
10452
10453 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10454 {
10456 {
10457 m_AdminLog.OnPlacementComplete(player,
this);
10458 }
10459
10460 super.OnPlacementComplete(player, position, orientation);
10461 }
10462
10463
10464
10465
10466
10468 {
10470 {
10471 return true;
10472 }
10473 else
10474 {
10475 return false;
10476 }
10477 }
10478
10479
10481 {
10483 {
10485 }
10486 }
10487
10488
10490 {
10492 }
10493
10495 {
10497 }
10498
10499 override void InsertAgent(
int agent,
float count = 1)
10500 {
10501 if (count < 1)
10502 return;
10503
10505 }
10506
10509 {
10511 }
10512
10513
10515 {
10517 }
10518
10519
10520
10521
10522
10523
10524
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
10561 {
10563 return false;
10564 return true;
10565 }
10566
10568 {
10569
10571 }
10572
10573
10576 {
10577 super.CheckForRoofLimited(timeTresholdMS);
10578
10579 float time =
g_Game.GetTime();
10580 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10581 {
10582 m_PreviousRoofTestTime = time;
10583 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10584 }
10585 }
10586
10587
10589 {
10591 {
10592 return 0;
10593 }
10594
10595 if (GetInventory().GetAttachmentSlotsCount() != 0)
10596 {
10597 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10598 if (filter)
10599 return filter.GetProtectionLevel(type, false, system);
10600 else
10601 return 0;
10602 }
10603
10604 string subclassPath, entryName;
10605
10606 switch (type)
10607 {
10609 entryName = "biological";
10610 break;
10612 entryName = "chemical";
10613 break;
10614 default:
10615 entryName = "biological";
10616 break;
10617 }
10618
10619 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10620
10621 return g_Game.ConfigGetFloat(subclassPath + entryName);
10622 }
10623
10624
10625
10628 {
10629 if (!IsMagazine())
10631
10633 }
10634
10635
10636
10637
10638
10643 {
10644 return true;
10645 }
10646
10648 {
10650 }
10651
10652
10653
10654
10655
10657 {
10658 if (parent)
10659 {
10660 if (parent.IsInherited(DayZInfected))
10661 return true;
10662
10663 if (!parent.IsRuined())
10664 return true;
10665 }
10666
10667 return true;
10668 }
10669
10671 {
10672 if (!super.CanPutAsAttachment(parent))
10673 {
10674 return false;
10675 }
10676
10677 if (!IsRuined() && !parent.IsRuined())
10678 {
10679 return true;
10680 }
10681
10682 return false;
10683 }
10684
10686 {
10687
10688
10689
10690
10691 return super.CanReceiveItemIntoCargo(item);
10692 }
10693
10695 {
10696
10697
10698
10699
10700 GameInventory attachmentInv = attachment.GetInventory();
10702 {
10703 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10704 return false;
10705 }
10706
10707 InventoryLocation loc = new InventoryLocation();
10708 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10709 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10710 return false;
10711
10712 return super.CanReceiveAttachment(attachment, slotId);
10713 }
10714
10716 {
10717 if (!super.CanReleaseAttachment(attachment))
10718 return false;
10719
10720 return GetInventory().AreChildrenAccessible();
10721 }
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10738
10739
10740
10741
10742
10744 {
10745 int id = muzzle_owner.GetMuzzleID();
10746 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10747
10748 if (WPOF_array)
10749 {
10750 for (int i = 0; i < WPOF_array.Count(); i++)
10751 {
10752 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10753
10754 if (WPOF)
10755 {
10756 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10757 }
10758 }
10759 }
10760 }
10761
10762
10764 {
10765 int id = muzzle_owner.GetMuzzleID();
10767
10768 if (WPOBE_array)
10769 {
10770 for (int i = 0; i < WPOBE_array.Count(); i++)
10771 {
10772 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10773
10774 if (WPOBE)
10775 {
10776 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10777 }
10778 }
10779 }
10780 }
10781
10782
10784 {
10785 int id = muzzle_owner.GetMuzzleID();
10786 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10787
10788 if (WPOOH_array)
10789 {
10790 for (int i = 0; i < WPOOH_array.Count(); i++)
10791 {
10792 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10793
10794 if (WPOOH)
10795 {
10796 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10797 }
10798 }
10799 }
10800 }
10801
10802
10804 {
10805 int id = muzzle_owner.GetMuzzleID();
10806 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10807
10808 if (WPOOH_array)
10809 {
10810 for (int i = 0; i < WPOOH_array.Count(); i++)
10811 {
10812 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10813
10814 if (WPOOH)
10815 {
10816 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10817 }
10818 }
10819 }
10820 }
10821
10822
10824 {
10825 int id = muzzle_owner.GetMuzzleID();
10826 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10827
10828 if (WPOOH_array)
10829 {
10830 for (int i = 0; i < WPOOH_array.Count(); i++)
10831 {
10832 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10833
10834 if (WPOOH)
10835 {
10836 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10837 }
10838 }
10839 }
10840 }
10841
10842
10843
10845 {
10847 {
10848 return true;
10849 }
10850
10851 return false;
10852 }
10853
10855 {
10857 {
10858 return true;
10859 }
10860
10861 return false;
10862 }
10863
10865 {
10867 {
10868 return true;
10869 }
10870
10871 return false;
10872 }
10873
10875 {
10876 return false;
10877 }
10878
10881 {
10882 return UATimeSpent.DEFAULT_DEPLOY;
10883 }
10884
10885
10886
10887
10889 {
10891 SetSynchDirty();
10892 }
10893
10895 {
10897 }
10898
10899
10901 {
10902 return false;
10903 }
10904
10907 {
10908 string att_type = "None";
10909
10910 if (ConfigIsExisting("soundAttType"))
10911 {
10912 att_type = ConfigGetString("soundAttType");
10913 }
10914
10916 }
10917
10919 {
10921 }
10922
10923
10924
10925
10926
10932
10934 {
10937
10939 }
10940
10941
10943 {
10945 return;
10946
10948
10951
10954
10955 SoundParameters params = new SoundParameters();
10959 }
10960
10961
10963 {
10965 {
10968
10969 SetSynchDirty();
10970
10973 }
10974 }
10975
10977 {
10979 }
10980
10981
10983 {
10985 return;
10986
10988 SetSynchDirty();
10989
10992 }
10993
10995 {
10998 }
10999
11001 {
11003 }
11004
11005 void OnApply(PlayerBase player);
11006
11008 {
11009 return 1.0;
11010 };
11011
11013 {
11015 }
11016
11018 {
11020 }
11021
11023
11025 {
11026 SetDynamicPhysicsLifeTime(0.01);
11028 }
11029
11031 {
11032 array<string> zone_names = new array<string>;
11033 GetDamageZones(zone_names);
11034 for (int i = 0; i < zone_names.Count(); i++)
11035 {
11036 SetHealthMax(zone_names.Get(i),"Health");
11037 }
11038 SetHealthMax("","Health");
11039 }
11040
11043 {
11044 float global_health = GetHealth01("","Health");
11045 array<string> zones = new array<string>;
11046 GetDamageZones(zones);
11047
11048 for (int i = 0; i < zones.Count(); i++)
11049 {
11050 SetHealth01(zones.Get(i),"Health",global_health);
11051 }
11052 }
11053
11056 {
11057 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11058 }
11059
11061 {
11062 if (!hasRootAsPlayer)
11063 {
11064 if (refParentIB)
11065 {
11066
11067 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11068 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11069
11070 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11071 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11072
11075 }
11076 else
11077 {
11078
11081 }
11082 }
11083 }
11084
11086 {
11088 {
11089 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11090 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11091 {
11092 float heatPermCoef = 1.0;
11094 while (ent)
11095 {
11096 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11097 ent = ent.GetHierarchyParent();
11098 }
11099
11100 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11101 }
11102 }
11103 }
11104
11106 {
11107
11108 EntityAI parent = GetHierarchyParent();
11109 if (!parent)
11110 {
11111 hasParent = false;
11112 hasRootAsPlayer = false;
11113 }
11114 else
11115 {
11116 hasParent = true;
11117 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11118 refParentIB =
ItemBase.Cast(parent);
11119 }
11120 }
11121
11122 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11123 {
11124
11125 }
11126
11128 {
11129
11130 return false;
11131 }
11132
11134 {
11135
11136
11137 return false;
11138 }
11139
11141 {
11142
11143 return false;
11144 }
11145
11148 {
11149 return !GetIsFrozen() &&
IsOpen();
11150 }
11151
11153 {
11154 bool hasParent = false, hasRootAsPlayer = false;
11156
11157 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11158 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11159
11160 if (wwtu || foodDecay)
11161 {
11165
11166 if (processWetness || processTemperature || processDecay)
11167 {
11169
11170 if (processWetness)
11171 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11172
11173 if (processTemperature)
11175
11176 if (processDecay)
11177 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11178 }
11179 }
11180 }
11181
11184 {
11186 }
11187
11189 {
11192
11193 return super.GetTemperatureFreezeThreshold();
11194 }
11195
11197 {
11200
11201 return super.GetTemperatureThawThreshold();
11202 }
11203
11205 {
11208
11209 return super.GetItemOverheatThreshold();
11210 }
11211
11213 {
11215 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11216
11217 return super.GetTemperatureFreezeTime();
11218 }
11219
11221 {
11223 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11224
11225 return super.GetTemperatureThawTime();
11226 }
11227
11232
11234 {
11235 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11236 }
11237
11239 {
11240 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11241 }
11242
11245 {
11247 }
11248
11250 {
11252 }
11253
11255 {
11257 }
11258
11261 {
11262 return null;
11263 }
11264
11267 {
11268 return false;
11269 }
11270
11272 {
11274 {
11277 if (!trg)
11278 {
11280 explosive = this;
11281 }
11282
11283 explosive.PairRemote(trg);
11285
11286 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11287 trg.SetPersistentPairID(persistentID);
11288 explosive.SetPersistentPairID(persistentID);
11289
11290 return true;
11291 }
11292 return false;
11293 }
11294
11297 {
11298 float ret = 1.0;
11301 ret *= GetHealth01();
11302
11303 return ret;
11304 }
11305
11306 #ifdef DEVELOPER
11307 override void SetDebugItem()
11308 {
11309 super.SetDebugItem();
11310 _itemBase = this;
11311 }
11312
11314 {
11315 string text = super.GetDebugText();
11316
11318 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11319
11320 return text;
11321 }
11322 #endif
11323
11325 {
11326 return true;
11327 }
11328
11330
11332
11334 {
11337 }
11338
11339
11347
11363
11364 [
Obsolete(
"Use ItemSoundHandler instead")]
11367 {
11368 if (!
g_Game.IsDedicatedServer())
11369 {
11370 if (ConfigIsExisting("attachSoundSet"))
11371 {
11372 string cfg_path = "";
11373 string soundset = "";
11374 string type_name =
GetType();
11375
11378 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11379 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11380
11381 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11382 {
11383 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11384 {
11385 if (cfg_slot_array[i] == slot_type)
11386 {
11387 soundset = cfg_soundset_array[i];
11388 break;
11389 }
11390 }
11391 }
11392
11393 if (soundset != "")
11394 {
11395 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11397 }
11398 }
11399 }
11400 }
11401
11403}
11404
11406{
11408 if (entity)
11409 {
11410 bool is_item = entity.IsInherited(
ItemBase);
11411 if (is_item && full_quantity)
11412 {
11415 }
11416 }
11417 else
11418 {
11420 return NULL;
11421 }
11422 return entity;
11423}
11424
11426{
11427 if (item)
11428 {
11429 if (health > 0)
11430 item.SetHealth("", "", health);
11431
11432 if (item.CanHaveTemperature())
11433 {
11435 if (item.CanFreeze())
11436 item.SetFrozen(false);
11437 }
11438
11439 if (item.HasEnergyManager())
11440 {
11441 if (quantity >= 0)
11442 {
11443 item.GetCompEM().SetEnergy0To1(quantity);
11444 }
11445 else
11446 {
11448 }
11449 }
11450 else if (item.IsMagazine())
11451 {
11452 Magazine mag = Magazine.Cast(item);
11453 if (quantity >= 0)
11454 {
11455 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11456 }
11457 else
11458 {
11460 }
11461
11462 }
11463 else
11464 {
11465 if (quantity >= 0)
11466 {
11467 item.SetQuantityNormalized(quantity, false);
11468 }
11469 else
11470 {
11472 }
11473
11474 }
11475 }
11476}
11477
11478#ifdef DEVELOPER
11480#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.