6223{
6225 {
6226 return true;
6227 }
6228};
6229
6230
6231
6233{
6237
6239
6242
6243
6244
6245
6246
6255
6261
6266
6271
6292 protected bool m_IsResultOfSplit
6293
6295
6300
6301
6302
6304
6308
6309
6310
6312
6315
6316
6317
6323
6324
6332
6335
6336
6338
6339
6341
6342
6347
6348
6353
6354
6356
6357
6359 {
6364
6365 if (!
GetGame().IsDedicatedServer())
6366 {
6368 {
6370
6372 {
6374 }
6375 }
6376
6379 }
6380
6381 m_OldLocation = null;
6382
6384 {
6386 }
6387
6388 if (ConfigIsExisting("headSelectionsToHide"))
6389 {
6392 }
6393
6395 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6396 {
6398 }
6399
6401
6402 m_IsResultOfSplit = false;
6403
6405 }
6406
6408 {
6409 super.InitItemVariables();
6410
6416 m_Count = ConfigGetInt(
"count");
6417
6420
6425
6428
6433
6445
6449
6450
6453 if (ConfigIsExisting("canBeSplit"))
6454 {
6457 }
6458
6460 if (ConfigIsExisting("itemBehaviour"))
6462
6463
6466 RegisterNetSyncVariableInt("m_VarLiquidType");
6467 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6468
6469 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6470 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6471 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6472
6473 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6474 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6475 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6476 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6477
6478 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6479 RegisterNetSyncVariableBool("m_IsTakeable");
6480 RegisterNetSyncVariableBool("m_IsHologram");
6481
6484 {
6487 }
6488
6490
6492 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6494
6495 }
6496
6498 {
6500 }
6501
6503 {
6506 {
6511 }
6512 }
6513
6514 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6515 {
6517 {
6520 }
6521
6523 }
6524
6526 {
6532 }
6533
6535
6537 {
6539
6540 if (!action)
6541 {
6542 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6543 return;
6544 }
6545
6547 if (!ai)
6548 {
6550 return;
6551 }
6552
6554 if (!action_array)
6555 {
6556 action_array = new array<ActionBase_Basic>;
6558 }
6559 if (LogManager.IsActionLogEnable())
6560 {
6561 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6562 }
6563
6564 if (action_array.Find(action) != -1)
6565 {
6566 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6567 }
6568 else
6569 {
6570 action_array.Insert(action);
6571 }
6572 }
6573
6575 {
6577 ActionBase action = player.GetActionManager().GetAction(actionName);
6580
6581 if (action_array)
6582 {
6583 action_array.RemoveItem(action);
6584 }
6585 }
6586
6587
6588
6590 {
6591 ActionOverrideData overrideData = new ActionOverrideData();
6595
6597 if (!actionMap)
6598 {
6601 }
6602
6603 actionMap.Insert(this.
Type(), overrideData);
6604
6605 }
6606
6608
6610
6611
6613 {
6616
6619
6620 string config_to_search = "CfgVehicles";
6621 string muzzle_owner_config;
6622
6624 {
6625 if (IsInherited(Weapon))
6626 config_to_search = "CfgWeapons";
6627
6628 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6629
6630 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6631
6633
6634 if (config_OnFire_subclass_count > 0)
6635 {
6636 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6637
6638 for (int i = 0; i < config_OnFire_subclass_count; i++)
6639 {
6640 string particle_class = "";
6642 string config_OnFire_entry = config_OnFire_class + particle_class;
6643 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6644 WPOF_array.Insert(WPOF);
6645 }
6646
6647
6649 }
6650 }
6651
6653 {
6654 config_to_search = "CfgWeapons";
6655 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6656
6657 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6658
6660
6661 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6662 {
6663 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6664
6665 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6666 {
6667 string particle_class2 = "";
6669 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6670 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6671 WPOBE_array.Insert(WPOBE);
6672 }
6673
6674
6676 }
6677 }
6678 }
6679
6680
6682 {
6685
6687 {
6688 string config_to_search = "CfgVehicles";
6689
6690 if (IsInherited(Weapon))
6691 config_to_search = "CfgWeapons";
6692
6693 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6694 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6695
6696 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6697 {
6698
6700
6702 {
6704 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6706 return;
6707 }
6708
6711
6712
6713
6715 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6716
6717 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6718 {
6719 string particle_class = "";
6721 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6723
6724 if (entry_type == CT_CLASS)
6725 {
6726 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6727 WPOOH_array.Insert(WPOF);
6728 }
6729 }
6730
6731
6733 }
6734 }
6735 }
6736
6738 {
6740 }
6741
6743 {
6745 {
6747
6750
6753
6754 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6755 }
6756 }
6757
6759 {
6761 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6762
6764 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6765
6767 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6768
6770 {
6772 }
6773 }
6774
6776 {
6778 }
6779
6781 {
6784 else
6786
6788 {
6791 }
6792 else
6793 {
6796
6799 }
6800
6802 }
6803
6805 {
6807 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6808 }
6809
6811 {
6813 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6815 }
6816
6818 {
6820 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6821 }
6822
6824 {
6827
6828 OverheatingParticle OP = new OverheatingParticle();
6833
6835 }
6836
6838 {
6841
6842 return -1;
6843 }
6844
6846 {
6848 {
6851
6852 for (int i = count; i > 0; --i)
6853 {
6854 int id = i - 1;
6857
6860
6861 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6862 {
6863 if (p)
6864 {
6867 }
6868 }
6869 }
6870 }
6871 }
6872
6874 {
6876 {
6878 {
6879 int id = i - 1;
6881
6882 if (OP)
6883 {
6885
6886 if (p)
6887 {
6889 }
6890
6891 delete OP;
6892 }
6893 }
6894
6897 }
6898 }
6899
6902 {
6903 return 0.0;
6904 }
6905
6906
6908 {
6909 return 250;
6910 }
6911
6913 {
6914 return 0;
6915 }
6916
6919 {
6921 return true;
6922
6923 return false;
6924 }
6925
6928 {
6931
6933 {
6935 }
6936 else
6937 {
6938
6940 }
6941
6943 }
6944
6951 {
6952 return -1;
6953 }
6954
6955
6956
6957
6959 {
6961 {
6963 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6964
6965 if (r_index >= 0)
6966 {
6967 InventoryLocation r_il = new InventoryLocation;
6968 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6969
6970 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6973 {
6974 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6975 }
6977 {
6978 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6979 }
6980
6981 }
6982
6983 player.GetHumanInventory().ClearUserReservedLocation(this);
6984 }
6985
6988 }
6989
6990
6991
6992
6994 {
6995 return ItemBase.m_DebugActionsMask;
6996 }
6997
6999 {
7000 return ItemBase.m_DebugActionsMask & mask;
7001 }
7002
7004 {
7005 ItemBase.m_DebugActionsMask = mask;
7006 }
7007
7009 {
7010 ItemBase.m_DebugActionsMask |= mask;
7011 }
7012
7014 {
7015 ItemBase.m_DebugActionsMask &= ~mask;
7016 }
7017
7019 {
7021 {
7023 }
7024 else
7025 {
7027 }
7028 }
7029
7030
7032 {
7033 if (GetEconomyProfile())
7034 {
7035 float q_max = GetEconomyProfile().GetQuantityMax();
7036 if (q_max > 0)
7037 {
7038 float q_min = GetEconomyProfile().GetQuantityMin();
7039 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7040
7042 {
7043 ComponentEnergyManager comp = GetCompEM();
7045 {
7047 }
7048 }
7050 {
7052
7053 }
7054
7055 }
7056 }
7057 }
7058
7061 {
7062 EntityAI parent = GetHierarchyParent();
7063
7064 if (parent)
7065 {
7066 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7067 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7068 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7069 }
7070 }
7071
7074 {
7075 EntityAI parent = GetHierarchyParent();
7076
7077 if (parent)
7078 {
7079 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7080 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7081 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7082 }
7083 }
7084
7086 {
7087
7088
7089
7090
7092
7094 {
7095 if (ScriptInputUserData.CanStoreInputUserData())
7096 {
7097 ScriptInputUserData ctx = new ScriptInputUserData;
7103 ctx.
Write(use_stack_max);
7106
7108 {
7109 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7110 }
7111 }
7112 }
7113 else if (!
GetGame().IsMultiplayer())
7114 {
7116 }
7117 }
7118
7120 {
7122 }
7123
7125 {
7127 }
7128
7130 {
7132 }
7133
7135 {
7136
7137 return false;
7138 }
7139
7141 {
7142 return false;
7143 }
7144
7148 {
7149 return false;
7150 }
7151
7153 {
7154 return "";
7155 }
7156
7158
7160 {
7161 return false;
7162 }
7163
7165 {
7166 return true;
7167 }
7168
7169
7170
7172 {
7173 return true;
7174 }
7175
7177 {
7178 return true;
7179 }
7180
7182 {
7183 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7185 }
7186
7188 {
7190 }
7191
7193 {
7195 if (!is_being_placed)
7197 SetSynchDirty();
7198 }
7199
7200
7202
7204 {
7206 }
7207
7209 {
7211 }
7212
7214 {
7215 return 1;
7216 }
7217
7219 {
7220 return false;
7221 }
7222
7224 {
7226 SetSynchDirty();
7227 }
7228
7229
7230
7231
7232
7233
7234
7235
7236
7237
7238
7239
7240
7241
7242
7243
7244
7245
7246
7247
7248
7249
7250
7251
7252
7253
7254
7255
7256
7257
7258
7259
7260
7261
7262
7264 {
7265 super.OnMovedInsideCargo(container);
7266
7267 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7268 }
7269
7270 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7271 {
7272 super.EEItemLocationChanged(oldLoc,newLoc);
7273
7274 PlayerBase new_player = null;
7275 PlayerBase old_player = null;
7276
7277 if (newLoc.GetParent())
7278 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7279
7280 if (oldLoc.GetParent())
7281 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7282
7284 {
7285 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
7286
7287 if (r_index >= 0)
7288 {
7289 InventoryLocation r_il = new InventoryLocation;
7290 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7291
7292 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7295 {
7296 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7297 }
7299 {
7300 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7301 }
7302
7303 }
7304 }
7305
7307 {
7308 if (new_player)
7309 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
7310
7311 if (new_player == old_player)
7312 {
7313
7314 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7315 {
7317 {
7318 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7319 {
7320 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7321 }
7322 }
7323 else
7324 {
7325 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7326 }
7327 }
7328
7329 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7330 {
7331 int type = oldLoc.GetType();
7333 {
7334 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7335 }
7337 {
7338 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7339 }
7340 }
7341 if (!m_OldLocation)
7342 {
7343 m_OldLocation = new InventoryLocation;
7344 }
7345 m_OldLocation.Copy(oldLoc);
7346 }
7347 else
7348 {
7349 if (m_OldLocation)
7350 {
7351 m_OldLocation.Reset();
7352 }
7353 }
7354
7356 }
7357 else
7358 {
7359 if (new_player)
7360 {
7361 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7362 if (res_index >= 0)
7363 {
7364 InventoryLocation il = new InventoryLocation;
7365 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
7367 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
7370 {
7371 il.
GetParent().GetOnReleaseLock().Invoke(it);
7372 }
7374 {
7376 }
7377
7378 }
7379 }
7381 {
7382
7384 }
7385
7386 if (m_OldLocation)
7387 {
7388 m_OldLocation.Reset();
7389 }
7390 }
7391 }
7392
7393 override void EOnContact(IEntity other, Contact extra)
7394 {
7396 {
7397 int liquidType = -1;
7399 if (impactSpeed > 0.0)
7400 {
7402 #ifndef SERVER
7404 #else
7406 SetSynchDirty();
7407 #endif
7409 }
7410 }
7411
7412 #ifdef SERVER
7413 if (GetCompEM() && GetCompEM().IsPlugged())
7414 {
7415 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7416 GetCompEM().UnplugThis();
7417 }
7418 #endif
7419 }
7420
7422
7424 {
7426 }
7427
7429 {
7430
7431 }
7432
7434 {
7435 super.OnItemLocationChanged(old_owner, new_owner);
7436
7437 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7438 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7439
7440 if (!relatedPlayer && playerNew)
7441 relatedPlayer = playerNew;
7442
7443 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7444 {
7446 if (actionMgr)
7447 {
7448 ActionBase currentAction = actionMgr.GetRunningAction();
7449 if (currentAction)
7451 }
7452 }
7453
7454 Man ownerPlayerOld = null;
7455 Man ownerPlayerNew = null;
7456
7457 if (old_owner)
7458 {
7459 if (old_owner.
IsMan())
7460 {
7461 ownerPlayerOld = Man.Cast(old_owner);
7462 }
7463 else
7464 {
7465 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7466 }
7467 }
7468 else
7469 {
7471 {
7473
7474 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7475 {
7476 GetCompEM().UnplugThis();
7477 }
7478 }
7479 }
7480
7481 if (new_owner)
7482 {
7483 if (new_owner.
IsMan())
7484 {
7485 ownerPlayerNew = Man.Cast(new_owner);
7486 }
7487 else
7488 {
7489 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7490 }
7491 }
7492
7493 if (ownerPlayerOld != ownerPlayerNew)
7494 {
7495 if (ownerPlayerOld)
7496 {
7497 array<EntityAI> subItemsExit = new array<EntityAI>;
7499 for (int i = 0; i < subItemsExit.Count(); i++)
7500 {
7503 }
7504 }
7505
7506 if (ownerPlayerNew)
7507 {
7508 array<EntityAI> subItemsEnter = new array<EntityAI>;
7510 for (int j = 0; j < subItemsEnter.Count(); j++)
7511 {
7514 }
7515 }
7516 }
7517 else if (ownerPlayerNew != null)
7518 {
7519 PlayerBase nplayer;
7520 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7521 {
7522 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7524 for (int k = 0; k < subItemsUpdate.Count(); k++)
7525 {
7527 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7528 }
7529 }
7530 }
7531
7532 if (old_owner)
7533 old_owner.OnChildItemRemoved(this);
7534 if (new_owner)
7535 new_owner.OnChildItemReceived(this);
7536 }
7537
7538
7540 {
7541 super.EEDelete(parent);
7542 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7543 if (player)
7544 {
7546
7547 if (player.IsAlive())
7548 {
7549 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7550 if (r_index >= 0)
7551 {
7552 InventoryLocation r_il = new InventoryLocation;
7553 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7554
7555 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7558 {
7559 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7560 }
7562 {
7563 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7564 }
7565
7566 }
7567
7568 player.RemoveQuickBarEntityShortcut(this);
7569 }
7570 }
7571 }
7572
7574 {
7575 super.EEKilled(killer);
7576
7579 {
7580 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7581 {
7582 if (IsMagazine())
7583 {
7584 if (Magazine.Cast(this).GetAmmoCount() > 0)
7585 {
7587 }
7588 }
7589 else
7590 {
7592 }
7593 }
7594 }
7595 }
7596
7598 {
7599 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7600
7601 super.OnWasAttached(parent, slot_id);
7602
7605
7607 }
7608
7610 {
7611 super.OnWasDetached(parent, slot_id);
7612
7615 }
7616
7618 {
7619 int idx;
7622
7623 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7624 if (inventory_slots.Count() < 1)
7625 {
7626 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7627 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7628 }
7629 else
7630 {
7631 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7632 }
7633
7634 idx = inventory_slots.Find(slot);
7635 if (idx < 0)
7636 return "";
7637
7638 return attach_types.Get(idx);
7639 }
7640
7642 {
7643 int idx = -1;
7644 string slot;
7645
7648
7649 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7650 if (inventory_slots.Count() < 1)
7651 {
7652 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7653 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7654 }
7655 else
7656 {
7657 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7658 if (detach_types.Count() < 1)
7659 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7660 }
7661
7662 for (int i = 0; i < inventory_slots.Count(); i++)
7663 {
7664 slot = inventory_slots.Get(i);
7665 }
7666
7667 if (slot != "")
7668 {
7669 if (detach_types.Count() == 1)
7670 idx = 0;
7671 else
7672 idx = inventory_slots.Find(slot);
7673 }
7674 if (idx < 0)
7675 return "";
7676
7677 return detach_types.Get(idx);
7678 }
7679
7681 {
7682
7684
7685
7686 float min_time = 1;
7687 float max_time = 3;
7688 float delay = Math.RandomFloat(min_time, max_time);
7689
7690 explode_timer.Run(delay, this, "DoAmmoExplosion");
7691 }
7692
7694 {
7695 Magazine magazine = Magazine.Cast(this);
7696 int pop_sounds_count = 6;
7697 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7698
7699
7700 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7701 string sound_name = pop_sounds[ sound_idx ];
7703
7704
7705 magazine.ServerAddAmmoCount(-1);
7706
7707
7708 float min_temp_to_explode = 100;
7709
7710 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7711 {
7713 }
7714 }
7715
7716
7717 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7718 {
7719 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7720
7721 const int CHANCE_DAMAGE_CARGO = 4;
7722 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7723 const int CHANCE_DAMAGE_NOTHING = 2;
7724
7726 {
7727 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7728 int chances;
7729 int rnd;
7730
7731 if (GetInventory().GetCargo())
7732 {
7733 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7734 rnd = Math.RandomInt(0,chances);
7735
7736 if (rnd < CHANCE_DAMAGE_CARGO)
7737 {
7739 }
7740 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7741 {
7743 }
7744 }
7745 else
7746 {
7747 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7748 rnd = Math.RandomInt(0,chances);
7749
7750 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7751 {
7753 }
7754 }
7755 }
7756 }
7757
7759 {
7760 if (GetInventory().GetCargo())
7761 {
7762 int item_count = GetInventory().GetCargo().GetItemCount();
7763 if (item_count > 0)
7764 {
7765 int random_pick = Math.RandomInt(0, item_count);
7767 if (!item.IsExplosive())
7768 {
7769 item.AddHealth("","",damage);
7770 return true;
7771 }
7772 }
7773 }
7774 return false;
7775 }
7776
7778 {
7779 int attachment_count = GetInventory().AttachmentCount();
7780 if (attachment_count > 0)
7781 {
7782 int random_pick = Math.RandomInt(0, attachment_count);
7783 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7784 if (!attachment.IsExplosive())
7785 {
7786 attachment.AddHealth("","",damage);
7787 return true;
7788 }
7789 }
7790 return false;
7791 }
7792
7794 {
7796 }
7797
7799 {
7801 return GetInventory().CanRemoveEntity();
7802
7803 return false;
7804 }
7805
7807 {
7808
7810 return false;
7811
7812
7814 return false;
7815
7816
7817
7819 if (delta == 0)
7820 return false;
7821
7822
7823 return true;
7824 }
7825
7827 {
7829 {
7830 if (ScriptInputUserData.CanStoreInputUserData())
7831 {
7832 ScriptInputUserData ctx = new ScriptInputUserData;
7837 ctx.
Write(destination_entity);
7841 }
7842 }
7843 else if (!
GetGame().IsMultiplayer())
7844 {
7846 }
7847 }
7848
7850 {
7851 float split_quantity_new;
7855 InventoryLocation loc = new InventoryLocation;
7856
7857 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7858 {
7860 split_quantity_new = stack_max;
7861 else
7863
7865 {
7866 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7867 if (new_item)
7868 {
7869 new_item.SetResultOfSplit(true);
7870 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7872 new_item.
SetQuantity(split_quantity_new,
false,
true);
7873 }
7874 }
7875 }
7876 else if (destination_entity && slot_id == -1)
7877 {
7878 if (quantity > stack_max)
7879 split_quantity_new = stack_max;
7880 else
7881 split_quantity_new = quantity;
7882
7884 {
7886 {
7889 }
7890
7891 if (new_item)
7892 {
7893 new_item.SetResultOfSplit(true);
7894 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7896 new_item.
SetQuantity(split_quantity_new,
false,
true);
7897 }
7898 }
7899 }
7900 else
7901 {
7902 if (stack_max != 0)
7903 {
7905 {
7907 }
7908
7909 if (split_quantity_new == 0)
7910 {
7911 if (!
GetGame().IsMultiplayer())
7912 player.PhysicalPredictiveDropItem(this);
7913 else
7914 player.ServerDropEntity(this);
7915 return;
7916 }
7917
7919 {
7921
7922 if (new_item)
7923 {
7924 new_item.SetResultOfSplit(true);
7925 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7928 new_item.PlaceOnSurface();
7929 }
7930 }
7931 }
7932 }
7933 }
7934
7936 {
7937 float split_quantity_new;
7941 InventoryLocation loc = new InventoryLocation;
7942
7943 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7944 {
7946 split_quantity_new = stack_max;
7947 else
7949
7951 {
7952 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7953 if (new_item)
7954 {
7955 new_item.SetResultOfSplit(true);
7956 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7958 new_item.
SetQuantity(split_quantity_new,
false,
true);
7959 }
7960 }
7961 }
7962 else if (destination_entity && slot_id == -1)
7963 {
7964 if (quantity > stack_max)
7965 split_quantity_new = stack_max;
7966 else
7967 split_quantity_new = quantity;
7968
7970 {
7972 {
7975 }
7976
7977 if (new_item)
7978 {
7979 new_item.SetResultOfSplit(true);
7980 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7982 new_item.
SetQuantity(split_quantity_new,
false,
true);
7983 }
7984 }
7985 }
7986 else
7987 {
7988 if (stack_max != 0)
7989 {
7991 {
7993 }
7994
7996 {
7998
7999 if (new_item)
8000 {
8001 new_item.SetResultOfSplit(true);
8002 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8005 new_item.PlaceOnSurface();
8006 }
8007 }
8008 }
8009 }
8010 }
8011
8013 {
8015 {
8016 if (ScriptInputUserData.CanStoreInputUserData())
8017 {
8018 ScriptInputUserData ctx = new ScriptInputUserData;
8023 dst.WriteToContext(ctx);
8025 }
8026 }
8027 else if (!
GetGame().IsMultiplayer())
8028 {
8030 }
8031 }
8032
8034 {
8036 {
8037 if (ScriptInputUserData.CanStoreInputUserData())
8038 {
8039 ScriptInputUserData ctx = new ScriptInputUserData;
8044 ctx.
Write(destination_entity);
8050 }
8051 }
8052 else if (!
GetGame().IsMultiplayer())
8053 {
8055 }
8056 }
8057
8059 {
8061 }
8062
8064 {
8066 float split_quantity_new;
8068 if (dst.IsValid())
8069 {
8070 int slot_id = dst.GetSlot();
8072
8073 if (quantity > stack_max)
8074 split_quantity_new = stack_max;
8075 else
8076 split_quantity_new = quantity;
8077
8079 {
8081
8082 if (new_item)
8083 {
8084 new_item.SetResultOfSplit(true);
8085 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8087 new_item.
SetQuantity(split_quantity_new,
false,
true);
8088 }
8089
8090 return new_item;
8091 }
8092 }
8093
8094 return null;
8095 }
8096
8098 {
8100 float split_quantity_new;
8102 if (destination_entity)
8103 {
8105 if (quantity > stackable)
8106 split_quantity_new = stackable;
8107 else
8108 split_quantity_new = quantity;
8109
8111 {
8112 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8113 if (new_item)
8114 {
8115 new_item.SetResultOfSplit(true);
8116 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8118 new_item.
SetQuantity(split_quantity_new,
false,
true);
8119 }
8120 }
8121 }
8122 }
8123
8125 {
8127 {
8128 if (ScriptInputUserData.CanStoreInputUserData())
8129 {
8130 ScriptInputUserData ctx = new ScriptInputUserData;
8135 ItemBase destination_entity =
this;
8136 ctx.
Write(destination_entity);
8140 }
8141 }
8142 else if (!
GetGame().IsMultiplayer())
8143 {
8145 }
8146 }
8147
8149 {
8151 float split_quantity_new;
8153 if (player)
8154 {
8156 if (quantity > stackable)
8157 split_quantity_new = stackable;
8158 else
8159 split_quantity_new = quantity;
8160
8162 {
8163 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8164 new_item =
ItemBase.Cast(in_hands);
8165 if (new_item)
8166 {
8167 new_item.SetResultOfSplit(true);
8168 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8170 new_item.SetQuantity(split_quantity_new, false, true);
8171 }
8172 }
8173 }
8174 }
8175
8177 {
8179 float split_quantity_new = Math.Floor(quantity * 0.5);
8180
8182 return;
8183
8185
8186 if (new_item)
8187 {
8188 if (new_item.GetQuantityMax() < split_quantity_new)
8189 {
8190 split_quantity_new = new_item.GetQuantityMax();
8191 }
8192
8193 new_item.SetResultOfSplit(true);
8194 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8195
8197 {
8200 }
8201 else
8202 {
8204 new_item.
SetQuantity(split_quantity_new,
false,
true);
8205 }
8206 }
8207 }
8208
8210 {
8212 float split_quantity_new = Math.Floor(quantity / 2);
8213
8215 return;
8216
8217 InventoryLocation invloc = new InventoryLocation;
8219
8221 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8222
8223 if (new_item)
8224 {
8225 if (new_item.GetQuantityMax() < split_quantity_new)
8226 {
8227 split_quantity_new = new_item.GetQuantityMax();
8228 }
8230 {
8233 }
8234 else if (split_quantity_new > 1)
8235 {
8237 new_item.
SetQuantity(split_quantity_new,
false,
true);
8238 }
8239 }
8240 }
8241
8244 {
8245 SetWeightDirty();
8247
8248 if (parent)
8249 parent.OnAttachmentQuantityChangedEx(this, delta);
8250
8252 {
8254 {
8256 }
8258 {
8259 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8261 }
8262 }
8263
8264 }
8265
8268 {
8269
8270 }
8271
8274 {
8276 }
8277
8279 {
8280 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8281
8283 {
8284 if (newLevel == GameConstants.STATE_RUINED)
8285 {
8287 EntityAI parent = GetHierarchyParent();
8288 if (parent && parent.IsFireplace())
8289 {
8290 CargoBase cargo = GetInventory().GetCargo();
8291 if (cargo)
8292 {
8294 {
8296 }
8297 }
8298 }
8299 }
8300
8302 {
8303
8305 return;
8306 }
8307
8308 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8309 {
8311 }
8312 }
8313 }
8314
8315
8317 {
8318 super.OnRightClick();
8319
8321 {
8323 {
8324 if (ScriptInputUserData.CanStoreInputUserData())
8325 {
8326 EntityAI root = GetHierarchyRoot();
8327 Man playerOwner = GetHierarchyRootPlayer();
8328 InventoryLocation dst = new InventoryLocation;
8329
8330
8331 if (!playerOwner && root && root == this)
8332 {
8334 }
8335 else
8336 {
8337
8338 GetInventory().GetCurrentInventoryLocation(dst);
8340 {
8343 {
8345 }
8346 else
8347 {
8349
8350
8351 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8352 {
8354 }
8355 else
8356 {
8357 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8358 }
8359 }
8360 }
8361 }
8362
8363 ScriptInputUserData ctx = new ScriptInputUserData;
8371 }
8372 }
8373 else if (!
GetGame().IsMultiplayer())
8374 {
8376 }
8377 }
8378 }
8379
8381 {
8382 if (root)
8383 {
8384 vector m4[4];
8385 root.GetTransform(m4);
8386 dst.SetGround(this, m4);
8387 }
8388 else
8389 {
8390 GetInventory().GetCurrentInventoryLocation(dst);
8391 }
8392 }
8393
8394 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8395 {
8396
8397 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8398 return false;
8399
8400 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8401 return false;
8402
8403
8405 return false;
8406
8407
8408 Magazine mag = Magazine.Cast(this);
8409 if (mag)
8410 {
8411 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8412 return false;
8413
8414 if (stack_max_limit)
8415 {
8416 Magazine other_mag = Magazine.Cast(other_item);
8417 if (other_item)
8418 {
8419 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8420 return false;
8421 }
8422
8423 }
8424 }
8425 else
8426 {
8427
8429 return false;
8430
8432 return false;
8433 }
8434
8435 PlayerBase player = null;
8436 if (CastTo(player, GetHierarchyRootPlayer()))
8437 {
8438 if (player.GetInventory().HasAttachment(this))
8439 return false;
8440
8441 if (player.IsItemsToDelete())
8442 return false;
8443 }
8444
8445 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8446 return false;
8447
8448 int slotID;
8450 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8451 return false;
8452
8453 return true;
8454 }
8455
8457 {
8459 }
8460
8462 {
8463 return m_IsResultOfSplit;
8464 }
8465
8467 {
8468 m_IsResultOfSplit = value;
8469 }
8470
8472 {
8474 }
8475
8477 {
8478 float other_item_quantity = other_item.GetQuantity();
8479 float this_free_space;
8480
8482
8484
8485 if (other_item_quantity > this_free_space)
8486 {
8487 return this_free_space;
8488 }
8489 else
8490 {
8491 return other_item_quantity;
8492 }
8493 }
8494
8496 {
8498 }
8499
8501 {
8503 return;
8504
8505 if (!IsMagazine() && other_item)
8506 {
8508 if (quantity_used != 0)
8509 {
8510 float hp1 = GetHealth01("","");
8511 float hp2 = other_item.GetHealth01("","");
8512 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8513 hpResult = hpResult / (
GetQuantity() + quantity_used);
8514
8515 hpResult *= GetMaxHealth();
8516 Math.Round(hpResult);
8517 SetHealth("", "Health", hpResult);
8518
8520 other_item.AddQuantity(-quantity_used);
8521 }
8522 }
8524 }
8525
8527 {
8528 #ifdef SERVER
8529 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8530 GetHierarchyParent().IncreaseLifetimeUp();
8531 #endif
8532 };
8533
8535 {
8536 PlayerBase p = PlayerBase.Cast(player);
8537
8538 array<int> recipesIds = p.m_Recipes;
8539 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8540 if (moduleRecipesManager)
8541 {
8542 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8543 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8544 }
8545
8546 for (int i = 0;i < recipesIds.Count(); i++)
8547 {
8548 int key = recipesIds.Get(i);
8549 string recipeName = moduleRecipesManager.GetRecipeName(key);
8551 }
8552 }
8553
8554
8555 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8556 {
8557 super.GetDebugActions(outputList);
8558
8559
8565
8566
8571
8576
8577
8581
8582
8584 {
8588 }
8589
8592
8593
8597
8599
8600 InventoryLocation loc = new InventoryLocation();
8601 GetInventory().GetCurrentInventoryLocation(loc);
8603 {
8604 if (Gizmo_IsSupported())
8607 }
8608
8610 }
8611
8612
8613
8614
8616 {
8617 super.OnAction(action_id, player, ctx);
8618
8620 {
8621 switch (action_id)
8622 {
8625 return true;
8628 return true;
8629 }
8630 }
8631
8633 {
8634 switch (action_id)
8635 {
8637 Delete();
8638 return true;
8639 }
8640 }
8641
8642 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8643 {
8644 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8645 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8646 PlayerBase p = PlayerBase.Cast(player);
8647 if (
EActions.RECIPES_RANGE_START < 1000)
8648 {
8649 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8650 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8651 }
8652 }
8653 #ifndef SERVER
8654 else if (action_id ==
EActions.WATCH_PLAYER)
8655 {
8656 PluginDeveloper.SetDeveloperItemClientEx(player);
8657 }
8658 #endif
8660 {
8661 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8662 {
8663 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8664 OnDebugButtonPressServer(id + 1);
8665 }
8666
8667 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8668 {
8669 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8671 }
8672
8673 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8674 {
8675 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8677 }
8678
8679 else if (action_id ==
EActions.ADD_QUANTITY)
8680 {
8681 if (IsMagazine())
8682 {
8683 Magazine mag = Magazine.Cast(this);
8684 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8685 }
8686 else
8687 {
8689 }
8690
8691 if (m_EM)
8692 {
8693 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8694 }
8695
8696 }
8697
8698 else if (action_id ==
EActions.REMOVE_QUANTITY)
8699 {
8700 if (IsMagazine())
8701 {
8702 Magazine mag2 = Magazine.Cast(this);
8703 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8704 }
8705 else
8706 {
8708 }
8709 if (m_EM)
8710 {
8711 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8712 }
8713
8714 }
8715
8716 else if (action_id ==
EActions.SET_QUANTITY_0)
8717 {
8719
8720 if (m_EM)
8721 {
8722 m_EM.SetEnergy(0);
8723 }
8724 }
8725
8726 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8727 {
8729
8730 if (m_EM)
8731 {
8732 m_EM.SetEnergy(m_EM.GetEnergyMax());
8733 }
8734 }
8735
8736 else if (action_id ==
EActions.ADD_HEALTH)
8737 {
8738 AddHealth("","",GetMaxHealth("","Health")/5);
8739 }
8740 else if (action_id ==
EActions.REMOVE_HEALTH)
8741 {
8742 AddHealth("","",-GetMaxHealth("","Health")/5);
8743 }
8744 else if (action_id ==
EActions.DESTROY_HEALTH)
8745 {
8746 SetHealth01("","",0);
8747 }
8748 else if (action_id ==
EActions.WATCH_ITEM)
8749 {
8751 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8752 #ifdef DEVELOPER
8753 SetDebugDeveloper_item(this);
8754 #endif
8755 }
8756
8757 else if (action_id ==
EActions.ADD_TEMPERATURE)
8758 {
8759 AddTemperature(20);
8760
8761 }
8762
8763 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8764 {
8765 AddTemperature(-20);
8766
8767 }
8768
8769 else if (action_id ==
EActions.FLIP_FROZEN)
8770 {
8771 SetFrozen(!GetIsFrozen());
8772
8773 }
8774
8775 else if (action_id ==
EActions.ADD_WETNESS)
8776 {
8778
8779 }
8780
8781 else if (action_id ==
EActions.REMOVE_WETNESS)
8782 {
8784
8785 }
8786
8787 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8788 {
8791
8792
8793 }
8794
8795 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8796 {
8799 }
8800
8801 else if (action_id ==
EActions.MAKE_SPECIAL)
8802 {
8803 auto debugParams = DebugSpawnParams.WithPlayer(player);
8804 OnDebugSpawnEx(debugParams);
8805 }
8806
8807 }
8808
8809
8810 return false;
8811 }
8812
8813
8814
8815
8819
8822
8823
8824
8826 {
8827 return false;
8828 }
8829
8830
8832 {
8833 return true;
8834 }
8835
8836
8838 {
8839 return true;
8840 }
8841
8842
8843
8845 {
8846 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8848 }
8849
8852 {
8853 return null;
8854 }
8855
8857 {
8858 return false;
8859 }
8860
8862 {
8863 return false;
8864 }
8865
8869
8870
8872 {
8873 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8874 return module_repairing.CanRepair(this, item_repair_kit);
8875 }
8876
8877
8878 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8879 {
8880 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8881 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8882 }
8883
8884
8886 {
8887
8888
8889
8890
8891
8892
8893
8894
8895 return 1;
8896 }
8897
8898
8899
8901 {
8903 }
8904
8905
8906
8908 {
8910 }
8911
8912
8921 {
8922 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8923
8924 if (player)
8925 {
8926 player.MessageStatus(text);
8927 }
8928 }
8929
8930
8939 {
8940 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8941
8942 if (player)
8943 {
8944 player.MessageAction(text);
8945 }
8946 }
8947
8948
8957 {
8958 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8959
8960 if (player)
8961 {
8962 player.MessageFriendly(text);
8963 }
8964 }
8965
8966
8975 {
8976 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8977
8978 if (player)
8979 {
8980 player.MessageImportant(text);
8981 }
8982 }
8983
8985 {
8986 return true;
8987 }
8988
8989
8990 override bool KindOf(
string tag)
8991 {
8992 bool found = false;
8993 string item_name = this.
GetType();
8996
8997 int array_size = item_tag_array.Count();
8998 for (int i = 0; i < array_size; i++)
8999 {
9000 if (item_tag_array.Get(i) == tag)
9001 {
9002 found = true;
9003 break;
9004 }
9005 }
9006 return found;
9007 }
9008
9009
9011 {
9012
9013 super.OnRPC(sender, rpc_type,ctx);
9014
9015
9016 switch (rpc_type)
9017 {
9018 #ifndef SERVER
9019 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9020 Param2<bool, string> p = new Param2<bool, string>(false, "");
9021
9023 return;
9024
9025 bool play = p.param1;
9026 string soundSet = p.param2;
9027
9028 if (play)
9029 {
9031 {
9033 {
9035 }
9036 }
9037 else
9038 {
9040 }
9041 }
9042 else
9043 {
9045 }
9046
9047 break;
9048 #endif
9049
9050 }
9051
9053 {
9055 }
9056 }
9057
9058
9059
9060
9062 {
9063 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9064 return plugin.GetID(
name);
9065 }
9066
9068 {
9069 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9070 return plugin.GetName(id);
9071 }
9072
9075 {
9076
9077
9078 int varFlags;
9079 if (!ctx.
Read(varFlags))
9080 return;
9081
9082 if (varFlags & ItemVariableFlags.FLOAT)
9083 {
9085 }
9086 }
9087
9089 {
9090
9091 super.SerializeNumericalVars(floats_out);
9092
9093
9094
9096 {
9098 }
9099
9101 {
9103 }
9104
9106 {
9108 }
9109
9111 {
9116 }
9117
9119 {
9121 }
9122 }
9123
9125 {
9126
9127 super.DeSerializeNumericalVars(floats);
9128
9129
9130 int index = 0;
9131 int mask = Math.Round(floats.Get(index));
9132
9133 index++;
9134
9136 {
9138 {
9140 }
9141 else
9142 {
9143 float quantity = floats.Get(index);
9145 }
9146 index++;
9147 }
9148
9150 {
9151 float wet = floats.Get(index);
9153 index++;
9154 }
9155
9157 {
9158 int liquidtype = Math.Round(floats.Get(index));
9160 index++;
9161 }
9162
9164 {
9166 index++;
9168 index++;
9170 index++;
9172 index++;
9173 }
9174
9176 {
9177 int cleanness = Math.Round(floats.Get(index));
9179 index++;
9180 }
9181 }
9182
9184 {
9185 super.WriteVarsToCTX(ctx);
9186
9187
9189 {
9191 }
9192
9194 {
9196 }
9197
9199 {
9201 }
9202
9204 {
9205 int r,g,b,a;
9211 }
9212
9214 {
9216 }
9217 }
9218
9220 {
9221 if (!super.ReadVarsFromCTX(ctx,version))
9222 return false;
9223
9224 int intValue;
9225 float value;
9226
9227 if (version < 140)
9228 {
9229 if (!ctx.
Read(intValue))
9230 return false;
9231
9232 m_VariablesMask = intValue;
9233 }
9234
9236 {
9237 if (!ctx.
Read(value))
9238 return false;
9239
9241 {
9243 }
9244 else
9245 {
9247 }
9248 }
9249
9250 if (version < 140)
9251 {
9253 {
9254 if (!ctx.
Read(value))
9255 return false;
9256 SetTemperatureDirect(value);
9257 }
9258 }
9259
9261 {
9262 if (!ctx.
Read(value))
9263 return false;
9265 }
9266
9268 {
9269 if (!ctx.
Read(intValue))
9270 return false;
9272 }
9273
9275 {
9276 int r,g,b,a;
9278 return false;
9280 return false;
9282 return false;
9284 return false;
9285
9287 }
9288
9290 {
9291 if (!ctx.
Read(intValue))
9292 return false;
9294 }
9295
9296 if (version >= 138 && version < 140)
9297 {
9299 {
9300 if (!ctx.
Read(intValue))
9301 return false;
9302 SetFrozen(intValue);
9303 }
9304 }
9305
9306 return true;
9307 }
9308
9309
9311 {
9314 {
9316 }
9317
9318 if (!super.OnStoreLoad(ctx, version))
9319 {
9321 return false;
9322 }
9323
9324 if (version >= 114)
9325 {
9326 bool hasQuickBarIndexSaved;
9327
9328 if (!ctx.
Read(hasQuickBarIndexSaved))
9329 {
9331 return false;
9332 }
9333
9334 if (hasQuickBarIndexSaved)
9335 {
9336 int itmQBIndex;
9337
9338
9339 if (!ctx.
Read(itmQBIndex))
9340 {
9342 return false;
9343 }
9344
9345 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9346 if (itmQBIndex != -1 && parentPlayer)
9347 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9348 }
9349 }
9350 else
9351 {
9352
9353 PlayerBase player;
9354 int itemQBIndex;
9355 if (version ==
int.
MAX)
9356 {
9357 if (!ctx.
Read(itemQBIndex))
9358 {
9360 return false;
9361 }
9362 }
9363 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9364 {
9365
9366 if (!ctx.
Read(itemQBIndex))
9367 {
9369 return false;
9370 }
9371 if (itemQBIndex != -1 && player)
9372 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9373 }
9374 }
9375
9376 if (version < 140)
9377 {
9378
9379 if (!LoadVariables(ctx, version))
9380 {
9382 return false;
9383 }
9384 }
9385
9386
9388 {
9390 return false;
9391 }
9392 if (version >= 132)
9393 {
9395 if (raib)
9396 {
9398 {
9400 return false;
9401 }
9402 }
9403 }
9404
9406 return true;
9407 }
9408
9409
9410
9412 {
9413 super.OnStoreSave(ctx);
9414
9415 PlayerBase player;
9416 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9417 {
9419
9420 int itemQBIndex = -1;
9421 itemQBIndex = player.FindQuickBarEntityIndex(this);
9422 ctx.
Write(itemQBIndex);
9423 }
9424 else
9425 {
9427 }
9428
9430
9432 if (raib)
9433 {
9435 }
9436 }
9437
9438
9440 {
9441 super.AfterStoreLoad();
9442
9444 {
9446 }
9447
9449 {
9452 }
9453 }
9454
9456 {
9457 super.EEOnAfterLoad();
9458
9460 {
9462 }
9463
9466 }
9467
9469 {
9470 return false;
9471 }
9472
9473
9474
9476 {
9478 {
9479 #ifdef PLATFORM_CONSOLE
9480
9482 {
9484 if (menu)
9485 {
9487 }
9488 }
9489 #endif
9490 }
9491
9493 {
9496 }
9497
9499 {
9500 SetWeightDirty();
9502 }
9504 {
9507 }
9508
9510 {
9513 }
9515 {
9518 }
9519
9520 super.OnVariablesSynchronized();
9521 }
9522
9523
9524
9526 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9527 {
9528 if (!IsServerCheck(allow_client))
9529 return false;
9530
9532 return false;
9533
9536
9537 if (value <= (min + 0.001))
9538 value = min;
9539
9540 if (value == min)
9541 {
9542 if (destroy_config)
9543 {
9544 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9545 if (dstr)
9546 {
9548 this.Delete();
9549 return true;
9550 }
9551 }
9552 else if (destroy_forced)
9553 {
9555 this.Delete();
9556 return true;
9557 }
9558
9560 }
9561
9564
9566 {
9568
9569 if (delta)
9571 }
9572
9574
9575 return false;
9576 }
9577
9578
9580 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9581 {
9583 }
9584
9586 {
9589 }
9590
9592 {
9595 }
9596
9598 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9599 {
9600 float value_clamped = Math.Clamp(value, 0, 1);
9602 SetQuantity(result, destroy_config, destroy_forced);
9603 }
9604
9605
9608 {
9610 }
9611
9613 {
9615 }
9616
9617
9618
9619
9620
9621
9622
9623
9624
9625
9627 {
9628 int slot = -1;
9629 if (GetInventory())
9630 {
9631 InventoryLocation il = new InventoryLocation;
9632 GetInventory().GetCurrentInventoryLocation(il);
9634 }
9635
9637 }
9638
9640 {
9641 float quantity_max = 0;
9642
9644 {
9645 if (attSlotID != -1)
9646 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9647
9648 if (quantity_max <= 0)
9650 }
9651
9652 if (quantity_max <= 0)
9654
9655 return quantity_max;
9656 }
9657
9659 {
9661 }
9662
9664 {
9666 }
9667
9668
9670 {
9672 }
9673
9675 {
9677 }
9678
9680 {
9682 }
9683
9684
9686 {
9687
9688 float weightEx = GetWeightEx();
9689 float special = GetInventoryAndCargoWeight();
9690 return weightEx - special;
9691 }
9692
9693
9695 {
9697 }
9698
9700 {
9702 {
9703 #ifdef DEVELOPER
9704 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9705 {
9706 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9708 }
9709 #endif
9710
9712 }
9713 else if (HasEnergyManager())
9714 {
9715 #ifdef DEVELOPER
9716 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9717 {
9718 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9719 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9720 }
9721 #endif
9722 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9723 }
9724 else
9725 {
9726 #ifdef DEVELOPER
9727 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9728 {
9729 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9730 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9731 }
9732 #endif
9733 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9734 }
9735 }
9736
9739 {
9740 int item_count = 0;
9742
9743 if (GetInventory().GetCargo() != NULL)
9744 {
9745 item_count = GetInventory().GetCargo().GetItemCount();
9746 }
9747
9748 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9749 {
9750 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9751 if (item)
9752 item_count += item.GetNumberOfItems();
9753 }
9754 return item_count;
9755 }
9756
9759 {
9760 float weight = 0;
9761 float wetness = 1;
9762 if (include_wetness)
9765 {
9766 weight = wetness * m_ConfigWeight;
9767 }
9769 {
9770 weight = 1;
9771 }
9772 return weight;
9773 }
9774
9775
9776
9778 {
9779 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9780 {
9781 GameInventory inv = GetInventory();
9782 array<EntityAI> items = new array<EntityAI>;
9784 for (int i = 0; i < items.Count(); i++)
9785 {
9787 if (item)
9788 {
9790 }
9791 }
9792 }
9793 }
9794
9795
9796
9797
9799 {
9800 float energy = 0;
9801 if (HasEnergyManager())
9802 {
9803 energy = GetCompEM().GetEnergy();
9804 }
9805 return energy;
9806 }
9807
9808
9810 {
9811 super.OnEnergyConsumed();
9812
9814 }
9815
9817 {
9818 super.OnEnergyAdded();
9819
9821 }
9822
9823
9825 {
9826 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9827 {
9829 {
9830 float energy_0to1 = GetCompEM().GetEnergy0To1();
9832 }
9833 }
9834 }
9835
9836
9838 {
9839 return ConfigGetFloat("heatIsolation");
9840 }
9841
9843 {
9845 }
9846
9848 {
9849 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9850 if (
GetGame().ConfigIsExisting(paramPath))
9852
9853 return 0.0;
9854 }
9855
9857 {
9858 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9859 if (
GetGame().ConfigIsExisting(paramPath))
9861
9862 return 0.0;
9863 }
9864
9865 override void SetWet(
float value,
bool allow_client =
false)
9866 {
9867 if (!IsServerCheck(allow_client))
9868 return;
9869
9872
9874
9875 m_VarWet = Math.Clamp(value, min, max);
9876
9878 {
9881 }
9882 }
9883
9884 override void AddWet(
float value)
9885 {
9887 }
9888
9890 {
9892 }
9893
9895 {
9897 }
9898
9900 {
9902 }
9903
9905 {
9907 }
9908
9910 {
9912 }
9913
9915 {
9918 if (newLevel != oldLevel)
9919 {
9921 }
9922 }
9923
9925 {
9926 SetWeightDirty();
9927 }
9928
9930 {
9931 return GetWetLevelInternal(
m_VarWet);
9932 }
9933
9934
9935
9937 {
9939 }
9940
9942 {
9944 }
9945
9947 {
9949 }
9950
9952 {
9954 }
9955
9956
9957
9959 {
9960 if (ConfigIsExisting("itemModelLength"))
9961 {
9962 return ConfigGetFloat("itemModelLength");
9963 }
9964 return 0;
9965 }
9966
9968 {
9969 if (ConfigIsExisting("itemAttachOffset"))
9970 {
9971 return ConfigGetFloat("itemAttachOffset");
9972 }
9973 return 0;
9974 }
9975
9976 override void SetCleanness(
int value,
bool allow_client =
false)
9977 {
9978 if (!IsServerCheck(allow_client))
9979 return;
9980
9982
9984
9987 }
9988
9990 {
9992 }
9993
9995 {
9996 return true;
9997 }
9998
9999
10000
10001
10003 {
10005 }
10006
10008 {
10010 }
10011
10012
10013
10014
10015 override void SetColor(
int r,
int g,
int b,
int a)
10016 {
10022 }
10024 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10025 {
10030 }
10031
10033 {
10035 }
10036
10039 {
10040 int r,g,b,a;
10042 r = r/255;
10043 g = g/255;
10044 b = b/255;
10045 a = a/255;
10046 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10047 }
10048
10049
10050
10051 override void SetLiquidType(
int value,
bool allow_client =
false)
10052 {
10053 if (!IsServerCheck(allow_client))
10054 return;
10055
10060 }
10061
10063 {
10064 return ConfigGetInt("varLiquidTypeInit");
10065 }
10066
10068 {
10070 }
10071
10073 {
10075 SetFrozen(false);
10076 }
10077
10080 {
10081 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10082 }
10083
10084
10087 {
10088 PlayerBase nplayer;
10089 if (PlayerBase.CastTo(nplayer, player))
10090 {
10092
10093 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10094 }
10095 }
10096
10097
10100 {
10101 PlayerBase nplayer;
10102 if (PlayerBase.CastTo(nplayer,player))
10103 {
10104
10105 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10106
10107 }
10108
10109
10110 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10111
10112
10113 if (HasEnergyManager())
10114 {
10115 GetCompEM().UpdatePlugState();
10116 }
10117 }
10118
10119
10121 {
10122 super.OnPlacementStarted(player);
10123
10125 }
10126
10127 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10128 {
10130 {
10131 m_AdminLog.OnPlacementComplete(player,
this);
10132 }
10133
10134 super.OnPlacementComplete(player, position, orientation);
10135 }
10136
10137
10138
10139
10140
10142 {
10144 {
10145 return true;
10146 }
10147 else
10148 {
10149 return false;
10150 }
10151 }
10152
10153
10155 {
10157 {
10159 }
10160 }
10161
10162
10164 {
10166 }
10167
10169 {
10171 }
10172
10173 override void InsertAgent(
int agent,
float count = 1)
10174 {
10175 if (count < 1)
10176 return;
10177
10179 }
10180
10183 {
10185 }
10186
10187
10189 {
10191 }
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
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
10235 {
10237 return false;
10238 return true;
10239 }
10240
10242 {
10243
10245 }
10246
10247
10250 {
10251 super.CheckForRoofLimited(timeTresholdMS);
10252
10254 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10255 {
10256 m_PreviousRoofTestTime = time;
10257 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10258 }
10259 }
10260
10261
10263 {
10265 {
10266 return 0;
10267 }
10268
10269 if (GetInventory().GetAttachmentSlotsCount() != 0)
10270 {
10271 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10272 if (filter)
10273 return filter.GetProtectionLevel(type, false, system);
10274 else
10275 return 0;
10276 }
10277
10278 string subclassPath, entryName;
10279
10280 switch (type)
10281 {
10283 entryName = "biological";
10284 break;
10286 entryName = "chemical";
10287 break;
10288 default:
10289 entryName = "biological";
10290 break;
10291 }
10292
10293 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10294
10296 }
10297
10298
10299
10302 {
10303 if (!IsMagazine())
10305
10307 }
10308
10309
10310
10311
10312
10317 {
10318 return true;
10319 }
10320
10322 {
10324 }
10325
10326
10327
10328
10329
10331 {
10332 if (parent)
10333 {
10334 if (parent.IsInherited(DayZInfected))
10335 return true;
10336
10337 if (!parent.IsRuined())
10338 return true;
10339 }
10340
10341 return true;
10342 }
10343
10345 {
10346 if (!super.CanPutAsAttachment(parent))
10347 {
10348 return false;
10349 }
10350
10351 if (!IsRuined() && !parent.IsRuined())
10352 {
10353 return true;
10354 }
10355
10356 return false;
10357 }
10358
10360 {
10361
10362
10363
10364
10365 return super.CanReceiveItemIntoCargo(item);
10366 }
10367
10369 {
10370
10371
10372
10373
10374 GameInventory attachmentInv = attachment.GetInventory();
10376 {
10377 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10378 return false;
10379 }
10380
10381 InventoryLocation loc = new InventoryLocation();
10382 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10383 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10384 return false;
10385
10386 return super.CanReceiveAttachment(attachment, slotId);
10387 }
10388
10390 {
10391 if (!super.CanReleaseAttachment(attachment))
10392 return false;
10393
10394 return GetInventory().AreChildrenAccessible();
10395 }
10396
10397
10398
10399
10400
10401
10402
10403
10404
10405
10406
10407
10408
10409
10410
10411
10412
10413
10414
10415
10416
10418 {
10419 int id = muzzle_owner.GetMuzzleID();
10420 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10421
10422 if (WPOF_array)
10423 {
10424 for (int i = 0; i < WPOF_array.Count(); i++)
10425 {
10426 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10427
10428 if (WPOF)
10429 {
10430 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10431 }
10432 }
10433 }
10434 }
10435
10436
10438 {
10439 int id = muzzle_owner.GetMuzzleID();
10441
10442 if (WPOBE_array)
10443 {
10444 for (int i = 0; i < WPOBE_array.Count(); i++)
10445 {
10446 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10447
10448 if (WPOBE)
10449 {
10450 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10451 }
10452 }
10453 }
10454 }
10455
10456
10458 {
10459 int id = muzzle_owner.GetMuzzleID();
10460 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10461
10462 if (WPOOH_array)
10463 {
10464 for (int i = 0; i < WPOOH_array.Count(); i++)
10465 {
10466 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10467
10468 if (WPOOH)
10469 {
10470 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10471 }
10472 }
10473 }
10474 }
10475
10476
10478 {
10479 int id = muzzle_owner.GetMuzzleID();
10480 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10481
10482 if (WPOOH_array)
10483 {
10484 for (int i = 0; i < WPOOH_array.Count(); i++)
10485 {
10486 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10487
10488 if (WPOOH)
10489 {
10490 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10491 }
10492 }
10493 }
10494 }
10495
10496
10498 {
10499 int id = muzzle_owner.GetMuzzleID();
10500 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10501
10502 if (WPOOH_array)
10503 {
10504 for (int i = 0; i < WPOOH_array.Count(); i++)
10505 {
10506 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10507
10508 if (WPOOH)
10509 {
10510 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10511 }
10512 }
10513 }
10514 }
10515
10516
10517
10519 {
10521 {
10522 return true;
10523 }
10524
10525 return false;
10526 }
10527
10529 {
10531 {
10532 return true;
10533 }
10534
10535 return false;
10536 }
10537
10539 {
10541 {
10542 return true;
10543 }
10544
10545 return false;
10546 }
10547
10549 {
10550 return false;
10551 }
10552
10555 {
10556 return UATimeSpent.DEFAULT_DEPLOY;
10557 }
10558
10559
10560
10561
10563 {
10565 SetSynchDirty();
10566 }
10567
10569 {
10571 }
10572
10573
10575 {
10576 return false;
10577 }
10578
10581 {
10582 string att_type = "None";
10583
10584 if (ConfigIsExisting("soundAttType"))
10585 {
10586 att_type = ConfigGetString("soundAttType");
10587 }
10588
10590 }
10591
10593 {
10595 }
10596
10597
10598
10599
10600
10606
10608 {
10611
10613 }
10614
10615
10617 {
10619 return;
10620
10622
10625
10628
10629 SoundParameters params = new SoundParameters();
10633 }
10634
10635
10637 {
10639 return;
10640
10642 SetSynchDirty();
10643
10646 }
10647
10648
10650 {
10652 return;
10653
10655 SetSynchDirty();
10656
10659 }
10660
10662 {
10664 }
10665
10667 {
10669 }
10670
10673 {
10674 if (!
GetGame().IsDedicatedServer())
10675 {
10676 if (ConfigIsExisting("attachSoundSet"))
10677 {
10678 string cfg_path = "";
10679 string soundset = "";
10680 string type_name =
GetType();
10681
10684 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10685 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10686
10687 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10688 {
10689 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10690 {
10691 if (cfg_slot_array[i] == slot_type)
10692 {
10693 soundset = cfg_soundset_array[i];
10694 break;
10695 }
10696 }
10697 }
10698
10699 if (soundset != "")
10700 {
10701 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10703 }
10704 }
10705 }
10706 }
10707
10709 {
10710
10711 }
10712
10713 void OnApply(PlayerBase player);
10714
10716 {
10717 return 1.0;
10718 };
10719
10721 {
10723 }
10724
10726 {
10728 }
10729
10731
10733 {
10734 SetDynamicPhysicsLifeTime(0.01);
10736 }
10737
10739 {
10740 array<string> zone_names = new array<string>;
10741 GetDamageZones(zone_names);
10742 for (int i = 0; i < zone_names.Count(); i++)
10743 {
10744 SetHealthMax(zone_names.Get(i),"Health");
10745 }
10746 SetHealthMax("","Health");
10747 }
10748
10751 {
10752 float global_health = GetHealth01("","Health");
10753 array<string> zones = new array<string>;
10754 GetDamageZones(zones);
10755
10756 for (int i = 0; i < zones.Count(); i++)
10757 {
10758 SetHealth01(zones.Get(i),"Health",global_health);
10759 }
10760 }
10761
10764 {
10765 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10766 }
10767
10769 {
10770 if (!hasRootAsPlayer)
10771 {
10772 if (refParentIB)
10773 {
10774
10775 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10776 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10777
10778 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10779 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10780
10783 }
10784 else
10785 {
10786
10789 }
10790 }
10791 }
10792
10794 {
10796 {
10797 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10798 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10799 {
10800 float heatPermCoef = 1.0;
10802 while (ent)
10803 {
10804 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10805 ent = ent.GetHierarchyParent();
10806 }
10807
10808 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10809 }
10810 }
10811 }
10812
10814 {
10815
10816 EntityAI parent = GetHierarchyParent();
10817 if (!parent)
10818 {
10819 hasParent = false;
10820 hasRootAsPlayer = false;
10821 }
10822 else
10823 {
10824 hasParent = true;
10825 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10826 refParentIB =
ItemBase.Cast(parent);
10827 }
10828 }
10829
10830 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10831 {
10832
10833 }
10834
10836 {
10837
10838 return false;
10839 }
10840
10842 {
10843
10844
10845 return false;
10846 }
10847
10849 {
10850
10851 return false;
10852 }
10853
10856 {
10857 return !GetIsFrozen() &&
IsOpen();
10858 }
10859
10861 {
10862 bool hasParent = false, hasRootAsPlayer = false;
10864
10865 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10866 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10867
10868 if (wwtu || foodDecay)
10869 {
10873
10874 if (processWetness || processTemperature || processDecay)
10875 {
10877
10878 if (processWetness)
10879 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10880
10881 if (processTemperature)
10883
10884 if (processDecay)
10885 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10886 }
10887 }
10888 }
10889
10892 {
10894 }
10895
10897 {
10900
10901 return super.GetTemperatureFreezeThreshold();
10902 }
10903
10905 {
10908
10909 return super.GetTemperatureThawThreshold();
10910 }
10911
10913 {
10916
10917 return super.GetItemOverheatThreshold();
10918 }
10919
10921 {
10923 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10924
10925 return super.GetTemperatureFreezeTime();
10926 }
10927
10929 {
10931 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10932
10933 return super.GetTemperatureThawTime();
10934 }
10935
10940
10942 {
10943 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10944 }
10945
10947 {
10948 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10949 }
10950
10953 {
10955 }
10956
10958 {
10960 }
10961
10963 {
10965 }
10966
10969 {
10970 return null;
10971 }
10972
10975 {
10976 return false;
10977 }
10978
10980 {
10982 {
10985 if (!trg)
10986 {
10988 explosive = this;
10989 }
10990
10991 explosive.PairRemote(trg);
10993
10994 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10995 trg.SetPersistentPairID(persistentID);
10996 explosive.SetPersistentPairID(persistentID);
10997
10998 return true;
10999 }
11000 return false;
11001 }
11002
11005 {
11006 float ret = 1.0;
11009 ret *= GetHealth01();
11010
11011 return ret;
11012 }
11013
11014 #ifdef DEVELOPER
11015 override void SetDebugItem()
11016 {
11017 super.SetDebugItem();
11018 _itemBase = this;
11019 }
11020
11022 {
11023 string text = super.GetDebugText();
11024
11026 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11027
11028 return text;
11029 }
11030 #endif
11031
11033 {
11034 return true;
11035 }
11036
11038
11040
11042 {
11045 }
11046
11047
11055
11071}
11072
11074{
11076 if (entity)
11077 {
11078 bool is_item = entity.IsInherited(
ItemBase);
11079 if (is_item && full_quantity)
11080 {
11083 }
11084 }
11085 else
11086 {
11088 return NULL;
11089 }
11090 return entity;
11091}
11092
11094{
11095 if (item)
11096 {
11097 if (health > 0)
11098 item.SetHealth("", "", health);
11099
11100 if (item.CanHaveTemperature())
11101 {
11103 if (item.CanFreeze())
11104 item.SetFrozen(false);
11105 }
11106
11107 if (item.HasEnergyManager())
11108 {
11109 if (quantity >= 0)
11110 {
11111 item.GetCompEM().SetEnergy0To1(quantity);
11112 }
11113 else
11114 {
11116 }
11117 }
11118 else if (item.IsMagazine())
11119 {
11120 Magazine mag = Magazine.Cast(item);
11121 if (quantity >= 0)
11122 {
11123 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11124 }
11125 else
11126 {
11128 }
11129
11130 }
11131 else
11132 {
11133 if (quantity >= 0)
11134 {
11135 item.SetQuantityNormalized(quantity, false);
11136 }
11137 else
11138 {
11140 }
11141
11142 }
11143 }
11144}
11145
11146#ifdef DEVELOPER
11148#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.