6306{
6308 {
6309 return true;
6310 }
6311};
6312
6313
6314
6316{
6320
6322
6325
6326
6327
6328
6329
6338
6344
6349
6354
6375 protected bool m_IsResultOfSplit
6376
6378
6383
6384
6385
6387
6391
6392
6393
6395
6398
6399
6400
6406
6407
6415
6418
6419
6421
6422
6424
6425
6430
6431
6436
6437
6439
6440
6442 {
6447
6448 if (!
GetGame().IsDedicatedServer())
6449 {
6451 {
6453
6455 {
6457 }
6458 }
6459
6462 }
6463
6464 m_OldLocation = null;
6465
6467 {
6469 }
6470
6471 if (ConfigIsExisting("headSelectionsToHide"))
6472 {
6475 }
6476
6478 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6479 {
6481 }
6482
6484
6485 m_IsResultOfSplit = false;
6486
6488 }
6489
6491 {
6492 super.InitItemVariables();
6493
6499 m_Count = ConfigGetInt(
"count");
6500
6503
6508
6511
6516
6528
6532
6533
6536 if (ConfigIsExisting("canBeSplit"))
6537 {
6540 }
6541
6543 if (ConfigIsExisting("itemBehaviour"))
6545
6546
6549 RegisterNetSyncVariableInt("m_VarLiquidType");
6550 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6551
6552 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6553 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6554 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6555
6556 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6557 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6558 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6559 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6560
6561 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6562 RegisterNetSyncVariableBool("m_IsTakeable");
6563 RegisterNetSyncVariableBool("m_IsHologram");
6564
6567 {
6570 }
6571
6573
6575 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6577
6578 }
6579
6581 {
6583 }
6584
6586 {
6589 {
6594 }
6595 }
6596
6597 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6598 {
6600 {
6603 }
6604
6606 }
6607
6609 {
6615 }
6616
6618
6620 {
6622
6623 if (!action)
6624 {
6625 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6626 return;
6627 }
6628
6630 if (!ai)
6631 {
6633 return;
6634 }
6635
6637 if (!action_array)
6638 {
6639 action_array = new array<ActionBase_Basic>;
6641 }
6642 if (LogManager.IsActionLogEnable())
6643 {
6644 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6645 }
6646
6647 if (action_array.Find(action) != -1)
6648 {
6649 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6650 }
6651 else
6652 {
6653 action_array.Insert(action);
6654 }
6655 }
6656
6658 {
6660 ActionBase action = player.GetActionManager().GetAction(actionName);
6663
6664 if (action_array)
6665 {
6666 action_array.RemoveItem(action);
6667 }
6668 }
6669
6670
6671
6673 {
6674 ActionOverrideData overrideData = new ActionOverrideData();
6678
6680 if (!actionMap)
6681 {
6684 }
6685
6686 actionMap.Insert(this.
Type(), overrideData);
6687
6688 }
6689
6691
6693
6694
6696 {
6699
6702
6703 string config_to_search = "CfgVehicles";
6704 string muzzle_owner_config;
6705
6707 {
6708 if (IsInherited(Weapon))
6709 config_to_search = "CfgWeapons";
6710
6711 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6712
6713 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6714
6716
6717 if (config_OnFire_subclass_count > 0)
6718 {
6719 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6720
6721 for (int i = 0; i < config_OnFire_subclass_count; i++)
6722 {
6723 string particle_class = "";
6725 string config_OnFire_entry = config_OnFire_class + particle_class;
6726 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6727 WPOF_array.Insert(WPOF);
6728 }
6729
6730
6732 }
6733 }
6734
6736 {
6737 config_to_search = "CfgWeapons";
6738 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6739
6740 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6741
6743
6744 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6745 {
6746 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6747
6748 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6749 {
6750 string particle_class2 = "";
6752 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6753 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6754 WPOBE_array.Insert(WPOBE);
6755 }
6756
6757
6759 }
6760 }
6761 }
6762
6763
6765 {
6768
6770 {
6771 string config_to_search = "CfgVehicles";
6772
6773 if (IsInherited(Weapon))
6774 config_to_search = "CfgWeapons";
6775
6776 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6777 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6778
6779 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6780 {
6781
6783
6785 {
6787 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6789 return;
6790 }
6791
6794
6795
6796
6798 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6799
6800 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6801 {
6802 string particle_class = "";
6804 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6806
6807 if (entry_type == CT_CLASS)
6808 {
6809 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6810 WPOOH_array.Insert(WPOF);
6811 }
6812 }
6813
6814
6816 }
6817 }
6818 }
6819
6821 {
6823 }
6824
6826 {
6828 {
6830
6833
6836
6837 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6838 }
6839 }
6840
6842 {
6844 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6845
6847 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6848
6850 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6851
6853 {
6855 }
6856 }
6857
6859 {
6861 }
6862
6864 {
6867 else
6869
6871 {
6874 }
6875 else
6876 {
6879
6882 }
6883
6885 }
6886
6888 {
6890 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6891 }
6892
6894 {
6896 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6898 }
6899
6901 {
6903 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6904 }
6905
6907 {
6910
6911 OverheatingParticle OP = new OverheatingParticle();
6916
6918 }
6919
6921 {
6924
6925 return -1;
6926 }
6927
6929 {
6931 {
6934
6935 for (int i = count; i > 0; --i)
6936 {
6937 int id = i - 1;
6940
6943
6944 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6945 {
6946 if (p)
6947 {
6950 }
6951 }
6952 }
6953 }
6954 }
6955
6957 {
6959 {
6961 {
6962 int id = i - 1;
6964
6965 if (OP)
6966 {
6968
6969 if (p)
6970 {
6972 }
6973
6974 delete OP;
6975 }
6976 }
6977
6980 }
6981 }
6982
6985 {
6986 return 0.0;
6987 }
6988
6989
6991 {
6992 return 250;
6993 }
6994
6996 {
6997 return 0;
6998 }
6999
7002 {
7004 return true;
7005
7006 return false;
7007 }
7008
7011 {
7014
7016 {
7018 }
7019 else
7020 {
7021
7023 }
7024
7026 }
7027
7034 {
7035 return -1;
7036 }
7037
7038
7039
7040
7042 {
7044 {
7046 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7047
7048 if (r_index >= 0)
7049 {
7050 InventoryLocation r_il = new InventoryLocation;
7051 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7052
7053 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7056 {
7057 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7058 }
7060 {
7061 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7062 }
7063
7064 }
7065
7066 player.GetHumanInventory().ClearUserReservedLocation(this);
7067 }
7068
7071 }
7072
7073
7074
7075
7077 {
7078 return ItemBase.m_DebugActionsMask;
7079 }
7080
7082 {
7083 return ItemBase.m_DebugActionsMask & mask;
7084 }
7085
7087 {
7088 ItemBase.m_DebugActionsMask = mask;
7089 }
7090
7092 {
7093 ItemBase.m_DebugActionsMask |= mask;
7094 }
7095
7097 {
7098 ItemBase.m_DebugActionsMask &= ~mask;
7099 }
7100
7102 {
7104 {
7106 }
7107 else
7108 {
7110 }
7111 }
7112
7113
7115 {
7116 if (GetEconomyProfile())
7117 {
7118 float q_max = GetEconomyProfile().GetQuantityMax();
7119 if (q_max > 0)
7120 {
7121 float q_min = GetEconomyProfile().GetQuantityMin();
7122 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7123
7125 {
7126 ComponentEnergyManager comp = GetCompEM();
7128 {
7130 }
7131 }
7133 {
7135
7136 }
7137
7138 }
7139 }
7140 }
7141
7144 {
7145 EntityAI parent = GetHierarchyParent();
7146
7147 if (parent)
7148 {
7149 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7150 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7151 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7152 }
7153 }
7154
7157 {
7158 EntityAI parent = GetHierarchyParent();
7159
7160 if (parent)
7161 {
7162 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7163 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7164 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7165 }
7166 }
7167
7169 {
7170
7171
7172
7173
7175
7177 {
7178 if (ScriptInputUserData.CanStoreInputUserData())
7179 {
7180 ScriptInputUserData ctx = new ScriptInputUserData;
7186 ctx.
Write(use_stack_max);
7189
7191 {
7192 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7193 }
7194 }
7195 }
7196 else if (!
GetGame().IsMultiplayer())
7197 {
7199 }
7200 }
7201
7203 {
7205 }
7206
7208 {
7210 }
7211
7213 {
7215 }
7216
7218 {
7219
7220 return false;
7221 }
7222
7224 {
7225 return false;
7226 }
7227
7231 {
7232 return false;
7233 }
7234
7236 {
7237 return "";
7238 }
7239
7241
7243 {
7244 return false;
7245 }
7246
7248 {
7249 return true;
7250 }
7251
7252
7253
7255 {
7256 return true;
7257 }
7258
7260 {
7261 return true;
7262 }
7263
7265 {
7266 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7268 }
7269
7271 {
7273 }
7274
7276 {
7278 if (!is_being_placed)
7280 SetSynchDirty();
7281 }
7282
7283
7285
7287 {
7289 }
7290
7292 {
7294 }
7295
7297 {
7298 return 1;
7299 }
7300
7302 {
7303 return false;
7304 }
7305
7307 {
7309 SetSynchDirty();
7310 }
7311
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7323
7324
7325
7326
7327
7328
7329
7330
7331
7332
7333
7334
7335
7336
7337
7338
7339
7340
7341
7342
7343
7344
7345
7347 {
7348 super.OnMovedInsideCargo(container);
7349
7350 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7351 }
7352
7353 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7354 {
7355 super.EEItemLocationChanged(oldLoc,newLoc);
7356
7357 PlayerBase new_player = null;
7358 PlayerBase old_player = null;
7359
7360 if (newLoc.GetParent())
7361 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7362
7363 if (oldLoc.GetParent())
7364 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7365
7367 {
7368 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
7369
7370 if (r_index >= 0)
7371 {
7372 InventoryLocation r_il = new InventoryLocation;
7373 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7374
7375 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7378 {
7379 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7380 }
7382 {
7383 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7384 }
7385
7386 }
7387 }
7388
7390 {
7391 if (new_player)
7392 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
7393
7394 if (new_player == old_player)
7395 {
7396
7397 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7398 {
7400 {
7401 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7402 {
7403 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7404 }
7405 }
7406 else
7407 {
7408 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7409 }
7410 }
7411
7412 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7413 {
7414 int type = oldLoc.GetType();
7416 {
7417 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7418 }
7420 {
7421 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7422 }
7423 }
7424 if (!m_OldLocation)
7425 {
7426 m_OldLocation = new InventoryLocation;
7427 }
7428 m_OldLocation.Copy(oldLoc);
7429 }
7430 else
7431 {
7432 if (m_OldLocation)
7433 {
7434 m_OldLocation.Reset();
7435 }
7436 }
7437
7439 }
7440 else
7441 {
7442 if (new_player)
7443 {
7444 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7445 if (res_index >= 0)
7446 {
7447 InventoryLocation il = new InventoryLocation;
7448 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
7450 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
7453 {
7454 il.
GetParent().GetOnReleaseLock().Invoke(it);
7455 }
7457 {
7459 }
7460
7461 }
7462 }
7464 {
7465
7467 }
7468
7469 if (m_OldLocation)
7470 {
7471 m_OldLocation.Reset();
7472 }
7473 }
7474 }
7475
7476 override void EOnContact(IEntity other, Contact extra)
7477 {
7479 {
7480 int liquidType = -1;
7482 if (impactSpeed > 0.0)
7483 {
7485 #ifndef SERVER
7487 #else
7489 SetSynchDirty();
7490 #endif
7492 }
7493 }
7494
7495 #ifdef SERVER
7496 if (GetCompEM() && GetCompEM().IsPlugged())
7497 {
7498 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7499 GetCompEM().UnplugThis();
7500 }
7501 #endif
7502 }
7503
7505
7507 {
7509 }
7510
7512 {
7513
7514 }
7515
7517 {
7518 super.OnItemLocationChanged(old_owner, new_owner);
7519
7520 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7521 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7522
7523 if (!relatedPlayer && playerNew)
7524 relatedPlayer = playerNew;
7525
7526 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7527 {
7529 if (actionMgr)
7530 {
7531 ActionBase currentAction = actionMgr.GetRunningAction();
7532 if (currentAction)
7534 }
7535 }
7536
7537 Man ownerPlayerOld = null;
7538 Man ownerPlayerNew = null;
7539
7540 if (old_owner)
7541 {
7542 if (old_owner.
IsMan())
7543 {
7544 ownerPlayerOld = Man.Cast(old_owner);
7545 }
7546 else
7547 {
7548 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7549 }
7550 }
7551 else
7552 {
7554 {
7556
7557 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7558 {
7559 GetCompEM().UnplugThis();
7560 }
7561 }
7562 }
7563
7564 if (new_owner)
7565 {
7566 if (new_owner.
IsMan())
7567 {
7568 ownerPlayerNew = Man.Cast(new_owner);
7569 }
7570 else
7571 {
7572 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7573 }
7574 }
7575
7576 if (ownerPlayerOld != ownerPlayerNew)
7577 {
7578 if (ownerPlayerOld)
7579 {
7580 array<EntityAI> subItemsExit = new array<EntityAI>;
7582 for (int i = 0; i < subItemsExit.Count(); i++)
7583 {
7586 }
7587 }
7588
7589 if (ownerPlayerNew)
7590 {
7591 array<EntityAI> subItemsEnter = new array<EntityAI>;
7593 for (int j = 0; j < subItemsEnter.Count(); j++)
7594 {
7597 }
7598 }
7599 }
7600 else if (ownerPlayerNew != null)
7601 {
7602 PlayerBase nplayer;
7603 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7604 {
7605 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7607 for (int k = 0; k < subItemsUpdate.Count(); k++)
7608 {
7610 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7611 }
7612 }
7613 }
7614
7615 if (old_owner)
7616 old_owner.OnChildItemRemoved(this);
7617 if (new_owner)
7618 new_owner.OnChildItemReceived(this);
7619 }
7620
7621
7623 {
7624 super.EEDelete(parent);
7625 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7626 if (player)
7627 {
7629
7630 if (player.IsAlive())
7631 {
7632 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7633 if (r_index >= 0)
7634 {
7635 InventoryLocation r_il = new InventoryLocation;
7636 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7637
7638 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7641 {
7642 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7643 }
7645 {
7646 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7647 }
7648
7649 }
7650
7651 player.RemoveQuickBarEntityShortcut(this);
7652 }
7653 }
7654 }
7655
7657 {
7658 super.EEKilled(killer);
7659
7662 {
7663 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7664 {
7665 if (IsMagazine())
7666 {
7667 if (Magazine.Cast(this).GetAmmoCount() > 0)
7668 {
7670 }
7671 }
7672 else
7673 {
7675 }
7676 }
7677 }
7678 }
7679
7681 {
7682 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7683
7684 super.OnWasAttached(parent, slot_id);
7685
7688
7690 }
7691
7693 {
7694 super.OnWasDetached(parent, slot_id);
7695
7698 }
7699
7701 {
7702 int idx;
7705
7706 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7707 if (inventory_slots.Count() < 1)
7708 {
7709 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7710 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7711 }
7712 else
7713 {
7714 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7715 }
7716
7717 idx = inventory_slots.Find(slot);
7718 if (idx < 0)
7719 return "";
7720
7721 return attach_types.Get(idx);
7722 }
7723
7725 {
7726 int idx = -1;
7727 string slot;
7728
7731
7732 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7733 if (inventory_slots.Count() < 1)
7734 {
7735 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7736 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7737 }
7738 else
7739 {
7740 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7741 if (detach_types.Count() < 1)
7742 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7743 }
7744
7745 for (int i = 0; i < inventory_slots.Count(); i++)
7746 {
7747 slot = inventory_slots.Get(i);
7748 }
7749
7750 if (slot != "")
7751 {
7752 if (detach_types.Count() == 1)
7753 idx = 0;
7754 else
7755 idx = inventory_slots.Find(slot);
7756 }
7757 if (idx < 0)
7758 return "";
7759
7760 return detach_types.Get(idx);
7761 }
7762
7764 {
7765
7767
7768
7769 float min_time = 1;
7770 float max_time = 3;
7771 float delay = Math.RandomFloat(min_time, max_time);
7772
7773 explode_timer.Run(delay, this, "DoAmmoExplosion");
7774 }
7775
7777 {
7778 Magazine magazine = Magazine.Cast(this);
7779 int pop_sounds_count = 6;
7780 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7781
7782
7783 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7784 string sound_name = pop_sounds[ sound_idx ];
7786
7787
7788 magazine.ServerAddAmmoCount(-1);
7789
7790
7791 float min_temp_to_explode = 100;
7792
7793 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7794 {
7796 }
7797 }
7798
7799
7800 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7801 {
7802 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7803
7804 const int CHANCE_DAMAGE_CARGO = 4;
7805 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7806 const int CHANCE_DAMAGE_NOTHING = 2;
7807
7809 {
7810 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7811 int chances;
7812 int rnd;
7813
7814 if (GetInventory().GetCargo())
7815 {
7816 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7817 rnd = Math.RandomInt(0,chances);
7818
7819 if (rnd < CHANCE_DAMAGE_CARGO)
7820 {
7822 }
7823 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7824 {
7826 }
7827 }
7828 else
7829 {
7830 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7831 rnd = Math.RandomInt(0,chances);
7832
7833 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7834 {
7836 }
7837 }
7838 }
7839 }
7840
7842 {
7843 if (GetInventory().GetCargo())
7844 {
7845 int item_count = GetInventory().GetCargo().GetItemCount();
7846 if (item_count > 0)
7847 {
7848 int random_pick = Math.RandomInt(0, item_count);
7850 if (!item.IsExplosive())
7851 {
7852 item.AddHealth("","",damage);
7853 return true;
7854 }
7855 }
7856 }
7857 return false;
7858 }
7859
7861 {
7862 int attachment_count = GetInventory().AttachmentCount();
7863 if (attachment_count > 0)
7864 {
7865 int random_pick = Math.RandomInt(0, attachment_count);
7866 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7867 if (!attachment.IsExplosive())
7868 {
7869 attachment.AddHealth("","",damage);
7870 return true;
7871 }
7872 }
7873 return false;
7874 }
7875
7877 {
7879 }
7880
7882 {
7884 return GetInventory().CanRemoveEntity();
7885
7886 return false;
7887 }
7888
7890 {
7891
7893 return false;
7894
7895
7897 return false;
7898
7899
7900
7902 if (delta == 0)
7903 return false;
7904
7905
7906 return true;
7907 }
7908
7910 {
7912 {
7913 if (ScriptInputUserData.CanStoreInputUserData())
7914 {
7915 ScriptInputUserData ctx = new ScriptInputUserData;
7920 ctx.
Write(destination_entity);
7924 }
7925 }
7926 else if (!
GetGame().IsMultiplayer())
7927 {
7929 }
7930 }
7931
7933 {
7934 float split_quantity_new;
7938 InventoryLocation loc = new InventoryLocation;
7939
7940 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7941 {
7943 split_quantity_new = stack_max;
7944 else
7946
7948 {
7949 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7950 if (new_item)
7951 {
7952 new_item.SetResultOfSplit(true);
7953 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7955 new_item.
SetQuantity(split_quantity_new,
false,
true);
7956 }
7957 }
7958 }
7959 else if (destination_entity && slot_id == -1)
7960 {
7961 if (quantity > stack_max)
7962 split_quantity_new = stack_max;
7963 else
7964 split_quantity_new = quantity;
7965
7967 {
7969 {
7972 }
7973
7974 if (new_item)
7975 {
7976 new_item.SetResultOfSplit(true);
7977 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7979 new_item.
SetQuantity(split_quantity_new,
false,
true);
7980 }
7981 }
7982 }
7983 else
7984 {
7985 if (stack_max != 0)
7986 {
7988 {
7990 }
7991
7992 if (split_quantity_new == 0)
7993 {
7994 if (!
GetGame().IsMultiplayer())
7995 player.PhysicalPredictiveDropItem(this);
7996 else
7997 player.ServerDropEntity(this);
7998 return;
7999 }
8000
8002 {
8004
8005 if (new_item)
8006 {
8007 new_item.SetResultOfSplit(true);
8008 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8011 new_item.PlaceOnSurface();
8012 }
8013 }
8014 }
8015 }
8016 }
8017
8019 {
8020 float split_quantity_new;
8024 InventoryLocation loc = new InventoryLocation;
8025
8026 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8027 {
8029 split_quantity_new = stack_max;
8030 else
8032
8034 {
8035 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8036 if (new_item)
8037 {
8038 new_item.SetResultOfSplit(true);
8039 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8041 new_item.
SetQuantity(split_quantity_new,
false,
true);
8042 }
8043 }
8044 }
8045 else if (destination_entity && slot_id == -1)
8046 {
8047 if (quantity > stack_max)
8048 split_quantity_new = stack_max;
8049 else
8050 split_quantity_new = quantity;
8051
8053 {
8055 {
8058 }
8059
8060 if (new_item)
8061 {
8062 new_item.SetResultOfSplit(true);
8063 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8065 new_item.
SetQuantity(split_quantity_new,
false,
true);
8066 }
8067 }
8068 }
8069 else
8070 {
8071 if (stack_max != 0)
8072 {
8074 {
8076 }
8077
8079 {
8081
8082 if (new_item)
8083 {
8084 new_item.SetResultOfSplit(true);
8085 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8088 new_item.PlaceOnSurface();
8089 }
8090 }
8091 }
8092 }
8093 }
8094
8096 {
8098 {
8099 if (ScriptInputUserData.CanStoreInputUserData())
8100 {
8101 ScriptInputUserData ctx = new ScriptInputUserData;
8106 dst.WriteToContext(ctx);
8108 }
8109 }
8110 else if (!
GetGame().IsMultiplayer())
8111 {
8113 }
8114 }
8115
8117 {
8119 {
8120 if (ScriptInputUserData.CanStoreInputUserData())
8121 {
8122 ScriptInputUserData ctx = new ScriptInputUserData;
8127 ctx.
Write(destination_entity);
8133 }
8134 }
8135 else if (!
GetGame().IsMultiplayer())
8136 {
8138 }
8139 }
8140
8142 {
8144 }
8145
8147 {
8149 float split_quantity_new;
8151 if (dst.IsValid())
8152 {
8153 int slot_id = dst.GetSlot();
8155
8156 if (quantity > stack_max)
8157 split_quantity_new = stack_max;
8158 else
8159 split_quantity_new = quantity;
8160
8162 {
8164
8165 if (new_item)
8166 {
8167 new_item.SetResultOfSplit(true);
8168 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8170 new_item.
SetQuantity(split_quantity_new,
false,
true);
8171 }
8172
8173 return new_item;
8174 }
8175 }
8176
8177 return null;
8178 }
8179
8181 {
8183 float split_quantity_new;
8185 if (destination_entity)
8186 {
8188 if (quantity > stackable)
8189 split_quantity_new = stackable;
8190 else
8191 split_quantity_new = quantity;
8192
8194 {
8195 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8196 if (new_item)
8197 {
8198 new_item.SetResultOfSplit(true);
8199 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8201 new_item.
SetQuantity(split_quantity_new,
false,
true);
8202 }
8203 }
8204 }
8205 }
8206
8208 {
8210 {
8211 if (ScriptInputUserData.CanStoreInputUserData())
8212 {
8213 ScriptInputUserData ctx = new ScriptInputUserData;
8218 ItemBase destination_entity =
this;
8219 ctx.
Write(destination_entity);
8223 }
8224 }
8225 else if (!
GetGame().IsMultiplayer())
8226 {
8228 }
8229 }
8230
8232 {
8234 float split_quantity_new;
8236 if (player)
8237 {
8239 if (quantity > stackable)
8240 split_quantity_new = stackable;
8241 else
8242 split_quantity_new = quantity;
8243
8245 {
8246 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8247 new_item =
ItemBase.Cast(in_hands);
8248 if (new_item)
8249 {
8250 new_item.SetResultOfSplit(true);
8251 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8253 new_item.SetQuantity(split_quantity_new, false, true);
8254 }
8255 }
8256 }
8257 }
8258
8260 {
8262 float split_quantity_new = Math.Floor(quantity * 0.5);
8263
8265 return;
8266
8268
8269 if (new_item)
8270 {
8271 if (new_item.GetQuantityMax() < split_quantity_new)
8272 {
8273 split_quantity_new = new_item.GetQuantityMax();
8274 }
8275
8276 new_item.SetResultOfSplit(true);
8277 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8278
8280 {
8283 }
8284 else
8285 {
8287 new_item.
SetQuantity(split_quantity_new,
false,
true);
8288 }
8289 }
8290 }
8291
8293 {
8295 float split_quantity_new = Math.Floor(quantity / 2);
8296
8298 return;
8299
8300 InventoryLocation invloc = new InventoryLocation;
8302
8304 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8305
8306 if (new_item)
8307 {
8308 if (new_item.GetQuantityMax() < split_quantity_new)
8309 {
8310 split_quantity_new = new_item.GetQuantityMax();
8311 }
8313 {
8316 }
8317 else if (split_quantity_new > 1)
8318 {
8320 new_item.
SetQuantity(split_quantity_new,
false,
true);
8321 }
8322 }
8323 }
8324
8327 {
8328 SetWeightDirty();
8330
8331 if (parent)
8332 parent.OnAttachmentQuantityChangedEx(this, delta);
8333
8335 {
8337 {
8339 }
8341 {
8342 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8344 }
8345 }
8346
8347 }
8348
8351 {
8352
8353 }
8354
8357 {
8359 }
8360
8362 {
8363 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8364
8366 {
8367 if (newLevel == GameConstants.STATE_RUINED)
8368 {
8370 EntityAI parent = GetHierarchyParent();
8371 if (parent && parent.IsFireplace())
8372 {
8373 CargoBase cargo = GetInventory().GetCargo();
8374 if (cargo)
8375 {
8377 {
8379 }
8380 }
8381 }
8382 }
8383
8385 {
8386
8388 return;
8389 }
8390
8391 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8392 {
8394 }
8395 }
8396 }
8397
8398
8400 {
8401 super.OnRightClick();
8402
8404 {
8406 {
8407 if (ScriptInputUserData.CanStoreInputUserData())
8408 {
8409 EntityAI root = GetHierarchyRoot();
8410 Man playerOwner = GetHierarchyRootPlayer();
8411 InventoryLocation dst = new InventoryLocation;
8412
8413
8414 if (!playerOwner && root && root == this)
8415 {
8417 }
8418 else
8419 {
8420
8421 GetInventory().GetCurrentInventoryLocation(dst);
8423 {
8426 {
8428 }
8429 else
8430 {
8432
8433
8434 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8435 {
8437 }
8438 else
8439 {
8440 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8441 }
8442 }
8443 }
8444 }
8445
8446 ScriptInputUserData ctx = new ScriptInputUserData;
8454 }
8455 }
8456 else if (!
GetGame().IsMultiplayer())
8457 {
8459 }
8460 }
8461 }
8462
8464 {
8465 if (root)
8466 {
8467 vector m4[4];
8468 root.GetTransform(m4);
8469 dst.SetGround(this, m4);
8470 }
8471 else
8472 {
8473 GetInventory().GetCurrentInventoryLocation(dst);
8474 }
8475 }
8476
8477 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8478 {
8479
8480 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8481 return false;
8482
8483 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8484 return false;
8485
8486
8488 return false;
8489
8490
8491 Magazine mag = Magazine.Cast(this);
8492 if (mag)
8493 {
8494 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8495 return false;
8496
8497 if (stack_max_limit)
8498 {
8499 Magazine other_mag = Magazine.Cast(other_item);
8500 if (other_item)
8501 {
8502 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8503 return false;
8504 }
8505
8506 }
8507 }
8508 else
8509 {
8510
8512 return false;
8513
8515 return false;
8516 }
8517
8518 PlayerBase player = null;
8519 if (CastTo(player, GetHierarchyRootPlayer()))
8520 {
8521 if (player.GetInventory().HasAttachment(this))
8522 return false;
8523
8524 if (player.IsItemsToDelete())
8525 return false;
8526 }
8527
8528 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8529 return false;
8530
8531 int slotID;
8533 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8534 return false;
8535
8536 return true;
8537 }
8538
8540 {
8542 }
8543
8545 {
8546 return m_IsResultOfSplit;
8547 }
8548
8550 {
8551 m_IsResultOfSplit = value;
8552 }
8553
8555 {
8557 }
8558
8560 {
8561 float other_item_quantity = other_item.GetQuantity();
8562 float this_free_space;
8563
8565
8567
8568 if (other_item_quantity > this_free_space)
8569 {
8570 return this_free_space;
8571 }
8572 else
8573 {
8574 return other_item_quantity;
8575 }
8576 }
8577
8579 {
8581 }
8582
8584 {
8586 return;
8587
8588 if (!IsMagazine() && other_item)
8589 {
8591 if (quantity_used != 0)
8592 {
8593 float hp1 = GetHealth01("","");
8594 float hp2 = other_item.GetHealth01("","");
8595 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8596 hpResult = hpResult / (
GetQuantity() + quantity_used);
8597
8598 hpResult *= GetMaxHealth();
8599 Math.Round(hpResult);
8600 SetHealth("", "Health", hpResult);
8601
8603 other_item.AddQuantity(-quantity_used);
8604 }
8605 }
8607 }
8608
8610 {
8611 #ifdef SERVER
8612 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8613 GetHierarchyParent().IncreaseLifetimeUp();
8614 #endif
8615 };
8616
8618 {
8619 PlayerBase p = PlayerBase.Cast(player);
8620
8621 array<int> recipesIds = p.m_Recipes;
8622 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8623 if (moduleRecipesManager)
8624 {
8625 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8626 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8627 }
8628
8629 for (int i = 0;i < recipesIds.Count(); i++)
8630 {
8631 int key = recipesIds.Get(i);
8632 string recipeName = moduleRecipesManager.GetRecipeName(key);
8634 }
8635 }
8636
8637
8638 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8639 {
8640 super.GetDebugActions(outputList);
8641
8642
8648
8649
8654
8659
8660
8664
8665
8667 {
8671 }
8672
8675
8676
8680
8682
8683 InventoryLocation loc = new InventoryLocation();
8684 GetInventory().GetCurrentInventoryLocation(loc);
8686 {
8687 if (Gizmo_IsSupported())
8690 }
8691
8693 }
8694
8695
8696
8697
8699 {
8700 super.OnAction(action_id, player, ctx);
8701
8703 {
8704 switch (action_id)
8705 {
8708 return true;
8711 return true;
8712 }
8713 }
8714
8716 {
8717 switch (action_id)
8718 {
8720 Delete();
8721 return true;
8722 }
8723 }
8724
8725 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8726 {
8727 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8728 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8729 PlayerBase p = PlayerBase.Cast(player);
8730 if (
EActions.RECIPES_RANGE_START < 1000)
8731 {
8732 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8733 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8734 }
8735 }
8736 #ifndef SERVER
8737 else if (action_id ==
EActions.WATCH_PLAYER)
8738 {
8739 PluginDeveloper.SetDeveloperItemClientEx(player);
8740 }
8741 #endif
8743 {
8744 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8745 {
8746 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8747 OnDebugButtonPressServer(id + 1);
8748 }
8749
8750 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8751 {
8752 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8754 }
8755
8756 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8757 {
8758 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8760 }
8761
8762 else if (action_id ==
EActions.ADD_QUANTITY)
8763 {
8764 if (IsMagazine())
8765 {
8766 Magazine mag = Magazine.Cast(this);
8767 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8768 }
8769 else
8770 {
8772 }
8773
8774 if (m_EM)
8775 {
8776 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8777 }
8778
8779 }
8780
8781 else if (action_id ==
EActions.REMOVE_QUANTITY)
8782 {
8783 if (IsMagazine())
8784 {
8785 Magazine mag2 = Magazine.Cast(this);
8786 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8787 }
8788 else
8789 {
8791 }
8792 if (m_EM)
8793 {
8794 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8795 }
8796
8797 }
8798
8799 else if (action_id ==
EActions.SET_QUANTITY_0)
8800 {
8802
8803 if (m_EM)
8804 {
8805 m_EM.SetEnergy(0);
8806 }
8807 }
8808
8809 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8810 {
8812
8813 if (m_EM)
8814 {
8815 m_EM.SetEnergy(m_EM.GetEnergyMax());
8816 }
8817 }
8818
8819 else if (action_id ==
EActions.ADD_HEALTH)
8820 {
8821 AddHealth("","",GetMaxHealth("","Health")/5);
8822 }
8823 else if (action_id ==
EActions.REMOVE_HEALTH)
8824 {
8825 AddHealth("","",-GetMaxHealth("","Health")/5);
8826 }
8827 else if (action_id ==
EActions.DESTROY_HEALTH)
8828 {
8829 SetHealth01("","",0);
8830 }
8831 else if (action_id ==
EActions.WATCH_ITEM)
8832 {
8834 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8835 #ifdef DEVELOPER
8836 SetDebugDeveloper_item(this);
8837 #endif
8838 }
8839
8840 else if (action_id ==
EActions.ADD_TEMPERATURE)
8841 {
8842 AddTemperature(20);
8843
8844 }
8845
8846 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8847 {
8848 AddTemperature(-20);
8849
8850 }
8851
8852 else if (action_id ==
EActions.FLIP_FROZEN)
8853 {
8854 SetFrozen(!GetIsFrozen());
8855
8856 }
8857
8858 else if (action_id ==
EActions.ADD_WETNESS)
8859 {
8861
8862 }
8863
8864 else if (action_id ==
EActions.REMOVE_WETNESS)
8865 {
8867
8868 }
8869
8870 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8871 {
8874
8875
8876 }
8877
8878 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8879 {
8882 }
8883
8884 else if (action_id ==
EActions.MAKE_SPECIAL)
8885 {
8886 auto debugParams = DebugSpawnParams.WithPlayer(player);
8887 OnDebugSpawnEx(debugParams);
8888 }
8889
8890 }
8891
8892
8893 return false;
8894 }
8895
8896
8897
8898
8902
8905
8906
8907
8909 {
8910 return false;
8911 }
8912
8913
8915 {
8916 return true;
8917 }
8918
8919
8921 {
8922 return true;
8923 }
8924
8925
8926
8928 {
8929 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8931 }
8932
8935 {
8936 return null;
8937 }
8938
8940 {
8941 return false;
8942 }
8943
8945 {
8946 return false;
8947 }
8948
8952
8953
8955 {
8956 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8957 return module_repairing.CanRepair(this, item_repair_kit);
8958 }
8959
8960
8961 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8962 {
8963 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8964 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8965 }
8966
8967
8969 {
8970
8971
8972
8973
8974
8975
8976
8977
8978 return 1;
8979 }
8980
8981
8982
8984 {
8986 }
8987
8988
8989
8991 {
8993 }
8994
8995
9004 {
9005 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9006
9007 if (player)
9008 {
9009 player.MessageStatus(text);
9010 }
9011 }
9012
9013
9022 {
9023 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9024
9025 if (player)
9026 {
9027 player.MessageAction(text);
9028 }
9029 }
9030
9031
9040 {
9041 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9042
9043 if (player)
9044 {
9045 player.MessageFriendly(text);
9046 }
9047 }
9048
9049
9058 {
9059 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9060
9061 if (player)
9062 {
9063 player.MessageImportant(text);
9064 }
9065 }
9066
9068 {
9069 return true;
9070 }
9071
9072
9073 override bool KindOf(
string tag)
9074 {
9075 bool found = false;
9076 string item_name = this.
GetType();
9079
9080 int array_size = item_tag_array.Count();
9081 for (int i = 0; i < array_size; i++)
9082 {
9083 if (item_tag_array.Get(i) == tag)
9084 {
9085 found = true;
9086 break;
9087 }
9088 }
9089 return found;
9090 }
9091
9092
9094 {
9095
9096 super.OnRPC(sender, rpc_type,ctx);
9097
9098
9099 switch (rpc_type)
9100 {
9101 #ifndef SERVER
9102 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9103 Param2<bool, string> p = new Param2<bool, string>(false, "");
9104
9106 return;
9107
9108 bool play = p.param1;
9109 string soundSet = p.param2;
9110
9111 if (play)
9112 {
9114 {
9116 {
9118 }
9119 }
9120 else
9121 {
9123 }
9124 }
9125 else
9126 {
9128 }
9129
9130 break;
9131 #endif
9132
9133 }
9134
9136 {
9138 }
9139 }
9140
9141
9142
9143
9145 {
9146 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9147 return plugin.GetID(
name);
9148 }
9149
9151 {
9152 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9153 return plugin.GetName(id);
9154 }
9155
9158 {
9159
9160
9161 int varFlags;
9162 if (!ctx.
Read(varFlags))
9163 return;
9164
9165 if (varFlags & ItemVariableFlags.FLOAT)
9166 {
9168 }
9169 }
9170
9172 {
9173
9174 super.SerializeNumericalVars(floats_out);
9175
9176
9177
9179 {
9181 }
9182
9184 {
9186 }
9187
9189 {
9191 }
9192
9194 {
9199 }
9200
9202 {
9204 }
9205 }
9206
9208 {
9209
9210 super.DeSerializeNumericalVars(floats);
9211
9212
9213 int index = 0;
9214 int mask = Math.Round(floats.Get(index));
9215
9216 index++;
9217
9219 {
9221 {
9223 }
9224 else
9225 {
9226 float quantity = floats.Get(index);
9228 }
9229 index++;
9230 }
9231
9233 {
9234 float wet = floats.Get(index);
9236 index++;
9237 }
9238
9240 {
9241 int liquidtype = Math.Round(floats.Get(index));
9243 index++;
9244 }
9245
9247 {
9249 index++;
9251 index++;
9253 index++;
9255 index++;
9256 }
9257
9259 {
9260 int cleanness = Math.Round(floats.Get(index));
9262 index++;
9263 }
9264 }
9265
9267 {
9268 super.WriteVarsToCTX(ctx);
9269
9270
9272 {
9274 }
9275
9277 {
9279 }
9280
9282 {
9284 }
9285
9287 {
9288 int r,g,b,a;
9294 }
9295
9297 {
9299 }
9300 }
9301
9303 {
9304 if (!super.ReadVarsFromCTX(ctx,version))
9305 return false;
9306
9307 int intValue;
9308 float value;
9309
9310 if (version < 140)
9311 {
9312 if (!ctx.
Read(intValue))
9313 return false;
9314
9315 m_VariablesMask = intValue;
9316 }
9317
9319 {
9320 if (!ctx.
Read(value))
9321 return false;
9322
9324 {
9326 }
9327 else
9328 {
9330 }
9331 }
9332
9333 if (version < 140)
9334 {
9336 {
9337 if (!ctx.
Read(value))
9338 return false;
9339 SetTemperatureDirect(value);
9340 }
9341 }
9342
9344 {
9345 if (!ctx.
Read(value))
9346 return false;
9348 }
9349
9351 {
9352 if (!ctx.
Read(intValue))
9353 return false;
9355 }
9356
9358 {
9359 int r,g,b,a;
9361 return false;
9363 return false;
9365 return false;
9367 return false;
9368
9370 }
9371
9373 {
9374 if (!ctx.
Read(intValue))
9375 return false;
9377 }
9378
9379 if (version >= 138 && version < 140)
9380 {
9382 {
9383 if (!ctx.
Read(intValue))
9384 return false;
9385 SetFrozen(intValue);
9386 }
9387 }
9388
9389 return true;
9390 }
9391
9392
9394 {
9397 {
9399 }
9400
9401 if (!super.OnStoreLoad(ctx, version))
9402 {
9404 return false;
9405 }
9406
9407 if (version >= 114)
9408 {
9409 bool hasQuickBarIndexSaved;
9410
9411 if (!ctx.
Read(hasQuickBarIndexSaved))
9412 {
9414 return false;
9415 }
9416
9417 if (hasQuickBarIndexSaved)
9418 {
9419 int itmQBIndex;
9420
9421
9422 if (!ctx.
Read(itmQBIndex))
9423 {
9425 return false;
9426 }
9427
9428 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9429 if (itmQBIndex != -1 && parentPlayer)
9430 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9431 }
9432 }
9433 else
9434 {
9435
9436 PlayerBase player;
9437 int itemQBIndex;
9438 if (version ==
int.
MAX)
9439 {
9440 if (!ctx.
Read(itemQBIndex))
9441 {
9443 return false;
9444 }
9445 }
9446 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9447 {
9448
9449 if (!ctx.
Read(itemQBIndex))
9450 {
9452 return false;
9453 }
9454 if (itemQBIndex != -1 && player)
9455 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9456 }
9457 }
9458
9459 if (version < 140)
9460 {
9461
9462 if (!LoadVariables(ctx, version))
9463 {
9465 return false;
9466 }
9467 }
9468
9469
9471 {
9473 return false;
9474 }
9475 if (version >= 132)
9476 {
9478 if (raib)
9479 {
9481 {
9483 return false;
9484 }
9485 }
9486 }
9487
9489 return true;
9490 }
9491
9492
9493
9495 {
9496 super.OnStoreSave(ctx);
9497
9498 PlayerBase player;
9499 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9500 {
9502
9503 int itemQBIndex = -1;
9504 itemQBIndex = player.FindQuickBarEntityIndex(this);
9505 ctx.
Write(itemQBIndex);
9506 }
9507 else
9508 {
9510 }
9511
9513
9515 if (raib)
9516 {
9518 }
9519 }
9520
9521
9523 {
9524 super.AfterStoreLoad();
9525
9527 {
9529 }
9530
9532 {
9535 }
9536 }
9537
9539 {
9540 super.EEOnAfterLoad();
9541
9543 {
9545 }
9546
9549 }
9550
9552 {
9553 return false;
9554 }
9555
9556
9557
9559 {
9561 {
9562 #ifdef PLATFORM_CONSOLE
9563
9565 {
9567 if (menu)
9568 {
9570 }
9571 }
9572 #endif
9573 }
9574
9576 {
9579 }
9580
9582 {
9583 SetWeightDirty();
9585 }
9587 {
9590 }
9591
9593 {
9596 }
9598 {
9601 }
9602
9603 super.OnVariablesSynchronized();
9604 }
9605
9606
9607
9609 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9610 {
9611 if (!IsServerCheck(allow_client))
9612 return false;
9613
9615 return false;
9616
9619
9620 if (value <= (min + 0.001))
9621 value = min;
9622
9623 if (value == min)
9624 {
9625 if (destroy_config)
9626 {
9627 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9628 if (dstr)
9629 {
9631 this.Delete();
9632 return true;
9633 }
9634 }
9635 else if (destroy_forced)
9636 {
9638 this.Delete();
9639 return true;
9640 }
9641
9643 }
9644
9647
9649 {
9651
9652 if (delta)
9654 }
9655
9657
9658 return false;
9659 }
9660
9661
9663 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9664 {
9666 }
9667
9669 {
9672 }
9673
9675 {
9678 }
9679
9681 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9682 {
9683 float value_clamped = Math.Clamp(value, 0, 1);
9685 SetQuantity(result, destroy_config, destroy_forced);
9686 }
9687
9688
9691 {
9693 }
9694
9696 {
9698 }
9699
9700
9701
9702
9703
9704
9705
9706
9707
9708
9710 {
9711 int slot = -1;
9712 if (GetInventory())
9713 {
9714 InventoryLocation il = new InventoryLocation;
9715 GetInventory().GetCurrentInventoryLocation(il);
9717 }
9718
9720 }
9721
9723 {
9724 float quantity_max = 0;
9725
9727 {
9728 if (attSlotID != -1)
9729 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9730
9731 if (quantity_max <= 0)
9733 }
9734
9735 if (quantity_max <= 0)
9737
9738 return quantity_max;
9739 }
9740
9742 {
9744 }
9745
9747 {
9749 }
9750
9751
9753 {
9755 }
9756
9758 {
9760 }
9761
9763 {
9765 }
9766
9767
9769 {
9770
9771 float weightEx = GetWeightEx();
9772 float special = GetInventoryAndCargoWeight();
9773 return weightEx - special;
9774 }
9775
9776
9778 {
9780 }
9781
9783 {
9785 {
9786 #ifdef DEVELOPER
9787 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9788 {
9789 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9791 }
9792 #endif
9793
9795 }
9796 else if (HasEnergyManager())
9797 {
9798 #ifdef DEVELOPER
9799 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9800 {
9801 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9802 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9803 }
9804 #endif
9805 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9806 }
9807 else
9808 {
9809 #ifdef DEVELOPER
9810 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9811 {
9812 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9813 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9814 }
9815 #endif
9816 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9817 }
9818 }
9819
9822 {
9823 int item_count = 0;
9825
9826 if (GetInventory().GetCargo() != NULL)
9827 {
9828 item_count = GetInventory().GetCargo().GetItemCount();
9829 }
9830
9831 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9832 {
9833 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9834 if (item)
9835 item_count += item.GetNumberOfItems();
9836 }
9837 return item_count;
9838 }
9839
9842 {
9843 float weight = 0;
9844 float wetness = 1;
9845 if (include_wetness)
9848 {
9849 weight = wetness * m_ConfigWeight;
9850 }
9852 {
9853 weight = 1;
9854 }
9855 return weight;
9856 }
9857
9858
9859
9861 {
9862 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9863 {
9864 GameInventory inv = GetInventory();
9865 array<EntityAI> items = new array<EntityAI>;
9867 for (int i = 0; i < items.Count(); i++)
9868 {
9870 if (item)
9871 {
9873 }
9874 }
9875 }
9876 }
9877
9878
9879
9880
9882 {
9883 float energy = 0;
9884 if (HasEnergyManager())
9885 {
9886 energy = GetCompEM().GetEnergy();
9887 }
9888 return energy;
9889 }
9890
9891
9893 {
9894 super.OnEnergyConsumed();
9895
9897 }
9898
9900 {
9901 super.OnEnergyAdded();
9902
9904 }
9905
9906
9908 {
9909 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9910 {
9912 {
9913 float energy_0to1 = GetCompEM().GetEnergy0To1();
9915 }
9916 }
9917 }
9918
9919
9921 {
9922 return ConfigGetFloat("heatIsolation");
9923 }
9924
9926 {
9928 }
9929
9931 {
9932 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9933 if (
GetGame().ConfigIsExisting(paramPath))
9935
9936 return 0.0;
9937 }
9938
9940 {
9941 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9942 if (
GetGame().ConfigIsExisting(paramPath))
9944
9945 return 0.0;
9946 }
9947
9948 override void SetWet(
float value,
bool allow_client =
false)
9949 {
9950 if (!IsServerCheck(allow_client))
9951 return;
9952
9955
9957
9958 m_VarWet = Math.Clamp(value, min, max);
9959
9961 {
9964 }
9965 }
9966
9967 override void AddWet(
float value)
9968 {
9970 }
9971
9973 {
9975 }
9976
9978 {
9980 }
9981
9983 {
9985 }
9986
9988 {
9990 }
9991
9993 {
9995 }
9996
9998 {
10001 if (newLevel != oldLevel)
10002 {
10004 }
10005 }
10006
10008 {
10009 SetWeightDirty();
10010 }
10011
10013 {
10014 return GetWetLevelInternal(
m_VarWet);
10015 }
10016
10017
10018
10020 {
10022 }
10023
10025 {
10027 }
10028
10030 {
10032 }
10033
10035 {
10037 }
10038
10039
10040
10042 {
10043 if (ConfigIsExisting("itemModelLength"))
10044 {
10045 return ConfigGetFloat("itemModelLength");
10046 }
10047 return 0;
10048 }
10049
10051 {
10052 if (ConfigIsExisting("itemAttachOffset"))
10053 {
10054 return ConfigGetFloat("itemAttachOffset");
10055 }
10056 return 0;
10057 }
10058
10059 override void SetCleanness(
int value,
bool allow_client =
false)
10060 {
10061 if (!IsServerCheck(allow_client))
10062 return;
10063
10065
10067
10070 }
10071
10073 {
10075 }
10076
10078 {
10079 return true;
10080 }
10081
10082
10083
10084
10086 {
10088 }
10089
10091 {
10093 }
10094
10095
10096
10097
10098 override void SetColor(
int r,
int g,
int b,
int a)
10099 {
10105 }
10107 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10108 {
10113 }
10114
10116 {
10118 }
10119
10122 {
10123 int r,g,b,a;
10125 r = r/255;
10126 g = g/255;
10127 b = b/255;
10128 a = a/255;
10129 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10130 }
10131
10132
10133
10134 override void SetLiquidType(
int value,
bool allow_client =
false)
10135 {
10136 if (!IsServerCheck(allow_client))
10137 return;
10138
10143 }
10144
10146 {
10147 return ConfigGetInt("varLiquidTypeInit");
10148 }
10149
10151 {
10153 }
10154
10156 {
10158 SetFrozen(false);
10159 }
10160
10163 {
10164 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10165 }
10166
10167
10170 {
10171 PlayerBase nplayer;
10172 if (PlayerBase.CastTo(nplayer, player))
10173 {
10175
10176 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10177 }
10178 }
10179
10180
10183 {
10184 PlayerBase nplayer;
10185 if (PlayerBase.CastTo(nplayer,player))
10186 {
10187
10188 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10189
10190 }
10191
10192
10193 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10194
10195
10196 if (HasEnergyManager())
10197 {
10198 GetCompEM().UpdatePlugState();
10199 }
10200 }
10201
10202
10204 {
10205 super.OnPlacementStarted(player);
10206
10208 }
10209
10210 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10211 {
10213 {
10214 m_AdminLog.OnPlacementComplete(player,
this);
10215 }
10216
10217 super.OnPlacementComplete(player, position, orientation);
10218 }
10219
10220
10221
10222
10223
10225 {
10227 {
10228 return true;
10229 }
10230 else
10231 {
10232 return false;
10233 }
10234 }
10235
10236
10238 {
10240 {
10242 }
10243 }
10244
10245
10247 {
10249 }
10250
10252 {
10254 }
10255
10256 override void InsertAgent(
int agent,
float count = 1)
10257 {
10258 if (count < 1)
10259 return;
10260
10262 }
10263
10266 {
10268 }
10269
10270
10272 {
10274 }
10275
10276
10277
10278
10279
10280
10281
10282
10283
10284
10285
10286
10287
10288
10289
10290
10291
10292
10293
10294
10295
10296
10297
10298
10299
10300
10301
10302
10303
10304
10305
10306
10307
10308
10309
10310
10311
10312
10313
10314
10315
10316
10318 {
10320 return false;
10321 return true;
10322 }
10323
10325 {
10326
10328 }
10329
10330
10333 {
10334 super.CheckForRoofLimited(timeTresholdMS);
10335
10337 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10338 {
10339 m_PreviousRoofTestTime = time;
10340 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10341 }
10342 }
10343
10344
10346 {
10348 {
10349 return 0;
10350 }
10351
10352 if (GetInventory().GetAttachmentSlotsCount() != 0)
10353 {
10354 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10355 if (filter)
10356 return filter.GetProtectionLevel(type, false, system);
10357 else
10358 return 0;
10359 }
10360
10361 string subclassPath, entryName;
10362
10363 switch (type)
10364 {
10366 entryName = "biological";
10367 break;
10369 entryName = "chemical";
10370 break;
10371 default:
10372 entryName = "biological";
10373 break;
10374 }
10375
10376 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10377
10379 }
10380
10381
10382
10385 {
10386 if (!IsMagazine())
10388
10390 }
10391
10392
10393
10394
10395
10400 {
10401 return true;
10402 }
10403
10405 {
10407 }
10408
10409
10410
10411
10412
10414 {
10415 if (parent)
10416 {
10417 if (parent.IsInherited(DayZInfected))
10418 return true;
10419
10420 if (!parent.IsRuined())
10421 return true;
10422 }
10423
10424 return true;
10425 }
10426
10428 {
10429 if (!super.CanPutAsAttachment(parent))
10430 {
10431 return false;
10432 }
10433
10434 if (!IsRuined() && !parent.IsRuined())
10435 {
10436 return true;
10437 }
10438
10439 return false;
10440 }
10441
10443 {
10444
10445
10446
10447
10448 return super.CanReceiveItemIntoCargo(item);
10449 }
10450
10452 {
10453
10454
10455
10456
10457 GameInventory attachmentInv = attachment.GetInventory();
10459 {
10460 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10461 return false;
10462 }
10463
10464 InventoryLocation loc = new InventoryLocation();
10465 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10466 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10467 return false;
10468
10469 return super.CanReceiveAttachment(attachment, slotId);
10470 }
10471
10473 {
10474 if (!super.CanReleaseAttachment(attachment))
10475 return false;
10476
10477 return GetInventory().AreChildrenAccessible();
10478 }
10479
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10501 {
10502 int id = muzzle_owner.GetMuzzleID();
10503 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10504
10505 if (WPOF_array)
10506 {
10507 for (int i = 0; i < WPOF_array.Count(); i++)
10508 {
10509 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10510
10511 if (WPOF)
10512 {
10513 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10514 }
10515 }
10516 }
10517 }
10518
10519
10521 {
10522 int id = muzzle_owner.GetMuzzleID();
10524
10525 if (WPOBE_array)
10526 {
10527 for (int i = 0; i < WPOBE_array.Count(); i++)
10528 {
10529 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10530
10531 if (WPOBE)
10532 {
10533 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10534 }
10535 }
10536 }
10537 }
10538
10539
10541 {
10542 int id = muzzle_owner.GetMuzzleID();
10543 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10544
10545 if (WPOOH_array)
10546 {
10547 for (int i = 0; i < WPOOH_array.Count(); i++)
10548 {
10549 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10550
10551 if (WPOOH)
10552 {
10553 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10554 }
10555 }
10556 }
10557 }
10558
10559
10561 {
10562 int id = muzzle_owner.GetMuzzleID();
10563 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10564
10565 if (WPOOH_array)
10566 {
10567 for (int i = 0; i < WPOOH_array.Count(); i++)
10568 {
10569 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10570
10571 if (WPOOH)
10572 {
10573 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10574 }
10575 }
10576 }
10577 }
10578
10579
10581 {
10582 int id = muzzle_owner.GetMuzzleID();
10583 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10584
10585 if (WPOOH_array)
10586 {
10587 for (int i = 0; i < WPOOH_array.Count(); i++)
10588 {
10589 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10590
10591 if (WPOOH)
10592 {
10593 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10594 }
10595 }
10596 }
10597 }
10598
10599
10600
10602 {
10604 {
10605 return true;
10606 }
10607
10608 return false;
10609 }
10610
10612 {
10614 {
10615 return true;
10616 }
10617
10618 return false;
10619 }
10620
10622 {
10624 {
10625 return true;
10626 }
10627
10628 return false;
10629 }
10630
10632 {
10633 return false;
10634 }
10635
10638 {
10639 return UATimeSpent.DEFAULT_DEPLOY;
10640 }
10641
10642
10643
10644
10646 {
10648 SetSynchDirty();
10649 }
10650
10652 {
10654 }
10655
10656
10658 {
10659 return false;
10660 }
10661
10664 {
10665 string att_type = "None";
10666
10667 if (ConfigIsExisting("soundAttType"))
10668 {
10669 att_type = ConfigGetString("soundAttType");
10670 }
10671
10673 }
10674
10676 {
10678 }
10679
10680
10681
10682
10683
10689
10691 {
10694
10696 }
10697
10698
10700 {
10702 return;
10703
10705
10708
10711
10712 SoundParameters params = new SoundParameters();
10716 }
10717
10718
10720 {
10722 return;
10723
10725 SetSynchDirty();
10726
10729 }
10730
10731
10733 {
10735 return;
10736
10738 SetSynchDirty();
10739
10742 }
10743
10745 {
10747 }
10748
10750 {
10752 }
10753
10756 {
10757 if (!
GetGame().IsDedicatedServer())
10758 {
10759 if (ConfigIsExisting("attachSoundSet"))
10760 {
10761 string cfg_path = "";
10762 string soundset = "";
10763 string type_name =
GetType();
10764
10767 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10768 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10769
10770 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10771 {
10772 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10773 {
10774 if (cfg_slot_array[i] == slot_type)
10775 {
10776 soundset = cfg_soundset_array[i];
10777 break;
10778 }
10779 }
10780 }
10781
10782 if (soundset != "")
10783 {
10784 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10786 }
10787 }
10788 }
10789 }
10790
10792 {
10793
10794 }
10795
10796 void OnApply(PlayerBase player);
10797
10799 {
10800 return 1.0;
10801 };
10802
10804 {
10806 }
10807
10809 {
10811 }
10812
10814
10816 {
10817 SetDynamicPhysicsLifeTime(0.01);
10819 }
10820
10822 {
10823 array<string> zone_names = new array<string>;
10824 GetDamageZones(zone_names);
10825 for (int i = 0; i < zone_names.Count(); i++)
10826 {
10827 SetHealthMax(zone_names.Get(i),"Health");
10828 }
10829 SetHealthMax("","Health");
10830 }
10831
10834 {
10835 float global_health = GetHealth01("","Health");
10836 array<string> zones = new array<string>;
10837 GetDamageZones(zones);
10838
10839 for (int i = 0; i < zones.Count(); i++)
10840 {
10841 SetHealth01(zones.Get(i),"Health",global_health);
10842 }
10843 }
10844
10847 {
10848 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10849 }
10850
10852 {
10853 if (!hasRootAsPlayer)
10854 {
10855 if (refParentIB)
10856 {
10857
10858 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10859 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10860
10861 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10862 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10863
10866 }
10867 else
10868 {
10869
10872 }
10873 }
10874 }
10875
10877 {
10879 {
10880 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10881 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10882 {
10883 float heatPermCoef = 1.0;
10885 while (ent)
10886 {
10887 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10888 ent = ent.GetHierarchyParent();
10889 }
10890
10891 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10892 }
10893 }
10894 }
10895
10897 {
10898
10899 EntityAI parent = GetHierarchyParent();
10900 if (!parent)
10901 {
10902 hasParent = false;
10903 hasRootAsPlayer = false;
10904 }
10905 else
10906 {
10907 hasParent = true;
10908 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10909 refParentIB =
ItemBase.Cast(parent);
10910 }
10911 }
10912
10913 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10914 {
10915
10916 }
10917
10919 {
10920
10921 return false;
10922 }
10923
10925 {
10926
10927
10928 return false;
10929 }
10930
10932 {
10933
10934 return false;
10935 }
10936
10939 {
10940 return !GetIsFrozen() &&
IsOpen();
10941 }
10942
10944 {
10945 bool hasParent = false, hasRootAsPlayer = false;
10947
10948 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10949 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10950
10951 if (wwtu || foodDecay)
10952 {
10956
10957 if (processWetness || processTemperature || processDecay)
10958 {
10960
10961 if (processWetness)
10962 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10963
10964 if (processTemperature)
10966
10967 if (processDecay)
10968 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10969 }
10970 }
10971 }
10972
10975 {
10977 }
10978
10980 {
10983
10984 return super.GetTemperatureFreezeThreshold();
10985 }
10986
10988 {
10991
10992 return super.GetTemperatureThawThreshold();
10993 }
10994
10996 {
10999
11000 return super.GetItemOverheatThreshold();
11001 }
11002
11004 {
11006 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11007
11008 return super.GetTemperatureFreezeTime();
11009 }
11010
11012 {
11014 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11015
11016 return super.GetTemperatureThawTime();
11017 }
11018
11023
11025 {
11026 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11027 }
11028
11030 {
11031 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11032 }
11033
11036 {
11038 }
11039
11041 {
11043 }
11044
11046 {
11048 }
11049
11052 {
11053 return null;
11054 }
11055
11058 {
11059 return false;
11060 }
11061
11063 {
11065 {
11068 if (!trg)
11069 {
11071 explosive = this;
11072 }
11073
11074 explosive.PairRemote(trg);
11076
11077 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11078 trg.SetPersistentPairID(persistentID);
11079 explosive.SetPersistentPairID(persistentID);
11080
11081 return true;
11082 }
11083 return false;
11084 }
11085
11088 {
11089 float ret = 1.0;
11092 ret *= GetHealth01();
11093
11094 return ret;
11095 }
11096
11097 #ifdef DEVELOPER
11098 override void SetDebugItem()
11099 {
11100 super.SetDebugItem();
11101 _itemBase = this;
11102 }
11103
11105 {
11106 string text = super.GetDebugText();
11107
11109 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11110
11111 return text;
11112 }
11113 #endif
11114
11116 {
11117 return true;
11118 }
11119
11121
11123
11125 {
11128 }
11129
11130
11138
11154}
11155
11157{
11159 if (entity)
11160 {
11161 bool is_item = entity.IsInherited(
ItemBase);
11162 if (is_item && full_quantity)
11163 {
11166 }
11167 }
11168 else
11169 {
11171 return NULL;
11172 }
11173 return entity;
11174}
11175
11177{
11178 if (item)
11179 {
11180 if (health > 0)
11181 item.SetHealth("", "", health);
11182
11183 if (item.CanHaveTemperature())
11184 {
11186 if (item.CanFreeze())
11187 item.SetFrozen(false);
11188 }
11189
11190 if (item.HasEnergyManager())
11191 {
11192 if (quantity >= 0)
11193 {
11194 item.GetCompEM().SetEnergy0To1(quantity);
11195 }
11196 else
11197 {
11199 }
11200 }
11201 else if (item.IsMagazine())
11202 {
11203 Magazine mag = Magazine.Cast(item);
11204 if (quantity >= 0)
11205 {
11206 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11207 }
11208 else
11209 {
11211 }
11212
11213 }
11214 else
11215 {
11216 if (quantity >= 0)
11217 {
11218 item.SetQuantityNormalized(quantity, false);
11219 }
11220 else
11221 {
11223 }
11224
11225 }
11226 }
11227}
11228
11229#ifdef DEVELOPER
11231#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.