6267{
6269 {
6270 return true;
6271 }
6272};
6273
6274
6275
6277{
6281
6283
6286
6287
6288
6289
6290
6299
6305
6310
6315
6336 protected bool m_IsResultOfSplit
6337
6339
6344
6345
6346
6348
6352
6353
6354
6356
6359
6360
6361
6367
6368
6376
6379
6380
6382
6383
6385
6386
6391
6392
6397
6398
6400
6401
6403 {
6408
6409 if (!
GetGame().IsDedicatedServer())
6410 {
6412 {
6414
6416 {
6418 }
6419 }
6420
6423 }
6424
6425 m_OldLocation = null;
6426
6428 {
6430 }
6431
6432 if (ConfigIsExisting("headSelectionsToHide"))
6433 {
6436 }
6437
6439 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6440 {
6442 }
6443
6445
6446 m_IsResultOfSplit = false;
6447
6449 }
6450
6452 {
6453 super.InitItemVariables();
6454
6460 m_Count = ConfigGetInt(
"count");
6461
6464
6469
6472
6477
6489
6493
6494
6497 if (ConfigIsExisting("canBeSplit"))
6498 {
6501 }
6502
6504 if (ConfigIsExisting("itemBehaviour"))
6506
6507
6510 RegisterNetSyncVariableInt("m_VarLiquidType");
6511 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6512
6513 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6514 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6515 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6516
6517 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6518 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6519 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6520 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6521
6522 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6523 RegisterNetSyncVariableBool("m_IsTakeable");
6524 RegisterNetSyncVariableBool("m_IsHologram");
6525
6528 {
6531 }
6532
6534
6536 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6538
6539 }
6540
6542 {
6544 }
6545
6547 {
6550 {
6555 }
6556 }
6557
6558 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6559 {
6561 {
6564 }
6565
6567 }
6568
6570 {
6576 }
6577
6579
6581 {
6583
6584 if (!action)
6585 {
6586 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6587 return;
6588 }
6589
6591 if (!ai)
6592 {
6594 return;
6595 }
6596
6598 if (!action_array)
6599 {
6600 action_array = new array<ActionBase_Basic>;
6602 }
6603 if (LogManager.IsActionLogEnable())
6604 {
6605 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6606 }
6607
6608 if (action_array.Find(action) != -1)
6609 {
6610 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6611 }
6612 else
6613 {
6614 action_array.Insert(action);
6615 }
6616 }
6617
6619 {
6621 ActionBase action = player.GetActionManager().GetAction(actionName);
6624
6625 if (action_array)
6626 {
6627 action_array.RemoveItem(action);
6628 }
6629 }
6630
6631
6632
6634 {
6635 ActionOverrideData overrideData = new ActionOverrideData();
6639
6641 if (!actionMap)
6642 {
6645 }
6646
6647 actionMap.Insert(this.
Type(), overrideData);
6648
6649 }
6650
6652
6654
6655
6657 {
6660
6663
6664 string config_to_search = "CfgVehicles";
6665 string muzzle_owner_config;
6666
6668 {
6669 if (IsInherited(Weapon))
6670 config_to_search = "CfgWeapons";
6671
6672 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6673
6674 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6675
6677
6678 if (config_OnFire_subclass_count > 0)
6679 {
6680 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6681
6682 for (int i = 0; i < config_OnFire_subclass_count; i++)
6683 {
6684 string particle_class = "";
6686 string config_OnFire_entry = config_OnFire_class + particle_class;
6687 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6688 WPOF_array.Insert(WPOF);
6689 }
6690
6691
6693 }
6694 }
6695
6697 {
6698 config_to_search = "CfgWeapons";
6699 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6700
6701 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6702
6704
6705 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6706 {
6707 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6708
6709 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6710 {
6711 string particle_class2 = "";
6713 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6714 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6715 WPOBE_array.Insert(WPOBE);
6716 }
6717
6718
6720 }
6721 }
6722 }
6723
6724
6726 {
6729
6731 {
6732 string config_to_search = "CfgVehicles";
6733
6734 if (IsInherited(Weapon))
6735 config_to_search = "CfgWeapons";
6736
6737 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6738 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6739
6740 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6741 {
6742
6744
6746 {
6748 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6750 return;
6751 }
6752
6755
6756
6757
6759 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6760
6761 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6762 {
6763 string particle_class = "";
6765 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6767
6768 if (entry_type == CT_CLASS)
6769 {
6770 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6771 WPOOH_array.Insert(WPOF);
6772 }
6773 }
6774
6775
6777 }
6778 }
6779 }
6780
6782 {
6784 }
6785
6787 {
6789 {
6791
6794
6797
6798 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6799 }
6800 }
6801
6803 {
6805 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6806
6808 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6809
6811 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6812
6814 {
6816 }
6817 }
6818
6820 {
6822 }
6823
6825 {
6828 else
6830
6832 {
6835 }
6836 else
6837 {
6840
6843 }
6844
6846 }
6847
6849 {
6851 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6852 }
6853
6855 {
6857 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6859 }
6860
6862 {
6864 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6865 }
6866
6868 {
6871
6872 OverheatingParticle OP = new OverheatingParticle();
6877
6879 }
6880
6882 {
6885
6886 return -1;
6887 }
6888
6890 {
6892 {
6895
6896 for (int i = count; i > 0; --i)
6897 {
6898 int id = i - 1;
6901
6904
6905 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6906 {
6907 if (p)
6908 {
6911 }
6912 }
6913 }
6914 }
6915 }
6916
6918 {
6920 {
6922 {
6923 int id = i - 1;
6925
6926 if (OP)
6927 {
6929
6930 if (p)
6931 {
6933 }
6934
6935 delete OP;
6936 }
6937 }
6938
6941 }
6942 }
6943
6946 {
6947 return 0.0;
6948 }
6949
6950
6952 {
6953 return 250;
6954 }
6955
6957 {
6958 return 0;
6959 }
6960
6963 {
6965 return true;
6966
6967 return false;
6968 }
6969
6972 {
6975
6977 {
6979 }
6980 else
6981 {
6982
6984 }
6985
6987 }
6988
6995 {
6996 return -1;
6997 }
6998
6999
7000
7001
7003 {
7005 {
7007 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7008
7009 if (r_index >= 0)
7010 {
7011 InventoryLocation r_il = new InventoryLocation;
7012 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7013
7014 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7017 {
7018 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7019 }
7021 {
7022 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7023 }
7024
7025 }
7026
7027 player.GetHumanInventory().ClearUserReservedLocation(this);
7028 }
7029
7032 }
7033
7034
7035
7036
7038 {
7039 return ItemBase.m_DebugActionsMask;
7040 }
7041
7043 {
7044 return ItemBase.m_DebugActionsMask & mask;
7045 }
7046
7048 {
7049 ItemBase.m_DebugActionsMask = mask;
7050 }
7051
7053 {
7054 ItemBase.m_DebugActionsMask |= mask;
7055 }
7056
7058 {
7059 ItemBase.m_DebugActionsMask &= ~mask;
7060 }
7061
7063 {
7065 {
7067 }
7068 else
7069 {
7071 }
7072 }
7073
7074
7076 {
7077 if (GetEconomyProfile())
7078 {
7079 float q_max = GetEconomyProfile().GetQuantityMax();
7080 if (q_max > 0)
7081 {
7082 float q_min = GetEconomyProfile().GetQuantityMin();
7083 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7084
7086 {
7087 ComponentEnergyManager comp = GetCompEM();
7089 {
7091 }
7092 }
7094 {
7096
7097 }
7098
7099 }
7100 }
7101 }
7102
7105 {
7106 EntityAI parent = GetHierarchyParent();
7107
7108 if (parent)
7109 {
7110 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7111 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7112 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7113 }
7114 }
7115
7118 {
7119 EntityAI parent = GetHierarchyParent();
7120
7121 if (parent)
7122 {
7123 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7124 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7125 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7126 }
7127 }
7128
7130 {
7131
7132
7133
7134
7136
7138 {
7139 if (ScriptInputUserData.CanStoreInputUserData())
7140 {
7141 ScriptInputUserData ctx = new ScriptInputUserData;
7147 ctx.
Write(use_stack_max);
7150
7152 {
7153 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7154 }
7155 }
7156 }
7157 else if (!
GetGame().IsMultiplayer())
7158 {
7160 }
7161 }
7162
7164 {
7166 }
7167
7169 {
7171 }
7172
7174 {
7176 }
7177
7179 {
7180
7181 return false;
7182 }
7183
7185 {
7186 return false;
7187 }
7188
7192 {
7193 return false;
7194 }
7195
7197 {
7198 return "";
7199 }
7200
7202
7204 {
7205 return false;
7206 }
7207
7209 {
7210 return true;
7211 }
7212
7213
7214
7216 {
7217 return true;
7218 }
7219
7221 {
7222 return true;
7223 }
7224
7226 {
7227 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7229 }
7230
7232 {
7234 }
7235
7237 {
7239 if (!is_being_placed)
7241 SetSynchDirty();
7242 }
7243
7244
7246
7248 {
7250 }
7251
7253 {
7255 }
7256
7258 {
7259 return 1;
7260 }
7261
7263 {
7264 return false;
7265 }
7266
7268 {
7270 SetSynchDirty();
7271 }
7272
7273
7274
7275
7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7290
7291
7292
7293
7294
7295
7296
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7308 {
7309 super.OnMovedInsideCargo(container);
7310
7311 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7312 }
7313
7314 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7315 {
7316 super.EEItemLocationChanged(oldLoc,newLoc);
7317
7318 PlayerBase new_player = null;
7319 PlayerBase old_player = null;
7320
7321 if (newLoc.GetParent())
7322 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7323
7324 if (oldLoc.GetParent())
7325 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7326
7328 {
7329 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
7330
7331 if (r_index >= 0)
7332 {
7333 InventoryLocation r_il = new InventoryLocation;
7334 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7335
7336 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7339 {
7340 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7341 }
7343 {
7344 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7345 }
7346
7347 }
7348 }
7349
7351 {
7352 if (new_player)
7353 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
7354
7355 if (new_player == old_player)
7356 {
7357
7358 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7359 {
7361 {
7362 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7363 {
7364 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7365 }
7366 }
7367 else
7368 {
7369 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7370 }
7371 }
7372
7373 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7374 {
7375 int type = oldLoc.GetType();
7377 {
7378 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7379 }
7381 {
7382 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7383 }
7384 }
7385 if (!m_OldLocation)
7386 {
7387 m_OldLocation = new InventoryLocation;
7388 }
7389 m_OldLocation.Copy(oldLoc);
7390 }
7391 else
7392 {
7393 if (m_OldLocation)
7394 {
7395 m_OldLocation.Reset();
7396 }
7397 }
7398
7400 }
7401 else
7402 {
7403 if (new_player)
7404 {
7405 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7406 if (res_index >= 0)
7407 {
7408 InventoryLocation il = new InventoryLocation;
7409 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
7411 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
7414 {
7415 il.
GetParent().GetOnReleaseLock().Invoke(it);
7416 }
7418 {
7420 }
7421
7422 }
7423 }
7425 {
7426
7428 }
7429
7430 if (m_OldLocation)
7431 {
7432 m_OldLocation.Reset();
7433 }
7434 }
7435 }
7436
7437 override void EOnContact(IEntity other, Contact extra)
7438 {
7440 {
7441 int liquidType = -1;
7443 if (impactSpeed > 0.0)
7444 {
7446 #ifndef SERVER
7448 #else
7450 SetSynchDirty();
7451 #endif
7453 }
7454 }
7455
7456 #ifdef SERVER
7457 if (GetCompEM() && GetCompEM().IsPlugged())
7458 {
7459 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7460 GetCompEM().UnplugThis();
7461 }
7462 #endif
7463 }
7464
7466
7468 {
7470 }
7471
7473 {
7474
7475 }
7476
7478 {
7479 super.OnItemLocationChanged(old_owner, new_owner);
7480
7481 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7482 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7483
7484 if (!relatedPlayer && playerNew)
7485 relatedPlayer = playerNew;
7486
7487 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7488 {
7490 if (actionMgr)
7491 {
7492 ActionBase currentAction = actionMgr.GetRunningAction();
7493 if (currentAction)
7495 }
7496 }
7497
7498 Man ownerPlayerOld = null;
7499 Man ownerPlayerNew = null;
7500
7501 if (old_owner)
7502 {
7503 if (old_owner.
IsMan())
7504 {
7505 ownerPlayerOld = Man.Cast(old_owner);
7506 }
7507 else
7508 {
7509 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7510 }
7511 }
7512 else
7513 {
7515 {
7517
7518 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7519 {
7520 GetCompEM().UnplugThis();
7521 }
7522 }
7523 }
7524
7525 if (new_owner)
7526 {
7527 if (new_owner.
IsMan())
7528 {
7529 ownerPlayerNew = Man.Cast(new_owner);
7530 }
7531 else
7532 {
7533 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7534 }
7535 }
7536
7537 if (ownerPlayerOld != ownerPlayerNew)
7538 {
7539 if (ownerPlayerOld)
7540 {
7541 array<EntityAI> subItemsExit = new array<EntityAI>;
7543 for (int i = 0; i < subItemsExit.Count(); i++)
7544 {
7547 }
7548 }
7549
7550 if (ownerPlayerNew)
7551 {
7552 array<EntityAI> subItemsEnter = new array<EntityAI>;
7554 for (int j = 0; j < subItemsEnter.Count(); j++)
7555 {
7558 }
7559 }
7560 }
7561 else if (ownerPlayerNew != null)
7562 {
7563 PlayerBase nplayer;
7564 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7565 {
7566 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7568 for (int k = 0; k < subItemsUpdate.Count(); k++)
7569 {
7571 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7572 }
7573 }
7574 }
7575
7576 if (old_owner)
7577 old_owner.OnChildItemRemoved(this);
7578 if (new_owner)
7579 new_owner.OnChildItemReceived(this);
7580 }
7581
7582
7584 {
7585 super.EEDelete(parent);
7586 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7587 if (player)
7588 {
7590
7591 if (player.IsAlive())
7592 {
7593 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7594 if (r_index >= 0)
7595 {
7596 InventoryLocation r_il = new InventoryLocation;
7597 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7598
7599 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7602 {
7603 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7604 }
7606 {
7607 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7608 }
7609
7610 }
7611
7612 player.RemoveQuickBarEntityShortcut(this);
7613 }
7614 }
7615 }
7616
7618 {
7619 super.EEKilled(killer);
7620
7623 {
7624 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7625 {
7626 if (IsMagazine())
7627 {
7628 if (Magazine.Cast(this).GetAmmoCount() > 0)
7629 {
7631 }
7632 }
7633 else
7634 {
7636 }
7637 }
7638 }
7639 }
7640
7642 {
7643 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7644
7645 super.OnWasAttached(parent, slot_id);
7646
7649
7651 }
7652
7654 {
7655 super.OnWasDetached(parent, slot_id);
7656
7659 }
7660
7662 {
7663 int idx;
7666
7667 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7668 if (inventory_slots.Count() < 1)
7669 {
7670 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7671 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7672 }
7673 else
7674 {
7675 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7676 }
7677
7678 idx = inventory_slots.Find(slot);
7679 if (idx < 0)
7680 return "";
7681
7682 return attach_types.Get(idx);
7683 }
7684
7686 {
7687 int idx = -1;
7688 string slot;
7689
7692
7693 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7694 if (inventory_slots.Count() < 1)
7695 {
7696 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7697 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7698 }
7699 else
7700 {
7701 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7702 if (detach_types.Count() < 1)
7703 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7704 }
7705
7706 for (int i = 0; i < inventory_slots.Count(); i++)
7707 {
7708 slot = inventory_slots.Get(i);
7709 }
7710
7711 if (slot != "")
7712 {
7713 if (detach_types.Count() == 1)
7714 idx = 0;
7715 else
7716 idx = inventory_slots.Find(slot);
7717 }
7718 if (idx < 0)
7719 return "";
7720
7721 return detach_types.Get(idx);
7722 }
7723
7725 {
7726
7728
7729
7730 float min_time = 1;
7731 float max_time = 3;
7732 float delay = Math.RandomFloat(min_time, max_time);
7733
7734 explode_timer.Run(delay, this, "DoAmmoExplosion");
7735 }
7736
7738 {
7739 Magazine magazine = Magazine.Cast(this);
7740 int pop_sounds_count = 6;
7741 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7742
7743
7744 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7745 string sound_name = pop_sounds[ sound_idx ];
7747
7748
7749 magazine.ServerAddAmmoCount(-1);
7750
7751
7752 float min_temp_to_explode = 100;
7753
7754 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7755 {
7757 }
7758 }
7759
7760
7761 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7762 {
7763 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7764
7765 const int CHANCE_DAMAGE_CARGO = 4;
7766 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7767 const int CHANCE_DAMAGE_NOTHING = 2;
7768
7770 {
7771 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7772 int chances;
7773 int rnd;
7774
7775 if (GetInventory().GetCargo())
7776 {
7777 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7778 rnd = Math.RandomInt(0,chances);
7779
7780 if (rnd < CHANCE_DAMAGE_CARGO)
7781 {
7783 }
7784 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7785 {
7787 }
7788 }
7789 else
7790 {
7791 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7792 rnd = Math.RandomInt(0,chances);
7793
7794 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7795 {
7797 }
7798 }
7799 }
7800 }
7801
7803 {
7804 if (GetInventory().GetCargo())
7805 {
7806 int item_count = GetInventory().GetCargo().GetItemCount();
7807 if (item_count > 0)
7808 {
7809 int random_pick = Math.RandomInt(0, item_count);
7811 if (!item.IsExplosive())
7812 {
7813 item.AddHealth("","",damage);
7814 return true;
7815 }
7816 }
7817 }
7818 return false;
7819 }
7820
7822 {
7823 int attachment_count = GetInventory().AttachmentCount();
7824 if (attachment_count > 0)
7825 {
7826 int random_pick = Math.RandomInt(0, attachment_count);
7827 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7828 if (!attachment.IsExplosive())
7829 {
7830 attachment.AddHealth("","",damage);
7831 return true;
7832 }
7833 }
7834 return false;
7835 }
7836
7838 {
7840 }
7841
7843 {
7845 return GetInventory().CanRemoveEntity();
7846
7847 return false;
7848 }
7849
7851 {
7852
7854 return false;
7855
7856
7858 return false;
7859
7860
7861
7863 if (delta == 0)
7864 return false;
7865
7866
7867 return true;
7868 }
7869
7871 {
7873 {
7874 if (ScriptInputUserData.CanStoreInputUserData())
7875 {
7876 ScriptInputUserData ctx = new ScriptInputUserData;
7881 ctx.
Write(destination_entity);
7885 }
7886 }
7887 else if (!
GetGame().IsMultiplayer())
7888 {
7890 }
7891 }
7892
7894 {
7895 float split_quantity_new;
7899 InventoryLocation loc = new InventoryLocation;
7900
7901 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7902 {
7904 split_quantity_new = stack_max;
7905 else
7907
7909 {
7910 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
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 if (destination_entity && slot_id == -1)
7921 {
7922 if (quantity > stack_max)
7923 split_quantity_new = stack_max;
7924 else
7925 split_quantity_new = quantity;
7926
7928 {
7930 {
7933 }
7934
7935 if (new_item)
7936 {
7937 new_item.SetResultOfSplit(true);
7938 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7940 new_item.
SetQuantity(split_quantity_new,
false,
true);
7941 }
7942 }
7943 }
7944 else
7945 {
7946 if (stack_max != 0)
7947 {
7949 {
7951 }
7952
7953 if (split_quantity_new == 0)
7954 {
7955 if (!
GetGame().IsMultiplayer())
7956 player.PhysicalPredictiveDropItem(this);
7957 else
7958 player.ServerDropEntity(this);
7959 return;
7960 }
7961
7963 {
7965
7966 if (new_item)
7967 {
7968 new_item.SetResultOfSplit(true);
7969 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7972 new_item.PlaceOnSurface();
7973 }
7974 }
7975 }
7976 }
7977 }
7978
7980 {
7981 float split_quantity_new;
7985 InventoryLocation loc = new InventoryLocation;
7986
7987 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7988 {
7990 split_quantity_new = stack_max;
7991 else
7993
7995 {
7996 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
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 if (destination_entity && slot_id == -1)
8007 {
8008 if (quantity > stack_max)
8009 split_quantity_new = stack_max;
8010 else
8011 split_quantity_new = quantity;
8012
8014 {
8016 {
8019 }
8020
8021 if (new_item)
8022 {
8023 new_item.SetResultOfSplit(true);
8024 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8026 new_item.
SetQuantity(split_quantity_new,
false,
true);
8027 }
8028 }
8029 }
8030 else
8031 {
8032 if (stack_max != 0)
8033 {
8035 {
8037 }
8038
8040 {
8042
8043 if (new_item)
8044 {
8045 new_item.SetResultOfSplit(true);
8046 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8049 new_item.PlaceOnSurface();
8050 }
8051 }
8052 }
8053 }
8054 }
8055
8057 {
8059 {
8060 if (ScriptInputUserData.CanStoreInputUserData())
8061 {
8062 ScriptInputUserData ctx = new ScriptInputUserData;
8067 dst.WriteToContext(ctx);
8069 }
8070 }
8071 else if (!
GetGame().IsMultiplayer())
8072 {
8074 }
8075 }
8076
8078 {
8080 {
8081 if (ScriptInputUserData.CanStoreInputUserData())
8082 {
8083 ScriptInputUserData ctx = new ScriptInputUserData;
8088 ctx.
Write(destination_entity);
8094 }
8095 }
8096 else if (!
GetGame().IsMultiplayer())
8097 {
8099 }
8100 }
8101
8103 {
8105 }
8106
8108 {
8110 float split_quantity_new;
8112 if (dst.IsValid())
8113 {
8114 int slot_id = dst.GetSlot();
8116
8117 if (quantity > stack_max)
8118 split_quantity_new = stack_max;
8119 else
8120 split_quantity_new = quantity;
8121
8123 {
8125
8126 if (new_item)
8127 {
8128 new_item.SetResultOfSplit(true);
8129 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8131 new_item.
SetQuantity(split_quantity_new,
false,
true);
8132 }
8133
8134 return new_item;
8135 }
8136 }
8137
8138 return null;
8139 }
8140
8142 {
8144 float split_quantity_new;
8146 if (destination_entity)
8147 {
8149 if (quantity > stackable)
8150 split_quantity_new = stackable;
8151 else
8152 split_quantity_new = quantity;
8153
8155 {
8156 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8157 if (new_item)
8158 {
8159 new_item.SetResultOfSplit(true);
8160 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8162 new_item.
SetQuantity(split_quantity_new,
false,
true);
8163 }
8164 }
8165 }
8166 }
8167
8169 {
8171 {
8172 if (ScriptInputUserData.CanStoreInputUserData())
8173 {
8174 ScriptInputUserData ctx = new ScriptInputUserData;
8179 ItemBase destination_entity =
this;
8180 ctx.
Write(destination_entity);
8184 }
8185 }
8186 else if (!
GetGame().IsMultiplayer())
8187 {
8189 }
8190 }
8191
8193 {
8195 float split_quantity_new;
8197 if (player)
8198 {
8200 if (quantity > stackable)
8201 split_quantity_new = stackable;
8202 else
8203 split_quantity_new = quantity;
8204
8206 {
8207 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8208 new_item =
ItemBase.Cast(in_hands);
8209 if (new_item)
8210 {
8211 new_item.SetResultOfSplit(true);
8212 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8214 new_item.SetQuantity(split_quantity_new, false, true);
8215 }
8216 }
8217 }
8218 }
8219
8221 {
8223 float split_quantity_new = Math.Floor(quantity * 0.5);
8224
8226 return;
8227
8229
8230 if (new_item)
8231 {
8232 if (new_item.GetQuantityMax() < split_quantity_new)
8233 {
8234 split_quantity_new = new_item.GetQuantityMax();
8235 }
8236
8237 new_item.SetResultOfSplit(true);
8238 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8239
8241 {
8244 }
8245 else
8246 {
8248 new_item.
SetQuantity(split_quantity_new,
false,
true);
8249 }
8250 }
8251 }
8252
8254 {
8256 float split_quantity_new = Math.Floor(quantity / 2);
8257
8259 return;
8260
8261 InventoryLocation invloc = new InventoryLocation;
8263
8265 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8266
8267 if (new_item)
8268 {
8269 if (new_item.GetQuantityMax() < split_quantity_new)
8270 {
8271 split_quantity_new = new_item.GetQuantityMax();
8272 }
8274 {
8277 }
8278 else if (split_quantity_new > 1)
8279 {
8281 new_item.
SetQuantity(split_quantity_new,
false,
true);
8282 }
8283 }
8284 }
8285
8288 {
8289 SetWeightDirty();
8291
8292 if (parent)
8293 parent.OnAttachmentQuantityChangedEx(this, delta);
8294
8296 {
8298 {
8300 }
8302 {
8303 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8305 }
8306 }
8307
8308 }
8309
8312 {
8313
8314 }
8315
8318 {
8320 }
8321
8323 {
8324 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8325
8327 {
8328 if (newLevel == GameConstants.STATE_RUINED)
8329 {
8331 EntityAI parent = GetHierarchyParent();
8332 if (parent && parent.IsFireplace())
8333 {
8334 CargoBase cargo = GetInventory().GetCargo();
8335 if (cargo)
8336 {
8338 {
8340 }
8341 }
8342 }
8343 }
8344
8346 {
8347
8349 return;
8350 }
8351
8352 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8353 {
8355 }
8356 }
8357 }
8358
8359
8361 {
8362 super.OnRightClick();
8363
8365 {
8367 {
8368 if (ScriptInputUserData.CanStoreInputUserData())
8369 {
8370 EntityAI root = GetHierarchyRoot();
8371 Man playerOwner = GetHierarchyRootPlayer();
8372 InventoryLocation dst = new InventoryLocation;
8373
8374
8375 if (!playerOwner && root && root == this)
8376 {
8378 }
8379 else
8380 {
8381
8382 GetInventory().GetCurrentInventoryLocation(dst);
8384 {
8387 {
8389 }
8390 else
8391 {
8393
8394
8395 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8396 {
8398 }
8399 else
8400 {
8401 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8402 }
8403 }
8404 }
8405 }
8406
8407 ScriptInputUserData ctx = new ScriptInputUserData;
8415 }
8416 }
8417 else if (!
GetGame().IsMultiplayer())
8418 {
8420 }
8421 }
8422 }
8423
8425 {
8426 if (root)
8427 {
8428 vector m4[4];
8429 root.GetTransform(m4);
8430 dst.SetGround(this, m4);
8431 }
8432 else
8433 {
8434 GetInventory().GetCurrentInventoryLocation(dst);
8435 }
8436 }
8437
8438 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8439 {
8440
8441 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8442 return false;
8443
8444 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8445 return false;
8446
8447
8449 return false;
8450
8451
8452 Magazine mag = Magazine.Cast(this);
8453 if (mag)
8454 {
8455 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8456 return false;
8457
8458 if (stack_max_limit)
8459 {
8460 Magazine other_mag = Magazine.Cast(other_item);
8461 if (other_item)
8462 {
8463 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8464 return false;
8465 }
8466
8467 }
8468 }
8469 else
8470 {
8471
8473 return false;
8474
8476 return false;
8477 }
8478
8479 PlayerBase player = null;
8480 if (CastTo(player, GetHierarchyRootPlayer()))
8481 {
8482 if (player.GetInventory().HasAttachment(this))
8483 return false;
8484
8485 if (player.IsItemsToDelete())
8486 return false;
8487 }
8488
8489 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8490 return false;
8491
8492 int slotID;
8494 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8495 return false;
8496
8497 return true;
8498 }
8499
8501 {
8503 }
8504
8506 {
8507 return m_IsResultOfSplit;
8508 }
8509
8511 {
8512 m_IsResultOfSplit = value;
8513 }
8514
8516 {
8518 }
8519
8521 {
8522 float other_item_quantity = other_item.GetQuantity();
8523 float this_free_space;
8524
8526
8528
8529 if (other_item_quantity > this_free_space)
8530 {
8531 return this_free_space;
8532 }
8533 else
8534 {
8535 return other_item_quantity;
8536 }
8537 }
8538
8540 {
8542 }
8543
8545 {
8547 return;
8548
8549 if (!IsMagazine() && other_item)
8550 {
8552 if (quantity_used != 0)
8553 {
8554 float hp1 = GetHealth01("","");
8555 float hp2 = other_item.GetHealth01("","");
8556 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8557 hpResult = hpResult / (
GetQuantity() + quantity_used);
8558
8559 hpResult *= GetMaxHealth();
8560 Math.Round(hpResult);
8561 SetHealth("", "Health", hpResult);
8562
8564 other_item.AddQuantity(-quantity_used);
8565 }
8566 }
8568 }
8569
8571 {
8572 #ifdef SERVER
8573 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8574 GetHierarchyParent().IncreaseLifetimeUp();
8575 #endif
8576 };
8577
8579 {
8580 PlayerBase p = PlayerBase.Cast(player);
8581
8582 array<int> recipesIds = p.m_Recipes;
8583 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8584 if (moduleRecipesManager)
8585 {
8586 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8587 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8588 }
8589
8590 for (int i = 0;i < recipesIds.Count(); i++)
8591 {
8592 int key = recipesIds.Get(i);
8593 string recipeName = moduleRecipesManager.GetRecipeName(key);
8595 }
8596 }
8597
8598
8599 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8600 {
8601 super.GetDebugActions(outputList);
8602
8603
8609
8610
8615
8620
8621
8625
8626
8628 {
8632 }
8633
8636
8637
8641
8643
8644 InventoryLocation loc = new InventoryLocation();
8645 GetInventory().GetCurrentInventoryLocation(loc);
8647 {
8648 if (Gizmo_IsSupported())
8651 }
8652
8654 }
8655
8656
8657
8658
8660 {
8661 super.OnAction(action_id, player, ctx);
8662
8664 {
8665 switch (action_id)
8666 {
8669 return true;
8672 return true;
8673 }
8674 }
8675
8677 {
8678 switch (action_id)
8679 {
8681 Delete();
8682 return true;
8683 }
8684 }
8685
8686 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8687 {
8688 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8689 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8690 PlayerBase p = PlayerBase.Cast(player);
8691 if (
EActions.RECIPES_RANGE_START < 1000)
8692 {
8693 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8694 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8695 }
8696 }
8697 #ifndef SERVER
8698 else if (action_id ==
EActions.WATCH_PLAYER)
8699 {
8700 PluginDeveloper.SetDeveloperItemClientEx(player);
8701 }
8702 #endif
8704 {
8705 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8706 {
8707 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8708 OnDebugButtonPressServer(id + 1);
8709 }
8710
8711 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8712 {
8713 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8715 }
8716
8717 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8718 {
8719 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8721 }
8722
8723 else if (action_id ==
EActions.ADD_QUANTITY)
8724 {
8725 if (IsMagazine())
8726 {
8727 Magazine mag = Magazine.Cast(this);
8728 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8729 }
8730 else
8731 {
8733 }
8734
8735 if (m_EM)
8736 {
8737 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8738 }
8739
8740 }
8741
8742 else if (action_id ==
EActions.REMOVE_QUANTITY)
8743 {
8744 if (IsMagazine())
8745 {
8746 Magazine mag2 = Magazine.Cast(this);
8747 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8748 }
8749 else
8750 {
8752 }
8753 if (m_EM)
8754 {
8755 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8756 }
8757
8758 }
8759
8760 else if (action_id ==
EActions.SET_QUANTITY_0)
8761 {
8763
8764 if (m_EM)
8765 {
8766 m_EM.SetEnergy(0);
8767 }
8768 }
8769
8770 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8771 {
8773
8774 if (m_EM)
8775 {
8776 m_EM.SetEnergy(m_EM.GetEnergyMax());
8777 }
8778 }
8779
8780 else if (action_id ==
EActions.ADD_HEALTH)
8781 {
8782 AddHealth("","",GetMaxHealth("","Health")/5);
8783 }
8784 else if (action_id ==
EActions.REMOVE_HEALTH)
8785 {
8786 AddHealth("","",-GetMaxHealth("","Health")/5);
8787 }
8788 else if (action_id ==
EActions.DESTROY_HEALTH)
8789 {
8790 SetHealth01("","",0);
8791 }
8792 else if (action_id ==
EActions.WATCH_ITEM)
8793 {
8795 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8796 #ifdef DEVELOPER
8797 SetDebugDeveloper_item(this);
8798 #endif
8799 }
8800
8801 else if (action_id ==
EActions.ADD_TEMPERATURE)
8802 {
8803 AddTemperature(20);
8804
8805 }
8806
8807 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8808 {
8809 AddTemperature(-20);
8810
8811 }
8812
8813 else if (action_id ==
EActions.FLIP_FROZEN)
8814 {
8815 SetFrozen(!GetIsFrozen());
8816
8817 }
8818
8819 else if (action_id ==
EActions.ADD_WETNESS)
8820 {
8822
8823 }
8824
8825 else if (action_id ==
EActions.REMOVE_WETNESS)
8826 {
8828
8829 }
8830
8831 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8832 {
8835
8836
8837 }
8838
8839 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8840 {
8843 }
8844
8845 else if (action_id ==
EActions.MAKE_SPECIAL)
8846 {
8847 auto debugParams = DebugSpawnParams.WithPlayer(player);
8848 OnDebugSpawnEx(debugParams);
8849 }
8850
8851 }
8852
8853
8854 return false;
8855 }
8856
8857
8858
8859
8863
8866
8867
8868
8870 {
8871 return false;
8872 }
8873
8874
8876 {
8877 return true;
8878 }
8879
8880
8882 {
8883 return true;
8884 }
8885
8886
8887
8889 {
8890 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8892 }
8893
8896 {
8897 return null;
8898 }
8899
8901 {
8902 return false;
8903 }
8904
8906 {
8907 return false;
8908 }
8909
8913
8914
8916 {
8917 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8918 return module_repairing.CanRepair(this, item_repair_kit);
8919 }
8920
8921
8922 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8923 {
8924 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8925 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8926 }
8927
8928
8930 {
8931
8932
8933
8934
8935
8936
8937
8938
8939 return 1;
8940 }
8941
8942
8943
8945 {
8947 }
8948
8949
8950
8952 {
8954 }
8955
8956
8965 {
8966 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8967
8968 if (player)
8969 {
8970 player.MessageStatus(text);
8971 }
8972 }
8973
8974
8983 {
8984 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8985
8986 if (player)
8987 {
8988 player.MessageAction(text);
8989 }
8990 }
8991
8992
9001 {
9002 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9003
9004 if (player)
9005 {
9006 player.MessageFriendly(text);
9007 }
9008 }
9009
9010
9019 {
9020 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9021
9022 if (player)
9023 {
9024 player.MessageImportant(text);
9025 }
9026 }
9027
9029 {
9030 return true;
9031 }
9032
9033
9034 override bool KindOf(
string tag)
9035 {
9036 bool found = false;
9037 string item_name = this.
GetType();
9040
9041 int array_size = item_tag_array.Count();
9042 for (int i = 0; i < array_size; i++)
9043 {
9044 if (item_tag_array.Get(i) == tag)
9045 {
9046 found = true;
9047 break;
9048 }
9049 }
9050 return found;
9051 }
9052
9053
9055 {
9056
9057 super.OnRPC(sender, rpc_type,ctx);
9058
9059
9060 switch (rpc_type)
9061 {
9062 #ifndef SERVER
9063 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9064 Param2<bool, string> p = new Param2<bool, string>(false, "");
9065
9067 return;
9068
9069 bool play = p.param1;
9070 string soundSet = p.param2;
9071
9072 if (play)
9073 {
9075 {
9077 {
9079 }
9080 }
9081 else
9082 {
9084 }
9085 }
9086 else
9087 {
9089 }
9090
9091 break;
9092 #endif
9093
9094 }
9095
9097 {
9099 }
9100 }
9101
9102
9103
9104
9106 {
9107 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9108 return plugin.GetID(
name);
9109 }
9110
9112 {
9113 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9114 return plugin.GetName(id);
9115 }
9116
9119 {
9120
9121
9122 int varFlags;
9123 if (!ctx.
Read(varFlags))
9124 return;
9125
9126 if (varFlags & ItemVariableFlags.FLOAT)
9127 {
9129 }
9130 }
9131
9133 {
9134
9135 super.SerializeNumericalVars(floats_out);
9136
9137
9138
9140 {
9142 }
9143
9145 {
9147 }
9148
9150 {
9152 }
9153
9155 {
9160 }
9161
9163 {
9165 }
9166 }
9167
9169 {
9170
9171 super.DeSerializeNumericalVars(floats);
9172
9173
9174 int index = 0;
9175 int mask = Math.Round(floats.Get(index));
9176
9177 index++;
9178
9180 {
9182 {
9184 }
9185 else
9186 {
9187 float quantity = floats.Get(index);
9189 }
9190 index++;
9191 }
9192
9194 {
9195 float wet = floats.Get(index);
9197 index++;
9198 }
9199
9201 {
9202 int liquidtype = Math.Round(floats.Get(index));
9204 index++;
9205 }
9206
9208 {
9210 index++;
9212 index++;
9214 index++;
9216 index++;
9217 }
9218
9220 {
9221 int cleanness = Math.Round(floats.Get(index));
9223 index++;
9224 }
9225 }
9226
9228 {
9229 super.WriteVarsToCTX(ctx);
9230
9231
9233 {
9235 }
9236
9238 {
9240 }
9241
9243 {
9245 }
9246
9248 {
9249 int r,g,b,a;
9255 }
9256
9258 {
9260 }
9261 }
9262
9264 {
9265 if (!super.ReadVarsFromCTX(ctx,version))
9266 return false;
9267
9268 int intValue;
9269 float value;
9270
9271 if (version < 140)
9272 {
9273 if (!ctx.
Read(intValue))
9274 return false;
9275
9276 m_VariablesMask = intValue;
9277 }
9278
9280 {
9281 if (!ctx.
Read(value))
9282 return false;
9283
9285 {
9287 }
9288 else
9289 {
9291 }
9292 }
9293
9294 if (version < 140)
9295 {
9297 {
9298 if (!ctx.
Read(value))
9299 return false;
9300 SetTemperatureDirect(value);
9301 }
9302 }
9303
9305 {
9306 if (!ctx.
Read(value))
9307 return false;
9309 }
9310
9312 {
9313 if (!ctx.
Read(intValue))
9314 return false;
9316 }
9317
9319 {
9320 int r,g,b,a;
9322 return false;
9324 return false;
9326 return false;
9328 return false;
9329
9331 }
9332
9334 {
9335 if (!ctx.
Read(intValue))
9336 return false;
9338 }
9339
9340 if (version >= 138 && version < 140)
9341 {
9343 {
9344 if (!ctx.
Read(intValue))
9345 return false;
9346 SetFrozen(intValue);
9347 }
9348 }
9349
9350 return true;
9351 }
9352
9353
9355 {
9358 {
9360 }
9361
9362 if (!super.OnStoreLoad(ctx, version))
9363 {
9365 return false;
9366 }
9367
9368 if (version >= 114)
9369 {
9370 bool hasQuickBarIndexSaved;
9371
9372 if (!ctx.
Read(hasQuickBarIndexSaved))
9373 {
9375 return false;
9376 }
9377
9378 if (hasQuickBarIndexSaved)
9379 {
9380 int itmQBIndex;
9381
9382
9383 if (!ctx.
Read(itmQBIndex))
9384 {
9386 return false;
9387 }
9388
9389 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9390 if (itmQBIndex != -1 && parentPlayer)
9391 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9392 }
9393 }
9394 else
9395 {
9396
9397 PlayerBase player;
9398 int itemQBIndex;
9399 if (version ==
int.
MAX)
9400 {
9401 if (!ctx.
Read(itemQBIndex))
9402 {
9404 return false;
9405 }
9406 }
9407 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9408 {
9409
9410 if (!ctx.
Read(itemQBIndex))
9411 {
9413 return false;
9414 }
9415 if (itemQBIndex != -1 && player)
9416 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9417 }
9418 }
9419
9420 if (version < 140)
9421 {
9422
9423 if (!LoadVariables(ctx, version))
9424 {
9426 return false;
9427 }
9428 }
9429
9430
9432 {
9434 return false;
9435 }
9436 if (version >= 132)
9437 {
9439 if (raib)
9440 {
9442 {
9444 return false;
9445 }
9446 }
9447 }
9448
9450 return true;
9451 }
9452
9453
9454
9456 {
9457 super.OnStoreSave(ctx);
9458
9459 PlayerBase player;
9460 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9461 {
9463
9464 int itemQBIndex = -1;
9465 itemQBIndex = player.FindQuickBarEntityIndex(this);
9466 ctx.
Write(itemQBIndex);
9467 }
9468 else
9469 {
9471 }
9472
9474
9476 if (raib)
9477 {
9479 }
9480 }
9481
9482
9484 {
9485 super.AfterStoreLoad();
9486
9488 {
9490 }
9491
9493 {
9496 }
9497 }
9498
9500 {
9501 super.EEOnAfterLoad();
9502
9504 {
9506 }
9507
9510 }
9511
9513 {
9514 return false;
9515 }
9516
9517
9518
9520 {
9522 {
9523 #ifdef PLATFORM_CONSOLE
9524
9526 {
9528 if (menu)
9529 {
9531 }
9532 }
9533 #endif
9534 }
9535
9537 {
9540 }
9541
9543 {
9544 SetWeightDirty();
9546 }
9548 {
9551 }
9552
9554 {
9557 }
9559 {
9562 }
9563
9564 super.OnVariablesSynchronized();
9565 }
9566
9567
9568
9570 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9571 {
9572 if (!IsServerCheck(allow_client))
9573 return false;
9574
9576 return false;
9577
9580
9581 if (value <= (min + 0.001))
9582 value = min;
9583
9584 if (value == min)
9585 {
9586 if (destroy_config)
9587 {
9588 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9589 if (dstr)
9590 {
9592 this.Delete();
9593 return true;
9594 }
9595 }
9596 else if (destroy_forced)
9597 {
9599 this.Delete();
9600 return true;
9601 }
9602
9604 }
9605
9608
9610 {
9612
9613 if (delta)
9615 }
9616
9618
9619 return false;
9620 }
9621
9622
9624 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9625 {
9627 }
9628
9630 {
9633 }
9634
9636 {
9639 }
9640
9642 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9643 {
9644 float value_clamped = Math.Clamp(value, 0, 1);
9646 SetQuantity(result, destroy_config, destroy_forced);
9647 }
9648
9649
9652 {
9654 }
9655
9657 {
9659 }
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9671 {
9672 int slot = -1;
9673 if (GetInventory())
9674 {
9675 InventoryLocation il = new InventoryLocation;
9676 GetInventory().GetCurrentInventoryLocation(il);
9678 }
9679
9681 }
9682
9684 {
9685 float quantity_max = 0;
9686
9688 {
9689 if (attSlotID != -1)
9690 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9691
9692 if (quantity_max <= 0)
9694 }
9695
9696 if (quantity_max <= 0)
9698
9699 return quantity_max;
9700 }
9701
9703 {
9705 }
9706
9708 {
9710 }
9711
9712
9714 {
9716 }
9717
9719 {
9721 }
9722
9724 {
9726 }
9727
9728
9730 {
9731
9732 float weightEx = GetWeightEx();
9733 float special = GetInventoryAndCargoWeight();
9734 return weightEx - special;
9735 }
9736
9737
9739 {
9741 }
9742
9744 {
9746 {
9747 #ifdef DEVELOPER
9748 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9749 {
9750 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9752 }
9753 #endif
9754
9756 }
9757 else if (HasEnergyManager())
9758 {
9759 #ifdef DEVELOPER
9760 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9761 {
9762 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9763 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9764 }
9765 #endif
9766 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9767 }
9768 else
9769 {
9770 #ifdef DEVELOPER
9771 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9772 {
9773 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9774 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9775 }
9776 #endif
9777 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9778 }
9779 }
9780
9783 {
9784 int item_count = 0;
9786
9787 if (GetInventory().GetCargo() != NULL)
9788 {
9789 item_count = GetInventory().GetCargo().GetItemCount();
9790 }
9791
9792 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9793 {
9794 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9795 if (item)
9796 item_count += item.GetNumberOfItems();
9797 }
9798 return item_count;
9799 }
9800
9803 {
9804 float weight = 0;
9805 float wetness = 1;
9806 if (include_wetness)
9809 {
9810 weight = wetness * m_ConfigWeight;
9811 }
9813 {
9814 weight = 1;
9815 }
9816 return weight;
9817 }
9818
9819
9820
9822 {
9823 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9824 {
9825 GameInventory inv = GetInventory();
9826 array<EntityAI> items = new array<EntityAI>;
9828 for (int i = 0; i < items.Count(); i++)
9829 {
9831 if (item)
9832 {
9834 }
9835 }
9836 }
9837 }
9838
9839
9840
9841
9843 {
9844 float energy = 0;
9845 if (HasEnergyManager())
9846 {
9847 energy = GetCompEM().GetEnergy();
9848 }
9849 return energy;
9850 }
9851
9852
9854 {
9855 super.OnEnergyConsumed();
9856
9858 }
9859
9861 {
9862 super.OnEnergyAdded();
9863
9865 }
9866
9867
9869 {
9870 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9871 {
9873 {
9874 float energy_0to1 = GetCompEM().GetEnergy0To1();
9876 }
9877 }
9878 }
9879
9880
9882 {
9883 return ConfigGetFloat("heatIsolation");
9884 }
9885
9887 {
9889 }
9890
9892 {
9893 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9894 if (
GetGame().ConfigIsExisting(paramPath))
9896
9897 return 0.0;
9898 }
9899
9901 {
9902 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9903 if (
GetGame().ConfigIsExisting(paramPath))
9905
9906 return 0.0;
9907 }
9908
9909 override void SetWet(
float value,
bool allow_client =
false)
9910 {
9911 if (!IsServerCheck(allow_client))
9912 return;
9913
9916
9918
9919 m_VarWet = Math.Clamp(value, min, max);
9920
9922 {
9925 }
9926 }
9927
9928 override void AddWet(
float value)
9929 {
9931 }
9932
9934 {
9936 }
9937
9939 {
9941 }
9942
9944 {
9946 }
9947
9949 {
9951 }
9952
9954 {
9956 }
9957
9959 {
9962 if (newLevel != oldLevel)
9963 {
9965 }
9966 }
9967
9969 {
9970 SetWeightDirty();
9971 }
9972
9974 {
9975 return GetWetLevelInternal(
m_VarWet);
9976 }
9977
9978
9979
9981 {
9983 }
9984
9986 {
9988 }
9989
9991 {
9993 }
9994
9996 {
9998 }
9999
10000
10001
10003 {
10004 if (ConfigIsExisting("itemModelLength"))
10005 {
10006 return ConfigGetFloat("itemModelLength");
10007 }
10008 return 0;
10009 }
10010
10012 {
10013 if (ConfigIsExisting("itemAttachOffset"))
10014 {
10015 return ConfigGetFloat("itemAttachOffset");
10016 }
10017 return 0;
10018 }
10019
10020 override void SetCleanness(
int value,
bool allow_client =
false)
10021 {
10022 if (!IsServerCheck(allow_client))
10023 return;
10024
10026
10028
10031 }
10032
10034 {
10036 }
10037
10039 {
10040 return true;
10041 }
10042
10043
10044
10045
10047 {
10049 }
10050
10052 {
10054 }
10055
10056
10057
10058
10059 override void SetColor(
int r,
int g,
int b,
int a)
10060 {
10066 }
10068 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10069 {
10074 }
10075
10077 {
10079 }
10080
10083 {
10084 int r,g,b,a;
10086 r = r/255;
10087 g = g/255;
10088 b = b/255;
10089 a = a/255;
10090 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10091 }
10092
10093
10094
10095 override void SetLiquidType(
int value,
bool allow_client =
false)
10096 {
10097 if (!IsServerCheck(allow_client))
10098 return;
10099
10104 }
10105
10107 {
10108 return ConfigGetInt("varLiquidTypeInit");
10109 }
10110
10112 {
10114 }
10115
10117 {
10119 SetFrozen(false);
10120 }
10121
10124 {
10125 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10126 }
10127
10128
10131 {
10132 PlayerBase nplayer;
10133 if (PlayerBase.CastTo(nplayer, player))
10134 {
10136
10137 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10138 }
10139 }
10140
10141
10144 {
10145 PlayerBase nplayer;
10146 if (PlayerBase.CastTo(nplayer,player))
10147 {
10148
10149 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10150
10151 }
10152
10153
10154 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10155
10156
10157 if (HasEnergyManager())
10158 {
10159 GetCompEM().UpdatePlugState();
10160 }
10161 }
10162
10163
10165 {
10166 super.OnPlacementStarted(player);
10167
10169 }
10170
10171 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10172 {
10174 {
10175 m_AdminLog.OnPlacementComplete(player,
this);
10176 }
10177
10178 super.OnPlacementComplete(player, position, orientation);
10179 }
10180
10181
10182
10183
10184
10186 {
10188 {
10189 return true;
10190 }
10191 else
10192 {
10193 return false;
10194 }
10195 }
10196
10197
10199 {
10201 {
10203 }
10204 }
10205
10206
10208 {
10210 }
10211
10213 {
10215 }
10216
10217 override void InsertAgent(
int agent,
float count = 1)
10218 {
10219 if (count < 1)
10220 return;
10221
10223 }
10224
10227 {
10229 }
10230
10231
10233 {
10235 }
10236
10237
10238
10239
10240
10241
10242
10243
10244
10245
10246
10247
10248
10249
10250
10251
10252
10253
10254
10255
10256
10257
10258
10259
10260
10261
10262
10263
10264
10265
10266
10267
10268
10269
10270
10271
10272
10273
10274
10275
10276
10277
10279 {
10281 return false;
10282 return true;
10283 }
10284
10286 {
10287
10289 }
10290
10291
10294 {
10295 super.CheckForRoofLimited(timeTresholdMS);
10296
10298 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10299 {
10300 m_PreviousRoofTestTime = time;
10301 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10302 }
10303 }
10304
10305
10307 {
10309 {
10310 return 0;
10311 }
10312
10313 if (GetInventory().GetAttachmentSlotsCount() != 0)
10314 {
10315 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10316 if (filter)
10317 return filter.GetProtectionLevel(type, false, system);
10318 else
10319 return 0;
10320 }
10321
10322 string subclassPath, entryName;
10323
10324 switch (type)
10325 {
10327 entryName = "biological";
10328 break;
10330 entryName = "chemical";
10331 break;
10332 default:
10333 entryName = "biological";
10334 break;
10335 }
10336
10337 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10338
10340 }
10341
10342
10343
10346 {
10347 if (!IsMagazine())
10349
10351 }
10352
10353
10354
10355
10356
10361 {
10362 return true;
10363 }
10364
10366 {
10368 }
10369
10370
10371
10372
10373
10375 {
10376 if (parent)
10377 {
10378 if (parent.IsInherited(DayZInfected))
10379 return true;
10380
10381 if (!parent.IsRuined())
10382 return true;
10383 }
10384
10385 return true;
10386 }
10387
10389 {
10390 if (!super.CanPutAsAttachment(parent))
10391 {
10392 return false;
10393 }
10394
10395 if (!IsRuined() && !parent.IsRuined())
10396 {
10397 return true;
10398 }
10399
10400 return false;
10401 }
10402
10404 {
10405
10406
10407
10408
10409 return super.CanReceiveItemIntoCargo(item);
10410 }
10411
10413 {
10414
10415
10416
10417
10418 GameInventory attachmentInv = attachment.GetInventory();
10420 {
10421 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10422 return false;
10423 }
10424
10425 InventoryLocation loc = new InventoryLocation();
10426 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10427 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10428 return false;
10429
10430 return super.CanReceiveAttachment(attachment, slotId);
10431 }
10432
10434 {
10435 if (!super.CanReleaseAttachment(attachment))
10436 return false;
10437
10438 return GetInventory().AreChildrenAccessible();
10439 }
10440
10441
10442
10443
10444
10445
10446
10447
10448
10449
10450
10451
10452
10453
10454
10455
10456
10457
10458
10459
10460
10462 {
10463 int id = muzzle_owner.GetMuzzleID();
10464 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10465
10466 if (WPOF_array)
10467 {
10468 for (int i = 0; i < WPOF_array.Count(); i++)
10469 {
10470 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10471
10472 if (WPOF)
10473 {
10474 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10475 }
10476 }
10477 }
10478 }
10479
10480
10482 {
10483 int id = muzzle_owner.GetMuzzleID();
10485
10486 if (WPOBE_array)
10487 {
10488 for (int i = 0; i < WPOBE_array.Count(); i++)
10489 {
10490 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10491
10492 if (WPOBE)
10493 {
10494 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10495 }
10496 }
10497 }
10498 }
10499
10500
10502 {
10503 int id = muzzle_owner.GetMuzzleID();
10504 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10505
10506 if (WPOOH_array)
10507 {
10508 for (int i = 0; i < WPOOH_array.Count(); i++)
10509 {
10510 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10511
10512 if (WPOOH)
10513 {
10514 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10515 }
10516 }
10517 }
10518 }
10519
10520
10522 {
10523 int id = muzzle_owner.GetMuzzleID();
10524 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10525
10526 if (WPOOH_array)
10527 {
10528 for (int i = 0; i < WPOOH_array.Count(); i++)
10529 {
10530 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10531
10532 if (WPOOH)
10533 {
10534 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10535 }
10536 }
10537 }
10538 }
10539
10540
10542 {
10543 int id = muzzle_owner.GetMuzzleID();
10544 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10545
10546 if (WPOOH_array)
10547 {
10548 for (int i = 0; i < WPOOH_array.Count(); i++)
10549 {
10550 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10551
10552 if (WPOOH)
10553 {
10554 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10555 }
10556 }
10557 }
10558 }
10559
10560
10561
10563 {
10565 {
10566 return true;
10567 }
10568
10569 return false;
10570 }
10571
10573 {
10575 {
10576 return true;
10577 }
10578
10579 return false;
10580 }
10581
10583 {
10585 {
10586 return true;
10587 }
10588
10589 return false;
10590 }
10591
10593 {
10594 return false;
10595 }
10596
10599 {
10600 return UATimeSpent.DEFAULT_DEPLOY;
10601 }
10602
10603
10604
10605
10607 {
10609 SetSynchDirty();
10610 }
10611
10613 {
10615 }
10616
10617
10619 {
10620 return false;
10621 }
10622
10625 {
10626 string att_type = "None";
10627
10628 if (ConfigIsExisting("soundAttType"))
10629 {
10630 att_type = ConfigGetString("soundAttType");
10631 }
10632
10634 }
10635
10637 {
10639 }
10640
10641
10642
10643
10644
10650
10652 {
10655
10657 }
10658
10659
10661 {
10663 return;
10664
10666
10669
10672
10673 SoundParameters params = new SoundParameters();
10677 }
10678
10679
10681 {
10683 return;
10684
10686 SetSynchDirty();
10687
10690 }
10691
10692
10694 {
10696 return;
10697
10699 SetSynchDirty();
10700
10703 }
10704
10706 {
10708 }
10709
10711 {
10713 }
10714
10717 {
10718 if (!
GetGame().IsDedicatedServer())
10719 {
10720 if (ConfigIsExisting("attachSoundSet"))
10721 {
10722 string cfg_path = "";
10723 string soundset = "";
10724 string type_name =
GetType();
10725
10728 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10729 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10730
10731 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10732 {
10733 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10734 {
10735 if (cfg_slot_array[i] == slot_type)
10736 {
10737 soundset = cfg_soundset_array[i];
10738 break;
10739 }
10740 }
10741 }
10742
10743 if (soundset != "")
10744 {
10745 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10747 }
10748 }
10749 }
10750 }
10751
10753 {
10754
10755 }
10756
10757 void OnApply(PlayerBase player);
10758
10760 {
10761 return 1.0;
10762 };
10763
10765 {
10767 }
10768
10770 {
10772 }
10773
10775
10777 {
10778 SetDynamicPhysicsLifeTime(0.01);
10780 }
10781
10783 {
10784 array<string> zone_names = new array<string>;
10785 GetDamageZones(zone_names);
10786 for (int i = 0; i < zone_names.Count(); i++)
10787 {
10788 SetHealthMax(zone_names.Get(i),"Health");
10789 }
10790 SetHealthMax("","Health");
10791 }
10792
10795 {
10796 float global_health = GetHealth01("","Health");
10797 array<string> zones = new array<string>;
10798 GetDamageZones(zones);
10799
10800 for (int i = 0; i < zones.Count(); i++)
10801 {
10802 SetHealth01(zones.Get(i),"Health",global_health);
10803 }
10804 }
10805
10808 {
10809 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10810 }
10811
10813 {
10814 if (!hasRootAsPlayer)
10815 {
10816 if (refParentIB)
10817 {
10818
10819 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10820 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10821
10822 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10823 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10824
10827 }
10828 else
10829 {
10830
10833 }
10834 }
10835 }
10836
10838 {
10840 {
10841 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10842 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10843 {
10844 float heatPermCoef = 1.0;
10846 while (ent)
10847 {
10848 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10849 ent = ent.GetHierarchyParent();
10850 }
10851
10852 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10853 }
10854 }
10855 }
10856
10858 {
10859
10860 EntityAI parent = GetHierarchyParent();
10861 if (!parent)
10862 {
10863 hasParent = false;
10864 hasRootAsPlayer = false;
10865 }
10866 else
10867 {
10868 hasParent = true;
10869 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10870 refParentIB =
ItemBase.Cast(parent);
10871 }
10872 }
10873
10874 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10875 {
10876
10877 }
10878
10880 {
10881
10882 return false;
10883 }
10884
10886 {
10887
10888
10889 return false;
10890 }
10891
10893 {
10894
10895 return false;
10896 }
10897
10900 {
10901 return !GetIsFrozen() &&
IsOpen();
10902 }
10903
10905 {
10906 bool hasParent = false, hasRootAsPlayer = false;
10908
10909 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10910 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10911
10912 if (wwtu || foodDecay)
10913 {
10917
10918 if (processWetness || processTemperature || processDecay)
10919 {
10921
10922 if (processWetness)
10923 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10924
10925 if (processTemperature)
10927
10928 if (processDecay)
10929 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10930 }
10931 }
10932 }
10933
10936 {
10938 }
10939
10941 {
10944
10945 return super.GetTemperatureFreezeThreshold();
10946 }
10947
10949 {
10952
10953 return super.GetTemperatureThawThreshold();
10954 }
10955
10957 {
10960
10961 return super.GetItemOverheatThreshold();
10962 }
10963
10965 {
10967 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10968
10969 return super.GetTemperatureFreezeTime();
10970 }
10971
10973 {
10975 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10976
10977 return super.GetTemperatureThawTime();
10978 }
10979
10984
10986 {
10987 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10988 }
10989
10991 {
10992 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10993 }
10994
10997 {
10999 }
11000
11002 {
11004 }
11005
11007 {
11009 }
11010
11013 {
11014 return null;
11015 }
11016
11019 {
11020 return false;
11021 }
11022
11024 {
11026 {
11029 if (!trg)
11030 {
11032 explosive = this;
11033 }
11034
11035 explosive.PairRemote(trg);
11037
11038 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11039 trg.SetPersistentPairID(persistentID);
11040 explosive.SetPersistentPairID(persistentID);
11041
11042 return true;
11043 }
11044 return false;
11045 }
11046
11049 {
11050 float ret = 1.0;
11053 ret *= GetHealth01();
11054
11055 return ret;
11056 }
11057
11058 #ifdef DEVELOPER
11059 override void SetDebugItem()
11060 {
11061 super.SetDebugItem();
11062 _itemBase = this;
11063 }
11064
11066 {
11067 string text = super.GetDebugText();
11068
11070 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11071
11072 return text;
11073 }
11074 #endif
11075
11077 {
11078 return true;
11079 }
11080
11082
11084
11086 {
11089 }
11090
11091
11099
11115}
11116
11118{
11120 if (entity)
11121 {
11122 bool is_item = entity.IsInherited(
ItemBase);
11123 if (is_item && full_quantity)
11124 {
11127 }
11128 }
11129 else
11130 {
11132 return NULL;
11133 }
11134 return entity;
11135}
11136
11138{
11139 if (item)
11140 {
11141 if (health > 0)
11142 item.SetHealth("", "", health);
11143
11144 if (item.CanHaveTemperature())
11145 {
11147 if (item.CanFreeze())
11148 item.SetFrozen(false);
11149 }
11150
11151 if (item.HasEnergyManager())
11152 {
11153 if (quantity >= 0)
11154 {
11155 item.GetCompEM().SetEnergy0To1(quantity);
11156 }
11157 else
11158 {
11160 }
11161 }
11162 else if (item.IsMagazine())
11163 {
11164 Magazine mag = Magazine.Cast(item);
11165 if (quantity >= 0)
11166 {
11167 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11168 }
11169 else
11170 {
11172 }
11173
11174 }
11175 else
11176 {
11177 if (quantity >= 0)
11178 {
11179 item.SetQuantityNormalized(quantity, false);
11180 }
11181 else
11182 {
11184 }
11185
11186 }
11187 }
11188}
11189
11190#ifdef DEVELOPER
11192#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.