6341{
6343 {
6344 return true;
6345 }
6346};
6347
6349{
6350
6351};
6352
6353
6354
6356{
6360
6362
6365
6366
6367
6368
6369
6378
6384
6389
6394
6415 protected bool m_IsResultOfSplit
6416
6418
6423
6424
6425
6427
6431
6432
6433
6435
6438
6439
6440
6446
6447
6455
6458
6459
6461
6462
6464
6465
6470
6471
6476
6478
6479
6481
6482
6484 {
6489
6490 if (!
g_Game.IsDedicatedServer())
6491 {
6493 {
6495
6497 {
6499 }
6500 }
6501
6504 }
6505
6506 m_OldLocation = null;
6507
6509 {
6511 }
6512
6513 if (ConfigIsExisting("headSelectionsToHide"))
6514 {
6517 }
6518
6520 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6521 {
6523 }
6524
6526
6527 m_IsResultOfSplit = false;
6528
6530 }
6531
6533 {
6534 super.InitItemVariables();
6535
6541 m_Count = ConfigGetInt(
"count");
6542
6545
6550
6553
6558
6570
6574
6575
6578 if (ConfigIsExisting("canBeSplit"))
6579 {
6582 }
6583
6585 if (ConfigIsExisting("itemBehaviour"))
6587
6588
6591 RegisterNetSyncVariableInt("m_VarLiquidType");
6592 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6593
6594 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6595 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6596 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6597
6598 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6599 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6600 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6601 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6602
6603 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6604 RegisterNetSyncVariableBool("m_IsTakeable");
6605 RegisterNetSyncVariableBool("m_IsHologram");
6606
6609 {
6612 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6613 }
6614
6616
6618 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6620
6622 }
6623
6625 {
6627 }
6628
6630 {
6633 {
6638 }
6639 }
6640
6641 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6642 {
6644 {
6647 }
6648
6650 }
6651
6653 {
6659 }
6660
6662
6664 {
6666
6667 if (!action)
6668 {
6669 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6670 return;
6671 }
6672
6674 if (!ai)
6675 {
6677 return;
6678 }
6679
6681 if (!action_array)
6682 {
6683 action_array = new array<ActionBase_Basic>;
6685 }
6686 if (LogManager.IsActionLogEnable())
6687 {
6688 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6689 }
6690
6691 if (action_array.Find(action) != -1)
6692 {
6693 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6694 }
6695 else
6696 {
6697 action_array.Insert(action);
6698 }
6699 }
6700
6702 {
6703 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6704 ActionBase action = player.GetActionManager().GetAction(actionName);
6707
6708 if (action_array)
6709 {
6710 action_array.RemoveItem(action);
6711 }
6712 }
6713
6714
6715
6717 {
6718 ActionOverrideData overrideData = new ActionOverrideData();
6722
6724 if (!actionMap)
6725 {
6728 }
6729
6730 actionMap.Insert(this.
Type(), overrideData);
6731
6732 }
6733
6735
6737
6738
6740 {
6743
6746
6747 string config_to_search = "CfgVehicles";
6748 string muzzle_owner_config;
6749
6751 {
6752 if (IsInherited(Weapon))
6753 config_to_search = "CfgWeapons";
6754
6755 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6756
6757 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6758
6759 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6760
6761 if (config_OnFire_subclass_count > 0)
6762 {
6763 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6764
6765 for (int i = 0; i < config_OnFire_subclass_count; i++)
6766 {
6767 string particle_class = "";
6768 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6769 string config_OnFire_entry = config_OnFire_class + particle_class;
6770 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6771 WPOF_array.Insert(WPOF);
6772 }
6773
6774
6776 }
6777 }
6778
6780 {
6781 config_to_search = "CfgWeapons";
6782 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6783
6784 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6785
6786 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6787
6788 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6789 {
6790 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6791
6792 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6793 {
6794 string particle_class2 = "";
6795 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6796 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6797 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6798 WPOBE_array.Insert(WPOBE);
6799 }
6800
6801
6803 }
6804 }
6805 }
6806
6807
6809 {
6812
6814 {
6815 string config_to_search = "CfgVehicles";
6816
6817 if (IsInherited(Weapon))
6818 config_to_search = "CfgWeapons";
6819
6820 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6821 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6822
6823 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6824 {
6825
6827
6829 {
6831 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6833 return;
6834 }
6835
6838
6839
6840
6841 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6842 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6843
6844 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6845 {
6846 string particle_class = "";
6847 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6848 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6849 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6850
6851 if (entry_type == CT_CLASS)
6852 {
6853 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6854 WPOOH_array.Insert(WPOF);
6855 }
6856 }
6857
6858
6860 }
6861 }
6862 }
6863
6865 {
6867 }
6868
6870 {
6872 {
6874
6877
6880
6881 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6882 }
6883 }
6884
6886 {
6888 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6889
6891 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6892
6894 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6895
6897 {
6899 }
6900 }
6901
6903 {
6905 }
6906
6908 {
6911 else
6913
6915 {
6918 }
6919 else
6920 {
6923
6926 }
6927
6929 }
6930
6932 {
6934 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6935 }
6936
6938 {
6940 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6942 }
6943
6945 {
6947 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6948 }
6949
6951 {
6954
6955 OverheatingParticle OP = new OverheatingParticle();
6960
6962 }
6963
6965 {
6968
6969 return -1;
6970 }
6971
6973 {
6975 {
6978
6979 for (int i = count; i > 0; --i)
6980 {
6981 int id = i - 1;
6984
6987
6988 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6989 {
6990 if (p)
6991 {
6994 }
6995 }
6996 }
6997 }
6998 }
6999
7001 {
7003 {
7005 {
7006 int id = i - 1;
7008
7009 if (OP)
7010 {
7012
7013 if (p)
7014 {
7016 }
7017
7018 delete OP;
7019 }
7020 }
7021
7024 }
7025 }
7026
7029 {
7030 return 0.0;
7031 }
7032
7033
7035 {
7036 return 250;
7037 }
7038
7040 {
7041 return 0;
7042 }
7043
7046 {
7048 return true;
7049
7050 return false;
7051 }
7052
7055 {
7058
7060 {
7062 }
7063 else
7064 {
7065
7067 }
7068
7070 }
7071
7078 {
7079 return -1;
7080 }
7081
7082
7083
7084
7086 {
7088 {
7089 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7090 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7091
7092 if (r_index >= 0)
7093 {
7094 InventoryLocation r_il = new InventoryLocation;
7095 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7096
7097 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7100 {
7101 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7102 }
7104 {
7105 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7106 }
7107
7108 }
7109
7110 player.GetHumanInventory().ClearUserReservedLocation(this);
7111 }
7112
7115 }
7116
7117
7118
7119
7121 {
7122 return ItemBase.m_DebugActionsMask;
7123 }
7124
7126 {
7127 return ItemBase.m_DebugActionsMask & mask;
7128 }
7129
7131 {
7132 ItemBase.m_DebugActionsMask = mask;
7133 }
7134
7136 {
7137 ItemBase.m_DebugActionsMask |= mask;
7138 }
7139
7141 {
7142 ItemBase.m_DebugActionsMask &= ~mask;
7143 }
7144
7146 {
7148 {
7150 }
7151 else
7152 {
7154 }
7155 }
7156
7157
7159 {
7160 if (GetEconomyProfile())
7161 {
7162 float q_max = GetEconomyProfile().GetQuantityMax();
7163 if (q_max > 0)
7164 {
7165 float q_min = GetEconomyProfile().GetQuantityMin();
7166 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7167
7169 {
7170 ComponentEnergyManager comp = GetCompEM();
7172 {
7174 }
7175 }
7177 {
7179
7180 }
7181
7182 }
7183 }
7184 }
7185
7188 {
7189 EntityAI parent = GetHierarchyParent();
7190
7191 if (parent)
7192 {
7193 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7194 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7195 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7196 }
7197 }
7198
7201 {
7202 EntityAI parent = GetHierarchyParent();
7203
7204 if (parent)
7205 {
7206 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7207 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7208 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7209 }
7210 }
7211
7213 {
7214
7215
7216
7217
7219
7221 {
7222 if (ScriptInputUserData.CanStoreInputUserData())
7223 {
7224 ScriptInputUserData ctx = new ScriptInputUserData;
7230 ctx.
Write(use_stack_max);
7233
7235 {
7236 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7237 }
7238 }
7239 }
7240 else if (!
g_Game.IsMultiplayer())
7241 {
7243 }
7244 }
7245
7247 {
7249 }
7250
7252 {
7254 }
7255
7257 {
7259 }
7260
7262 {
7263
7264 return false;
7265 }
7266
7268 {
7269 return false;
7270 }
7271
7275 {
7276 return false;
7277 }
7278
7280 {
7281 return "";
7282 }
7283
7285
7287 {
7288 return false;
7289 }
7290
7292 {
7293 return true;
7294 }
7295
7296
7297
7299 {
7300 return true;
7301 }
7302
7304 {
7305 return true;
7306 }
7307
7309 {
7310 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7312 }
7313
7315 {
7317 }
7318
7320 {
7322 if (!is_being_placed)
7324 SetSynchDirty();
7325 }
7326
7327
7329
7331 {
7333 }
7334
7336 {
7338 }
7339
7341 {
7342 return 1;
7343 }
7344
7346 {
7347 return false;
7348 }
7349
7351 {
7353 SetSynchDirty();
7354 }
7355
7356
7357
7358
7359
7360
7361
7362
7363
7364
7365
7366
7367
7368
7369
7370
7371
7372
7373
7374
7375
7376
7377
7378
7379
7380
7381
7382
7383
7384
7385
7386
7387
7388
7389
7391 {
7392 super.OnMovedInsideCargo(container);
7393
7394 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7395 }
7396
7397 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7398 {
7399 super.EEItemLocationChanged(oldLoc, newLoc);
7400
7401 PlayerBase newPlayer = null;
7402 PlayerBase oldPlayer = null;
7403
7404 if (newLoc.GetParent())
7405 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7406
7407 if (oldLoc.GetParent())
7408 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7409
7411 {
7412 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7413
7414 if (rIndex >= 0)
7415 {
7416 InventoryLocation rIl = new InventoryLocation;
7417 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7418
7419 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7422 {
7423 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7424 }
7426 {
7428 }
7429
7430 }
7431 }
7432
7434 {
7435 if (newPlayer)
7436 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7437
7438 if (newPlayer == oldPlayer)
7439 {
7440 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7441 {
7443 {
7444 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7445 {
7446 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7447 }
7448 }
7449 else
7450 {
7451 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7452 }
7453 }
7454
7455 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7456 {
7457 int type = oldLoc.GetType();
7459 {
7460 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7461 }
7463 {
7464 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7465 }
7466 }
7467 if (!m_OldLocation)
7468 {
7469 m_OldLocation = new InventoryLocation;
7470 }
7471 m_OldLocation.Copy(oldLoc);
7472 }
7473 else
7474 {
7475 if (m_OldLocation)
7476 {
7477 m_OldLocation.Reset();
7478 }
7479 }
7480
7481 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7482 }
7483 else
7484 {
7485 if (newPlayer)
7486 {
7487 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7488 if (resIndex >= 0)
7489 {
7490 InventoryLocation il = new InventoryLocation;
7491 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7493 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7496 {
7497 il.
GetParent().GetOnReleaseLock().Invoke(it);
7498 }
7500 {
7502 }
7503
7504 }
7505 }
7507 {
7508
7510 }
7511
7512 if (m_OldLocation)
7513 {
7514 m_OldLocation.Reset();
7515 }
7516 }
7517
7519 {
7520 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7521 }
7522
7524 {
7525 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7526 }
7527 }
7528
7529 override void EOnContact(IEntity other, Contact extra)
7530 {
7532 {
7533 int liquidType = -1;
7535 if (impactSpeed > 0.0)
7536 {
7538 #ifndef SERVER
7540 #else
7542 SetSynchDirty();
7543 #endif
7545 }
7546 }
7547
7548 #ifdef SERVER
7549 if (GetCompEM() && GetCompEM().IsPlugged())
7550 {
7551 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7552 GetCompEM().UnplugThis();
7553 }
7554 #endif
7555 }
7556
7558
7560 {
7562 }
7563
7565 {
7566
7567 }
7568
7570 {
7571 super.OnItemLocationChanged(old_owner, new_owner);
7572
7573 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7574 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7575
7576 if (!relatedPlayer && playerNew)
7577 relatedPlayer = playerNew;
7578
7579 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7580 {
7582 if (actionMgr)
7583 {
7584 ActionBase currentAction = actionMgr.GetRunningAction();
7585 if (currentAction)
7587 }
7588 }
7589
7590 Man ownerPlayerOld = null;
7591 Man ownerPlayerNew = null;
7592
7593 if (old_owner)
7594 {
7595 if (old_owner.
IsMan())
7596 {
7597 ownerPlayerOld = Man.Cast(old_owner);
7598 }
7599 else
7600 {
7601 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7602 }
7603 }
7604 else
7605 {
7607 {
7609
7610 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7611 {
7612 GetCompEM().UnplugThis();
7613 }
7614 }
7615 }
7616
7617 if (new_owner)
7618 {
7619 if (new_owner.
IsMan())
7620 {
7621 ownerPlayerNew = Man.Cast(new_owner);
7622 }
7623 else
7624 {
7625 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7626 }
7627 }
7628
7629 if (ownerPlayerOld != ownerPlayerNew)
7630 {
7631 if (ownerPlayerOld)
7632 {
7633 array<EntityAI> subItemsExit = new array<EntityAI>;
7635 for (int i = 0; i < subItemsExit.Count(); i++)
7636 {
7639 }
7640 }
7641
7642 if (ownerPlayerNew)
7643 {
7644 array<EntityAI> subItemsEnter = new array<EntityAI>;
7646 for (int j = 0; j < subItemsEnter.Count(); j++)
7647 {
7650 }
7651 }
7652 }
7653 else if (ownerPlayerNew != null)
7654 {
7655 PlayerBase nplayer;
7656 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7657 {
7658 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7660 for (int k = 0; k < subItemsUpdate.Count(); k++)
7661 {
7663 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7664 }
7665 }
7666 }
7667
7668 if (old_owner)
7669 old_owner.OnChildItemRemoved(this);
7670 if (new_owner)
7671 new_owner.OnChildItemReceived(this);
7672 }
7673
7674
7676 {
7677 super.EEDelete(parent);
7678 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7679 if (player)
7680 {
7682
7683 if (player.IsAlive())
7684 {
7685 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7686 if (r_index >= 0)
7687 {
7688 InventoryLocation r_il = new InventoryLocation;
7689 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7690
7691 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7694 {
7695 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7696 }
7698 {
7699 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7700 }
7701
7702 }
7703
7704 player.RemoveQuickBarEntityShortcut(this);
7705 }
7706 }
7707 }
7708
7710 {
7711 super.EEKilled(killer);
7712
7715 {
7716 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7717 {
7718 if (IsMagazine())
7719 {
7720 if (Magazine.Cast(this).GetAmmoCount() > 0)
7721 {
7723 }
7724 }
7725 else
7726 {
7728 }
7729 }
7730 }
7731 }
7732
7734 {
7735 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7736
7737 super.OnWasAttached(parent, slot_id);
7738
7741
7744 }
7745
7747 {
7748 super.OnWasDetached(parent, slot_id);
7749
7752
7755 }
7756
7758 {
7759 int idx;
7762
7763 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7764 if (inventory_slots.Count() < 1)
7765 {
7766 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7767 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7768 }
7769 else
7770 {
7771 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7772 }
7773
7774 idx = inventory_slots.Find(slot);
7775 if (idx < 0)
7776 return "";
7777
7778 return attach_types.Get(idx);
7779 }
7780
7782 {
7783 int idx = -1;
7784 string slot;
7785
7788
7789 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7790 if (inventory_slots.Count() < 1)
7791 {
7792 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7793 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7794 }
7795 else
7796 {
7797 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7798 if (detach_types.Count() < 1)
7799 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7800 }
7801
7802 for (int i = 0; i < inventory_slots.Count(); i++)
7803 {
7804 slot = inventory_slots.Get(i);
7805 }
7806
7807 if (slot != "")
7808 {
7809 if (detach_types.Count() == 1)
7810 idx = 0;
7811 else
7812 idx = inventory_slots.Find(slot);
7813 }
7814 if (idx < 0)
7815 return "";
7816
7817 return detach_types.Get(idx);
7818 }
7819
7821 {
7822
7824
7825
7826 float min_time = 1;
7827 float max_time = 3;
7828 float delay = Math.RandomFloat(min_time, max_time);
7829
7830 explode_timer.Run(delay, this, "DoAmmoExplosion");
7831 }
7832
7834 {
7835 Magazine magazine = Magazine.Cast(this);
7836 int pop_sounds_count = 6;
7837 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7838
7839
7840 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7841 string sound_name = pop_sounds[ sound_idx ];
7842 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7843
7844
7845 magazine.ServerAddAmmoCount(-1);
7846
7847
7848 float min_temp_to_explode = 100;
7849
7850 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7851 {
7853 }
7854 }
7855
7856
7857 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7858 {
7859 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7860
7861 const int CHANCE_DAMAGE_CARGO = 4;
7862 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7863 const int CHANCE_DAMAGE_NOTHING = 2;
7864
7866 {
7867 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7868 int chances;
7869 int rnd;
7870
7871 if (GetInventory().GetCargo())
7872 {
7873 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7874 rnd = Math.RandomInt(0,chances);
7875
7876 if (rnd < CHANCE_DAMAGE_CARGO)
7877 {
7879 }
7880 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7881 {
7883 }
7884 }
7885 else
7886 {
7887 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7888 rnd = Math.RandomInt(0,chances);
7889
7890 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7891 {
7893 }
7894 }
7895 }
7896 }
7897
7899 {
7900 CargoBase cargo = GetInventory().GetCargo();
7901 if (cargo)
7902 {
7904 if (item_count > 0)
7905 {
7906 int random_pick = Math.RandomInt(0, item_count);
7908 if (!item.IsExplosive())
7909 {
7910 item.AddHealth("","",damage);
7911 return true;
7912 }
7913 }
7914 }
7915 return false;
7916 }
7917
7919 {
7920 GameInventory inventory = GetInventory();
7922 if (attachment_count > 0)
7923 {
7924 int random_pick = Math.RandomInt(0, attachment_count);
7926 if (!attachment.IsExplosive())
7927 {
7928 attachment.AddHealth("","",damage);
7929 return true;
7930 }
7931 }
7932 return false;
7933 }
7934
7936 {
7938 }
7939
7941 {
7943 return GetInventory().CanRemoveEntity();
7944
7945 return false;
7946 }
7947
7949 {
7950
7952 return false;
7953
7954
7956 return false;
7957
7958
7959
7961 if (delta == 0)
7962 return false;
7963
7964
7965 return true;
7966 }
7967
7969 {
7971 {
7972 if (ScriptInputUserData.CanStoreInputUserData())
7973 {
7974 ScriptInputUserData ctx = new ScriptInputUserData;
7979 ctx.
Write(destination_entity);
7983 }
7984 }
7985 else if (!
g_Game.IsMultiplayer())
7986 {
7988 }
7989 }
7990
7992 {
7993 float split_quantity_new;
7997 InventoryLocation loc = new InventoryLocation;
7998
7999 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8000 {
8002 split_quantity_new = stack_max;
8003 else
8005
8007 {
8008 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8009 if (new_item)
8010 {
8011 new_item.SetResultOfSplit(true);
8012 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8014 new_item.
SetQuantity(split_quantity_new,
false,
true);
8015 }
8016 }
8017 }
8018 else if (destination_entity && slot_id == -1)
8019 {
8020 if (quantity > stack_max)
8021 split_quantity_new = stack_max;
8022 else
8023 split_quantity_new = quantity;
8024
8026 {
8027 GameInventory destinationInventory = destination_entity.GetInventory();
8029 {
8032 }
8033
8034 if (new_item)
8035 {
8036 new_item.SetResultOfSplit(true);
8037 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8039 new_item.
SetQuantity(split_quantity_new,
false,
true);
8040 }
8041 }
8042 }
8043 else
8044 {
8045 if (stack_max != 0)
8046 {
8048 {
8050 }
8051
8052 if (split_quantity_new == 0)
8053 {
8054 if (!
g_Game.IsMultiplayer())
8055 player.PhysicalPredictiveDropItem(this);
8056 else
8057 player.ServerDropEntity(this);
8058 return;
8059 }
8060
8062 {
8064
8065 if (new_item)
8066 {
8067 new_item.SetResultOfSplit(true);
8068 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8071 new_item.PlaceOnSurface();
8072 }
8073 }
8074 }
8075 }
8076 }
8077
8079 {
8080 float split_quantity_new;
8084 InventoryLocation loc = new InventoryLocation;
8085
8086 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8087 {
8089 split_quantity_new = stack_max;
8090 else
8092
8094 {
8095 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8096 if (new_item)
8097 {
8098 new_item.SetResultOfSplit(true);
8099 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8101 new_item.
SetQuantity(split_quantity_new,
false,
true);
8102 }
8103 }
8104 }
8105 else if (destination_entity && slot_id == -1)
8106 {
8107 if (quantity > stack_max)
8108 split_quantity_new = stack_max;
8109 else
8110 split_quantity_new = quantity;
8111
8113 {
8114 GameInventory destinationInventory = destination_entity.GetInventory();
8116 {
8119 }
8120
8121 if (new_item)
8122 {
8123 new_item.SetResultOfSplit(true);
8124 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8126 new_item.
SetQuantity(split_quantity_new,
false,
true);
8127 }
8128 }
8129 }
8130 else
8131 {
8132 if (stack_max != 0)
8133 {
8135 {
8137 }
8138
8140 {
8142
8143 if (new_item)
8144 {
8145 new_item.SetResultOfSplit(true);
8146 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8149 new_item.PlaceOnSurface();
8150 }
8151 }
8152 }
8153 }
8154 }
8155
8157 {
8159 {
8160 if (ScriptInputUserData.CanStoreInputUserData())
8161 {
8162 ScriptInputUserData ctx = new ScriptInputUserData;
8167 dst.WriteToContext(ctx);
8169 }
8170 }
8171 else if (!
g_Game.IsMultiplayer())
8172 {
8174 }
8175 }
8176
8178 {
8180 {
8181 if (ScriptInputUserData.CanStoreInputUserData())
8182 {
8183 ScriptInputUserData ctx = new ScriptInputUserData;
8188 ctx.
Write(destination_entity);
8194 }
8195 }
8196 else if (!
g_Game.IsMultiplayer())
8197 {
8199 }
8200 }
8201
8203 {
8205 }
8206
8208 {
8210 float split_quantity_new;
8212 if (dst.IsValid())
8213 {
8214 int slot_id = dst.GetSlot();
8216
8217 if (quantity > stack_max)
8218 split_quantity_new = stack_max;
8219 else
8220 split_quantity_new = quantity;
8221
8223 {
8225
8226 if (new_item)
8227 {
8228 new_item.SetResultOfSplit(true);
8229 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8231 new_item.
SetQuantity(split_quantity_new,
false,
true);
8232 }
8233
8234 return new_item;
8235 }
8236 }
8237
8238 return null;
8239 }
8240
8242 {
8244 float split_quantity_new;
8246 if (destination_entity)
8247 {
8249 if (quantity > stackable)
8250 split_quantity_new = stackable;
8251 else
8252 split_quantity_new = quantity;
8253
8255 {
8256 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8257 if (new_item)
8258 {
8259 new_item.SetResultOfSplit(true);
8260 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8262 new_item.
SetQuantity(split_quantity_new,
false,
true);
8263 }
8264 }
8265 }
8266 }
8267
8269 {
8271 {
8272 if (ScriptInputUserData.CanStoreInputUserData())
8273 {
8274 ScriptInputUserData ctx = new ScriptInputUserData;
8279 ItemBase destination_entity =
this;
8280 ctx.
Write(destination_entity);
8284 }
8285 }
8286 else if (!
g_Game.IsMultiplayer())
8287 {
8289 }
8290 }
8291
8293 {
8295 float split_quantity_new;
8297 if (player)
8298 {
8300 if (quantity > stackable)
8301 split_quantity_new = stackable;
8302 else
8303 split_quantity_new = quantity;
8304
8306 {
8307 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8308 new_item =
ItemBase.Cast(in_hands);
8309 if (new_item)
8310 {
8311 new_item.SetResultOfSplit(true);
8312 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8314 new_item.SetQuantity(split_quantity_new, false, true);
8315 }
8316 }
8317 }
8318 }
8319
8321 {
8323 float split_quantity_new = Math.Floor(quantity * 0.5);
8324
8326 return;
8327
8329
8330 if (new_item)
8331 {
8332 if (new_item.GetQuantityMax() < split_quantity_new)
8333 {
8334 split_quantity_new = new_item.GetQuantityMax();
8335 }
8336
8337 new_item.SetResultOfSplit(true);
8338 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8339
8341 {
8344 }
8345 else
8346 {
8348 new_item.
SetQuantity(split_quantity_new,
false,
true);
8349 }
8350 }
8351 }
8352
8354 {
8356 float split_quantity_new = Math.Floor(quantity / 2);
8357
8359 return;
8360
8361 InventoryLocation invloc = new InventoryLocation;
8363
8365 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8366
8367 if (new_item)
8368 {
8369 if (new_item.GetQuantityMax() < split_quantity_new)
8370 {
8371 split_quantity_new = new_item.GetQuantityMax();
8372 }
8374 {
8377 }
8378 else if (split_quantity_new > 1)
8379 {
8381 new_item.
SetQuantity(split_quantity_new,
false,
true);
8382 }
8383 }
8384 }
8385
8388 {
8389 SetWeightDirty();
8391
8392 if (parent)
8393 parent.OnAttachmentQuantityChangedEx(this, delta);
8394
8396 {
8398 {
8400 }
8402 {
8403 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8405 }
8406 }
8407 }
8408
8411 {
8412
8413 }
8414
8417 {
8419 }
8420
8422 {
8423 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8424
8426 {
8427 if (newLevel == GameConstants.STATE_RUINED)
8428 {
8430 EntityAI parent = GetHierarchyParent();
8431 if (parent && parent.IsFireplace())
8432 {
8433 CargoBase cargo = GetInventory().GetCargo();
8434 if (cargo)
8435 {
8437 {
8439 }
8440 }
8441 }
8442 }
8443
8445 {
8446
8448 return;
8449 }
8450
8451 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8452 {
8454 }
8455 }
8456 }
8457
8458
8460 {
8461 super.OnRightClick();
8462
8464 {
8466 {
8467 if (ScriptInputUserData.CanStoreInputUserData())
8468 {
8469 EntityAI root = GetHierarchyRoot();
8470 Man playerOwner = GetHierarchyRootPlayer();
8471 InventoryLocation dst = new InventoryLocation;
8472
8473
8474 if (!playerOwner && root && root == this)
8475 {
8477 }
8478 else
8479 {
8480
8481 GetInventory().GetCurrentInventoryLocation(dst);
8483 {
8484 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8486 {
8488 }
8489 else
8490 {
8492
8493
8494 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8495 {
8497 }
8498 else
8499 {
8500 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8501 }
8502 }
8503 }
8504 }
8505
8506 ScriptInputUserData ctx = new ScriptInputUserData;
8514 }
8515 }
8516 else if (!
g_Game.IsMultiplayer())
8517 {
8519 }
8520 }
8521 }
8522
8524 {
8525 if (root)
8526 {
8527 vector m4[4];
8528 root.GetTransform(m4);
8529 dst.SetGround(this, m4);
8530 }
8531 else
8532 {
8533 GetInventory().GetCurrentInventoryLocation(dst);
8534 }
8535 }
8536
8537 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8538 {
8539
8540 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8541 return false;
8542
8543 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8544 return false;
8545
8546
8548 return false;
8549
8550
8551 Magazine mag = Magazine.Cast(this);
8552 if (mag)
8553 {
8554 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8555 return false;
8556
8557 if (stack_max_limit)
8558 {
8559 Magazine other_mag = Magazine.Cast(other_item);
8560 if (other_item)
8561 {
8562 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8563 return false;
8564 }
8565
8566 }
8567 }
8568 else
8569 {
8570
8572 return false;
8573
8575 return false;
8576 }
8577
8578 PlayerBase player = null;
8579 if (CastTo(player, GetHierarchyRootPlayer()))
8580 {
8581 if (player.GetInventory().HasAttachment(this))
8582 return false;
8583
8584 if (player.IsItemsToDelete())
8585 return false;
8586 }
8587
8588 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8589 return false;
8590
8591 int slotID;
8593 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8594 return false;
8595
8596 return true;
8597 }
8598
8600 {
8602 }
8603
8605 {
8606 return m_IsResultOfSplit;
8607 }
8608
8610 {
8611 m_IsResultOfSplit = value;
8612 }
8613
8615 {
8617 }
8618
8620 {
8621 float other_item_quantity = other_item.GetQuantity();
8622 float this_free_space;
8623
8625
8627
8628 if (other_item_quantity > this_free_space)
8629 {
8630 return this_free_space;
8631 }
8632 else
8633 {
8634 return other_item_quantity;
8635 }
8636 }
8637
8639 {
8641 }
8642
8644 {
8646 return;
8647
8648 if (!IsMagazine() && other_item)
8649 {
8651 if (quantity_used != 0)
8652 {
8653 float hp1 = GetHealth01("","");
8654 float hp2 = other_item.GetHealth01("","");
8655 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8656 hpResult = hpResult / (
GetQuantity() + quantity_used);
8657
8658 hpResult *= GetMaxHealth();
8659 Math.Round(hpResult);
8660 SetHealth("", "Health", hpResult);
8661
8663 other_item.AddQuantity(-quantity_used);
8664 }
8665 }
8667 }
8668
8670 {
8671 #ifdef SERVER
8672 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8673 GetHierarchyParent().IncreaseLifetimeUp();
8674 #endif
8675 };
8676
8678 {
8679 PlayerBase p = PlayerBase.Cast(player);
8680
8681 array<int> recipesIds = p.m_Recipes;
8682 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8683 if (moduleRecipesManager)
8684 {
8685 EntityAI itemInHands = player.GetEntityInHands();
8686 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8687 }
8688
8689 for (int i = 0;i < recipesIds.Count(); i++)
8690 {
8691 int key = recipesIds.Get(i);
8692 string recipeName = moduleRecipesManager.GetRecipeName(key);
8694 }
8695 }
8696
8697
8698 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8699 {
8700 super.GetDebugActions(outputList);
8701
8702
8708
8709
8714
8719
8720
8724
8725
8727 {
8731 }
8732
8735
8736
8740
8742
8743 InventoryLocation loc = new InventoryLocation();
8744 GetInventory().GetCurrentInventoryLocation(loc);
8746 {
8747 if (Gizmo_IsSupported())
8750 }
8751
8753 }
8754
8755
8756
8757
8759 {
8760 super.OnAction(action_id, player, ctx);
8761
8763 {
8764 switch (action_id)
8765 {
8769 return true;
8773 return true;
8774 }
8775 }
8776
8778 {
8779 switch (action_id)
8780 {
8782 Delete();
8783 return true;
8784 }
8785 }
8786
8787 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8788 {
8789 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8790 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8791 PlayerBase p = PlayerBase.Cast(player);
8792 if (
EActions.RECIPES_RANGE_START < 1000)
8793 {
8794 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8795 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8796 }
8797 }
8798 #ifndef SERVER
8799 else if (action_id ==
EActions.WATCH_PLAYER)
8800 {
8801 PluginDeveloper.SetDeveloperItemClientEx(player);
8802 }
8803 #endif
8805 {
8806 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8807 {
8808 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8809 OnDebugButtonPressServer(id + 1);
8810 }
8811
8812 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8813 {
8814 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8816 }
8817
8818 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8819 {
8820 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8822 }
8823
8824 else if (action_id ==
EActions.ADD_QUANTITY)
8825 {
8826 if (IsMagazine())
8827 {
8828 Magazine mag = Magazine.Cast(this);
8829 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8830 }
8831 else
8832 {
8834 }
8835
8836 if (m_EM)
8837 {
8838 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8839 }
8840
8841 }
8842
8843 else if (action_id ==
EActions.REMOVE_QUANTITY)
8844 {
8845 if (IsMagazine())
8846 {
8847 Magazine mag2 = Magazine.Cast(this);
8848 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8849 }
8850 else
8851 {
8853 }
8854 if (m_EM)
8855 {
8856 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8857 }
8858
8859 }
8860
8861 else if (action_id ==
EActions.SET_QUANTITY_0)
8862 {
8864
8865 if (m_EM)
8866 {
8867 m_EM.SetEnergy(0);
8868 }
8869 }
8870
8871 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8872 {
8874
8875 if (m_EM)
8876 {
8877 m_EM.SetEnergy(m_EM.GetEnergyMax());
8878 }
8879 }
8880
8881 else if (action_id ==
EActions.ADD_HEALTH)
8882 {
8883 AddHealth("","",GetMaxHealth("","Health")/5);
8884 }
8885 else if (action_id ==
EActions.REMOVE_HEALTH)
8886 {
8887 AddHealth("","",-GetMaxHealth("","Health")/5);
8888 }
8889 else if (action_id ==
EActions.DESTROY_HEALTH)
8890 {
8891 SetHealth01("","",0);
8892 }
8893 else if (action_id ==
EActions.WATCH_ITEM)
8894 {
8896 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8897 #ifdef DEVELOPER
8898 SetDebugDeveloper_item(this);
8899 #endif
8900 }
8901
8902 else if (action_id ==
EActions.ADD_TEMPERATURE)
8903 {
8904 AddTemperature(20);
8905
8906 }
8907
8908 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8909 {
8910 AddTemperature(-20);
8911
8912 }
8913
8914 else if (action_id ==
EActions.FLIP_FROZEN)
8915 {
8916 SetFrozen(!GetIsFrozen());
8917
8918 }
8919
8920 else if (action_id ==
EActions.ADD_WETNESS)
8921 {
8923
8924 }
8925
8926 else if (action_id ==
EActions.REMOVE_WETNESS)
8927 {
8929
8930 }
8931
8932 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8933 {
8936
8937
8938 }
8939
8940 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8941 {
8944 }
8945
8946 else if (action_id ==
EActions.MAKE_SPECIAL)
8947 {
8948 auto debugParams = DebugSpawnParams.WithPlayer(player);
8949 OnDebugSpawnEx(debugParams);
8950 }
8951
8952 }
8953
8954
8955 return false;
8956 }
8957
8958
8959
8960
8964
8967
8968
8969
8971 {
8972 return false;
8973 }
8974
8975
8977 {
8978 return true;
8979 }
8980
8981
8983 {
8984 return true;
8985 }
8986
8987
8988
8990 {
8991 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8992 return g_Game.ConfigIsExisting(config_path);
8993 }
8994
8997 {
8998 return null;
8999 }
9000
9002 {
9003 return false;
9004 }
9005
9007 {
9008 return false;
9009 }
9010
9014
9015
9017 {
9018 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9019 return module_repairing.CanRepair(this, item_repair_kit);
9020 }
9021
9022
9023 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9024 {
9025 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9026 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9027 }
9028
9029
9031 {
9032
9033
9034
9035
9036
9037
9038
9039
9040 return 1;
9041 }
9042
9043
9044
9046 {
9048 }
9049
9050
9051
9053 {
9055 }
9056
9057
9066 {
9067 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9068
9069 if (player)
9070 {
9071 player.MessageStatus(text);
9072 }
9073 }
9074
9075
9084 {
9085 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9086
9087 if (player)
9088 {
9089 player.MessageAction(text);
9090 }
9091 }
9092
9093
9102 {
9103 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9104
9105 if (player)
9106 {
9107 player.MessageFriendly(text);
9108 }
9109 }
9110
9111
9120 {
9121 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9122
9123 if (player)
9124 {
9125 player.MessageImportant(text);
9126 }
9127 }
9128
9130 {
9131 return true;
9132 }
9133
9134
9135 override bool KindOf(
string tag)
9136 {
9137 bool found = false;
9138 string item_name = this.
GetType();
9140 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9141
9142 int array_size = item_tag_array.Count();
9143 for (int i = 0; i < array_size; i++)
9144 {
9145 if (item_tag_array.Get(i) == tag)
9146 {
9147 found = true;
9148 break;
9149 }
9150 }
9151 return found;
9152 }
9153
9154
9156 {
9157
9158 super.OnRPC(sender, rpc_type,ctx);
9159
9160
9161 switch (rpc_type)
9162 {
9163 #ifndef SERVER
9164 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9165 Param2<bool, string> p = new Param2<bool, string>(false, "");
9166
9168 return;
9169
9170 bool play = p.param1;
9171 string soundSet = p.param2;
9172
9173 if (play)
9174 {
9176 {
9178 {
9180 }
9181 }
9182 else
9183 {
9185 }
9186 }
9187 else
9188 {
9190 }
9191
9192 break;
9193 #endif
9194
9195 }
9196
9198 {
9200 }
9201 }
9202
9203
9204
9205
9207 {
9208 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9209 return plugin.GetID(
name);
9210 }
9211
9213 {
9214 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9215 return plugin.GetName(id);
9216 }
9217
9220 {
9221
9222
9223 int varFlags;
9224 if (!ctx.
Read(varFlags))
9225 return;
9226
9227 if (varFlags & ItemVariableFlags.FLOAT)
9228 {
9230 }
9231 }
9232
9234 {
9235
9236 super.SerializeNumericalVars(floats_out);
9237
9238
9239
9241 {
9243 }
9244
9246 {
9248 }
9249
9251 {
9253 }
9254
9256 {
9261 }
9262
9264 {
9266 }
9267 }
9268
9270 {
9271
9272 super.DeSerializeNumericalVars(floats);
9273
9274
9275 int index = 0;
9276 int mask = Math.Round(floats.Get(index));
9277
9278 index++;
9279
9281 {
9283 {
9285 }
9286 else
9287 {
9288 float quantity = floats.Get(index);
9290 }
9291 index++;
9292 }
9293
9295 {
9296 float wet = floats.Get(index);
9298 index++;
9299 }
9300
9302 {
9303 int liquidtype = Math.Round(floats.Get(index));
9305 index++;
9306 }
9307
9309 {
9311 index++;
9313 index++;
9315 index++;
9317 index++;
9318 }
9319
9321 {
9322 int cleanness = Math.Round(floats.Get(index));
9324 index++;
9325 }
9326 }
9327
9329 {
9330 super.WriteVarsToCTX(ctx);
9331
9332
9334 {
9336 }
9337
9339 {
9341 }
9342
9344 {
9346 }
9347
9349 {
9350 int r,g,b,a;
9356 }
9357
9359 {
9361 }
9362 }
9363
9365 {
9366 if (!super.ReadVarsFromCTX(ctx,version))
9367 return false;
9368
9369 int intValue;
9370 float value;
9371
9372 if (version < 140)
9373 {
9374 if (!ctx.
Read(intValue))
9375 return false;
9376
9377 m_VariablesMask = intValue;
9378 }
9379
9381 {
9382 if (!ctx.
Read(value))
9383 return false;
9384
9386 {
9388 }
9389 else
9390 {
9392 }
9393 }
9394
9395 if (version < 140)
9396 {
9398 {
9399 if (!ctx.
Read(value))
9400 return false;
9401 SetTemperatureDirect(value);
9402 }
9403 }
9404
9406 {
9407 if (!ctx.
Read(value))
9408 return false;
9410 }
9411
9413 {
9414 if (!ctx.
Read(intValue))
9415 return false;
9417 }
9418
9420 {
9421 int r,g,b,a;
9423 return false;
9425 return false;
9427 return false;
9429 return false;
9430
9432 }
9433
9435 {
9436 if (!ctx.
Read(intValue))
9437 return false;
9439 }
9440
9441 if (version >= 138 && version < 140)
9442 {
9444 {
9445 if (!ctx.
Read(intValue))
9446 return false;
9447 SetFrozen(intValue);
9448 }
9449 }
9450
9451 return true;
9452 }
9453
9454
9456 {
9459 {
9461 }
9462
9463 if (!super.OnStoreLoad(ctx, version))
9464 {
9466 return false;
9467 }
9468
9469 if (version >= 114)
9470 {
9471 bool hasQuickBarIndexSaved;
9472
9473 if (!ctx.
Read(hasQuickBarIndexSaved))
9474 {
9476 return false;
9477 }
9478
9479 if (hasQuickBarIndexSaved)
9480 {
9481 int itmQBIndex;
9482
9483
9484 if (!ctx.
Read(itmQBIndex))
9485 {
9487 return false;
9488 }
9489
9490 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9491 if (itmQBIndex != -1 && parentPlayer)
9492 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9493 }
9494 }
9495 else
9496 {
9497
9498 PlayerBase player;
9499 int itemQBIndex;
9500 if (version ==
int.
MAX)
9501 {
9502 if (!ctx.
Read(itemQBIndex))
9503 {
9505 return false;
9506 }
9507 }
9508 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9509 {
9510
9511 if (!ctx.
Read(itemQBIndex))
9512 {
9514 return false;
9515 }
9516 if (itemQBIndex != -1 && player)
9517 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9518 }
9519 }
9520
9521 if (version < 140)
9522 {
9523
9524 if (!LoadVariables(ctx, version))
9525 {
9527 return false;
9528 }
9529 }
9530
9531
9533 {
9535 return false;
9536 }
9537 if (version >= 132)
9538 {
9540 if (raib)
9541 {
9543 {
9545 return false;
9546 }
9547 }
9548 }
9549
9551 return true;
9552 }
9553
9554
9555
9557 {
9558 super.OnStoreSave(ctx);
9559
9560 PlayerBase player;
9561 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9562 {
9564
9565 int itemQBIndex = -1;
9566 itemQBIndex = player.FindQuickBarEntityIndex(this);
9567 ctx.
Write(itemQBIndex);
9568 }
9569 else
9570 {
9572 }
9573
9575
9577 if (raib)
9578 {
9580 }
9581 }
9582
9583
9585 {
9586 super.AfterStoreLoad();
9587
9589 {
9591 }
9592
9594 {
9597 }
9598 }
9599
9601 {
9602 super.EEOnAfterLoad();
9603
9605 {
9607 }
9608
9611 }
9612
9614 {
9615 return false;
9616 }
9617
9618
9619
9621 {
9623 {
9624 #ifdef PLATFORM_CONSOLE
9625
9627 {
9629 if (menu)
9630 {
9632 }
9633 }
9634 #endif
9635 }
9636
9638 {
9641 }
9642
9644 {
9645 SetWeightDirty();
9647 }
9649 {
9652 }
9653
9655 {
9658
9661 }
9663 {
9667 }
9668
9669 super.OnVariablesSynchronized();
9670 }
9671
9672
9673
9675 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9676 {
9677 if (!IsServerCheck(allow_client))
9678 return false;
9679
9681 return false;
9682
9685
9686 if (value <= (min + 0.001))
9687 value = min;
9688
9689 if (value == min)
9690 {
9691 if (destroy_config)
9692 {
9693 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9694 if (dstr)
9695 {
9697 this.Delete();
9698 return true;
9699 }
9700 }
9701 else if (destroy_forced)
9702 {
9704 this.Delete();
9705 return true;
9706 }
9707
9709 }
9710
9713
9715 {
9716 EntityAI parent = GetHierarchyRoot();
9717 InventoryLocation iLoc = new InventoryLocation();
9718 GetInventory().GetCurrentInventoryLocation(iLoc);
9720 {
9721 int iLocSlot = iLoc.
GetSlot();
9723 {
9725 }
9727 {
9729 }
9730 }
9731 }
9732
9734 {
9736
9737 if (delta)
9739 }
9740
9742
9743 return false;
9744 }
9745
9746
9748 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9749 {
9751 }
9752
9754 {
9757 }
9758
9760 {
9763 }
9764
9766 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9767 {
9768 float value_clamped = Math.Clamp(value, 0, 1);
9770 SetQuantity(result, destroy_config, destroy_forced);
9771 }
9772
9773
9776 {
9778 }
9779
9781 {
9783 }
9784
9785
9786
9787
9788
9789
9790
9791
9792
9793
9795 {
9796 int slot = -1;
9797 GameInventory inventory = GetInventory();
9798 if (inventory)
9799 {
9800 InventoryLocation il = new InventoryLocation;
9803 }
9804
9806 }
9807
9809 {
9810 float quantity_max = 0;
9811
9813 {
9814 if (attSlotID != -1)
9815 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9816
9817 if (quantity_max <= 0)
9819 }
9820
9821 if (quantity_max <= 0)
9823
9824 return quantity_max;
9825 }
9826
9828 {
9830 }
9831
9833 {
9835 }
9836
9837
9839 {
9841 }
9842
9844 {
9846 }
9847
9849 {
9851 }
9852
9853
9855 {
9856
9857 float weightEx = GetWeightEx();
9858 float special = GetInventoryAndCargoWeight();
9859 return weightEx - special;
9860 }
9861
9862
9864 {
9866 }
9867
9869 {
9871 {
9872 #ifdef DEVELOPER
9873 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9874 {
9875 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9877 }
9878 #endif
9879
9881 }
9882 else if (HasEnergyManager())
9883 {
9884 #ifdef DEVELOPER
9885 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9886 {
9887 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9888 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9889 }
9890 #endif
9891 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9892 }
9893 else
9894 {
9895 #ifdef DEVELOPER
9896 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9897 {
9898 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9899 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9900 }
9901 #endif
9902 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9903 }
9904 }
9905
9908 {
9909 int item_count = 0;
9911
9912 GameInventory inventory = GetInventory();
9913 CargoBase cargo = inventory.
GetCargo();
9914 if (cargo != NULL)
9915 {
9917 }
9918
9920 for (int i = 0; i < nAttachments; ++i)
9921 {
9923 if (item)
9924 item_count += item.GetNumberOfItems();
9925 }
9926 return item_count;
9927 }
9928
9931 {
9932 float weight = 0;
9933 float wetness = 1;
9934 if (include_wetness)
9937 {
9938 weight = wetness * m_ConfigWeight;
9939 }
9941 {
9942 weight = 1;
9943 }
9944 return weight;
9945 }
9946
9947
9948
9950 {
9951 GameInventory inventory = GetInventory();
9952 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9953 {
9954 array<EntityAI> items = new array<EntityAI>;
9956 for (int i = 0; i < items.Count(); ++i)
9957 {
9959 if (item)
9960 {
9961 g_Game.ObjectDelete(item);
9962 }
9963 }
9964 }
9965 }
9966
9967
9968
9969
9971 {
9972 float energy = 0;
9973 if (HasEnergyManager())
9974 {
9975 energy = GetCompEM().GetEnergy();
9976 }
9977 return energy;
9978 }
9979
9980
9982 {
9983 super.OnEnergyConsumed();
9984
9986 }
9987
9989 {
9990 super.OnEnergyAdded();
9991
9993 }
9994
9995
9997 {
9998 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9999 {
10001 {
10002 float energy_0to1 = GetCompEM().GetEnergy0To1();
10004 }
10005 }
10006 }
10007
10008
10010 {
10011 return ConfigGetFloat("heatIsolation");
10012 }
10013
10015 {
10017 }
10018
10020 {
10021 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10022 if (
g_Game.ConfigIsExisting(paramPath))
10023 return g_Game.ConfigGetFloat(paramPath);
10024
10025 return 0.0;
10026 }
10027
10029 {
10030 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10031 if (
g_Game.ConfigIsExisting(paramPath))
10032 return g_Game.ConfigGetFloat(paramPath);
10033
10034 return 0.0;
10035 }
10036
10037 override void SetWet(
float value,
bool allow_client =
false)
10038 {
10039 if (!IsServerCheck(allow_client))
10040 return;
10041
10044
10046
10047 m_VarWet = Math.Clamp(value, min, max);
10048
10050 {
10053 }
10054 }
10055
10056 override void AddWet(
float value)
10057 {
10059 }
10060
10062 {
10064 }
10065
10067 {
10069 }
10070
10072 {
10074 }
10075
10077 {
10079 }
10080
10082 {
10084 }
10085
10086 override void OnWetChanged(
float newVal,
float oldVal)
10087 {
10090 if (newLevel != oldLevel)
10091 {
10093 }
10094 }
10095
10097 {
10098 SetWeightDirty();
10099 }
10100
10102 {
10103 return GetWetLevelInternal(
m_VarWet);
10104 }
10105
10106
10107
10109 {
10111 }
10112
10114 {
10116 }
10117
10119 {
10121 }
10122
10124 {
10126 }
10127
10128
10129
10131 {
10132 if (ConfigIsExisting("itemModelLength"))
10133 {
10134 return ConfigGetFloat("itemModelLength");
10135 }
10136 return 0;
10137 }
10138
10140 {
10141 if (ConfigIsExisting("itemAttachOffset"))
10142 {
10143 return ConfigGetFloat("itemAttachOffset");
10144 }
10145 return 0;
10146 }
10147
10148 override void SetCleanness(
int value,
bool allow_client =
false)
10149 {
10150 if (!IsServerCheck(allow_client))
10151 return;
10152
10154
10156
10159 }
10160
10162 {
10164 }
10165
10167 {
10168 return true;
10169 }
10170
10171
10172
10173
10175 {
10177 }
10178
10180 {
10182 }
10183
10184
10185
10186
10187 override void SetColor(
int r,
int g,
int b,
int a)
10188 {
10194 }
10196 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10197 {
10202 }
10203
10205 {
10207 }
10208
10211 {
10212 int r,g,b,a;
10214 r = r/255;
10215 g = g/255;
10216 b = b/255;
10217 a = a/255;
10218 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10219 }
10220
10221
10222
10223 override void SetLiquidType(
int value,
bool allow_client =
false)
10224 {
10225 if (!IsServerCheck(allow_client))
10226 return;
10227
10232 }
10233
10235 {
10236 return ConfigGetInt("varLiquidTypeInit");
10237 }
10238
10240 {
10242 }
10243
10245 {
10247 SetFrozen(false);
10248 }
10249
10252 {
10253 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10254 }
10255
10256
10259 {
10260 PlayerBase nplayer;
10261 if (PlayerBase.CastTo(nplayer, player))
10262 {
10264 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10265 }
10266 }
10267
10268
10271 {
10272 PlayerBase nplayer;
10273 if (PlayerBase.CastTo(nplayer,player))
10274 {
10275 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10276 }
10277
10278 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10279
10280 if (HasEnergyManager())
10281 {
10282 GetCompEM().UpdatePlugState();
10283 }
10284 }
10285
10286
10288 {
10289 super.OnPlacementStarted(player);
10290
10292 }
10293
10294 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10295 {
10297 {
10298 m_AdminLog.OnPlacementComplete(player,
this);
10299 }
10300
10301 super.OnPlacementComplete(player, position, orientation);
10302 }
10303
10304
10305
10306
10307
10309 {
10311 {
10312 return true;
10313 }
10314 else
10315 {
10316 return false;
10317 }
10318 }
10319
10320
10322 {
10324 {
10326 }
10327 }
10328
10329
10331 {
10333 }
10334
10336 {
10338 }
10339
10340 override void InsertAgent(
int agent,
float count = 1)
10341 {
10342 if (count < 1)
10343 return;
10344
10346 }
10347
10350 {
10352 }
10353
10354
10356 {
10358 }
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10402 {
10404 return false;
10405 return true;
10406 }
10407
10409 {
10410
10412 }
10413
10414
10417 {
10418 super.CheckForRoofLimited(timeTresholdMS);
10419
10420 float time =
g_Game.GetTime();
10421 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10422 {
10423 m_PreviousRoofTestTime = time;
10424 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10425 }
10426 }
10427
10428
10430 {
10432 {
10433 return 0;
10434 }
10435
10436 if (GetInventory().GetAttachmentSlotsCount() != 0)
10437 {
10438 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10439 if (filter)
10440 return filter.GetProtectionLevel(type, false, system);
10441 else
10442 return 0;
10443 }
10444
10445 string subclassPath, entryName;
10446
10447 switch (type)
10448 {
10450 entryName = "biological";
10451 break;
10453 entryName = "chemical";
10454 break;
10455 default:
10456 entryName = "biological";
10457 break;
10458 }
10459
10460 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10461
10462 return g_Game.ConfigGetFloat(subclassPath + entryName);
10463 }
10464
10465
10466
10469 {
10470 if (!IsMagazine())
10472
10474 }
10475
10476
10477
10478
10479
10484 {
10485 return true;
10486 }
10487
10489 {
10491 }
10492
10493
10494
10495
10496
10498 {
10499 if (parent)
10500 {
10501 if (parent.IsInherited(DayZInfected))
10502 return true;
10503
10504 if (!parent.IsRuined())
10505 return true;
10506 }
10507
10508 return true;
10509 }
10510
10512 {
10513 if (!super.CanPutAsAttachment(parent))
10514 {
10515 return false;
10516 }
10517
10518 if (!IsRuined() && !parent.IsRuined())
10519 {
10520 return true;
10521 }
10522
10523 return false;
10524 }
10525
10527 {
10528
10529
10530
10531
10532 return super.CanReceiveItemIntoCargo(item);
10533 }
10534
10536 {
10537
10538
10539
10540
10541 GameInventory attachmentInv = attachment.GetInventory();
10543 {
10544 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10545 return false;
10546 }
10547
10548 InventoryLocation loc = new InventoryLocation();
10549 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10550 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10551 return false;
10552
10553 return super.CanReceiveAttachment(attachment, slotId);
10554 }
10555
10557 {
10558 if (!super.CanReleaseAttachment(attachment))
10559 return false;
10560
10561 return GetInventory().AreChildrenAccessible();
10562 }
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10585 {
10586 int id = muzzle_owner.GetMuzzleID();
10587 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10588
10589 if (WPOF_array)
10590 {
10591 for (int i = 0; i < WPOF_array.Count(); i++)
10592 {
10593 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10594
10595 if (WPOF)
10596 {
10597 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10598 }
10599 }
10600 }
10601 }
10602
10603
10605 {
10606 int id = muzzle_owner.GetMuzzleID();
10608
10609 if (WPOBE_array)
10610 {
10611 for (int i = 0; i < WPOBE_array.Count(); i++)
10612 {
10613 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10614
10615 if (WPOBE)
10616 {
10617 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10618 }
10619 }
10620 }
10621 }
10622
10623
10625 {
10626 int id = muzzle_owner.GetMuzzleID();
10627 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10628
10629 if (WPOOH_array)
10630 {
10631 for (int i = 0; i < WPOOH_array.Count(); i++)
10632 {
10633 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10634
10635 if (WPOOH)
10636 {
10637 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10638 }
10639 }
10640 }
10641 }
10642
10643
10645 {
10646 int id = muzzle_owner.GetMuzzleID();
10647 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10648
10649 if (WPOOH_array)
10650 {
10651 for (int i = 0; i < WPOOH_array.Count(); i++)
10652 {
10653 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10654
10655 if (WPOOH)
10656 {
10657 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10658 }
10659 }
10660 }
10661 }
10662
10663
10665 {
10666 int id = muzzle_owner.GetMuzzleID();
10667 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10668
10669 if (WPOOH_array)
10670 {
10671 for (int i = 0; i < WPOOH_array.Count(); i++)
10672 {
10673 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10674
10675 if (WPOOH)
10676 {
10677 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10678 }
10679 }
10680 }
10681 }
10682
10683
10684
10686 {
10688 {
10689 return true;
10690 }
10691
10692 return false;
10693 }
10694
10696 {
10698 {
10699 return true;
10700 }
10701
10702 return false;
10703 }
10704
10706 {
10708 {
10709 return true;
10710 }
10711
10712 return false;
10713 }
10714
10716 {
10717 return false;
10718 }
10719
10722 {
10723 return UATimeSpent.DEFAULT_DEPLOY;
10724 }
10725
10726
10727
10728
10730 {
10732 SetSynchDirty();
10733 }
10734
10736 {
10738 }
10739
10740
10742 {
10743 return false;
10744 }
10745
10748 {
10749 string att_type = "None";
10750
10751 if (ConfigIsExisting("soundAttType"))
10752 {
10753 att_type = ConfigGetString("soundAttType");
10754 }
10755
10757 }
10758
10760 {
10762 }
10763
10764
10765
10766
10767
10773
10775 {
10778
10780 }
10781
10782
10784 {
10786 return;
10787
10789
10792
10795
10796 SoundParameters params = new SoundParameters();
10800 }
10801
10802
10804 {
10806 {
10809
10810 SetSynchDirty();
10811
10814 }
10815 }
10816
10818 {
10820 }
10821
10822
10824 {
10826 return;
10827
10829 SetSynchDirty();
10830
10833 }
10834
10836 {
10839 }
10840
10842 {
10844 }
10845
10846 void OnApply(PlayerBase player);
10847
10849 {
10850 return 1.0;
10851 };
10852
10854 {
10856 }
10857
10859 {
10861 }
10862
10864
10866 {
10867 SetDynamicPhysicsLifeTime(0.01);
10869 }
10870
10872 {
10873 array<string> zone_names = new array<string>;
10874 GetDamageZones(zone_names);
10875 for (int i = 0; i < zone_names.Count(); i++)
10876 {
10877 SetHealthMax(zone_names.Get(i),"Health");
10878 }
10879 SetHealthMax("","Health");
10880 }
10881
10884 {
10885 float global_health = GetHealth01("","Health");
10886 array<string> zones = new array<string>;
10887 GetDamageZones(zones);
10888
10889 for (int i = 0; i < zones.Count(); i++)
10890 {
10891 SetHealth01(zones.Get(i),"Health",global_health);
10892 }
10893 }
10894
10897 {
10898 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10899 }
10900
10902 {
10903 if (!hasRootAsPlayer)
10904 {
10905 if (refParentIB)
10906 {
10907
10908 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10909 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10910
10911 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10912 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10913
10916 }
10917 else
10918 {
10919
10922 }
10923 }
10924 }
10925
10927 {
10929 {
10930 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10931 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10932 {
10933 float heatPermCoef = 1.0;
10935 while (ent)
10936 {
10937 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10938 ent = ent.GetHierarchyParent();
10939 }
10940
10941 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10942 }
10943 }
10944 }
10945
10947 {
10948
10949 EntityAI parent = GetHierarchyParent();
10950 if (!parent)
10951 {
10952 hasParent = false;
10953 hasRootAsPlayer = false;
10954 }
10955 else
10956 {
10957 hasParent = true;
10958 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10959 refParentIB =
ItemBase.Cast(parent);
10960 }
10961 }
10962
10963 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10964 {
10965
10966 }
10967
10969 {
10970
10971 return false;
10972 }
10973
10975 {
10976
10977
10978 return false;
10979 }
10980
10982 {
10983
10984 return false;
10985 }
10986
10989 {
10990 return !GetIsFrozen() &&
IsOpen();
10991 }
10992
10994 {
10995 bool hasParent = false, hasRootAsPlayer = false;
10997
10998 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10999 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11000
11001 if (wwtu || foodDecay)
11002 {
11006
11007 if (processWetness || processTemperature || processDecay)
11008 {
11010
11011 if (processWetness)
11012 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11013
11014 if (processTemperature)
11016
11017 if (processDecay)
11018 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11019 }
11020 }
11021 }
11022
11025 {
11027 }
11028
11030 {
11033
11034 return super.GetTemperatureFreezeThreshold();
11035 }
11036
11038 {
11041
11042 return super.GetTemperatureThawThreshold();
11043 }
11044
11046 {
11049
11050 return super.GetItemOverheatThreshold();
11051 }
11052
11054 {
11056 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11057
11058 return super.GetTemperatureFreezeTime();
11059 }
11060
11062 {
11064 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11065
11066 return super.GetTemperatureThawTime();
11067 }
11068
11073
11075 {
11076 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11077 }
11078
11080 {
11081 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11082 }
11083
11086 {
11088 }
11089
11091 {
11093 }
11094
11096 {
11098 }
11099
11102 {
11103 return null;
11104 }
11105
11108 {
11109 return false;
11110 }
11111
11113 {
11115 {
11118 if (!trg)
11119 {
11121 explosive = this;
11122 }
11123
11124 explosive.PairRemote(trg);
11126
11127 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11128 trg.SetPersistentPairID(persistentID);
11129 explosive.SetPersistentPairID(persistentID);
11130
11131 return true;
11132 }
11133 return false;
11134 }
11135
11138 {
11139 float ret = 1.0;
11142 ret *= GetHealth01();
11143
11144 return ret;
11145 }
11146
11147 #ifdef DEVELOPER
11148 override void SetDebugItem()
11149 {
11150 super.SetDebugItem();
11151 _itemBase = this;
11152 }
11153
11155 {
11156 string text = super.GetDebugText();
11157
11159 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11160
11161 return text;
11162 }
11163 #endif
11164
11166 {
11167 return true;
11168 }
11169
11171
11173
11175 {
11178 }
11179
11180
11188
11204
11205 [
Obsolete(
"Use ItemSoundHandler instead")]
11208 {
11209 if (!
g_Game.IsDedicatedServer())
11210 {
11211 if (ConfigIsExisting("attachSoundSet"))
11212 {
11213 string cfg_path = "";
11214 string soundset = "";
11215 string type_name =
GetType();
11216
11219 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11220 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11221
11222 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11223 {
11224 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11225 {
11226 if (cfg_slot_array[i] == slot_type)
11227 {
11228 soundset = cfg_soundset_array[i];
11229 break;
11230 }
11231 }
11232 }
11233
11234 if (soundset != "")
11235 {
11236 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11238 }
11239 }
11240 }
11241 }
11242
11244}
11245
11247{
11249 if (entity)
11250 {
11251 bool is_item = entity.IsInherited(
ItemBase);
11252 if (is_item && full_quantity)
11253 {
11256 }
11257 }
11258 else
11259 {
11261 return NULL;
11262 }
11263 return entity;
11264}
11265
11267{
11268 if (item)
11269 {
11270 if (health > 0)
11271 item.SetHealth("", "", health);
11272
11273 if (item.CanHaveTemperature())
11274 {
11276 if (item.CanFreeze())
11277 item.SetFrozen(false);
11278 }
11279
11280 if (item.HasEnergyManager())
11281 {
11282 if (quantity >= 0)
11283 {
11284 item.GetCompEM().SetEnergy0To1(quantity);
11285 }
11286 else
11287 {
11289 }
11290 }
11291 else if (item.IsMagazine())
11292 {
11293 Magazine mag = Magazine.Cast(item);
11294 if (quantity >= 0)
11295 {
11296 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11297 }
11298 else
11299 {
11301 }
11302
11303 }
11304 else
11305 {
11306 if (quantity >= 0)
11307 {
11308 item.SetQuantityNormalized(quantity, false);
11309 }
11310 else
11311 {
11313 }
11314
11315 }
11316 }
11317}
11318
11319#ifdef DEVELOPER
11321#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.