6403{
6405 {
6406 return true;
6407 }
6408};
6409
6410
6411
6413{
6417
6419
6422
6423
6424
6425
6426
6435
6441
6446
6451
6472 protected bool m_IsResultOfSplit
6473
6475
6480
6481
6482
6484
6488
6489
6490
6492
6495
6496
6497
6503
6504
6512
6515
6516
6518
6519
6521
6522
6527
6528
6533
6534
6536
6537
6539 {
6544
6545 if (!
GetGame().IsDedicatedServer())
6546 {
6548 {
6550
6552 {
6554 }
6555 }
6556
6559 }
6560
6561 m_OldLocation = null;
6562
6564 {
6566 }
6567
6568 if (ConfigIsExisting("headSelectionsToHide"))
6569 {
6572 }
6573
6575 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6576 {
6578 }
6579
6581
6582 m_IsResultOfSplit = false;
6583
6585 }
6586
6588 {
6589 super.InitItemVariables();
6590
6596 m_Count = ConfigGetInt(
"count");
6597
6600
6605
6608
6613
6625
6629
6630
6633 if (ConfigIsExisting("canBeSplit"))
6634 {
6637 }
6638
6640 if (ConfigIsExisting("itemBehaviour"))
6642
6643
6646 RegisterNetSyncVariableInt("m_VarLiquidType");
6647 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6648
6649 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6650 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6651 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6652
6653 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6654 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6655 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6656 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6657
6658 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6659 RegisterNetSyncVariableBool("m_IsTakeable");
6660 RegisterNetSyncVariableBool("m_IsHologram");
6661
6664 {
6667 }
6668
6670
6672 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6674
6675 }
6676
6678 {
6680 }
6681
6683 {
6686 {
6691 }
6692 }
6693
6694 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6695 {
6697 {
6700 }
6701
6703 }
6704
6706 {
6712 }
6713
6715
6717 {
6719
6720 if (!action)
6721 {
6722 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6723 return;
6724 }
6725
6727 if (!ai)
6728 {
6730 return;
6731 }
6732
6734 if (!action_array)
6735 {
6736 action_array = new array<ActionBase_Basic>;
6738 }
6739 if (LogManager.IsActionLogEnable())
6740 {
6741 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6742 }
6743
6744 if (action_array.Find(action) != -1)
6745 {
6746 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6747 }
6748 else
6749 {
6750 action_array.Insert(action);
6751 }
6752 }
6753
6755 {
6757 ActionBase action = player.GetActionManager().GetAction(actionName);
6760
6761 if (action_array)
6762 {
6763 action_array.RemoveItem(action);
6764 }
6765 }
6766
6767
6768
6770 {
6771 ActionOverrideData overrideData = new ActionOverrideData();
6775
6777 if (!actionMap)
6778 {
6781 }
6782
6783 actionMap.Insert(this.
Type(), overrideData);
6784
6785 }
6786
6788
6790
6791
6793 {
6796
6799
6800 string config_to_search = "CfgVehicles";
6801 string muzzle_owner_config;
6802
6804 {
6805 if (IsInherited(Weapon))
6806 config_to_search = "CfgWeapons";
6807
6808 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6809
6810 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6811
6813
6814 if (config_OnFire_subclass_count > 0)
6815 {
6816 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6817
6818 for (int i = 0; i < config_OnFire_subclass_count; i++)
6819 {
6820 string particle_class = "";
6822 string config_OnFire_entry = config_OnFire_class + particle_class;
6823 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6824 WPOF_array.Insert(WPOF);
6825 }
6826
6827
6829 }
6830 }
6831
6833 {
6834 config_to_search = "CfgWeapons";
6835 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6836
6837 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6838
6840
6841 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6842 {
6843 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6844
6845 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6846 {
6847 string particle_class2 = "";
6849 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6850 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6851 WPOBE_array.Insert(WPOBE);
6852 }
6853
6854
6856 }
6857 }
6858 }
6859
6860
6862 {
6865
6867 {
6868 string config_to_search = "CfgVehicles";
6869
6870 if (IsInherited(Weapon))
6871 config_to_search = "CfgWeapons";
6872
6873 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6874 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6875
6876 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6877 {
6878
6880
6882 {
6884 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6886 return;
6887 }
6888
6891
6892
6893
6895 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6896
6897 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6898 {
6899 string particle_class = "";
6901 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6903
6904 if (entry_type == CT_CLASS)
6905 {
6906 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6907 WPOOH_array.Insert(WPOF);
6908 }
6909 }
6910
6911
6913 }
6914 }
6915 }
6916
6918 {
6920 }
6921
6923 {
6925 {
6927
6930
6933
6934 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6935 }
6936 }
6937
6939 {
6941 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6942
6944 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6945
6947 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6948
6950 {
6952 }
6953 }
6954
6956 {
6958 }
6959
6961 {
6964 else
6966
6968 {
6971 }
6972 else
6973 {
6976
6979 }
6980
6982 }
6983
6985 {
6987 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6988 }
6989
6991 {
6993 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6995 }
6996
6998 {
7000 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7001 }
7002
7004 {
7007
7008 OverheatingParticle OP = new OverheatingParticle();
7013
7015 }
7016
7018 {
7021
7022 return -1;
7023 }
7024
7026 {
7028 {
7031
7032 for (int i = count; i > 0; --i)
7033 {
7034 int id = i - 1;
7037
7040
7041 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7042 {
7043 if (p)
7044 {
7047 }
7048 }
7049 }
7050 }
7051 }
7052
7054 {
7056 {
7058 {
7059 int id = i - 1;
7061
7062 if (OP)
7063 {
7065
7066 if (p)
7067 {
7069 }
7070
7071 delete OP;
7072 }
7073 }
7074
7077 }
7078 }
7079
7082 {
7083 return 0.0;
7084 }
7085
7086
7088 {
7089 return 250;
7090 }
7091
7093 {
7094 return 0;
7095 }
7096
7099 {
7101 return true;
7102
7103 return false;
7104 }
7105
7108 {
7111
7113 {
7115 }
7116 else
7117 {
7118
7120 }
7121
7123 }
7124
7131 {
7132 return -1;
7133 }
7134
7135
7136
7137
7139 {
7141 {
7143 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7144
7145 if (r_index >= 0)
7146 {
7147 InventoryLocation r_il = new InventoryLocation;
7148 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7149
7150 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7153 {
7154 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7155 }
7157 {
7158 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7159 }
7160
7161 }
7162
7163 player.GetHumanInventory().ClearUserReservedLocation(this);
7164 }
7165
7168 }
7169
7170
7171
7172
7174 {
7175 return ItemBase.m_DebugActionsMask;
7176 }
7177
7179 {
7180 return ItemBase.m_DebugActionsMask & mask;
7181 }
7182
7184 {
7185 ItemBase.m_DebugActionsMask = mask;
7186 }
7187
7189 {
7190 ItemBase.m_DebugActionsMask |= mask;
7191 }
7192
7194 {
7195 ItemBase.m_DebugActionsMask &= ~mask;
7196 }
7197
7199 {
7201 {
7203 }
7204 else
7205 {
7207 }
7208 }
7209
7210
7212 {
7213 if (GetEconomyProfile())
7214 {
7215 float q_max = GetEconomyProfile().GetQuantityMax();
7216 if (q_max > 0)
7217 {
7218 float q_min = GetEconomyProfile().GetQuantityMin();
7219 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7220
7222 {
7223 ComponentEnergyManager comp = GetCompEM();
7225 {
7227 }
7228 }
7230 {
7232
7233 }
7234
7235 }
7236 }
7237 }
7238
7241 {
7242 EntityAI parent = GetHierarchyParent();
7243
7244 if (parent)
7245 {
7246 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7247 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7248 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7249 }
7250 }
7251
7254 {
7255 EntityAI parent = GetHierarchyParent();
7256
7257 if (parent)
7258 {
7259 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7260 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7261 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7262 }
7263 }
7264
7266 {
7267
7268
7269
7270
7272
7274 {
7275 if (ScriptInputUserData.CanStoreInputUserData())
7276 {
7277 ScriptInputUserData ctx = new ScriptInputUserData;
7283 ctx.
Write(use_stack_max);
7286
7288 {
7289 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7290 }
7291 }
7292 }
7293 else if (!
GetGame().IsMultiplayer())
7294 {
7296 }
7297 }
7298
7300 {
7302 }
7303
7305 {
7307 }
7308
7310 {
7312 }
7313
7315 {
7316
7317 return false;
7318 }
7319
7321 {
7322 return false;
7323 }
7324
7328 {
7329 return false;
7330 }
7331
7333 {
7334 return "";
7335 }
7336
7338
7340 {
7341 return false;
7342 }
7343
7345 {
7346 return true;
7347 }
7348
7349
7350
7352 {
7353 return true;
7354 }
7355
7357 {
7358 return true;
7359 }
7360
7362 {
7363 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7365 }
7366
7368 {
7370 }
7371
7373 {
7375 if (!is_being_placed)
7377 SetSynchDirty();
7378 }
7379
7380
7382
7384 {
7386 }
7387
7389 {
7391 }
7392
7394 {
7395 return 1;
7396 }
7397
7399 {
7400 return false;
7401 }
7402
7404 {
7406 SetSynchDirty();
7407 }
7408
7409
7410
7411
7412
7413
7414
7415
7416
7417
7418
7419
7420
7421
7422
7423
7424
7425
7426
7427
7428
7429
7430
7431
7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7444 {
7445 super.OnMovedInsideCargo(container);
7446
7447 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7448 }
7449
7450 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7451 {
7452 super.EEItemLocationChanged(oldLoc,newLoc);
7453
7454 PlayerBase new_player = null;
7455 PlayerBase old_player = null;
7456
7457 if (newLoc.GetParent())
7458 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7459
7460 if (oldLoc.GetParent())
7461 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7462
7464 {
7465 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
7466
7467 if (r_index >= 0)
7468 {
7469 InventoryLocation r_il = new InventoryLocation;
7470 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7471
7472 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7475 {
7476 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7477 }
7479 {
7480 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7481 }
7482
7483 }
7484 }
7485
7487 {
7488 if (new_player)
7489 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
7490
7491 if (new_player == old_player)
7492 {
7493
7494 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7495 {
7497 {
7498 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7499 {
7500 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7501 }
7502 }
7503 else
7504 {
7505 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7506 }
7507 }
7508
7509 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7510 {
7511 int type = oldLoc.GetType();
7513 {
7514 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7515 }
7517 {
7518 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7519 }
7520 }
7521 if (!m_OldLocation)
7522 {
7523 m_OldLocation = new InventoryLocation;
7524 }
7525 m_OldLocation.Copy(oldLoc);
7526 }
7527 else
7528 {
7529 if (m_OldLocation)
7530 {
7531 m_OldLocation.Reset();
7532 }
7533 }
7534
7536 }
7537 else
7538 {
7539 if (new_player)
7540 {
7541 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7542 if (res_index >= 0)
7543 {
7544 InventoryLocation il = new InventoryLocation;
7545 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
7547 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
7550 {
7551 il.
GetParent().GetOnReleaseLock().Invoke(it);
7552 }
7554 {
7556 }
7557
7558 }
7559 }
7561 {
7562
7564 }
7565
7566 if (m_OldLocation)
7567 {
7568 m_OldLocation.Reset();
7569 }
7570 }
7571 }
7572
7573 override void EOnContact(IEntity other, Contact extra)
7574 {
7576 {
7577 int liquidType = -1;
7579 if (impactSpeed > 0.0)
7580 {
7582 #ifndef SERVER
7584 #else
7586 SetSynchDirty();
7587 #endif
7589 }
7590 }
7591
7592 #ifdef SERVER
7593 if (GetCompEM() && GetCompEM().IsPlugged())
7594 {
7595 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7596 GetCompEM().UnplugThis();
7597 }
7598 #endif
7599 }
7600
7602
7604 {
7606 }
7607
7609 {
7610
7611 }
7612
7614 {
7615 super.OnItemLocationChanged(old_owner, new_owner);
7616
7617 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7618 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7619
7620 if (!relatedPlayer && playerNew)
7621 relatedPlayer = playerNew;
7622
7623 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7624 {
7626 if (actionMgr)
7627 {
7628 ActionBase currentAction = actionMgr.GetRunningAction();
7629 if (currentAction)
7631 }
7632 }
7633
7634 Man ownerPlayerOld = null;
7635 Man ownerPlayerNew = null;
7636
7637 if (old_owner)
7638 {
7639 if (old_owner.
IsMan())
7640 {
7641 ownerPlayerOld = Man.Cast(old_owner);
7642 }
7643 else
7644 {
7645 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7646 }
7647 }
7648 else
7649 {
7651 {
7653
7654 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7655 {
7656 GetCompEM().UnplugThis();
7657 }
7658 }
7659 }
7660
7661 if (new_owner)
7662 {
7663 if (new_owner.
IsMan())
7664 {
7665 ownerPlayerNew = Man.Cast(new_owner);
7666 }
7667 else
7668 {
7669 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7670 }
7671 }
7672
7673 if (ownerPlayerOld != ownerPlayerNew)
7674 {
7675 if (ownerPlayerOld)
7676 {
7677 array<EntityAI> subItemsExit = new array<EntityAI>;
7679 for (int i = 0; i < subItemsExit.Count(); i++)
7680 {
7683 }
7684 }
7685
7686 if (ownerPlayerNew)
7687 {
7688 array<EntityAI> subItemsEnter = new array<EntityAI>;
7690 for (int j = 0; j < subItemsEnter.Count(); j++)
7691 {
7694 }
7695 }
7696 }
7697 else if (ownerPlayerNew != null)
7698 {
7699 PlayerBase nplayer;
7700 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7701 {
7702 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7704 for (int k = 0; k < subItemsUpdate.Count(); k++)
7705 {
7707 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7708 }
7709 }
7710 }
7711
7712 if (old_owner)
7713 old_owner.OnChildItemRemoved(this);
7714 if (new_owner)
7715 new_owner.OnChildItemReceived(this);
7716 }
7717
7718
7720 {
7721 super.EEDelete(parent);
7722 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7723 if (player)
7724 {
7726
7727 if (player.IsAlive())
7728 {
7729 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7730 if (r_index >= 0)
7731 {
7732 InventoryLocation r_il = new InventoryLocation;
7733 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7734
7735 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7738 {
7739 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7740 }
7742 {
7743 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7744 }
7745
7746 }
7747
7748 player.RemoveQuickBarEntityShortcut(this);
7749 }
7750 }
7751 }
7752
7754 {
7755 super.EEKilled(killer);
7756
7759 {
7760 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7761 {
7762 if (IsMagazine())
7763 {
7764 if (Magazine.Cast(this).GetAmmoCount() > 0)
7765 {
7767 }
7768 }
7769 else
7770 {
7772 }
7773 }
7774 }
7775 }
7776
7778 {
7779 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7780
7781 super.OnWasAttached(parent, slot_id);
7782
7785
7787 }
7788
7790 {
7791 super.OnWasDetached(parent, slot_id);
7792
7795 }
7796
7798 {
7799 int idx;
7802
7803 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7804 if (inventory_slots.Count() < 1)
7805 {
7806 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7807 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7808 }
7809 else
7810 {
7811 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7812 }
7813
7814 idx = inventory_slots.Find(slot);
7815 if (idx < 0)
7816 return "";
7817
7818 return attach_types.Get(idx);
7819 }
7820
7822 {
7823 int idx = -1;
7824 string slot;
7825
7828
7829 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7830 if (inventory_slots.Count() < 1)
7831 {
7832 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7833 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7834 }
7835 else
7836 {
7837 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7838 if (detach_types.Count() < 1)
7839 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7840 }
7841
7842 for (int i = 0; i < inventory_slots.Count(); i++)
7843 {
7844 slot = inventory_slots.Get(i);
7845 }
7846
7847 if (slot != "")
7848 {
7849 if (detach_types.Count() == 1)
7850 idx = 0;
7851 else
7852 idx = inventory_slots.Find(slot);
7853 }
7854 if (idx < 0)
7855 return "";
7856
7857 return detach_types.Get(idx);
7858 }
7859
7861 {
7862
7864
7865
7866 float min_time = 1;
7867 float max_time = 3;
7868 float delay = Math.RandomFloat(min_time, max_time);
7869
7870 explode_timer.Run(delay, this, "DoAmmoExplosion");
7871 }
7872
7874 {
7875 Magazine magazine = Magazine.Cast(this);
7876 int pop_sounds_count = 6;
7877 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7878
7879
7880 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7881 string sound_name = pop_sounds[ sound_idx ];
7883
7884
7885 magazine.ServerAddAmmoCount(-1);
7886
7887
7888 float min_temp_to_explode = 100;
7889
7890 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7891 {
7893 }
7894 }
7895
7896
7897 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7898 {
7899 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7900
7901 const int CHANCE_DAMAGE_CARGO = 4;
7902 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7903 const int CHANCE_DAMAGE_NOTHING = 2;
7904
7906 {
7907 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7908 int chances;
7909 int rnd;
7910
7911 if (GetInventory().GetCargo())
7912 {
7913 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7914 rnd = Math.RandomInt(0,chances);
7915
7916 if (rnd < CHANCE_DAMAGE_CARGO)
7917 {
7919 }
7920 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7921 {
7923 }
7924 }
7925 else
7926 {
7927 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7928 rnd = Math.RandomInt(0,chances);
7929
7930 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7931 {
7933 }
7934 }
7935 }
7936 }
7937
7939 {
7940 if (GetInventory().GetCargo())
7941 {
7942 int item_count = GetInventory().GetCargo().GetItemCount();
7943 if (item_count > 0)
7944 {
7945 int random_pick = Math.RandomInt(0, item_count);
7947 if (!item.IsExplosive())
7948 {
7949 item.AddHealth("","",damage);
7950 return true;
7951 }
7952 }
7953 }
7954 return false;
7955 }
7956
7958 {
7959 int attachment_count = GetInventory().AttachmentCount();
7960 if (attachment_count > 0)
7961 {
7962 int random_pick = Math.RandomInt(0, attachment_count);
7963 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7964 if (!attachment.IsExplosive())
7965 {
7966 attachment.AddHealth("","",damage);
7967 return true;
7968 }
7969 }
7970 return false;
7971 }
7972
7974 {
7976 }
7977
7979 {
7981 return GetInventory().CanRemoveEntity();
7982
7983 return false;
7984 }
7985
7987 {
7988
7990 return false;
7991
7992
7994 return false;
7995
7996
7997
7999 if (delta == 0)
8000 return false;
8001
8002
8003 return true;
8004 }
8005
8007 {
8009 {
8010 if (ScriptInputUserData.CanStoreInputUserData())
8011 {
8012 ScriptInputUserData ctx = new ScriptInputUserData;
8017 ctx.
Write(destination_entity);
8021 }
8022 }
8023 else if (!
GetGame().IsMultiplayer())
8024 {
8026 }
8027 }
8028
8030 {
8031 float split_quantity_new;
8035 InventoryLocation loc = new InventoryLocation;
8036
8037 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8038 {
8040 split_quantity_new = stack_max;
8041 else
8043
8045 {
8046 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8047 if (new_item)
8048 {
8049 new_item.SetResultOfSplit(true);
8050 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8052 new_item.
SetQuantity(split_quantity_new,
false,
true);
8053 }
8054 }
8055 }
8056 else if (destination_entity && slot_id == -1)
8057 {
8058 if (quantity > stack_max)
8059 split_quantity_new = stack_max;
8060 else
8061 split_quantity_new = quantity;
8062
8064 {
8066 {
8069 }
8070
8071 if (new_item)
8072 {
8073 new_item.SetResultOfSplit(true);
8074 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8076 new_item.
SetQuantity(split_quantity_new,
false,
true);
8077 }
8078 }
8079 }
8080 else
8081 {
8082 if (stack_max != 0)
8083 {
8085 {
8087 }
8088
8089 if (split_quantity_new == 0)
8090 {
8091 if (!
GetGame().IsMultiplayer())
8092 player.PhysicalPredictiveDropItem(this);
8093 else
8094 player.ServerDropEntity(this);
8095 return;
8096 }
8097
8099 {
8101
8102 if (new_item)
8103 {
8104 new_item.SetResultOfSplit(true);
8105 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8108 new_item.PlaceOnSurface();
8109 }
8110 }
8111 }
8112 }
8113 }
8114
8116 {
8117 float split_quantity_new;
8121 InventoryLocation loc = new InventoryLocation;
8122
8123 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8124 {
8126 split_quantity_new = stack_max;
8127 else
8129
8131 {
8132 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8133 if (new_item)
8134 {
8135 new_item.SetResultOfSplit(true);
8136 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8138 new_item.
SetQuantity(split_quantity_new,
false,
true);
8139 }
8140 }
8141 }
8142 else if (destination_entity && slot_id == -1)
8143 {
8144 if (quantity > stack_max)
8145 split_quantity_new = stack_max;
8146 else
8147 split_quantity_new = quantity;
8148
8150 {
8152 {
8155 }
8156
8157 if (new_item)
8158 {
8159 new_item.SetResultOfSplit(true);
8160 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8162 new_item.
SetQuantity(split_quantity_new,
false,
true);
8163 }
8164 }
8165 }
8166 else
8167 {
8168 if (stack_max != 0)
8169 {
8171 {
8173 }
8174
8176 {
8178
8179 if (new_item)
8180 {
8181 new_item.SetResultOfSplit(true);
8182 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8185 new_item.PlaceOnSurface();
8186 }
8187 }
8188 }
8189 }
8190 }
8191
8193 {
8195 {
8196 if (ScriptInputUserData.CanStoreInputUserData())
8197 {
8198 ScriptInputUserData ctx = new ScriptInputUserData;
8203 dst.WriteToContext(ctx);
8205 }
8206 }
8207 else if (!
GetGame().IsMultiplayer())
8208 {
8210 }
8211 }
8212
8214 {
8216 {
8217 if (ScriptInputUserData.CanStoreInputUserData())
8218 {
8219 ScriptInputUserData ctx = new ScriptInputUserData;
8224 ctx.
Write(destination_entity);
8230 }
8231 }
8232 else if (!
GetGame().IsMultiplayer())
8233 {
8235 }
8236 }
8237
8239 {
8241 }
8242
8244 {
8246 float split_quantity_new;
8248 if (dst.IsValid())
8249 {
8250 int slot_id = dst.GetSlot();
8252
8253 if (quantity > stack_max)
8254 split_quantity_new = stack_max;
8255 else
8256 split_quantity_new = quantity;
8257
8259 {
8261
8262 if (new_item)
8263 {
8264 new_item.SetResultOfSplit(true);
8265 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8267 new_item.
SetQuantity(split_quantity_new,
false,
true);
8268 }
8269
8270 return new_item;
8271 }
8272 }
8273
8274 return null;
8275 }
8276
8278 {
8280 float split_quantity_new;
8282 if (destination_entity)
8283 {
8285 if (quantity > stackable)
8286 split_quantity_new = stackable;
8287 else
8288 split_quantity_new = quantity;
8289
8291 {
8292 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8293 if (new_item)
8294 {
8295 new_item.SetResultOfSplit(true);
8296 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8298 new_item.
SetQuantity(split_quantity_new,
false,
true);
8299 }
8300 }
8301 }
8302 }
8303
8305 {
8307 {
8308 if (ScriptInputUserData.CanStoreInputUserData())
8309 {
8310 ScriptInputUserData ctx = new ScriptInputUserData;
8315 ItemBase destination_entity =
this;
8316 ctx.
Write(destination_entity);
8320 }
8321 }
8322 else if (!
GetGame().IsMultiplayer())
8323 {
8325 }
8326 }
8327
8329 {
8331 float split_quantity_new;
8333 if (player)
8334 {
8336 if (quantity > stackable)
8337 split_quantity_new = stackable;
8338 else
8339 split_quantity_new = quantity;
8340
8342 {
8343 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8344 new_item =
ItemBase.Cast(in_hands);
8345 if (new_item)
8346 {
8347 new_item.SetResultOfSplit(true);
8348 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8350 new_item.SetQuantity(split_quantity_new, false, true);
8351 }
8352 }
8353 }
8354 }
8355
8357 {
8359 float split_quantity_new = Math.Floor(quantity * 0.5);
8360
8362 return;
8363
8365
8366 if (new_item)
8367 {
8368 if (new_item.GetQuantityMax() < split_quantity_new)
8369 {
8370 split_quantity_new = new_item.GetQuantityMax();
8371 }
8372
8373 new_item.SetResultOfSplit(true);
8374 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8375
8377 {
8380 }
8381 else
8382 {
8384 new_item.
SetQuantity(split_quantity_new,
false,
true);
8385 }
8386 }
8387 }
8388
8390 {
8392 float split_quantity_new = Math.Floor(quantity / 2);
8393
8395 return;
8396
8397 InventoryLocation invloc = new InventoryLocation;
8399
8401 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8402
8403 if (new_item)
8404 {
8405 if (new_item.GetQuantityMax() < split_quantity_new)
8406 {
8407 split_quantity_new = new_item.GetQuantityMax();
8408 }
8410 {
8413 }
8414 else if (split_quantity_new > 1)
8415 {
8417 new_item.
SetQuantity(split_quantity_new,
false,
true);
8418 }
8419 }
8420 }
8421
8424 {
8425 SetWeightDirty();
8427
8428 if (parent)
8429 parent.OnAttachmentQuantityChangedEx(this, delta);
8430
8432 {
8434 {
8436 }
8438 {
8439 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8441 }
8442 }
8443
8444 }
8445
8448 {
8449
8450 }
8451
8454 {
8456 }
8457
8459 {
8460 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8461
8463 {
8464 if (newLevel == GameConstants.STATE_RUINED)
8465 {
8467 EntityAI parent = GetHierarchyParent();
8468 if (parent && parent.IsFireplace())
8469 {
8470 CargoBase cargo = GetInventory().GetCargo();
8471 if (cargo)
8472 {
8474 {
8476 }
8477 }
8478 }
8479 }
8480
8482 {
8483
8485 return;
8486 }
8487
8488 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8489 {
8491 }
8492 }
8493 }
8494
8495
8497 {
8498 super.OnRightClick();
8499
8501 {
8503 {
8504 if (ScriptInputUserData.CanStoreInputUserData())
8505 {
8506 EntityAI root = GetHierarchyRoot();
8507 Man playerOwner = GetHierarchyRootPlayer();
8508 InventoryLocation dst = new InventoryLocation;
8509
8510
8511 if (!playerOwner && root && root == this)
8512 {
8514 }
8515 else
8516 {
8517
8518 GetInventory().GetCurrentInventoryLocation(dst);
8520 {
8523 {
8525 }
8526 else
8527 {
8529
8530
8531 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8532 {
8534 }
8535 else
8536 {
8537 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8538 }
8539 }
8540 }
8541 }
8542
8543 ScriptInputUserData ctx = new ScriptInputUserData;
8551 }
8552 }
8553 else if (!
GetGame().IsMultiplayer())
8554 {
8556 }
8557 }
8558 }
8559
8561 {
8562 if (root)
8563 {
8564 vector m4[4];
8565 root.GetTransform(m4);
8566 dst.SetGround(this, m4);
8567 }
8568 else
8569 {
8570 GetInventory().GetCurrentInventoryLocation(dst);
8571 }
8572 }
8573
8574 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8575 {
8576
8577 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8578 return false;
8579
8580 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8581 return false;
8582
8583
8585 return false;
8586
8587
8588 Magazine mag = Magazine.Cast(this);
8589 if (mag)
8590 {
8591 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8592 return false;
8593
8594 if (stack_max_limit)
8595 {
8596 Magazine other_mag = Magazine.Cast(other_item);
8597 if (other_item)
8598 {
8599 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8600 return false;
8601 }
8602
8603 }
8604 }
8605 else
8606 {
8607
8609 return false;
8610
8612 return false;
8613 }
8614
8615 PlayerBase player = null;
8616 if (CastTo(player, GetHierarchyRootPlayer()))
8617 {
8618 if (player.GetInventory().HasAttachment(this))
8619 return false;
8620
8621 if (player.IsItemsToDelete())
8622 return false;
8623 }
8624
8625 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8626 return false;
8627
8628 int slotID;
8630 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8631 return false;
8632
8633 return true;
8634 }
8635
8637 {
8639 }
8640
8642 {
8643 return m_IsResultOfSplit;
8644 }
8645
8647 {
8648 m_IsResultOfSplit = value;
8649 }
8650
8652 {
8654 }
8655
8657 {
8658 float other_item_quantity = other_item.GetQuantity();
8659 float this_free_space;
8660
8662
8664
8665 if (other_item_quantity > this_free_space)
8666 {
8667 return this_free_space;
8668 }
8669 else
8670 {
8671 return other_item_quantity;
8672 }
8673 }
8674
8676 {
8678 }
8679
8681 {
8683 return;
8684
8685 if (!IsMagazine() && other_item)
8686 {
8688 if (quantity_used != 0)
8689 {
8690 float hp1 = GetHealth01("","");
8691 float hp2 = other_item.GetHealth01("","");
8692 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8693 hpResult = hpResult / (
GetQuantity() + quantity_used);
8694
8695 hpResult *= GetMaxHealth();
8696 Math.Round(hpResult);
8697 SetHealth("", "Health", hpResult);
8698
8700 other_item.AddQuantity(-quantity_used);
8701 }
8702 }
8704 }
8705
8707 {
8708 #ifdef SERVER
8709 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8710 GetHierarchyParent().IncreaseLifetimeUp();
8711 #endif
8712 };
8713
8715 {
8716 PlayerBase p = PlayerBase.Cast(player);
8717
8718 array<int> recipesIds = p.m_Recipes;
8719 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8720 if (moduleRecipesManager)
8721 {
8722 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8723 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8724 }
8725
8726 for (int i = 0;i < recipesIds.Count(); i++)
8727 {
8728 int key = recipesIds.Get(i);
8729 string recipeName = moduleRecipesManager.GetRecipeName(key);
8731 }
8732 }
8733
8734
8735 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8736 {
8737 super.GetDebugActions(outputList);
8738
8739
8745
8746
8751
8756
8757
8761
8762
8764 {
8768 }
8769
8772
8773
8777
8779
8780 InventoryLocation loc = new InventoryLocation();
8781 GetInventory().GetCurrentInventoryLocation(loc);
8783 {
8784 if (Gizmo_IsSupported())
8787 }
8788
8790 }
8791
8792
8793
8794
8796 {
8797 super.OnAction(action_id, player, ctx);
8798
8800 {
8801 switch (action_id)
8802 {
8805 return true;
8808 return true;
8809 }
8810 }
8811
8813 {
8814 switch (action_id)
8815 {
8817 Delete();
8818 return true;
8819 }
8820 }
8821
8822 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8823 {
8824 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8825 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8826 PlayerBase p = PlayerBase.Cast(player);
8827 if (
EActions.RECIPES_RANGE_START < 1000)
8828 {
8829 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8830 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8831 }
8832 }
8833 #ifndef SERVER
8834 else if (action_id ==
EActions.WATCH_PLAYER)
8835 {
8836 PluginDeveloper.SetDeveloperItemClientEx(player);
8837 }
8838 #endif
8840 {
8841 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8842 {
8843 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8844 OnDebugButtonPressServer(id + 1);
8845 }
8846
8847 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8848 {
8849 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8851 }
8852
8853 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8854 {
8855 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8857 }
8858
8859 else if (action_id ==
EActions.ADD_QUANTITY)
8860 {
8861 if (IsMagazine())
8862 {
8863 Magazine mag = Magazine.Cast(this);
8864 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8865 }
8866 else
8867 {
8869 }
8870
8871 if (m_EM)
8872 {
8873 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8874 }
8875
8876 }
8877
8878 else if (action_id ==
EActions.REMOVE_QUANTITY)
8879 {
8880 if (IsMagazine())
8881 {
8882 Magazine mag2 = Magazine.Cast(this);
8883 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8884 }
8885 else
8886 {
8888 }
8889 if (m_EM)
8890 {
8891 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8892 }
8893
8894 }
8895
8896 else if (action_id ==
EActions.SET_QUANTITY_0)
8897 {
8899
8900 if (m_EM)
8901 {
8902 m_EM.SetEnergy(0);
8903 }
8904 }
8905
8906 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8907 {
8909
8910 if (m_EM)
8911 {
8912 m_EM.SetEnergy(m_EM.GetEnergyMax());
8913 }
8914 }
8915
8916 else if (action_id ==
EActions.ADD_HEALTH)
8917 {
8918 AddHealth("","",GetMaxHealth("","Health")/5);
8919 }
8920 else if (action_id ==
EActions.REMOVE_HEALTH)
8921 {
8922 AddHealth("","",-GetMaxHealth("","Health")/5);
8923 }
8924 else if (action_id ==
EActions.DESTROY_HEALTH)
8925 {
8926 SetHealth01("","",0);
8927 }
8928 else if (action_id ==
EActions.WATCH_ITEM)
8929 {
8931 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8932 #ifdef DEVELOPER
8933 SetDebugDeveloper_item(this);
8934 #endif
8935 }
8936
8937 else if (action_id ==
EActions.ADD_TEMPERATURE)
8938 {
8939 AddTemperature(20);
8940
8941 }
8942
8943 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8944 {
8945 AddTemperature(-20);
8946
8947 }
8948
8949 else if (action_id ==
EActions.FLIP_FROZEN)
8950 {
8951 SetFrozen(!GetIsFrozen());
8952
8953 }
8954
8955 else if (action_id ==
EActions.ADD_WETNESS)
8956 {
8958
8959 }
8960
8961 else if (action_id ==
EActions.REMOVE_WETNESS)
8962 {
8964
8965 }
8966
8967 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8968 {
8971
8972
8973 }
8974
8975 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8976 {
8979 }
8980
8981 else if (action_id ==
EActions.MAKE_SPECIAL)
8982 {
8983 auto debugParams = DebugSpawnParams.WithPlayer(player);
8984 OnDebugSpawnEx(debugParams);
8985 }
8986
8987 }
8988
8989
8990 return false;
8991 }
8992
8993
8994
8995
8999
9002
9003
9004
9006 {
9007 return false;
9008 }
9009
9010
9012 {
9013 return true;
9014 }
9015
9016
9018 {
9019 return true;
9020 }
9021
9022
9023
9025 {
9026 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9028 }
9029
9032 {
9033 return null;
9034 }
9035
9037 {
9038 return false;
9039 }
9040
9042 {
9043 return false;
9044 }
9045
9049
9050
9052 {
9053 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9054 return module_repairing.CanRepair(this, item_repair_kit);
9055 }
9056
9057
9058 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9059 {
9060 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9061 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9062 }
9063
9064
9066 {
9067
9068
9069
9070
9071
9072
9073
9074
9075 return 1;
9076 }
9077
9078
9079
9081 {
9083 }
9084
9085
9086
9088 {
9090 }
9091
9092
9101 {
9102 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9103
9104 if (player)
9105 {
9106 player.MessageStatus(text);
9107 }
9108 }
9109
9110
9119 {
9120 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9121
9122 if (player)
9123 {
9124 player.MessageAction(text);
9125 }
9126 }
9127
9128
9137 {
9138 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9139
9140 if (player)
9141 {
9142 player.MessageFriendly(text);
9143 }
9144 }
9145
9146
9155 {
9156 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9157
9158 if (player)
9159 {
9160 player.MessageImportant(text);
9161 }
9162 }
9163
9165 {
9166 return true;
9167 }
9168
9169
9170 override bool KindOf(
string tag)
9171 {
9172 bool found = false;
9173 string item_name = this.
GetType();
9176
9177 int array_size = item_tag_array.Count();
9178 for (int i = 0; i < array_size; i++)
9179 {
9180 if (item_tag_array.Get(i) == tag)
9181 {
9182 found = true;
9183 break;
9184 }
9185 }
9186 return found;
9187 }
9188
9189
9191 {
9192
9193 super.OnRPC(sender, rpc_type,ctx);
9194
9195
9196 switch (rpc_type)
9197 {
9198 #ifndef SERVER
9199 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9200 Param2<bool, string> p = new Param2<bool, string>(false, "");
9201
9203 return;
9204
9205 bool play = p.param1;
9206 string soundSet = p.param2;
9207
9208 if (play)
9209 {
9211 {
9213 {
9215 }
9216 }
9217 else
9218 {
9220 }
9221 }
9222 else
9223 {
9225 }
9226
9227 break;
9228 #endif
9229
9230 }
9231
9233 {
9235 }
9236 }
9237
9238
9239
9240
9242 {
9243 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9244 return plugin.GetID(
name);
9245 }
9246
9248 {
9249 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9250 return plugin.GetName(id);
9251 }
9252
9255 {
9256
9257
9258 int varFlags;
9259 if (!ctx.
Read(varFlags))
9260 return;
9261
9262 if (varFlags & ItemVariableFlags.FLOAT)
9263 {
9265 }
9266 }
9267
9269 {
9270
9271 super.SerializeNumericalVars(floats_out);
9272
9273
9274
9276 {
9278 }
9279
9281 {
9283 }
9284
9286 {
9288 }
9289
9291 {
9296 }
9297
9299 {
9301 }
9302 }
9303
9305 {
9306
9307 super.DeSerializeNumericalVars(floats);
9308
9309
9310 int index = 0;
9311 int mask = Math.Round(floats.Get(index));
9312
9313 index++;
9314
9316 {
9318 {
9320 }
9321 else
9322 {
9323 float quantity = floats.Get(index);
9325 }
9326 index++;
9327 }
9328
9330 {
9331 float wet = floats.Get(index);
9333 index++;
9334 }
9335
9337 {
9338 int liquidtype = Math.Round(floats.Get(index));
9340 index++;
9341 }
9342
9344 {
9346 index++;
9348 index++;
9350 index++;
9352 index++;
9353 }
9354
9356 {
9357 int cleanness = Math.Round(floats.Get(index));
9359 index++;
9360 }
9361 }
9362
9364 {
9365 super.WriteVarsToCTX(ctx);
9366
9367
9369 {
9371 }
9372
9374 {
9376 }
9377
9379 {
9381 }
9382
9384 {
9385 int r,g,b,a;
9391 }
9392
9394 {
9396 }
9397 }
9398
9400 {
9401 if (!super.ReadVarsFromCTX(ctx,version))
9402 return false;
9403
9404 int intValue;
9405 float value;
9406
9407 if (version < 140)
9408 {
9409 if (!ctx.
Read(intValue))
9410 return false;
9411
9412 m_VariablesMask = intValue;
9413 }
9414
9416 {
9417 if (!ctx.
Read(value))
9418 return false;
9419
9421 {
9423 }
9424 else
9425 {
9427 }
9428 }
9429
9430 if (version < 140)
9431 {
9433 {
9434 if (!ctx.
Read(value))
9435 return false;
9436 SetTemperatureDirect(value);
9437 }
9438 }
9439
9441 {
9442 if (!ctx.
Read(value))
9443 return false;
9445 }
9446
9448 {
9449 if (!ctx.
Read(intValue))
9450 return false;
9452 }
9453
9455 {
9456 int r,g,b,a;
9458 return false;
9460 return false;
9462 return false;
9464 return false;
9465
9467 }
9468
9470 {
9471 if (!ctx.
Read(intValue))
9472 return false;
9474 }
9475
9476 if (version >= 138 && version < 140)
9477 {
9479 {
9480 if (!ctx.
Read(intValue))
9481 return false;
9482 SetFrozen(intValue);
9483 }
9484 }
9485
9486 return true;
9487 }
9488
9489
9491 {
9494 {
9496 }
9497
9498 if (!super.OnStoreLoad(ctx, version))
9499 {
9501 return false;
9502 }
9503
9504 if (version >= 114)
9505 {
9506 bool hasQuickBarIndexSaved;
9507
9508 if (!ctx.
Read(hasQuickBarIndexSaved))
9509 {
9511 return false;
9512 }
9513
9514 if (hasQuickBarIndexSaved)
9515 {
9516 int itmQBIndex;
9517
9518
9519 if (!ctx.
Read(itmQBIndex))
9520 {
9522 return false;
9523 }
9524
9525 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9526 if (itmQBIndex != -1 && parentPlayer)
9527 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9528 }
9529 }
9530 else
9531 {
9532
9533 PlayerBase player;
9534 int itemQBIndex;
9535 if (version ==
int.
MAX)
9536 {
9537 if (!ctx.
Read(itemQBIndex))
9538 {
9540 return false;
9541 }
9542 }
9543 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9544 {
9545
9546 if (!ctx.
Read(itemQBIndex))
9547 {
9549 return false;
9550 }
9551 if (itemQBIndex != -1 && player)
9552 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9553 }
9554 }
9555
9556 if (version < 140)
9557 {
9558
9559 if (!LoadVariables(ctx, version))
9560 {
9562 return false;
9563 }
9564 }
9565
9566
9568 {
9570 return false;
9571 }
9572 if (version >= 132)
9573 {
9575 if (raib)
9576 {
9578 {
9580 return false;
9581 }
9582 }
9583 }
9584
9586 return true;
9587 }
9588
9589
9590
9592 {
9593 super.OnStoreSave(ctx);
9594
9595 PlayerBase player;
9596 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9597 {
9599
9600 int itemQBIndex = -1;
9601 itemQBIndex = player.FindQuickBarEntityIndex(this);
9602 ctx.
Write(itemQBIndex);
9603 }
9604 else
9605 {
9607 }
9608
9610
9612 if (raib)
9613 {
9615 }
9616 }
9617
9618
9620 {
9621 super.AfterStoreLoad();
9622
9624 {
9626 }
9627
9629 {
9632 }
9633 }
9634
9636 {
9637 super.EEOnAfterLoad();
9638
9640 {
9642 }
9643
9646 }
9647
9649 {
9650 return false;
9651 }
9652
9653
9654
9656 {
9658 {
9659 #ifdef PLATFORM_CONSOLE
9660
9662 {
9664 if (menu)
9665 {
9667 }
9668 }
9669 #endif
9670 }
9671
9673 {
9676 }
9677
9679 {
9680 SetWeightDirty();
9682 }
9684 {
9687 }
9688
9690 {
9693 }
9695 {
9698 }
9699
9700 super.OnVariablesSynchronized();
9701 }
9702
9703
9704
9706 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9707 {
9708 if (!IsServerCheck(allow_client))
9709 return false;
9710
9712 return false;
9713
9716
9717 if (value <= (min + 0.001))
9718 value = min;
9719
9720 if (value == min)
9721 {
9722 if (destroy_config)
9723 {
9724 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9725 if (dstr)
9726 {
9728 this.Delete();
9729 return true;
9730 }
9731 }
9732 else if (destroy_forced)
9733 {
9735 this.Delete();
9736 return true;
9737 }
9738
9740 }
9741
9744
9746 {
9748
9749 if (delta)
9751 }
9752
9754
9755 return false;
9756 }
9757
9758
9760 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9761 {
9763 }
9764
9766 {
9769 }
9770
9772 {
9775 }
9776
9778 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9779 {
9780 float value_clamped = Math.Clamp(value, 0, 1);
9782 SetQuantity(result, destroy_config, destroy_forced);
9783 }
9784
9785
9788 {
9790 }
9791
9793 {
9795 }
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9807 {
9808 int slot = -1;
9809 if (GetInventory())
9810 {
9811 InventoryLocation il = new InventoryLocation;
9812 GetInventory().GetCurrentInventoryLocation(il);
9814 }
9815
9817 }
9818
9820 {
9821 float quantity_max = 0;
9822
9824 {
9825 if (attSlotID != -1)
9826 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9827
9828 if (quantity_max <= 0)
9830 }
9831
9832 if (quantity_max <= 0)
9834
9835 return quantity_max;
9836 }
9837
9839 {
9841 }
9842
9844 {
9846 }
9847
9848
9850 {
9852 }
9853
9855 {
9857 }
9858
9860 {
9862 }
9863
9864
9866 {
9867
9868 float weightEx = GetWeightEx();
9869 float special = GetInventoryAndCargoWeight();
9870 return weightEx - special;
9871 }
9872
9873
9875 {
9877 }
9878
9880 {
9882 {
9883 #ifdef DEVELOPER
9884 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9885 {
9886 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9888 }
9889 #endif
9890
9892 }
9893 else if (HasEnergyManager())
9894 {
9895 #ifdef DEVELOPER
9896 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9897 {
9898 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9899 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9900 }
9901 #endif
9902 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9903 }
9904 else
9905 {
9906 #ifdef DEVELOPER
9907 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9908 {
9909 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9910 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9911 }
9912 #endif
9913 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9914 }
9915 }
9916
9919 {
9920 int item_count = 0;
9922
9923 if (GetInventory().GetCargo() != NULL)
9924 {
9925 item_count = GetInventory().GetCargo().GetItemCount();
9926 }
9927
9928 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9929 {
9930 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9931 if (item)
9932 item_count += item.GetNumberOfItems();
9933 }
9934 return item_count;
9935 }
9936
9939 {
9940 float weight = 0;
9941 float wetness = 1;
9942 if (include_wetness)
9945 {
9946 weight = wetness * m_ConfigWeight;
9947 }
9949 {
9950 weight = 1;
9951 }
9952 return weight;
9953 }
9954
9955
9956
9958 {
9959 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9960 {
9961 GameInventory inv = GetInventory();
9962 array<EntityAI> items = new array<EntityAI>;
9964 for (int i = 0; i < items.Count(); i++)
9965 {
9967 if (item)
9968 {
9970 }
9971 }
9972 }
9973 }
9974
9975
9976
9977
9979 {
9980 float energy = 0;
9981 if (HasEnergyManager())
9982 {
9983 energy = GetCompEM().GetEnergy();
9984 }
9985 return energy;
9986 }
9987
9988
9990 {
9991 super.OnEnergyConsumed();
9992
9994 }
9995
9997 {
9998 super.OnEnergyAdded();
9999
10001 }
10002
10003
10005 {
10006 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10007 {
10009 {
10010 float energy_0to1 = GetCompEM().GetEnergy0To1();
10012 }
10013 }
10014 }
10015
10016
10018 {
10019 return ConfigGetFloat("heatIsolation");
10020 }
10021
10023 {
10025 }
10026
10028 {
10029 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10030 if (
GetGame().ConfigIsExisting(paramPath))
10032
10033 return 0.0;
10034 }
10035
10037 {
10038 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10039 if (
GetGame().ConfigIsExisting(paramPath))
10041
10042 return 0.0;
10043 }
10044
10045 override void SetWet(
float value,
bool allow_client =
false)
10046 {
10047 if (!IsServerCheck(allow_client))
10048 return;
10049
10052
10054
10055 m_VarWet = Math.Clamp(value, min, max);
10056
10058 {
10061 }
10062 }
10063
10064 override void AddWet(
float value)
10065 {
10067 }
10068
10070 {
10072 }
10073
10075 {
10077 }
10078
10080 {
10082 }
10083
10085 {
10087 }
10088
10090 {
10092 }
10093
10094 override void OnWetChanged(
float newVal,
float oldVal)
10095 {
10098 if (newLevel != oldLevel)
10099 {
10101 }
10102 }
10103
10105 {
10106 SetWeightDirty();
10107 }
10108
10110 {
10111 return GetWetLevelInternal(
m_VarWet);
10112 }
10113
10114
10115
10117 {
10119 }
10120
10122 {
10124 }
10125
10127 {
10129 }
10130
10132 {
10134 }
10135
10136
10137
10139 {
10140 if (ConfigIsExisting("itemModelLength"))
10141 {
10142 return ConfigGetFloat("itemModelLength");
10143 }
10144 return 0;
10145 }
10146
10148 {
10149 if (ConfigIsExisting("itemAttachOffset"))
10150 {
10151 return ConfigGetFloat("itemAttachOffset");
10152 }
10153 return 0;
10154 }
10155
10156 override void SetCleanness(
int value,
bool allow_client =
false)
10157 {
10158 if (!IsServerCheck(allow_client))
10159 return;
10160
10162
10164
10167 }
10168
10170 {
10172 }
10173
10175 {
10176 return true;
10177 }
10178
10179
10180
10181
10183 {
10185 }
10186
10188 {
10190 }
10191
10192
10193
10194
10195 override void SetColor(
int r,
int g,
int b,
int a)
10196 {
10202 }
10204 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10205 {
10210 }
10211
10213 {
10215 }
10216
10219 {
10220 int r,g,b,a;
10222 r = r/255;
10223 g = g/255;
10224 b = b/255;
10225 a = a/255;
10226 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10227 }
10228
10229
10230
10231 override void SetLiquidType(
int value,
bool allow_client =
false)
10232 {
10233 if (!IsServerCheck(allow_client))
10234 return;
10235
10240 }
10241
10243 {
10244 return ConfigGetInt("varLiquidTypeInit");
10245 }
10246
10248 {
10250 }
10251
10253 {
10255 SetFrozen(false);
10256 }
10257
10260 {
10261 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10262 }
10263
10264
10267 {
10268 PlayerBase nplayer;
10269 if (PlayerBase.CastTo(nplayer, player))
10270 {
10272
10273 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10274 }
10275 }
10276
10277
10280 {
10281 PlayerBase nplayer;
10282 if (PlayerBase.CastTo(nplayer,player))
10283 {
10284
10285 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10286
10287 }
10288
10289
10290 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10291
10292
10293 if (HasEnergyManager())
10294 {
10295 GetCompEM().UpdatePlugState();
10296 }
10297 }
10298
10299
10301 {
10302 super.OnPlacementStarted(player);
10303
10305 }
10306
10307 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10308 {
10310 {
10311 m_AdminLog.OnPlacementComplete(player,
this);
10312 }
10313
10314 super.OnPlacementComplete(player, position, orientation);
10315 }
10316
10317
10318
10319
10320
10322 {
10324 {
10325 return true;
10326 }
10327 else
10328 {
10329 return false;
10330 }
10331 }
10332
10333
10335 {
10337 {
10339 }
10340 }
10341
10342
10344 {
10346 }
10347
10349 {
10351 }
10352
10353 override void InsertAgent(
int agent,
float count = 1)
10354 {
10355 if (count < 1)
10356 return;
10357
10359 }
10360
10363 {
10365 }
10366
10367
10369 {
10371 }
10372
10373
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10415 {
10417 return false;
10418 return true;
10419 }
10420
10422 {
10423
10425 }
10426
10427
10430 {
10431 super.CheckForRoofLimited(timeTresholdMS);
10432
10434 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10435 {
10436 m_PreviousRoofTestTime = time;
10437 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10438 }
10439 }
10440
10441
10443 {
10445 {
10446 return 0;
10447 }
10448
10449 if (GetInventory().GetAttachmentSlotsCount() != 0)
10450 {
10451 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10452 if (filter)
10453 return filter.GetProtectionLevel(type, false, system);
10454 else
10455 return 0;
10456 }
10457
10458 string subclassPath, entryName;
10459
10460 switch (type)
10461 {
10463 entryName = "biological";
10464 break;
10466 entryName = "chemical";
10467 break;
10468 default:
10469 entryName = "biological";
10470 break;
10471 }
10472
10473 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10474
10476 }
10477
10478
10479
10482 {
10483 if (!IsMagazine())
10485
10487 }
10488
10489
10490
10491
10492
10497 {
10498 return true;
10499 }
10500
10502 {
10504 }
10505
10506
10507
10508
10509
10511 {
10512 if (parent)
10513 {
10514 if (parent.IsInherited(DayZInfected))
10515 return true;
10516
10517 if (!parent.IsRuined())
10518 return true;
10519 }
10520
10521 return true;
10522 }
10523
10525 {
10526 if (!super.CanPutAsAttachment(parent))
10527 {
10528 return false;
10529 }
10530
10531 if (!IsRuined() && !parent.IsRuined())
10532 {
10533 return true;
10534 }
10535
10536 return false;
10537 }
10538
10540 {
10541
10542
10543
10544
10545 return super.CanReceiveItemIntoCargo(item);
10546 }
10547
10549 {
10550
10551
10552
10553
10554 GameInventory attachmentInv = attachment.GetInventory();
10556 {
10557 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10558 return false;
10559 }
10560
10561 InventoryLocation loc = new InventoryLocation();
10562 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10563 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10564 return false;
10565
10566 return super.CanReceiveAttachment(attachment, slotId);
10567 }
10568
10570 {
10571 if (!super.CanReleaseAttachment(attachment))
10572 return false;
10573
10574 return GetInventory().AreChildrenAccessible();
10575 }
10576
10577
10578
10579
10580
10581
10582
10583
10584
10585
10586
10587
10588
10589
10590
10591
10592
10593
10594
10595
10596
10598 {
10599 int id = muzzle_owner.GetMuzzleID();
10600 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10601
10602 if (WPOF_array)
10603 {
10604 for (int i = 0; i < WPOF_array.Count(); i++)
10605 {
10606 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10607
10608 if (WPOF)
10609 {
10610 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10611 }
10612 }
10613 }
10614 }
10615
10616
10618 {
10619 int id = muzzle_owner.GetMuzzleID();
10621
10622 if (WPOBE_array)
10623 {
10624 for (int i = 0; i < WPOBE_array.Count(); i++)
10625 {
10626 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10627
10628 if (WPOBE)
10629 {
10630 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10631 }
10632 }
10633 }
10634 }
10635
10636
10638 {
10639 int id = muzzle_owner.GetMuzzleID();
10640 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10641
10642 if (WPOOH_array)
10643 {
10644 for (int i = 0; i < WPOOH_array.Count(); i++)
10645 {
10646 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10647
10648 if (WPOOH)
10649 {
10650 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10651 }
10652 }
10653 }
10654 }
10655
10656
10658 {
10659 int id = muzzle_owner.GetMuzzleID();
10660 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10661
10662 if (WPOOH_array)
10663 {
10664 for (int i = 0; i < WPOOH_array.Count(); i++)
10665 {
10666 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10667
10668 if (WPOOH)
10669 {
10670 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10671 }
10672 }
10673 }
10674 }
10675
10676
10678 {
10679 int id = muzzle_owner.GetMuzzleID();
10680 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10681
10682 if (WPOOH_array)
10683 {
10684 for (int i = 0; i < WPOOH_array.Count(); i++)
10685 {
10686 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10687
10688 if (WPOOH)
10689 {
10690 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10691 }
10692 }
10693 }
10694 }
10695
10696
10697
10699 {
10701 {
10702 return true;
10703 }
10704
10705 return false;
10706 }
10707
10709 {
10711 {
10712 return true;
10713 }
10714
10715 return false;
10716 }
10717
10719 {
10721 {
10722 return true;
10723 }
10724
10725 return false;
10726 }
10727
10729 {
10730 return false;
10731 }
10732
10735 {
10736 return UATimeSpent.DEFAULT_DEPLOY;
10737 }
10738
10739
10740
10741
10743 {
10745 SetSynchDirty();
10746 }
10747
10749 {
10751 }
10752
10753
10755 {
10756 return false;
10757 }
10758
10761 {
10762 string att_type = "None";
10763
10764 if (ConfigIsExisting("soundAttType"))
10765 {
10766 att_type = ConfigGetString("soundAttType");
10767 }
10768
10770 }
10771
10773 {
10775 }
10776
10777
10778
10779
10780
10786
10788 {
10791
10793 }
10794
10795
10797 {
10799 return;
10800
10802
10805
10808
10809 SoundParameters params = new SoundParameters();
10813 }
10814
10815
10817 {
10819 return;
10820
10822 SetSynchDirty();
10823
10826 }
10827
10828
10830 {
10832 return;
10833
10835 SetSynchDirty();
10836
10839 }
10840
10842 {
10844 }
10845
10847 {
10849 }
10850
10853 {
10854 if (!
GetGame().IsDedicatedServer())
10855 {
10856 if (ConfigIsExisting("attachSoundSet"))
10857 {
10858 string cfg_path = "";
10859 string soundset = "";
10860 string type_name =
GetType();
10861
10864 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10865 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10866
10867 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10868 {
10869 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10870 {
10871 if (cfg_slot_array[i] == slot_type)
10872 {
10873 soundset = cfg_soundset_array[i];
10874 break;
10875 }
10876 }
10877 }
10878
10879 if (soundset != "")
10880 {
10881 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10883 }
10884 }
10885 }
10886 }
10887
10889 {
10890
10891 }
10892
10893 void OnApply(PlayerBase player);
10894
10896 {
10897 return 1.0;
10898 };
10899
10901 {
10903 }
10904
10906 {
10908 }
10909
10911
10913 {
10914 SetDynamicPhysicsLifeTime(0.01);
10916 }
10917
10919 {
10920 array<string> zone_names = new array<string>;
10921 GetDamageZones(zone_names);
10922 for (int i = 0; i < zone_names.Count(); i++)
10923 {
10924 SetHealthMax(zone_names.Get(i),"Health");
10925 }
10926 SetHealthMax("","Health");
10927 }
10928
10931 {
10932 float global_health = GetHealth01("","Health");
10933 array<string> zones = new array<string>;
10934 GetDamageZones(zones);
10935
10936 for (int i = 0; i < zones.Count(); i++)
10937 {
10938 SetHealth01(zones.Get(i),"Health",global_health);
10939 }
10940 }
10941
10944 {
10945 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10946 }
10947
10949 {
10950 if (!hasRootAsPlayer)
10951 {
10952 if (refParentIB)
10953 {
10954
10955 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10956 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10957
10958 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10959 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10960
10963 }
10964 else
10965 {
10966
10969 }
10970 }
10971 }
10972
10974 {
10976 {
10977 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10978 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10979 {
10980 float heatPermCoef = 1.0;
10982 while (ent)
10983 {
10984 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10985 ent = ent.GetHierarchyParent();
10986 }
10987
10988 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10989 }
10990 }
10991 }
10992
10994 {
10995
10996 EntityAI parent = GetHierarchyParent();
10997 if (!parent)
10998 {
10999 hasParent = false;
11000 hasRootAsPlayer = false;
11001 }
11002 else
11003 {
11004 hasParent = true;
11005 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11006 refParentIB =
ItemBase.Cast(parent);
11007 }
11008 }
11009
11010 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11011 {
11012
11013 }
11014
11016 {
11017
11018 return false;
11019 }
11020
11022 {
11023
11024
11025 return false;
11026 }
11027
11029 {
11030
11031 return false;
11032 }
11033
11036 {
11037 return !GetIsFrozen() &&
IsOpen();
11038 }
11039
11041 {
11042 bool hasParent = false, hasRootAsPlayer = false;
11044
11045 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11046 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11047
11048 if (wwtu || foodDecay)
11049 {
11053
11054 if (processWetness || processTemperature || processDecay)
11055 {
11057
11058 if (processWetness)
11059 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11060
11061 if (processTemperature)
11063
11064 if (processDecay)
11065 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11066 }
11067 }
11068 }
11069
11072 {
11074 }
11075
11077 {
11080
11081 return super.GetTemperatureFreezeThreshold();
11082 }
11083
11085 {
11088
11089 return super.GetTemperatureThawThreshold();
11090 }
11091
11093 {
11096
11097 return super.GetItemOverheatThreshold();
11098 }
11099
11101 {
11103 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11104
11105 return super.GetTemperatureFreezeTime();
11106 }
11107
11109 {
11111 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11112
11113 return super.GetTemperatureThawTime();
11114 }
11115
11120
11122 {
11123 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11124 }
11125
11127 {
11128 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11129 }
11130
11133 {
11135 }
11136
11138 {
11140 }
11141
11143 {
11145 }
11146
11149 {
11150 return null;
11151 }
11152
11155 {
11156 return false;
11157 }
11158
11160 {
11162 {
11165 if (!trg)
11166 {
11168 explosive = this;
11169 }
11170
11171 explosive.PairRemote(trg);
11173
11174 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11175 trg.SetPersistentPairID(persistentID);
11176 explosive.SetPersistentPairID(persistentID);
11177
11178 return true;
11179 }
11180 return false;
11181 }
11182
11185 {
11186 float ret = 1.0;
11189 ret *= GetHealth01();
11190
11191 return ret;
11192 }
11193
11194 #ifdef DEVELOPER
11195 override void SetDebugItem()
11196 {
11197 super.SetDebugItem();
11198 _itemBase = this;
11199 }
11200
11202 {
11203 string text = super.GetDebugText();
11204
11206 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11207
11208 return text;
11209 }
11210 #endif
11211
11213 {
11214 return true;
11215 }
11216
11218
11220
11222 {
11225 }
11226
11227
11235
11251}
11252
11254{
11256 if (entity)
11257 {
11258 bool is_item = entity.IsInherited(
ItemBase);
11259 if (is_item && full_quantity)
11260 {
11263 }
11264 }
11265 else
11266 {
11268 return NULL;
11269 }
11270 return entity;
11271}
11272
11274{
11275 if (item)
11276 {
11277 if (health > 0)
11278 item.SetHealth("", "", health);
11279
11280 if (item.CanHaveTemperature())
11281 {
11283 if (item.CanFreeze())
11284 item.SetFrozen(false);
11285 }
11286
11287 if (item.HasEnergyManager())
11288 {
11289 if (quantity >= 0)
11290 {
11291 item.GetCompEM().SetEnergy0To1(quantity);
11292 }
11293 else
11294 {
11296 }
11297 }
11298 else if (item.IsMagazine())
11299 {
11300 Magazine mag = Magazine.Cast(item);
11301 if (quantity >= 0)
11302 {
11303 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11304 }
11305 else
11306 {
11308 }
11309
11310 }
11311 else
11312 {
11313 if (quantity >= 0)
11314 {
11315 item.SetQuantityNormalized(quantity, false);
11316 }
11317 else
11318 {
11320 }
11321
11322 }
11323 }
11324}
11325
11326#ifdef DEVELOPER
11328#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.