6384{
6386 {
6387 return true;
6388 }
6389};
6390
6391
6392
6394{
6398
6400
6403
6404
6405
6406
6407
6416
6422
6427
6432
6453 protected bool m_IsResultOfSplit
6454
6456
6461
6462
6463
6465
6469
6470
6471
6473
6476
6477
6478
6484
6485
6493
6496
6497
6499
6500
6502
6503
6508
6509
6514
6515
6517
6518
6520 {
6525
6526 if (!
GetGame().IsDedicatedServer())
6527 {
6529 {
6531
6533 {
6535 }
6536 }
6537
6540 }
6541
6542 m_OldLocation = null;
6543
6545 {
6547 }
6548
6549 if (ConfigIsExisting("headSelectionsToHide"))
6550 {
6553 }
6554
6556 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6557 {
6559 }
6560
6562
6563 m_IsResultOfSplit = false;
6564
6566 }
6567
6569 {
6570 super.InitItemVariables();
6571
6577 m_Count = ConfigGetInt(
"count");
6578
6581
6586
6589
6594
6606
6610
6611
6614 if (ConfigIsExisting("canBeSplit"))
6615 {
6618 }
6619
6621 if (ConfigIsExisting("itemBehaviour"))
6623
6624
6627 RegisterNetSyncVariableInt("m_VarLiquidType");
6628 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6629
6630 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6631 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6632 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6633
6634 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6635 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6636 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6637 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6638
6639 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6640 RegisterNetSyncVariableBool("m_IsTakeable");
6641 RegisterNetSyncVariableBool("m_IsHologram");
6642
6645 {
6648 }
6649
6651
6653 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6655
6656 }
6657
6659 {
6661 }
6662
6664 {
6667 {
6672 }
6673 }
6674
6675 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6676 {
6678 {
6681 }
6682
6684 }
6685
6687 {
6693 }
6694
6696
6698 {
6700
6701 if (!action)
6702 {
6703 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6704 return;
6705 }
6706
6708 if (!ai)
6709 {
6711 return;
6712 }
6713
6715 if (!action_array)
6716 {
6717 action_array = new array<ActionBase_Basic>;
6719 }
6720 if (LogManager.IsActionLogEnable())
6721 {
6722 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6723 }
6724
6725 if (action_array.Find(action) != -1)
6726 {
6727 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6728 }
6729 else
6730 {
6731 action_array.Insert(action);
6732 }
6733 }
6734
6736 {
6738 ActionBase action = player.GetActionManager().GetAction(actionName);
6741
6742 if (action_array)
6743 {
6744 action_array.RemoveItem(action);
6745 }
6746 }
6747
6748
6749
6751 {
6752 ActionOverrideData overrideData = new ActionOverrideData();
6756
6758 if (!actionMap)
6759 {
6762 }
6763
6764 actionMap.Insert(this.
Type(), overrideData);
6765
6766 }
6767
6769
6771
6772
6774 {
6777
6780
6781 string config_to_search = "CfgVehicles";
6782 string muzzle_owner_config;
6783
6785 {
6786 if (IsInherited(Weapon))
6787 config_to_search = "CfgWeapons";
6788
6789 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6790
6791 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6792
6794
6795 if (config_OnFire_subclass_count > 0)
6796 {
6797 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6798
6799 for (int i = 0; i < config_OnFire_subclass_count; i++)
6800 {
6801 string particle_class = "";
6803 string config_OnFire_entry = config_OnFire_class + particle_class;
6804 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6805 WPOF_array.Insert(WPOF);
6806 }
6807
6808
6810 }
6811 }
6812
6814 {
6815 config_to_search = "CfgWeapons";
6816 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6817
6818 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6819
6821
6822 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6823 {
6824 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6825
6826 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6827 {
6828 string particle_class2 = "";
6830 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6831 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6832 WPOBE_array.Insert(WPOBE);
6833 }
6834
6835
6837 }
6838 }
6839 }
6840
6841
6843 {
6846
6848 {
6849 string config_to_search = "CfgVehicles";
6850
6851 if (IsInherited(Weapon))
6852 config_to_search = "CfgWeapons";
6853
6854 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6855 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6856
6857 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6858 {
6859
6861
6863 {
6865 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6867 return;
6868 }
6869
6872
6873
6874
6876 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6877
6878 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6879 {
6880 string particle_class = "";
6882 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6884
6885 if (entry_type == CT_CLASS)
6886 {
6887 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6888 WPOOH_array.Insert(WPOF);
6889 }
6890 }
6891
6892
6894 }
6895 }
6896 }
6897
6899 {
6901 }
6902
6904 {
6906 {
6908
6911
6914
6915 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6916 }
6917 }
6918
6920 {
6922 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6923
6925 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6926
6928 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6929
6931 {
6933 }
6934 }
6935
6937 {
6939 }
6940
6942 {
6945 else
6947
6949 {
6952 }
6953 else
6954 {
6957
6960 }
6961
6963 }
6964
6966 {
6968 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6969 }
6970
6972 {
6974 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6976 }
6977
6979 {
6981 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6982 }
6983
6985 {
6988
6989 OverheatingParticle OP = new OverheatingParticle();
6994
6996 }
6997
6999 {
7002
7003 return -1;
7004 }
7005
7007 {
7009 {
7012
7013 for (int i = count; i > 0; --i)
7014 {
7015 int id = i - 1;
7018
7021
7022 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7023 {
7024 if (p)
7025 {
7028 }
7029 }
7030 }
7031 }
7032 }
7033
7035 {
7037 {
7039 {
7040 int id = i - 1;
7042
7043 if (OP)
7044 {
7046
7047 if (p)
7048 {
7050 }
7051
7052 delete OP;
7053 }
7054 }
7055
7058 }
7059 }
7060
7063 {
7064 return 0.0;
7065 }
7066
7067
7069 {
7070 return 250;
7071 }
7072
7074 {
7075 return 0;
7076 }
7077
7080 {
7082 return true;
7083
7084 return false;
7085 }
7086
7089 {
7092
7094 {
7096 }
7097 else
7098 {
7099
7101 }
7102
7104 }
7105
7112 {
7113 return -1;
7114 }
7115
7116
7117
7118
7120 {
7122 {
7124 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7125
7126 if (r_index >= 0)
7127 {
7128 InventoryLocation r_il = new InventoryLocation;
7129 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7130
7131 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7134 {
7135 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7136 }
7138 {
7139 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7140 }
7141
7142 }
7143
7144 player.GetHumanInventory().ClearUserReservedLocation(this);
7145 }
7146
7149 }
7150
7151
7152
7153
7155 {
7156 return ItemBase.m_DebugActionsMask;
7157 }
7158
7160 {
7161 return ItemBase.m_DebugActionsMask & mask;
7162 }
7163
7165 {
7166 ItemBase.m_DebugActionsMask = mask;
7167 }
7168
7170 {
7171 ItemBase.m_DebugActionsMask |= mask;
7172 }
7173
7175 {
7176 ItemBase.m_DebugActionsMask &= ~mask;
7177 }
7178
7180 {
7182 {
7184 }
7185 else
7186 {
7188 }
7189 }
7190
7191
7193 {
7194 if (GetEconomyProfile())
7195 {
7196 float q_max = GetEconomyProfile().GetQuantityMax();
7197 if (q_max > 0)
7198 {
7199 float q_min = GetEconomyProfile().GetQuantityMin();
7200 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7201
7203 {
7204 ComponentEnergyManager comp = GetCompEM();
7206 {
7208 }
7209 }
7211 {
7213
7214 }
7215
7216 }
7217 }
7218 }
7219
7222 {
7223 EntityAI parent = GetHierarchyParent();
7224
7225 if (parent)
7226 {
7227 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7228 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7229 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7230 }
7231 }
7232
7235 {
7236 EntityAI parent = GetHierarchyParent();
7237
7238 if (parent)
7239 {
7240 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7241 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7242 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7243 }
7244 }
7245
7247 {
7248
7249
7250
7251
7253
7255 {
7256 if (ScriptInputUserData.CanStoreInputUserData())
7257 {
7258 ScriptInputUserData ctx = new ScriptInputUserData;
7264 ctx.
Write(use_stack_max);
7267
7269 {
7270 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7271 }
7272 }
7273 }
7274 else if (!
GetGame().IsMultiplayer())
7275 {
7277 }
7278 }
7279
7281 {
7283 }
7284
7286 {
7288 }
7289
7291 {
7293 }
7294
7296 {
7297
7298 return false;
7299 }
7300
7302 {
7303 return false;
7304 }
7305
7309 {
7310 return false;
7311 }
7312
7314 {
7315 return "";
7316 }
7317
7319
7321 {
7322 return false;
7323 }
7324
7326 {
7327 return true;
7328 }
7329
7330
7331
7333 {
7334 return true;
7335 }
7336
7338 {
7339 return true;
7340 }
7341
7343 {
7344 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7346 }
7347
7349 {
7351 }
7352
7354 {
7356 if (!is_being_placed)
7358 SetSynchDirty();
7359 }
7360
7361
7363
7365 {
7367 }
7368
7370 {
7372 }
7373
7375 {
7376 return 1;
7377 }
7378
7380 {
7381 return false;
7382 }
7383
7385 {
7387 SetSynchDirty();
7388 }
7389
7390
7391
7392
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
7425 {
7426 super.OnMovedInsideCargo(container);
7427
7428 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7429 }
7430
7431 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7432 {
7433 super.EEItemLocationChanged(oldLoc,newLoc);
7434
7435 PlayerBase new_player = null;
7436 PlayerBase old_player = null;
7437
7438 if (newLoc.GetParent())
7439 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7440
7441 if (oldLoc.GetParent())
7442 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7443
7445 {
7446 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
7447
7448 if (r_index >= 0)
7449 {
7450 InventoryLocation r_il = new InventoryLocation;
7451 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7452
7453 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7456 {
7457 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7458 }
7460 {
7461 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7462 }
7463
7464 }
7465 }
7466
7468 {
7469 if (new_player)
7470 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
7471
7472 if (new_player == old_player)
7473 {
7474
7475 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7476 {
7478 {
7479 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7480 {
7481 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7482 }
7483 }
7484 else
7485 {
7486 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7487 }
7488 }
7489
7490 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7491 {
7492 int type = oldLoc.GetType();
7494 {
7495 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7496 }
7498 {
7499 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7500 }
7501 }
7502 if (!m_OldLocation)
7503 {
7504 m_OldLocation = new InventoryLocation;
7505 }
7506 m_OldLocation.Copy(oldLoc);
7507 }
7508 else
7509 {
7510 if (m_OldLocation)
7511 {
7512 m_OldLocation.Reset();
7513 }
7514 }
7515
7517 }
7518 else
7519 {
7520 if (new_player)
7521 {
7522 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7523 if (res_index >= 0)
7524 {
7525 InventoryLocation il = new InventoryLocation;
7526 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
7528 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
7531 {
7532 il.
GetParent().GetOnReleaseLock().Invoke(it);
7533 }
7535 {
7537 }
7538
7539 }
7540 }
7542 {
7543
7545 }
7546
7547 if (m_OldLocation)
7548 {
7549 m_OldLocation.Reset();
7550 }
7551 }
7552 }
7553
7554 override void EOnContact(IEntity other, Contact extra)
7555 {
7557 {
7558 int liquidType = -1;
7560 if (impactSpeed > 0.0)
7561 {
7563 #ifndef SERVER
7565 #else
7567 SetSynchDirty();
7568 #endif
7570 }
7571 }
7572
7573 #ifdef SERVER
7574 if (GetCompEM() && GetCompEM().IsPlugged())
7575 {
7576 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7577 GetCompEM().UnplugThis();
7578 }
7579 #endif
7580 }
7581
7583
7585 {
7587 }
7588
7590 {
7591
7592 }
7593
7595 {
7596 super.OnItemLocationChanged(old_owner, new_owner);
7597
7598 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7599 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7600
7601 if (!relatedPlayer && playerNew)
7602 relatedPlayer = playerNew;
7603
7604 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7605 {
7607 if (actionMgr)
7608 {
7609 ActionBase currentAction = actionMgr.GetRunningAction();
7610 if (currentAction)
7612 }
7613 }
7614
7615 Man ownerPlayerOld = null;
7616 Man ownerPlayerNew = null;
7617
7618 if (old_owner)
7619 {
7620 if (old_owner.
IsMan())
7621 {
7622 ownerPlayerOld = Man.Cast(old_owner);
7623 }
7624 else
7625 {
7626 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7627 }
7628 }
7629 else
7630 {
7632 {
7634
7635 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7636 {
7637 GetCompEM().UnplugThis();
7638 }
7639 }
7640 }
7641
7642 if (new_owner)
7643 {
7644 if (new_owner.
IsMan())
7645 {
7646 ownerPlayerNew = Man.Cast(new_owner);
7647 }
7648 else
7649 {
7650 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7651 }
7652 }
7653
7654 if (ownerPlayerOld != ownerPlayerNew)
7655 {
7656 if (ownerPlayerOld)
7657 {
7658 array<EntityAI> subItemsExit = new array<EntityAI>;
7660 for (int i = 0; i < subItemsExit.Count(); i++)
7661 {
7664 }
7665 }
7666
7667 if (ownerPlayerNew)
7668 {
7669 array<EntityAI> subItemsEnter = new array<EntityAI>;
7671 for (int j = 0; j < subItemsEnter.Count(); j++)
7672 {
7675 }
7676 }
7677 }
7678 else if (ownerPlayerNew != null)
7679 {
7680 PlayerBase nplayer;
7681 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7682 {
7683 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7685 for (int k = 0; k < subItemsUpdate.Count(); k++)
7686 {
7688 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7689 }
7690 }
7691 }
7692
7693 if (old_owner)
7694 old_owner.OnChildItemRemoved(this);
7695 if (new_owner)
7696 new_owner.OnChildItemReceived(this);
7697 }
7698
7699
7701 {
7702 super.EEDelete(parent);
7703 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7704 if (player)
7705 {
7707
7708 if (player.IsAlive())
7709 {
7710 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7711 if (r_index >= 0)
7712 {
7713 InventoryLocation r_il = new InventoryLocation;
7714 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7715
7716 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7719 {
7720 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7721 }
7723 {
7724 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7725 }
7726
7727 }
7728
7729 player.RemoveQuickBarEntityShortcut(this);
7730 }
7731 }
7732 }
7733
7735 {
7736 super.EEKilled(killer);
7737
7740 {
7741 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7742 {
7743 if (IsMagazine())
7744 {
7745 if (Magazine.Cast(this).GetAmmoCount() > 0)
7746 {
7748 }
7749 }
7750 else
7751 {
7753 }
7754 }
7755 }
7756 }
7757
7759 {
7760 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7761
7762 super.OnWasAttached(parent, slot_id);
7763
7766
7768 }
7769
7771 {
7772 super.OnWasDetached(parent, slot_id);
7773
7776 }
7777
7779 {
7780 int idx;
7783
7784 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7785 if (inventory_slots.Count() < 1)
7786 {
7787 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7788 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7789 }
7790 else
7791 {
7792 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7793 }
7794
7795 idx = inventory_slots.Find(slot);
7796 if (idx < 0)
7797 return "";
7798
7799 return attach_types.Get(idx);
7800 }
7801
7803 {
7804 int idx = -1;
7805 string slot;
7806
7809
7810 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7811 if (inventory_slots.Count() < 1)
7812 {
7813 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7814 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7815 }
7816 else
7817 {
7818 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7819 if (detach_types.Count() < 1)
7820 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7821 }
7822
7823 for (int i = 0; i < inventory_slots.Count(); i++)
7824 {
7825 slot = inventory_slots.Get(i);
7826 }
7827
7828 if (slot != "")
7829 {
7830 if (detach_types.Count() == 1)
7831 idx = 0;
7832 else
7833 idx = inventory_slots.Find(slot);
7834 }
7835 if (idx < 0)
7836 return "";
7837
7838 return detach_types.Get(idx);
7839 }
7840
7842 {
7843
7845
7846
7847 float min_time = 1;
7848 float max_time = 3;
7849 float delay = Math.RandomFloat(min_time, max_time);
7850
7851 explode_timer.Run(delay, this, "DoAmmoExplosion");
7852 }
7853
7855 {
7856 Magazine magazine = Magazine.Cast(this);
7857 int pop_sounds_count = 6;
7858 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7859
7860
7861 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7862 string sound_name = pop_sounds[ sound_idx ];
7864
7865
7866 magazine.ServerAddAmmoCount(-1);
7867
7868
7869 float min_temp_to_explode = 100;
7870
7871 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7872 {
7874 }
7875 }
7876
7877
7878 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7879 {
7880 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7881
7882 const int CHANCE_DAMAGE_CARGO = 4;
7883 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7884 const int CHANCE_DAMAGE_NOTHING = 2;
7885
7887 {
7888 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7889 int chances;
7890 int rnd;
7891
7892 if (GetInventory().GetCargo())
7893 {
7894 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7895 rnd = Math.RandomInt(0,chances);
7896
7897 if (rnd < CHANCE_DAMAGE_CARGO)
7898 {
7900 }
7901 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7902 {
7904 }
7905 }
7906 else
7907 {
7908 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7909 rnd = Math.RandomInt(0,chances);
7910
7911 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7912 {
7914 }
7915 }
7916 }
7917 }
7918
7920 {
7921 if (GetInventory().GetCargo())
7922 {
7923 int item_count = GetInventory().GetCargo().GetItemCount();
7924 if (item_count > 0)
7925 {
7926 int random_pick = Math.RandomInt(0, item_count);
7928 if (!item.IsExplosive())
7929 {
7930 item.AddHealth("","",damage);
7931 return true;
7932 }
7933 }
7934 }
7935 return false;
7936 }
7937
7939 {
7940 int attachment_count = GetInventory().AttachmentCount();
7941 if (attachment_count > 0)
7942 {
7943 int random_pick = Math.RandomInt(0, attachment_count);
7944 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7945 if (!attachment.IsExplosive())
7946 {
7947 attachment.AddHealth("","",damage);
7948 return true;
7949 }
7950 }
7951 return false;
7952 }
7953
7955 {
7957 }
7958
7960 {
7962 return GetInventory().CanRemoveEntity();
7963
7964 return false;
7965 }
7966
7968 {
7969
7971 return false;
7972
7973
7975 return false;
7976
7977
7978
7980 if (delta == 0)
7981 return false;
7982
7983
7984 return true;
7985 }
7986
7988 {
7990 {
7991 if (ScriptInputUserData.CanStoreInputUserData())
7992 {
7993 ScriptInputUserData ctx = new ScriptInputUserData;
7998 ctx.
Write(destination_entity);
8002 }
8003 }
8004 else if (!
GetGame().IsMultiplayer())
8005 {
8007 }
8008 }
8009
8011 {
8012 float split_quantity_new;
8016 InventoryLocation loc = new InventoryLocation;
8017
8018 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8019 {
8021 split_quantity_new = stack_max;
8022 else
8024
8026 {
8027 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8028 if (new_item)
8029 {
8030 new_item.SetResultOfSplit(true);
8031 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8033 new_item.
SetQuantity(split_quantity_new,
false,
true);
8034 }
8035 }
8036 }
8037 else if (destination_entity && slot_id == -1)
8038 {
8039 if (quantity > stack_max)
8040 split_quantity_new = stack_max;
8041 else
8042 split_quantity_new = quantity;
8043
8045 {
8047 {
8050 }
8051
8052 if (new_item)
8053 {
8054 new_item.SetResultOfSplit(true);
8055 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8057 new_item.
SetQuantity(split_quantity_new,
false,
true);
8058 }
8059 }
8060 }
8061 else
8062 {
8063 if (stack_max != 0)
8064 {
8066 {
8068 }
8069
8070 if (split_quantity_new == 0)
8071 {
8072 if (!
GetGame().IsMultiplayer())
8073 player.PhysicalPredictiveDropItem(this);
8074 else
8075 player.ServerDropEntity(this);
8076 return;
8077 }
8078
8080 {
8082
8083 if (new_item)
8084 {
8085 new_item.SetResultOfSplit(true);
8086 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8089 new_item.PlaceOnSurface();
8090 }
8091 }
8092 }
8093 }
8094 }
8095
8097 {
8098 float split_quantity_new;
8102 InventoryLocation loc = new InventoryLocation;
8103
8104 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8105 {
8107 split_quantity_new = stack_max;
8108 else
8110
8112 {
8113 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8114 if (new_item)
8115 {
8116 new_item.SetResultOfSplit(true);
8117 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8119 new_item.
SetQuantity(split_quantity_new,
false,
true);
8120 }
8121 }
8122 }
8123 else if (destination_entity && slot_id == -1)
8124 {
8125 if (quantity > stack_max)
8126 split_quantity_new = stack_max;
8127 else
8128 split_quantity_new = quantity;
8129
8131 {
8133 {
8136 }
8137
8138 if (new_item)
8139 {
8140 new_item.SetResultOfSplit(true);
8141 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8143 new_item.
SetQuantity(split_quantity_new,
false,
true);
8144 }
8145 }
8146 }
8147 else
8148 {
8149 if (stack_max != 0)
8150 {
8152 {
8154 }
8155
8157 {
8159
8160 if (new_item)
8161 {
8162 new_item.SetResultOfSplit(true);
8163 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8166 new_item.PlaceOnSurface();
8167 }
8168 }
8169 }
8170 }
8171 }
8172
8174 {
8176 {
8177 if (ScriptInputUserData.CanStoreInputUserData())
8178 {
8179 ScriptInputUserData ctx = new ScriptInputUserData;
8184 dst.WriteToContext(ctx);
8186 }
8187 }
8188 else if (!
GetGame().IsMultiplayer())
8189 {
8191 }
8192 }
8193
8195 {
8197 {
8198 if (ScriptInputUserData.CanStoreInputUserData())
8199 {
8200 ScriptInputUserData ctx = new ScriptInputUserData;
8205 ctx.
Write(destination_entity);
8211 }
8212 }
8213 else if (!
GetGame().IsMultiplayer())
8214 {
8216 }
8217 }
8218
8220 {
8222 }
8223
8225 {
8227 float split_quantity_new;
8229 if (dst.IsValid())
8230 {
8231 int slot_id = dst.GetSlot();
8233
8234 if (quantity > stack_max)
8235 split_quantity_new = stack_max;
8236 else
8237 split_quantity_new = quantity;
8238
8240 {
8242
8243 if (new_item)
8244 {
8245 new_item.SetResultOfSplit(true);
8246 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8248 new_item.
SetQuantity(split_quantity_new,
false,
true);
8249 }
8250
8251 return new_item;
8252 }
8253 }
8254
8255 return null;
8256 }
8257
8259 {
8261 float split_quantity_new;
8263 if (destination_entity)
8264 {
8266 if (quantity > stackable)
8267 split_quantity_new = stackable;
8268 else
8269 split_quantity_new = quantity;
8270
8272 {
8273 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8274 if (new_item)
8275 {
8276 new_item.SetResultOfSplit(true);
8277 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8279 new_item.
SetQuantity(split_quantity_new,
false,
true);
8280 }
8281 }
8282 }
8283 }
8284
8286 {
8288 {
8289 if (ScriptInputUserData.CanStoreInputUserData())
8290 {
8291 ScriptInputUserData ctx = new ScriptInputUserData;
8296 ItemBase destination_entity =
this;
8297 ctx.
Write(destination_entity);
8301 }
8302 }
8303 else if (!
GetGame().IsMultiplayer())
8304 {
8306 }
8307 }
8308
8310 {
8312 float split_quantity_new;
8314 if (player)
8315 {
8317 if (quantity > stackable)
8318 split_quantity_new = stackable;
8319 else
8320 split_quantity_new = quantity;
8321
8323 {
8324 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8325 new_item =
ItemBase.Cast(in_hands);
8326 if (new_item)
8327 {
8328 new_item.SetResultOfSplit(true);
8329 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8331 new_item.SetQuantity(split_quantity_new, false, true);
8332 }
8333 }
8334 }
8335 }
8336
8338 {
8340 float split_quantity_new = Math.Floor(quantity * 0.5);
8341
8343 return;
8344
8346
8347 if (new_item)
8348 {
8349 if (new_item.GetQuantityMax() < split_quantity_new)
8350 {
8351 split_quantity_new = new_item.GetQuantityMax();
8352 }
8353
8354 new_item.SetResultOfSplit(true);
8355 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8356
8358 {
8361 }
8362 else
8363 {
8365 new_item.
SetQuantity(split_quantity_new,
false,
true);
8366 }
8367 }
8368 }
8369
8371 {
8373 float split_quantity_new = Math.Floor(quantity / 2);
8374
8376 return;
8377
8378 InventoryLocation invloc = new InventoryLocation;
8380
8382 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8383
8384 if (new_item)
8385 {
8386 if (new_item.GetQuantityMax() < split_quantity_new)
8387 {
8388 split_quantity_new = new_item.GetQuantityMax();
8389 }
8391 {
8394 }
8395 else if (split_quantity_new > 1)
8396 {
8398 new_item.
SetQuantity(split_quantity_new,
false,
true);
8399 }
8400 }
8401 }
8402
8405 {
8406 SetWeightDirty();
8408
8409 if (parent)
8410 parent.OnAttachmentQuantityChangedEx(this, delta);
8411
8413 {
8415 {
8417 }
8419 {
8420 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8422 }
8423 }
8424
8425 }
8426
8429 {
8430
8431 }
8432
8435 {
8437 }
8438
8440 {
8441 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8442
8444 {
8445 if (newLevel == GameConstants.STATE_RUINED)
8446 {
8448 EntityAI parent = GetHierarchyParent();
8449 if (parent && parent.IsFireplace())
8450 {
8451 CargoBase cargo = GetInventory().GetCargo();
8452 if (cargo)
8453 {
8455 {
8457 }
8458 }
8459 }
8460 }
8461
8463 {
8464
8466 return;
8467 }
8468
8469 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8470 {
8472 }
8473 }
8474 }
8475
8476
8478 {
8479 super.OnRightClick();
8480
8482 {
8484 {
8485 if (ScriptInputUserData.CanStoreInputUserData())
8486 {
8487 EntityAI root = GetHierarchyRoot();
8488 Man playerOwner = GetHierarchyRootPlayer();
8489 InventoryLocation dst = new InventoryLocation;
8490
8491
8492 if (!playerOwner && root && root == this)
8493 {
8495 }
8496 else
8497 {
8498
8499 GetInventory().GetCurrentInventoryLocation(dst);
8501 {
8504 {
8506 }
8507 else
8508 {
8510
8511
8512 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8513 {
8515 }
8516 else
8517 {
8518 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8519 }
8520 }
8521 }
8522 }
8523
8524 ScriptInputUserData ctx = new ScriptInputUserData;
8532 }
8533 }
8534 else if (!
GetGame().IsMultiplayer())
8535 {
8537 }
8538 }
8539 }
8540
8542 {
8543 if (root)
8544 {
8545 vector m4[4];
8546 root.GetTransform(m4);
8547 dst.SetGround(this, m4);
8548 }
8549 else
8550 {
8551 GetInventory().GetCurrentInventoryLocation(dst);
8552 }
8553 }
8554
8555 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8556 {
8557
8558 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8559 return false;
8560
8561 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8562 return false;
8563
8564
8566 return false;
8567
8568
8569 Magazine mag = Magazine.Cast(this);
8570 if (mag)
8571 {
8572 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8573 return false;
8574
8575 if (stack_max_limit)
8576 {
8577 Magazine other_mag = Magazine.Cast(other_item);
8578 if (other_item)
8579 {
8580 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8581 return false;
8582 }
8583
8584 }
8585 }
8586 else
8587 {
8588
8590 return false;
8591
8593 return false;
8594 }
8595
8596 PlayerBase player = null;
8597 if (CastTo(player, GetHierarchyRootPlayer()))
8598 {
8599 if (player.GetInventory().HasAttachment(this))
8600 return false;
8601
8602 if (player.IsItemsToDelete())
8603 return false;
8604 }
8605
8606 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8607 return false;
8608
8609 int slotID;
8611 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8612 return false;
8613
8614 return true;
8615 }
8616
8618 {
8620 }
8621
8623 {
8624 return m_IsResultOfSplit;
8625 }
8626
8628 {
8629 m_IsResultOfSplit = value;
8630 }
8631
8633 {
8635 }
8636
8638 {
8639 float other_item_quantity = other_item.GetQuantity();
8640 float this_free_space;
8641
8643
8645
8646 if (other_item_quantity > this_free_space)
8647 {
8648 return this_free_space;
8649 }
8650 else
8651 {
8652 return other_item_quantity;
8653 }
8654 }
8655
8657 {
8659 }
8660
8662 {
8664 return;
8665
8666 if (!IsMagazine() && other_item)
8667 {
8669 if (quantity_used != 0)
8670 {
8671 float hp1 = GetHealth01("","");
8672 float hp2 = other_item.GetHealth01("","");
8673 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8674 hpResult = hpResult / (
GetQuantity() + quantity_used);
8675
8676 hpResult *= GetMaxHealth();
8677 Math.Round(hpResult);
8678 SetHealth("", "Health", hpResult);
8679
8681 other_item.AddQuantity(-quantity_used);
8682 }
8683 }
8685 }
8686
8688 {
8689 #ifdef SERVER
8690 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8691 GetHierarchyParent().IncreaseLifetimeUp();
8692 #endif
8693 };
8694
8696 {
8697 PlayerBase p = PlayerBase.Cast(player);
8698
8699 array<int> recipesIds = p.m_Recipes;
8700 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8701 if (moduleRecipesManager)
8702 {
8703 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8704 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8705 }
8706
8707 for (int i = 0;i < recipesIds.Count(); i++)
8708 {
8709 int key = recipesIds.Get(i);
8710 string recipeName = moduleRecipesManager.GetRecipeName(key);
8712 }
8713 }
8714
8715
8716 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8717 {
8718 super.GetDebugActions(outputList);
8719
8720
8726
8727
8732
8737
8738
8742
8743
8745 {
8749 }
8750
8753
8754
8758
8760
8761 InventoryLocation loc = new InventoryLocation();
8762 GetInventory().GetCurrentInventoryLocation(loc);
8764 {
8765 if (Gizmo_IsSupported())
8768 }
8769
8771 }
8772
8773
8774
8775
8777 {
8778 super.OnAction(action_id, player, ctx);
8779
8781 {
8782 switch (action_id)
8783 {
8786 return true;
8789 return true;
8790 }
8791 }
8792
8794 {
8795 switch (action_id)
8796 {
8798 Delete();
8799 return true;
8800 }
8801 }
8802
8803 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8804 {
8805 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8806 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8807 PlayerBase p = PlayerBase.Cast(player);
8808 if (
EActions.RECIPES_RANGE_START < 1000)
8809 {
8810 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8811 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8812 }
8813 }
8814 #ifndef SERVER
8815 else if (action_id ==
EActions.WATCH_PLAYER)
8816 {
8817 PluginDeveloper.SetDeveloperItemClientEx(player);
8818 }
8819 #endif
8821 {
8822 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8823 {
8824 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8825 OnDebugButtonPressServer(id + 1);
8826 }
8827
8828 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8829 {
8830 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8832 }
8833
8834 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8835 {
8836 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8838 }
8839
8840 else if (action_id ==
EActions.ADD_QUANTITY)
8841 {
8842 if (IsMagazine())
8843 {
8844 Magazine mag = Magazine.Cast(this);
8845 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8846 }
8847 else
8848 {
8850 }
8851
8852 if (m_EM)
8853 {
8854 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8855 }
8856
8857 }
8858
8859 else if (action_id ==
EActions.REMOVE_QUANTITY)
8860 {
8861 if (IsMagazine())
8862 {
8863 Magazine mag2 = Magazine.Cast(this);
8864 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8865 }
8866 else
8867 {
8869 }
8870 if (m_EM)
8871 {
8872 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8873 }
8874
8875 }
8876
8877 else if (action_id ==
EActions.SET_QUANTITY_0)
8878 {
8880
8881 if (m_EM)
8882 {
8883 m_EM.SetEnergy(0);
8884 }
8885 }
8886
8887 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8888 {
8890
8891 if (m_EM)
8892 {
8893 m_EM.SetEnergy(m_EM.GetEnergyMax());
8894 }
8895 }
8896
8897 else if (action_id ==
EActions.ADD_HEALTH)
8898 {
8899 AddHealth("","",GetMaxHealth("","Health")/5);
8900 }
8901 else if (action_id ==
EActions.REMOVE_HEALTH)
8902 {
8903 AddHealth("","",-GetMaxHealth("","Health")/5);
8904 }
8905 else if (action_id ==
EActions.DESTROY_HEALTH)
8906 {
8907 SetHealth01("","",0);
8908 }
8909 else if (action_id ==
EActions.WATCH_ITEM)
8910 {
8912 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8913 #ifdef DEVELOPER
8914 SetDebugDeveloper_item(this);
8915 #endif
8916 }
8917
8918 else if (action_id ==
EActions.ADD_TEMPERATURE)
8919 {
8920 AddTemperature(20);
8921
8922 }
8923
8924 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8925 {
8926 AddTemperature(-20);
8927
8928 }
8929
8930 else if (action_id ==
EActions.FLIP_FROZEN)
8931 {
8932 SetFrozen(!GetIsFrozen());
8933
8934 }
8935
8936 else if (action_id ==
EActions.ADD_WETNESS)
8937 {
8939
8940 }
8941
8942 else if (action_id ==
EActions.REMOVE_WETNESS)
8943 {
8945
8946 }
8947
8948 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8949 {
8952
8953
8954 }
8955
8956 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8957 {
8960 }
8961
8962 else if (action_id ==
EActions.MAKE_SPECIAL)
8963 {
8964 auto debugParams = DebugSpawnParams.WithPlayer(player);
8965 OnDebugSpawnEx(debugParams);
8966 }
8967
8968 }
8969
8970
8971 return false;
8972 }
8973
8974
8975
8976
8980
8983
8984
8985
8987 {
8988 return false;
8989 }
8990
8991
8993 {
8994 return true;
8995 }
8996
8997
8999 {
9000 return true;
9001 }
9002
9003
9004
9006 {
9007 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9009 }
9010
9013 {
9014 return null;
9015 }
9016
9018 {
9019 return false;
9020 }
9021
9023 {
9024 return false;
9025 }
9026
9030
9031
9033 {
9034 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9035 return module_repairing.CanRepair(this, item_repair_kit);
9036 }
9037
9038
9039 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9040 {
9041 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9042 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9043 }
9044
9045
9047 {
9048
9049
9050
9051
9052
9053
9054
9055
9056 return 1;
9057 }
9058
9059
9060
9062 {
9064 }
9065
9066
9067
9069 {
9071 }
9072
9073
9082 {
9083 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9084
9085 if (player)
9086 {
9087 player.MessageStatus(text);
9088 }
9089 }
9090
9091
9100 {
9101 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9102
9103 if (player)
9104 {
9105 player.MessageAction(text);
9106 }
9107 }
9108
9109
9118 {
9119 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9120
9121 if (player)
9122 {
9123 player.MessageFriendly(text);
9124 }
9125 }
9126
9127
9136 {
9137 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9138
9139 if (player)
9140 {
9141 player.MessageImportant(text);
9142 }
9143 }
9144
9146 {
9147 return true;
9148 }
9149
9150
9151 override bool KindOf(
string tag)
9152 {
9153 bool found = false;
9154 string item_name = this.
GetType();
9157
9158 int array_size = item_tag_array.Count();
9159 for (int i = 0; i < array_size; i++)
9160 {
9161 if (item_tag_array.Get(i) == tag)
9162 {
9163 found = true;
9164 break;
9165 }
9166 }
9167 return found;
9168 }
9169
9170
9172 {
9173
9174 super.OnRPC(sender, rpc_type,ctx);
9175
9176
9177 switch (rpc_type)
9178 {
9179 #ifndef SERVER
9180 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9181 Param2<bool, string> p = new Param2<bool, string>(false, "");
9182
9184 return;
9185
9186 bool play = p.param1;
9187 string soundSet = p.param2;
9188
9189 if (play)
9190 {
9192 {
9194 {
9196 }
9197 }
9198 else
9199 {
9201 }
9202 }
9203 else
9204 {
9206 }
9207
9208 break;
9209 #endif
9210
9211 }
9212
9214 {
9216 }
9217 }
9218
9219
9220
9221
9223 {
9224 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9225 return plugin.GetID(
name);
9226 }
9227
9229 {
9230 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9231 return plugin.GetName(id);
9232 }
9233
9236 {
9237
9238
9239 int varFlags;
9240 if (!ctx.
Read(varFlags))
9241 return;
9242
9243 if (varFlags & ItemVariableFlags.FLOAT)
9244 {
9246 }
9247 }
9248
9250 {
9251
9252 super.SerializeNumericalVars(floats_out);
9253
9254
9255
9257 {
9259 }
9260
9262 {
9264 }
9265
9267 {
9269 }
9270
9272 {
9277 }
9278
9280 {
9282 }
9283 }
9284
9286 {
9287
9288 super.DeSerializeNumericalVars(floats);
9289
9290
9291 int index = 0;
9292 int mask = Math.Round(floats.Get(index));
9293
9294 index++;
9295
9297 {
9299 {
9301 }
9302 else
9303 {
9304 float quantity = floats.Get(index);
9306 }
9307 index++;
9308 }
9309
9311 {
9312 float wet = floats.Get(index);
9314 index++;
9315 }
9316
9318 {
9319 int liquidtype = Math.Round(floats.Get(index));
9321 index++;
9322 }
9323
9325 {
9327 index++;
9329 index++;
9331 index++;
9333 index++;
9334 }
9335
9337 {
9338 int cleanness = Math.Round(floats.Get(index));
9340 index++;
9341 }
9342 }
9343
9345 {
9346 super.WriteVarsToCTX(ctx);
9347
9348
9350 {
9352 }
9353
9355 {
9357 }
9358
9360 {
9362 }
9363
9365 {
9366 int r,g,b,a;
9372 }
9373
9375 {
9377 }
9378 }
9379
9381 {
9382 if (!super.ReadVarsFromCTX(ctx,version))
9383 return false;
9384
9385 int intValue;
9386 float value;
9387
9388 if (version < 140)
9389 {
9390 if (!ctx.
Read(intValue))
9391 return false;
9392
9393 m_VariablesMask = intValue;
9394 }
9395
9397 {
9398 if (!ctx.
Read(value))
9399 return false;
9400
9402 {
9404 }
9405 else
9406 {
9408 }
9409 }
9410
9411 if (version < 140)
9412 {
9414 {
9415 if (!ctx.
Read(value))
9416 return false;
9417 SetTemperatureDirect(value);
9418 }
9419 }
9420
9422 {
9423 if (!ctx.
Read(value))
9424 return false;
9426 }
9427
9429 {
9430 if (!ctx.
Read(intValue))
9431 return false;
9433 }
9434
9436 {
9437 int r,g,b,a;
9439 return false;
9441 return false;
9443 return false;
9445 return false;
9446
9448 }
9449
9451 {
9452 if (!ctx.
Read(intValue))
9453 return false;
9455 }
9456
9457 if (version >= 138 && version < 140)
9458 {
9460 {
9461 if (!ctx.
Read(intValue))
9462 return false;
9463 SetFrozen(intValue);
9464 }
9465 }
9466
9467 return true;
9468 }
9469
9470
9472 {
9475 {
9477 }
9478
9479 if (!super.OnStoreLoad(ctx, version))
9480 {
9482 return false;
9483 }
9484
9485 if (version >= 114)
9486 {
9487 bool hasQuickBarIndexSaved;
9488
9489 if (!ctx.
Read(hasQuickBarIndexSaved))
9490 {
9492 return false;
9493 }
9494
9495 if (hasQuickBarIndexSaved)
9496 {
9497 int itmQBIndex;
9498
9499
9500 if (!ctx.
Read(itmQBIndex))
9501 {
9503 return false;
9504 }
9505
9506 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9507 if (itmQBIndex != -1 && parentPlayer)
9508 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9509 }
9510 }
9511 else
9512 {
9513
9514 PlayerBase player;
9515 int itemQBIndex;
9516 if (version ==
int.
MAX)
9517 {
9518 if (!ctx.
Read(itemQBIndex))
9519 {
9521 return false;
9522 }
9523 }
9524 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9525 {
9526
9527 if (!ctx.
Read(itemQBIndex))
9528 {
9530 return false;
9531 }
9532 if (itemQBIndex != -1 && player)
9533 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9534 }
9535 }
9536
9537 if (version < 140)
9538 {
9539
9540 if (!LoadVariables(ctx, version))
9541 {
9543 return false;
9544 }
9545 }
9546
9547
9549 {
9551 return false;
9552 }
9553 if (version >= 132)
9554 {
9556 if (raib)
9557 {
9559 {
9561 return false;
9562 }
9563 }
9564 }
9565
9567 return true;
9568 }
9569
9570
9571
9573 {
9574 super.OnStoreSave(ctx);
9575
9576 PlayerBase player;
9577 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9578 {
9580
9581 int itemQBIndex = -1;
9582 itemQBIndex = player.FindQuickBarEntityIndex(this);
9583 ctx.
Write(itemQBIndex);
9584 }
9585 else
9586 {
9588 }
9589
9591
9593 if (raib)
9594 {
9596 }
9597 }
9598
9599
9601 {
9602 super.AfterStoreLoad();
9603
9605 {
9607 }
9608
9610 {
9613 }
9614 }
9615
9617 {
9618 super.EEOnAfterLoad();
9619
9621 {
9623 }
9624
9627 }
9628
9630 {
9631 return false;
9632 }
9633
9634
9635
9637 {
9639 {
9640 #ifdef PLATFORM_CONSOLE
9641
9643 {
9645 if (menu)
9646 {
9648 }
9649 }
9650 #endif
9651 }
9652
9654 {
9657 }
9658
9660 {
9661 SetWeightDirty();
9663 }
9665 {
9668 }
9669
9671 {
9674 }
9676 {
9679 }
9680
9681 super.OnVariablesSynchronized();
9682 }
9683
9684
9685
9687 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9688 {
9689 if (!IsServerCheck(allow_client))
9690 return false;
9691
9693 return false;
9694
9697
9698 if (value <= (min + 0.001))
9699 value = min;
9700
9701 if (value == min)
9702 {
9703 if (destroy_config)
9704 {
9705 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9706 if (dstr)
9707 {
9709 this.Delete();
9710 return true;
9711 }
9712 }
9713 else if (destroy_forced)
9714 {
9716 this.Delete();
9717 return true;
9718 }
9719
9721 }
9722
9725
9727 {
9729
9730 if (delta)
9732 }
9733
9735
9736 return false;
9737 }
9738
9739
9741 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9742 {
9744 }
9745
9747 {
9750 }
9751
9753 {
9756 }
9757
9759 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9760 {
9761 float value_clamped = Math.Clamp(value, 0, 1);
9763 SetQuantity(result, destroy_config, destroy_forced);
9764 }
9765
9766
9769 {
9771 }
9772
9774 {
9776 }
9777
9778
9779
9780
9781
9782
9783
9784
9785
9786
9788 {
9789 int slot = -1;
9790 if (GetInventory())
9791 {
9792 InventoryLocation il = new InventoryLocation;
9793 GetInventory().GetCurrentInventoryLocation(il);
9795 }
9796
9798 }
9799
9801 {
9802 float quantity_max = 0;
9803
9805 {
9806 if (attSlotID != -1)
9807 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9808
9809 if (quantity_max <= 0)
9811 }
9812
9813 if (quantity_max <= 0)
9815
9816 return quantity_max;
9817 }
9818
9820 {
9822 }
9823
9825 {
9827 }
9828
9829
9831 {
9833 }
9834
9836 {
9838 }
9839
9841 {
9843 }
9844
9845
9847 {
9848
9849 float weightEx = GetWeightEx();
9850 float special = GetInventoryAndCargoWeight();
9851 return weightEx - special;
9852 }
9853
9854
9856 {
9858 }
9859
9861 {
9863 {
9864 #ifdef DEVELOPER
9865 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9866 {
9867 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9869 }
9870 #endif
9871
9873 }
9874 else if (HasEnergyManager())
9875 {
9876 #ifdef DEVELOPER
9877 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9878 {
9879 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9880 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9881 }
9882 #endif
9883 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9884 }
9885 else
9886 {
9887 #ifdef DEVELOPER
9888 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9889 {
9890 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9891 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9892 }
9893 #endif
9894 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9895 }
9896 }
9897
9900 {
9901 int item_count = 0;
9903
9904 if (GetInventory().GetCargo() != NULL)
9905 {
9906 item_count = GetInventory().GetCargo().GetItemCount();
9907 }
9908
9909 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9910 {
9911 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9912 if (item)
9913 item_count += item.GetNumberOfItems();
9914 }
9915 return item_count;
9916 }
9917
9920 {
9921 float weight = 0;
9922 float wetness = 1;
9923 if (include_wetness)
9926 {
9927 weight = wetness * m_ConfigWeight;
9928 }
9930 {
9931 weight = 1;
9932 }
9933 return weight;
9934 }
9935
9936
9937
9939 {
9940 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9941 {
9942 GameInventory inv = GetInventory();
9943 array<EntityAI> items = new array<EntityAI>;
9945 for (int i = 0; i < items.Count(); i++)
9946 {
9948 if (item)
9949 {
9951 }
9952 }
9953 }
9954 }
9955
9956
9957
9958
9960 {
9961 float energy = 0;
9962 if (HasEnergyManager())
9963 {
9964 energy = GetCompEM().GetEnergy();
9965 }
9966 return energy;
9967 }
9968
9969
9971 {
9972 super.OnEnergyConsumed();
9973
9975 }
9976
9978 {
9979 super.OnEnergyAdded();
9980
9982 }
9983
9984
9986 {
9987 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9988 {
9990 {
9991 float energy_0to1 = GetCompEM().GetEnergy0To1();
9993 }
9994 }
9995 }
9996
9997
9999 {
10000 return ConfigGetFloat("heatIsolation");
10001 }
10002
10004 {
10006 }
10007
10009 {
10010 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10011 if (
GetGame().ConfigIsExisting(paramPath))
10013
10014 return 0.0;
10015 }
10016
10018 {
10019 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10020 if (
GetGame().ConfigIsExisting(paramPath))
10022
10023 return 0.0;
10024 }
10025
10026 override void SetWet(
float value,
bool allow_client =
false)
10027 {
10028 if (!IsServerCheck(allow_client))
10029 return;
10030
10033
10035
10036 m_VarWet = Math.Clamp(value, min, max);
10037
10039 {
10042 }
10043 }
10044
10045 override void AddWet(
float value)
10046 {
10048 }
10049
10051 {
10053 }
10054
10056 {
10058 }
10059
10061 {
10063 }
10064
10066 {
10068 }
10069
10071 {
10073 }
10074
10075 override void OnWetChanged(
float newVal,
float oldVal)
10076 {
10079 if (newLevel != oldLevel)
10080 {
10082 }
10083 }
10084
10086 {
10087 SetWeightDirty();
10088 }
10089
10091 {
10092 return GetWetLevelInternal(
m_VarWet);
10093 }
10094
10095
10096
10098 {
10100 }
10101
10103 {
10105 }
10106
10108 {
10110 }
10111
10113 {
10115 }
10116
10117
10118
10120 {
10121 if (ConfigIsExisting("itemModelLength"))
10122 {
10123 return ConfigGetFloat("itemModelLength");
10124 }
10125 return 0;
10126 }
10127
10129 {
10130 if (ConfigIsExisting("itemAttachOffset"))
10131 {
10132 return ConfigGetFloat("itemAttachOffset");
10133 }
10134 return 0;
10135 }
10136
10137 override void SetCleanness(
int value,
bool allow_client =
false)
10138 {
10139 if (!IsServerCheck(allow_client))
10140 return;
10141
10143
10145
10148 }
10149
10151 {
10153 }
10154
10156 {
10157 return true;
10158 }
10159
10160
10161
10162
10164 {
10166 }
10167
10169 {
10171 }
10172
10173
10174
10175
10176 override void SetColor(
int r,
int g,
int b,
int a)
10177 {
10183 }
10185 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10186 {
10191 }
10192
10194 {
10196 }
10197
10200 {
10201 int r,g,b,a;
10203 r = r/255;
10204 g = g/255;
10205 b = b/255;
10206 a = a/255;
10207 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10208 }
10209
10210
10211
10212 override void SetLiquidType(
int value,
bool allow_client =
false)
10213 {
10214 if (!IsServerCheck(allow_client))
10215 return;
10216
10221 }
10222
10224 {
10225 return ConfigGetInt("varLiquidTypeInit");
10226 }
10227
10229 {
10231 }
10232
10234 {
10236 SetFrozen(false);
10237 }
10238
10241 {
10242 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10243 }
10244
10245
10248 {
10249 PlayerBase nplayer;
10250 if (PlayerBase.CastTo(nplayer, player))
10251 {
10253
10254 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10255 }
10256 }
10257
10258
10261 {
10262 PlayerBase nplayer;
10263 if (PlayerBase.CastTo(nplayer,player))
10264 {
10265
10266 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10267
10268 }
10269
10270
10271 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10272
10273
10274 if (HasEnergyManager())
10275 {
10276 GetCompEM().UpdatePlugState();
10277 }
10278 }
10279
10280
10282 {
10283 super.OnPlacementStarted(player);
10284
10286 }
10287
10288 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10289 {
10291 {
10292 m_AdminLog.OnPlacementComplete(player,
this);
10293 }
10294
10295 super.OnPlacementComplete(player, position, orientation);
10296 }
10297
10298
10299
10300
10301
10303 {
10305 {
10306 return true;
10307 }
10308 else
10309 {
10310 return false;
10311 }
10312 }
10313
10314
10316 {
10318 {
10320 }
10321 }
10322
10323
10325 {
10327 }
10328
10330 {
10332 }
10333
10334 override void InsertAgent(
int agent,
float count = 1)
10335 {
10336 if (count < 1)
10337 return;
10338
10340 }
10341
10344 {
10346 }
10347
10348
10350 {
10352 }
10353
10354
10355
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10366
10367
10368
10369
10370
10371
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10396 {
10398 return false;
10399 return true;
10400 }
10401
10403 {
10404
10406 }
10407
10408
10411 {
10412 super.CheckForRoofLimited(timeTresholdMS);
10413
10415 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10416 {
10417 m_PreviousRoofTestTime = time;
10418 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10419 }
10420 }
10421
10422
10424 {
10426 {
10427 return 0;
10428 }
10429
10430 if (GetInventory().GetAttachmentSlotsCount() != 0)
10431 {
10432 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10433 if (filter)
10434 return filter.GetProtectionLevel(type, false, system);
10435 else
10436 return 0;
10437 }
10438
10439 string subclassPath, entryName;
10440
10441 switch (type)
10442 {
10444 entryName = "biological";
10445 break;
10447 entryName = "chemical";
10448 break;
10449 default:
10450 entryName = "biological";
10451 break;
10452 }
10453
10454 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10455
10457 }
10458
10459
10460
10463 {
10464 if (!IsMagazine())
10466
10468 }
10469
10470
10471
10472
10473
10478 {
10479 return true;
10480 }
10481
10483 {
10485 }
10486
10487
10488
10489
10490
10492 {
10493 if (parent)
10494 {
10495 if (parent.IsInherited(DayZInfected))
10496 return true;
10497
10498 if (!parent.IsRuined())
10499 return true;
10500 }
10501
10502 return true;
10503 }
10504
10506 {
10507 if (!super.CanPutAsAttachment(parent))
10508 {
10509 return false;
10510 }
10511
10512 if (!IsRuined() && !parent.IsRuined())
10513 {
10514 return true;
10515 }
10516
10517 return false;
10518 }
10519
10521 {
10522
10523
10524
10525
10526 return super.CanReceiveItemIntoCargo(item);
10527 }
10528
10530 {
10531
10532
10533
10534
10535 GameInventory attachmentInv = attachment.GetInventory();
10537 {
10538 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10539 return false;
10540 }
10541
10542 InventoryLocation loc = new InventoryLocation();
10543 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10544 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10545 return false;
10546
10547 return super.CanReceiveAttachment(attachment, slotId);
10548 }
10549
10551 {
10552 if (!super.CanReleaseAttachment(attachment))
10553 return false;
10554
10555 return GetInventory().AreChildrenAccessible();
10556 }
10557
10558
10559
10560
10561
10562
10563
10564
10565
10566
10567
10568
10569
10570
10571
10572
10573
10574
10575
10576
10577
10579 {
10580 int id = muzzle_owner.GetMuzzleID();
10581 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10582
10583 if (WPOF_array)
10584 {
10585 for (int i = 0; i < WPOF_array.Count(); i++)
10586 {
10587 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10588
10589 if (WPOF)
10590 {
10591 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10592 }
10593 }
10594 }
10595 }
10596
10597
10599 {
10600 int id = muzzle_owner.GetMuzzleID();
10602
10603 if (WPOBE_array)
10604 {
10605 for (int i = 0; i < WPOBE_array.Count(); i++)
10606 {
10607 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10608
10609 if (WPOBE)
10610 {
10611 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10612 }
10613 }
10614 }
10615 }
10616
10617
10619 {
10620 int id = muzzle_owner.GetMuzzleID();
10621 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10622
10623 if (WPOOH_array)
10624 {
10625 for (int i = 0; i < WPOOH_array.Count(); i++)
10626 {
10627 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10628
10629 if (WPOOH)
10630 {
10631 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10632 }
10633 }
10634 }
10635 }
10636
10637
10639 {
10640 int id = muzzle_owner.GetMuzzleID();
10641 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10642
10643 if (WPOOH_array)
10644 {
10645 for (int i = 0; i < WPOOH_array.Count(); i++)
10646 {
10647 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10648
10649 if (WPOOH)
10650 {
10651 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10652 }
10653 }
10654 }
10655 }
10656
10657
10659 {
10660 int id = muzzle_owner.GetMuzzleID();
10661 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10662
10663 if (WPOOH_array)
10664 {
10665 for (int i = 0; i < WPOOH_array.Count(); i++)
10666 {
10667 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10668
10669 if (WPOOH)
10670 {
10671 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10672 }
10673 }
10674 }
10675 }
10676
10677
10678
10680 {
10682 {
10683 return true;
10684 }
10685
10686 return false;
10687 }
10688
10690 {
10692 {
10693 return true;
10694 }
10695
10696 return false;
10697 }
10698
10700 {
10702 {
10703 return true;
10704 }
10705
10706 return false;
10707 }
10708
10710 {
10711 return false;
10712 }
10713
10716 {
10717 return UATimeSpent.DEFAULT_DEPLOY;
10718 }
10719
10720
10721
10722
10724 {
10726 SetSynchDirty();
10727 }
10728
10730 {
10732 }
10733
10734
10736 {
10737 return false;
10738 }
10739
10742 {
10743 string att_type = "None";
10744
10745 if (ConfigIsExisting("soundAttType"))
10746 {
10747 att_type = ConfigGetString("soundAttType");
10748 }
10749
10751 }
10752
10754 {
10756 }
10757
10758
10759
10760
10761
10767
10769 {
10772
10774 }
10775
10776
10778 {
10780 return;
10781
10783
10786
10789
10790 SoundParameters params = new SoundParameters();
10794 }
10795
10796
10798 {
10800 return;
10801
10803 SetSynchDirty();
10804
10807 }
10808
10809
10811 {
10813 return;
10814
10816 SetSynchDirty();
10817
10820 }
10821
10823 {
10825 }
10826
10828 {
10830 }
10831
10834 {
10835 if (!
GetGame().IsDedicatedServer())
10836 {
10837 if (ConfigIsExisting("attachSoundSet"))
10838 {
10839 string cfg_path = "";
10840 string soundset = "";
10841 string type_name =
GetType();
10842
10845 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10846 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10847
10848 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10849 {
10850 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10851 {
10852 if (cfg_slot_array[i] == slot_type)
10853 {
10854 soundset = cfg_soundset_array[i];
10855 break;
10856 }
10857 }
10858 }
10859
10860 if (soundset != "")
10861 {
10862 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10864 }
10865 }
10866 }
10867 }
10868
10870 {
10871
10872 }
10873
10874 void OnApply(PlayerBase player);
10875
10877 {
10878 return 1.0;
10879 };
10880
10882 {
10884 }
10885
10887 {
10889 }
10890
10892
10894 {
10895 SetDynamicPhysicsLifeTime(0.01);
10897 }
10898
10900 {
10901 array<string> zone_names = new array<string>;
10902 GetDamageZones(zone_names);
10903 for (int i = 0; i < zone_names.Count(); i++)
10904 {
10905 SetHealthMax(zone_names.Get(i),"Health");
10906 }
10907 SetHealthMax("","Health");
10908 }
10909
10912 {
10913 float global_health = GetHealth01("","Health");
10914 array<string> zones = new array<string>;
10915 GetDamageZones(zones);
10916
10917 for (int i = 0; i < zones.Count(); i++)
10918 {
10919 SetHealth01(zones.Get(i),"Health",global_health);
10920 }
10921 }
10922
10925 {
10926 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10927 }
10928
10930 {
10931 if (!hasRootAsPlayer)
10932 {
10933 if (refParentIB)
10934 {
10935
10936 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10937 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10938
10939 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10940 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10941
10944 }
10945 else
10946 {
10947
10950 }
10951 }
10952 }
10953
10955 {
10957 {
10958 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10959 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10960 {
10961 float heatPermCoef = 1.0;
10963 while (ent)
10964 {
10965 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10966 ent = ent.GetHierarchyParent();
10967 }
10968
10969 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10970 }
10971 }
10972 }
10973
10975 {
10976
10977 EntityAI parent = GetHierarchyParent();
10978 if (!parent)
10979 {
10980 hasParent = false;
10981 hasRootAsPlayer = false;
10982 }
10983 else
10984 {
10985 hasParent = true;
10986 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10987 refParentIB =
ItemBase.Cast(parent);
10988 }
10989 }
10990
10991 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10992 {
10993
10994 }
10995
10997 {
10998
10999 return false;
11000 }
11001
11003 {
11004
11005
11006 return false;
11007 }
11008
11010 {
11011
11012 return false;
11013 }
11014
11017 {
11018 return !GetIsFrozen() &&
IsOpen();
11019 }
11020
11022 {
11023 bool hasParent = false, hasRootAsPlayer = false;
11025
11026 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11027 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11028
11029 if (wwtu || foodDecay)
11030 {
11034
11035 if (processWetness || processTemperature || processDecay)
11036 {
11038
11039 if (processWetness)
11040 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11041
11042 if (processTemperature)
11044
11045 if (processDecay)
11046 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11047 }
11048 }
11049 }
11050
11053 {
11055 }
11056
11058 {
11061
11062 return super.GetTemperatureFreezeThreshold();
11063 }
11064
11066 {
11069
11070 return super.GetTemperatureThawThreshold();
11071 }
11072
11074 {
11077
11078 return super.GetItemOverheatThreshold();
11079 }
11080
11082 {
11084 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11085
11086 return super.GetTemperatureFreezeTime();
11087 }
11088
11090 {
11092 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11093
11094 return super.GetTemperatureThawTime();
11095 }
11096
11101
11103 {
11104 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11105 }
11106
11108 {
11109 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11110 }
11111
11114 {
11116 }
11117
11119 {
11121 }
11122
11124 {
11126 }
11127
11130 {
11131 return null;
11132 }
11133
11136 {
11137 return false;
11138 }
11139
11141 {
11143 {
11146 if (!trg)
11147 {
11149 explosive = this;
11150 }
11151
11152 explosive.PairRemote(trg);
11154
11155 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11156 trg.SetPersistentPairID(persistentID);
11157 explosive.SetPersistentPairID(persistentID);
11158
11159 return true;
11160 }
11161 return false;
11162 }
11163
11166 {
11167 float ret = 1.0;
11170 ret *= GetHealth01();
11171
11172 return ret;
11173 }
11174
11175 #ifdef DEVELOPER
11176 override void SetDebugItem()
11177 {
11178 super.SetDebugItem();
11179 _itemBase = this;
11180 }
11181
11183 {
11184 string text = super.GetDebugText();
11185
11187 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11188
11189 return text;
11190 }
11191 #endif
11192
11194 {
11195 return true;
11196 }
11197
11199
11201
11203 {
11206 }
11207
11208
11216
11232}
11233
11235{
11237 if (entity)
11238 {
11239 bool is_item = entity.IsInherited(
ItemBase);
11240 if (is_item && full_quantity)
11241 {
11244 }
11245 }
11246 else
11247 {
11249 return NULL;
11250 }
11251 return entity;
11252}
11253
11255{
11256 if (item)
11257 {
11258 if (health > 0)
11259 item.SetHealth("", "", health);
11260
11261 if (item.CanHaveTemperature())
11262 {
11264 if (item.CanFreeze())
11265 item.SetFrozen(false);
11266 }
11267
11268 if (item.HasEnergyManager())
11269 {
11270 if (quantity >= 0)
11271 {
11272 item.GetCompEM().SetEnergy0To1(quantity);
11273 }
11274 else
11275 {
11277 }
11278 }
11279 else if (item.IsMagazine())
11280 {
11281 Magazine mag = Magazine.Cast(item);
11282 if (quantity >= 0)
11283 {
11284 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11285 }
11286 else
11287 {
11289 }
11290
11291 }
11292 else
11293 {
11294 if (quantity >= 0)
11295 {
11296 item.SetQuantityNormalized(quantity, false);
11297 }
11298 else
11299 {
11301 }
11302
11303 }
11304 }
11305}
11306
11307#ifdef DEVELOPER
11309#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
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 CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
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
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)
void StartItemSoundServer(int id)
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()
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)
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
proto native void GizmoSelectObject(Object object)
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto native void GizmoSelectPhysics(Physics physics)
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
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 bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
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 void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, 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)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
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
proto native CGame GetGame()
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
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
class JsonUndergroundAreaTriggerData GetPosition
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.