6269{
6271 {
6272 return true;
6273 }
6274};
6275
6277{
6278
6279};
6280
6281
6282
6284{
6288
6290
6293
6294
6295
6296
6297
6306
6312
6317
6322
6343 protected bool m_IsResultOfSplit
6344
6346
6351
6352
6353
6355
6359
6360
6361
6363
6366
6367
6368
6374
6375
6383
6386
6387
6389
6390
6392
6393
6398
6399
6404
6406
6407
6409
6410
6412 {
6417
6418 if (!
g_Game.IsDedicatedServer())
6419 {
6421 {
6423
6425 {
6427 }
6428 }
6429
6432 }
6433
6434 m_OldLocation = null;
6435
6437 {
6439 }
6440
6441 if (ConfigIsExisting("headSelectionsToHide"))
6442 {
6445 }
6446
6448 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6449 {
6451 }
6452
6454
6455 m_IsResultOfSplit = false;
6456
6458 }
6459
6461 {
6462 super.InitItemVariables();
6463
6469 m_Count = ConfigGetInt(
"count");
6470
6473
6478
6481
6486
6498
6502
6503
6506 if (ConfigIsExisting("canBeSplit"))
6507 {
6510 }
6511
6513 if (ConfigIsExisting("itemBehaviour"))
6515
6516
6519 RegisterNetSyncVariableInt("m_VarLiquidType");
6520 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6521
6522 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6523 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6524 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6525
6526 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6527 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6528 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6529 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6530
6531 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6532 RegisterNetSyncVariableBool("m_IsTakeable");
6533 RegisterNetSyncVariableBool("m_IsHologram");
6534
6537 {
6540 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6541 }
6542
6544
6546 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6548
6550 }
6551
6553 {
6555 }
6556
6558 {
6561 {
6566 }
6567 }
6568
6569 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6570 {
6572 {
6575 }
6576
6578 }
6579
6581 {
6587 }
6588
6590
6592 {
6594
6595 if (!action)
6596 {
6597 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6598 return;
6599 }
6600
6602 if (!ai)
6603 {
6605 return;
6606 }
6607
6609 if (!action_array)
6610 {
6611 action_array = new array<ActionBase_Basic>;
6613 }
6614 if (LogManager.IsActionLogEnable())
6615 {
6616 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6617 }
6618
6619 if (action_array.Find(action) != -1)
6620 {
6621 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6622 }
6623 else
6624 {
6625 action_array.Insert(action);
6626 }
6627 }
6628
6630 {
6631 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6632 ActionBase action = player.GetActionManager().GetAction(actionName);
6635
6636 if (action_array)
6637 {
6638 action_array.RemoveItem(action);
6639 }
6640 }
6641
6642
6643
6645 {
6646 ActionOverrideData overrideData = new ActionOverrideData();
6650
6652 if (!actionMap)
6653 {
6656 }
6657
6658 actionMap.Insert(this.
Type(), overrideData);
6659
6660 }
6661
6663
6665
6666
6668 {
6671
6674
6675 string config_to_search = "CfgVehicles";
6676 string muzzle_owner_config;
6677
6679 {
6680 if (IsInherited(Weapon))
6681 config_to_search = "CfgWeapons";
6682
6683 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6684
6685 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6686
6687 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6688
6689 if (config_OnFire_subclass_count > 0)
6690 {
6691 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6692
6693 for (int i = 0; i < config_OnFire_subclass_count; i++)
6694 {
6695 string particle_class = "";
6696 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6697 string config_OnFire_entry = config_OnFire_class + particle_class;
6698 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6699 WPOF_array.Insert(WPOF);
6700 }
6701
6702
6704 }
6705 }
6706
6708 {
6709 config_to_search = "CfgWeapons";
6710 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6711
6712 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6713
6714 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6715
6716 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6717 {
6718 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6719
6720 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6721 {
6722 string particle_class2 = "";
6723 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6724 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6725 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6726 WPOBE_array.Insert(WPOBE);
6727 }
6728
6729
6731 }
6732 }
6733 }
6734
6735
6737 {
6740
6742 {
6743 string config_to_search = "CfgVehicles";
6744
6745 if (IsInherited(Weapon))
6746 config_to_search = "CfgWeapons";
6747
6748 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6749 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6750
6751 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6752 {
6753
6755
6757 {
6759 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6761 return;
6762 }
6763
6766
6767
6768
6769 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6770 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6771
6772 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6773 {
6774 string particle_class = "";
6775 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6776 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6777 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6778
6779 if (entry_type == CT_CLASS)
6780 {
6781 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6782 WPOOH_array.Insert(WPOF);
6783 }
6784 }
6785
6786
6788 }
6789 }
6790 }
6791
6793 {
6795 }
6796
6798 {
6800 {
6802
6805
6808
6809 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6810 }
6811 }
6812
6814 {
6816 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6817
6819 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6820
6822 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6823
6825 {
6827 }
6828 }
6829
6831 {
6833 }
6834
6836 {
6839 else
6841
6843 {
6846 }
6847 else
6848 {
6851
6854 }
6855
6857 }
6858
6860 {
6862 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6863 }
6864
6866 {
6868 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6870 }
6871
6873 {
6875 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6876 }
6877
6879 {
6882
6883 OverheatingParticle OP = new OverheatingParticle();
6888
6890 }
6891
6893 {
6896
6897 return -1;
6898 }
6899
6901 {
6903 {
6906
6907 for (int i = count; i > 0; --i)
6908 {
6909 int id = i - 1;
6912
6915
6916 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6917 {
6918 if (p)
6919 {
6922 }
6923 }
6924 }
6925 }
6926 }
6927
6929 {
6931 {
6933 {
6934 int id = i - 1;
6936
6937 if (OP)
6938 {
6940
6941 if (p)
6942 {
6944 }
6945
6946 delete OP;
6947 }
6948 }
6949
6952 }
6953 }
6954
6957 {
6958 return 0.0;
6959 }
6960
6961
6963 {
6964 return 250;
6965 }
6966
6968 {
6969 return 0;
6970 }
6971
6974 {
6976 return true;
6977
6978 return false;
6979 }
6980
6983 {
6986
6988 {
6990 }
6991 else
6992 {
6993
6995 }
6996
6998 }
6999
7006 {
7007 return -1;
7008 }
7009
7010
7011
7012
7014 {
7016 {
7017 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7018 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7019
7020 if (r_index >= 0)
7021 {
7022 InventoryLocation r_il = new InventoryLocation;
7023 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7024
7025 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7028 {
7029 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7030 }
7032 {
7033 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7034 }
7035
7036 }
7037
7038 player.GetHumanInventory().ClearUserReservedLocation(this);
7039 }
7040
7043 }
7044
7045
7046
7047
7049 {
7050 return ItemBase.m_DebugActionsMask;
7051 }
7052
7054 {
7055 return ItemBase.m_DebugActionsMask & mask;
7056 }
7057
7059 {
7060 ItemBase.m_DebugActionsMask = mask;
7061 }
7062
7064 {
7065 ItemBase.m_DebugActionsMask |= mask;
7066 }
7067
7069 {
7070 ItemBase.m_DebugActionsMask &= ~mask;
7071 }
7072
7074 {
7076 {
7078 }
7079 else
7080 {
7082 }
7083 }
7084
7085
7087 {
7088 if (GetEconomyProfile())
7089 {
7090 float q_max = GetEconomyProfile().GetQuantityMax();
7091 if (q_max > 0)
7092 {
7093 float q_min = GetEconomyProfile().GetQuantityMin();
7094 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7095
7097 {
7098 ComponentEnergyManager comp = GetCompEM();
7100 {
7102 }
7103 }
7105 {
7107
7108 }
7109
7110 }
7111 }
7112 }
7113
7116 {
7117 EntityAI parent = GetHierarchyParent();
7118
7119 if (parent)
7120 {
7121 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7122 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7123 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7124 }
7125 }
7126
7129 {
7130 EntityAI parent = GetHierarchyParent();
7131
7132 if (parent)
7133 {
7134 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7135 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7136 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7137 }
7138 }
7139
7141 {
7142
7143
7144
7145
7147
7149 {
7150 if (ScriptInputUserData.CanStoreInputUserData())
7151 {
7152 ScriptInputUserData ctx = new ScriptInputUserData;
7158 ctx.
Write(use_stack_max);
7161
7163 {
7164 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7165 }
7166 }
7167 }
7168 else if (!
g_Game.IsMultiplayer())
7169 {
7171 }
7172 }
7173
7175 {
7177 }
7178
7180 {
7182 }
7183
7185 {
7187 }
7188
7190 {
7191
7192 return false;
7193 }
7194
7196 {
7197 return false;
7198 }
7199
7203 {
7204 return false;
7205 }
7206
7208 {
7209 return "";
7210 }
7211
7213
7215 {
7216 return false;
7217 }
7218
7220 {
7221 return true;
7222 }
7223
7224
7225
7227 {
7228 return true;
7229 }
7230
7232 {
7233 return true;
7234 }
7235
7237 {
7238 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7240 }
7241
7243 {
7245 }
7246
7248 {
7250 if (!is_being_placed)
7252 SetSynchDirty();
7253 }
7254
7255
7257
7259 {
7261 }
7262
7264 {
7266 }
7267
7269 {
7270 return 1;
7271 }
7272
7274 {
7275 return false;
7276 }
7277
7279 {
7281 SetSynchDirty();
7282 }
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
7319 {
7320 super.OnMovedInsideCargo(container);
7321
7322 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7323 }
7324
7325 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7326 {
7327 super.EEItemLocationChanged(oldLoc, newLoc);
7328
7329 PlayerBase newPlayer = null;
7330 PlayerBase oldPlayer = null;
7331
7332 if (newLoc.GetParent())
7333 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7334
7335 if (oldLoc.GetParent())
7336 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7337
7339 {
7340 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7341
7342 if (rIndex >= 0)
7343 {
7344 InventoryLocation rIl = new InventoryLocation;
7345 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7346
7347 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7350 {
7351 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7352 }
7354 {
7356 }
7357
7358 }
7359 }
7360
7362 {
7363 if (newPlayer)
7364 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7365
7366 if (newPlayer == oldPlayer)
7367 {
7368 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7369 {
7371 {
7372 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7373 {
7374 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7375 }
7376 }
7377 else
7378 {
7379 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7380 }
7381 }
7382
7383 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7384 {
7385 int type = oldLoc.GetType();
7387 {
7388 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7389 }
7391 {
7392 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7393 }
7394 }
7395 if (!m_OldLocation)
7396 {
7397 m_OldLocation = new InventoryLocation;
7398 }
7399 m_OldLocation.Copy(oldLoc);
7400 }
7401 else
7402 {
7403 if (m_OldLocation)
7404 {
7405 m_OldLocation.Reset();
7406 }
7407 }
7408
7409 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7410 }
7411 else
7412 {
7413 if (newPlayer)
7414 {
7415 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7416 if (resIndex >= 0)
7417 {
7418 InventoryLocation il = new InventoryLocation;
7419 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7421 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7424 {
7425 il.
GetParent().GetOnReleaseLock().Invoke(it);
7426 }
7428 {
7430 }
7431
7432 }
7433 }
7435 {
7436
7438 }
7439
7440 if (m_OldLocation)
7441 {
7442 m_OldLocation.Reset();
7443 }
7444 }
7445
7447 {
7448 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7449 }
7450
7452 {
7453 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7454 }
7455 }
7456
7457 override void EOnContact(IEntity other, Contact extra)
7458 {
7460 {
7461 int liquidType = -1;
7463 if (impactSpeed > 0.0)
7464 {
7466 #ifndef SERVER
7468 #else
7470 SetSynchDirty();
7471 #endif
7473 }
7474 }
7475
7476 #ifdef SERVER
7477 if (GetCompEM() && GetCompEM().IsPlugged())
7478 {
7479 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7480 GetCompEM().UnplugThis();
7481 }
7482 #endif
7483 }
7484
7486
7488 {
7490 }
7491
7493 {
7494
7495 }
7496
7498 {
7499 super.OnItemLocationChanged(old_owner, new_owner);
7500
7501 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7502 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7503
7504 if (!relatedPlayer && playerNew)
7505 relatedPlayer = playerNew;
7506
7507 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7508 {
7510 if (actionMgr)
7511 {
7512 ActionBase currentAction = actionMgr.GetRunningAction();
7513 if (currentAction)
7515 }
7516 }
7517
7518 Man ownerPlayerOld = null;
7519 Man ownerPlayerNew = null;
7520
7521 if (old_owner)
7522 {
7523 if (old_owner.
IsMan())
7524 {
7525 ownerPlayerOld = Man.Cast(old_owner);
7526 }
7527 else
7528 {
7529 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7530 }
7531 }
7532 else
7533 {
7535 {
7537
7538 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7539 {
7540 GetCompEM().UnplugThis();
7541 }
7542 }
7543 }
7544
7545 if (new_owner)
7546 {
7547 if (new_owner.
IsMan())
7548 {
7549 ownerPlayerNew = Man.Cast(new_owner);
7550 }
7551 else
7552 {
7553 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7554 }
7555 }
7556
7557 if (ownerPlayerOld != ownerPlayerNew)
7558 {
7559 if (ownerPlayerOld)
7560 {
7561 array<EntityAI> subItemsExit = new array<EntityAI>;
7563 for (int i = 0; i < subItemsExit.Count(); i++)
7564 {
7567 }
7568 }
7569
7570 if (ownerPlayerNew)
7571 {
7572 array<EntityAI> subItemsEnter = new array<EntityAI>;
7574 for (int j = 0; j < subItemsEnter.Count(); j++)
7575 {
7578 }
7579 }
7580 }
7581 else if (ownerPlayerNew != null)
7582 {
7583 PlayerBase nplayer;
7584 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7585 {
7586 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7588 for (int k = 0; k < subItemsUpdate.Count(); k++)
7589 {
7591 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7592 }
7593 }
7594 }
7595
7596 if (old_owner)
7597 old_owner.OnChildItemRemoved(this);
7598 if (new_owner)
7599 new_owner.OnChildItemReceived(this);
7600 }
7601
7602
7604 {
7605 super.EEDelete(parent);
7606 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7607 if (player)
7608 {
7610
7611 if (player.IsAlive())
7612 {
7613 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7614 if (r_index >= 0)
7615 {
7616 InventoryLocation r_il = new InventoryLocation;
7617 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7618
7619 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7622 {
7623 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7624 }
7626 {
7627 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7628 }
7629
7630 }
7631
7632 player.RemoveQuickBarEntityShortcut(this);
7633 }
7634 }
7635 }
7636
7638 {
7639 super.EEKilled(killer);
7640
7643 {
7644 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7645 {
7646 if (IsMagazine())
7647 {
7648 if (Magazine.Cast(this).GetAmmoCount() > 0)
7649 {
7651 }
7652 }
7653 else
7654 {
7656 }
7657 }
7658 }
7659 }
7660
7662 {
7663 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7664
7665 super.OnWasAttached(parent, slot_id);
7666
7669
7672 }
7673
7675 {
7676 super.OnWasDetached(parent, slot_id);
7677
7680
7683 }
7684
7686 {
7687 int idx;
7690
7691 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7692 if (inventory_slots.Count() < 1)
7693 {
7694 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7695 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7696 }
7697 else
7698 {
7699 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7700 }
7701
7702 idx = inventory_slots.Find(slot);
7703 if (idx < 0)
7704 return "";
7705
7706 return attach_types.Get(idx);
7707 }
7708
7710 {
7711 int idx = -1;
7712 string slot;
7713
7716
7717 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7718 if (inventory_slots.Count() < 1)
7719 {
7720 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7721 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7722 }
7723 else
7724 {
7725 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7726 if (detach_types.Count() < 1)
7727 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7728 }
7729
7730 for (int i = 0; i < inventory_slots.Count(); i++)
7731 {
7732 slot = inventory_slots.Get(i);
7733 }
7734
7735 if (slot != "")
7736 {
7737 if (detach_types.Count() == 1)
7738 idx = 0;
7739 else
7740 idx = inventory_slots.Find(slot);
7741 }
7742 if (idx < 0)
7743 return "";
7744
7745 return detach_types.Get(idx);
7746 }
7747
7749 {
7750
7752
7753
7754 float min_time = 1;
7755 float max_time = 3;
7756 float delay = Math.RandomFloat(min_time, max_time);
7757
7758 explode_timer.Run(delay, this, "DoAmmoExplosion");
7759 }
7760
7762 {
7763 Magazine magazine = Magazine.Cast(this);
7764 int pop_sounds_count = 6;
7765 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7766
7767
7768 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7769 string sound_name = pop_sounds[ sound_idx ];
7770 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7771
7772
7773 magazine.ServerAddAmmoCount(-1);
7774
7775
7776 float min_temp_to_explode = 100;
7777
7778 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7779 {
7781 }
7782 }
7783
7784
7785 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7786 {
7787 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7788
7789 const int CHANCE_DAMAGE_CARGO = 4;
7790 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7791 const int CHANCE_DAMAGE_NOTHING = 2;
7792
7794 {
7795 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7796 int chances;
7797 int rnd;
7798
7799 if (GetInventory().GetCargo())
7800 {
7801 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7802 rnd = Math.RandomInt(0,chances);
7803
7804 if (rnd < CHANCE_DAMAGE_CARGO)
7805 {
7807 }
7808 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7809 {
7811 }
7812 }
7813 else
7814 {
7815 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7816 rnd = Math.RandomInt(0,chances);
7817
7818 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7819 {
7821 }
7822 }
7823 }
7824 }
7825
7827 {
7828 CargoBase cargo = GetInventory().GetCargo();
7829 if (cargo)
7830 {
7832 if (item_count > 0)
7833 {
7834 int random_pick = Math.RandomInt(0, item_count);
7836 if (!item.IsExplosive())
7837 {
7838 item.AddHealth("","",damage);
7839 return true;
7840 }
7841 }
7842 }
7843 return false;
7844 }
7845
7847 {
7848 GameInventory inventory = GetInventory();
7850 if (attachment_count > 0)
7851 {
7852 int random_pick = Math.RandomInt(0, attachment_count);
7854 if (!attachment.IsExplosive())
7855 {
7856 attachment.AddHealth("","",damage);
7857 return true;
7858 }
7859 }
7860 return false;
7861 }
7862
7864 {
7866 }
7867
7869 {
7871 return GetInventory().CanRemoveEntity();
7872
7873 return false;
7874 }
7875
7877 {
7878
7880 return false;
7881
7882
7884 return false;
7885
7886
7887
7889 if (delta == 0)
7890 return false;
7891
7892
7893 return true;
7894 }
7895
7897 {
7899 {
7900 if (ScriptInputUserData.CanStoreInputUserData())
7901 {
7902 ScriptInputUserData ctx = new ScriptInputUserData;
7907 ctx.
Write(destination_entity);
7911 }
7912 }
7913 else if (!
g_Game.IsMultiplayer())
7914 {
7916 }
7917 }
7918
7920 {
7921 float split_quantity_new;
7925 InventoryLocation loc = new InventoryLocation;
7926
7927 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7928 {
7930 split_quantity_new = stack_max;
7931 else
7933
7935 {
7936 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7937 if (new_item)
7938 {
7939 new_item.SetResultOfSplit(true);
7940 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7942 new_item.
SetQuantity(split_quantity_new,
false,
true);
7943 }
7944 }
7945 }
7946 else if (destination_entity && slot_id == -1)
7947 {
7948 if (quantity > stack_max)
7949 split_quantity_new = stack_max;
7950 else
7951 split_quantity_new = quantity;
7952
7954 {
7955 GameInventory destinationInventory = destination_entity.GetInventory();
7957 {
7960 }
7961
7962 if (new_item)
7963 {
7964 new_item.SetResultOfSplit(true);
7965 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7967 new_item.
SetQuantity(split_quantity_new,
false,
true);
7968 }
7969 }
7970 }
7971 else
7972 {
7973 if (stack_max != 0)
7974 {
7976 {
7978 }
7979
7980 if (split_quantity_new == 0)
7981 {
7982 if (!
g_Game.IsMultiplayer())
7983 player.PhysicalPredictiveDropItem(this);
7984 else
7985 player.ServerDropEntity(this);
7986 return;
7987 }
7988
7990 {
7992
7993 if (new_item)
7994 {
7995 new_item.SetResultOfSplit(true);
7996 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7999 new_item.PlaceOnSurface();
8000 }
8001 }
8002 }
8003 }
8004 }
8005
8007 {
8008 float split_quantity_new;
8012 InventoryLocation loc = new InventoryLocation;
8013
8014 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8015 {
8017 split_quantity_new = stack_max;
8018 else
8020
8022 {
8023 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8024 if (new_item)
8025 {
8026 new_item.SetResultOfSplit(true);
8027 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8029 new_item.
SetQuantity(split_quantity_new,
false,
true);
8030 }
8031 }
8032 }
8033 else if (destination_entity && slot_id == -1)
8034 {
8035 if (quantity > stack_max)
8036 split_quantity_new = stack_max;
8037 else
8038 split_quantity_new = quantity;
8039
8041 {
8042 GameInventory destinationInventory = destination_entity.GetInventory();
8044 {
8047 }
8048
8049 if (new_item)
8050 {
8051 new_item.SetResultOfSplit(true);
8052 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8054 new_item.
SetQuantity(split_quantity_new,
false,
true);
8055 }
8056 }
8057 }
8058 else
8059 {
8060 if (stack_max != 0)
8061 {
8063 {
8065 }
8066
8068 {
8070
8071 if (new_item)
8072 {
8073 new_item.SetResultOfSplit(true);
8074 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8077 new_item.PlaceOnSurface();
8078 }
8079 }
8080 }
8081 }
8082 }
8083
8085 {
8087 {
8088 if (ScriptInputUserData.CanStoreInputUserData())
8089 {
8090 ScriptInputUserData ctx = new ScriptInputUserData;
8095 dst.WriteToContext(ctx);
8097 }
8098 }
8099 else if (!
g_Game.IsMultiplayer())
8100 {
8102 }
8103 }
8104
8106 {
8108 {
8109 if (ScriptInputUserData.CanStoreInputUserData())
8110 {
8111 ScriptInputUserData ctx = new ScriptInputUserData;
8116 ctx.
Write(destination_entity);
8122 }
8123 }
8124 else if (!
g_Game.IsMultiplayer())
8125 {
8127 }
8128 }
8129
8131 {
8133 }
8134
8136 {
8138 float split_quantity_new;
8140 if (dst.IsValid())
8141 {
8142 int slot_id = dst.GetSlot();
8144
8145 if (quantity > stack_max)
8146 split_quantity_new = stack_max;
8147 else
8148 split_quantity_new = quantity;
8149
8151 {
8153
8154 if (new_item)
8155 {
8156 new_item.SetResultOfSplit(true);
8157 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8159 new_item.
SetQuantity(split_quantity_new,
false,
true);
8160 }
8161
8162 return new_item;
8163 }
8164 }
8165
8166 return null;
8167 }
8168
8170 {
8172 float split_quantity_new;
8174 if (destination_entity)
8175 {
8177 if (quantity > stackable)
8178 split_quantity_new = stackable;
8179 else
8180 split_quantity_new = quantity;
8181
8183 {
8184 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8185 if (new_item)
8186 {
8187 new_item.SetResultOfSplit(true);
8188 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8190 new_item.
SetQuantity(split_quantity_new,
false,
true);
8191 }
8192 }
8193 }
8194 }
8195
8197 {
8199 {
8200 if (ScriptInputUserData.CanStoreInputUserData())
8201 {
8202 ScriptInputUserData ctx = new ScriptInputUserData;
8207 ItemBase destination_entity =
this;
8208 ctx.
Write(destination_entity);
8212 }
8213 }
8214 else if (!
g_Game.IsMultiplayer())
8215 {
8217 }
8218 }
8219
8221 {
8223 float split_quantity_new;
8225 if (player)
8226 {
8228 if (quantity > stackable)
8229 split_quantity_new = stackable;
8230 else
8231 split_quantity_new = quantity;
8232
8234 {
8235 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8236 new_item =
ItemBase.Cast(in_hands);
8237 if (new_item)
8238 {
8239 new_item.SetResultOfSplit(true);
8240 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8242 new_item.SetQuantity(split_quantity_new, false, true);
8243 }
8244 }
8245 }
8246 }
8247
8249 {
8251 float split_quantity_new = Math.Floor(quantity * 0.5);
8252
8254 return;
8255
8257
8258 if (new_item)
8259 {
8260 if (new_item.GetQuantityMax() < split_quantity_new)
8261 {
8262 split_quantity_new = new_item.GetQuantityMax();
8263 }
8264
8265 new_item.SetResultOfSplit(true);
8266 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8267
8269 {
8272 }
8273 else
8274 {
8276 new_item.
SetQuantity(split_quantity_new,
false,
true);
8277 }
8278 }
8279 }
8280
8282 {
8284 float split_quantity_new = Math.Floor(quantity / 2);
8285
8287 return;
8288
8289 InventoryLocation invloc = new InventoryLocation;
8291
8293 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8294
8295 if (new_item)
8296 {
8297 if (new_item.GetQuantityMax() < split_quantity_new)
8298 {
8299 split_quantity_new = new_item.GetQuantityMax();
8300 }
8302 {
8305 }
8306 else if (split_quantity_new > 1)
8307 {
8309 new_item.
SetQuantity(split_quantity_new,
false,
true);
8310 }
8311 }
8312 }
8313
8316 {
8317 SetWeightDirty();
8319
8320 if (parent)
8321 parent.OnAttachmentQuantityChangedEx(this, delta);
8322
8324 {
8326 {
8328 }
8330 {
8331 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8333 }
8334 }
8335 }
8336
8339 {
8340
8341 }
8342
8345 {
8347 }
8348
8350 {
8351 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8352
8354 {
8355 if (newLevel == GameConstants.STATE_RUINED)
8356 {
8358 EntityAI parent = GetHierarchyParent();
8359 if (parent && parent.IsFireplace())
8360 {
8361 CargoBase cargo = GetInventory().GetCargo();
8362 if (cargo)
8363 {
8365 {
8367 }
8368 }
8369 }
8370 }
8371
8373 {
8374
8376 return;
8377 }
8378
8379 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8380 {
8382 }
8383 }
8384 }
8385
8386
8388 {
8389 super.OnRightClick();
8390
8392 {
8394 {
8395 if (ScriptInputUserData.CanStoreInputUserData())
8396 {
8397 EntityAI root = GetHierarchyRoot();
8398 Man playerOwner = GetHierarchyRootPlayer();
8399 InventoryLocation dst = new InventoryLocation;
8400
8401
8402 if (!playerOwner && root && root == this)
8403 {
8405 }
8406 else
8407 {
8408
8409 GetInventory().GetCurrentInventoryLocation(dst);
8411 {
8412 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8414 {
8416 }
8417 else
8418 {
8420
8421
8422 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8423 {
8425 }
8426 else
8427 {
8428 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8429 }
8430 }
8431 }
8432 }
8433
8434 ScriptInputUserData ctx = new ScriptInputUserData;
8442 }
8443 }
8444 else if (!
g_Game.IsMultiplayer())
8445 {
8447 }
8448 }
8449 }
8450
8452 {
8453 if (root)
8454 {
8455 vector m4[4];
8456 root.GetTransform(m4);
8457 dst.SetGround(this, m4);
8458 }
8459 else
8460 {
8461 GetInventory().GetCurrentInventoryLocation(dst);
8462 }
8463 }
8464
8465 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8466 {
8467
8468 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8469 return false;
8470
8471 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8472 return false;
8473
8474
8476 return false;
8477
8478
8479 Magazine mag = Magazine.Cast(this);
8480 if (mag)
8481 {
8482 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8483 return false;
8484
8485 if (stack_max_limit)
8486 {
8487 Magazine other_mag = Magazine.Cast(other_item);
8488 if (other_item)
8489 {
8490 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8491 return false;
8492 }
8493
8494 }
8495 }
8496 else
8497 {
8498
8500 return false;
8501
8503 return false;
8504 }
8505
8506 PlayerBase player = null;
8507 if (CastTo(player, GetHierarchyRootPlayer()))
8508 {
8509 if (player.GetInventory().HasAttachment(this))
8510 return false;
8511
8512 if (player.IsItemsToDelete())
8513 return false;
8514 }
8515
8516 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8517 return false;
8518
8519 int slotID;
8521 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8522 return false;
8523
8524 return true;
8525 }
8526
8528 {
8530 }
8531
8533 {
8534 return m_IsResultOfSplit;
8535 }
8536
8538 {
8539 m_IsResultOfSplit = value;
8540 }
8541
8543 {
8545 }
8546
8548 {
8549 float other_item_quantity = other_item.GetQuantity();
8550 float this_free_space;
8551
8553
8555
8556 if (other_item_quantity > this_free_space)
8557 {
8558 return this_free_space;
8559 }
8560 else
8561 {
8562 return other_item_quantity;
8563 }
8564 }
8565
8567 {
8569 }
8570
8572 {
8574 return;
8575
8576 if (!IsMagazine() && other_item)
8577 {
8579 if (quantity_used != 0)
8580 {
8581 float hp1 = GetHealth01("","");
8582 float hp2 = other_item.GetHealth01("","");
8583 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8584 hpResult = hpResult / (
GetQuantity() + quantity_used);
8585
8586 hpResult *= GetMaxHealth();
8587 Math.Round(hpResult);
8588 SetHealth("", "Health", hpResult);
8589
8591 other_item.AddQuantity(-quantity_used);
8592 }
8593 }
8595 }
8596
8598 {
8599 #ifdef SERVER
8600 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8601 GetHierarchyParent().IncreaseLifetimeUp();
8602 #endif
8603 };
8604
8606 {
8607 PlayerBase p = PlayerBase.Cast(player);
8608
8609 array<int> recipesIds = p.m_Recipes;
8610 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8611 if (moduleRecipesManager)
8612 {
8613 EntityAI itemInHands = player.GetEntityInHands();
8614 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8615 }
8616
8617 for (int i = 0;i < recipesIds.Count(); i++)
8618 {
8619 int key = recipesIds.Get(i);
8620 string recipeName = moduleRecipesManager.GetRecipeName(key);
8622 }
8623 }
8624
8625
8626 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8627 {
8628 super.GetDebugActions(outputList);
8629
8630
8636
8637
8642
8647
8648
8652
8653
8655 {
8659 }
8660
8663
8664
8668
8670
8671 InventoryLocation loc = new InventoryLocation();
8672 GetInventory().GetCurrentInventoryLocation(loc);
8674 {
8675 if (Gizmo_IsSupported())
8678 }
8679
8681 }
8682
8683
8684
8685
8687 {
8688 super.OnAction(action_id, player, ctx);
8689
8691 {
8692 switch (action_id)
8693 {
8697 return true;
8701 return true;
8702 }
8703 }
8704
8706 {
8707 switch (action_id)
8708 {
8710 Delete();
8711 return true;
8712 }
8713 }
8714
8715 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8716 {
8717 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8718 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8719 PlayerBase p = PlayerBase.Cast(player);
8720 if (
EActions.RECIPES_RANGE_START < 1000)
8721 {
8722 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8723 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8724 }
8725 }
8726 #ifndef SERVER
8727 else if (action_id ==
EActions.WATCH_PLAYER)
8728 {
8729 PluginDeveloper.SetDeveloperItemClientEx(player);
8730 }
8731 #endif
8733 {
8734 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8735 {
8736 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8737 OnDebugButtonPressServer(id + 1);
8738 }
8739
8740 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8741 {
8742 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8744 }
8745
8746 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8747 {
8748 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8750 }
8751
8752 else if (action_id ==
EActions.ADD_QUANTITY)
8753 {
8754 if (IsMagazine())
8755 {
8756 Magazine mag = Magazine.Cast(this);
8757 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8758 }
8759 else
8760 {
8762 }
8763
8764 if (m_EM)
8765 {
8766 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8767 }
8768
8769 }
8770
8771 else if (action_id ==
EActions.REMOVE_QUANTITY)
8772 {
8773 if (IsMagazine())
8774 {
8775 Magazine mag2 = Magazine.Cast(this);
8776 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8777 }
8778 else
8779 {
8781 }
8782 if (m_EM)
8783 {
8784 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8785 }
8786
8787 }
8788
8789 else if (action_id ==
EActions.SET_QUANTITY_0)
8790 {
8792
8793 if (m_EM)
8794 {
8795 m_EM.SetEnergy(0);
8796 }
8797 }
8798
8799 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8800 {
8802
8803 if (m_EM)
8804 {
8805 m_EM.SetEnergy(m_EM.GetEnergyMax());
8806 }
8807 }
8808
8809 else if (action_id ==
EActions.ADD_HEALTH)
8810 {
8811 AddHealth("","",GetMaxHealth("","Health")/5);
8812 }
8813 else if (action_id ==
EActions.REMOVE_HEALTH)
8814 {
8815 AddHealth("","",-GetMaxHealth("","Health")/5);
8816 }
8817 else if (action_id ==
EActions.DESTROY_HEALTH)
8818 {
8819 SetHealth01("","",0);
8820 }
8821 else if (action_id ==
EActions.WATCH_ITEM)
8822 {
8824 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8825 #ifdef DEVELOPER
8826 SetDebugDeveloper_item(this);
8827 #endif
8828 }
8829
8830 else if (action_id ==
EActions.ADD_TEMPERATURE)
8831 {
8832 AddTemperature(20);
8833
8834 }
8835
8836 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8837 {
8838 AddTemperature(-20);
8839
8840 }
8841
8842 else if (action_id ==
EActions.FLIP_FROZEN)
8843 {
8844 SetFrozen(!GetIsFrozen());
8845
8846 }
8847
8848 else if (action_id ==
EActions.ADD_WETNESS)
8849 {
8851
8852 }
8853
8854 else if (action_id ==
EActions.REMOVE_WETNESS)
8855 {
8857
8858 }
8859
8860 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8861 {
8864
8865
8866 }
8867
8868 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8869 {
8872 }
8873
8874 else if (action_id ==
EActions.MAKE_SPECIAL)
8875 {
8876 auto debugParams = DebugSpawnParams.WithPlayer(player);
8877 OnDebugSpawnEx(debugParams);
8878 }
8879
8880 }
8881
8882
8883 return false;
8884 }
8885
8886
8887
8888
8892
8895
8896
8897
8899 {
8900 return false;
8901 }
8902
8903
8905 {
8906 return true;
8907 }
8908
8909
8911 {
8912 return true;
8913 }
8914
8915
8916
8918 {
8919 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8920 return g_Game.ConfigIsExisting(config_path);
8921 }
8922
8925 {
8926 return null;
8927 }
8928
8930 {
8931 return false;
8932 }
8933
8935 {
8936 return false;
8937 }
8938
8942
8943
8945 {
8946 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8947 return module_repairing.CanRepair(this, item_repair_kit);
8948 }
8949
8950
8951 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8952 {
8953 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8954 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8955 }
8956
8957
8959 {
8960
8961
8962
8963
8964
8965
8966
8967
8968 return 1;
8969 }
8970
8971
8972
8974 {
8976 }
8977
8978
8979
8981 {
8983 }
8984
8985
8994 {
8995 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8996
8997 if (player)
8998 {
8999 player.MessageStatus(text);
9000 }
9001 }
9002
9003
9012 {
9013 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9014
9015 if (player)
9016 {
9017 player.MessageAction(text);
9018 }
9019 }
9020
9021
9030 {
9031 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9032
9033 if (player)
9034 {
9035 player.MessageFriendly(text);
9036 }
9037 }
9038
9039
9048 {
9049 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9050
9051 if (player)
9052 {
9053 player.MessageImportant(text);
9054 }
9055 }
9056
9058 {
9059 return true;
9060 }
9061
9062
9063 override bool KindOf(
string tag)
9064 {
9065 bool found = false;
9066 string item_name = this.
GetType();
9068 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9069
9070 int array_size = item_tag_array.Count();
9071 for (int i = 0; i < array_size; i++)
9072 {
9073 if (item_tag_array.Get(i) == tag)
9074 {
9075 found = true;
9076 break;
9077 }
9078 }
9079 return found;
9080 }
9081
9082
9084 {
9085
9086 super.OnRPC(sender, rpc_type,ctx);
9087
9088
9089 switch (rpc_type)
9090 {
9091 #ifndef SERVER
9092 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9093 Param2<bool, string> p = new Param2<bool, string>(false, "");
9094
9096 return;
9097
9098 bool play = p.param1;
9099 string soundSet = p.param2;
9100
9101 if (play)
9102 {
9104 {
9106 {
9108 }
9109 }
9110 else
9111 {
9113 }
9114 }
9115 else
9116 {
9118 }
9119
9120 break;
9121 #endif
9122
9123 }
9124
9126 {
9128 }
9129 }
9130
9131
9132
9133
9135 {
9136 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9137 return plugin.GetID(
name);
9138 }
9139
9141 {
9142 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9143 return plugin.GetName(id);
9144 }
9145
9148 {
9149
9150
9151 int varFlags;
9152 if (!ctx.
Read(varFlags))
9153 return;
9154
9155 if (varFlags & ItemVariableFlags.FLOAT)
9156 {
9158 }
9159 }
9160
9162 {
9163
9164 super.SerializeNumericalVars(floats_out);
9165
9166
9167
9169 {
9171 }
9172
9174 {
9176 }
9177
9179 {
9181 }
9182
9184 {
9189 }
9190
9192 {
9194 }
9195 }
9196
9198 {
9199
9200 super.DeSerializeNumericalVars(floats);
9201
9202
9203 int index = 0;
9204 int mask = Math.Round(floats.Get(index));
9205
9206 index++;
9207
9209 {
9211 {
9213 }
9214 else
9215 {
9216 float quantity = floats.Get(index);
9218 }
9219 index++;
9220 }
9221
9223 {
9224 float wet = floats.Get(index);
9226 index++;
9227 }
9228
9230 {
9231 int liquidtype = Math.Round(floats.Get(index));
9233 index++;
9234 }
9235
9237 {
9239 index++;
9241 index++;
9243 index++;
9245 index++;
9246 }
9247
9249 {
9250 int cleanness = Math.Round(floats.Get(index));
9252 index++;
9253 }
9254 }
9255
9257 {
9258 super.WriteVarsToCTX(ctx);
9259
9260
9262 {
9264 }
9265
9267 {
9269 }
9270
9272 {
9274 }
9275
9277 {
9278 int r,g,b,a;
9284 }
9285
9287 {
9289 }
9290 }
9291
9293 {
9294 if (!super.ReadVarsFromCTX(ctx,version))
9295 return false;
9296
9297 int intValue;
9298 float value;
9299
9300 if (version < 140)
9301 {
9302 if (!ctx.
Read(intValue))
9303 return false;
9304
9305 m_VariablesMask = intValue;
9306 }
9307
9309 {
9310 if (!ctx.
Read(value))
9311 return false;
9312
9314 {
9316 }
9317 else
9318 {
9320 }
9321 }
9322
9323 if (version < 140)
9324 {
9326 {
9327 if (!ctx.
Read(value))
9328 return false;
9329 SetTemperatureDirect(value);
9330 }
9331 }
9332
9334 {
9335 if (!ctx.
Read(value))
9336 return false;
9338 }
9339
9341 {
9342 if (!ctx.
Read(intValue))
9343 return false;
9345 }
9346
9348 {
9349 int r,g,b,a;
9351 return false;
9353 return false;
9355 return false;
9357 return false;
9358
9360 }
9361
9363 {
9364 if (!ctx.
Read(intValue))
9365 return false;
9367 }
9368
9369 if (version >= 138 && version < 140)
9370 {
9372 {
9373 if (!ctx.
Read(intValue))
9374 return false;
9375 SetFrozen(intValue);
9376 }
9377 }
9378
9379 return true;
9380 }
9381
9382
9384 {
9387 {
9389 }
9390
9391 if (!super.OnStoreLoad(ctx, version))
9392 {
9394 return false;
9395 }
9396
9397 if (version >= 114)
9398 {
9399 bool hasQuickBarIndexSaved;
9400
9401 if (!ctx.
Read(hasQuickBarIndexSaved))
9402 {
9404 return false;
9405 }
9406
9407 if (hasQuickBarIndexSaved)
9408 {
9409 int itmQBIndex;
9410
9411
9412 if (!ctx.
Read(itmQBIndex))
9413 {
9415 return false;
9416 }
9417
9418 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9419 if (itmQBIndex != -1 && parentPlayer)
9420 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9421 }
9422 }
9423 else
9424 {
9425
9426 PlayerBase player;
9427 int itemQBIndex;
9428 if (version ==
int.
MAX)
9429 {
9430 if (!ctx.
Read(itemQBIndex))
9431 {
9433 return false;
9434 }
9435 }
9436 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9437 {
9438
9439 if (!ctx.
Read(itemQBIndex))
9440 {
9442 return false;
9443 }
9444 if (itemQBIndex != -1 && player)
9445 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9446 }
9447 }
9448
9449 if (version < 140)
9450 {
9451
9452 if (!LoadVariables(ctx, version))
9453 {
9455 return false;
9456 }
9457 }
9458
9459
9461 {
9463 return false;
9464 }
9465 if (version >= 132)
9466 {
9468 if (raib)
9469 {
9471 {
9473 return false;
9474 }
9475 }
9476 }
9477
9479 return true;
9480 }
9481
9482
9483
9485 {
9486 super.OnStoreSave(ctx);
9487
9488 PlayerBase player;
9489 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9490 {
9492
9493 int itemQBIndex = -1;
9494 itemQBIndex = player.FindQuickBarEntityIndex(this);
9495 ctx.
Write(itemQBIndex);
9496 }
9497 else
9498 {
9500 }
9501
9503
9505 if (raib)
9506 {
9508 }
9509 }
9510
9511
9513 {
9514 super.AfterStoreLoad();
9515
9517 {
9519 }
9520
9522 {
9525 }
9526 }
9527
9529 {
9530 super.EEOnAfterLoad();
9531
9533 {
9535 }
9536
9539 }
9540
9542 {
9543 return false;
9544 }
9545
9546
9547
9549 {
9551 {
9552 #ifdef PLATFORM_CONSOLE
9553
9555 {
9557 if (menu)
9558 {
9560 }
9561 }
9562 #endif
9563 }
9564
9566 {
9569 }
9570
9572 {
9573 SetWeightDirty();
9575 }
9577 {
9580 }
9581
9583 {
9586
9589 }
9591 {
9595 }
9596
9597 super.OnVariablesSynchronized();
9598 }
9599
9600
9601
9603 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9604 {
9605 if (!IsServerCheck(allow_client))
9606 return false;
9607
9609 return false;
9610
9613
9614 if (value <= (min + 0.001))
9615 value = min;
9616
9617 if (value == min)
9618 {
9619 if (destroy_config)
9620 {
9621 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9622 if (dstr)
9623 {
9625 this.Delete();
9626 return true;
9627 }
9628 }
9629 else if (destroy_forced)
9630 {
9632 this.Delete();
9633 return true;
9634 }
9635
9637 }
9638
9641
9643 {
9644 EntityAI parent = GetHierarchyRoot();
9645 InventoryLocation iLoc = new InventoryLocation();
9646 GetInventory().GetCurrentInventoryLocation(iLoc);
9648 {
9649 int iLocSlot = iLoc.
GetSlot();
9651 {
9653 }
9655 {
9657 }
9658 }
9659 }
9660
9662 {
9664
9665 if (delta)
9667 }
9668
9670
9671 return false;
9672 }
9673
9674
9676 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9677 {
9679 }
9680
9682 {
9685 }
9686
9688 {
9691 }
9692
9694 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9695 {
9696 float value_clamped = Math.Clamp(value, 0, 1);
9698 SetQuantity(result, destroy_config, destroy_forced);
9699 }
9700
9701
9704 {
9706 }
9707
9709 {
9711 }
9712
9713
9714
9715
9716
9717
9718
9719
9720
9721
9723 {
9724 int slot = -1;
9725 GameInventory inventory = GetInventory();
9726 if (inventory)
9727 {
9728 InventoryLocation il = new InventoryLocation;
9731 }
9732
9734 }
9735
9737 {
9738 float quantity_max = 0;
9739
9741 {
9742 if (attSlotID != -1)
9743 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9744
9745 if (quantity_max <= 0)
9747 }
9748
9749 if (quantity_max <= 0)
9751
9752 return quantity_max;
9753 }
9754
9756 {
9758 }
9759
9761 {
9763 }
9764
9765
9767 {
9769 }
9770
9772 {
9774 }
9775
9777 {
9779 }
9780
9781
9783 {
9784
9785 float weightEx = GetWeightEx();
9786 float special = GetInventoryAndCargoWeight();
9787 return weightEx - special;
9788 }
9789
9790
9792 {
9794 }
9795
9797 {
9799 {
9800 #ifdef DEVELOPER
9801 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9802 {
9803 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9805 }
9806 #endif
9807
9809 }
9810 else if (HasEnergyManager())
9811 {
9812 #ifdef DEVELOPER
9813 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9814 {
9815 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9816 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9817 }
9818 #endif
9819 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9820 }
9821 else
9822 {
9823 #ifdef DEVELOPER
9824 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9825 {
9826 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9827 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9828 }
9829 #endif
9830 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9831 }
9832 }
9833
9836 {
9837 int item_count = 0;
9839
9840 GameInventory inventory = GetInventory();
9841 CargoBase cargo = inventory.
GetCargo();
9842 if (cargo != NULL)
9843 {
9845 }
9846
9848 for (int i = 0; i < nAttachments; ++i)
9849 {
9851 if (item)
9852 item_count += item.GetNumberOfItems();
9853 }
9854 return item_count;
9855 }
9856
9859 {
9860 float weight = 0;
9861 float wetness = 1;
9862 if (include_wetness)
9865 {
9866 weight = wetness * m_ConfigWeight;
9867 }
9869 {
9870 weight = 1;
9871 }
9872 return weight;
9873 }
9874
9875
9876
9878 {
9879 GameInventory inventory = GetInventory();
9880 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9881 {
9882 array<EntityAI> items = new array<EntityAI>;
9884 for (int i = 0; i < items.Count(); ++i)
9885 {
9887 if (item)
9888 {
9889 g_Game.ObjectDelete(item);
9890 }
9891 }
9892 }
9893 }
9894
9895
9896
9897
9899 {
9900 float energy = 0;
9901 if (HasEnergyManager())
9902 {
9903 energy = GetCompEM().GetEnergy();
9904 }
9905 return energy;
9906 }
9907
9908
9910 {
9911 super.OnEnergyConsumed();
9912
9914 }
9915
9917 {
9918 super.OnEnergyAdded();
9919
9921 }
9922
9923
9925 {
9926 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9927 {
9929 {
9930 float energy_0to1 = GetCompEM().GetEnergy0To1();
9932 }
9933 }
9934 }
9935
9936
9938 {
9939 return ConfigGetFloat("heatIsolation");
9940 }
9941
9943 {
9945 }
9946
9948 {
9949 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9950 if (
g_Game.ConfigIsExisting(paramPath))
9951 return g_Game.ConfigGetFloat(paramPath);
9952
9953 return 0.0;
9954 }
9955
9957 {
9958 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9959 if (
g_Game.ConfigIsExisting(paramPath))
9960 return g_Game.ConfigGetFloat(paramPath);
9961
9962 return 0.0;
9963 }
9964
9965 override void SetWet(
float value,
bool allow_client =
false)
9966 {
9967 if (!IsServerCheck(allow_client))
9968 return;
9969
9972
9974
9975 m_VarWet = Math.Clamp(value, min, max);
9976
9978 {
9981 }
9982 }
9983
9984 override void AddWet(
float value)
9985 {
9987 }
9988
9990 {
9992 }
9993
9995 {
9997 }
9998
10000 {
10002 }
10003
10005 {
10007 }
10008
10010 {
10012 }
10013
10014 override void OnWetChanged(
float newVal,
float oldVal)
10015 {
10018 if (newLevel != oldLevel)
10019 {
10021 }
10022 }
10023
10025 {
10026 SetWeightDirty();
10027 }
10028
10030 {
10031 return GetWetLevelInternal(
m_VarWet);
10032 }
10033
10034
10035
10037 {
10039 }
10040
10042 {
10044 }
10045
10047 {
10049 }
10050
10052 {
10054 }
10055
10056
10057
10059 {
10060 if (ConfigIsExisting("itemModelLength"))
10061 {
10062 return ConfigGetFloat("itemModelLength");
10063 }
10064 return 0;
10065 }
10066
10068 {
10069 if (ConfigIsExisting("itemAttachOffset"))
10070 {
10071 return ConfigGetFloat("itemAttachOffset");
10072 }
10073 return 0;
10074 }
10075
10076 override void SetCleanness(
int value,
bool allow_client =
false)
10077 {
10078 if (!IsServerCheck(allow_client))
10079 return;
10080
10082
10084
10087 }
10088
10090 {
10092 }
10093
10095 {
10096 return true;
10097 }
10098
10099
10100
10101
10103 {
10105 }
10106
10108 {
10110 }
10111
10112
10113
10114
10115 override void SetColor(
int r,
int g,
int b,
int a)
10116 {
10122 }
10124 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10125 {
10130 }
10131
10133 {
10135 }
10136
10139 {
10140 int r,g,b,a;
10142 r = r/255;
10143 g = g/255;
10144 b = b/255;
10145 a = a/255;
10146 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10147 }
10148
10149
10150
10151 override void SetLiquidType(
int value,
bool allow_client =
false)
10152 {
10153 if (!IsServerCheck(allow_client))
10154 return;
10155
10160 }
10161
10163 {
10164 return ConfigGetInt("varLiquidTypeInit");
10165 }
10166
10168 {
10170 }
10171
10173 {
10175 SetFrozen(false);
10176 }
10177
10180 {
10181 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10182 }
10183
10184
10187 {
10188 PlayerBase nplayer;
10189 if (PlayerBase.CastTo(nplayer, player))
10190 {
10192 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10193 }
10194 }
10195
10196
10199 {
10200 PlayerBase nplayer;
10201 if (PlayerBase.CastTo(nplayer,player))
10202 {
10203 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10204 }
10205
10206 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10207
10208 if (HasEnergyManager())
10209 {
10210 GetCompEM().UpdatePlugState();
10211 }
10212 }
10213
10214
10216 {
10217 super.OnPlacementStarted(player);
10218
10220 }
10221
10222 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10223 {
10225 {
10226 m_AdminLog.OnPlacementComplete(player,
this);
10227 }
10228
10229 super.OnPlacementComplete(player, position, orientation);
10230 }
10231
10232
10233
10234
10235
10237 {
10239 {
10240 return true;
10241 }
10242 else
10243 {
10244 return false;
10245 }
10246 }
10247
10248
10250 {
10252 {
10254 }
10255 }
10256
10257
10259 {
10261 }
10262
10264 {
10266 }
10267
10268 override void InsertAgent(
int agent,
float count = 1)
10269 {
10270 if (count < 1)
10271 return;
10272
10274 }
10275
10278 {
10280 }
10281
10282
10284 {
10286 }
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10317
10318
10319
10320
10321
10322
10323
10324
10325
10326
10327
10328
10330 {
10332 return false;
10333 return true;
10334 }
10335
10337 {
10338
10340 }
10341
10342
10345 {
10346 super.CheckForRoofLimited(timeTresholdMS);
10347
10348 float time =
g_Game.GetTime();
10349 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10350 {
10351 m_PreviousRoofTestTime = time;
10352 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10353 }
10354 }
10355
10356
10358 {
10360 {
10361 return 0;
10362 }
10363
10364 if (GetInventory().GetAttachmentSlotsCount() != 0)
10365 {
10366 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10367 if (filter)
10368 return filter.GetProtectionLevel(type, false, system);
10369 else
10370 return 0;
10371 }
10372
10373 string subclassPath, entryName;
10374
10375 switch (type)
10376 {
10378 entryName = "biological";
10379 break;
10381 entryName = "chemical";
10382 break;
10383 default:
10384 entryName = "biological";
10385 break;
10386 }
10387
10388 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10389
10390 return g_Game.ConfigGetFloat(subclassPath + entryName);
10391 }
10392
10393
10394
10397 {
10398 if (!IsMagazine())
10400
10402 }
10403
10404
10405
10406
10407
10412 {
10413 return true;
10414 }
10415
10417 {
10419 }
10420
10421
10422
10423
10424
10426 {
10427 if (parent)
10428 {
10429 if (parent.IsInherited(DayZInfected))
10430 return true;
10431
10432 if (!parent.IsRuined())
10433 return true;
10434 }
10435
10436 return true;
10437 }
10438
10440 {
10441 if (!super.CanPutAsAttachment(parent))
10442 {
10443 return false;
10444 }
10445
10446 if (!IsRuined() && !parent.IsRuined())
10447 {
10448 return true;
10449 }
10450
10451 return false;
10452 }
10453
10455 {
10456
10457
10458
10459
10460 return super.CanReceiveItemIntoCargo(item);
10461 }
10462
10464 {
10465
10466
10467
10468
10469 GameInventory attachmentInv = attachment.GetInventory();
10471 {
10472 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10473 return false;
10474 }
10475
10476 InventoryLocation loc = new InventoryLocation();
10477 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10478 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10479 return false;
10480
10481 return super.CanReceiveAttachment(attachment, slotId);
10482 }
10483
10485 {
10486 if (!super.CanReleaseAttachment(attachment))
10487 return false;
10488
10489 return GetInventory().AreChildrenAccessible();
10490 }
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10513 {
10514 int id = muzzle_owner.GetMuzzleID();
10515 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10516
10517 if (WPOF_array)
10518 {
10519 for (int i = 0; i < WPOF_array.Count(); i++)
10520 {
10521 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10522
10523 if (WPOF)
10524 {
10525 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10526 }
10527 }
10528 }
10529 }
10530
10531
10533 {
10534 int id = muzzle_owner.GetMuzzleID();
10536
10537 if (WPOBE_array)
10538 {
10539 for (int i = 0; i < WPOBE_array.Count(); i++)
10540 {
10541 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10542
10543 if (WPOBE)
10544 {
10545 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10546 }
10547 }
10548 }
10549 }
10550
10551
10553 {
10554 int id = muzzle_owner.GetMuzzleID();
10555 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10556
10557 if (WPOOH_array)
10558 {
10559 for (int i = 0; i < WPOOH_array.Count(); i++)
10560 {
10561 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10562
10563 if (WPOOH)
10564 {
10565 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10566 }
10567 }
10568 }
10569 }
10570
10571
10573 {
10574 int id = muzzle_owner.GetMuzzleID();
10575 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10576
10577 if (WPOOH_array)
10578 {
10579 for (int i = 0; i < WPOOH_array.Count(); i++)
10580 {
10581 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10582
10583 if (WPOOH)
10584 {
10585 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10586 }
10587 }
10588 }
10589 }
10590
10591
10593 {
10594 int id = muzzle_owner.GetMuzzleID();
10595 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10596
10597 if (WPOOH_array)
10598 {
10599 for (int i = 0; i < WPOOH_array.Count(); i++)
10600 {
10601 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10602
10603 if (WPOOH)
10604 {
10605 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10606 }
10607 }
10608 }
10609 }
10610
10611
10612
10614 {
10616 {
10617 return true;
10618 }
10619
10620 return false;
10621 }
10622
10624 {
10626 {
10627 return true;
10628 }
10629
10630 return false;
10631 }
10632
10634 {
10636 {
10637 return true;
10638 }
10639
10640 return false;
10641 }
10642
10644 {
10645 return false;
10646 }
10647
10650 {
10651 return UATimeSpent.DEFAULT_DEPLOY;
10652 }
10653
10654
10655
10656
10658 {
10660 SetSynchDirty();
10661 }
10662
10664 {
10666 }
10667
10668
10670 {
10671 return false;
10672 }
10673
10676 {
10677 string att_type = "None";
10678
10679 if (ConfigIsExisting("soundAttType"))
10680 {
10681 att_type = ConfigGetString("soundAttType");
10682 }
10683
10685 }
10686
10688 {
10690 }
10691
10692
10693
10694
10695
10701
10703 {
10706
10708 }
10709
10710
10712 {
10714 return;
10715
10717
10720
10723
10724 SoundParameters params = new SoundParameters();
10728 }
10729
10730
10732 {
10734 {
10737
10738 SetSynchDirty();
10739
10742 }
10743 }
10744
10746 {
10748 }
10749
10750
10752 {
10754 return;
10755
10757 SetSynchDirty();
10758
10761 }
10762
10764 {
10767 }
10768
10770 {
10772 }
10773
10774 void OnApply(PlayerBase player);
10775
10777 {
10778 return 1.0;
10779 };
10780
10782 {
10784 }
10785
10787 {
10789 }
10790
10792
10794 {
10795 SetDynamicPhysicsLifeTime(0.01);
10797 }
10798
10800 {
10801 array<string> zone_names = new array<string>;
10802 GetDamageZones(zone_names);
10803 for (int i = 0; i < zone_names.Count(); i++)
10804 {
10805 SetHealthMax(zone_names.Get(i),"Health");
10806 }
10807 SetHealthMax("","Health");
10808 }
10809
10812 {
10813 float global_health = GetHealth01("","Health");
10814 array<string> zones = new array<string>;
10815 GetDamageZones(zones);
10816
10817 for (int i = 0; i < zones.Count(); i++)
10818 {
10819 SetHealth01(zones.Get(i),"Health",global_health);
10820 }
10821 }
10822
10825 {
10826 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10827 }
10828
10830 {
10831 if (!hasRootAsPlayer)
10832 {
10833 if (refParentIB)
10834 {
10835
10836 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10837 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10838
10839 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10840 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10841
10844 }
10845 else
10846 {
10847
10850 }
10851 }
10852 }
10853
10855 {
10857 {
10858 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10859 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10860 {
10861 float heatPermCoef = 1.0;
10863 while (ent)
10864 {
10865 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10866 ent = ent.GetHierarchyParent();
10867 }
10868
10869 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10870 }
10871 }
10872 }
10873
10875 {
10876
10877 EntityAI parent = GetHierarchyParent();
10878 if (!parent)
10879 {
10880 hasParent = false;
10881 hasRootAsPlayer = false;
10882 }
10883 else
10884 {
10885 hasParent = true;
10886 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10887 refParentIB =
ItemBase.Cast(parent);
10888 }
10889 }
10890
10891 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10892 {
10893
10894 }
10895
10897 {
10898
10899 return false;
10900 }
10901
10903 {
10904
10905
10906 return false;
10907 }
10908
10910 {
10911
10912 return false;
10913 }
10914
10917 {
10918 return !GetIsFrozen() &&
IsOpen();
10919 }
10920
10922 {
10923 bool hasParent = false, hasRootAsPlayer = false;
10925
10926 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10927 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10928
10929 if (wwtu || foodDecay)
10930 {
10934
10935 if (processWetness || processTemperature || processDecay)
10936 {
10938
10939 if (processWetness)
10940 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10941
10942 if (processTemperature)
10944
10945 if (processDecay)
10946 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10947 }
10948 }
10949 }
10950
10953 {
10955 }
10956
10958 {
10961
10962 return super.GetTemperatureFreezeThreshold();
10963 }
10964
10966 {
10969
10970 return super.GetTemperatureThawThreshold();
10971 }
10972
10974 {
10977
10978 return super.GetItemOverheatThreshold();
10979 }
10980
10982 {
10984 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10985
10986 return super.GetTemperatureFreezeTime();
10987 }
10988
10990 {
10992 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10993
10994 return super.GetTemperatureThawTime();
10995 }
10996
11001
11003 {
11004 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11005 }
11006
11008 {
11009 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11010 }
11011
11014 {
11016 }
11017
11019 {
11021 }
11022
11024 {
11026 }
11027
11030 {
11031 return null;
11032 }
11033
11036 {
11037 return false;
11038 }
11039
11041 {
11043 {
11046 if (!trg)
11047 {
11049 explosive = this;
11050 }
11051
11052 explosive.PairRemote(trg);
11054
11055 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11056 trg.SetPersistentPairID(persistentID);
11057 explosive.SetPersistentPairID(persistentID);
11058
11059 return true;
11060 }
11061 return false;
11062 }
11063
11066 {
11067 float ret = 1.0;
11070 ret *= GetHealth01();
11071
11072 return ret;
11073 }
11074
11075 #ifdef DEVELOPER
11076 override void SetDebugItem()
11077 {
11078 super.SetDebugItem();
11079 _itemBase = this;
11080 }
11081
11083 {
11084 string text = super.GetDebugText();
11085
11087 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11088
11089 return text;
11090 }
11091 #endif
11092
11094 {
11095 return true;
11096 }
11097
11099
11101
11103 {
11106 }
11107
11108
11116
11132
11133 [
Obsolete(
"Use ItemSoundHandler instead")]
11136 {
11137 if (!
g_Game.IsDedicatedServer())
11138 {
11139 if (ConfigIsExisting("attachSoundSet"))
11140 {
11141 string cfg_path = "";
11142 string soundset = "";
11143 string type_name =
GetType();
11144
11147 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11148 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11149
11150 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11151 {
11152 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11153 {
11154 if (cfg_slot_array[i] == slot_type)
11155 {
11156 soundset = cfg_soundset_array[i];
11157 break;
11158 }
11159 }
11160 }
11161
11162 if (soundset != "")
11163 {
11164 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11166 }
11167 }
11168 }
11169 }
11170
11172}
11173
11175{
11177 if (entity)
11178 {
11179 bool is_item = entity.IsInherited(
ItemBase);
11180 if (is_item && full_quantity)
11181 {
11184 }
11185 }
11186 else
11187 {
11189 return NULL;
11190 }
11191 return entity;
11192}
11193
11195{
11196 if (item)
11197 {
11198 if (health > 0)
11199 item.SetHealth("", "", health);
11200
11201 if (item.CanHaveTemperature())
11202 {
11204 if (item.CanFreeze())
11205 item.SetFrozen(false);
11206 }
11207
11208 if (item.HasEnergyManager())
11209 {
11210 if (quantity >= 0)
11211 {
11212 item.GetCompEM().SetEnergy0To1(quantity);
11213 }
11214 else
11215 {
11217 }
11218 }
11219 else if (item.IsMagazine())
11220 {
11221 Magazine mag = Magazine.Cast(item);
11222 if (quantity >= 0)
11223 {
11224 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11225 }
11226 else
11227 {
11229 }
11230
11231 }
11232 else
11233 {
11234 if (quantity >= 0)
11235 {
11236 item.SetQuantityNormalized(quantity, false);
11237 }
11238 else
11239 {
11241 }
11242
11243 }
11244 }
11245}
11246
11247#ifdef DEVELOPER
11249#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.