6271{
6273 {
6274 return true;
6275 }
6276};
6277
6278
6279
6281{
6285
6287
6290
6291
6292
6293
6294
6303
6309
6314
6319
6340 protected bool m_IsResultOfSplit
6341
6343
6348
6349
6350
6352
6356
6357
6358
6360
6363
6364
6365
6371
6372
6380
6383
6384
6386
6387
6389
6390
6395
6396
6401
6402
6404
6405
6407 {
6412
6413 if (!
GetGame().IsDedicatedServer())
6414 {
6416 {
6418
6420 {
6422 }
6423 }
6424
6427 }
6428
6429 m_OldLocation = null;
6430
6432 {
6434 }
6435
6436 if (ConfigIsExisting("headSelectionsToHide"))
6437 {
6440 }
6441
6443 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6444 {
6446 }
6447
6449
6450 m_IsResultOfSplit = false;
6451
6453 }
6454
6456 {
6457 super.InitItemVariables();
6458
6464 m_Count = ConfigGetInt(
"count");
6465
6468
6473
6476
6481
6493
6497
6498
6501 if (ConfigIsExisting("canBeSplit"))
6502 {
6505 }
6506
6508 if (ConfigIsExisting("itemBehaviour"))
6510
6511
6514 RegisterNetSyncVariableInt("m_VarLiquidType");
6515 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6516
6517 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6518 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6519 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6520
6521 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6522 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6523 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6524 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6525
6526 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6527 RegisterNetSyncVariableBool("m_IsTakeable");
6528 RegisterNetSyncVariableBool("m_IsHologram");
6529
6532 {
6535 }
6536
6538
6540 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6542
6543 }
6544
6546 {
6548 }
6549
6551 {
6554 {
6559 }
6560 }
6561
6562 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6563 {
6565 {
6568 }
6569
6571 }
6572
6574 {
6580 }
6581
6583
6585 {
6587
6588 if (!action)
6589 {
6590 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6591 return;
6592 }
6593
6595 if (!ai)
6596 {
6598 return;
6599 }
6600
6602 if (!action_array)
6603 {
6604 action_array = new array<ActionBase_Basic>;
6606 }
6607 if (LogManager.IsActionLogEnable())
6608 {
6609 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6610 }
6611
6612 if (action_array.Find(action) != -1)
6613 {
6614 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6615 }
6616 else
6617 {
6618 action_array.Insert(action);
6619 }
6620 }
6621
6623 {
6625 ActionBase action = player.GetActionManager().GetAction(actionName);
6628
6629 if (action_array)
6630 {
6631 action_array.RemoveItem(action);
6632 }
6633 }
6634
6635
6636
6638 {
6639 ActionOverrideData overrideData = new ActionOverrideData();
6643
6645 if (!actionMap)
6646 {
6649 }
6650
6651 actionMap.Insert(this.
Type(), overrideData);
6652
6653 }
6654
6656
6658
6659
6661 {
6664
6667
6668 string config_to_search = "CfgVehicles";
6669 string muzzle_owner_config;
6670
6672 {
6673 if (IsInherited(Weapon))
6674 config_to_search = "CfgWeapons";
6675
6676 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6677
6678 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6679
6681
6682 if (config_OnFire_subclass_count > 0)
6683 {
6684 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6685
6686 for (int i = 0; i < config_OnFire_subclass_count; i++)
6687 {
6688 string particle_class = "";
6690 string config_OnFire_entry = config_OnFire_class + particle_class;
6691 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6692 WPOF_array.Insert(WPOF);
6693 }
6694
6695
6697 }
6698 }
6699
6701 {
6702 config_to_search = "CfgWeapons";
6703 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6704
6705 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6706
6708
6709 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6710 {
6711 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6712
6713 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6714 {
6715 string particle_class2 = "";
6717 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6718 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6719 WPOBE_array.Insert(WPOBE);
6720 }
6721
6722
6724 }
6725 }
6726 }
6727
6728
6730 {
6733
6735 {
6736 string config_to_search = "CfgVehicles";
6737
6738 if (IsInherited(Weapon))
6739 config_to_search = "CfgWeapons";
6740
6741 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6742 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6743
6744 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6745 {
6746
6748
6750 {
6752 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6754 return;
6755 }
6756
6759
6760
6761
6763 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6764
6765 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6766 {
6767 string particle_class = "";
6769 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6771
6772 if (entry_type == CT_CLASS)
6773 {
6774 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6775 WPOOH_array.Insert(WPOF);
6776 }
6777 }
6778
6779
6781 }
6782 }
6783 }
6784
6786 {
6788 }
6789
6791 {
6793 {
6795
6798
6801
6802 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6803 }
6804 }
6805
6807 {
6809 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6810
6812 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6813
6815 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6816
6818 {
6820 }
6821 }
6822
6824 {
6826 }
6827
6829 {
6832 else
6834
6836 {
6839 }
6840 else
6841 {
6844
6847 }
6848
6850 }
6851
6853 {
6855 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6856 }
6857
6859 {
6861 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6863 }
6864
6866 {
6868 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6869 }
6870
6872 {
6875
6876 OverheatingParticle OP = new OverheatingParticle();
6881
6883 }
6884
6886 {
6889
6890 return -1;
6891 }
6892
6894 {
6896 {
6899
6900 for (int i = count; i > 0; --i)
6901 {
6902 int id = i - 1;
6905
6908
6909 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6910 {
6911 if (p)
6912 {
6915 }
6916 }
6917 }
6918 }
6919 }
6920
6922 {
6924 {
6926 {
6927 int id = i - 1;
6929
6930 if (OP)
6931 {
6933
6934 if (p)
6935 {
6937 }
6938
6939 delete OP;
6940 }
6941 }
6942
6945 }
6946 }
6947
6950 {
6951 return 0.0;
6952 }
6953
6954
6956 {
6957 return 250;
6958 }
6959
6961 {
6962 return 0;
6963 }
6964
6967 {
6969 return true;
6970
6971 return false;
6972 }
6973
6976 {
6979
6981 {
6983 }
6984 else
6985 {
6986
6988 }
6989
6991 }
6992
6999 {
7000 return -1;
7001 }
7002
7003
7004
7005
7007 {
7009 {
7011 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7012
7013 if (r_index >= 0)
7014 {
7015 InventoryLocation r_il = new InventoryLocation;
7016 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7017
7018 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7021 {
7022 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7023 }
7025 {
7026 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7027 }
7028
7029 }
7030
7031 player.GetHumanInventory().ClearUserReservedLocation(this);
7032 }
7033
7036 }
7037
7038
7039
7040
7042 {
7043 return ItemBase.m_DebugActionsMask;
7044 }
7045
7047 {
7048 return ItemBase.m_DebugActionsMask & mask;
7049 }
7050
7052 {
7053 ItemBase.m_DebugActionsMask = mask;
7054 }
7055
7057 {
7058 ItemBase.m_DebugActionsMask |= mask;
7059 }
7060
7062 {
7063 ItemBase.m_DebugActionsMask &= ~mask;
7064 }
7065
7067 {
7069 {
7071 }
7072 else
7073 {
7075 }
7076 }
7077
7078
7080 {
7081 if (GetEconomyProfile())
7082 {
7083 float q_max = GetEconomyProfile().GetQuantityMax();
7084 if (q_max > 0)
7085 {
7086 float q_min = GetEconomyProfile().GetQuantityMin();
7087 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7088
7090 {
7091 ComponentEnergyManager comp = GetCompEM();
7093 {
7095 }
7096 }
7098 {
7100
7101 }
7102
7103 }
7104 }
7105 }
7106
7109 {
7110 EntityAI parent = GetHierarchyParent();
7111
7112 if (parent)
7113 {
7114 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7115 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7116 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7117 }
7118 }
7119
7122 {
7123 EntityAI parent = GetHierarchyParent();
7124
7125 if (parent)
7126 {
7127 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7128 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7129 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7130 }
7131 }
7132
7134 {
7135
7136
7137
7138
7140
7142 {
7143 if (ScriptInputUserData.CanStoreInputUserData())
7144 {
7145 ScriptInputUserData ctx = new ScriptInputUserData;
7151 ctx.
Write(use_stack_max);
7154
7156 {
7157 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7158 }
7159 }
7160 }
7161 else if (!
GetGame().IsMultiplayer())
7162 {
7164 }
7165 }
7166
7168 {
7170 }
7171
7173 {
7175 }
7176
7178 {
7180 }
7181
7183 {
7184
7185 return false;
7186 }
7187
7189 {
7190 return false;
7191 }
7192
7196 {
7197 return false;
7198 }
7199
7201 {
7202 return "";
7203 }
7204
7206
7208 {
7209 return false;
7210 }
7211
7213 {
7214 return true;
7215 }
7216
7217
7218
7220 {
7221 return true;
7222 }
7223
7225 {
7226 return true;
7227 }
7228
7230 {
7231 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7233 }
7234
7236 {
7238 }
7239
7241 {
7243 if (!is_being_placed)
7245 SetSynchDirty();
7246 }
7247
7248
7250
7252 {
7254 }
7255
7257 {
7259 }
7260
7262 {
7263 return 1;
7264 }
7265
7267 {
7268 return false;
7269 }
7270
7272 {
7274 SetSynchDirty();
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
7307
7308
7309
7310
7312 {
7313 super.OnMovedInsideCargo(container);
7314
7315 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7316 }
7317
7318 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7319 {
7320 super.EEItemLocationChanged(oldLoc,newLoc);
7321
7322 PlayerBase new_player = null;
7323 PlayerBase old_player = null;
7324
7325 if (newLoc.GetParent())
7326 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7327
7328 if (oldLoc.GetParent())
7329 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7330
7332 {
7333 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
7334
7335 if (r_index >= 0)
7336 {
7337 InventoryLocation r_il = new InventoryLocation;
7338 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7339
7340 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7343 {
7344 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7345 }
7347 {
7348 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7349 }
7350
7351 }
7352 }
7353
7355 {
7356 if (new_player)
7357 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
7358
7359 if (new_player == old_player)
7360 {
7361
7362 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7363 {
7365 {
7366 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7367 {
7368 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7369 }
7370 }
7371 else
7372 {
7373 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7374 }
7375 }
7376
7377 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7378 {
7379 int type = oldLoc.GetType();
7381 {
7382 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7383 }
7385 {
7386 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7387 }
7388 }
7389 if (!m_OldLocation)
7390 {
7391 m_OldLocation = new InventoryLocation;
7392 }
7393 m_OldLocation.Copy(oldLoc);
7394 }
7395 else
7396 {
7397 if (m_OldLocation)
7398 {
7399 m_OldLocation.Reset();
7400 }
7401 }
7402
7404 }
7405 else
7406 {
7407 if (new_player)
7408 {
7409 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7410 if (res_index >= 0)
7411 {
7412 InventoryLocation il = new InventoryLocation;
7413 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
7415 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
7418 {
7419 il.
GetParent().GetOnReleaseLock().Invoke(it);
7420 }
7422 {
7424 }
7425
7426 }
7427 }
7429 {
7430
7432 }
7433
7434 if (m_OldLocation)
7435 {
7436 m_OldLocation.Reset();
7437 }
7438 }
7439 }
7440
7441 override void EOnContact(IEntity other, Contact extra)
7442 {
7444 {
7445 int liquidType = -1;
7447 if (impactSpeed > 0.0)
7448 {
7450 #ifndef SERVER
7452 #else
7454 SetSynchDirty();
7455 #endif
7457 }
7458 }
7459
7460 #ifdef SERVER
7461 if (GetCompEM() && GetCompEM().IsPlugged())
7462 {
7463 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7464 GetCompEM().UnplugThis();
7465 }
7466 #endif
7467 }
7468
7470
7472 {
7474 }
7475
7477 {
7478
7479 }
7480
7482 {
7483 super.OnItemLocationChanged(old_owner, new_owner);
7484
7485 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7486 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7487
7488 if (!relatedPlayer && playerNew)
7489 relatedPlayer = playerNew;
7490
7491 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7492 {
7494 if (actionMgr)
7495 {
7496 ActionBase currentAction = actionMgr.GetRunningAction();
7497 if (currentAction)
7499 }
7500 }
7501
7502 Man ownerPlayerOld = null;
7503 Man ownerPlayerNew = null;
7504
7505 if (old_owner)
7506 {
7507 if (old_owner.
IsMan())
7508 {
7509 ownerPlayerOld = Man.Cast(old_owner);
7510 }
7511 else
7512 {
7513 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7514 }
7515 }
7516 else
7517 {
7519 {
7521
7522 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7523 {
7524 GetCompEM().UnplugThis();
7525 }
7526 }
7527 }
7528
7529 if (new_owner)
7530 {
7531 if (new_owner.
IsMan())
7532 {
7533 ownerPlayerNew = Man.Cast(new_owner);
7534 }
7535 else
7536 {
7537 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7538 }
7539 }
7540
7541 if (ownerPlayerOld != ownerPlayerNew)
7542 {
7543 if (ownerPlayerOld)
7544 {
7545 array<EntityAI> subItemsExit = new array<EntityAI>;
7547 for (int i = 0; i < subItemsExit.Count(); i++)
7548 {
7551 }
7552 }
7553
7554 if (ownerPlayerNew)
7555 {
7556 array<EntityAI> subItemsEnter = new array<EntityAI>;
7558 for (int j = 0; j < subItemsEnter.Count(); j++)
7559 {
7562 }
7563 }
7564 }
7565 else if (ownerPlayerNew != null)
7566 {
7567 PlayerBase nplayer;
7568 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7569 {
7570 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7572 for (int k = 0; k < subItemsUpdate.Count(); k++)
7573 {
7575 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7576 }
7577 }
7578 }
7579
7580 if (old_owner)
7581 old_owner.OnChildItemRemoved(this);
7582 if (new_owner)
7583 new_owner.OnChildItemReceived(this);
7584 }
7585
7586
7588 {
7589 super.EEDelete(parent);
7590 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7591 if (player)
7592 {
7594
7595 if (player.IsAlive())
7596 {
7597 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7598 if (r_index >= 0)
7599 {
7600 InventoryLocation r_il = new InventoryLocation;
7601 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7602
7603 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7606 {
7607 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7608 }
7610 {
7611 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7612 }
7613
7614 }
7615
7616 player.RemoveQuickBarEntityShortcut(this);
7617 }
7618 }
7619 }
7620
7622 {
7623 super.EEKilled(killer);
7624
7627 {
7628 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7629 {
7630 if (IsMagazine())
7631 {
7632 if (Magazine.Cast(this).GetAmmoCount() > 0)
7633 {
7635 }
7636 }
7637 else
7638 {
7640 }
7641 }
7642 }
7643 }
7644
7646 {
7647 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7648
7649 super.OnWasAttached(parent, slot_id);
7650
7653
7655 }
7656
7658 {
7659 super.OnWasDetached(parent, slot_id);
7660
7663 }
7664
7666 {
7667 int idx;
7670
7671 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7672 if (inventory_slots.Count() < 1)
7673 {
7674 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7675 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7676 }
7677 else
7678 {
7679 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7680 }
7681
7682 idx = inventory_slots.Find(slot);
7683 if (idx < 0)
7684 return "";
7685
7686 return attach_types.Get(idx);
7687 }
7688
7690 {
7691 int idx = -1;
7692 string slot;
7693
7696
7697 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7698 if (inventory_slots.Count() < 1)
7699 {
7700 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7701 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7702 }
7703 else
7704 {
7705 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7706 if (detach_types.Count() < 1)
7707 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7708 }
7709
7710 for (int i = 0; i < inventory_slots.Count(); i++)
7711 {
7712 slot = inventory_slots.Get(i);
7713 }
7714
7715 if (slot != "")
7716 {
7717 if (detach_types.Count() == 1)
7718 idx = 0;
7719 else
7720 idx = inventory_slots.Find(slot);
7721 }
7722 if (idx < 0)
7723 return "";
7724
7725 return detach_types.Get(idx);
7726 }
7727
7729 {
7730
7732
7733
7734 float min_time = 1;
7735 float max_time = 3;
7736 float delay = Math.RandomFloat(min_time, max_time);
7737
7738 explode_timer.Run(delay, this, "DoAmmoExplosion");
7739 }
7740
7742 {
7743 Magazine magazine = Magazine.Cast(this);
7744 int pop_sounds_count = 6;
7745 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7746
7747
7748 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7749 string sound_name = pop_sounds[ sound_idx ];
7751
7752
7753 magazine.ServerAddAmmoCount(-1);
7754
7755
7756 float min_temp_to_explode = 100;
7757
7758 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode)
7759 {
7761 }
7762 }
7763
7764
7765 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7766 {
7767 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7768
7769 const int CHANCE_DAMAGE_CARGO = 4;
7770 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7771 const int CHANCE_DAMAGE_NOTHING = 2;
7772
7774 {
7775 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7776 int chances;
7777 int rnd;
7778
7779 if (GetInventory().GetCargo())
7780 {
7781 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7782 rnd = Math.RandomInt(0,chances);
7783
7784 if (rnd < CHANCE_DAMAGE_CARGO)
7785 {
7787 }
7788 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7789 {
7791 }
7792 }
7793 else
7794 {
7795 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7796 rnd = Math.RandomInt(0,chances);
7797
7798 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7799 {
7801 }
7802 }
7803 }
7804 }
7805
7807 {
7808 if (GetInventory().GetCargo())
7809 {
7810 int item_count = GetInventory().GetCargo().GetItemCount();
7811 if (item_count > 0)
7812 {
7813 int random_pick = Math.RandomInt(0, item_count);
7815 if (!item.IsExplosive())
7816 {
7817 item.AddHealth("","",damage);
7818 return true;
7819 }
7820 }
7821 }
7822 return false;
7823 }
7824
7826 {
7827 int attachment_count = GetInventory().AttachmentCount();
7828 if (attachment_count > 0)
7829 {
7830 int random_pick = Math.RandomInt(0, attachment_count);
7831 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7832 if (!attachment.IsExplosive())
7833 {
7834 attachment.AddHealth("","",damage);
7835 return true;
7836 }
7837 }
7838 return false;
7839 }
7840
7842 {
7844 }
7845
7847 {
7849 return GetInventory().CanRemoveEntity();
7850
7851 return false;
7852 }
7853
7855 {
7857 return;
7858
7860 {
7861 if (ScriptInputUserData.CanStoreInputUserData())
7862 {
7863 ScriptInputUserData ctx = new ScriptInputUserData;
7868 ctx.
Write(destination_entity);
7872 }
7873 }
7874 else if (!
GetGame().IsMultiplayer())
7875 {
7877 }
7878 }
7879
7881 {
7883 return;
7884
7885 float split_quantity_new;
7889 InventoryLocation loc = new InventoryLocation;
7890
7891 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7892 {
7894 split_quantity_new = stack_max;
7895 else
7897
7898 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7899 if (new_item)
7900 {
7901 new_item.SetResultOfSplit(true);
7902 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7904 new_item.SetQuantity(split_quantity_new);
7905 }
7906 }
7907 else if (destination_entity && slot_id == -1)
7908 {
7909 if (quantity > stack_max)
7910 split_quantity_new = stack_max;
7911 else
7912 split_quantity_new = quantity;
7913
7915 {
7918 }
7919
7920 if (new_item)
7921 {
7922 new_item.SetResultOfSplit(true);
7923 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7925 new_item.SetQuantity(split_quantity_new);
7926 }
7927 }
7928 else
7929 {
7930 if (stack_max != 0)
7931 {
7933 {
7935 }
7936
7937 if (split_quantity_new == 0)
7938 {
7939 if (!
GetGame().IsMultiplayer())
7940 player.PhysicalPredictiveDropItem(this);
7941 else
7942 player.ServerDropEntity(this);
7943 return;
7944 }
7945
7947
7948 if (new_item)
7949 {
7950 new_item.SetResultOfSplit(true);
7951 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7953 new_item.SetQuantity(stack_max);
7954 new_item.PlaceOnSurface();
7955 }
7956 }
7957 }
7958 }
7959
7961 {
7963 return;
7964
7965 float split_quantity_new;
7969 InventoryLocation loc = new InventoryLocation;
7970
7971 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7972 {
7974 split_quantity_new = stack_max;
7975 else
7977
7978 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7979 if (new_item)
7980 {
7981 new_item.SetResultOfSplit(true);
7982 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7984 new_item.SetQuantity(split_quantity_new);
7985 }
7986 }
7987 else if (destination_entity && slot_id == -1)
7988 {
7989 if (quantity > stack_max)
7990 split_quantity_new = stack_max;
7991 else
7992 split_quantity_new = quantity;
7993
7995 {
7998 }
7999
8000 if (new_item)
8001 {
8002 new_item.SetResultOfSplit(true);
8003 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8005 new_item.SetQuantity(split_quantity_new);
8006 }
8007 }
8008 else
8009 {
8010 if (stack_max != 0)
8011 {
8013 {
8015 }
8016
8018
8019 if (new_item)
8020 {
8021 new_item.SetResultOfSplit(true);
8022 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8024 new_item.SetQuantity(stack_max);
8025 new_item.PlaceOnSurface();
8026 }
8027 }
8028 }
8029 }
8030
8032 {
8034 return;
8035
8037 {
8038 if (ScriptInputUserData.CanStoreInputUserData())
8039 {
8040 ScriptInputUserData ctx = new ScriptInputUserData;
8045 dst.WriteToContext(ctx);
8047 }
8048 }
8049 else if (!
GetGame().IsMultiplayer())
8050 {
8052 }
8053 }
8054
8056 {
8058 return;
8059
8061 {
8062 if (ScriptInputUserData.CanStoreInputUserData())
8063 {
8064 ScriptInputUserData ctx = new ScriptInputUserData;
8069 ctx.
Write(destination_entity);
8075 }
8076 }
8077 else if (!
GetGame().IsMultiplayer())
8078 {
8080 }
8081 }
8082
8084 {
8086 }
8087
8089 {
8091 return this;
8092
8094 float split_quantity_new;
8096 if (dst.IsValid())
8097 {
8098 int slot_id = dst.GetSlot();
8100
8101 if (quantity > stack_max)
8102 split_quantity_new = stack_max;
8103 else
8104 split_quantity_new = quantity;
8105
8107
8108 if (new_item)
8109 {
8110 new_item.SetResultOfSplit(true);
8111 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8114 }
8115
8116 return new_item;
8117 }
8118
8119 return null;
8120 }
8121
8123 {
8125 return;
8126
8128 float split_quantity_new;
8130 if (destination_entity)
8131 {
8133 if (quantity > stackable)
8134 split_quantity_new = stackable;
8135 else
8136 split_quantity_new = quantity;
8137
8138 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8139 if (new_item)
8140 {
8141 new_item.SetResultOfSplit(true);
8142 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8144 new_item.SetQuantity(split_quantity_new);
8145 }
8146 }
8147 }
8148
8150 {
8152 return;
8153
8155 {
8156 if (ScriptInputUserData.CanStoreInputUserData())
8157 {
8158 ScriptInputUserData ctx = new ScriptInputUserData;
8163 ItemBase destination_entity =
this;
8164 ctx.
Write(destination_entity);
8168 }
8169 }
8170 else if (!
GetGame().IsMultiplayer())
8171 {
8173 }
8174 }
8175
8177 {
8179 return;
8180
8182 float split_quantity_new;
8184 if (player)
8185 {
8187 if (quantity > stackable)
8188 split_quantity_new = stackable;
8189 else
8190 split_quantity_new = quantity;
8191
8192 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8193 new_item =
ItemBase.Cast(in_hands);
8194 if (new_item)
8195 {
8196 new_item.SetResultOfSplit(true);
8197 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8199 new_item.SetQuantity(split_quantity_new);
8200 }
8201 }
8202 }
8203
8205 {
8207 return;
8208
8210 float split_quantity_new = Math.Floor(quantity * 0.5);
8211
8213
8214 if (new_item)
8215 {
8216 if (new_item.GetQuantityMax() < split_quantity_new)
8217 {
8218 split_quantity_new = new_item.GetQuantityMax();
8219 }
8220
8221 new_item.SetResultOfSplit(true);
8222 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8223
8225 {
8228 }
8229 else
8230 {
8233 }
8234 }
8235 }
8236
8238 {
8240 return;
8241
8243 float split_quantity_new = Math.Floor(quantity / 2);
8244
8245 InventoryLocation invloc = new InventoryLocation;
8247
8249 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8250
8251 if (new_item)
8252 {
8253 if (new_item.GetQuantityMax() < split_quantity_new)
8254 {
8255 split_quantity_new = new_item.GetQuantityMax();
8256 }
8258 {
8261 }
8262 else
8263 {
8266 }
8267 }
8268 }
8269
8272 {
8273 SetWeightDirty();
8275
8276 if (parent)
8277 parent.OnAttachmentQuantityChangedEx(this, delta);
8278
8280 {
8282 {
8284 }
8286 {
8287 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8289 }
8290 }
8291
8292 }
8293
8296 {
8297
8298 }
8299
8302 {
8304 }
8305
8307 {
8308 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8309
8311 {
8312 if (newLevel == GameConstants.STATE_RUINED)
8313 {
8315 EntityAI parent = GetHierarchyParent();
8316 if (parent && parent.IsFireplace())
8317 {
8318 CargoBase cargo = GetInventory().GetCargo();
8319 if (cargo)
8320 {
8322 {
8324 }
8325 }
8326 }
8327 }
8328
8330 {
8331
8333 return;
8334 }
8335
8336 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8337 {
8339 }
8340 }
8341 }
8342
8343
8345 {
8346 super.OnRightClick();
8347
8349 {
8351 {
8352 if (ScriptInputUserData.CanStoreInputUserData())
8353 {
8354 vector m4[4];
8356
8357 EntityAI root = GetHierarchyRoot();
8358
8359 InventoryLocation dst = new InventoryLocation;
8361 {
8362 if (root)
8363 {
8364 root.GetTransform(m4);
8366 }
8367 else
8368 GetInventory().GetCurrentInventoryLocation(dst);
8369 }
8370 else
8371 {
8373
8374
8375 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8376 {
8377 if (root)
8378 {
8379 root.GetTransform(m4);
8381 }
8382 else
8383 GetInventory().GetCurrentInventoryLocation(dst);
8384 }
8385 else
8386 {
8387 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8388 }
8389 }
8390
8391 ScriptInputUserData ctx = new ScriptInputUserData;
8399 }
8400 }
8401 else if (!
GetGame().IsMultiplayer())
8402 {
8404 }
8405 }
8406 }
8407
8408 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8409 {
8410
8411 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8412 return false;
8413
8414 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8415 return false;
8416
8417
8419 return false;
8420
8421
8422 Magazine mag = Magazine.Cast(this);
8423 if (mag)
8424 {
8425 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8426 return false;
8427
8428 if (stack_max_limit)
8429 {
8430 Magazine other_mag = Magazine.Cast(other_item);
8431 if (other_item)
8432 {
8433 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8434 return false;
8435 }
8436
8437 }
8438 }
8439 else
8440 {
8441
8443 return false;
8444
8446 return false;
8447 }
8448
8449 PlayerBase player = null;
8450 if (CastTo(player, GetHierarchyRootPlayer()))
8451 {
8452 if (player.GetInventory().HasAttachment(this))
8453 return false;
8454
8455 if (player.IsItemsToDelete())
8456 return false;
8457 }
8458
8459 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8460 return false;
8461
8462 int slotID;
8464 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8465 return false;
8466
8467 return true;
8468 }
8469
8471 {
8473 }
8474
8476 {
8477 return m_IsResultOfSplit;
8478 }
8479
8481 {
8482 m_IsResultOfSplit = value;
8483 }
8484
8486 {
8488 }
8489
8491 {
8492 float other_item_quantity = other_item.GetQuantity();
8493 float this_free_space;
8494
8496
8498
8499 if (other_item_quantity > this_free_space)
8500 {
8501 return this_free_space;
8502 }
8503 else
8504 {
8505 return other_item_quantity;
8506 }
8507 }
8508
8510 {
8512 }
8513
8515 {
8517 return;
8518
8519 if (!IsMagazine() && other_item)
8520 {
8522 if (quantity_used != 0)
8523 {
8524 float hp1 = GetHealth01("","");
8525 float hp2 = other_item.GetHealth01("","");
8526 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8527 hpResult = hpResult / (
GetQuantity() + quantity_used);
8528
8529 hpResult *= GetMaxHealth();
8530 Math.Round(hpResult);
8531 SetHealth("", "Health", hpResult);
8532
8534 other_item.AddQuantity(-quantity_used);
8535 }
8536 }
8538 }
8539
8541 {
8542 #ifdef SERVER
8543 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8544 GetHierarchyParent().IncreaseLifetimeUp();
8545 #endif
8546 };
8547
8549 {
8550 PlayerBase p = PlayerBase.Cast(player);
8551
8552 array<int> recipesIds = p.m_Recipes;
8553 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8554 if (moduleRecipesManager)
8555 {
8556 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8557 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8558 }
8559
8560 for (int i = 0;i < recipesIds.Count(); i++)
8561 {
8562 int key = recipesIds.Get(i);
8563 string recipeName = moduleRecipesManager.GetRecipeName(key);
8565 }
8566 }
8567
8568
8569 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8570 {
8571 super.GetDebugActions(outputList);
8572
8573
8578
8579
8583
8587
8588
8591
8592
8594 {
8597 }
8598
8600
8603
8607 }
8608
8609
8610
8611
8613 {
8614 super.OnAction(action_id, player, ctx);
8615 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8616 {
8617 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8618 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8619 PlayerBase p = PlayerBase.Cast(player);
8620 if (
EActions.RECIPES_RANGE_START < 1000)
8621 {
8622 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8623 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8624 }
8625 }
8626 #ifndef SERVER
8627 else if (action_id ==
EActions.WATCH_PLAYER)
8628 {
8629 PluginDeveloper.SetDeveloperItemClientEx(player);
8630 }
8631 #endif
8633 {
8634 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8635 {
8636 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8637 OnDebugButtonPressServer(id + 1);
8638 }
8639
8640 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8641 {
8642 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8644 }
8645
8646 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8647 {
8648 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8650 }
8651
8652 else if (action_id ==
EActions.ADD_QUANTITY)
8653 {
8654 if (IsMagazine())
8655 {
8656 Magazine mag = Magazine.Cast(this);
8657 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8658 }
8659 else
8660 {
8662 }
8663
8664 if (m_EM)
8665 {
8666 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8667 }
8668
8669 }
8670
8671 else if (action_id ==
EActions.REMOVE_QUANTITY)
8672 {
8673 if (IsMagazine())
8674 {
8675 Magazine mag2 = Magazine.Cast(this);
8676 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8677 }
8678 else
8679 {
8681 }
8682 if (m_EM)
8683 {
8684 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8685 }
8686
8687 }
8688
8689 else if (action_id ==
EActions.SET_QUANTITY_0)
8690 {
8692
8693 if (m_EM)
8694 {
8695 m_EM.SetEnergy(0);
8696 }
8697 }
8698
8699 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8700 {
8702
8703 if (m_EM)
8704 {
8705 m_EM.SetEnergy(m_EM.GetEnergyMax());
8706 }
8707 }
8708
8709 else if (action_id ==
EActions.ADD_HEALTH)
8710 {
8711 AddHealth("","",GetMaxHealth("","Health")/5);
8712 }
8713 else if (action_id ==
EActions.REMOVE_HEALTH)
8714 {
8715 AddHealth("","",-GetMaxHealth("","Health")/5);
8716 }
8717 else if (action_id ==
EActions.DESTROY_HEALTH)
8718 {
8719 SetHealth01("","",0);
8720 }
8721 else if (action_id ==
EActions.WATCH_ITEM)
8722 {
8724 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8725 #ifdef DEVELOPER
8726 SetDebugDeveloper_item(this);
8727 #endif
8728 }
8729
8730 else if (action_id ==
EActions.ADD_TEMPERATURE)
8731 {
8732 AddTemperature(20);
8733
8734 }
8735
8736 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8737 {
8738 AddTemperature(-20);
8739
8740 }
8741
8742 else if (action_id ==
EActions.FLIP_FROZEN)
8743 {
8744 SetFrozen(!GetIsFrozen());
8745
8746 }
8747
8748 else if (action_id ==
EActions.ADD_WETNESS)
8749 {
8751
8752 }
8753
8754 else if (action_id ==
EActions.REMOVE_WETNESS)
8755 {
8757
8758 }
8759
8760 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8761 {
8764
8765
8766 }
8767
8768 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8769 {
8772 }
8773
8774 else if (action_id ==
EActions.MAKE_SPECIAL)
8775 {
8776 auto debugParams = DebugSpawnParams.WithPlayer(player);
8777 OnDebugSpawnEx(debugParams);
8778 }
8779
8780 else if (action_id ==
EActions.DELETE)
8781 {
8782 Delete();
8783 }
8784
8785 }
8786
8787
8788 return false;
8789 }
8790
8791
8792
8793
8797
8800
8801
8802
8804 {
8805 return false;
8806 }
8807
8808
8810 {
8811 return true;
8812 }
8813
8814
8816 {
8817 return true;
8818 }
8819
8820
8821
8823 {
8824 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8826 }
8827
8830 {
8831 return null;
8832 }
8833
8835 {
8836 return false;
8837 }
8838
8840 {
8841 return false;
8842 }
8843
8847
8848
8850 {
8851 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8852 return module_repairing.CanRepair(this, item_repair_kit);
8853 }
8854
8855
8856 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8857 {
8858 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8859 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8860 }
8861
8862
8864 {
8865
8866
8867
8868
8869
8870
8871
8872
8873 return 1;
8874 }
8875
8876
8877
8879 {
8881 }
8882
8883
8884
8886 {
8888 }
8889
8890
8899 {
8900 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8901
8902 if (player)
8903 {
8904 player.MessageStatus(text);
8905 }
8906 }
8907
8908
8917 {
8918 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8919
8920 if (player)
8921 {
8922 player.MessageAction(text);
8923 }
8924 }
8925
8926
8935 {
8936 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8937
8938 if (player)
8939 {
8940 player.MessageFriendly(text);
8941 }
8942 }
8943
8944
8953 {
8954 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8955
8956 if (player)
8957 {
8958 player.MessageImportant(text);
8959 }
8960 }
8961
8963 {
8964 return true;
8965 }
8966
8967
8968 override bool KindOf(
string tag)
8969 {
8970 bool found = false;
8971 string item_name = this.
GetType();
8974
8975 int array_size = item_tag_array.Count();
8976 for (int i = 0; i < array_size; i++)
8977 {
8978 if (item_tag_array.Get(i) == tag)
8979 {
8980 found = true;
8981 break;
8982 }
8983 }
8984 return found;
8985 }
8986
8987
8989 {
8990
8991 super.OnRPC(sender, rpc_type,ctx);
8992
8993
8994 switch (rpc_type)
8995 {
8996 #ifndef SERVER
8997 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8998 Param2<bool, string> p = new Param2<bool, string>(false, "");
8999
9001 return;
9002
9003 bool play = p.param1;
9004 string soundSet = p.param2;
9005
9006 if (play)
9007 {
9009 {
9011 {
9013 }
9014 }
9015 else
9016 {
9018 }
9019 }
9020 else
9021 {
9023 }
9024
9025 break;
9026 #endif
9027
9028 }
9029
9031 {
9033 }
9034 }
9035
9036
9037
9038
9040 {
9041 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9042 return plugin.GetID(
name);
9043 }
9044
9046 {
9047 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9048 return plugin.GetName(id);
9049 }
9050
9053 {
9054
9055
9056 int varFlags;
9057 if (!ctx.
Read(varFlags))
9058 return;
9059
9060 if (varFlags & ItemVariableFlags.FLOAT)
9061 {
9063 }
9064 }
9065
9067 {
9068
9069 super.SerializeNumericalVars(floats_out);
9070
9071
9072
9074 {
9076 }
9077
9079 {
9081 }
9082
9084 {
9086 }
9087
9089 {
9094 }
9095
9097 {
9099 }
9100 }
9101
9103 {
9104
9105 super.DeSerializeNumericalVars(floats);
9106
9107
9108 int index = 0;
9109 int mask = Math.Round(floats.Get(index));
9110
9111 index++;
9112
9114 {
9116 {
9118 }
9119 else
9120 {
9121 float quantity = floats.Get(index);
9123 }
9124 index++;
9125 }
9126
9128 {
9129 float wet = floats.Get(index);
9131 index++;
9132 }
9133
9135 {
9136 int liquidtype = Math.Round(floats.Get(index));
9138 index++;
9139 }
9140
9142 {
9144 index++;
9146 index++;
9148 index++;
9150 index++;
9151 }
9152
9154 {
9155 int cleanness = Math.Round(floats.Get(index));
9157 index++;
9158 }
9159 }
9160
9162 {
9163 super.WriteVarsToCTX(ctx);
9164
9165
9167 {
9169 }
9170
9172 {
9174 }
9175
9177 {
9179 }
9180
9182 {
9183 int r,g,b,a;
9189 }
9190
9192 {
9194 }
9195 }
9196
9198 {
9199 if (!super.ReadVarsFromCTX(ctx,version))
9200 return false;
9201
9202 int intValue;
9203 float value;
9204
9205 if (version < 140)
9206 {
9207 if (!ctx.
Read(intValue))
9208 return false;
9209
9210 m_VariablesMask = intValue;
9211 }
9212
9214 {
9215 if (!ctx.
Read(value))
9216 return false;
9217
9219 {
9221 }
9222 else
9223 {
9225 }
9226 }
9227
9228 if (version < 140)
9229 {
9231 {
9232 if (!ctx.
Read(value))
9233 return false;
9234 SetTemperatureDirect(value);
9235 }
9236 }
9237
9239 {
9240 if (!ctx.
Read(value))
9241 return false;
9243 }
9244
9246 {
9247 if (!ctx.
Read(intValue))
9248 return false;
9250 }
9251
9253 {
9254 int r,g,b,a;
9256 return false;
9258 return false;
9260 return false;
9262 return false;
9263
9265 }
9266
9268 {
9269 if (!ctx.
Read(intValue))
9270 return false;
9272 }
9273
9274 if (version >= 138 && version < 140)
9275 {
9277 {
9278 if (!ctx.
Read(intValue))
9279 return false;
9280 SetFrozen(intValue);
9281 }
9282 }
9283
9284 return true;
9285 }
9286
9287
9289 {
9292 {
9294 }
9295
9296 if (!super.OnStoreLoad(ctx, version))
9297 {
9299 return false;
9300 }
9301
9302 if (version >= 114)
9303 {
9304 bool hasQuickBarIndexSaved;
9305
9306 if (!ctx.
Read(hasQuickBarIndexSaved))
9307 {
9309 return false;
9310 }
9311
9312 if (hasQuickBarIndexSaved)
9313 {
9314 int itmQBIndex;
9315
9316
9317 if (!ctx.
Read(itmQBIndex))
9318 {
9320 return false;
9321 }
9322
9323 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9324 if (itmQBIndex != -1 && parentPlayer)
9325 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9326 }
9327 }
9328 else
9329 {
9330
9331 PlayerBase player;
9332 int itemQBIndex;
9333 if (version ==
int.
MAX)
9334 {
9335 if (!ctx.
Read(itemQBIndex))
9336 {
9338 return false;
9339 }
9340 }
9341 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9342 {
9343
9344 if (!ctx.
Read(itemQBIndex))
9345 {
9347 return false;
9348 }
9349 if (itemQBIndex != -1 && player)
9350 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9351 }
9352 }
9353
9354 if (version < 140)
9355 {
9356
9357 if (!LoadVariables(ctx, version))
9358 {
9360 return false;
9361 }
9362 }
9363
9364
9366 {
9368 return false;
9369 }
9370 if (version >= 132)
9371 {
9373 if (raib)
9374 {
9376 {
9378 return false;
9379 }
9380 }
9381 }
9382
9384 return true;
9385 }
9386
9387
9388
9390 {
9391 super.OnStoreSave(ctx);
9392
9393 PlayerBase player;
9394 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9395 {
9397
9398 int itemQBIndex = -1;
9399 itemQBIndex = player.FindQuickBarEntityIndex(this);
9400 ctx.
Write(itemQBIndex);
9401 }
9402 else
9403 {
9405 }
9406
9408
9410 if (raib)
9411 {
9413 }
9414 }
9415
9416
9418 {
9419 super.AfterStoreLoad();
9420
9422 {
9424 }
9425
9427 {
9430 }
9431 }
9432
9434 {
9435 super.EEOnAfterLoad();
9436
9438 {
9440 }
9441
9444 }
9445
9447 {
9448 return false;
9449 }
9450
9451
9452
9454 {
9456 {
9457 #ifdef PLATFORM_CONSOLE
9458
9460 {
9462 if (menu)
9463 {
9465 }
9466 }
9467 #endif
9468 }
9469
9471 {
9474 }
9475
9477 {
9478 SetWeightDirty();
9480 }
9482 {
9485 }
9486
9488 {
9491 }
9493 {
9496 }
9497
9498 super.OnVariablesSynchronized();
9499 }
9500
9501
9502
9504 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9505 {
9506 if (!IsServerCheck(allow_client))
9507 return false;
9508
9510 return false;
9511
9514
9515 if (value <= (min + 0.001))
9516 value = min;
9517
9518 if (value == min)
9519 {
9520 if (destroy_config)
9521 {
9522 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9523 if (dstr)
9524 {
9526 this.Delete();
9527 return true;
9528 }
9529 }
9530 else if (destroy_forced)
9531 {
9533 this.Delete();
9534 return true;
9535 }
9536
9538 }
9539
9542
9544 {
9546
9547 if (delta)
9549 }
9550
9552
9553 return false;
9554 }
9555
9556
9558 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9559 {
9561 }
9562
9564 {
9567 }
9568
9570 {
9573 }
9574
9577 {
9578 float value_clamped = Math.Clamp(value, 0, 1);
9580 SetQuantity(result, destroy_config, destroy_forced);
9581 }
9582
9583
9586 {
9588 }
9589
9591 {
9593 }
9594
9595
9596
9597
9598
9599
9600
9601
9602
9603
9605 {
9606 int slot = -1;
9607 if (GetInventory())
9608 {
9609 InventoryLocation il = new InventoryLocation;
9610 GetInventory().GetCurrentInventoryLocation(il);
9612 }
9613
9615 }
9616
9618 {
9619 float quantity_max = 0;
9620
9622 {
9623 if (attSlotID != -1)
9624 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9625
9626 if (quantity_max <= 0)
9628 }
9629
9630 if (quantity_max <= 0)
9632
9633 return quantity_max;
9634 }
9635
9637 {
9639 }
9640
9642 {
9644 }
9645
9646
9648 {
9650 }
9651
9653 {
9655 }
9656
9658 {
9660 }
9661
9662
9664 {
9665
9666 float weightEx = GetWeightEx();
9667 float special = GetInventoryAndCargoWeight();
9668 return weightEx - special;
9669 }
9670
9671
9673 {
9675 }
9676
9678 {
9680 {
9681 #ifdef DEVELOPER
9682 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9683 {
9684 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9686 }
9687 #endif
9688
9690 }
9691 else if (HasEnergyManager())
9692 {
9693 #ifdef DEVELOPER
9694 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9695 {
9696 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9697 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9698 }
9699 #endif
9700 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
9701 }
9702 else
9703 {
9704 #ifdef DEVELOPER
9705 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9706 {
9707 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9708 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9709 }
9710 #endif
9711 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified());
9712 }
9713 }
9714
9717 {
9718 int item_count = 0;
9720
9721 if (GetInventory().GetCargo() != NULL)
9722 {
9723 item_count = GetInventory().GetCargo().GetItemCount();
9724 }
9725
9726 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9727 {
9728 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9729 if (item)
9730 item_count += item.GetNumberOfItems();
9731 }
9732 return item_count;
9733 }
9734
9737 {
9738 float weight = 0;
9739 float wetness = 1;
9740 if (include_wetness)
9743 {
9744 weight = wetness * m_ConfigWeight;
9745 }
9747 {
9748 weight = 1;
9749 }
9750 return weight;
9751 }
9752
9753
9754
9756 {
9757 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9758 {
9759 GameInventory inv = GetInventory();
9760 array<EntityAI> items = new array<EntityAI>;
9762 for (int i = 0; i < items.Count(); i++)
9763 {
9765 if (item)
9766 {
9768 }
9769 }
9770 }
9771 }
9772
9773
9774
9775
9777 {
9778 float energy = 0;
9779 if (HasEnergyManager())
9780 {
9781 energy = GetCompEM().GetEnergy();
9782 }
9783 return energy;
9784 }
9785
9786
9788 {
9789 super.OnEnergyConsumed();
9790
9792 }
9793
9795 {
9796 super.OnEnergyAdded();
9797
9799 }
9800
9801
9803 {
9804 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9805 {
9807 {
9808 float energy_0to1 = GetCompEM().GetEnergy0To1();
9810 }
9811 }
9812 }
9813
9814
9816 {
9817 return ConfigGetFloat("heatIsolation");
9818 }
9819
9821 {
9823 }
9824
9826 {
9827 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9828 if (
GetGame().ConfigIsExisting(paramPath))
9830
9831 return 0.0;
9832 }
9833
9835 {
9836 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9837 if (
GetGame().ConfigIsExisting(paramPath))
9839
9840 return 0.0;
9841 }
9842
9843 override void SetWet(
float value,
bool allow_client =
false)
9844 {
9845 if (!IsServerCheck(allow_client))
9846 return;
9847
9850
9852
9853 m_VarWet = Math.Clamp(value, min, max);
9854
9856 {
9859 }
9860 }
9861
9862 override void AddWet(
float value)
9863 {
9865 }
9866
9868 {
9870 }
9871
9873 {
9875 }
9876
9878 {
9880 }
9881
9883 {
9885 }
9886
9888 {
9890 }
9891
9893 {
9896 if (newLevel != oldLevel)
9897 {
9899 }
9900 }
9901
9903 {
9904 SetWeightDirty();
9905 }
9906
9908 {
9909 return GetWetLevelInternal(
m_VarWet);
9910 }
9911
9912
9913
9915 {
9917 }
9918
9920 {
9922 }
9923
9925 {
9927 }
9928
9930 {
9932 }
9933
9934
9935
9937 {
9938 if (ConfigIsExisting("itemModelLength"))
9939 {
9940 return ConfigGetFloat("itemModelLength");
9941 }
9942 return 0;
9943 }
9944
9946 {
9947 if (ConfigIsExisting("itemAttachOffset"))
9948 {
9949 return ConfigGetFloat("itemAttachOffset");
9950 }
9951 return 0;
9952 }
9953
9954 override void SetCleanness(
int value,
bool allow_client =
false)
9955 {
9956 if (!IsServerCheck(allow_client))
9957 return;
9958
9960
9962
9965 }
9966
9968 {
9970 }
9971
9973 {
9974 return true;
9975 }
9976
9977
9978
9979
9981 {
9983 }
9984
9986 {
9988 }
9989
9990
9991
9992
9993 override void SetColor(
int r,
int g,
int b,
int a)
9994 {
10000 }
10002 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10003 {
10008 }
10009
10011 {
10013 }
10014
10017 {
10018 int r,g,b,a;
10020 r = r/255;
10021 g = g/255;
10022 b = b/255;
10023 a = a/255;
10024 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10025 }
10026
10027
10028
10029 override void SetLiquidType(
int value,
bool allow_client =
false)
10030 {
10031 if (!IsServerCheck(allow_client))
10032 return;
10033
10038 }
10039
10041 {
10042 return ConfigGetInt("varLiquidTypeInit");
10043 }
10044
10046 {
10048 }
10049
10051 {
10053 SetFrozen(false);
10054 }
10055
10058 {
10059 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10060 }
10061
10062
10065 {
10066 PlayerBase nplayer;
10067 if (PlayerBase.CastTo(nplayer, player))
10068 {
10070
10071 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10072 }
10073 }
10074
10075
10078 {
10079 PlayerBase nplayer;
10080 if (PlayerBase.CastTo(nplayer,player))
10081 {
10082
10083 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10084
10085 }
10086
10087
10088 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10089
10090
10091 if (HasEnergyManager())
10092 {
10093 GetCompEM().UpdatePlugState();
10094 }
10095 }
10096
10097
10099 {
10100 super.OnPlacementStarted(player);
10101
10103 }
10104
10105 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10106 {
10108 {
10109 m_AdminLog.OnPlacementComplete(player,
this);
10110 }
10111
10112 super.OnPlacementComplete(player, position, orientation);
10113 }
10114
10115
10116
10117
10118
10120 {
10122 {
10123 return true;
10124 }
10125 else
10126 {
10127 return false;
10128 }
10129 }
10130
10131
10133 {
10135 {
10137 }
10138 }
10139
10140
10142 {
10144 }
10145
10147 {
10149 }
10150
10151 override void InsertAgent(
int agent,
float count = 1)
10152 {
10153 if (count < 1)
10154 return;
10155
10157 }
10158
10161 {
10163 }
10164
10165
10167 {
10169 }
10170
10171
10172
10173
10174
10175
10176
10177
10178
10179
10180
10181
10182
10183
10184
10185
10186
10187
10188
10189
10190
10191
10192
10193
10194
10195
10196
10197
10198
10199
10200
10201
10202
10203
10204
10205
10206
10207
10208
10209
10210
10211
10213 {
10215 return false;
10216 return true;
10217 }
10218
10220 {
10221
10223 }
10224
10225
10228 {
10229 super.CheckForRoofLimited(timeTresholdMS);
10230
10232 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10233 {
10234 m_PreviousRoofTestTime = time;
10235 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10236 }
10237 }
10238
10239
10241 {
10243 {
10244 return 0;
10245 }
10246
10247 if (GetInventory().GetAttachmentSlotsCount() != 0)
10248 {
10249 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10250 if (filter)
10251 return filter.GetProtectionLevel(type, false, system);
10252 else
10253 return 0;
10254 }
10255
10256 string subclassPath, entryName;
10257
10258 switch (type)
10259 {
10261 entryName = "biological";
10262 break;
10264 entryName = "chemical";
10265 break;
10266 default:
10267 entryName = "biological";
10268 break;
10269 }
10270
10271 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10272
10274 }
10275
10276
10277
10280 {
10281 if (!IsMagazine())
10283
10285 }
10286
10287
10288
10289
10290
10295 {
10296 return true;
10297 }
10298
10300 {
10302 }
10303
10304
10305
10306
10307
10309 {
10310 if (parent)
10311 {
10312 if (parent.IsInherited(DayZInfected))
10313 return true;
10314
10315 if (!parent.IsRuined())
10316 return true;
10317 }
10318
10319 return true;
10320 }
10321
10323 {
10324 if (!super.CanPutAsAttachment(parent))
10325 {
10326 return false;
10327 }
10328
10329 if (!IsRuined() && !parent.IsRuined())
10330 {
10331 return true;
10332 }
10333
10334 return false;
10335 }
10336
10338 {
10339
10340
10341
10342
10343 return super.CanReceiveItemIntoCargo(item);
10344 }
10345
10347 {
10348
10349
10350
10351
10352 GameInventory attachmentInv = attachment.GetInventory();
10354 {
10355 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10356 return false;
10357 }
10358
10359 InventoryLocation loc = new InventoryLocation();
10360 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10361 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10362 return false;
10363
10364 return super.CanReceiveAttachment(attachment, slotId);
10365 }
10366
10368 {
10369 if (!super.CanReleaseAttachment(attachment))
10370 return false;
10371
10372 return GetInventory().AreChildrenAccessible();
10373 }
10374
10375
10376
10377
10378
10379
10380
10381
10382
10383
10384
10385
10386
10387
10388
10389
10390
10391
10392
10393
10394
10396 {
10397 int id = muzzle_owner.GetMuzzleID();
10398 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10399
10400 if (WPOF_array)
10401 {
10402 for (int i = 0; i < WPOF_array.Count(); i++)
10403 {
10404 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10405
10406 if (WPOF)
10407 {
10408 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10409 }
10410 }
10411 }
10412 }
10413
10414
10416 {
10417 int id = muzzle_owner.GetMuzzleID();
10419
10420 if (WPOBE_array)
10421 {
10422 for (int i = 0; i < WPOBE_array.Count(); i++)
10423 {
10424 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10425
10426 if (WPOBE)
10427 {
10428 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10429 }
10430 }
10431 }
10432 }
10433
10434
10436 {
10437 int id = muzzle_owner.GetMuzzleID();
10438 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10439
10440 if (WPOOH_array)
10441 {
10442 for (int i = 0; i < WPOOH_array.Count(); i++)
10443 {
10444 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10445
10446 if (WPOOH)
10447 {
10448 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10449 }
10450 }
10451 }
10452 }
10453
10454
10456 {
10457 int id = muzzle_owner.GetMuzzleID();
10458 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10459
10460 if (WPOOH_array)
10461 {
10462 for (int i = 0; i < WPOOH_array.Count(); i++)
10463 {
10464 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10465
10466 if (WPOOH)
10467 {
10468 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10469 }
10470 }
10471 }
10472 }
10473
10474
10476 {
10477 int id = muzzle_owner.GetMuzzleID();
10478 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10479
10480 if (WPOOH_array)
10481 {
10482 for (int i = 0; i < WPOOH_array.Count(); i++)
10483 {
10484 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10485
10486 if (WPOOH)
10487 {
10488 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10489 }
10490 }
10491 }
10492 }
10493
10494
10495
10497 {
10499 {
10500 return true;
10501 }
10502
10503 return false;
10504 }
10505
10507 {
10509 {
10510 return true;
10511 }
10512
10513 return false;
10514 }
10515
10517 {
10519 {
10520 return true;
10521 }
10522
10523 return false;
10524 }
10525
10527 {
10528 return false;
10529 }
10530
10533 {
10534 return UATimeSpent.DEFAULT_DEPLOY;
10535 }
10536
10537
10538
10539
10541 {
10543 SetSynchDirty();
10544 }
10545
10547 {
10549 }
10550
10551
10553 {
10554 return false;
10555 }
10556
10559 {
10560 string att_type = "None";
10561
10562 if (ConfigIsExisting("soundAttType"))
10563 {
10564 att_type = ConfigGetString("soundAttType");
10565 }
10566
10568 }
10569
10571 {
10573 }
10574
10575
10576
10577
10578
10582
10584 {
10587
10589 }
10590
10591
10593 {
10595 return;
10596
10598
10601
10604
10605 SoundParameters params = new SoundParameters();
10609 }
10610
10611
10613 {
10615 return;
10616
10618 SetSynchDirty();
10619
10622 }
10623
10624
10626 {
10628 return;
10629
10631 SetSynchDirty();
10632
10635 }
10636
10638 {
10640 }
10641
10643 {
10645 }
10646
10649 {
10650 if (!
GetGame().IsDedicatedServer())
10651 {
10652 if (ConfigIsExisting("attachSoundSet"))
10653 {
10654 string cfg_path = "";
10655 string soundset = "";
10656 string type_name =
GetType();
10657
10660 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10661 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10662
10663 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10664 {
10665 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10666 {
10667 if (cfg_slot_array[i] == slot_type)
10668 {
10669 soundset = cfg_soundset_array[i];
10670 break;
10671 }
10672 }
10673 }
10674
10675 if (soundset != "")
10676 {
10677 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10679 }
10680 }
10681 }
10682 }
10683
10685 {
10686
10687 }
10688
10689 void OnApply(PlayerBase player);
10690
10692 {
10693 return 1.0;
10694 };
10695
10697 {
10699 }
10700
10702 {
10704 }
10705
10707
10709 {
10710 SetDynamicPhysicsLifeTime(0.01);
10712 }
10713
10715 {
10716 array<string> zone_names = new array<string>;
10717 GetDamageZones(zone_names);
10718 for (int i = 0; i < zone_names.Count(); i++)
10719 {
10720 SetHealthMax(zone_names.Get(i),"Health");
10721 }
10722 SetHealthMax("","Health");
10723 }
10724
10727 {
10728 float global_health = GetHealth01("","Health");
10729 array<string> zones = new array<string>;
10730 GetDamageZones(zones);
10731
10732 for (int i = 0; i < zones.Count(); i++)
10733 {
10734 SetHealth01(zones.Get(i),"Health",global_health);
10735 }
10736 }
10737
10740 {
10741 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10742 }
10743
10745 {
10746 if (!hasRootAsPlayer)
10747 {
10748 if (refParentIB)
10749 {
10750
10751 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10752 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10753
10754 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10755 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10756
10759 }
10760 else
10761 {
10762
10765 }
10766 }
10767 }
10768
10770 {
10772 {
10773 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10774 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
10775 {
10776 float heatPermCoef = 1.0;
10778 while (ent)
10779 {
10780 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10781 ent = ent.GetHierarchyParent();
10782 }
10783
10784 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10785 }
10786 }
10787 }
10788
10790 {
10791
10792 EntityAI parent = GetHierarchyParent();
10793 if (!parent)
10794 {
10795 hasParent = false;
10796 hasRootAsPlayer = false;
10797 }
10798 else
10799 {
10800 hasParent = true;
10801 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10802 refParentIB =
ItemBase.Cast(parent);
10803 }
10804 }
10805
10806 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10807 {
10808
10809 }
10810
10812 {
10813
10814 return false;
10815 }
10816
10818 {
10819
10820
10821 return false;
10822 }
10823
10825 {
10826
10827 return false;
10828 }
10829
10832 {
10833 return !GetIsFrozen() &&
IsOpen();
10834 }
10835
10837 {
10838 bool hasParent = false, hasRootAsPlayer = false;
10840
10841 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10842 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10843
10844 if (wwtu || foodDecay)
10845 {
10849
10850 if (processWetness || processTemperature || processDecay)
10851 {
10853
10854 if (processWetness)
10855 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10856
10857 if (processTemperature)
10859
10860 if (processDecay)
10861 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10862 }
10863 }
10864 }
10865
10868 {
10870 }
10871
10873 {
10876
10877 return super.GetTemperatureFreezeThreshold();
10878 }
10879
10881 {
10884
10885 return super.GetTemperatureThawThreshold();
10886 }
10887
10889 {
10892
10893 return super.GetItemOverheatThreshold();
10894 }
10895
10897 {
10899 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10900
10901 return super.GetTemperatureFreezeTime();
10902 }
10903
10905 {
10907 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10908
10909 return super.GetTemperatureThawTime();
10910 }
10911
10916
10918 {
10919 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10920 }
10921
10923 {
10924 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10925 }
10926
10929 {
10931 }
10932
10934 {
10936 }
10937
10939 {
10941 }
10942
10945 {
10946 return null;
10947 }
10948
10951 {
10952 return false;
10953 }
10954
10956 {
10958 {
10961 if (!trg)
10962 {
10964 explosive = this;
10965 }
10966
10967 explosive.PairRemote(trg);
10969
10970 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10971 trg.SetPersistentPairID(persistentID);
10972 explosive.SetPersistentPairID(persistentID);
10973
10974 return true;
10975 }
10976 return false;
10977 }
10978
10981 {
10982 float ret = 1.0;
10985 ret *= GetHealth01();
10986
10987 return ret;
10988 }
10989
10990 #ifdef DEVELOPER
10991 override void SetDebugItem()
10992 {
10993 super.SetDebugItem();
10994 _itemBase = this;
10995 }
10996
10998 {
10999 string text = super.GetDebugText();
11000
11002 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11003
11004 return text;
11005 }
11006 #endif
11007
11009 {
11010 return true;
11011 }
11012
11014
11016
11018 {
11021 }
11022
11023
11031
11047}
11048
11050{
11052 if (entity)
11053 {
11054 bool is_item = entity.IsInherited(
ItemBase);
11055 if (is_item && full_quantity)
11056 {
11059 }
11060 }
11061 else
11062 {
11064 return NULL;
11065 }
11066 return entity;
11067}
11068
11070{
11071 if (item)
11072 {
11073 if (health > 0)
11074 item.SetHealth("", "", health);
11075
11076 if (item.CanHaveTemperature())
11077 {
11079 if (item.CanFreeze())
11080 item.SetFrozen(false);
11081 }
11082
11083 if (item.HasEnergyManager())
11084 {
11085 if (quantity >= 0)
11086 {
11087 item.GetCompEM().SetEnergy0To1(quantity);
11088 }
11089 else
11090 {
11092 }
11093 }
11094 else if (item.IsMagazine())
11095 {
11096 Magazine mag = Magazine.Cast(item);
11097 if (quantity >= 0)
11098 {
11099 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11100 }
11101 else
11102 {
11104 }
11105
11106 }
11107 else
11108 {
11109 if (quantity >= 0)
11110 {
11111 item.SetQuantityNormalized(quantity, false);
11112 }
11113 else
11114 {
11116 }
11117
11118 }
11119 }
11120}
11121
11122#ifdef DEVELOPER
11124#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
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 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...
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)
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)
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
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()
override int GetLiquidType()
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)
void Open()
Implementations only.
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 EEOnCECreate()
Called when entity is being created as new by CE/ Debug.
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 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 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
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
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 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 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.