6306{
6308 {
6309 return true;
6310 }
6311};
6312
6314{
6315
6316};
6317
6318
6319
6321{
6325
6327
6330
6331
6332
6333
6334
6343
6349
6354
6359
6380 protected bool m_IsResultOfSplit
6381
6383
6388
6389
6390
6392
6396
6397
6398
6400
6403
6404
6405
6411
6412
6420
6423
6424
6426
6427
6429
6430
6435
6436
6441
6443
6444
6446
6447
6449 {
6454
6455 if (!
g_Game.IsDedicatedServer())
6456 {
6458 {
6460
6462 {
6464 }
6465 }
6466
6469 }
6470
6471 m_OldLocation = null;
6472
6474 {
6476 }
6477
6478 if (ConfigIsExisting("headSelectionsToHide"))
6479 {
6482 }
6483
6485 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6486 {
6488 }
6489
6491
6492 m_IsResultOfSplit = false;
6493
6495 }
6496
6498 {
6499 super.InitItemVariables();
6500
6506 m_Count = ConfigGetInt(
"count");
6507
6510
6515
6518
6523
6535
6539
6540
6543 if (ConfigIsExisting("canBeSplit"))
6544 {
6547 }
6548
6550 if (ConfigIsExisting("itemBehaviour"))
6552
6553
6556 RegisterNetSyncVariableInt("m_VarLiquidType");
6557 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6558
6559 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6560 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6561 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6562
6563 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6564 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6565 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6566 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6567
6568 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6569 RegisterNetSyncVariableBool("m_IsTakeable");
6570 RegisterNetSyncVariableBool("m_IsHologram");
6571
6574 {
6577 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6578 }
6579
6581
6583 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6585
6587 }
6588
6590 {
6592 }
6593
6595 {
6598 {
6603 }
6604 }
6605
6606 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6607 {
6609 {
6612 }
6613
6615 }
6616
6618 {
6624 }
6625
6627
6629 {
6631
6632 if (!action)
6633 {
6634 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6635 return;
6636 }
6637
6639 if (!ai)
6640 {
6642 return;
6643 }
6644
6646 if (!action_array)
6647 {
6648 action_array = new array<ActionBase_Basic>;
6650 }
6651 if (LogManager.IsActionLogEnable())
6652 {
6653 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6654 }
6655
6656 if (action_array.Find(action) != -1)
6657 {
6658 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6659 }
6660 else
6661 {
6662 action_array.Insert(action);
6663 }
6664 }
6665
6667 {
6668 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6669 ActionBase action = player.GetActionManager().GetAction(actionName);
6672
6673 if (action_array)
6674 {
6675 action_array.RemoveItem(action);
6676 }
6677 }
6678
6679
6680
6682 {
6683 ActionOverrideData overrideData = new ActionOverrideData();
6687
6689 if (!actionMap)
6690 {
6693 }
6694
6695 actionMap.Insert(this.
Type(), overrideData);
6696
6697 }
6698
6700
6702
6703
6705 {
6708
6711
6712 string config_to_search = "CfgVehicles";
6713 string muzzle_owner_config;
6714
6716 {
6717 if (IsInherited(Weapon))
6718 config_to_search = "CfgWeapons";
6719
6720 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6721
6722 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6723
6724 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6725
6726 if (config_OnFire_subclass_count > 0)
6727 {
6728 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6729
6730 for (int i = 0; i < config_OnFire_subclass_count; i++)
6731 {
6732 string particle_class = "";
6733 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6734 string config_OnFire_entry = config_OnFire_class + particle_class;
6735 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6736 WPOF_array.Insert(WPOF);
6737 }
6738
6739
6741 }
6742 }
6743
6745 {
6746 config_to_search = "CfgWeapons";
6747 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6748
6749 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6750
6751 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6752
6753 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6754 {
6755 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6756
6757 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6758 {
6759 string particle_class2 = "";
6760 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6761 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6762 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6763 WPOBE_array.Insert(WPOBE);
6764 }
6765
6766
6768 }
6769 }
6770 }
6771
6772
6774 {
6777
6779 {
6780 string config_to_search = "CfgVehicles";
6781
6782 if (IsInherited(Weapon))
6783 config_to_search = "CfgWeapons";
6784
6785 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6786 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6787
6788 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6789 {
6790
6792
6794 {
6796 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6798 return;
6799 }
6800
6803
6804
6805
6806 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6807 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6808
6809 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6810 {
6811 string particle_class = "";
6812 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6813 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6814 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6815
6816 if (entry_type == CT_CLASS)
6817 {
6818 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6819 WPOOH_array.Insert(WPOF);
6820 }
6821 }
6822
6823
6825 }
6826 }
6827 }
6828
6830 {
6832 }
6833
6835 {
6837 {
6839
6842
6845
6846 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6847 }
6848 }
6849
6851 {
6853 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6854
6856 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6857
6859 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6860
6862 {
6864 }
6865 }
6866
6868 {
6870 }
6871
6873 {
6876 else
6878
6880 {
6883 }
6884 else
6885 {
6888
6891 }
6892
6894 }
6895
6897 {
6899 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6900 }
6901
6903 {
6905 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6907 }
6908
6910 {
6912 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6913 }
6914
6916 {
6919
6920 OverheatingParticle OP = new OverheatingParticle();
6925
6927 }
6928
6930 {
6933
6934 return -1;
6935 }
6936
6938 {
6940 {
6943
6944 for (int i = count; i > 0; --i)
6945 {
6946 int id = i - 1;
6949
6952
6953 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6954 {
6955 if (p)
6956 {
6959 }
6960 }
6961 }
6962 }
6963 }
6964
6966 {
6968 {
6970 {
6971 int id = i - 1;
6973
6974 if (OP)
6975 {
6977
6978 if (p)
6979 {
6981 }
6982
6983 delete OP;
6984 }
6985 }
6986
6989 }
6990 }
6991
6994 {
6995 return 0.0;
6996 }
6997
6998
7000 {
7001 return 250;
7002 }
7003
7005 {
7006 return 0;
7007 }
7008
7011 {
7013 return true;
7014
7015 return false;
7016 }
7017
7020 {
7023
7025 {
7027 }
7028 else
7029 {
7030
7032 }
7033
7035 }
7036
7043 {
7044 return -1;
7045 }
7046
7047
7048
7049
7051 {
7053 {
7054 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7055 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7056
7057 if (r_index >= 0)
7058 {
7059 InventoryLocation r_il = new InventoryLocation;
7060 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7061
7062 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7065 {
7066 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7067 }
7069 {
7070 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7071 }
7072
7073 }
7074
7075 player.GetHumanInventory().ClearUserReservedLocation(this);
7076 }
7077
7080 }
7081
7082
7083
7084
7086 {
7087 return ItemBase.m_DebugActionsMask;
7088 }
7089
7091 {
7092 return ItemBase.m_DebugActionsMask & mask;
7093 }
7094
7096 {
7097 ItemBase.m_DebugActionsMask = mask;
7098 }
7099
7101 {
7102 ItemBase.m_DebugActionsMask |= mask;
7103 }
7104
7106 {
7107 ItemBase.m_DebugActionsMask &= ~mask;
7108 }
7109
7111 {
7113 {
7115 }
7116 else
7117 {
7119 }
7120 }
7121
7122
7124 {
7125 if (GetEconomyProfile())
7126 {
7127 float q_max = GetEconomyProfile().GetQuantityMax();
7128 if (q_max > 0)
7129 {
7130 float q_min = GetEconomyProfile().GetQuantityMin();
7131 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7132
7134 {
7135 ComponentEnergyManager comp = GetCompEM();
7137 {
7139 }
7140 }
7142 {
7144
7145 }
7146
7147 }
7148 }
7149 }
7150
7153 {
7154 EntityAI parent = GetHierarchyParent();
7155
7156 if (parent)
7157 {
7158 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7159 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7160 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7161 }
7162 }
7163
7166 {
7167 EntityAI parent = GetHierarchyParent();
7168
7169 if (parent)
7170 {
7171 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7172 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7173 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7174 }
7175 }
7176
7178 {
7179
7180
7181
7182
7184
7186 {
7187 if (ScriptInputUserData.CanStoreInputUserData())
7188 {
7189 ScriptInputUserData ctx = new ScriptInputUserData;
7195 ctx.
Write(use_stack_max);
7198
7200 {
7201 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7202 }
7203 }
7204 }
7205 else if (!
g_Game.IsMultiplayer())
7206 {
7208 }
7209 }
7210
7212 {
7214 }
7215
7217 {
7219 }
7220
7222 {
7224 }
7225
7227 {
7228
7229 return false;
7230 }
7231
7233 {
7234 return false;
7235 }
7236
7240 {
7241 return false;
7242 }
7243
7245 {
7246 return "";
7247 }
7248
7250
7252 {
7253 return false;
7254 }
7255
7257 {
7258 return true;
7259 }
7260
7261
7262
7264 {
7265 return true;
7266 }
7267
7269 {
7270 return true;
7271 }
7272
7274 {
7275 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7277 }
7278
7280 {
7282 }
7283
7285 {
7287 if (!is_being_placed)
7289 SetSynchDirty();
7290 }
7291
7292
7294
7296 {
7298 }
7299
7301 {
7303 }
7304
7306 {
7307 return 1;
7308 }
7309
7311 {
7312 return false;
7313 }
7314
7316 {
7318 SetSynchDirty();
7319 }
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7346
7347
7348
7349
7350
7351
7352
7353
7354
7356 {
7357 super.OnMovedInsideCargo(container);
7358
7359 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7360 }
7361
7362 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7363 {
7364 super.EEItemLocationChanged(oldLoc, newLoc);
7365
7366 PlayerBase newPlayer = null;
7367 PlayerBase oldPlayer = null;
7368
7369 if (newLoc.GetParent())
7370 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7371
7372 if (oldLoc.GetParent())
7373 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7374
7376 {
7377 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7378
7379 if (rIndex >= 0)
7380 {
7381 InventoryLocation rIl = new InventoryLocation;
7382 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7383
7384 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7387 {
7388 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7389 }
7391 {
7393 }
7394
7395 }
7396 }
7397
7399 {
7400 if (newPlayer)
7401 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7402
7403 if (newPlayer == oldPlayer)
7404 {
7405 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7406 {
7408 {
7409 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7410 {
7411 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7412 }
7413 }
7414 else
7415 {
7416 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7417 }
7418 }
7419
7420 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7421 {
7422 int type = oldLoc.GetType();
7424 {
7425 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7426 }
7428 {
7429 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7430 }
7431 }
7432 if (!m_OldLocation)
7433 {
7434 m_OldLocation = new InventoryLocation;
7435 }
7436 m_OldLocation.Copy(oldLoc);
7437 }
7438 else
7439 {
7440 if (m_OldLocation)
7441 {
7442 m_OldLocation.Reset();
7443 }
7444 }
7445
7446 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7447 }
7448 else
7449 {
7450 if (newPlayer)
7451 {
7452 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7453 if (resIndex >= 0)
7454 {
7455 InventoryLocation il = new InventoryLocation;
7456 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7458 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7461 {
7462 il.
GetParent().GetOnReleaseLock().Invoke(it);
7463 }
7465 {
7467 }
7468
7469 }
7470 }
7472 {
7473
7475 }
7476
7477 if (m_OldLocation)
7478 {
7479 m_OldLocation.Reset();
7480 }
7481 }
7482
7484 {
7485 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7486 }
7487
7489 {
7490 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7491 }
7492 }
7493
7494 override void EOnContact(IEntity other, Contact extra)
7495 {
7497 {
7498 int liquidType = -1;
7500 if (impactSpeed > 0.0)
7501 {
7503 #ifndef SERVER
7505 #else
7507 SetSynchDirty();
7508 #endif
7510 }
7511 }
7512
7513 #ifdef SERVER
7514 if (GetCompEM() && GetCompEM().IsPlugged())
7515 {
7516 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7517 GetCompEM().UnplugThis();
7518 }
7519 #endif
7520 }
7521
7523
7525 {
7527 }
7528
7530 {
7531
7532 }
7533
7535 {
7536 super.OnItemLocationChanged(old_owner, new_owner);
7537
7538 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7539 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7540
7541 if (!relatedPlayer && playerNew)
7542 relatedPlayer = playerNew;
7543
7544 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7545 {
7547 if (actionMgr)
7548 {
7549 ActionBase currentAction = actionMgr.GetRunningAction();
7550 if (currentAction)
7552 }
7553 }
7554
7555 Man ownerPlayerOld = null;
7556 Man ownerPlayerNew = null;
7557
7558 if (old_owner)
7559 {
7560 if (old_owner.
IsMan())
7561 {
7562 ownerPlayerOld = Man.Cast(old_owner);
7563 }
7564 else
7565 {
7566 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7567 }
7568 }
7569 else
7570 {
7572 {
7574
7575 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7576 {
7577 GetCompEM().UnplugThis();
7578 }
7579 }
7580 }
7581
7582 if (new_owner)
7583 {
7584 if (new_owner.
IsMan())
7585 {
7586 ownerPlayerNew = Man.Cast(new_owner);
7587 }
7588 else
7589 {
7590 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7591 }
7592 }
7593
7594 if (ownerPlayerOld != ownerPlayerNew)
7595 {
7596 if (ownerPlayerOld)
7597 {
7598 array<EntityAI> subItemsExit = new array<EntityAI>;
7600 for (int i = 0; i < subItemsExit.Count(); i++)
7601 {
7604 }
7605 }
7606
7607 if (ownerPlayerNew)
7608 {
7609 array<EntityAI> subItemsEnter = new array<EntityAI>;
7611 for (int j = 0; j < subItemsEnter.Count(); j++)
7612 {
7615 }
7616 }
7617 }
7618 else if (ownerPlayerNew != null)
7619 {
7620 PlayerBase nplayer;
7621 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7622 {
7623 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7625 for (int k = 0; k < subItemsUpdate.Count(); k++)
7626 {
7628 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7629 }
7630 }
7631 }
7632
7633 if (old_owner)
7634 old_owner.OnChildItemRemoved(this);
7635 if (new_owner)
7636 new_owner.OnChildItemReceived(this);
7637 }
7638
7639
7641 {
7642 super.EEDelete(parent);
7643 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7644 if (player)
7645 {
7647
7648 if (player.IsAlive())
7649 {
7650 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7651 if (r_index >= 0)
7652 {
7653 InventoryLocation r_il = new InventoryLocation;
7654 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7655
7656 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7659 {
7660 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7661 }
7663 {
7664 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7665 }
7666
7667 }
7668
7669 player.RemoveQuickBarEntityShortcut(this);
7670 }
7671 }
7672 }
7673
7675 {
7676 super.EEKilled(killer);
7677
7680 {
7681 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7682 {
7683 if (IsMagazine())
7684 {
7685 if (Magazine.Cast(this).GetAmmoCount() > 0)
7686 {
7688 }
7689 }
7690 else
7691 {
7693 }
7694 }
7695 }
7696 }
7697
7699 {
7700 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7701
7702 super.OnWasAttached(parent, slot_id);
7703
7706
7709 }
7710
7712 {
7713 super.OnWasDetached(parent, slot_id);
7714
7717
7720 }
7721
7723 {
7724 int idx;
7727
7728 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7729 if (inventory_slots.Count() < 1)
7730 {
7731 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7732 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7733 }
7734 else
7735 {
7736 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7737 }
7738
7739 idx = inventory_slots.Find(slot);
7740 if (idx < 0)
7741 return "";
7742
7743 return attach_types.Get(idx);
7744 }
7745
7747 {
7748 int idx = -1;
7749 string slot;
7750
7753
7754 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7755 if (inventory_slots.Count() < 1)
7756 {
7757 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7758 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7759 }
7760 else
7761 {
7762 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7763 if (detach_types.Count() < 1)
7764 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7765 }
7766
7767 for (int i = 0; i < inventory_slots.Count(); i++)
7768 {
7769 slot = inventory_slots.Get(i);
7770 }
7771
7772 if (slot != "")
7773 {
7774 if (detach_types.Count() == 1)
7775 idx = 0;
7776 else
7777 idx = inventory_slots.Find(slot);
7778 }
7779 if (idx < 0)
7780 return "";
7781
7782 return detach_types.Get(idx);
7783 }
7784
7786 {
7787
7789
7790
7791 float min_time = 1;
7792 float max_time = 3;
7793 float delay = Math.RandomFloat(min_time, max_time);
7794
7795 explode_timer.Run(delay, this, "DoAmmoExplosion");
7796 }
7797
7799 {
7800 Magazine magazine = Magazine.Cast(this);
7801 int pop_sounds_count = 6;
7802 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7803
7804
7805 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7806 string sound_name = pop_sounds[ sound_idx ];
7807 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7808
7809
7810 magazine.ServerAddAmmoCount(-1);
7811
7812
7813 float min_temp_to_explode = 100;
7814
7815 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7816 {
7818 }
7819 }
7820
7821
7822 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7823 {
7824 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7825
7826 const int CHANCE_DAMAGE_CARGO = 4;
7827 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7828 const int CHANCE_DAMAGE_NOTHING = 2;
7829
7831 {
7832 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7833 int chances;
7834 int rnd;
7835
7836 if (GetInventory().GetCargo())
7837 {
7838 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7839 rnd = Math.RandomInt(0,chances);
7840
7841 if (rnd < CHANCE_DAMAGE_CARGO)
7842 {
7844 }
7845 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7846 {
7848 }
7849 }
7850 else
7851 {
7852 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7853 rnd = Math.RandomInt(0,chances);
7854
7855 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7856 {
7858 }
7859 }
7860 }
7861 }
7862
7864 {
7865 CargoBase cargo = GetInventory().GetCargo();
7866 if (cargo)
7867 {
7869 if (item_count > 0)
7870 {
7871 int random_pick = Math.RandomInt(0, item_count);
7873 if (!item.IsExplosive())
7874 {
7875 item.AddHealth("","",damage);
7876 return true;
7877 }
7878 }
7879 }
7880 return false;
7881 }
7882
7884 {
7885 GameInventory inventory = GetInventory();
7887 if (attachment_count > 0)
7888 {
7889 int random_pick = Math.RandomInt(0, attachment_count);
7891 if (!attachment.IsExplosive())
7892 {
7893 attachment.AddHealth("","",damage);
7894 return true;
7895 }
7896 }
7897 return false;
7898 }
7899
7901 {
7903 }
7904
7906 {
7908 return GetInventory().CanRemoveEntity();
7909
7910 return false;
7911 }
7912
7914 {
7915
7917 return false;
7918
7919
7921 return false;
7922
7923
7924
7926 if (delta == 0)
7927 return false;
7928
7929
7930 return true;
7931 }
7932
7934 {
7936 {
7937 if (ScriptInputUserData.CanStoreInputUserData())
7938 {
7939 ScriptInputUserData ctx = new ScriptInputUserData;
7944 ctx.
Write(destination_entity);
7948 }
7949 }
7950 else if (!
g_Game.IsMultiplayer())
7951 {
7953 }
7954 }
7955
7957 {
7958 float split_quantity_new;
7962 InventoryLocation loc = new InventoryLocation;
7963
7964 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7965 {
7967 split_quantity_new = stack_max;
7968 else
7970
7972 {
7973 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7974 if (new_item)
7975 {
7976 new_item.SetResultOfSplit(true);
7977 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7979 new_item.
SetQuantity(split_quantity_new,
false,
true);
7980 }
7981 }
7982 }
7983 else if (destination_entity && slot_id == -1)
7984 {
7985 if (quantity > stack_max)
7986 split_quantity_new = stack_max;
7987 else
7988 split_quantity_new = quantity;
7989
7991 {
7992 GameInventory destinationInventory = destination_entity.GetInventory();
7994 {
7997 }
7998
7999 if (new_item)
8000 {
8001 new_item.SetResultOfSplit(true);
8002 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8004 new_item.
SetQuantity(split_quantity_new,
false,
true);
8005 }
8006 }
8007 }
8008 else
8009 {
8010 if (stack_max != 0)
8011 {
8013 {
8015 }
8016
8017 if (split_quantity_new == 0)
8018 {
8019 if (!
g_Game.IsMultiplayer())
8020 player.PhysicalPredictiveDropItem(this);
8021 else
8022 player.ServerDropEntity(this);
8023 return;
8024 }
8025
8027 {
8029
8030 if (new_item)
8031 {
8032 new_item.SetResultOfSplit(true);
8033 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8036 new_item.PlaceOnSurface();
8037 }
8038 }
8039 }
8040 }
8041 }
8042
8044 {
8045 float split_quantity_new;
8049 InventoryLocation loc = new InventoryLocation;
8050
8051 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8052 {
8054 split_quantity_new = stack_max;
8055 else
8057
8059 {
8060 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8061 if (new_item)
8062 {
8063 new_item.SetResultOfSplit(true);
8064 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8066 new_item.
SetQuantity(split_quantity_new,
false,
true);
8067 }
8068 }
8069 }
8070 else if (destination_entity && slot_id == -1)
8071 {
8072 if (quantity > stack_max)
8073 split_quantity_new = stack_max;
8074 else
8075 split_quantity_new = quantity;
8076
8078 {
8079 GameInventory destinationInventory = destination_entity.GetInventory();
8081 {
8084 }
8085
8086 if (new_item)
8087 {
8088 new_item.SetResultOfSplit(true);
8089 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8091 new_item.
SetQuantity(split_quantity_new,
false,
true);
8092 }
8093 }
8094 }
8095 else
8096 {
8097 if (stack_max != 0)
8098 {
8100 {
8102 }
8103
8105 {
8107
8108 if (new_item)
8109 {
8110 new_item.SetResultOfSplit(true);
8111 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8114 new_item.PlaceOnSurface();
8115 }
8116 }
8117 }
8118 }
8119 }
8120
8122 {
8124 {
8125 if (ScriptInputUserData.CanStoreInputUserData())
8126 {
8127 ScriptInputUserData ctx = new ScriptInputUserData;
8132 dst.WriteToContext(ctx);
8134 }
8135 }
8136 else if (!
g_Game.IsMultiplayer())
8137 {
8139 }
8140 }
8141
8143 {
8145 {
8146 if (ScriptInputUserData.CanStoreInputUserData())
8147 {
8148 ScriptInputUserData ctx = new ScriptInputUserData;
8153 ctx.
Write(destination_entity);
8159 }
8160 }
8161 else if (!
g_Game.IsMultiplayer())
8162 {
8164 }
8165 }
8166
8168 {
8170 }
8171
8173 {
8175 float split_quantity_new;
8177 if (dst.IsValid())
8178 {
8179 int slot_id = dst.GetSlot();
8181
8182 if (quantity > stack_max)
8183 split_quantity_new = stack_max;
8184 else
8185 split_quantity_new = quantity;
8186
8188 {
8190
8191 if (new_item)
8192 {
8193 new_item.SetResultOfSplit(true);
8194 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8196 new_item.
SetQuantity(split_quantity_new,
false,
true);
8197 }
8198
8199 return new_item;
8200 }
8201 }
8202
8203 return null;
8204 }
8205
8207 {
8209 float split_quantity_new;
8211 if (destination_entity)
8212 {
8214 if (quantity > stackable)
8215 split_quantity_new = stackable;
8216 else
8217 split_quantity_new = quantity;
8218
8220 {
8221 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8222 if (new_item)
8223 {
8224 new_item.SetResultOfSplit(true);
8225 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8227 new_item.
SetQuantity(split_quantity_new,
false,
true);
8228 }
8229 }
8230 }
8231 }
8232
8234 {
8236 {
8237 if (ScriptInputUserData.CanStoreInputUserData())
8238 {
8239 ScriptInputUserData ctx = new ScriptInputUserData;
8244 ItemBase destination_entity =
this;
8245 ctx.
Write(destination_entity);
8249 }
8250 }
8251 else if (!
g_Game.IsMultiplayer())
8252 {
8254 }
8255 }
8256
8258 {
8260 float split_quantity_new;
8262 if (player)
8263 {
8265 if (quantity > stackable)
8266 split_quantity_new = stackable;
8267 else
8268 split_quantity_new = quantity;
8269
8271 {
8272 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8273 new_item =
ItemBase.Cast(in_hands);
8274 if (new_item)
8275 {
8276 new_item.SetResultOfSplit(true);
8277 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8279 new_item.SetQuantity(split_quantity_new, false, true);
8280 }
8281 }
8282 }
8283 }
8284
8286 {
8288 float split_quantity_new = Math.Floor(quantity * 0.5);
8289
8291 return;
8292
8294
8295 if (new_item)
8296 {
8297 if (new_item.GetQuantityMax() < split_quantity_new)
8298 {
8299 split_quantity_new = new_item.GetQuantityMax();
8300 }
8301
8302 new_item.SetResultOfSplit(true);
8303 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8304
8306 {
8309 }
8310 else
8311 {
8313 new_item.
SetQuantity(split_quantity_new,
false,
true);
8314 }
8315 }
8316 }
8317
8319 {
8321 float split_quantity_new = Math.Floor(quantity / 2);
8322
8324 return;
8325
8326 InventoryLocation invloc = new InventoryLocation;
8328
8330 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8331
8332 if (new_item)
8333 {
8334 if (new_item.GetQuantityMax() < split_quantity_new)
8335 {
8336 split_quantity_new = new_item.GetQuantityMax();
8337 }
8339 {
8342 }
8343 else if (split_quantity_new > 1)
8344 {
8346 new_item.
SetQuantity(split_quantity_new,
false,
true);
8347 }
8348 }
8349 }
8350
8353 {
8354 SetWeightDirty();
8356
8357 if (parent)
8358 parent.OnAttachmentQuantityChangedEx(this, delta);
8359
8361 {
8363 {
8365 }
8367 {
8368 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8370 }
8371 }
8372 }
8373
8376 {
8377
8378 }
8379
8382 {
8384 }
8385
8387 {
8388 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8389
8391 {
8392 if (newLevel == GameConstants.STATE_RUINED)
8393 {
8395 EntityAI parent = GetHierarchyParent();
8396 if (parent && parent.IsFireplace())
8397 {
8398 CargoBase cargo = GetInventory().GetCargo();
8399 if (cargo)
8400 {
8402 {
8404 }
8405 }
8406 }
8407 }
8408
8410 {
8411
8413 return;
8414 }
8415
8416 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8417 {
8419 }
8420 }
8421 }
8422
8423
8425 {
8426 super.OnRightClick();
8427
8429 {
8431 {
8432 if (ScriptInputUserData.CanStoreInputUserData())
8433 {
8434 EntityAI root = GetHierarchyRoot();
8435 Man playerOwner = GetHierarchyRootPlayer();
8436 InventoryLocation dst = new InventoryLocation;
8437
8438
8439 if (!playerOwner && root && root == this)
8440 {
8442 }
8443 else
8444 {
8445
8446 GetInventory().GetCurrentInventoryLocation(dst);
8448 {
8449 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8451 {
8453 }
8454 else
8455 {
8457
8458
8459 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8460 {
8462 }
8463 else
8464 {
8465 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8466 }
8467 }
8468 }
8469 }
8470
8471 ScriptInputUserData ctx = new ScriptInputUserData;
8479 }
8480 }
8481 else if (!
g_Game.IsMultiplayer())
8482 {
8484 }
8485 }
8486 }
8487
8489 {
8490 if (root)
8491 {
8492 vector m4[4];
8493 root.GetTransform(m4);
8494 dst.SetGround(this, m4);
8495 }
8496 else
8497 {
8498 GetInventory().GetCurrentInventoryLocation(dst);
8499 }
8500 }
8501
8502 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8503 {
8504
8505 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8506 return false;
8507
8508 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8509 return false;
8510
8511
8513 return false;
8514
8515
8516 Magazine mag = Magazine.Cast(this);
8517 if (mag)
8518 {
8519 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8520 return false;
8521
8522 if (stack_max_limit)
8523 {
8524 Magazine other_mag = Magazine.Cast(other_item);
8525 if (other_item)
8526 {
8527 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8528 return false;
8529 }
8530
8531 }
8532 }
8533 else
8534 {
8535
8537 return false;
8538
8540 return false;
8541 }
8542
8543 PlayerBase player = null;
8544 if (CastTo(player, GetHierarchyRootPlayer()))
8545 {
8546 if (player.GetInventory().HasAttachment(this))
8547 return false;
8548
8549 if (player.IsItemsToDelete())
8550 return false;
8551 }
8552
8553 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8554 return false;
8555
8556 int slotID;
8558 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8559 return false;
8560
8561 return true;
8562 }
8563
8565 {
8567 }
8568
8570 {
8571 return m_IsResultOfSplit;
8572 }
8573
8575 {
8576 m_IsResultOfSplit = value;
8577 }
8578
8580 {
8582 }
8583
8585 {
8586 float other_item_quantity = other_item.GetQuantity();
8587 float this_free_space;
8588
8590
8592
8593 if (other_item_quantity > this_free_space)
8594 {
8595 return this_free_space;
8596 }
8597 else
8598 {
8599 return other_item_quantity;
8600 }
8601 }
8602
8604 {
8606 }
8607
8609 {
8611 return;
8612
8613 if (!IsMagazine() && other_item)
8614 {
8616 if (quantity_used != 0)
8617 {
8618 float hp1 = GetHealth01("","");
8619 float hp2 = other_item.GetHealth01("","");
8620 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8621 hpResult = hpResult / (
GetQuantity() + quantity_used);
8622
8623 hpResult *= GetMaxHealth();
8624 Math.Round(hpResult);
8625 SetHealth("", "Health", hpResult);
8626
8628 other_item.AddQuantity(-quantity_used);
8629 }
8630 }
8632 }
8633
8635 {
8636 #ifdef SERVER
8637 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8638 GetHierarchyParent().IncreaseLifetimeUp();
8639 #endif
8640 };
8641
8643 {
8644 PlayerBase p = PlayerBase.Cast(player);
8645
8646 array<int> recipesIds = p.m_Recipes;
8647 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8648 if (moduleRecipesManager)
8649 {
8650 EntityAI itemInHands = player.GetEntityInHands();
8651 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8652 }
8653
8654 for (int i = 0;i < recipesIds.Count(); i++)
8655 {
8656 int key = recipesIds.Get(i);
8657 string recipeName = moduleRecipesManager.GetRecipeName(key);
8659 }
8660 }
8661
8662
8663 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8664 {
8665 super.GetDebugActions(outputList);
8666
8667
8673
8674
8679
8684
8685
8689
8690
8692 {
8696 }
8697
8700
8701
8705
8707
8708 InventoryLocation loc = new InventoryLocation();
8709 GetInventory().GetCurrentInventoryLocation(loc);
8711 {
8712 if (Gizmo_IsSupported())
8715 }
8716
8718 }
8719
8720
8721
8722
8724 {
8725 super.OnAction(action_id, player, ctx);
8726
8728 {
8729 switch (action_id)
8730 {
8734 return true;
8738 return true;
8739 }
8740 }
8741
8743 {
8744 switch (action_id)
8745 {
8747 Delete();
8748 return true;
8749 }
8750 }
8751
8752 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8753 {
8754 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8755 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8756 PlayerBase p = PlayerBase.Cast(player);
8757 if (
EActions.RECIPES_RANGE_START < 1000)
8758 {
8759 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8760 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8761 }
8762 }
8763 #ifndef SERVER
8764 else if (action_id ==
EActions.WATCH_PLAYER)
8765 {
8766 PluginDeveloper.SetDeveloperItemClientEx(player);
8767 }
8768 #endif
8770 {
8771 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8772 {
8773 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8774 OnDebugButtonPressServer(id + 1);
8775 }
8776
8777 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8778 {
8779 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8781 }
8782
8783 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8784 {
8785 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8787 }
8788
8789 else if (action_id ==
EActions.ADD_QUANTITY)
8790 {
8791 if (IsMagazine())
8792 {
8793 Magazine mag = Magazine.Cast(this);
8794 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8795 }
8796 else
8797 {
8799 }
8800
8801 if (m_EM)
8802 {
8803 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8804 }
8805
8806 }
8807
8808 else if (action_id ==
EActions.REMOVE_QUANTITY)
8809 {
8810 if (IsMagazine())
8811 {
8812 Magazine mag2 = Magazine.Cast(this);
8813 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8814 }
8815 else
8816 {
8818 }
8819 if (m_EM)
8820 {
8821 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8822 }
8823
8824 }
8825
8826 else if (action_id ==
EActions.SET_QUANTITY_0)
8827 {
8829
8830 if (m_EM)
8831 {
8832 m_EM.SetEnergy(0);
8833 }
8834 }
8835
8836 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8837 {
8839
8840 if (m_EM)
8841 {
8842 m_EM.SetEnergy(m_EM.GetEnergyMax());
8843 }
8844 }
8845
8846 else if (action_id ==
EActions.ADD_HEALTH)
8847 {
8848 AddHealth("","",GetMaxHealth("","Health")/5);
8849 }
8850 else if (action_id ==
EActions.REMOVE_HEALTH)
8851 {
8852 AddHealth("","",-GetMaxHealth("","Health")/5);
8853 }
8854 else if (action_id ==
EActions.DESTROY_HEALTH)
8855 {
8856 SetHealth01("","",0);
8857 }
8858 else if (action_id ==
EActions.WATCH_ITEM)
8859 {
8861 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8862 #ifdef DEVELOPER
8863 SetDebugDeveloper_item(this);
8864 #endif
8865 }
8866
8867 else if (action_id ==
EActions.ADD_TEMPERATURE)
8868 {
8869 AddTemperature(20);
8870
8871 }
8872
8873 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8874 {
8875 AddTemperature(-20);
8876
8877 }
8878
8879 else if (action_id ==
EActions.FLIP_FROZEN)
8880 {
8881 SetFrozen(!GetIsFrozen());
8882
8883 }
8884
8885 else if (action_id ==
EActions.ADD_WETNESS)
8886 {
8888
8889 }
8890
8891 else if (action_id ==
EActions.REMOVE_WETNESS)
8892 {
8894
8895 }
8896
8897 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8898 {
8901
8902
8903 }
8904
8905 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8906 {
8909 }
8910
8911 else if (action_id ==
EActions.MAKE_SPECIAL)
8912 {
8913 auto debugParams = DebugSpawnParams.WithPlayer(player);
8914 OnDebugSpawnEx(debugParams);
8915 }
8916
8917 }
8918
8919
8920 return false;
8921 }
8922
8923
8924
8925
8929
8932
8933
8934
8936 {
8937 return false;
8938 }
8939
8940
8942 {
8943 return true;
8944 }
8945
8946
8948 {
8949 return true;
8950 }
8951
8952
8953
8955 {
8956 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8957 return g_Game.ConfigIsExisting(config_path);
8958 }
8959
8962 {
8963 return null;
8964 }
8965
8967 {
8968 return false;
8969 }
8970
8972 {
8973 return false;
8974 }
8975
8979
8980
8982 {
8983 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8984 return module_repairing.CanRepair(this, item_repair_kit);
8985 }
8986
8987
8988 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8989 {
8990 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8991 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8992 }
8993
8994
8996 {
8997
8998
8999
9000
9001
9002
9003
9004
9005 return 1;
9006 }
9007
9008
9009
9011 {
9013 }
9014
9015
9016
9018 {
9020 }
9021
9022
9031 {
9032 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9033
9034 if (player)
9035 {
9036 player.MessageStatus(text);
9037 }
9038 }
9039
9040
9049 {
9050 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9051
9052 if (player)
9053 {
9054 player.MessageAction(text);
9055 }
9056 }
9057
9058
9067 {
9068 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9069
9070 if (player)
9071 {
9072 player.MessageFriendly(text);
9073 }
9074 }
9075
9076
9085 {
9086 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9087
9088 if (player)
9089 {
9090 player.MessageImportant(text);
9091 }
9092 }
9093
9095 {
9096 return true;
9097 }
9098
9099
9100 override bool KindOf(
string tag)
9101 {
9102 bool found = false;
9103 string item_name = this.
GetType();
9105 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9106
9107 int array_size = item_tag_array.Count();
9108 for (int i = 0; i < array_size; i++)
9109 {
9110 if (item_tag_array.Get(i) == tag)
9111 {
9112 found = true;
9113 break;
9114 }
9115 }
9116 return found;
9117 }
9118
9119
9121 {
9122
9123 super.OnRPC(sender, rpc_type,ctx);
9124
9125
9126 switch (rpc_type)
9127 {
9128 #ifndef SERVER
9129 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9130 Param2<bool, string> p = new Param2<bool, string>(false, "");
9131
9133 return;
9134
9135 bool play = p.param1;
9136 string soundSet = p.param2;
9137
9138 if (play)
9139 {
9141 {
9143 {
9145 }
9146 }
9147 else
9148 {
9150 }
9151 }
9152 else
9153 {
9155 }
9156
9157 break;
9158 #endif
9159
9160 }
9161
9163 {
9165 }
9166 }
9167
9168
9169
9170
9172 {
9173 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9174 return plugin.GetID(
name);
9175 }
9176
9178 {
9179 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9180 return plugin.GetName(id);
9181 }
9182
9185 {
9186
9187
9188 int varFlags;
9189 if (!ctx.
Read(varFlags))
9190 return;
9191
9192 if (varFlags & ItemVariableFlags.FLOAT)
9193 {
9195 }
9196 }
9197
9199 {
9200
9201 super.SerializeNumericalVars(floats_out);
9202
9203
9204
9206 {
9208 }
9209
9211 {
9213 }
9214
9216 {
9218 }
9219
9221 {
9226 }
9227
9229 {
9231 }
9232 }
9233
9235 {
9236
9237 super.DeSerializeNumericalVars(floats);
9238
9239
9240 int index = 0;
9241 int mask = Math.Round(floats.Get(index));
9242
9243 index++;
9244
9246 {
9248 {
9250 }
9251 else
9252 {
9253 float quantity = floats.Get(index);
9255 }
9256 index++;
9257 }
9258
9260 {
9261 float wet = floats.Get(index);
9263 index++;
9264 }
9265
9267 {
9268 int liquidtype = Math.Round(floats.Get(index));
9270 index++;
9271 }
9272
9274 {
9276 index++;
9278 index++;
9280 index++;
9282 index++;
9283 }
9284
9286 {
9287 int cleanness = Math.Round(floats.Get(index));
9289 index++;
9290 }
9291 }
9292
9294 {
9295 super.WriteVarsToCTX(ctx);
9296
9297
9299 {
9301 }
9302
9304 {
9306 }
9307
9309 {
9311 }
9312
9314 {
9315 int r,g,b,a;
9321 }
9322
9324 {
9326 }
9327 }
9328
9330 {
9331 if (!super.ReadVarsFromCTX(ctx,version))
9332 return false;
9333
9334 int intValue;
9335 float value;
9336
9337 if (version < 140)
9338 {
9339 if (!ctx.
Read(intValue))
9340 return false;
9341
9342 m_VariablesMask = intValue;
9343 }
9344
9346 {
9347 if (!ctx.
Read(value))
9348 return false;
9349
9351 {
9353 }
9354 else
9355 {
9357 }
9358 }
9359
9360 if (version < 140)
9361 {
9363 {
9364 if (!ctx.
Read(value))
9365 return false;
9366 SetTemperatureDirect(value);
9367 }
9368 }
9369
9371 {
9372 if (!ctx.
Read(value))
9373 return false;
9375 }
9376
9378 {
9379 if (!ctx.
Read(intValue))
9380 return false;
9382 }
9383
9385 {
9386 int r,g,b,a;
9388 return false;
9390 return false;
9392 return false;
9394 return false;
9395
9397 }
9398
9400 {
9401 if (!ctx.
Read(intValue))
9402 return false;
9404 }
9405
9406 if (version >= 138 && version < 140)
9407 {
9409 {
9410 if (!ctx.
Read(intValue))
9411 return false;
9412 SetFrozen(intValue);
9413 }
9414 }
9415
9416 return true;
9417 }
9418
9419
9421 {
9424 {
9426 }
9427
9428 if (!super.OnStoreLoad(ctx, version))
9429 {
9431 return false;
9432 }
9433
9434 if (version >= 114)
9435 {
9436 bool hasQuickBarIndexSaved;
9437
9438 if (!ctx.
Read(hasQuickBarIndexSaved))
9439 {
9441 return false;
9442 }
9443
9444 if (hasQuickBarIndexSaved)
9445 {
9446 int itmQBIndex;
9447
9448
9449 if (!ctx.
Read(itmQBIndex))
9450 {
9452 return false;
9453 }
9454
9455 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9456 if (itmQBIndex != -1 && parentPlayer)
9457 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9458 }
9459 }
9460 else
9461 {
9462
9463 PlayerBase player;
9464 int itemQBIndex;
9465 if (version ==
int.
MAX)
9466 {
9467 if (!ctx.
Read(itemQBIndex))
9468 {
9470 return false;
9471 }
9472 }
9473 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9474 {
9475
9476 if (!ctx.
Read(itemQBIndex))
9477 {
9479 return false;
9480 }
9481 if (itemQBIndex != -1 && player)
9482 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9483 }
9484 }
9485
9486 if (version < 140)
9487 {
9488
9489 if (!LoadVariables(ctx, version))
9490 {
9492 return false;
9493 }
9494 }
9495
9496
9498 {
9500 return false;
9501 }
9502 if (version >= 132)
9503 {
9505 if (raib)
9506 {
9508 {
9510 return false;
9511 }
9512 }
9513 }
9514
9516 return true;
9517 }
9518
9519
9520
9522 {
9523 super.OnStoreSave(ctx);
9524
9525 PlayerBase player;
9526 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9527 {
9529
9530 int itemQBIndex = -1;
9531 itemQBIndex = player.FindQuickBarEntityIndex(this);
9532 ctx.
Write(itemQBIndex);
9533 }
9534 else
9535 {
9537 }
9538
9540
9542 if (raib)
9543 {
9545 }
9546 }
9547
9548
9550 {
9551 super.AfterStoreLoad();
9552
9554 {
9556 }
9557
9559 {
9562 }
9563 }
9564
9566 {
9567 super.EEOnAfterLoad();
9568
9570 {
9572 }
9573
9576 }
9577
9579 {
9580 return false;
9581 }
9582
9583
9584
9586 {
9588 {
9589 #ifdef PLATFORM_CONSOLE
9590
9592 {
9594 if (menu)
9595 {
9597 }
9598 }
9599 #endif
9600 }
9601
9603 {
9606 }
9607
9609 {
9610 SetWeightDirty();
9612 }
9614 {
9617 }
9618
9620 {
9623
9626 }
9628 {
9632 }
9633
9634 super.OnVariablesSynchronized();
9635 }
9636
9637
9638
9640 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9641 {
9642 if (!IsServerCheck(allow_client))
9643 return false;
9644
9646 return false;
9647
9650
9651 if (value <= (min + 0.001))
9652 value = min;
9653
9654 if (value == min)
9655 {
9656 if (destroy_config)
9657 {
9658 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9659 if (dstr)
9660 {
9662 this.Delete();
9663 return true;
9664 }
9665 }
9666 else if (destroy_forced)
9667 {
9669 this.Delete();
9670 return true;
9671 }
9672
9674 }
9675
9678
9680 {
9681 EntityAI parent = GetHierarchyRoot();
9682 InventoryLocation iLoc = new InventoryLocation();
9683 GetInventory().GetCurrentInventoryLocation(iLoc);
9685 {
9686 int iLocSlot = iLoc.
GetSlot();
9688 {
9690 }
9692 {
9694 }
9695 }
9696 }
9697
9699 {
9701
9702 if (delta)
9704 }
9705
9707
9708 return false;
9709 }
9710
9711
9713 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9714 {
9716 }
9717
9719 {
9722 }
9723
9725 {
9728 }
9729
9731 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9732 {
9733 float value_clamped = Math.Clamp(value, 0, 1);
9735 SetQuantity(result, destroy_config, destroy_forced);
9736 }
9737
9738
9741 {
9743 }
9744
9746 {
9748 }
9749
9750
9751
9752
9753
9754
9755
9756
9757
9758
9760 {
9761 int slot = -1;
9762 GameInventory inventory = GetInventory();
9763 if (inventory)
9764 {
9765 InventoryLocation il = new InventoryLocation;
9768 }
9769
9771 }
9772
9774 {
9775 float quantity_max = 0;
9776
9778 {
9779 if (attSlotID != -1)
9780 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9781
9782 if (quantity_max <= 0)
9784 }
9785
9786 if (quantity_max <= 0)
9788
9789 return quantity_max;
9790 }
9791
9793 {
9795 }
9796
9798 {
9800 }
9801
9802
9804 {
9806 }
9807
9809 {
9811 }
9812
9814 {
9816 }
9817
9818
9820 {
9821
9822 float weightEx = GetWeightEx();
9823 float special = GetInventoryAndCargoWeight();
9824 return weightEx - special;
9825 }
9826
9827
9829 {
9831 }
9832
9834 {
9836 {
9837 #ifdef DEVELOPER
9838 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9839 {
9840 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9842 }
9843 #endif
9844
9846 }
9847 else if (HasEnergyManager())
9848 {
9849 #ifdef DEVELOPER
9850 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9851 {
9852 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9853 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9854 }
9855 #endif
9856 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9857 }
9858 else
9859 {
9860 #ifdef DEVELOPER
9861 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9862 {
9863 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9864 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9865 }
9866 #endif
9867 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9868 }
9869 }
9870
9873 {
9874 int item_count = 0;
9876
9877 GameInventory inventory = GetInventory();
9878 CargoBase cargo = inventory.
GetCargo();
9879 if (cargo != NULL)
9880 {
9882 }
9883
9885 for (int i = 0; i < nAttachments; ++i)
9886 {
9888 if (item)
9889 item_count += item.GetNumberOfItems();
9890 }
9891 return item_count;
9892 }
9893
9896 {
9897 float weight = 0;
9898 float wetness = 1;
9899 if (include_wetness)
9902 {
9903 weight = wetness * m_ConfigWeight;
9904 }
9906 {
9907 weight = 1;
9908 }
9909 return weight;
9910 }
9911
9912
9913
9915 {
9916 GameInventory inventory = GetInventory();
9917 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9918 {
9919 array<EntityAI> items = new array<EntityAI>;
9921 for (int i = 0; i < items.Count(); ++i)
9922 {
9924 if (item)
9925 {
9926 g_Game.ObjectDelete(item);
9927 }
9928 }
9929 }
9930 }
9931
9932
9933
9934
9936 {
9937 float energy = 0;
9938 if (HasEnergyManager())
9939 {
9940 energy = GetCompEM().GetEnergy();
9941 }
9942 return energy;
9943 }
9944
9945
9947 {
9948 super.OnEnergyConsumed();
9949
9951 }
9952
9954 {
9955 super.OnEnergyAdded();
9956
9958 }
9959
9960
9962 {
9963 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9964 {
9966 {
9967 float energy_0to1 = GetCompEM().GetEnergy0To1();
9969 }
9970 }
9971 }
9972
9973
9975 {
9976 return ConfigGetFloat("heatIsolation");
9977 }
9978
9980 {
9982 }
9983
9985 {
9986 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9987 if (
g_Game.ConfigIsExisting(paramPath))
9988 return g_Game.ConfigGetFloat(paramPath);
9989
9990 return 0.0;
9991 }
9992
9994 {
9995 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9996 if (
g_Game.ConfigIsExisting(paramPath))
9997 return g_Game.ConfigGetFloat(paramPath);
9998
9999 return 0.0;
10000 }
10001
10002 override void SetWet(
float value,
bool allow_client =
false)
10003 {
10004 if (!IsServerCheck(allow_client))
10005 return;
10006
10009
10011
10012 m_VarWet = Math.Clamp(value, min, max);
10013
10015 {
10018 }
10019 }
10020
10021 override void AddWet(
float value)
10022 {
10024 }
10025
10027 {
10029 }
10030
10032 {
10034 }
10035
10037 {
10039 }
10040
10042 {
10044 }
10045
10047 {
10049 }
10050
10051 override void OnWetChanged(
float newVal,
float oldVal)
10052 {
10055 if (newLevel != oldLevel)
10056 {
10058 }
10059 }
10060
10062 {
10063 SetWeightDirty();
10064 }
10065
10067 {
10068 return GetWetLevelInternal(
m_VarWet);
10069 }
10070
10071
10072
10074 {
10076 }
10077
10079 {
10081 }
10082
10084 {
10086 }
10087
10089 {
10091 }
10092
10093
10094
10096 {
10097 if (ConfigIsExisting("itemModelLength"))
10098 {
10099 return ConfigGetFloat("itemModelLength");
10100 }
10101 return 0;
10102 }
10103
10105 {
10106 if (ConfigIsExisting("itemAttachOffset"))
10107 {
10108 return ConfigGetFloat("itemAttachOffset");
10109 }
10110 return 0;
10111 }
10112
10113 override void SetCleanness(
int value,
bool allow_client =
false)
10114 {
10115 if (!IsServerCheck(allow_client))
10116 return;
10117
10119
10121
10124 }
10125
10127 {
10129 }
10130
10132 {
10133 return true;
10134 }
10135
10136
10137
10138
10140 {
10142 }
10143
10145 {
10147 }
10148
10149
10150
10151
10152 override void SetColor(
int r,
int g,
int b,
int a)
10153 {
10159 }
10161 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10162 {
10167 }
10168
10170 {
10172 }
10173
10176 {
10177 int r,g,b,a;
10179 r = r/255;
10180 g = g/255;
10181 b = b/255;
10182 a = a/255;
10183 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10184 }
10185
10186
10187
10188 override void SetLiquidType(
int value,
bool allow_client =
false)
10189 {
10190 if (!IsServerCheck(allow_client))
10191 return;
10192
10197 }
10198
10200 {
10201 return ConfigGetInt("varLiquidTypeInit");
10202 }
10203
10205 {
10207 }
10208
10210 {
10212 SetFrozen(false);
10213 }
10214
10217 {
10218 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10219 }
10220
10221
10224 {
10225 PlayerBase nplayer;
10226 if (PlayerBase.CastTo(nplayer, player))
10227 {
10229 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10230 }
10231 }
10232
10233
10236 {
10237 PlayerBase nplayer;
10238 if (PlayerBase.CastTo(nplayer,player))
10239 {
10240 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10241 }
10242
10243 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10244
10245 if (HasEnergyManager())
10246 {
10247 GetCompEM().UpdatePlugState();
10248 }
10249 }
10250
10251
10253 {
10254 super.OnPlacementStarted(player);
10255
10257 }
10258
10259 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10260 {
10262 {
10263 m_AdminLog.OnPlacementComplete(player,
this);
10264 }
10265
10266 super.OnPlacementComplete(player, position, orientation);
10267 }
10268
10269
10270
10271
10272
10274 {
10276 {
10277 return true;
10278 }
10279 else
10280 {
10281 return false;
10282 }
10283 }
10284
10285
10287 {
10289 {
10291 }
10292 }
10293
10294
10296 {
10298 }
10299
10301 {
10303 }
10304
10305 override void InsertAgent(
int agent,
float count = 1)
10306 {
10307 if (count < 1)
10308 return;
10309
10311 }
10312
10315 {
10317 }
10318
10319
10321 {
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
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10367 {
10369 return false;
10370 return true;
10371 }
10372
10374 {
10375
10377 }
10378
10379
10382 {
10383 super.CheckForRoofLimited(timeTresholdMS);
10384
10385 float time =
g_Game.GetTime();
10386 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10387 {
10388 m_PreviousRoofTestTime = time;
10389 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10390 }
10391 }
10392
10393
10395 {
10397 {
10398 return 0;
10399 }
10400
10401 if (GetInventory().GetAttachmentSlotsCount() != 0)
10402 {
10403 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10404 if (filter)
10405 return filter.GetProtectionLevel(type, false, system);
10406 else
10407 return 0;
10408 }
10409
10410 string subclassPath, entryName;
10411
10412 switch (type)
10413 {
10415 entryName = "biological";
10416 break;
10418 entryName = "chemical";
10419 break;
10420 default:
10421 entryName = "biological";
10422 break;
10423 }
10424
10425 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10426
10427 return g_Game.ConfigGetFloat(subclassPath + entryName);
10428 }
10429
10430
10431
10434 {
10435 if (!IsMagazine())
10437
10439 }
10440
10441
10442
10443
10444
10449 {
10450 return true;
10451 }
10452
10454 {
10456 }
10457
10458
10459
10460
10461
10463 {
10464 if (parent)
10465 {
10466 if (parent.IsInherited(DayZInfected))
10467 return true;
10468
10469 if (!parent.IsRuined())
10470 return true;
10471 }
10472
10473 return true;
10474 }
10475
10477 {
10478 if (!super.CanPutAsAttachment(parent))
10479 {
10480 return false;
10481 }
10482
10483 if (!IsRuined() && !parent.IsRuined())
10484 {
10485 return true;
10486 }
10487
10488 return false;
10489 }
10490
10492 {
10493
10494
10495
10496
10497 return super.CanReceiveItemIntoCargo(item);
10498 }
10499
10501 {
10502
10503
10504
10505
10506 GameInventory attachmentInv = attachment.GetInventory();
10508 {
10509 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10510 return false;
10511 }
10512
10513 InventoryLocation loc = new InventoryLocation();
10514 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10515 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10516 return false;
10517
10518 return super.CanReceiveAttachment(attachment, slotId);
10519 }
10520
10522 {
10523 if (!super.CanReleaseAttachment(attachment))
10524 return false;
10525
10526 return GetInventory().AreChildrenAccessible();
10527 }
10528
10529
10530
10531
10532
10533
10534
10535
10536
10537
10538
10539
10540
10541
10542
10543
10544
10545
10546
10547
10548
10550 {
10551 int id = muzzle_owner.GetMuzzleID();
10552 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10553
10554 if (WPOF_array)
10555 {
10556 for (int i = 0; i < WPOF_array.Count(); i++)
10557 {
10558 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10559
10560 if (WPOF)
10561 {
10562 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10563 }
10564 }
10565 }
10566 }
10567
10568
10570 {
10571 int id = muzzle_owner.GetMuzzleID();
10573
10574 if (WPOBE_array)
10575 {
10576 for (int i = 0; i < WPOBE_array.Count(); i++)
10577 {
10578 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10579
10580 if (WPOBE)
10581 {
10582 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10583 }
10584 }
10585 }
10586 }
10587
10588
10590 {
10591 int id = muzzle_owner.GetMuzzleID();
10592 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10593
10594 if (WPOOH_array)
10595 {
10596 for (int i = 0; i < WPOOH_array.Count(); i++)
10597 {
10598 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10599
10600 if (WPOOH)
10601 {
10602 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10603 }
10604 }
10605 }
10606 }
10607
10608
10610 {
10611 int id = muzzle_owner.GetMuzzleID();
10612 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10613
10614 if (WPOOH_array)
10615 {
10616 for (int i = 0; i < WPOOH_array.Count(); i++)
10617 {
10618 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10619
10620 if (WPOOH)
10621 {
10622 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10623 }
10624 }
10625 }
10626 }
10627
10628
10630 {
10631 int id = muzzle_owner.GetMuzzleID();
10632 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10633
10634 if (WPOOH_array)
10635 {
10636 for (int i = 0; i < WPOOH_array.Count(); i++)
10637 {
10638 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10639
10640 if (WPOOH)
10641 {
10642 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10643 }
10644 }
10645 }
10646 }
10647
10648
10649
10651 {
10653 {
10654 return true;
10655 }
10656
10657 return false;
10658 }
10659
10661 {
10663 {
10664 return true;
10665 }
10666
10667 return false;
10668 }
10669
10671 {
10673 {
10674 return true;
10675 }
10676
10677 return false;
10678 }
10679
10681 {
10682 return false;
10683 }
10684
10687 {
10688 return UATimeSpent.DEFAULT_DEPLOY;
10689 }
10690
10691
10692
10693
10695 {
10697 SetSynchDirty();
10698 }
10699
10701 {
10703 }
10704
10705
10707 {
10708 return false;
10709 }
10710
10713 {
10714 string att_type = "None";
10715
10716 if (ConfigIsExisting("soundAttType"))
10717 {
10718 att_type = ConfigGetString("soundAttType");
10719 }
10720
10722 }
10723
10725 {
10727 }
10728
10729
10730
10731
10732
10738
10740 {
10743
10745 }
10746
10747
10749 {
10751 return;
10752
10754
10757
10760
10761 SoundParameters params = new SoundParameters();
10765 }
10766
10767
10769 {
10771 {
10774
10775 SetSynchDirty();
10776
10779 }
10780 }
10781
10783 {
10785 }
10786
10787
10789 {
10791 return;
10792
10794 SetSynchDirty();
10795
10798 }
10799
10801 {
10804 }
10805
10807 {
10809 }
10810
10811 void OnApply(PlayerBase player);
10812
10814 {
10815 return 1.0;
10816 };
10817
10819 {
10821 }
10822
10824 {
10826 }
10827
10829
10831 {
10832 SetDynamicPhysicsLifeTime(0.01);
10834 }
10835
10837 {
10838 array<string> zone_names = new array<string>;
10839 GetDamageZones(zone_names);
10840 for (int i = 0; i < zone_names.Count(); i++)
10841 {
10842 SetHealthMax(zone_names.Get(i),"Health");
10843 }
10844 SetHealthMax("","Health");
10845 }
10846
10849 {
10850 float global_health = GetHealth01("","Health");
10851 array<string> zones = new array<string>;
10852 GetDamageZones(zones);
10853
10854 for (int i = 0; i < zones.Count(); i++)
10855 {
10856 SetHealth01(zones.Get(i),"Health",global_health);
10857 }
10858 }
10859
10862 {
10863 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10864 }
10865
10867 {
10868 if (!hasRootAsPlayer)
10869 {
10870 if (refParentIB)
10871 {
10872
10873 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10874 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10875
10876 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10877 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10878
10881 }
10882 else
10883 {
10884
10887 }
10888 }
10889 }
10890
10892 {
10894 {
10895 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10896 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10897 {
10898 float heatPermCoef = 1.0;
10900 while (ent)
10901 {
10902 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10903 ent = ent.GetHierarchyParent();
10904 }
10905
10906 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10907 }
10908 }
10909 }
10910
10912 {
10913
10914 EntityAI parent = GetHierarchyParent();
10915 if (!parent)
10916 {
10917 hasParent = false;
10918 hasRootAsPlayer = false;
10919 }
10920 else
10921 {
10922 hasParent = true;
10923 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10924 refParentIB =
ItemBase.Cast(parent);
10925 }
10926 }
10927
10928 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10929 {
10930
10931 }
10932
10934 {
10935
10936 return false;
10937 }
10938
10940 {
10941
10942
10943 return false;
10944 }
10945
10947 {
10948
10949 return false;
10950 }
10951
10954 {
10955 return !GetIsFrozen() &&
IsOpen();
10956 }
10957
10959 {
10960 bool hasParent = false, hasRootAsPlayer = false;
10962
10963 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10964 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10965
10966 if (wwtu || foodDecay)
10967 {
10971
10972 if (processWetness || processTemperature || processDecay)
10973 {
10975
10976 if (processWetness)
10977 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10978
10979 if (processTemperature)
10981
10982 if (processDecay)
10983 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10984 }
10985 }
10986 }
10987
10990 {
10992 }
10993
10995 {
10998
10999 return super.GetTemperatureFreezeThreshold();
11000 }
11001
11003 {
11006
11007 return super.GetTemperatureThawThreshold();
11008 }
11009
11011 {
11014
11015 return super.GetItemOverheatThreshold();
11016 }
11017
11019 {
11021 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11022
11023 return super.GetTemperatureFreezeTime();
11024 }
11025
11027 {
11029 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11030
11031 return super.GetTemperatureThawTime();
11032 }
11033
11038
11040 {
11041 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11042 }
11043
11045 {
11046 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11047 }
11048
11051 {
11053 }
11054
11056 {
11058 }
11059
11061 {
11063 }
11064
11067 {
11068 return null;
11069 }
11070
11073 {
11074 return false;
11075 }
11076
11078 {
11080 {
11083 if (!trg)
11084 {
11086 explosive = this;
11087 }
11088
11089 explosive.PairRemote(trg);
11091
11092 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11093 trg.SetPersistentPairID(persistentID);
11094 explosive.SetPersistentPairID(persistentID);
11095
11096 return true;
11097 }
11098 return false;
11099 }
11100
11103 {
11104 float ret = 1.0;
11107 ret *= GetHealth01();
11108
11109 return ret;
11110 }
11111
11112 #ifdef DEVELOPER
11113 override void SetDebugItem()
11114 {
11115 super.SetDebugItem();
11116 _itemBase = this;
11117 }
11118
11120 {
11121 string text = super.GetDebugText();
11122
11124 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11125
11126 return text;
11127 }
11128 #endif
11129
11131 {
11132 return true;
11133 }
11134
11136
11138
11140 {
11143 }
11144
11145
11153
11169
11170 [
Obsolete(
"Use ItemSoundHandler instead")]
11173 {
11174 if (!
g_Game.IsDedicatedServer())
11175 {
11176 if (ConfigIsExisting("attachSoundSet"))
11177 {
11178 string cfg_path = "";
11179 string soundset = "";
11180 string type_name =
GetType();
11181
11184 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11185 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11186
11187 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11188 {
11189 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11190 {
11191 if (cfg_slot_array[i] == slot_type)
11192 {
11193 soundset = cfg_soundset_array[i];
11194 break;
11195 }
11196 }
11197 }
11198
11199 if (soundset != "")
11200 {
11201 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11203 }
11204 }
11205 }
11206 }
11207
11209}
11210
11212{
11214 if (entity)
11215 {
11216 bool is_item = entity.IsInherited(
ItemBase);
11217 if (is_item && full_quantity)
11218 {
11221 }
11222 }
11223 else
11224 {
11226 return NULL;
11227 }
11228 return entity;
11229}
11230
11232{
11233 if (item)
11234 {
11235 if (health > 0)
11236 item.SetHealth("", "", health);
11237
11238 if (item.CanHaveTemperature())
11239 {
11241 if (item.CanFreeze())
11242 item.SetFrozen(false);
11243 }
11244
11245 if (item.HasEnergyManager())
11246 {
11247 if (quantity >= 0)
11248 {
11249 item.GetCompEM().SetEnergy0To1(quantity);
11250 }
11251 else
11252 {
11254 }
11255 }
11256 else if (item.IsMagazine())
11257 {
11258 Magazine mag = Magazine.Cast(item);
11259 if (quantity >= 0)
11260 {
11261 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11262 }
11263 else
11264 {
11266 }
11267
11268 }
11269 else
11270 {
11271 if (quantity >= 0)
11272 {
11273 item.SetQuantityNormalized(quantity, false);
11274 }
11275 else
11276 {
11278 }
11279
11280 }
11281 }
11282}
11283
11284#ifdef DEVELOPER
11286#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.