6243{
6245 {
6246 return true;
6247 }
6248};
6249
6250
6251
6253{
6257
6259
6262
6263
6264
6265
6266
6275
6281
6286
6291
6312 protected bool m_IsResultOfSplit
6313
6315
6320
6321
6322
6324
6328
6329
6330
6332
6335
6336
6337
6343
6344
6352
6355
6356
6358
6359
6361
6362
6367
6368
6373
6374
6376
6377
6379 {
6384
6385 if (!
GetGame().IsDedicatedServer())
6386 {
6388 {
6390
6392 {
6394 }
6395 }
6396
6399 }
6400
6401 m_OldLocation = null;
6402
6404 {
6406 }
6407
6408 if (ConfigIsExisting("headSelectionsToHide"))
6409 {
6412 }
6413
6415 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6416 {
6418 }
6419
6421
6422 m_IsResultOfSplit = false;
6423
6425 }
6426
6428 {
6429 super.InitItemVariables();
6430
6436 m_Count = ConfigGetInt(
"count");
6437
6440
6445
6448
6453
6465
6469
6470
6473 if (ConfigIsExisting("canBeSplit"))
6474 {
6477 }
6478
6480 if (ConfigIsExisting("itemBehaviour"))
6482
6483
6486 RegisterNetSyncVariableInt("m_VarLiquidType");
6487 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6488
6489 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6490 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6491 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6492
6493 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6494 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6495 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6496 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6497
6498 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6499 RegisterNetSyncVariableBool("m_IsTakeable");
6500 RegisterNetSyncVariableBool("m_IsHologram");
6501
6504 {
6507 }
6508
6510
6512 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6514
6515 }
6516
6518 {
6520 }
6521
6523 {
6526 {
6531 }
6532 }
6533
6534 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6535 {
6537 {
6540 }
6541
6543 }
6544
6546 {
6552 }
6553
6555
6557 {
6559
6560 if (!action)
6561 {
6562 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6563 return;
6564 }
6565
6567 if (!ai)
6568 {
6570 return;
6571 }
6572
6574 if (!action_array)
6575 {
6576 action_array = new array<ActionBase_Basic>;
6578 }
6579 if (LogManager.IsActionLogEnable())
6580 {
6581 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6582 }
6583
6584 if (action_array.Find(action) != -1)
6585 {
6586 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6587 }
6588 else
6589 {
6590 action_array.Insert(action);
6591 }
6592 }
6593
6595 {
6597 ActionBase action = player.GetActionManager().GetAction(actionName);
6600
6601 if (action_array)
6602 {
6603 action_array.RemoveItem(action);
6604 }
6605 }
6606
6607
6608
6610 {
6611 ActionOverrideData overrideData = new ActionOverrideData();
6615
6617 if (!actionMap)
6618 {
6621 }
6622
6623 actionMap.Insert(this.
Type(), overrideData);
6624
6625 }
6626
6628
6630
6631
6633 {
6636
6639
6640 string config_to_search = "CfgVehicles";
6641 string muzzle_owner_config;
6642
6644 {
6645 if (IsInherited(Weapon))
6646 config_to_search = "CfgWeapons";
6647
6648 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6649
6650 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6651
6653
6654 if (config_OnFire_subclass_count > 0)
6655 {
6656 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6657
6658 for (int i = 0; i < config_OnFire_subclass_count; i++)
6659 {
6660 string particle_class = "";
6662 string config_OnFire_entry = config_OnFire_class + particle_class;
6663 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6664 WPOF_array.Insert(WPOF);
6665 }
6666
6667
6669 }
6670 }
6671
6673 {
6674 config_to_search = "CfgWeapons";
6675 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6676
6677 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6678
6680
6681 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6682 {
6683 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6684
6685 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6686 {
6687 string particle_class2 = "";
6689 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6690 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6691 WPOBE_array.Insert(WPOBE);
6692 }
6693
6694
6696 }
6697 }
6698 }
6699
6700
6702 {
6705
6707 {
6708 string config_to_search = "CfgVehicles";
6709
6710 if (IsInherited(Weapon))
6711 config_to_search = "CfgWeapons";
6712
6713 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6714 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6715
6716 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6717 {
6718
6720
6722 {
6724 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6726 return;
6727 }
6728
6731
6732
6733
6735 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6736
6737 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6738 {
6739 string particle_class = "";
6741 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6743
6744 if (entry_type == CT_CLASS)
6745 {
6746 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6747 WPOOH_array.Insert(WPOF);
6748 }
6749 }
6750
6751
6753 }
6754 }
6755 }
6756
6758 {
6760 }
6761
6763 {
6765 {
6767
6770
6773
6774 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6775 }
6776 }
6777
6779 {
6781 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6782
6784 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6785
6787 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6788
6790 {
6792 }
6793 }
6794
6796 {
6798 }
6799
6801 {
6804 else
6806
6808 {
6811 }
6812 else
6813 {
6816
6819 }
6820
6822 }
6823
6825 {
6827 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6828 }
6829
6831 {
6833 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6835 }
6836
6838 {
6840 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6841 }
6842
6844 {
6847
6848 OverheatingParticle OP = new OverheatingParticle();
6853
6855 }
6856
6858 {
6861
6862 return -1;
6863 }
6864
6866 {
6868 {
6871
6872 for (int i = count; i > 0; --i)
6873 {
6874 int id = i - 1;
6877
6880
6881 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6882 {
6883 if (p)
6884 {
6887 }
6888 }
6889 }
6890 }
6891 }
6892
6894 {
6896 {
6898 {
6899 int id = i - 1;
6901
6902 if (OP)
6903 {
6905
6906 if (p)
6907 {
6909 }
6910
6911 delete OP;
6912 }
6913 }
6914
6917 }
6918 }
6919
6922 {
6923 return 0.0;
6924 }
6925
6926
6928 {
6929 return 250;
6930 }
6931
6933 {
6934 return 0;
6935 }
6936
6939 {
6941 return true;
6942
6943 return false;
6944 }
6945
6948 {
6951
6953 {
6955 }
6956 else
6957 {
6958
6960 }
6961
6963 }
6964
6971 {
6972 return -1;
6973 }
6974
6975
6976
6977
6979 {
6981 {
6983 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6984
6985 if (r_index >= 0)
6986 {
6987 InventoryLocation r_il = new InventoryLocation;
6988 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6989
6990 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6993 {
6994 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6995 }
6997 {
6998 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6999 }
7000
7001 }
7002
7003 player.GetHumanInventory().ClearUserReservedLocation(this);
7004 }
7005
7008 }
7009
7010
7011
7012
7014 {
7015 return ItemBase.m_DebugActionsMask;
7016 }
7017
7019 {
7020 return ItemBase.m_DebugActionsMask & mask;
7021 }
7022
7024 {
7025 ItemBase.m_DebugActionsMask = mask;
7026 }
7027
7029 {
7030 ItemBase.m_DebugActionsMask |= mask;
7031 }
7032
7034 {
7035 ItemBase.m_DebugActionsMask &= ~mask;
7036 }
7037
7039 {
7041 {
7043 }
7044 else
7045 {
7047 }
7048 }
7049
7050
7052 {
7053 if (GetEconomyProfile())
7054 {
7055 float q_max = GetEconomyProfile().GetQuantityMax();
7056 if (q_max > 0)
7057 {
7058 float q_min = GetEconomyProfile().GetQuantityMin();
7059 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7060
7062 {
7063 ComponentEnergyManager comp = GetCompEM();
7065 {
7067 }
7068 }
7070 {
7072
7073 }
7074
7075 }
7076 }
7077 }
7078
7081 {
7082 EntityAI parent = GetHierarchyParent();
7083
7084 if (parent)
7085 {
7086 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7087 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7088 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7089 }
7090 }
7091
7094 {
7095 EntityAI parent = GetHierarchyParent();
7096
7097 if (parent)
7098 {
7099 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7100 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7101 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7102 }
7103 }
7104
7106 {
7107
7108
7109
7110
7112
7114 {
7115 if (ScriptInputUserData.CanStoreInputUserData())
7116 {
7117 ScriptInputUserData ctx = new ScriptInputUserData;
7123 ctx.
Write(use_stack_max);
7126
7128 {
7129 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7130 }
7131 }
7132 }
7133 else if (!
GetGame().IsMultiplayer())
7134 {
7136 }
7137 }
7138
7140 {
7142 }
7143
7145 {
7147 }
7148
7150 {
7152 }
7153
7155 {
7156
7157 return false;
7158 }
7159
7161 {
7162 return false;
7163 }
7164
7168 {
7169 return false;
7170 }
7171
7173 {
7174 return "";
7175 }
7176
7178
7180 {
7181 return false;
7182 }
7183
7185 {
7186 return true;
7187 }
7188
7189
7190
7192 {
7193 return true;
7194 }
7195
7197 {
7198 return true;
7199 }
7200
7202 {
7203 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7205 }
7206
7208 {
7210 }
7211
7213 {
7215 if (!is_being_placed)
7217 SetSynchDirty();
7218 }
7219
7220
7222
7224 {
7226 }
7227
7229 {
7231 }
7232
7234 {
7235 return 1;
7236 }
7237
7239 {
7240 return false;
7241 }
7242
7244 {
7246 SetSynchDirty();
7247 }
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7263
7264
7265
7266
7267
7268
7269
7270
7271
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7284 {
7285 super.OnMovedInsideCargo(container);
7286
7287 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7288 }
7289
7290 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7291 {
7292 super.EEItemLocationChanged(oldLoc,newLoc);
7293
7294 PlayerBase new_player = null;
7295 PlayerBase old_player = null;
7296
7297 if (newLoc.GetParent())
7298 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7299
7300 if (oldLoc.GetParent())
7301 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7302
7304 {
7305 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
7306
7307 if (r_index >= 0)
7308 {
7309 InventoryLocation r_il = new InventoryLocation;
7310 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7311
7312 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7315 {
7316 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7317 }
7319 {
7320 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7321 }
7322
7323 }
7324 }
7325
7327 {
7328 if (new_player)
7329 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
7330
7331 if (new_player == old_player)
7332 {
7333
7334 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7335 {
7337 {
7338 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7339 {
7340 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7341 }
7342 }
7343 else
7344 {
7345 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7346 }
7347 }
7348
7349 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7350 {
7351 int type = oldLoc.GetType();
7353 {
7354 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7355 }
7357 {
7358 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7359 }
7360 }
7361 if (!m_OldLocation)
7362 {
7363 m_OldLocation = new InventoryLocation;
7364 }
7365 m_OldLocation.Copy(oldLoc);
7366 }
7367 else
7368 {
7369 if (m_OldLocation)
7370 {
7371 m_OldLocation.Reset();
7372 }
7373 }
7374
7376 }
7377 else
7378 {
7379 if (new_player)
7380 {
7381 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7382 if (res_index >= 0)
7383 {
7384 InventoryLocation il = new InventoryLocation;
7385 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
7387 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
7390 {
7391 il.
GetParent().GetOnReleaseLock().Invoke(it);
7392 }
7394 {
7396 }
7397
7398 }
7399 }
7401 {
7402
7404 }
7405
7406 if (m_OldLocation)
7407 {
7408 m_OldLocation.Reset();
7409 }
7410 }
7411 }
7412
7413 override void EOnContact(IEntity other, Contact extra)
7414 {
7416 {
7417 int liquidType = -1;
7419 if (impactSpeed > 0.0)
7420 {
7422 #ifndef SERVER
7424 #else
7426 SetSynchDirty();
7427 #endif
7429 }
7430 }
7431
7432 #ifdef SERVER
7433 if (GetCompEM() && GetCompEM().IsPlugged())
7434 {
7435 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7436 GetCompEM().UnplugThis();
7437 }
7438 #endif
7439 }
7440
7442
7444 {
7446 }
7447
7449 {
7450
7451 }
7452
7454 {
7455 super.OnItemLocationChanged(old_owner, new_owner);
7456
7457 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7458 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7459
7460 if (!relatedPlayer && playerNew)
7461 relatedPlayer = playerNew;
7462
7463 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7464 {
7466 if (actionMgr)
7467 {
7468 ActionBase currentAction = actionMgr.GetRunningAction();
7469 if (currentAction)
7471 }
7472 }
7473
7474 Man ownerPlayerOld = null;
7475 Man ownerPlayerNew = null;
7476
7477 if (old_owner)
7478 {
7479 if (old_owner.
IsMan())
7480 {
7481 ownerPlayerOld = Man.Cast(old_owner);
7482 }
7483 else
7484 {
7485 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7486 }
7487 }
7488 else
7489 {
7491 {
7493
7494 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7495 {
7496 GetCompEM().UnplugThis();
7497 }
7498 }
7499 }
7500
7501 if (new_owner)
7502 {
7503 if (new_owner.
IsMan())
7504 {
7505 ownerPlayerNew = Man.Cast(new_owner);
7506 }
7507 else
7508 {
7509 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7510 }
7511 }
7512
7513 if (ownerPlayerOld != ownerPlayerNew)
7514 {
7515 if (ownerPlayerOld)
7516 {
7517 array<EntityAI> subItemsExit = new array<EntityAI>;
7519 for (int i = 0; i < subItemsExit.Count(); i++)
7520 {
7523 }
7524 }
7525
7526 if (ownerPlayerNew)
7527 {
7528 array<EntityAI> subItemsEnter = new array<EntityAI>;
7530 for (int j = 0; j < subItemsEnter.Count(); j++)
7531 {
7534 }
7535 }
7536 }
7537 else if (ownerPlayerNew != null)
7538 {
7539 PlayerBase nplayer;
7540 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7541 {
7542 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7544 for (int k = 0; k < subItemsUpdate.Count(); k++)
7545 {
7547 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7548 }
7549 }
7550 }
7551
7552 if (old_owner)
7553 old_owner.OnChildItemRemoved(this);
7554 if (new_owner)
7555 new_owner.OnChildItemReceived(this);
7556 }
7557
7558
7560 {
7561 super.EEDelete(parent);
7562 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7563 if (player)
7564 {
7566
7567 if (player.IsAlive())
7568 {
7569 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7570 if (r_index >= 0)
7571 {
7572 InventoryLocation r_il = new InventoryLocation;
7573 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7574
7575 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7578 {
7579 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7580 }
7582 {
7583 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7584 }
7585
7586 }
7587
7588 player.RemoveQuickBarEntityShortcut(this);
7589 }
7590 }
7591 }
7592
7594 {
7595 super.EEKilled(killer);
7596
7599 {
7600 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7601 {
7602 if (IsMagazine())
7603 {
7604 if (Magazine.Cast(this).GetAmmoCount() > 0)
7605 {
7607 }
7608 }
7609 else
7610 {
7612 }
7613 }
7614 }
7615 }
7616
7618 {
7619 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7620
7621 super.OnWasAttached(parent, slot_id);
7622
7625
7627 }
7628
7630 {
7631 super.OnWasDetached(parent, slot_id);
7632
7635 }
7636
7638 {
7639 int idx;
7642
7643 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7644 if (inventory_slots.Count() < 1)
7645 {
7646 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7647 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7648 }
7649 else
7650 {
7651 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7652 }
7653
7654 idx = inventory_slots.Find(slot);
7655 if (idx < 0)
7656 return "";
7657
7658 return attach_types.Get(idx);
7659 }
7660
7662 {
7663 int idx = -1;
7664 string slot;
7665
7668
7669 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7670 if (inventory_slots.Count() < 1)
7671 {
7672 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7673 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7674 }
7675 else
7676 {
7677 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7678 if (detach_types.Count() < 1)
7679 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7680 }
7681
7682 for (int i = 0; i < inventory_slots.Count(); i++)
7683 {
7684 slot = inventory_slots.Get(i);
7685 }
7686
7687 if (slot != "")
7688 {
7689 if (detach_types.Count() == 1)
7690 idx = 0;
7691 else
7692 idx = inventory_slots.Find(slot);
7693 }
7694 if (idx < 0)
7695 return "";
7696
7697 return detach_types.Get(idx);
7698 }
7699
7701 {
7702
7704
7705
7706 float min_time = 1;
7707 float max_time = 3;
7708 float delay = Math.RandomFloat(min_time, max_time);
7709
7710 explode_timer.Run(delay, this, "DoAmmoExplosion");
7711 }
7712
7714 {
7715 Magazine magazine = Magazine.Cast(this);
7716 int pop_sounds_count = 6;
7717 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7718
7719
7720 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7721 string sound_name = pop_sounds[ sound_idx ];
7723
7724
7725 magazine.ServerAddAmmoCount(-1);
7726
7727
7728 float min_temp_to_explode = 100;
7729
7730 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7731 {
7733 }
7734 }
7735
7736
7737 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7738 {
7739 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7740
7741 const int CHANCE_DAMAGE_CARGO = 4;
7742 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7743 const int CHANCE_DAMAGE_NOTHING = 2;
7744
7746 {
7747 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7748 int chances;
7749 int rnd;
7750
7751 if (GetInventory().GetCargo())
7752 {
7753 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7754 rnd = Math.RandomInt(0,chances);
7755
7756 if (rnd < CHANCE_DAMAGE_CARGO)
7757 {
7759 }
7760 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7761 {
7763 }
7764 }
7765 else
7766 {
7767 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7768 rnd = Math.RandomInt(0,chances);
7769
7770 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7771 {
7773 }
7774 }
7775 }
7776 }
7777
7779 {
7780 if (GetInventory().GetCargo())
7781 {
7782 int item_count = GetInventory().GetCargo().GetItemCount();
7783 if (item_count > 0)
7784 {
7785 int random_pick = Math.RandomInt(0, item_count);
7787 if (!item.IsExplosive())
7788 {
7789 item.AddHealth("","",damage);
7790 return true;
7791 }
7792 }
7793 }
7794 return false;
7795 }
7796
7798 {
7799 int attachment_count = GetInventory().AttachmentCount();
7800 if (attachment_count > 0)
7801 {
7802 int random_pick = Math.RandomInt(0, attachment_count);
7803 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7804 if (!attachment.IsExplosive())
7805 {
7806 attachment.AddHealth("","",damage);
7807 return true;
7808 }
7809 }
7810 return false;
7811 }
7812
7814 {
7816 }
7817
7819 {
7821 return GetInventory().CanRemoveEntity();
7822
7823 return false;
7824 }
7825
7827 {
7828
7830 return false;
7831
7832
7834 return false;
7835
7836
7837
7839 if (delta == 0)
7840 return false;
7841
7842
7843 return true;
7844 }
7845
7847 {
7849 {
7850 if (ScriptInputUserData.CanStoreInputUserData())
7851 {
7852 ScriptInputUserData ctx = new ScriptInputUserData;
7857 ctx.
Write(destination_entity);
7861 }
7862 }
7863 else if (!
GetGame().IsMultiplayer())
7864 {
7866 }
7867 }
7868
7870 {
7871 float split_quantity_new;
7875 InventoryLocation loc = new InventoryLocation;
7876
7877 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7878 {
7880 split_quantity_new = stack_max;
7881 else
7883
7885 {
7886 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7887 if (new_item)
7888 {
7889 new_item.SetResultOfSplit(true);
7890 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7892 new_item.
SetQuantity(split_quantity_new,
false,
true);
7893 }
7894 }
7895 }
7896 else if (destination_entity && slot_id == -1)
7897 {
7898 if (quantity > stack_max)
7899 split_quantity_new = stack_max;
7900 else
7901 split_quantity_new = quantity;
7902
7904 {
7906 {
7909 }
7910
7911 if (new_item)
7912 {
7913 new_item.SetResultOfSplit(true);
7914 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7916 new_item.
SetQuantity(split_quantity_new,
false,
true);
7917 }
7918 }
7919 }
7920 else
7921 {
7922 if (stack_max != 0)
7923 {
7925 {
7927 }
7928
7929 if (split_quantity_new == 0)
7930 {
7931 if (!
GetGame().IsMultiplayer())
7932 player.PhysicalPredictiveDropItem(this);
7933 else
7934 player.ServerDropEntity(this);
7935 return;
7936 }
7937
7939 {
7941
7942 if (new_item)
7943 {
7944 new_item.SetResultOfSplit(true);
7945 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7948 new_item.PlaceOnSurface();
7949 }
7950 }
7951 }
7952 }
7953 }
7954
7956 {
7957 float split_quantity_new;
7961 InventoryLocation loc = new InventoryLocation;
7962
7963 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7964 {
7966 split_quantity_new = stack_max;
7967 else
7969
7971 {
7972 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7973 if (new_item)
7974 {
7975 new_item.SetResultOfSplit(true);
7976 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7978 new_item.
SetQuantity(split_quantity_new,
false,
true);
7979 }
7980 }
7981 }
7982 else if (destination_entity && slot_id == -1)
7983 {
7984 if (quantity > stack_max)
7985 split_quantity_new = stack_max;
7986 else
7987 split_quantity_new = quantity;
7988
7990 {
7992 {
7995 }
7996
7997 if (new_item)
7998 {
7999 new_item.SetResultOfSplit(true);
8000 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8002 new_item.
SetQuantity(split_quantity_new,
false,
true);
8003 }
8004 }
8005 }
8006 else
8007 {
8008 if (stack_max != 0)
8009 {
8011 {
8013 }
8014
8016 {
8018
8019 if (new_item)
8020 {
8021 new_item.SetResultOfSplit(true);
8022 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8025 new_item.PlaceOnSurface();
8026 }
8027 }
8028 }
8029 }
8030 }
8031
8033 {
8035 {
8036 if (ScriptInputUserData.CanStoreInputUserData())
8037 {
8038 ScriptInputUserData ctx = new ScriptInputUserData;
8043 dst.WriteToContext(ctx);
8045 }
8046 }
8047 else if (!
GetGame().IsMultiplayer())
8048 {
8050 }
8051 }
8052
8054 {
8056 {
8057 if (ScriptInputUserData.CanStoreInputUserData())
8058 {
8059 ScriptInputUserData ctx = new ScriptInputUserData;
8064 ctx.
Write(destination_entity);
8070 }
8071 }
8072 else if (!
GetGame().IsMultiplayer())
8073 {
8075 }
8076 }
8077
8079 {
8081 }
8082
8084 {
8086 float split_quantity_new;
8088 if (dst.IsValid())
8089 {
8090 int slot_id = dst.GetSlot();
8092
8093 if (quantity > stack_max)
8094 split_quantity_new = stack_max;
8095 else
8096 split_quantity_new = quantity;
8097
8099 {
8101
8102 if (new_item)
8103 {
8104 new_item.SetResultOfSplit(true);
8105 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8107 new_item.
SetQuantity(split_quantity_new,
false,
true);
8108 }
8109
8110 return new_item;
8111 }
8112 }
8113
8114 return null;
8115 }
8116
8118 {
8120 float split_quantity_new;
8122 if (destination_entity)
8123 {
8125 if (quantity > stackable)
8126 split_quantity_new = stackable;
8127 else
8128 split_quantity_new = quantity;
8129
8131 {
8132 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
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 }
8143
8145 {
8147 {
8148 if (ScriptInputUserData.CanStoreInputUserData())
8149 {
8150 ScriptInputUserData ctx = new ScriptInputUserData;
8155 ItemBase destination_entity =
this;
8156 ctx.
Write(destination_entity);
8160 }
8161 }
8162 else if (!
GetGame().IsMultiplayer())
8163 {
8165 }
8166 }
8167
8169 {
8171 float split_quantity_new;
8173 if (player)
8174 {
8176 if (quantity > stackable)
8177 split_quantity_new = stackable;
8178 else
8179 split_quantity_new = quantity;
8180
8182 {
8183 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8184 new_item =
ItemBase.Cast(in_hands);
8185 if (new_item)
8186 {
8187 new_item.SetResultOfSplit(true);
8188 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8190 new_item.SetQuantity(split_quantity_new, false, true);
8191 }
8192 }
8193 }
8194 }
8195
8197 {
8199 float split_quantity_new = Math.Floor(quantity * 0.5);
8200
8202 return;
8203
8205
8206 if (new_item)
8207 {
8208 if (new_item.GetQuantityMax() < split_quantity_new)
8209 {
8210 split_quantity_new = new_item.GetQuantityMax();
8211 }
8212
8213 new_item.SetResultOfSplit(true);
8214 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8215
8217 {
8220 }
8221 else
8222 {
8224 new_item.
SetQuantity(split_quantity_new,
false,
true);
8225 }
8226 }
8227 }
8228
8230 {
8232 float split_quantity_new = Math.Floor(quantity / 2);
8233
8235 return;
8236
8237 InventoryLocation invloc = new InventoryLocation;
8239
8241 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8242
8243 if (new_item)
8244 {
8245 if (new_item.GetQuantityMax() < split_quantity_new)
8246 {
8247 split_quantity_new = new_item.GetQuantityMax();
8248 }
8250 {
8253 }
8254 else if (split_quantity_new > 1)
8255 {
8257 new_item.
SetQuantity(split_quantity_new,
false,
true);
8258 }
8259 }
8260 }
8261
8264 {
8265 SetWeightDirty();
8267
8268 if (parent)
8269 parent.OnAttachmentQuantityChangedEx(this, delta);
8270
8272 {
8274 {
8276 }
8278 {
8279 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8281 }
8282 }
8283
8284 }
8285
8288 {
8289
8290 }
8291
8294 {
8296 }
8297
8299 {
8300 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8301
8303 {
8304 if (newLevel == GameConstants.STATE_RUINED)
8305 {
8307 EntityAI parent = GetHierarchyParent();
8308 if (parent && parent.IsFireplace())
8309 {
8310 CargoBase cargo = GetInventory().GetCargo();
8311 if (cargo)
8312 {
8314 {
8316 }
8317 }
8318 }
8319 }
8320
8322 {
8323
8325 return;
8326 }
8327
8328 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8329 {
8331 }
8332 }
8333 }
8334
8335
8337 {
8338 super.OnRightClick();
8339
8341 {
8343 {
8344 if (ScriptInputUserData.CanStoreInputUserData())
8345 {
8346 EntityAI root = GetHierarchyRoot();
8347 Man playerOwner = GetHierarchyRootPlayer();
8348 InventoryLocation dst = new InventoryLocation;
8349
8350
8351 if (!playerOwner && root && root == this)
8352 {
8354 }
8355 else
8356 {
8357
8358 GetInventory().GetCurrentInventoryLocation(dst);
8360 {
8363 {
8365 }
8366 else
8367 {
8369
8370
8371 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8372 {
8374 }
8375 else
8376 {
8377 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8378 }
8379 }
8380 }
8381 }
8382
8383 ScriptInputUserData ctx = new ScriptInputUserData;
8391 }
8392 }
8393 else if (!
GetGame().IsMultiplayer())
8394 {
8396 }
8397 }
8398 }
8399
8401 {
8402 if (root)
8403 {
8404 vector m4[4];
8405 root.GetTransform(m4);
8406 dst.SetGround(this, m4);
8407 }
8408 else
8409 {
8410 GetInventory().GetCurrentInventoryLocation(dst);
8411 }
8412 }
8413
8414 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8415 {
8416
8417 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8418 return false;
8419
8420 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8421 return false;
8422
8423
8425 return false;
8426
8427
8428 Magazine mag = Magazine.Cast(this);
8429 if (mag)
8430 {
8431 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8432 return false;
8433
8434 if (stack_max_limit)
8435 {
8436 Magazine other_mag = Magazine.Cast(other_item);
8437 if (other_item)
8438 {
8439 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8440 return false;
8441 }
8442
8443 }
8444 }
8445 else
8446 {
8447
8449 return false;
8450
8452 return false;
8453 }
8454
8455 PlayerBase player = null;
8456 if (CastTo(player, GetHierarchyRootPlayer()))
8457 {
8458 if (player.GetInventory().HasAttachment(this))
8459 return false;
8460
8461 if (player.IsItemsToDelete())
8462 return false;
8463 }
8464
8465 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8466 return false;
8467
8468 int slotID;
8470 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8471 return false;
8472
8473 return true;
8474 }
8475
8477 {
8479 }
8480
8482 {
8483 return m_IsResultOfSplit;
8484 }
8485
8487 {
8488 m_IsResultOfSplit = value;
8489 }
8490
8492 {
8494 }
8495
8497 {
8498 float other_item_quantity = other_item.GetQuantity();
8499 float this_free_space;
8500
8502
8504
8505 if (other_item_quantity > this_free_space)
8506 {
8507 return this_free_space;
8508 }
8509 else
8510 {
8511 return other_item_quantity;
8512 }
8513 }
8514
8516 {
8518 }
8519
8521 {
8523 return;
8524
8525 if (!IsMagazine() && other_item)
8526 {
8528 if (quantity_used != 0)
8529 {
8530 float hp1 = GetHealth01("","");
8531 float hp2 = other_item.GetHealth01("","");
8532 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8533 hpResult = hpResult / (
GetQuantity() + quantity_used);
8534
8535 hpResult *= GetMaxHealth();
8536 Math.Round(hpResult);
8537 SetHealth("", "Health", hpResult);
8538
8540 other_item.AddQuantity(-quantity_used);
8541 }
8542 }
8544 }
8545
8547 {
8548 #ifdef SERVER
8549 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8550 GetHierarchyParent().IncreaseLifetimeUp();
8551 #endif
8552 };
8553
8555 {
8556 PlayerBase p = PlayerBase.Cast(player);
8557
8558 array<int> recipesIds = p.m_Recipes;
8559 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8560 if (moduleRecipesManager)
8561 {
8562 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8563 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8564 }
8565
8566 for (int i = 0;i < recipesIds.Count(); i++)
8567 {
8568 int key = recipesIds.Get(i);
8569 string recipeName = moduleRecipesManager.GetRecipeName(key);
8571 }
8572 }
8573
8574
8575 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8576 {
8577 super.GetDebugActions(outputList);
8578
8579
8585
8586
8591
8596
8597
8601
8602
8604 {
8608 }
8609
8612
8613
8617
8619
8620 InventoryLocation loc = new InventoryLocation();
8621 GetInventory().GetCurrentInventoryLocation(loc);
8623 {
8624 if (Gizmo_IsSupported())
8627 }
8628
8630 }
8631
8632
8633
8634
8636 {
8637 super.OnAction(action_id, player, ctx);
8638
8640 {
8641 switch (action_id)
8642 {
8645 return true;
8648 return true;
8649 }
8650 }
8651
8653 {
8654 switch (action_id)
8655 {
8657 Delete();
8658 return true;
8659 }
8660 }
8661
8662 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8663 {
8664 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8665 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8666 PlayerBase p = PlayerBase.Cast(player);
8667 if (
EActions.RECIPES_RANGE_START < 1000)
8668 {
8669 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8670 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8671 }
8672 }
8673 #ifndef SERVER
8674 else if (action_id ==
EActions.WATCH_PLAYER)
8675 {
8676 PluginDeveloper.SetDeveloperItemClientEx(player);
8677 }
8678 #endif
8680 {
8681 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8682 {
8683 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8684 OnDebugButtonPressServer(id + 1);
8685 }
8686
8687 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8688 {
8689 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8691 }
8692
8693 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8694 {
8695 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8697 }
8698
8699 else if (action_id ==
EActions.ADD_QUANTITY)
8700 {
8701 if (IsMagazine())
8702 {
8703 Magazine mag = Magazine.Cast(this);
8704 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8705 }
8706 else
8707 {
8709 }
8710
8711 if (m_EM)
8712 {
8713 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8714 }
8715
8716 }
8717
8718 else if (action_id ==
EActions.REMOVE_QUANTITY)
8719 {
8720 if (IsMagazine())
8721 {
8722 Magazine mag2 = Magazine.Cast(this);
8723 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8724 }
8725 else
8726 {
8728 }
8729 if (m_EM)
8730 {
8731 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8732 }
8733
8734 }
8735
8736 else if (action_id ==
EActions.SET_QUANTITY_0)
8737 {
8739
8740 if (m_EM)
8741 {
8742 m_EM.SetEnergy(0);
8743 }
8744 }
8745
8746 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8747 {
8749
8750 if (m_EM)
8751 {
8752 m_EM.SetEnergy(m_EM.GetEnergyMax());
8753 }
8754 }
8755
8756 else if (action_id ==
EActions.ADD_HEALTH)
8757 {
8758 AddHealth("","",GetMaxHealth("","Health")/5);
8759 }
8760 else if (action_id ==
EActions.REMOVE_HEALTH)
8761 {
8762 AddHealth("","",-GetMaxHealth("","Health")/5);
8763 }
8764 else if (action_id ==
EActions.DESTROY_HEALTH)
8765 {
8766 SetHealth01("","",0);
8767 }
8768 else if (action_id ==
EActions.WATCH_ITEM)
8769 {
8771 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8772 #ifdef DEVELOPER
8773 SetDebugDeveloper_item(this);
8774 #endif
8775 }
8776
8777 else if (action_id ==
EActions.ADD_TEMPERATURE)
8778 {
8779 AddTemperature(20);
8780
8781 }
8782
8783 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8784 {
8785 AddTemperature(-20);
8786
8787 }
8788
8789 else if (action_id ==
EActions.FLIP_FROZEN)
8790 {
8791 SetFrozen(!GetIsFrozen());
8792
8793 }
8794
8795 else if (action_id ==
EActions.ADD_WETNESS)
8796 {
8798
8799 }
8800
8801 else if (action_id ==
EActions.REMOVE_WETNESS)
8802 {
8804
8805 }
8806
8807 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8808 {
8811
8812
8813 }
8814
8815 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8816 {
8819 }
8820
8821 else if (action_id ==
EActions.MAKE_SPECIAL)
8822 {
8823 auto debugParams = DebugSpawnParams.WithPlayer(player);
8824 OnDebugSpawnEx(debugParams);
8825 }
8826
8827 }
8828
8829
8830 return false;
8831 }
8832
8833
8834
8835
8839
8842
8843
8844
8846 {
8847 return false;
8848 }
8849
8850
8852 {
8853 return true;
8854 }
8855
8856
8858 {
8859 return true;
8860 }
8861
8862
8863
8865 {
8866 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8868 }
8869
8872 {
8873 return null;
8874 }
8875
8877 {
8878 return false;
8879 }
8880
8882 {
8883 return false;
8884 }
8885
8889
8890
8892 {
8893 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8894 return module_repairing.CanRepair(this, item_repair_kit);
8895 }
8896
8897
8898 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8899 {
8900 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8901 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8902 }
8903
8904
8906 {
8907
8908
8909
8910
8911
8912
8913
8914
8915 return 1;
8916 }
8917
8918
8919
8921 {
8923 }
8924
8925
8926
8928 {
8930 }
8931
8932
8941 {
8942 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8943
8944 if (player)
8945 {
8946 player.MessageStatus(text);
8947 }
8948 }
8949
8950
8959 {
8960 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8961
8962 if (player)
8963 {
8964 player.MessageAction(text);
8965 }
8966 }
8967
8968
8977 {
8978 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8979
8980 if (player)
8981 {
8982 player.MessageFriendly(text);
8983 }
8984 }
8985
8986
8995 {
8996 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8997
8998 if (player)
8999 {
9000 player.MessageImportant(text);
9001 }
9002 }
9003
9005 {
9006 return true;
9007 }
9008
9009
9010 override bool KindOf(
string tag)
9011 {
9012 bool found = false;
9013 string item_name = this.
GetType();
9016
9017 int array_size = item_tag_array.Count();
9018 for (int i = 0; i < array_size; i++)
9019 {
9020 if (item_tag_array.Get(i) == tag)
9021 {
9022 found = true;
9023 break;
9024 }
9025 }
9026 return found;
9027 }
9028
9029
9031 {
9032
9033 super.OnRPC(sender, rpc_type,ctx);
9034
9035
9036 switch (rpc_type)
9037 {
9038 #ifndef SERVER
9039 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9040 Param2<bool, string> p = new Param2<bool, string>(false, "");
9041
9043 return;
9044
9045 bool play = p.param1;
9046 string soundSet = p.param2;
9047
9048 if (play)
9049 {
9051 {
9053 {
9055 }
9056 }
9057 else
9058 {
9060 }
9061 }
9062 else
9063 {
9065 }
9066
9067 break;
9068 #endif
9069
9070 }
9071
9073 {
9075 }
9076 }
9077
9078
9079
9080
9082 {
9083 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9084 return plugin.GetID(
name);
9085 }
9086
9088 {
9089 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9090 return plugin.GetName(id);
9091 }
9092
9095 {
9096
9097
9098 int varFlags;
9099 if (!ctx.
Read(varFlags))
9100 return;
9101
9102 if (varFlags & ItemVariableFlags.FLOAT)
9103 {
9105 }
9106 }
9107
9109 {
9110
9111 super.SerializeNumericalVars(floats_out);
9112
9113
9114
9116 {
9118 }
9119
9121 {
9123 }
9124
9126 {
9128 }
9129
9131 {
9136 }
9137
9139 {
9141 }
9142 }
9143
9145 {
9146
9147 super.DeSerializeNumericalVars(floats);
9148
9149
9150 int index = 0;
9151 int mask = Math.Round(floats.Get(index));
9152
9153 index++;
9154
9156 {
9158 {
9160 }
9161 else
9162 {
9163 float quantity = floats.Get(index);
9165 }
9166 index++;
9167 }
9168
9170 {
9171 float wet = floats.Get(index);
9173 index++;
9174 }
9175
9177 {
9178 int liquidtype = Math.Round(floats.Get(index));
9180 index++;
9181 }
9182
9184 {
9186 index++;
9188 index++;
9190 index++;
9192 index++;
9193 }
9194
9196 {
9197 int cleanness = Math.Round(floats.Get(index));
9199 index++;
9200 }
9201 }
9202
9204 {
9205 super.WriteVarsToCTX(ctx);
9206
9207
9209 {
9211 }
9212
9214 {
9216 }
9217
9219 {
9221 }
9222
9224 {
9225 int r,g,b,a;
9231 }
9232
9234 {
9236 }
9237 }
9238
9240 {
9241 if (!super.ReadVarsFromCTX(ctx,version))
9242 return false;
9243
9244 int intValue;
9245 float value;
9246
9247 if (version < 140)
9248 {
9249 if (!ctx.
Read(intValue))
9250 return false;
9251
9252 m_VariablesMask = intValue;
9253 }
9254
9256 {
9257 if (!ctx.
Read(value))
9258 return false;
9259
9261 {
9263 }
9264 else
9265 {
9267 }
9268 }
9269
9270 if (version < 140)
9271 {
9273 {
9274 if (!ctx.
Read(value))
9275 return false;
9276 SetTemperatureDirect(value);
9277 }
9278 }
9279
9281 {
9282 if (!ctx.
Read(value))
9283 return false;
9285 }
9286
9288 {
9289 if (!ctx.
Read(intValue))
9290 return false;
9292 }
9293
9295 {
9296 int r,g,b,a;
9298 return false;
9300 return false;
9302 return false;
9304 return false;
9305
9307 }
9308
9310 {
9311 if (!ctx.
Read(intValue))
9312 return false;
9314 }
9315
9316 if (version >= 138 && version < 140)
9317 {
9319 {
9320 if (!ctx.
Read(intValue))
9321 return false;
9322 SetFrozen(intValue);
9323 }
9324 }
9325
9326 return true;
9327 }
9328
9329
9331 {
9334 {
9336 }
9337
9338 if (!super.OnStoreLoad(ctx, version))
9339 {
9341 return false;
9342 }
9343
9344 if (version >= 114)
9345 {
9346 bool hasQuickBarIndexSaved;
9347
9348 if (!ctx.
Read(hasQuickBarIndexSaved))
9349 {
9351 return false;
9352 }
9353
9354 if (hasQuickBarIndexSaved)
9355 {
9356 int itmQBIndex;
9357
9358
9359 if (!ctx.
Read(itmQBIndex))
9360 {
9362 return false;
9363 }
9364
9365 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9366 if (itmQBIndex != -1 && parentPlayer)
9367 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9368 }
9369 }
9370 else
9371 {
9372
9373 PlayerBase player;
9374 int itemQBIndex;
9375 if (version ==
int.
MAX)
9376 {
9377 if (!ctx.
Read(itemQBIndex))
9378 {
9380 return false;
9381 }
9382 }
9383 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9384 {
9385
9386 if (!ctx.
Read(itemQBIndex))
9387 {
9389 return false;
9390 }
9391 if (itemQBIndex != -1 && player)
9392 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9393 }
9394 }
9395
9396 if (version < 140)
9397 {
9398
9399 if (!LoadVariables(ctx, version))
9400 {
9402 return false;
9403 }
9404 }
9405
9406
9408 {
9410 return false;
9411 }
9412 if (version >= 132)
9413 {
9415 if (raib)
9416 {
9418 {
9420 return false;
9421 }
9422 }
9423 }
9424
9426 return true;
9427 }
9428
9429
9430
9432 {
9433 super.OnStoreSave(ctx);
9434
9435 PlayerBase player;
9436 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9437 {
9439
9440 int itemQBIndex = -1;
9441 itemQBIndex = player.FindQuickBarEntityIndex(this);
9442 ctx.
Write(itemQBIndex);
9443 }
9444 else
9445 {
9447 }
9448
9450
9452 if (raib)
9453 {
9455 }
9456 }
9457
9458
9460 {
9461 super.AfterStoreLoad();
9462
9464 {
9466 }
9467
9469 {
9472 }
9473 }
9474
9476 {
9477 super.EEOnAfterLoad();
9478
9480 {
9482 }
9483
9486 }
9487
9489 {
9490 return false;
9491 }
9492
9493
9494
9496 {
9498 {
9499 #ifdef PLATFORM_CONSOLE
9500
9502 {
9504 if (menu)
9505 {
9507 }
9508 }
9509 #endif
9510 }
9511
9513 {
9516 }
9517
9519 {
9520 SetWeightDirty();
9522 }
9524 {
9527 }
9528
9530 {
9533 }
9535 {
9538 }
9539
9540 super.OnVariablesSynchronized();
9541 }
9542
9543
9544
9546 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9547 {
9548 if (!IsServerCheck(allow_client))
9549 return false;
9550
9552 return false;
9553
9556
9557 if (value <= (min + 0.001))
9558 value = min;
9559
9560 if (value == min)
9561 {
9562 if (destroy_config)
9563 {
9564 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9565 if (dstr)
9566 {
9568 this.Delete();
9569 return true;
9570 }
9571 }
9572 else if (destroy_forced)
9573 {
9575 this.Delete();
9576 return true;
9577 }
9578
9580 }
9581
9584
9586 {
9588
9589 if (delta)
9591 }
9592
9594
9595 return false;
9596 }
9597
9598
9600 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9601 {
9603 }
9604
9606 {
9609 }
9610
9612 {
9615 }
9616
9618 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9619 {
9620 float value_clamped = Math.Clamp(value, 0, 1);
9622 SetQuantity(result, destroy_config, destroy_forced);
9623 }
9624
9625
9628 {
9630 }
9631
9633 {
9635 }
9636
9637
9638
9639
9640
9641
9642
9643
9644
9645
9647 {
9648 int slot = -1;
9649 if (GetInventory())
9650 {
9651 InventoryLocation il = new InventoryLocation;
9652 GetInventory().GetCurrentInventoryLocation(il);
9654 }
9655
9657 }
9658
9660 {
9661 float quantity_max = 0;
9662
9664 {
9665 if (attSlotID != -1)
9666 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9667
9668 if (quantity_max <= 0)
9670 }
9671
9672 if (quantity_max <= 0)
9674
9675 return quantity_max;
9676 }
9677
9679 {
9681 }
9682
9684 {
9686 }
9687
9688
9690 {
9692 }
9693
9695 {
9697 }
9698
9700 {
9702 }
9703
9704
9706 {
9707
9708 float weightEx = GetWeightEx();
9709 float special = GetInventoryAndCargoWeight();
9710 return weightEx - special;
9711 }
9712
9713
9715 {
9717 }
9718
9720 {
9722 {
9723 #ifdef DEVELOPER
9724 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9725 {
9726 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9728 }
9729 #endif
9730
9732 }
9733 else if (HasEnergyManager())
9734 {
9735 #ifdef DEVELOPER
9736 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9737 {
9738 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9739 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9740 }
9741 #endif
9742 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9743 }
9744 else
9745 {
9746 #ifdef DEVELOPER
9747 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9748 {
9749 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9750 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9751 }
9752 #endif
9753 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9754 }
9755 }
9756
9759 {
9760 int item_count = 0;
9762
9763 if (GetInventory().GetCargo() != NULL)
9764 {
9765 item_count = GetInventory().GetCargo().GetItemCount();
9766 }
9767
9768 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9769 {
9770 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9771 if (item)
9772 item_count += item.GetNumberOfItems();
9773 }
9774 return item_count;
9775 }
9776
9779 {
9780 float weight = 0;
9781 float wetness = 1;
9782 if (include_wetness)
9785 {
9786 weight = wetness * m_ConfigWeight;
9787 }
9789 {
9790 weight = 1;
9791 }
9792 return weight;
9793 }
9794
9795
9796
9798 {
9799 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9800 {
9801 GameInventory inv = GetInventory();
9802 array<EntityAI> items = new array<EntityAI>;
9804 for (int i = 0; i < items.Count(); i++)
9805 {
9807 if (item)
9808 {
9810 }
9811 }
9812 }
9813 }
9814
9815
9816
9817
9819 {
9820 float energy = 0;
9821 if (HasEnergyManager())
9822 {
9823 energy = GetCompEM().GetEnergy();
9824 }
9825 return energy;
9826 }
9827
9828
9830 {
9831 super.OnEnergyConsumed();
9832
9834 }
9835
9837 {
9838 super.OnEnergyAdded();
9839
9841 }
9842
9843
9845 {
9846 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9847 {
9849 {
9850 float energy_0to1 = GetCompEM().GetEnergy0To1();
9852 }
9853 }
9854 }
9855
9856
9858 {
9859 return ConfigGetFloat("heatIsolation");
9860 }
9861
9863 {
9865 }
9866
9868 {
9869 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9870 if (
GetGame().ConfigIsExisting(paramPath))
9872
9873 return 0.0;
9874 }
9875
9877 {
9878 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9879 if (
GetGame().ConfigIsExisting(paramPath))
9881
9882 return 0.0;
9883 }
9884
9885 override void SetWet(
float value,
bool allow_client =
false)
9886 {
9887 if (!IsServerCheck(allow_client))
9888 return;
9889
9892
9894
9895 m_VarWet = Math.Clamp(value, min, max);
9896
9898 {
9901 }
9902 }
9903
9904 override void AddWet(
float value)
9905 {
9907 }
9908
9910 {
9912 }
9913
9915 {
9917 }
9918
9920 {
9922 }
9923
9925 {
9927 }
9928
9930 {
9932 }
9933
9935 {
9938 if (newLevel != oldLevel)
9939 {
9941 }
9942 }
9943
9945 {
9946 SetWeightDirty();
9947 }
9948
9950 {
9951 return GetWetLevelInternal(
m_VarWet);
9952 }
9953
9954
9955
9957 {
9959 }
9960
9962 {
9964 }
9965
9967 {
9969 }
9970
9972 {
9974 }
9975
9976
9977
9979 {
9980 if (ConfigIsExisting("itemModelLength"))
9981 {
9982 return ConfigGetFloat("itemModelLength");
9983 }
9984 return 0;
9985 }
9986
9988 {
9989 if (ConfigIsExisting("itemAttachOffset"))
9990 {
9991 return ConfigGetFloat("itemAttachOffset");
9992 }
9993 return 0;
9994 }
9995
9996 override void SetCleanness(
int value,
bool allow_client =
false)
9997 {
9998 if (!IsServerCheck(allow_client))
9999 return;
10000
10002
10004
10007 }
10008
10010 {
10012 }
10013
10015 {
10016 return true;
10017 }
10018
10019
10020
10021
10023 {
10025 }
10026
10028 {
10030 }
10031
10032
10033
10034
10035 override void SetColor(
int r,
int g,
int b,
int a)
10036 {
10042 }
10044 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10045 {
10050 }
10051
10053 {
10055 }
10056
10059 {
10060 int r,g,b,a;
10062 r = r/255;
10063 g = g/255;
10064 b = b/255;
10065 a = a/255;
10066 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10067 }
10068
10069
10070
10071 override void SetLiquidType(
int value,
bool allow_client =
false)
10072 {
10073 if (!IsServerCheck(allow_client))
10074 return;
10075
10080 }
10081
10083 {
10084 return ConfigGetInt("varLiquidTypeInit");
10085 }
10086
10088 {
10090 }
10091
10093 {
10095 SetFrozen(false);
10096 }
10097
10100 {
10101 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10102 }
10103
10104
10107 {
10108 PlayerBase nplayer;
10109 if (PlayerBase.CastTo(nplayer, player))
10110 {
10112
10113 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10114 }
10115 }
10116
10117
10120 {
10121 PlayerBase nplayer;
10122 if (PlayerBase.CastTo(nplayer,player))
10123 {
10124
10125 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10126
10127 }
10128
10129
10130 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10131
10132
10133 if (HasEnergyManager())
10134 {
10135 GetCompEM().UpdatePlugState();
10136 }
10137 }
10138
10139
10141 {
10142 super.OnPlacementStarted(player);
10143
10145 }
10146
10147 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10148 {
10150 {
10151 m_AdminLog.OnPlacementComplete(player,
this);
10152 }
10153
10154 super.OnPlacementComplete(player, position, orientation);
10155 }
10156
10157
10158
10159
10160
10162 {
10164 {
10165 return true;
10166 }
10167 else
10168 {
10169 return false;
10170 }
10171 }
10172
10173
10175 {
10177 {
10179 }
10180 }
10181
10182
10184 {
10186 }
10187
10189 {
10191 }
10192
10193 override void InsertAgent(
int agent,
float count = 1)
10194 {
10195 if (count < 1)
10196 return;
10197
10199 }
10200
10203 {
10205 }
10206
10207
10209 {
10211 }
10212
10213
10214
10215
10216
10217
10218
10219
10220
10221
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10255 {
10257 return false;
10258 return true;
10259 }
10260
10262 {
10263
10265 }
10266
10267
10270 {
10271 super.CheckForRoofLimited(timeTresholdMS);
10272
10274 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10275 {
10276 m_PreviousRoofTestTime = time;
10277 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10278 }
10279 }
10280
10281
10283 {
10285 {
10286 return 0;
10287 }
10288
10289 if (GetInventory().GetAttachmentSlotsCount() != 0)
10290 {
10291 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10292 if (filter)
10293 return filter.GetProtectionLevel(type, false, system);
10294 else
10295 return 0;
10296 }
10297
10298 string subclassPath, entryName;
10299
10300 switch (type)
10301 {
10303 entryName = "biological";
10304 break;
10306 entryName = "chemical";
10307 break;
10308 default:
10309 entryName = "biological";
10310 break;
10311 }
10312
10313 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10314
10316 }
10317
10318
10319
10322 {
10323 if (!IsMagazine())
10325
10327 }
10328
10329
10330
10331
10332
10337 {
10338 return true;
10339 }
10340
10342 {
10344 }
10345
10346
10347
10348
10349
10351 {
10352 if (parent)
10353 {
10354 if (parent.IsInherited(DayZInfected))
10355 return true;
10356
10357 if (!parent.IsRuined())
10358 return true;
10359 }
10360
10361 return true;
10362 }
10363
10365 {
10366 if (!super.CanPutAsAttachment(parent))
10367 {
10368 return false;
10369 }
10370
10371 if (!IsRuined() && !parent.IsRuined())
10372 {
10373 return true;
10374 }
10375
10376 return false;
10377 }
10378
10380 {
10381
10382
10383
10384
10385 return super.CanReceiveItemIntoCargo(item);
10386 }
10387
10389 {
10390
10391
10392
10393
10394 GameInventory attachmentInv = attachment.GetInventory();
10396 {
10397 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10398 return false;
10399 }
10400
10401 InventoryLocation loc = new InventoryLocation();
10402 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10403 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10404 return false;
10405
10406 return super.CanReceiveAttachment(attachment, slotId);
10407 }
10408
10410 {
10411 if (!super.CanReleaseAttachment(attachment))
10412 return false;
10413
10414 return GetInventory().AreChildrenAccessible();
10415 }
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10434
10435
10436
10438 {
10439 int id = muzzle_owner.GetMuzzleID();
10440 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10441
10442 if (WPOF_array)
10443 {
10444 for (int i = 0; i < WPOF_array.Count(); i++)
10445 {
10446 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10447
10448 if (WPOF)
10449 {
10450 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10451 }
10452 }
10453 }
10454 }
10455
10456
10458 {
10459 int id = muzzle_owner.GetMuzzleID();
10461
10462 if (WPOBE_array)
10463 {
10464 for (int i = 0; i < WPOBE_array.Count(); i++)
10465 {
10466 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10467
10468 if (WPOBE)
10469 {
10470 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10471 }
10472 }
10473 }
10474 }
10475
10476
10478 {
10479 int id = muzzle_owner.GetMuzzleID();
10480 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10481
10482 if (WPOOH_array)
10483 {
10484 for (int i = 0; i < WPOOH_array.Count(); i++)
10485 {
10486 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10487
10488 if (WPOOH)
10489 {
10490 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10491 }
10492 }
10493 }
10494 }
10495
10496
10498 {
10499 int id = muzzle_owner.GetMuzzleID();
10500 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10501
10502 if (WPOOH_array)
10503 {
10504 for (int i = 0; i < WPOOH_array.Count(); i++)
10505 {
10506 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10507
10508 if (WPOOH)
10509 {
10510 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10511 }
10512 }
10513 }
10514 }
10515
10516
10518 {
10519 int id = muzzle_owner.GetMuzzleID();
10520 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10521
10522 if (WPOOH_array)
10523 {
10524 for (int i = 0; i < WPOOH_array.Count(); i++)
10525 {
10526 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10527
10528 if (WPOOH)
10529 {
10530 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10531 }
10532 }
10533 }
10534 }
10535
10536
10537
10539 {
10541 {
10542 return true;
10543 }
10544
10545 return false;
10546 }
10547
10549 {
10551 {
10552 return true;
10553 }
10554
10555 return false;
10556 }
10557
10559 {
10561 {
10562 return true;
10563 }
10564
10565 return false;
10566 }
10567
10569 {
10570 return false;
10571 }
10572
10575 {
10576 return UATimeSpent.DEFAULT_DEPLOY;
10577 }
10578
10579
10580
10581
10583 {
10585 SetSynchDirty();
10586 }
10587
10589 {
10591 }
10592
10593
10595 {
10596 return false;
10597 }
10598
10601 {
10602 string att_type = "None";
10603
10604 if (ConfigIsExisting("soundAttType"))
10605 {
10606 att_type = ConfigGetString("soundAttType");
10607 }
10608
10610 }
10611
10613 {
10615 }
10616
10617
10618
10619
10620
10626
10628 {
10631
10633 }
10634
10635
10637 {
10639 return;
10640
10642
10645
10648
10649 SoundParameters params = new SoundParameters();
10653 }
10654
10655
10657 {
10659 return;
10660
10662 SetSynchDirty();
10663
10666 }
10667
10668
10670 {
10672 return;
10673
10675 SetSynchDirty();
10676
10679 }
10680
10682 {
10684 }
10685
10687 {
10689 }
10690
10693 {
10694 if (!
GetGame().IsDedicatedServer())
10695 {
10696 if (ConfigIsExisting("attachSoundSet"))
10697 {
10698 string cfg_path = "";
10699 string soundset = "";
10700 string type_name =
GetType();
10701
10704 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10705 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10706
10707 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10708 {
10709 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10710 {
10711 if (cfg_slot_array[i] == slot_type)
10712 {
10713 soundset = cfg_soundset_array[i];
10714 break;
10715 }
10716 }
10717 }
10718
10719 if (soundset != "")
10720 {
10721 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10723 }
10724 }
10725 }
10726 }
10727
10729 {
10730
10731 }
10732
10733 void OnApply(PlayerBase player);
10734
10736 {
10737 return 1.0;
10738 };
10739
10741 {
10743 }
10744
10746 {
10748 }
10749
10751
10753 {
10754 SetDynamicPhysicsLifeTime(0.01);
10756 }
10757
10759 {
10760 array<string> zone_names = new array<string>;
10761 GetDamageZones(zone_names);
10762 for (int i = 0; i < zone_names.Count(); i++)
10763 {
10764 SetHealthMax(zone_names.Get(i),"Health");
10765 }
10766 SetHealthMax("","Health");
10767 }
10768
10771 {
10772 float global_health = GetHealth01("","Health");
10773 array<string> zones = new array<string>;
10774 GetDamageZones(zones);
10775
10776 for (int i = 0; i < zones.Count(); i++)
10777 {
10778 SetHealth01(zones.Get(i),"Health",global_health);
10779 }
10780 }
10781
10784 {
10785 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10786 }
10787
10789 {
10790 if (!hasRootAsPlayer)
10791 {
10792 if (refParentIB)
10793 {
10794
10795 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10796 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10797
10798 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10799 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10800
10803 }
10804 else
10805 {
10806
10809 }
10810 }
10811 }
10812
10814 {
10816 {
10817 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10818 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10819 {
10820 float heatPermCoef = 1.0;
10822 while (ent)
10823 {
10824 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10825 ent = ent.GetHierarchyParent();
10826 }
10827
10828 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10829 }
10830 }
10831 }
10832
10834 {
10835
10836 EntityAI parent = GetHierarchyParent();
10837 if (!parent)
10838 {
10839 hasParent = false;
10840 hasRootAsPlayer = false;
10841 }
10842 else
10843 {
10844 hasParent = true;
10845 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10846 refParentIB =
ItemBase.Cast(parent);
10847 }
10848 }
10849
10850 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10851 {
10852
10853 }
10854
10856 {
10857
10858 return false;
10859 }
10860
10862 {
10863
10864
10865 return false;
10866 }
10867
10869 {
10870
10871 return false;
10872 }
10873
10876 {
10877 return !GetIsFrozen() &&
IsOpen();
10878 }
10879
10881 {
10882 bool hasParent = false, hasRootAsPlayer = false;
10884
10885 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10886 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10887
10888 if (wwtu || foodDecay)
10889 {
10893
10894 if (processWetness || processTemperature || processDecay)
10895 {
10897
10898 if (processWetness)
10899 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10900
10901 if (processTemperature)
10903
10904 if (processDecay)
10905 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10906 }
10907 }
10908 }
10909
10912 {
10914 }
10915
10917 {
10920
10921 return super.GetTemperatureFreezeThreshold();
10922 }
10923
10925 {
10928
10929 return super.GetTemperatureThawThreshold();
10930 }
10931
10933 {
10936
10937 return super.GetItemOverheatThreshold();
10938 }
10939
10941 {
10943 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10944
10945 return super.GetTemperatureFreezeTime();
10946 }
10947
10949 {
10951 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10952
10953 return super.GetTemperatureThawTime();
10954 }
10955
10960
10962 {
10963 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10964 }
10965
10967 {
10968 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10969 }
10970
10973 {
10975 }
10976
10978 {
10980 }
10981
10983 {
10985 }
10986
10989 {
10990 return null;
10991 }
10992
10995 {
10996 return false;
10997 }
10998
11000 {
11002 {
11005 if (!trg)
11006 {
11008 explosive = this;
11009 }
11010
11011 explosive.PairRemote(trg);
11013
11014 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11015 trg.SetPersistentPairID(persistentID);
11016 explosive.SetPersistentPairID(persistentID);
11017
11018 return true;
11019 }
11020 return false;
11021 }
11022
11025 {
11026 float ret = 1.0;
11029 ret *= GetHealth01();
11030
11031 return ret;
11032 }
11033
11034 #ifdef DEVELOPER
11035 override void SetDebugItem()
11036 {
11037 super.SetDebugItem();
11038 _itemBase = this;
11039 }
11040
11042 {
11043 string text = super.GetDebugText();
11044
11046 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11047
11048 return text;
11049 }
11050 #endif
11051
11053 {
11054 return true;
11055 }
11056
11058
11060
11062 {
11065 }
11066
11067
11075
11091}
11092
11094{
11096 if (entity)
11097 {
11098 bool is_item = entity.IsInherited(
ItemBase);
11099 if (is_item && full_quantity)
11100 {
11103 }
11104 }
11105 else
11106 {
11108 return NULL;
11109 }
11110 return entity;
11111}
11112
11114{
11115 if (item)
11116 {
11117 if (health > 0)
11118 item.SetHealth("", "", health);
11119
11120 if (item.CanHaveTemperature())
11121 {
11123 if (item.CanFreeze())
11124 item.SetFrozen(false);
11125 }
11126
11127 if (item.HasEnergyManager())
11128 {
11129 if (quantity >= 0)
11130 {
11131 item.GetCompEM().SetEnergy0To1(quantity);
11132 }
11133 else
11134 {
11136 }
11137 }
11138 else if (item.IsMagazine())
11139 {
11140 Magazine mag = Magazine.Cast(item);
11141 if (quantity >= 0)
11142 {
11143 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11144 }
11145 else
11146 {
11148 }
11149
11150 }
11151 else
11152 {
11153 if (quantity >= 0)
11154 {
11155 item.SetQuantityNormalized(quantity, false);
11156 }
11157 else
11158 {
11160 }
11161
11162 }
11163 }
11164}
11165
11166#ifdef DEVELOPER
11168#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.