6458{
6460 {
6461 return true;
6462 }
6463};
6464
6466{
6467
6468};
6469
6470
6471
6473{
6477
6479
6482
6483
6484
6485
6486
6495
6501
6506
6511
6532 protected bool m_IsResultOfSplit
6533
6535
6540
6541
6542
6544
6548
6549
6550
6552
6555
6556
6557
6563
6564
6572
6575
6576
6578
6579
6581
6582
6587
6588
6593
6595
6596
6598
6599
6601 {
6606
6607 if (!
g_Game.IsDedicatedServer())
6608 {
6610 {
6612
6614 {
6616 }
6617 }
6618
6621 }
6622
6623 m_OldLocation = null;
6624
6626 {
6628 }
6629
6630 if (ConfigIsExisting("headSelectionsToHide"))
6631 {
6634 }
6635
6637 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6638 {
6640 }
6641
6643
6644 m_IsResultOfSplit = false;
6645
6647 }
6648
6650 {
6651 super.InitItemVariables();
6652
6658 m_Count = ConfigGetInt(
"count");
6659
6662
6667
6670
6675
6687
6691
6692
6695 if (ConfigIsExisting("canBeSplit"))
6696 {
6699 }
6700
6702 if (ConfigIsExisting("itemBehaviour"))
6704
6705
6708 RegisterNetSyncVariableInt("m_VarLiquidType");
6709 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6710
6711 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6712 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6713 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6714
6715 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6716 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6717 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6718 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6719
6720 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6721 RegisterNetSyncVariableBool("m_IsTakeable");
6722 RegisterNetSyncVariableBool("m_IsHologram");
6723
6726 {
6729 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6730 }
6731
6733
6735 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6737
6739 }
6740
6742 {
6744 }
6745
6747 {
6750 {
6755 }
6756 }
6757
6758 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6759 {
6761 {
6764 }
6765
6767 }
6768
6770 {
6776 }
6777
6779
6781 {
6783
6784 if (!action)
6785 {
6786 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6787 return;
6788 }
6789
6791 if (!ai)
6792 {
6794 return;
6795 }
6796
6798 if (!action_array)
6799 {
6800 action_array = new array<ActionBase_Basic>;
6802 }
6803 if (LogManager.IsActionLogEnable())
6804 {
6805 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6806 }
6807
6808 if (action_array.Find(action) != -1)
6809 {
6810 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6811 }
6812 else
6813 {
6814 action_array.Insert(action);
6815 }
6816 }
6817
6819 {
6820 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6821 ActionBase action = player.GetActionManager().GetAction(actionName);
6824
6825 if (action_array)
6826 {
6827 action_array.RemoveItem(action);
6828 }
6829 }
6830
6831
6832
6834 {
6835 ActionOverrideData overrideData = new ActionOverrideData();
6839
6841 if (!actionMap)
6842 {
6845 }
6846
6847 actionMap.Insert(this.
Type(), overrideData);
6848
6849 }
6850
6852
6854
6855
6857 {
6860
6863
6864 string config_to_search = "CfgVehicles";
6865 string muzzle_owner_config;
6866
6868 {
6869 if (IsInherited(Weapon))
6870 config_to_search = "CfgWeapons";
6871
6872 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6873
6874 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6875
6876 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6877
6878 if (config_OnFire_subclass_count > 0)
6879 {
6880 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6881
6882 for (int i = 0; i < config_OnFire_subclass_count; i++)
6883 {
6884 string particle_class = "";
6885 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6886 string config_OnFire_entry = config_OnFire_class + particle_class;
6887 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6888 WPOF_array.Insert(WPOF);
6889 }
6890
6891
6893 }
6894 }
6895
6897 {
6898 config_to_search = "CfgWeapons";
6899 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6900
6901 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6902
6903 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6904
6905 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6906 {
6907 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6908
6909 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6910 {
6911 string particle_class2 = "";
6912 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6913 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6914 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6915 WPOBE_array.Insert(WPOBE);
6916 }
6917
6918
6920 }
6921 }
6922 }
6923
6924
6926 {
6929
6931 {
6932 string config_to_search = "CfgVehicles";
6933
6934 if (IsInherited(Weapon))
6935 config_to_search = "CfgWeapons";
6936
6937 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6938 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6939
6940 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6941 {
6942
6944
6946 {
6948 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6950 return;
6951 }
6952
6955
6956
6957
6958 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6959 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6960
6961 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6962 {
6963 string particle_class = "";
6964 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6965 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6966 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6967
6968 if (entry_type == CT_CLASS)
6969 {
6970 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6971 WPOOH_array.Insert(WPOF);
6972 }
6973 }
6974
6975
6977 }
6978 }
6979 }
6980
6982 {
6984 }
6985
6987 {
6989 {
6991
6994
6997
6998 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6999 }
7000 }
7001
7003 {
7005 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7006
7008 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7009
7011 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7012
7014 {
7016 }
7017 }
7018
7020 {
7022 }
7023
7025 {
7028 else
7030
7032 {
7035 }
7036 else
7037 {
7040
7043 }
7044
7046 }
7047
7049 {
7051 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7052 }
7053
7055 {
7057 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7059 }
7060
7062 {
7064 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7065 }
7066
7068 {
7071
7072 OverheatingParticle OP = new OverheatingParticle();
7077
7079 }
7080
7082 {
7085
7086 return -1;
7087 }
7088
7090 {
7092 {
7095
7096 for (int i = count; i > 0; --i)
7097 {
7098 int id = i - 1;
7101
7104
7105 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7106 {
7107 if (p)
7108 {
7111 }
7112 }
7113 }
7114 }
7115 }
7116
7118 {
7120 {
7122 {
7123 int id = i - 1;
7125
7126 if (OP)
7127 {
7129
7130 if (p)
7131 {
7133 }
7134
7135 delete OP;
7136 }
7137 }
7138
7141 }
7142 }
7143
7146 {
7147 return 0.0;
7148 }
7149
7150
7152 {
7153 return 250;
7154 }
7155
7157 {
7158 return 0;
7159 }
7160
7163 {
7165 return true;
7166
7167 return false;
7168 }
7169
7172 {
7175
7177 {
7179 }
7180 else
7181 {
7182
7184 }
7185
7187 }
7188
7195 {
7196 return -1;
7197 }
7198
7199
7200
7201
7203 {
7205 {
7206 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7207 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7208
7209 if (r_index >= 0)
7210 {
7211 InventoryLocation r_il = new InventoryLocation;
7212 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7213
7214 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7217 {
7218 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7219 }
7221 {
7222 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7223 }
7224
7225 }
7226
7227 player.GetHumanInventory().ClearUserReservedLocation(this);
7228 }
7229
7232 }
7233
7234
7235
7236
7238 {
7239 return ItemBase.m_DebugActionsMask;
7240 }
7241
7243 {
7244 return ItemBase.m_DebugActionsMask & mask;
7245 }
7246
7248 {
7249 ItemBase.m_DebugActionsMask = mask;
7250 }
7251
7253 {
7254 ItemBase.m_DebugActionsMask |= mask;
7255 }
7256
7258 {
7259 ItemBase.m_DebugActionsMask &= ~mask;
7260 }
7261
7263 {
7265 {
7267 }
7268 else
7269 {
7271 }
7272 }
7273
7274
7276 {
7277 if (GetEconomyProfile())
7278 {
7279 float q_max = GetEconomyProfile().GetQuantityMax();
7280 if (q_max > 0)
7281 {
7282 float q_min = GetEconomyProfile().GetQuantityMin();
7283 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7284
7286 {
7287 ComponentEnergyManager comp = GetCompEM();
7289 {
7291 }
7292 }
7294 {
7296
7297 }
7298
7299 }
7300 }
7301 }
7302
7305 {
7306 EntityAI parent = GetHierarchyParent();
7307
7308 if (parent)
7309 {
7310 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7311 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7312 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7313 }
7314 }
7315
7318 {
7319 EntityAI parent = GetHierarchyParent();
7320
7321 if (parent)
7322 {
7323 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7324 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7325 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7326 }
7327 }
7328
7330 {
7331
7332
7333
7334
7336
7338 {
7339 if (ScriptInputUserData.CanStoreInputUserData())
7340 {
7341 ScriptInputUserData ctx = new ScriptInputUserData;
7347 ctx.
Write(use_stack_max);
7350
7352 {
7353 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7354 }
7355 }
7356 }
7357 else if (!
g_Game.IsMultiplayer())
7358 {
7360 }
7361 }
7362
7364 {
7366 }
7367
7369 {
7371 }
7372
7374 {
7376 }
7377
7379 {
7380
7381 return false;
7382 }
7383
7385 {
7386 return false;
7387 }
7388
7392 {
7393 return false;
7394 }
7395
7397 {
7398 return "";
7399 }
7400
7402
7404 {
7405 return false;
7406 }
7407
7409 {
7410 return true;
7411 }
7412
7413
7414
7416 {
7417 return true;
7418 }
7419
7421 {
7422 return true;
7423 }
7424
7426 {
7427 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7429 }
7430
7432 {
7434 }
7435
7437 {
7439 if (!is_being_placed)
7441 SetSynchDirty();
7442 }
7443
7444
7446
7448 {
7450 }
7451
7453 {
7455 }
7456
7458 {
7459 return 1;
7460 }
7461
7463 {
7464 return false;
7465 }
7466
7468 {
7470 SetSynchDirty();
7471 }
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7492
7493
7494
7495
7496
7497
7498
7499
7500
7501
7502
7503
7504
7505
7506
7508 {
7509 super.OnMovedInsideCargo(container);
7510
7511 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7512 }
7513
7514 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7515 {
7516 super.EEItemLocationChanged(oldLoc, newLoc);
7517
7518 PlayerBase newPlayer = null;
7519 PlayerBase oldPlayer = null;
7520
7521 if (newLoc.GetParent())
7522 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7523
7524 if (oldLoc.GetParent())
7525 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7526
7528 {
7529 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7530
7531 if (rIndex >= 0)
7532 {
7533 InventoryLocation rIl = new InventoryLocation;
7534 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7535
7536 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7539 {
7540 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7541 }
7543 {
7545 }
7546
7547 }
7548 }
7549
7551 {
7552 if (newPlayer)
7553 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7554
7555 if (newPlayer == oldPlayer)
7556 {
7557 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7558 {
7560 {
7561 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7562 {
7563 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7564 }
7565 }
7566 else
7567 {
7568 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7569 }
7570 }
7571
7572 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7573 {
7574 int type = oldLoc.GetType();
7576 {
7577 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7578 }
7580 {
7581 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7582 }
7583 }
7584 if (!m_OldLocation)
7585 {
7586 m_OldLocation = new InventoryLocation;
7587 }
7588 m_OldLocation.Copy(oldLoc);
7589 }
7590 else
7591 {
7592 if (m_OldLocation)
7593 {
7594 m_OldLocation.Reset();
7595 }
7596 }
7597
7598 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7599 }
7600 else
7601 {
7602 if (newPlayer)
7603 {
7604 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7605 if (resIndex >= 0)
7606 {
7607 InventoryLocation il = new InventoryLocation;
7608 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7610 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7613 {
7614 il.
GetParent().GetOnReleaseLock().Invoke(it);
7615 }
7617 {
7619 }
7620
7621 }
7622 }
7624 {
7625
7627 }
7628
7629 if (m_OldLocation)
7630 {
7631 m_OldLocation.Reset();
7632 }
7633 }
7634
7636 {
7637 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7638 }
7639
7641 {
7642 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7643 }
7644 }
7645
7646 override void EOnContact(IEntity other, Contact extra)
7647 {
7649 {
7650 int liquidType = -1;
7652 if (impactSpeed > 0.0)
7653 {
7655 #ifndef SERVER
7657 #else
7659 SetSynchDirty();
7660 #endif
7662 }
7663 }
7664
7665 #ifdef SERVER
7666 if (GetCompEM() && GetCompEM().IsPlugged())
7667 {
7668 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7669 GetCompEM().UnplugThis();
7670 }
7671 #endif
7672 }
7673
7675
7677 {
7679 }
7680
7682 {
7683
7684 }
7685
7687 {
7688 super.OnItemLocationChanged(old_owner, new_owner);
7689
7690 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7691 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7692
7693 if (!relatedPlayer && playerNew)
7694 relatedPlayer = playerNew;
7695
7696 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7697 {
7699 if (actionMgr)
7700 {
7701 ActionBase currentAction = actionMgr.GetRunningAction();
7702 if (currentAction)
7704 }
7705 }
7706
7707 Man ownerPlayerOld = null;
7708 Man ownerPlayerNew = null;
7709
7710 if (old_owner)
7711 {
7712 if (old_owner.
IsMan())
7713 {
7714 ownerPlayerOld = Man.Cast(old_owner);
7715 }
7716 else
7717 {
7718 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7719 }
7720 }
7721 else
7722 {
7724 {
7726
7727 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7728 {
7729 GetCompEM().UnplugThis();
7730 }
7731 }
7732 }
7733
7734 if (new_owner)
7735 {
7736 if (new_owner.
IsMan())
7737 {
7738 ownerPlayerNew = Man.Cast(new_owner);
7739 }
7740 else
7741 {
7742 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7743 }
7744 }
7745
7746 if (ownerPlayerOld != ownerPlayerNew)
7747 {
7748 if (ownerPlayerOld)
7749 {
7750 array<EntityAI> subItemsExit = new array<EntityAI>;
7752 for (int i = 0; i < subItemsExit.Count(); i++)
7753 {
7756 }
7757 }
7758
7759 if (ownerPlayerNew)
7760 {
7761 array<EntityAI> subItemsEnter = new array<EntityAI>;
7763 for (int j = 0; j < subItemsEnter.Count(); j++)
7764 {
7767 }
7768 }
7769 }
7770 else if (ownerPlayerNew != null)
7771 {
7772 PlayerBase nplayer;
7773 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7774 {
7775 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7777 for (int k = 0; k < subItemsUpdate.Count(); k++)
7778 {
7780 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7781 }
7782 }
7783 }
7784
7785 if (old_owner)
7786 old_owner.OnChildItemRemoved(this);
7787 if (new_owner)
7788 new_owner.OnChildItemReceived(this);
7789 }
7790
7791
7793 {
7794 super.EEDelete(parent);
7795 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7796 if (player)
7797 {
7799
7800 if (player.IsAlive())
7801 {
7802 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7803 if (r_index >= 0)
7804 {
7805 InventoryLocation r_il = new InventoryLocation;
7806 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7807
7808 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7811 {
7812 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7813 }
7815 {
7816 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7817 }
7818
7819 }
7820
7821 player.RemoveQuickBarEntityShortcut(this);
7822 }
7823 }
7824 }
7825
7827 {
7828 super.EEKilled(killer);
7829
7832 {
7833 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7834 {
7835 if (IsMagazine())
7836 {
7837 if (Magazine.Cast(this).GetAmmoCount() > 0)
7838 {
7840 }
7841 }
7842 else
7843 {
7845 }
7846 }
7847 }
7848 }
7849
7851 {
7852 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7853
7854 super.OnWasAttached(parent, slot_id);
7855
7858
7861 }
7862
7864 {
7865 super.OnWasDetached(parent, slot_id);
7866
7869
7872 }
7873
7875 {
7876 int idx;
7879
7880 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7881 if (inventory_slots.Count() < 1)
7882 {
7883 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7884 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7885 }
7886 else
7887 {
7888 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7889 }
7890
7891 idx = inventory_slots.Find(slot);
7892 if (idx < 0)
7893 return "";
7894
7895 return attach_types.Get(idx);
7896 }
7897
7899 {
7900 int idx = -1;
7901 string slot;
7902
7905
7906 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7907 if (inventory_slots.Count() < 1)
7908 {
7909 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7910 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7911 }
7912 else
7913 {
7914 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7915 if (detach_types.Count() < 1)
7916 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7917 }
7918
7919 for (int i = 0; i < inventory_slots.Count(); i++)
7920 {
7921 slot = inventory_slots.Get(i);
7922 }
7923
7924 if (slot != "")
7925 {
7926 if (detach_types.Count() == 1)
7927 idx = 0;
7928 else
7929 idx = inventory_slots.Find(slot);
7930 }
7931 if (idx < 0)
7932 return "";
7933
7934 return detach_types.Get(idx);
7935 }
7936
7938 {
7939
7941
7942
7943 float min_time = 1;
7944 float max_time = 3;
7945 float delay = Math.RandomFloat(min_time, max_time);
7946
7947 explode_timer.Run(delay, this, "DoAmmoExplosion");
7948 }
7949
7951 {
7952 Magazine magazine = Magazine.Cast(this);
7953 int pop_sounds_count = 6;
7954 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7955
7956
7957 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7958 string sound_name = pop_sounds[ sound_idx ];
7959 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7960
7961
7962 magazine.ServerAddAmmoCount(-1);
7963
7964
7965 float min_temp_to_explode = 100;
7966
7967 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7968 {
7970 }
7971 }
7972
7973
7974 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7975 {
7976 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7977
7978 const int CHANCE_DAMAGE_CARGO = 4;
7979 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7980 const int CHANCE_DAMAGE_NOTHING = 2;
7981
7983 {
7984 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7985 int chances;
7986 int rnd;
7987
7988 if (GetInventory().GetCargo())
7989 {
7990 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7991 rnd = Math.RandomInt(0,chances);
7992
7993 if (rnd < CHANCE_DAMAGE_CARGO)
7994 {
7996 }
7997 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7998 {
8000 }
8001 }
8002 else
8003 {
8004 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8005 rnd = Math.RandomInt(0,chances);
8006
8007 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8008 {
8010 }
8011 }
8012 }
8013 }
8014
8016 {
8017 CargoBase cargo = GetInventory().GetCargo();
8018 if (cargo)
8019 {
8021 if (item_count > 0)
8022 {
8023 int random_pick = Math.RandomInt(0, item_count);
8025 if (!item.IsExplosive())
8026 {
8027 item.AddHealth("","",damage);
8028 return true;
8029 }
8030 }
8031 }
8032 return false;
8033 }
8034
8036 {
8037 GameInventory inventory = GetInventory();
8039 if (attachment_count > 0)
8040 {
8041 int random_pick = Math.RandomInt(0, attachment_count);
8043 if (!attachment.IsExplosive())
8044 {
8045 attachment.AddHealth("","",damage);
8046 return true;
8047 }
8048 }
8049 return false;
8050 }
8051
8053 {
8055 }
8056
8058 {
8060 return GetInventory().CanRemoveEntity();
8061
8062 return false;
8063 }
8064
8066 {
8067
8069 return false;
8070
8071
8073 return false;
8074
8075
8076
8078 if (delta == 0)
8079 return false;
8080
8081
8082 return true;
8083 }
8084
8086 {
8088 {
8089 if (ScriptInputUserData.CanStoreInputUserData())
8090 {
8091 ScriptInputUserData ctx = new ScriptInputUserData;
8096 ctx.
Write(destination_entity);
8100 }
8101 }
8102 else if (!
g_Game.IsMultiplayer())
8103 {
8105 }
8106 }
8107
8109 {
8110 float split_quantity_new;
8114 InventoryLocation loc = new InventoryLocation;
8115
8116 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8117 {
8119 split_quantity_new = stack_max;
8120 else
8122
8124 {
8125 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8126 if (new_item)
8127 {
8128 new_item.SetResultOfSplit(true);
8129 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8131 new_item.
SetQuantity(split_quantity_new,
false,
true);
8132 }
8133 }
8134 }
8135 else if (destination_entity && slot_id == -1)
8136 {
8137 if (quantity > stack_max)
8138 split_quantity_new = stack_max;
8139 else
8140 split_quantity_new = quantity;
8141
8143 {
8144 GameInventory destinationInventory = destination_entity.GetInventory();
8146 {
8149 }
8150
8151 if (new_item)
8152 {
8153 new_item.SetResultOfSplit(true);
8154 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8156 new_item.
SetQuantity(split_quantity_new,
false,
true);
8157 }
8158 }
8159 }
8160 else
8161 {
8162 if (stack_max != 0)
8163 {
8165 {
8167 }
8168
8169 if (split_quantity_new == 0)
8170 {
8171 if (!
g_Game.IsMultiplayer())
8172 player.PhysicalPredictiveDropItem(this);
8173 else
8174 player.ServerDropEntity(this);
8175 return;
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 {
8197 float split_quantity_new;
8201 InventoryLocation loc = new InventoryLocation;
8202
8203 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8204 {
8206 split_quantity_new = stack_max;
8207 else
8209
8211 {
8212 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8213 if (new_item)
8214 {
8215 new_item.SetResultOfSplit(true);
8216 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8218 new_item.
SetQuantity(split_quantity_new,
false,
true);
8219 }
8220 }
8221 }
8222 else if (destination_entity && slot_id == -1)
8223 {
8224 if (quantity > stack_max)
8225 split_quantity_new = stack_max;
8226 else
8227 split_quantity_new = quantity;
8228
8230 {
8231 GameInventory destinationInventory = destination_entity.GetInventory();
8233 {
8236 }
8237
8238 if (new_item)
8239 {
8240 new_item.SetResultOfSplit(true);
8241 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8243 new_item.
SetQuantity(split_quantity_new,
false,
true);
8244 }
8245 }
8246 }
8247 else
8248 {
8249 if (stack_max != 0)
8250 {
8252 {
8254 }
8255
8257 {
8259
8260 if (new_item)
8261 {
8262 new_item.SetResultOfSplit(true);
8263 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8266 new_item.PlaceOnSurface();
8267 }
8268 }
8269 }
8270 }
8271 }
8272
8274 {
8276 {
8277 if (ScriptInputUserData.CanStoreInputUserData())
8278 {
8279 ScriptInputUserData ctx = new ScriptInputUserData;
8284 dst.WriteToContext(ctx);
8286 }
8287 }
8288 else if (!
g_Game.IsMultiplayer())
8289 {
8291 }
8292 }
8293
8295 {
8297 {
8298 if (ScriptInputUserData.CanStoreInputUserData())
8299 {
8300 ScriptInputUserData ctx = new ScriptInputUserData;
8305 ctx.
Write(destination_entity);
8311 }
8312 }
8313 else if (!
g_Game.IsMultiplayer())
8314 {
8316 }
8317 }
8318
8320 {
8322 }
8323
8325 {
8327 float split_quantity_new;
8329 if (dst.IsValid())
8330 {
8331 int slot_id = dst.GetSlot();
8333
8334 if (quantity > stack_max)
8335 split_quantity_new = stack_max;
8336 else
8337 split_quantity_new = quantity;
8338
8340 {
8342
8343 if (new_item)
8344 {
8345 new_item.SetResultOfSplit(true);
8346 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8348 new_item.
SetQuantity(split_quantity_new,
false,
true);
8349 }
8350
8351 return new_item;
8352 }
8353 }
8354
8355 return null;
8356 }
8357
8359 {
8361 float split_quantity_new;
8363 if (destination_entity)
8364 {
8366 if (quantity > stackable)
8367 split_quantity_new = stackable;
8368 else
8369 split_quantity_new = quantity;
8370
8372 {
8373 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8374 if (new_item)
8375 {
8376 new_item.SetResultOfSplit(true);
8377 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8379 new_item.
SetQuantity(split_quantity_new,
false,
true);
8380 }
8381 }
8382 }
8383 }
8384
8386 {
8388 {
8389 if (ScriptInputUserData.CanStoreInputUserData())
8390 {
8391 ScriptInputUserData ctx = new ScriptInputUserData;
8396 ItemBase destination_entity =
this;
8397 ctx.
Write(destination_entity);
8401 }
8402 }
8403 else if (!
g_Game.IsMultiplayer())
8404 {
8406 }
8407 }
8408
8410 {
8412 float split_quantity_new;
8414 if (player)
8415 {
8417 if (quantity > stackable)
8418 split_quantity_new = stackable;
8419 else
8420 split_quantity_new = quantity;
8421
8423 {
8424 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8425 new_item =
ItemBase.Cast(in_hands);
8426 if (new_item)
8427 {
8428 new_item.SetResultOfSplit(true);
8429 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8431 new_item.SetQuantity(split_quantity_new, false, true);
8432 }
8433 }
8434 }
8435 }
8436
8438 {
8440 float split_quantity_new = Math.Floor(quantity * 0.5);
8441
8443 return;
8444
8446
8447 if (new_item)
8448 {
8449 if (new_item.GetQuantityMax() < split_quantity_new)
8450 {
8451 split_quantity_new = new_item.GetQuantityMax();
8452 }
8453
8454 new_item.SetResultOfSplit(true);
8455 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8456
8458 {
8461 }
8462 else
8463 {
8465 new_item.
SetQuantity(split_quantity_new,
false,
true);
8466 }
8467 }
8468 }
8469
8471 {
8473 float split_quantity_new = Math.Floor(quantity / 2);
8474
8476 return;
8477
8478 InventoryLocation invloc = new InventoryLocation;
8480
8482 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8483
8484 if (new_item)
8485 {
8486 if (new_item.GetQuantityMax() < split_quantity_new)
8487 {
8488 split_quantity_new = new_item.GetQuantityMax();
8489 }
8491 {
8494 }
8495 else if (split_quantity_new > 1)
8496 {
8498 new_item.
SetQuantity(split_quantity_new,
false,
true);
8499 }
8500 }
8501 }
8502
8505 {
8506 SetWeightDirty();
8508
8509 if (parent)
8510 parent.OnAttachmentQuantityChangedEx(this, delta);
8511
8513 {
8515 {
8517 }
8519 {
8520 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8522 }
8523 }
8524 }
8525
8528 {
8529
8530 }
8531
8534 {
8536 }
8537
8539 {
8540 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8541
8543 {
8544 if (newLevel == GameConstants.STATE_RUINED)
8545 {
8547 EntityAI parent = GetHierarchyParent();
8548 if (parent && parent.IsFireplace())
8549 {
8550 CargoBase cargo = GetInventory().GetCargo();
8551 if (cargo)
8552 {
8554 {
8556 }
8557 }
8558 }
8559 }
8560
8562 {
8563
8565 return;
8566 }
8567
8568 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8569 {
8571 }
8572 }
8573 }
8574
8575
8577 {
8578 super.OnRightClick();
8579
8581 {
8583 {
8584 if (ScriptInputUserData.CanStoreInputUserData())
8585 {
8586 EntityAI root = GetHierarchyRoot();
8587 Man playerOwner = GetHierarchyRootPlayer();
8588 InventoryLocation dst = new InventoryLocation;
8589
8590
8591 if (!playerOwner && root && root == this)
8592 {
8594 }
8595 else
8596 {
8597
8598 GetInventory().GetCurrentInventoryLocation(dst);
8600 {
8601 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8603 {
8605 }
8606 else
8607 {
8609
8610
8611 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8612 {
8614 }
8615 else
8616 {
8617 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8618 }
8619 }
8620 }
8621 }
8622
8623 ScriptInputUserData ctx = new ScriptInputUserData;
8631 }
8632 }
8633 else if (!
g_Game.IsMultiplayer())
8634 {
8636 }
8637 }
8638 }
8639
8641 {
8642 if (root)
8643 {
8644 vector m4[4];
8645 root.GetTransform(m4);
8646 dst.SetGround(this, m4);
8647 }
8648 else
8649 {
8650 GetInventory().GetCurrentInventoryLocation(dst);
8651 }
8652 }
8653
8654 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8655 {
8656
8657 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8658 return false;
8659
8660 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8661 return false;
8662
8663
8665 return false;
8666
8667
8668 Magazine mag = Magazine.Cast(this);
8669 if (mag)
8670 {
8671 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8672 return false;
8673
8674 if (stack_max_limit)
8675 {
8676 Magazine other_mag = Magazine.Cast(other_item);
8677 if (other_item)
8678 {
8679 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8680 return false;
8681 }
8682
8683 }
8684 }
8685 else
8686 {
8687
8689 return false;
8690
8692 return false;
8693 }
8694
8695 PlayerBase player = null;
8696 if (CastTo(player, GetHierarchyRootPlayer()))
8697 {
8698 if (player.GetInventory().HasAttachment(this))
8699 return false;
8700
8701 if (player.IsItemsToDelete())
8702 return false;
8703 }
8704
8705 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8706 return false;
8707
8708 int slotID;
8710 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8711 return false;
8712
8713 return true;
8714 }
8715
8717 {
8719 }
8720
8722 {
8723 return m_IsResultOfSplit;
8724 }
8725
8727 {
8728 m_IsResultOfSplit = value;
8729 }
8730
8732 {
8734 }
8735
8737 {
8738 float other_item_quantity = other_item.GetQuantity();
8739 float this_free_space;
8740
8742
8744
8745 if (other_item_quantity > this_free_space)
8746 {
8747 return this_free_space;
8748 }
8749 else
8750 {
8751 return other_item_quantity;
8752 }
8753 }
8754
8756 {
8758 }
8759
8761 {
8763 return;
8764
8765 if (!IsMagazine() && other_item)
8766 {
8768 if (quantity_used != 0)
8769 {
8770 float hp1 = GetHealth01("","");
8771 float hp2 = other_item.GetHealth01("","");
8772 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8773 hpResult = hpResult / (
GetQuantity() + quantity_used);
8774
8775 hpResult *= GetMaxHealth();
8776 Math.Round(hpResult);
8777 SetHealth("", "Health", hpResult);
8778
8780 other_item.AddQuantity(-quantity_used);
8781 }
8782 }
8784 }
8785
8787 {
8788 #ifdef SERVER
8789 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8790 GetHierarchyParent().IncreaseLifetimeUp();
8791 #endif
8792 };
8793
8795 {
8796 PlayerBase p = PlayerBase.Cast(player);
8797
8798 array<int> recipesIds = p.m_Recipes;
8799 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8800 if (moduleRecipesManager)
8801 {
8802 EntityAI itemInHands = player.GetEntityInHands();
8803 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8804 }
8805
8806 for (int i = 0;i < recipesIds.Count(); i++)
8807 {
8808 int key = recipesIds.Get(i);
8809 string recipeName = moduleRecipesManager.GetRecipeName(key);
8811 }
8812 }
8813
8814
8815 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8816 {
8817 super.GetDebugActions(outputList);
8818
8819
8825
8826
8831
8836
8837
8841
8842
8844 {
8848 }
8849
8852
8853
8857
8859
8860 InventoryLocation loc = new InventoryLocation();
8861 GetInventory().GetCurrentInventoryLocation(loc);
8863 {
8864 if (Gizmo_IsSupported())
8867 }
8868
8870 }
8871
8872
8873
8874
8876 {
8877 super.OnAction(action_id, player, ctx);
8878
8880 {
8881 switch (action_id)
8882 {
8886 return true;
8890 return true;
8891 }
8892 }
8893
8895 {
8896 switch (action_id)
8897 {
8899 Delete();
8900 return true;
8901 }
8902 }
8903
8904 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8905 {
8906 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8907 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8908 PlayerBase p = PlayerBase.Cast(player);
8909 if (
EActions.RECIPES_RANGE_START < 1000)
8910 {
8911 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8912 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8913 }
8914 }
8915 #ifndef SERVER
8916 else if (action_id ==
EActions.WATCH_PLAYER)
8917 {
8918 PluginDeveloper.SetDeveloperItemClientEx(player);
8919 }
8920 #endif
8922 {
8923 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8924 {
8925 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8926 OnDebugButtonPressServer(id + 1);
8927 }
8928
8929 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8930 {
8931 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8933 }
8934
8935 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8936 {
8937 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8939 }
8940
8941 else if (action_id ==
EActions.ADD_QUANTITY)
8942 {
8943 if (IsMagazine())
8944 {
8945 Magazine mag = Magazine.Cast(this);
8946 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8947 }
8948 else
8949 {
8951 }
8952
8953 if (m_EM)
8954 {
8955 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8956 }
8957
8958 }
8959
8960 else if (action_id ==
EActions.REMOVE_QUANTITY)
8961 {
8962 if (IsMagazine())
8963 {
8964 Magazine mag2 = Magazine.Cast(this);
8965 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8966 }
8967 else
8968 {
8970 }
8971 if (m_EM)
8972 {
8973 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8974 }
8975
8976 }
8977
8978 else if (action_id ==
EActions.SET_QUANTITY_0)
8979 {
8981
8982 if (m_EM)
8983 {
8984 m_EM.SetEnergy(0);
8985 }
8986 }
8987
8988 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8989 {
8991
8992 if (m_EM)
8993 {
8994 m_EM.SetEnergy(m_EM.GetEnergyMax());
8995 }
8996 }
8997
8998 else if (action_id ==
EActions.ADD_HEALTH)
8999 {
9000 AddHealth("","",GetMaxHealth("","Health")/5);
9001 }
9002 else if (action_id ==
EActions.REMOVE_HEALTH)
9003 {
9004 AddHealth("","",-GetMaxHealth("","Health")/5);
9005 }
9006 else if (action_id ==
EActions.DESTROY_HEALTH)
9007 {
9008 SetHealth01("","",0);
9009 }
9010 else if (action_id ==
EActions.WATCH_ITEM)
9011 {
9013 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9014 #ifdef DEVELOPER
9015 SetDebugDeveloper_item(this);
9016 #endif
9017 }
9018
9019 else if (action_id ==
EActions.ADD_TEMPERATURE)
9020 {
9021 AddTemperature(20);
9022
9023 }
9024
9025 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9026 {
9027 AddTemperature(-20);
9028
9029 }
9030
9031 else if (action_id ==
EActions.FLIP_FROZEN)
9032 {
9033 SetFrozen(!GetIsFrozen());
9034
9035 }
9036
9037 else if (action_id ==
EActions.ADD_WETNESS)
9038 {
9040
9041 }
9042
9043 else if (action_id ==
EActions.REMOVE_WETNESS)
9044 {
9046
9047 }
9048
9049 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9050 {
9053
9054
9055 }
9056
9057 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9058 {
9061 }
9062
9063 else if (action_id ==
EActions.MAKE_SPECIAL)
9064 {
9065 auto debugParams = DebugSpawnParams.WithPlayer(player);
9066 OnDebugSpawnEx(debugParams);
9067 }
9068
9069 }
9070
9071
9072 return false;
9073 }
9074
9075
9076
9077
9081
9084
9085
9086
9088 {
9089 return false;
9090 }
9091
9092
9094 {
9095 return true;
9096 }
9097
9098
9100 {
9101 return true;
9102 }
9103
9104
9105
9107 {
9108 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9109 return g_Game.ConfigIsExisting(config_path);
9110 }
9111
9114 {
9115 return null;
9116 }
9117
9119 {
9120 return false;
9121 }
9122
9124 {
9125 return false;
9126 }
9127
9131
9132
9134 {
9135 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9136 return module_repairing.CanRepair(this, item_repair_kit);
9137 }
9138
9139
9140 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9141 {
9142 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9143 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9144 }
9145
9146
9148 {
9149
9150
9151
9152
9153
9154
9155
9156
9157 return 1;
9158 }
9159
9160
9161
9163 {
9165 }
9166
9167
9168
9170 {
9172 }
9173
9174
9183 {
9184 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9185
9186 if (player)
9187 {
9188 player.MessageStatus(text);
9189 }
9190 }
9191
9192
9201 {
9202 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9203
9204 if (player)
9205 {
9206 player.MessageAction(text);
9207 }
9208 }
9209
9210
9219 {
9220 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9221
9222 if (player)
9223 {
9224 player.MessageFriendly(text);
9225 }
9226 }
9227
9228
9237 {
9238 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9239
9240 if (player)
9241 {
9242 player.MessageImportant(text);
9243 }
9244 }
9245
9247 {
9248 return true;
9249 }
9250
9251
9252 override bool KindOf(
string tag)
9253 {
9254 bool found = false;
9255 string item_name = this.
GetType();
9257 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9258
9259 int array_size = item_tag_array.Count();
9260 for (int i = 0; i < array_size; i++)
9261 {
9262 if (item_tag_array.Get(i) == tag)
9263 {
9264 found = true;
9265 break;
9266 }
9267 }
9268 return found;
9269 }
9270
9271
9273 {
9274
9275 super.OnRPC(sender, rpc_type,ctx);
9276
9277
9278 switch (rpc_type)
9279 {
9280 #ifndef SERVER
9281 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9282 Param2<bool, string> p = new Param2<bool, string>(false, "");
9283
9285 return;
9286
9287 bool play = p.param1;
9288 string soundSet = p.param2;
9289
9290 if (play)
9291 {
9293 {
9295 {
9297 }
9298 }
9299 else
9300 {
9302 }
9303 }
9304 else
9305 {
9307 }
9308
9309 break;
9310 #endif
9311
9312 }
9313
9315 {
9317 }
9318 }
9319
9320
9321
9322
9324 {
9325 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9326 return plugin.GetID(
name);
9327 }
9328
9330 {
9331 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9332 return plugin.GetName(id);
9333 }
9334
9337 {
9338
9339
9340 int varFlags;
9341 if (!ctx.
Read(varFlags))
9342 return;
9343
9344 if (varFlags & ItemVariableFlags.FLOAT)
9345 {
9347 }
9348 }
9349
9351 {
9352
9353 super.SerializeNumericalVars(floats_out);
9354
9355
9356
9358 {
9360 }
9361
9363 {
9365 }
9366
9368 {
9370 }
9371
9373 {
9378 }
9379
9381 {
9383 }
9384 }
9385
9387 {
9388
9389 super.DeSerializeNumericalVars(floats);
9390
9391
9392 int index = 0;
9393 int mask = Math.Round(floats.Get(index));
9394
9395 index++;
9396
9398 {
9400 {
9402 }
9403 else
9404 {
9405 float quantity = floats.Get(index);
9407 }
9408 index++;
9409 }
9410
9412 {
9413 float wet = floats.Get(index);
9415 index++;
9416 }
9417
9419 {
9420 int liquidtype = Math.Round(floats.Get(index));
9422 index++;
9423 }
9424
9426 {
9428 index++;
9430 index++;
9432 index++;
9434 index++;
9435 }
9436
9438 {
9439 int cleanness = Math.Round(floats.Get(index));
9441 index++;
9442 }
9443 }
9444
9446 {
9447 super.WriteVarsToCTX(ctx);
9448
9449
9451 {
9453 }
9454
9456 {
9458 }
9459
9461 {
9463 }
9464
9466 {
9467 int r,g,b,a;
9473 }
9474
9476 {
9478 }
9479 }
9480
9482 {
9483 if (!super.ReadVarsFromCTX(ctx,version))
9484 return false;
9485
9486 int intValue;
9487 float value;
9488
9489 if (version < 140)
9490 {
9491 if (!ctx.
Read(intValue))
9492 return false;
9493
9494 m_VariablesMask = intValue;
9495 }
9496
9498 {
9499 if (!ctx.
Read(value))
9500 return false;
9501
9503 {
9505 }
9506 else
9507 {
9509 }
9510 }
9511
9512 if (version < 140)
9513 {
9515 {
9516 if (!ctx.
Read(value))
9517 return false;
9518 SetTemperatureDirect(value);
9519 }
9520 }
9521
9523 {
9524 if (!ctx.
Read(value))
9525 return false;
9527 }
9528
9530 {
9531 if (!ctx.
Read(intValue))
9532 return false;
9534 }
9535
9537 {
9538 int r,g,b,a;
9540 return false;
9542 return false;
9544 return false;
9546 return false;
9547
9549 }
9550
9552 {
9553 if (!ctx.
Read(intValue))
9554 return false;
9556 }
9557
9558 if (version >= 138 && version < 140)
9559 {
9561 {
9562 if (!ctx.
Read(intValue))
9563 return false;
9564 SetFrozen(intValue);
9565 }
9566 }
9567
9568 return true;
9569 }
9570
9571
9573 {
9576 {
9578 }
9579
9580 if (!super.OnStoreLoad(ctx, version))
9581 {
9583 return false;
9584 }
9585
9586 if (version >= 114)
9587 {
9588 bool hasQuickBarIndexSaved;
9589
9590 if (!ctx.
Read(hasQuickBarIndexSaved))
9591 {
9593 return false;
9594 }
9595
9596 if (hasQuickBarIndexSaved)
9597 {
9598 int itmQBIndex;
9599
9600
9601 if (!ctx.
Read(itmQBIndex))
9602 {
9604 return false;
9605 }
9606
9607 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9608 if (itmQBIndex != -1 && parentPlayer)
9609 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9610 }
9611 }
9612 else
9613 {
9614
9615 PlayerBase player;
9616 int itemQBIndex;
9617 if (version ==
int.
MAX)
9618 {
9619 if (!ctx.
Read(itemQBIndex))
9620 {
9622 return false;
9623 }
9624 }
9625 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9626 {
9627
9628 if (!ctx.
Read(itemQBIndex))
9629 {
9631 return false;
9632 }
9633 if (itemQBIndex != -1 && player)
9634 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9635 }
9636 }
9637
9638 if (version < 140)
9639 {
9640
9641 if (!LoadVariables(ctx, version))
9642 {
9644 return false;
9645 }
9646 }
9647
9648
9650 {
9652 return false;
9653 }
9654 if (version >= 132)
9655 {
9657 if (raib)
9658 {
9660 {
9662 return false;
9663 }
9664 }
9665 }
9666
9668 return true;
9669 }
9670
9671
9672
9674 {
9675 super.OnStoreSave(ctx);
9676
9677 PlayerBase player;
9678 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9679 {
9681
9682 int itemQBIndex = -1;
9683 itemQBIndex = player.FindQuickBarEntityIndex(this);
9684 ctx.
Write(itemQBIndex);
9685 }
9686 else
9687 {
9689 }
9690
9692
9694 if (raib)
9695 {
9697 }
9698 }
9699
9700
9702 {
9703 super.AfterStoreLoad();
9704
9706 {
9708 }
9709
9711 {
9714 }
9715 }
9716
9718 {
9719 super.EEOnAfterLoad();
9720
9722 {
9724 }
9725
9728 }
9729
9731 {
9732 return false;
9733 }
9734
9735
9736
9738 {
9740 {
9741 #ifdef PLATFORM_CONSOLE
9742
9744 {
9746 if (menu)
9747 {
9749 }
9750 }
9751 #endif
9752 }
9753
9755 {
9758 }
9759
9761 {
9762 SetWeightDirty();
9764 }
9766 {
9769 }
9770
9772 {
9775
9778 }
9780 {
9784 }
9785
9786 super.OnVariablesSynchronized();
9787 }
9788
9789
9790
9792 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9793 {
9794 if (!IsServerCheck(allow_client))
9795 return false;
9796
9798 return false;
9799
9802
9803 if (value <= (min + 0.001))
9804 value = min;
9805
9806 if (value == min)
9807 {
9808 if (destroy_config)
9809 {
9810 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9811 if (dstr)
9812 {
9814 this.Delete();
9815 return true;
9816 }
9817 }
9818 else if (destroy_forced)
9819 {
9821 this.Delete();
9822 return true;
9823 }
9824
9826 }
9827
9830
9832 {
9833 EntityAI parent = GetHierarchyRoot();
9834 InventoryLocation iLoc = new InventoryLocation();
9835 GetInventory().GetCurrentInventoryLocation(iLoc);
9837 {
9838 int iLocSlot = iLoc.
GetSlot();
9840 {
9842 }
9844 {
9846 }
9847 }
9848 }
9849
9851 {
9853
9854 if (delta)
9856 }
9857
9859
9860 return false;
9861 }
9862
9863
9865 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9866 {
9868 }
9869
9871 {
9874 }
9875
9877 {
9880 }
9881
9883 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9884 {
9885 float value_clamped = Math.Clamp(value, 0, 1);
9887 SetQuantity(result, destroy_config, destroy_forced);
9888 }
9889
9890
9893 {
9895 }
9896
9898 {
9900 }
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9912 {
9913 int slot = -1;
9914 GameInventory inventory = GetInventory();
9915 if (inventory)
9916 {
9917 InventoryLocation il = new InventoryLocation;
9920 }
9921
9923 }
9924
9926 {
9927 float quantity_max = 0;
9928
9930 {
9931 if (attSlotID != -1)
9932 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9933
9934 if (quantity_max <= 0)
9936 }
9937
9938 if (quantity_max <= 0)
9940
9941 return quantity_max;
9942 }
9943
9945 {
9947 }
9948
9950 {
9952 }
9953
9954
9956 {
9958 }
9959
9961 {
9963 }
9964
9966 {
9968 }
9969
9970
9972 {
9973
9974 float weightEx = GetWeightEx();
9975 float special = GetInventoryAndCargoWeight();
9976 return weightEx - special;
9977 }
9978
9979
9981 {
9983 }
9984
9986 {
9988 {
9989 #ifdef DEVELOPER
9990 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9991 {
9992 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9994 }
9995 #endif
9996
9998 }
9999 else if (HasEnergyManager())
10000 {
10001 #ifdef DEVELOPER
10002 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10003 {
10004 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10005 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10006 }
10007 #endif
10008 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10009 }
10010 else
10011 {
10012 #ifdef DEVELOPER
10013 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10014 {
10015 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10016 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10017 }
10018 #endif
10019 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10020 }
10021 }
10022
10025 {
10026 int item_count = 0;
10028
10029 GameInventory inventory = GetInventory();
10030 CargoBase cargo = inventory.
GetCargo();
10031 if (cargo != NULL)
10032 {
10034 }
10035
10037 for (int i = 0; i < nAttachments; ++i)
10038 {
10040 if (item)
10041 item_count += item.GetNumberOfItems();
10042 }
10043 return item_count;
10044 }
10045
10048 {
10049 float weight = 0;
10050 float wetness = 1;
10051 if (include_wetness)
10054 {
10055 weight = wetness * m_ConfigWeight;
10056 }
10058 {
10059 weight = 1;
10060 }
10061 return weight;
10062 }
10063
10064
10065
10067 {
10068 GameInventory inventory = GetInventory();
10069 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10070 {
10071 array<EntityAI> items = new array<EntityAI>;
10073 for (int i = 0; i < items.Count(); ++i)
10074 {
10076 if (item)
10077 {
10078 g_Game.ObjectDelete(item);
10079 }
10080 }
10081 }
10082 }
10083
10084
10085
10086
10088 {
10089 float energy = 0;
10090 if (HasEnergyManager())
10091 {
10092 energy = GetCompEM().GetEnergy();
10093 }
10094 return energy;
10095 }
10096
10097
10099 {
10100 super.OnEnergyConsumed();
10101
10103 }
10104
10106 {
10107 super.OnEnergyAdded();
10108
10110 }
10111
10112
10114 {
10115 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10116 {
10118 {
10119 float energy_0to1 = GetCompEM().GetEnergy0To1();
10121 }
10122 }
10123 }
10124
10125
10127 {
10128 return ConfigGetFloat("heatIsolation");
10129 }
10130
10132 {
10134 }
10135
10137 {
10138 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10139 if (
g_Game.ConfigIsExisting(paramPath))
10140 return g_Game.ConfigGetFloat(paramPath);
10141
10142 return 0.0;
10143 }
10144
10146 {
10147 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10148 if (
g_Game.ConfigIsExisting(paramPath))
10149 return g_Game.ConfigGetFloat(paramPath);
10150
10151 return 0.0;
10152 }
10153
10154 override void SetWet(
float value,
bool allow_client =
false)
10155 {
10156 if (!IsServerCheck(allow_client))
10157 return;
10158
10161
10163
10164 m_VarWet = Math.Clamp(value, min, max);
10165
10167 {
10170 }
10171 }
10172
10173 override void AddWet(
float value)
10174 {
10176 }
10177
10179 {
10181 }
10182
10184 {
10186 }
10187
10189 {
10191 }
10192
10194 {
10196 }
10197
10199 {
10201 }
10202
10203 override void OnWetChanged(
float newVal,
float oldVal)
10204 {
10207 if (newLevel != oldLevel)
10208 {
10210 }
10211 }
10212
10214 {
10215 SetWeightDirty();
10216 }
10217
10219 {
10220 return GetWetLevelInternal(
m_VarWet);
10221 }
10222
10223
10224
10226 {
10228 }
10229
10231 {
10233 }
10234
10236 {
10238 }
10239
10241 {
10243 }
10244
10245
10246
10248 {
10249 if (ConfigIsExisting("itemModelLength"))
10250 {
10251 return ConfigGetFloat("itemModelLength");
10252 }
10253 return 0;
10254 }
10255
10257 {
10258 if (ConfigIsExisting("itemAttachOffset"))
10259 {
10260 return ConfigGetFloat("itemAttachOffset");
10261 }
10262 return 0;
10263 }
10264
10265 override void SetCleanness(
int value,
bool allow_client =
false)
10266 {
10267 if (!IsServerCheck(allow_client))
10268 return;
10269
10271
10273
10276 }
10277
10279 {
10281 }
10282
10284 {
10285 return true;
10286 }
10287
10288
10289
10290
10292 {
10294 }
10295
10297 {
10299 }
10300
10301
10302
10303
10304 override void SetColor(
int r,
int g,
int b,
int a)
10305 {
10311 }
10313 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10314 {
10319 }
10320
10322 {
10324 }
10325
10328 {
10329 int r,g,b,a;
10331 r = r/255;
10332 g = g/255;
10333 b = b/255;
10334 a = a/255;
10335 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10336 }
10337
10338
10339
10340 override void SetLiquidType(
int value,
bool allow_client =
false)
10341 {
10342 if (!IsServerCheck(allow_client))
10343 return;
10344
10349 }
10350
10352 {
10353 return ConfigGetInt("varLiquidTypeInit");
10354 }
10355
10357 {
10359 }
10360
10362 {
10364 SetFrozen(false);
10365 }
10366
10369 {
10370 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10371 }
10372
10373
10376 {
10377 PlayerBase nplayer;
10378 if (PlayerBase.CastTo(nplayer, player))
10379 {
10381 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10382 }
10383 }
10384
10385
10388 {
10389 PlayerBase nplayer;
10390 if (PlayerBase.CastTo(nplayer,player))
10391 {
10392 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10393 }
10394
10395 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10396
10397 if (HasEnergyManager())
10398 {
10399 GetCompEM().UpdatePlugState();
10400 }
10401 }
10402
10403
10405 {
10406 super.OnPlacementStarted(player);
10407
10409 }
10410
10411 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10412 {
10414 {
10415 m_AdminLog.OnPlacementComplete(player,
this);
10416 }
10417
10418 super.OnPlacementComplete(player, position, orientation);
10419 }
10420
10421
10422
10423
10424
10426 {
10428 {
10429 return true;
10430 }
10431 else
10432 {
10433 return false;
10434 }
10435 }
10436
10437
10439 {
10441 {
10443 }
10444 }
10445
10446
10448 {
10450 }
10451
10453 {
10455 }
10456
10457 override void InsertAgent(
int agent,
float count = 1)
10458 {
10459 if (count < 1)
10460 return;
10461
10463 }
10464
10467 {
10469 }
10470
10471
10473 {
10475 }
10476
10477
10478
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10500
10501
10502
10503
10504
10505
10506
10507
10508
10509
10510
10511
10512
10513
10514
10515
10516
10517
10519 {
10521 return false;
10522 return true;
10523 }
10524
10526 {
10527
10529 }
10530
10531
10534 {
10535 super.CheckForRoofLimited(timeTresholdMS);
10536
10537 float time =
g_Game.GetTime();
10538 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10539 {
10540 m_PreviousRoofTestTime = time;
10541 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10542 }
10543 }
10544
10545
10547 {
10549 {
10550 return 0;
10551 }
10552
10553 if (GetInventory().GetAttachmentSlotsCount() != 0)
10554 {
10555 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10556 if (filter)
10557 return filter.GetProtectionLevel(type, false, system);
10558 else
10559 return 0;
10560 }
10561
10562 string subclassPath, entryName;
10563
10564 switch (type)
10565 {
10567 entryName = "biological";
10568 break;
10570 entryName = "chemical";
10571 break;
10572 default:
10573 entryName = "biological";
10574 break;
10575 }
10576
10577 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10578
10579 return g_Game.ConfigGetFloat(subclassPath + entryName);
10580 }
10581
10582
10583
10586 {
10587 if (!IsMagazine())
10589
10591 }
10592
10593
10594
10595
10596
10601 {
10602 return true;
10603 }
10604
10606 {
10608 }
10609
10610
10611
10612
10613
10615 {
10616 if (parent)
10617 {
10618 if (parent.IsInherited(DayZInfected))
10619 return true;
10620
10621 if (!parent.IsRuined())
10622 return true;
10623 }
10624
10625 return true;
10626 }
10627
10629 {
10630 if (!super.CanPutAsAttachment(parent))
10631 {
10632 return false;
10633 }
10634
10635 if (!IsRuined() && !parent.IsRuined())
10636 {
10637 return true;
10638 }
10639
10640 return false;
10641 }
10642
10644 {
10645
10646
10647
10648
10649 return super.CanReceiveItemIntoCargo(item);
10650 }
10651
10653 {
10654
10655
10656
10657
10658 GameInventory attachmentInv = attachment.GetInventory();
10660 {
10661 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10662 return false;
10663 }
10664
10665 InventoryLocation loc = new InventoryLocation();
10666 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10667 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10668 return false;
10669
10670 return super.CanReceiveAttachment(attachment, slotId);
10671 }
10672
10674 {
10675 if (!super.CanReleaseAttachment(attachment))
10676 return false;
10677
10678 return GetInventory().AreChildrenAccessible();
10679 }
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10700
10702 {
10703 int id = muzzle_owner.GetMuzzleID();
10704 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10705
10706 if (WPOF_array)
10707 {
10708 for (int i = 0; i < WPOF_array.Count(); i++)
10709 {
10710 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10711
10712 if (WPOF)
10713 {
10714 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10715 }
10716 }
10717 }
10718 }
10719
10720
10722 {
10723 int id = muzzle_owner.GetMuzzleID();
10725
10726 if (WPOBE_array)
10727 {
10728 for (int i = 0; i < WPOBE_array.Count(); i++)
10729 {
10730 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10731
10732 if (WPOBE)
10733 {
10734 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10735 }
10736 }
10737 }
10738 }
10739
10740
10742 {
10743 int id = muzzle_owner.GetMuzzleID();
10744 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10745
10746 if (WPOOH_array)
10747 {
10748 for (int i = 0; i < WPOOH_array.Count(); i++)
10749 {
10750 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10751
10752 if (WPOOH)
10753 {
10754 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10755 }
10756 }
10757 }
10758 }
10759
10760
10762 {
10763 int id = muzzle_owner.GetMuzzleID();
10764 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10765
10766 if (WPOOH_array)
10767 {
10768 for (int i = 0; i < WPOOH_array.Count(); i++)
10769 {
10770 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10771
10772 if (WPOOH)
10773 {
10774 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10775 }
10776 }
10777 }
10778 }
10779
10780
10782 {
10783 int id = muzzle_owner.GetMuzzleID();
10784 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10785
10786 if (WPOOH_array)
10787 {
10788 for (int i = 0; i < WPOOH_array.Count(); i++)
10789 {
10790 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10791
10792 if (WPOOH)
10793 {
10794 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10795 }
10796 }
10797 }
10798 }
10799
10800
10801
10803 {
10805 {
10806 return true;
10807 }
10808
10809 return false;
10810 }
10811
10813 {
10815 {
10816 return true;
10817 }
10818
10819 return false;
10820 }
10821
10823 {
10825 {
10826 return true;
10827 }
10828
10829 return false;
10830 }
10831
10833 {
10834 return false;
10835 }
10836
10839 {
10840 return UATimeSpent.DEFAULT_DEPLOY;
10841 }
10842
10843
10844
10845
10847 {
10849 SetSynchDirty();
10850 }
10851
10853 {
10855 }
10856
10857
10859 {
10860 return false;
10861 }
10862
10865 {
10866 string att_type = "None";
10867
10868 if (ConfigIsExisting("soundAttType"))
10869 {
10870 att_type = ConfigGetString("soundAttType");
10871 }
10872
10874 }
10875
10877 {
10879 }
10880
10881
10882
10883
10884
10890
10892 {
10895
10897 }
10898
10899
10901 {
10903 return;
10904
10906
10909
10912
10913 SoundParameters params = new SoundParameters();
10917 }
10918
10919
10921 {
10923 {
10926
10927 SetSynchDirty();
10928
10931 }
10932 }
10933
10935 {
10937 }
10938
10939
10941 {
10943 return;
10944
10946 SetSynchDirty();
10947
10950 }
10951
10953 {
10956 }
10957
10959 {
10961 }
10962
10963 void OnApply(PlayerBase player);
10964
10966 {
10967 return 1.0;
10968 };
10969
10971 {
10973 }
10974
10976 {
10978 }
10979
10981
10983 {
10984 SetDynamicPhysicsLifeTime(0.01);
10986 }
10987
10989 {
10990 array<string> zone_names = new array<string>;
10991 GetDamageZones(zone_names);
10992 for (int i = 0; i < zone_names.Count(); i++)
10993 {
10994 SetHealthMax(zone_names.Get(i),"Health");
10995 }
10996 SetHealthMax("","Health");
10997 }
10998
11001 {
11002 float global_health = GetHealth01("","Health");
11003 array<string> zones = new array<string>;
11004 GetDamageZones(zones);
11005
11006 for (int i = 0; i < zones.Count(); i++)
11007 {
11008 SetHealth01(zones.Get(i),"Health",global_health);
11009 }
11010 }
11011
11014 {
11015 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11016 }
11017
11019 {
11020 if (!hasRootAsPlayer)
11021 {
11022 if (refParentIB)
11023 {
11024
11025 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11026 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11027
11028 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11029 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11030
11033 }
11034 else
11035 {
11036
11039 }
11040 }
11041 }
11042
11044 {
11046 {
11047 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11048 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11049 {
11050 float heatPermCoef = 1.0;
11052 while (ent)
11053 {
11054 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11055 ent = ent.GetHierarchyParent();
11056 }
11057
11058 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11059 }
11060 }
11061 }
11062
11064 {
11065
11066 EntityAI parent = GetHierarchyParent();
11067 if (!parent)
11068 {
11069 hasParent = false;
11070 hasRootAsPlayer = false;
11071 }
11072 else
11073 {
11074 hasParent = true;
11075 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11076 refParentIB =
ItemBase.Cast(parent);
11077 }
11078 }
11079
11080 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11081 {
11082
11083 }
11084
11086 {
11087
11088 return false;
11089 }
11090
11092 {
11093
11094
11095 return false;
11096 }
11097
11099 {
11100
11101 return false;
11102 }
11103
11106 {
11107 return !GetIsFrozen() &&
IsOpen();
11108 }
11109
11111 {
11112 bool hasParent = false, hasRootAsPlayer = false;
11114
11115 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11116 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11117
11118 if (wwtu || foodDecay)
11119 {
11123
11124 if (processWetness || processTemperature || processDecay)
11125 {
11127
11128 if (processWetness)
11129 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11130
11131 if (processTemperature)
11133
11134 if (processDecay)
11135 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11136 }
11137 }
11138 }
11139
11142 {
11144 }
11145
11147 {
11150
11151 return super.GetTemperatureFreezeThreshold();
11152 }
11153
11155 {
11158
11159 return super.GetTemperatureThawThreshold();
11160 }
11161
11163 {
11166
11167 return super.GetItemOverheatThreshold();
11168 }
11169
11171 {
11173 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11174
11175 return super.GetTemperatureFreezeTime();
11176 }
11177
11179 {
11181 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11182
11183 return super.GetTemperatureThawTime();
11184 }
11185
11190
11192 {
11193 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11194 }
11195
11197 {
11198 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11199 }
11200
11203 {
11205 }
11206
11208 {
11210 }
11211
11213 {
11215 }
11216
11219 {
11220 return null;
11221 }
11222
11225 {
11226 return false;
11227 }
11228
11230 {
11232 {
11235 if (!trg)
11236 {
11238 explosive = this;
11239 }
11240
11241 explosive.PairRemote(trg);
11243
11244 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11245 trg.SetPersistentPairID(persistentID);
11246 explosive.SetPersistentPairID(persistentID);
11247
11248 return true;
11249 }
11250 return false;
11251 }
11252
11255 {
11256 float ret = 1.0;
11259 ret *= GetHealth01();
11260
11261 return ret;
11262 }
11263
11264 #ifdef DEVELOPER
11265 override void SetDebugItem()
11266 {
11267 super.SetDebugItem();
11268 _itemBase = this;
11269 }
11270
11272 {
11273 string text = super.GetDebugText();
11274
11276 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11277
11278 return text;
11279 }
11280 #endif
11281
11283 {
11284 return true;
11285 }
11286
11288
11290
11292 {
11295 }
11296
11297
11305
11321
11322 [
Obsolete(
"Use ItemSoundHandler instead")]
11325 {
11326 if (!
g_Game.IsDedicatedServer())
11327 {
11328 if (ConfigIsExisting("attachSoundSet"))
11329 {
11330 string cfg_path = "";
11331 string soundset = "";
11332 string type_name =
GetType();
11333
11336 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11337 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11338
11339 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11340 {
11341 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11342 {
11343 if (cfg_slot_array[i] == slot_type)
11344 {
11345 soundset = cfg_soundset_array[i];
11346 break;
11347 }
11348 }
11349 }
11350
11351 if (soundset != "")
11352 {
11353 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11355 }
11356 }
11357 }
11358 }
11359
11361}
11362
11364{
11366 if (entity)
11367 {
11368 bool is_item = entity.IsInherited(
ItemBase);
11369 if (is_item && full_quantity)
11370 {
11373 }
11374 }
11375 else
11376 {
11378 return NULL;
11379 }
11380 return entity;
11381}
11382
11384{
11385 if (item)
11386 {
11387 if (health > 0)
11388 item.SetHealth("", "", health);
11389
11390 if (item.CanHaveTemperature())
11391 {
11393 if (item.CanFreeze())
11394 item.SetFrozen(false);
11395 }
11396
11397 if (item.HasEnergyManager())
11398 {
11399 if (quantity >= 0)
11400 {
11401 item.GetCompEM().SetEnergy0To1(quantity);
11402 }
11403 else
11404 {
11406 }
11407 }
11408 else if (item.IsMagazine())
11409 {
11410 Magazine mag = Magazine.Cast(item);
11411 if (quantity >= 0)
11412 {
11413 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11414 }
11415 else
11416 {
11418 }
11419
11420 }
11421 else
11422 {
11423 if (quantity >= 0)
11424 {
11425 item.SetQuantityNormalized(quantity, false);
11426 }
11427 else
11428 {
11430 }
11431
11432 }
11433 }
11434}
11435
11436#ifdef DEVELOPER
11438#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.