6293{
6295 {
6296 return true;
6297 }
6298};
6299
6301{
6302
6303};
6304
6305
6306
6308{
6312
6314
6317
6318
6319
6320
6321
6330
6336
6341
6346
6367 protected bool m_IsResultOfSplit
6368
6370
6375
6376
6377
6379
6383
6384
6385
6387
6390
6391
6392
6398
6399
6407
6410
6411
6413
6414
6416
6417
6422
6423
6428
6430
6431
6433
6434
6436 {
6441
6442 if (!
g_Game.IsDedicatedServer())
6443 {
6445 {
6447
6449 {
6451 }
6452 }
6453
6456 }
6457
6458 m_OldLocation = null;
6459
6461 {
6463 }
6464
6465 if (ConfigIsExisting("headSelectionsToHide"))
6466 {
6469 }
6470
6472 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6473 {
6475 }
6476
6478
6479 m_IsResultOfSplit = false;
6480
6482 }
6483
6485 {
6486 super.InitItemVariables();
6487
6493 m_Count = ConfigGetInt(
"count");
6494
6497
6502
6505
6510
6522
6526
6527
6530 if (ConfigIsExisting("canBeSplit"))
6531 {
6534 }
6535
6537 if (ConfigIsExisting("itemBehaviour"))
6539
6540
6543 RegisterNetSyncVariableInt("m_VarLiquidType");
6544 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6545
6546 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6547 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6548 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6549
6550 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6551 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6552 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6553 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6554
6555 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6556 RegisterNetSyncVariableBool("m_IsTakeable");
6557 RegisterNetSyncVariableBool("m_IsHologram");
6558
6561 {
6564 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6565 }
6566
6568
6570 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6572
6574 }
6575
6577 {
6579 }
6580
6582 {
6585 {
6590 }
6591 }
6592
6593 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6594 {
6596 {
6599 }
6600
6602 }
6603
6605 {
6611 }
6612
6614
6616 {
6618
6619 if (!action)
6620 {
6621 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6622 return;
6623 }
6624
6626 if (!ai)
6627 {
6629 return;
6630 }
6631
6633 if (!action_array)
6634 {
6635 action_array = new array<ActionBase_Basic>;
6637 }
6638 if (LogManager.IsActionLogEnable())
6639 {
6640 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6641 }
6642
6643 if (action_array.Find(action) != -1)
6644 {
6645 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6646 }
6647 else
6648 {
6649 action_array.Insert(action);
6650 }
6651 }
6652
6654 {
6655 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6656 ActionBase action = player.GetActionManager().GetAction(actionName);
6659
6660 if (action_array)
6661 {
6662 action_array.RemoveItem(action);
6663 }
6664 }
6665
6666
6667
6669 {
6670 ActionOverrideData overrideData = new ActionOverrideData();
6674
6676 if (!actionMap)
6677 {
6680 }
6681
6682 actionMap.Insert(this.
Type(), overrideData);
6683
6684 }
6685
6687
6689
6690
6692 {
6695
6698
6699 string config_to_search = "CfgVehicles";
6700 string muzzle_owner_config;
6701
6703 {
6704 if (IsInherited(Weapon))
6705 config_to_search = "CfgWeapons";
6706
6707 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6708
6709 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6710
6711 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6712
6713 if (config_OnFire_subclass_count > 0)
6714 {
6715 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6716
6717 for (int i = 0; i < config_OnFire_subclass_count; i++)
6718 {
6719 string particle_class = "";
6720 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6721 string config_OnFire_entry = config_OnFire_class + particle_class;
6722 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6723 WPOF_array.Insert(WPOF);
6724 }
6725
6726
6728 }
6729 }
6730
6732 {
6733 config_to_search = "CfgWeapons";
6734 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6735
6736 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6737
6738 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6739
6740 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6741 {
6742 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6743
6744 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6745 {
6746 string particle_class2 = "";
6747 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6748 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6749 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6750 WPOBE_array.Insert(WPOBE);
6751 }
6752
6753
6755 }
6756 }
6757 }
6758
6759
6761 {
6764
6766 {
6767 string config_to_search = "CfgVehicles";
6768
6769 if (IsInherited(Weapon))
6770 config_to_search = "CfgWeapons";
6771
6772 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6773 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6774
6775 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6776 {
6777
6779
6781 {
6783 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6785 return;
6786 }
6787
6790
6791
6792
6793 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6794 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6795
6796 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6797 {
6798 string particle_class = "";
6799 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6800 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6801 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6802
6803 if (entry_type == CT_CLASS)
6804 {
6805 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6806 WPOOH_array.Insert(WPOF);
6807 }
6808 }
6809
6810
6812 }
6813 }
6814 }
6815
6817 {
6819 }
6820
6822 {
6824 {
6826
6829
6832
6833 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6834 }
6835 }
6836
6838 {
6840 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6841
6843 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6844
6846 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6847
6849 {
6851 }
6852 }
6853
6855 {
6857 }
6858
6860 {
6863 else
6865
6867 {
6870 }
6871 else
6872 {
6875
6878 }
6879
6881 }
6882
6884 {
6886 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6887 }
6888
6890 {
6892 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6894 }
6895
6897 {
6899 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6900 }
6901
6903 {
6906
6907 OverheatingParticle OP = new OverheatingParticle();
6912
6914 }
6915
6917 {
6920
6921 return -1;
6922 }
6923
6925 {
6927 {
6930
6931 for (int i = count; i > 0; --i)
6932 {
6933 int id = i - 1;
6936
6939
6940 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6941 {
6942 if (p)
6943 {
6946 }
6947 }
6948 }
6949 }
6950 }
6951
6953 {
6955 {
6957 {
6958 int id = i - 1;
6960
6961 if (OP)
6962 {
6964
6965 if (p)
6966 {
6968 }
6969
6970 delete OP;
6971 }
6972 }
6973
6976 }
6977 }
6978
6981 {
6982 return 0.0;
6983 }
6984
6985
6987 {
6988 return 250;
6989 }
6990
6992 {
6993 return 0;
6994 }
6995
6998 {
7000 return true;
7001
7002 return false;
7003 }
7004
7007 {
7010
7012 {
7014 }
7015 else
7016 {
7017
7019 }
7020
7022 }
7023
7030 {
7031 return -1;
7032 }
7033
7034
7035
7036
7038 {
7040 {
7041 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7042 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7043
7044 if (r_index >= 0)
7045 {
7046 InventoryLocation r_il = new InventoryLocation;
7047 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7048
7049 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7052 {
7053 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7054 }
7056 {
7057 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7058 }
7059
7060 }
7061
7062 player.GetHumanInventory().ClearUserReservedLocation(this);
7063 }
7064
7067 }
7068
7069
7070
7071
7073 {
7074 return ItemBase.m_DebugActionsMask;
7075 }
7076
7078 {
7079 return ItemBase.m_DebugActionsMask & mask;
7080 }
7081
7083 {
7084 ItemBase.m_DebugActionsMask = mask;
7085 }
7086
7088 {
7089 ItemBase.m_DebugActionsMask |= mask;
7090 }
7091
7093 {
7094 ItemBase.m_DebugActionsMask &= ~mask;
7095 }
7096
7098 {
7100 {
7102 }
7103 else
7104 {
7106 }
7107 }
7108
7109
7111 {
7112 if (GetEconomyProfile())
7113 {
7114 float q_max = GetEconomyProfile().GetQuantityMax();
7115 if (q_max > 0)
7116 {
7117 float q_min = GetEconomyProfile().GetQuantityMin();
7118 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7119
7121 {
7122 ComponentEnergyManager comp = GetCompEM();
7124 {
7126 }
7127 }
7129 {
7131
7132 }
7133
7134 }
7135 }
7136 }
7137
7140 {
7141 EntityAI parent = GetHierarchyParent();
7142
7143 if (parent)
7144 {
7145 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7146 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7147 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7148 }
7149 }
7150
7153 {
7154 EntityAI parent = GetHierarchyParent();
7155
7156 if (parent)
7157 {
7158 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7159 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7160 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7161 }
7162 }
7163
7165 {
7166
7167
7168
7169
7171
7173 {
7174 if (ScriptInputUserData.CanStoreInputUserData())
7175 {
7176 ScriptInputUserData ctx = new ScriptInputUserData;
7182 ctx.
Write(use_stack_max);
7185
7187 {
7188 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7189 }
7190 }
7191 }
7192 else if (!
g_Game.IsMultiplayer())
7193 {
7195 }
7196 }
7197
7199 {
7201 }
7202
7204 {
7206 }
7207
7209 {
7211 }
7212
7214 {
7215
7216 return false;
7217 }
7218
7220 {
7221 return false;
7222 }
7223
7227 {
7228 return false;
7229 }
7230
7232 {
7233 return "";
7234 }
7235
7237
7239 {
7240 return false;
7241 }
7242
7244 {
7245 return true;
7246 }
7247
7248
7249
7251 {
7252 return true;
7253 }
7254
7256 {
7257 return true;
7258 }
7259
7261 {
7262 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7264 }
7265
7267 {
7269 }
7270
7272 {
7274 if (!is_being_placed)
7276 SetSynchDirty();
7277 }
7278
7279
7281
7283 {
7285 }
7286
7288 {
7290 }
7291
7293 {
7294 return 1;
7295 }
7296
7298 {
7299 return false;
7300 }
7301
7303 {
7305 SetSynchDirty();
7306 }
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7343 {
7344 super.OnMovedInsideCargo(container);
7345
7346 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7347 }
7348
7349 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7350 {
7351 super.EEItemLocationChanged(oldLoc, newLoc);
7352
7353 PlayerBase newPlayer = null;
7354 PlayerBase oldPlayer = null;
7355
7356 if (newLoc.GetParent())
7357 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7358
7359 if (oldLoc.GetParent())
7360 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7361
7363 {
7364 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7365
7366 if (rIndex >= 0)
7367 {
7368 InventoryLocation rIl = new InventoryLocation;
7369 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7370
7371 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7374 {
7375 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7376 }
7378 {
7380 }
7381
7382 }
7383 }
7384
7386 {
7387 if (newPlayer)
7388 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7389
7390 if (newPlayer == oldPlayer)
7391 {
7392 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7393 {
7395 {
7396 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7397 {
7398 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7399 }
7400 }
7401 else
7402 {
7403 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7404 }
7405 }
7406
7407 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7408 {
7409 int type = oldLoc.GetType();
7411 {
7412 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7413 }
7415 {
7416 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7417 }
7418 }
7419 if (!m_OldLocation)
7420 {
7421 m_OldLocation = new InventoryLocation;
7422 }
7423 m_OldLocation.Copy(oldLoc);
7424 }
7425 else
7426 {
7427 if (m_OldLocation)
7428 {
7429 m_OldLocation.Reset();
7430 }
7431 }
7432
7433 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7434 }
7435 else
7436 {
7437 if (newPlayer)
7438 {
7439 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7440 if (resIndex >= 0)
7441 {
7442 InventoryLocation il = new InventoryLocation;
7443 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7445 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7448 {
7449 il.
GetParent().GetOnReleaseLock().Invoke(it);
7450 }
7452 {
7454 }
7455
7456 }
7457 }
7459 {
7460
7462 }
7463
7464 if (m_OldLocation)
7465 {
7466 m_OldLocation.Reset();
7467 }
7468 }
7469
7471 {
7472 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7473 }
7474
7476 {
7477 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7478 }
7479 }
7480
7481 override void EOnContact(IEntity other, Contact extra)
7482 {
7484 {
7485 int liquidType = -1;
7487 if (impactSpeed > 0.0)
7488 {
7490 #ifndef SERVER
7492 #else
7494 SetSynchDirty();
7495 #endif
7497 }
7498 }
7499
7500 #ifdef SERVER
7501 if (GetCompEM() && GetCompEM().IsPlugged())
7502 {
7503 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7504 GetCompEM().UnplugThis();
7505 }
7506 #endif
7507 }
7508
7510
7512 {
7514 }
7515
7517 {
7518
7519 }
7520
7522 {
7523 super.OnItemLocationChanged(old_owner, new_owner);
7524
7525 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7526 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7527
7528 if (!relatedPlayer && playerNew)
7529 relatedPlayer = playerNew;
7530
7531 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7532 {
7534 if (actionMgr)
7535 {
7536 ActionBase currentAction = actionMgr.GetRunningAction();
7537 if (currentAction)
7539 }
7540 }
7541
7542 Man ownerPlayerOld = null;
7543 Man ownerPlayerNew = null;
7544
7545 if (old_owner)
7546 {
7547 if (old_owner.
IsMan())
7548 {
7549 ownerPlayerOld = Man.Cast(old_owner);
7550 }
7551 else
7552 {
7553 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7554 }
7555 }
7556 else
7557 {
7559 {
7561
7562 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7563 {
7564 GetCompEM().UnplugThis();
7565 }
7566 }
7567 }
7568
7569 if (new_owner)
7570 {
7571 if (new_owner.
IsMan())
7572 {
7573 ownerPlayerNew = Man.Cast(new_owner);
7574 }
7575 else
7576 {
7577 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7578 }
7579 }
7580
7581 if (ownerPlayerOld != ownerPlayerNew)
7582 {
7583 if (ownerPlayerOld)
7584 {
7585 array<EntityAI> subItemsExit = new array<EntityAI>;
7587 for (int i = 0; i < subItemsExit.Count(); i++)
7588 {
7591 }
7592 }
7593
7594 if (ownerPlayerNew)
7595 {
7596 array<EntityAI> subItemsEnter = new array<EntityAI>;
7598 for (int j = 0; j < subItemsEnter.Count(); j++)
7599 {
7602 }
7603 }
7604 }
7605 else if (ownerPlayerNew != null)
7606 {
7607 PlayerBase nplayer;
7608 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7609 {
7610 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7612 for (int k = 0; k < subItemsUpdate.Count(); k++)
7613 {
7615 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7616 }
7617 }
7618 }
7619
7620 if (old_owner)
7621 old_owner.OnChildItemRemoved(this);
7622 if (new_owner)
7623 new_owner.OnChildItemReceived(this);
7624 }
7625
7626
7628 {
7629 super.EEDelete(parent);
7630 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7631 if (player)
7632 {
7634
7635 if (player.IsAlive())
7636 {
7637 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7638 if (r_index >= 0)
7639 {
7640 InventoryLocation r_il = new InventoryLocation;
7641 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7642
7643 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7646 {
7647 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7648 }
7650 {
7651 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7652 }
7653
7654 }
7655
7656 player.RemoveQuickBarEntityShortcut(this);
7657 }
7658 }
7659 }
7660
7662 {
7663 super.EEKilled(killer);
7664
7667 {
7668 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7669 {
7670 if (IsMagazine())
7671 {
7672 if (Magazine.Cast(this).GetAmmoCount() > 0)
7673 {
7675 }
7676 }
7677 else
7678 {
7680 }
7681 }
7682 }
7683 }
7684
7686 {
7687 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7688
7689 super.OnWasAttached(parent, slot_id);
7690
7693
7696 }
7697
7699 {
7700 super.OnWasDetached(parent, slot_id);
7701
7704
7707 }
7708
7710 {
7711 int idx;
7714
7715 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7716 if (inventory_slots.Count() < 1)
7717 {
7718 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7719 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7720 }
7721 else
7722 {
7723 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7724 }
7725
7726 idx = inventory_slots.Find(slot);
7727 if (idx < 0)
7728 return "";
7729
7730 return attach_types.Get(idx);
7731 }
7732
7734 {
7735 int idx = -1;
7736 string slot;
7737
7740
7741 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7742 if (inventory_slots.Count() < 1)
7743 {
7744 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7745 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7746 }
7747 else
7748 {
7749 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7750 if (detach_types.Count() < 1)
7751 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7752 }
7753
7754 for (int i = 0; i < inventory_slots.Count(); i++)
7755 {
7756 slot = inventory_slots.Get(i);
7757 }
7758
7759 if (slot != "")
7760 {
7761 if (detach_types.Count() == 1)
7762 idx = 0;
7763 else
7764 idx = inventory_slots.Find(slot);
7765 }
7766 if (idx < 0)
7767 return "";
7768
7769 return detach_types.Get(idx);
7770 }
7771
7773 {
7774
7776
7777
7778 float min_time = 1;
7779 float max_time = 3;
7780 float delay = Math.RandomFloat(min_time, max_time);
7781
7782 explode_timer.Run(delay, this, "DoAmmoExplosion");
7783 }
7784
7786 {
7787 Magazine magazine = Magazine.Cast(this);
7788 int pop_sounds_count = 6;
7789 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7790
7791
7792 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7793 string sound_name = pop_sounds[ sound_idx ];
7794 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7795
7796
7797 magazine.ServerAddAmmoCount(-1);
7798
7799
7800 float min_temp_to_explode = 100;
7801
7802 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7803 {
7805 }
7806 }
7807
7808
7809 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7810 {
7811 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7812
7813 const int CHANCE_DAMAGE_CARGO = 4;
7814 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7815 const int CHANCE_DAMAGE_NOTHING = 2;
7816
7818 {
7819 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7820 int chances;
7821 int rnd;
7822
7823 if (GetInventory().GetCargo())
7824 {
7825 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7826 rnd = Math.RandomInt(0,chances);
7827
7828 if (rnd < CHANCE_DAMAGE_CARGO)
7829 {
7831 }
7832 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7833 {
7835 }
7836 }
7837 else
7838 {
7839 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7840 rnd = Math.RandomInt(0,chances);
7841
7842 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7843 {
7845 }
7846 }
7847 }
7848 }
7849
7851 {
7852 CargoBase cargo = GetInventory().GetCargo();
7853 if (cargo)
7854 {
7856 if (item_count > 0)
7857 {
7858 int random_pick = Math.RandomInt(0, item_count);
7860 if (!item.IsExplosive())
7861 {
7862 item.AddHealth("","",damage);
7863 return true;
7864 }
7865 }
7866 }
7867 return false;
7868 }
7869
7871 {
7872 GameInventory inventory = GetInventory();
7874 if (attachment_count > 0)
7875 {
7876 int random_pick = Math.RandomInt(0, attachment_count);
7878 if (!attachment.IsExplosive())
7879 {
7880 attachment.AddHealth("","",damage);
7881 return true;
7882 }
7883 }
7884 return false;
7885 }
7886
7888 {
7890 }
7891
7893 {
7895 return GetInventory().CanRemoveEntity();
7896
7897 return false;
7898 }
7899
7901 {
7902
7904 return false;
7905
7906
7908 return false;
7909
7910
7911
7913 if (delta == 0)
7914 return false;
7915
7916
7917 return true;
7918 }
7919
7921 {
7923 {
7924 if (ScriptInputUserData.CanStoreInputUserData())
7925 {
7926 ScriptInputUserData ctx = new ScriptInputUserData;
7931 ctx.
Write(destination_entity);
7935 }
7936 }
7937 else if (!
g_Game.IsMultiplayer())
7938 {
7940 }
7941 }
7942
7944 {
7945 float split_quantity_new;
7949 InventoryLocation loc = new InventoryLocation;
7950
7951 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7952 {
7954 split_quantity_new = stack_max;
7955 else
7957
7959 {
7960 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7961 if (new_item)
7962 {
7963 new_item.SetResultOfSplit(true);
7964 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7966 new_item.
SetQuantity(split_quantity_new,
false,
true);
7967 }
7968 }
7969 }
7970 else if (destination_entity && slot_id == -1)
7971 {
7972 if (quantity > stack_max)
7973 split_quantity_new = stack_max;
7974 else
7975 split_quantity_new = quantity;
7976
7978 {
7979 GameInventory destinationInventory = destination_entity.GetInventory();
7981 {
7984 }
7985
7986 if (new_item)
7987 {
7988 new_item.SetResultOfSplit(true);
7989 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7991 new_item.
SetQuantity(split_quantity_new,
false,
true);
7992 }
7993 }
7994 }
7995 else
7996 {
7997 if (stack_max != 0)
7998 {
8000 {
8002 }
8003
8004 if (split_quantity_new == 0)
8005 {
8006 if (!
g_Game.IsMultiplayer())
8007 player.PhysicalPredictiveDropItem(this);
8008 else
8009 player.ServerDropEntity(this);
8010 return;
8011 }
8012
8014 {
8016
8017 if (new_item)
8018 {
8019 new_item.SetResultOfSplit(true);
8020 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8023 new_item.PlaceOnSurface();
8024 }
8025 }
8026 }
8027 }
8028 }
8029
8031 {
8032 float split_quantity_new;
8036 InventoryLocation loc = new InventoryLocation;
8037
8038 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8039 {
8041 split_quantity_new = stack_max;
8042 else
8044
8046 {
8047 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8048 if (new_item)
8049 {
8050 new_item.SetResultOfSplit(true);
8051 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8053 new_item.
SetQuantity(split_quantity_new,
false,
true);
8054 }
8055 }
8056 }
8057 else if (destination_entity && slot_id == -1)
8058 {
8059 if (quantity > stack_max)
8060 split_quantity_new = stack_max;
8061 else
8062 split_quantity_new = quantity;
8063
8065 {
8066 GameInventory destinationInventory = destination_entity.GetInventory();
8068 {
8071 }
8072
8073 if (new_item)
8074 {
8075 new_item.SetResultOfSplit(true);
8076 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8078 new_item.
SetQuantity(split_quantity_new,
false,
true);
8079 }
8080 }
8081 }
8082 else
8083 {
8084 if (stack_max != 0)
8085 {
8087 {
8089 }
8090
8092 {
8094
8095 if (new_item)
8096 {
8097 new_item.SetResultOfSplit(true);
8098 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8101 new_item.PlaceOnSurface();
8102 }
8103 }
8104 }
8105 }
8106 }
8107
8109 {
8111 {
8112 if (ScriptInputUserData.CanStoreInputUserData())
8113 {
8114 ScriptInputUserData ctx = new ScriptInputUserData;
8119 dst.WriteToContext(ctx);
8121 }
8122 }
8123 else if (!
g_Game.IsMultiplayer())
8124 {
8126 }
8127 }
8128
8130 {
8132 {
8133 if (ScriptInputUserData.CanStoreInputUserData())
8134 {
8135 ScriptInputUserData ctx = new ScriptInputUserData;
8140 ctx.
Write(destination_entity);
8146 }
8147 }
8148 else if (!
g_Game.IsMultiplayer())
8149 {
8151 }
8152 }
8153
8155 {
8157 }
8158
8160 {
8162 float split_quantity_new;
8164 if (dst.IsValid())
8165 {
8166 int slot_id = dst.GetSlot();
8168
8169 if (quantity > stack_max)
8170 split_quantity_new = stack_max;
8171 else
8172 split_quantity_new = quantity;
8173
8175 {
8177
8178 if (new_item)
8179 {
8180 new_item.SetResultOfSplit(true);
8181 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8183 new_item.
SetQuantity(split_quantity_new,
false,
true);
8184 }
8185
8186 return new_item;
8187 }
8188 }
8189
8190 return null;
8191 }
8192
8194 {
8196 float split_quantity_new;
8198 if (destination_entity)
8199 {
8201 if (quantity > stackable)
8202 split_quantity_new = stackable;
8203 else
8204 split_quantity_new = quantity;
8205
8207 {
8208 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8209 if (new_item)
8210 {
8211 new_item.SetResultOfSplit(true);
8212 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8214 new_item.
SetQuantity(split_quantity_new,
false,
true);
8215 }
8216 }
8217 }
8218 }
8219
8221 {
8223 {
8224 if (ScriptInputUserData.CanStoreInputUserData())
8225 {
8226 ScriptInputUserData ctx = new ScriptInputUserData;
8231 ItemBase destination_entity =
this;
8232 ctx.
Write(destination_entity);
8236 }
8237 }
8238 else if (!
g_Game.IsMultiplayer())
8239 {
8241 }
8242 }
8243
8245 {
8247 float split_quantity_new;
8249 if (player)
8250 {
8252 if (quantity > stackable)
8253 split_quantity_new = stackable;
8254 else
8255 split_quantity_new = quantity;
8256
8258 {
8259 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8260 new_item =
ItemBase.Cast(in_hands);
8261 if (new_item)
8262 {
8263 new_item.SetResultOfSplit(true);
8264 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8266 new_item.SetQuantity(split_quantity_new, false, true);
8267 }
8268 }
8269 }
8270 }
8271
8273 {
8275 float split_quantity_new = Math.Floor(quantity * 0.5);
8276
8278 return;
8279
8281
8282 if (new_item)
8283 {
8284 if (new_item.GetQuantityMax() < split_quantity_new)
8285 {
8286 split_quantity_new = new_item.GetQuantityMax();
8287 }
8288
8289 new_item.SetResultOfSplit(true);
8290 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8291
8293 {
8296 }
8297 else
8298 {
8300 new_item.
SetQuantity(split_quantity_new,
false,
true);
8301 }
8302 }
8303 }
8304
8306 {
8308 float split_quantity_new = Math.Floor(quantity / 2);
8309
8311 return;
8312
8313 InventoryLocation invloc = new InventoryLocation;
8315
8317 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8318
8319 if (new_item)
8320 {
8321 if (new_item.GetQuantityMax() < split_quantity_new)
8322 {
8323 split_quantity_new = new_item.GetQuantityMax();
8324 }
8326 {
8329 }
8330 else if (split_quantity_new > 1)
8331 {
8333 new_item.
SetQuantity(split_quantity_new,
false,
true);
8334 }
8335 }
8336 }
8337
8340 {
8341 SetWeightDirty();
8343
8344 if (parent)
8345 parent.OnAttachmentQuantityChangedEx(this, delta);
8346
8348 {
8350 {
8352 }
8354 {
8355 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8357 }
8358 }
8359 }
8360
8363 {
8364
8365 }
8366
8369 {
8371 }
8372
8374 {
8375 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8376
8378 {
8379 if (newLevel == GameConstants.STATE_RUINED)
8380 {
8382 EntityAI parent = GetHierarchyParent();
8383 if (parent && parent.IsFireplace())
8384 {
8385 CargoBase cargo = GetInventory().GetCargo();
8386 if (cargo)
8387 {
8389 {
8391 }
8392 }
8393 }
8394 }
8395
8397 {
8398
8400 return;
8401 }
8402
8403 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8404 {
8406 }
8407 }
8408 }
8409
8410
8412 {
8413 super.OnRightClick();
8414
8416 {
8418 {
8419 if (ScriptInputUserData.CanStoreInputUserData())
8420 {
8421 EntityAI root = GetHierarchyRoot();
8422 Man playerOwner = GetHierarchyRootPlayer();
8423 InventoryLocation dst = new InventoryLocation;
8424
8425
8426 if (!playerOwner && root && root == this)
8427 {
8429 }
8430 else
8431 {
8432
8433 GetInventory().GetCurrentInventoryLocation(dst);
8435 {
8436 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8438 {
8440 }
8441 else
8442 {
8444
8445
8446 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8447 {
8449 }
8450 else
8451 {
8452 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8453 }
8454 }
8455 }
8456 }
8457
8458 ScriptInputUserData ctx = new ScriptInputUserData;
8466 }
8467 }
8468 else if (!
g_Game.IsMultiplayer())
8469 {
8471 }
8472 }
8473 }
8474
8476 {
8477 if (root)
8478 {
8479 vector m4[4];
8480 root.GetTransform(m4);
8481 dst.SetGround(this, m4);
8482 }
8483 else
8484 {
8485 GetInventory().GetCurrentInventoryLocation(dst);
8486 }
8487 }
8488
8489 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8490 {
8491
8492 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8493 return false;
8494
8495 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8496 return false;
8497
8498
8500 return false;
8501
8502
8503 Magazine mag = Magazine.Cast(this);
8504 if (mag)
8505 {
8506 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8507 return false;
8508
8509 if (stack_max_limit)
8510 {
8511 Magazine other_mag = Magazine.Cast(other_item);
8512 if (other_item)
8513 {
8514 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8515 return false;
8516 }
8517
8518 }
8519 }
8520 else
8521 {
8522
8524 return false;
8525
8527 return false;
8528 }
8529
8530 PlayerBase player = null;
8531 if (CastTo(player, GetHierarchyRootPlayer()))
8532 {
8533 if (player.GetInventory().HasAttachment(this))
8534 return false;
8535
8536 if (player.IsItemsToDelete())
8537 return false;
8538 }
8539
8540 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8541 return false;
8542
8543 int slotID;
8545 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8546 return false;
8547
8548 return true;
8549 }
8550
8552 {
8554 }
8555
8557 {
8558 return m_IsResultOfSplit;
8559 }
8560
8562 {
8563 m_IsResultOfSplit = value;
8564 }
8565
8567 {
8569 }
8570
8572 {
8573 float other_item_quantity = other_item.GetQuantity();
8574 float this_free_space;
8575
8577
8579
8580 if (other_item_quantity > this_free_space)
8581 {
8582 return this_free_space;
8583 }
8584 else
8585 {
8586 return other_item_quantity;
8587 }
8588 }
8589
8591 {
8593 }
8594
8596 {
8598 return;
8599
8600 if (!IsMagazine() && other_item)
8601 {
8603 if (quantity_used != 0)
8604 {
8605 float hp1 = GetHealth01("","");
8606 float hp2 = other_item.GetHealth01("","");
8607 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8608 hpResult = hpResult / (
GetQuantity() + quantity_used);
8609
8610 hpResult *= GetMaxHealth();
8611 Math.Round(hpResult);
8612 SetHealth("", "Health", hpResult);
8613
8615 other_item.AddQuantity(-quantity_used);
8616 }
8617 }
8619 }
8620
8622 {
8623 #ifdef SERVER
8624 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8625 GetHierarchyParent().IncreaseLifetimeUp();
8626 #endif
8627 };
8628
8630 {
8631 PlayerBase p = PlayerBase.Cast(player);
8632
8633 array<int> recipesIds = p.m_Recipes;
8634 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8635 if (moduleRecipesManager)
8636 {
8637 EntityAI itemInHands = player.GetEntityInHands();
8638 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8639 }
8640
8641 for (int i = 0;i < recipesIds.Count(); i++)
8642 {
8643 int key = recipesIds.Get(i);
8644 string recipeName = moduleRecipesManager.GetRecipeName(key);
8646 }
8647 }
8648
8649
8650 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8651 {
8652 super.GetDebugActions(outputList);
8653
8654
8660
8661
8666
8671
8672
8676
8677
8679 {
8683 }
8684
8687
8688
8692
8694
8695 InventoryLocation loc = new InventoryLocation();
8696 GetInventory().GetCurrentInventoryLocation(loc);
8698 {
8699 if (Gizmo_IsSupported())
8702 }
8703
8705 }
8706
8707
8708
8709
8711 {
8712 super.OnAction(action_id, player, ctx);
8713
8715 {
8716 switch (action_id)
8717 {
8721 return true;
8725 return true;
8726 }
8727 }
8728
8730 {
8731 switch (action_id)
8732 {
8734 Delete();
8735 return true;
8736 }
8737 }
8738
8739 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8740 {
8741 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8742 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8743 PlayerBase p = PlayerBase.Cast(player);
8744 if (
EActions.RECIPES_RANGE_START < 1000)
8745 {
8746 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8747 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8748 }
8749 }
8750 #ifndef SERVER
8751 else if (action_id ==
EActions.WATCH_PLAYER)
8752 {
8753 PluginDeveloper.SetDeveloperItemClientEx(player);
8754 }
8755 #endif
8757 {
8758 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8759 {
8760 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8761 OnDebugButtonPressServer(id + 1);
8762 }
8763
8764 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8765 {
8766 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8768 }
8769
8770 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8771 {
8772 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8774 }
8775
8776 else if (action_id ==
EActions.ADD_QUANTITY)
8777 {
8778 if (IsMagazine())
8779 {
8780 Magazine mag = Magazine.Cast(this);
8781 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8782 }
8783 else
8784 {
8786 }
8787
8788 if (m_EM)
8789 {
8790 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8791 }
8792
8793 }
8794
8795 else if (action_id ==
EActions.REMOVE_QUANTITY)
8796 {
8797 if (IsMagazine())
8798 {
8799 Magazine mag2 = Magazine.Cast(this);
8800 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8801 }
8802 else
8803 {
8805 }
8806 if (m_EM)
8807 {
8808 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8809 }
8810
8811 }
8812
8813 else if (action_id ==
EActions.SET_QUANTITY_0)
8814 {
8816
8817 if (m_EM)
8818 {
8819 m_EM.SetEnergy(0);
8820 }
8821 }
8822
8823 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8824 {
8826
8827 if (m_EM)
8828 {
8829 m_EM.SetEnergy(m_EM.GetEnergyMax());
8830 }
8831 }
8832
8833 else if (action_id ==
EActions.ADD_HEALTH)
8834 {
8835 AddHealth("","",GetMaxHealth("","Health")/5);
8836 }
8837 else if (action_id ==
EActions.REMOVE_HEALTH)
8838 {
8839 AddHealth("","",-GetMaxHealth("","Health")/5);
8840 }
8841 else if (action_id ==
EActions.DESTROY_HEALTH)
8842 {
8843 SetHealth01("","",0);
8844 }
8845 else if (action_id ==
EActions.WATCH_ITEM)
8846 {
8848 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8849 #ifdef DEVELOPER
8850 SetDebugDeveloper_item(this);
8851 #endif
8852 }
8853
8854 else if (action_id ==
EActions.ADD_TEMPERATURE)
8855 {
8856 AddTemperature(20);
8857
8858 }
8859
8860 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8861 {
8862 AddTemperature(-20);
8863
8864 }
8865
8866 else if (action_id ==
EActions.FLIP_FROZEN)
8867 {
8868 SetFrozen(!GetIsFrozen());
8869
8870 }
8871
8872 else if (action_id ==
EActions.ADD_WETNESS)
8873 {
8875
8876 }
8877
8878 else if (action_id ==
EActions.REMOVE_WETNESS)
8879 {
8881
8882 }
8883
8884 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8885 {
8888
8889
8890 }
8891
8892 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8893 {
8896 }
8897
8898 else if (action_id ==
EActions.MAKE_SPECIAL)
8899 {
8900 auto debugParams = DebugSpawnParams.WithPlayer(player);
8901 OnDebugSpawnEx(debugParams);
8902 }
8903
8904 }
8905
8906
8907 return false;
8908 }
8909
8910
8911
8912
8916
8919
8920
8921
8923 {
8924 return false;
8925 }
8926
8927
8929 {
8930 return true;
8931 }
8932
8933
8935 {
8936 return true;
8937 }
8938
8939
8940
8942 {
8943 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8944 return g_Game.ConfigIsExisting(config_path);
8945 }
8946
8949 {
8950 return null;
8951 }
8952
8954 {
8955 return false;
8956 }
8957
8959 {
8960 return false;
8961 }
8962
8966
8967
8969 {
8970 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8971 return module_repairing.CanRepair(this, item_repair_kit);
8972 }
8973
8974
8975 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8976 {
8977 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8978 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8979 }
8980
8981
8983 {
8984
8985
8986
8987
8988
8989
8990
8991
8992 return 1;
8993 }
8994
8995
8996
8998 {
9000 }
9001
9002
9003
9005 {
9007 }
9008
9009
9018 {
9019 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9020
9021 if (player)
9022 {
9023 player.MessageStatus(text);
9024 }
9025 }
9026
9027
9036 {
9037 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9038
9039 if (player)
9040 {
9041 player.MessageAction(text);
9042 }
9043 }
9044
9045
9054 {
9055 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9056
9057 if (player)
9058 {
9059 player.MessageFriendly(text);
9060 }
9061 }
9062
9063
9072 {
9073 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9074
9075 if (player)
9076 {
9077 player.MessageImportant(text);
9078 }
9079 }
9080
9082 {
9083 return true;
9084 }
9085
9086
9087 override bool KindOf(
string tag)
9088 {
9089 bool found = false;
9090 string item_name = this.
GetType();
9092 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9093
9094 int array_size = item_tag_array.Count();
9095 for (int i = 0; i < array_size; i++)
9096 {
9097 if (item_tag_array.Get(i) == tag)
9098 {
9099 found = true;
9100 break;
9101 }
9102 }
9103 return found;
9104 }
9105
9106
9108 {
9109
9110 super.OnRPC(sender, rpc_type,ctx);
9111
9112
9113 switch (rpc_type)
9114 {
9115 #ifndef SERVER
9116 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9117 Param2<bool, string> p = new Param2<bool, string>(false, "");
9118
9120 return;
9121
9122 bool play = p.param1;
9123 string soundSet = p.param2;
9124
9125 if (play)
9126 {
9128 {
9130 {
9132 }
9133 }
9134 else
9135 {
9137 }
9138 }
9139 else
9140 {
9142 }
9143
9144 break;
9145 #endif
9146
9147 }
9148
9150 {
9152 }
9153 }
9154
9155
9156
9157
9159 {
9160 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9161 return plugin.GetID(
name);
9162 }
9163
9165 {
9166 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9167 return plugin.GetName(id);
9168 }
9169
9172 {
9173
9174
9175 int varFlags;
9176 if (!ctx.
Read(varFlags))
9177 return;
9178
9179 if (varFlags & ItemVariableFlags.FLOAT)
9180 {
9182 }
9183 }
9184
9186 {
9187
9188 super.SerializeNumericalVars(floats_out);
9189
9190
9191
9193 {
9195 }
9196
9198 {
9200 }
9201
9203 {
9205 }
9206
9208 {
9213 }
9214
9216 {
9218 }
9219 }
9220
9222 {
9223
9224 super.DeSerializeNumericalVars(floats);
9225
9226
9227 int index = 0;
9228 int mask = Math.Round(floats.Get(index));
9229
9230 index++;
9231
9233 {
9235 {
9237 }
9238 else
9239 {
9240 float quantity = floats.Get(index);
9242 }
9243 index++;
9244 }
9245
9247 {
9248 float wet = floats.Get(index);
9250 index++;
9251 }
9252
9254 {
9255 int liquidtype = Math.Round(floats.Get(index));
9257 index++;
9258 }
9259
9261 {
9263 index++;
9265 index++;
9267 index++;
9269 index++;
9270 }
9271
9273 {
9274 int cleanness = Math.Round(floats.Get(index));
9276 index++;
9277 }
9278 }
9279
9281 {
9282 super.WriteVarsToCTX(ctx);
9283
9284
9286 {
9288 }
9289
9291 {
9293 }
9294
9296 {
9298 }
9299
9301 {
9302 int r,g,b,a;
9308 }
9309
9311 {
9313 }
9314 }
9315
9317 {
9318 if (!super.ReadVarsFromCTX(ctx,version))
9319 return false;
9320
9321 int intValue;
9322 float value;
9323
9324 if (version < 140)
9325 {
9326 if (!ctx.
Read(intValue))
9327 return false;
9328
9329 m_VariablesMask = intValue;
9330 }
9331
9333 {
9334 if (!ctx.
Read(value))
9335 return false;
9336
9338 {
9340 }
9341 else
9342 {
9344 }
9345 }
9346
9347 if (version < 140)
9348 {
9350 {
9351 if (!ctx.
Read(value))
9352 return false;
9353 SetTemperatureDirect(value);
9354 }
9355 }
9356
9358 {
9359 if (!ctx.
Read(value))
9360 return false;
9362 }
9363
9365 {
9366 if (!ctx.
Read(intValue))
9367 return false;
9369 }
9370
9372 {
9373 int r,g,b,a;
9375 return false;
9377 return false;
9379 return false;
9381 return false;
9382
9384 }
9385
9387 {
9388 if (!ctx.
Read(intValue))
9389 return false;
9391 }
9392
9393 if (version >= 138 && version < 140)
9394 {
9396 {
9397 if (!ctx.
Read(intValue))
9398 return false;
9399 SetFrozen(intValue);
9400 }
9401 }
9402
9403 return true;
9404 }
9405
9406
9408 {
9411 {
9413 }
9414
9415 if (!super.OnStoreLoad(ctx, version))
9416 {
9418 return false;
9419 }
9420
9421 if (version >= 114)
9422 {
9423 bool hasQuickBarIndexSaved;
9424
9425 if (!ctx.
Read(hasQuickBarIndexSaved))
9426 {
9428 return false;
9429 }
9430
9431 if (hasQuickBarIndexSaved)
9432 {
9433 int itmQBIndex;
9434
9435
9436 if (!ctx.
Read(itmQBIndex))
9437 {
9439 return false;
9440 }
9441
9442 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9443 if (itmQBIndex != -1 && parentPlayer)
9444 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9445 }
9446 }
9447 else
9448 {
9449
9450 PlayerBase player;
9451 int itemQBIndex;
9452 if (version ==
int.
MAX)
9453 {
9454 if (!ctx.
Read(itemQBIndex))
9455 {
9457 return false;
9458 }
9459 }
9460 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9461 {
9462
9463 if (!ctx.
Read(itemQBIndex))
9464 {
9466 return false;
9467 }
9468 if (itemQBIndex != -1 && player)
9469 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9470 }
9471 }
9472
9473 if (version < 140)
9474 {
9475
9476 if (!LoadVariables(ctx, version))
9477 {
9479 return false;
9480 }
9481 }
9482
9483
9485 {
9487 return false;
9488 }
9489 if (version >= 132)
9490 {
9492 if (raib)
9493 {
9495 {
9497 return false;
9498 }
9499 }
9500 }
9501
9503 return true;
9504 }
9505
9506
9507
9509 {
9510 super.OnStoreSave(ctx);
9511
9512 PlayerBase player;
9513 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9514 {
9516
9517 int itemQBIndex = -1;
9518 itemQBIndex = player.FindQuickBarEntityIndex(this);
9519 ctx.
Write(itemQBIndex);
9520 }
9521 else
9522 {
9524 }
9525
9527
9529 if (raib)
9530 {
9532 }
9533 }
9534
9535
9537 {
9538 super.AfterStoreLoad();
9539
9541 {
9543 }
9544
9546 {
9549 }
9550 }
9551
9553 {
9554 super.EEOnAfterLoad();
9555
9557 {
9559 }
9560
9563 }
9564
9566 {
9567 return false;
9568 }
9569
9570
9571
9573 {
9575 {
9576 #ifdef PLATFORM_CONSOLE
9577
9579 {
9581 if (menu)
9582 {
9584 }
9585 }
9586 #endif
9587 }
9588
9590 {
9593 }
9594
9596 {
9597 SetWeightDirty();
9599 }
9601 {
9604 }
9605
9607 {
9610
9613 }
9615 {
9619 }
9620
9621 super.OnVariablesSynchronized();
9622 }
9623
9624
9625
9627 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9628 {
9629 if (!IsServerCheck(allow_client))
9630 return false;
9631
9633 return false;
9634
9637
9638 if (value <= (min + 0.001))
9639 value = min;
9640
9641 if (value == min)
9642 {
9643 if (destroy_config)
9644 {
9645 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9646 if (dstr)
9647 {
9649 this.Delete();
9650 return true;
9651 }
9652 }
9653 else if (destroy_forced)
9654 {
9656 this.Delete();
9657 return true;
9658 }
9659
9661 }
9662
9665
9667 {
9668 EntityAI parent = GetHierarchyRoot();
9669 InventoryLocation iLoc = new InventoryLocation();
9670 GetInventory().GetCurrentInventoryLocation(iLoc);
9672 {
9673 int iLocSlot = iLoc.
GetSlot();
9675 {
9677 }
9679 {
9681 }
9682 }
9683 }
9684
9686 {
9688
9689 if (delta)
9691 }
9692
9694
9695 return false;
9696 }
9697
9698
9700 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9701 {
9703 }
9704
9706 {
9709 }
9710
9712 {
9715 }
9716
9718 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9719 {
9720 float value_clamped = Math.Clamp(value, 0, 1);
9722 SetQuantity(result, destroy_config, destroy_forced);
9723 }
9724
9725
9728 {
9730 }
9731
9733 {
9735 }
9736
9737
9738
9739
9740
9741
9742
9743
9744
9745
9747 {
9748 int slot = -1;
9749 GameInventory inventory = GetInventory();
9750 if (inventory)
9751 {
9752 InventoryLocation il = new InventoryLocation;
9755 }
9756
9758 }
9759
9761 {
9762 float quantity_max = 0;
9763
9765 {
9766 if (attSlotID != -1)
9767 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9768
9769 if (quantity_max <= 0)
9771 }
9772
9773 if (quantity_max <= 0)
9775
9776 return quantity_max;
9777 }
9778
9780 {
9782 }
9783
9785 {
9787 }
9788
9789
9791 {
9793 }
9794
9796 {
9798 }
9799
9801 {
9803 }
9804
9805
9807 {
9808
9809 float weightEx = GetWeightEx();
9810 float special = GetInventoryAndCargoWeight();
9811 return weightEx - special;
9812 }
9813
9814
9816 {
9818 }
9819
9821 {
9823 {
9824 #ifdef DEVELOPER
9825 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9826 {
9827 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9829 }
9830 #endif
9831
9833 }
9834 else if (HasEnergyManager())
9835 {
9836 #ifdef DEVELOPER
9837 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9838 {
9839 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9840 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9841 }
9842 #endif
9843 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9844 }
9845 else
9846 {
9847 #ifdef DEVELOPER
9848 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9849 {
9850 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9851 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9852 }
9853 #endif
9854 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9855 }
9856 }
9857
9860 {
9861 int item_count = 0;
9863
9864 GameInventory inventory = GetInventory();
9865 CargoBase cargo = inventory.
GetCargo();
9866 if (cargo != NULL)
9867 {
9869 }
9870
9872 for (int i = 0; i < nAttachments; ++i)
9873 {
9875 if (item)
9876 item_count += item.GetNumberOfItems();
9877 }
9878 return item_count;
9879 }
9880
9883 {
9884 float weight = 0;
9885 float wetness = 1;
9886 if (include_wetness)
9889 {
9890 weight = wetness * m_ConfigWeight;
9891 }
9893 {
9894 weight = 1;
9895 }
9896 return weight;
9897 }
9898
9899
9900
9902 {
9903 GameInventory inventory = GetInventory();
9904 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9905 {
9906 array<EntityAI> items = new array<EntityAI>;
9908 for (int i = 0; i < items.Count(); ++i)
9909 {
9911 if (item)
9912 {
9913 g_Game.ObjectDelete(item);
9914 }
9915 }
9916 }
9917 }
9918
9919
9920
9921
9923 {
9924 float energy = 0;
9925 if (HasEnergyManager())
9926 {
9927 energy = GetCompEM().GetEnergy();
9928 }
9929 return energy;
9930 }
9931
9932
9934 {
9935 super.OnEnergyConsumed();
9936
9938 }
9939
9941 {
9942 super.OnEnergyAdded();
9943
9945 }
9946
9947
9949 {
9950 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9951 {
9953 {
9954 float energy_0to1 = GetCompEM().GetEnergy0To1();
9956 }
9957 }
9958 }
9959
9960
9962 {
9963 return ConfigGetFloat("heatIsolation");
9964 }
9965
9967 {
9969 }
9970
9972 {
9973 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9974 if (
g_Game.ConfigIsExisting(paramPath))
9975 return g_Game.ConfigGetFloat(paramPath);
9976
9977 return 0.0;
9978 }
9979
9981 {
9982 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9983 if (
g_Game.ConfigIsExisting(paramPath))
9984 return g_Game.ConfigGetFloat(paramPath);
9985
9986 return 0.0;
9987 }
9988
9989 override void SetWet(
float value,
bool allow_client =
false)
9990 {
9991 if (!IsServerCheck(allow_client))
9992 return;
9993
9996
9998
9999 m_VarWet = Math.Clamp(value, min, max);
10000
10002 {
10005 }
10006 }
10007
10008 override void AddWet(
float value)
10009 {
10011 }
10012
10014 {
10016 }
10017
10019 {
10021 }
10022
10024 {
10026 }
10027
10029 {
10031 }
10032
10034 {
10036 }
10037
10038 override void OnWetChanged(
float newVal,
float oldVal)
10039 {
10042 if (newLevel != oldLevel)
10043 {
10045 }
10046 }
10047
10049 {
10050 SetWeightDirty();
10051 }
10052
10054 {
10055 return GetWetLevelInternal(
m_VarWet);
10056 }
10057
10058
10059
10061 {
10063 }
10064
10066 {
10068 }
10069
10071 {
10073 }
10074
10076 {
10078 }
10079
10080
10081
10083 {
10084 if (ConfigIsExisting("itemModelLength"))
10085 {
10086 return ConfigGetFloat("itemModelLength");
10087 }
10088 return 0;
10089 }
10090
10092 {
10093 if (ConfigIsExisting("itemAttachOffset"))
10094 {
10095 return ConfigGetFloat("itemAttachOffset");
10096 }
10097 return 0;
10098 }
10099
10100 override void SetCleanness(
int value,
bool allow_client =
false)
10101 {
10102 if (!IsServerCheck(allow_client))
10103 return;
10104
10106
10108
10111 }
10112
10114 {
10116 }
10117
10119 {
10120 return true;
10121 }
10122
10123
10124
10125
10127 {
10129 }
10130
10132 {
10134 }
10135
10136
10137
10138
10139 override void SetColor(
int r,
int g,
int b,
int a)
10140 {
10146 }
10148 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10149 {
10154 }
10155
10157 {
10159 }
10160
10163 {
10164 int r,g,b,a;
10166 r = r/255;
10167 g = g/255;
10168 b = b/255;
10169 a = a/255;
10170 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10171 }
10172
10173
10174
10175 override void SetLiquidType(
int value,
bool allow_client =
false)
10176 {
10177 if (!IsServerCheck(allow_client))
10178 return;
10179
10184 }
10185
10187 {
10188 return ConfigGetInt("varLiquidTypeInit");
10189 }
10190
10192 {
10194 }
10195
10197 {
10199 SetFrozen(false);
10200 }
10201
10204 {
10205 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10206 }
10207
10208
10211 {
10212 PlayerBase nplayer;
10213 if (PlayerBase.CastTo(nplayer, player))
10214 {
10216 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10217 }
10218 }
10219
10220
10223 {
10224 PlayerBase nplayer;
10225 if (PlayerBase.CastTo(nplayer,player))
10226 {
10227 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10228 }
10229
10230 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10231
10232 if (HasEnergyManager())
10233 {
10234 GetCompEM().UpdatePlugState();
10235 }
10236 }
10237
10238
10240 {
10241 super.OnPlacementStarted(player);
10242
10244 }
10245
10246 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10247 {
10249 {
10250 m_AdminLog.OnPlacementComplete(player,
this);
10251 }
10252
10253 super.OnPlacementComplete(player, position, orientation);
10254 }
10255
10256
10257
10258
10259
10261 {
10263 {
10264 return true;
10265 }
10266 else
10267 {
10268 return false;
10269 }
10270 }
10271
10272
10274 {
10276 {
10278 }
10279 }
10280
10281
10283 {
10285 }
10286
10288 {
10290 }
10291
10292 override void InsertAgent(
int agent,
float count = 1)
10293 {
10294 if (count < 1)
10295 return;
10296
10298 }
10299
10302 {
10304 }
10305
10306
10308 {
10310 }
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10329
10330
10331
10332
10333
10334
10335
10336
10337
10338
10339
10340
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10354 {
10356 return false;
10357 return true;
10358 }
10359
10361 {
10362
10364 }
10365
10366
10369 {
10370 super.CheckForRoofLimited(timeTresholdMS);
10371
10372 float time =
g_Game.GetTime();
10373 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10374 {
10375 m_PreviousRoofTestTime = time;
10376 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10377 }
10378 }
10379
10380
10382 {
10384 {
10385 return 0;
10386 }
10387
10388 if (GetInventory().GetAttachmentSlotsCount() != 0)
10389 {
10390 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10391 if (filter)
10392 return filter.GetProtectionLevel(type, false, system);
10393 else
10394 return 0;
10395 }
10396
10397 string subclassPath, entryName;
10398
10399 switch (type)
10400 {
10402 entryName = "biological";
10403 break;
10405 entryName = "chemical";
10406 break;
10407 default:
10408 entryName = "biological";
10409 break;
10410 }
10411
10412 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10413
10414 return g_Game.ConfigGetFloat(subclassPath + entryName);
10415 }
10416
10417
10418
10421 {
10422 if (!IsMagazine())
10424
10426 }
10427
10428
10429
10430
10431
10436 {
10437 return true;
10438 }
10439
10441 {
10443 }
10444
10445
10446
10447
10448
10450 {
10451 if (parent)
10452 {
10453 if (parent.IsInherited(DayZInfected))
10454 return true;
10455
10456 if (!parent.IsRuined())
10457 return true;
10458 }
10459
10460 return true;
10461 }
10462
10464 {
10465 if (!super.CanPutAsAttachment(parent))
10466 {
10467 return false;
10468 }
10469
10470 if (!IsRuined() && !parent.IsRuined())
10471 {
10472 return true;
10473 }
10474
10475 return false;
10476 }
10477
10479 {
10480
10481
10482
10483
10484 return super.CanReceiveItemIntoCargo(item);
10485 }
10486
10488 {
10489
10490
10491
10492
10493 GameInventory attachmentInv = attachment.GetInventory();
10495 {
10496 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10497 return false;
10498 }
10499
10500 InventoryLocation loc = new InventoryLocation();
10501 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10502 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10503 return false;
10504
10505 return super.CanReceiveAttachment(attachment, slotId);
10506 }
10507
10509 {
10510 if (!super.CanReleaseAttachment(attachment))
10511 return false;
10512
10513 return GetInventory().AreChildrenAccessible();
10514 }
10515
10516
10517
10518
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10537 {
10538 int id = muzzle_owner.GetMuzzleID();
10539 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10540
10541 if (WPOF_array)
10542 {
10543 for (int i = 0; i < WPOF_array.Count(); i++)
10544 {
10545 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10546
10547 if (WPOF)
10548 {
10549 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10550 }
10551 }
10552 }
10553 }
10554
10555
10557 {
10558 int id = muzzle_owner.GetMuzzleID();
10560
10561 if (WPOBE_array)
10562 {
10563 for (int i = 0; i < WPOBE_array.Count(); i++)
10564 {
10565 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10566
10567 if (WPOBE)
10568 {
10569 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10570 }
10571 }
10572 }
10573 }
10574
10575
10577 {
10578 int id = muzzle_owner.GetMuzzleID();
10579 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10580
10581 if (WPOOH_array)
10582 {
10583 for (int i = 0; i < WPOOH_array.Count(); i++)
10584 {
10585 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10586
10587 if (WPOOH)
10588 {
10589 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10590 }
10591 }
10592 }
10593 }
10594
10595
10597 {
10598 int id = muzzle_owner.GetMuzzleID();
10599 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10600
10601 if (WPOOH_array)
10602 {
10603 for (int i = 0; i < WPOOH_array.Count(); i++)
10604 {
10605 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10606
10607 if (WPOOH)
10608 {
10609 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10610 }
10611 }
10612 }
10613 }
10614
10615
10617 {
10618 int id = muzzle_owner.GetMuzzleID();
10619 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10620
10621 if (WPOOH_array)
10622 {
10623 for (int i = 0; i < WPOOH_array.Count(); i++)
10624 {
10625 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10626
10627 if (WPOOH)
10628 {
10629 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10630 }
10631 }
10632 }
10633 }
10634
10635
10636
10638 {
10640 {
10641 return true;
10642 }
10643
10644 return false;
10645 }
10646
10648 {
10650 {
10651 return true;
10652 }
10653
10654 return false;
10655 }
10656
10658 {
10660 {
10661 return true;
10662 }
10663
10664 return false;
10665 }
10666
10668 {
10669 return false;
10670 }
10671
10674 {
10675 return UATimeSpent.DEFAULT_DEPLOY;
10676 }
10677
10678
10679
10680
10682 {
10684 SetSynchDirty();
10685 }
10686
10688 {
10690 }
10691
10692
10694 {
10695 return false;
10696 }
10697
10700 {
10701 string att_type = "None";
10702
10703 if (ConfigIsExisting("soundAttType"))
10704 {
10705 att_type = ConfigGetString("soundAttType");
10706 }
10707
10709 }
10710
10712 {
10714 }
10715
10716
10717
10718
10719
10725
10727 {
10730
10732 }
10733
10734
10736 {
10738 return;
10739
10741
10744
10747
10748 SoundParameters params = new SoundParameters();
10752 }
10753
10754
10756 {
10758 {
10761
10762 SetSynchDirty();
10763
10766 }
10767 }
10768
10770 {
10772 }
10773
10774
10776 {
10778 return;
10779
10781 SetSynchDirty();
10782
10785 }
10786
10788 {
10791 }
10792
10794 {
10796 }
10797
10798 void OnApply(PlayerBase player);
10799
10801 {
10802 return 1.0;
10803 };
10804
10806 {
10808 }
10809
10811 {
10813 }
10814
10816
10818 {
10819 SetDynamicPhysicsLifeTime(0.01);
10821 }
10822
10824 {
10825 array<string> zone_names = new array<string>;
10826 GetDamageZones(zone_names);
10827 for (int i = 0; i < zone_names.Count(); i++)
10828 {
10829 SetHealthMax(zone_names.Get(i),"Health");
10830 }
10831 SetHealthMax("","Health");
10832 }
10833
10836 {
10837 float global_health = GetHealth01("","Health");
10838 array<string> zones = new array<string>;
10839 GetDamageZones(zones);
10840
10841 for (int i = 0; i < zones.Count(); i++)
10842 {
10843 SetHealth01(zones.Get(i),"Health",global_health);
10844 }
10845 }
10846
10849 {
10850 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10851 }
10852
10854 {
10855 if (!hasRootAsPlayer)
10856 {
10857 if (refParentIB)
10858 {
10859
10860 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10861 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10862
10863 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10864 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10865
10868 }
10869 else
10870 {
10871
10874 }
10875 }
10876 }
10877
10879 {
10881 {
10882 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10883 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10884 {
10885 float heatPermCoef = 1.0;
10887 while (ent)
10888 {
10889 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10890 ent = ent.GetHierarchyParent();
10891 }
10892
10893 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10894 }
10895 }
10896 }
10897
10899 {
10900
10901 EntityAI parent = GetHierarchyParent();
10902 if (!parent)
10903 {
10904 hasParent = false;
10905 hasRootAsPlayer = false;
10906 }
10907 else
10908 {
10909 hasParent = true;
10910 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10911 refParentIB =
ItemBase.Cast(parent);
10912 }
10913 }
10914
10915 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10916 {
10917
10918 }
10919
10921 {
10922
10923 return false;
10924 }
10925
10927 {
10928
10929
10930 return false;
10931 }
10932
10934 {
10935
10936 return false;
10937 }
10938
10941 {
10942 return !GetIsFrozen() &&
IsOpen();
10943 }
10944
10946 {
10947 bool hasParent = false, hasRootAsPlayer = false;
10949
10950 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10951 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10952
10953 if (wwtu || foodDecay)
10954 {
10958
10959 if (processWetness || processTemperature || processDecay)
10960 {
10962
10963 if (processWetness)
10964 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10965
10966 if (processTemperature)
10968
10969 if (processDecay)
10970 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10971 }
10972 }
10973 }
10974
10977 {
10979 }
10980
10982 {
10985
10986 return super.GetTemperatureFreezeThreshold();
10987 }
10988
10990 {
10993
10994 return super.GetTemperatureThawThreshold();
10995 }
10996
10998 {
11001
11002 return super.GetItemOverheatThreshold();
11003 }
11004
11006 {
11008 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11009
11010 return super.GetTemperatureFreezeTime();
11011 }
11012
11014 {
11016 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11017
11018 return super.GetTemperatureThawTime();
11019 }
11020
11025
11027 {
11028 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11029 }
11030
11032 {
11033 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11034 }
11035
11038 {
11040 }
11041
11043 {
11045 }
11046
11048 {
11050 }
11051
11054 {
11055 return null;
11056 }
11057
11060 {
11061 return false;
11062 }
11063
11065 {
11067 {
11070 if (!trg)
11071 {
11073 explosive = this;
11074 }
11075
11076 explosive.PairRemote(trg);
11078
11079 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11080 trg.SetPersistentPairID(persistentID);
11081 explosive.SetPersistentPairID(persistentID);
11082
11083 return true;
11084 }
11085 return false;
11086 }
11087
11090 {
11091 float ret = 1.0;
11094 ret *= GetHealth01();
11095
11096 return ret;
11097 }
11098
11099 #ifdef DEVELOPER
11100 override void SetDebugItem()
11101 {
11102 super.SetDebugItem();
11103 _itemBase = this;
11104 }
11105
11107 {
11108 string text = super.GetDebugText();
11109
11111 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11112
11113 return text;
11114 }
11115 #endif
11116
11118 {
11119 return true;
11120 }
11121
11123
11125
11127 {
11130 }
11131
11132
11140
11156
11157 [
Obsolete(
"Use ItemSoundHandler instead")]
11160 {
11161 if (!
g_Game.IsDedicatedServer())
11162 {
11163 if (ConfigIsExisting("attachSoundSet"))
11164 {
11165 string cfg_path = "";
11166 string soundset = "";
11167 string type_name =
GetType();
11168
11171 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11172 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11173
11174 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11175 {
11176 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11177 {
11178 if (cfg_slot_array[i] == slot_type)
11179 {
11180 soundset = cfg_soundset_array[i];
11181 break;
11182 }
11183 }
11184 }
11185
11186 if (soundset != "")
11187 {
11188 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11190 }
11191 }
11192 }
11193 }
11194
11196}
11197
11199{
11201 if (entity)
11202 {
11203 bool is_item = entity.IsInherited(
ItemBase);
11204 if (is_item && full_quantity)
11205 {
11208 }
11209 }
11210 else
11211 {
11213 return NULL;
11214 }
11215 return entity;
11216}
11217
11219{
11220 if (item)
11221 {
11222 if (health > 0)
11223 item.SetHealth("", "", health);
11224
11225 if (item.CanHaveTemperature())
11226 {
11228 if (item.CanFreeze())
11229 item.SetFrozen(false);
11230 }
11231
11232 if (item.HasEnergyManager())
11233 {
11234 if (quantity >= 0)
11235 {
11236 item.GetCompEM().SetEnergy0To1(quantity);
11237 }
11238 else
11239 {
11241 }
11242 }
11243 else if (item.IsMagazine())
11244 {
11245 Magazine mag = Magazine.Cast(item);
11246 if (quantity >= 0)
11247 {
11248 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11249 }
11250 else
11251 {
11253 }
11254
11255 }
11256 else
11257 {
11258 if (quantity >= 0)
11259 {
11260 item.SetQuantityNormalized(quantity, false);
11261 }
11262 else
11263 {
11265 }
11266
11267 }
11268 }
11269}
11270
11271#ifdef DEVELOPER
11273#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.