6235{
6237 {
6238 return true;
6239 }
6240};
6241
6242
6243
6245{
6249
6251
6254
6255
6256
6257
6258
6267
6273
6278
6283
6304 protected bool m_IsResultOfSplit
6305
6307
6312
6313
6314
6316
6320
6321
6322
6324
6327
6328
6329
6335
6336
6344
6347
6348
6350
6351
6353
6354
6359
6360
6365
6366
6368
6369
6371 {
6376
6377 if (!
GetGame().IsDedicatedServer())
6378 {
6380 {
6382
6384 {
6386 }
6387 }
6388
6391 }
6392
6393 m_OldLocation = null;
6394
6396 {
6398 }
6399
6400 if (ConfigIsExisting("headSelectionsToHide"))
6401 {
6404 }
6405
6407 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6408 {
6410 }
6411
6413
6414 m_IsResultOfSplit = false;
6415
6417 }
6418
6420 {
6421 super.InitItemVariables();
6422
6428 m_Count = ConfigGetInt(
"count");
6429
6432
6437
6440
6445
6457
6461
6462
6465 if (ConfigIsExisting("canBeSplit"))
6466 {
6469 }
6470
6472 if (ConfigIsExisting("itemBehaviour"))
6474
6475
6478 RegisterNetSyncVariableInt("m_VarLiquidType");
6479 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6480
6481 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6482 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6483 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6484
6485 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6486 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6487 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6488 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6489
6490 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6491 RegisterNetSyncVariableBool("m_IsTakeable");
6492 RegisterNetSyncVariableBool("m_IsHologram");
6493
6496 {
6499 }
6500
6502
6504 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6506
6507 }
6508
6510 {
6512 }
6513
6515 {
6518 {
6523 }
6524 }
6525
6526 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6527 {
6529 {
6532 }
6533
6535 }
6536
6538 {
6544 }
6545
6547
6549 {
6551
6552 if (!action)
6553 {
6554 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6555 return;
6556 }
6557
6559 if (!ai)
6560 {
6562 return;
6563 }
6564
6566 if (!action_array)
6567 {
6568 action_array = new array<ActionBase_Basic>;
6570 }
6571 if (LogManager.IsActionLogEnable())
6572 {
6573 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6574 }
6575
6576 if (action_array.Find(action) != -1)
6577 {
6578 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6579 }
6580 else
6581 {
6582 action_array.Insert(action);
6583 }
6584 }
6585
6587 {
6589 ActionBase action = player.GetActionManager().GetAction(actionName);
6592
6593 if (action_array)
6594 {
6595 action_array.RemoveItem(action);
6596 }
6597 }
6598
6599
6600
6602 {
6603 ActionOverrideData overrideData = new ActionOverrideData();
6607
6609 if (!actionMap)
6610 {
6613 }
6614
6615 actionMap.Insert(this.
Type(), overrideData);
6616
6617 }
6618
6620
6622
6623
6625 {
6628
6631
6632 string config_to_search = "CfgVehicles";
6633 string muzzle_owner_config;
6634
6636 {
6637 if (IsInherited(Weapon))
6638 config_to_search = "CfgWeapons";
6639
6640 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6641
6642 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6643
6645
6646 if (config_OnFire_subclass_count > 0)
6647 {
6648 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6649
6650 for (int i = 0; i < config_OnFire_subclass_count; i++)
6651 {
6652 string particle_class = "";
6654 string config_OnFire_entry = config_OnFire_class + particle_class;
6655 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6656 WPOF_array.Insert(WPOF);
6657 }
6658
6659
6661 }
6662 }
6663
6665 {
6666 config_to_search = "CfgWeapons";
6667 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6668
6669 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6670
6672
6673 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6674 {
6675 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6676
6677 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6678 {
6679 string particle_class2 = "";
6681 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6682 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6683 WPOBE_array.Insert(WPOBE);
6684 }
6685
6686
6688 }
6689 }
6690 }
6691
6692
6694 {
6697
6699 {
6700 string config_to_search = "CfgVehicles";
6701
6702 if (IsInherited(Weapon))
6703 config_to_search = "CfgWeapons";
6704
6705 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6706 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6707
6708 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6709 {
6710
6712
6714 {
6716 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6718 return;
6719 }
6720
6723
6724
6725
6727 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6728
6729 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6730 {
6731 string particle_class = "";
6733 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6735
6736 if (entry_type == CT_CLASS)
6737 {
6738 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6739 WPOOH_array.Insert(WPOF);
6740 }
6741 }
6742
6743
6745 }
6746 }
6747 }
6748
6750 {
6752 }
6753
6755 {
6757 {
6759
6762
6765
6766 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6767 }
6768 }
6769
6771 {
6773 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6774
6776 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6777
6779 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6780
6782 {
6784 }
6785 }
6786
6788 {
6790 }
6791
6793 {
6796 else
6798
6800 {
6803 }
6804 else
6805 {
6808
6811 }
6812
6814 }
6815
6817 {
6819 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6820 }
6821
6823 {
6825 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6827 }
6828
6830 {
6832 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6833 }
6834
6836 {
6839
6840 OverheatingParticle OP = new OverheatingParticle();
6845
6847 }
6848
6850 {
6853
6854 return -1;
6855 }
6856
6858 {
6860 {
6863
6864 for (int i = count; i > 0; --i)
6865 {
6866 int id = i - 1;
6869
6872
6873 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6874 {
6875 if (p)
6876 {
6879 }
6880 }
6881 }
6882 }
6883 }
6884
6886 {
6888 {
6890 {
6891 int id = i - 1;
6893
6894 if (OP)
6895 {
6897
6898 if (p)
6899 {
6901 }
6902
6903 delete OP;
6904 }
6905 }
6906
6909 }
6910 }
6911
6914 {
6915 return 0.0;
6916 }
6917
6918
6920 {
6921 return 250;
6922 }
6923
6925 {
6926 return 0;
6927 }
6928
6931 {
6933 return true;
6934
6935 return false;
6936 }
6937
6940 {
6943
6945 {
6947 }
6948 else
6949 {
6950
6952 }
6953
6955 }
6956
6963 {
6964 return -1;
6965 }
6966
6967
6968
6969
6971 {
6973 {
6975 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6976
6977 if (r_index >= 0)
6978 {
6979 InventoryLocation r_il = new InventoryLocation;
6980 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6981
6982 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6985 {
6986 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6987 }
6989 {
6990 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6991 }
6992
6993 }
6994
6995 player.GetHumanInventory().ClearUserReservedLocation(this);
6996 }
6997
7000 }
7001
7002
7003
7004
7006 {
7007 return ItemBase.m_DebugActionsMask;
7008 }
7009
7011 {
7012 return ItemBase.m_DebugActionsMask & mask;
7013 }
7014
7016 {
7017 ItemBase.m_DebugActionsMask = mask;
7018 }
7019
7021 {
7022 ItemBase.m_DebugActionsMask |= mask;
7023 }
7024
7026 {
7027 ItemBase.m_DebugActionsMask &= ~mask;
7028 }
7029
7031 {
7033 {
7035 }
7036 else
7037 {
7039 }
7040 }
7041
7042
7044 {
7045 if (GetEconomyProfile())
7046 {
7047 float q_max = GetEconomyProfile().GetQuantityMax();
7048 if (q_max > 0)
7049 {
7050 float q_min = GetEconomyProfile().GetQuantityMin();
7051 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7052
7054 {
7055 ComponentEnergyManager comp = GetCompEM();
7057 {
7059 }
7060 }
7062 {
7064
7065 }
7066
7067 }
7068 }
7069 }
7070
7073 {
7074 EntityAI parent = GetHierarchyParent();
7075
7076 if (parent)
7077 {
7078 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7079 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7080 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7081 }
7082 }
7083
7086 {
7087 EntityAI parent = GetHierarchyParent();
7088
7089 if (parent)
7090 {
7091 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7092 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7093 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7094 }
7095 }
7096
7098 {
7099
7100
7101
7102
7104
7106 {
7107 if (ScriptInputUserData.CanStoreInputUserData())
7108 {
7109 ScriptInputUserData ctx = new ScriptInputUserData;
7115 ctx.
Write(use_stack_max);
7118
7120 {
7121 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7122 }
7123 }
7124 }
7125 else if (!
GetGame().IsMultiplayer())
7126 {
7128 }
7129 }
7130
7132 {
7134 }
7135
7137 {
7139 }
7140
7142 {
7144 }
7145
7147 {
7148
7149 return false;
7150 }
7151
7153 {
7154 return false;
7155 }
7156
7160 {
7161 return false;
7162 }
7163
7165 {
7166 return "";
7167 }
7168
7170
7172 {
7173 return false;
7174 }
7175
7177 {
7178 return true;
7179 }
7180
7181
7182
7184 {
7185 return true;
7186 }
7187
7189 {
7190 return true;
7191 }
7192
7194 {
7195 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7197 }
7198
7200 {
7202 }
7203
7205 {
7207 if (!is_being_placed)
7209 SetSynchDirty();
7210 }
7211
7212
7214
7216 {
7218 }
7219
7221 {
7223 }
7224
7226 {
7227 return 1;
7228 }
7229
7231 {
7232 return false;
7233 }
7234
7236 {
7238 SetSynchDirty();
7239 }
7240
7241
7242
7243
7244
7245
7246
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
7276 {
7277 super.OnMovedInsideCargo(container);
7278
7279 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7280 }
7281
7282 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7283 {
7284 super.EEItemLocationChanged(oldLoc,newLoc);
7285
7286 PlayerBase new_player = null;
7287 PlayerBase old_player = null;
7288
7289 if (newLoc.GetParent())
7290 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7291
7292 if (oldLoc.GetParent())
7293 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7294
7296 {
7297 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
7298
7299 if (r_index >= 0)
7300 {
7301 InventoryLocation r_il = new InventoryLocation;
7302 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7303
7304 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7307 {
7308 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7309 }
7311 {
7312 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7313 }
7314
7315 }
7316 }
7317
7319 {
7320 if (new_player)
7321 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
7322
7323 if (new_player == old_player)
7324 {
7325
7326 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7327 {
7329 {
7330 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7331 {
7332 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7333 }
7334 }
7335 else
7336 {
7337 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7338 }
7339 }
7340
7341 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7342 {
7343 int type = oldLoc.GetType();
7345 {
7346 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7347 }
7349 {
7350 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7351 }
7352 }
7353 if (!m_OldLocation)
7354 {
7355 m_OldLocation = new InventoryLocation;
7356 }
7357 m_OldLocation.Copy(oldLoc);
7358 }
7359 else
7360 {
7361 if (m_OldLocation)
7362 {
7363 m_OldLocation.Reset();
7364 }
7365 }
7366
7368 }
7369 else
7370 {
7371 if (new_player)
7372 {
7373 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7374 if (res_index >= 0)
7375 {
7376 InventoryLocation il = new InventoryLocation;
7377 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
7379 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
7382 {
7383 il.
GetParent().GetOnReleaseLock().Invoke(it);
7384 }
7386 {
7388 }
7389
7390 }
7391 }
7393 {
7394
7396 }
7397
7398 if (m_OldLocation)
7399 {
7400 m_OldLocation.Reset();
7401 }
7402 }
7403 }
7404
7405 override void EOnContact(IEntity other, Contact extra)
7406 {
7408 {
7409 int liquidType = -1;
7411 if (impactSpeed > 0.0)
7412 {
7414 #ifndef SERVER
7416 #else
7418 SetSynchDirty();
7419 #endif
7421 }
7422 }
7423
7424 #ifdef SERVER
7425 if (GetCompEM() && GetCompEM().IsPlugged())
7426 {
7427 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7428 GetCompEM().UnplugThis();
7429 }
7430 #endif
7431 }
7432
7434
7436 {
7438 }
7439
7441 {
7442
7443 }
7444
7446 {
7447 super.OnItemLocationChanged(old_owner, new_owner);
7448
7449 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7450 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7451
7452 if (!relatedPlayer && playerNew)
7453 relatedPlayer = playerNew;
7454
7455 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7456 {
7458 if (actionMgr)
7459 {
7460 ActionBase currentAction = actionMgr.GetRunningAction();
7461 if (currentAction)
7463 }
7464 }
7465
7466 Man ownerPlayerOld = null;
7467 Man ownerPlayerNew = null;
7468
7469 if (old_owner)
7470 {
7471 if (old_owner.
IsMan())
7472 {
7473 ownerPlayerOld = Man.Cast(old_owner);
7474 }
7475 else
7476 {
7477 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7478 }
7479 }
7480 else
7481 {
7483 {
7485
7486 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7487 {
7488 GetCompEM().UnplugThis();
7489 }
7490 }
7491 }
7492
7493 if (new_owner)
7494 {
7495 if (new_owner.
IsMan())
7496 {
7497 ownerPlayerNew = Man.Cast(new_owner);
7498 }
7499 else
7500 {
7501 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7502 }
7503 }
7504
7505 if (ownerPlayerOld != ownerPlayerNew)
7506 {
7507 if (ownerPlayerOld)
7508 {
7509 array<EntityAI> subItemsExit = new array<EntityAI>;
7511 for (int i = 0; i < subItemsExit.Count(); i++)
7512 {
7515 }
7516 }
7517
7518 if (ownerPlayerNew)
7519 {
7520 array<EntityAI> subItemsEnter = new array<EntityAI>;
7522 for (int j = 0; j < subItemsEnter.Count(); j++)
7523 {
7526 }
7527 }
7528 }
7529 else if (ownerPlayerNew != null)
7530 {
7531 PlayerBase nplayer;
7532 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7533 {
7534 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7536 for (int k = 0; k < subItemsUpdate.Count(); k++)
7537 {
7539 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7540 }
7541 }
7542 }
7543
7544 if (old_owner)
7545 old_owner.OnChildItemRemoved(this);
7546 if (new_owner)
7547 new_owner.OnChildItemReceived(this);
7548 }
7549
7550
7552 {
7553 super.EEDelete(parent);
7554 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7555 if (player)
7556 {
7558
7559 if (player.IsAlive())
7560 {
7561 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7562 if (r_index >= 0)
7563 {
7564 InventoryLocation r_il = new InventoryLocation;
7565 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7566
7567 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7570 {
7571 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7572 }
7574 {
7575 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7576 }
7577
7578 }
7579
7580 player.RemoveQuickBarEntityShortcut(this);
7581 }
7582 }
7583 }
7584
7586 {
7587 super.EEKilled(killer);
7588
7591 {
7592 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7593 {
7594 if (IsMagazine())
7595 {
7596 if (Magazine.Cast(this).GetAmmoCount() > 0)
7597 {
7599 }
7600 }
7601 else
7602 {
7604 }
7605 }
7606 }
7607 }
7608
7610 {
7611 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7612
7613 super.OnWasAttached(parent, slot_id);
7614
7617
7619 }
7620
7622 {
7623 super.OnWasDetached(parent, slot_id);
7624
7627 }
7628
7630 {
7631 int idx;
7634
7635 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7636 if (inventory_slots.Count() < 1)
7637 {
7638 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7639 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7640 }
7641 else
7642 {
7643 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7644 }
7645
7646 idx = inventory_slots.Find(slot);
7647 if (idx < 0)
7648 return "";
7649
7650 return attach_types.Get(idx);
7651 }
7652
7654 {
7655 int idx = -1;
7656 string slot;
7657
7660
7661 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7662 if (inventory_slots.Count() < 1)
7663 {
7664 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7665 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7666 }
7667 else
7668 {
7669 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7670 if (detach_types.Count() < 1)
7671 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7672 }
7673
7674 for (int i = 0; i < inventory_slots.Count(); i++)
7675 {
7676 slot = inventory_slots.Get(i);
7677 }
7678
7679 if (slot != "")
7680 {
7681 if (detach_types.Count() == 1)
7682 idx = 0;
7683 else
7684 idx = inventory_slots.Find(slot);
7685 }
7686 if (idx < 0)
7687 return "";
7688
7689 return detach_types.Get(idx);
7690 }
7691
7693 {
7694
7696
7697
7698 float min_time = 1;
7699 float max_time = 3;
7700 float delay = Math.RandomFloat(min_time, max_time);
7701
7702 explode_timer.Run(delay, this, "DoAmmoExplosion");
7703 }
7704
7706 {
7707 Magazine magazine = Magazine.Cast(this);
7708 int pop_sounds_count = 6;
7709 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7710
7711
7712 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7713 string sound_name = pop_sounds[ sound_idx ];
7715
7716
7717 magazine.ServerAddAmmoCount(-1);
7718
7719
7720 float min_temp_to_explode = 100;
7721
7722 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7723 {
7725 }
7726 }
7727
7728
7729 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7730 {
7731 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7732
7733 const int CHANCE_DAMAGE_CARGO = 4;
7734 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7735 const int CHANCE_DAMAGE_NOTHING = 2;
7736
7738 {
7739 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7740 int chances;
7741 int rnd;
7742
7743 if (GetInventory().GetCargo())
7744 {
7745 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7746 rnd = Math.RandomInt(0,chances);
7747
7748 if (rnd < CHANCE_DAMAGE_CARGO)
7749 {
7751 }
7752 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7753 {
7755 }
7756 }
7757 else
7758 {
7759 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7760 rnd = Math.RandomInt(0,chances);
7761
7762 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7763 {
7765 }
7766 }
7767 }
7768 }
7769
7771 {
7772 if (GetInventory().GetCargo())
7773 {
7774 int item_count = GetInventory().GetCargo().GetItemCount();
7775 if (item_count > 0)
7776 {
7777 int random_pick = Math.RandomInt(0, item_count);
7779 if (!item.IsExplosive())
7780 {
7781 item.AddHealth("","",damage);
7782 return true;
7783 }
7784 }
7785 }
7786 return false;
7787 }
7788
7790 {
7791 int attachment_count = GetInventory().AttachmentCount();
7792 if (attachment_count > 0)
7793 {
7794 int random_pick = Math.RandomInt(0, attachment_count);
7795 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7796 if (!attachment.IsExplosive())
7797 {
7798 attachment.AddHealth("","",damage);
7799 return true;
7800 }
7801 }
7802 return false;
7803 }
7804
7806 {
7808 }
7809
7811 {
7813 return GetInventory().CanRemoveEntity();
7814
7815 return false;
7816 }
7817
7819 {
7820
7822 return false;
7823
7824
7826 return false;
7827
7828
7829
7831 if (delta == 0)
7832 return false;
7833
7834
7835 return true;
7836 }
7837
7839 {
7841 {
7842 if (ScriptInputUserData.CanStoreInputUserData())
7843 {
7844 ScriptInputUserData ctx = new ScriptInputUserData;
7849 ctx.
Write(destination_entity);
7853 }
7854 }
7855 else if (!
GetGame().IsMultiplayer())
7856 {
7858 }
7859 }
7860
7862 {
7863 float split_quantity_new;
7867 InventoryLocation loc = new InventoryLocation;
7868
7869 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7870 {
7872 split_quantity_new = stack_max;
7873 else
7875
7877 {
7878 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7879 if (new_item)
7880 {
7881 new_item.SetResultOfSplit(true);
7882 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7884 new_item.
SetQuantity(split_quantity_new,
false,
true);
7885 }
7886 }
7887 }
7888 else if (destination_entity && slot_id == -1)
7889 {
7890 if (quantity > stack_max)
7891 split_quantity_new = stack_max;
7892 else
7893 split_quantity_new = quantity;
7894
7896 {
7898 {
7901 }
7902
7903 if (new_item)
7904 {
7905 new_item.SetResultOfSplit(true);
7906 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7908 new_item.
SetQuantity(split_quantity_new,
false,
true);
7909 }
7910 }
7911 }
7912 else
7913 {
7914 if (stack_max != 0)
7915 {
7917 {
7919 }
7920
7921 if (split_quantity_new == 0)
7922 {
7923 if (!
GetGame().IsMultiplayer())
7924 player.PhysicalPredictiveDropItem(this);
7925 else
7926 player.ServerDropEntity(this);
7927 return;
7928 }
7929
7931 {
7933
7934 if (new_item)
7935 {
7936 new_item.SetResultOfSplit(true);
7937 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7940 new_item.PlaceOnSurface();
7941 }
7942 }
7943 }
7944 }
7945 }
7946
7948 {
7949 float split_quantity_new;
7953 InventoryLocation loc = new InventoryLocation;
7954
7955 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7956 {
7958 split_quantity_new = stack_max;
7959 else
7961
7963 {
7964 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7965 if (new_item)
7966 {
7967 new_item.SetResultOfSplit(true);
7968 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7970 new_item.
SetQuantity(split_quantity_new,
false,
true);
7971 }
7972 }
7973 }
7974 else if (destination_entity && slot_id == -1)
7975 {
7976 if (quantity > stack_max)
7977 split_quantity_new = stack_max;
7978 else
7979 split_quantity_new = quantity;
7980
7982 {
7984 {
7987 }
7988
7989 if (new_item)
7990 {
7991 new_item.SetResultOfSplit(true);
7992 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7994 new_item.
SetQuantity(split_quantity_new,
false,
true);
7995 }
7996 }
7997 }
7998 else
7999 {
8000 if (stack_max != 0)
8001 {
8003 {
8005 }
8006
8008 {
8010
8011 if (new_item)
8012 {
8013 new_item.SetResultOfSplit(true);
8014 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8017 new_item.PlaceOnSurface();
8018 }
8019 }
8020 }
8021 }
8022 }
8023
8025 {
8027 {
8028 if (ScriptInputUserData.CanStoreInputUserData())
8029 {
8030 ScriptInputUserData ctx = new ScriptInputUserData;
8035 dst.WriteToContext(ctx);
8037 }
8038 }
8039 else if (!
GetGame().IsMultiplayer())
8040 {
8042 }
8043 }
8044
8046 {
8048 {
8049 if (ScriptInputUserData.CanStoreInputUserData())
8050 {
8051 ScriptInputUserData ctx = new ScriptInputUserData;
8056 ctx.
Write(destination_entity);
8062 }
8063 }
8064 else if (!
GetGame().IsMultiplayer())
8065 {
8067 }
8068 }
8069
8071 {
8073 }
8074
8076 {
8078 float split_quantity_new;
8080 if (dst.IsValid())
8081 {
8082 int slot_id = dst.GetSlot();
8084
8085 if (quantity > stack_max)
8086 split_quantity_new = stack_max;
8087 else
8088 split_quantity_new = quantity;
8089
8091 {
8093
8094 if (new_item)
8095 {
8096 new_item.SetResultOfSplit(true);
8097 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8099 new_item.
SetQuantity(split_quantity_new,
false,
true);
8100 }
8101
8102 return new_item;
8103 }
8104 }
8105
8106 return null;
8107 }
8108
8110 {
8112 float split_quantity_new;
8114 if (destination_entity)
8115 {
8117 if (quantity > stackable)
8118 split_quantity_new = stackable;
8119 else
8120 split_quantity_new = quantity;
8121
8123 {
8124 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8125 if (new_item)
8126 {
8127 new_item.SetResultOfSplit(true);
8128 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8130 new_item.
SetQuantity(split_quantity_new,
false,
true);
8131 }
8132 }
8133 }
8134 }
8135
8137 {
8139 {
8140 if (ScriptInputUserData.CanStoreInputUserData())
8141 {
8142 ScriptInputUserData ctx = new ScriptInputUserData;
8147 ItemBase destination_entity =
this;
8148 ctx.
Write(destination_entity);
8152 }
8153 }
8154 else if (!
GetGame().IsMultiplayer())
8155 {
8157 }
8158 }
8159
8161 {
8163 float split_quantity_new;
8165 if (player)
8166 {
8168 if (quantity > stackable)
8169 split_quantity_new = stackable;
8170 else
8171 split_quantity_new = quantity;
8172
8174 {
8175 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8176 new_item =
ItemBase.Cast(in_hands);
8177 if (new_item)
8178 {
8179 new_item.SetResultOfSplit(true);
8180 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8182 new_item.SetQuantity(split_quantity_new, false, true);
8183 }
8184 }
8185 }
8186 }
8187
8189 {
8191 float split_quantity_new = Math.Floor(quantity * 0.5);
8192
8194 return;
8195
8197
8198 if (new_item)
8199 {
8200 if (new_item.GetQuantityMax() < split_quantity_new)
8201 {
8202 split_quantity_new = new_item.GetQuantityMax();
8203 }
8204
8205 new_item.SetResultOfSplit(true);
8206 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8207
8209 {
8212 }
8213 else
8214 {
8216 new_item.
SetQuantity(split_quantity_new,
false,
true);
8217 }
8218 }
8219 }
8220
8222 {
8224 float split_quantity_new = Math.Floor(quantity / 2);
8225
8227 return;
8228
8229 InventoryLocation invloc = new InventoryLocation;
8231
8233 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8234
8235 if (new_item)
8236 {
8237 if (new_item.GetQuantityMax() < split_quantity_new)
8238 {
8239 split_quantity_new = new_item.GetQuantityMax();
8240 }
8242 {
8245 }
8246 else if (split_quantity_new > 1)
8247 {
8249 new_item.
SetQuantity(split_quantity_new,
false,
true);
8250 }
8251 }
8252 }
8253
8256 {
8257 SetWeightDirty();
8259
8260 if (parent)
8261 parent.OnAttachmentQuantityChangedEx(this, delta);
8262
8264 {
8266 {
8268 }
8270 {
8271 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8273 }
8274 }
8275
8276 }
8277
8280 {
8281
8282 }
8283
8286 {
8288 }
8289
8291 {
8292 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8293
8295 {
8296 if (newLevel == GameConstants.STATE_RUINED)
8297 {
8299 EntityAI parent = GetHierarchyParent();
8300 if (parent && parent.IsFireplace())
8301 {
8302 CargoBase cargo = GetInventory().GetCargo();
8303 if (cargo)
8304 {
8306 {
8308 }
8309 }
8310 }
8311 }
8312
8314 {
8315
8317 return;
8318 }
8319
8320 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8321 {
8323 }
8324 }
8325 }
8326
8327
8329 {
8330 super.OnRightClick();
8331
8333 {
8335 {
8336 if (ScriptInputUserData.CanStoreInputUserData())
8337 {
8338 EntityAI root = GetHierarchyRoot();
8339 Man playerOwner = GetHierarchyRootPlayer();
8340 InventoryLocation dst = new InventoryLocation;
8341
8342
8343 if (!playerOwner && root && root == this)
8344 {
8346 }
8347 else
8348 {
8349
8350 GetInventory().GetCurrentInventoryLocation(dst);
8352 {
8355 {
8357 }
8358 else
8359 {
8361
8362
8363 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8364 {
8366 }
8367 else
8368 {
8369 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8370 }
8371 }
8372 }
8373 }
8374
8375 ScriptInputUserData ctx = new ScriptInputUserData;
8383 }
8384 }
8385 else if (!
GetGame().IsMultiplayer())
8386 {
8388 }
8389 }
8390 }
8391
8393 {
8394 if (root)
8395 {
8396 vector m4[4];
8397 root.GetTransform(m4);
8398 dst.SetGround(this, m4);
8399 }
8400 else
8401 {
8402 GetInventory().GetCurrentInventoryLocation(dst);
8403 }
8404 }
8405
8406 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8407 {
8408
8409 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8410 return false;
8411
8412 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8413 return false;
8414
8415
8417 return false;
8418
8419
8420 Magazine mag = Magazine.Cast(this);
8421 if (mag)
8422 {
8423 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8424 return false;
8425
8426 if (stack_max_limit)
8427 {
8428 Magazine other_mag = Magazine.Cast(other_item);
8429 if (other_item)
8430 {
8431 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8432 return false;
8433 }
8434
8435 }
8436 }
8437 else
8438 {
8439
8441 return false;
8442
8444 return false;
8445 }
8446
8447 PlayerBase player = null;
8448 if (CastTo(player, GetHierarchyRootPlayer()))
8449 {
8450 if (player.GetInventory().HasAttachment(this))
8451 return false;
8452
8453 if (player.IsItemsToDelete())
8454 return false;
8455 }
8456
8457 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8458 return false;
8459
8460 int slotID;
8462 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8463 return false;
8464
8465 return true;
8466 }
8467
8469 {
8471 }
8472
8474 {
8475 return m_IsResultOfSplit;
8476 }
8477
8479 {
8480 m_IsResultOfSplit = value;
8481 }
8482
8484 {
8486 }
8487
8489 {
8490 float other_item_quantity = other_item.GetQuantity();
8491 float this_free_space;
8492
8494
8496
8497 if (other_item_quantity > this_free_space)
8498 {
8499 return this_free_space;
8500 }
8501 else
8502 {
8503 return other_item_quantity;
8504 }
8505 }
8506
8508 {
8510 }
8511
8513 {
8515 return;
8516
8517 if (!IsMagazine() && other_item)
8518 {
8520 if (quantity_used != 0)
8521 {
8522 float hp1 = GetHealth01("","");
8523 float hp2 = other_item.GetHealth01("","");
8524 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8525 hpResult = hpResult / (
GetQuantity() + quantity_used);
8526
8527 hpResult *= GetMaxHealth();
8528 Math.Round(hpResult);
8529 SetHealth("", "Health", hpResult);
8530
8532 other_item.AddQuantity(-quantity_used);
8533 }
8534 }
8536 }
8537
8539 {
8540 #ifdef SERVER
8541 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8542 GetHierarchyParent().IncreaseLifetimeUp();
8543 #endif
8544 };
8545
8547 {
8548 PlayerBase p = PlayerBase.Cast(player);
8549
8550 array<int> recipesIds = p.m_Recipes;
8551 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8552 if (moduleRecipesManager)
8553 {
8554 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8555 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8556 }
8557
8558 for (int i = 0;i < recipesIds.Count(); i++)
8559 {
8560 int key = recipesIds.Get(i);
8561 string recipeName = moduleRecipesManager.GetRecipeName(key);
8563 }
8564 }
8565
8566
8567 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8568 {
8569 super.GetDebugActions(outputList);
8570
8571
8577
8578
8583
8588
8589
8593
8594
8596 {
8600 }
8601
8604
8605
8609
8611
8612 InventoryLocation loc = new InventoryLocation();
8613 GetInventory().GetCurrentInventoryLocation(loc);
8615 {
8616 if (Gizmo_IsSupported())
8619 }
8620
8622 }
8623
8624
8625
8626
8628 {
8629 super.OnAction(action_id, player, ctx);
8630
8632 {
8633 switch (action_id)
8634 {
8637 return true;
8640 return true;
8641 }
8642 }
8643
8645 {
8646 switch (action_id)
8647 {
8649 Delete();
8650 return true;
8651 }
8652 }
8653
8654 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8655 {
8656 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8657 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8658 PlayerBase p = PlayerBase.Cast(player);
8659 if (
EActions.RECIPES_RANGE_START < 1000)
8660 {
8661 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8662 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8663 }
8664 }
8665 #ifndef SERVER
8666 else if (action_id ==
EActions.WATCH_PLAYER)
8667 {
8668 PluginDeveloper.SetDeveloperItemClientEx(player);
8669 }
8670 #endif
8672 {
8673 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8674 {
8675 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8676 OnDebugButtonPressServer(id + 1);
8677 }
8678
8679 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8680 {
8681 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8683 }
8684
8685 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8686 {
8687 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8689 }
8690
8691 else if (action_id ==
EActions.ADD_QUANTITY)
8692 {
8693 if (IsMagazine())
8694 {
8695 Magazine mag = Magazine.Cast(this);
8696 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8697 }
8698 else
8699 {
8701 }
8702
8703 if (m_EM)
8704 {
8705 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8706 }
8707
8708 }
8709
8710 else if (action_id ==
EActions.REMOVE_QUANTITY)
8711 {
8712 if (IsMagazine())
8713 {
8714 Magazine mag2 = Magazine.Cast(this);
8715 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8716 }
8717 else
8718 {
8720 }
8721 if (m_EM)
8722 {
8723 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8724 }
8725
8726 }
8727
8728 else if (action_id ==
EActions.SET_QUANTITY_0)
8729 {
8731
8732 if (m_EM)
8733 {
8734 m_EM.SetEnergy(0);
8735 }
8736 }
8737
8738 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8739 {
8741
8742 if (m_EM)
8743 {
8744 m_EM.SetEnergy(m_EM.GetEnergyMax());
8745 }
8746 }
8747
8748 else if (action_id ==
EActions.ADD_HEALTH)
8749 {
8750 AddHealth("","",GetMaxHealth("","Health")/5);
8751 }
8752 else if (action_id ==
EActions.REMOVE_HEALTH)
8753 {
8754 AddHealth("","",-GetMaxHealth("","Health")/5);
8755 }
8756 else if (action_id ==
EActions.DESTROY_HEALTH)
8757 {
8758 SetHealth01("","",0);
8759 }
8760 else if (action_id ==
EActions.WATCH_ITEM)
8761 {
8763 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8764 #ifdef DEVELOPER
8765 SetDebugDeveloper_item(this);
8766 #endif
8767 }
8768
8769 else if (action_id ==
EActions.ADD_TEMPERATURE)
8770 {
8771 AddTemperature(20);
8772
8773 }
8774
8775 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8776 {
8777 AddTemperature(-20);
8778
8779 }
8780
8781 else if (action_id ==
EActions.FLIP_FROZEN)
8782 {
8783 SetFrozen(!GetIsFrozen());
8784
8785 }
8786
8787 else if (action_id ==
EActions.ADD_WETNESS)
8788 {
8790
8791 }
8792
8793 else if (action_id ==
EActions.REMOVE_WETNESS)
8794 {
8796
8797 }
8798
8799 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8800 {
8803
8804
8805 }
8806
8807 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8808 {
8811 }
8812
8813 else if (action_id ==
EActions.MAKE_SPECIAL)
8814 {
8815 auto debugParams = DebugSpawnParams.WithPlayer(player);
8816 OnDebugSpawnEx(debugParams);
8817 }
8818
8819 }
8820
8821
8822 return false;
8823 }
8824
8825
8826
8827
8831
8834
8835
8836
8838 {
8839 return false;
8840 }
8841
8842
8844 {
8845 return true;
8846 }
8847
8848
8850 {
8851 return true;
8852 }
8853
8854
8855
8857 {
8858 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8860 }
8861
8864 {
8865 return null;
8866 }
8867
8869 {
8870 return false;
8871 }
8872
8874 {
8875 return false;
8876 }
8877
8881
8882
8884 {
8885 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8886 return module_repairing.CanRepair(this, item_repair_kit);
8887 }
8888
8889
8890 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8891 {
8892 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8893 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8894 }
8895
8896
8898 {
8899
8900
8901
8902
8903
8904
8905
8906
8907 return 1;
8908 }
8909
8910
8911
8913 {
8915 }
8916
8917
8918
8920 {
8922 }
8923
8924
8933 {
8934 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8935
8936 if (player)
8937 {
8938 player.MessageStatus(text);
8939 }
8940 }
8941
8942
8951 {
8952 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8953
8954 if (player)
8955 {
8956 player.MessageAction(text);
8957 }
8958 }
8959
8960
8969 {
8970 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8971
8972 if (player)
8973 {
8974 player.MessageFriendly(text);
8975 }
8976 }
8977
8978
8987 {
8988 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8989
8990 if (player)
8991 {
8992 player.MessageImportant(text);
8993 }
8994 }
8995
8997 {
8998 return true;
8999 }
9000
9001
9002 override bool KindOf(
string tag)
9003 {
9004 bool found = false;
9005 string item_name = this.
GetType();
9008
9009 int array_size = item_tag_array.Count();
9010 for (int i = 0; i < array_size; i++)
9011 {
9012 if (item_tag_array.Get(i) == tag)
9013 {
9014 found = true;
9015 break;
9016 }
9017 }
9018 return found;
9019 }
9020
9021
9023 {
9024
9025 super.OnRPC(sender, rpc_type,ctx);
9026
9027
9028 switch (rpc_type)
9029 {
9030 #ifndef SERVER
9031 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9032 Param2<bool, string> p = new Param2<bool, string>(false, "");
9033
9035 return;
9036
9037 bool play = p.param1;
9038 string soundSet = p.param2;
9039
9040 if (play)
9041 {
9043 {
9045 {
9047 }
9048 }
9049 else
9050 {
9052 }
9053 }
9054 else
9055 {
9057 }
9058
9059 break;
9060 #endif
9061
9062 }
9063
9065 {
9067 }
9068 }
9069
9070
9071
9072
9074 {
9075 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9076 return plugin.GetID(
name);
9077 }
9078
9080 {
9081 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9082 return plugin.GetName(id);
9083 }
9084
9087 {
9088
9089
9090 int varFlags;
9091 if (!ctx.
Read(varFlags))
9092 return;
9093
9094 if (varFlags & ItemVariableFlags.FLOAT)
9095 {
9097 }
9098 }
9099
9101 {
9102
9103 super.SerializeNumericalVars(floats_out);
9104
9105
9106
9108 {
9110 }
9111
9113 {
9115 }
9116
9118 {
9120 }
9121
9123 {
9128 }
9129
9131 {
9133 }
9134 }
9135
9137 {
9138
9139 super.DeSerializeNumericalVars(floats);
9140
9141
9142 int index = 0;
9143 int mask = Math.Round(floats.Get(index));
9144
9145 index++;
9146
9148 {
9150 {
9152 }
9153 else
9154 {
9155 float quantity = floats.Get(index);
9157 }
9158 index++;
9159 }
9160
9162 {
9163 float wet = floats.Get(index);
9165 index++;
9166 }
9167
9169 {
9170 int liquidtype = Math.Round(floats.Get(index));
9172 index++;
9173 }
9174
9176 {
9178 index++;
9180 index++;
9182 index++;
9184 index++;
9185 }
9186
9188 {
9189 int cleanness = Math.Round(floats.Get(index));
9191 index++;
9192 }
9193 }
9194
9196 {
9197 super.WriteVarsToCTX(ctx);
9198
9199
9201 {
9203 }
9204
9206 {
9208 }
9209
9211 {
9213 }
9214
9216 {
9217 int r,g,b,a;
9223 }
9224
9226 {
9228 }
9229 }
9230
9232 {
9233 if (!super.ReadVarsFromCTX(ctx,version))
9234 return false;
9235
9236 int intValue;
9237 float value;
9238
9239 if (version < 140)
9240 {
9241 if (!ctx.
Read(intValue))
9242 return false;
9243
9244 m_VariablesMask = intValue;
9245 }
9246
9248 {
9249 if (!ctx.
Read(value))
9250 return false;
9251
9253 {
9255 }
9256 else
9257 {
9259 }
9260 }
9261
9262 if (version < 140)
9263 {
9265 {
9266 if (!ctx.
Read(value))
9267 return false;
9268 SetTemperatureDirect(value);
9269 }
9270 }
9271
9273 {
9274 if (!ctx.
Read(value))
9275 return false;
9277 }
9278
9280 {
9281 if (!ctx.
Read(intValue))
9282 return false;
9284 }
9285
9287 {
9288 int r,g,b,a;
9290 return false;
9292 return false;
9294 return false;
9296 return false;
9297
9299 }
9300
9302 {
9303 if (!ctx.
Read(intValue))
9304 return false;
9306 }
9307
9308 if (version >= 138 && version < 140)
9309 {
9311 {
9312 if (!ctx.
Read(intValue))
9313 return false;
9314 SetFrozen(intValue);
9315 }
9316 }
9317
9318 return true;
9319 }
9320
9321
9323 {
9326 {
9328 }
9329
9330 if (!super.OnStoreLoad(ctx, version))
9331 {
9333 return false;
9334 }
9335
9336 if (version >= 114)
9337 {
9338 bool hasQuickBarIndexSaved;
9339
9340 if (!ctx.
Read(hasQuickBarIndexSaved))
9341 {
9343 return false;
9344 }
9345
9346 if (hasQuickBarIndexSaved)
9347 {
9348 int itmQBIndex;
9349
9350
9351 if (!ctx.
Read(itmQBIndex))
9352 {
9354 return false;
9355 }
9356
9357 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9358 if (itmQBIndex != -1 && parentPlayer)
9359 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9360 }
9361 }
9362 else
9363 {
9364
9365 PlayerBase player;
9366 int itemQBIndex;
9367 if (version ==
int.
MAX)
9368 {
9369 if (!ctx.
Read(itemQBIndex))
9370 {
9372 return false;
9373 }
9374 }
9375 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9376 {
9377
9378 if (!ctx.
Read(itemQBIndex))
9379 {
9381 return false;
9382 }
9383 if (itemQBIndex != -1 && player)
9384 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9385 }
9386 }
9387
9388 if (version < 140)
9389 {
9390
9391 if (!LoadVariables(ctx, version))
9392 {
9394 return false;
9395 }
9396 }
9397
9398
9400 {
9402 return false;
9403 }
9404 if (version >= 132)
9405 {
9407 if (raib)
9408 {
9410 {
9412 return false;
9413 }
9414 }
9415 }
9416
9418 return true;
9419 }
9420
9421
9422
9424 {
9425 super.OnStoreSave(ctx);
9426
9427 PlayerBase player;
9428 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9429 {
9431
9432 int itemQBIndex = -1;
9433 itemQBIndex = player.FindQuickBarEntityIndex(this);
9434 ctx.
Write(itemQBIndex);
9435 }
9436 else
9437 {
9439 }
9440
9442
9444 if (raib)
9445 {
9447 }
9448 }
9449
9450
9452 {
9453 super.AfterStoreLoad();
9454
9456 {
9458 }
9459
9461 {
9464 }
9465 }
9466
9468 {
9469 super.EEOnAfterLoad();
9470
9472 {
9474 }
9475
9478 }
9479
9481 {
9482 return false;
9483 }
9484
9485
9486
9488 {
9490 {
9491 #ifdef PLATFORM_CONSOLE
9492
9494 {
9496 if (menu)
9497 {
9499 }
9500 }
9501 #endif
9502 }
9503
9505 {
9508 }
9509
9511 {
9512 SetWeightDirty();
9514 }
9516 {
9519 }
9520
9522 {
9525 }
9527 {
9530 }
9531
9532 super.OnVariablesSynchronized();
9533 }
9534
9535
9536
9538 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9539 {
9540 if (!IsServerCheck(allow_client))
9541 return false;
9542
9544 return false;
9545
9548
9549 if (value <= (min + 0.001))
9550 value = min;
9551
9552 if (value == min)
9553 {
9554 if (destroy_config)
9555 {
9556 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9557 if (dstr)
9558 {
9560 this.Delete();
9561 return true;
9562 }
9563 }
9564 else if (destroy_forced)
9565 {
9567 this.Delete();
9568 return true;
9569 }
9570
9572 }
9573
9576
9578 {
9580
9581 if (delta)
9583 }
9584
9586
9587 return false;
9588 }
9589
9590
9592 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9593 {
9595 }
9596
9598 {
9601 }
9602
9604 {
9607 }
9608
9610 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9611 {
9612 float value_clamped = Math.Clamp(value, 0, 1);
9614 SetQuantity(result, destroy_config, destroy_forced);
9615 }
9616
9617
9620 {
9622 }
9623
9625 {
9627 }
9628
9629
9630
9631
9632
9633
9634
9635
9636
9637
9639 {
9640 int slot = -1;
9641 if (GetInventory())
9642 {
9643 InventoryLocation il = new InventoryLocation;
9644 GetInventory().GetCurrentInventoryLocation(il);
9646 }
9647
9649 }
9650
9652 {
9653 float quantity_max = 0;
9654
9656 {
9657 if (attSlotID != -1)
9658 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9659
9660 if (quantity_max <= 0)
9662 }
9663
9664 if (quantity_max <= 0)
9666
9667 return quantity_max;
9668 }
9669
9671 {
9673 }
9674
9676 {
9678 }
9679
9680
9682 {
9684 }
9685
9687 {
9689 }
9690
9692 {
9694 }
9695
9696
9698 {
9699
9700 float weightEx = GetWeightEx();
9701 float special = GetInventoryAndCargoWeight();
9702 return weightEx - special;
9703 }
9704
9705
9707 {
9709 }
9710
9712 {
9714 {
9715 #ifdef DEVELOPER
9716 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9717 {
9718 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9720 }
9721 #endif
9722
9724 }
9725 else if (HasEnergyManager())
9726 {
9727 #ifdef DEVELOPER
9728 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9729 {
9730 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9731 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9732 }
9733 #endif
9734 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9735 }
9736 else
9737 {
9738 #ifdef DEVELOPER
9739 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9740 {
9741 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9742 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9743 }
9744 #endif
9745 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9746 }
9747 }
9748
9751 {
9752 int item_count = 0;
9754
9755 if (GetInventory().GetCargo() != NULL)
9756 {
9757 item_count = GetInventory().GetCargo().GetItemCount();
9758 }
9759
9760 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9761 {
9762 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9763 if (item)
9764 item_count += item.GetNumberOfItems();
9765 }
9766 return item_count;
9767 }
9768
9771 {
9772 float weight = 0;
9773 float wetness = 1;
9774 if (include_wetness)
9777 {
9778 weight = wetness * m_ConfigWeight;
9779 }
9781 {
9782 weight = 1;
9783 }
9784 return weight;
9785 }
9786
9787
9788
9790 {
9791 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9792 {
9793 GameInventory inv = GetInventory();
9794 array<EntityAI> items = new array<EntityAI>;
9796 for (int i = 0; i < items.Count(); i++)
9797 {
9799 if (item)
9800 {
9802 }
9803 }
9804 }
9805 }
9806
9807
9808
9809
9811 {
9812 float energy = 0;
9813 if (HasEnergyManager())
9814 {
9815 energy = GetCompEM().GetEnergy();
9816 }
9817 return energy;
9818 }
9819
9820
9822 {
9823 super.OnEnergyConsumed();
9824
9826 }
9827
9829 {
9830 super.OnEnergyAdded();
9831
9833 }
9834
9835
9837 {
9838 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9839 {
9841 {
9842 float energy_0to1 = GetCompEM().GetEnergy0To1();
9844 }
9845 }
9846 }
9847
9848
9850 {
9851 return ConfigGetFloat("heatIsolation");
9852 }
9853
9855 {
9857 }
9858
9860 {
9861 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9862 if (
GetGame().ConfigIsExisting(paramPath))
9864
9865 return 0.0;
9866 }
9867
9869 {
9870 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9871 if (
GetGame().ConfigIsExisting(paramPath))
9873
9874 return 0.0;
9875 }
9876
9877 override void SetWet(
float value,
bool allow_client =
false)
9878 {
9879 if (!IsServerCheck(allow_client))
9880 return;
9881
9884
9886
9887 m_VarWet = Math.Clamp(value, min, max);
9888
9890 {
9893 }
9894 }
9895
9896 override void AddWet(
float value)
9897 {
9899 }
9900
9902 {
9904 }
9905
9907 {
9909 }
9910
9912 {
9914 }
9915
9917 {
9919 }
9920
9922 {
9924 }
9925
9927 {
9930 if (newLevel != oldLevel)
9931 {
9933 }
9934 }
9935
9937 {
9938 SetWeightDirty();
9939 }
9940
9942 {
9943 return GetWetLevelInternal(
m_VarWet);
9944 }
9945
9946
9947
9949 {
9951 }
9952
9954 {
9956 }
9957
9959 {
9961 }
9962
9964 {
9966 }
9967
9968
9969
9971 {
9972 if (ConfigIsExisting("itemModelLength"))
9973 {
9974 return ConfigGetFloat("itemModelLength");
9975 }
9976 return 0;
9977 }
9978
9980 {
9981 if (ConfigIsExisting("itemAttachOffset"))
9982 {
9983 return ConfigGetFloat("itemAttachOffset");
9984 }
9985 return 0;
9986 }
9987
9988 override void SetCleanness(
int value,
bool allow_client =
false)
9989 {
9990 if (!IsServerCheck(allow_client))
9991 return;
9992
9994
9996
9999 }
10000
10002 {
10004 }
10005
10007 {
10008 return true;
10009 }
10010
10011
10012
10013
10015 {
10017 }
10018
10020 {
10022 }
10023
10024
10025
10026
10027 override void SetColor(
int r,
int g,
int b,
int a)
10028 {
10034 }
10036 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10037 {
10042 }
10043
10045 {
10047 }
10048
10051 {
10052 int r,g,b,a;
10054 r = r/255;
10055 g = g/255;
10056 b = b/255;
10057 a = a/255;
10058 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10059 }
10060
10061
10062
10063 override void SetLiquidType(
int value,
bool allow_client =
false)
10064 {
10065 if (!IsServerCheck(allow_client))
10066 return;
10067
10072 }
10073
10075 {
10076 return ConfigGetInt("varLiquidTypeInit");
10077 }
10078
10080 {
10082 }
10083
10085 {
10087 SetFrozen(false);
10088 }
10089
10092 {
10093 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10094 }
10095
10096
10099 {
10100 PlayerBase nplayer;
10101 if (PlayerBase.CastTo(nplayer, player))
10102 {
10104
10105 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10106 }
10107 }
10108
10109
10112 {
10113 PlayerBase nplayer;
10114 if (PlayerBase.CastTo(nplayer,player))
10115 {
10116
10117 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10118
10119 }
10120
10121
10122 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10123
10124
10125 if (HasEnergyManager())
10126 {
10127 GetCompEM().UpdatePlugState();
10128 }
10129 }
10130
10131
10133 {
10134 super.OnPlacementStarted(player);
10135
10137 }
10138
10139 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10140 {
10142 {
10143 m_AdminLog.OnPlacementComplete(player,
this);
10144 }
10145
10146 super.OnPlacementComplete(player, position, orientation);
10147 }
10148
10149
10150
10151
10152
10154 {
10156 {
10157 return true;
10158 }
10159 else
10160 {
10161 return false;
10162 }
10163 }
10164
10165
10167 {
10169 {
10171 }
10172 }
10173
10174
10176 {
10178 }
10179
10181 {
10183 }
10184
10185 override void InsertAgent(
int agent,
float count = 1)
10186 {
10187 if (count < 1)
10188 return;
10189
10191 }
10192
10195 {
10197 }
10198
10199
10201 {
10203 }
10204
10205
10206
10207
10208
10209
10210
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
10247 {
10249 return false;
10250 return true;
10251 }
10252
10254 {
10255
10257 }
10258
10259
10262 {
10263 super.CheckForRoofLimited(timeTresholdMS);
10264
10266 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10267 {
10268 m_PreviousRoofTestTime = time;
10269 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10270 }
10271 }
10272
10273
10275 {
10277 {
10278 return 0;
10279 }
10280
10281 if (GetInventory().GetAttachmentSlotsCount() != 0)
10282 {
10283 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10284 if (filter)
10285 return filter.GetProtectionLevel(type, false, system);
10286 else
10287 return 0;
10288 }
10289
10290 string subclassPath, entryName;
10291
10292 switch (type)
10293 {
10295 entryName = "biological";
10296 break;
10298 entryName = "chemical";
10299 break;
10300 default:
10301 entryName = "biological";
10302 break;
10303 }
10304
10305 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10306
10308 }
10309
10310
10311
10314 {
10315 if (!IsMagazine())
10317
10319 }
10320
10321
10322
10323
10324
10329 {
10330 return true;
10331 }
10332
10334 {
10336 }
10337
10338
10339
10340
10341
10343 {
10344 if (parent)
10345 {
10346 if (parent.IsInherited(DayZInfected))
10347 return true;
10348
10349 if (!parent.IsRuined())
10350 return true;
10351 }
10352
10353 return true;
10354 }
10355
10357 {
10358 if (!super.CanPutAsAttachment(parent))
10359 {
10360 return false;
10361 }
10362
10363 if (!IsRuined() && !parent.IsRuined())
10364 {
10365 return true;
10366 }
10367
10368 return false;
10369 }
10370
10372 {
10373
10374
10375
10376
10377 return super.CanReceiveItemIntoCargo(item);
10378 }
10379
10381 {
10382
10383
10384
10385
10386 GameInventory attachmentInv = attachment.GetInventory();
10388 {
10389 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10390 return false;
10391 }
10392
10393 InventoryLocation loc = new InventoryLocation();
10394 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10395 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10396 return false;
10397
10398 return super.CanReceiveAttachment(attachment, slotId);
10399 }
10400
10402 {
10403 if (!super.CanReleaseAttachment(attachment))
10404 return false;
10405
10406 return GetInventory().AreChildrenAccessible();
10407 }
10408
10409
10410
10411
10412
10413
10414
10415
10416
10417
10418
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10430 {
10431 int id = muzzle_owner.GetMuzzleID();
10432 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10433
10434 if (WPOF_array)
10435 {
10436 for (int i = 0; i < WPOF_array.Count(); i++)
10437 {
10438 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10439
10440 if (WPOF)
10441 {
10442 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10443 }
10444 }
10445 }
10446 }
10447
10448
10450 {
10451 int id = muzzle_owner.GetMuzzleID();
10453
10454 if (WPOBE_array)
10455 {
10456 for (int i = 0; i < WPOBE_array.Count(); i++)
10457 {
10458 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10459
10460 if (WPOBE)
10461 {
10462 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10463 }
10464 }
10465 }
10466 }
10467
10468
10470 {
10471 int id = muzzle_owner.GetMuzzleID();
10472 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10473
10474 if (WPOOH_array)
10475 {
10476 for (int i = 0; i < WPOOH_array.Count(); i++)
10477 {
10478 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10479
10480 if (WPOOH)
10481 {
10482 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10483 }
10484 }
10485 }
10486 }
10487
10488
10490 {
10491 int id = muzzle_owner.GetMuzzleID();
10492 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10493
10494 if (WPOOH_array)
10495 {
10496 for (int i = 0; i < WPOOH_array.Count(); i++)
10497 {
10498 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10499
10500 if (WPOOH)
10501 {
10502 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10503 }
10504 }
10505 }
10506 }
10507
10508
10510 {
10511 int id = muzzle_owner.GetMuzzleID();
10512 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10513
10514 if (WPOOH_array)
10515 {
10516 for (int i = 0; i < WPOOH_array.Count(); i++)
10517 {
10518 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10519
10520 if (WPOOH)
10521 {
10522 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10523 }
10524 }
10525 }
10526 }
10527
10528
10529
10531 {
10533 {
10534 return true;
10535 }
10536
10537 return false;
10538 }
10539
10541 {
10543 {
10544 return true;
10545 }
10546
10547 return false;
10548 }
10549
10551 {
10553 {
10554 return true;
10555 }
10556
10557 return false;
10558 }
10559
10561 {
10562 return false;
10563 }
10564
10567 {
10568 return UATimeSpent.DEFAULT_DEPLOY;
10569 }
10570
10571
10572
10573
10575 {
10577 SetSynchDirty();
10578 }
10579
10581 {
10583 }
10584
10585
10587 {
10588 return false;
10589 }
10590
10593 {
10594 string att_type = "None";
10595
10596 if (ConfigIsExisting("soundAttType"))
10597 {
10598 att_type = ConfigGetString("soundAttType");
10599 }
10600
10602 }
10603
10605 {
10607 }
10608
10609
10610
10611
10612
10618
10620 {
10623
10625 }
10626
10627
10629 {
10631 return;
10632
10634
10637
10640
10641 SoundParameters params = new SoundParameters();
10645 }
10646
10647
10649 {
10651 return;
10652
10654 SetSynchDirty();
10655
10658 }
10659
10660
10662 {
10664 return;
10665
10667 SetSynchDirty();
10668
10671 }
10672
10674 {
10676 }
10677
10679 {
10681 }
10682
10685 {
10686 if (!
GetGame().IsDedicatedServer())
10687 {
10688 if (ConfigIsExisting("attachSoundSet"))
10689 {
10690 string cfg_path = "";
10691 string soundset = "";
10692 string type_name =
GetType();
10693
10696 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10697 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10698
10699 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10700 {
10701 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10702 {
10703 if (cfg_slot_array[i] == slot_type)
10704 {
10705 soundset = cfg_soundset_array[i];
10706 break;
10707 }
10708 }
10709 }
10710
10711 if (soundset != "")
10712 {
10713 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10715 }
10716 }
10717 }
10718 }
10719
10721 {
10722
10723 }
10724
10725 void OnApply(PlayerBase player);
10726
10728 {
10729 return 1.0;
10730 };
10731
10733 {
10735 }
10736
10738 {
10740 }
10741
10743
10745 {
10746 SetDynamicPhysicsLifeTime(0.01);
10748 }
10749
10751 {
10752 array<string> zone_names = new array<string>;
10753 GetDamageZones(zone_names);
10754 for (int i = 0; i < zone_names.Count(); i++)
10755 {
10756 SetHealthMax(zone_names.Get(i),"Health");
10757 }
10758 SetHealthMax("","Health");
10759 }
10760
10763 {
10764 float global_health = GetHealth01("","Health");
10765 array<string> zones = new array<string>;
10766 GetDamageZones(zones);
10767
10768 for (int i = 0; i < zones.Count(); i++)
10769 {
10770 SetHealth01(zones.Get(i),"Health",global_health);
10771 }
10772 }
10773
10776 {
10777 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10778 }
10779
10781 {
10782 if (!hasRootAsPlayer)
10783 {
10784 if (refParentIB)
10785 {
10786
10787 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10788 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10789
10790 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10791 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10792
10795 }
10796 else
10797 {
10798
10801 }
10802 }
10803 }
10804
10806 {
10808 {
10809 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10810 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10811 {
10812 float heatPermCoef = 1.0;
10814 while (ent)
10815 {
10816 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10817 ent = ent.GetHierarchyParent();
10818 }
10819
10820 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10821 }
10822 }
10823 }
10824
10826 {
10827
10828 EntityAI parent = GetHierarchyParent();
10829 if (!parent)
10830 {
10831 hasParent = false;
10832 hasRootAsPlayer = false;
10833 }
10834 else
10835 {
10836 hasParent = true;
10837 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10838 refParentIB =
ItemBase.Cast(parent);
10839 }
10840 }
10841
10842 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10843 {
10844
10845 }
10846
10848 {
10849
10850 return false;
10851 }
10852
10854 {
10855
10856
10857 return false;
10858 }
10859
10861 {
10862
10863 return false;
10864 }
10865
10868 {
10869 return !GetIsFrozen() &&
IsOpen();
10870 }
10871
10873 {
10874 bool hasParent = false, hasRootAsPlayer = false;
10876
10877 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10878 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10879
10880 if (wwtu || foodDecay)
10881 {
10885
10886 if (processWetness || processTemperature || processDecay)
10887 {
10889
10890 if (processWetness)
10891 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10892
10893 if (processTemperature)
10895
10896 if (processDecay)
10897 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10898 }
10899 }
10900 }
10901
10904 {
10906 }
10907
10909 {
10912
10913 return super.GetTemperatureFreezeThreshold();
10914 }
10915
10917 {
10920
10921 return super.GetTemperatureThawThreshold();
10922 }
10923
10925 {
10928
10929 return super.GetItemOverheatThreshold();
10930 }
10931
10933 {
10935 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10936
10937 return super.GetTemperatureFreezeTime();
10938 }
10939
10941 {
10943 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10944
10945 return super.GetTemperatureThawTime();
10946 }
10947
10952
10954 {
10955 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10956 }
10957
10959 {
10960 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10961 }
10962
10965 {
10967 }
10968
10970 {
10972 }
10973
10975 {
10977 }
10978
10981 {
10982 return null;
10983 }
10984
10987 {
10988 return false;
10989 }
10990
10992 {
10994 {
10997 if (!trg)
10998 {
11000 explosive = this;
11001 }
11002
11003 explosive.PairRemote(trg);
11005
11006 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11007 trg.SetPersistentPairID(persistentID);
11008 explosive.SetPersistentPairID(persistentID);
11009
11010 return true;
11011 }
11012 return false;
11013 }
11014
11017 {
11018 float ret = 1.0;
11021 ret *= GetHealth01();
11022
11023 return ret;
11024 }
11025
11026 #ifdef DEVELOPER
11027 override void SetDebugItem()
11028 {
11029 super.SetDebugItem();
11030 _itemBase = this;
11031 }
11032
11034 {
11035 string text = super.GetDebugText();
11036
11038 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11039
11040 return text;
11041 }
11042 #endif
11043
11045 {
11046 return true;
11047 }
11048
11050
11052
11054 {
11057 }
11058
11059
11067
11083}
11084
11086{
11088 if (entity)
11089 {
11090 bool is_item = entity.IsInherited(
ItemBase);
11091 if (is_item && full_quantity)
11092 {
11095 }
11096 }
11097 else
11098 {
11100 return NULL;
11101 }
11102 return entity;
11103}
11104
11106{
11107 if (item)
11108 {
11109 if (health > 0)
11110 item.SetHealth("", "", health);
11111
11112 if (item.CanHaveTemperature())
11113 {
11115 if (item.CanFreeze())
11116 item.SetFrozen(false);
11117 }
11118
11119 if (item.HasEnergyManager())
11120 {
11121 if (quantity >= 0)
11122 {
11123 item.GetCompEM().SetEnergy0To1(quantity);
11124 }
11125 else
11126 {
11128 }
11129 }
11130 else if (item.IsMagazine())
11131 {
11132 Magazine mag = Magazine.Cast(item);
11133 if (quantity >= 0)
11134 {
11135 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11136 }
11137 else
11138 {
11140 }
11141
11142 }
11143 else
11144 {
11145 if (quantity >= 0)
11146 {
11147 item.SetQuantityNormalized(quantity, false);
11148 }
11149 else
11150 {
11152 }
11153
11154 }
11155 }
11156}
11157
11158#ifdef DEVELOPER
11160#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.