6452{
6454 {
6455 return true;
6456 }
6457};
6458
6459
6460
6462{
6466
6468
6471
6472
6473
6474
6475
6484
6490
6495
6500
6521 protected bool m_IsResultOfSplit
6522
6524
6529
6530
6531
6533
6537
6538
6539
6541
6544
6545
6546
6552
6553
6561
6564
6565
6567
6568
6570
6571
6576
6577
6582
6583
6585
6586
6588 {
6593
6594 if (!
GetGame().IsDedicatedServer())
6595 {
6597 {
6599
6601 {
6603 }
6604 }
6605
6608 }
6609
6610 m_OldLocation = null;
6611
6613 {
6615 }
6616
6617 if (ConfigIsExisting("headSelectionsToHide"))
6618 {
6621 }
6622
6624 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6625 {
6627 }
6628
6630
6631 m_IsResultOfSplit = false;
6632
6634 }
6635
6637 {
6638 super.InitItemVariables();
6639
6645 m_Count = ConfigGetInt(
"count");
6646
6649
6654
6657
6662
6674
6678
6679
6682 if (ConfigIsExisting("canBeSplit"))
6683 {
6686 }
6687
6689 if (ConfigIsExisting("itemBehaviour"))
6691
6692
6695 RegisterNetSyncVariableInt("m_VarLiquidType");
6696 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6697
6698 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6699 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6700 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6701
6702 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6703 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6704 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6705 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6706
6707 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6708 RegisterNetSyncVariableBool("m_IsTakeable");
6709 RegisterNetSyncVariableBool("m_IsHologram");
6710
6713 {
6716 }
6717
6719
6721 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6723
6724 }
6725
6727 {
6729 }
6730
6732 {
6735 {
6740 }
6741 }
6742
6743 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6744 {
6746 {
6749 }
6750
6752 }
6753
6755 {
6761 }
6762
6764
6766 {
6768
6769 if (!action)
6770 {
6771 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6772 return;
6773 }
6774
6776 if (!ai)
6777 {
6779 return;
6780 }
6781
6783 if (!action_array)
6784 {
6785 action_array = new array<ActionBase_Basic>;
6787 }
6788 if (LogManager.IsActionLogEnable())
6789 {
6790 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6791 }
6792
6793 if (action_array.Find(action) != -1)
6794 {
6795 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6796 }
6797 else
6798 {
6799 action_array.Insert(action);
6800 }
6801 }
6802
6804 {
6806 ActionBase action = player.GetActionManager().GetAction(actionName);
6809
6810 if (action_array)
6811 {
6812 action_array.RemoveItem(action);
6813 }
6814 }
6815
6816
6817
6819 {
6820 ActionOverrideData overrideData = new ActionOverrideData();
6824
6826 if (!actionMap)
6827 {
6830 }
6831
6832 actionMap.Insert(this.
Type(), overrideData);
6833
6834 }
6835
6837
6839
6840
6842 {
6845
6848
6849 string config_to_search = "CfgVehicles";
6850 string muzzle_owner_config;
6851
6853 {
6854 if (IsInherited(Weapon))
6855 config_to_search = "CfgWeapons";
6856
6857 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6858
6859 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6860
6862
6863 if (config_OnFire_subclass_count > 0)
6864 {
6865 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6866
6867 for (int i = 0; i < config_OnFire_subclass_count; i++)
6868 {
6869 string particle_class = "";
6871 string config_OnFire_entry = config_OnFire_class + particle_class;
6872 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6873 WPOF_array.Insert(WPOF);
6874 }
6875
6876
6878 }
6879 }
6880
6882 {
6883 config_to_search = "CfgWeapons";
6884 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6885
6886 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6887
6889
6890 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6891 {
6892 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6893
6894 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6895 {
6896 string particle_class2 = "";
6898 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6899 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6900 WPOBE_array.Insert(WPOBE);
6901 }
6902
6903
6905 }
6906 }
6907 }
6908
6909
6911 {
6914
6916 {
6917 string config_to_search = "CfgVehicles";
6918
6919 if (IsInherited(Weapon))
6920 config_to_search = "CfgWeapons";
6921
6922 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6923 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6924
6925 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6926 {
6927
6929
6931 {
6933 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6935 return;
6936 }
6937
6940
6941
6942
6944 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6945
6946 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6947 {
6948 string particle_class = "";
6950 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6952
6953 if (entry_type == CT_CLASS)
6954 {
6955 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6956 WPOOH_array.Insert(WPOF);
6957 }
6958 }
6959
6960
6962 }
6963 }
6964 }
6965
6967 {
6969 }
6970
6972 {
6974 {
6976
6979
6982
6983 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6984 }
6985 }
6986
6988 {
6990 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6991
6993 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6994
6996 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6997
6999 {
7001 }
7002 }
7003
7005 {
7007 }
7008
7010 {
7013 else
7015
7017 {
7020 }
7021 else
7022 {
7025
7028 }
7029
7031 }
7032
7034 {
7036 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7037 }
7038
7040 {
7042 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7044 }
7045
7047 {
7049 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7050 }
7051
7053 {
7056
7057 OverheatingParticle OP = new OverheatingParticle();
7062
7064 }
7065
7067 {
7070
7071 return -1;
7072 }
7073
7075 {
7077 {
7080
7081 for (int i = count; i > 0; --i)
7082 {
7083 int id = i - 1;
7086
7089
7090 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7091 {
7092 if (p)
7093 {
7096 }
7097 }
7098 }
7099 }
7100 }
7101
7103 {
7105 {
7107 {
7108 int id = i - 1;
7110
7111 if (OP)
7112 {
7114
7115 if (p)
7116 {
7118 }
7119
7120 delete OP;
7121 }
7122 }
7123
7126 }
7127 }
7128
7131 {
7132 return 0.0;
7133 }
7134
7135
7137 {
7138 return 250;
7139 }
7140
7142 {
7143 return 0;
7144 }
7145
7148 {
7150 return true;
7151
7152 return false;
7153 }
7154
7157 {
7160
7162 {
7164 }
7165 else
7166 {
7167
7169 }
7170
7172 }
7173
7180 {
7181 return -1;
7182 }
7183
7184
7185
7186
7188 {
7190 {
7192 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7193
7194 if (r_index >= 0)
7195 {
7196 InventoryLocation r_il = new InventoryLocation;
7197 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7198
7199 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7202 {
7203 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7204 }
7206 {
7207 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7208 }
7209
7210 }
7211
7212 player.GetHumanInventory().ClearUserReservedLocation(this);
7213 }
7214
7217 }
7218
7219
7220
7221
7223 {
7224 return ItemBase.m_DebugActionsMask;
7225 }
7226
7228 {
7229 return ItemBase.m_DebugActionsMask & mask;
7230 }
7231
7233 {
7234 ItemBase.m_DebugActionsMask = mask;
7235 }
7236
7238 {
7239 ItemBase.m_DebugActionsMask |= mask;
7240 }
7241
7243 {
7244 ItemBase.m_DebugActionsMask &= ~mask;
7245 }
7246
7248 {
7250 {
7252 }
7253 else
7254 {
7256 }
7257 }
7258
7259
7261 {
7262 if (GetEconomyProfile())
7263 {
7264 float q_max = GetEconomyProfile().GetQuantityMax();
7265 if (q_max > 0)
7266 {
7267 float q_min = GetEconomyProfile().GetQuantityMin();
7268 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7269
7271 {
7272 ComponentEnergyManager comp = GetCompEM();
7274 {
7276 }
7277 }
7279 {
7281
7282 }
7283
7284 }
7285 }
7286 }
7287
7290 {
7291 EntityAI parent = GetHierarchyParent();
7292
7293 if (parent)
7294 {
7295 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7296 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7297 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7298 }
7299 }
7300
7303 {
7304 EntityAI parent = GetHierarchyParent();
7305
7306 if (parent)
7307 {
7308 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7309 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7310 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7311 }
7312 }
7313
7315 {
7316
7317
7318
7319
7321
7323 {
7324 if (ScriptInputUserData.CanStoreInputUserData())
7325 {
7326 ScriptInputUserData ctx = new ScriptInputUserData;
7332 ctx.
Write(use_stack_max);
7335
7337 {
7338 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7339 }
7340 }
7341 }
7342 else if (!
GetGame().IsMultiplayer())
7343 {
7345 }
7346 }
7347
7349 {
7351 }
7352
7354 {
7356 }
7357
7359 {
7361 }
7362
7364 {
7365
7366 return false;
7367 }
7368
7370 {
7371 return false;
7372 }
7373
7377 {
7378 return false;
7379 }
7380
7382 {
7383 return "";
7384 }
7385
7387
7389 {
7390 return false;
7391 }
7392
7394 {
7395 return true;
7396 }
7397
7398
7399
7401 {
7402 return true;
7403 }
7404
7406 {
7407 return true;
7408 }
7409
7411 {
7412 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7414 }
7415
7417 {
7419 }
7420
7422 {
7424 if (!is_being_placed)
7426 SetSynchDirty();
7427 }
7428
7429
7431
7433 {
7435 }
7436
7438 {
7440 }
7441
7443 {
7444 return 1;
7445 }
7446
7448 {
7449 return false;
7450 }
7451
7453 {
7455 SetSynchDirty();
7456 }
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
7493 {
7494 super.OnMovedInsideCargo(container);
7495
7496 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7497 }
7498
7499 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7500 {
7501 super.EEItemLocationChanged(oldLoc,newLoc);
7502
7503 PlayerBase new_player = null;
7504 PlayerBase old_player = null;
7505
7506 if (newLoc.GetParent())
7507 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7508
7509 if (oldLoc.GetParent())
7510 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7511
7513 {
7514 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
7515
7516 if (r_index >= 0)
7517 {
7518 InventoryLocation r_il = new InventoryLocation;
7519 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7520
7521 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7524 {
7525 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7526 }
7528 {
7529 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7530 }
7531
7532 }
7533 }
7534
7536 {
7537 if (new_player)
7538 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
7539
7540 if (new_player == old_player)
7541 {
7542
7543 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7544 {
7546 {
7547 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7548 {
7549 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7550 }
7551 }
7552 else
7553 {
7554 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7555 }
7556 }
7557
7558 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7559 {
7560 int type = oldLoc.GetType();
7562 {
7563 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7564 }
7566 {
7567 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7568 }
7569 }
7570 if (!m_OldLocation)
7571 {
7572 m_OldLocation = new InventoryLocation;
7573 }
7574 m_OldLocation.Copy(oldLoc);
7575 }
7576 else
7577 {
7578 if (m_OldLocation)
7579 {
7580 m_OldLocation.Reset();
7581 }
7582 }
7583
7585 }
7586 else
7587 {
7588 if (new_player)
7589 {
7590 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7591 if (res_index >= 0)
7592 {
7593 InventoryLocation il = new InventoryLocation;
7594 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
7596 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
7599 {
7600 il.
GetParent().GetOnReleaseLock().Invoke(it);
7601 }
7603 {
7605 }
7606
7607 }
7608 }
7610 {
7611
7613 }
7614
7615 if (m_OldLocation)
7616 {
7617 m_OldLocation.Reset();
7618 }
7619 }
7620 }
7621
7622 override void EOnContact(IEntity other, Contact extra)
7623 {
7625 {
7626 int liquidType = -1;
7628 if (impactSpeed > 0.0)
7629 {
7631 #ifndef SERVER
7633 #else
7635 SetSynchDirty();
7636 #endif
7638 }
7639 }
7640
7641 #ifdef SERVER
7642 if (GetCompEM() && GetCompEM().IsPlugged())
7643 {
7644 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7645 GetCompEM().UnplugThis();
7646 }
7647 #endif
7648 }
7649
7651
7653 {
7655 }
7656
7658 {
7659
7660 }
7661
7663 {
7664 super.OnItemLocationChanged(old_owner, new_owner);
7665
7666 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7667 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7668
7669 if (!relatedPlayer && playerNew)
7670 relatedPlayer = playerNew;
7671
7672 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7673 {
7675 if (actionMgr)
7676 {
7677 ActionBase currentAction = actionMgr.GetRunningAction();
7678 if (currentAction)
7680 }
7681 }
7682
7683 Man ownerPlayerOld = null;
7684 Man ownerPlayerNew = null;
7685
7686 if (old_owner)
7687 {
7688 if (old_owner.
IsMan())
7689 {
7690 ownerPlayerOld = Man.Cast(old_owner);
7691 }
7692 else
7693 {
7694 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7695 }
7696 }
7697 else
7698 {
7700 {
7702
7703 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7704 {
7705 GetCompEM().UnplugThis();
7706 }
7707 }
7708 }
7709
7710 if (new_owner)
7711 {
7712 if (new_owner.
IsMan())
7713 {
7714 ownerPlayerNew = Man.Cast(new_owner);
7715 }
7716 else
7717 {
7718 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7719 }
7720 }
7721
7722 if (ownerPlayerOld != ownerPlayerNew)
7723 {
7724 if (ownerPlayerOld)
7725 {
7726 array<EntityAI> subItemsExit = new array<EntityAI>;
7728 for (int i = 0; i < subItemsExit.Count(); i++)
7729 {
7732 }
7733 }
7734
7735 if (ownerPlayerNew)
7736 {
7737 array<EntityAI> subItemsEnter = new array<EntityAI>;
7739 for (int j = 0; j < subItemsEnter.Count(); j++)
7740 {
7743 }
7744 }
7745 }
7746 else if (ownerPlayerNew != null)
7747 {
7748 PlayerBase nplayer;
7749 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7750 {
7751 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7753 for (int k = 0; k < subItemsUpdate.Count(); k++)
7754 {
7756 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7757 }
7758 }
7759 }
7760
7761 if (old_owner)
7762 old_owner.OnChildItemRemoved(this);
7763 if (new_owner)
7764 new_owner.OnChildItemReceived(this);
7765 }
7766
7767
7769 {
7770 super.EEDelete(parent);
7771 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7772 if (player)
7773 {
7775
7776 if (player.IsAlive())
7777 {
7778 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7779 if (r_index >= 0)
7780 {
7781 InventoryLocation r_il = new InventoryLocation;
7782 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7783
7784 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7787 {
7788 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7789 }
7791 {
7792 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7793 }
7794
7795 }
7796
7797 player.RemoveQuickBarEntityShortcut(this);
7798 }
7799 }
7800 }
7801
7803 {
7804 super.EEKilled(killer);
7805
7808 {
7809 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7810 {
7811 if (IsMagazine())
7812 {
7813 if (Magazine.Cast(this).GetAmmoCount() > 0)
7814 {
7816 }
7817 }
7818 else
7819 {
7821 }
7822 }
7823 }
7824 }
7825
7827 {
7828 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7829
7830 super.OnWasAttached(parent, slot_id);
7831
7834
7836 }
7837
7839 {
7840 super.OnWasDetached(parent, slot_id);
7841
7844 }
7845
7847 {
7848 int idx;
7851
7852 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7853 if (inventory_slots.Count() < 1)
7854 {
7855 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7856 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7857 }
7858 else
7859 {
7860 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7861 }
7862
7863 idx = inventory_slots.Find(slot);
7864 if (idx < 0)
7865 return "";
7866
7867 return attach_types.Get(idx);
7868 }
7869
7871 {
7872 int idx = -1;
7873 string slot;
7874
7877
7878 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7879 if (inventory_slots.Count() < 1)
7880 {
7881 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7882 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7883 }
7884 else
7885 {
7886 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7887 if (detach_types.Count() < 1)
7888 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7889 }
7890
7891 for (int i = 0; i < inventory_slots.Count(); i++)
7892 {
7893 slot = inventory_slots.Get(i);
7894 }
7895
7896 if (slot != "")
7897 {
7898 if (detach_types.Count() == 1)
7899 idx = 0;
7900 else
7901 idx = inventory_slots.Find(slot);
7902 }
7903 if (idx < 0)
7904 return "";
7905
7906 return detach_types.Get(idx);
7907 }
7908
7910 {
7911
7913
7914
7915 float min_time = 1;
7916 float max_time = 3;
7917 float delay = Math.RandomFloat(min_time, max_time);
7918
7919 explode_timer.Run(delay, this, "DoAmmoExplosion");
7920 }
7921
7923 {
7924 Magazine magazine = Magazine.Cast(this);
7925 int pop_sounds_count = 6;
7926 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7927
7928
7929 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7930 string sound_name = pop_sounds[ sound_idx ];
7932
7933
7934 magazine.ServerAddAmmoCount(-1);
7935
7936
7937 float min_temp_to_explode = 100;
7938
7939 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7940 {
7942 }
7943 }
7944
7945
7946 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7947 {
7948 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7949
7950 const int CHANCE_DAMAGE_CARGO = 4;
7951 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7952 const int CHANCE_DAMAGE_NOTHING = 2;
7953
7955 {
7956 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7957 int chances;
7958 int rnd;
7959
7960 if (GetInventory().GetCargo())
7961 {
7962 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7963 rnd = Math.RandomInt(0,chances);
7964
7965 if (rnd < CHANCE_DAMAGE_CARGO)
7966 {
7968 }
7969 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7970 {
7972 }
7973 }
7974 else
7975 {
7976 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7977 rnd = Math.RandomInt(0,chances);
7978
7979 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7980 {
7982 }
7983 }
7984 }
7985 }
7986
7988 {
7989 if (GetInventory().GetCargo())
7990 {
7991 int item_count = GetInventory().GetCargo().GetItemCount();
7992 if (item_count > 0)
7993 {
7994 int random_pick = Math.RandomInt(0, item_count);
7996 if (!item.IsExplosive())
7997 {
7998 item.AddHealth("","",damage);
7999 return true;
8000 }
8001 }
8002 }
8003 return false;
8004 }
8005
8007 {
8008 int attachment_count = GetInventory().AttachmentCount();
8009 if (attachment_count > 0)
8010 {
8011 int random_pick = Math.RandomInt(0, attachment_count);
8012 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
8013 if (!attachment.IsExplosive())
8014 {
8015 attachment.AddHealth("","",damage);
8016 return true;
8017 }
8018 }
8019 return false;
8020 }
8021
8023 {
8025 }
8026
8028 {
8030 return GetInventory().CanRemoveEntity();
8031
8032 return false;
8033 }
8034
8036 {
8037
8039 return false;
8040
8041
8043 return false;
8044
8045
8046
8048 if (delta == 0)
8049 return false;
8050
8051
8052 return true;
8053 }
8054
8056 {
8058 {
8059 if (ScriptInputUserData.CanStoreInputUserData())
8060 {
8061 ScriptInputUserData ctx = new ScriptInputUserData;
8066 ctx.
Write(destination_entity);
8070 }
8071 }
8072 else if (!
GetGame().IsMultiplayer())
8073 {
8075 }
8076 }
8077
8079 {
8080 float split_quantity_new;
8084 InventoryLocation loc = new InventoryLocation;
8085
8086 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8087 {
8089 split_quantity_new = stack_max;
8090 else
8092
8094 {
8095 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8096 if (new_item)
8097 {
8098 new_item.SetResultOfSplit(true);
8099 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8101 new_item.
SetQuantity(split_quantity_new,
false,
true);
8102 }
8103 }
8104 }
8105 else if (destination_entity && slot_id == -1)
8106 {
8107 if (quantity > stack_max)
8108 split_quantity_new = stack_max;
8109 else
8110 split_quantity_new = quantity;
8111
8113 {
8115 {
8118 }
8119
8120 if (new_item)
8121 {
8122 new_item.SetResultOfSplit(true);
8123 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8125 new_item.
SetQuantity(split_quantity_new,
false,
true);
8126 }
8127 }
8128 }
8129 else
8130 {
8131 if (stack_max != 0)
8132 {
8134 {
8136 }
8137
8138 if (split_quantity_new == 0)
8139 {
8140 if (!
GetGame().IsMultiplayer())
8141 player.PhysicalPredictiveDropItem(this);
8142 else
8143 player.ServerDropEntity(this);
8144 return;
8145 }
8146
8148 {
8150
8151 if (new_item)
8152 {
8153 new_item.SetResultOfSplit(true);
8154 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8157 new_item.PlaceOnSurface();
8158 }
8159 }
8160 }
8161 }
8162 }
8163
8165 {
8166 float split_quantity_new;
8170 InventoryLocation loc = new InventoryLocation;
8171
8172 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8173 {
8175 split_quantity_new = stack_max;
8176 else
8178
8180 {
8181 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8182 if (new_item)
8183 {
8184 new_item.SetResultOfSplit(true);
8185 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8187 new_item.
SetQuantity(split_quantity_new,
false,
true);
8188 }
8189 }
8190 }
8191 else if (destination_entity && slot_id == -1)
8192 {
8193 if (quantity > stack_max)
8194 split_quantity_new = stack_max;
8195 else
8196 split_quantity_new = quantity;
8197
8199 {
8201 {
8204 }
8205
8206 if (new_item)
8207 {
8208 new_item.SetResultOfSplit(true);
8209 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8211 new_item.
SetQuantity(split_quantity_new,
false,
true);
8212 }
8213 }
8214 }
8215 else
8216 {
8217 if (stack_max != 0)
8218 {
8220 {
8222 }
8223
8225 {
8227
8228 if (new_item)
8229 {
8230 new_item.SetResultOfSplit(true);
8231 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8234 new_item.PlaceOnSurface();
8235 }
8236 }
8237 }
8238 }
8239 }
8240
8242 {
8244 {
8245 if (ScriptInputUserData.CanStoreInputUserData())
8246 {
8247 ScriptInputUserData ctx = new ScriptInputUserData;
8252 dst.WriteToContext(ctx);
8254 }
8255 }
8256 else if (!
GetGame().IsMultiplayer())
8257 {
8259 }
8260 }
8261
8263 {
8265 {
8266 if (ScriptInputUserData.CanStoreInputUserData())
8267 {
8268 ScriptInputUserData ctx = new ScriptInputUserData;
8273 ctx.
Write(destination_entity);
8279 }
8280 }
8281 else if (!
GetGame().IsMultiplayer())
8282 {
8284 }
8285 }
8286
8288 {
8290 }
8291
8293 {
8295 float split_quantity_new;
8297 if (dst.IsValid())
8298 {
8299 int slot_id = dst.GetSlot();
8301
8302 if (quantity > stack_max)
8303 split_quantity_new = stack_max;
8304 else
8305 split_quantity_new = quantity;
8306
8308 {
8310
8311 if (new_item)
8312 {
8313 new_item.SetResultOfSplit(true);
8314 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8316 new_item.
SetQuantity(split_quantity_new,
false,
true);
8317 }
8318
8319 return new_item;
8320 }
8321 }
8322
8323 return null;
8324 }
8325
8327 {
8329 float split_quantity_new;
8331 if (destination_entity)
8332 {
8334 if (quantity > stackable)
8335 split_quantity_new = stackable;
8336 else
8337 split_quantity_new = quantity;
8338
8340 {
8341 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8342 if (new_item)
8343 {
8344 new_item.SetResultOfSplit(true);
8345 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8347 new_item.
SetQuantity(split_quantity_new,
false,
true);
8348 }
8349 }
8350 }
8351 }
8352
8354 {
8356 {
8357 if (ScriptInputUserData.CanStoreInputUserData())
8358 {
8359 ScriptInputUserData ctx = new ScriptInputUserData;
8364 ItemBase destination_entity =
this;
8365 ctx.
Write(destination_entity);
8369 }
8370 }
8371 else if (!
GetGame().IsMultiplayer())
8372 {
8374 }
8375 }
8376
8378 {
8380 float split_quantity_new;
8382 if (player)
8383 {
8385 if (quantity > stackable)
8386 split_quantity_new = stackable;
8387 else
8388 split_quantity_new = quantity;
8389
8391 {
8392 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8393 new_item =
ItemBase.Cast(in_hands);
8394 if (new_item)
8395 {
8396 new_item.SetResultOfSplit(true);
8397 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8399 new_item.SetQuantity(split_quantity_new, false, true);
8400 }
8401 }
8402 }
8403 }
8404
8406 {
8408 float split_quantity_new = Math.Floor(quantity * 0.5);
8409
8411 return;
8412
8414
8415 if (new_item)
8416 {
8417 if (new_item.GetQuantityMax() < split_quantity_new)
8418 {
8419 split_quantity_new = new_item.GetQuantityMax();
8420 }
8421
8422 new_item.SetResultOfSplit(true);
8423 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8424
8426 {
8429 }
8430 else
8431 {
8433 new_item.
SetQuantity(split_quantity_new,
false,
true);
8434 }
8435 }
8436 }
8437
8439 {
8441 float split_quantity_new = Math.Floor(quantity / 2);
8442
8444 return;
8445
8446 InventoryLocation invloc = new InventoryLocation;
8448
8450 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8451
8452 if (new_item)
8453 {
8454 if (new_item.GetQuantityMax() < split_quantity_new)
8455 {
8456 split_quantity_new = new_item.GetQuantityMax();
8457 }
8459 {
8462 }
8463 else if (split_quantity_new > 1)
8464 {
8466 new_item.
SetQuantity(split_quantity_new,
false,
true);
8467 }
8468 }
8469 }
8470
8473 {
8474 SetWeightDirty();
8476
8477 if (parent)
8478 parent.OnAttachmentQuantityChangedEx(this, delta);
8479
8481 {
8483 {
8485 }
8487 {
8488 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8490 }
8491 }
8492
8493 }
8494
8497 {
8498
8499 }
8500
8503 {
8505 }
8506
8508 {
8509 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8510
8512 {
8513 if (newLevel == GameConstants.STATE_RUINED)
8514 {
8516 EntityAI parent = GetHierarchyParent();
8517 if (parent && parent.IsFireplace())
8518 {
8519 CargoBase cargo = GetInventory().GetCargo();
8520 if (cargo)
8521 {
8523 {
8525 }
8526 }
8527 }
8528 }
8529
8531 {
8532
8534 return;
8535 }
8536
8537 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8538 {
8540 }
8541 }
8542 }
8543
8544
8546 {
8547 super.OnRightClick();
8548
8550 {
8552 {
8553 if (ScriptInputUserData.CanStoreInputUserData())
8554 {
8555 EntityAI root = GetHierarchyRoot();
8556 Man playerOwner = GetHierarchyRootPlayer();
8557 InventoryLocation dst = new InventoryLocation;
8558
8559
8560 if (!playerOwner && root && root == this)
8561 {
8563 }
8564 else
8565 {
8566
8567 GetInventory().GetCurrentInventoryLocation(dst);
8569 {
8572 {
8574 }
8575 else
8576 {
8578
8579
8580 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8581 {
8583 }
8584 else
8585 {
8586 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8587 }
8588 }
8589 }
8590 }
8591
8592 ScriptInputUserData ctx = new ScriptInputUserData;
8600 }
8601 }
8602 else if (!
GetGame().IsMultiplayer())
8603 {
8605 }
8606 }
8607 }
8608
8610 {
8611 if (root)
8612 {
8613 vector m4[4];
8614 root.GetTransform(m4);
8615 dst.SetGround(this, m4);
8616 }
8617 else
8618 {
8619 GetInventory().GetCurrentInventoryLocation(dst);
8620 }
8621 }
8622
8623 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8624 {
8625
8626 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8627 return false;
8628
8629 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8630 return false;
8631
8632
8634 return false;
8635
8636
8637 Magazine mag = Magazine.Cast(this);
8638 if (mag)
8639 {
8640 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8641 return false;
8642
8643 if (stack_max_limit)
8644 {
8645 Magazine other_mag = Magazine.Cast(other_item);
8646 if (other_item)
8647 {
8648 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8649 return false;
8650 }
8651
8652 }
8653 }
8654 else
8655 {
8656
8658 return false;
8659
8661 return false;
8662 }
8663
8664 PlayerBase player = null;
8665 if (CastTo(player, GetHierarchyRootPlayer()))
8666 {
8667 if (player.GetInventory().HasAttachment(this))
8668 return false;
8669
8670 if (player.IsItemsToDelete())
8671 return false;
8672 }
8673
8674 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8675 return false;
8676
8677 int slotID;
8679 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8680 return false;
8681
8682 return true;
8683 }
8684
8686 {
8688 }
8689
8691 {
8692 return m_IsResultOfSplit;
8693 }
8694
8696 {
8697 m_IsResultOfSplit = value;
8698 }
8699
8701 {
8703 }
8704
8706 {
8707 float other_item_quantity = other_item.GetQuantity();
8708 float this_free_space;
8709
8711
8713
8714 if (other_item_quantity > this_free_space)
8715 {
8716 return this_free_space;
8717 }
8718 else
8719 {
8720 return other_item_quantity;
8721 }
8722 }
8723
8725 {
8727 }
8728
8730 {
8732 return;
8733
8734 if (!IsMagazine() && other_item)
8735 {
8737 if (quantity_used != 0)
8738 {
8739 float hp1 = GetHealth01("","");
8740 float hp2 = other_item.GetHealth01("","");
8741 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8742 hpResult = hpResult / (
GetQuantity() + quantity_used);
8743
8744 hpResult *= GetMaxHealth();
8745 Math.Round(hpResult);
8746 SetHealth("", "Health", hpResult);
8747
8749 other_item.AddQuantity(-quantity_used);
8750 }
8751 }
8753 }
8754
8756 {
8757 #ifdef SERVER
8758 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8759 GetHierarchyParent().IncreaseLifetimeUp();
8760 #endif
8761 };
8762
8764 {
8765 PlayerBase p = PlayerBase.Cast(player);
8766
8767 array<int> recipesIds = p.m_Recipes;
8768 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8769 if (moduleRecipesManager)
8770 {
8771 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8772 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8773 }
8774
8775 for (int i = 0;i < recipesIds.Count(); i++)
8776 {
8777 int key = recipesIds.Get(i);
8778 string recipeName = moduleRecipesManager.GetRecipeName(key);
8780 }
8781 }
8782
8783
8784 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8785 {
8786 super.GetDebugActions(outputList);
8787
8788
8794
8795
8800
8805
8806
8810
8811
8813 {
8817 }
8818
8821
8822
8826
8828
8829 InventoryLocation loc = new InventoryLocation();
8830 GetInventory().GetCurrentInventoryLocation(loc);
8832 {
8833 if (Gizmo_IsSupported())
8836 }
8837
8839 }
8840
8841
8842
8843
8845 {
8846 super.OnAction(action_id, player, ctx);
8847
8849 {
8850 switch (action_id)
8851 {
8854 return true;
8857 return true;
8858 }
8859 }
8860
8862 {
8863 switch (action_id)
8864 {
8866 Delete();
8867 return true;
8868 }
8869 }
8870
8871 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8872 {
8873 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8874 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8875 PlayerBase p = PlayerBase.Cast(player);
8876 if (
EActions.RECIPES_RANGE_START < 1000)
8877 {
8878 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8879 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8880 }
8881 }
8882 #ifndef SERVER
8883 else if (action_id ==
EActions.WATCH_PLAYER)
8884 {
8885 PluginDeveloper.SetDeveloperItemClientEx(player);
8886 }
8887 #endif
8889 {
8890 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8891 {
8892 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8893 OnDebugButtonPressServer(id + 1);
8894 }
8895
8896 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8897 {
8898 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8900 }
8901
8902 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8903 {
8904 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8906 }
8907
8908 else if (action_id ==
EActions.ADD_QUANTITY)
8909 {
8910 if (IsMagazine())
8911 {
8912 Magazine mag = Magazine.Cast(this);
8913 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8914 }
8915 else
8916 {
8918 }
8919
8920 if (m_EM)
8921 {
8922 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8923 }
8924
8925 }
8926
8927 else if (action_id ==
EActions.REMOVE_QUANTITY)
8928 {
8929 if (IsMagazine())
8930 {
8931 Magazine mag2 = Magazine.Cast(this);
8932 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8933 }
8934 else
8935 {
8937 }
8938 if (m_EM)
8939 {
8940 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8941 }
8942
8943 }
8944
8945 else if (action_id ==
EActions.SET_QUANTITY_0)
8946 {
8948
8949 if (m_EM)
8950 {
8951 m_EM.SetEnergy(0);
8952 }
8953 }
8954
8955 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8956 {
8958
8959 if (m_EM)
8960 {
8961 m_EM.SetEnergy(m_EM.GetEnergyMax());
8962 }
8963 }
8964
8965 else if (action_id ==
EActions.ADD_HEALTH)
8966 {
8967 AddHealth("","",GetMaxHealth("","Health")/5);
8968 }
8969 else if (action_id ==
EActions.REMOVE_HEALTH)
8970 {
8971 AddHealth("","",-GetMaxHealth("","Health")/5);
8972 }
8973 else if (action_id ==
EActions.DESTROY_HEALTH)
8974 {
8975 SetHealth01("","",0);
8976 }
8977 else if (action_id ==
EActions.WATCH_ITEM)
8978 {
8980 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8981 #ifdef DEVELOPER
8982 SetDebugDeveloper_item(this);
8983 #endif
8984 }
8985
8986 else if (action_id ==
EActions.ADD_TEMPERATURE)
8987 {
8988 AddTemperature(20);
8989
8990 }
8991
8992 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8993 {
8994 AddTemperature(-20);
8995
8996 }
8997
8998 else if (action_id ==
EActions.FLIP_FROZEN)
8999 {
9000 SetFrozen(!GetIsFrozen());
9001
9002 }
9003
9004 else if (action_id ==
EActions.ADD_WETNESS)
9005 {
9007
9008 }
9009
9010 else if (action_id ==
EActions.REMOVE_WETNESS)
9011 {
9013
9014 }
9015
9016 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9017 {
9020
9021
9022 }
9023
9024 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9025 {
9028 }
9029
9030 else if (action_id ==
EActions.MAKE_SPECIAL)
9031 {
9032 auto debugParams = DebugSpawnParams.WithPlayer(player);
9033 OnDebugSpawnEx(debugParams);
9034 }
9035
9036 }
9037
9038
9039 return false;
9040 }
9041
9042
9043
9044
9048
9051
9052
9053
9055 {
9056 return false;
9057 }
9058
9059
9061 {
9062 return true;
9063 }
9064
9065
9067 {
9068 return true;
9069 }
9070
9071
9072
9074 {
9075 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9077 }
9078
9081 {
9082 return null;
9083 }
9084
9086 {
9087 return false;
9088 }
9089
9091 {
9092 return false;
9093 }
9094
9098
9099
9101 {
9102 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9103 return module_repairing.CanRepair(this, item_repair_kit);
9104 }
9105
9106
9107 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9108 {
9109 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9110 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9111 }
9112
9113
9115 {
9116
9117
9118
9119
9120
9121
9122
9123
9124 return 1;
9125 }
9126
9127
9128
9130 {
9132 }
9133
9134
9135
9137 {
9139 }
9140
9141
9150 {
9151 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9152
9153 if (player)
9154 {
9155 player.MessageStatus(text);
9156 }
9157 }
9158
9159
9168 {
9169 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9170
9171 if (player)
9172 {
9173 player.MessageAction(text);
9174 }
9175 }
9176
9177
9186 {
9187 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9188
9189 if (player)
9190 {
9191 player.MessageFriendly(text);
9192 }
9193 }
9194
9195
9204 {
9205 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9206
9207 if (player)
9208 {
9209 player.MessageImportant(text);
9210 }
9211 }
9212
9214 {
9215 return true;
9216 }
9217
9218
9219 override bool KindOf(
string tag)
9220 {
9221 bool found = false;
9222 string item_name = this.
GetType();
9225
9226 int array_size = item_tag_array.Count();
9227 for (int i = 0; i < array_size; i++)
9228 {
9229 if (item_tag_array.Get(i) == tag)
9230 {
9231 found = true;
9232 break;
9233 }
9234 }
9235 return found;
9236 }
9237
9238
9240 {
9241
9242 super.OnRPC(sender, rpc_type,ctx);
9243
9244
9245 switch (rpc_type)
9246 {
9247 #ifndef SERVER
9248 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9249 Param2<bool, string> p = new Param2<bool, string>(false, "");
9250
9252 return;
9253
9254 bool play = p.param1;
9255 string soundSet = p.param2;
9256
9257 if (play)
9258 {
9260 {
9262 {
9264 }
9265 }
9266 else
9267 {
9269 }
9270 }
9271 else
9272 {
9274 }
9275
9276 break;
9277 #endif
9278
9279 }
9280
9282 {
9284 }
9285 }
9286
9287
9288
9289
9291 {
9292 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9293 return plugin.GetID(
name);
9294 }
9295
9297 {
9298 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9299 return plugin.GetName(id);
9300 }
9301
9304 {
9305
9306
9307 int varFlags;
9308 if (!ctx.
Read(varFlags))
9309 return;
9310
9311 if (varFlags & ItemVariableFlags.FLOAT)
9312 {
9314 }
9315 }
9316
9318 {
9319
9320 super.SerializeNumericalVars(floats_out);
9321
9322
9323
9325 {
9327 }
9328
9330 {
9332 }
9333
9335 {
9337 }
9338
9340 {
9345 }
9346
9348 {
9350 }
9351 }
9352
9354 {
9355
9356 super.DeSerializeNumericalVars(floats);
9357
9358
9359 int index = 0;
9360 int mask = Math.Round(floats.Get(index));
9361
9362 index++;
9363
9365 {
9367 {
9369 }
9370 else
9371 {
9372 float quantity = floats.Get(index);
9374 }
9375 index++;
9376 }
9377
9379 {
9380 float wet = floats.Get(index);
9382 index++;
9383 }
9384
9386 {
9387 int liquidtype = Math.Round(floats.Get(index));
9389 index++;
9390 }
9391
9393 {
9395 index++;
9397 index++;
9399 index++;
9401 index++;
9402 }
9403
9405 {
9406 int cleanness = Math.Round(floats.Get(index));
9408 index++;
9409 }
9410 }
9411
9413 {
9414 super.WriteVarsToCTX(ctx);
9415
9416
9418 {
9420 }
9421
9423 {
9425 }
9426
9428 {
9430 }
9431
9433 {
9434 int r,g,b,a;
9440 }
9441
9443 {
9445 }
9446 }
9447
9449 {
9450 if (!super.ReadVarsFromCTX(ctx,version))
9451 return false;
9452
9453 int intValue;
9454 float value;
9455
9456 if (version < 140)
9457 {
9458 if (!ctx.
Read(intValue))
9459 return false;
9460
9461 m_VariablesMask = intValue;
9462 }
9463
9465 {
9466 if (!ctx.
Read(value))
9467 return false;
9468
9470 {
9472 }
9473 else
9474 {
9476 }
9477 }
9478
9479 if (version < 140)
9480 {
9482 {
9483 if (!ctx.
Read(value))
9484 return false;
9485 SetTemperatureDirect(value);
9486 }
9487 }
9488
9490 {
9491 if (!ctx.
Read(value))
9492 return false;
9494 }
9495
9497 {
9498 if (!ctx.
Read(intValue))
9499 return false;
9501 }
9502
9504 {
9505 int r,g,b,a;
9507 return false;
9509 return false;
9511 return false;
9513 return false;
9514
9516 }
9517
9519 {
9520 if (!ctx.
Read(intValue))
9521 return false;
9523 }
9524
9525 if (version >= 138 && version < 140)
9526 {
9528 {
9529 if (!ctx.
Read(intValue))
9530 return false;
9531 SetFrozen(intValue);
9532 }
9533 }
9534
9535 return true;
9536 }
9537
9538
9540 {
9543 {
9545 }
9546
9547 if (!super.OnStoreLoad(ctx, version))
9548 {
9550 return false;
9551 }
9552
9553 if (version >= 114)
9554 {
9555 bool hasQuickBarIndexSaved;
9556
9557 if (!ctx.
Read(hasQuickBarIndexSaved))
9558 {
9560 return false;
9561 }
9562
9563 if (hasQuickBarIndexSaved)
9564 {
9565 int itmQBIndex;
9566
9567
9568 if (!ctx.
Read(itmQBIndex))
9569 {
9571 return false;
9572 }
9573
9574 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9575 if (itmQBIndex != -1 && parentPlayer)
9576 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9577 }
9578 }
9579 else
9580 {
9581
9582 PlayerBase player;
9583 int itemQBIndex;
9584 if (version ==
int.
MAX)
9585 {
9586 if (!ctx.
Read(itemQBIndex))
9587 {
9589 return false;
9590 }
9591 }
9592 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9593 {
9594
9595 if (!ctx.
Read(itemQBIndex))
9596 {
9598 return false;
9599 }
9600 if (itemQBIndex != -1 && player)
9601 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9602 }
9603 }
9604
9605 if (version < 140)
9606 {
9607
9608 if (!LoadVariables(ctx, version))
9609 {
9611 return false;
9612 }
9613 }
9614
9615
9617 {
9619 return false;
9620 }
9621 if (version >= 132)
9622 {
9624 if (raib)
9625 {
9627 {
9629 return false;
9630 }
9631 }
9632 }
9633
9635 return true;
9636 }
9637
9638
9639
9641 {
9642 super.OnStoreSave(ctx);
9643
9644 PlayerBase player;
9645 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9646 {
9648
9649 int itemQBIndex = -1;
9650 itemQBIndex = player.FindQuickBarEntityIndex(this);
9651 ctx.
Write(itemQBIndex);
9652 }
9653 else
9654 {
9656 }
9657
9659
9661 if (raib)
9662 {
9664 }
9665 }
9666
9667
9669 {
9670 super.AfterStoreLoad();
9671
9673 {
9675 }
9676
9678 {
9681 }
9682 }
9683
9685 {
9686 super.EEOnAfterLoad();
9687
9689 {
9691 }
9692
9695 }
9696
9698 {
9699 return false;
9700 }
9701
9702
9703
9705 {
9707 {
9708 #ifdef PLATFORM_CONSOLE
9709
9711 {
9713 if (menu)
9714 {
9716 }
9717 }
9718 #endif
9719 }
9720
9722 {
9725 }
9726
9728 {
9729 SetWeightDirty();
9731 }
9733 {
9736 }
9737
9739 {
9742 }
9744 {
9747 }
9748
9749 super.OnVariablesSynchronized();
9750 }
9751
9752
9753
9755 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9756 {
9757 if (!IsServerCheck(allow_client))
9758 return false;
9759
9761 return false;
9762
9765
9766 if (value <= (min + 0.001))
9767 value = min;
9768
9769 if (value == min)
9770 {
9771 if (destroy_config)
9772 {
9773 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9774 if (dstr)
9775 {
9777 this.Delete();
9778 return true;
9779 }
9780 }
9781 else if (destroy_forced)
9782 {
9784 this.Delete();
9785 return true;
9786 }
9787
9789 }
9790
9793
9795 {
9797
9798 if (delta)
9800 }
9801
9803
9804 return false;
9805 }
9806
9807
9809 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9810 {
9812 }
9813
9815 {
9818 }
9819
9821 {
9824 }
9825
9827 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9828 {
9829 float value_clamped = Math.Clamp(value, 0, 1);
9831 SetQuantity(result, destroy_config, destroy_forced);
9832 }
9833
9834
9837 {
9839 }
9840
9842 {
9844 }
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9856 {
9857 int slot = -1;
9858 if (GetInventory())
9859 {
9860 InventoryLocation il = new InventoryLocation;
9861 GetInventory().GetCurrentInventoryLocation(il);
9863 }
9864
9866 }
9867
9869 {
9870 float quantity_max = 0;
9871
9873 {
9874 if (attSlotID != -1)
9875 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9876
9877 if (quantity_max <= 0)
9879 }
9880
9881 if (quantity_max <= 0)
9883
9884 return quantity_max;
9885 }
9886
9888 {
9890 }
9891
9893 {
9895 }
9896
9897
9899 {
9901 }
9902
9904 {
9906 }
9907
9909 {
9911 }
9912
9913
9915 {
9916
9917 float weightEx = GetWeightEx();
9918 float special = GetInventoryAndCargoWeight();
9919 return weightEx - special;
9920 }
9921
9922
9924 {
9926 }
9927
9929 {
9931 {
9932 #ifdef DEVELOPER
9933 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9934 {
9935 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9937 }
9938 #endif
9939
9941 }
9942 else if (HasEnergyManager())
9943 {
9944 #ifdef DEVELOPER
9945 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9946 {
9947 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9948 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9949 }
9950 #endif
9951 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9952 }
9953 else
9954 {
9955 #ifdef DEVELOPER
9956 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9957 {
9958 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9959 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9960 }
9961 #endif
9962 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9963 }
9964 }
9965
9968 {
9969 int item_count = 0;
9971
9972 if (GetInventory().GetCargo() != NULL)
9973 {
9974 item_count = GetInventory().GetCargo().GetItemCount();
9975 }
9976
9977 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9978 {
9979 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9980 if (item)
9981 item_count += item.GetNumberOfItems();
9982 }
9983 return item_count;
9984 }
9985
9988 {
9989 float weight = 0;
9990 float wetness = 1;
9991 if (include_wetness)
9994 {
9995 weight = wetness * m_ConfigWeight;
9996 }
9998 {
9999 weight = 1;
10000 }
10001 return weight;
10002 }
10003
10004
10005
10007 {
10008 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
10009 {
10010 GameInventory inv = GetInventory();
10011 array<EntityAI> items = new array<EntityAI>;
10013 for (int i = 0; i < items.Count(); i++)
10014 {
10016 if (item)
10017 {
10019 }
10020 }
10021 }
10022 }
10023
10024
10025
10026
10028 {
10029 float energy = 0;
10030 if (HasEnergyManager())
10031 {
10032 energy = GetCompEM().GetEnergy();
10033 }
10034 return energy;
10035 }
10036
10037
10039 {
10040 super.OnEnergyConsumed();
10041
10043 }
10044
10046 {
10047 super.OnEnergyAdded();
10048
10050 }
10051
10052
10054 {
10055 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10056 {
10058 {
10059 float energy_0to1 = GetCompEM().GetEnergy0To1();
10061 }
10062 }
10063 }
10064
10065
10067 {
10068 return ConfigGetFloat("heatIsolation");
10069 }
10070
10072 {
10074 }
10075
10077 {
10078 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10079 if (
GetGame().ConfigIsExisting(paramPath))
10081
10082 return 0.0;
10083 }
10084
10086 {
10087 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10088 if (
GetGame().ConfigIsExisting(paramPath))
10090
10091 return 0.0;
10092 }
10093
10094 override void SetWet(
float value,
bool allow_client =
false)
10095 {
10096 if (!IsServerCheck(allow_client))
10097 return;
10098
10101
10103
10104 m_VarWet = Math.Clamp(value, min, max);
10105
10107 {
10110 }
10111 }
10112
10113 override void AddWet(
float value)
10114 {
10116 }
10117
10119 {
10121 }
10122
10124 {
10126 }
10127
10129 {
10131 }
10132
10134 {
10136 }
10137
10139 {
10141 }
10142
10143 override void OnWetChanged(
float newVal,
float oldVal)
10144 {
10147 if (newLevel != oldLevel)
10148 {
10150 }
10151 }
10152
10154 {
10155 SetWeightDirty();
10156 }
10157
10159 {
10160 return GetWetLevelInternal(
m_VarWet);
10161 }
10162
10163
10164
10166 {
10168 }
10169
10171 {
10173 }
10174
10176 {
10178 }
10179
10181 {
10183 }
10184
10185
10186
10188 {
10189 if (ConfigIsExisting("itemModelLength"))
10190 {
10191 return ConfigGetFloat("itemModelLength");
10192 }
10193 return 0;
10194 }
10195
10197 {
10198 if (ConfigIsExisting("itemAttachOffset"))
10199 {
10200 return ConfigGetFloat("itemAttachOffset");
10201 }
10202 return 0;
10203 }
10204
10205 override void SetCleanness(
int value,
bool allow_client =
false)
10206 {
10207 if (!IsServerCheck(allow_client))
10208 return;
10209
10211
10213
10216 }
10217
10219 {
10221 }
10222
10224 {
10225 return true;
10226 }
10227
10228
10229
10230
10232 {
10234 }
10235
10237 {
10239 }
10240
10241
10242
10243
10244 override void SetColor(
int r,
int g,
int b,
int a)
10245 {
10251 }
10253 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10254 {
10259 }
10260
10262 {
10264 }
10265
10268 {
10269 int r,g,b,a;
10271 r = r/255;
10272 g = g/255;
10273 b = b/255;
10274 a = a/255;
10275 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10276 }
10277
10278
10279
10280 override void SetLiquidType(
int value,
bool allow_client =
false)
10281 {
10282 if (!IsServerCheck(allow_client))
10283 return;
10284
10289 }
10290
10292 {
10293 return ConfigGetInt("varLiquidTypeInit");
10294 }
10295
10297 {
10299 }
10300
10302 {
10304 SetFrozen(false);
10305 }
10306
10309 {
10310 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10311 }
10312
10313
10316 {
10317 PlayerBase nplayer;
10318 if (PlayerBase.CastTo(nplayer, player))
10319 {
10321
10322 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10323 }
10324 }
10325
10326
10329 {
10330 PlayerBase nplayer;
10331 if (PlayerBase.CastTo(nplayer,player))
10332 {
10333
10334 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10335
10336 }
10337
10338
10339 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10340
10341
10342 if (HasEnergyManager())
10343 {
10344 GetCompEM().UpdatePlugState();
10345 }
10346 }
10347
10348
10350 {
10351 super.OnPlacementStarted(player);
10352
10354 }
10355
10356 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10357 {
10359 {
10360 m_AdminLog.OnPlacementComplete(player,
this);
10361 }
10362
10363 super.OnPlacementComplete(player, position, orientation);
10364 }
10365
10366
10367
10368
10369
10371 {
10373 {
10374 return true;
10375 }
10376 else
10377 {
10378 return false;
10379 }
10380 }
10381
10382
10384 {
10386 {
10388 }
10389 }
10390
10391
10393 {
10395 }
10396
10398 {
10400 }
10401
10402 override void InsertAgent(
int agent,
float count = 1)
10403 {
10404 if (count < 1)
10405 return;
10406
10408 }
10409
10412 {
10414 }
10415
10416
10418 {
10420 }
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10437
10438
10439
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10461
10462
10464 {
10466 return false;
10467 return true;
10468 }
10469
10471 {
10472
10474 }
10475
10476
10479 {
10480 super.CheckForRoofLimited(timeTresholdMS);
10481
10483 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10484 {
10485 m_PreviousRoofTestTime = time;
10486 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10487 }
10488 }
10489
10490
10492 {
10494 {
10495 return 0;
10496 }
10497
10498 if (GetInventory().GetAttachmentSlotsCount() != 0)
10499 {
10500 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10501 if (filter)
10502 return filter.GetProtectionLevel(type, false, system);
10503 else
10504 return 0;
10505 }
10506
10507 string subclassPath, entryName;
10508
10509 switch (type)
10510 {
10512 entryName = "biological";
10513 break;
10515 entryName = "chemical";
10516 break;
10517 default:
10518 entryName = "biological";
10519 break;
10520 }
10521
10522 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10523
10525 }
10526
10527
10528
10531 {
10532 if (!IsMagazine())
10534
10536 }
10537
10538
10539
10540
10541
10546 {
10547 return true;
10548 }
10549
10551 {
10553 }
10554
10555
10556
10557
10558
10560 {
10561 if (parent)
10562 {
10563 if (parent.IsInherited(DayZInfected))
10564 return true;
10565
10566 if (!parent.IsRuined())
10567 return true;
10568 }
10569
10570 return true;
10571 }
10572
10574 {
10575 if (!super.CanPutAsAttachment(parent))
10576 {
10577 return false;
10578 }
10579
10580 if (!IsRuined() && !parent.IsRuined())
10581 {
10582 return true;
10583 }
10584
10585 return false;
10586 }
10587
10589 {
10590
10591
10592
10593
10594 return super.CanReceiveItemIntoCargo(item);
10595 }
10596
10598 {
10599
10600
10601
10602
10603 GameInventory attachmentInv = attachment.GetInventory();
10605 {
10606 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10607 return false;
10608 }
10609
10610 InventoryLocation loc = new InventoryLocation();
10611 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10612 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10613 return false;
10614
10615 return super.CanReceiveAttachment(attachment, slotId);
10616 }
10617
10619 {
10620 if (!super.CanReleaseAttachment(attachment))
10621 return false;
10622
10623 return GetInventory().AreChildrenAccessible();
10624 }
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10647 {
10648 int id = muzzle_owner.GetMuzzleID();
10649 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10650
10651 if (WPOF_array)
10652 {
10653 for (int i = 0; i < WPOF_array.Count(); i++)
10654 {
10655 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10656
10657 if (WPOF)
10658 {
10659 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10660 }
10661 }
10662 }
10663 }
10664
10665
10667 {
10668 int id = muzzle_owner.GetMuzzleID();
10670
10671 if (WPOBE_array)
10672 {
10673 for (int i = 0; i < WPOBE_array.Count(); i++)
10674 {
10675 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10676
10677 if (WPOBE)
10678 {
10679 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10680 }
10681 }
10682 }
10683 }
10684
10685
10687 {
10688 int id = muzzle_owner.GetMuzzleID();
10689 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10690
10691 if (WPOOH_array)
10692 {
10693 for (int i = 0; i < WPOOH_array.Count(); i++)
10694 {
10695 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10696
10697 if (WPOOH)
10698 {
10699 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10700 }
10701 }
10702 }
10703 }
10704
10705
10707 {
10708 int id = muzzle_owner.GetMuzzleID();
10709 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10710
10711 if (WPOOH_array)
10712 {
10713 for (int i = 0; i < WPOOH_array.Count(); i++)
10714 {
10715 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10716
10717 if (WPOOH)
10718 {
10719 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10720 }
10721 }
10722 }
10723 }
10724
10725
10727 {
10728 int id = muzzle_owner.GetMuzzleID();
10729 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10730
10731 if (WPOOH_array)
10732 {
10733 for (int i = 0; i < WPOOH_array.Count(); i++)
10734 {
10735 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10736
10737 if (WPOOH)
10738 {
10739 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10740 }
10741 }
10742 }
10743 }
10744
10745
10746
10748 {
10750 {
10751 return true;
10752 }
10753
10754 return false;
10755 }
10756
10758 {
10760 {
10761 return true;
10762 }
10763
10764 return false;
10765 }
10766
10768 {
10770 {
10771 return true;
10772 }
10773
10774 return false;
10775 }
10776
10778 {
10779 return false;
10780 }
10781
10784 {
10785 return UATimeSpent.DEFAULT_DEPLOY;
10786 }
10787
10788
10789
10790
10792 {
10794 SetSynchDirty();
10795 }
10796
10798 {
10800 }
10801
10802
10804 {
10805 return false;
10806 }
10807
10810 {
10811 string att_type = "None";
10812
10813 if (ConfigIsExisting("soundAttType"))
10814 {
10815 att_type = ConfigGetString("soundAttType");
10816 }
10817
10819 }
10820
10822 {
10824 }
10825
10826
10827
10828
10829
10835
10837 {
10840
10842 }
10843
10844
10846 {
10848 return;
10849
10851
10854
10857
10858 SoundParameters params = new SoundParameters();
10862 }
10863
10864
10866 {
10868 return;
10869
10871 SetSynchDirty();
10872
10875 }
10876
10877
10879 {
10881 return;
10882
10884 SetSynchDirty();
10885
10888 }
10889
10891 {
10893 }
10894
10896 {
10898 }
10899
10902 {
10903 if (!
GetGame().IsDedicatedServer())
10904 {
10905 if (ConfigIsExisting("attachSoundSet"))
10906 {
10907 string cfg_path = "";
10908 string soundset = "";
10909 string type_name =
GetType();
10910
10913 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10914 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10915
10916 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10917 {
10918 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10919 {
10920 if (cfg_slot_array[i] == slot_type)
10921 {
10922 soundset = cfg_soundset_array[i];
10923 break;
10924 }
10925 }
10926 }
10927
10928 if (soundset != "")
10929 {
10930 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10932 }
10933 }
10934 }
10935 }
10936
10938 {
10939
10940 }
10941
10942 void OnApply(PlayerBase player);
10943
10945 {
10946 return 1.0;
10947 };
10948
10950 {
10952 }
10953
10955 {
10957 }
10958
10960
10962 {
10963 SetDynamicPhysicsLifeTime(0.01);
10965 }
10966
10968 {
10969 array<string> zone_names = new array<string>;
10970 GetDamageZones(zone_names);
10971 for (int i = 0; i < zone_names.Count(); i++)
10972 {
10973 SetHealthMax(zone_names.Get(i),"Health");
10974 }
10975 SetHealthMax("","Health");
10976 }
10977
10980 {
10981 float global_health = GetHealth01("","Health");
10982 array<string> zones = new array<string>;
10983 GetDamageZones(zones);
10984
10985 for (int i = 0; i < zones.Count(); i++)
10986 {
10987 SetHealth01(zones.Get(i),"Health",global_health);
10988 }
10989 }
10990
10993 {
10994 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10995 }
10996
10998 {
10999 if (!hasRootAsPlayer)
11000 {
11001 if (refParentIB)
11002 {
11003
11004 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11005 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11006
11007 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11008 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11009
11012 }
11013 else
11014 {
11015
11018 }
11019 }
11020 }
11021
11023 {
11025 {
11026 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11027 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11028 {
11029 float heatPermCoef = 1.0;
11031 while (ent)
11032 {
11033 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11034 ent = ent.GetHierarchyParent();
11035 }
11036
11037 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11038 }
11039 }
11040 }
11041
11043 {
11044
11045 EntityAI parent = GetHierarchyParent();
11046 if (!parent)
11047 {
11048 hasParent = false;
11049 hasRootAsPlayer = false;
11050 }
11051 else
11052 {
11053 hasParent = true;
11054 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11055 refParentIB =
ItemBase.Cast(parent);
11056 }
11057 }
11058
11059 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11060 {
11061
11062 }
11063
11065 {
11066
11067 return false;
11068 }
11069
11071 {
11072
11073
11074 return false;
11075 }
11076
11078 {
11079
11080 return false;
11081 }
11082
11085 {
11086 return !GetIsFrozen() &&
IsOpen();
11087 }
11088
11090 {
11091 bool hasParent = false, hasRootAsPlayer = false;
11093
11094 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11095 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11096
11097 if (wwtu || foodDecay)
11098 {
11102
11103 if (processWetness || processTemperature || processDecay)
11104 {
11106
11107 if (processWetness)
11108 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11109
11110 if (processTemperature)
11112
11113 if (processDecay)
11114 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11115 }
11116 }
11117 }
11118
11121 {
11123 }
11124
11126 {
11129
11130 return super.GetTemperatureFreezeThreshold();
11131 }
11132
11134 {
11137
11138 return super.GetTemperatureThawThreshold();
11139 }
11140
11142 {
11145
11146 return super.GetItemOverheatThreshold();
11147 }
11148
11150 {
11152 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11153
11154 return super.GetTemperatureFreezeTime();
11155 }
11156
11158 {
11160 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11161
11162 return super.GetTemperatureThawTime();
11163 }
11164
11169
11171 {
11172 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11173 }
11174
11176 {
11177 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11178 }
11179
11182 {
11184 }
11185
11187 {
11189 }
11190
11192 {
11194 }
11195
11198 {
11199 return null;
11200 }
11201
11204 {
11205 return false;
11206 }
11207
11209 {
11211 {
11214 if (!trg)
11215 {
11217 explosive = this;
11218 }
11219
11220 explosive.PairRemote(trg);
11222
11223 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11224 trg.SetPersistentPairID(persistentID);
11225 explosive.SetPersistentPairID(persistentID);
11226
11227 return true;
11228 }
11229 return false;
11230 }
11231
11234 {
11235 float ret = 1.0;
11238 ret *= GetHealth01();
11239
11240 return ret;
11241 }
11242
11243 #ifdef DEVELOPER
11244 override void SetDebugItem()
11245 {
11246 super.SetDebugItem();
11247 _itemBase = this;
11248 }
11249
11251 {
11252 string text = super.GetDebugText();
11253
11255 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11256
11257 return text;
11258 }
11259 #endif
11260
11262 {
11263 return true;
11264 }
11265
11267
11269
11271 {
11274 }
11275
11276
11284
11300}
11301
11303{
11305 if (entity)
11306 {
11307 bool is_item = entity.IsInherited(
ItemBase);
11308 if (is_item && full_quantity)
11309 {
11312 }
11313 }
11314 else
11315 {
11317 return NULL;
11318 }
11319 return entity;
11320}
11321
11323{
11324 if (item)
11325 {
11326 if (health > 0)
11327 item.SetHealth("", "", health);
11328
11329 if (item.CanHaveTemperature())
11330 {
11332 if (item.CanFreeze())
11333 item.SetFrozen(false);
11334 }
11335
11336 if (item.HasEnergyManager())
11337 {
11338 if (quantity >= 0)
11339 {
11340 item.GetCompEM().SetEnergy0To1(quantity);
11341 }
11342 else
11343 {
11345 }
11346 }
11347 else if (item.IsMagazine())
11348 {
11349 Magazine mag = Magazine.Cast(item);
11350 if (quantity >= 0)
11351 {
11352 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11353 }
11354 else
11355 {
11357 }
11358
11359 }
11360 else
11361 {
11362 if (quantity >= 0)
11363 {
11364 item.SetQuantityNormalized(quantity, false);
11365 }
11366 else
11367 {
11369 }
11370
11371 }
11372 }
11373}
11374
11375#ifdef DEVELOPER
11377#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.