6424{
6426 {
6427 return true;
6428 }
6429};
6430
6431
6432
6434{
6438
6440
6443
6444
6445
6446
6447
6456
6462
6467
6472
6493 protected bool m_IsResultOfSplit
6494
6496
6501
6502
6503
6505
6509
6510
6511
6513
6516
6517
6518
6524
6525
6533
6536
6537
6539
6540
6542
6543
6548
6549
6554
6555
6557
6558
6560 {
6565
6566 if (!
GetGame().IsDedicatedServer())
6567 {
6569 {
6571
6573 {
6575 }
6576 }
6577
6580 }
6581
6582 m_OldLocation = null;
6583
6585 {
6587 }
6588
6589 if (ConfigIsExisting("headSelectionsToHide"))
6590 {
6593 }
6594
6596 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6597 {
6599 }
6600
6602
6603 m_IsResultOfSplit = false;
6604
6606 }
6607
6609 {
6610 super.InitItemVariables();
6611
6617 m_Count = ConfigGetInt(
"count");
6618
6621
6626
6629
6634
6646
6650
6651
6654 if (ConfigIsExisting("canBeSplit"))
6655 {
6658 }
6659
6661 if (ConfigIsExisting("itemBehaviour"))
6663
6664
6667 RegisterNetSyncVariableInt("m_VarLiquidType");
6668 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6669
6670 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6671 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6672 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6673
6674 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6675 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6676 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6677 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6678
6679 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6680 RegisterNetSyncVariableBool("m_IsTakeable");
6681 RegisterNetSyncVariableBool("m_IsHologram");
6682
6685 {
6688 }
6689
6691
6693 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6695
6696 }
6697
6699 {
6701 }
6702
6704 {
6707 {
6712 }
6713 }
6714
6715 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6716 {
6718 {
6721 }
6722
6724 }
6725
6727 {
6733 }
6734
6736
6738 {
6740
6741 if (!action)
6742 {
6743 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6744 return;
6745 }
6746
6748 if (!ai)
6749 {
6751 return;
6752 }
6753
6755 if (!action_array)
6756 {
6757 action_array = new array<ActionBase_Basic>;
6759 }
6760 if (LogManager.IsActionLogEnable())
6761 {
6762 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6763 }
6764
6765 if (action_array.Find(action) != -1)
6766 {
6767 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6768 }
6769 else
6770 {
6771 action_array.Insert(action);
6772 }
6773 }
6774
6776 {
6778 ActionBase action = player.GetActionManager().GetAction(actionName);
6781
6782 if (action_array)
6783 {
6784 action_array.RemoveItem(action);
6785 }
6786 }
6787
6788
6789
6791 {
6792 ActionOverrideData overrideData = new ActionOverrideData();
6796
6798 if (!actionMap)
6799 {
6802 }
6803
6804 actionMap.Insert(this.
Type(), overrideData);
6805
6806 }
6807
6809
6811
6812
6814 {
6817
6820
6821 string config_to_search = "CfgVehicles";
6822 string muzzle_owner_config;
6823
6825 {
6826 if (IsInherited(Weapon))
6827 config_to_search = "CfgWeapons";
6828
6829 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6830
6831 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6832
6834
6835 if (config_OnFire_subclass_count > 0)
6836 {
6837 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6838
6839 for (int i = 0; i < config_OnFire_subclass_count; i++)
6840 {
6841 string particle_class = "";
6843 string config_OnFire_entry = config_OnFire_class + particle_class;
6844 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6845 WPOF_array.Insert(WPOF);
6846 }
6847
6848
6850 }
6851 }
6852
6854 {
6855 config_to_search = "CfgWeapons";
6856 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6857
6858 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6859
6861
6862 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6863 {
6864 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6865
6866 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6867 {
6868 string particle_class2 = "";
6870 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6871 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6872 WPOBE_array.Insert(WPOBE);
6873 }
6874
6875
6877 }
6878 }
6879 }
6880
6881
6883 {
6886
6888 {
6889 string config_to_search = "CfgVehicles";
6890
6891 if (IsInherited(Weapon))
6892 config_to_search = "CfgWeapons";
6893
6894 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6895 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6896
6897 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6898 {
6899
6901
6903 {
6905 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6907 return;
6908 }
6909
6912
6913
6914
6916 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6917
6918 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6919 {
6920 string particle_class = "";
6922 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6924
6925 if (entry_type == CT_CLASS)
6926 {
6927 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6928 WPOOH_array.Insert(WPOF);
6929 }
6930 }
6931
6932
6934 }
6935 }
6936 }
6937
6939 {
6941 }
6942
6944 {
6946 {
6948
6951
6954
6955 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6956 }
6957 }
6958
6960 {
6962 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6963
6965 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6966
6968 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6969
6971 {
6973 }
6974 }
6975
6977 {
6979 }
6980
6982 {
6985 else
6987
6989 {
6992 }
6993 else
6994 {
6997
7000 }
7001
7003 }
7004
7006 {
7008 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7009 }
7010
7012 {
7014 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7016 }
7017
7019 {
7021 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7022 }
7023
7025 {
7028
7029 OverheatingParticle OP = new OverheatingParticle();
7034
7036 }
7037
7039 {
7042
7043 return -1;
7044 }
7045
7047 {
7049 {
7052
7053 for (int i = count; i > 0; --i)
7054 {
7055 int id = i - 1;
7058
7061
7062 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7063 {
7064 if (p)
7065 {
7068 }
7069 }
7070 }
7071 }
7072 }
7073
7075 {
7077 {
7079 {
7080 int id = i - 1;
7082
7083 if (OP)
7084 {
7086
7087 if (p)
7088 {
7090 }
7091
7092 delete OP;
7093 }
7094 }
7095
7098 }
7099 }
7100
7103 {
7104 return 0.0;
7105 }
7106
7107
7109 {
7110 return 250;
7111 }
7112
7114 {
7115 return 0;
7116 }
7117
7120 {
7122 return true;
7123
7124 return false;
7125 }
7126
7129 {
7132
7134 {
7136 }
7137 else
7138 {
7139
7141 }
7142
7144 }
7145
7152 {
7153 return -1;
7154 }
7155
7156
7157
7158
7160 {
7162 {
7164 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7165
7166 if (r_index >= 0)
7167 {
7168 InventoryLocation r_il = new InventoryLocation;
7169 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7170
7171 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7174 {
7175 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7176 }
7178 {
7179 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7180 }
7181
7182 }
7183
7184 player.GetHumanInventory().ClearUserReservedLocation(this);
7185 }
7186
7189 }
7190
7191
7192
7193
7195 {
7196 return ItemBase.m_DebugActionsMask;
7197 }
7198
7200 {
7201 return ItemBase.m_DebugActionsMask & mask;
7202 }
7203
7205 {
7206 ItemBase.m_DebugActionsMask = mask;
7207 }
7208
7210 {
7211 ItemBase.m_DebugActionsMask |= mask;
7212 }
7213
7215 {
7216 ItemBase.m_DebugActionsMask &= ~mask;
7217 }
7218
7220 {
7222 {
7224 }
7225 else
7226 {
7228 }
7229 }
7230
7231
7233 {
7234 if (GetEconomyProfile())
7235 {
7236 float q_max = GetEconomyProfile().GetQuantityMax();
7237 if (q_max > 0)
7238 {
7239 float q_min = GetEconomyProfile().GetQuantityMin();
7240 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7241
7243 {
7244 ComponentEnergyManager comp = GetCompEM();
7246 {
7248 }
7249 }
7251 {
7253
7254 }
7255
7256 }
7257 }
7258 }
7259
7262 {
7263 EntityAI parent = GetHierarchyParent();
7264
7265 if (parent)
7266 {
7267 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7268 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7269 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7270 }
7271 }
7272
7275 {
7276 EntityAI parent = GetHierarchyParent();
7277
7278 if (parent)
7279 {
7280 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7281 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7282 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7283 }
7284 }
7285
7287 {
7288
7289
7290
7291
7293
7295 {
7296 if (ScriptInputUserData.CanStoreInputUserData())
7297 {
7298 ScriptInputUserData ctx = new ScriptInputUserData;
7304 ctx.
Write(use_stack_max);
7307
7309 {
7310 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7311 }
7312 }
7313 }
7314 else if (!
GetGame().IsMultiplayer())
7315 {
7317 }
7318 }
7319
7321 {
7323 }
7324
7326 {
7328 }
7329
7331 {
7333 }
7334
7336 {
7337
7338 return false;
7339 }
7340
7342 {
7343 return false;
7344 }
7345
7349 {
7350 return false;
7351 }
7352
7354 {
7355 return "";
7356 }
7357
7359
7361 {
7362 return false;
7363 }
7364
7366 {
7367 return true;
7368 }
7369
7370
7371
7373 {
7374 return true;
7375 }
7376
7378 {
7379 return true;
7380 }
7381
7383 {
7384 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7386 }
7387
7389 {
7391 }
7392
7394 {
7396 if (!is_being_placed)
7398 SetSynchDirty();
7399 }
7400
7401
7403
7405 {
7407 }
7408
7410 {
7412 }
7413
7415 {
7416 return 1;
7417 }
7418
7420 {
7421 return false;
7422 }
7423
7425 {
7427 SetSynchDirty();
7428 }
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7465 {
7466 super.OnMovedInsideCargo(container);
7467
7468 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7469 }
7470
7471 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7472 {
7473 super.EEItemLocationChanged(oldLoc,newLoc);
7474
7475 PlayerBase new_player = null;
7476 PlayerBase old_player = null;
7477
7478 if (newLoc.GetParent())
7479 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7480
7481 if (oldLoc.GetParent())
7482 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7483
7485 {
7486 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
7487
7488 if (r_index >= 0)
7489 {
7490 InventoryLocation r_il = new InventoryLocation;
7491 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7492
7493 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7496 {
7497 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7498 }
7500 {
7501 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7502 }
7503
7504 }
7505 }
7506
7508 {
7509 if (new_player)
7510 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
7511
7512 if (new_player == old_player)
7513 {
7514
7515 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7516 {
7518 {
7519 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7520 {
7521 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7522 }
7523 }
7524 else
7525 {
7526 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7527 }
7528 }
7529
7530 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7531 {
7532 int type = oldLoc.GetType();
7534 {
7535 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7536 }
7538 {
7539 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7540 }
7541 }
7542 if (!m_OldLocation)
7543 {
7544 m_OldLocation = new InventoryLocation;
7545 }
7546 m_OldLocation.Copy(oldLoc);
7547 }
7548 else
7549 {
7550 if (m_OldLocation)
7551 {
7552 m_OldLocation.Reset();
7553 }
7554 }
7555
7557 }
7558 else
7559 {
7560 if (new_player)
7561 {
7562 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7563 if (res_index >= 0)
7564 {
7565 InventoryLocation il = new InventoryLocation;
7566 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
7568 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
7571 {
7572 il.
GetParent().GetOnReleaseLock().Invoke(it);
7573 }
7575 {
7577 }
7578
7579 }
7580 }
7582 {
7583
7585 }
7586
7587 if (m_OldLocation)
7588 {
7589 m_OldLocation.Reset();
7590 }
7591 }
7592 }
7593
7594 override void EOnContact(IEntity other, Contact extra)
7595 {
7597 {
7598 int liquidType = -1;
7600 if (impactSpeed > 0.0)
7601 {
7603 #ifndef SERVER
7605 #else
7607 SetSynchDirty();
7608 #endif
7610 }
7611 }
7612
7613 #ifdef SERVER
7614 if (GetCompEM() && GetCompEM().IsPlugged())
7615 {
7616 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7617 GetCompEM().UnplugThis();
7618 }
7619 #endif
7620 }
7621
7623
7625 {
7627 }
7628
7630 {
7631
7632 }
7633
7635 {
7636 super.OnItemLocationChanged(old_owner, new_owner);
7637
7638 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7639 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7640
7641 if (!relatedPlayer && playerNew)
7642 relatedPlayer = playerNew;
7643
7644 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7645 {
7647 if (actionMgr)
7648 {
7649 ActionBase currentAction = actionMgr.GetRunningAction();
7650 if (currentAction)
7652 }
7653 }
7654
7655 Man ownerPlayerOld = null;
7656 Man ownerPlayerNew = null;
7657
7658 if (old_owner)
7659 {
7660 if (old_owner.
IsMan())
7661 {
7662 ownerPlayerOld = Man.Cast(old_owner);
7663 }
7664 else
7665 {
7666 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7667 }
7668 }
7669 else
7670 {
7672 {
7674
7675 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7676 {
7677 GetCompEM().UnplugThis();
7678 }
7679 }
7680 }
7681
7682 if (new_owner)
7683 {
7684 if (new_owner.
IsMan())
7685 {
7686 ownerPlayerNew = Man.Cast(new_owner);
7687 }
7688 else
7689 {
7690 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7691 }
7692 }
7693
7694 if (ownerPlayerOld != ownerPlayerNew)
7695 {
7696 if (ownerPlayerOld)
7697 {
7698 array<EntityAI> subItemsExit = new array<EntityAI>;
7700 for (int i = 0; i < subItemsExit.Count(); i++)
7701 {
7704 }
7705 }
7706
7707 if (ownerPlayerNew)
7708 {
7709 array<EntityAI> subItemsEnter = new array<EntityAI>;
7711 for (int j = 0; j < subItemsEnter.Count(); j++)
7712 {
7715 }
7716 }
7717 }
7718 else if (ownerPlayerNew != null)
7719 {
7720 PlayerBase nplayer;
7721 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7722 {
7723 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7725 for (int k = 0; k < subItemsUpdate.Count(); k++)
7726 {
7728 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7729 }
7730 }
7731 }
7732
7733 if (old_owner)
7734 old_owner.OnChildItemRemoved(this);
7735 if (new_owner)
7736 new_owner.OnChildItemReceived(this);
7737 }
7738
7739
7741 {
7742 super.EEDelete(parent);
7743 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7744 if (player)
7745 {
7747
7748 if (player.IsAlive())
7749 {
7750 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7751 if (r_index >= 0)
7752 {
7753 InventoryLocation r_il = new InventoryLocation;
7754 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7755
7756 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7759 {
7760 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7761 }
7763 {
7764 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7765 }
7766
7767 }
7768
7769 player.RemoveQuickBarEntityShortcut(this);
7770 }
7771 }
7772 }
7773
7775 {
7776 super.EEKilled(killer);
7777
7780 {
7781 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7782 {
7783 if (IsMagazine())
7784 {
7785 if (Magazine.Cast(this).GetAmmoCount() > 0)
7786 {
7788 }
7789 }
7790 else
7791 {
7793 }
7794 }
7795 }
7796 }
7797
7799 {
7800 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7801
7802 super.OnWasAttached(parent, slot_id);
7803
7806
7808 }
7809
7811 {
7812 super.OnWasDetached(parent, slot_id);
7813
7816 }
7817
7819 {
7820 int idx;
7823
7824 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7825 if (inventory_slots.Count() < 1)
7826 {
7827 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7828 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7829 }
7830 else
7831 {
7832 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7833 }
7834
7835 idx = inventory_slots.Find(slot);
7836 if (idx < 0)
7837 return "";
7838
7839 return attach_types.Get(idx);
7840 }
7841
7843 {
7844 int idx = -1;
7845 string slot;
7846
7849
7850 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7851 if (inventory_slots.Count() < 1)
7852 {
7853 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7854 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7855 }
7856 else
7857 {
7858 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7859 if (detach_types.Count() < 1)
7860 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7861 }
7862
7863 for (int i = 0; i < inventory_slots.Count(); i++)
7864 {
7865 slot = inventory_slots.Get(i);
7866 }
7867
7868 if (slot != "")
7869 {
7870 if (detach_types.Count() == 1)
7871 idx = 0;
7872 else
7873 idx = inventory_slots.Find(slot);
7874 }
7875 if (idx < 0)
7876 return "";
7877
7878 return detach_types.Get(idx);
7879 }
7880
7882 {
7883
7885
7886
7887 float min_time = 1;
7888 float max_time = 3;
7889 float delay = Math.RandomFloat(min_time, max_time);
7890
7891 explode_timer.Run(delay, this, "DoAmmoExplosion");
7892 }
7893
7895 {
7896 Magazine magazine = Magazine.Cast(this);
7897 int pop_sounds_count = 6;
7898 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7899
7900
7901 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7902 string sound_name = pop_sounds[ sound_idx ];
7904
7905
7906 magazine.ServerAddAmmoCount(-1);
7907
7908
7909 float min_temp_to_explode = 100;
7910
7911 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7912 {
7914 }
7915 }
7916
7917
7918 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7919 {
7920 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7921
7922 const int CHANCE_DAMAGE_CARGO = 4;
7923 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7924 const int CHANCE_DAMAGE_NOTHING = 2;
7925
7927 {
7928 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7929 int chances;
7930 int rnd;
7931
7932 if (GetInventory().GetCargo())
7933 {
7934 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7935 rnd = Math.RandomInt(0,chances);
7936
7937 if (rnd < CHANCE_DAMAGE_CARGO)
7938 {
7940 }
7941 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7942 {
7944 }
7945 }
7946 else
7947 {
7948 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7949 rnd = Math.RandomInt(0,chances);
7950
7951 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7952 {
7954 }
7955 }
7956 }
7957 }
7958
7960 {
7961 if (GetInventory().GetCargo())
7962 {
7963 int item_count = GetInventory().GetCargo().GetItemCount();
7964 if (item_count > 0)
7965 {
7966 int random_pick = Math.RandomInt(0, item_count);
7968 if (!item.IsExplosive())
7969 {
7970 item.AddHealth("","",damage);
7971 return true;
7972 }
7973 }
7974 }
7975 return false;
7976 }
7977
7979 {
7980 int attachment_count = GetInventory().AttachmentCount();
7981 if (attachment_count > 0)
7982 {
7983 int random_pick = Math.RandomInt(0, attachment_count);
7984 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7985 if (!attachment.IsExplosive())
7986 {
7987 attachment.AddHealth("","",damage);
7988 return true;
7989 }
7990 }
7991 return false;
7992 }
7993
7995 {
7997 }
7998
8000 {
8002 return GetInventory().CanRemoveEntity();
8003
8004 return false;
8005 }
8006
8008 {
8009
8011 return false;
8012
8013
8015 return false;
8016
8017
8018
8020 if (delta == 0)
8021 return false;
8022
8023
8024 return true;
8025 }
8026
8028 {
8030 {
8031 if (ScriptInputUserData.CanStoreInputUserData())
8032 {
8033 ScriptInputUserData ctx = new ScriptInputUserData;
8038 ctx.
Write(destination_entity);
8042 }
8043 }
8044 else if (!
GetGame().IsMultiplayer())
8045 {
8047 }
8048 }
8049
8051 {
8052 float split_quantity_new;
8056 InventoryLocation loc = new InventoryLocation;
8057
8058 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8059 {
8061 split_quantity_new = stack_max;
8062 else
8064
8066 {
8067 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8068 if (new_item)
8069 {
8070 new_item.SetResultOfSplit(true);
8071 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8073 new_item.
SetQuantity(split_quantity_new,
false,
true);
8074 }
8075 }
8076 }
8077 else if (destination_entity && slot_id == -1)
8078 {
8079 if (quantity > stack_max)
8080 split_quantity_new = stack_max;
8081 else
8082 split_quantity_new = quantity;
8083
8085 {
8087 {
8090 }
8091
8092 if (new_item)
8093 {
8094 new_item.SetResultOfSplit(true);
8095 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8097 new_item.
SetQuantity(split_quantity_new,
false,
true);
8098 }
8099 }
8100 }
8101 else
8102 {
8103 if (stack_max != 0)
8104 {
8106 {
8108 }
8109
8110 if (split_quantity_new == 0)
8111 {
8112 if (!
GetGame().IsMultiplayer())
8113 player.PhysicalPredictiveDropItem(this);
8114 else
8115 player.ServerDropEntity(this);
8116 return;
8117 }
8118
8120 {
8122
8123 if (new_item)
8124 {
8125 new_item.SetResultOfSplit(true);
8126 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8129 new_item.PlaceOnSurface();
8130 }
8131 }
8132 }
8133 }
8134 }
8135
8137 {
8138 float split_quantity_new;
8142 InventoryLocation loc = new InventoryLocation;
8143
8144 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8145 {
8147 split_quantity_new = stack_max;
8148 else
8150
8152 {
8153 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8154 if (new_item)
8155 {
8156 new_item.SetResultOfSplit(true);
8157 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8159 new_item.
SetQuantity(split_quantity_new,
false,
true);
8160 }
8161 }
8162 }
8163 else if (destination_entity && slot_id == -1)
8164 {
8165 if (quantity > stack_max)
8166 split_quantity_new = stack_max;
8167 else
8168 split_quantity_new = quantity;
8169
8171 {
8173 {
8176 }
8177
8178 if (new_item)
8179 {
8180 new_item.SetResultOfSplit(true);
8181 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8183 new_item.
SetQuantity(split_quantity_new,
false,
true);
8184 }
8185 }
8186 }
8187 else
8188 {
8189 if (stack_max != 0)
8190 {
8192 {
8194 }
8195
8197 {
8199
8200 if (new_item)
8201 {
8202 new_item.SetResultOfSplit(true);
8203 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8206 new_item.PlaceOnSurface();
8207 }
8208 }
8209 }
8210 }
8211 }
8212
8214 {
8216 {
8217 if (ScriptInputUserData.CanStoreInputUserData())
8218 {
8219 ScriptInputUserData ctx = new ScriptInputUserData;
8224 dst.WriteToContext(ctx);
8226 }
8227 }
8228 else if (!
GetGame().IsMultiplayer())
8229 {
8231 }
8232 }
8233
8235 {
8237 {
8238 if (ScriptInputUserData.CanStoreInputUserData())
8239 {
8240 ScriptInputUserData ctx = new ScriptInputUserData;
8245 ctx.
Write(destination_entity);
8251 }
8252 }
8253 else if (!
GetGame().IsMultiplayer())
8254 {
8256 }
8257 }
8258
8260 {
8262 }
8263
8265 {
8267 float split_quantity_new;
8269 if (dst.IsValid())
8270 {
8271 int slot_id = dst.GetSlot();
8273
8274 if (quantity > stack_max)
8275 split_quantity_new = stack_max;
8276 else
8277 split_quantity_new = quantity;
8278
8280 {
8282
8283 if (new_item)
8284 {
8285 new_item.SetResultOfSplit(true);
8286 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8288 new_item.
SetQuantity(split_quantity_new,
false,
true);
8289 }
8290
8291 return new_item;
8292 }
8293 }
8294
8295 return null;
8296 }
8297
8299 {
8301 float split_quantity_new;
8303 if (destination_entity)
8304 {
8306 if (quantity > stackable)
8307 split_quantity_new = stackable;
8308 else
8309 split_quantity_new = quantity;
8310
8312 {
8313 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8314 if (new_item)
8315 {
8316 new_item.SetResultOfSplit(true);
8317 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8319 new_item.
SetQuantity(split_quantity_new,
false,
true);
8320 }
8321 }
8322 }
8323 }
8324
8326 {
8328 {
8329 if (ScriptInputUserData.CanStoreInputUserData())
8330 {
8331 ScriptInputUserData ctx = new ScriptInputUserData;
8336 ItemBase destination_entity =
this;
8337 ctx.
Write(destination_entity);
8341 }
8342 }
8343 else if (!
GetGame().IsMultiplayer())
8344 {
8346 }
8347 }
8348
8350 {
8352 float split_quantity_new;
8354 if (player)
8355 {
8357 if (quantity > stackable)
8358 split_quantity_new = stackable;
8359 else
8360 split_quantity_new = quantity;
8361
8363 {
8364 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8365 new_item =
ItemBase.Cast(in_hands);
8366 if (new_item)
8367 {
8368 new_item.SetResultOfSplit(true);
8369 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8371 new_item.SetQuantity(split_quantity_new, false, true);
8372 }
8373 }
8374 }
8375 }
8376
8378 {
8380 float split_quantity_new = Math.Floor(quantity * 0.5);
8381
8383 return;
8384
8386
8387 if (new_item)
8388 {
8389 if (new_item.GetQuantityMax() < split_quantity_new)
8390 {
8391 split_quantity_new = new_item.GetQuantityMax();
8392 }
8393
8394 new_item.SetResultOfSplit(true);
8395 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8396
8398 {
8401 }
8402 else
8403 {
8405 new_item.
SetQuantity(split_quantity_new,
false,
true);
8406 }
8407 }
8408 }
8409
8411 {
8413 float split_quantity_new = Math.Floor(quantity / 2);
8414
8416 return;
8417
8418 InventoryLocation invloc = new InventoryLocation;
8420
8422 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8423
8424 if (new_item)
8425 {
8426 if (new_item.GetQuantityMax() < split_quantity_new)
8427 {
8428 split_quantity_new = new_item.GetQuantityMax();
8429 }
8431 {
8434 }
8435 else if (split_quantity_new > 1)
8436 {
8438 new_item.
SetQuantity(split_quantity_new,
false,
true);
8439 }
8440 }
8441 }
8442
8445 {
8446 SetWeightDirty();
8448
8449 if (parent)
8450 parent.OnAttachmentQuantityChangedEx(this, delta);
8451
8453 {
8455 {
8457 }
8459 {
8460 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8462 }
8463 }
8464
8465 }
8466
8469 {
8470
8471 }
8472
8475 {
8477 }
8478
8480 {
8481 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8482
8484 {
8485 if (newLevel == GameConstants.STATE_RUINED)
8486 {
8488 EntityAI parent = GetHierarchyParent();
8489 if (parent && parent.IsFireplace())
8490 {
8491 CargoBase cargo = GetInventory().GetCargo();
8492 if (cargo)
8493 {
8495 {
8497 }
8498 }
8499 }
8500 }
8501
8503 {
8504
8506 return;
8507 }
8508
8509 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8510 {
8512 }
8513 }
8514 }
8515
8516
8518 {
8519 super.OnRightClick();
8520
8522 {
8524 {
8525 if (ScriptInputUserData.CanStoreInputUserData())
8526 {
8527 EntityAI root = GetHierarchyRoot();
8528 Man playerOwner = GetHierarchyRootPlayer();
8529 InventoryLocation dst = new InventoryLocation;
8530
8531
8532 if (!playerOwner && root && root == this)
8533 {
8535 }
8536 else
8537 {
8538
8539 GetInventory().GetCurrentInventoryLocation(dst);
8541 {
8544 {
8546 }
8547 else
8548 {
8550
8551
8552 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8553 {
8555 }
8556 else
8557 {
8558 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8559 }
8560 }
8561 }
8562 }
8563
8564 ScriptInputUserData ctx = new ScriptInputUserData;
8572 }
8573 }
8574 else if (!
GetGame().IsMultiplayer())
8575 {
8577 }
8578 }
8579 }
8580
8582 {
8583 if (root)
8584 {
8585 vector m4[4];
8586 root.GetTransform(m4);
8587 dst.SetGround(this, m4);
8588 }
8589 else
8590 {
8591 GetInventory().GetCurrentInventoryLocation(dst);
8592 }
8593 }
8594
8595 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8596 {
8597
8598 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8599 return false;
8600
8601 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8602 return false;
8603
8604
8606 return false;
8607
8608
8609 Magazine mag = Magazine.Cast(this);
8610 if (mag)
8611 {
8612 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8613 return false;
8614
8615 if (stack_max_limit)
8616 {
8617 Magazine other_mag = Magazine.Cast(other_item);
8618 if (other_item)
8619 {
8620 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8621 return false;
8622 }
8623
8624 }
8625 }
8626 else
8627 {
8628
8630 return false;
8631
8633 return false;
8634 }
8635
8636 PlayerBase player = null;
8637 if (CastTo(player, GetHierarchyRootPlayer()))
8638 {
8639 if (player.GetInventory().HasAttachment(this))
8640 return false;
8641
8642 if (player.IsItemsToDelete())
8643 return false;
8644 }
8645
8646 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8647 return false;
8648
8649 int slotID;
8651 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8652 return false;
8653
8654 return true;
8655 }
8656
8658 {
8660 }
8661
8663 {
8664 return m_IsResultOfSplit;
8665 }
8666
8668 {
8669 m_IsResultOfSplit = value;
8670 }
8671
8673 {
8675 }
8676
8678 {
8679 float other_item_quantity = other_item.GetQuantity();
8680 float this_free_space;
8681
8683
8685
8686 if (other_item_quantity > this_free_space)
8687 {
8688 return this_free_space;
8689 }
8690 else
8691 {
8692 return other_item_quantity;
8693 }
8694 }
8695
8697 {
8699 }
8700
8702 {
8704 return;
8705
8706 if (!IsMagazine() && other_item)
8707 {
8709 if (quantity_used != 0)
8710 {
8711 float hp1 = GetHealth01("","");
8712 float hp2 = other_item.GetHealth01("","");
8713 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8714 hpResult = hpResult / (
GetQuantity() + quantity_used);
8715
8716 hpResult *= GetMaxHealth();
8717 Math.Round(hpResult);
8718 SetHealth("", "Health", hpResult);
8719
8721 other_item.AddQuantity(-quantity_used);
8722 }
8723 }
8725 }
8726
8728 {
8729 #ifdef SERVER
8730 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8731 GetHierarchyParent().IncreaseLifetimeUp();
8732 #endif
8733 };
8734
8736 {
8737 PlayerBase p = PlayerBase.Cast(player);
8738
8739 array<int> recipesIds = p.m_Recipes;
8740 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8741 if (moduleRecipesManager)
8742 {
8743 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8744 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8745 }
8746
8747 for (int i = 0;i < recipesIds.Count(); i++)
8748 {
8749 int key = recipesIds.Get(i);
8750 string recipeName = moduleRecipesManager.GetRecipeName(key);
8752 }
8753 }
8754
8755
8756 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8757 {
8758 super.GetDebugActions(outputList);
8759
8760
8766
8767
8772
8777
8778
8782
8783
8785 {
8789 }
8790
8793
8794
8798
8800
8801 InventoryLocation loc = new InventoryLocation();
8802 GetInventory().GetCurrentInventoryLocation(loc);
8804 {
8805 if (Gizmo_IsSupported())
8808 }
8809
8811 }
8812
8813
8814
8815
8817 {
8818 super.OnAction(action_id, player, ctx);
8819
8821 {
8822 switch (action_id)
8823 {
8826 return true;
8829 return true;
8830 }
8831 }
8832
8834 {
8835 switch (action_id)
8836 {
8838 Delete();
8839 return true;
8840 }
8841 }
8842
8843 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8844 {
8845 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8846 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8847 PlayerBase p = PlayerBase.Cast(player);
8848 if (
EActions.RECIPES_RANGE_START < 1000)
8849 {
8850 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8851 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8852 }
8853 }
8854 #ifndef SERVER
8855 else if (action_id ==
EActions.WATCH_PLAYER)
8856 {
8857 PluginDeveloper.SetDeveloperItemClientEx(player);
8858 }
8859 #endif
8861 {
8862 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8863 {
8864 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8865 OnDebugButtonPressServer(id + 1);
8866 }
8867
8868 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8869 {
8870 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8872 }
8873
8874 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8875 {
8876 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8878 }
8879
8880 else if (action_id ==
EActions.ADD_QUANTITY)
8881 {
8882 if (IsMagazine())
8883 {
8884 Magazine mag = Magazine.Cast(this);
8885 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8886 }
8887 else
8888 {
8890 }
8891
8892 if (m_EM)
8893 {
8894 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8895 }
8896
8897 }
8898
8899 else if (action_id ==
EActions.REMOVE_QUANTITY)
8900 {
8901 if (IsMagazine())
8902 {
8903 Magazine mag2 = Magazine.Cast(this);
8904 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8905 }
8906 else
8907 {
8909 }
8910 if (m_EM)
8911 {
8912 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8913 }
8914
8915 }
8916
8917 else if (action_id ==
EActions.SET_QUANTITY_0)
8918 {
8920
8921 if (m_EM)
8922 {
8923 m_EM.SetEnergy(0);
8924 }
8925 }
8926
8927 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8928 {
8930
8931 if (m_EM)
8932 {
8933 m_EM.SetEnergy(m_EM.GetEnergyMax());
8934 }
8935 }
8936
8937 else if (action_id ==
EActions.ADD_HEALTH)
8938 {
8939 AddHealth("","",GetMaxHealth("","Health")/5);
8940 }
8941 else if (action_id ==
EActions.REMOVE_HEALTH)
8942 {
8943 AddHealth("","",-GetMaxHealth("","Health")/5);
8944 }
8945 else if (action_id ==
EActions.DESTROY_HEALTH)
8946 {
8947 SetHealth01("","",0);
8948 }
8949 else if (action_id ==
EActions.WATCH_ITEM)
8950 {
8952 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8953 #ifdef DEVELOPER
8954 SetDebugDeveloper_item(this);
8955 #endif
8956 }
8957
8958 else if (action_id ==
EActions.ADD_TEMPERATURE)
8959 {
8960 AddTemperature(20);
8961
8962 }
8963
8964 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8965 {
8966 AddTemperature(-20);
8967
8968 }
8969
8970 else if (action_id ==
EActions.FLIP_FROZEN)
8971 {
8972 SetFrozen(!GetIsFrozen());
8973
8974 }
8975
8976 else if (action_id ==
EActions.ADD_WETNESS)
8977 {
8979
8980 }
8981
8982 else if (action_id ==
EActions.REMOVE_WETNESS)
8983 {
8985
8986 }
8987
8988 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8989 {
8992
8993
8994 }
8995
8996 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8997 {
9000 }
9001
9002 else if (action_id ==
EActions.MAKE_SPECIAL)
9003 {
9004 auto debugParams = DebugSpawnParams.WithPlayer(player);
9005 OnDebugSpawnEx(debugParams);
9006 }
9007
9008 }
9009
9010
9011 return false;
9012 }
9013
9014
9015
9016
9020
9023
9024
9025
9027 {
9028 return false;
9029 }
9030
9031
9033 {
9034 return true;
9035 }
9036
9037
9039 {
9040 return true;
9041 }
9042
9043
9044
9046 {
9047 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9049 }
9050
9053 {
9054 return null;
9055 }
9056
9058 {
9059 return false;
9060 }
9061
9063 {
9064 return false;
9065 }
9066
9070
9071
9073 {
9074 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9075 return module_repairing.CanRepair(this, item_repair_kit);
9076 }
9077
9078
9079 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9080 {
9081 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9082 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9083 }
9084
9085
9087 {
9088
9089
9090
9091
9092
9093
9094
9095
9096 return 1;
9097 }
9098
9099
9100
9102 {
9104 }
9105
9106
9107
9109 {
9111 }
9112
9113
9122 {
9123 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9124
9125 if (player)
9126 {
9127 player.MessageStatus(text);
9128 }
9129 }
9130
9131
9140 {
9141 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9142
9143 if (player)
9144 {
9145 player.MessageAction(text);
9146 }
9147 }
9148
9149
9158 {
9159 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9160
9161 if (player)
9162 {
9163 player.MessageFriendly(text);
9164 }
9165 }
9166
9167
9176 {
9177 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9178
9179 if (player)
9180 {
9181 player.MessageImportant(text);
9182 }
9183 }
9184
9186 {
9187 return true;
9188 }
9189
9190
9191 override bool KindOf(
string tag)
9192 {
9193 bool found = false;
9194 string item_name = this.
GetType();
9197
9198 int array_size = item_tag_array.Count();
9199 for (int i = 0; i < array_size; i++)
9200 {
9201 if (item_tag_array.Get(i) == tag)
9202 {
9203 found = true;
9204 break;
9205 }
9206 }
9207 return found;
9208 }
9209
9210
9212 {
9213
9214 super.OnRPC(sender, rpc_type,ctx);
9215
9216
9217 switch (rpc_type)
9218 {
9219 #ifndef SERVER
9220 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9221 Param2<bool, string> p = new Param2<bool, string>(false, "");
9222
9224 return;
9225
9226 bool play = p.param1;
9227 string soundSet = p.param2;
9228
9229 if (play)
9230 {
9232 {
9234 {
9236 }
9237 }
9238 else
9239 {
9241 }
9242 }
9243 else
9244 {
9246 }
9247
9248 break;
9249 #endif
9250
9251 }
9252
9254 {
9256 }
9257 }
9258
9259
9260
9261
9263 {
9264 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9265 return plugin.GetID(
name);
9266 }
9267
9269 {
9270 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9271 return plugin.GetName(id);
9272 }
9273
9276 {
9277
9278
9279 int varFlags;
9280 if (!ctx.
Read(varFlags))
9281 return;
9282
9283 if (varFlags & ItemVariableFlags.FLOAT)
9284 {
9286 }
9287 }
9288
9290 {
9291
9292 super.SerializeNumericalVars(floats_out);
9293
9294
9295
9297 {
9299 }
9300
9302 {
9304 }
9305
9307 {
9309 }
9310
9312 {
9317 }
9318
9320 {
9322 }
9323 }
9324
9326 {
9327
9328 super.DeSerializeNumericalVars(floats);
9329
9330
9331 int index = 0;
9332 int mask = Math.Round(floats.Get(index));
9333
9334 index++;
9335
9337 {
9339 {
9341 }
9342 else
9343 {
9344 float quantity = floats.Get(index);
9346 }
9347 index++;
9348 }
9349
9351 {
9352 float wet = floats.Get(index);
9354 index++;
9355 }
9356
9358 {
9359 int liquidtype = Math.Round(floats.Get(index));
9361 index++;
9362 }
9363
9365 {
9367 index++;
9369 index++;
9371 index++;
9373 index++;
9374 }
9375
9377 {
9378 int cleanness = Math.Round(floats.Get(index));
9380 index++;
9381 }
9382 }
9383
9385 {
9386 super.WriteVarsToCTX(ctx);
9387
9388
9390 {
9392 }
9393
9395 {
9397 }
9398
9400 {
9402 }
9403
9405 {
9406 int r,g,b,a;
9412 }
9413
9415 {
9417 }
9418 }
9419
9421 {
9422 if (!super.ReadVarsFromCTX(ctx,version))
9423 return false;
9424
9425 int intValue;
9426 float value;
9427
9428 if (version < 140)
9429 {
9430 if (!ctx.
Read(intValue))
9431 return false;
9432
9433 m_VariablesMask = intValue;
9434 }
9435
9437 {
9438 if (!ctx.
Read(value))
9439 return false;
9440
9442 {
9444 }
9445 else
9446 {
9448 }
9449 }
9450
9451 if (version < 140)
9452 {
9454 {
9455 if (!ctx.
Read(value))
9456 return false;
9457 SetTemperatureDirect(value);
9458 }
9459 }
9460
9462 {
9463 if (!ctx.
Read(value))
9464 return false;
9466 }
9467
9469 {
9470 if (!ctx.
Read(intValue))
9471 return false;
9473 }
9474
9476 {
9477 int r,g,b,a;
9479 return false;
9481 return false;
9483 return false;
9485 return false;
9486
9488 }
9489
9491 {
9492 if (!ctx.
Read(intValue))
9493 return false;
9495 }
9496
9497 if (version >= 138 && version < 140)
9498 {
9500 {
9501 if (!ctx.
Read(intValue))
9502 return false;
9503 SetFrozen(intValue);
9504 }
9505 }
9506
9507 return true;
9508 }
9509
9510
9512 {
9515 {
9517 }
9518
9519 if (!super.OnStoreLoad(ctx, version))
9520 {
9522 return false;
9523 }
9524
9525 if (version >= 114)
9526 {
9527 bool hasQuickBarIndexSaved;
9528
9529 if (!ctx.
Read(hasQuickBarIndexSaved))
9530 {
9532 return false;
9533 }
9534
9535 if (hasQuickBarIndexSaved)
9536 {
9537 int itmQBIndex;
9538
9539
9540 if (!ctx.
Read(itmQBIndex))
9541 {
9543 return false;
9544 }
9545
9546 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9547 if (itmQBIndex != -1 && parentPlayer)
9548 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9549 }
9550 }
9551 else
9552 {
9553
9554 PlayerBase player;
9555 int itemQBIndex;
9556 if (version ==
int.
MAX)
9557 {
9558 if (!ctx.
Read(itemQBIndex))
9559 {
9561 return false;
9562 }
9563 }
9564 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9565 {
9566
9567 if (!ctx.
Read(itemQBIndex))
9568 {
9570 return false;
9571 }
9572 if (itemQBIndex != -1 && player)
9573 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9574 }
9575 }
9576
9577 if (version < 140)
9578 {
9579
9580 if (!LoadVariables(ctx, version))
9581 {
9583 return false;
9584 }
9585 }
9586
9587
9589 {
9591 return false;
9592 }
9593 if (version >= 132)
9594 {
9596 if (raib)
9597 {
9599 {
9601 return false;
9602 }
9603 }
9604 }
9605
9607 return true;
9608 }
9609
9610
9611
9613 {
9614 super.OnStoreSave(ctx);
9615
9616 PlayerBase player;
9617 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9618 {
9620
9621 int itemQBIndex = -1;
9622 itemQBIndex = player.FindQuickBarEntityIndex(this);
9623 ctx.
Write(itemQBIndex);
9624 }
9625 else
9626 {
9628 }
9629
9631
9633 if (raib)
9634 {
9636 }
9637 }
9638
9639
9641 {
9642 super.AfterStoreLoad();
9643
9645 {
9647 }
9648
9650 {
9653 }
9654 }
9655
9657 {
9658 super.EEOnAfterLoad();
9659
9661 {
9663 }
9664
9667 }
9668
9670 {
9671 return false;
9672 }
9673
9674
9675
9677 {
9679 {
9680 #ifdef PLATFORM_CONSOLE
9681
9683 {
9685 if (menu)
9686 {
9688 }
9689 }
9690 #endif
9691 }
9692
9694 {
9697 }
9698
9700 {
9701 SetWeightDirty();
9703 }
9705 {
9708 }
9709
9711 {
9714 }
9716 {
9719 }
9720
9721 super.OnVariablesSynchronized();
9722 }
9723
9724
9725
9727 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9728 {
9729 if (!IsServerCheck(allow_client))
9730 return false;
9731
9733 return false;
9734
9737
9738 if (value <= (min + 0.001))
9739 value = min;
9740
9741 if (value == min)
9742 {
9743 if (destroy_config)
9744 {
9745 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9746 if (dstr)
9747 {
9749 this.Delete();
9750 return true;
9751 }
9752 }
9753 else if (destroy_forced)
9754 {
9756 this.Delete();
9757 return true;
9758 }
9759
9761 }
9762
9765
9767 {
9769
9770 if (delta)
9772 }
9773
9775
9776 return false;
9777 }
9778
9779
9781 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9782 {
9784 }
9785
9787 {
9790 }
9791
9793 {
9796 }
9797
9799 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9800 {
9801 float value_clamped = Math.Clamp(value, 0, 1);
9803 SetQuantity(result, destroy_config, destroy_forced);
9804 }
9805
9806
9809 {
9811 }
9812
9814 {
9816 }
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9828 {
9829 int slot = -1;
9830 if (GetInventory())
9831 {
9832 InventoryLocation il = new InventoryLocation;
9833 GetInventory().GetCurrentInventoryLocation(il);
9835 }
9836
9838 }
9839
9841 {
9842 float quantity_max = 0;
9843
9845 {
9846 if (attSlotID != -1)
9847 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9848
9849 if (quantity_max <= 0)
9851 }
9852
9853 if (quantity_max <= 0)
9855
9856 return quantity_max;
9857 }
9858
9860 {
9862 }
9863
9865 {
9867 }
9868
9869
9871 {
9873 }
9874
9876 {
9878 }
9879
9881 {
9883 }
9884
9885
9887 {
9888
9889 float weightEx = GetWeightEx();
9890 float special = GetInventoryAndCargoWeight();
9891 return weightEx - special;
9892 }
9893
9894
9896 {
9898 }
9899
9901 {
9903 {
9904 #ifdef DEVELOPER
9905 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9906 {
9907 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9909 }
9910 #endif
9911
9913 }
9914 else if (HasEnergyManager())
9915 {
9916 #ifdef DEVELOPER
9917 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9918 {
9919 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9920 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9921 }
9922 #endif
9923 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9924 }
9925 else
9926 {
9927 #ifdef DEVELOPER
9928 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9929 {
9930 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9931 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9932 }
9933 #endif
9934 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9935 }
9936 }
9937
9940 {
9941 int item_count = 0;
9943
9944 if (GetInventory().GetCargo() != NULL)
9945 {
9946 item_count = GetInventory().GetCargo().GetItemCount();
9947 }
9948
9949 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9950 {
9951 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9952 if (item)
9953 item_count += item.GetNumberOfItems();
9954 }
9955 return item_count;
9956 }
9957
9960 {
9961 float weight = 0;
9962 float wetness = 1;
9963 if (include_wetness)
9966 {
9967 weight = wetness * m_ConfigWeight;
9968 }
9970 {
9971 weight = 1;
9972 }
9973 return weight;
9974 }
9975
9976
9977
9979 {
9980 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9981 {
9982 GameInventory inv = GetInventory();
9983 array<EntityAI> items = new array<EntityAI>;
9985 for (int i = 0; i < items.Count(); i++)
9986 {
9988 if (item)
9989 {
9991 }
9992 }
9993 }
9994 }
9995
9996
9997
9998
10000 {
10001 float energy = 0;
10002 if (HasEnergyManager())
10003 {
10004 energy = GetCompEM().GetEnergy();
10005 }
10006 return energy;
10007 }
10008
10009
10011 {
10012 super.OnEnergyConsumed();
10013
10015 }
10016
10018 {
10019 super.OnEnergyAdded();
10020
10022 }
10023
10024
10026 {
10027 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10028 {
10030 {
10031 float energy_0to1 = GetCompEM().GetEnergy0To1();
10033 }
10034 }
10035 }
10036
10037
10039 {
10040 return ConfigGetFloat("heatIsolation");
10041 }
10042
10044 {
10046 }
10047
10049 {
10050 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10051 if (
GetGame().ConfigIsExisting(paramPath))
10053
10054 return 0.0;
10055 }
10056
10058 {
10059 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10060 if (
GetGame().ConfigIsExisting(paramPath))
10062
10063 return 0.0;
10064 }
10065
10066 override void SetWet(
float value,
bool allow_client =
false)
10067 {
10068 if (!IsServerCheck(allow_client))
10069 return;
10070
10073
10075
10076 m_VarWet = Math.Clamp(value, min, max);
10077
10079 {
10082 }
10083 }
10084
10085 override void AddWet(
float value)
10086 {
10088 }
10089
10091 {
10093 }
10094
10096 {
10098 }
10099
10101 {
10103 }
10104
10106 {
10108 }
10109
10111 {
10113 }
10114
10115 override void OnWetChanged(
float newVal,
float oldVal)
10116 {
10119 if (newLevel != oldLevel)
10120 {
10122 }
10123 }
10124
10126 {
10127 SetWeightDirty();
10128 }
10129
10131 {
10132 return GetWetLevelInternal(
m_VarWet);
10133 }
10134
10135
10136
10138 {
10140 }
10141
10143 {
10145 }
10146
10148 {
10150 }
10151
10153 {
10155 }
10156
10157
10158
10160 {
10161 if (ConfigIsExisting("itemModelLength"))
10162 {
10163 return ConfigGetFloat("itemModelLength");
10164 }
10165 return 0;
10166 }
10167
10169 {
10170 if (ConfigIsExisting("itemAttachOffset"))
10171 {
10172 return ConfigGetFloat("itemAttachOffset");
10173 }
10174 return 0;
10175 }
10176
10177 override void SetCleanness(
int value,
bool allow_client =
false)
10178 {
10179 if (!IsServerCheck(allow_client))
10180 return;
10181
10183
10185
10188 }
10189
10191 {
10193 }
10194
10196 {
10197 return true;
10198 }
10199
10200
10201
10202
10204 {
10206 }
10207
10209 {
10211 }
10212
10213
10214
10215
10216 override void SetColor(
int r,
int g,
int b,
int a)
10217 {
10223 }
10225 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10226 {
10231 }
10232
10234 {
10236 }
10237
10240 {
10241 int r,g,b,a;
10243 r = r/255;
10244 g = g/255;
10245 b = b/255;
10246 a = a/255;
10247 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10248 }
10249
10250
10251
10252 override void SetLiquidType(
int value,
bool allow_client =
false)
10253 {
10254 if (!IsServerCheck(allow_client))
10255 return;
10256
10261 }
10262
10264 {
10265 return ConfigGetInt("varLiquidTypeInit");
10266 }
10267
10269 {
10271 }
10272
10274 {
10276 SetFrozen(false);
10277 }
10278
10281 {
10282 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10283 }
10284
10285
10288 {
10289 PlayerBase nplayer;
10290 if (PlayerBase.CastTo(nplayer, player))
10291 {
10293
10294 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10295 }
10296 }
10297
10298
10301 {
10302 PlayerBase nplayer;
10303 if (PlayerBase.CastTo(nplayer,player))
10304 {
10305
10306 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10307
10308 }
10309
10310
10311 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10312
10313
10314 if (HasEnergyManager())
10315 {
10316 GetCompEM().UpdatePlugState();
10317 }
10318 }
10319
10320
10322 {
10323 super.OnPlacementStarted(player);
10324
10326 }
10327
10328 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10329 {
10331 {
10332 m_AdminLog.OnPlacementComplete(player,
this);
10333 }
10334
10335 super.OnPlacementComplete(player, position, orientation);
10336 }
10337
10338
10339
10340
10341
10343 {
10345 {
10346 return true;
10347 }
10348 else
10349 {
10350 return false;
10351 }
10352 }
10353
10354
10356 {
10358 {
10360 }
10361 }
10362
10363
10365 {
10367 }
10368
10370 {
10372 }
10373
10374 override void InsertAgent(
int agent,
float count = 1)
10375 {
10376 if (count < 1)
10377 return;
10378
10380 }
10381
10384 {
10386 }
10387
10388
10390 {
10392 }
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10436 {
10438 return false;
10439 return true;
10440 }
10441
10443 {
10444
10446 }
10447
10448
10451 {
10452 super.CheckForRoofLimited(timeTresholdMS);
10453
10455 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10456 {
10457 m_PreviousRoofTestTime = time;
10458 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10459 }
10460 }
10461
10462
10464 {
10466 {
10467 return 0;
10468 }
10469
10470 if (GetInventory().GetAttachmentSlotsCount() != 0)
10471 {
10472 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10473 if (filter)
10474 return filter.GetProtectionLevel(type, false, system);
10475 else
10476 return 0;
10477 }
10478
10479 string subclassPath, entryName;
10480
10481 switch (type)
10482 {
10484 entryName = "biological";
10485 break;
10487 entryName = "chemical";
10488 break;
10489 default:
10490 entryName = "biological";
10491 break;
10492 }
10493
10494 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10495
10497 }
10498
10499
10500
10503 {
10504 if (!IsMagazine())
10506
10508 }
10509
10510
10511
10512
10513
10518 {
10519 return true;
10520 }
10521
10523 {
10525 }
10526
10527
10528
10529
10530
10532 {
10533 if (parent)
10534 {
10535 if (parent.IsInherited(DayZInfected))
10536 return true;
10537
10538 if (!parent.IsRuined())
10539 return true;
10540 }
10541
10542 return true;
10543 }
10544
10546 {
10547 if (!super.CanPutAsAttachment(parent))
10548 {
10549 return false;
10550 }
10551
10552 if (!IsRuined() && !parent.IsRuined())
10553 {
10554 return true;
10555 }
10556
10557 return false;
10558 }
10559
10561 {
10562
10563
10564
10565
10566 return super.CanReceiveItemIntoCargo(item);
10567 }
10568
10570 {
10571
10572
10573
10574
10575 GameInventory attachmentInv = attachment.GetInventory();
10577 {
10578 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10579 return false;
10580 }
10581
10582 InventoryLocation loc = new InventoryLocation();
10583 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10584 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10585 return false;
10586
10587 return super.CanReceiveAttachment(attachment, slotId);
10588 }
10589
10591 {
10592 if (!super.CanReleaseAttachment(attachment))
10593 return false;
10594
10595 return GetInventory().AreChildrenAccessible();
10596 }
10597
10598
10599
10600
10601
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10617
10619 {
10620 int id = muzzle_owner.GetMuzzleID();
10621 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10622
10623 if (WPOF_array)
10624 {
10625 for (int i = 0; i < WPOF_array.Count(); i++)
10626 {
10627 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10628
10629 if (WPOF)
10630 {
10631 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10632 }
10633 }
10634 }
10635 }
10636
10637
10639 {
10640 int id = muzzle_owner.GetMuzzleID();
10642
10643 if (WPOBE_array)
10644 {
10645 for (int i = 0; i < WPOBE_array.Count(); i++)
10646 {
10647 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10648
10649 if (WPOBE)
10650 {
10651 WPOBE.OnActivate(weapon, 0, 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.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10672 }
10673 }
10674 }
10675 }
10676
10677
10679 {
10680 int id = muzzle_owner.GetMuzzleID();
10681 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10682
10683 if (WPOOH_array)
10684 {
10685 for (int i = 0; i < WPOOH_array.Count(); i++)
10686 {
10687 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10688
10689 if (WPOOH)
10690 {
10691 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10692 }
10693 }
10694 }
10695 }
10696
10697
10699 {
10700 int id = muzzle_owner.GetMuzzleID();
10701 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10702
10703 if (WPOOH_array)
10704 {
10705 for (int i = 0; i < WPOOH_array.Count(); i++)
10706 {
10707 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10708
10709 if (WPOOH)
10710 {
10711 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10712 }
10713 }
10714 }
10715 }
10716
10717
10718
10720 {
10722 {
10723 return true;
10724 }
10725
10726 return false;
10727 }
10728
10730 {
10732 {
10733 return true;
10734 }
10735
10736 return false;
10737 }
10738
10740 {
10742 {
10743 return true;
10744 }
10745
10746 return false;
10747 }
10748
10750 {
10751 return false;
10752 }
10753
10756 {
10757 return UATimeSpent.DEFAULT_DEPLOY;
10758 }
10759
10760
10761
10762
10764 {
10766 SetSynchDirty();
10767 }
10768
10770 {
10772 }
10773
10774
10776 {
10777 return false;
10778 }
10779
10782 {
10783 string att_type = "None";
10784
10785 if (ConfigIsExisting("soundAttType"))
10786 {
10787 att_type = ConfigGetString("soundAttType");
10788 }
10789
10791 }
10792
10794 {
10796 }
10797
10798
10799
10800
10801
10807
10809 {
10812
10814 }
10815
10816
10818 {
10820 return;
10821
10823
10826
10829
10830 SoundParameters params = new SoundParameters();
10834 }
10835
10836
10838 {
10840 return;
10841
10843 SetSynchDirty();
10844
10847 }
10848
10849
10851 {
10853 return;
10854
10856 SetSynchDirty();
10857
10860 }
10861
10863 {
10865 }
10866
10868 {
10870 }
10871
10874 {
10875 if (!
GetGame().IsDedicatedServer())
10876 {
10877 if (ConfigIsExisting("attachSoundSet"))
10878 {
10879 string cfg_path = "";
10880 string soundset = "";
10881 string type_name =
GetType();
10882
10885 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10886 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10887
10888 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10889 {
10890 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10891 {
10892 if (cfg_slot_array[i] == slot_type)
10893 {
10894 soundset = cfg_soundset_array[i];
10895 break;
10896 }
10897 }
10898 }
10899
10900 if (soundset != "")
10901 {
10902 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10904 }
10905 }
10906 }
10907 }
10908
10910 {
10911
10912 }
10913
10914 void OnApply(PlayerBase player);
10915
10917 {
10918 return 1.0;
10919 };
10920
10922 {
10924 }
10925
10927 {
10929 }
10930
10932
10934 {
10935 SetDynamicPhysicsLifeTime(0.01);
10937 }
10938
10940 {
10941 array<string> zone_names = new array<string>;
10942 GetDamageZones(zone_names);
10943 for (int i = 0; i < zone_names.Count(); i++)
10944 {
10945 SetHealthMax(zone_names.Get(i),"Health");
10946 }
10947 SetHealthMax("","Health");
10948 }
10949
10952 {
10953 float global_health = GetHealth01("","Health");
10954 array<string> zones = new array<string>;
10955 GetDamageZones(zones);
10956
10957 for (int i = 0; i < zones.Count(); i++)
10958 {
10959 SetHealth01(zones.Get(i),"Health",global_health);
10960 }
10961 }
10962
10965 {
10966 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10967 }
10968
10970 {
10971 if (!hasRootAsPlayer)
10972 {
10973 if (refParentIB)
10974 {
10975
10976 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10977 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10978
10979 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10980 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10981
10984 }
10985 else
10986 {
10987
10990 }
10991 }
10992 }
10993
10995 {
10997 {
10998 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10999 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11000 {
11001 float heatPermCoef = 1.0;
11003 while (ent)
11004 {
11005 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11006 ent = ent.GetHierarchyParent();
11007 }
11008
11009 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11010 }
11011 }
11012 }
11013
11015 {
11016
11017 EntityAI parent = GetHierarchyParent();
11018 if (!parent)
11019 {
11020 hasParent = false;
11021 hasRootAsPlayer = false;
11022 }
11023 else
11024 {
11025 hasParent = true;
11026 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11027 refParentIB =
ItemBase.Cast(parent);
11028 }
11029 }
11030
11031 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11032 {
11033
11034 }
11035
11037 {
11038
11039 return false;
11040 }
11041
11043 {
11044
11045
11046 return false;
11047 }
11048
11050 {
11051
11052 return false;
11053 }
11054
11057 {
11058 return !GetIsFrozen() &&
IsOpen();
11059 }
11060
11062 {
11063 bool hasParent = false, hasRootAsPlayer = false;
11065
11066 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11067 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11068
11069 if (wwtu || foodDecay)
11070 {
11074
11075 if (processWetness || processTemperature || processDecay)
11076 {
11078
11079 if (processWetness)
11080 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11081
11082 if (processTemperature)
11084
11085 if (processDecay)
11086 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11087 }
11088 }
11089 }
11090
11093 {
11095 }
11096
11098 {
11101
11102 return super.GetTemperatureFreezeThreshold();
11103 }
11104
11106 {
11109
11110 return super.GetTemperatureThawThreshold();
11111 }
11112
11114 {
11117
11118 return super.GetItemOverheatThreshold();
11119 }
11120
11122 {
11124 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11125
11126 return super.GetTemperatureFreezeTime();
11127 }
11128
11130 {
11132 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11133
11134 return super.GetTemperatureThawTime();
11135 }
11136
11141
11143 {
11144 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11145 }
11146
11148 {
11149 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11150 }
11151
11154 {
11156 }
11157
11159 {
11161 }
11162
11164 {
11166 }
11167
11170 {
11171 return null;
11172 }
11173
11176 {
11177 return false;
11178 }
11179
11181 {
11183 {
11186 if (!trg)
11187 {
11189 explosive = this;
11190 }
11191
11192 explosive.PairRemote(trg);
11194
11195 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11196 trg.SetPersistentPairID(persistentID);
11197 explosive.SetPersistentPairID(persistentID);
11198
11199 return true;
11200 }
11201 return false;
11202 }
11203
11206 {
11207 float ret = 1.0;
11210 ret *= GetHealth01();
11211
11212 return ret;
11213 }
11214
11215 #ifdef DEVELOPER
11216 override void SetDebugItem()
11217 {
11218 super.SetDebugItem();
11219 _itemBase = this;
11220 }
11221
11223 {
11224 string text = super.GetDebugText();
11225
11227 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11228
11229 return text;
11230 }
11231 #endif
11232
11234 {
11235 return true;
11236 }
11237
11239
11241
11243 {
11246 }
11247
11248
11256
11272}
11273
11275{
11277 if (entity)
11278 {
11279 bool is_item = entity.IsInherited(
ItemBase);
11280 if (is_item && full_quantity)
11281 {
11284 }
11285 }
11286 else
11287 {
11289 return NULL;
11290 }
11291 return entity;
11292}
11293
11295{
11296 if (item)
11297 {
11298 if (health > 0)
11299 item.SetHealth("", "", health);
11300
11301 if (item.CanHaveTemperature())
11302 {
11304 if (item.CanFreeze())
11305 item.SetFrozen(false);
11306 }
11307
11308 if (item.HasEnergyManager())
11309 {
11310 if (quantity >= 0)
11311 {
11312 item.GetCompEM().SetEnergy0To1(quantity);
11313 }
11314 else
11315 {
11317 }
11318 }
11319 else if (item.IsMagazine())
11320 {
11321 Magazine mag = Magazine.Cast(item);
11322 if (quantity >= 0)
11323 {
11324 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11325 }
11326 else
11327 {
11329 }
11330
11331 }
11332 else
11333 {
11334 if (quantity >= 0)
11335 {
11336 item.SetQuantityNormalized(quantity, false);
11337 }
11338 else
11339 {
11341 }
11342
11343 }
11344 }
11345}
11346
11347#ifdef DEVELOPER
11349#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.