6495{
6497 {
6498 return true;
6499 }
6500};
6501
6503{
6504
6505};
6506
6507
6508
6510{
6514
6516
6519
6520
6521
6522
6523
6532
6538
6543
6548
6569 protected bool m_IsResultOfSplit
6570
6572
6577
6578
6579
6581
6585
6586
6587
6589
6592
6593
6594
6600
6601
6609
6612
6613
6615
6616
6618
6619
6624
6625
6630
6632
6633
6635
6636
6638 {
6643
6644 if (!
g_Game.IsDedicatedServer())
6645 {
6647 {
6649
6651 {
6653 }
6654 }
6655
6658 }
6659
6660 m_OldLocation = null;
6661
6663 {
6665 }
6666
6667 if (ConfigIsExisting("headSelectionsToHide"))
6668 {
6671 }
6672
6674 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6675 {
6677 }
6678
6680
6681 m_IsResultOfSplit = false;
6682
6684 }
6685
6687 {
6688 super.InitItemVariables();
6689
6695 m_Count = ConfigGetInt(
"count");
6696
6699
6704
6707
6712
6724
6728
6729
6732 if (ConfigIsExisting("canBeSplit"))
6733 {
6736 }
6737
6739 if (ConfigIsExisting("itemBehaviour"))
6741
6742
6745 RegisterNetSyncVariableInt("m_VarLiquidType");
6746 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6747
6748 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6749 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6750 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6751
6752 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6753 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6754 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6755 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6756
6757 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6758 RegisterNetSyncVariableBool("m_IsTakeable");
6759 RegisterNetSyncVariableBool("m_IsHologram");
6760
6763 {
6766 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6767 }
6768
6770
6772 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6774
6776 }
6777
6779 {
6781 }
6782
6784 {
6787 {
6792 }
6793 }
6794
6795 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6796 {
6798 {
6801 }
6802
6804 }
6805
6807 {
6813 }
6814
6816
6818 {
6820
6821 if (!action)
6822 {
6823 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6824 return;
6825 }
6826
6828 if (!ai)
6829 {
6831 return;
6832 }
6833
6835 if (!action_array)
6836 {
6837 action_array = new array<ActionBase_Basic>;
6839 }
6840 if (LogManager.IsActionLogEnable())
6841 {
6842 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6843 }
6844
6845 if (action_array.Find(action) != -1)
6846 {
6847 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6848 }
6849 else
6850 {
6851 action_array.Insert(action);
6852 }
6853 }
6854
6856 {
6857 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6858 ActionBase action = player.GetActionManager().GetAction(actionName);
6861
6862 if (action_array)
6863 {
6864 action_array.RemoveItem(action);
6865 }
6866 }
6867
6868
6869
6871 {
6872 ActionOverrideData overrideData = new ActionOverrideData();
6876
6878 if (!actionMap)
6879 {
6882 }
6883
6884 actionMap.Insert(this.
Type(), overrideData);
6885
6886 }
6887
6889
6891
6892
6894 {
6897
6900
6901 string config_to_search = "CfgVehicles";
6902 string muzzle_owner_config;
6903
6905 {
6906 if (IsInherited(Weapon))
6907 config_to_search = "CfgWeapons";
6908
6909 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6910
6911 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6912
6913 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6914
6915 if (config_OnFire_subclass_count > 0)
6916 {
6917 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6918
6919 for (int i = 0; i < config_OnFire_subclass_count; i++)
6920 {
6921 string particle_class = "";
6922 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6923 string config_OnFire_entry = config_OnFire_class + particle_class;
6924 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6925 WPOF_array.Insert(WPOF);
6926 }
6927
6928
6930 }
6931 }
6932
6934 {
6935 config_to_search = "CfgWeapons";
6936 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6937
6938 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6939
6940 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6941
6942 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6943 {
6944 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6945
6946 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6947 {
6948 string particle_class2 = "";
6949 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6950 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6951 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6952 WPOBE_array.Insert(WPOBE);
6953 }
6954
6955
6957 }
6958 }
6959 }
6960
6961
6963 {
6966
6968 {
6969 string config_to_search = "CfgVehicles";
6970
6971 if (IsInherited(Weapon))
6972 config_to_search = "CfgWeapons";
6973
6974 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6975 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6976
6977 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6978 {
6979
6981
6983 {
6985 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6987 return;
6988 }
6989
6992
6993
6994
6995 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6996 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6997
6998 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6999 {
7000 string particle_class = "";
7001 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7002 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7003 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7004
7005 if (entry_type == CT_CLASS)
7006 {
7007 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7008 WPOOH_array.Insert(WPOF);
7009 }
7010 }
7011
7012
7014 }
7015 }
7016 }
7017
7019 {
7021 }
7022
7024 {
7026 {
7028
7031
7034
7035 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7036 }
7037 }
7038
7040 {
7042 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7043
7045 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7046
7048 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7049
7051 {
7053 }
7054 }
7055
7057 {
7059 }
7060
7062 {
7065 else
7067
7069 {
7072 }
7073 else
7074 {
7077
7080 }
7081
7083 }
7084
7086 {
7088 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7089 }
7090
7092 {
7094 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7096 }
7097
7099 {
7101 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7102 }
7103
7105 {
7108
7109 OverheatingParticle OP = new OverheatingParticle();
7114
7116 }
7117
7119 {
7122
7123 return -1;
7124 }
7125
7127 {
7129 {
7132
7133 for (int i = count; i > 0; --i)
7134 {
7135 int id = i - 1;
7138
7141
7142 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7143 {
7144 if (p)
7145 {
7148 }
7149 }
7150 }
7151 }
7152 }
7153
7155 {
7157 {
7159 {
7160 int id = i - 1;
7162
7163 if (OP)
7164 {
7166
7167 if (p)
7168 {
7170 }
7171
7172 delete OP;
7173 }
7174 }
7175
7178 }
7179 }
7180
7183 {
7184 return 0.0;
7185 }
7186
7187
7189 {
7190 return 250;
7191 }
7192
7194 {
7195 return 0;
7196 }
7197
7200 {
7202 return true;
7203
7204 return false;
7205 }
7206
7209 {
7212
7214 {
7216 }
7217 else
7218 {
7219
7221 }
7222
7224 }
7225
7232 {
7233 return -1;
7234 }
7235
7236
7237
7238
7240 {
7242 {
7243 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7244 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7245
7246 if (r_index >= 0)
7247 {
7248 InventoryLocation r_il = new InventoryLocation;
7249 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7250
7251 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7254 {
7255 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7256 }
7258 {
7259 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7260 }
7261
7262 }
7263
7264 player.GetHumanInventory().ClearUserReservedLocation(this);
7265 }
7266
7269 }
7270
7271
7272
7273
7275 {
7276 return ItemBase.m_DebugActionsMask;
7277 }
7278
7280 {
7281 return ItemBase.m_DebugActionsMask & mask;
7282 }
7283
7285 {
7286 ItemBase.m_DebugActionsMask = mask;
7287 }
7288
7290 {
7291 ItemBase.m_DebugActionsMask |= mask;
7292 }
7293
7295 {
7296 ItemBase.m_DebugActionsMask &= ~mask;
7297 }
7298
7300 {
7302 {
7304 }
7305 else
7306 {
7308 }
7309 }
7310
7311
7313 {
7314 if (GetEconomyProfile())
7315 {
7316 float q_max = GetEconomyProfile().GetQuantityMax();
7317 if (q_max > 0)
7318 {
7319 float q_min = GetEconomyProfile().GetQuantityMin();
7320 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7321
7323 {
7324 ComponentEnergyManager comp = GetCompEM();
7326 {
7328 }
7329 }
7331 {
7333
7334 }
7335
7336 }
7337 }
7338 }
7339
7342 {
7343 EntityAI parent = GetHierarchyParent();
7344
7345 if (parent)
7346 {
7347 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7348 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7349 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7350 }
7351 }
7352
7355 {
7356 EntityAI parent = GetHierarchyParent();
7357
7358 if (parent)
7359 {
7360 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7361 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7362 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7363 }
7364 }
7365
7367 {
7368
7369
7370
7371
7373
7375 {
7376 if (ScriptInputUserData.CanStoreInputUserData())
7377 {
7378 ScriptInputUserData ctx = new ScriptInputUserData;
7384 ctx.
Write(use_stack_max);
7387
7389 {
7390 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7391 }
7392 }
7393 }
7394 else if (!
g_Game.IsMultiplayer())
7395 {
7397 }
7398 }
7399
7401 {
7403 }
7404
7406 {
7408 }
7409
7411 {
7413 }
7414
7416 {
7417
7418 return false;
7419 }
7420
7422 {
7423 return false;
7424 }
7425
7429 {
7430 return false;
7431 }
7432
7434 {
7435 return "";
7436 }
7437
7439
7441 {
7442 return false;
7443 }
7444
7446 {
7447 return true;
7448 }
7449
7450
7451
7453 {
7454 return true;
7455 }
7456
7458 {
7459 return true;
7460 }
7461
7463 {
7464 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7466 }
7467
7469 {
7471 }
7472
7474 {
7476 if (!is_being_placed)
7478 SetSynchDirty();
7479 }
7480
7481
7483
7485 {
7487 }
7488
7490 {
7492 }
7493
7495 {
7496 return 1;
7497 }
7498
7500 {
7501 return false;
7502 }
7503
7505 {
7507 SetSynchDirty();
7508 }
7509
7510
7511
7512
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
7545 {
7546 super.OnMovedInsideCargo(container);
7547
7548 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7549 }
7550
7551 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7552 {
7553 super.EEItemLocationChanged(oldLoc, newLoc);
7554
7555 PlayerBase newPlayer = null;
7556 PlayerBase oldPlayer = null;
7557
7558 if (newLoc.GetParent())
7559 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7560
7561 if (oldLoc.GetParent())
7562 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7563
7565 {
7566 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7567
7568 if (rIndex >= 0)
7569 {
7570 InventoryLocation rIl = new InventoryLocation;
7571 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7572
7573 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7576 {
7577 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7578 }
7580 {
7582 }
7583
7584 }
7585 }
7586
7588 {
7589 if (newPlayer)
7590 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7591
7592 if (newPlayer == oldPlayer)
7593 {
7594 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7595 {
7597 {
7598 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7599 {
7600 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7601 }
7602 }
7603 else
7604 {
7605 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7606 }
7607 }
7608
7609 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7610 {
7611 int type = oldLoc.GetType();
7613 {
7614 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7615 }
7617 {
7618 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7619 }
7620 }
7621 if (!m_OldLocation)
7622 {
7623 m_OldLocation = new InventoryLocation;
7624 }
7625 m_OldLocation.Copy(oldLoc);
7626 }
7627 else
7628 {
7629 if (m_OldLocation)
7630 {
7631 m_OldLocation.Reset();
7632 }
7633 }
7634
7635 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7636 }
7637 else
7638 {
7639 if (newPlayer)
7640 {
7641 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7642 if (resIndex >= 0)
7643 {
7644 InventoryLocation il = new InventoryLocation;
7645 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7647 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7650 {
7651 il.
GetParent().GetOnReleaseLock().Invoke(it);
7652 }
7654 {
7656 }
7657
7658 }
7659 }
7661 {
7662
7664 }
7665
7666 if (m_OldLocation)
7667 {
7668 m_OldLocation.Reset();
7669 }
7670 }
7671
7673 {
7674 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7675 }
7676
7678 {
7679 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7680 }
7681 }
7682
7683 override void EOnContact(IEntity other, Contact extra)
7684 {
7686 {
7687 int liquidType = -1;
7689 if (impactSpeed > 0.0)
7690 {
7692 #ifndef SERVER
7694 #else
7696 SetSynchDirty();
7697 #endif
7699 }
7700 }
7701
7702 #ifdef SERVER
7703 if (GetCompEM() && GetCompEM().IsPlugged())
7704 {
7705 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7706 GetCompEM().UnplugThis();
7707 }
7708 #endif
7709 }
7710
7712
7714 {
7716 }
7717
7719 {
7720
7721 }
7722
7724 {
7725 super.OnItemLocationChanged(old_owner, new_owner);
7726
7727 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7728 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7729
7730 if (!relatedPlayer && playerNew)
7731 relatedPlayer = playerNew;
7732
7733 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7734 {
7736 if (actionMgr)
7737 {
7738 ActionBase currentAction = actionMgr.GetRunningAction();
7739 if (currentAction)
7741 }
7742 }
7743
7744 Man ownerPlayerOld = null;
7745 Man ownerPlayerNew = null;
7746
7747 if (old_owner)
7748 {
7749 if (old_owner.
IsMan())
7750 {
7751 ownerPlayerOld = Man.Cast(old_owner);
7752 }
7753 else
7754 {
7755 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7756 }
7757 }
7758 else
7759 {
7761 {
7763
7764 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7765 {
7766 GetCompEM().UnplugThis();
7767 }
7768 }
7769 }
7770
7771 if (new_owner)
7772 {
7773 if (new_owner.
IsMan())
7774 {
7775 ownerPlayerNew = Man.Cast(new_owner);
7776 }
7777 else
7778 {
7779 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7780 }
7781 }
7782
7783 if (ownerPlayerOld != ownerPlayerNew)
7784 {
7785 if (ownerPlayerOld)
7786 {
7787 array<EntityAI> subItemsExit = new array<EntityAI>;
7789 for (int i = 0; i < subItemsExit.Count(); i++)
7790 {
7793 }
7794 }
7795
7796 if (ownerPlayerNew)
7797 {
7798 array<EntityAI> subItemsEnter = new array<EntityAI>;
7800 for (int j = 0; j < subItemsEnter.Count(); j++)
7801 {
7804 }
7805 }
7806 }
7807 else if (ownerPlayerNew != null)
7808 {
7809 PlayerBase nplayer;
7810 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7811 {
7812 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7814 for (int k = 0; k < subItemsUpdate.Count(); k++)
7815 {
7817 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7818 }
7819 }
7820 }
7821
7822 if (old_owner)
7823 old_owner.OnChildItemRemoved(this);
7824 if (new_owner)
7825 new_owner.OnChildItemReceived(this);
7826 }
7827
7828
7830 {
7831 super.EEDelete(parent);
7832 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7833 if (player)
7834 {
7836
7837 if (player.IsAlive())
7838 {
7839 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7840 if (r_index >= 0)
7841 {
7842 InventoryLocation r_il = new InventoryLocation;
7843 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7844
7845 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7848 {
7849 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7850 }
7852 {
7853 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7854 }
7855
7856 }
7857
7858 player.RemoveQuickBarEntityShortcut(this);
7859 }
7860 }
7861 }
7862
7864 {
7865 super.EEKilled(killer);
7866
7869 {
7870 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7871 {
7872 if (IsMagazine())
7873 {
7874 if (Magazine.Cast(this).GetAmmoCount() > 0)
7875 {
7877 }
7878 }
7879 else
7880 {
7882 }
7883 }
7884 }
7885 }
7886
7888 {
7889 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7890
7891 super.OnWasAttached(parent, slot_id);
7892
7895
7898 }
7899
7901 {
7902 super.OnWasDetached(parent, slot_id);
7903
7906
7909 }
7910
7912 {
7913 int idx;
7916
7917 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7918 if (inventory_slots.Count() < 1)
7919 {
7920 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7921 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7922 }
7923 else
7924 {
7925 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7926 }
7927
7928 idx = inventory_slots.Find(slot);
7929 if (idx < 0)
7930 return "";
7931
7932 return attach_types.Get(idx);
7933 }
7934
7936 {
7937 int idx = -1;
7938 string slot;
7939
7942
7943 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7944 if (inventory_slots.Count() < 1)
7945 {
7946 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7947 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7948 }
7949 else
7950 {
7951 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7952 if (detach_types.Count() < 1)
7953 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7954 }
7955
7956 for (int i = 0; i < inventory_slots.Count(); i++)
7957 {
7958 slot = inventory_slots.Get(i);
7959 }
7960
7961 if (slot != "")
7962 {
7963 if (detach_types.Count() == 1)
7964 idx = 0;
7965 else
7966 idx = inventory_slots.Find(slot);
7967 }
7968 if (idx < 0)
7969 return "";
7970
7971 return detach_types.Get(idx);
7972 }
7973
7975 {
7976
7978
7979
7980 float min_time = 1;
7981 float max_time = 3;
7982 float delay = Math.RandomFloat(min_time, max_time);
7983
7984 explode_timer.Run(delay, this, "DoAmmoExplosion");
7985 }
7986
7988 {
7989 Magazine magazine = Magazine.Cast(this);
7990 int pop_sounds_count = 6;
7991 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7992
7993
7994 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7995 string sound_name = pop_sounds[ sound_idx ];
7996 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7997
7998
7999 magazine.ServerAddAmmoCount(-1);
8000
8001
8002 float min_temp_to_explode = 100;
8003
8004 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8005 {
8007 }
8008 }
8009
8010
8011 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8012 {
8013 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8014
8015 const int CHANCE_DAMAGE_CARGO = 4;
8016 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8017 const int CHANCE_DAMAGE_NOTHING = 2;
8018
8020 {
8021 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8022 int chances;
8023 int rnd;
8024
8025 if (GetInventory().GetCargo())
8026 {
8027 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8028 rnd = Math.RandomInt(0,chances);
8029
8030 if (rnd < CHANCE_DAMAGE_CARGO)
8031 {
8033 }
8034 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8035 {
8037 }
8038 }
8039 else
8040 {
8041 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8042 rnd = Math.RandomInt(0,chances);
8043
8044 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8045 {
8047 }
8048 }
8049 }
8050 }
8051
8053 {
8054 CargoBase cargo = GetInventory().GetCargo();
8055 if (cargo)
8056 {
8058 if (item_count > 0)
8059 {
8060 int random_pick = Math.RandomInt(0, item_count);
8062 if (!item.IsExplosive())
8063 {
8064 item.AddHealth("","",damage);
8065 return true;
8066 }
8067 }
8068 }
8069 return false;
8070 }
8071
8073 {
8074 GameInventory inventory = GetInventory();
8076 if (attachment_count > 0)
8077 {
8078 int random_pick = Math.RandomInt(0, attachment_count);
8080 if (!attachment.IsExplosive())
8081 {
8082 attachment.AddHealth("","",damage);
8083 return true;
8084 }
8085 }
8086 return false;
8087 }
8088
8090 {
8092 }
8093
8095 {
8097 return GetInventory().CanRemoveEntity();
8098
8099 return false;
8100 }
8101
8103 {
8104
8106 return false;
8107
8108
8110 return false;
8111
8112
8113
8115 if (delta == 0)
8116 return false;
8117
8118
8119 return true;
8120 }
8121
8123 {
8125 {
8126 if (ScriptInputUserData.CanStoreInputUserData())
8127 {
8128 ScriptInputUserData ctx = new ScriptInputUserData;
8133 ctx.
Write(destination_entity);
8137 }
8138 }
8139 else if (!
g_Game.IsMultiplayer())
8140 {
8142 }
8143 }
8144
8146 {
8147 float split_quantity_new;
8151 InventoryLocation loc = new InventoryLocation;
8152
8153 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8154 {
8156 split_quantity_new = stack_max;
8157 else
8159
8161 {
8162 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8163 if (new_item)
8164 {
8165 new_item.SetResultOfSplit(true);
8166 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8168 new_item.
SetQuantity(split_quantity_new,
false,
true);
8169 }
8170 }
8171 }
8172 else if (destination_entity && slot_id == -1)
8173 {
8174 if (quantity > stack_max)
8175 split_quantity_new = stack_max;
8176 else
8177 split_quantity_new = quantity;
8178
8180 {
8181 GameInventory destinationInventory = destination_entity.GetInventory();
8183 {
8186 }
8187
8188 if (new_item)
8189 {
8190 new_item.SetResultOfSplit(true);
8191 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8193 new_item.
SetQuantity(split_quantity_new,
false,
true);
8194 }
8195 }
8196 }
8197 else
8198 {
8199 if (stack_max != 0)
8200 {
8202 {
8204 }
8205
8206 if (split_quantity_new == 0)
8207 {
8208 if (!
g_Game.IsMultiplayer())
8209 player.PhysicalPredictiveDropItem(this);
8210 else
8211 player.ServerDropEntity(this);
8212 return;
8213 }
8214
8216 {
8218
8219 if (new_item)
8220 {
8221 new_item.SetResultOfSplit(true);
8222 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8225 new_item.PlaceOnSurface();
8226 }
8227 }
8228 }
8229 }
8230 }
8231
8233 {
8234 float split_quantity_new;
8238 InventoryLocation loc = new InventoryLocation;
8239
8240 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8241 {
8243 split_quantity_new = stack_max;
8244 else
8246
8248 {
8249 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8250 if (new_item)
8251 {
8252 new_item.SetResultOfSplit(true);
8253 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8255 new_item.
SetQuantity(split_quantity_new,
false,
true);
8256 }
8257 }
8258 }
8259 else if (destination_entity && slot_id == -1)
8260 {
8261 if (quantity > stack_max)
8262 split_quantity_new = stack_max;
8263 else
8264 split_quantity_new = quantity;
8265
8267 {
8268 GameInventory destinationInventory = destination_entity.GetInventory();
8270 {
8273 }
8274
8275 if (new_item)
8276 {
8277 new_item.SetResultOfSplit(true);
8278 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8280 new_item.
SetQuantity(split_quantity_new,
false,
true);
8281 }
8282 }
8283 }
8284 else
8285 {
8286 if (stack_max != 0)
8287 {
8289 {
8291 }
8292
8294 {
8296
8297 if (new_item)
8298 {
8299 new_item.SetResultOfSplit(true);
8300 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8303 new_item.PlaceOnSurface();
8304 }
8305 }
8306 }
8307 }
8308 }
8309
8311 {
8313 {
8314 if (ScriptInputUserData.CanStoreInputUserData())
8315 {
8316 ScriptInputUserData ctx = new ScriptInputUserData;
8321 dst.WriteToContext(ctx);
8323 }
8324 }
8325 else if (!
g_Game.IsMultiplayer())
8326 {
8328 }
8329 }
8330
8332 {
8334 {
8335 if (ScriptInputUserData.CanStoreInputUserData())
8336 {
8337 ScriptInputUserData ctx = new ScriptInputUserData;
8342 ctx.
Write(destination_entity);
8348 }
8349 }
8350 else if (!
g_Game.IsMultiplayer())
8351 {
8353 }
8354 }
8355
8357 {
8359 }
8360
8362 {
8364 float split_quantity_new;
8366 if (dst.IsValid())
8367 {
8368 int slot_id = dst.GetSlot();
8370
8371 if (quantity > stack_max)
8372 split_quantity_new = stack_max;
8373 else
8374 split_quantity_new = quantity;
8375
8377 {
8379
8380 if (new_item)
8381 {
8382 new_item.SetResultOfSplit(true);
8383 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8385 new_item.
SetQuantity(split_quantity_new,
false,
true);
8386 }
8387
8388 return new_item;
8389 }
8390 }
8391
8392 return null;
8393 }
8394
8396 {
8398 float split_quantity_new;
8400 if (destination_entity)
8401 {
8403 if (quantity > stackable)
8404 split_quantity_new = stackable;
8405 else
8406 split_quantity_new = quantity;
8407
8409 {
8410 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8411 if (new_item)
8412 {
8413 new_item.SetResultOfSplit(true);
8414 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8416 new_item.
SetQuantity(split_quantity_new,
false,
true);
8417 }
8418 }
8419 }
8420 }
8421
8423 {
8425 {
8426 if (ScriptInputUserData.CanStoreInputUserData())
8427 {
8428 ScriptInputUserData ctx = new ScriptInputUserData;
8433 ItemBase destination_entity =
this;
8434 ctx.
Write(destination_entity);
8438 }
8439 }
8440 else if (!
g_Game.IsMultiplayer())
8441 {
8443 }
8444 }
8445
8447 {
8449 float split_quantity_new;
8451 if (player)
8452 {
8454 if (quantity > stackable)
8455 split_quantity_new = stackable;
8456 else
8457 split_quantity_new = quantity;
8458
8460 {
8461 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8462 new_item =
ItemBase.Cast(in_hands);
8463 if (new_item)
8464 {
8465 new_item.SetResultOfSplit(true);
8466 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8468 new_item.SetQuantity(split_quantity_new, false, true);
8469 }
8470 }
8471 }
8472 }
8473
8475 {
8477 float split_quantity_new = Math.Floor(quantity * 0.5);
8478
8480 return;
8481
8483
8484 if (new_item)
8485 {
8486 if (new_item.GetQuantityMax() < split_quantity_new)
8487 {
8488 split_quantity_new = new_item.GetQuantityMax();
8489 }
8490
8491 new_item.SetResultOfSplit(true);
8492 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8493
8495 {
8498 }
8499 else
8500 {
8502 new_item.
SetQuantity(split_quantity_new,
false,
true);
8503 }
8504 }
8505 }
8506
8508 {
8510 float split_quantity_new = Math.Floor(quantity / 2);
8511
8513 return;
8514
8515 InventoryLocation invloc = new InventoryLocation;
8517
8519 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8520
8521 if (new_item)
8522 {
8523 if (new_item.GetQuantityMax() < split_quantity_new)
8524 {
8525 split_quantity_new = new_item.GetQuantityMax();
8526 }
8528 {
8531 }
8532 else if (split_quantity_new > 1)
8533 {
8535 new_item.
SetQuantity(split_quantity_new,
false,
true);
8536 }
8537 }
8538 }
8539
8542 {
8543 SetWeightDirty();
8545
8546 if (parent)
8547 parent.OnAttachmentQuantityChangedEx(this, delta);
8548
8550 {
8552 {
8554 }
8556 {
8557 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8559 }
8560 }
8561 }
8562
8565 {
8566
8567 }
8568
8571 {
8573 }
8574
8576 {
8577 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8578
8580 {
8581 if (newLevel == GameConstants.STATE_RUINED)
8582 {
8584 EntityAI parent = GetHierarchyParent();
8585 if (parent && parent.IsFireplace())
8586 {
8587 CargoBase cargo = GetInventory().GetCargo();
8588 if (cargo)
8589 {
8591 {
8593 }
8594 }
8595 }
8596 }
8597
8599 {
8600
8602 return;
8603 }
8604
8605 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8606 {
8608 }
8609 }
8610 }
8611
8612
8614 {
8615 super.OnRightClick();
8616
8618 {
8620 {
8621 if (ScriptInputUserData.CanStoreInputUserData())
8622 {
8623 EntityAI root = GetHierarchyRoot();
8624 Man playerOwner = GetHierarchyRootPlayer();
8625 InventoryLocation dst = new InventoryLocation;
8626
8627
8628 if (!playerOwner && root && root == this)
8629 {
8631 }
8632 else
8633 {
8634
8635 GetInventory().GetCurrentInventoryLocation(dst);
8637 {
8638 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8640 {
8642 }
8643 else
8644 {
8646
8647
8648 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8649 {
8651 }
8652 else
8653 {
8654 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8655 }
8656 }
8657 }
8658 }
8659
8660 ScriptInputUserData ctx = new ScriptInputUserData;
8668 }
8669 }
8670 else if (!
g_Game.IsMultiplayer())
8671 {
8673 }
8674 }
8675 }
8676
8678 {
8679 if (root)
8680 {
8681 vector m4[4];
8682 root.GetTransform(m4);
8683 dst.SetGround(this, m4);
8684 }
8685 else
8686 {
8687 GetInventory().GetCurrentInventoryLocation(dst);
8688 }
8689 }
8690
8691 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8692 {
8693
8694 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8695 return false;
8696
8697 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8698 return false;
8699
8700
8702 return false;
8703
8704
8705 Magazine mag = Magazine.Cast(this);
8706 if (mag)
8707 {
8708 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8709 return false;
8710
8711 if (stack_max_limit)
8712 {
8713 Magazine other_mag = Magazine.Cast(other_item);
8714 if (other_item)
8715 {
8716 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8717 return false;
8718 }
8719
8720 }
8721 }
8722 else
8723 {
8724
8726 return false;
8727
8729 return false;
8730 }
8731
8732 PlayerBase player = null;
8733 if (CastTo(player, GetHierarchyRootPlayer()))
8734 {
8735 if (player.GetInventory().HasAttachment(this))
8736 return false;
8737
8738 if (player.IsItemsToDelete())
8739 return false;
8740 }
8741
8742 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8743 return false;
8744
8745 int slotID;
8747 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8748 return false;
8749
8750 return true;
8751 }
8752
8754 {
8756 }
8757
8759 {
8760 return m_IsResultOfSplit;
8761 }
8762
8764 {
8765 m_IsResultOfSplit = value;
8766 }
8767
8769 {
8771 }
8772
8774 {
8775 float other_item_quantity = other_item.GetQuantity();
8776 float this_free_space;
8777
8779
8781
8782 if (other_item_quantity > this_free_space)
8783 {
8784 return this_free_space;
8785 }
8786 else
8787 {
8788 return other_item_quantity;
8789 }
8790 }
8791
8793 {
8795 }
8796
8798 {
8800 return;
8801
8802 if (!IsMagazine() && other_item)
8803 {
8805 if (quantity_used != 0)
8806 {
8807 float hp1 = GetHealth01("","");
8808 float hp2 = other_item.GetHealth01("","");
8809 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8810 hpResult = hpResult / (
GetQuantity() + quantity_used);
8811
8812 hpResult *= GetMaxHealth();
8813 Math.Round(hpResult);
8814 SetHealth("", "Health", hpResult);
8815
8817 other_item.AddQuantity(-quantity_used);
8818 }
8819 }
8821 }
8822
8824 {
8825 #ifdef SERVER
8826 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8827 GetHierarchyParent().IncreaseLifetimeUp();
8828 #endif
8829 };
8830
8832 {
8833 PlayerBase p = PlayerBase.Cast(player);
8834
8835 array<int> recipesIds = p.m_Recipes;
8836 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8837 if (moduleRecipesManager)
8838 {
8839 EntityAI itemInHands = player.GetEntityInHands();
8840 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8841 }
8842
8843 for (int i = 0;i < recipesIds.Count(); i++)
8844 {
8845 int key = recipesIds.Get(i);
8846 string recipeName = moduleRecipesManager.GetRecipeName(key);
8848 }
8849 }
8850
8851
8852 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8853 {
8854 super.GetDebugActions(outputList);
8855
8856
8862
8863
8868
8873
8874
8878
8879
8881 {
8885 }
8886
8889
8890
8894
8896
8897 InventoryLocation loc = new InventoryLocation();
8898 GetInventory().GetCurrentInventoryLocation(loc);
8900 {
8901 if (Gizmo_IsSupported())
8904 }
8905
8907 }
8908
8909
8910
8911
8913 {
8914 super.OnAction(action_id, player, ctx);
8915
8917 {
8918 switch (action_id)
8919 {
8923 return true;
8927 return true;
8928 }
8929 }
8930
8932 {
8933 switch (action_id)
8934 {
8936 Delete();
8937 return true;
8938 }
8939 }
8940
8941 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8942 {
8943 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8944 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8945 PlayerBase p = PlayerBase.Cast(player);
8946 if (
EActions.RECIPES_RANGE_START < 1000)
8947 {
8948 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8949 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8950 }
8951 }
8952 #ifndef SERVER
8953 else if (action_id ==
EActions.WATCH_PLAYER)
8954 {
8955 PluginDeveloper.SetDeveloperItemClientEx(player);
8956 }
8957 #endif
8959 {
8960 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8961 {
8962 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8963 OnDebugButtonPressServer(id + 1);
8964 }
8965
8966 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8967 {
8968 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8970 }
8971
8972 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8973 {
8974 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8976 }
8977
8978 else if (action_id ==
EActions.ADD_QUANTITY)
8979 {
8980 if (IsMagazine())
8981 {
8982 Magazine mag = Magazine.Cast(this);
8983 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8984 }
8985 else
8986 {
8988 }
8989
8990 if (m_EM)
8991 {
8992 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8993 }
8994
8995 }
8996
8997 else if (action_id ==
EActions.REMOVE_QUANTITY)
8998 {
8999 if (IsMagazine())
9000 {
9001 Magazine mag2 = Magazine.Cast(this);
9002 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9003 }
9004 else
9005 {
9007 }
9008 if (m_EM)
9009 {
9010 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9011 }
9012
9013 }
9014
9015 else if (action_id ==
EActions.SET_QUANTITY_0)
9016 {
9018
9019 if (m_EM)
9020 {
9021 m_EM.SetEnergy(0);
9022 }
9023 }
9024
9025 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9026 {
9028
9029 if (m_EM)
9030 {
9031 m_EM.SetEnergy(m_EM.GetEnergyMax());
9032 }
9033 }
9034
9035 else if (action_id ==
EActions.ADD_HEALTH)
9036 {
9037 AddHealth("","",GetMaxHealth("","Health")/5);
9038 }
9039 else if (action_id ==
EActions.REMOVE_HEALTH)
9040 {
9041 AddHealth("","",-GetMaxHealth("","Health")/5);
9042 }
9043 else if (action_id ==
EActions.DESTROY_HEALTH)
9044 {
9045 SetHealth01("","",0);
9046 }
9047 else if (action_id ==
EActions.WATCH_ITEM)
9048 {
9050 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9051 #ifdef DEVELOPER
9052 SetDebugDeveloper_item(this);
9053 #endif
9054 }
9055
9056 else if (action_id ==
EActions.ADD_TEMPERATURE)
9057 {
9058 AddTemperature(20);
9059
9060 }
9061
9062 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9063 {
9064 AddTemperature(-20);
9065
9066 }
9067
9068 else if (action_id ==
EActions.FLIP_FROZEN)
9069 {
9070 SetFrozen(!GetIsFrozen());
9071
9072 }
9073
9074 else if (action_id ==
EActions.ADD_WETNESS)
9075 {
9077
9078 }
9079
9080 else if (action_id ==
EActions.REMOVE_WETNESS)
9081 {
9083
9084 }
9085
9086 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9087 {
9090
9091
9092 }
9093
9094 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9095 {
9098 }
9099
9100 else if (action_id ==
EActions.MAKE_SPECIAL)
9101 {
9102 auto debugParams = DebugSpawnParams.WithPlayer(player);
9103 OnDebugSpawnEx(debugParams);
9104 }
9105
9106 }
9107
9108
9109 return false;
9110 }
9111
9112
9113
9114
9118
9121
9122
9123
9125 {
9126 return false;
9127 }
9128
9129
9131 {
9132 return true;
9133 }
9134
9135
9137 {
9138 return true;
9139 }
9140
9141
9142
9144 {
9145 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9146 return g_Game.ConfigIsExisting(config_path);
9147 }
9148
9151 {
9152 return null;
9153 }
9154
9156 {
9157 return false;
9158 }
9159
9161 {
9162 return false;
9163 }
9164
9168
9169
9171 {
9172 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9173 return module_repairing.CanRepair(this, item_repair_kit);
9174 }
9175
9176
9177 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9178 {
9179 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9180 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9181 }
9182
9183
9185 {
9186
9187
9188
9189
9190
9191
9192
9193
9194 return 1;
9195 }
9196
9197
9198
9200 {
9202 }
9203
9204
9205
9207 {
9209 }
9210
9211
9220 {
9221 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9222
9223 if (player)
9224 {
9225 player.MessageStatus(text);
9226 }
9227 }
9228
9229
9238 {
9239 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9240
9241 if (player)
9242 {
9243 player.MessageAction(text);
9244 }
9245 }
9246
9247
9256 {
9257 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9258
9259 if (player)
9260 {
9261 player.MessageFriendly(text);
9262 }
9263 }
9264
9265
9274 {
9275 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9276
9277 if (player)
9278 {
9279 player.MessageImportant(text);
9280 }
9281 }
9282
9284 {
9285 return true;
9286 }
9287
9288
9289 override bool KindOf(
string tag)
9290 {
9291 bool found = false;
9292 string item_name = this.
GetType();
9294 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9295
9296 int array_size = item_tag_array.Count();
9297 for (int i = 0; i < array_size; i++)
9298 {
9299 if (item_tag_array.Get(i) == tag)
9300 {
9301 found = true;
9302 break;
9303 }
9304 }
9305 return found;
9306 }
9307
9308
9310 {
9311
9312 super.OnRPC(sender, rpc_type,ctx);
9313
9314
9315 switch (rpc_type)
9316 {
9317 #ifndef SERVER
9318 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9319 Param2<bool, string> p = new Param2<bool, string>(false, "");
9320
9322 return;
9323
9324 bool play = p.param1;
9325 string soundSet = p.param2;
9326
9327 if (play)
9328 {
9330 {
9332 {
9334 }
9335 }
9336 else
9337 {
9339 }
9340 }
9341 else
9342 {
9344 }
9345
9346 break;
9347 #endif
9348
9349 }
9350
9352 {
9354 }
9355 }
9356
9357
9358
9359
9361 {
9362 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9363 return plugin.GetID(
name);
9364 }
9365
9367 {
9368 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9369 return plugin.GetName(id);
9370 }
9371
9374 {
9375
9376
9377 int varFlags;
9378 if (!ctx.
Read(varFlags))
9379 return;
9380
9381 if (varFlags & ItemVariableFlags.FLOAT)
9382 {
9384 }
9385 }
9386
9388 {
9389
9390 super.SerializeNumericalVars(floats_out);
9391
9392
9393
9395 {
9397 }
9398
9400 {
9402 }
9403
9405 {
9407 }
9408
9410 {
9415 }
9416
9418 {
9420 }
9421 }
9422
9424 {
9425
9426 super.DeSerializeNumericalVars(floats);
9427
9428
9429 int index = 0;
9430 int mask = Math.Round(floats.Get(index));
9431
9432 index++;
9433
9435 {
9437 {
9439 }
9440 else
9441 {
9442 float quantity = floats.Get(index);
9444 }
9445 index++;
9446 }
9447
9449 {
9450 float wet = floats.Get(index);
9452 index++;
9453 }
9454
9456 {
9457 int liquidtype = Math.Round(floats.Get(index));
9459 index++;
9460 }
9461
9463 {
9465 index++;
9467 index++;
9469 index++;
9471 index++;
9472 }
9473
9475 {
9476 int cleanness = Math.Round(floats.Get(index));
9478 index++;
9479 }
9480 }
9481
9483 {
9484 super.WriteVarsToCTX(ctx);
9485
9486
9488 {
9490 }
9491
9493 {
9495 }
9496
9498 {
9500 }
9501
9503 {
9504 int r,g,b,a;
9510 }
9511
9513 {
9515 }
9516 }
9517
9519 {
9520 if (!super.ReadVarsFromCTX(ctx,version))
9521 return false;
9522
9523 int intValue;
9524 float value;
9525
9526 if (version < 140)
9527 {
9528 if (!ctx.
Read(intValue))
9529 return false;
9530
9531 m_VariablesMask = intValue;
9532 }
9533
9535 {
9536 if (!ctx.
Read(value))
9537 return false;
9538
9540 {
9542 }
9543 else
9544 {
9546 }
9547 }
9548
9549 if (version < 140)
9550 {
9552 {
9553 if (!ctx.
Read(value))
9554 return false;
9555 SetTemperatureDirect(value);
9556 }
9557 }
9558
9560 {
9561 if (!ctx.
Read(value))
9562 return false;
9564 }
9565
9567 {
9568 if (!ctx.
Read(intValue))
9569 return false;
9571 }
9572
9574 {
9575 int r,g,b,a;
9577 return false;
9579 return false;
9581 return false;
9583 return false;
9584
9586 }
9587
9589 {
9590 if (!ctx.
Read(intValue))
9591 return false;
9593 }
9594
9595 if (version >= 138 && version < 140)
9596 {
9598 {
9599 if (!ctx.
Read(intValue))
9600 return false;
9601 SetFrozen(intValue);
9602 }
9603 }
9604
9605 return true;
9606 }
9607
9608
9610 {
9613 {
9615 }
9616
9617 if (!super.OnStoreLoad(ctx, version))
9618 {
9620 return false;
9621 }
9622
9623 if (version >= 114)
9624 {
9625 bool hasQuickBarIndexSaved;
9626
9627 if (!ctx.
Read(hasQuickBarIndexSaved))
9628 {
9630 return false;
9631 }
9632
9633 if (hasQuickBarIndexSaved)
9634 {
9635 int itmQBIndex;
9636
9637
9638 if (!ctx.
Read(itmQBIndex))
9639 {
9641 return false;
9642 }
9643
9644 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9645 if (itmQBIndex != -1 && parentPlayer)
9646 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9647 }
9648 }
9649 else
9650 {
9651
9652 PlayerBase player;
9653 int itemQBIndex;
9654 if (version ==
int.
MAX)
9655 {
9656 if (!ctx.
Read(itemQBIndex))
9657 {
9659 return false;
9660 }
9661 }
9662 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9663 {
9664
9665 if (!ctx.
Read(itemQBIndex))
9666 {
9668 return false;
9669 }
9670 if (itemQBIndex != -1 && player)
9671 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9672 }
9673 }
9674
9675 if (version < 140)
9676 {
9677
9678 if (!LoadVariables(ctx, version))
9679 {
9681 return false;
9682 }
9683 }
9684
9685
9687 {
9689 return false;
9690 }
9691 if (version >= 132)
9692 {
9694 if (raib)
9695 {
9697 {
9699 return false;
9700 }
9701 }
9702 }
9703
9705 return true;
9706 }
9707
9708
9709
9711 {
9712 super.OnStoreSave(ctx);
9713
9714 PlayerBase player;
9715 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9716 {
9718
9719 int itemQBIndex = -1;
9720 itemQBIndex = player.FindQuickBarEntityIndex(this);
9721 ctx.
Write(itemQBIndex);
9722 }
9723 else
9724 {
9726 }
9727
9729
9731 if (raib)
9732 {
9734 }
9735 }
9736
9737
9739 {
9740 super.AfterStoreLoad();
9741
9743 {
9745 }
9746
9748 {
9751 }
9752 }
9753
9755 {
9756 super.EEOnAfterLoad();
9757
9759 {
9761 }
9762
9765 }
9766
9768 {
9769 return false;
9770 }
9771
9772
9773
9775 {
9777 {
9778 #ifdef PLATFORM_CONSOLE
9779
9781 {
9783 if (menu)
9784 {
9786 }
9787 }
9788 #endif
9789 }
9790
9792 {
9795 }
9796
9798 {
9799 SetWeightDirty();
9801 }
9803 {
9806 }
9807
9809 {
9812
9815 }
9817 {
9821 }
9822
9823 super.OnVariablesSynchronized();
9824 }
9825
9826
9827
9829 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9830 {
9831 if (!IsServerCheck(allow_client))
9832 return false;
9833
9835 return false;
9836
9839
9840 if (value <= (min + 0.001))
9841 value = min;
9842
9843 if (value == min)
9844 {
9845 if (destroy_config)
9846 {
9847 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9848 if (dstr)
9849 {
9851 this.Delete();
9852 return true;
9853 }
9854 }
9855 else if (destroy_forced)
9856 {
9858 this.Delete();
9859 return true;
9860 }
9861
9863 }
9864
9867
9869 {
9870 EntityAI parent = GetHierarchyRoot();
9871 InventoryLocation iLoc = new InventoryLocation();
9872 GetInventory().GetCurrentInventoryLocation(iLoc);
9874 {
9875 int iLocSlot = iLoc.
GetSlot();
9877 {
9879 }
9881 {
9883 }
9884 }
9885 }
9886
9888 {
9890
9891 if (delta)
9893 }
9894
9896
9897 return false;
9898 }
9899
9900
9902 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9903 {
9905 }
9906
9908 {
9911 }
9912
9914 {
9917 }
9918
9920 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9921 {
9922 float value_clamped = Math.Clamp(value, 0, 1);
9924 SetQuantity(result, destroy_config, destroy_forced);
9925 }
9926
9927
9930 {
9932 }
9933
9935 {
9937 }
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9949 {
9950 int slot = -1;
9951 GameInventory inventory = GetInventory();
9952 if (inventory)
9953 {
9954 InventoryLocation il = new InventoryLocation;
9957 }
9958
9960 }
9961
9963 {
9964 float quantity_max = 0;
9965
9967 {
9968 if (attSlotID != -1)
9969 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9970
9971 if (quantity_max <= 0)
9973 }
9974
9975 if (quantity_max <= 0)
9977
9978 return quantity_max;
9979 }
9980
9982 {
9984 }
9985
9987 {
9989 }
9990
9991
9993 {
9995 }
9996
9998 {
10000 }
10001
10003 {
10005 }
10006
10007
10009 {
10010
10011 float weightEx = GetWeightEx();
10012 float special = GetInventoryAndCargoWeight();
10013 return weightEx - special;
10014 }
10015
10016
10018 {
10020 }
10021
10023 {
10025 {
10026 #ifdef DEVELOPER
10027 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10028 {
10029 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10031 }
10032 #endif
10033
10034 return GetQuantity() * GetConfigWeightModified();
10035 }
10036 else if (HasEnergyManager())
10037 {
10038 #ifdef DEVELOPER
10039 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10040 {
10041 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10042 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10043 }
10044 #endif
10045 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10046 }
10047 else
10048 {
10049 #ifdef DEVELOPER
10050 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10051 {
10052 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10053 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10054 }
10055 #endif
10056 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10057 }
10058 }
10059
10062 {
10063 int item_count = 0;
10065
10066 GameInventory inventory = GetInventory();
10067 CargoBase cargo = inventory.
GetCargo();
10068 if (cargo != NULL)
10069 {
10071 }
10072
10074 for (int i = 0; i < nAttachments; ++i)
10075 {
10077 if (item)
10078 item_count += item.GetNumberOfItems();
10079 }
10080 return item_count;
10081 }
10082
10085 {
10086 float weight = 0;
10087 float wetness = 1;
10088 if (include_wetness)
10091 {
10092 weight = wetness * m_ConfigWeight;
10093 }
10095 {
10096 weight = 1;
10097 }
10098 return weight;
10099 }
10100
10101
10102
10104 {
10105 GameInventory inventory = GetInventory();
10106 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10107 {
10108 array<EntityAI> items = new array<EntityAI>;
10110 for (int i = 0; i < items.Count(); ++i)
10111 {
10113 if (item)
10114 {
10115 g_Game.ObjectDelete(item);
10116 }
10117 }
10118 }
10119 }
10120
10121
10122
10123
10125 {
10126 float energy = 0;
10127 if (HasEnergyManager())
10128 {
10129 energy = GetCompEM().GetEnergy();
10130 }
10131 return energy;
10132 }
10133
10134
10136 {
10137 super.OnEnergyConsumed();
10138
10140 }
10141
10143 {
10144 super.OnEnergyAdded();
10145
10147 }
10148
10149
10151 {
10152 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10153 {
10155 {
10156 float energy_0to1 = GetCompEM().GetEnergy0To1();
10158 }
10159 }
10160 }
10161
10162
10164 {
10165 return ConfigGetFloat("heatIsolation");
10166 }
10167
10169 {
10171 }
10172
10174 {
10175 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10176 if (
g_Game.ConfigIsExisting(paramPath))
10177 return g_Game.ConfigGetFloat(paramPath);
10178
10179 return 0.0;
10180 }
10181
10183 {
10184 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10185 if (
g_Game.ConfigIsExisting(paramPath))
10186 return g_Game.ConfigGetFloat(paramPath);
10187
10188 return 0.0;
10189 }
10190
10191 override void SetWet(
float value,
bool allow_client =
false)
10192 {
10193 if (!IsServerCheck(allow_client))
10194 return;
10195
10198
10200
10201 m_VarWet = Math.Clamp(value, min, max);
10202
10204 {
10207 }
10208 }
10209
10210 override void AddWet(
float value)
10211 {
10213 }
10214
10216 {
10218 }
10219
10221 {
10223 }
10224
10226 {
10228 }
10229
10231 {
10233 }
10234
10236 {
10238 }
10239
10240 override void OnWetChanged(
float newVal,
float oldVal)
10241 {
10244 if (newLevel != oldLevel)
10245 {
10247 }
10248 }
10249
10251 {
10252 SetWeightDirty();
10253 }
10254
10256 {
10257 return GetWetLevelInternal(
m_VarWet);
10258 }
10259
10260
10261
10263 {
10265 }
10266
10268 {
10270 }
10271
10273 {
10275 }
10276
10278 {
10280 }
10281
10282
10283
10285 {
10286 if (ConfigIsExisting("itemModelLength"))
10287 {
10288 return ConfigGetFloat("itemModelLength");
10289 }
10290 return 0;
10291 }
10292
10294 {
10295 if (ConfigIsExisting("itemAttachOffset"))
10296 {
10297 return ConfigGetFloat("itemAttachOffset");
10298 }
10299 return 0;
10300 }
10301
10302 override void SetCleanness(
int value,
bool allow_client =
false)
10303 {
10304 if (!IsServerCheck(allow_client))
10305 return;
10306
10308
10310
10313 }
10314
10316 {
10318 }
10319
10321 {
10322 return true;
10323 }
10324
10325
10326
10327
10329 {
10331 }
10332
10334 {
10336 }
10337
10338
10339
10340
10341 override void SetColor(
int r,
int g,
int b,
int a)
10342 {
10348 }
10350 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10351 {
10356 }
10357
10359 {
10361 }
10362
10365 {
10366 int r,g,b,a;
10368 r = r/255;
10369 g = g/255;
10370 b = b/255;
10371 a = a/255;
10372 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10373 }
10374
10375
10376
10377 override void SetLiquidType(
int value,
bool allow_client =
false)
10378 {
10379 if (!IsServerCheck(allow_client))
10380 return;
10381
10386 }
10387
10389 {
10390 return ConfigGetInt("varLiquidTypeInit");
10391 }
10392
10394 {
10396 }
10397
10399 {
10401 SetFrozen(false);
10402 }
10403
10406 {
10407 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10408 }
10409
10410
10413 {
10414 PlayerBase nplayer;
10415 if (PlayerBase.CastTo(nplayer, player))
10416 {
10418 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10419 }
10420 }
10421
10422
10425 {
10426 PlayerBase nplayer;
10427 if (PlayerBase.CastTo(nplayer,player))
10428 {
10429 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10430 }
10431
10432 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10433
10434 if (HasEnergyManager())
10435 {
10436 GetCompEM().UpdatePlugState();
10437 }
10438 }
10439
10440
10442 {
10443 super.OnPlacementStarted(player);
10444
10446 }
10447
10448 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10449 {
10451 {
10452 m_AdminLog.OnPlacementComplete(player,
this);
10453 }
10454
10455 super.OnPlacementComplete(player, position, orientation);
10456 }
10457
10458
10459
10460
10461
10463 {
10465 {
10466 return true;
10467 }
10468 else
10469 {
10470 return false;
10471 }
10472 }
10473
10474
10476 {
10478 {
10480 }
10481 }
10482
10483
10485 {
10487 }
10488
10490 {
10492 }
10493
10494 override void InsertAgent(
int agent,
float count = 1)
10495 {
10496 if (count < 1)
10497 return;
10498
10500 }
10501
10504 {
10506 }
10507
10508
10510 {
10512 }
10513
10514
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10556 {
10558 return false;
10559 return true;
10560 }
10561
10563 {
10564
10566 }
10567
10568
10571 {
10572 super.CheckForRoofLimited(timeTresholdMS);
10573
10574 float time =
g_Game.GetTime();
10575 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10576 {
10577 m_PreviousRoofTestTime = time;
10578 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10579 }
10580 }
10581
10582
10584 {
10586 {
10587 return 0;
10588 }
10589
10590 if (GetInventory().GetAttachmentSlotsCount() != 0)
10591 {
10592 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10593 if (filter)
10594 return filter.GetProtectionLevel(type, false, system);
10595 else
10596 return 0;
10597 }
10598
10599 string subclassPath, entryName;
10600
10601 switch (type)
10602 {
10604 entryName = "biological";
10605 break;
10607 entryName = "chemical";
10608 break;
10609 default:
10610 entryName = "biological";
10611 break;
10612 }
10613
10614 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10615
10616 return g_Game.ConfigGetFloat(subclassPath + entryName);
10617 }
10618
10619
10620
10623 {
10624 if (!IsMagazine())
10626
10628 }
10629
10630
10631
10632
10633
10638 {
10639 return true;
10640 }
10641
10643 {
10645 }
10646
10647
10648
10649
10650
10652 {
10653 if (parent)
10654 {
10655 if (parent.IsInherited(DayZInfected))
10656 return true;
10657
10658 if (!parent.IsRuined())
10659 return true;
10660 }
10661
10662 return true;
10663 }
10664
10666 {
10667 if (!super.CanPutAsAttachment(parent))
10668 {
10669 return false;
10670 }
10671
10672 if (!IsRuined() && !parent.IsRuined())
10673 {
10674 return true;
10675 }
10676
10677 return false;
10678 }
10679
10681 {
10682
10683
10684
10685
10686 return super.CanReceiveItemIntoCargo(item);
10687 }
10688
10690 {
10691
10692
10693
10694
10695 GameInventory attachmentInv = attachment.GetInventory();
10697 {
10698 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10699 return false;
10700 }
10701
10702 InventoryLocation loc = new InventoryLocation();
10703 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10704 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10705 return false;
10706
10707 return super.CanReceiveAttachment(attachment, slotId);
10708 }
10709
10711 {
10712 if (!super.CanReleaseAttachment(attachment))
10713 return false;
10714
10715 return GetInventory().AreChildrenAccessible();
10716 }
10717
10718
10719
10720
10721
10722
10723
10724
10725
10726
10727
10728
10729
10730
10731
10732
10733
10734
10735
10736
10737
10739 {
10740 int id = muzzle_owner.GetMuzzleID();
10741 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10742
10743 if (WPOF_array)
10744 {
10745 for (int i = 0; i < WPOF_array.Count(); i++)
10746 {
10747 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10748
10749 if (WPOF)
10750 {
10751 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10752 }
10753 }
10754 }
10755 }
10756
10757
10759 {
10760 int id = muzzle_owner.GetMuzzleID();
10762
10763 if (WPOBE_array)
10764 {
10765 for (int i = 0; i < WPOBE_array.Count(); i++)
10766 {
10767 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10768
10769 if (WPOBE)
10770 {
10771 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10772 }
10773 }
10774 }
10775 }
10776
10777
10779 {
10780 int id = muzzle_owner.GetMuzzleID();
10781 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10782
10783 if (WPOOH_array)
10784 {
10785 for (int i = 0; i < WPOOH_array.Count(); i++)
10786 {
10787 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10788
10789 if (WPOOH)
10790 {
10791 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10792 }
10793 }
10794 }
10795 }
10796
10797
10799 {
10800 int id = muzzle_owner.GetMuzzleID();
10801 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10802
10803 if (WPOOH_array)
10804 {
10805 for (int i = 0; i < WPOOH_array.Count(); i++)
10806 {
10807 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10808
10809 if (WPOOH)
10810 {
10811 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10812 }
10813 }
10814 }
10815 }
10816
10817
10819 {
10820 int id = muzzle_owner.GetMuzzleID();
10821 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10822
10823 if (WPOOH_array)
10824 {
10825 for (int i = 0; i < WPOOH_array.Count(); i++)
10826 {
10827 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10828
10829 if (WPOOH)
10830 {
10831 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10832 }
10833 }
10834 }
10835 }
10836
10837
10838
10840 {
10842 {
10843 return true;
10844 }
10845
10846 return false;
10847 }
10848
10850 {
10852 {
10853 return true;
10854 }
10855
10856 return false;
10857 }
10858
10860 {
10862 {
10863 return true;
10864 }
10865
10866 return false;
10867 }
10868
10870 {
10871 return false;
10872 }
10873
10876 {
10877 return UATimeSpent.DEFAULT_DEPLOY;
10878 }
10879
10880
10881
10882
10884 {
10886 SetSynchDirty();
10887 }
10888
10890 {
10892 }
10893
10894
10896 {
10897 return false;
10898 }
10899
10902 {
10903 string att_type = "None";
10904
10905 if (ConfigIsExisting("soundAttType"))
10906 {
10907 att_type = ConfigGetString("soundAttType");
10908 }
10909
10911 }
10912
10914 {
10916 }
10917
10918
10919
10920
10921
10927
10929 {
10932
10934 }
10935
10936
10938 {
10940 return;
10941
10943
10946
10949
10950 SoundParameters params = new SoundParameters();
10954 }
10955
10956
10958 {
10960 {
10963
10964 SetSynchDirty();
10965
10968 }
10969 }
10970
10972 {
10974 }
10975
10976
10978 {
10980 return;
10981
10983 SetSynchDirty();
10984
10987 }
10988
10990 {
10993 }
10994
10996 {
10998 }
10999
11000 void OnApply(PlayerBase player);
11001
11003 {
11004 return 1.0;
11005 };
11006
11008 {
11010 }
11011
11013 {
11015 }
11016
11018
11020 {
11021 SetDynamicPhysicsLifeTime(0.01);
11023 }
11024
11026 {
11027 array<string> zone_names = new array<string>;
11028 GetDamageZones(zone_names);
11029 for (int i = 0; i < zone_names.Count(); i++)
11030 {
11031 SetHealthMax(zone_names.Get(i),"Health");
11032 }
11033 SetHealthMax("","Health");
11034 }
11035
11038 {
11039 float global_health = GetHealth01("","Health");
11040 array<string> zones = new array<string>;
11041 GetDamageZones(zones);
11042
11043 for (int i = 0; i < zones.Count(); i++)
11044 {
11045 SetHealth01(zones.Get(i),"Health",global_health);
11046 }
11047 }
11048
11051 {
11052 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11053 }
11054
11056 {
11057 if (!hasRootAsPlayer)
11058 {
11059 if (refParentIB)
11060 {
11061
11062 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11063 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11064
11065 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11066 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11067
11070 }
11071 else
11072 {
11073
11076 }
11077 }
11078 }
11079
11081 {
11083 {
11084 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11085 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11086 {
11087 float heatPermCoef = 1.0;
11089 while (ent)
11090 {
11091 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11092 ent = ent.GetHierarchyParent();
11093 }
11094
11095 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11096 }
11097 }
11098 }
11099
11101 {
11102
11103 EntityAI parent = GetHierarchyParent();
11104 if (!parent)
11105 {
11106 hasParent = false;
11107 hasRootAsPlayer = false;
11108 }
11109 else
11110 {
11111 hasParent = true;
11112 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11113 refParentIB =
ItemBase.Cast(parent);
11114 }
11115 }
11116
11117 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11118 {
11119
11120 }
11121
11123 {
11124
11125 return false;
11126 }
11127
11129 {
11130
11131
11132 return false;
11133 }
11134
11136 {
11137
11138 return false;
11139 }
11140
11143 {
11144 return !GetIsFrozen() &&
IsOpen();
11145 }
11146
11148 {
11149 bool hasParent = false, hasRootAsPlayer = false;
11151
11152 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11153 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11154
11155 if (wwtu || foodDecay)
11156 {
11160
11161 if (processWetness || processTemperature || processDecay)
11162 {
11164
11165 if (processWetness)
11166 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11167
11168 if (processTemperature)
11170
11171 if (processDecay)
11172 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11173 }
11174 }
11175 }
11176
11179 {
11181 }
11182
11184 {
11187
11188 return super.GetTemperatureFreezeThreshold();
11189 }
11190
11192 {
11195
11196 return super.GetTemperatureThawThreshold();
11197 }
11198
11200 {
11203
11204 return super.GetItemOverheatThreshold();
11205 }
11206
11208 {
11210 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11211
11212 return super.GetTemperatureFreezeTime();
11213 }
11214
11216 {
11218 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11219
11220 return super.GetTemperatureThawTime();
11221 }
11222
11227
11229 {
11230 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11231 }
11232
11234 {
11235 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11236 }
11237
11240 {
11242 }
11243
11245 {
11247 }
11248
11250 {
11252 }
11253
11256 {
11257 return null;
11258 }
11259
11262 {
11263 return false;
11264 }
11265
11267 {
11269 {
11272 if (!trg)
11273 {
11275 explosive = this;
11276 }
11277
11278 explosive.PairRemote(trg);
11280
11281 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11282 trg.SetPersistentPairID(persistentID);
11283 explosive.SetPersistentPairID(persistentID);
11284
11285 return true;
11286 }
11287 return false;
11288 }
11289
11292 {
11293 float ret = 1.0;
11296 ret *= GetHealth01();
11297
11298 return ret;
11299 }
11300
11301 #ifdef DEVELOPER
11302 override void SetDebugItem()
11303 {
11304 super.SetDebugItem();
11305 _itemBase = this;
11306 }
11307
11309 {
11310 string text = super.GetDebugText();
11311
11313 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11314
11315 return text;
11316 }
11317 #endif
11318
11320 {
11321 return true;
11322 }
11323
11325
11327
11329 {
11332 }
11333
11334
11342
11358
11359 [
Obsolete(
"Use ItemSoundHandler instead")]
11362 {
11363 if (!
g_Game.IsDedicatedServer())
11364 {
11365 if (ConfigIsExisting("attachSoundSet"))
11366 {
11367 string cfg_path = "";
11368 string soundset = "";
11369 string type_name =
GetType();
11370
11373 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11374 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11375
11376 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11377 {
11378 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11379 {
11380 if (cfg_slot_array[i] == slot_type)
11381 {
11382 soundset = cfg_soundset_array[i];
11383 break;
11384 }
11385 }
11386 }
11387
11388 if (soundset != "")
11389 {
11390 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11392 }
11393 }
11394 }
11395 }
11396
11398}
11399
11401{
11403 if (entity)
11404 {
11405 bool is_item = entity.IsInherited(
ItemBase);
11406 if (is_item && full_quantity)
11407 {
11410 }
11411 }
11412 else
11413 {
11415 return NULL;
11416 }
11417 return entity;
11418}
11419
11421{
11422 if (item)
11423 {
11424 if (health > 0)
11425 item.SetHealth("", "", health);
11426
11427 if (item.CanHaveTemperature())
11428 {
11430 if (item.CanFreeze())
11431 item.SetFrozen(false);
11432 }
11433
11434 if (item.HasEnergyManager())
11435 {
11436 if (quantity >= 0)
11437 {
11438 item.GetCompEM().SetEnergy0To1(quantity);
11439 }
11440 else
11441 {
11443 }
11444 }
11445 else if (item.IsMagazine())
11446 {
11447 Magazine mag = Magazine.Cast(item);
11448 if (quantity >= 0)
11449 {
11450 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11451 }
11452 else
11453 {
11455 }
11456
11457 }
11458 else
11459 {
11460 if (quantity >= 0)
11461 {
11462 item.SetQuantityNormalized(quantity, false);
11463 }
11464 else
11465 {
11467 }
11468
11469 }
11470 }
11471}
11472
11473#ifdef DEVELOPER
11475#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.