6393{
6395 {
6396 return true;
6397 }
6398};
6399
6401{
6402
6403};
6404
6405
6406
6408{
6412
6414
6417
6418
6419
6420
6421
6430
6436
6441
6446
6467 protected bool m_IsResultOfSplit
6468
6470
6475
6476
6477
6479
6483
6484
6485
6487
6490
6491
6492
6498
6499
6507
6510
6511
6513
6514
6516
6517
6522
6523
6528
6530
6531
6533
6534
6536 {
6541
6542 if (!
g_Game.IsDedicatedServer())
6543 {
6545 {
6547
6549 {
6551 }
6552 }
6553
6556 }
6557
6558 m_OldLocation = null;
6559
6561 {
6563 }
6564
6565 if (ConfigIsExisting("headSelectionsToHide"))
6566 {
6569 }
6570
6572 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6573 {
6575 }
6576
6578
6579 m_IsResultOfSplit = false;
6580
6582 }
6583
6585 {
6586 super.InitItemVariables();
6587
6593 m_Count = ConfigGetInt(
"count");
6594
6597
6602
6605
6610
6622
6626
6627
6630 if (ConfigIsExisting("canBeSplit"))
6631 {
6634 }
6635
6637 if (ConfigIsExisting("itemBehaviour"))
6639
6640
6643 RegisterNetSyncVariableInt("m_VarLiquidType");
6644 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6645
6646 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6647 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6648 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6649
6650 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6651 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6652 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6653 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6654
6655 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6656 RegisterNetSyncVariableBool("m_IsTakeable");
6657 RegisterNetSyncVariableBool("m_IsHologram");
6658
6661 {
6664 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6665 }
6666
6668
6670 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6672
6674 }
6675
6677 {
6679 }
6680
6682 {
6685 {
6690 }
6691 }
6692
6693 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6694 {
6696 {
6699 }
6700
6702 }
6703
6705 {
6711 }
6712
6714
6716 {
6718
6719 if (!action)
6720 {
6721 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6722 return;
6723 }
6724
6726 if (!ai)
6727 {
6729 return;
6730 }
6731
6733 if (!action_array)
6734 {
6735 action_array = new array<ActionBase_Basic>;
6737 }
6738 if (LogManager.IsActionLogEnable())
6739 {
6740 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6741 }
6742
6743 if (action_array.Find(action) != -1)
6744 {
6745 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6746 }
6747 else
6748 {
6749 action_array.Insert(action);
6750 }
6751 }
6752
6754 {
6755 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6756 ActionBase action = player.GetActionManager().GetAction(actionName);
6759
6760 if (action_array)
6761 {
6762 action_array.RemoveItem(action);
6763 }
6764 }
6765
6766
6767
6769 {
6770 ActionOverrideData overrideData = new ActionOverrideData();
6774
6776 if (!actionMap)
6777 {
6780 }
6781
6782 actionMap.Insert(this.
Type(), overrideData);
6783
6784 }
6785
6787
6789
6790
6792 {
6795
6798
6799 string config_to_search = "CfgVehicles";
6800 string muzzle_owner_config;
6801
6803 {
6804 if (IsInherited(Weapon))
6805 config_to_search = "CfgWeapons";
6806
6807 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6808
6809 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6810
6811 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6812
6813 if (config_OnFire_subclass_count > 0)
6814 {
6815 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6816
6817 for (int i = 0; i < config_OnFire_subclass_count; i++)
6818 {
6819 string particle_class = "";
6820 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6821 string config_OnFire_entry = config_OnFire_class + particle_class;
6822 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6823 WPOF_array.Insert(WPOF);
6824 }
6825
6826
6828 }
6829 }
6830
6832 {
6833 config_to_search = "CfgWeapons";
6834 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6835
6836 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6837
6838 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6839
6840 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6841 {
6842 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6843
6844 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6845 {
6846 string particle_class2 = "";
6847 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6848 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6849 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6850 WPOBE_array.Insert(WPOBE);
6851 }
6852
6853
6855 }
6856 }
6857 }
6858
6859
6861 {
6864
6866 {
6867 string config_to_search = "CfgVehicles";
6868
6869 if (IsInherited(Weapon))
6870 config_to_search = "CfgWeapons";
6871
6872 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6873 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6874
6875 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6876 {
6877
6879
6881 {
6883 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6885 return;
6886 }
6887
6890
6891
6892
6893 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6894 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6895
6896 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6897 {
6898 string particle_class = "";
6899 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6900 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6901 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6902
6903 if (entry_type == CT_CLASS)
6904 {
6905 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6906 WPOOH_array.Insert(WPOF);
6907 }
6908 }
6909
6910
6912 }
6913 }
6914 }
6915
6917 {
6919 }
6920
6922 {
6924 {
6926
6929
6932
6933 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6934 }
6935 }
6936
6938 {
6940 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6941
6943 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6944
6946 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6947
6949 {
6951 }
6952 }
6953
6955 {
6957 }
6958
6960 {
6963 else
6965
6967 {
6970 }
6971 else
6972 {
6975
6978 }
6979
6981 }
6982
6984 {
6986 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6987 }
6988
6990 {
6992 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6994 }
6995
6997 {
6999 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7000 }
7001
7003 {
7006
7007 OverheatingParticle OP = new OverheatingParticle();
7012
7014 }
7015
7017 {
7020
7021 return -1;
7022 }
7023
7025 {
7027 {
7030
7031 for (int i = count; i > 0; --i)
7032 {
7033 int id = i - 1;
7036
7039
7040 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7041 {
7042 if (p)
7043 {
7046 }
7047 }
7048 }
7049 }
7050 }
7051
7053 {
7055 {
7057 {
7058 int id = i - 1;
7060
7061 if (OP)
7062 {
7064
7065 if (p)
7066 {
7068 }
7069
7070 delete OP;
7071 }
7072 }
7073
7076 }
7077 }
7078
7081 {
7082 return 0.0;
7083 }
7084
7085
7087 {
7088 return 250;
7089 }
7090
7092 {
7093 return 0;
7094 }
7095
7098 {
7100 return true;
7101
7102 return false;
7103 }
7104
7107 {
7110
7112 {
7114 }
7115 else
7116 {
7117
7119 }
7120
7122 }
7123
7130 {
7131 return -1;
7132 }
7133
7134
7135
7136
7138 {
7140 {
7141 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7142 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7143
7144 if (r_index >= 0)
7145 {
7146 InventoryLocation r_il = new InventoryLocation;
7147 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7148
7149 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7152 {
7153 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7154 }
7156 {
7157 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7158 }
7159
7160 }
7161
7162 player.GetHumanInventory().ClearUserReservedLocation(this);
7163 }
7164
7167 }
7168
7169
7170
7171
7173 {
7174 return ItemBase.m_DebugActionsMask;
7175 }
7176
7178 {
7179 return ItemBase.m_DebugActionsMask & mask;
7180 }
7181
7183 {
7184 ItemBase.m_DebugActionsMask = mask;
7185 }
7186
7188 {
7189 ItemBase.m_DebugActionsMask |= mask;
7190 }
7191
7193 {
7194 ItemBase.m_DebugActionsMask &= ~mask;
7195 }
7196
7198 {
7200 {
7202 }
7203 else
7204 {
7206 }
7207 }
7208
7209
7211 {
7212 if (GetEconomyProfile())
7213 {
7214 float q_max = GetEconomyProfile().GetQuantityMax();
7215 if (q_max > 0)
7216 {
7217 float q_min = GetEconomyProfile().GetQuantityMin();
7218 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7219
7221 {
7222 ComponentEnergyManager comp = GetCompEM();
7224 {
7226 }
7227 }
7229 {
7231
7232 }
7233
7234 }
7235 }
7236 }
7237
7240 {
7241 EntityAI parent = GetHierarchyParent();
7242
7243 if (parent)
7244 {
7245 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7246 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7247 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7248 }
7249 }
7250
7253 {
7254 EntityAI parent = GetHierarchyParent();
7255
7256 if (parent)
7257 {
7258 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7259 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7260 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7261 }
7262 }
7263
7265 {
7266
7267
7268
7269
7271
7273 {
7274 if (ScriptInputUserData.CanStoreInputUserData())
7275 {
7276 ScriptInputUserData ctx = new ScriptInputUserData;
7282 ctx.
Write(use_stack_max);
7285
7287 {
7288 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7289 }
7290 }
7291 }
7292 else if (!
g_Game.IsMultiplayer())
7293 {
7295 }
7296 }
7297
7299 {
7301 }
7302
7304 {
7306 }
7307
7309 {
7311 }
7312
7314 {
7315
7316 return false;
7317 }
7318
7320 {
7321 return false;
7322 }
7323
7327 {
7328 return false;
7329 }
7330
7332 {
7333 return "";
7334 }
7335
7337
7339 {
7340 return false;
7341 }
7342
7344 {
7345 return true;
7346 }
7347
7348
7349
7351 {
7352 return true;
7353 }
7354
7356 {
7357 return true;
7358 }
7359
7361 {
7362 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7364 }
7365
7367 {
7369 }
7370
7372 {
7374 if (!is_being_placed)
7376 SetSynchDirty();
7377 }
7378
7379
7381
7383 {
7385 }
7386
7388 {
7390 }
7391
7393 {
7394 return 1;
7395 }
7396
7398 {
7399 return false;
7400 }
7401
7403 {
7405 SetSynchDirty();
7406 }
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7443 {
7444 super.OnMovedInsideCargo(container);
7445
7446 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7447 }
7448
7449 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7450 {
7451 super.EEItemLocationChanged(oldLoc, newLoc);
7452
7453 PlayerBase newPlayer = null;
7454 PlayerBase oldPlayer = null;
7455
7456 if (newLoc.GetParent())
7457 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7458
7459 if (oldLoc.GetParent())
7460 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7461
7463 {
7464 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7465
7466 if (rIndex >= 0)
7467 {
7468 InventoryLocation rIl = new InventoryLocation;
7469 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7470
7471 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7474 {
7475 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7476 }
7478 {
7480 }
7481
7482 }
7483 }
7484
7486 {
7487 if (newPlayer)
7488 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7489
7490 if (newPlayer == oldPlayer)
7491 {
7492 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7493 {
7495 {
7496 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7497 {
7498 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7499 }
7500 }
7501 else
7502 {
7503 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7504 }
7505 }
7506
7507 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7508 {
7509 int type = oldLoc.GetType();
7511 {
7512 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7513 }
7515 {
7516 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7517 }
7518 }
7519 if (!m_OldLocation)
7520 {
7521 m_OldLocation = new InventoryLocation;
7522 }
7523 m_OldLocation.Copy(oldLoc);
7524 }
7525 else
7526 {
7527 if (m_OldLocation)
7528 {
7529 m_OldLocation.Reset();
7530 }
7531 }
7532
7533 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7534 }
7535 else
7536 {
7537 if (newPlayer)
7538 {
7539 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7540 if (resIndex >= 0)
7541 {
7542 InventoryLocation il = new InventoryLocation;
7543 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7545 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7548 {
7549 il.
GetParent().GetOnReleaseLock().Invoke(it);
7550 }
7552 {
7554 }
7555
7556 }
7557 }
7559 {
7560
7562 }
7563
7564 if (m_OldLocation)
7565 {
7566 m_OldLocation.Reset();
7567 }
7568 }
7569
7571 {
7572 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7573 }
7574
7576 {
7577 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7578 }
7579 }
7580
7581 override void EOnContact(IEntity other, Contact extra)
7582 {
7584 {
7585 int liquidType = -1;
7587 if (impactSpeed > 0.0)
7588 {
7590 #ifndef SERVER
7592 #else
7594 SetSynchDirty();
7595 #endif
7597 }
7598 }
7599
7600 #ifdef SERVER
7601 if (GetCompEM() && GetCompEM().IsPlugged())
7602 {
7603 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7604 GetCompEM().UnplugThis();
7605 }
7606 #endif
7607 }
7608
7610
7612 {
7614 }
7615
7617 {
7618
7619 }
7620
7622 {
7623 super.OnItemLocationChanged(old_owner, new_owner);
7624
7625 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7626 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7627
7628 if (!relatedPlayer && playerNew)
7629 relatedPlayer = playerNew;
7630
7631 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7632 {
7634 if (actionMgr)
7635 {
7636 ActionBase currentAction = actionMgr.GetRunningAction();
7637 if (currentAction)
7639 }
7640 }
7641
7642 Man ownerPlayerOld = null;
7643 Man ownerPlayerNew = null;
7644
7645 if (old_owner)
7646 {
7647 if (old_owner.
IsMan())
7648 {
7649 ownerPlayerOld = Man.Cast(old_owner);
7650 }
7651 else
7652 {
7653 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7654 }
7655 }
7656 else
7657 {
7659 {
7661
7662 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7663 {
7664 GetCompEM().UnplugThis();
7665 }
7666 }
7667 }
7668
7669 if (new_owner)
7670 {
7671 if (new_owner.
IsMan())
7672 {
7673 ownerPlayerNew = Man.Cast(new_owner);
7674 }
7675 else
7676 {
7677 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7678 }
7679 }
7680
7681 if (ownerPlayerOld != ownerPlayerNew)
7682 {
7683 if (ownerPlayerOld)
7684 {
7685 array<EntityAI> subItemsExit = new array<EntityAI>;
7687 for (int i = 0; i < subItemsExit.Count(); i++)
7688 {
7691 }
7692 }
7693
7694 if (ownerPlayerNew)
7695 {
7696 array<EntityAI> subItemsEnter = new array<EntityAI>;
7698 for (int j = 0; j < subItemsEnter.Count(); j++)
7699 {
7702 }
7703 }
7704 }
7705 else if (ownerPlayerNew != null)
7706 {
7707 PlayerBase nplayer;
7708 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7709 {
7710 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7712 for (int k = 0; k < subItemsUpdate.Count(); k++)
7713 {
7715 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7716 }
7717 }
7718 }
7719
7720 if (old_owner)
7721 old_owner.OnChildItemRemoved(this);
7722 if (new_owner)
7723 new_owner.OnChildItemReceived(this);
7724 }
7725
7726
7728 {
7729 super.EEDelete(parent);
7730 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7731 if (player)
7732 {
7734
7735 if (player.IsAlive())
7736 {
7737 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7738 if (r_index >= 0)
7739 {
7740 InventoryLocation r_il = new InventoryLocation;
7741 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7742
7743 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7746 {
7747 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7748 }
7750 {
7751 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7752 }
7753
7754 }
7755
7756 player.RemoveQuickBarEntityShortcut(this);
7757 }
7758 }
7759 }
7760
7762 {
7763 super.EEKilled(killer);
7764
7767 {
7768 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7769 {
7770 if (IsMagazine())
7771 {
7772 if (Magazine.Cast(this).GetAmmoCount() > 0)
7773 {
7775 }
7776 }
7777 else
7778 {
7780 }
7781 }
7782 }
7783 }
7784
7786 {
7787 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7788
7789 super.OnWasAttached(parent, slot_id);
7790
7793
7796 }
7797
7799 {
7800 super.OnWasDetached(parent, slot_id);
7801
7804
7807 }
7808
7810 {
7811 int idx;
7814
7815 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7816 if (inventory_slots.Count() < 1)
7817 {
7818 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7819 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7820 }
7821 else
7822 {
7823 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7824 }
7825
7826 idx = inventory_slots.Find(slot);
7827 if (idx < 0)
7828 return "";
7829
7830 return attach_types.Get(idx);
7831 }
7832
7834 {
7835 int idx = -1;
7836 string slot;
7837
7840
7841 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7842 if (inventory_slots.Count() < 1)
7843 {
7844 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7845 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7846 }
7847 else
7848 {
7849 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7850 if (detach_types.Count() < 1)
7851 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7852 }
7853
7854 for (int i = 0; i < inventory_slots.Count(); i++)
7855 {
7856 slot = inventory_slots.Get(i);
7857 }
7858
7859 if (slot != "")
7860 {
7861 if (detach_types.Count() == 1)
7862 idx = 0;
7863 else
7864 idx = inventory_slots.Find(slot);
7865 }
7866 if (idx < 0)
7867 return "";
7868
7869 return detach_types.Get(idx);
7870 }
7871
7873 {
7874
7876
7877
7878 float min_time = 1;
7879 float max_time = 3;
7880 float delay = Math.RandomFloat(min_time, max_time);
7881
7882 explode_timer.Run(delay, this, "DoAmmoExplosion");
7883 }
7884
7886 {
7887 Magazine magazine = Magazine.Cast(this);
7888 int pop_sounds_count = 6;
7889 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7890
7891
7892 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7893 string sound_name = pop_sounds[ sound_idx ];
7894 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7895
7896
7897 magazine.ServerAddAmmoCount(-1);
7898
7899
7900 float min_temp_to_explode = 100;
7901
7902 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7903 {
7905 }
7906 }
7907
7908
7909 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7910 {
7911 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7912
7913 const int CHANCE_DAMAGE_CARGO = 4;
7914 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7915 const int CHANCE_DAMAGE_NOTHING = 2;
7916
7918 {
7919 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7920 int chances;
7921 int rnd;
7922
7923 if (GetInventory().GetCargo())
7924 {
7925 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7926 rnd = Math.RandomInt(0,chances);
7927
7928 if (rnd < CHANCE_DAMAGE_CARGO)
7929 {
7931 }
7932 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7933 {
7935 }
7936 }
7937 else
7938 {
7939 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7940 rnd = Math.RandomInt(0,chances);
7941
7942 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7943 {
7945 }
7946 }
7947 }
7948 }
7949
7951 {
7952 CargoBase cargo = GetInventory().GetCargo();
7953 if (cargo)
7954 {
7956 if (item_count > 0)
7957 {
7958 int random_pick = Math.RandomInt(0, item_count);
7960 if (!item.IsExplosive())
7961 {
7962 item.AddHealth("","",damage);
7963 return true;
7964 }
7965 }
7966 }
7967 return false;
7968 }
7969
7971 {
7972 GameInventory inventory = GetInventory();
7974 if (attachment_count > 0)
7975 {
7976 int random_pick = Math.RandomInt(0, attachment_count);
7978 if (!attachment.IsExplosive())
7979 {
7980 attachment.AddHealth("","",damage);
7981 return true;
7982 }
7983 }
7984 return false;
7985 }
7986
7988 {
7990 }
7991
7993 {
7995 return GetInventory().CanRemoveEntity();
7996
7997 return false;
7998 }
7999
8001 {
8002
8004 return false;
8005
8006
8008 return false;
8009
8010
8011
8013 if (delta == 0)
8014 return false;
8015
8016
8017 return true;
8018 }
8019
8021 {
8023 {
8024 if (ScriptInputUserData.CanStoreInputUserData())
8025 {
8026 ScriptInputUserData ctx = new ScriptInputUserData;
8031 ctx.
Write(destination_entity);
8035 }
8036 }
8037 else if (!
g_Game.IsMultiplayer())
8038 {
8040 }
8041 }
8042
8044 {
8045 float split_quantity_new;
8049 InventoryLocation loc = new InventoryLocation;
8050
8051 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8052 {
8054 split_quantity_new = stack_max;
8055 else
8057
8059 {
8060 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8061 if (new_item)
8062 {
8063 new_item.SetResultOfSplit(true);
8064 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8066 new_item.
SetQuantity(split_quantity_new,
false,
true);
8067 }
8068 }
8069 }
8070 else if (destination_entity && slot_id == -1)
8071 {
8072 if (quantity > stack_max)
8073 split_quantity_new = stack_max;
8074 else
8075 split_quantity_new = quantity;
8076
8078 {
8079 GameInventory destinationInventory = destination_entity.GetInventory();
8081 {
8084 }
8085
8086 if (new_item)
8087 {
8088 new_item.SetResultOfSplit(true);
8089 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8091 new_item.
SetQuantity(split_quantity_new,
false,
true);
8092 }
8093 }
8094 }
8095 else
8096 {
8097 if (stack_max != 0)
8098 {
8100 {
8102 }
8103
8104 if (split_quantity_new == 0)
8105 {
8106 if (!
g_Game.IsMultiplayer())
8107 player.PhysicalPredictiveDropItem(this);
8108 else
8109 player.ServerDropEntity(this);
8110 return;
8111 }
8112
8114 {
8116
8117 if (new_item)
8118 {
8119 new_item.SetResultOfSplit(true);
8120 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8123 new_item.PlaceOnSurface();
8124 }
8125 }
8126 }
8127 }
8128 }
8129
8131 {
8132 float split_quantity_new;
8136 InventoryLocation loc = new InventoryLocation;
8137
8138 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8139 {
8141 split_quantity_new = stack_max;
8142 else
8144
8146 {
8147 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8148 if (new_item)
8149 {
8150 new_item.SetResultOfSplit(true);
8151 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8153 new_item.
SetQuantity(split_quantity_new,
false,
true);
8154 }
8155 }
8156 }
8157 else if (destination_entity && slot_id == -1)
8158 {
8159 if (quantity > stack_max)
8160 split_quantity_new = stack_max;
8161 else
8162 split_quantity_new = quantity;
8163
8165 {
8166 GameInventory destinationInventory = destination_entity.GetInventory();
8168 {
8171 }
8172
8173 if (new_item)
8174 {
8175 new_item.SetResultOfSplit(true);
8176 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8178 new_item.
SetQuantity(split_quantity_new,
false,
true);
8179 }
8180 }
8181 }
8182 else
8183 {
8184 if (stack_max != 0)
8185 {
8187 {
8189 }
8190
8192 {
8194
8195 if (new_item)
8196 {
8197 new_item.SetResultOfSplit(true);
8198 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8201 new_item.PlaceOnSurface();
8202 }
8203 }
8204 }
8205 }
8206 }
8207
8209 {
8211 {
8212 if (ScriptInputUserData.CanStoreInputUserData())
8213 {
8214 ScriptInputUserData ctx = new ScriptInputUserData;
8219 dst.WriteToContext(ctx);
8221 }
8222 }
8223 else if (!
g_Game.IsMultiplayer())
8224 {
8226 }
8227 }
8228
8230 {
8232 {
8233 if (ScriptInputUserData.CanStoreInputUserData())
8234 {
8235 ScriptInputUserData ctx = new ScriptInputUserData;
8240 ctx.
Write(destination_entity);
8246 }
8247 }
8248 else if (!
g_Game.IsMultiplayer())
8249 {
8251 }
8252 }
8253
8255 {
8257 }
8258
8260 {
8262 float split_quantity_new;
8264 if (dst.IsValid())
8265 {
8266 int slot_id = dst.GetSlot();
8268
8269 if (quantity > stack_max)
8270 split_quantity_new = stack_max;
8271 else
8272 split_quantity_new = quantity;
8273
8275 {
8277
8278 if (new_item)
8279 {
8280 new_item.SetResultOfSplit(true);
8281 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8283 new_item.
SetQuantity(split_quantity_new,
false,
true);
8284 }
8285
8286 return new_item;
8287 }
8288 }
8289
8290 return null;
8291 }
8292
8294 {
8296 float split_quantity_new;
8298 if (destination_entity)
8299 {
8301 if (quantity > stackable)
8302 split_quantity_new = stackable;
8303 else
8304 split_quantity_new = quantity;
8305
8307 {
8308 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8309 if (new_item)
8310 {
8311 new_item.SetResultOfSplit(true);
8312 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8314 new_item.
SetQuantity(split_quantity_new,
false,
true);
8315 }
8316 }
8317 }
8318 }
8319
8321 {
8323 {
8324 if (ScriptInputUserData.CanStoreInputUserData())
8325 {
8326 ScriptInputUserData ctx = new ScriptInputUserData;
8331 ItemBase destination_entity =
this;
8332 ctx.
Write(destination_entity);
8336 }
8337 }
8338 else if (!
g_Game.IsMultiplayer())
8339 {
8341 }
8342 }
8343
8345 {
8347 float split_quantity_new;
8349 if (player)
8350 {
8352 if (quantity > stackable)
8353 split_quantity_new = stackable;
8354 else
8355 split_quantity_new = quantity;
8356
8358 {
8359 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8360 new_item =
ItemBase.Cast(in_hands);
8361 if (new_item)
8362 {
8363 new_item.SetResultOfSplit(true);
8364 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8366 new_item.SetQuantity(split_quantity_new, false, true);
8367 }
8368 }
8369 }
8370 }
8371
8373 {
8375 float split_quantity_new = Math.Floor(quantity * 0.5);
8376
8378 return;
8379
8381
8382 if (new_item)
8383 {
8384 if (new_item.GetQuantityMax() < split_quantity_new)
8385 {
8386 split_quantity_new = new_item.GetQuantityMax();
8387 }
8388
8389 new_item.SetResultOfSplit(true);
8390 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8391
8393 {
8396 }
8397 else
8398 {
8400 new_item.
SetQuantity(split_quantity_new,
false,
true);
8401 }
8402 }
8403 }
8404
8406 {
8408 float split_quantity_new = Math.Floor(quantity / 2);
8409
8411 return;
8412
8413 InventoryLocation invloc = new InventoryLocation;
8415
8417 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8418
8419 if (new_item)
8420 {
8421 if (new_item.GetQuantityMax() < split_quantity_new)
8422 {
8423 split_quantity_new = new_item.GetQuantityMax();
8424 }
8426 {
8429 }
8430 else if (split_quantity_new > 1)
8431 {
8433 new_item.
SetQuantity(split_quantity_new,
false,
true);
8434 }
8435 }
8436 }
8437
8440 {
8441 SetWeightDirty();
8443
8444 if (parent)
8445 parent.OnAttachmentQuantityChangedEx(this, delta);
8446
8448 {
8450 {
8452 }
8454 {
8455 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8457 }
8458 }
8459 }
8460
8463 {
8464
8465 }
8466
8469 {
8471 }
8472
8474 {
8475 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8476
8478 {
8479 if (newLevel == GameConstants.STATE_RUINED)
8480 {
8482 EntityAI parent = GetHierarchyParent();
8483 if (parent && parent.IsFireplace())
8484 {
8485 CargoBase cargo = GetInventory().GetCargo();
8486 if (cargo)
8487 {
8489 {
8491 }
8492 }
8493 }
8494 }
8495
8497 {
8498
8500 return;
8501 }
8502
8503 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8504 {
8506 }
8507 }
8508 }
8509
8510
8512 {
8513 super.OnRightClick();
8514
8516 {
8518 {
8519 if (ScriptInputUserData.CanStoreInputUserData())
8520 {
8521 EntityAI root = GetHierarchyRoot();
8522 Man playerOwner = GetHierarchyRootPlayer();
8523 InventoryLocation dst = new InventoryLocation;
8524
8525
8526 if (!playerOwner && root && root == this)
8527 {
8529 }
8530 else
8531 {
8532
8533 GetInventory().GetCurrentInventoryLocation(dst);
8535 {
8536 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8538 {
8540 }
8541 else
8542 {
8544
8545
8546 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8547 {
8549 }
8550 else
8551 {
8552 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8553 }
8554 }
8555 }
8556 }
8557
8558 ScriptInputUserData ctx = new ScriptInputUserData;
8566 }
8567 }
8568 else if (!
g_Game.IsMultiplayer())
8569 {
8571 }
8572 }
8573 }
8574
8576 {
8577 if (root)
8578 {
8579 vector m4[4];
8580 root.GetTransform(m4);
8581 dst.SetGround(this, m4);
8582 }
8583 else
8584 {
8585 GetInventory().GetCurrentInventoryLocation(dst);
8586 }
8587 }
8588
8589 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8590 {
8591
8592 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8593 return false;
8594
8595 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8596 return false;
8597
8598
8600 return false;
8601
8602
8603 Magazine mag = Magazine.Cast(this);
8604 if (mag)
8605 {
8606 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8607 return false;
8608
8609 if (stack_max_limit)
8610 {
8611 Magazine other_mag = Magazine.Cast(other_item);
8612 if (other_item)
8613 {
8614 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8615 return false;
8616 }
8617
8618 }
8619 }
8620 else
8621 {
8622
8624 return false;
8625
8627 return false;
8628 }
8629
8630 PlayerBase player = null;
8631 if (CastTo(player, GetHierarchyRootPlayer()))
8632 {
8633 if (player.GetInventory().HasAttachment(this))
8634 return false;
8635
8636 if (player.IsItemsToDelete())
8637 return false;
8638 }
8639
8640 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8641 return false;
8642
8643 int slotID;
8645 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8646 return false;
8647
8648 return true;
8649 }
8650
8652 {
8654 }
8655
8657 {
8658 return m_IsResultOfSplit;
8659 }
8660
8662 {
8663 m_IsResultOfSplit = value;
8664 }
8665
8667 {
8669 }
8670
8672 {
8673 float other_item_quantity = other_item.GetQuantity();
8674 float this_free_space;
8675
8677
8679
8680 if (other_item_quantity > this_free_space)
8681 {
8682 return this_free_space;
8683 }
8684 else
8685 {
8686 return other_item_quantity;
8687 }
8688 }
8689
8691 {
8693 }
8694
8696 {
8698 return;
8699
8700 if (!IsMagazine() && other_item)
8701 {
8703 if (quantity_used != 0)
8704 {
8705 float hp1 = GetHealth01("","");
8706 float hp2 = other_item.GetHealth01("","");
8707 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8708 hpResult = hpResult / (
GetQuantity() + quantity_used);
8709
8710 hpResult *= GetMaxHealth();
8711 Math.Round(hpResult);
8712 SetHealth("", "Health", hpResult);
8713
8715 other_item.AddQuantity(-quantity_used);
8716 }
8717 }
8719 }
8720
8722 {
8723 #ifdef SERVER
8724 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8725 GetHierarchyParent().IncreaseLifetimeUp();
8726 #endif
8727 };
8728
8730 {
8731 PlayerBase p = PlayerBase.Cast(player);
8732
8733 array<int> recipesIds = p.m_Recipes;
8734 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8735 if (moduleRecipesManager)
8736 {
8737 EntityAI itemInHands = player.GetEntityInHands();
8738 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8739 }
8740
8741 for (int i = 0;i < recipesIds.Count(); i++)
8742 {
8743 int key = recipesIds.Get(i);
8744 string recipeName = moduleRecipesManager.GetRecipeName(key);
8746 }
8747 }
8748
8749
8750 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8751 {
8752 super.GetDebugActions(outputList);
8753
8754
8760
8761
8766
8771
8772
8776
8777
8779 {
8783 }
8784
8787
8788
8792
8794
8795 InventoryLocation loc = new InventoryLocation();
8796 GetInventory().GetCurrentInventoryLocation(loc);
8798 {
8799 if (Gizmo_IsSupported())
8802 }
8803
8805 }
8806
8807
8808
8809
8811 {
8812 super.OnAction(action_id, player, ctx);
8813
8815 {
8816 switch (action_id)
8817 {
8821 return true;
8825 return true;
8826 }
8827 }
8828
8830 {
8831 switch (action_id)
8832 {
8834 Delete();
8835 return true;
8836 }
8837 }
8838
8839 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8840 {
8841 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8842 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8843 PlayerBase p = PlayerBase.Cast(player);
8844 if (
EActions.RECIPES_RANGE_START < 1000)
8845 {
8846 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8847 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8848 }
8849 }
8850 #ifndef SERVER
8851 else if (action_id ==
EActions.WATCH_PLAYER)
8852 {
8853 PluginDeveloper.SetDeveloperItemClientEx(player);
8854 }
8855 #endif
8857 {
8858 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8859 {
8860 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8861 OnDebugButtonPressServer(id + 1);
8862 }
8863
8864 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8865 {
8866 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8868 }
8869
8870 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8871 {
8872 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8874 }
8875
8876 else if (action_id ==
EActions.ADD_QUANTITY)
8877 {
8878 if (IsMagazine())
8879 {
8880 Magazine mag = Magazine.Cast(this);
8881 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8882 }
8883 else
8884 {
8886 }
8887
8888 if (m_EM)
8889 {
8890 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8891 }
8892
8893 }
8894
8895 else if (action_id ==
EActions.REMOVE_QUANTITY)
8896 {
8897 if (IsMagazine())
8898 {
8899 Magazine mag2 = Magazine.Cast(this);
8900 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8901 }
8902 else
8903 {
8905 }
8906 if (m_EM)
8907 {
8908 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8909 }
8910
8911 }
8912
8913 else if (action_id ==
EActions.SET_QUANTITY_0)
8914 {
8916
8917 if (m_EM)
8918 {
8919 m_EM.SetEnergy(0);
8920 }
8921 }
8922
8923 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8924 {
8926
8927 if (m_EM)
8928 {
8929 m_EM.SetEnergy(m_EM.GetEnergyMax());
8930 }
8931 }
8932
8933 else if (action_id ==
EActions.ADD_HEALTH)
8934 {
8935 AddHealth("","",GetMaxHealth("","Health")/5);
8936 }
8937 else if (action_id ==
EActions.REMOVE_HEALTH)
8938 {
8939 AddHealth("","",-GetMaxHealth("","Health")/5);
8940 }
8941 else if (action_id ==
EActions.DESTROY_HEALTH)
8942 {
8943 SetHealth01("","",0);
8944 }
8945 else if (action_id ==
EActions.WATCH_ITEM)
8946 {
8948 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8949 #ifdef DEVELOPER
8950 SetDebugDeveloper_item(this);
8951 #endif
8952 }
8953
8954 else if (action_id ==
EActions.ADD_TEMPERATURE)
8955 {
8956 AddTemperature(20);
8957
8958 }
8959
8960 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8961 {
8962 AddTemperature(-20);
8963
8964 }
8965
8966 else if (action_id ==
EActions.FLIP_FROZEN)
8967 {
8968 SetFrozen(!GetIsFrozen());
8969
8970 }
8971
8972 else if (action_id ==
EActions.ADD_WETNESS)
8973 {
8975
8976 }
8977
8978 else if (action_id ==
EActions.REMOVE_WETNESS)
8979 {
8981
8982 }
8983
8984 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8985 {
8988
8989
8990 }
8991
8992 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8993 {
8996 }
8997
8998 else if (action_id ==
EActions.MAKE_SPECIAL)
8999 {
9000 auto debugParams = DebugSpawnParams.WithPlayer(player);
9001 OnDebugSpawnEx(debugParams);
9002 }
9003
9004 }
9005
9006
9007 return false;
9008 }
9009
9010
9011
9012
9016
9019
9020
9021
9023 {
9024 return false;
9025 }
9026
9027
9029 {
9030 return true;
9031 }
9032
9033
9035 {
9036 return true;
9037 }
9038
9039
9040
9042 {
9043 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9044 return g_Game.ConfigIsExisting(config_path);
9045 }
9046
9049 {
9050 return null;
9051 }
9052
9054 {
9055 return false;
9056 }
9057
9059 {
9060 return false;
9061 }
9062
9066
9067
9069 {
9070 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9071 return module_repairing.CanRepair(this, item_repair_kit);
9072 }
9073
9074
9075 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9076 {
9077 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9078 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9079 }
9080
9081
9083 {
9084
9085
9086
9087
9088
9089
9090
9091
9092 return 1;
9093 }
9094
9095
9096
9098 {
9100 }
9101
9102
9103
9105 {
9107 }
9108
9109
9118 {
9119 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9120
9121 if (player)
9122 {
9123 player.MessageStatus(text);
9124 }
9125 }
9126
9127
9136 {
9137 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9138
9139 if (player)
9140 {
9141 player.MessageAction(text);
9142 }
9143 }
9144
9145
9154 {
9155 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9156
9157 if (player)
9158 {
9159 player.MessageFriendly(text);
9160 }
9161 }
9162
9163
9172 {
9173 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9174
9175 if (player)
9176 {
9177 player.MessageImportant(text);
9178 }
9179 }
9180
9182 {
9183 return true;
9184 }
9185
9186
9187 override bool KindOf(
string tag)
9188 {
9189 bool found = false;
9190 string item_name = this.
GetType();
9192 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9193
9194 int array_size = item_tag_array.Count();
9195 for (int i = 0; i < array_size; i++)
9196 {
9197 if (item_tag_array.Get(i) == tag)
9198 {
9199 found = true;
9200 break;
9201 }
9202 }
9203 return found;
9204 }
9205
9206
9208 {
9209
9210 super.OnRPC(sender, rpc_type,ctx);
9211
9212
9213 switch (rpc_type)
9214 {
9215 #ifndef SERVER
9216 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9217 Param2<bool, string> p = new Param2<bool, string>(false, "");
9218
9220 return;
9221
9222 bool play = p.param1;
9223 string soundSet = p.param2;
9224
9225 if (play)
9226 {
9228 {
9230 {
9232 }
9233 }
9234 else
9235 {
9237 }
9238 }
9239 else
9240 {
9242 }
9243
9244 break;
9245 #endif
9246
9247 }
9248
9250 {
9252 }
9253 }
9254
9255
9256
9257
9259 {
9260 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9261 return plugin.GetID(
name);
9262 }
9263
9265 {
9266 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9267 return plugin.GetName(id);
9268 }
9269
9272 {
9273
9274
9275 int varFlags;
9276 if (!ctx.
Read(varFlags))
9277 return;
9278
9279 if (varFlags & ItemVariableFlags.FLOAT)
9280 {
9282 }
9283 }
9284
9286 {
9287
9288 super.SerializeNumericalVars(floats_out);
9289
9290
9291
9293 {
9295 }
9296
9298 {
9300 }
9301
9303 {
9305 }
9306
9308 {
9313 }
9314
9316 {
9318 }
9319 }
9320
9322 {
9323
9324 super.DeSerializeNumericalVars(floats);
9325
9326
9327 int index = 0;
9328 int mask = Math.Round(floats.Get(index));
9329
9330 index++;
9331
9333 {
9335 {
9337 }
9338 else
9339 {
9340 float quantity = floats.Get(index);
9342 }
9343 index++;
9344 }
9345
9347 {
9348 float wet = floats.Get(index);
9350 index++;
9351 }
9352
9354 {
9355 int liquidtype = Math.Round(floats.Get(index));
9357 index++;
9358 }
9359
9361 {
9363 index++;
9365 index++;
9367 index++;
9369 index++;
9370 }
9371
9373 {
9374 int cleanness = Math.Round(floats.Get(index));
9376 index++;
9377 }
9378 }
9379
9381 {
9382 super.WriteVarsToCTX(ctx);
9383
9384
9386 {
9388 }
9389
9391 {
9393 }
9394
9396 {
9398 }
9399
9401 {
9402 int r,g,b,a;
9408 }
9409
9411 {
9413 }
9414 }
9415
9417 {
9418 if (!super.ReadVarsFromCTX(ctx,version))
9419 return false;
9420
9421 int intValue;
9422 float value;
9423
9424 if (version < 140)
9425 {
9426 if (!ctx.
Read(intValue))
9427 return false;
9428
9429 m_VariablesMask = intValue;
9430 }
9431
9433 {
9434 if (!ctx.
Read(value))
9435 return false;
9436
9438 {
9440 }
9441 else
9442 {
9444 }
9445 }
9446
9447 if (version < 140)
9448 {
9450 {
9451 if (!ctx.
Read(value))
9452 return false;
9453 SetTemperatureDirect(value);
9454 }
9455 }
9456
9458 {
9459 if (!ctx.
Read(value))
9460 return false;
9462 }
9463
9465 {
9466 if (!ctx.
Read(intValue))
9467 return false;
9469 }
9470
9472 {
9473 int r,g,b,a;
9475 return false;
9477 return false;
9479 return false;
9481 return false;
9482
9484 }
9485
9487 {
9488 if (!ctx.
Read(intValue))
9489 return false;
9491 }
9492
9493 if (version >= 138 && version < 140)
9494 {
9496 {
9497 if (!ctx.
Read(intValue))
9498 return false;
9499 SetFrozen(intValue);
9500 }
9501 }
9502
9503 return true;
9504 }
9505
9506
9508 {
9511 {
9513 }
9514
9515 if (!super.OnStoreLoad(ctx, version))
9516 {
9518 return false;
9519 }
9520
9521 if (version >= 114)
9522 {
9523 bool hasQuickBarIndexSaved;
9524
9525 if (!ctx.
Read(hasQuickBarIndexSaved))
9526 {
9528 return false;
9529 }
9530
9531 if (hasQuickBarIndexSaved)
9532 {
9533 int itmQBIndex;
9534
9535
9536 if (!ctx.
Read(itmQBIndex))
9537 {
9539 return false;
9540 }
9541
9542 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9543 if (itmQBIndex != -1 && parentPlayer)
9544 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9545 }
9546 }
9547 else
9548 {
9549
9550 PlayerBase player;
9551 int itemQBIndex;
9552 if (version ==
int.
MAX)
9553 {
9554 if (!ctx.
Read(itemQBIndex))
9555 {
9557 return false;
9558 }
9559 }
9560 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9561 {
9562
9563 if (!ctx.
Read(itemQBIndex))
9564 {
9566 return false;
9567 }
9568 if (itemQBIndex != -1 && player)
9569 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9570 }
9571 }
9572
9573 if (version < 140)
9574 {
9575
9576 if (!LoadVariables(ctx, version))
9577 {
9579 return false;
9580 }
9581 }
9582
9583
9585 {
9587 return false;
9588 }
9589 if (version >= 132)
9590 {
9592 if (raib)
9593 {
9595 {
9597 return false;
9598 }
9599 }
9600 }
9601
9603 return true;
9604 }
9605
9606
9607
9609 {
9610 super.OnStoreSave(ctx);
9611
9612 PlayerBase player;
9613 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9614 {
9616
9617 int itemQBIndex = -1;
9618 itemQBIndex = player.FindQuickBarEntityIndex(this);
9619 ctx.
Write(itemQBIndex);
9620 }
9621 else
9622 {
9624 }
9625
9627
9629 if (raib)
9630 {
9632 }
9633 }
9634
9635
9637 {
9638 super.AfterStoreLoad();
9639
9641 {
9643 }
9644
9646 {
9649 }
9650 }
9651
9653 {
9654 super.EEOnAfterLoad();
9655
9657 {
9659 }
9660
9663 }
9664
9666 {
9667 return false;
9668 }
9669
9670
9671
9673 {
9675 {
9676 #ifdef PLATFORM_CONSOLE
9677
9679 {
9681 if (menu)
9682 {
9684 }
9685 }
9686 #endif
9687 }
9688
9690 {
9693 }
9694
9696 {
9697 SetWeightDirty();
9699 }
9701 {
9704 }
9705
9707 {
9710
9713 }
9715 {
9719 }
9720
9721 super.OnVariablesSynchronized();
9722 }
9723
9724
9725
9727 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9728 {
9729 if (!IsServerCheck(allow_client))
9730 return false;
9731
9733 return false;
9734
9737
9738 if (value <= (min + 0.001))
9739 value = min;
9740
9741 if (value == min)
9742 {
9743 if (destroy_config)
9744 {
9745 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9746 if (dstr)
9747 {
9749 this.Delete();
9750 return true;
9751 }
9752 }
9753 else if (destroy_forced)
9754 {
9756 this.Delete();
9757 return true;
9758 }
9759
9761 }
9762
9765
9767 {
9768 EntityAI parent = GetHierarchyRoot();
9769 InventoryLocation iLoc = new InventoryLocation();
9770 GetInventory().GetCurrentInventoryLocation(iLoc);
9772 {
9773 int iLocSlot = iLoc.
GetSlot();
9775 {
9777 }
9779 {
9781 }
9782 }
9783 }
9784
9786 {
9788
9789 if (delta)
9791 }
9792
9794
9795 return false;
9796 }
9797
9798
9800 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9801 {
9803 }
9804
9806 {
9809 }
9810
9812 {
9815 }
9816
9818 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9819 {
9820 float value_clamped = Math.Clamp(value, 0, 1);
9822 SetQuantity(result, destroy_config, destroy_forced);
9823 }
9824
9825
9828 {
9830 }
9831
9833 {
9835 }
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9847 {
9848 int slot = -1;
9849 GameInventory inventory = GetInventory();
9850 if (inventory)
9851 {
9852 InventoryLocation il = new InventoryLocation;
9855 }
9856
9858 }
9859
9861 {
9862 float quantity_max = 0;
9863
9865 {
9866 if (attSlotID != -1)
9867 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9868
9869 if (quantity_max <= 0)
9871 }
9872
9873 if (quantity_max <= 0)
9875
9876 return quantity_max;
9877 }
9878
9880 {
9882 }
9883
9885 {
9887 }
9888
9889
9891 {
9893 }
9894
9896 {
9898 }
9899
9901 {
9903 }
9904
9905
9907 {
9908
9909 float weightEx = GetWeightEx();
9910 float special = GetInventoryAndCargoWeight();
9911 return weightEx - special;
9912 }
9913
9914
9916 {
9918 }
9919
9921 {
9923 {
9924 #ifdef DEVELOPER
9925 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9926 {
9927 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9929 }
9930 #endif
9931
9933 }
9934 else if (HasEnergyManager())
9935 {
9936 #ifdef DEVELOPER
9937 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9938 {
9939 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9940 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9941 }
9942 #endif
9943 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9944 }
9945 else
9946 {
9947 #ifdef DEVELOPER
9948 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9949 {
9950 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9951 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9952 }
9953 #endif
9954 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9955 }
9956 }
9957
9960 {
9961 int item_count = 0;
9963
9964 GameInventory inventory = GetInventory();
9965 CargoBase cargo = inventory.
GetCargo();
9966 if (cargo != NULL)
9967 {
9969 }
9970
9972 for (int i = 0; i < nAttachments; ++i)
9973 {
9975 if (item)
9976 item_count += item.GetNumberOfItems();
9977 }
9978 return item_count;
9979 }
9980
9983 {
9984 float weight = 0;
9985 float wetness = 1;
9986 if (include_wetness)
9989 {
9990 weight = wetness * m_ConfigWeight;
9991 }
9993 {
9994 weight = 1;
9995 }
9996 return weight;
9997 }
9998
9999
10000
10002 {
10003 GameInventory inventory = GetInventory();
10004 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10005 {
10006 array<EntityAI> items = new array<EntityAI>;
10008 for (int i = 0; i < items.Count(); ++i)
10009 {
10011 if (item)
10012 {
10013 g_Game.ObjectDelete(item);
10014 }
10015 }
10016 }
10017 }
10018
10019
10020
10021
10023 {
10024 float energy = 0;
10025 if (HasEnergyManager())
10026 {
10027 energy = GetCompEM().GetEnergy();
10028 }
10029 return energy;
10030 }
10031
10032
10034 {
10035 super.OnEnergyConsumed();
10036
10038 }
10039
10041 {
10042 super.OnEnergyAdded();
10043
10045 }
10046
10047
10049 {
10050 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10051 {
10053 {
10054 float energy_0to1 = GetCompEM().GetEnergy0To1();
10056 }
10057 }
10058 }
10059
10060
10062 {
10063 return ConfigGetFloat("heatIsolation");
10064 }
10065
10067 {
10069 }
10070
10072 {
10073 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10074 if (
g_Game.ConfigIsExisting(paramPath))
10075 return g_Game.ConfigGetFloat(paramPath);
10076
10077 return 0.0;
10078 }
10079
10081 {
10082 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10083 if (
g_Game.ConfigIsExisting(paramPath))
10084 return g_Game.ConfigGetFloat(paramPath);
10085
10086 return 0.0;
10087 }
10088
10089 override void SetWet(
float value,
bool allow_client =
false)
10090 {
10091 if (!IsServerCheck(allow_client))
10092 return;
10093
10096
10098
10099 m_VarWet = Math.Clamp(value, min, max);
10100
10102 {
10105 }
10106 }
10107
10108 override void AddWet(
float value)
10109 {
10111 }
10112
10114 {
10116 }
10117
10119 {
10121 }
10122
10124 {
10126 }
10127
10129 {
10131 }
10132
10134 {
10136 }
10137
10138 override void OnWetChanged(
float newVal,
float oldVal)
10139 {
10142 if (newLevel != oldLevel)
10143 {
10145 }
10146 }
10147
10149 {
10150 SetWeightDirty();
10151 }
10152
10154 {
10155 return GetWetLevelInternal(
m_VarWet);
10156 }
10157
10158
10159
10161 {
10163 }
10164
10166 {
10168 }
10169
10171 {
10173 }
10174
10176 {
10178 }
10179
10180
10181
10183 {
10184 if (ConfigIsExisting("itemModelLength"))
10185 {
10186 return ConfigGetFloat("itemModelLength");
10187 }
10188 return 0;
10189 }
10190
10192 {
10193 if (ConfigIsExisting("itemAttachOffset"))
10194 {
10195 return ConfigGetFloat("itemAttachOffset");
10196 }
10197 return 0;
10198 }
10199
10200 override void SetCleanness(
int value,
bool allow_client =
false)
10201 {
10202 if (!IsServerCheck(allow_client))
10203 return;
10204
10206
10208
10211 }
10212
10214 {
10216 }
10217
10219 {
10220 return true;
10221 }
10222
10223
10224
10225
10227 {
10229 }
10230
10232 {
10234 }
10235
10236
10237
10238
10239 override void SetColor(
int r,
int g,
int b,
int a)
10240 {
10246 }
10248 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10249 {
10254 }
10255
10257 {
10259 }
10260
10263 {
10264 int r,g,b,a;
10266 r = r/255;
10267 g = g/255;
10268 b = b/255;
10269 a = a/255;
10270 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10271 }
10272
10273
10274
10275 override void SetLiquidType(
int value,
bool allow_client =
false)
10276 {
10277 if (!IsServerCheck(allow_client))
10278 return;
10279
10284 }
10285
10287 {
10288 return ConfigGetInt("varLiquidTypeInit");
10289 }
10290
10292 {
10294 }
10295
10297 {
10299 SetFrozen(false);
10300 }
10301
10304 {
10305 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10306 }
10307
10308
10311 {
10312 PlayerBase nplayer;
10313 if (PlayerBase.CastTo(nplayer, player))
10314 {
10316 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10317 }
10318 }
10319
10320
10323 {
10324 PlayerBase nplayer;
10325 if (PlayerBase.CastTo(nplayer,player))
10326 {
10327 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10328 }
10329
10330 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10331
10332 if (HasEnergyManager())
10333 {
10334 GetCompEM().UpdatePlugState();
10335 }
10336 }
10337
10338
10340 {
10341 super.OnPlacementStarted(player);
10342
10344 }
10345
10346 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10347 {
10349 {
10350 m_AdminLog.OnPlacementComplete(player,
this);
10351 }
10352
10353 super.OnPlacementComplete(player, position, orientation);
10354 }
10355
10356
10357
10358
10359
10361 {
10363 {
10364 return true;
10365 }
10366 else
10367 {
10368 return false;
10369 }
10370 }
10371
10372
10374 {
10376 {
10378 }
10379 }
10380
10381
10383 {
10385 }
10386
10388 {
10390 }
10391
10392 override void InsertAgent(
int agent,
float count = 1)
10393 {
10394 if (count < 1)
10395 return;
10396
10398 }
10399
10402 {
10404 }
10405
10406
10408 {
10410 }
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10454 {
10456 return false;
10457 return true;
10458 }
10459
10461 {
10462
10464 }
10465
10466
10469 {
10470 super.CheckForRoofLimited(timeTresholdMS);
10471
10472 float time =
g_Game.GetTime();
10473 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10474 {
10475 m_PreviousRoofTestTime = time;
10476 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10477 }
10478 }
10479
10480
10482 {
10484 {
10485 return 0;
10486 }
10487
10488 if (GetInventory().GetAttachmentSlotsCount() != 0)
10489 {
10490 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10491 if (filter)
10492 return filter.GetProtectionLevel(type, false, system);
10493 else
10494 return 0;
10495 }
10496
10497 string subclassPath, entryName;
10498
10499 switch (type)
10500 {
10502 entryName = "biological";
10503 break;
10505 entryName = "chemical";
10506 break;
10507 default:
10508 entryName = "biological";
10509 break;
10510 }
10511
10512 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10513
10514 return g_Game.ConfigGetFloat(subclassPath + entryName);
10515 }
10516
10517
10518
10521 {
10522 if (!IsMagazine())
10524
10526 }
10527
10528
10529
10530
10531
10536 {
10537 return true;
10538 }
10539
10541 {
10543 }
10544
10545
10546
10547
10548
10550 {
10551 if (parent)
10552 {
10553 if (parent.IsInherited(DayZInfected))
10554 return true;
10555
10556 if (!parent.IsRuined())
10557 return true;
10558 }
10559
10560 return true;
10561 }
10562
10564 {
10565 if (!super.CanPutAsAttachment(parent))
10566 {
10567 return false;
10568 }
10569
10570 if (!IsRuined() && !parent.IsRuined())
10571 {
10572 return true;
10573 }
10574
10575 return false;
10576 }
10577
10579 {
10580
10581
10582
10583
10584 return super.CanReceiveItemIntoCargo(item);
10585 }
10586
10588 {
10589
10590
10591
10592
10593 GameInventory attachmentInv = attachment.GetInventory();
10595 {
10596 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10597 return false;
10598 }
10599
10600 InventoryLocation loc = new InventoryLocation();
10601 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10602 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10603 return false;
10604
10605 return super.CanReceiveAttachment(attachment, slotId);
10606 }
10607
10609 {
10610 if (!super.CanReleaseAttachment(attachment))
10611 return false;
10612
10613 return GetInventory().AreChildrenAccessible();
10614 }
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10637 {
10638 int id = muzzle_owner.GetMuzzleID();
10639 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10640
10641 if (WPOF_array)
10642 {
10643 for (int i = 0; i < WPOF_array.Count(); i++)
10644 {
10645 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10646
10647 if (WPOF)
10648 {
10649 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10650 }
10651 }
10652 }
10653 }
10654
10655
10657 {
10658 int id = muzzle_owner.GetMuzzleID();
10660
10661 if (WPOBE_array)
10662 {
10663 for (int i = 0; i < WPOBE_array.Count(); i++)
10664 {
10665 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10666
10667 if (WPOBE)
10668 {
10669 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10670 }
10671 }
10672 }
10673 }
10674
10675
10677 {
10678 int id = muzzle_owner.GetMuzzleID();
10679 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10680
10681 if (WPOOH_array)
10682 {
10683 for (int i = 0; i < WPOOH_array.Count(); i++)
10684 {
10685 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10686
10687 if (WPOOH)
10688 {
10689 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10690 }
10691 }
10692 }
10693 }
10694
10695
10697 {
10698 int id = muzzle_owner.GetMuzzleID();
10699 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10700
10701 if (WPOOH_array)
10702 {
10703 for (int i = 0; i < WPOOH_array.Count(); i++)
10704 {
10705 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10706
10707 if (WPOOH)
10708 {
10709 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10710 }
10711 }
10712 }
10713 }
10714
10715
10717 {
10718 int id = muzzle_owner.GetMuzzleID();
10719 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10720
10721 if (WPOOH_array)
10722 {
10723 for (int i = 0; i < WPOOH_array.Count(); i++)
10724 {
10725 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10726
10727 if (WPOOH)
10728 {
10729 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10730 }
10731 }
10732 }
10733 }
10734
10735
10736
10738 {
10740 {
10741 return true;
10742 }
10743
10744 return false;
10745 }
10746
10748 {
10750 {
10751 return true;
10752 }
10753
10754 return false;
10755 }
10756
10758 {
10760 {
10761 return true;
10762 }
10763
10764 return false;
10765 }
10766
10768 {
10769 return false;
10770 }
10771
10774 {
10775 return UATimeSpent.DEFAULT_DEPLOY;
10776 }
10777
10778
10779
10780
10782 {
10784 SetSynchDirty();
10785 }
10786
10788 {
10790 }
10791
10792
10794 {
10795 return false;
10796 }
10797
10800 {
10801 string att_type = "None";
10802
10803 if (ConfigIsExisting("soundAttType"))
10804 {
10805 att_type = ConfigGetString("soundAttType");
10806 }
10807
10809 }
10810
10812 {
10814 }
10815
10816
10817
10818
10819
10825
10827 {
10830
10832 }
10833
10834
10836 {
10838 return;
10839
10841
10844
10847
10848 SoundParameters params = new SoundParameters();
10852 }
10853
10854
10856 {
10858 {
10861
10862 SetSynchDirty();
10863
10866 }
10867 }
10868
10870 {
10872 }
10873
10874
10876 {
10878 return;
10879
10881 SetSynchDirty();
10882
10885 }
10886
10888 {
10891 }
10892
10894 {
10896 }
10897
10898 void OnApply(PlayerBase player);
10899
10901 {
10902 return 1.0;
10903 };
10904
10906 {
10908 }
10909
10911 {
10913 }
10914
10916
10918 {
10919 SetDynamicPhysicsLifeTime(0.01);
10921 }
10922
10924 {
10925 array<string> zone_names = new array<string>;
10926 GetDamageZones(zone_names);
10927 for (int i = 0; i < zone_names.Count(); i++)
10928 {
10929 SetHealthMax(zone_names.Get(i),"Health");
10930 }
10931 SetHealthMax("","Health");
10932 }
10933
10936 {
10937 float global_health = GetHealth01("","Health");
10938 array<string> zones = new array<string>;
10939 GetDamageZones(zones);
10940
10941 for (int i = 0; i < zones.Count(); i++)
10942 {
10943 SetHealth01(zones.Get(i),"Health",global_health);
10944 }
10945 }
10946
10949 {
10950 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10951 }
10952
10954 {
10955 if (!hasRootAsPlayer)
10956 {
10957 if (refParentIB)
10958 {
10959
10960 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10961 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10962
10963 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10964 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10965
10968 }
10969 else
10970 {
10971
10974 }
10975 }
10976 }
10977
10979 {
10981 {
10982 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10983 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10984 {
10985 float heatPermCoef = 1.0;
10987 while (ent)
10988 {
10989 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10990 ent = ent.GetHierarchyParent();
10991 }
10992
10993 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10994 }
10995 }
10996 }
10997
10999 {
11000
11001 EntityAI parent = GetHierarchyParent();
11002 if (!parent)
11003 {
11004 hasParent = false;
11005 hasRootAsPlayer = false;
11006 }
11007 else
11008 {
11009 hasParent = true;
11010 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11011 refParentIB =
ItemBase.Cast(parent);
11012 }
11013 }
11014
11015 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11016 {
11017
11018 }
11019
11021 {
11022
11023 return false;
11024 }
11025
11027 {
11028
11029
11030 return false;
11031 }
11032
11034 {
11035
11036 return false;
11037 }
11038
11041 {
11042 return !GetIsFrozen() &&
IsOpen();
11043 }
11044
11046 {
11047 bool hasParent = false, hasRootAsPlayer = false;
11049
11050 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11051 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11052
11053 if (wwtu || foodDecay)
11054 {
11058
11059 if (processWetness || processTemperature || processDecay)
11060 {
11062
11063 if (processWetness)
11064 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11065
11066 if (processTemperature)
11068
11069 if (processDecay)
11070 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11071 }
11072 }
11073 }
11074
11077 {
11079 }
11080
11082 {
11085
11086 return super.GetTemperatureFreezeThreshold();
11087 }
11088
11090 {
11093
11094 return super.GetTemperatureThawThreshold();
11095 }
11096
11098 {
11101
11102 return super.GetItemOverheatThreshold();
11103 }
11104
11106 {
11108 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11109
11110 return super.GetTemperatureFreezeTime();
11111 }
11112
11114 {
11116 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11117
11118 return super.GetTemperatureThawTime();
11119 }
11120
11125
11127 {
11128 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11129 }
11130
11132 {
11133 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11134 }
11135
11138 {
11140 }
11141
11143 {
11145 }
11146
11148 {
11150 }
11151
11154 {
11155 return null;
11156 }
11157
11160 {
11161 return false;
11162 }
11163
11165 {
11167 {
11170 if (!trg)
11171 {
11173 explosive = this;
11174 }
11175
11176 explosive.PairRemote(trg);
11178
11179 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11180 trg.SetPersistentPairID(persistentID);
11181 explosive.SetPersistentPairID(persistentID);
11182
11183 return true;
11184 }
11185 return false;
11186 }
11187
11190 {
11191 float ret = 1.0;
11194 ret *= GetHealth01();
11195
11196 return ret;
11197 }
11198
11199 #ifdef DEVELOPER
11200 override void SetDebugItem()
11201 {
11202 super.SetDebugItem();
11203 _itemBase = this;
11204 }
11205
11207 {
11208 string text = super.GetDebugText();
11209
11211 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11212
11213 return text;
11214 }
11215 #endif
11216
11218 {
11219 return true;
11220 }
11221
11223
11225
11227 {
11230 }
11231
11232
11240
11256
11257 [
Obsolete(
"Use ItemSoundHandler instead")]
11260 {
11261 if (!
g_Game.IsDedicatedServer())
11262 {
11263 if (ConfigIsExisting("attachSoundSet"))
11264 {
11265 string cfg_path = "";
11266 string soundset = "";
11267 string type_name =
GetType();
11268
11271 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11272 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11273
11274 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11275 {
11276 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11277 {
11278 if (cfg_slot_array[i] == slot_type)
11279 {
11280 soundset = cfg_soundset_array[i];
11281 break;
11282 }
11283 }
11284 }
11285
11286 if (soundset != "")
11287 {
11288 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11290 }
11291 }
11292 }
11293 }
11294
11296}
11297
11299{
11301 if (entity)
11302 {
11303 bool is_item = entity.IsInherited(
ItemBase);
11304 if (is_item && full_quantity)
11305 {
11308 }
11309 }
11310 else
11311 {
11313 return NULL;
11314 }
11315 return entity;
11316}
11317
11319{
11320 if (item)
11321 {
11322 if (health > 0)
11323 item.SetHealth("", "", health);
11324
11325 if (item.CanHaveTemperature())
11326 {
11328 if (item.CanFreeze())
11329 item.SetFrozen(false);
11330 }
11331
11332 if (item.HasEnergyManager())
11333 {
11334 if (quantity >= 0)
11335 {
11336 item.GetCompEM().SetEnergy0To1(quantity);
11337 }
11338 else
11339 {
11341 }
11342 }
11343 else if (item.IsMagazine())
11344 {
11345 Magazine mag = Magazine.Cast(item);
11346 if (quantity >= 0)
11347 {
11348 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11349 }
11350 else
11351 {
11353 }
11354
11355 }
11356 else
11357 {
11358 if (quantity >= 0)
11359 {
11360 item.SetQuantityNormalized(quantity, false);
11361 }
11362 else
11363 {
11365 }
11366
11367 }
11368 }
11369}
11370
11371#ifdef DEVELOPER
11373#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.