6317{
6319 {
6320 return true;
6321 }
6322};
6323
6325{
6326
6327};
6328
6329
6330
6332{
6336
6338
6341
6342
6343
6344
6345
6354
6360
6365
6370
6391 protected bool m_IsResultOfSplit
6392
6394
6399
6400
6401
6403
6407
6408
6409
6411
6414
6415
6416
6422
6423
6431
6434
6435
6437
6438
6440
6441
6446
6447
6452
6454
6455
6457
6458
6460 {
6465
6466 if (!
g_Game.IsDedicatedServer())
6467 {
6469 {
6471
6473 {
6475 }
6476 }
6477
6480 }
6481
6482 m_OldLocation = null;
6483
6485 {
6487 }
6488
6489 if (ConfigIsExisting("headSelectionsToHide"))
6490 {
6493 }
6494
6496 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6497 {
6499 }
6500
6502
6503 m_IsResultOfSplit = false;
6504
6506 }
6507
6509 {
6510 super.InitItemVariables();
6511
6517 m_Count = ConfigGetInt(
"count");
6518
6521
6526
6529
6534
6546
6550
6551
6554 if (ConfigIsExisting("canBeSplit"))
6555 {
6558 }
6559
6561 if (ConfigIsExisting("itemBehaviour"))
6563
6564
6567 RegisterNetSyncVariableInt("m_VarLiquidType");
6568 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6569
6570 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6571 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6572 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6573
6574 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6575 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6576 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6577 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6578
6579 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6580 RegisterNetSyncVariableBool("m_IsTakeable");
6581 RegisterNetSyncVariableBool("m_IsHologram");
6582
6585 {
6588 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6589 }
6590
6592
6594 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6596
6598 }
6599
6601 {
6603 }
6604
6606 {
6609 {
6614 }
6615 }
6616
6617 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6618 {
6620 {
6623 }
6624
6626 }
6627
6629 {
6635 }
6636
6638
6640 {
6642
6643 if (!action)
6644 {
6645 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6646 return;
6647 }
6648
6650 if (!ai)
6651 {
6653 return;
6654 }
6655
6657 if (!action_array)
6658 {
6659 action_array = new array<ActionBase_Basic>;
6661 }
6662 if (LogManager.IsActionLogEnable())
6663 {
6664 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6665 }
6666
6667 if (action_array.Find(action) != -1)
6668 {
6669 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6670 }
6671 else
6672 {
6673 action_array.Insert(action);
6674 }
6675 }
6676
6678 {
6679 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6680 ActionBase action = player.GetActionManager().GetAction(actionName);
6683
6684 if (action_array)
6685 {
6686 action_array.RemoveItem(action);
6687 }
6688 }
6689
6690
6691
6693 {
6694 ActionOverrideData overrideData = new ActionOverrideData();
6698
6700 if (!actionMap)
6701 {
6704 }
6705
6706 actionMap.Insert(this.
Type(), overrideData);
6707
6708 }
6709
6711
6713
6714
6716 {
6719
6722
6723 string config_to_search = "CfgVehicles";
6724 string muzzle_owner_config;
6725
6727 {
6728 if (IsInherited(Weapon))
6729 config_to_search = "CfgWeapons";
6730
6731 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6732
6733 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6734
6735 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6736
6737 if (config_OnFire_subclass_count > 0)
6738 {
6739 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6740
6741 for (int i = 0; i < config_OnFire_subclass_count; i++)
6742 {
6743 string particle_class = "";
6744 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6745 string config_OnFire_entry = config_OnFire_class + particle_class;
6746 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6747 WPOF_array.Insert(WPOF);
6748 }
6749
6750
6752 }
6753 }
6754
6756 {
6757 config_to_search = "CfgWeapons";
6758 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6759
6760 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6761
6762 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6763
6764 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6765 {
6766 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6767
6768 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6769 {
6770 string particle_class2 = "";
6771 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6772 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6773 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6774 WPOBE_array.Insert(WPOBE);
6775 }
6776
6777
6779 }
6780 }
6781 }
6782
6783
6785 {
6788
6790 {
6791 string config_to_search = "CfgVehicles";
6792
6793 if (IsInherited(Weapon))
6794 config_to_search = "CfgWeapons";
6795
6796 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6797 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6798
6799 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6800 {
6801
6803
6805 {
6807 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6809 return;
6810 }
6811
6814
6815
6816
6817 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6818 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6819
6820 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6821 {
6822 string particle_class = "";
6823 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6824 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6825 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6826
6827 if (entry_type == CT_CLASS)
6828 {
6829 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6830 WPOOH_array.Insert(WPOF);
6831 }
6832 }
6833
6834
6836 }
6837 }
6838 }
6839
6841 {
6843 }
6844
6846 {
6848 {
6850
6853
6856
6857 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6858 }
6859 }
6860
6862 {
6864 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6865
6867 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6868
6870 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6871
6873 {
6875 }
6876 }
6877
6879 {
6881 }
6882
6884 {
6887 else
6889
6891 {
6894 }
6895 else
6896 {
6899
6902 }
6903
6905 }
6906
6908 {
6910 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6911 }
6912
6914 {
6916 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6918 }
6919
6921 {
6923 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6924 }
6925
6927 {
6930
6931 OverheatingParticle OP = new OverheatingParticle();
6936
6938 }
6939
6941 {
6944
6945 return -1;
6946 }
6947
6949 {
6951 {
6954
6955 for (int i = count; i > 0; --i)
6956 {
6957 int id = i - 1;
6960
6963
6964 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6965 {
6966 if (p)
6967 {
6970 }
6971 }
6972 }
6973 }
6974 }
6975
6977 {
6979 {
6981 {
6982 int id = i - 1;
6984
6985 if (OP)
6986 {
6988
6989 if (p)
6990 {
6992 }
6993
6994 delete OP;
6995 }
6996 }
6997
7000 }
7001 }
7002
7005 {
7006 return 0.0;
7007 }
7008
7009
7011 {
7012 return 250;
7013 }
7014
7016 {
7017 return 0;
7018 }
7019
7022 {
7024 return true;
7025
7026 return false;
7027 }
7028
7031 {
7034
7036 {
7038 }
7039 else
7040 {
7041
7043 }
7044
7046 }
7047
7054 {
7055 return -1;
7056 }
7057
7058
7059
7060
7062 {
7064 {
7065 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7066 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7067
7068 if (r_index >= 0)
7069 {
7070 InventoryLocation r_il = new InventoryLocation;
7071 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7072
7073 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7076 {
7077 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7078 }
7080 {
7081 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7082 }
7083
7084 }
7085
7086 player.GetHumanInventory().ClearUserReservedLocation(this);
7087 }
7088
7091 }
7092
7093
7094
7095
7097 {
7098 return ItemBase.m_DebugActionsMask;
7099 }
7100
7102 {
7103 return ItemBase.m_DebugActionsMask & mask;
7104 }
7105
7107 {
7108 ItemBase.m_DebugActionsMask = mask;
7109 }
7110
7112 {
7113 ItemBase.m_DebugActionsMask |= mask;
7114 }
7115
7117 {
7118 ItemBase.m_DebugActionsMask &= ~mask;
7119 }
7120
7122 {
7124 {
7126 }
7127 else
7128 {
7130 }
7131 }
7132
7133
7135 {
7136 if (GetEconomyProfile())
7137 {
7138 float q_max = GetEconomyProfile().GetQuantityMax();
7139 if (q_max > 0)
7140 {
7141 float q_min = GetEconomyProfile().GetQuantityMin();
7142 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7143
7145 {
7146 ComponentEnergyManager comp = GetCompEM();
7148 {
7150 }
7151 }
7153 {
7155
7156 }
7157
7158 }
7159 }
7160 }
7161
7164 {
7165 EntityAI parent = GetHierarchyParent();
7166
7167 if (parent)
7168 {
7169 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7170 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7171 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7172 }
7173 }
7174
7177 {
7178 EntityAI parent = GetHierarchyParent();
7179
7180 if (parent)
7181 {
7182 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7183 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7184 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7185 }
7186 }
7187
7189 {
7190
7191
7192
7193
7195
7197 {
7198 if (ScriptInputUserData.CanStoreInputUserData())
7199 {
7200 ScriptInputUserData ctx = new ScriptInputUserData;
7206 ctx.
Write(use_stack_max);
7209
7211 {
7212 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7213 }
7214 }
7215 }
7216 else if (!
g_Game.IsMultiplayer())
7217 {
7219 }
7220 }
7221
7223 {
7225 }
7226
7228 {
7230 }
7231
7233 {
7235 }
7236
7238 {
7239
7240 return false;
7241 }
7242
7244 {
7245 return false;
7246 }
7247
7251 {
7252 return false;
7253 }
7254
7256 {
7257 return "";
7258 }
7259
7261
7263 {
7264 return false;
7265 }
7266
7268 {
7269 return true;
7270 }
7271
7272
7273
7275 {
7276 return true;
7277 }
7278
7280 {
7281 return true;
7282 }
7283
7285 {
7286 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7288 }
7289
7291 {
7293 }
7294
7296 {
7298 if (!is_being_placed)
7300 SetSynchDirty();
7301 }
7302
7303
7305
7307 {
7309 }
7310
7312 {
7314 }
7315
7317 {
7318 return 1;
7319 }
7320
7322 {
7323 return false;
7324 }
7325
7327 {
7329 SetSynchDirty();
7330 }
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7367 {
7368 super.OnMovedInsideCargo(container);
7369
7370 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7371 }
7372
7373 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7374 {
7375 super.EEItemLocationChanged(oldLoc, newLoc);
7376
7377 PlayerBase newPlayer = null;
7378 PlayerBase oldPlayer = null;
7379
7380 if (newLoc.GetParent())
7381 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7382
7383 if (oldLoc.GetParent())
7384 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7385
7387 {
7388 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7389
7390 if (rIndex >= 0)
7391 {
7392 InventoryLocation rIl = new InventoryLocation;
7393 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7394
7395 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7398 {
7399 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7400 }
7402 {
7404 }
7405
7406 }
7407 }
7408
7410 {
7411 if (newPlayer)
7412 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7413
7414 if (newPlayer == oldPlayer)
7415 {
7416 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7417 {
7419 {
7420 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7421 {
7422 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7423 }
7424 }
7425 else
7426 {
7427 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7428 }
7429 }
7430
7431 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7432 {
7433 int type = oldLoc.GetType();
7435 {
7436 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7437 }
7439 {
7440 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7441 }
7442 }
7443 if (!m_OldLocation)
7444 {
7445 m_OldLocation = new InventoryLocation;
7446 }
7447 m_OldLocation.Copy(oldLoc);
7448 }
7449 else
7450 {
7451 if (m_OldLocation)
7452 {
7453 m_OldLocation.Reset();
7454 }
7455 }
7456
7457 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7458 }
7459 else
7460 {
7461 if (newPlayer)
7462 {
7463 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7464 if (resIndex >= 0)
7465 {
7466 InventoryLocation il = new InventoryLocation;
7467 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7469 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7472 {
7473 il.
GetParent().GetOnReleaseLock().Invoke(it);
7474 }
7476 {
7478 }
7479
7480 }
7481 }
7483 {
7484
7486 }
7487
7488 if (m_OldLocation)
7489 {
7490 m_OldLocation.Reset();
7491 }
7492 }
7493
7495 {
7496 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7497 }
7498
7500 {
7501 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7502 }
7503 }
7504
7505 override void EOnContact(IEntity other, Contact extra)
7506 {
7508 {
7509 int liquidType = -1;
7511 if (impactSpeed > 0.0)
7512 {
7514 #ifndef SERVER
7516 #else
7518 SetSynchDirty();
7519 #endif
7521 }
7522 }
7523
7524 #ifdef SERVER
7525 if (GetCompEM() && GetCompEM().IsPlugged())
7526 {
7527 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7528 GetCompEM().UnplugThis();
7529 }
7530 #endif
7531 }
7532
7534
7536 {
7538 }
7539
7541 {
7542
7543 }
7544
7546 {
7547 super.OnItemLocationChanged(old_owner, new_owner);
7548
7549 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7550 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7551
7552 if (!relatedPlayer && playerNew)
7553 relatedPlayer = playerNew;
7554
7555 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7556 {
7558 if (actionMgr)
7559 {
7560 ActionBase currentAction = actionMgr.GetRunningAction();
7561 if (currentAction)
7563 }
7564 }
7565
7566 Man ownerPlayerOld = null;
7567 Man ownerPlayerNew = null;
7568
7569 if (old_owner)
7570 {
7571 if (old_owner.
IsMan())
7572 {
7573 ownerPlayerOld = Man.Cast(old_owner);
7574 }
7575 else
7576 {
7577 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7578 }
7579 }
7580 else
7581 {
7583 {
7585
7586 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7587 {
7588 GetCompEM().UnplugThis();
7589 }
7590 }
7591 }
7592
7593 if (new_owner)
7594 {
7595 if (new_owner.
IsMan())
7596 {
7597 ownerPlayerNew = Man.Cast(new_owner);
7598 }
7599 else
7600 {
7601 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7602 }
7603 }
7604
7605 if (ownerPlayerOld != ownerPlayerNew)
7606 {
7607 if (ownerPlayerOld)
7608 {
7609 array<EntityAI> subItemsExit = new array<EntityAI>;
7611 for (int i = 0; i < subItemsExit.Count(); i++)
7612 {
7615 }
7616 }
7617
7618 if (ownerPlayerNew)
7619 {
7620 array<EntityAI> subItemsEnter = new array<EntityAI>;
7622 for (int j = 0; j < subItemsEnter.Count(); j++)
7623 {
7626 }
7627 }
7628 }
7629 else if (ownerPlayerNew != null)
7630 {
7631 PlayerBase nplayer;
7632 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7633 {
7634 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7636 for (int k = 0; k < subItemsUpdate.Count(); k++)
7637 {
7639 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7640 }
7641 }
7642 }
7643
7644 if (old_owner)
7645 old_owner.OnChildItemRemoved(this);
7646 if (new_owner)
7647 new_owner.OnChildItemReceived(this);
7648 }
7649
7650
7652 {
7653 super.EEDelete(parent);
7654 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7655 if (player)
7656 {
7658
7659 if (player.IsAlive())
7660 {
7661 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7662 if (r_index >= 0)
7663 {
7664 InventoryLocation r_il = new InventoryLocation;
7665 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7666
7667 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7670 {
7671 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7672 }
7674 {
7675 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7676 }
7677
7678 }
7679
7680 player.RemoveQuickBarEntityShortcut(this);
7681 }
7682 }
7683 }
7684
7686 {
7687 super.EEKilled(killer);
7688
7691 {
7692 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7693 {
7694 if (IsMagazine())
7695 {
7696 if (Magazine.Cast(this).GetAmmoCount() > 0)
7697 {
7699 }
7700 }
7701 else
7702 {
7704 }
7705 }
7706 }
7707 }
7708
7710 {
7711 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7712
7713 super.OnWasAttached(parent, slot_id);
7714
7717
7720 }
7721
7723 {
7724 super.OnWasDetached(parent, slot_id);
7725
7728
7731 }
7732
7734 {
7735 int idx;
7738
7739 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7740 if (inventory_slots.Count() < 1)
7741 {
7742 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7743 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7744 }
7745 else
7746 {
7747 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7748 }
7749
7750 idx = inventory_slots.Find(slot);
7751 if (idx < 0)
7752 return "";
7753
7754 return attach_types.Get(idx);
7755 }
7756
7758 {
7759 int idx = -1;
7760 string slot;
7761
7764
7765 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7766 if (inventory_slots.Count() < 1)
7767 {
7768 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7769 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7770 }
7771 else
7772 {
7773 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7774 if (detach_types.Count() < 1)
7775 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7776 }
7777
7778 for (int i = 0; i < inventory_slots.Count(); i++)
7779 {
7780 slot = inventory_slots.Get(i);
7781 }
7782
7783 if (slot != "")
7784 {
7785 if (detach_types.Count() == 1)
7786 idx = 0;
7787 else
7788 idx = inventory_slots.Find(slot);
7789 }
7790 if (idx < 0)
7791 return "";
7792
7793 return detach_types.Get(idx);
7794 }
7795
7797 {
7798
7800
7801
7802 float min_time = 1;
7803 float max_time = 3;
7804 float delay = Math.RandomFloat(min_time, max_time);
7805
7806 explode_timer.Run(delay, this, "DoAmmoExplosion");
7807 }
7808
7810 {
7811 Magazine magazine = Magazine.Cast(this);
7812 int pop_sounds_count = 6;
7813 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7814
7815
7816 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7817 string sound_name = pop_sounds[ sound_idx ];
7818 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7819
7820
7821 magazine.ServerAddAmmoCount(-1);
7822
7823
7824 float min_temp_to_explode = 100;
7825
7826 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7827 {
7829 }
7830 }
7831
7832
7833 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7834 {
7835 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7836
7837 const int CHANCE_DAMAGE_CARGO = 4;
7838 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7839 const int CHANCE_DAMAGE_NOTHING = 2;
7840
7842 {
7843 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7844 int chances;
7845 int rnd;
7846
7847 if (GetInventory().GetCargo())
7848 {
7849 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7850 rnd = Math.RandomInt(0,chances);
7851
7852 if (rnd < CHANCE_DAMAGE_CARGO)
7853 {
7855 }
7856 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7857 {
7859 }
7860 }
7861 else
7862 {
7863 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7864 rnd = Math.RandomInt(0,chances);
7865
7866 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7867 {
7869 }
7870 }
7871 }
7872 }
7873
7875 {
7876 CargoBase cargo = GetInventory().GetCargo();
7877 if (cargo)
7878 {
7880 if (item_count > 0)
7881 {
7882 int random_pick = Math.RandomInt(0, item_count);
7884 if (!item.IsExplosive())
7885 {
7886 item.AddHealth("","",damage);
7887 return true;
7888 }
7889 }
7890 }
7891 return false;
7892 }
7893
7895 {
7896 GameInventory inventory = GetInventory();
7898 if (attachment_count > 0)
7899 {
7900 int random_pick = Math.RandomInt(0, attachment_count);
7902 if (!attachment.IsExplosive())
7903 {
7904 attachment.AddHealth("","",damage);
7905 return true;
7906 }
7907 }
7908 return false;
7909 }
7910
7912 {
7914 }
7915
7917 {
7919 return GetInventory().CanRemoveEntity();
7920
7921 return false;
7922 }
7923
7925 {
7926
7928 return false;
7929
7930
7932 return false;
7933
7934
7935
7937 if (delta == 0)
7938 return false;
7939
7940
7941 return true;
7942 }
7943
7945 {
7947 {
7948 if (ScriptInputUserData.CanStoreInputUserData())
7949 {
7950 ScriptInputUserData ctx = new ScriptInputUserData;
7955 ctx.
Write(destination_entity);
7959 }
7960 }
7961 else if (!
g_Game.IsMultiplayer())
7962 {
7964 }
7965 }
7966
7968 {
7969 float split_quantity_new;
7973 InventoryLocation loc = new InventoryLocation;
7974
7975 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7976 {
7978 split_quantity_new = stack_max;
7979 else
7981
7983 {
7984 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7985 if (new_item)
7986 {
7987 new_item.SetResultOfSplit(true);
7988 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7990 new_item.
SetQuantity(split_quantity_new,
false,
true);
7991 }
7992 }
7993 }
7994 else if (destination_entity && slot_id == -1)
7995 {
7996 if (quantity > stack_max)
7997 split_quantity_new = stack_max;
7998 else
7999 split_quantity_new = quantity;
8000
8002 {
8003 GameInventory destinationInventory = destination_entity.GetInventory();
8005 {
8008 }
8009
8010 if (new_item)
8011 {
8012 new_item.SetResultOfSplit(true);
8013 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8015 new_item.
SetQuantity(split_quantity_new,
false,
true);
8016 }
8017 }
8018 }
8019 else
8020 {
8021 if (stack_max != 0)
8022 {
8024 {
8026 }
8027
8028 if (split_quantity_new == 0)
8029 {
8030 if (!
g_Game.IsMultiplayer())
8031 player.PhysicalPredictiveDropItem(this);
8032 else
8033 player.ServerDropEntity(this);
8034 return;
8035 }
8036
8038 {
8040
8041 if (new_item)
8042 {
8043 new_item.SetResultOfSplit(true);
8044 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8047 new_item.PlaceOnSurface();
8048 }
8049 }
8050 }
8051 }
8052 }
8053
8055 {
8056 float split_quantity_new;
8060 InventoryLocation loc = new InventoryLocation;
8061
8062 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8063 {
8065 split_quantity_new = stack_max;
8066 else
8068
8070 {
8071 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8072 if (new_item)
8073 {
8074 new_item.SetResultOfSplit(true);
8075 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8077 new_item.
SetQuantity(split_quantity_new,
false,
true);
8078 }
8079 }
8080 }
8081 else if (destination_entity && slot_id == -1)
8082 {
8083 if (quantity > stack_max)
8084 split_quantity_new = stack_max;
8085 else
8086 split_quantity_new = quantity;
8087
8089 {
8090 GameInventory destinationInventory = destination_entity.GetInventory();
8092 {
8095 }
8096
8097 if (new_item)
8098 {
8099 new_item.SetResultOfSplit(true);
8100 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8102 new_item.
SetQuantity(split_quantity_new,
false,
true);
8103 }
8104 }
8105 }
8106 else
8107 {
8108 if (stack_max != 0)
8109 {
8111 {
8113 }
8114
8116 {
8118
8119 if (new_item)
8120 {
8121 new_item.SetResultOfSplit(true);
8122 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8125 new_item.PlaceOnSurface();
8126 }
8127 }
8128 }
8129 }
8130 }
8131
8133 {
8135 {
8136 if (ScriptInputUserData.CanStoreInputUserData())
8137 {
8138 ScriptInputUserData ctx = new ScriptInputUserData;
8143 dst.WriteToContext(ctx);
8145 }
8146 }
8147 else if (!
g_Game.IsMultiplayer())
8148 {
8150 }
8151 }
8152
8154 {
8156 {
8157 if (ScriptInputUserData.CanStoreInputUserData())
8158 {
8159 ScriptInputUserData ctx = new ScriptInputUserData;
8164 ctx.
Write(destination_entity);
8170 }
8171 }
8172 else if (!
g_Game.IsMultiplayer())
8173 {
8175 }
8176 }
8177
8179 {
8181 }
8182
8184 {
8186 float split_quantity_new;
8188 if (dst.IsValid())
8189 {
8190 int slot_id = dst.GetSlot();
8192
8193 if (quantity > stack_max)
8194 split_quantity_new = stack_max;
8195 else
8196 split_quantity_new = quantity;
8197
8199 {
8201
8202 if (new_item)
8203 {
8204 new_item.SetResultOfSplit(true);
8205 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8207 new_item.
SetQuantity(split_quantity_new,
false,
true);
8208 }
8209
8210 return new_item;
8211 }
8212 }
8213
8214 return null;
8215 }
8216
8218 {
8220 float split_quantity_new;
8222 if (destination_entity)
8223 {
8225 if (quantity > stackable)
8226 split_quantity_new = stackable;
8227 else
8228 split_quantity_new = quantity;
8229
8231 {
8232 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8233 if (new_item)
8234 {
8235 new_item.SetResultOfSplit(true);
8236 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8238 new_item.
SetQuantity(split_quantity_new,
false,
true);
8239 }
8240 }
8241 }
8242 }
8243
8245 {
8247 {
8248 if (ScriptInputUserData.CanStoreInputUserData())
8249 {
8250 ScriptInputUserData ctx = new ScriptInputUserData;
8255 ItemBase destination_entity =
this;
8256 ctx.
Write(destination_entity);
8260 }
8261 }
8262 else if (!
g_Game.IsMultiplayer())
8263 {
8265 }
8266 }
8267
8269 {
8271 float split_quantity_new;
8273 if (player)
8274 {
8276 if (quantity > stackable)
8277 split_quantity_new = stackable;
8278 else
8279 split_quantity_new = quantity;
8280
8282 {
8283 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8284 new_item =
ItemBase.Cast(in_hands);
8285 if (new_item)
8286 {
8287 new_item.SetResultOfSplit(true);
8288 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8290 new_item.SetQuantity(split_quantity_new, false, true);
8291 }
8292 }
8293 }
8294 }
8295
8297 {
8299 float split_quantity_new = Math.Floor(quantity * 0.5);
8300
8302 return;
8303
8305
8306 if (new_item)
8307 {
8308 if (new_item.GetQuantityMax() < split_quantity_new)
8309 {
8310 split_quantity_new = new_item.GetQuantityMax();
8311 }
8312
8313 new_item.SetResultOfSplit(true);
8314 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8315
8317 {
8320 }
8321 else
8322 {
8324 new_item.
SetQuantity(split_quantity_new,
false,
true);
8325 }
8326 }
8327 }
8328
8330 {
8332 float split_quantity_new = Math.Floor(quantity / 2);
8333
8335 return;
8336
8337 InventoryLocation invloc = new InventoryLocation;
8339
8341 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8342
8343 if (new_item)
8344 {
8345 if (new_item.GetQuantityMax() < split_quantity_new)
8346 {
8347 split_quantity_new = new_item.GetQuantityMax();
8348 }
8350 {
8353 }
8354 else if (split_quantity_new > 1)
8355 {
8357 new_item.
SetQuantity(split_quantity_new,
false,
true);
8358 }
8359 }
8360 }
8361
8364 {
8365 SetWeightDirty();
8367
8368 if (parent)
8369 parent.OnAttachmentQuantityChangedEx(this, delta);
8370
8372 {
8374 {
8376 }
8378 {
8379 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8381 }
8382 }
8383 }
8384
8387 {
8388
8389 }
8390
8393 {
8395 }
8396
8398 {
8399 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8400
8402 {
8403 if (newLevel == GameConstants.STATE_RUINED)
8404 {
8406 EntityAI parent = GetHierarchyParent();
8407 if (parent && parent.IsFireplace())
8408 {
8409 CargoBase cargo = GetInventory().GetCargo();
8410 if (cargo)
8411 {
8413 {
8415 }
8416 }
8417 }
8418 }
8419
8421 {
8422
8424 return;
8425 }
8426
8427 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8428 {
8430 }
8431 }
8432 }
8433
8434
8436 {
8437 super.OnRightClick();
8438
8440 {
8442 {
8443 if (ScriptInputUserData.CanStoreInputUserData())
8444 {
8445 EntityAI root = GetHierarchyRoot();
8446 Man playerOwner = GetHierarchyRootPlayer();
8447 InventoryLocation dst = new InventoryLocation;
8448
8449
8450 if (!playerOwner && root && root == this)
8451 {
8453 }
8454 else
8455 {
8456
8457 GetInventory().GetCurrentInventoryLocation(dst);
8459 {
8460 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8462 {
8464 }
8465 else
8466 {
8468
8469
8470 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8471 {
8473 }
8474 else
8475 {
8476 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8477 }
8478 }
8479 }
8480 }
8481
8482 ScriptInputUserData ctx = new ScriptInputUserData;
8490 }
8491 }
8492 else if (!
g_Game.IsMultiplayer())
8493 {
8495 }
8496 }
8497 }
8498
8500 {
8501 if (root)
8502 {
8503 vector m4[4];
8504 root.GetTransform(m4);
8505 dst.SetGround(this, m4);
8506 }
8507 else
8508 {
8509 GetInventory().GetCurrentInventoryLocation(dst);
8510 }
8511 }
8512
8513 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8514 {
8515
8516 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8517 return false;
8518
8519 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8520 return false;
8521
8522
8524 return false;
8525
8526
8527 Magazine mag = Magazine.Cast(this);
8528 if (mag)
8529 {
8530 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8531 return false;
8532
8533 if (stack_max_limit)
8534 {
8535 Magazine other_mag = Magazine.Cast(other_item);
8536 if (other_item)
8537 {
8538 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8539 return false;
8540 }
8541
8542 }
8543 }
8544 else
8545 {
8546
8548 return false;
8549
8551 return false;
8552 }
8553
8554 PlayerBase player = null;
8555 if (CastTo(player, GetHierarchyRootPlayer()))
8556 {
8557 if (player.GetInventory().HasAttachment(this))
8558 return false;
8559
8560 if (player.IsItemsToDelete())
8561 return false;
8562 }
8563
8564 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8565 return false;
8566
8567 int slotID;
8569 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8570 return false;
8571
8572 return true;
8573 }
8574
8576 {
8578 }
8579
8581 {
8582 return m_IsResultOfSplit;
8583 }
8584
8586 {
8587 m_IsResultOfSplit = value;
8588 }
8589
8591 {
8593 }
8594
8596 {
8597 float other_item_quantity = other_item.GetQuantity();
8598 float this_free_space;
8599
8601
8603
8604 if (other_item_quantity > this_free_space)
8605 {
8606 return this_free_space;
8607 }
8608 else
8609 {
8610 return other_item_quantity;
8611 }
8612 }
8613
8615 {
8617 }
8618
8620 {
8622 return;
8623
8624 if (!IsMagazine() && other_item)
8625 {
8627 if (quantity_used != 0)
8628 {
8629 float hp1 = GetHealth01("","");
8630 float hp2 = other_item.GetHealth01("","");
8631 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8632 hpResult = hpResult / (
GetQuantity() + quantity_used);
8633
8634 hpResult *= GetMaxHealth();
8635 Math.Round(hpResult);
8636 SetHealth("", "Health", hpResult);
8637
8639 other_item.AddQuantity(-quantity_used);
8640 }
8641 }
8643 }
8644
8646 {
8647 #ifdef SERVER
8648 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8649 GetHierarchyParent().IncreaseLifetimeUp();
8650 #endif
8651 };
8652
8654 {
8655 PlayerBase p = PlayerBase.Cast(player);
8656
8657 array<int> recipesIds = p.m_Recipes;
8658 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8659 if (moduleRecipesManager)
8660 {
8661 EntityAI itemInHands = player.GetEntityInHands();
8662 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8663 }
8664
8665 for (int i = 0;i < recipesIds.Count(); i++)
8666 {
8667 int key = recipesIds.Get(i);
8668 string recipeName = moduleRecipesManager.GetRecipeName(key);
8670 }
8671 }
8672
8673
8674 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8675 {
8676 super.GetDebugActions(outputList);
8677
8678
8684
8685
8690
8695
8696
8700
8701
8703 {
8707 }
8708
8711
8712
8716
8718
8719 InventoryLocation loc = new InventoryLocation();
8720 GetInventory().GetCurrentInventoryLocation(loc);
8722 {
8723 if (Gizmo_IsSupported())
8726 }
8727
8729 }
8730
8731
8732
8733
8735 {
8736 super.OnAction(action_id, player, ctx);
8737
8739 {
8740 switch (action_id)
8741 {
8745 return true;
8749 return true;
8750 }
8751 }
8752
8754 {
8755 switch (action_id)
8756 {
8758 Delete();
8759 return true;
8760 }
8761 }
8762
8763 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8764 {
8765 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8766 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8767 PlayerBase p = PlayerBase.Cast(player);
8768 if (
EActions.RECIPES_RANGE_START < 1000)
8769 {
8770 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8771 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8772 }
8773 }
8774 #ifndef SERVER
8775 else if (action_id ==
EActions.WATCH_PLAYER)
8776 {
8777 PluginDeveloper.SetDeveloperItemClientEx(player);
8778 }
8779 #endif
8781 {
8782 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8783 {
8784 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8785 OnDebugButtonPressServer(id + 1);
8786 }
8787
8788 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8789 {
8790 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8792 }
8793
8794 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8795 {
8796 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8798 }
8799
8800 else if (action_id ==
EActions.ADD_QUANTITY)
8801 {
8802 if (IsMagazine())
8803 {
8804 Magazine mag = Magazine.Cast(this);
8805 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8806 }
8807 else
8808 {
8810 }
8811
8812 if (m_EM)
8813 {
8814 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8815 }
8816
8817 }
8818
8819 else if (action_id ==
EActions.REMOVE_QUANTITY)
8820 {
8821 if (IsMagazine())
8822 {
8823 Magazine mag2 = Magazine.Cast(this);
8824 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8825 }
8826 else
8827 {
8829 }
8830 if (m_EM)
8831 {
8832 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8833 }
8834
8835 }
8836
8837 else if (action_id ==
EActions.SET_QUANTITY_0)
8838 {
8840
8841 if (m_EM)
8842 {
8843 m_EM.SetEnergy(0);
8844 }
8845 }
8846
8847 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8848 {
8850
8851 if (m_EM)
8852 {
8853 m_EM.SetEnergy(m_EM.GetEnergyMax());
8854 }
8855 }
8856
8857 else if (action_id ==
EActions.ADD_HEALTH)
8858 {
8859 AddHealth("","",GetMaxHealth("","Health")/5);
8860 }
8861 else if (action_id ==
EActions.REMOVE_HEALTH)
8862 {
8863 AddHealth("","",-GetMaxHealth("","Health")/5);
8864 }
8865 else if (action_id ==
EActions.DESTROY_HEALTH)
8866 {
8867 SetHealth01("","",0);
8868 }
8869 else if (action_id ==
EActions.WATCH_ITEM)
8870 {
8872 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8873 #ifdef DEVELOPER
8874 SetDebugDeveloper_item(this);
8875 #endif
8876 }
8877
8878 else if (action_id ==
EActions.ADD_TEMPERATURE)
8879 {
8880 AddTemperature(20);
8881
8882 }
8883
8884 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8885 {
8886 AddTemperature(-20);
8887
8888 }
8889
8890 else if (action_id ==
EActions.FLIP_FROZEN)
8891 {
8892 SetFrozen(!GetIsFrozen());
8893
8894 }
8895
8896 else if (action_id ==
EActions.ADD_WETNESS)
8897 {
8899
8900 }
8901
8902 else if (action_id ==
EActions.REMOVE_WETNESS)
8903 {
8905
8906 }
8907
8908 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8909 {
8912
8913
8914 }
8915
8916 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8917 {
8920 }
8921
8922 else if (action_id ==
EActions.MAKE_SPECIAL)
8923 {
8924 auto debugParams = DebugSpawnParams.WithPlayer(player);
8925 OnDebugSpawnEx(debugParams);
8926 }
8927
8928 }
8929
8930
8931 return false;
8932 }
8933
8934
8935
8936
8940
8943
8944
8945
8947 {
8948 return false;
8949 }
8950
8951
8953 {
8954 return true;
8955 }
8956
8957
8959 {
8960 return true;
8961 }
8962
8963
8964
8966 {
8967 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8968 return g_Game.ConfigIsExisting(config_path);
8969 }
8970
8973 {
8974 return null;
8975 }
8976
8978 {
8979 return false;
8980 }
8981
8983 {
8984 return false;
8985 }
8986
8990
8991
8993 {
8994 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8995 return module_repairing.CanRepair(this, item_repair_kit);
8996 }
8997
8998
8999 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9000 {
9001 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9002 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9003 }
9004
9005
9007 {
9008
9009
9010
9011
9012
9013
9014
9015
9016 return 1;
9017 }
9018
9019
9020
9022 {
9024 }
9025
9026
9027
9029 {
9031 }
9032
9033
9042 {
9043 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9044
9045 if (player)
9046 {
9047 player.MessageStatus(text);
9048 }
9049 }
9050
9051
9060 {
9061 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9062
9063 if (player)
9064 {
9065 player.MessageAction(text);
9066 }
9067 }
9068
9069
9078 {
9079 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9080
9081 if (player)
9082 {
9083 player.MessageFriendly(text);
9084 }
9085 }
9086
9087
9096 {
9097 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9098
9099 if (player)
9100 {
9101 player.MessageImportant(text);
9102 }
9103 }
9104
9106 {
9107 return true;
9108 }
9109
9110
9111 override bool KindOf(
string tag)
9112 {
9113 bool found = false;
9114 string item_name = this.
GetType();
9116 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9117
9118 int array_size = item_tag_array.Count();
9119 for (int i = 0; i < array_size; i++)
9120 {
9121 if (item_tag_array.Get(i) == tag)
9122 {
9123 found = true;
9124 break;
9125 }
9126 }
9127 return found;
9128 }
9129
9130
9132 {
9133
9134 super.OnRPC(sender, rpc_type,ctx);
9135
9136
9137 switch (rpc_type)
9138 {
9139 #ifndef SERVER
9140 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9141 Param2<bool, string> p = new Param2<bool, string>(false, "");
9142
9144 return;
9145
9146 bool play = p.param1;
9147 string soundSet = p.param2;
9148
9149 if (play)
9150 {
9152 {
9154 {
9156 }
9157 }
9158 else
9159 {
9161 }
9162 }
9163 else
9164 {
9166 }
9167
9168 break;
9169 #endif
9170
9171 }
9172
9174 {
9176 }
9177 }
9178
9179
9180
9181
9183 {
9184 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9185 return plugin.GetID(
name);
9186 }
9187
9189 {
9190 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9191 return plugin.GetName(id);
9192 }
9193
9196 {
9197
9198
9199 int varFlags;
9200 if (!ctx.
Read(varFlags))
9201 return;
9202
9203 if (varFlags & ItemVariableFlags.FLOAT)
9204 {
9206 }
9207 }
9208
9210 {
9211
9212 super.SerializeNumericalVars(floats_out);
9213
9214
9215
9217 {
9219 }
9220
9222 {
9224 }
9225
9227 {
9229 }
9230
9232 {
9237 }
9238
9240 {
9242 }
9243 }
9244
9246 {
9247
9248 super.DeSerializeNumericalVars(floats);
9249
9250
9251 int index = 0;
9252 int mask = Math.Round(floats.Get(index));
9253
9254 index++;
9255
9257 {
9259 {
9261 }
9262 else
9263 {
9264 float quantity = floats.Get(index);
9266 }
9267 index++;
9268 }
9269
9271 {
9272 float wet = floats.Get(index);
9274 index++;
9275 }
9276
9278 {
9279 int liquidtype = Math.Round(floats.Get(index));
9281 index++;
9282 }
9283
9285 {
9287 index++;
9289 index++;
9291 index++;
9293 index++;
9294 }
9295
9297 {
9298 int cleanness = Math.Round(floats.Get(index));
9300 index++;
9301 }
9302 }
9303
9305 {
9306 super.WriteVarsToCTX(ctx);
9307
9308
9310 {
9312 }
9313
9315 {
9317 }
9318
9320 {
9322 }
9323
9325 {
9326 int r,g,b,a;
9332 }
9333
9335 {
9337 }
9338 }
9339
9341 {
9342 if (!super.ReadVarsFromCTX(ctx,version))
9343 return false;
9344
9345 int intValue;
9346 float value;
9347
9348 if (version < 140)
9349 {
9350 if (!ctx.
Read(intValue))
9351 return false;
9352
9353 m_VariablesMask = intValue;
9354 }
9355
9357 {
9358 if (!ctx.
Read(value))
9359 return false;
9360
9362 {
9364 }
9365 else
9366 {
9368 }
9369 }
9370
9371 if (version < 140)
9372 {
9374 {
9375 if (!ctx.
Read(value))
9376 return false;
9377 SetTemperatureDirect(value);
9378 }
9379 }
9380
9382 {
9383 if (!ctx.
Read(value))
9384 return false;
9386 }
9387
9389 {
9390 if (!ctx.
Read(intValue))
9391 return false;
9393 }
9394
9396 {
9397 int r,g,b,a;
9399 return false;
9401 return false;
9403 return false;
9405 return false;
9406
9408 }
9409
9411 {
9412 if (!ctx.
Read(intValue))
9413 return false;
9415 }
9416
9417 if (version >= 138 && version < 140)
9418 {
9420 {
9421 if (!ctx.
Read(intValue))
9422 return false;
9423 SetFrozen(intValue);
9424 }
9425 }
9426
9427 return true;
9428 }
9429
9430
9432 {
9435 {
9437 }
9438
9439 if (!super.OnStoreLoad(ctx, version))
9440 {
9442 return false;
9443 }
9444
9445 if (version >= 114)
9446 {
9447 bool hasQuickBarIndexSaved;
9448
9449 if (!ctx.
Read(hasQuickBarIndexSaved))
9450 {
9452 return false;
9453 }
9454
9455 if (hasQuickBarIndexSaved)
9456 {
9457 int itmQBIndex;
9458
9459
9460 if (!ctx.
Read(itmQBIndex))
9461 {
9463 return false;
9464 }
9465
9466 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9467 if (itmQBIndex != -1 && parentPlayer)
9468 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9469 }
9470 }
9471 else
9472 {
9473
9474 PlayerBase player;
9475 int itemQBIndex;
9476 if (version ==
int.
MAX)
9477 {
9478 if (!ctx.
Read(itemQBIndex))
9479 {
9481 return false;
9482 }
9483 }
9484 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9485 {
9486
9487 if (!ctx.
Read(itemQBIndex))
9488 {
9490 return false;
9491 }
9492 if (itemQBIndex != -1 && player)
9493 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9494 }
9495 }
9496
9497 if (version < 140)
9498 {
9499
9500 if (!LoadVariables(ctx, version))
9501 {
9503 return false;
9504 }
9505 }
9506
9507
9509 {
9511 return false;
9512 }
9513 if (version >= 132)
9514 {
9516 if (raib)
9517 {
9519 {
9521 return false;
9522 }
9523 }
9524 }
9525
9527 return true;
9528 }
9529
9530
9531
9533 {
9534 super.OnStoreSave(ctx);
9535
9536 PlayerBase player;
9537 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9538 {
9540
9541 int itemQBIndex = -1;
9542 itemQBIndex = player.FindQuickBarEntityIndex(this);
9543 ctx.
Write(itemQBIndex);
9544 }
9545 else
9546 {
9548 }
9549
9551
9553 if (raib)
9554 {
9556 }
9557 }
9558
9559
9561 {
9562 super.AfterStoreLoad();
9563
9565 {
9567 }
9568
9570 {
9573 }
9574 }
9575
9577 {
9578 super.EEOnAfterLoad();
9579
9581 {
9583 }
9584
9587 }
9588
9590 {
9591 return false;
9592 }
9593
9594
9595
9597 {
9599 {
9600 #ifdef PLATFORM_CONSOLE
9601
9603 {
9605 if (menu)
9606 {
9608 }
9609 }
9610 #endif
9611 }
9612
9614 {
9617 }
9618
9620 {
9621 SetWeightDirty();
9623 }
9625 {
9628 }
9629
9631 {
9634
9637 }
9639 {
9643 }
9644
9645 super.OnVariablesSynchronized();
9646 }
9647
9648
9649
9651 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9652 {
9653 if (!IsServerCheck(allow_client))
9654 return false;
9655
9657 return false;
9658
9661
9662 if (value <= (min + 0.001))
9663 value = min;
9664
9665 if (value == min)
9666 {
9667 if (destroy_config)
9668 {
9669 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9670 if (dstr)
9671 {
9673 this.Delete();
9674 return true;
9675 }
9676 }
9677 else if (destroy_forced)
9678 {
9680 this.Delete();
9681 return true;
9682 }
9683
9685 }
9686
9689
9691 {
9692 EntityAI parent = GetHierarchyRoot();
9693 InventoryLocation iLoc = new InventoryLocation();
9694 GetInventory().GetCurrentInventoryLocation(iLoc);
9696 {
9697 int iLocSlot = iLoc.
GetSlot();
9699 {
9701 }
9703 {
9705 }
9706 }
9707 }
9708
9710 {
9712
9713 if (delta)
9715 }
9716
9718
9719 return false;
9720 }
9721
9722
9724 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9725 {
9727 }
9728
9730 {
9733 }
9734
9736 {
9739 }
9740
9742 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9743 {
9744 float value_clamped = Math.Clamp(value, 0, 1);
9746 SetQuantity(result, destroy_config, destroy_forced);
9747 }
9748
9749
9752 {
9754 }
9755
9757 {
9759 }
9760
9761
9762
9763
9764
9765
9766
9767
9768
9769
9771 {
9772 int slot = -1;
9773 GameInventory inventory = GetInventory();
9774 if (inventory)
9775 {
9776 InventoryLocation il = new InventoryLocation;
9779 }
9780
9782 }
9783
9785 {
9786 float quantity_max = 0;
9787
9789 {
9790 if (attSlotID != -1)
9791 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9792
9793 if (quantity_max <= 0)
9795 }
9796
9797 if (quantity_max <= 0)
9799
9800 return quantity_max;
9801 }
9802
9804 {
9806 }
9807
9809 {
9811 }
9812
9813
9815 {
9817 }
9818
9820 {
9822 }
9823
9825 {
9827 }
9828
9829
9831 {
9832
9833 float weightEx = GetWeightEx();
9834 float special = GetInventoryAndCargoWeight();
9835 return weightEx - special;
9836 }
9837
9838
9840 {
9842 }
9843
9845 {
9847 {
9848 #ifdef DEVELOPER
9849 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9850 {
9851 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9853 }
9854 #endif
9855
9857 }
9858 else if (HasEnergyManager())
9859 {
9860 #ifdef DEVELOPER
9861 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9862 {
9863 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9864 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9865 }
9866 #endif
9867 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9868 }
9869 else
9870 {
9871 #ifdef DEVELOPER
9872 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9873 {
9874 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9875 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9876 }
9877 #endif
9878 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9879 }
9880 }
9881
9884 {
9885 int item_count = 0;
9887
9888 GameInventory inventory = GetInventory();
9889 CargoBase cargo = inventory.
GetCargo();
9890 if (cargo != NULL)
9891 {
9893 }
9894
9896 for (int i = 0; i < nAttachments; ++i)
9897 {
9899 if (item)
9900 item_count += item.GetNumberOfItems();
9901 }
9902 return item_count;
9903 }
9904
9907 {
9908 float weight = 0;
9909 float wetness = 1;
9910 if (include_wetness)
9913 {
9914 weight = wetness * m_ConfigWeight;
9915 }
9917 {
9918 weight = 1;
9919 }
9920 return weight;
9921 }
9922
9923
9924
9926 {
9927 GameInventory inventory = GetInventory();
9928 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9929 {
9930 array<EntityAI> items = new array<EntityAI>;
9932 for (int i = 0; i < items.Count(); ++i)
9933 {
9935 if (item)
9936 {
9937 g_Game.ObjectDelete(item);
9938 }
9939 }
9940 }
9941 }
9942
9943
9944
9945
9947 {
9948 float energy = 0;
9949 if (HasEnergyManager())
9950 {
9951 energy = GetCompEM().GetEnergy();
9952 }
9953 return energy;
9954 }
9955
9956
9958 {
9959 super.OnEnergyConsumed();
9960
9962 }
9963
9965 {
9966 super.OnEnergyAdded();
9967
9969 }
9970
9971
9973 {
9974 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9975 {
9977 {
9978 float energy_0to1 = GetCompEM().GetEnergy0To1();
9980 }
9981 }
9982 }
9983
9984
9986 {
9987 return ConfigGetFloat("heatIsolation");
9988 }
9989
9991 {
9993 }
9994
9996 {
9997 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9998 if (
g_Game.ConfigIsExisting(paramPath))
9999 return g_Game.ConfigGetFloat(paramPath);
10000
10001 return 0.0;
10002 }
10003
10005 {
10006 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10007 if (
g_Game.ConfigIsExisting(paramPath))
10008 return g_Game.ConfigGetFloat(paramPath);
10009
10010 return 0.0;
10011 }
10012
10013 override void SetWet(
float value,
bool allow_client =
false)
10014 {
10015 if (!IsServerCheck(allow_client))
10016 return;
10017
10020
10022
10023 m_VarWet = Math.Clamp(value, min, max);
10024
10026 {
10029 }
10030 }
10031
10032 override void AddWet(
float value)
10033 {
10035 }
10036
10038 {
10040 }
10041
10043 {
10045 }
10046
10048 {
10050 }
10051
10053 {
10055 }
10056
10058 {
10060 }
10061
10062 override void OnWetChanged(
float newVal,
float oldVal)
10063 {
10066 if (newLevel != oldLevel)
10067 {
10069 }
10070 }
10071
10073 {
10074 SetWeightDirty();
10075 }
10076
10078 {
10079 return GetWetLevelInternal(
m_VarWet);
10080 }
10081
10082
10083
10085 {
10087 }
10088
10090 {
10092 }
10093
10095 {
10097 }
10098
10100 {
10102 }
10103
10104
10105
10107 {
10108 if (ConfigIsExisting("itemModelLength"))
10109 {
10110 return ConfigGetFloat("itemModelLength");
10111 }
10112 return 0;
10113 }
10114
10116 {
10117 if (ConfigIsExisting("itemAttachOffset"))
10118 {
10119 return ConfigGetFloat("itemAttachOffset");
10120 }
10121 return 0;
10122 }
10123
10124 override void SetCleanness(
int value,
bool allow_client =
false)
10125 {
10126 if (!IsServerCheck(allow_client))
10127 return;
10128
10130
10132
10135 }
10136
10138 {
10140 }
10141
10143 {
10144 return true;
10145 }
10146
10147
10148
10149
10151 {
10153 }
10154
10156 {
10158 }
10159
10160
10161
10162
10163 override void SetColor(
int r,
int g,
int b,
int a)
10164 {
10170 }
10172 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10173 {
10178 }
10179
10181 {
10183 }
10184
10187 {
10188 int r,g,b,a;
10190 r = r/255;
10191 g = g/255;
10192 b = b/255;
10193 a = a/255;
10194 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10195 }
10196
10197
10198
10199 override void SetLiquidType(
int value,
bool allow_client =
false)
10200 {
10201 if (!IsServerCheck(allow_client))
10202 return;
10203
10208 }
10209
10211 {
10212 return ConfigGetInt("varLiquidTypeInit");
10213 }
10214
10216 {
10218 }
10219
10221 {
10223 SetFrozen(false);
10224 }
10225
10228 {
10229 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10230 }
10231
10232
10235 {
10236 PlayerBase nplayer;
10237 if (PlayerBase.CastTo(nplayer, player))
10238 {
10240 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10241 }
10242 }
10243
10244
10247 {
10248 PlayerBase nplayer;
10249 if (PlayerBase.CastTo(nplayer,player))
10250 {
10251 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10252 }
10253
10254 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10255
10256 if (HasEnergyManager())
10257 {
10258 GetCompEM().UpdatePlugState();
10259 }
10260 }
10261
10262
10264 {
10265 super.OnPlacementStarted(player);
10266
10268 }
10269
10270 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10271 {
10273 {
10274 m_AdminLog.OnPlacementComplete(player,
this);
10275 }
10276
10277 super.OnPlacementComplete(player, position, orientation);
10278 }
10279
10280
10281
10282
10283
10285 {
10287 {
10288 return true;
10289 }
10290 else
10291 {
10292 return false;
10293 }
10294 }
10295
10296
10298 {
10300 {
10302 }
10303 }
10304
10305
10307 {
10309 }
10310
10312 {
10314 }
10315
10316 override void InsertAgent(
int agent,
float count = 1)
10317 {
10318 if (count < 1)
10319 return;
10320
10322 }
10323
10326 {
10328 }
10329
10330
10332 {
10334 }
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10378 {
10380 return false;
10381 return true;
10382 }
10383
10385 {
10386
10388 }
10389
10390
10393 {
10394 super.CheckForRoofLimited(timeTresholdMS);
10395
10396 float time =
g_Game.GetTime();
10397 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10398 {
10399 m_PreviousRoofTestTime = time;
10400 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10401 }
10402 }
10403
10404
10406 {
10408 {
10409 return 0;
10410 }
10411
10412 if (GetInventory().GetAttachmentSlotsCount() != 0)
10413 {
10414 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10415 if (filter)
10416 return filter.GetProtectionLevel(type, false, system);
10417 else
10418 return 0;
10419 }
10420
10421 string subclassPath, entryName;
10422
10423 switch (type)
10424 {
10426 entryName = "biological";
10427 break;
10429 entryName = "chemical";
10430 break;
10431 default:
10432 entryName = "biological";
10433 break;
10434 }
10435
10436 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10437
10438 return g_Game.ConfigGetFloat(subclassPath + entryName);
10439 }
10440
10441
10442
10445 {
10446 if (!IsMagazine())
10448
10450 }
10451
10452
10453
10454
10455
10460 {
10461 return true;
10462 }
10463
10465 {
10467 }
10468
10469
10470
10471
10472
10474 {
10475 if (parent)
10476 {
10477 if (parent.IsInherited(DayZInfected))
10478 return true;
10479
10480 if (!parent.IsRuined())
10481 return true;
10482 }
10483
10484 return true;
10485 }
10486
10488 {
10489 if (!super.CanPutAsAttachment(parent))
10490 {
10491 return false;
10492 }
10493
10494 if (!IsRuined() && !parent.IsRuined())
10495 {
10496 return true;
10497 }
10498
10499 return false;
10500 }
10501
10503 {
10504
10505
10506
10507
10508 return super.CanReceiveItemIntoCargo(item);
10509 }
10510
10512 {
10513
10514
10515
10516
10517 GameInventory attachmentInv = attachment.GetInventory();
10519 {
10520 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10521 return false;
10522 }
10523
10524 InventoryLocation loc = new InventoryLocation();
10525 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10526 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10527 return false;
10528
10529 return super.CanReceiveAttachment(attachment, slotId);
10530 }
10531
10533 {
10534 if (!super.CanReleaseAttachment(attachment))
10535 return false;
10536
10537 return GetInventory().AreChildrenAccessible();
10538 }
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10555
10556
10557
10558
10559
10561 {
10562 int id = muzzle_owner.GetMuzzleID();
10563 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10564
10565 if (WPOF_array)
10566 {
10567 for (int i = 0; i < WPOF_array.Count(); i++)
10568 {
10569 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10570
10571 if (WPOF)
10572 {
10573 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10574 }
10575 }
10576 }
10577 }
10578
10579
10581 {
10582 int id = muzzle_owner.GetMuzzleID();
10584
10585 if (WPOBE_array)
10586 {
10587 for (int i = 0; i < WPOBE_array.Count(); i++)
10588 {
10589 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10590
10591 if (WPOBE)
10592 {
10593 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10594 }
10595 }
10596 }
10597 }
10598
10599
10601 {
10602 int id = muzzle_owner.GetMuzzleID();
10603 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10604
10605 if (WPOOH_array)
10606 {
10607 for (int i = 0; i < WPOOH_array.Count(); i++)
10608 {
10609 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10610
10611 if (WPOOH)
10612 {
10613 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10614 }
10615 }
10616 }
10617 }
10618
10619
10621 {
10622 int id = muzzle_owner.GetMuzzleID();
10623 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10624
10625 if (WPOOH_array)
10626 {
10627 for (int i = 0; i < WPOOH_array.Count(); i++)
10628 {
10629 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10630
10631 if (WPOOH)
10632 {
10633 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10634 }
10635 }
10636 }
10637 }
10638
10639
10641 {
10642 int id = muzzle_owner.GetMuzzleID();
10643 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10644
10645 if (WPOOH_array)
10646 {
10647 for (int i = 0; i < WPOOH_array.Count(); i++)
10648 {
10649 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10650
10651 if (WPOOH)
10652 {
10653 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10654 }
10655 }
10656 }
10657 }
10658
10659
10660
10662 {
10664 {
10665 return true;
10666 }
10667
10668 return false;
10669 }
10670
10672 {
10674 {
10675 return true;
10676 }
10677
10678 return false;
10679 }
10680
10682 {
10684 {
10685 return true;
10686 }
10687
10688 return false;
10689 }
10690
10692 {
10693 return false;
10694 }
10695
10698 {
10699 return UATimeSpent.DEFAULT_DEPLOY;
10700 }
10701
10702
10703
10704
10706 {
10708 SetSynchDirty();
10709 }
10710
10712 {
10714 }
10715
10716
10718 {
10719 return false;
10720 }
10721
10724 {
10725 string att_type = "None";
10726
10727 if (ConfigIsExisting("soundAttType"))
10728 {
10729 att_type = ConfigGetString("soundAttType");
10730 }
10731
10733 }
10734
10736 {
10738 }
10739
10740
10741
10742
10743
10749
10751 {
10754
10756 }
10757
10758
10760 {
10762 return;
10763
10765
10768
10771
10772 SoundParameters params = new SoundParameters();
10776 }
10777
10778
10780 {
10782 {
10785
10786 SetSynchDirty();
10787
10790 }
10791 }
10792
10794 {
10796 }
10797
10798
10800 {
10802 return;
10803
10805 SetSynchDirty();
10806
10809 }
10810
10812 {
10815 }
10816
10818 {
10820 }
10821
10822 void OnApply(PlayerBase player);
10823
10825 {
10826 return 1.0;
10827 };
10828
10830 {
10832 }
10833
10835 {
10837 }
10838
10840
10842 {
10843 SetDynamicPhysicsLifeTime(0.01);
10845 }
10846
10848 {
10849 array<string> zone_names = new array<string>;
10850 GetDamageZones(zone_names);
10851 for (int i = 0; i < zone_names.Count(); i++)
10852 {
10853 SetHealthMax(zone_names.Get(i),"Health");
10854 }
10855 SetHealthMax("","Health");
10856 }
10857
10860 {
10861 float global_health = GetHealth01("","Health");
10862 array<string> zones = new array<string>;
10863 GetDamageZones(zones);
10864
10865 for (int i = 0; i < zones.Count(); i++)
10866 {
10867 SetHealth01(zones.Get(i),"Health",global_health);
10868 }
10869 }
10870
10873 {
10874 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10875 }
10876
10878 {
10879 if (!hasRootAsPlayer)
10880 {
10881 if (refParentIB)
10882 {
10883
10884 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10885 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10886
10887 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10888 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10889
10892 }
10893 else
10894 {
10895
10898 }
10899 }
10900 }
10901
10903 {
10905 {
10906 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10907 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10908 {
10909 float heatPermCoef = 1.0;
10911 while (ent)
10912 {
10913 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10914 ent = ent.GetHierarchyParent();
10915 }
10916
10917 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10918 }
10919 }
10920 }
10921
10923 {
10924
10925 EntityAI parent = GetHierarchyParent();
10926 if (!parent)
10927 {
10928 hasParent = false;
10929 hasRootAsPlayer = false;
10930 }
10931 else
10932 {
10933 hasParent = true;
10934 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10935 refParentIB =
ItemBase.Cast(parent);
10936 }
10937 }
10938
10939 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10940 {
10941
10942 }
10943
10945 {
10946
10947 return false;
10948 }
10949
10951 {
10952
10953
10954 return false;
10955 }
10956
10958 {
10959
10960 return false;
10961 }
10962
10965 {
10966 return !GetIsFrozen() &&
IsOpen();
10967 }
10968
10970 {
10971 bool hasParent = false, hasRootAsPlayer = false;
10973
10974 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10975 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10976
10977 if (wwtu || foodDecay)
10978 {
10982
10983 if (processWetness || processTemperature || processDecay)
10984 {
10986
10987 if (processWetness)
10988 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10989
10990 if (processTemperature)
10992
10993 if (processDecay)
10994 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10995 }
10996 }
10997 }
10998
11001 {
11003 }
11004
11006 {
11009
11010 return super.GetTemperatureFreezeThreshold();
11011 }
11012
11014 {
11017
11018 return super.GetTemperatureThawThreshold();
11019 }
11020
11022 {
11025
11026 return super.GetItemOverheatThreshold();
11027 }
11028
11030 {
11032 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11033
11034 return super.GetTemperatureFreezeTime();
11035 }
11036
11038 {
11040 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11041
11042 return super.GetTemperatureThawTime();
11043 }
11044
11049
11051 {
11052 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11053 }
11054
11056 {
11057 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11058 }
11059
11062 {
11064 }
11065
11067 {
11069 }
11070
11072 {
11074 }
11075
11078 {
11079 return null;
11080 }
11081
11084 {
11085 return false;
11086 }
11087
11089 {
11091 {
11094 if (!trg)
11095 {
11097 explosive = this;
11098 }
11099
11100 explosive.PairRemote(trg);
11102
11103 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11104 trg.SetPersistentPairID(persistentID);
11105 explosive.SetPersistentPairID(persistentID);
11106
11107 return true;
11108 }
11109 return false;
11110 }
11111
11114 {
11115 float ret = 1.0;
11118 ret *= GetHealth01();
11119
11120 return ret;
11121 }
11122
11123 #ifdef DEVELOPER
11124 override void SetDebugItem()
11125 {
11126 super.SetDebugItem();
11127 _itemBase = this;
11128 }
11129
11131 {
11132 string text = super.GetDebugText();
11133
11135 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11136
11137 return text;
11138 }
11139 #endif
11140
11142 {
11143 return true;
11144 }
11145
11147
11149
11151 {
11154 }
11155
11156
11164
11180
11181 [
Obsolete(
"Use ItemSoundHandler instead")]
11184 {
11185 if (!
g_Game.IsDedicatedServer())
11186 {
11187 if (ConfigIsExisting("attachSoundSet"))
11188 {
11189 string cfg_path = "";
11190 string soundset = "";
11191 string type_name =
GetType();
11192
11195 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11196 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11197
11198 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11199 {
11200 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11201 {
11202 if (cfg_slot_array[i] == slot_type)
11203 {
11204 soundset = cfg_soundset_array[i];
11205 break;
11206 }
11207 }
11208 }
11209
11210 if (soundset != "")
11211 {
11212 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11214 }
11215 }
11216 }
11217 }
11218
11220}
11221
11223{
11225 if (entity)
11226 {
11227 bool is_item = entity.IsInherited(
ItemBase);
11228 if (is_item && full_quantity)
11229 {
11232 }
11233 }
11234 else
11235 {
11237 return NULL;
11238 }
11239 return entity;
11240}
11241
11243{
11244 if (item)
11245 {
11246 if (health > 0)
11247 item.SetHealth("", "", health);
11248
11249 if (item.CanHaveTemperature())
11250 {
11252 if (item.CanFreeze())
11253 item.SetFrozen(false);
11254 }
11255
11256 if (item.HasEnergyManager())
11257 {
11258 if (quantity >= 0)
11259 {
11260 item.GetCompEM().SetEnergy0To1(quantity);
11261 }
11262 else
11263 {
11265 }
11266 }
11267 else if (item.IsMagazine())
11268 {
11269 Magazine mag = Magazine.Cast(item);
11270 if (quantity >= 0)
11271 {
11272 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11273 }
11274 else
11275 {
11277 }
11278
11279 }
11280 else
11281 {
11282 if (quantity >= 0)
11283 {
11284 item.SetQuantityNormalized(quantity, false);
11285 }
11286 else
11287 {
11289 }
11290
11291 }
11292 }
11293}
11294
11295#ifdef DEVELOPER
11297#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.