6380{
6382 {
6383 return true;
6384 }
6385};
6386
6388{
6389
6390};
6391
6392
6393
6395{
6399
6401
6404
6405
6406
6407
6408
6417
6423
6428
6433
6454 protected bool m_IsResultOfSplit
6455
6457
6462
6463
6464
6466
6470
6471
6472
6474
6477
6478
6479
6485
6486
6494
6497
6498
6500
6501
6503
6504
6509
6510
6515
6517
6518
6520
6521
6523 {
6528
6529 if (!
g_Game.IsDedicatedServer())
6530 {
6532 {
6534
6536 {
6538 }
6539 }
6540
6543 }
6544
6545 m_OldLocation = null;
6546
6548 {
6550 }
6551
6552 if (ConfigIsExisting("headSelectionsToHide"))
6553 {
6556 }
6557
6559 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6560 {
6562 }
6563
6565
6566 m_IsResultOfSplit = false;
6567
6569 }
6570
6572 {
6573 super.InitItemVariables();
6574
6580 m_Count = ConfigGetInt(
"count");
6581
6584
6589
6592
6597
6609
6613
6614
6617 if (ConfigIsExisting("canBeSplit"))
6618 {
6621 }
6622
6624 if (ConfigIsExisting("itemBehaviour"))
6626
6627
6630 RegisterNetSyncVariableInt("m_VarLiquidType");
6631 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6632
6633 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6634 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6635 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6636
6637 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6638 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6639 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6640 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6641
6642 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6643 RegisterNetSyncVariableBool("m_IsTakeable");
6644 RegisterNetSyncVariableBool("m_IsHologram");
6645
6648 {
6651 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6652 }
6653
6655
6657 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6659
6661 }
6662
6664 {
6666 }
6667
6669 {
6672 {
6677 }
6678 }
6679
6680 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6681 {
6683 {
6686 }
6687
6689 }
6690
6692 {
6698 }
6699
6701
6703 {
6705
6706 if (!action)
6707 {
6708 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6709 return;
6710 }
6711
6713 if (!ai)
6714 {
6716 return;
6717 }
6718
6720 if (!action_array)
6721 {
6722 action_array = new array<ActionBase_Basic>;
6724 }
6725 if (LogManager.IsActionLogEnable())
6726 {
6727 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6728 }
6729
6730 if (action_array.Find(action) != -1)
6731 {
6732 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6733 }
6734 else
6735 {
6736 action_array.Insert(action);
6737 }
6738 }
6739
6741 {
6742 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6743 ActionBase action = player.GetActionManager().GetAction(actionName);
6746
6747 if (action_array)
6748 {
6749 action_array.RemoveItem(action);
6750 }
6751 }
6752
6753
6754
6756 {
6757 ActionOverrideData overrideData = new ActionOverrideData();
6761
6763 if (!actionMap)
6764 {
6767 }
6768
6769 actionMap.Insert(this.
Type(), overrideData);
6770
6771 }
6772
6774
6776
6777
6779 {
6782
6785
6786 string config_to_search = "CfgVehicles";
6787 string muzzle_owner_config;
6788
6790 {
6791 if (IsInherited(Weapon))
6792 config_to_search = "CfgWeapons";
6793
6794 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6795
6796 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6797
6798 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6799
6800 if (config_OnFire_subclass_count > 0)
6801 {
6802 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6803
6804 for (int i = 0; i < config_OnFire_subclass_count; i++)
6805 {
6806 string particle_class = "";
6807 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6808 string config_OnFire_entry = config_OnFire_class + particle_class;
6809 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6810 WPOF_array.Insert(WPOF);
6811 }
6812
6813
6815 }
6816 }
6817
6819 {
6820 config_to_search = "CfgWeapons";
6821 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6822
6823 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6824
6825 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6826
6827 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6828 {
6829 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6830
6831 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6832 {
6833 string particle_class2 = "";
6834 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6835 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6836 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6837 WPOBE_array.Insert(WPOBE);
6838 }
6839
6840
6842 }
6843 }
6844 }
6845
6846
6848 {
6851
6853 {
6854 string config_to_search = "CfgVehicles";
6855
6856 if (IsInherited(Weapon))
6857 config_to_search = "CfgWeapons";
6858
6859 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6860 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6861
6862 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6863 {
6864
6866
6868 {
6870 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6872 return;
6873 }
6874
6877
6878
6879
6880 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6881 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6882
6883 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6884 {
6885 string particle_class = "";
6886 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6887 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6888 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6889
6890 if (entry_type == CT_CLASS)
6891 {
6892 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6893 WPOOH_array.Insert(WPOF);
6894 }
6895 }
6896
6897
6899 }
6900 }
6901 }
6902
6904 {
6906 }
6907
6909 {
6911 {
6913
6916
6919
6920 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6921 }
6922 }
6923
6925 {
6927 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6928
6930 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6931
6933 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6934
6936 {
6938 }
6939 }
6940
6942 {
6944 }
6945
6947 {
6950 else
6952
6954 {
6957 }
6958 else
6959 {
6962
6965 }
6966
6968 }
6969
6971 {
6973 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6974 }
6975
6977 {
6979 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6981 }
6982
6984 {
6986 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6987 }
6988
6990 {
6993
6994 OverheatingParticle OP = new OverheatingParticle();
6999
7001 }
7002
7004 {
7007
7008 return -1;
7009 }
7010
7012 {
7014 {
7017
7018 for (int i = count; i > 0; --i)
7019 {
7020 int id = i - 1;
7023
7026
7027 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7028 {
7029 if (p)
7030 {
7033 }
7034 }
7035 }
7036 }
7037 }
7038
7040 {
7042 {
7044 {
7045 int id = i - 1;
7047
7048 if (OP)
7049 {
7051
7052 if (p)
7053 {
7055 }
7056
7057 delete OP;
7058 }
7059 }
7060
7063 }
7064 }
7065
7068 {
7069 return 0.0;
7070 }
7071
7072
7074 {
7075 return 250;
7076 }
7077
7079 {
7080 return 0;
7081 }
7082
7085 {
7087 return true;
7088
7089 return false;
7090 }
7091
7094 {
7097
7099 {
7101 }
7102 else
7103 {
7104
7106 }
7107
7109 }
7110
7117 {
7118 return -1;
7119 }
7120
7121
7122
7123
7125 {
7127 {
7128 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7129 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7130
7131 if (r_index >= 0)
7132 {
7133 InventoryLocation r_il = new InventoryLocation;
7134 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7135
7136 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7139 {
7140 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7141 }
7143 {
7144 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7145 }
7146
7147 }
7148
7149 player.GetHumanInventory().ClearUserReservedLocation(this);
7150 }
7151
7154 }
7155
7156
7157
7158
7160 {
7161 return ItemBase.m_DebugActionsMask;
7162 }
7163
7165 {
7166 return ItemBase.m_DebugActionsMask & mask;
7167 }
7168
7170 {
7171 ItemBase.m_DebugActionsMask = mask;
7172 }
7173
7175 {
7176 ItemBase.m_DebugActionsMask |= mask;
7177 }
7178
7180 {
7181 ItemBase.m_DebugActionsMask &= ~mask;
7182 }
7183
7185 {
7187 {
7189 }
7190 else
7191 {
7193 }
7194 }
7195
7196
7198 {
7199 if (GetEconomyProfile())
7200 {
7201 float q_max = GetEconomyProfile().GetQuantityMax();
7202 if (q_max > 0)
7203 {
7204 float q_min = GetEconomyProfile().GetQuantityMin();
7205 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7206
7208 {
7209 ComponentEnergyManager comp = GetCompEM();
7211 {
7213 }
7214 }
7216 {
7218
7219 }
7220
7221 }
7222 }
7223 }
7224
7227 {
7228 EntityAI parent = GetHierarchyParent();
7229
7230 if (parent)
7231 {
7232 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7233 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7234 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7235 }
7236 }
7237
7240 {
7241 EntityAI parent = GetHierarchyParent();
7242
7243 if (parent)
7244 {
7245 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7246 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7247 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7248 }
7249 }
7250
7252 {
7253
7254
7255
7256
7258
7260 {
7261 if (ScriptInputUserData.CanStoreInputUserData())
7262 {
7263 ScriptInputUserData ctx = new ScriptInputUserData;
7269 ctx.
Write(use_stack_max);
7272
7274 {
7275 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7276 }
7277 }
7278 }
7279 else if (!
g_Game.IsMultiplayer())
7280 {
7282 }
7283 }
7284
7286 {
7288 }
7289
7291 {
7293 }
7294
7296 {
7298 }
7299
7301 {
7302
7303 return false;
7304 }
7305
7307 {
7308 return false;
7309 }
7310
7314 {
7315 return false;
7316 }
7317
7319 {
7320 return "";
7321 }
7322
7324
7326 {
7327 return false;
7328 }
7329
7331 {
7332 return true;
7333 }
7334
7335
7336
7338 {
7339 return true;
7340 }
7341
7343 {
7344 return true;
7345 }
7346
7348 {
7349 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7351 }
7352
7354 {
7356 }
7357
7359 {
7361 if (!is_being_placed)
7363 SetSynchDirty();
7364 }
7365
7366
7368
7370 {
7372 }
7373
7375 {
7377 }
7378
7380 {
7381 return 1;
7382 }
7383
7385 {
7386 return false;
7387 }
7388
7390 {
7392 SetSynchDirty();
7393 }
7394
7395
7396
7397
7398
7399
7400
7401
7402
7403
7404
7405
7406
7407
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7430 {
7431 super.OnMovedInsideCargo(container);
7432
7433 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7434 }
7435
7436 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7437 {
7438 super.EEItemLocationChanged(oldLoc, newLoc);
7439
7440 PlayerBase newPlayer = null;
7441 PlayerBase oldPlayer = null;
7442
7443 if (newLoc.GetParent())
7444 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7445
7446 if (oldLoc.GetParent())
7447 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7448
7450 {
7451 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7452
7453 if (rIndex >= 0)
7454 {
7455 InventoryLocation rIl = new InventoryLocation;
7456 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7457
7458 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7461 {
7462 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7463 }
7465 {
7467 }
7468
7469 }
7470 }
7471
7473 {
7474 if (newPlayer)
7475 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7476
7477 if (newPlayer == oldPlayer)
7478 {
7479 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7480 {
7482 {
7483 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7484 {
7485 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7486 }
7487 }
7488 else
7489 {
7490 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7491 }
7492 }
7493
7494 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7495 {
7496 int type = oldLoc.GetType();
7498 {
7499 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7500 }
7502 {
7503 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7504 }
7505 }
7506 if (!m_OldLocation)
7507 {
7508 m_OldLocation = new InventoryLocation;
7509 }
7510 m_OldLocation.Copy(oldLoc);
7511 }
7512 else
7513 {
7514 if (m_OldLocation)
7515 {
7516 m_OldLocation.Reset();
7517 }
7518 }
7519
7520 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7521 }
7522 else
7523 {
7524 if (newPlayer)
7525 {
7526 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7527 if (resIndex >= 0)
7528 {
7529 InventoryLocation il = new InventoryLocation;
7530 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7532 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7535 {
7536 il.
GetParent().GetOnReleaseLock().Invoke(it);
7537 }
7539 {
7541 }
7542
7543 }
7544 }
7546 {
7547
7549 }
7550
7551 if (m_OldLocation)
7552 {
7553 m_OldLocation.Reset();
7554 }
7555 }
7556
7558 {
7559 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7560 }
7561
7563 {
7564 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7565 }
7566 }
7567
7568 override void EOnContact(IEntity other, Contact extra)
7569 {
7571 {
7572 int liquidType = -1;
7574 if (impactSpeed > 0.0)
7575 {
7577 #ifndef SERVER
7579 #else
7581 SetSynchDirty();
7582 #endif
7584 }
7585 }
7586
7587 #ifdef SERVER
7588 if (GetCompEM() && GetCompEM().IsPlugged())
7589 {
7590 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7591 GetCompEM().UnplugThis();
7592 }
7593 #endif
7594 }
7595
7597
7599 {
7601 }
7602
7604 {
7605
7606 }
7607
7609 {
7610 super.OnItemLocationChanged(old_owner, new_owner);
7611
7612 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7613 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7614
7615 if (!relatedPlayer && playerNew)
7616 relatedPlayer = playerNew;
7617
7618 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7619 {
7621 if (actionMgr)
7622 {
7623 ActionBase currentAction = actionMgr.GetRunningAction();
7624 if (currentAction)
7626 }
7627 }
7628
7629 Man ownerPlayerOld = null;
7630 Man ownerPlayerNew = null;
7631
7632 if (old_owner)
7633 {
7634 if (old_owner.
IsMan())
7635 {
7636 ownerPlayerOld = Man.Cast(old_owner);
7637 }
7638 else
7639 {
7640 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7641 }
7642 }
7643 else
7644 {
7646 {
7648
7649 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7650 {
7651 GetCompEM().UnplugThis();
7652 }
7653 }
7654 }
7655
7656 if (new_owner)
7657 {
7658 if (new_owner.
IsMan())
7659 {
7660 ownerPlayerNew = Man.Cast(new_owner);
7661 }
7662 else
7663 {
7664 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7665 }
7666 }
7667
7668 if (ownerPlayerOld != ownerPlayerNew)
7669 {
7670 if (ownerPlayerOld)
7671 {
7672 array<EntityAI> subItemsExit = new array<EntityAI>;
7674 for (int i = 0; i < subItemsExit.Count(); i++)
7675 {
7678 }
7679 }
7680
7681 if (ownerPlayerNew)
7682 {
7683 array<EntityAI> subItemsEnter = new array<EntityAI>;
7685 for (int j = 0; j < subItemsEnter.Count(); j++)
7686 {
7689 }
7690 }
7691 }
7692 else if (ownerPlayerNew != null)
7693 {
7694 PlayerBase nplayer;
7695 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7696 {
7697 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7699 for (int k = 0; k < subItemsUpdate.Count(); k++)
7700 {
7702 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7703 }
7704 }
7705 }
7706
7707 if (old_owner)
7708 old_owner.OnChildItemRemoved(this);
7709 if (new_owner)
7710 new_owner.OnChildItemReceived(this);
7711 }
7712
7713
7715 {
7716 super.EEDelete(parent);
7717 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7718 if (player)
7719 {
7721
7722 if (player.IsAlive())
7723 {
7724 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7725 if (r_index >= 0)
7726 {
7727 InventoryLocation r_il = new InventoryLocation;
7728 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7729
7730 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7733 {
7734 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7735 }
7737 {
7738 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7739 }
7740
7741 }
7742
7743 player.RemoveQuickBarEntityShortcut(this);
7744 }
7745 }
7746 }
7747
7749 {
7750 super.EEKilled(killer);
7751
7754 {
7755 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7756 {
7757 if (IsMagazine())
7758 {
7759 if (Magazine.Cast(this).GetAmmoCount() > 0)
7760 {
7762 }
7763 }
7764 else
7765 {
7767 }
7768 }
7769 }
7770 }
7771
7773 {
7774 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7775
7776 super.OnWasAttached(parent, slot_id);
7777
7780
7783 }
7784
7786 {
7787 super.OnWasDetached(parent, slot_id);
7788
7791
7794 }
7795
7797 {
7798 int idx;
7801
7802 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7803 if (inventory_slots.Count() < 1)
7804 {
7805 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7806 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7807 }
7808 else
7809 {
7810 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7811 }
7812
7813 idx = inventory_slots.Find(slot);
7814 if (idx < 0)
7815 return "";
7816
7817 return attach_types.Get(idx);
7818 }
7819
7821 {
7822 int idx = -1;
7823 string slot;
7824
7827
7828 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7829 if (inventory_slots.Count() < 1)
7830 {
7831 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7832 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7833 }
7834 else
7835 {
7836 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7837 if (detach_types.Count() < 1)
7838 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7839 }
7840
7841 for (int i = 0; i < inventory_slots.Count(); i++)
7842 {
7843 slot = inventory_slots.Get(i);
7844 }
7845
7846 if (slot != "")
7847 {
7848 if (detach_types.Count() == 1)
7849 idx = 0;
7850 else
7851 idx = inventory_slots.Find(slot);
7852 }
7853 if (idx < 0)
7854 return "";
7855
7856 return detach_types.Get(idx);
7857 }
7858
7860 {
7861
7863
7864
7865 float min_time = 1;
7866 float max_time = 3;
7867 float delay = Math.RandomFloat(min_time, max_time);
7868
7869 explode_timer.Run(delay, this, "DoAmmoExplosion");
7870 }
7871
7873 {
7874 Magazine magazine = Magazine.Cast(this);
7875 int pop_sounds_count = 6;
7876 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7877
7878
7879 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7880 string sound_name = pop_sounds[ sound_idx ];
7881 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7882
7883
7884 magazine.ServerAddAmmoCount(-1);
7885
7886
7887 float min_temp_to_explode = 100;
7888
7889 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7890 {
7892 }
7893 }
7894
7895
7896 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7897 {
7898 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7899
7900 const int CHANCE_DAMAGE_CARGO = 4;
7901 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7902 const int CHANCE_DAMAGE_NOTHING = 2;
7903
7905 {
7906 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7907 int chances;
7908 int rnd;
7909
7910 if (GetInventory().GetCargo())
7911 {
7912 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7913 rnd = Math.RandomInt(0,chances);
7914
7915 if (rnd < CHANCE_DAMAGE_CARGO)
7916 {
7918 }
7919 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7920 {
7922 }
7923 }
7924 else
7925 {
7926 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7927 rnd = Math.RandomInt(0,chances);
7928
7929 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7930 {
7932 }
7933 }
7934 }
7935 }
7936
7938 {
7939 CargoBase cargo = GetInventory().GetCargo();
7940 if (cargo)
7941 {
7943 if (item_count > 0)
7944 {
7945 int random_pick = Math.RandomInt(0, item_count);
7947 if (!item.IsExplosive())
7948 {
7949 item.AddHealth("","",damage);
7950 return true;
7951 }
7952 }
7953 }
7954 return false;
7955 }
7956
7958 {
7959 GameInventory inventory = GetInventory();
7961 if (attachment_count > 0)
7962 {
7963 int random_pick = Math.RandomInt(0, attachment_count);
7965 if (!attachment.IsExplosive())
7966 {
7967 attachment.AddHealth("","",damage);
7968 return true;
7969 }
7970 }
7971 return false;
7972 }
7973
7975 {
7977 }
7978
7980 {
7982 return GetInventory().CanRemoveEntity();
7983
7984 return false;
7985 }
7986
7988 {
7989
7991 return false;
7992
7993
7995 return false;
7996
7997
7998
8000 if (delta == 0)
8001 return false;
8002
8003
8004 return true;
8005 }
8006
8008 {
8010 {
8011 if (ScriptInputUserData.CanStoreInputUserData())
8012 {
8013 ScriptInputUserData ctx = new ScriptInputUserData;
8018 ctx.
Write(destination_entity);
8022 }
8023 }
8024 else if (!
g_Game.IsMultiplayer())
8025 {
8027 }
8028 }
8029
8031 {
8032 float split_quantity_new;
8036 InventoryLocation loc = new InventoryLocation;
8037
8038 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8039 {
8041 split_quantity_new = stack_max;
8042 else
8044
8046 {
8047 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8048 if (new_item)
8049 {
8050 new_item.SetResultOfSplit(true);
8051 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8053 new_item.
SetQuantity(split_quantity_new,
false,
true);
8054 }
8055 }
8056 }
8057 else if (destination_entity && slot_id == -1)
8058 {
8059 if (quantity > stack_max)
8060 split_quantity_new = stack_max;
8061 else
8062 split_quantity_new = quantity;
8063
8065 {
8066 GameInventory destinationInventory = destination_entity.GetInventory();
8068 {
8071 }
8072
8073 if (new_item)
8074 {
8075 new_item.SetResultOfSplit(true);
8076 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8078 new_item.
SetQuantity(split_quantity_new,
false,
true);
8079 }
8080 }
8081 }
8082 else
8083 {
8084 if (stack_max != 0)
8085 {
8087 {
8089 }
8090
8091 if (split_quantity_new == 0)
8092 {
8093 if (!
g_Game.IsMultiplayer())
8094 player.PhysicalPredictiveDropItem(this);
8095 else
8096 player.ServerDropEntity(this);
8097 return;
8098 }
8099
8101 {
8103
8104 if (new_item)
8105 {
8106 new_item.SetResultOfSplit(true);
8107 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8110 new_item.PlaceOnSurface();
8111 }
8112 }
8113 }
8114 }
8115 }
8116
8118 {
8119 float split_quantity_new;
8123 InventoryLocation loc = new InventoryLocation;
8124
8125 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8126 {
8128 split_quantity_new = stack_max;
8129 else
8131
8133 {
8134 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8135 if (new_item)
8136 {
8137 new_item.SetResultOfSplit(true);
8138 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8140 new_item.
SetQuantity(split_quantity_new,
false,
true);
8141 }
8142 }
8143 }
8144 else if (destination_entity && slot_id == -1)
8145 {
8146 if (quantity > stack_max)
8147 split_quantity_new = stack_max;
8148 else
8149 split_quantity_new = quantity;
8150
8152 {
8153 GameInventory destinationInventory = destination_entity.GetInventory();
8155 {
8158 }
8159
8160 if (new_item)
8161 {
8162 new_item.SetResultOfSplit(true);
8163 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8165 new_item.
SetQuantity(split_quantity_new,
false,
true);
8166 }
8167 }
8168 }
8169 else
8170 {
8171 if (stack_max != 0)
8172 {
8174 {
8176 }
8177
8179 {
8181
8182 if (new_item)
8183 {
8184 new_item.SetResultOfSplit(true);
8185 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8188 new_item.PlaceOnSurface();
8189 }
8190 }
8191 }
8192 }
8193 }
8194
8196 {
8198 {
8199 if (ScriptInputUserData.CanStoreInputUserData())
8200 {
8201 ScriptInputUserData ctx = new ScriptInputUserData;
8206 dst.WriteToContext(ctx);
8208 }
8209 }
8210 else if (!
g_Game.IsMultiplayer())
8211 {
8213 }
8214 }
8215
8217 {
8219 {
8220 if (ScriptInputUserData.CanStoreInputUserData())
8221 {
8222 ScriptInputUserData ctx = new ScriptInputUserData;
8227 ctx.
Write(destination_entity);
8233 }
8234 }
8235 else if (!
g_Game.IsMultiplayer())
8236 {
8238 }
8239 }
8240
8242 {
8244 }
8245
8247 {
8249 float split_quantity_new;
8251 if (dst.IsValid())
8252 {
8253 int slot_id = dst.GetSlot();
8255
8256 if (quantity > stack_max)
8257 split_quantity_new = stack_max;
8258 else
8259 split_quantity_new = quantity;
8260
8262 {
8264
8265 if (new_item)
8266 {
8267 new_item.SetResultOfSplit(true);
8268 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8270 new_item.
SetQuantity(split_quantity_new,
false,
true);
8271 }
8272
8273 return new_item;
8274 }
8275 }
8276
8277 return null;
8278 }
8279
8281 {
8283 float split_quantity_new;
8285 if (destination_entity)
8286 {
8288 if (quantity > stackable)
8289 split_quantity_new = stackable;
8290 else
8291 split_quantity_new = quantity;
8292
8294 {
8295 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8296 if (new_item)
8297 {
8298 new_item.SetResultOfSplit(true);
8299 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8301 new_item.
SetQuantity(split_quantity_new,
false,
true);
8302 }
8303 }
8304 }
8305 }
8306
8308 {
8310 {
8311 if (ScriptInputUserData.CanStoreInputUserData())
8312 {
8313 ScriptInputUserData ctx = new ScriptInputUserData;
8318 ItemBase destination_entity =
this;
8319 ctx.
Write(destination_entity);
8323 }
8324 }
8325 else if (!
g_Game.IsMultiplayer())
8326 {
8328 }
8329 }
8330
8332 {
8334 float split_quantity_new;
8336 if (player)
8337 {
8339 if (quantity > stackable)
8340 split_quantity_new = stackable;
8341 else
8342 split_quantity_new = quantity;
8343
8345 {
8346 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8347 new_item =
ItemBase.Cast(in_hands);
8348 if (new_item)
8349 {
8350 new_item.SetResultOfSplit(true);
8351 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8353 new_item.SetQuantity(split_quantity_new, false, true);
8354 }
8355 }
8356 }
8357 }
8358
8360 {
8362 float split_quantity_new = Math.Floor(quantity * 0.5);
8363
8365 return;
8366
8368
8369 if (new_item)
8370 {
8371 if (new_item.GetQuantityMax() < split_quantity_new)
8372 {
8373 split_quantity_new = new_item.GetQuantityMax();
8374 }
8375
8376 new_item.SetResultOfSplit(true);
8377 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8378
8380 {
8383 }
8384 else
8385 {
8387 new_item.
SetQuantity(split_quantity_new,
false,
true);
8388 }
8389 }
8390 }
8391
8393 {
8395 float split_quantity_new = Math.Floor(quantity / 2);
8396
8398 return;
8399
8400 InventoryLocation invloc = new InventoryLocation;
8402
8404 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8405
8406 if (new_item)
8407 {
8408 if (new_item.GetQuantityMax() < split_quantity_new)
8409 {
8410 split_quantity_new = new_item.GetQuantityMax();
8411 }
8413 {
8416 }
8417 else if (split_quantity_new > 1)
8418 {
8420 new_item.
SetQuantity(split_quantity_new,
false,
true);
8421 }
8422 }
8423 }
8424
8427 {
8428 SetWeightDirty();
8430
8431 if (parent)
8432 parent.OnAttachmentQuantityChangedEx(this, delta);
8433
8435 {
8437 {
8439 }
8441 {
8442 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8444 }
8445 }
8446 }
8447
8450 {
8451
8452 }
8453
8456 {
8458 }
8459
8461 {
8462 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8463
8465 {
8466 if (newLevel == GameConstants.STATE_RUINED)
8467 {
8469 EntityAI parent = GetHierarchyParent();
8470 if (parent && parent.IsFireplace())
8471 {
8472 CargoBase cargo = GetInventory().GetCargo();
8473 if (cargo)
8474 {
8476 {
8478 }
8479 }
8480 }
8481 }
8482
8484 {
8485
8487 return;
8488 }
8489
8490 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8491 {
8493 }
8494 }
8495 }
8496
8497
8499 {
8500 super.OnRightClick();
8501
8503 {
8505 {
8506 if (ScriptInputUserData.CanStoreInputUserData())
8507 {
8508 EntityAI root = GetHierarchyRoot();
8509 Man playerOwner = GetHierarchyRootPlayer();
8510 InventoryLocation dst = new InventoryLocation;
8511
8512
8513 if (!playerOwner && root && root == this)
8514 {
8516 }
8517 else
8518 {
8519
8520 GetInventory().GetCurrentInventoryLocation(dst);
8522 {
8523 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8525 {
8527 }
8528 else
8529 {
8531
8532
8533 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8534 {
8536 }
8537 else
8538 {
8539 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8540 }
8541 }
8542 }
8543 }
8544
8545 ScriptInputUserData ctx = new ScriptInputUserData;
8553 }
8554 }
8555 else if (!
g_Game.IsMultiplayer())
8556 {
8558 }
8559 }
8560 }
8561
8563 {
8564 if (root)
8565 {
8566 vector m4[4];
8567 root.GetTransform(m4);
8568 dst.SetGround(this, m4);
8569 }
8570 else
8571 {
8572 GetInventory().GetCurrentInventoryLocation(dst);
8573 }
8574 }
8575
8576 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8577 {
8578
8579 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8580 return false;
8581
8582 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8583 return false;
8584
8585
8587 return false;
8588
8589
8590 Magazine mag = Magazine.Cast(this);
8591 if (mag)
8592 {
8593 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8594 return false;
8595
8596 if (stack_max_limit)
8597 {
8598 Magazine other_mag = Magazine.Cast(other_item);
8599 if (other_item)
8600 {
8601 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8602 return false;
8603 }
8604
8605 }
8606 }
8607 else
8608 {
8609
8611 return false;
8612
8614 return false;
8615 }
8616
8617 PlayerBase player = null;
8618 if (CastTo(player, GetHierarchyRootPlayer()))
8619 {
8620 if (player.GetInventory().HasAttachment(this))
8621 return false;
8622
8623 if (player.IsItemsToDelete())
8624 return false;
8625 }
8626
8627 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8628 return false;
8629
8630 int slotID;
8632 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8633 return false;
8634
8635 return true;
8636 }
8637
8639 {
8641 }
8642
8644 {
8645 return m_IsResultOfSplit;
8646 }
8647
8649 {
8650 m_IsResultOfSplit = value;
8651 }
8652
8654 {
8656 }
8657
8659 {
8660 float other_item_quantity = other_item.GetQuantity();
8661 float this_free_space;
8662
8664
8666
8667 if (other_item_quantity > this_free_space)
8668 {
8669 return this_free_space;
8670 }
8671 else
8672 {
8673 return other_item_quantity;
8674 }
8675 }
8676
8678 {
8680 }
8681
8683 {
8685 return;
8686
8687 if (!IsMagazine() && other_item)
8688 {
8690 if (quantity_used != 0)
8691 {
8692 float hp1 = GetHealth01("","");
8693 float hp2 = other_item.GetHealth01("","");
8694 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8695 hpResult = hpResult / (
GetQuantity() + quantity_used);
8696
8697 hpResult *= GetMaxHealth();
8698 Math.Round(hpResult);
8699 SetHealth("", "Health", hpResult);
8700
8702 other_item.AddQuantity(-quantity_used);
8703 }
8704 }
8706 }
8707
8709 {
8710 #ifdef SERVER
8711 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8712 GetHierarchyParent().IncreaseLifetimeUp();
8713 #endif
8714 };
8715
8717 {
8718 PlayerBase p = PlayerBase.Cast(player);
8719
8720 array<int> recipesIds = p.m_Recipes;
8721 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8722 if (moduleRecipesManager)
8723 {
8724 EntityAI itemInHands = player.GetEntityInHands();
8725 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8726 }
8727
8728 for (int i = 0;i < recipesIds.Count(); i++)
8729 {
8730 int key = recipesIds.Get(i);
8731 string recipeName = moduleRecipesManager.GetRecipeName(key);
8733 }
8734 }
8735
8736
8737 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8738 {
8739 super.GetDebugActions(outputList);
8740
8741
8747
8748
8753
8758
8759
8763
8764
8766 {
8770 }
8771
8774
8775
8779
8781
8782 InventoryLocation loc = new InventoryLocation();
8783 GetInventory().GetCurrentInventoryLocation(loc);
8785 {
8786 if (Gizmo_IsSupported())
8789 }
8790
8792 }
8793
8794
8795
8796
8798 {
8799 super.OnAction(action_id, player, ctx);
8800
8802 {
8803 switch (action_id)
8804 {
8808 return true;
8812 return true;
8813 }
8814 }
8815
8817 {
8818 switch (action_id)
8819 {
8821 Delete();
8822 return true;
8823 }
8824 }
8825
8826 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8827 {
8828 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8829 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8830 PlayerBase p = PlayerBase.Cast(player);
8831 if (
EActions.RECIPES_RANGE_START < 1000)
8832 {
8833 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8834 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8835 }
8836 }
8837 #ifndef SERVER
8838 else if (action_id ==
EActions.WATCH_PLAYER)
8839 {
8840 PluginDeveloper.SetDeveloperItemClientEx(player);
8841 }
8842 #endif
8844 {
8845 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8846 {
8847 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8848 OnDebugButtonPressServer(id + 1);
8849 }
8850
8851 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8852 {
8853 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8855 }
8856
8857 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8858 {
8859 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8861 }
8862
8863 else if (action_id ==
EActions.ADD_QUANTITY)
8864 {
8865 if (IsMagazine())
8866 {
8867 Magazine mag = Magazine.Cast(this);
8868 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8869 }
8870 else
8871 {
8873 }
8874
8875 if (m_EM)
8876 {
8877 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8878 }
8879
8880 }
8881
8882 else if (action_id ==
EActions.REMOVE_QUANTITY)
8883 {
8884 if (IsMagazine())
8885 {
8886 Magazine mag2 = Magazine.Cast(this);
8887 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8888 }
8889 else
8890 {
8892 }
8893 if (m_EM)
8894 {
8895 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8896 }
8897
8898 }
8899
8900 else if (action_id ==
EActions.SET_QUANTITY_0)
8901 {
8903
8904 if (m_EM)
8905 {
8906 m_EM.SetEnergy(0);
8907 }
8908 }
8909
8910 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8911 {
8913
8914 if (m_EM)
8915 {
8916 m_EM.SetEnergy(m_EM.GetEnergyMax());
8917 }
8918 }
8919
8920 else if (action_id ==
EActions.ADD_HEALTH)
8921 {
8922 AddHealth("","",GetMaxHealth("","Health")/5);
8923 }
8924 else if (action_id ==
EActions.REMOVE_HEALTH)
8925 {
8926 AddHealth("","",-GetMaxHealth("","Health")/5);
8927 }
8928 else if (action_id ==
EActions.DESTROY_HEALTH)
8929 {
8930 SetHealth01("","",0);
8931 }
8932 else if (action_id ==
EActions.WATCH_ITEM)
8933 {
8935 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8936 #ifdef DEVELOPER
8937 SetDebugDeveloper_item(this);
8938 #endif
8939 }
8940
8941 else if (action_id ==
EActions.ADD_TEMPERATURE)
8942 {
8943 AddTemperature(20);
8944
8945 }
8946
8947 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8948 {
8949 AddTemperature(-20);
8950
8951 }
8952
8953 else if (action_id ==
EActions.FLIP_FROZEN)
8954 {
8955 SetFrozen(!GetIsFrozen());
8956
8957 }
8958
8959 else if (action_id ==
EActions.ADD_WETNESS)
8960 {
8962
8963 }
8964
8965 else if (action_id ==
EActions.REMOVE_WETNESS)
8966 {
8968
8969 }
8970
8971 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8972 {
8975
8976
8977 }
8978
8979 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8980 {
8983 }
8984
8985 else if (action_id ==
EActions.MAKE_SPECIAL)
8986 {
8987 auto debugParams = DebugSpawnParams.WithPlayer(player);
8988 OnDebugSpawnEx(debugParams);
8989 }
8990
8991 }
8992
8993
8994 return false;
8995 }
8996
8997
8998
8999
9003
9006
9007
9008
9010 {
9011 return false;
9012 }
9013
9014
9016 {
9017 return true;
9018 }
9019
9020
9022 {
9023 return true;
9024 }
9025
9026
9027
9029 {
9030 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9031 return g_Game.ConfigIsExisting(config_path);
9032 }
9033
9036 {
9037 return null;
9038 }
9039
9041 {
9042 return false;
9043 }
9044
9046 {
9047 return false;
9048 }
9049
9053
9054
9056 {
9057 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9058 return module_repairing.CanRepair(this, item_repair_kit);
9059 }
9060
9061
9062 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9063 {
9064 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9065 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9066 }
9067
9068
9070 {
9071
9072
9073
9074
9075
9076
9077
9078
9079 return 1;
9080 }
9081
9082
9083
9085 {
9087 }
9088
9089
9090
9092 {
9094 }
9095
9096
9105 {
9106 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9107
9108 if (player)
9109 {
9110 player.MessageStatus(text);
9111 }
9112 }
9113
9114
9123 {
9124 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9125
9126 if (player)
9127 {
9128 player.MessageAction(text);
9129 }
9130 }
9131
9132
9141 {
9142 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9143
9144 if (player)
9145 {
9146 player.MessageFriendly(text);
9147 }
9148 }
9149
9150
9159 {
9160 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9161
9162 if (player)
9163 {
9164 player.MessageImportant(text);
9165 }
9166 }
9167
9169 {
9170 return true;
9171 }
9172
9173
9174 override bool KindOf(
string tag)
9175 {
9176 bool found = false;
9177 string item_name = this.
GetType();
9179 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9180
9181 int array_size = item_tag_array.Count();
9182 for (int i = 0; i < array_size; i++)
9183 {
9184 if (item_tag_array.Get(i) == tag)
9185 {
9186 found = true;
9187 break;
9188 }
9189 }
9190 return found;
9191 }
9192
9193
9195 {
9196
9197 super.OnRPC(sender, rpc_type,ctx);
9198
9199
9200 switch (rpc_type)
9201 {
9202 #ifndef SERVER
9203 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9204 Param2<bool, string> p = new Param2<bool, string>(false, "");
9205
9207 return;
9208
9209 bool play = p.param1;
9210 string soundSet = p.param2;
9211
9212 if (play)
9213 {
9215 {
9217 {
9219 }
9220 }
9221 else
9222 {
9224 }
9225 }
9226 else
9227 {
9229 }
9230
9231 break;
9232 #endif
9233
9234 }
9235
9237 {
9239 }
9240 }
9241
9242
9243
9244
9246 {
9247 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9248 return plugin.GetID(
name);
9249 }
9250
9252 {
9253 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9254 return plugin.GetName(id);
9255 }
9256
9259 {
9260
9261
9262 int varFlags;
9263 if (!ctx.
Read(varFlags))
9264 return;
9265
9266 if (varFlags & ItemVariableFlags.FLOAT)
9267 {
9269 }
9270 }
9271
9273 {
9274
9275 super.SerializeNumericalVars(floats_out);
9276
9277
9278
9280 {
9282 }
9283
9285 {
9287 }
9288
9290 {
9292 }
9293
9295 {
9300 }
9301
9303 {
9305 }
9306 }
9307
9309 {
9310
9311 super.DeSerializeNumericalVars(floats);
9312
9313
9314 int index = 0;
9315 int mask = Math.Round(floats.Get(index));
9316
9317 index++;
9318
9320 {
9322 {
9324 }
9325 else
9326 {
9327 float quantity = floats.Get(index);
9329 }
9330 index++;
9331 }
9332
9334 {
9335 float wet = floats.Get(index);
9337 index++;
9338 }
9339
9341 {
9342 int liquidtype = Math.Round(floats.Get(index));
9344 index++;
9345 }
9346
9348 {
9350 index++;
9352 index++;
9354 index++;
9356 index++;
9357 }
9358
9360 {
9361 int cleanness = Math.Round(floats.Get(index));
9363 index++;
9364 }
9365 }
9366
9368 {
9369 super.WriteVarsToCTX(ctx);
9370
9371
9373 {
9375 }
9376
9378 {
9380 }
9381
9383 {
9385 }
9386
9388 {
9389 int r,g,b,a;
9395 }
9396
9398 {
9400 }
9401 }
9402
9404 {
9405 if (!super.ReadVarsFromCTX(ctx,version))
9406 return false;
9407
9408 int intValue;
9409 float value;
9410
9411 if (version < 140)
9412 {
9413 if (!ctx.
Read(intValue))
9414 return false;
9415
9416 m_VariablesMask = intValue;
9417 }
9418
9420 {
9421 if (!ctx.
Read(value))
9422 return false;
9423
9425 {
9427 }
9428 else
9429 {
9431 }
9432 }
9433
9434 if (version < 140)
9435 {
9437 {
9438 if (!ctx.
Read(value))
9439 return false;
9440 SetTemperatureDirect(value);
9441 }
9442 }
9443
9445 {
9446 if (!ctx.
Read(value))
9447 return false;
9449 }
9450
9452 {
9453 if (!ctx.
Read(intValue))
9454 return false;
9456 }
9457
9459 {
9460 int r,g,b,a;
9462 return false;
9464 return false;
9466 return false;
9468 return false;
9469
9471 }
9472
9474 {
9475 if (!ctx.
Read(intValue))
9476 return false;
9478 }
9479
9480 if (version >= 138 && version < 140)
9481 {
9483 {
9484 if (!ctx.
Read(intValue))
9485 return false;
9486 SetFrozen(intValue);
9487 }
9488 }
9489
9490 return true;
9491 }
9492
9493
9495 {
9498 {
9500 }
9501
9502 if (!super.OnStoreLoad(ctx, version))
9503 {
9505 return false;
9506 }
9507
9508 if (version >= 114)
9509 {
9510 bool hasQuickBarIndexSaved;
9511
9512 if (!ctx.
Read(hasQuickBarIndexSaved))
9513 {
9515 return false;
9516 }
9517
9518 if (hasQuickBarIndexSaved)
9519 {
9520 int itmQBIndex;
9521
9522
9523 if (!ctx.
Read(itmQBIndex))
9524 {
9526 return false;
9527 }
9528
9529 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9530 if (itmQBIndex != -1 && parentPlayer)
9531 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9532 }
9533 }
9534 else
9535 {
9536
9537 PlayerBase player;
9538 int itemQBIndex;
9539 if (version ==
int.
MAX)
9540 {
9541 if (!ctx.
Read(itemQBIndex))
9542 {
9544 return false;
9545 }
9546 }
9547 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9548 {
9549
9550 if (!ctx.
Read(itemQBIndex))
9551 {
9553 return false;
9554 }
9555 if (itemQBIndex != -1 && player)
9556 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9557 }
9558 }
9559
9560 if (version < 140)
9561 {
9562
9563 if (!LoadVariables(ctx, version))
9564 {
9566 return false;
9567 }
9568 }
9569
9570
9572 {
9574 return false;
9575 }
9576 if (version >= 132)
9577 {
9579 if (raib)
9580 {
9582 {
9584 return false;
9585 }
9586 }
9587 }
9588
9590 return true;
9591 }
9592
9593
9594
9596 {
9597 super.OnStoreSave(ctx);
9598
9599 PlayerBase player;
9600 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9601 {
9603
9604 int itemQBIndex = -1;
9605 itemQBIndex = player.FindQuickBarEntityIndex(this);
9606 ctx.
Write(itemQBIndex);
9607 }
9608 else
9609 {
9611 }
9612
9614
9616 if (raib)
9617 {
9619 }
9620 }
9621
9622
9624 {
9625 super.AfterStoreLoad();
9626
9628 {
9630 }
9631
9633 {
9636 }
9637 }
9638
9640 {
9641 super.EEOnAfterLoad();
9642
9644 {
9646 }
9647
9650 }
9651
9653 {
9654 return false;
9655 }
9656
9657
9658
9660 {
9662 {
9663 #ifdef PLATFORM_CONSOLE
9664
9666 {
9668 if (menu)
9669 {
9671 }
9672 }
9673 #endif
9674 }
9675
9677 {
9680 }
9681
9683 {
9684 SetWeightDirty();
9686 }
9688 {
9691 }
9692
9694 {
9697
9700 }
9702 {
9706 }
9707
9708 super.OnVariablesSynchronized();
9709 }
9710
9711
9712
9714 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9715 {
9716 if (!IsServerCheck(allow_client))
9717 return false;
9718
9720 return false;
9721
9724
9725 if (value <= (min + 0.001))
9726 value = min;
9727
9728 if (value == min)
9729 {
9730 if (destroy_config)
9731 {
9732 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9733 if (dstr)
9734 {
9736 this.Delete();
9737 return true;
9738 }
9739 }
9740 else if (destroy_forced)
9741 {
9743 this.Delete();
9744 return true;
9745 }
9746
9748 }
9749
9752
9754 {
9755 EntityAI parent = GetHierarchyRoot();
9756 InventoryLocation iLoc = new InventoryLocation();
9757 GetInventory().GetCurrentInventoryLocation(iLoc);
9759 {
9760 int iLocSlot = iLoc.
GetSlot();
9762 {
9764 }
9766 {
9768 }
9769 }
9770 }
9771
9773 {
9775
9776 if (delta)
9778 }
9779
9781
9782 return false;
9783 }
9784
9785
9787 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9788 {
9790 }
9791
9793 {
9796 }
9797
9799 {
9802 }
9803
9805 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9806 {
9807 float value_clamped = Math.Clamp(value, 0, 1);
9809 SetQuantity(result, destroy_config, destroy_forced);
9810 }
9811
9812
9815 {
9817 }
9818
9820 {
9822 }
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9834 {
9835 int slot = -1;
9836 GameInventory inventory = GetInventory();
9837 if (inventory)
9838 {
9839 InventoryLocation il = new InventoryLocation;
9842 }
9843
9845 }
9846
9848 {
9849 float quantity_max = 0;
9850
9852 {
9853 if (attSlotID != -1)
9854 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9855
9856 if (quantity_max <= 0)
9858 }
9859
9860 if (quantity_max <= 0)
9862
9863 return quantity_max;
9864 }
9865
9867 {
9869 }
9870
9872 {
9874 }
9875
9876
9878 {
9880 }
9881
9883 {
9885 }
9886
9888 {
9890 }
9891
9892
9894 {
9895
9896 float weightEx = GetWeightEx();
9897 float special = GetInventoryAndCargoWeight();
9898 return weightEx - special;
9899 }
9900
9901
9903 {
9905 }
9906
9908 {
9910 {
9911 #ifdef DEVELOPER
9912 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9913 {
9914 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9916 }
9917 #endif
9918
9920 }
9921 else if (HasEnergyManager())
9922 {
9923 #ifdef DEVELOPER
9924 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9925 {
9926 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9927 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9928 }
9929 #endif
9930 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9931 }
9932 else
9933 {
9934 #ifdef DEVELOPER
9935 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9936 {
9937 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9938 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9939 }
9940 #endif
9941 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9942 }
9943 }
9944
9947 {
9948 int item_count = 0;
9950
9951 GameInventory inventory = GetInventory();
9952 CargoBase cargo = inventory.
GetCargo();
9953 if (cargo != NULL)
9954 {
9956 }
9957
9959 for (int i = 0; i < nAttachments; ++i)
9960 {
9962 if (item)
9963 item_count += item.GetNumberOfItems();
9964 }
9965 return item_count;
9966 }
9967
9970 {
9971 float weight = 0;
9972 float wetness = 1;
9973 if (include_wetness)
9976 {
9977 weight = wetness * m_ConfigWeight;
9978 }
9980 {
9981 weight = 1;
9982 }
9983 return weight;
9984 }
9985
9986
9987
9989 {
9990 GameInventory inventory = GetInventory();
9991 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9992 {
9993 array<EntityAI> items = new array<EntityAI>;
9995 for (int i = 0; i < items.Count(); ++i)
9996 {
9998 if (item)
9999 {
10000 g_Game.ObjectDelete(item);
10001 }
10002 }
10003 }
10004 }
10005
10006
10007
10008
10010 {
10011 float energy = 0;
10012 if (HasEnergyManager())
10013 {
10014 energy = GetCompEM().GetEnergy();
10015 }
10016 return energy;
10017 }
10018
10019
10021 {
10022 super.OnEnergyConsumed();
10023
10025 }
10026
10028 {
10029 super.OnEnergyAdded();
10030
10032 }
10033
10034
10036 {
10037 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10038 {
10040 {
10041 float energy_0to1 = GetCompEM().GetEnergy0To1();
10043 }
10044 }
10045 }
10046
10047
10049 {
10050 return ConfigGetFloat("heatIsolation");
10051 }
10052
10054 {
10056 }
10057
10059 {
10060 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10061 if (
g_Game.ConfigIsExisting(paramPath))
10062 return g_Game.ConfigGetFloat(paramPath);
10063
10064 return 0.0;
10065 }
10066
10068 {
10069 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10070 if (
g_Game.ConfigIsExisting(paramPath))
10071 return g_Game.ConfigGetFloat(paramPath);
10072
10073 return 0.0;
10074 }
10075
10076 override void SetWet(
float value,
bool allow_client =
false)
10077 {
10078 if (!IsServerCheck(allow_client))
10079 return;
10080
10083
10085
10086 m_VarWet = Math.Clamp(value, min, max);
10087
10089 {
10092 }
10093 }
10094
10095 override void AddWet(
float value)
10096 {
10098 }
10099
10101 {
10103 }
10104
10106 {
10108 }
10109
10111 {
10113 }
10114
10116 {
10118 }
10119
10121 {
10123 }
10124
10125 override void OnWetChanged(
float newVal,
float oldVal)
10126 {
10129 if (newLevel != oldLevel)
10130 {
10132 }
10133 }
10134
10136 {
10137 SetWeightDirty();
10138 }
10139
10141 {
10142 return GetWetLevelInternal(
m_VarWet);
10143 }
10144
10145
10146
10148 {
10150 }
10151
10153 {
10155 }
10156
10158 {
10160 }
10161
10163 {
10165 }
10166
10167
10168
10170 {
10171 if (ConfigIsExisting("itemModelLength"))
10172 {
10173 return ConfigGetFloat("itemModelLength");
10174 }
10175 return 0;
10176 }
10177
10179 {
10180 if (ConfigIsExisting("itemAttachOffset"))
10181 {
10182 return ConfigGetFloat("itemAttachOffset");
10183 }
10184 return 0;
10185 }
10186
10187 override void SetCleanness(
int value,
bool allow_client =
false)
10188 {
10189 if (!IsServerCheck(allow_client))
10190 return;
10191
10193
10195
10198 }
10199
10201 {
10203 }
10204
10206 {
10207 return true;
10208 }
10209
10210
10211
10212
10214 {
10216 }
10217
10219 {
10221 }
10222
10223
10224
10225
10226 override void SetColor(
int r,
int g,
int b,
int a)
10227 {
10233 }
10235 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10236 {
10241 }
10242
10244 {
10246 }
10247
10250 {
10251 int r,g,b,a;
10253 r = r/255;
10254 g = g/255;
10255 b = b/255;
10256 a = a/255;
10257 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10258 }
10259
10260
10261
10262 override void SetLiquidType(
int value,
bool allow_client =
false)
10263 {
10264 if (!IsServerCheck(allow_client))
10265 return;
10266
10271 }
10272
10274 {
10275 return ConfigGetInt("varLiquidTypeInit");
10276 }
10277
10279 {
10281 }
10282
10284 {
10286 SetFrozen(false);
10287 }
10288
10291 {
10292 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10293 }
10294
10295
10298 {
10299 PlayerBase nplayer;
10300 if (PlayerBase.CastTo(nplayer, player))
10301 {
10303 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10304 }
10305 }
10306
10307
10310 {
10311 PlayerBase nplayer;
10312 if (PlayerBase.CastTo(nplayer,player))
10313 {
10314 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10315 }
10316
10317 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10318
10319 if (HasEnergyManager())
10320 {
10321 GetCompEM().UpdatePlugState();
10322 }
10323 }
10324
10325
10327 {
10328 super.OnPlacementStarted(player);
10329
10331 }
10332
10333 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10334 {
10336 {
10337 m_AdminLog.OnPlacementComplete(player,
this);
10338 }
10339
10340 super.OnPlacementComplete(player, position, orientation);
10341 }
10342
10343
10344
10345
10346
10348 {
10350 {
10351 return true;
10352 }
10353 else
10354 {
10355 return false;
10356 }
10357 }
10358
10359
10361 {
10363 {
10365 }
10366 }
10367
10368
10370 {
10372 }
10373
10375 {
10377 }
10378
10379 override void InsertAgent(
int agent,
float count = 1)
10380 {
10381 if (count < 1)
10382 return;
10383
10385 }
10386
10389 {
10391 }
10392
10393
10395 {
10397 }
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10441 {
10443 return false;
10444 return true;
10445 }
10446
10448 {
10449
10451 }
10452
10453
10456 {
10457 super.CheckForRoofLimited(timeTresholdMS);
10458
10459 float time =
g_Game.GetTime();
10460 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10461 {
10462 m_PreviousRoofTestTime = time;
10463 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10464 }
10465 }
10466
10467
10469 {
10471 {
10472 return 0;
10473 }
10474
10475 if (GetInventory().GetAttachmentSlotsCount() != 0)
10476 {
10477 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10478 if (filter)
10479 return filter.GetProtectionLevel(type, false, system);
10480 else
10481 return 0;
10482 }
10483
10484 string subclassPath, entryName;
10485
10486 switch (type)
10487 {
10489 entryName = "biological";
10490 break;
10492 entryName = "chemical";
10493 break;
10494 default:
10495 entryName = "biological";
10496 break;
10497 }
10498
10499 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10500
10501 return g_Game.ConfigGetFloat(subclassPath + entryName);
10502 }
10503
10504
10505
10508 {
10509 if (!IsMagazine())
10511
10513 }
10514
10515
10516
10517
10518
10523 {
10524 return true;
10525 }
10526
10528 {
10530 }
10531
10532
10533
10534
10535
10537 {
10538 if (parent)
10539 {
10540 if (parent.IsInherited(DayZInfected))
10541 return true;
10542
10543 if (!parent.IsRuined())
10544 return true;
10545 }
10546
10547 return true;
10548 }
10549
10551 {
10552 if (!super.CanPutAsAttachment(parent))
10553 {
10554 return false;
10555 }
10556
10557 if (!IsRuined() && !parent.IsRuined())
10558 {
10559 return true;
10560 }
10561
10562 return false;
10563 }
10564
10566 {
10567
10568
10569
10570
10571 return super.CanReceiveItemIntoCargo(item);
10572 }
10573
10575 {
10576
10577
10578
10579
10580 GameInventory attachmentInv = attachment.GetInventory();
10582 {
10583 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10584 return false;
10585 }
10586
10587 InventoryLocation loc = new InventoryLocation();
10588 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10589 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10590 return false;
10591
10592 return super.CanReceiveAttachment(attachment, slotId);
10593 }
10594
10596 {
10597 if (!super.CanReleaseAttachment(attachment))
10598 return false;
10599
10600 return GetInventory().AreChildrenAccessible();
10601 }
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10624 {
10625 int id = muzzle_owner.GetMuzzleID();
10626 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10627
10628 if (WPOF_array)
10629 {
10630 for (int i = 0; i < WPOF_array.Count(); i++)
10631 {
10632 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10633
10634 if (WPOF)
10635 {
10636 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10637 }
10638 }
10639 }
10640 }
10641
10642
10644 {
10645 int id = muzzle_owner.GetMuzzleID();
10647
10648 if (WPOBE_array)
10649 {
10650 for (int i = 0; i < WPOBE_array.Count(); i++)
10651 {
10652 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10653
10654 if (WPOBE)
10655 {
10656 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10657 }
10658 }
10659 }
10660 }
10661
10662
10664 {
10665 int id = muzzle_owner.GetMuzzleID();
10666 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10667
10668 if (WPOOH_array)
10669 {
10670 for (int i = 0; i < WPOOH_array.Count(); i++)
10671 {
10672 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10673
10674 if (WPOOH)
10675 {
10676 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10677 }
10678 }
10679 }
10680 }
10681
10682
10684 {
10685 int id = muzzle_owner.GetMuzzleID();
10686 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10687
10688 if (WPOOH_array)
10689 {
10690 for (int i = 0; i < WPOOH_array.Count(); i++)
10691 {
10692 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10693
10694 if (WPOOH)
10695 {
10696 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10697 }
10698 }
10699 }
10700 }
10701
10702
10704 {
10705 int id = muzzle_owner.GetMuzzleID();
10706 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10707
10708 if (WPOOH_array)
10709 {
10710 for (int i = 0; i < WPOOH_array.Count(); i++)
10711 {
10712 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10713
10714 if (WPOOH)
10715 {
10716 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10717 }
10718 }
10719 }
10720 }
10721
10722
10723
10725 {
10727 {
10728 return true;
10729 }
10730
10731 return false;
10732 }
10733
10735 {
10737 {
10738 return true;
10739 }
10740
10741 return false;
10742 }
10743
10745 {
10747 {
10748 return true;
10749 }
10750
10751 return false;
10752 }
10753
10755 {
10756 return false;
10757 }
10758
10761 {
10762 return UATimeSpent.DEFAULT_DEPLOY;
10763 }
10764
10765
10766
10767
10769 {
10771 SetSynchDirty();
10772 }
10773
10775 {
10777 }
10778
10779
10781 {
10782 return false;
10783 }
10784
10787 {
10788 string att_type = "None";
10789
10790 if (ConfigIsExisting("soundAttType"))
10791 {
10792 att_type = ConfigGetString("soundAttType");
10793 }
10794
10796 }
10797
10799 {
10801 }
10802
10803
10804
10805
10806
10812
10814 {
10817
10819 }
10820
10821
10823 {
10825 return;
10826
10828
10831
10834
10835 SoundParameters params = new SoundParameters();
10839 }
10840
10841
10843 {
10845 {
10848
10849 SetSynchDirty();
10850
10853 }
10854 }
10855
10857 {
10859 }
10860
10861
10863 {
10865 return;
10866
10868 SetSynchDirty();
10869
10872 }
10873
10875 {
10878 }
10879
10881 {
10883 }
10884
10885 void OnApply(PlayerBase player);
10886
10888 {
10889 return 1.0;
10890 };
10891
10893 {
10895 }
10896
10898 {
10900 }
10901
10903
10905 {
10906 SetDynamicPhysicsLifeTime(0.01);
10908 }
10909
10911 {
10912 array<string> zone_names = new array<string>;
10913 GetDamageZones(zone_names);
10914 for (int i = 0; i < zone_names.Count(); i++)
10915 {
10916 SetHealthMax(zone_names.Get(i),"Health");
10917 }
10918 SetHealthMax("","Health");
10919 }
10920
10923 {
10924 float global_health = GetHealth01("","Health");
10925 array<string> zones = new array<string>;
10926 GetDamageZones(zones);
10927
10928 for (int i = 0; i < zones.Count(); i++)
10929 {
10930 SetHealth01(zones.Get(i),"Health",global_health);
10931 }
10932 }
10933
10936 {
10937 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10938 }
10939
10941 {
10942 if (!hasRootAsPlayer)
10943 {
10944 if (refParentIB)
10945 {
10946
10947 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10948 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10949
10950 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10951 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10952
10955 }
10956 else
10957 {
10958
10961 }
10962 }
10963 }
10964
10966 {
10968 {
10969 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10970 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10971 {
10972 float heatPermCoef = 1.0;
10974 while (ent)
10975 {
10976 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10977 ent = ent.GetHierarchyParent();
10978 }
10979
10980 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10981 }
10982 }
10983 }
10984
10986 {
10987
10988 EntityAI parent = GetHierarchyParent();
10989 if (!parent)
10990 {
10991 hasParent = false;
10992 hasRootAsPlayer = false;
10993 }
10994 else
10995 {
10996 hasParent = true;
10997 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10998 refParentIB =
ItemBase.Cast(parent);
10999 }
11000 }
11001
11002 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11003 {
11004
11005 }
11006
11008 {
11009
11010 return false;
11011 }
11012
11014 {
11015
11016
11017 return false;
11018 }
11019
11021 {
11022
11023 return false;
11024 }
11025
11028 {
11029 return !GetIsFrozen() &&
IsOpen();
11030 }
11031
11033 {
11034 bool hasParent = false, hasRootAsPlayer = false;
11036
11037 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11038 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11039
11040 if (wwtu || foodDecay)
11041 {
11045
11046 if (processWetness || processTemperature || processDecay)
11047 {
11049
11050 if (processWetness)
11051 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11052
11053 if (processTemperature)
11055
11056 if (processDecay)
11057 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11058 }
11059 }
11060 }
11061
11064 {
11066 }
11067
11069 {
11072
11073 return super.GetTemperatureFreezeThreshold();
11074 }
11075
11077 {
11080
11081 return super.GetTemperatureThawThreshold();
11082 }
11083
11085 {
11088
11089 return super.GetItemOverheatThreshold();
11090 }
11091
11093 {
11095 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11096
11097 return super.GetTemperatureFreezeTime();
11098 }
11099
11101 {
11103 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11104
11105 return super.GetTemperatureThawTime();
11106 }
11107
11112
11114 {
11115 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11116 }
11117
11119 {
11120 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11121 }
11122
11125 {
11127 }
11128
11130 {
11132 }
11133
11135 {
11137 }
11138
11141 {
11142 return null;
11143 }
11144
11147 {
11148 return false;
11149 }
11150
11152 {
11154 {
11157 if (!trg)
11158 {
11160 explosive = this;
11161 }
11162
11163 explosive.PairRemote(trg);
11165
11166 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11167 trg.SetPersistentPairID(persistentID);
11168 explosive.SetPersistentPairID(persistentID);
11169
11170 return true;
11171 }
11172 return false;
11173 }
11174
11177 {
11178 float ret = 1.0;
11181 ret *= GetHealth01();
11182
11183 return ret;
11184 }
11185
11186 #ifdef DEVELOPER
11187 override void SetDebugItem()
11188 {
11189 super.SetDebugItem();
11190 _itemBase = this;
11191 }
11192
11194 {
11195 string text = super.GetDebugText();
11196
11198 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11199
11200 return text;
11201 }
11202 #endif
11203
11205 {
11206 return true;
11207 }
11208
11210
11212
11214 {
11217 }
11218
11219
11227
11243
11244 [
Obsolete(
"Use ItemSoundHandler instead")]
11247 {
11248 if (!
g_Game.IsDedicatedServer())
11249 {
11250 if (ConfigIsExisting("attachSoundSet"))
11251 {
11252 string cfg_path = "";
11253 string soundset = "";
11254 string type_name =
GetType();
11255
11258 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11259 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11260
11261 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11262 {
11263 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11264 {
11265 if (cfg_slot_array[i] == slot_type)
11266 {
11267 soundset = cfg_soundset_array[i];
11268 break;
11269 }
11270 }
11271 }
11272
11273 if (soundset != "")
11274 {
11275 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11277 }
11278 }
11279 }
11280 }
11281
11283}
11284
11286{
11288 if (entity)
11289 {
11290 bool is_item = entity.IsInherited(
ItemBase);
11291 if (is_item && full_quantity)
11292 {
11295 }
11296 }
11297 else
11298 {
11300 return NULL;
11301 }
11302 return entity;
11303}
11304
11306{
11307 if (item)
11308 {
11309 if (health > 0)
11310 item.SetHealth("", "", health);
11311
11312 if (item.CanHaveTemperature())
11313 {
11315 if (item.CanFreeze())
11316 item.SetFrozen(false);
11317 }
11318
11319 if (item.HasEnergyManager())
11320 {
11321 if (quantity >= 0)
11322 {
11323 item.GetCompEM().SetEnergy0To1(quantity);
11324 }
11325 else
11326 {
11328 }
11329 }
11330 else if (item.IsMagazine())
11331 {
11332 Magazine mag = Magazine.Cast(item);
11333 if (quantity >= 0)
11334 {
11335 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11336 }
11337 else
11338 {
11340 }
11341
11342 }
11343 else
11344 {
11345 if (quantity >= 0)
11346 {
11347 item.SetQuantityNormalized(quantity, false);
11348 }
11349 else
11350 {
11352 }
11353
11354 }
11355 }
11356}
11357
11358#ifdef DEVELOPER
11360#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.