6049{
6051 {
6052 return true;
6053 }
6054};
6055
6056
6057
6059{
6063
6065
6068
6069
6070
6071
6072
6081
6087
6092
6097
6118 protected bool m_IsResultOfSplit
6119
6121
6126
6127
6128
6130
6134
6135
6136
6138
6141
6142
6143
6149
6150
6158
6161
6162
6164
6165
6167
6168
6173
6174
6179
6180
6182
6183
6185 {
6190
6191 if (!
GetGame().IsDedicatedServer())
6192 {
6194 {
6196
6198 {
6200 }
6201 }
6202
6205 }
6206
6207 m_OldLocation = null;
6208
6210 {
6212 }
6213
6214 if (ConfigIsExisting("headSelectionsToHide"))
6215 {
6218 }
6219
6221 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6222 {
6224 }
6225
6227
6228 m_IsResultOfSplit = false;
6229
6231 }
6232
6234 {
6235 super.InitItemVariables();
6236
6242 m_Count = ConfigGetInt(
"count");
6243
6246
6251
6254
6259
6271
6275
6276
6279 if (ConfigIsExisting("canBeSplit"))
6280 {
6283 }
6284
6286 if (ConfigIsExisting("itemBehaviour"))
6288
6289
6292 RegisterNetSyncVariableInt("m_VarLiquidType");
6293 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6294
6295 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6296 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6297 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6298
6299 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6300 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6301 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6302 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6303
6304 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6305 RegisterNetSyncVariableBool("m_IsTakeable");
6306 RegisterNetSyncVariableBool("m_IsHologram");
6307
6310 {
6313 }
6314
6316
6318 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6320
6321 }
6322
6324 {
6326 }
6327
6329 {
6332 {
6337 }
6338 }
6339
6340 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6341 {
6343 {
6346 }
6347
6349 }
6350
6352 {
6358 }
6359
6361
6363 {
6365
6366 if (!action)
6367 {
6368 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6369 return;
6370 }
6371
6373 if (!ai)
6374 {
6376 return;
6377 }
6378
6380 if (!action_array)
6381 {
6382 action_array = new array<ActionBase_Basic>;
6384 }
6385 if (LogManager.IsActionLogEnable())
6386 {
6387 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6388 }
6389
6390 if (action_array.Find(action) != -1)
6391 {
6392 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6393 }
6394 else
6395 {
6396 action_array.Insert(action);
6397 }
6398 }
6399
6401 {
6403 ActionBase action = player.GetActionManager().GetAction(actionName);
6406
6407 if (action_array)
6408 {
6409 action_array.RemoveItem(action);
6410 }
6411 }
6412
6413
6414
6416 {
6417 ActionOverrideData overrideData = new ActionOverrideData();
6421
6423 if (!actionMap)
6424 {
6427 }
6428
6429 actionMap.Insert(this.
Type(), overrideData);
6430
6431 }
6432
6434
6436
6437
6439 {
6442
6445
6446 string config_to_search = "CfgVehicles";
6447 string muzzle_owner_config;
6448
6450 {
6451 if (IsInherited(Weapon))
6452 config_to_search = "CfgWeapons";
6453
6454 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6455
6456 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6457
6459
6460 if (config_OnFire_subclass_count > 0)
6461 {
6462 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6463
6464 for (int i = 0; i < config_OnFire_subclass_count; i++)
6465 {
6466 string particle_class = "";
6468 string config_OnFire_entry = config_OnFire_class + particle_class;
6469 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6470 WPOF_array.Insert(WPOF);
6471 }
6472
6473
6475 }
6476 }
6477
6479 {
6480 config_to_search = "CfgWeapons";
6481 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6482
6483 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6484
6486
6487 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6488 {
6489 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6490
6491 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6492 {
6493 string particle_class2 = "";
6495 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6496 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6497 WPOBE_array.Insert(WPOBE);
6498 }
6499
6500
6502 }
6503 }
6504 }
6505
6506
6508 {
6511
6513 {
6514 string config_to_search = "CfgVehicles";
6515
6516 if (IsInherited(Weapon))
6517 config_to_search = "CfgWeapons";
6518
6519 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6520 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6521
6522 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6523 {
6524
6526
6528 {
6530 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6532 return;
6533 }
6534
6537
6538
6539
6541 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6542
6543 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6544 {
6545 string particle_class = "";
6547 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6549
6550 if (entry_type == CT_CLASS)
6551 {
6552 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6553 WPOOH_array.Insert(WPOF);
6554 }
6555 }
6556
6557
6559 }
6560 }
6561 }
6562
6564 {
6566 }
6567
6569 {
6571 {
6573
6576
6579
6580 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6581 }
6582 }
6583
6585 {
6587 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6588
6590 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6591
6593 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6594
6596 {
6598 }
6599 }
6600
6602 {
6604 }
6605
6607 {
6610 else
6612
6614 {
6617 }
6618 else
6619 {
6622
6625 }
6626
6628 }
6629
6631 {
6633 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6634 }
6635
6637 {
6639 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6641 }
6642
6644 {
6646 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6647 }
6648
6650 {
6653
6654 OverheatingParticle OP = new OverheatingParticle();
6659
6661 }
6662
6664 {
6667
6668 return -1;
6669 }
6670
6672 {
6674 {
6677
6678 for (int i = count; i > 0; --i)
6679 {
6680 int id = i - 1;
6683
6686
6687 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6688 {
6689 if (p)
6690 {
6693 }
6694 }
6695 }
6696 }
6697 }
6698
6700 {
6702 {
6704 {
6705 int id = i - 1;
6707
6708 if (OP)
6709 {
6711
6712 if (p)
6713 {
6715 }
6716
6717 delete OP;
6718 }
6719 }
6720
6723 }
6724 }
6725
6728 {
6729 return 0.0;
6730 }
6731
6732
6734 {
6735 return 250;
6736 }
6737
6739 {
6740 return 0;
6741 }
6742
6745 {
6747 return true;
6748
6749 return false;
6750 }
6751
6754 {
6757
6759 {
6761 }
6762 else
6763 {
6764
6766 }
6767
6769 }
6770
6777 {
6778 return -1;
6779 }
6780
6781
6782
6783
6785 {
6787 {
6789 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6790
6791 if (r_index >= 0)
6792 {
6793 InventoryLocation r_il = new InventoryLocation;
6794 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6795
6796 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6799 {
6800 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6801 }
6803 {
6804 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6805 }
6806
6807 }
6808
6809 player.GetHumanInventory().ClearUserReservedLocation(this);
6810 }
6811
6814 }
6815
6816
6817
6818
6820 {
6821 return ItemBase.m_DebugActionsMask;
6822 }
6823
6825 {
6826 return ItemBase.m_DebugActionsMask & mask;
6827 }
6828
6830 {
6831 ItemBase.m_DebugActionsMask = mask;
6832 }
6833
6835 {
6836 ItemBase.m_DebugActionsMask |= mask;
6837 }
6838
6840 {
6841 ItemBase.m_DebugActionsMask &= ~mask;
6842 }
6843
6845 {
6847 {
6849 }
6850 else
6851 {
6853 }
6854 }
6855
6856
6858 {
6859 if (GetEconomyProfile())
6860 {
6861 float q_max = GetEconomyProfile().GetQuantityMax();
6862 if (q_max > 0)
6863 {
6864 float q_min = GetEconomyProfile().GetQuantityMin();
6865 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6866
6868 {
6869 ComponentEnergyManager comp = GetCompEM();
6871 {
6873 }
6874 }
6876 {
6878
6879 }
6880
6881 }
6882 }
6883 }
6884
6887 {
6888 EntityAI parent = GetHierarchyParent();
6889
6890 if (parent)
6891 {
6892 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6893 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6894 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6895 }
6896 }
6897
6900 {
6901 EntityAI parent = GetHierarchyParent();
6902
6903 if (parent)
6904 {
6905 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6906 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6907 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6908 }
6909 }
6910
6912 {
6913
6914
6915
6916
6918
6920 {
6921 if (ScriptInputUserData.CanStoreInputUserData())
6922 {
6923 ScriptInputUserData ctx = new ScriptInputUserData;
6929 ctx.
Write(use_stack_max);
6932
6934 {
6935 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6936 }
6937 }
6938 }
6939 else if (!
GetGame().IsMultiplayer())
6940 {
6942 }
6943 }
6944
6946 {
6948 }
6949
6951 {
6953 }
6954
6956 {
6958 }
6959
6961 {
6962
6963 return false;
6964 }
6965
6967 {
6968 return false;
6969 }
6970
6974 {
6975 return false;
6976 }
6977
6979 {
6980 return "";
6981 }
6982
6984
6986 {
6987 return false;
6988 }
6989
6991 {
6992 return true;
6993 }
6994
6995
6996
6998 {
6999 return true;
7000 }
7001
7003 {
7004 return true;
7005 }
7006
7008 {
7009 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7011 }
7012
7014 {
7016 }
7017
7019 {
7021 if (!is_being_placed)
7023 SetSynchDirty();
7024 }
7025
7026
7028
7030 {
7032 }
7033
7035 {
7037 }
7038
7040 {
7041 return 1;
7042 }
7043
7045 {
7046 return false;
7047 }
7048
7050 {
7052 SetSynchDirty();
7053 }
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
7090 {
7091 super.OnMovedInsideCargo(container);
7092
7093 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7094 }
7095
7096 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7097 {
7098 super.EEItemLocationChanged(oldLoc,newLoc);
7099
7100 PlayerBase new_player = null;
7101 PlayerBase old_player = null;
7102
7103 if (newLoc.GetParent())
7104 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7105
7106 if (oldLoc.GetParent())
7107 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7108
7110 {
7111 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
7112
7113 if (r_index >= 0)
7114 {
7115 InventoryLocation r_il = new InventoryLocation;
7116 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7117
7118 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7121 {
7122 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7123 }
7125 {
7126 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7127 }
7128
7129 }
7130 }
7131
7133 {
7134 if (new_player)
7135 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
7136
7137 if (new_player == old_player)
7138 {
7139
7140 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7141 {
7143 {
7144 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7145 {
7146 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7147 }
7148 }
7149 else
7150 {
7151 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7152 }
7153 }
7154
7155 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7156 {
7157 int type = oldLoc.GetType();
7159 {
7160 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7161 }
7163 {
7164 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7165 }
7166 }
7167 if (!m_OldLocation)
7168 {
7169 m_OldLocation = new InventoryLocation;
7170 }
7171 m_OldLocation.Copy(oldLoc);
7172 }
7173 else
7174 {
7175 if (m_OldLocation)
7176 {
7177 m_OldLocation.Reset();
7178 }
7179 }
7180
7182 }
7183 else
7184 {
7185 if (new_player)
7186 {
7187 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7188 if (res_index >= 0)
7189 {
7190 InventoryLocation il = new InventoryLocation;
7191 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
7193 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
7196 {
7197 il.
GetParent().GetOnReleaseLock().Invoke(it);
7198 }
7200 {
7202 }
7203
7204 }
7205 }
7207 {
7208
7210 }
7211
7212 if (m_OldLocation)
7213 {
7214 m_OldLocation.Reset();
7215 }
7216 }
7217 }
7218
7219 override void EOnContact(IEntity other, Contact extra)
7220 {
7222 {
7223 int liquidType = -1;
7225 if (impactSpeed > 0.0)
7226 {
7228 #ifndef SERVER
7230 #else
7232 SetSynchDirty();
7233 #endif
7235 }
7236 }
7237
7238 #ifdef SERVER
7239 if (GetCompEM() && GetCompEM().IsPlugged())
7240 {
7241 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7242 GetCompEM().UnplugThis();
7243 }
7244 #endif
7245 }
7246
7248
7250 {
7252 }
7253
7255 {
7256
7257 }
7258
7260 {
7261 super.OnItemLocationChanged(old_owner, new_owner);
7262
7263 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7264 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7265
7266 if (!relatedPlayer && playerNew)
7267 relatedPlayer = playerNew;
7268
7269 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7270 {
7272 if (actionMgr)
7273 {
7274 ActionBase currentAction = actionMgr.GetRunningAction();
7275 if (currentAction)
7277 }
7278 }
7279
7280 Man ownerPlayerOld = null;
7281 Man ownerPlayerNew = null;
7282
7283 if (old_owner)
7284 {
7285 if (old_owner.
IsMan())
7286 {
7287 ownerPlayerOld = Man.Cast(old_owner);
7288 }
7289 else
7290 {
7291 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7292 }
7293 }
7294 else
7295 {
7297 {
7299
7300 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7301 {
7302 GetCompEM().UnplugThis();
7303 }
7304 }
7305 }
7306
7307 if (new_owner)
7308 {
7309 if (new_owner.
IsMan())
7310 {
7311 ownerPlayerNew = Man.Cast(new_owner);
7312 }
7313 else
7314 {
7315 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7316 }
7317 }
7318
7319 if (ownerPlayerOld != ownerPlayerNew)
7320 {
7321 if (ownerPlayerOld)
7322 {
7323 array<EntityAI> subItemsExit = new array<EntityAI>;
7325 for (int i = 0; i < subItemsExit.Count(); i++)
7326 {
7329 }
7330 }
7331
7332 if (ownerPlayerNew)
7333 {
7334 array<EntityAI> subItemsEnter = new array<EntityAI>;
7336 for (int j = 0; j < subItemsEnter.Count(); j++)
7337 {
7340 }
7341 }
7342 }
7343 else if (ownerPlayerNew != null)
7344 {
7345 PlayerBase nplayer;
7346 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7347 {
7348 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7350 for (int k = 0; k < subItemsUpdate.Count(); k++)
7351 {
7353 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7354 }
7355 }
7356 }
7357
7358 if (old_owner)
7359 old_owner.OnChildItemRemoved(this);
7360 if (new_owner)
7361 new_owner.OnChildItemReceived(this);
7362 }
7363
7364
7366 {
7367 super.EEDelete(parent);
7368 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7369 if (player)
7370 {
7372
7373 if (player.IsAlive())
7374 {
7375 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7376 if (r_index >= 0)
7377 {
7378 InventoryLocation r_il = new InventoryLocation;
7379 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7380
7381 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7384 {
7385 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7386 }
7388 {
7389 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7390 }
7391
7392 }
7393
7394 player.RemoveQuickBarEntityShortcut(this);
7395 }
7396 }
7397 }
7398
7400 {
7401 super.EEKilled(killer);
7402
7405 {
7406 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7407 {
7408 if (IsMagazine())
7409 {
7410 if (Magazine.Cast(this).GetAmmoCount() > 0)
7411 {
7413 }
7414 }
7415 else
7416 {
7418 }
7419 }
7420 }
7421 }
7422
7424 {
7425 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7426
7427 super.OnWasAttached(parent, slot_id);
7428
7431
7433 }
7434
7436 {
7437 super.OnWasDetached(parent, slot_id);
7438
7441 }
7442
7444 {
7445 int idx;
7448
7449 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7450 if (inventory_slots.Count() < 1)
7451 {
7452 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7453 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7454 }
7455 else
7456 {
7457 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7458 }
7459
7460 idx = inventory_slots.Find(slot);
7461 if (idx < 0)
7462 return "";
7463
7464 return attach_types.Get(idx);
7465 }
7466
7468 {
7469 int idx = -1;
7470 string slot;
7471
7474
7475 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7476 if (inventory_slots.Count() < 1)
7477 {
7478 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7479 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7480 }
7481 else
7482 {
7483 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7484 if (detach_types.Count() < 1)
7485 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7486 }
7487
7488 for (int i = 0; i < inventory_slots.Count(); i++)
7489 {
7490 slot = inventory_slots.Get(i);
7491 }
7492
7493 if (slot != "")
7494 {
7495 if (detach_types.Count() == 1)
7496 idx = 0;
7497 else
7498 idx = inventory_slots.Find(slot);
7499 }
7500 if (idx < 0)
7501 return "";
7502
7503 return detach_types.Get(idx);
7504 }
7505
7507 {
7508
7510
7511
7512 float min_time = 1;
7513 float max_time = 3;
7514 float delay = Math.RandomFloat(min_time, max_time);
7515
7516 explode_timer.Run(delay, this, "DoAmmoExplosion");
7517 }
7518
7520 {
7521 Magazine magazine = Magazine.Cast(this);
7522 int pop_sounds_count = 6;
7523 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7524
7525
7526 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7527 string sound_name = pop_sounds[ sound_idx ];
7529
7530
7531 magazine.ServerAddAmmoCount(-1);
7532
7533
7534 float min_temp_to_explode = 100;
7535
7536 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7537 {
7539 }
7540 }
7541
7542
7543 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7544 {
7545 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7546
7547 const int CHANCE_DAMAGE_CARGO = 4;
7548 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7549 const int CHANCE_DAMAGE_NOTHING = 2;
7550
7552 {
7553 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7554 int chances;
7555 int rnd;
7556
7557 if (GetInventory().GetCargo())
7558 {
7559 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7560 rnd = Math.RandomInt(0,chances);
7561
7562 if (rnd < CHANCE_DAMAGE_CARGO)
7563 {
7565 }
7566 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7567 {
7569 }
7570 }
7571 else
7572 {
7573 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7574 rnd = Math.RandomInt(0,chances);
7575
7576 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7577 {
7579 }
7580 }
7581 }
7582 }
7583
7585 {
7586 if (GetInventory().GetCargo())
7587 {
7588 int item_count = GetInventory().GetCargo().GetItemCount();
7589 if (item_count > 0)
7590 {
7591 int random_pick = Math.RandomInt(0, item_count);
7593 if (!item.IsExplosive())
7594 {
7595 item.AddHealth("","",damage);
7596 return true;
7597 }
7598 }
7599 }
7600 return false;
7601 }
7602
7604 {
7605 int attachment_count = GetInventory().AttachmentCount();
7606 if (attachment_count > 0)
7607 {
7608 int random_pick = Math.RandomInt(0, attachment_count);
7609 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7610 if (!attachment.IsExplosive())
7611 {
7612 attachment.AddHealth("","",damage);
7613 return true;
7614 }
7615 }
7616 return false;
7617 }
7618
7620 {
7622 }
7623
7625 {
7627 return GetInventory().CanRemoveEntity();
7628
7629 return false;
7630 }
7631
7633 {
7634
7636 return false;
7637
7638
7640 return false;
7641
7642
7643
7645 if (delta == 0)
7646 return false;
7647
7648
7649 return true;
7650 }
7651
7653 {
7655 {
7656 if (ScriptInputUserData.CanStoreInputUserData())
7657 {
7658 ScriptInputUserData ctx = new ScriptInputUserData;
7663 ctx.
Write(destination_entity);
7667 }
7668 }
7669 else if (!
GetGame().IsMultiplayer())
7670 {
7672 }
7673 }
7674
7676 {
7677 float split_quantity_new;
7681 InventoryLocation loc = new InventoryLocation;
7682
7683 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7684 {
7686 split_quantity_new = stack_max;
7687 else
7689
7691 {
7692 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7693 if (new_item)
7694 {
7695 new_item.SetResultOfSplit(true);
7696 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7698 new_item.
SetQuantity(split_quantity_new,
false,
true);
7699 }
7700 }
7701 }
7702 else if (destination_entity && slot_id == -1)
7703 {
7704 if (quantity > stack_max)
7705 split_quantity_new = stack_max;
7706 else
7707 split_quantity_new = quantity;
7708
7710 {
7712 {
7715 }
7716
7717 if (new_item)
7718 {
7719 new_item.SetResultOfSplit(true);
7720 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7722 new_item.
SetQuantity(split_quantity_new,
false,
true);
7723 }
7724 }
7725 }
7726 else
7727 {
7728 if (stack_max != 0)
7729 {
7731 {
7733 }
7734
7735 if (split_quantity_new == 0)
7736 {
7737 if (!
GetGame().IsMultiplayer())
7738 player.PhysicalPredictiveDropItem(this);
7739 else
7740 player.ServerDropEntity(this);
7741 return;
7742 }
7743
7745 {
7747
7748 if (new_item)
7749 {
7750 new_item.SetResultOfSplit(true);
7751 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7754 new_item.PlaceOnSurface();
7755 }
7756 }
7757 }
7758 }
7759 }
7760
7762 {
7763 float split_quantity_new;
7767 InventoryLocation loc = new InventoryLocation;
7768
7769 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7770 {
7772 split_quantity_new = stack_max;
7773 else
7775
7777 {
7778 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7779 if (new_item)
7780 {
7781 new_item.SetResultOfSplit(true);
7782 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7784 new_item.
SetQuantity(split_quantity_new,
false,
true);
7785 }
7786 }
7787 }
7788 else if (destination_entity && slot_id == -1)
7789 {
7790 if (quantity > stack_max)
7791 split_quantity_new = stack_max;
7792 else
7793 split_quantity_new = quantity;
7794
7796 {
7798 {
7801 }
7802
7803 if (new_item)
7804 {
7805 new_item.SetResultOfSplit(true);
7806 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7808 new_item.
SetQuantity(split_quantity_new,
false,
true);
7809 }
7810 }
7811 }
7812 else
7813 {
7814 if (stack_max != 0)
7815 {
7817 {
7819 }
7820
7822 {
7824
7825 if (new_item)
7826 {
7827 new_item.SetResultOfSplit(true);
7828 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7831 new_item.PlaceOnSurface();
7832 }
7833 }
7834 }
7835 }
7836 }
7837
7839 {
7841 {
7842 if (ScriptInputUserData.CanStoreInputUserData())
7843 {
7844 ScriptInputUserData ctx = new ScriptInputUserData;
7849 dst.WriteToContext(ctx);
7851 }
7852 }
7853 else if (!
GetGame().IsMultiplayer())
7854 {
7856 }
7857 }
7858
7860 {
7862 {
7863 if (ScriptInputUserData.CanStoreInputUserData())
7864 {
7865 ScriptInputUserData ctx = new ScriptInputUserData;
7870 ctx.
Write(destination_entity);
7876 }
7877 }
7878 else if (!
GetGame().IsMultiplayer())
7879 {
7881 }
7882 }
7883
7885 {
7887 }
7888
7890 {
7892 float split_quantity_new;
7894 if (dst.IsValid())
7895 {
7896 int slot_id = dst.GetSlot();
7898
7899 if (quantity > stack_max)
7900 split_quantity_new = stack_max;
7901 else
7902 split_quantity_new = quantity;
7903
7905 {
7907
7908 if (new_item)
7909 {
7910 new_item.SetResultOfSplit(true);
7911 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7913 new_item.
SetQuantity(split_quantity_new,
false,
true);
7914 }
7915
7916 return new_item;
7917 }
7918 }
7919
7920 return null;
7921 }
7922
7924 {
7926 float split_quantity_new;
7928 if (destination_entity)
7929 {
7931 if (quantity > stackable)
7932 split_quantity_new = stackable;
7933 else
7934 split_quantity_new = quantity;
7935
7937 {
7938 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7939 if (new_item)
7940 {
7941 new_item.SetResultOfSplit(true);
7942 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7944 new_item.
SetQuantity(split_quantity_new,
false,
true);
7945 }
7946 }
7947 }
7948 }
7949
7951 {
7953 {
7954 if (ScriptInputUserData.CanStoreInputUserData())
7955 {
7956 ScriptInputUserData ctx = new ScriptInputUserData;
7961 ItemBase destination_entity =
this;
7962 ctx.
Write(destination_entity);
7966 }
7967 }
7968 else if (!
GetGame().IsMultiplayer())
7969 {
7971 }
7972 }
7973
7975 {
7977 float split_quantity_new;
7979 if (player)
7980 {
7982 if (quantity > stackable)
7983 split_quantity_new = stackable;
7984 else
7985 split_quantity_new = quantity;
7986
7988 {
7989 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7990 new_item =
ItemBase.Cast(in_hands);
7991 if (new_item)
7992 {
7993 new_item.SetResultOfSplit(true);
7994 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7996 new_item.SetQuantity(split_quantity_new, false, true);
7997 }
7998 }
7999 }
8000 }
8001
8003 {
8005 float split_quantity_new = Math.Floor(quantity * 0.5);
8006
8008 return;
8009
8011
8012 if (new_item)
8013 {
8014 if (new_item.GetQuantityMax() < split_quantity_new)
8015 {
8016 split_quantity_new = new_item.GetQuantityMax();
8017 }
8018
8019 new_item.SetResultOfSplit(true);
8020 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8021
8023 {
8026 }
8027 else
8028 {
8030 new_item.
SetQuantity(split_quantity_new,
false,
true);
8031 }
8032 }
8033 }
8034
8036 {
8038 float split_quantity_new = Math.Floor(quantity / 2);
8039
8041 return;
8042
8043 InventoryLocation invloc = new InventoryLocation;
8045
8047 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8048
8049 if (new_item)
8050 {
8051 if (new_item.GetQuantityMax() < split_quantity_new)
8052 {
8053 split_quantity_new = new_item.GetQuantityMax();
8054 }
8056 {
8059 }
8060 else if (split_quantity_new > 1)
8061 {
8063 new_item.
SetQuantity(split_quantity_new,
false,
true);
8064 }
8065 }
8066 }
8067
8070 {
8071 SetWeightDirty();
8073
8074 if (parent)
8075 parent.OnAttachmentQuantityChangedEx(this, delta);
8076
8078 {
8080 {
8082 }
8084 {
8085 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8087 }
8088 }
8089
8090 }
8091
8094 {
8095
8096 }
8097
8100 {
8102 }
8103
8105 {
8106 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8107
8109 {
8110 if (newLevel == GameConstants.STATE_RUINED)
8111 {
8113 EntityAI parent = GetHierarchyParent();
8114 if (parent && parent.IsFireplace())
8115 {
8116 CargoBase cargo = GetInventory().GetCargo();
8117 if (cargo)
8118 {
8120 {
8122 }
8123 }
8124 }
8125 }
8126
8128 {
8129
8131 return;
8132 }
8133
8134 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8135 {
8137 }
8138 }
8139 }
8140
8141
8143 {
8144 super.OnRightClick();
8145
8147 {
8149 {
8150 if (ScriptInputUserData.CanStoreInputUserData())
8151 {
8152 EntityAI root = GetHierarchyRoot();
8153 Man playerOwner = GetHierarchyRootPlayer();
8154 InventoryLocation dst = new InventoryLocation;
8155
8156
8157 if (!playerOwner && root && root == this)
8158 {
8160 }
8161 else
8162 {
8163
8164 GetInventory().GetCurrentInventoryLocation(dst);
8166 {
8169 {
8171 }
8172 else
8173 {
8175
8176
8177 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8178 {
8180 }
8181 else
8182 {
8183 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8184 }
8185 }
8186 }
8187 }
8188
8189 ScriptInputUserData ctx = new ScriptInputUserData;
8197 }
8198 }
8199 else if (!
GetGame().IsMultiplayer())
8200 {
8202 }
8203 }
8204 }
8205
8207 {
8208 if (root)
8209 {
8210 vector m4[4];
8211 root.GetTransform(m4);
8212 dst.SetGround(this, m4);
8213 }
8214 else
8215 {
8216 GetInventory().GetCurrentInventoryLocation(dst);
8217 }
8218 }
8219
8220 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8221 {
8222
8223 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8224 return false;
8225
8226 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8227 return false;
8228
8229
8231 return false;
8232
8233
8234 Magazine mag = Magazine.Cast(this);
8235 if (mag)
8236 {
8237 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8238 return false;
8239
8240 if (stack_max_limit)
8241 {
8242 Magazine other_mag = Magazine.Cast(other_item);
8243 if (other_item)
8244 {
8245 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8246 return false;
8247 }
8248
8249 }
8250 }
8251 else
8252 {
8253
8255 return false;
8256
8258 return false;
8259 }
8260
8261 PlayerBase player = null;
8262 if (CastTo(player, GetHierarchyRootPlayer()))
8263 {
8264 if (player.GetInventory().HasAttachment(this))
8265 return false;
8266
8267 if (player.IsItemsToDelete())
8268 return false;
8269 }
8270
8271 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8272 return false;
8273
8274 int slotID;
8276 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8277 return false;
8278
8279 return true;
8280 }
8281
8283 {
8285 }
8286
8288 {
8289 return m_IsResultOfSplit;
8290 }
8291
8293 {
8294 m_IsResultOfSplit = value;
8295 }
8296
8298 {
8300 }
8301
8303 {
8304 float other_item_quantity = other_item.GetQuantity();
8305 float this_free_space;
8306
8308
8310
8311 if (other_item_quantity > this_free_space)
8312 {
8313 return this_free_space;
8314 }
8315 else
8316 {
8317 return other_item_quantity;
8318 }
8319 }
8320
8322 {
8324 }
8325
8327 {
8329 return;
8330
8331 if (!IsMagazine() && other_item)
8332 {
8334 if (quantity_used != 0)
8335 {
8336 float hp1 = GetHealth01("","");
8337 float hp2 = other_item.GetHealth01("","");
8338 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8339 hpResult = hpResult / (
GetQuantity() + quantity_used);
8340
8341 hpResult *= GetMaxHealth();
8342 Math.Round(hpResult);
8343 SetHealth("", "Health", hpResult);
8344
8346 other_item.AddQuantity(-quantity_used);
8347 }
8348 }
8350 }
8351
8353 {
8354 #ifdef SERVER
8355 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8356 GetHierarchyParent().IncreaseLifetimeUp();
8357 #endif
8358 };
8359
8361 {
8362 PlayerBase p = PlayerBase.Cast(player);
8363
8364 array<int> recipesIds = p.m_Recipes;
8365 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8366 if (moduleRecipesManager)
8367 {
8368 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8369 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8370 }
8371
8372 for (int i = 0;i < recipesIds.Count(); i++)
8373 {
8374 int key = recipesIds.Get(i);
8375 string recipeName = moduleRecipesManager.GetRecipeName(key);
8377 }
8378 }
8379
8380
8381 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8382 {
8383 super.GetDebugActions(outputList);
8384
8385
8391
8392
8397
8402
8403
8407
8408
8410 {
8414 }
8415
8418
8419
8423
8425
8426 InventoryLocation loc = new InventoryLocation();
8427 GetInventory().GetCurrentInventoryLocation(loc);
8429 {
8430 if (Gizmo_IsSupported())
8433 }
8434
8436 }
8437
8438
8439
8440
8442 {
8443 super.OnAction(action_id, player, ctx);
8444
8446 {
8447 switch (action_id)
8448 {
8451 return true;
8454 return true;
8455 }
8456 }
8457
8459 {
8460 switch (action_id)
8461 {
8463 Delete();
8464 return true;
8465 }
8466 }
8467
8468 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8469 {
8470 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8471 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8472 PlayerBase p = PlayerBase.Cast(player);
8473 if (
EActions.RECIPES_RANGE_START < 1000)
8474 {
8475 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8476 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8477 }
8478 }
8479 #ifndef SERVER
8480 else if (action_id ==
EActions.WATCH_PLAYER)
8481 {
8482 PluginDeveloper.SetDeveloperItemClientEx(player);
8483 }
8484 #endif
8486 {
8487 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8488 {
8489 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8490 OnDebugButtonPressServer(id + 1);
8491 }
8492
8493 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8494 {
8495 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8497 }
8498
8499 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8500 {
8501 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8503 }
8504
8505 else if (action_id ==
EActions.ADD_QUANTITY)
8506 {
8507 if (IsMagazine())
8508 {
8509 Magazine mag = Magazine.Cast(this);
8510 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8511 }
8512 else
8513 {
8515 }
8516
8517 if (m_EM)
8518 {
8519 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8520 }
8521
8522 }
8523
8524 else if (action_id ==
EActions.REMOVE_QUANTITY)
8525 {
8526 if (IsMagazine())
8527 {
8528 Magazine mag2 = Magazine.Cast(this);
8529 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8530 }
8531 else
8532 {
8534 }
8535 if (m_EM)
8536 {
8537 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8538 }
8539
8540 }
8541
8542 else if (action_id ==
EActions.SET_QUANTITY_0)
8543 {
8545
8546 if (m_EM)
8547 {
8548 m_EM.SetEnergy(0);
8549 }
8550 }
8551
8552 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8553 {
8555
8556 if (m_EM)
8557 {
8558 m_EM.SetEnergy(m_EM.GetEnergyMax());
8559 }
8560 }
8561
8562 else if (action_id ==
EActions.ADD_HEALTH)
8563 {
8564 AddHealth("","",GetMaxHealth("","Health")/5);
8565 }
8566 else if (action_id ==
EActions.REMOVE_HEALTH)
8567 {
8568 AddHealth("","",-GetMaxHealth("","Health")/5);
8569 }
8570 else if (action_id ==
EActions.DESTROY_HEALTH)
8571 {
8572 SetHealth01("","",0);
8573 }
8574 else if (action_id ==
EActions.WATCH_ITEM)
8575 {
8577 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8578 #ifdef DEVELOPER
8579 SetDebugDeveloper_item(this);
8580 #endif
8581 }
8582
8583 else if (action_id ==
EActions.ADD_TEMPERATURE)
8584 {
8585 AddTemperature(20);
8586
8587 }
8588
8589 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8590 {
8591 AddTemperature(-20);
8592
8593 }
8594
8595 else if (action_id ==
EActions.FLIP_FROZEN)
8596 {
8597 SetFrozen(!GetIsFrozen());
8598
8599 }
8600
8601 else if (action_id ==
EActions.ADD_WETNESS)
8602 {
8604
8605 }
8606
8607 else if (action_id ==
EActions.REMOVE_WETNESS)
8608 {
8610
8611 }
8612
8613 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8614 {
8617
8618
8619 }
8620
8621 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8622 {
8625 }
8626
8627 else if (action_id ==
EActions.MAKE_SPECIAL)
8628 {
8629 auto debugParams = DebugSpawnParams.WithPlayer(player);
8630 OnDebugSpawnEx(debugParams);
8631 }
8632
8633 }
8634
8635
8636 return false;
8637 }
8638
8639
8640
8641
8645
8648
8649
8650
8652 {
8653 return false;
8654 }
8655
8656
8658 {
8659 return true;
8660 }
8661
8662
8664 {
8665 return true;
8666 }
8667
8668
8669
8671 {
8672 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8674 }
8675
8678 {
8679 return null;
8680 }
8681
8683 {
8684 return false;
8685 }
8686
8688 {
8689 return false;
8690 }
8691
8695
8696
8698 {
8699 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8700 return module_repairing.CanRepair(this, item_repair_kit);
8701 }
8702
8703
8704 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8705 {
8706 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8707 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8708 }
8709
8710
8712 {
8713
8714
8715
8716
8717
8718
8719
8720
8721 return 1;
8722 }
8723
8724
8725
8727 {
8729 }
8730
8731
8732
8734 {
8736 }
8737
8738
8747 {
8748 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8749
8750 if (player)
8751 {
8752 player.MessageStatus(text);
8753 }
8754 }
8755
8756
8765 {
8766 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8767
8768 if (player)
8769 {
8770 player.MessageAction(text);
8771 }
8772 }
8773
8774
8783 {
8784 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8785
8786 if (player)
8787 {
8788 player.MessageFriendly(text);
8789 }
8790 }
8791
8792
8801 {
8802 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8803
8804 if (player)
8805 {
8806 player.MessageImportant(text);
8807 }
8808 }
8809
8811 {
8812 return true;
8813 }
8814
8815
8816 override bool KindOf(
string tag)
8817 {
8818 bool found = false;
8819 string item_name = this.
GetType();
8822
8823 int array_size = item_tag_array.Count();
8824 for (int i = 0; i < array_size; i++)
8825 {
8826 if (item_tag_array.Get(i) == tag)
8827 {
8828 found = true;
8829 break;
8830 }
8831 }
8832 return found;
8833 }
8834
8835
8837 {
8838
8839 super.OnRPC(sender, rpc_type,ctx);
8840
8841
8842 switch (rpc_type)
8843 {
8844 #ifndef SERVER
8845 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8846 Param2<bool, string> p = new Param2<bool, string>(false, "");
8847
8849 return;
8850
8851 bool play = p.param1;
8852 string soundSet = p.param2;
8853
8854 if (play)
8855 {
8857 {
8859 {
8861 }
8862 }
8863 else
8864 {
8866 }
8867 }
8868 else
8869 {
8871 }
8872
8873 break;
8874 #endif
8875
8876 }
8877
8879 {
8881 }
8882 }
8883
8884
8885
8886
8888 {
8889 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8890 return plugin.GetID(
name);
8891 }
8892
8894 {
8895 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8896 return plugin.GetName(id);
8897 }
8898
8901 {
8902
8903
8904 int varFlags;
8905 if (!ctx.
Read(varFlags))
8906 return;
8907
8908 if (varFlags & ItemVariableFlags.FLOAT)
8909 {
8911 }
8912 }
8913
8915 {
8916
8917 super.SerializeNumericalVars(floats_out);
8918
8919
8920
8922 {
8924 }
8925
8927 {
8929 }
8930
8932 {
8934 }
8935
8937 {
8942 }
8943
8945 {
8947 }
8948 }
8949
8951 {
8952
8953 super.DeSerializeNumericalVars(floats);
8954
8955
8956 int index = 0;
8957 int mask = Math.Round(floats.Get(index));
8958
8959 index++;
8960
8962 {
8964 {
8966 }
8967 else
8968 {
8969 float quantity = floats.Get(index);
8971 }
8972 index++;
8973 }
8974
8976 {
8977 float wet = floats.Get(index);
8979 index++;
8980 }
8981
8983 {
8984 int liquidtype = Math.Round(floats.Get(index));
8986 index++;
8987 }
8988
8990 {
8992 index++;
8994 index++;
8996 index++;
8998 index++;
8999 }
9000
9002 {
9003 int cleanness = Math.Round(floats.Get(index));
9005 index++;
9006 }
9007 }
9008
9010 {
9011 super.WriteVarsToCTX(ctx);
9012
9013
9015 {
9017 }
9018
9020 {
9022 }
9023
9025 {
9027 }
9028
9030 {
9031 int r,g,b,a;
9037 }
9038
9040 {
9042 }
9043 }
9044
9046 {
9047 if (!super.ReadVarsFromCTX(ctx,version))
9048 return false;
9049
9050 int intValue;
9051 float value;
9052
9053 if (version < 140)
9054 {
9055 if (!ctx.
Read(intValue))
9056 return false;
9057
9058 m_VariablesMask = intValue;
9059 }
9060
9062 {
9063 if (!ctx.
Read(value))
9064 return false;
9065
9067 {
9069 }
9070 else
9071 {
9073 }
9074 }
9075
9076 if (version < 140)
9077 {
9079 {
9080 if (!ctx.
Read(value))
9081 return false;
9082 SetTemperatureDirect(value);
9083 }
9084 }
9085
9087 {
9088 if (!ctx.
Read(value))
9089 return false;
9091 }
9092
9094 {
9095 if (!ctx.
Read(intValue))
9096 return false;
9098 }
9099
9101 {
9102 int r,g,b,a;
9104 return false;
9106 return false;
9108 return false;
9110 return false;
9111
9113 }
9114
9116 {
9117 if (!ctx.
Read(intValue))
9118 return false;
9120 }
9121
9122 if (version >= 138 && version < 140)
9123 {
9125 {
9126 if (!ctx.
Read(intValue))
9127 return false;
9128 SetFrozen(intValue);
9129 }
9130 }
9131
9132 return true;
9133 }
9134
9135
9137 {
9140 {
9142 }
9143
9144 if (!super.OnStoreLoad(ctx, version))
9145 {
9147 return false;
9148 }
9149
9150 if (version >= 114)
9151 {
9152 bool hasQuickBarIndexSaved;
9153
9154 if (!ctx.
Read(hasQuickBarIndexSaved))
9155 {
9157 return false;
9158 }
9159
9160 if (hasQuickBarIndexSaved)
9161 {
9162 int itmQBIndex;
9163
9164
9165 if (!ctx.
Read(itmQBIndex))
9166 {
9168 return false;
9169 }
9170
9171 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9172 if (itmQBIndex != -1 && parentPlayer)
9173 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9174 }
9175 }
9176 else
9177 {
9178
9179 PlayerBase player;
9180 int itemQBIndex;
9181 if (version ==
int.
MAX)
9182 {
9183 if (!ctx.
Read(itemQBIndex))
9184 {
9186 return false;
9187 }
9188 }
9189 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9190 {
9191
9192 if (!ctx.
Read(itemQBIndex))
9193 {
9195 return false;
9196 }
9197 if (itemQBIndex != -1 && player)
9198 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9199 }
9200 }
9201
9202 if (version < 140)
9203 {
9204
9205 if (!LoadVariables(ctx, version))
9206 {
9208 return false;
9209 }
9210 }
9211
9212
9214 {
9216 return false;
9217 }
9218 if (version >= 132)
9219 {
9221 if (raib)
9222 {
9224 {
9226 return false;
9227 }
9228 }
9229 }
9230
9232 return true;
9233 }
9234
9235
9236
9238 {
9239 super.OnStoreSave(ctx);
9240
9241 PlayerBase player;
9242 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9243 {
9245
9246 int itemQBIndex = -1;
9247 itemQBIndex = player.FindQuickBarEntityIndex(this);
9248 ctx.
Write(itemQBIndex);
9249 }
9250 else
9251 {
9253 }
9254
9256
9258 if (raib)
9259 {
9261 }
9262 }
9263
9264
9266 {
9267 super.AfterStoreLoad();
9268
9270 {
9272 }
9273
9275 {
9278 }
9279 }
9280
9282 {
9283 super.EEOnAfterLoad();
9284
9286 {
9288 }
9289
9292 }
9293
9295 {
9296 return false;
9297 }
9298
9299
9300
9302 {
9304 {
9305 #ifdef PLATFORM_CONSOLE
9306
9308 {
9310 if (menu)
9311 {
9313 }
9314 }
9315 #endif
9316 }
9317
9319 {
9322 }
9323
9325 {
9326 SetWeightDirty();
9328 }
9330 {
9333 }
9334
9336 {
9339 }
9341 {
9344 }
9345
9346 super.OnVariablesSynchronized();
9347 }
9348
9349
9350
9352 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9353 {
9354 if (!IsServerCheck(allow_client))
9355 return false;
9356
9358 return false;
9359
9362
9363 if (value <= (min + 0.001))
9364 value = min;
9365
9366 if (value == min)
9367 {
9368 if (destroy_config)
9369 {
9370 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9371 if (dstr)
9372 {
9374 this.Delete();
9375 return true;
9376 }
9377 }
9378 else if (destroy_forced)
9379 {
9381 this.Delete();
9382 return true;
9383 }
9384
9386 }
9387
9390
9392 {
9394
9395 if (delta)
9397 }
9398
9400
9401 return false;
9402 }
9403
9404
9406 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9407 {
9409 }
9410
9412 {
9415 }
9416
9418 {
9421 }
9422
9424 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9425 {
9426 float value_clamped = Math.Clamp(value, 0, 1);
9428 SetQuantity(result, destroy_config, destroy_forced);
9429 }
9430
9431
9434 {
9436 }
9437
9439 {
9441 }
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9453 {
9454 int slot = -1;
9455 if (GetInventory())
9456 {
9457 InventoryLocation il = new InventoryLocation;
9458 GetInventory().GetCurrentInventoryLocation(il);
9460 }
9461
9463 }
9464
9466 {
9467 float quantity_max = 0;
9468
9470 {
9471 if (attSlotID != -1)
9472 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9473
9474 if (quantity_max <= 0)
9476 }
9477
9478 if (quantity_max <= 0)
9480
9481 return quantity_max;
9482 }
9483
9485 {
9487 }
9488
9490 {
9492 }
9493
9494
9496 {
9498 }
9499
9501 {
9503 }
9504
9506 {
9508 }
9509
9510
9512 {
9513
9514 float weightEx = GetWeightEx();
9515 float special = GetInventoryAndCargoWeight();
9516 return weightEx - special;
9517 }
9518
9519
9521 {
9523 }
9524
9526 {
9528 {
9529 #ifdef DEVELOPER
9530 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9531 {
9532 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9534 }
9535 #endif
9536
9538 }
9539 else if (HasEnergyManager())
9540 {
9541 #ifdef DEVELOPER
9542 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9543 {
9544 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9545 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9546 }
9547 #endif
9548 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9549 }
9550 else
9551 {
9552 #ifdef DEVELOPER
9553 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9554 {
9555 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9556 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9557 }
9558 #endif
9559 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9560 }
9561 }
9562
9565 {
9566 int item_count = 0;
9568
9569 if (GetInventory().GetCargo() != NULL)
9570 {
9571 item_count = GetInventory().GetCargo().GetItemCount();
9572 }
9573
9574 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9575 {
9576 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9577 if (item)
9578 item_count += item.GetNumberOfItems();
9579 }
9580 return item_count;
9581 }
9582
9585 {
9586 float weight = 0;
9587 float wetness = 1;
9588 if (include_wetness)
9591 {
9592 weight = wetness * m_ConfigWeight;
9593 }
9595 {
9596 weight = 1;
9597 }
9598 return weight;
9599 }
9600
9601
9602
9604 {
9605 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9606 {
9607 GameInventory inv = GetInventory();
9608 array<EntityAI> items = new array<EntityAI>;
9610 for (int i = 0; i < items.Count(); i++)
9611 {
9613 if (item)
9614 {
9616 }
9617 }
9618 }
9619 }
9620
9621
9622
9623
9625 {
9626 float energy = 0;
9627 if (HasEnergyManager())
9628 {
9629 energy = GetCompEM().GetEnergy();
9630 }
9631 return energy;
9632 }
9633
9634
9636 {
9637 super.OnEnergyConsumed();
9638
9640 }
9641
9643 {
9644 super.OnEnergyAdded();
9645
9647 }
9648
9649
9651 {
9652 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9653 {
9655 {
9656 float energy_0to1 = GetCompEM().GetEnergy0To1();
9658 }
9659 }
9660 }
9661
9662
9664 {
9665 return ConfigGetFloat("heatIsolation");
9666 }
9667
9669 {
9671 }
9672
9674 {
9675 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9676 if (
GetGame().ConfigIsExisting(paramPath))
9678
9679 return 0.0;
9680 }
9681
9683 {
9684 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9685 if (
GetGame().ConfigIsExisting(paramPath))
9687
9688 return 0.0;
9689 }
9690
9691 override void SetWet(
float value,
bool allow_client =
false)
9692 {
9693 if (!IsServerCheck(allow_client))
9694 return;
9695
9698
9700
9701 m_VarWet = Math.Clamp(value, min, max);
9702
9704 {
9707 }
9708 }
9709
9710 override void AddWet(
float value)
9711 {
9713 }
9714
9716 {
9718 }
9719
9721 {
9723 }
9724
9726 {
9728 }
9729
9731 {
9733 }
9734
9736 {
9738 }
9739
9741 {
9744 if (newLevel != oldLevel)
9745 {
9747 }
9748 }
9749
9751 {
9752 SetWeightDirty();
9753 }
9754
9756 {
9757 return GetWetLevelInternal(
m_VarWet);
9758 }
9759
9760
9761
9763 {
9765 }
9766
9768 {
9770 }
9771
9773 {
9775 }
9776
9778 {
9780 }
9781
9782
9783
9785 {
9786 if (ConfigIsExisting("itemModelLength"))
9787 {
9788 return ConfigGetFloat("itemModelLength");
9789 }
9790 return 0;
9791 }
9792
9794 {
9795 if (ConfigIsExisting("itemAttachOffset"))
9796 {
9797 return ConfigGetFloat("itemAttachOffset");
9798 }
9799 return 0;
9800 }
9801
9802 override void SetCleanness(
int value,
bool allow_client =
false)
9803 {
9804 if (!IsServerCheck(allow_client))
9805 return;
9806
9808
9810
9813 }
9814
9816 {
9818 }
9819
9821 {
9822 return true;
9823 }
9824
9825
9826
9827
9829 {
9831 }
9832
9834 {
9836 }
9837
9838
9839
9840
9841 override void SetColor(
int r,
int g,
int b,
int a)
9842 {
9848 }
9850 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9851 {
9856 }
9857
9859 {
9861 }
9862
9865 {
9866 int r,g,b,a;
9868 r = r/255;
9869 g = g/255;
9870 b = b/255;
9871 a = a/255;
9872 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9873 }
9874
9875
9876
9877 override void SetLiquidType(
int value,
bool allow_client =
false)
9878 {
9879 if (!IsServerCheck(allow_client))
9880 return;
9881
9886 }
9887
9889 {
9890 return ConfigGetInt("varLiquidTypeInit");
9891 }
9892
9894 {
9896 }
9897
9899 {
9901 SetFrozen(false);
9902 }
9903
9906 {
9907 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9908 }
9909
9910
9913 {
9914 PlayerBase nplayer;
9915 if (PlayerBase.CastTo(nplayer, player))
9916 {
9918
9919 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9920 }
9921 }
9922
9923
9926 {
9927 PlayerBase nplayer;
9928 if (PlayerBase.CastTo(nplayer,player))
9929 {
9930
9931 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9932
9933 }
9934
9935
9936 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9937
9938
9939 if (HasEnergyManager())
9940 {
9941 GetCompEM().UpdatePlugState();
9942 }
9943 }
9944
9945
9947 {
9948 super.OnPlacementStarted(player);
9949
9951 }
9952
9953 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9954 {
9956 {
9957 m_AdminLog.OnPlacementComplete(player,
this);
9958 }
9959
9960 super.OnPlacementComplete(player, position, orientation);
9961 }
9962
9963
9964
9965
9966
9968 {
9970 {
9971 return true;
9972 }
9973 else
9974 {
9975 return false;
9976 }
9977 }
9978
9979
9981 {
9983 {
9985 }
9986 }
9987
9988
9990 {
9992 }
9993
9995 {
9997 }
9998
9999 override void InsertAgent(
int agent,
float count = 1)
10000 {
10001 if (count < 1)
10002 return;
10003
10005 }
10006
10009 {
10011 }
10012
10013
10015 {
10017 }
10018
10019
10020
10021
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10061 {
10063 return false;
10064 return true;
10065 }
10066
10068 {
10069
10071 }
10072
10073
10076 {
10077 super.CheckForRoofLimited(timeTresholdMS);
10078
10080 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10081 {
10082 m_PreviousRoofTestTime = time;
10083 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10084 }
10085 }
10086
10087
10089 {
10091 {
10092 return 0;
10093 }
10094
10095 if (GetInventory().GetAttachmentSlotsCount() != 0)
10096 {
10097 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10098 if (filter)
10099 return filter.GetProtectionLevel(type, false, system);
10100 else
10101 return 0;
10102 }
10103
10104 string subclassPath, entryName;
10105
10106 switch (type)
10107 {
10109 entryName = "biological";
10110 break;
10112 entryName = "chemical";
10113 break;
10114 default:
10115 entryName = "biological";
10116 break;
10117 }
10118
10119 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10120
10122 }
10123
10124
10125
10128 {
10129 if (!IsMagazine())
10131
10133 }
10134
10135
10136
10137
10138
10143 {
10144 return true;
10145 }
10146
10148 {
10150 }
10151
10152
10153
10154
10155
10157 {
10158 if (parent)
10159 {
10160 if (parent.IsInherited(DayZInfected))
10161 return true;
10162
10163 if (!parent.IsRuined())
10164 return true;
10165 }
10166
10167 return true;
10168 }
10169
10171 {
10172 if (!super.CanPutAsAttachment(parent))
10173 {
10174 return false;
10175 }
10176
10177 if (!IsRuined() && !parent.IsRuined())
10178 {
10179 return true;
10180 }
10181
10182 return false;
10183 }
10184
10186 {
10187
10188
10189
10190
10191 return super.CanReceiveItemIntoCargo(item);
10192 }
10193
10195 {
10196
10197
10198
10199
10200 GameInventory attachmentInv = attachment.GetInventory();
10202 {
10203 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10204 return false;
10205 }
10206
10207 InventoryLocation loc = new InventoryLocation();
10208 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10209 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10210 return false;
10211
10212 return super.CanReceiveAttachment(attachment, slotId);
10213 }
10214
10216 {
10217 if (!super.CanReleaseAttachment(attachment))
10218 return false;
10219
10220 return GetInventory().AreChildrenAccessible();
10221 }
10222
10223
10224
10225
10226
10227
10228
10229
10230
10231
10232
10233
10234
10235
10236
10237
10238
10239
10240
10241
10242
10244 {
10245 int id = muzzle_owner.GetMuzzleID();
10246 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10247
10248 if (WPOF_array)
10249 {
10250 for (int i = 0; i < WPOF_array.Count(); i++)
10251 {
10252 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10253
10254 if (WPOF)
10255 {
10256 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10257 }
10258 }
10259 }
10260 }
10261
10262
10264 {
10265 int id = muzzle_owner.GetMuzzleID();
10267
10268 if (WPOBE_array)
10269 {
10270 for (int i = 0; i < WPOBE_array.Count(); i++)
10271 {
10272 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10273
10274 if (WPOBE)
10275 {
10276 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10277 }
10278 }
10279 }
10280 }
10281
10282
10284 {
10285 int id = muzzle_owner.GetMuzzleID();
10286 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10287
10288 if (WPOOH_array)
10289 {
10290 for (int i = 0; i < WPOOH_array.Count(); i++)
10291 {
10292 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10293
10294 if (WPOOH)
10295 {
10296 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10297 }
10298 }
10299 }
10300 }
10301
10302
10304 {
10305 int id = muzzle_owner.GetMuzzleID();
10306 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10307
10308 if (WPOOH_array)
10309 {
10310 for (int i = 0; i < WPOOH_array.Count(); i++)
10311 {
10312 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10313
10314 if (WPOOH)
10315 {
10316 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10317 }
10318 }
10319 }
10320 }
10321
10322
10324 {
10325 int id = muzzle_owner.GetMuzzleID();
10326 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10327
10328 if (WPOOH_array)
10329 {
10330 for (int i = 0; i < WPOOH_array.Count(); i++)
10331 {
10332 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10333
10334 if (WPOOH)
10335 {
10336 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10337 }
10338 }
10339 }
10340 }
10341
10342
10343
10345 {
10347 {
10348 return true;
10349 }
10350
10351 return false;
10352 }
10353
10355 {
10357 {
10358 return true;
10359 }
10360
10361 return false;
10362 }
10363
10365 {
10367 {
10368 return true;
10369 }
10370
10371 return false;
10372 }
10373
10375 {
10376 return false;
10377 }
10378
10381 {
10382 return UATimeSpent.DEFAULT_DEPLOY;
10383 }
10384
10385
10386
10387
10389 {
10391 SetSynchDirty();
10392 }
10393
10395 {
10397 }
10398
10399
10401 {
10402 return false;
10403 }
10404
10407 {
10408 string att_type = "None";
10409
10410 if (ConfigIsExisting("soundAttType"))
10411 {
10412 att_type = ConfigGetString("soundAttType");
10413 }
10414
10416 }
10417
10419 {
10421 }
10422
10423
10424
10425
10426
10432
10434 {
10437
10439 }
10440
10441
10443 {
10445 return;
10446
10448
10451
10454
10455 SoundParameters params = new SoundParameters();
10459 }
10460
10461
10463 {
10465 return;
10466
10468 SetSynchDirty();
10469
10472 }
10473
10474
10476 {
10478 return;
10479
10481 SetSynchDirty();
10482
10485 }
10486
10488 {
10490 }
10491
10493 {
10495 }
10496
10499 {
10500 if (!
GetGame().IsDedicatedServer())
10501 {
10502 if (ConfigIsExisting("attachSoundSet"))
10503 {
10504 string cfg_path = "";
10505 string soundset = "";
10506 string type_name =
GetType();
10507
10510 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10511 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10512
10513 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10514 {
10515 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10516 {
10517 if (cfg_slot_array[i] == slot_type)
10518 {
10519 soundset = cfg_soundset_array[i];
10520 break;
10521 }
10522 }
10523 }
10524
10525 if (soundset != "")
10526 {
10527 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10529 }
10530 }
10531 }
10532 }
10533
10535 {
10536
10537 }
10538
10539 void OnApply(PlayerBase player);
10540
10542 {
10543 return 1.0;
10544 };
10545
10547 {
10549 }
10550
10552 {
10554 }
10555
10557
10559 {
10560 SetDynamicPhysicsLifeTime(0.01);
10562 }
10563
10565 {
10566 array<string> zone_names = new array<string>;
10567 GetDamageZones(zone_names);
10568 for (int i = 0; i < zone_names.Count(); i++)
10569 {
10570 SetHealthMax(zone_names.Get(i),"Health");
10571 }
10572 SetHealthMax("","Health");
10573 }
10574
10577 {
10578 float global_health = GetHealth01("","Health");
10579 array<string> zones = new array<string>;
10580 GetDamageZones(zones);
10581
10582 for (int i = 0; i < zones.Count(); i++)
10583 {
10584 SetHealth01(zones.Get(i),"Health",global_health);
10585 }
10586 }
10587
10590 {
10591 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10592 }
10593
10595 {
10596 if (!hasRootAsPlayer)
10597 {
10598 if (refParentIB)
10599 {
10600
10601 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10602 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10603
10604 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10605 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10606
10609 }
10610 else
10611 {
10612
10615 }
10616 }
10617 }
10618
10620 {
10622 {
10623 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10624 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10625 {
10626 float heatPermCoef = 1.0;
10628 while (ent)
10629 {
10630 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10631 ent = ent.GetHierarchyParent();
10632 }
10633
10634 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10635 }
10636 }
10637 }
10638
10640 {
10641
10642 EntityAI parent = GetHierarchyParent();
10643 if (!parent)
10644 {
10645 hasParent = false;
10646 hasRootAsPlayer = false;
10647 }
10648 else
10649 {
10650 hasParent = true;
10651 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10652 refParentIB =
ItemBase.Cast(parent);
10653 }
10654 }
10655
10656 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10657 {
10658
10659 }
10660
10662 {
10663
10664 return false;
10665 }
10666
10668 {
10669
10670
10671 return false;
10672 }
10673
10675 {
10676
10677 return false;
10678 }
10679
10682 {
10683 return !GetIsFrozen() &&
IsOpen();
10684 }
10685
10687 {
10688 bool hasParent = false, hasRootAsPlayer = false;
10690
10691 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10692 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10693
10694 if (wwtu || foodDecay)
10695 {
10699
10700 if (processWetness || processTemperature || processDecay)
10701 {
10703
10704 if (processWetness)
10705 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10706
10707 if (processTemperature)
10709
10710 if (processDecay)
10711 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10712 }
10713 }
10714 }
10715
10718 {
10720 }
10721
10723 {
10726
10727 return super.GetTemperatureFreezeThreshold();
10728 }
10729
10731 {
10734
10735 return super.GetTemperatureThawThreshold();
10736 }
10737
10739 {
10742
10743 return super.GetItemOverheatThreshold();
10744 }
10745
10747 {
10749 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10750
10751 return super.GetTemperatureFreezeTime();
10752 }
10753
10755 {
10757 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10758
10759 return super.GetTemperatureThawTime();
10760 }
10761
10766
10768 {
10769 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10770 }
10771
10773 {
10774 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10775 }
10776
10779 {
10781 }
10782
10784 {
10786 }
10787
10789 {
10791 }
10792
10795 {
10796 return null;
10797 }
10798
10801 {
10802 return false;
10803 }
10804
10806 {
10808 {
10811 if (!trg)
10812 {
10814 explosive = this;
10815 }
10816
10817 explosive.PairRemote(trg);
10819
10820 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10821 trg.SetPersistentPairID(persistentID);
10822 explosive.SetPersistentPairID(persistentID);
10823
10824 return true;
10825 }
10826 return false;
10827 }
10828
10831 {
10832 float ret = 1.0;
10835 ret *= GetHealth01();
10836
10837 return ret;
10838 }
10839
10840 #ifdef DEVELOPER
10841 override void SetDebugItem()
10842 {
10843 super.SetDebugItem();
10844 _itemBase = this;
10845 }
10846
10848 {
10849 string text = super.GetDebugText();
10850
10852 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10853
10854 return text;
10855 }
10856 #endif
10857
10859 {
10860 return true;
10861 }
10862
10864
10866
10868 {
10871 }
10872
10873
10881
10897}
10898
10900{
10902 if (entity)
10903 {
10904 bool is_item = entity.IsInherited(
ItemBase);
10905 if (is_item && full_quantity)
10906 {
10909 }
10910 }
10911 else
10912 {
10914 return NULL;
10915 }
10916 return entity;
10917}
10918
10920{
10921 if (item)
10922 {
10923 if (health > 0)
10924 item.SetHealth("", "", health);
10925
10926 if (item.CanHaveTemperature())
10927 {
10929 if (item.CanFreeze())
10930 item.SetFrozen(false);
10931 }
10932
10933 if (item.HasEnergyManager())
10934 {
10935 if (quantity >= 0)
10936 {
10937 item.GetCompEM().SetEnergy0To1(quantity);
10938 }
10939 else
10940 {
10942 }
10943 }
10944 else if (item.IsMagazine())
10945 {
10946 Magazine mag = Magazine.Cast(item);
10947 if (quantity >= 0)
10948 {
10949 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10950 }
10951 else
10952 {
10954 }
10955
10956 }
10957 else
10958 {
10959 if (quantity >= 0)
10960 {
10961 item.SetQuantityNormalized(quantity, false);
10962 }
10963 else
10964 {
10966 }
10967
10968 }
10969 }
10970}
10971
10972#ifdef DEVELOPER
10974#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.