6417{
6419 {
6420 return true;
6421 }
6422};
6423
6425{
6426
6427};
6428
6429
6430
6432{
6436
6438
6441
6442
6443
6444
6445
6454
6460
6465
6470
6491 protected bool m_IsResultOfSplit
6492
6494
6499
6500
6501
6503
6507
6508
6509
6511
6514
6515
6516
6522
6523
6531
6534
6535
6537
6538
6540
6541
6546
6547
6552
6554
6555
6557
6558
6560 {
6565
6566 if (!
g_Game.IsDedicatedServer())
6567 {
6569 {
6571
6573 {
6575 }
6576 }
6577
6580 }
6581
6582 m_OldLocation = null;
6583
6585 {
6587 }
6588
6589 if (ConfigIsExisting("headSelectionsToHide"))
6590 {
6593 }
6594
6596 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6597 {
6599 }
6600
6602
6603 m_IsResultOfSplit = false;
6604
6606 }
6607
6609 {
6610 super.InitItemVariables();
6611
6617 m_Count = ConfigGetInt(
"count");
6618
6621
6626
6629
6634
6646
6650
6651
6654 if (ConfigIsExisting("canBeSplit"))
6655 {
6658 }
6659
6661 if (ConfigIsExisting("itemBehaviour"))
6663
6664
6667 RegisterNetSyncVariableInt("m_VarLiquidType");
6668 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6669
6670 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6671 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6672 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6673
6674 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6675 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6676 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6677 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6678
6679 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6680 RegisterNetSyncVariableBool("m_IsTakeable");
6681 RegisterNetSyncVariableBool("m_IsHologram");
6682
6685 {
6688 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6689 }
6690
6692
6694 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6696
6698 }
6699
6701 {
6703 }
6704
6706 {
6709 {
6714 }
6715 }
6716
6717 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6718 {
6720 {
6723 }
6724
6726 }
6727
6729 {
6735 }
6736
6738
6740 {
6742
6743 if (!action)
6744 {
6745 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6746 return;
6747 }
6748
6750 if (!ai)
6751 {
6753 return;
6754 }
6755
6757 if (!action_array)
6758 {
6759 action_array = new array<ActionBase_Basic>;
6761 }
6762 if (LogManager.IsActionLogEnable())
6763 {
6764 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6765 }
6766
6767 if (action_array.Find(action) != -1)
6768 {
6769 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6770 }
6771 else
6772 {
6773 action_array.Insert(action);
6774 }
6775 }
6776
6778 {
6779 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6780 ActionBase action = player.GetActionManager().GetAction(actionName);
6783
6784 if (action_array)
6785 {
6786 action_array.RemoveItem(action);
6787 }
6788 }
6789
6790
6791
6793 {
6794 ActionOverrideData overrideData = new ActionOverrideData();
6798
6800 if (!actionMap)
6801 {
6804 }
6805
6806 actionMap.Insert(this.
Type(), overrideData);
6807
6808 }
6809
6811
6813
6814
6816 {
6819
6822
6823 string config_to_search = "CfgVehicles";
6824 string muzzle_owner_config;
6825
6827 {
6828 if (IsInherited(Weapon))
6829 config_to_search = "CfgWeapons";
6830
6831 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6832
6833 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6834
6835 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6836
6837 if (config_OnFire_subclass_count > 0)
6838 {
6839 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6840
6841 for (int i = 0; i < config_OnFire_subclass_count; i++)
6842 {
6843 string particle_class = "";
6844 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6845 string config_OnFire_entry = config_OnFire_class + particle_class;
6846 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6847 WPOF_array.Insert(WPOF);
6848 }
6849
6850
6852 }
6853 }
6854
6856 {
6857 config_to_search = "CfgWeapons";
6858 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6859
6860 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6861
6862 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6863
6864 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6865 {
6866 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6867
6868 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6869 {
6870 string particle_class2 = "";
6871 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6872 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6873 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6874 WPOBE_array.Insert(WPOBE);
6875 }
6876
6877
6879 }
6880 }
6881 }
6882
6883
6885 {
6888
6890 {
6891 string config_to_search = "CfgVehicles";
6892
6893 if (IsInherited(Weapon))
6894 config_to_search = "CfgWeapons";
6895
6896 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6897 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6898
6899 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6900 {
6901
6903
6905 {
6907 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6909 return;
6910 }
6911
6914
6915
6916
6917 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6918 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6919
6920 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6921 {
6922 string particle_class = "";
6923 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6924 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6925 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6926
6927 if (entry_type == CT_CLASS)
6928 {
6929 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6930 WPOOH_array.Insert(WPOF);
6931 }
6932 }
6933
6934
6936 }
6937 }
6938 }
6939
6941 {
6943 }
6944
6946 {
6948 {
6950
6953
6956
6957 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6958 }
6959 }
6960
6962 {
6964 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6965
6967 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6968
6970 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6971
6973 {
6975 }
6976 }
6977
6979 {
6981 }
6982
6984 {
6987 else
6989
6991 {
6994 }
6995 else
6996 {
6999
7002 }
7003
7005 }
7006
7008 {
7010 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7011 }
7012
7014 {
7016 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7018 }
7019
7021 {
7023 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7024 }
7025
7027 {
7030
7031 OverheatingParticle OP = new OverheatingParticle();
7036
7038 }
7039
7041 {
7044
7045 return -1;
7046 }
7047
7049 {
7051 {
7054
7055 for (int i = count; i > 0; --i)
7056 {
7057 int id = i - 1;
7060
7063
7064 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7065 {
7066 if (p)
7067 {
7070 }
7071 }
7072 }
7073 }
7074 }
7075
7077 {
7079 {
7081 {
7082 int id = i - 1;
7084
7085 if (OP)
7086 {
7088
7089 if (p)
7090 {
7092 }
7093
7094 delete OP;
7095 }
7096 }
7097
7100 }
7101 }
7102
7105 {
7106 return 0.0;
7107 }
7108
7109
7111 {
7112 return 250;
7113 }
7114
7116 {
7117 return 0;
7118 }
7119
7122 {
7124 return true;
7125
7126 return false;
7127 }
7128
7131 {
7134
7136 {
7138 }
7139 else
7140 {
7141
7143 }
7144
7146 }
7147
7154 {
7155 return -1;
7156 }
7157
7158
7159
7160
7162 {
7164 {
7165 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7166 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7167
7168 if (r_index >= 0)
7169 {
7170 InventoryLocation r_il = new InventoryLocation;
7171 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7172
7173 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7176 {
7177 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7178 }
7180 {
7181 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7182 }
7183
7184 }
7185
7186 player.GetHumanInventory().ClearUserReservedLocation(this);
7187 }
7188
7191 }
7192
7193
7194
7195
7197 {
7198 return ItemBase.m_DebugActionsMask;
7199 }
7200
7202 {
7203 return ItemBase.m_DebugActionsMask & mask;
7204 }
7205
7207 {
7208 ItemBase.m_DebugActionsMask = mask;
7209 }
7210
7212 {
7213 ItemBase.m_DebugActionsMask |= mask;
7214 }
7215
7217 {
7218 ItemBase.m_DebugActionsMask &= ~mask;
7219 }
7220
7222 {
7224 {
7226 }
7227 else
7228 {
7230 }
7231 }
7232
7233
7235 {
7236 if (GetEconomyProfile())
7237 {
7238 float q_max = GetEconomyProfile().GetQuantityMax();
7239 if (q_max > 0)
7240 {
7241 float q_min = GetEconomyProfile().GetQuantityMin();
7242 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7243
7245 {
7246 ComponentEnergyManager comp = GetCompEM();
7248 {
7250 }
7251 }
7253 {
7255
7256 }
7257
7258 }
7259 }
7260 }
7261
7264 {
7265 EntityAI parent = GetHierarchyParent();
7266
7267 if (parent)
7268 {
7269 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7270 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7271 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7272 }
7273 }
7274
7277 {
7278 EntityAI parent = GetHierarchyParent();
7279
7280 if (parent)
7281 {
7282 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7283 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7284 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7285 }
7286 }
7287
7289 {
7290
7291
7292
7293
7295
7297 {
7298 if (ScriptInputUserData.CanStoreInputUserData())
7299 {
7300 ScriptInputUserData ctx = new ScriptInputUserData;
7306 ctx.
Write(use_stack_max);
7309
7311 {
7312 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7313 }
7314 }
7315 }
7316 else if (!
g_Game.IsMultiplayer())
7317 {
7319 }
7320 }
7321
7323 {
7325 }
7326
7328 {
7330 }
7331
7333 {
7335 }
7336
7338 {
7339
7340 return false;
7341 }
7342
7344 {
7345 return false;
7346 }
7347
7351 {
7352 return false;
7353 }
7354
7356 {
7357 return "";
7358 }
7359
7361
7363 {
7364 return false;
7365 }
7366
7368 {
7369 return true;
7370 }
7371
7372
7373
7375 {
7376 return true;
7377 }
7378
7380 {
7381 return true;
7382 }
7383
7385 {
7386 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7388 }
7389
7391 {
7393 }
7394
7396 {
7398 if (!is_being_placed)
7400 SetSynchDirty();
7401 }
7402
7403
7405
7407 {
7409 }
7410
7412 {
7414 }
7415
7417 {
7418 return 1;
7419 }
7420
7422 {
7423 return false;
7424 }
7425
7427 {
7429 SetSynchDirty();
7430 }
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7467 {
7468 super.OnMovedInsideCargo(container);
7469
7470 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7471 }
7472
7473 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7474 {
7475 super.EEItemLocationChanged(oldLoc, newLoc);
7476
7477 PlayerBase newPlayer = null;
7478 PlayerBase oldPlayer = null;
7479
7480 if (newLoc.GetParent())
7481 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7482
7483 if (oldLoc.GetParent())
7484 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7485
7487 {
7488 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7489
7490 if (rIndex >= 0)
7491 {
7492 InventoryLocation rIl = new InventoryLocation;
7493 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7494
7495 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7498 {
7499 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7500 }
7502 {
7504 }
7505
7506 }
7507 }
7508
7510 {
7511 if (newPlayer)
7512 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7513
7514 if (newPlayer == oldPlayer)
7515 {
7516 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7517 {
7519 {
7520 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7521 {
7522 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7523 }
7524 }
7525 else
7526 {
7527 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7528 }
7529 }
7530
7531 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7532 {
7533 int type = oldLoc.GetType();
7535 {
7536 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7537 }
7539 {
7540 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7541 }
7542 }
7543 if (!m_OldLocation)
7544 {
7545 m_OldLocation = new InventoryLocation;
7546 }
7547 m_OldLocation.Copy(oldLoc);
7548 }
7549 else
7550 {
7551 if (m_OldLocation)
7552 {
7553 m_OldLocation.Reset();
7554 }
7555 }
7556
7557 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7558 }
7559 else
7560 {
7561 if (newPlayer)
7562 {
7563 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7564 if (resIndex >= 0)
7565 {
7566 InventoryLocation il = new InventoryLocation;
7567 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7569 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7572 {
7573 il.
GetParent().GetOnReleaseLock().Invoke(it);
7574 }
7576 {
7578 }
7579
7580 }
7581 }
7583 {
7584
7586 }
7587
7588 if (m_OldLocation)
7589 {
7590 m_OldLocation.Reset();
7591 }
7592 }
7593
7595 {
7596 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7597 }
7598
7600 {
7601 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7602 }
7603 }
7604
7605 override void EOnContact(IEntity other, Contact extra)
7606 {
7608 {
7609 int liquidType = -1;
7611 if (impactSpeed > 0.0)
7612 {
7614 #ifndef SERVER
7616 #else
7618 SetSynchDirty();
7619 #endif
7621 }
7622 }
7623
7624 #ifdef SERVER
7625 if (GetCompEM() && GetCompEM().IsPlugged())
7626 {
7627 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7628 GetCompEM().UnplugThis();
7629 }
7630 #endif
7631 }
7632
7634
7636 {
7638 }
7639
7641 {
7642
7643 }
7644
7646 {
7647 super.OnItemLocationChanged(old_owner, new_owner);
7648
7649 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7650 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7651
7652 if (!relatedPlayer && playerNew)
7653 relatedPlayer = playerNew;
7654
7655 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7656 {
7658 if (actionMgr)
7659 {
7660 ActionBase currentAction = actionMgr.GetRunningAction();
7661 if (currentAction)
7663 }
7664 }
7665
7666 Man ownerPlayerOld = null;
7667 Man ownerPlayerNew = null;
7668
7669 if (old_owner)
7670 {
7671 if (old_owner.
IsMan())
7672 {
7673 ownerPlayerOld = Man.Cast(old_owner);
7674 }
7675 else
7676 {
7677 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7678 }
7679 }
7680 else
7681 {
7683 {
7685
7686 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7687 {
7688 GetCompEM().UnplugThis();
7689 }
7690 }
7691 }
7692
7693 if (new_owner)
7694 {
7695 if (new_owner.
IsMan())
7696 {
7697 ownerPlayerNew = Man.Cast(new_owner);
7698 }
7699 else
7700 {
7701 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7702 }
7703 }
7704
7705 if (ownerPlayerOld != ownerPlayerNew)
7706 {
7707 if (ownerPlayerOld)
7708 {
7709 array<EntityAI> subItemsExit = new array<EntityAI>;
7711 for (int i = 0; i < subItemsExit.Count(); i++)
7712 {
7715 }
7716 }
7717
7718 if (ownerPlayerNew)
7719 {
7720 array<EntityAI> subItemsEnter = new array<EntityAI>;
7722 for (int j = 0; j < subItemsEnter.Count(); j++)
7723 {
7726 }
7727 }
7728 }
7729 else if (ownerPlayerNew != null)
7730 {
7731 PlayerBase nplayer;
7732 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7733 {
7734 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7736 for (int k = 0; k < subItemsUpdate.Count(); k++)
7737 {
7739 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7740 }
7741 }
7742 }
7743
7744 if (old_owner)
7745 old_owner.OnChildItemRemoved(this);
7746 if (new_owner)
7747 new_owner.OnChildItemReceived(this);
7748 }
7749
7750
7752 {
7753 super.EEDelete(parent);
7754 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7755 if (player)
7756 {
7758
7759 if (player.IsAlive())
7760 {
7761 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7762 if (r_index >= 0)
7763 {
7764 InventoryLocation r_il = new InventoryLocation;
7765 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7766
7767 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7770 {
7771 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7772 }
7774 {
7775 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7776 }
7777
7778 }
7779
7780 player.RemoveQuickBarEntityShortcut(this);
7781 }
7782 }
7783 }
7784
7786 {
7787 super.EEKilled(killer);
7788
7791 {
7792 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7793 {
7794 if (IsMagazine())
7795 {
7796 if (Magazine.Cast(this).GetAmmoCount() > 0)
7797 {
7799 }
7800 }
7801 else
7802 {
7804 }
7805 }
7806 }
7807 }
7808
7810 {
7811 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7812
7813 super.OnWasAttached(parent, slot_id);
7814
7817
7820 }
7821
7823 {
7824 super.OnWasDetached(parent, slot_id);
7825
7828
7831 }
7832
7834 {
7835 int idx;
7838
7839 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7840 if (inventory_slots.Count() < 1)
7841 {
7842 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7843 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7844 }
7845 else
7846 {
7847 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7848 }
7849
7850 idx = inventory_slots.Find(slot);
7851 if (idx < 0)
7852 return "";
7853
7854 return attach_types.Get(idx);
7855 }
7856
7858 {
7859 int idx = -1;
7860 string slot;
7861
7864
7865 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7866 if (inventory_slots.Count() < 1)
7867 {
7868 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7869 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7870 }
7871 else
7872 {
7873 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7874 if (detach_types.Count() < 1)
7875 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7876 }
7877
7878 for (int i = 0; i < inventory_slots.Count(); i++)
7879 {
7880 slot = inventory_slots.Get(i);
7881 }
7882
7883 if (slot != "")
7884 {
7885 if (detach_types.Count() == 1)
7886 idx = 0;
7887 else
7888 idx = inventory_slots.Find(slot);
7889 }
7890 if (idx < 0)
7891 return "";
7892
7893 return detach_types.Get(idx);
7894 }
7895
7897 {
7898
7900
7901
7902 float min_time = 1;
7903 float max_time = 3;
7904 float delay = Math.RandomFloat(min_time, max_time);
7905
7906 explode_timer.Run(delay, this, "DoAmmoExplosion");
7907 }
7908
7910 {
7911 Magazine magazine = Magazine.Cast(this);
7912 int pop_sounds_count = 6;
7913 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7914
7915
7916 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7917 string sound_name = pop_sounds[ sound_idx ];
7918 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7919
7920
7921 magazine.ServerAddAmmoCount(-1);
7922
7923
7924 float min_temp_to_explode = 100;
7925
7926 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7927 {
7929 }
7930 }
7931
7932
7933 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7934 {
7935 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7936
7937 const int CHANCE_DAMAGE_CARGO = 4;
7938 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7939 const int CHANCE_DAMAGE_NOTHING = 2;
7940
7942 {
7943 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7944 int chances;
7945 int rnd;
7946
7947 if (GetInventory().GetCargo())
7948 {
7949 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7950 rnd = Math.RandomInt(0,chances);
7951
7952 if (rnd < CHANCE_DAMAGE_CARGO)
7953 {
7955 }
7956 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7957 {
7959 }
7960 }
7961 else
7962 {
7963 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7964 rnd = Math.RandomInt(0,chances);
7965
7966 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7967 {
7969 }
7970 }
7971 }
7972 }
7973
7975 {
7976 CargoBase cargo = GetInventory().GetCargo();
7977 if (cargo)
7978 {
7980 if (item_count > 0)
7981 {
7982 int random_pick = Math.RandomInt(0, item_count);
7984 if (!item.IsExplosive())
7985 {
7986 item.AddHealth("","",damage);
7987 return true;
7988 }
7989 }
7990 }
7991 return false;
7992 }
7993
7995 {
7996 GameInventory inventory = GetInventory();
7998 if (attachment_count > 0)
7999 {
8000 int random_pick = Math.RandomInt(0, attachment_count);
8002 if (!attachment.IsExplosive())
8003 {
8004 attachment.AddHealth("","",damage);
8005 return true;
8006 }
8007 }
8008 return false;
8009 }
8010
8012 {
8014 }
8015
8017 {
8019 return GetInventory().CanRemoveEntity();
8020
8021 return false;
8022 }
8023
8025 {
8026
8028 return false;
8029
8030
8032 return false;
8033
8034
8035
8037 if (delta == 0)
8038 return false;
8039
8040
8041 return true;
8042 }
8043
8045 {
8047 {
8048 if (ScriptInputUserData.CanStoreInputUserData())
8049 {
8050 ScriptInputUserData ctx = new ScriptInputUserData;
8055 ctx.
Write(destination_entity);
8059 }
8060 }
8061 else if (!
g_Game.IsMultiplayer())
8062 {
8064 }
8065 }
8066
8068 {
8069 float split_quantity_new;
8073 InventoryLocation loc = new InventoryLocation;
8074
8075 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8076 {
8078 split_quantity_new = stack_max;
8079 else
8081
8083 {
8084 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8085 if (new_item)
8086 {
8087 new_item.SetResultOfSplit(true);
8088 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8090 new_item.
SetQuantity(split_quantity_new,
false,
true);
8091 }
8092 }
8093 }
8094 else if (destination_entity && slot_id == -1)
8095 {
8096 if (quantity > stack_max)
8097 split_quantity_new = stack_max;
8098 else
8099 split_quantity_new = quantity;
8100
8102 {
8103 GameInventory destinationInventory = destination_entity.GetInventory();
8105 {
8108 }
8109
8110 if (new_item)
8111 {
8112 new_item.SetResultOfSplit(true);
8113 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8115 new_item.
SetQuantity(split_quantity_new,
false,
true);
8116 }
8117 }
8118 }
8119 else
8120 {
8121 if (stack_max != 0)
8122 {
8124 {
8126 }
8127
8128 if (split_quantity_new == 0)
8129 {
8130 if (!
g_Game.IsMultiplayer())
8131 player.PhysicalPredictiveDropItem(this);
8132 else
8133 player.ServerDropEntity(this);
8134 return;
8135 }
8136
8138 {
8140
8141 if (new_item)
8142 {
8143 new_item.SetResultOfSplit(true);
8144 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8147 new_item.PlaceOnSurface();
8148 }
8149 }
8150 }
8151 }
8152 }
8153
8155 {
8156 float split_quantity_new;
8160 InventoryLocation loc = new InventoryLocation;
8161
8162 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8163 {
8165 split_quantity_new = stack_max;
8166 else
8168
8170 {
8171 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8172 if (new_item)
8173 {
8174 new_item.SetResultOfSplit(true);
8175 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8177 new_item.
SetQuantity(split_quantity_new,
false,
true);
8178 }
8179 }
8180 }
8181 else if (destination_entity && slot_id == -1)
8182 {
8183 if (quantity > stack_max)
8184 split_quantity_new = stack_max;
8185 else
8186 split_quantity_new = quantity;
8187
8189 {
8190 GameInventory destinationInventory = destination_entity.GetInventory();
8192 {
8195 }
8196
8197 if (new_item)
8198 {
8199 new_item.SetResultOfSplit(true);
8200 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8202 new_item.
SetQuantity(split_quantity_new,
false,
true);
8203 }
8204 }
8205 }
8206 else
8207 {
8208 if (stack_max != 0)
8209 {
8211 {
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 {
8235 {
8236 if (ScriptInputUserData.CanStoreInputUserData())
8237 {
8238 ScriptInputUserData ctx = new ScriptInputUserData;
8243 dst.WriteToContext(ctx);
8245 }
8246 }
8247 else if (!
g_Game.IsMultiplayer())
8248 {
8250 }
8251 }
8252
8254 {
8256 {
8257 if (ScriptInputUserData.CanStoreInputUserData())
8258 {
8259 ScriptInputUserData ctx = new ScriptInputUserData;
8264 ctx.
Write(destination_entity);
8270 }
8271 }
8272 else if (!
g_Game.IsMultiplayer())
8273 {
8275 }
8276 }
8277
8279 {
8281 }
8282
8284 {
8286 float split_quantity_new;
8288 if (dst.IsValid())
8289 {
8290 int slot_id = dst.GetSlot();
8292
8293 if (quantity > stack_max)
8294 split_quantity_new = stack_max;
8295 else
8296 split_quantity_new = quantity;
8297
8299 {
8301
8302 if (new_item)
8303 {
8304 new_item.SetResultOfSplit(true);
8305 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8307 new_item.
SetQuantity(split_quantity_new,
false,
true);
8308 }
8309
8310 return new_item;
8311 }
8312 }
8313
8314 return null;
8315 }
8316
8318 {
8320 float split_quantity_new;
8322 if (destination_entity)
8323 {
8325 if (quantity > stackable)
8326 split_quantity_new = stackable;
8327 else
8328 split_quantity_new = quantity;
8329
8331 {
8332 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8333 if (new_item)
8334 {
8335 new_item.SetResultOfSplit(true);
8336 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8338 new_item.
SetQuantity(split_quantity_new,
false,
true);
8339 }
8340 }
8341 }
8342 }
8343
8345 {
8347 {
8348 if (ScriptInputUserData.CanStoreInputUserData())
8349 {
8350 ScriptInputUserData ctx = new ScriptInputUserData;
8355 ItemBase destination_entity =
this;
8356 ctx.
Write(destination_entity);
8360 }
8361 }
8362 else if (!
g_Game.IsMultiplayer())
8363 {
8365 }
8366 }
8367
8369 {
8371 float split_quantity_new;
8373 if (player)
8374 {
8376 if (quantity > stackable)
8377 split_quantity_new = stackable;
8378 else
8379 split_quantity_new = quantity;
8380
8382 {
8383 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8384 new_item =
ItemBase.Cast(in_hands);
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 }
8394 }
8395
8397 {
8399 float split_quantity_new = Math.Floor(quantity * 0.5);
8400
8402 return;
8403
8405
8406 if (new_item)
8407 {
8408 if (new_item.GetQuantityMax() < split_quantity_new)
8409 {
8410 split_quantity_new = new_item.GetQuantityMax();
8411 }
8412
8413 new_item.SetResultOfSplit(true);
8414 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8415
8417 {
8420 }
8421 else
8422 {
8424 new_item.
SetQuantity(split_quantity_new,
false,
true);
8425 }
8426 }
8427 }
8428
8430 {
8432 float split_quantity_new = Math.Floor(quantity / 2);
8433
8435 return;
8436
8437 InventoryLocation invloc = new InventoryLocation;
8439
8441 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8442
8443 if (new_item)
8444 {
8445 if (new_item.GetQuantityMax() < split_quantity_new)
8446 {
8447 split_quantity_new = new_item.GetQuantityMax();
8448 }
8450 {
8453 }
8454 else if (split_quantity_new > 1)
8455 {
8457 new_item.
SetQuantity(split_quantity_new,
false,
true);
8458 }
8459 }
8460 }
8461
8464 {
8465 SetWeightDirty();
8467
8468 if (parent)
8469 parent.OnAttachmentQuantityChangedEx(this, delta);
8470
8472 {
8474 {
8476 }
8478 {
8479 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8481 }
8482 }
8483 }
8484
8487 {
8488
8489 }
8490
8493 {
8495 }
8496
8498 {
8499 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8500
8502 {
8503 if (newLevel == GameConstants.STATE_RUINED)
8504 {
8506 EntityAI parent = GetHierarchyParent();
8507 if (parent && parent.IsFireplace())
8508 {
8509 CargoBase cargo = GetInventory().GetCargo();
8510 if (cargo)
8511 {
8513 {
8515 }
8516 }
8517 }
8518 }
8519
8521 {
8522
8524 return;
8525 }
8526
8527 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8528 {
8530 }
8531 }
8532 }
8533
8534
8536 {
8537 super.OnRightClick();
8538
8540 {
8542 {
8543 if (ScriptInputUserData.CanStoreInputUserData())
8544 {
8545 EntityAI root = GetHierarchyRoot();
8546 Man playerOwner = GetHierarchyRootPlayer();
8547 InventoryLocation dst = new InventoryLocation;
8548
8549
8550 if (!playerOwner && root && root == this)
8551 {
8553 }
8554 else
8555 {
8556
8557 GetInventory().GetCurrentInventoryLocation(dst);
8559 {
8560 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8562 {
8564 }
8565 else
8566 {
8568
8569
8570 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8571 {
8573 }
8574 else
8575 {
8576 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8577 }
8578 }
8579 }
8580 }
8581
8582 ScriptInputUserData ctx = new ScriptInputUserData;
8590 }
8591 }
8592 else if (!
g_Game.IsMultiplayer())
8593 {
8595 }
8596 }
8597 }
8598
8600 {
8601 if (root)
8602 {
8603 vector m4[4];
8604 root.GetTransform(m4);
8605 dst.SetGround(this, m4);
8606 }
8607 else
8608 {
8609 GetInventory().GetCurrentInventoryLocation(dst);
8610 }
8611 }
8612
8613 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8614 {
8615
8616 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8617 return false;
8618
8619 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8620 return false;
8621
8622
8624 return false;
8625
8626
8627 Magazine mag = Magazine.Cast(this);
8628 if (mag)
8629 {
8630 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8631 return false;
8632
8633 if (stack_max_limit)
8634 {
8635 Magazine other_mag = Magazine.Cast(other_item);
8636 if (other_item)
8637 {
8638 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8639 return false;
8640 }
8641
8642 }
8643 }
8644 else
8645 {
8646
8648 return false;
8649
8651 return false;
8652 }
8653
8654 PlayerBase player = null;
8655 if (CastTo(player, GetHierarchyRootPlayer()))
8656 {
8657 if (player.GetInventory().HasAttachment(this))
8658 return false;
8659
8660 if (player.IsItemsToDelete())
8661 return false;
8662 }
8663
8664 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8665 return false;
8666
8667 int slotID;
8669 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8670 return false;
8671
8672 return true;
8673 }
8674
8676 {
8678 }
8679
8681 {
8682 return m_IsResultOfSplit;
8683 }
8684
8686 {
8687 m_IsResultOfSplit = value;
8688 }
8689
8691 {
8693 }
8694
8696 {
8697 float other_item_quantity = other_item.GetQuantity();
8698 float this_free_space;
8699
8701
8703
8704 if (other_item_quantity > this_free_space)
8705 {
8706 return this_free_space;
8707 }
8708 else
8709 {
8710 return other_item_quantity;
8711 }
8712 }
8713
8715 {
8717 }
8718
8720 {
8722 return;
8723
8724 if (!IsMagazine() && other_item)
8725 {
8727 if (quantity_used != 0)
8728 {
8729 float hp1 = GetHealth01("","");
8730 float hp2 = other_item.GetHealth01("","");
8731 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8732 hpResult = hpResult / (
GetQuantity() + quantity_used);
8733
8734 hpResult *= GetMaxHealth();
8735 Math.Round(hpResult);
8736 SetHealth("", "Health", hpResult);
8737
8739 other_item.AddQuantity(-quantity_used);
8740 }
8741 }
8743 }
8744
8746 {
8747 #ifdef SERVER
8748 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8749 GetHierarchyParent().IncreaseLifetimeUp();
8750 #endif
8751 };
8752
8754 {
8755 PlayerBase p = PlayerBase.Cast(player);
8756
8757 array<int> recipesIds = p.m_Recipes;
8758 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8759 if (moduleRecipesManager)
8760 {
8761 EntityAI itemInHands = player.GetEntityInHands();
8762 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8763 }
8764
8765 for (int i = 0;i < recipesIds.Count(); i++)
8766 {
8767 int key = recipesIds.Get(i);
8768 string recipeName = moduleRecipesManager.GetRecipeName(key);
8770 }
8771 }
8772
8773
8774 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8775 {
8776 super.GetDebugActions(outputList);
8777
8778
8784
8785
8790
8795
8796
8800
8801
8803 {
8807 }
8808
8811
8812
8816
8818
8819 InventoryLocation loc = new InventoryLocation();
8820 GetInventory().GetCurrentInventoryLocation(loc);
8822 {
8823 if (Gizmo_IsSupported())
8826 }
8827
8829 }
8830
8831
8832
8833
8835 {
8836 super.OnAction(action_id, player, ctx);
8837
8839 {
8840 switch (action_id)
8841 {
8845 return true;
8849 return true;
8850 }
8851 }
8852
8854 {
8855 switch (action_id)
8856 {
8858 Delete();
8859 return true;
8860 }
8861 }
8862
8863 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8864 {
8865 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8866 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8867 PlayerBase p = PlayerBase.Cast(player);
8868 if (
EActions.RECIPES_RANGE_START < 1000)
8869 {
8870 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8871 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8872 }
8873 }
8874 #ifndef SERVER
8875 else if (action_id ==
EActions.WATCH_PLAYER)
8876 {
8877 PluginDeveloper.SetDeveloperItemClientEx(player);
8878 }
8879 #endif
8881 {
8882 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8883 {
8884 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8885 OnDebugButtonPressServer(id + 1);
8886 }
8887
8888 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8889 {
8890 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8892 }
8893
8894 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8895 {
8896 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8898 }
8899
8900 else if (action_id ==
EActions.ADD_QUANTITY)
8901 {
8902 if (IsMagazine())
8903 {
8904 Magazine mag = Magazine.Cast(this);
8905 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8906 }
8907 else
8908 {
8910 }
8911
8912 if (m_EM)
8913 {
8914 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8915 }
8916
8917 }
8918
8919 else if (action_id ==
EActions.REMOVE_QUANTITY)
8920 {
8921 if (IsMagazine())
8922 {
8923 Magazine mag2 = Magazine.Cast(this);
8924 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8925 }
8926 else
8927 {
8929 }
8930 if (m_EM)
8931 {
8932 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8933 }
8934
8935 }
8936
8937 else if (action_id ==
EActions.SET_QUANTITY_0)
8938 {
8940
8941 if (m_EM)
8942 {
8943 m_EM.SetEnergy(0);
8944 }
8945 }
8946
8947 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8948 {
8950
8951 if (m_EM)
8952 {
8953 m_EM.SetEnergy(m_EM.GetEnergyMax());
8954 }
8955 }
8956
8957 else if (action_id ==
EActions.ADD_HEALTH)
8958 {
8959 AddHealth("","",GetMaxHealth("","Health")/5);
8960 }
8961 else if (action_id ==
EActions.REMOVE_HEALTH)
8962 {
8963 AddHealth("","",-GetMaxHealth("","Health")/5);
8964 }
8965 else if (action_id ==
EActions.DESTROY_HEALTH)
8966 {
8967 SetHealth01("","",0);
8968 }
8969 else if (action_id ==
EActions.WATCH_ITEM)
8970 {
8972 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8973 #ifdef DEVELOPER
8974 SetDebugDeveloper_item(this);
8975 #endif
8976 }
8977
8978 else if (action_id ==
EActions.ADD_TEMPERATURE)
8979 {
8980 AddTemperature(20);
8981
8982 }
8983
8984 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8985 {
8986 AddTemperature(-20);
8987
8988 }
8989
8990 else if (action_id ==
EActions.FLIP_FROZEN)
8991 {
8992 SetFrozen(!GetIsFrozen());
8993
8994 }
8995
8996 else if (action_id ==
EActions.ADD_WETNESS)
8997 {
8999
9000 }
9001
9002 else if (action_id ==
EActions.REMOVE_WETNESS)
9003 {
9005
9006 }
9007
9008 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9009 {
9012
9013
9014 }
9015
9016 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9017 {
9020 }
9021
9022 else if (action_id ==
EActions.MAKE_SPECIAL)
9023 {
9024 auto debugParams = DebugSpawnParams.WithPlayer(player);
9025 OnDebugSpawnEx(debugParams);
9026 }
9027
9028 }
9029
9030
9031 return false;
9032 }
9033
9034
9035
9036
9040
9043
9044
9045
9047 {
9048 return false;
9049 }
9050
9051
9053 {
9054 return true;
9055 }
9056
9057
9059 {
9060 return true;
9061 }
9062
9063
9064
9066 {
9067 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9068 return g_Game.ConfigIsExisting(config_path);
9069 }
9070
9073 {
9074 return null;
9075 }
9076
9078 {
9079 return false;
9080 }
9081
9083 {
9084 return false;
9085 }
9086
9090
9091
9093 {
9094 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9095 return module_repairing.CanRepair(this, item_repair_kit);
9096 }
9097
9098
9099 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9100 {
9101 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9102 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9103 }
9104
9105
9107 {
9108
9109
9110
9111
9112
9113
9114
9115
9116 return 1;
9117 }
9118
9119
9120
9122 {
9124 }
9125
9126
9127
9129 {
9131 }
9132
9133
9142 {
9143 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9144
9145 if (player)
9146 {
9147 player.MessageStatus(text);
9148 }
9149 }
9150
9151
9160 {
9161 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9162
9163 if (player)
9164 {
9165 player.MessageAction(text);
9166 }
9167 }
9168
9169
9178 {
9179 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9180
9181 if (player)
9182 {
9183 player.MessageFriendly(text);
9184 }
9185 }
9186
9187
9196 {
9197 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9198
9199 if (player)
9200 {
9201 player.MessageImportant(text);
9202 }
9203 }
9204
9206 {
9207 return true;
9208 }
9209
9210
9211 override bool KindOf(
string tag)
9212 {
9213 bool found = false;
9214 string item_name = this.
GetType();
9216 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9217
9218 int array_size = item_tag_array.Count();
9219 for (int i = 0; i < array_size; i++)
9220 {
9221 if (item_tag_array.Get(i) == tag)
9222 {
9223 found = true;
9224 break;
9225 }
9226 }
9227 return found;
9228 }
9229
9230
9232 {
9233
9234 super.OnRPC(sender, rpc_type,ctx);
9235
9236
9237 switch (rpc_type)
9238 {
9239 #ifndef SERVER
9240 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9241 Param2<bool, string> p = new Param2<bool, string>(false, "");
9242
9244 return;
9245
9246 bool play = p.param1;
9247 string soundSet = p.param2;
9248
9249 if (play)
9250 {
9252 {
9254 {
9256 }
9257 }
9258 else
9259 {
9261 }
9262 }
9263 else
9264 {
9266 }
9267
9268 break;
9269 #endif
9270
9271 }
9272
9274 {
9276 }
9277 }
9278
9279
9280
9281
9283 {
9284 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9285 return plugin.GetID(
name);
9286 }
9287
9289 {
9290 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9291 return plugin.GetName(id);
9292 }
9293
9296 {
9297
9298
9299 int varFlags;
9300 if (!ctx.
Read(varFlags))
9301 return;
9302
9303 if (varFlags & ItemVariableFlags.FLOAT)
9304 {
9306 }
9307 }
9308
9310 {
9311
9312 super.SerializeNumericalVars(floats_out);
9313
9314
9315
9317 {
9319 }
9320
9322 {
9324 }
9325
9327 {
9329 }
9330
9332 {
9337 }
9338
9340 {
9342 }
9343 }
9344
9346 {
9347
9348 super.DeSerializeNumericalVars(floats);
9349
9350
9351 int index = 0;
9352 int mask = Math.Round(floats.Get(index));
9353
9354 index++;
9355
9357 {
9359 {
9361 }
9362 else
9363 {
9364 float quantity = floats.Get(index);
9366 }
9367 index++;
9368 }
9369
9371 {
9372 float wet = floats.Get(index);
9374 index++;
9375 }
9376
9378 {
9379 int liquidtype = Math.Round(floats.Get(index));
9381 index++;
9382 }
9383
9385 {
9387 index++;
9389 index++;
9391 index++;
9393 index++;
9394 }
9395
9397 {
9398 int cleanness = Math.Round(floats.Get(index));
9400 index++;
9401 }
9402 }
9403
9405 {
9406 super.WriteVarsToCTX(ctx);
9407
9408
9410 {
9412 }
9413
9415 {
9417 }
9418
9420 {
9422 }
9423
9425 {
9426 int r,g,b,a;
9432 }
9433
9435 {
9437 }
9438 }
9439
9441 {
9442 if (!super.ReadVarsFromCTX(ctx,version))
9443 return false;
9444
9445 int intValue;
9446 float value;
9447
9448 if (version < 140)
9449 {
9450 if (!ctx.
Read(intValue))
9451 return false;
9452
9453 m_VariablesMask = intValue;
9454 }
9455
9457 {
9458 if (!ctx.
Read(value))
9459 return false;
9460
9462 {
9464 }
9465 else
9466 {
9468 }
9469 }
9470
9471 if (version < 140)
9472 {
9474 {
9475 if (!ctx.
Read(value))
9476 return false;
9477 SetTemperatureDirect(value);
9478 }
9479 }
9480
9482 {
9483 if (!ctx.
Read(value))
9484 return false;
9486 }
9487
9489 {
9490 if (!ctx.
Read(intValue))
9491 return false;
9493 }
9494
9496 {
9497 int r,g,b,a;
9499 return false;
9501 return false;
9503 return false;
9505 return false;
9506
9508 }
9509
9511 {
9512 if (!ctx.
Read(intValue))
9513 return false;
9515 }
9516
9517 if (version >= 138 && version < 140)
9518 {
9520 {
9521 if (!ctx.
Read(intValue))
9522 return false;
9523 SetFrozen(intValue);
9524 }
9525 }
9526
9527 return true;
9528 }
9529
9530
9532 {
9535 {
9537 }
9538
9539 if (!super.OnStoreLoad(ctx, version))
9540 {
9542 return false;
9543 }
9544
9545 if (version >= 114)
9546 {
9547 bool hasQuickBarIndexSaved;
9548
9549 if (!ctx.
Read(hasQuickBarIndexSaved))
9550 {
9552 return false;
9553 }
9554
9555 if (hasQuickBarIndexSaved)
9556 {
9557 int itmQBIndex;
9558
9559
9560 if (!ctx.
Read(itmQBIndex))
9561 {
9563 return false;
9564 }
9565
9566 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9567 if (itmQBIndex != -1 && parentPlayer)
9568 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9569 }
9570 }
9571 else
9572 {
9573
9574 PlayerBase player;
9575 int itemQBIndex;
9576 if (version ==
int.
MAX)
9577 {
9578 if (!ctx.
Read(itemQBIndex))
9579 {
9581 return false;
9582 }
9583 }
9584 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9585 {
9586
9587 if (!ctx.
Read(itemQBIndex))
9588 {
9590 return false;
9591 }
9592 if (itemQBIndex != -1 && player)
9593 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9594 }
9595 }
9596
9597 if (version < 140)
9598 {
9599
9600 if (!LoadVariables(ctx, version))
9601 {
9603 return false;
9604 }
9605 }
9606
9607
9609 {
9611 return false;
9612 }
9613 if (version >= 132)
9614 {
9616 if (raib)
9617 {
9619 {
9621 return false;
9622 }
9623 }
9624 }
9625
9627 return true;
9628 }
9629
9630
9631
9633 {
9634 super.OnStoreSave(ctx);
9635
9636 PlayerBase player;
9637 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9638 {
9640
9641 int itemQBIndex = -1;
9642 itemQBIndex = player.FindQuickBarEntityIndex(this);
9643 ctx.
Write(itemQBIndex);
9644 }
9645 else
9646 {
9648 }
9649
9651
9653 if (raib)
9654 {
9656 }
9657 }
9658
9659
9661 {
9662 super.AfterStoreLoad();
9663
9665 {
9667 }
9668
9670 {
9673 }
9674 }
9675
9677 {
9678 super.EEOnAfterLoad();
9679
9681 {
9683 }
9684
9687 }
9688
9690 {
9691 return false;
9692 }
9693
9694
9695
9697 {
9699 {
9700 #ifdef PLATFORM_CONSOLE
9701
9703 {
9705 if (menu)
9706 {
9708 }
9709 }
9710 #endif
9711 }
9712
9714 {
9717 }
9718
9720 {
9721 SetWeightDirty();
9723 }
9725 {
9728 }
9729
9731 {
9734
9737 }
9739 {
9743 }
9744
9745 super.OnVariablesSynchronized();
9746 }
9747
9748
9749
9751 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9752 {
9753 if (!IsServerCheck(allow_client))
9754 return false;
9755
9757 return false;
9758
9761
9762 if (value <= (min + 0.001))
9763 value = min;
9764
9765 if (value == min)
9766 {
9767 if (destroy_config)
9768 {
9769 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9770 if (dstr)
9771 {
9773 this.Delete();
9774 return true;
9775 }
9776 }
9777 else if (destroy_forced)
9778 {
9780 this.Delete();
9781 return true;
9782 }
9783
9785 }
9786
9789
9791 {
9792 EntityAI parent = GetHierarchyRoot();
9793 InventoryLocation iLoc = new InventoryLocation();
9794 GetInventory().GetCurrentInventoryLocation(iLoc);
9796 {
9797 int iLocSlot = iLoc.
GetSlot();
9799 {
9801 }
9803 {
9805 }
9806 }
9807 }
9808
9810 {
9812
9813 if (delta)
9815 }
9816
9818
9819 return false;
9820 }
9821
9822
9824 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9825 {
9827 }
9828
9830 {
9833 }
9834
9836 {
9839 }
9840
9842 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9843 {
9844 float value_clamped = Math.Clamp(value, 0, 1);
9846 SetQuantity(result, destroy_config, destroy_forced);
9847 }
9848
9849
9852 {
9854 }
9855
9857 {
9859 }
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9871 {
9872 int slot = -1;
9873 GameInventory inventory = GetInventory();
9874 if (inventory)
9875 {
9876 InventoryLocation il = new InventoryLocation;
9879 }
9880
9882 }
9883
9885 {
9886 float quantity_max = 0;
9887
9889 {
9890 if (attSlotID != -1)
9891 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9892
9893 if (quantity_max <= 0)
9895 }
9896
9897 if (quantity_max <= 0)
9899
9900 return quantity_max;
9901 }
9902
9904 {
9906 }
9907
9909 {
9911 }
9912
9913
9915 {
9917 }
9918
9920 {
9922 }
9923
9925 {
9927 }
9928
9929
9931 {
9932
9933 float weightEx = GetWeightEx();
9934 float special = GetInventoryAndCargoWeight();
9935 return weightEx - special;
9936 }
9937
9938
9940 {
9942 }
9943
9945 {
9947 {
9948 #ifdef DEVELOPER
9949 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9950 {
9951 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9953 }
9954 #endif
9955
9957 }
9958 else if (HasEnergyManager())
9959 {
9960 #ifdef DEVELOPER
9961 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9962 {
9963 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9964 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9965 }
9966 #endif
9967 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9968 }
9969 else
9970 {
9971 #ifdef DEVELOPER
9972 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9973 {
9974 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9975 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9976 }
9977 #endif
9978 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9979 }
9980 }
9981
9984 {
9985 int item_count = 0;
9987
9988 GameInventory inventory = GetInventory();
9989 CargoBase cargo = inventory.
GetCargo();
9990 if (cargo != NULL)
9991 {
9993 }
9994
9996 for (int i = 0; i < nAttachments; ++i)
9997 {
9999 if (item)
10000 item_count += item.GetNumberOfItems();
10001 }
10002 return item_count;
10003 }
10004
10007 {
10008 float weight = 0;
10009 float wetness = 1;
10010 if (include_wetness)
10013 {
10014 weight = wetness * m_ConfigWeight;
10015 }
10017 {
10018 weight = 1;
10019 }
10020 return weight;
10021 }
10022
10023
10024
10026 {
10027 GameInventory inventory = GetInventory();
10028 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10029 {
10030 array<EntityAI> items = new array<EntityAI>;
10032 for (int i = 0; i < items.Count(); ++i)
10033 {
10035 if (item)
10036 {
10037 g_Game.ObjectDelete(item);
10038 }
10039 }
10040 }
10041 }
10042
10043
10044
10045
10047 {
10048 float energy = 0;
10049 if (HasEnergyManager())
10050 {
10051 energy = GetCompEM().GetEnergy();
10052 }
10053 return energy;
10054 }
10055
10056
10058 {
10059 super.OnEnergyConsumed();
10060
10062 }
10063
10065 {
10066 super.OnEnergyAdded();
10067
10069 }
10070
10071
10073 {
10074 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10075 {
10077 {
10078 float energy_0to1 = GetCompEM().GetEnergy0To1();
10080 }
10081 }
10082 }
10083
10084
10086 {
10087 return ConfigGetFloat("heatIsolation");
10088 }
10089
10091 {
10093 }
10094
10096 {
10097 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10098 if (
g_Game.ConfigIsExisting(paramPath))
10099 return g_Game.ConfigGetFloat(paramPath);
10100
10101 return 0.0;
10102 }
10103
10105 {
10106 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10107 if (
g_Game.ConfigIsExisting(paramPath))
10108 return g_Game.ConfigGetFloat(paramPath);
10109
10110 return 0.0;
10111 }
10112
10113 override void SetWet(
float value,
bool allow_client =
false)
10114 {
10115 if (!IsServerCheck(allow_client))
10116 return;
10117
10120
10122
10123 m_VarWet = Math.Clamp(value, min, max);
10124
10126 {
10129 }
10130 }
10131
10132 override void AddWet(
float value)
10133 {
10135 }
10136
10138 {
10140 }
10141
10143 {
10145 }
10146
10148 {
10150 }
10151
10153 {
10155 }
10156
10158 {
10160 }
10161
10162 override void OnWetChanged(
float newVal,
float oldVal)
10163 {
10166 if (newLevel != oldLevel)
10167 {
10169 }
10170 }
10171
10173 {
10174 SetWeightDirty();
10175 }
10176
10178 {
10179 return GetWetLevelInternal(
m_VarWet);
10180 }
10181
10182
10183
10185 {
10187 }
10188
10190 {
10192 }
10193
10195 {
10197 }
10198
10200 {
10202 }
10203
10204
10205
10207 {
10208 if (ConfigIsExisting("itemModelLength"))
10209 {
10210 return ConfigGetFloat("itemModelLength");
10211 }
10212 return 0;
10213 }
10214
10216 {
10217 if (ConfigIsExisting("itemAttachOffset"))
10218 {
10219 return ConfigGetFloat("itemAttachOffset");
10220 }
10221 return 0;
10222 }
10223
10224 override void SetCleanness(
int value,
bool allow_client =
false)
10225 {
10226 if (!IsServerCheck(allow_client))
10227 return;
10228
10230
10232
10235 }
10236
10238 {
10240 }
10241
10243 {
10244 return true;
10245 }
10246
10247
10248
10249
10251 {
10253 }
10254
10256 {
10258 }
10259
10260
10261
10262
10263 override void SetColor(
int r,
int g,
int b,
int a)
10264 {
10270 }
10272 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10273 {
10278 }
10279
10281 {
10283 }
10284
10287 {
10288 int r,g,b,a;
10290 r = r/255;
10291 g = g/255;
10292 b = b/255;
10293 a = a/255;
10294 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10295 }
10296
10297
10298
10299 override void SetLiquidType(
int value,
bool allow_client =
false)
10300 {
10301 if (!IsServerCheck(allow_client))
10302 return;
10303
10308 }
10309
10311 {
10312 return ConfigGetInt("varLiquidTypeInit");
10313 }
10314
10316 {
10318 }
10319
10321 {
10323 SetFrozen(false);
10324 }
10325
10328 {
10329 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10330 }
10331
10332
10335 {
10336 PlayerBase nplayer;
10337 if (PlayerBase.CastTo(nplayer, player))
10338 {
10340 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10341 }
10342 }
10343
10344
10347 {
10348 PlayerBase nplayer;
10349 if (PlayerBase.CastTo(nplayer,player))
10350 {
10351 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10352 }
10353
10354 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10355
10356 if (HasEnergyManager())
10357 {
10358 GetCompEM().UpdatePlugState();
10359 }
10360 }
10361
10362
10364 {
10365 super.OnPlacementStarted(player);
10366
10368 }
10369
10370 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10371 {
10373 {
10374 m_AdminLog.OnPlacementComplete(player,
this);
10375 }
10376
10377 super.OnPlacementComplete(player, position, orientation);
10378 }
10379
10380
10381
10382
10383
10385 {
10387 {
10388 return true;
10389 }
10390 else
10391 {
10392 return false;
10393 }
10394 }
10395
10396
10398 {
10400 {
10402 }
10403 }
10404
10405
10407 {
10409 }
10410
10412 {
10414 }
10415
10416 override void InsertAgent(
int agent,
float count = 1)
10417 {
10418 if (count < 1)
10419 return;
10420
10422 }
10423
10426 {
10428 }
10429
10430
10432 {
10434 }
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10463
10464
10465
10466
10467
10468
10469
10470
10471
10472
10473
10474
10475
10476
10478 {
10480 return false;
10481 return true;
10482 }
10483
10485 {
10486
10488 }
10489
10490
10493 {
10494 super.CheckForRoofLimited(timeTresholdMS);
10495
10496 float time =
g_Game.GetTime();
10497 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10498 {
10499 m_PreviousRoofTestTime = time;
10500 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10501 }
10502 }
10503
10504
10506 {
10508 {
10509 return 0;
10510 }
10511
10512 if (GetInventory().GetAttachmentSlotsCount() != 0)
10513 {
10514 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10515 if (filter)
10516 return filter.GetProtectionLevel(type, false, system);
10517 else
10518 return 0;
10519 }
10520
10521 string subclassPath, entryName;
10522
10523 switch (type)
10524 {
10526 entryName = "biological";
10527 break;
10529 entryName = "chemical";
10530 break;
10531 default:
10532 entryName = "biological";
10533 break;
10534 }
10535
10536 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10537
10538 return g_Game.ConfigGetFloat(subclassPath + entryName);
10539 }
10540
10541
10542
10545 {
10546 if (!IsMagazine())
10548
10550 }
10551
10552
10553
10554
10555
10560 {
10561 return true;
10562 }
10563
10565 {
10567 }
10568
10569
10570
10571
10572
10574 {
10575 if (parent)
10576 {
10577 if (parent.IsInherited(DayZInfected))
10578 return true;
10579
10580 if (!parent.IsRuined())
10581 return true;
10582 }
10583
10584 return true;
10585 }
10586
10588 {
10589 if (!super.CanPutAsAttachment(parent))
10590 {
10591 return false;
10592 }
10593
10594 if (!IsRuined() && !parent.IsRuined())
10595 {
10596 return true;
10597 }
10598
10599 return false;
10600 }
10601
10603 {
10604
10605
10606
10607
10608 return super.CanReceiveItemIntoCargo(item);
10609 }
10610
10612 {
10613
10614
10615
10616
10617 GameInventory attachmentInv = attachment.GetInventory();
10619 {
10620 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10621 return false;
10622 }
10623
10624 InventoryLocation loc = new InventoryLocation();
10625 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10626 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10627 return false;
10628
10629 return super.CanReceiveAttachment(attachment, slotId);
10630 }
10631
10633 {
10634 if (!super.CanReleaseAttachment(attachment))
10635 return false;
10636
10637 return GetInventory().AreChildrenAccessible();
10638 }
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10651
10652
10653
10654
10655
10656
10657
10658
10659
10661 {
10662 int id = muzzle_owner.GetMuzzleID();
10663 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10664
10665 if (WPOF_array)
10666 {
10667 for (int i = 0; i < WPOF_array.Count(); i++)
10668 {
10669 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10670
10671 if (WPOF)
10672 {
10673 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10674 }
10675 }
10676 }
10677 }
10678
10679
10681 {
10682 int id = muzzle_owner.GetMuzzleID();
10684
10685 if (WPOBE_array)
10686 {
10687 for (int i = 0; i < WPOBE_array.Count(); i++)
10688 {
10689 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10690
10691 if (WPOBE)
10692 {
10693 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10694 }
10695 }
10696 }
10697 }
10698
10699
10701 {
10702 int id = muzzle_owner.GetMuzzleID();
10703 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10704
10705 if (WPOOH_array)
10706 {
10707 for (int i = 0; i < WPOOH_array.Count(); i++)
10708 {
10709 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10710
10711 if (WPOOH)
10712 {
10713 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10714 }
10715 }
10716 }
10717 }
10718
10719
10721 {
10722 int id = muzzle_owner.GetMuzzleID();
10723 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10724
10725 if (WPOOH_array)
10726 {
10727 for (int i = 0; i < WPOOH_array.Count(); i++)
10728 {
10729 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10730
10731 if (WPOOH)
10732 {
10733 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10734 }
10735 }
10736 }
10737 }
10738
10739
10741 {
10742 int id = muzzle_owner.GetMuzzleID();
10743 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10744
10745 if (WPOOH_array)
10746 {
10747 for (int i = 0; i < WPOOH_array.Count(); i++)
10748 {
10749 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10750
10751 if (WPOOH)
10752 {
10753 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10754 }
10755 }
10756 }
10757 }
10758
10759
10760
10762 {
10764 {
10765 return true;
10766 }
10767
10768 return false;
10769 }
10770
10772 {
10774 {
10775 return true;
10776 }
10777
10778 return false;
10779 }
10780
10782 {
10784 {
10785 return true;
10786 }
10787
10788 return false;
10789 }
10790
10792 {
10793 return false;
10794 }
10795
10798 {
10799 return UATimeSpent.DEFAULT_DEPLOY;
10800 }
10801
10802
10803
10804
10806 {
10808 SetSynchDirty();
10809 }
10810
10812 {
10814 }
10815
10816
10818 {
10819 return false;
10820 }
10821
10824 {
10825 string att_type = "None";
10826
10827 if (ConfigIsExisting("soundAttType"))
10828 {
10829 att_type = ConfigGetString("soundAttType");
10830 }
10831
10833 }
10834
10836 {
10838 }
10839
10840
10841
10842
10843
10849
10851 {
10854
10856 }
10857
10858
10860 {
10862 return;
10863
10865
10868
10871
10872 SoundParameters params = new SoundParameters();
10876 }
10877
10878
10880 {
10882 {
10885
10886 SetSynchDirty();
10887
10890 }
10891 }
10892
10894 {
10896 }
10897
10898
10900 {
10902 return;
10903
10905 SetSynchDirty();
10906
10909 }
10910
10912 {
10915 }
10916
10918 {
10920 }
10921
10922 void OnApply(PlayerBase player);
10923
10925 {
10926 return 1.0;
10927 };
10928
10930 {
10932 }
10933
10935 {
10937 }
10938
10940
10942 {
10943 SetDynamicPhysicsLifeTime(0.01);
10945 }
10946
10948 {
10949 array<string> zone_names = new array<string>;
10950 GetDamageZones(zone_names);
10951 for (int i = 0; i < zone_names.Count(); i++)
10952 {
10953 SetHealthMax(zone_names.Get(i),"Health");
10954 }
10955 SetHealthMax("","Health");
10956 }
10957
10960 {
10961 float global_health = GetHealth01("","Health");
10962 array<string> zones = new array<string>;
10963 GetDamageZones(zones);
10964
10965 for (int i = 0; i < zones.Count(); i++)
10966 {
10967 SetHealth01(zones.Get(i),"Health",global_health);
10968 }
10969 }
10970
10973 {
10974 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10975 }
10976
10978 {
10979 if (!hasRootAsPlayer)
10980 {
10981 if (refParentIB)
10982 {
10983
10984 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10985 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10986
10987 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10988 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10989
10992 }
10993 else
10994 {
10995
10998 }
10999 }
11000 }
11001
11003 {
11005 {
11006 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11007 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11008 {
11009 float heatPermCoef = 1.0;
11011 while (ent)
11012 {
11013 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11014 ent = ent.GetHierarchyParent();
11015 }
11016
11017 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11018 }
11019 }
11020 }
11021
11023 {
11024
11025 EntityAI parent = GetHierarchyParent();
11026 if (!parent)
11027 {
11028 hasParent = false;
11029 hasRootAsPlayer = false;
11030 }
11031 else
11032 {
11033 hasParent = true;
11034 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11035 refParentIB =
ItemBase.Cast(parent);
11036 }
11037 }
11038
11039 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11040 {
11041
11042 }
11043
11045 {
11046
11047 return false;
11048 }
11049
11051 {
11052
11053
11054 return false;
11055 }
11056
11058 {
11059
11060 return false;
11061 }
11062
11065 {
11066 return !GetIsFrozen() &&
IsOpen();
11067 }
11068
11070 {
11071 bool hasParent = false, hasRootAsPlayer = false;
11073
11074 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11075 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11076
11077 if (wwtu || foodDecay)
11078 {
11082
11083 if (processWetness || processTemperature || processDecay)
11084 {
11086
11087 if (processWetness)
11088 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11089
11090 if (processTemperature)
11092
11093 if (processDecay)
11094 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11095 }
11096 }
11097 }
11098
11101 {
11103 }
11104
11106 {
11109
11110 return super.GetTemperatureFreezeThreshold();
11111 }
11112
11114 {
11117
11118 return super.GetTemperatureThawThreshold();
11119 }
11120
11122 {
11125
11126 return super.GetItemOverheatThreshold();
11127 }
11128
11130 {
11132 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11133
11134 return super.GetTemperatureFreezeTime();
11135 }
11136
11138 {
11140 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11141
11142 return super.GetTemperatureThawTime();
11143 }
11144
11149
11151 {
11152 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11153 }
11154
11156 {
11157 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11158 }
11159
11162 {
11164 }
11165
11167 {
11169 }
11170
11172 {
11174 }
11175
11178 {
11179 return null;
11180 }
11181
11184 {
11185 return false;
11186 }
11187
11189 {
11191 {
11194 if (!trg)
11195 {
11197 explosive = this;
11198 }
11199
11200 explosive.PairRemote(trg);
11202
11203 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11204 trg.SetPersistentPairID(persistentID);
11205 explosive.SetPersistentPairID(persistentID);
11206
11207 return true;
11208 }
11209 return false;
11210 }
11211
11214 {
11215 float ret = 1.0;
11218 ret *= GetHealth01();
11219
11220 return ret;
11221 }
11222
11223 #ifdef DEVELOPER
11224 override void SetDebugItem()
11225 {
11226 super.SetDebugItem();
11227 _itemBase = this;
11228 }
11229
11231 {
11232 string text = super.GetDebugText();
11233
11235 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11236
11237 return text;
11238 }
11239 #endif
11240
11242 {
11243 return true;
11244 }
11245
11247
11249
11251 {
11254 }
11255
11256
11264
11280
11281 [
Obsolete(
"Use ItemSoundHandler instead")]
11284 {
11285 if (!
g_Game.IsDedicatedServer())
11286 {
11287 if (ConfigIsExisting("attachSoundSet"))
11288 {
11289 string cfg_path = "";
11290 string soundset = "";
11291 string type_name =
GetType();
11292
11295 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11296 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11297
11298 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11299 {
11300 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11301 {
11302 if (cfg_slot_array[i] == slot_type)
11303 {
11304 soundset = cfg_soundset_array[i];
11305 break;
11306 }
11307 }
11308 }
11309
11310 if (soundset != "")
11311 {
11312 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11314 }
11315 }
11316 }
11317 }
11318
11320}
11321
11323{
11325 if (entity)
11326 {
11327 bool is_item = entity.IsInherited(
ItemBase);
11328 if (is_item && full_quantity)
11329 {
11332 }
11333 }
11334 else
11335 {
11337 return NULL;
11338 }
11339 return entity;
11340}
11341
11343{
11344 if (item)
11345 {
11346 if (health > 0)
11347 item.SetHealth("", "", health);
11348
11349 if (item.CanHaveTemperature())
11350 {
11352 if (item.CanFreeze())
11353 item.SetFrozen(false);
11354 }
11355
11356 if (item.HasEnergyManager())
11357 {
11358 if (quantity >= 0)
11359 {
11360 item.GetCompEM().SetEnergy0To1(quantity);
11361 }
11362 else
11363 {
11365 }
11366 }
11367 else if (item.IsMagazine())
11368 {
11369 Magazine mag = Magazine.Cast(item);
11370 if (quantity >= 0)
11371 {
11372 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11373 }
11374 else
11375 {
11377 }
11378
11379 }
11380 else
11381 {
11382 if (quantity >= 0)
11383 {
11384 item.SetQuantityNormalized(quantity, false);
11385 }
11386 else
11387 {
11389 }
11390
11391 }
11392 }
11393}
11394
11395#ifdef DEVELOPER
11397#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.