6119{
6121 {
6122 return true;
6123 }
6124};
6125
6127{
6128
6129};
6130
6131
6132
6134{
6138
6140
6143
6144
6145
6146
6147
6156
6162
6167
6172
6193 protected bool m_IsResultOfSplit
6194
6196
6201
6202
6203
6205
6209
6210
6211
6213
6216
6217
6218
6224
6225
6233
6236
6237
6239
6240
6242
6243
6248
6249
6254
6256
6257
6259
6260
6262 {
6267
6268 if (!
g_Game.IsDedicatedServer())
6269 {
6271 {
6273
6275 {
6277 }
6278 }
6279
6282 }
6283
6284 m_OldLocation = null;
6285
6287 {
6289 }
6290
6291 if (ConfigIsExisting("headSelectionsToHide"))
6292 {
6295 }
6296
6298 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6299 {
6301 }
6302
6304
6305 m_IsResultOfSplit = false;
6306
6308 }
6309
6311 {
6312 super.InitItemVariables();
6313
6319 m_Count = ConfigGetInt(
"count");
6320
6323
6328
6331
6336
6348
6352
6353
6356 if (ConfigIsExisting("canBeSplit"))
6357 {
6360 }
6361
6363 if (ConfigIsExisting("itemBehaviour"))
6365
6366
6369 RegisterNetSyncVariableInt("m_VarLiquidType");
6370 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6371
6372 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6373 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6374 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6375
6376 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6377 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6378 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6379 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6380
6381 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6382 RegisterNetSyncVariableBool("m_IsTakeable");
6383 RegisterNetSyncVariableBool("m_IsHologram");
6384
6387 {
6390 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6391 }
6392
6394
6396 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6398
6400 }
6401
6403 {
6405 }
6406
6408 {
6411 {
6416 }
6417 }
6418
6419 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6420 {
6422 {
6425 }
6426
6428 }
6429
6431 {
6437 }
6438
6440
6442 {
6444
6445 if (!action)
6446 {
6447 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6448 return;
6449 }
6450
6452 if (!ai)
6453 {
6455 return;
6456 }
6457
6459 if (!action_array)
6460 {
6461 action_array = new array<ActionBase_Basic>;
6463 }
6464 if (LogManager.IsActionLogEnable())
6465 {
6466 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6467 }
6468
6469 if (action_array.Find(action) != -1)
6470 {
6471 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6472 }
6473 else
6474 {
6475 action_array.Insert(action);
6476 }
6477 }
6478
6480 {
6481 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6482 ActionBase action = player.GetActionManager().GetAction(actionName);
6485
6486 if (action_array)
6487 {
6488 action_array.RemoveItem(action);
6489 }
6490 }
6491
6492
6493
6495 {
6496 ActionOverrideData overrideData = new ActionOverrideData();
6500
6502 if (!actionMap)
6503 {
6506 }
6507
6508 actionMap.Insert(this.
Type(), overrideData);
6509
6510 }
6511
6513
6515
6516
6518 {
6521
6524
6525 string config_to_search = "CfgVehicles";
6526 string muzzle_owner_config;
6527
6529 {
6530 if (IsInherited(Weapon))
6531 config_to_search = "CfgWeapons";
6532
6533 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6534
6535 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6536
6537 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6538
6539 if (config_OnFire_subclass_count > 0)
6540 {
6541 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6542
6543 for (int i = 0; i < config_OnFire_subclass_count; i++)
6544 {
6545 string particle_class = "";
6546 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6547 string config_OnFire_entry = config_OnFire_class + particle_class;
6548 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6549 WPOF_array.Insert(WPOF);
6550 }
6551
6552
6554 }
6555 }
6556
6558 {
6559 config_to_search = "CfgWeapons";
6560 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6561
6562 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6563
6564 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6565
6566 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6567 {
6568 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6569
6570 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6571 {
6572 string particle_class2 = "";
6573 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6574 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6575 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6576 WPOBE_array.Insert(WPOBE);
6577 }
6578
6579
6581 }
6582 }
6583 }
6584
6585
6587 {
6590
6592 {
6593 string config_to_search = "CfgVehicles";
6594
6595 if (IsInherited(Weapon))
6596 config_to_search = "CfgWeapons";
6597
6598 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6599 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6600
6601 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6602 {
6603
6605
6607 {
6609 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6611 return;
6612 }
6613
6616
6617
6618
6619 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6620 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6621
6622 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6623 {
6624 string particle_class = "";
6625 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6626 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6627 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6628
6629 if (entry_type == CT_CLASS)
6630 {
6631 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6632 WPOOH_array.Insert(WPOF);
6633 }
6634 }
6635
6636
6638 }
6639 }
6640 }
6641
6643 {
6645 }
6646
6648 {
6650 {
6652
6655
6658
6659 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6660 }
6661 }
6662
6664 {
6666 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6667
6669 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6670
6672 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6673
6675 {
6677 }
6678 }
6679
6681 {
6683 }
6684
6686 {
6689 else
6691
6693 {
6696 }
6697 else
6698 {
6701
6704 }
6705
6707 }
6708
6710 {
6712 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6713 }
6714
6716 {
6718 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6720 }
6721
6723 {
6725 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6726 }
6727
6729 {
6732
6733 OverheatingParticle OP = new OverheatingParticle();
6738
6740 }
6741
6743 {
6746
6747 return -1;
6748 }
6749
6751 {
6753 {
6756
6757 for (int i = count; i > 0; --i)
6758 {
6759 int id = i - 1;
6762
6765
6766 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6767 {
6768 if (p)
6769 {
6772 }
6773 }
6774 }
6775 }
6776 }
6777
6779 {
6781 {
6783 {
6784 int id = i - 1;
6786
6787 if (OP)
6788 {
6790
6791 if (p)
6792 {
6794 }
6795
6796 delete OP;
6797 }
6798 }
6799
6802 }
6803 }
6804
6807 {
6808 return 0.0;
6809 }
6810
6811
6813 {
6814 return 250;
6815 }
6816
6818 {
6819 return 0;
6820 }
6821
6824 {
6826 return true;
6827
6828 return false;
6829 }
6830
6833 {
6836
6838 {
6840 }
6841 else
6842 {
6843
6845 }
6846
6848 }
6849
6856 {
6857 return -1;
6858 }
6859
6860
6861
6862
6864 {
6866 {
6867 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6868 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6869
6870 if (r_index >= 0)
6871 {
6872 InventoryLocation r_il = new InventoryLocation;
6873 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6874
6875 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6878 {
6879 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6880 }
6882 {
6883 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6884 }
6885
6886 }
6887
6888 player.GetHumanInventory().ClearUserReservedLocation(this);
6889 }
6890
6893 }
6894
6895
6896
6897
6899 {
6900 return ItemBase.m_DebugActionsMask;
6901 }
6902
6904 {
6905 return ItemBase.m_DebugActionsMask & mask;
6906 }
6907
6909 {
6910 ItemBase.m_DebugActionsMask = mask;
6911 }
6912
6914 {
6915 ItemBase.m_DebugActionsMask |= mask;
6916 }
6917
6919 {
6920 ItemBase.m_DebugActionsMask &= ~mask;
6921 }
6922
6924 {
6926 {
6928 }
6929 else
6930 {
6932 }
6933 }
6934
6935
6937 {
6938 if (GetEconomyProfile())
6939 {
6940 float q_max = GetEconomyProfile().GetQuantityMax();
6941 if (q_max > 0)
6942 {
6943 float q_min = GetEconomyProfile().GetQuantityMin();
6944 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6945
6947 {
6948 ComponentEnergyManager comp = GetCompEM();
6950 {
6952 }
6953 }
6955 {
6957
6958 }
6959
6960 }
6961 }
6962 }
6963
6966 {
6967 EntityAI parent = GetHierarchyParent();
6968
6969 if (parent)
6970 {
6971 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6972 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6973 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6974 }
6975 }
6976
6979 {
6980 EntityAI parent = GetHierarchyParent();
6981
6982 if (parent)
6983 {
6984 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6985 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6986 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6987 }
6988 }
6989
6991 {
6992
6993
6994
6995
6997
6999 {
7000 if (ScriptInputUserData.CanStoreInputUserData())
7001 {
7002 ScriptInputUserData ctx = new ScriptInputUserData;
7008 ctx.
Write(use_stack_max);
7011
7013 {
7014 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7015 }
7016 }
7017 }
7018 else if (!
g_Game.IsMultiplayer())
7019 {
7021 }
7022 }
7023
7025 {
7027 }
7028
7030 {
7032 }
7033
7035 {
7037 }
7038
7040 {
7041
7042 return false;
7043 }
7044
7046 {
7047 return false;
7048 }
7049
7053 {
7054 return false;
7055 }
7056
7058 {
7059 return "";
7060 }
7061
7063
7065 {
7066 return false;
7067 }
7068
7070 {
7071 return true;
7072 }
7073
7074
7075
7077 {
7078 return true;
7079 }
7080
7082 {
7083 return true;
7084 }
7085
7087 {
7088 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7090 }
7091
7093 {
7095 }
7096
7098 {
7100 if (!is_being_placed)
7102 SetSynchDirty();
7103 }
7104
7105
7107
7109 {
7111 }
7112
7114 {
7116 }
7117
7119 {
7120 return 1;
7121 }
7122
7124 {
7125 return false;
7126 }
7127
7129 {
7131 SetSynchDirty();
7132 }
7133
7134
7135
7136
7137
7138
7139
7140
7141
7142
7143
7144
7145
7146
7147
7148
7149
7150
7151
7152
7153
7154
7155
7156
7157
7158
7159
7160
7161
7162
7163
7164
7165
7166
7167
7169 {
7170 super.OnMovedInsideCargo(container);
7171
7172 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7173 }
7174
7175 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7176 {
7177 super.EEItemLocationChanged(oldLoc, newLoc);
7178
7179 PlayerBase newPlayer = null;
7180 PlayerBase oldPlayer = null;
7181
7182 if (newLoc.GetParent())
7183 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7184
7185 if (oldLoc.GetParent())
7186 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7187
7189 {
7190 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7191
7192 if (rIndex >= 0)
7193 {
7194 InventoryLocation rIl = new InventoryLocation;
7195 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7196
7197 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7200 {
7201 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7202 }
7204 {
7206 }
7207
7208 }
7209 }
7210
7212 {
7213 if (newPlayer)
7214 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
7215
7216 if (newPlayer == oldPlayer)
7217 {
7218 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7219 {
7221 {
7222 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7223 {
7224 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7225 }
7226 }
7227 else
7228 {
7229 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7230 }
7231 }
7232
7233 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7234 {
7235 int type = oldLoc.GetType();
7237 {
7238 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7239 }
7241 {
7242 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7243 }
7244 }
7245 if (!m_OldLocation)
7246 {
7247 m_OldLocation = new InventoryLocation;
7248 }
7249 m_OldLocation.Copy(oldLoc);
7250 }
7251 else
7252 {
7253 if (m_OldLocation)
7254 {
7255 m_OldLocation.Reset();
7256 }
7257 }
7258
7259 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7260 }
7261 else
7262 {
7263 if (newPlayer)
7264 {
7265 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7266 if (resIndex >= 0)
7267 {
7268 InventoryLocation il = new InventoryLocation;
7269 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7271 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7274 {
7275 il.
GetParent().GetOnReleaseLock().Invoke(it);
7276 }
7278 {
7280 }
7281
7282 }
7283 }
7285 {
7286
7288 }
7289
7290 if (m_OldLocation)
7291 {
7292 m_OldLocation.Reset();
7293 }
7294 }
7295
7297 {
7298 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7299 }
7300
7302 {
7303 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7304 }
7305 }
7306
7307 override void EOnContact(IEntity other, Contact extra)
7308 {
7310 {
7311 int liquidType = -1;
7313 if (impactSpeed > 0.0)
7314 {
7316 #ifndef SERVER
7318 #else
7320 SetSynchDirty();
7321 #endif
7323 }
7324 }
7325
7326 #ifdef SERVER
7327 if (GetCompEM() && GetCompEM().IsPlugged())
7328 {
7329 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7330 GetCompEM().UnplugThis();
7331 }
7332 #endif
7333 }
7334
7336
7338 {
7340 }
7341
7343 {
7344
7345 }
7346
7348 {
7349 super.OnItemLocationChanged(old_owner, new_owner);
7350
7351 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7352 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7353
7354 if (!relatedPlayer && playerNew)
7355 relatedPlayer = playerNew;
7356
7357 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7358 {
7360 if (actionMgr)
7361 {
7362 ActionBase currentAction = actionMgr.GetRunningAction();
7363 if (currentAction)
7365 }
7366 }
7367
7368 Man ownerPlayerOld = null;
7369 Man ownerPlayerNew = null;
7370
7371 if (old_owner)
7372 {
7373 if (old_owner.
IsMan())
7374 {
7375 ownerPlayerOld = Man.Cast(old_owner);
7376 }
7377 else
7378 {
7379 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7380 }
7381 }
7382 else
7383 {
7385 {
7387
7388 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7389 {
7390 GetCompEM().UnplugThis();
7391 }
7392 }
7393 }
7394
7395 if (new_owner)
7396 {
7397 if (new_owner.
IsMan())
7398 {
7399 ownerPlayerNew = Man.Cast(new_owner);
7400 }
7401 else
7402 {
7403 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7404 }
7405 }
7406
7407 if (ownerPlayerOld != ownerPlayerNew)
7408 {
7409 if (ownerPlayerOld)
7410 {
7411 array<EntityAI> subItemsExit = new array<EntityAI>;
7413 for (int i = 0; i < subItemsExit.Count(); i++)
7414 {
7417 }
7418 }
7419
7420 if (ownerPlayerNew)
7421 {
7422 array<EntityAI> subItemsEnter = new array<EntityAI>;
7424 for (int j = 0; j < subItemsEnter.Count(); j++)
7425 {
7428 }
7429 }
7430 }
7431 else if (ownerPlayerNew != null)
7432 {
7433 PlayerBase nplayer;
7434 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7435 {
7436 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7438 for (int k = 0; k < subItemsUpdate.Count(); k++)
7439 {
7441 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7442 }
7443 }
7444 }
7445
7446 if (old_owner)
7447 old_owner.OnChildItemRemoved(this);
7448 if (new_owner)
7449 new_owner.OnChildItemReceived(this);
7450 }
7451
7452
7454 {
7455 super.EEDelete(parent);
7456 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7457 if (player)
7458 {
7460
7461 if (player.IsAlive())
7462 {
7463 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7464 if (r_index >= 0)
7465 {
7466 InventoryLocation r_il = new InventoryLocation;
7467 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7468
7469 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7472 {
7473 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7474 }
7476 {
7477 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7478 }
7479
7480 }
7481
7482 player.RemoveQuickBarEntityShortcut(this);
7483 }
7484 }
7485 }
7486
7488 {
7489 super.EEKilled(killer);
7490
7493 {
7494 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7495 {
7496 if (IsMagazine())
7497 {
7498 if (Magazine.Cast(this).GetAmmoCount() > 0)
7499 {
7501 }
7502 }
7503 else
7504 {
7506 }
7507 }
7508 }
7509 }
7510
7512 {
7513 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7514
7515 super.OnWasAttached(parent, slot_id);
7516
7519
7522 }
7523
7525 {
7526 super.OnWasDetached(parent, slot_id);
7527
7530
7533 }
7534
7536 {
7537 int idx;
7540
7541 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7542 if (inventory_slots.Count() < 1)
7543 {
7544 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7545 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7546 }
7547 else
7548 {
7549 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7550 }
7551
7552 idx = inventory_slots.Find(slot);
7553 if (idx < 0)
7554 return "";
7555
7556 return attach_types.Get(idx);
7557 }
7558
7560 {
7561 int idx = -1;
7562 string slot;
7563
7566
7567 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7568 if (inventory_slots.Count() < 1)
7569 {
7570 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7571 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7572 }
7573 else
7574 {
7575 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7576 if (detach_types.Count() < 1)
7577 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7578 }
7579
7580 for (int i = 0; i < inventory_slots.Count(); i++)
7581 {
7582 slot = inventory_slots.Get(i);
7583 }
7584
7585 if (slot != "")
7586 {
7587 if (detach_types.Count() == 1)
7588 idx = 0;
7589 else
7590 idx = inventory_slots.Find(slot);
7591 }
7592 if (idx < 0)
7593 return "";
7594
7595 return detach_types.Get(idx);
7596 }
7597
7599 {
7600
7602
7603
7604 float min_time = 1;
7605 float max_time = 3;
7606 float delay = Math.RandomFloat(min_time, max_time);
7607
7608 explode_timer.Run(delay, this, "DoAmmoExplosion");
7609 }
7610
7612 {
7613 Magazine magazine = Magazine.Cast(this);
7614 int pop_sounds_count = 6;
7615 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7616
7617
7618 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7619 string sound_name = pop_sounds[ sound_idx ];
7620 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7621
7622
7623 magazine.ServerAddAmmoCount(-1);
7624
7625
7626 float min_temp_to_explode = 100;
7627
7628 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7629 {
7631 }
7632 }
7633
7634
7635 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7636 {
7637 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7638
7639 const int CHANCE_DAMAGE_CARGO = 4;
7640 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7641 const int CHANCE_DAMAGE_NOTHING = 2;
7642
7644 {
7645 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7646 int chances;
7647 int rnd;
7648
7649 if (GetInventory().GetCargo())
7650 {
7651 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7652 rnd = Math.RandomInt(0,chances);
7653
7654 if (rnd < CHANCE_DAMAGE_CARGO)
7655 {
7657 }
7658 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7659 {
7661 }
7662 }
7663 else
7664 {
7665 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7666 rnd = Math.RandomInt(0,chances);
7667
7668 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7669 {
7671 }
7672 }
7673 }
7674 }
7675
7677 {
7678 CargoBase cargo = GetInventory().GetCargo();
7679 if (cargo)
7680 {
7682 if (item_count > 0)
7683 {
7684 int random_pick = Math.RandomInt(0, item_count);
7686 if (!item.IsExplosive())
7687 {
7688 item.AddHealth("","",damage);
7689 return true;
7690 }
7691 }
7692 }
7693 return false;
7694 }
7695
7697 {
7698 GameInventory inventory = GetInventory();
7700 if (attachment_count > 0)
7701 {
7702 int random_pick = Math.RandomInt(0, attachment_count);
7704 if (!attachment.IsExplosive())
7705 {
7706 attachment.AddHealth("","",damage);
7707 return true;
7708 }
7709 }
7710 return false;
7711 }
7712
7714 {
7716 }
7717
7719 {
7721 return GetInventory().CanRemoveEntity();
7722
7723 return false;
7724 }
7725
7727 {
7728
7730 return false;
7731
7732
7734 return false;
7735
7736
7737
7739 if (delta == 0)
7740 return false;
7741
7742
7743 return true;
7744 }
7745
7747 {
7749 {
7750 if (ScriptInputUserData.CanStoreInputUserData())
7751 {
7752 ScriptInputUserData ctx = new ScriptInputUserData;
7757 ctx.
Write(destination_entity);
7761 }
7762 }
7763 else if (!
g_Game.IsMultiplayer())
7764 {
7766 }
7767 }
7768
7770 {
7771 float split_quantity_new;
7775 InventoryLocation loc = new InventoryLocation;
7776
7777 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7778 {
7780 split_quantity_new = stack_max;
7781 else
7783
7785 {
7786 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7787 if (new_item)
7788 {
7789 new_item.SetResultOfSplit(true);
7790 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7792 new_item.
SetQuantity(split_quantity_new,
false,
true);
7793 }
7794 }
7795 }
7796 else if (destination_entity && slot_id == -1)
7797 {
7798 if (quantity > stack_max)
7799 split_quantity_new = stack_max;
7800 else
7801 split_quantity_new = quantity;
7802
7804 {
7805 GameInventory destinationInventory = destination_entity.GetInventory();
7807 {
7810 }
7811
7812 if (new_item)
7813 {
7814 new_item.SetResultOfSplit(true);
7815 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7817 new_item.
SetQuantity(split_quantity_new,
false,
true);
7818 }
7819 }
7820 }
7821 else
7822 {
7823 if (stack_max != 0)
7824 {
7826 {
7828 }
7829
7830 if (split_quantity_new == 0)
7831 {
7832 if (!
g_Game.IsMultiplayer())
7833 player.PhysicalPredictiveDropItem(this);
7834 else
7835 player.ServerDropEntity(this);
7836 return;
7837 }
7838
7840 {
7842
7843 if (new_item)
7844 {
7845 new_item.SetResultOfSplit(true);
7846 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7849 new_item.PlaceOnSurface();
7850 }
7851 }
7852 }
7853 }
7854 }
7855
7857 {
7858 float split_quantity_new;
7862 InventoryLocation loc = new InventoryLocation;
7863
7864 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7865 {
7867 split_quantity_new = stack_max;
7868 else
7870
7872 {
7873 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7874 if (new_item)
7875 {
7876 new_item.SetResultOfSplit(true);
7877 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7879 new_item.
SetQuantity(split_quantity_new,
false,
true);
7880 }
7881 }
7882 }
7883 else if (destination_entity && slot_id == -1)
7884 {
7885 if (quantity > stack_max)
7886 split_quantity_new = stack_max;
7887 else
7888 split_quantity_new = quantity;
7889
7891 {
7892 GameInventory destinationInventory = destination_entity.GetInventory();
7894 {
7897 }
7898
7899 if (new_item)
7900 {
7901 new_item.SetResultOfSplit(true);
7902 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7904 new_item.
SetQuantity(split_quantity_new,
false,
true);
7905 }
7906 }
7907 }
7908 else
7909 {
7910 if (stack_max != 0)
7911 {
7913 {
7915 }
7916
7918 {
7920
7921 if (new_item)
7922 {
7923 new_item.SetResultOfSplit(true);
7924 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7927 new_item.PlaceOnSurface();
7928 }
7929 }
7930 }
7931 }
7932 }
7933
7935 {
7937 {
7938 if (ScriptInputUserData.CanStoreInputUserData())
7939 {
7940 ScriptInputUserData ctx = new ScriptInputUserData;
7945 dst.WriteToContext(ctx);
7947 }
7948 }
7949 else if (!
g_Game.IsMultiplayer())
7950 {
7952 }
7953 }
7954
7956 {
7958 {
7959 if (ScriptInputUserData.CanStoreInputUserData())
7960 {
7961 ScriptInputUserData ctx = new ScriptInputUserData;
7966 ctx.
Write(destination_entity);
7972 }
7973 }
7974 else if (!
g_Game.IsMultiplayer())
7975 {
7977 }
7978 }
7979
7981 {
7983 }
7984
7986 {
7988 float split_quantity_new;
7990 if (dst.IsValid())
7991 {
7992 int slot_id = dst.GetSlot();
7994
7995 if (quantity > stack_max)
7996 split_quantity_new = stack_max;
7997 else
7998 split_quantity_new = quantity;
7999
8001 {
8003
8004 if (new_item)
8005 {
8006 new_item.SetResultOfSplit(true);
8007 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8009 new_item.
SetQuantity(split_quantity_new,
false,
true);
8010 }
8011
8012 return new_item;
8013 }
8014 }
8015
8016 return null;
8017 }
8018
8020 {
8022 float split_quantity_new;
8024 if (destination_entity)
8025 {
8027 if (quantity > stackable)
8028 split_quantity_new = stackable;
8029 else
8030 split_quantity_new = quantity;
8031
8033 {
8034 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8035 if (new_item)
8036 {
8037 new_item.SetResultOfSplit(true);
8038 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8040 new_item.
SetQuantity(split_quantity_new,
false,
true);
8041 }
8042 }
8043 }
8044 }
8045
8047 {
8049 {
8050 if (ScriptInputUserData.CanStoreInputUserData())
8051 {
8052 ScriptInputUserData ctx = new ScriptInputUserData;
8057 ItemBase destination_entity =
this;
8058 ctx.
Write(destination_entity);
8062 }
8063 }
8064 else if (!
g_Game.IsMultiplayer())
8065 {
8067 }
8068 }
8069
8071 {
8073 float split_quantity_new;
8075 if (player)
8076 {
8078 if (quantity > stackable)
8079 split_quantity_new = stackable;
8080 else
8081 split_quantity_new = quantity;
8082
8084 {
8085 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8086 new_item =
ItemBase.Cast(in_hands);
8087 if (new_item)
8088 {
8089 new_item.SetResultOfSplit(true);
8090 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8092 new_item.SetQuantity(split_quantity_new, false, true);
8093 }
8094 }
8095 }
8096 }
8097
8099 {
8101 float split_quantity_new = Math.Floor(quantity * 0.5);
8102
8104 return;
8105
8107
8108 if (new_item)
8109 {
8110 if (new_item.GetQuantityMax() < split_quantity_new)
8111 {
8112 split_quantity_new = new_item.GetQuantityMax();
8113 }
8114
8115 new_item.SetResultOfSplit(true);
8116 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8117
8119 {
8122 }
8123 else
8124 {
8126 new_item.
SetQuantity(split_quantity_new,
false,
true);
8127 }
8128 }
8129 }
8130
8132 {
8134 float split_quantity_new = Math.Floor(quantity / 2);
8135
8137 return;
8138
8139 InventoryLocation invloc = new InventoryLocation;
8141
8143 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8144
8145 if (new_item)
8146 {
8147 if (new_item.GetQuantityMax() < split_quantity_new)
8148 {
8149 split_quantity_new = new_item.GetQuantityMax();
8150 }
8152 {
8155 }
8156 else if (split_quantity_new > 1)
8157 {
8159 new_item.
SetQuantity(split_quantity_new,
false,
true);
8160 }
8161 }
8162 }
8163
8166 {
8167 SetWeightDirty();
8169
8170 if (parent)
8171 parent.OnAttachmentQuantityChangedEx(this, delta);
8172
8174 {
8176 {
8178 }
8180 {
8181 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8183 }
8184 }
8185 }
8186
8189 {
8190
8191 }
8192
8195 {
8197 }
8198
8200 {
8201 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8202
8204 {
8205 if (newLevel == GameConstants.STATE_RUINED)
8206 {
8208 EntityAI parent = GetHierarchyParent();
8209 if (parent && parent.IsFireplace())
8210 {
8211 CargoBase cargo = GetInventory().GetCargo();
8212 if (cargo)
8213 {
8215 {
8217 }
8218 }
8219 }
8220 }
8221
8223 {
8224
8226 return;
8227 }
8228
8229 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8230 {
8232 }
8233 }
8234 }
8235
8236
8238 {
8239 super.OnRightClick();
8240
8242 {
8244 {
8245 if (ScriptInputUserData.CanStoreInputUserData())
8246 {
8247 EntityAI root = GetHierarchyRoot();
8248 Man playerOwner = GetHierarchyRootPlayer();
8249 InventoryLocation dst = new InventoryLocation;
8250
8251
8252 if (!playerOwner && root && root == this)
8253 {
8255 }
8256 else
8257 {
8258
8259 GetInventory().GetCurrentInventoryLocation(dst);
8261 {
8262 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8264 {
8266 }
8267 else
8268 {
8270
8271
8272 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8273 {
8275 }
8276 else
8277 {
8278 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8279 }
8280 }
8281 }
8282 }
8283
8284 ScriptInputUserData ctx = new ScriptInputUserData;
8292 }
8293 }
8294 else if (!
g_Game.IsMultiplayer())
8295 {
8297 }
8298 }
8299 }
8300
8302 {
8303 if (root)
8304 {
8305 vector m4[4];
8306 root.GetTransform(m4);
8307 dst.SetGround(this, m4);
8308 }
8309 else
8310 {
8311 GetInventory().GetCurrentInventoryLocation(dst);
8312 }
8313 }
8314
8315 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8316 {
8317
8318 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8319 return false;
8320
8321 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8322 return false;
8323
8324
8326 return false;
8327
8328
8329 Magazine mag = Magazine.Cast(this);
8330 if (mag)
8331 {
8332 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8333 return false;
8334
8335 if (stack_max_limit)
8336 {
8337 Magazine other_mag = Magazine.Cast(other_item);
8338 if (other_item)
8339 {
8340 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8341 return false;
8342 }
8343
8344 }
8345 }
8346 else
8347 {
8348
8350 return false;
8351
8353 return false;
8354 }
8355
8356 PlayerBase player = null;
8357 if (CastTo(player, GetHierarchyRootPlayer()))
8358 {
8359 if (player.GetInventory().HasAttachment(this))
8360 return false;
8361
8362 if (player.IsItemsToDelete())
8363 return false;
8364 }
8365
8366 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8367 return false;
8368
8369 int slotID;
8371 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8372 return false;
8373
8374 return true;
8375 }
8376
8378 {
8380 }
8381
8383 {
8384 return m_IsResultOfSplit;
8385 }
8386
8388 {
8389 m_IsResultOfSplit = value;
8390 }
8391
8393 {
8395 }
8396
8398 {
8399 float other_item_quantity = other_item.GetQuantity();
8400 float this_free_space;
8401
8403
8405
8406 if (other_item_quantity > this_free_space)
8407 {
8408 return this_free_space;
8409 }
8410 else
8411 {
8412 return other_item_quantity;
8413 }
8414 }
8415
8417 {
8419 }
8420
8422 {
8424 return;
8425
8426 if (!IsMagazine() && other_item)
8427 {
8429 if (quantity_used != 0)
8430 {
8431 float hp1 = GetHealth01("","");
8432 float hp2 = other_item.GetHealth01("","");
8433 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8434 hpResult = hpResult / (
GetQuantity() + quantity_used);
8435
8436 hpResult *= GetMaxHealth();
8437 Math.Round(hpResult);
8438 SetHealth("", "Health", hpResult);
8439
8441 other_item.AddQuantity(-quantity_used);
8442 }
8443 }
8445 }
8446
8448 {
8449 #ifdef SERVER
8450 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8451 GetHierarchyParent().IncreaseLifetimeUp();
8452 #endif
8453 };
8454
8456 {
8457 PlayerBase p = PlayerBase.Cast(player);
8458
8459 array<int> recipesIds = p.m_Recipes;
8460 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8461 if (moduleRecipesManager)
8462 {
8463 EntityAI itemInHands = player.GetEntityInHands();
8464 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8465 }
8466
8467 for (int i = 0;i < recipesIds.Count(); i++)
8468 {
8469 int key = recipesIds.Get(i);
8470 string recipeName = moduleRecipesManager.GetRecipeName(key);
8472 }
8473 }
8474
8475
8476 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8477 {
8478 super.GetDebugActions(outputList);
8479
8480
8486
8487
8492
8497
8498
8502
8503
8505 {
8509 }
8510
8513
8514
8518
8520
8521 InventoryLocation loc = new InventoryLocation();
8522 GetInventory().GetCurrentInventoryLocation(loc);
8524 {
8525 if (Gizmo_IsSupported())
8528 }
8529
8531 }
8532
8533
8534
8535
8537 {
8538 super.OnAction(action_id, player, ctx);
8539
8541 {
8542 switch (action_id)
8543 {
8547 return true;
8551 return true;
8552 }
8553 }
8554
8556 {
8557 switch (action_id)
8558 {
8560 Delete();
8561 return true;
8562 }
8563 }
8564
8565 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8566 {
8567 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8568 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8569 PlayerBase p = PlayerBase.Cast(player);
8570 if (
EActions.RECIPES_RANGE_START < 1000)
8571 {
8572 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8573 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8574 }
8575 }
8576 #ifndef SERVER
8577 else if (action_id ==
EActions.WATCH_PLAYER)
8578 {
8579 PluginDeveloper.SetDeveloperItemClientEx(player);
8580 }
8581 #endif
8583 {
8584 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8585 {
8586 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8587 OnDebugButtonPressServer(id + 1);
8588 }
8589
8590 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8591 {
8592 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8594 }
8595
8596 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8597 {
8598 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8600 }
8601
8602 else if (action_id ==
EActions.ADD_QUANTITY)
8603 {
8604 if (IsMagazine())
8605 {
8606 Magazine mag = Magazine.Cast(this);
8607 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8608 }
8609 else
8610 {
8612 }
8613
8614 if (m_EM)
8615 {
8616 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8617 }
8618
8619 }
8620
8621 else if (action_id ==
EActions.REMOVE_QUANTITY)
8622 {
8623 if (IsMagazine())
8624 {
8625 Magazine mag2 = Magazine.Cast(this);
8626 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8627 }
8628 else
8629 {
8631 }
8632 if (m_EM)
8633 {
8634 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8635 }
8636
8637 }
8638
8639 else if (action_id ==
EActions.SET_QUANTITY_0)
8640 {
8642
8643 if (m_EM)
8644 {
8645 m_EM.SetEnergy(0);
8646 }
8647 }
8648
8649 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8650 {
8652
8653 if (m_EM)
8654 {
8655 m_EM.SetEnergy(m_EM.GetEnergyMax());
8656 }
8657 }
8658
8659 else if (action_id ==
EActions.ADD_HEALTH)
8660 {
8661 AddHealth("","",GetMaxHealth("","Health")/5);
8662 }
8663 else if (action_id ==
EActions.REMOVE_HEALTH)
8664 {
8665 AddHealth("","",-GetMaxHealth("","Health")/5);
8666 }
8667 else if (action_id ==
EActions.DESTROY_HEALTH)
8668 {
8669 SetHealth01("","",0);
8670 }
8671 else if (action_id ==
EActions.WATCH_ITEM)
8672 {
8674 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8675 #ifdef DEVELOPER
8676 SetDebugDeveloper_item(this);
8677 #endif
8678 }
8679
8680 else if (action_id ==
EActions.ADD_TEMPERATURE)
8681 {
8682 AddTemperature(20);
8683
8684 }
8685
8686 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8687 {
8688 AddTemperature(-20);
8689
8690 }
8691
8692 else if (action_id ==
EActions.FLIP_FROZEN)
8693 {
8694 SetFrozen(!GetIsFrozen());
8695
8696 }
8697
8698 else if (action_id ==
EActions.ADD_WETNESS)
8699 {
8701
8702 }
8703
8704 else if (action_id ==
EActions.REMOVE_WETNESS)
8705 {
8707
8708 }
8709
8710 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8711 {
8714
8715
8716 }
8717
8718 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8719 {
8722 }
8723
8724 else if (action_id ==
EActions.MAKE_SPECIAL)
8725 {
8726 auto debugParams = DebugSpawnParams.WithPlayer(player);
8727 OnDebugSpawnEx(debugParams);
8728 }
8729
8730 }
8731
8732
8733 return false;
8734 }
8735
8736
8737
8738
8742
8745
8746
8747
8749 {
8750 return false;
8751 }
8752
8753
8755 {
8756 return true;
8757 }
8758
8759
8761 {
8762 return true;
8763 }
8764
8765
8766
8768 {
8769 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8770 return g_Game.ConfigIsExisting(config_path);
8771 }
8772
8775 {
8776 return null;
8777 }
8778
8780 {
8781 return false;
8782 }
8783
8785 {
8786 return false;
8787 }
8788
8792
8793
8795 {
8796 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8797 return module_repairing.CanRepair(this, item_repair_kit);
8798 }
8799
8800
8801 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8802 {
8803 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8804 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8805 }
8806
8807
8809 {
8810
8811
8812
8813
8814
8815
8816
8817
8818 return 1;
8819 }
8820
8821
8822
8824 {
8826 }
8827
8828
8829
8831 {
8833 }
8834
8835
8844 {
8845 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8846
8847 if (player)
8848 {
8849 player.MessageStatus(text);
8850 }
8851 }
8852
8853
8862 {
8863 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8864
8865 if (player)
8866 {
8867 player.MessageAction(text);
8868 }
8869 }
8870
8871
8880 {
8881 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8882
8883 if (player)
8884 {
8885 player.MessageFriendly(text);
8886 }
8887 }
8888
8889
8898 {
8899 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8900
8901 if (player)
8902 {
8903 player.MessageImportant(text);
8904 }
8905 }
8906
8908 {
8909 return true;
8910 }
8911
8912
8913 override bool KindOf(
string tag)
8914 {
8915 bool found = false;
8916 string item_name = this.
GetType();
8918 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8919
8920 int array_size = item_tag_array.Count();
8921 for (int i = 0; i < array_size; i++)
8922 {
8923 if (item_tag_array.Get(i) == tag)
8924 {
8925 found = true;
8926 break;
8927 }
8928 }
8929 return found;
8930 }
8931
8932
8934 {
8935
8936 super.OnRPC(sender, rpc_type,ctx);
8937
8938
8939 switch (rpc_type)
8940 {
8941 #ifndef SERVER
8942 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8943 Param2<bool, string> p = new Param2<bool, string>(false, "");
8944
8946 return;
8947
8948 bool play = p.param1;
8949 string soundSet = p.param2;
8950
8951 if (play)
8952 {
8954 {
8956 {
8958 }
8959 }
8960 else
8961 {
8963 }
8964 }
8965 else
8966 {
8968 }
8969
8970 break;
8971 #endif
8972
8973 }
8974
8976 {
8978 }
8979 }
8980
8981
8982
8983
8985 {
8986 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8987 return plugin.GetID(
name);
8988 }
8989
8991 {
8992 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8993 return plugin.GetName(id);
8994 }
8995
8998 {
8999
9000
9001 int varFlags;
9002 if (!ctx.
Read(varFlags))
9003 return;
9004
9005 if (varFlags & ItemVariableFlags.FLOAT)
9006 {
9008 }
9009 }
9010
9012 {
9013
9014 super.SerializeNumericalVars(floats_out);
9015
9016
9017
9019 {
9021 }
9022
9024 {
9026 }
9027
9029 {
9031 }
9032
9034 {
9039 }
9040
9042 {
9044 }
9045 }
9046
9048 {
9049
9050 super.DeSerializeNumericalVars(floats);
9051
9052
9053 int index = 0;
9054 int mask = Math.Round(floats.Get(index));
9055
9056 index++;
9057
9059 {
9061 {
9063 }
9064 else
9065 {
9066 float quantity = floats.Get(index);
9068 }
9069 index++;
9070 }
9071
9073 {
9074 float wet = floats.Get(index);
9076 index++;
9077 }
9078
9080 {
9081 int liquidtype = Math.Round(floats.Get(index));
9083 index++;
9084 }
9085
9087 {
9089 index++;
9091 index++;
9093 index++;
9095 index++;
9096 }
9097
9099 {
9100 int cleanness = Math.Round(floats.Get(index));
9102 index++;
9103 }
9104 }
9105
9107 {
9108 super.WriteVarsToCTX(ctx);
9109
9110
9112 {
9114 }
9115
9117 {
9119 }
9120
9122 {
9124 }
9125
9127 {
9128 int r,g,b,a;
9134 }
9135
9137 {
9139 }
9140 }
9141
9143 {
9144 if (!super.ReadVarsFromCTX(ctx,version))
9145 return false;
9146
9147 int intValue;
9148 float value;
9149
9150 if (version < 140)
9151 {
9152 if (!ctx.
Read(intValue))
9153 return false;
9154
9155 m_VariablesMask = intValue;
9156 }
9157
9159 {
9160 if (!ctx.
Read(value))
9161 return false;
9162
9164 {
9166 }
9167 else
9168 {
9170 }
9171 }
9172
9173 if (version < 140)
9174 {
9176 {
9177 if (!ctx.
Read(value))
9178 return false;
9179 SetTemperatureDirect(value);
9180 }
9181 }
9182
9184 {
9185 if (!ctx.
Read(value))
9186 return false;
9188 }
9189
9191 {
9192 if (!ctx.
Read(intValue))
9193 return false;
9195 }
9196
9198 {
9199 int r,g,b,a;
9201 return false;
9203 return false;
9205 return false;
9207 return false;
9208
9210 }
9211
9213 {
9214 if (!ctx.
Read(intValue))
9215 return false;
9217 }
9218
9219 if (version >= 138 && version < 140)
9220 {
9222 {
9223 if (!ctx.
Read(intValue))
9224 return false;
9225 SetFrozen(intValue);
9226 }
9227 }
9228
9229 return true;
9230 }
9231
9232
9234 {
9237 {
9239 }
9240
9241 if (!super.OnStoreLoad(ctx, version))
9242 {
9244 return false;
9245 }
9246
9247 if (version >= 114)
9248 {
9249 bool hasQuickBarIndexSaved;
9250
9251 if (!ctx.
Read(hasQuickBarIndexSaved))
9252 {
9254 return false;
9255 }
9256
9257 if (hasQuickBarIndexSaved)
9258 {
9259 int itmQBIndex;
9260
9261
9262 if (!ctx.
Read(itmQBIndex))
9263 {
9265 return false;
9266 }
9267
9268 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9269 if (itmQBIndex != -1 && parentPlayer)
9270 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9271 }
9272 }
9273 else
9274 {
9275
9276 PlayerBase player;
9277 int itemQBIndex;
9278 if (version ==
int.
MAX)
9279 {
9280 if (!ctx.
Read(itemQBIndex))
9281 {
9283 return false;
9284 }
9285 }
9286 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9287 {
9288
9289 if (!ctx.
Read(itemQBIndex))
9290 {
9292 return false;
9293 }
9294 if (itemQBIndex != -1 && player)
9295 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9296 }
9297 }
9298
9299 if (version < 140)
9300 {
9301
9302 if (!LoadVariables(ctx, version))
9303 {
9305 return false;
9306 }
9307 }
9308
9309
9311 {
9313 return false;
9314 }
9315 if (version >= 132)
9316 {
9318 if (raib)
9319 {
9321 {
9323 return false;
9324 }
9325 }
9326 }
9327
9329 return true;
9330 }
9331
9332
9333
9335 {
9336 super.OnStoreSave(ctx);
9337
9338 PlayerBase player;
9339 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9340 {
9342
9343 int itemQBIndex = -1;
9344 itemQBIndex = player.FindQuickBarEntityIndex(this);
9345 ctx.
Write(itemQBIndex);
9346 }
9347 else
9348 {
9350 }
9351
9353
9355 if (raib)
9356 {
9358 }
9359 }
9360
9361
9363 {
9364 super.AfterStoreLoad();
9365
9367 {
9369 }
9370
9372 {
9375 }
9376 }
9377
9379 {
9380 super.EEOnAfterLoad();
9381
9383 {
9385 }
9386
9389 }
9390
9392 {
9393 return false;
9394 }
9395
9396
9397
9399 {
9401 {
9402 #ifdef PLATFORM_CONSOLE
9403
9405 {
9407 if (menu)
9408 {
9410 }
9411 }
9412 #endif
9413 }
9414
9416 {
9419 }
9420
9422 {
9423 SetWeightDirty();
9425 }
9427 {
9430 }
9431
9433 {
9436
9439 }
9441 {
9445 }
9446
9447 super.OnVariablesSynchronized();
9448 }
9449
9450
9451
9453 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9454 {
9455 if (!IsServerCheck(allow_client))
9456 return false;
9457
9459 return false;
9460
9463
9464 if (value <= (min + 0.001))
9465 value = min;
9466
9467 if (value == min)
9468 {
9469 if (destroy_config)
9470 {
9471 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9472 if (dstr)
9473 {
9475 this.Delete();
9476 return true;
9477 }
9478 }
9479 else if (destroy_forced)
9480 {
9482 this.Delete();
9483 return true;
9484 }
9485
9487 }
9488
9491
9493 {
9494 EntityAI parent = GetHierarchyRoot();
9495 InventoryLocation iLoc = new InventoryLocation();
9496 GetInventory().GetCurrentInventoryLocation(iLoc);
9498 {
9499 int iLocSlot = iLoc.
GetSlot();
9501 {
9503 }
9505 {
9507 }
9508 }
9509 }
9510
9512 {
9514
9515 if (delta)
9517 }
9518
9520
9521 return false;
9522 }
9523
9524
9526 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9527 {
9529 }
9530
9532 {
9535 }
9536
9538 {
9541 }
9542
9544 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9545 {
9546 float value_clamped = Math.Clamp(value, 0, 1);
9548 SetQuantity(result, destroy_config, destroy_forced);
9549 }
9550
9551
9554 {
9556 }
9557
9559 {
9561 }
9562
9563
9564
9565
9566
9567
9568
9569
9570
9571
9573 {
9574 int slot = -1;
9575 GameInventory inventory = GetInventory();
9576 if (inventory)
9577 {
9578 InventoryLocation il = new InventoryLocation;
9581 }
9582
9584 }
9585
9587 {
9588 float quantity_max = 0;
9589
9591 {
9592 if (attSlotID != -1)
9593 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9594
9595 if (quantity_max <= 0)
9597 }
9598
9599 if (quantity_max <= 0)
9601
9602 return quantity_max;
9603 }
9604
9606 {
9608 }
9609
9611 {
9613 }
9614
9615
9617 {
9619 }
9620
9622 {
9624 }
9625
9627 {
9629 }
9630
9631
9633 {
9634
9635 float weightEx = GetWeightEx();
9636 float special = GetInventoryAndCargoWeight();
9637 return weightEx - special;
9638 }
9639
9640
9642 {
9644 }
9645
9647 {
9649 {
9650 #ifdef DEVELOPER
9651 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9652 {
9653 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9655 }
9656 #endif
9657
9659 }
9660 else if (HasEnergyManager())
9661 {
9662 #ifdef DEVELOPER
9663 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9664 {
9665 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9666 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9667 }
9668 #endif
9669 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9670 }
9671 else
9672 {
9673 #ifdef DEVELOPER
9674 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9675 {
9676 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9677 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9678 }
9679 #endif
9680 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9681 }
9682 }
9683
9686 {
9687 int item_count = 0;
9689
9690 GameInventory inventory = GetInventory();
9691 CargoBase cargo = inventory.
GetCargo();
9692 if (cargo != NULL)
9693 {
9695 }
9696
9698 for (int i = 0; i < nAttachments; ++i)
9699 {
9701 if (item)
9702 item_count += item.GetNumberOfItems();
9703 }
9704 return item_count;
9705 }
9706
9709 {
9710 float weight = 0;
9711 float wetness = 1;
9712 if (include_wetness)
9715 {
9716 weight = wetness * m_ConfigWeight;
9717 }
9719 {
9720 weight = 1;
9721 }
9722 return weight;
9723 }
9724
9725
9726
9728 {
9729 GameInventory inventory = GetInventory();
9730 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9731 {
9732 array<EntityAI> items = new array<EntityAI>;
9734 for (int i = 0; i < items.Count(); ++i)
9735 {
9737 if (item)
9738 {
9739 g_Game.ObjectDelete(item);
9740 }
9741 }
9742 }
9743 }
9744
9745
9746
9747
9749 {
9750 float energy = 0;
9751 if (HasEnergyManager())
9752 {
9753 energy = GetCompEM().GetEnergy();
9754 }
9755 return energy;
9756 }
9757
9758
9760 {
9761 super.OnEnergyConsumed();
9762
9764 }
9765
9767 {
9768 super.OnEnergyAdded();
9769
9771 }
9772
9773
9775 {
9776 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9777 {
9779 {
9780 float energy_0to1 = GetCompEM().GetEnergy0To1();
9782 }
9783 }
9784 }
9785
9786
9788 {
9789 return ConfigGetFloat("heatIsolation");
9790 }
9791
9793 {
9795 }
9796
9798 {
9799 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9800 if (
g_Game.ConfigIsExisting(paramPath))
9801 return g_Game.ConfigGetFloat(paramPath);
9802
9803 return 0.0;
9804 }
9805
9807 {
9808 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9809 if (
g_Game.ConfigIsExisting(paramPath))
9810 return g_Game.ConfigGetFloat(paramPath);
9811
9812 return 0.0;
9813 }
9814
9815 override void SetWet(
float value,
bool allow_client =
false)
9816 {
9817 if (!IsServerCheck(allow_client))
9818 return;
9819
9822
9824
9825 m_VarWet = Math.Clamp(value, min, max);
9826
9828 {
9831 }
9832 }
9833
9834 override void AddWet(
float value)
9835 {
9837 }
9838
9840 {
9842 }
9843
9845 {
9847 }
9848
9850 {
9852 }
9853
9855 {
9857 }
9858
9860 {
9862 }
9863
9865 {
9868 if (newLevel != oldLevel)
9869 {
9871 }
9872 }
9873
9875 {
9876 SetWeightDirty();
9877 }
9878
9880 {
9881 return GetWetLevelInternal(
m_VarWet);
9882 }
9883
9884
9885
9887 {
9889 }
9890
9892 {
9894 }
9895
9897 {
9899 }
9900
9902 {
9904 }
9905
9906
9907
9909 {
9910 if (ConfigIsExisting("itemModelLength"))
9911 {
9912 return ConfigGetFloat("itemModelLength");
9913 }
9914 return 0;
9915 }
9916
9918 {
9919 if (ConfigIsExisting("itemAttachOffset"))
9920 {
9921 return ConfigGetFloat("itemAttachOffset");
9922 }
9923 return 0;
9924 }
9925
9926 override void SetCleanness(
int value,
bool allow_client =
false)
9927 {
9928 if (!IsServerCheck(allow_client))
9929 return;
9930
9932
9934
9937 }
9938
9940 {
9942 }
9943
9945 {
9946 return true;
9947 }
9948
9949
9950
9951
9953 {
9955 }
9956
9958 {
9960 }
9961
9962
9963
9964
9965 override void SetColor(
int r,
int g,
int b,
int a)
9966 {
9972 }
9974 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9975 {
9980 }
9981
9983 {
9985 }
9986
9989 {
9990 int r,g,b,a;
9992 r = r/255;
9993 g = g/255;
9994 b = b/255;
9995 a = a/255;
9996 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9997 }
9998
9999
10000
10001 override void SetLiquidType(
int value,
bool allow_client =
false)
10002 {
10003 if (!IsServerCheck(allow_client))
10004 return;
10005
10010 }
10011
10013 {
10014 return ConfigGetInt("varLiquidTypeInit");
10015 }
10016
10018 {
10020 }
10021
10023 {
10025 SetFrozen(false);
10026 }
10027
10030 {
10031 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10032 }
10033
10034
10037 {
10038 PlayerBase nplayer;
10039 if (PlayerBase.CastTo(nplayer, player))
10040 {
10042 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10043 }
10044 }
10045
10046
10049 {
10050 PlayerBase nplayer;
10051 if (PlayerBase.CastTo(nplayer,player))
10052 {
10053 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10054 }
10055
10056 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10057
10058 if (HasEnergyManager())
10059 {
10060 GetCompEM().UpdatePlugState();
10061 }
10062 }
10063
10064
10066 {
10067 super.OnPlacementStarted(player);
10068
10070 }
10071
10072 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10073 {
10075 {
10076 m_AdminLog.OnPlacementComplete(player,
this);
10077 }
10078
10079 super.OnPlacementComplete(player, position, orientation);
10080 }
10081
10082
10083
10084
10085
10087 {
10089 {
10090 return true;
10091 }
10092 else
10093 {
10094 return false;
10095 }
10096 }
10097
10098
10100 {
10102 {
10104 }
10105 }
10106
10107
10109 {
10111 }
10112
10114 {
10116 }
10117
10118 override void InsertAgent(
int agent,
float count = 1)
10119 {
10120 if (count < 1)
10121 return;
10122
10124 }
10125
10128 {
10130 }
10131
10132
10134 {
10136 }
10137
10138
10139
10140
10141
10142
10143
10144
10145
10146
10147
10148
10149
10150
10151
10152
10153
10154
10155
10156
10157
10158
10159
10160
10161
10162
10163
10164
10165
10166
10167
10168
10169
10170
10171
10172
10173
10174
10175
10176
10177
10178
10180 {
10182 return false;
10183 return true;
10184 }
10185
10187 {
10188
10190 }
10191
10192
10195 {
10196 super.CheckForRoofLimited(timeTresholdMS);
10197
10198 float time =
g_Game.GetTime();
10199 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10200 {
10201 m_PreviousRoofTestTime = time;
10202 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10203 }
10204 }
10205
10206
10208 {
10210 {
10211 return 0;
10212 }
10213
10214 if (GetInventory().GetAttachmentSlotsCount() != 0)
10215 {
10216 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10217 if (filter)
10218 return filter.GetProtectionLevel(type, false, system);
10219 else
10220 return 0;
10221 }
10222
10223 string subclassPath, entryName;
10224
10225 switch (type)
10226 {
10228 entryName = "biological";
10229 break;
10231 entryName = "chemical";
10232 break;
10233 default:
10234 entryName = "biological";
10235 break;
10236 }
10237
10238 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10239
10240 return g_Game.ConfigGetFloat(subclassPath + entryName);
10241 }
10242
10243
10244
10247 {
10248 if (!IsMagazine())
10250
10252 }
10253
10254
10255
10256
10257
10262 {
10263 return true;
10264 }
10265
10267 {
10269 }
10270
10271
10272
10273
10274
10276 {
10277 if (parent)
10278 {
10279 if (parent.IsInherited(DayZInfected))
10280 return true;
10281
10282 if (!parent.IsRuined())
10283 return true;
10284 }
10285
10286 return true;
10287 }
10288
10290 {
10291 if (!super.CanPutAsAttachment(parent))
10292 {
10293 return false;
10294 }
10295
10296 if (!IsRuined() && !parent.IsRuined())
10297 {
10298 return true;
10299 }
10300
10301 return false;
10302 }
10303
10305 {
10306
10307
10308
10309
10310 return super.CanReceiveItemIntoCargo(item);
10311 }
10312
10314 {
10315
10316
10317
10318
10319 GameInventory attachmentInv = attachment.GetInventory();
10321 {
10322 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10323 return false;
10324 }
10325
10326 InventoryLocation loc = new InventoryLocation();
10327 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10328 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10329 return false;
10330
10331 return super.CanReceiveAttachment(attachment, slotId);
10332 }
10333
10335 {
10336 if (!super.CanReleaseAttachment(attachment))
10337 return false;
10338
10339 return GetInventory().AreChildrenAccessible();
10340 }
10341
10342
10343
10344
10345
10346
10347
10348
10349
10350
10351
10352
10353
10354
10355
10356
10357
10358
10359
10360
10361
10363 {
10364 int id = muzzle_owner.GetMuzzleID();
10365 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10366
10367 if (WPOF_array)
10368 {
10369 for (int i = 0; i < WPOF_array.Count(); i++)
10370 {
10371 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10372
10373 if (WPOF)
10374 {
10375 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10376 }
10377 }
10378 }
10379 }
10380
10381
10383 {
10384 int id = muzzle_owner.GetMuzzleID();
10386
10387 if (WPOBE_array)
10388 {
10389 for (int i = 0; i < WPOBE_array.Count(); i++)
10390 {
10391 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10392
10393 if (WPOBE)
10394 {
10395 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10396 }
10397 }
10398 }
10399 }
10400
10401
10403 {
10404 int id = muzzle_owner.GetMuzzleID();
10405 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10406
10407 if (WPOOH_array)
10408 {
10409 for (int i = 0; i < WPOOH_array.Count(); i++)
10410 {
10411 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10412
10413 if (WPOOH)
10414 {
10415 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10416 }
10417 }
10418 }
10419 }
10420
10421
10423 {
10424 int id = muzzle_owner.GetMuzzleID();
10425 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10426
10427 if (WPOOH_array)
10428 {
10429 for (int i = 0; i < WPOOH_array.Count(); i++)
10430 {
10431 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10432
10433 if (WPOOH)
10434 {
10435 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10436 }
10437 }
10438 }
10439 }
10440
10441
10443 {
10444 int id = muzzle_owner.GetMuzzleID();
10445 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10446
10447 if (WPOOH_array)
10448 {
10449 for (int i = 0; i < WPOOH_array.Count(); i++)
10450 {
10451 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10452
10453 if (WPOOH)
10454 {
10455 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10456 }
10457 }
10458 }
10459 }
10460
10461
10462
10464 {
10466 {
10467 return true;
10468 }
10469
10470 return false;
10471 }
10472
10474 {
10476 {
10477 return true;
10478 }
10479
10480 return false;
10481 }
10482
10484 {
10486 {
10487 return true;
10488 }
10489
10490 return false;
10491 }
10492
10494 {
10495 return false;
10496 }
10497
10500 {
10501 return UATimeSpent.DEFAULT_DEPLOY;
10502 }
10503
10504
10505
10506
10508 {
10510 SetSynchDirty();
10511 }
10512
10514 {
10516 }
10517
10518
10520 {
10521 return false;
10522 }
10523
10526 {
10527 string att_type = "None";
10528
10529 if (ConfigIsExisting("soundAttType"))
10530 {
10531 att_type = ConfigGetString("soundAttType");
10532 }
10533
10535 }
10536
10538 {
10540 }
10541
10542
10543
10544
10545
10551
10553 {
10556
10558 }
10559
10560
10562 {
10564 return;
10565
10567
10570
10573
10574 SoundParameters params = new SoundParameters();
10578 }
10579
10580
10582 {
10584 {
10587
10588 SetSynchDirty();
10589
10592 }
10593 }
10594
10596 {
10598 }
10599
10600
10602 {
10604 return;
10605
10607 SetSynchDirty();
10608
10611 }
10612
10614 {
10617 }
10618
10620 {
10622 }
10623
10624 void OnApply(PlayerBase player);
10625
10627 {
10628 return 1.0;
10629 };
10630
10632 {
10634 }
10635
10637 {
10639 }
10640
10642
10644 {
10645 SetDynamicPhysicsLifeTime(0.01);
10647 }
10648
10650 {
10651 array<string> zone_names = new array<string>;
10652 GetDamageZones(zone_names);
10653 for (int i = 0; i < zone_names.Count(); i++)
10654 {
10655 SetHealthMax(zone_names.Get(i),"Health");
10656 }
10657 SetHealthMax("","Health");
10658 }
10659
10662 {
10663 float global_health = GetHealth01("","Health");
10664 array<string> zones = new array<string>;
10665 GetDamageZones(zones);
10666
10667 for (int i = 0; i < zones.Count(); i++)
10668 {
10669 SetHealth01(zones.Get(i),"Health",global_health);
10670 }
10671 }
10672
10675 {
10676 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10677 }
10678
10680 {
10681 if (!hasRootAsPlayer)
10682 {
10683 if (refParentIB)
10684 {
10685
10686 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10687 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10688
10689 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10690 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10691
10694 }
10695 else
10696 {
10697
10700 }
10701 }
10702 }
10703
10705 {
10707 {
10708 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10709 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10710 {
10711 float heatPermCoef = 1.0;
10713 while (ent)
10714 {
10715 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10716 ent = ent.GetHierarchyParent();
10717 }
10718
10719 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10720 }
10721 }
10722 }
10723
10725 {
10726
10727 EntityAI parent = GetHierarchyParent();
10728 if (!parent)
10729 {
10730 hasParent = false;
10731 hasRootAsPlayer = false;
10732 }
10733 else
10734 {
10735 hasParent = true;
10736 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10737 refParentIB =
ItemBase.Cast(parent);
10738 }
10739 }
10740
10741 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10742 {
10743
10744 }
10745
10747 {
10748
10749 return false;
10750 }
10751
10753 {
10754
10755
10756 return false;
10757 }
10758
10760 {
10761
10762 return false;
10763 }
10764
10767 {
10768 return !GetIsFrozen() &&
IsOpen();
10769 }
10770
10772 {
10773 bool hasParent = false, hasRootAsPlayer = false;
10775
10776 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10777 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10778
10779 if (wwtu || foodDecay)
10780 {
10784
10785 if (processWetness || processTemperature || processDecay)
10786 {
10788
10789 if (processWetness)
10790 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10791
10792 if (processTemperature)
10794
10795 if (processDecay)
10796 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10797 }
10798 }
10799 }
10800
10803 {
10805 }
10806
10808 {
10811
10812 return super.GetTemperatureFreezeThreshold();
10813 }
10814
10816 {
10819
10820 return super.GetTemperatureThawThreshold();
10821 }
10822
10824 {
10827
10828 return super.GetItemOverheatThreshold();
10829 }
10830
10832 {
10834 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10835
10836 return super.GetTemperatureFreezeTime();
10837 }
10838
10840 {
10842 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10843
10844 return super.GetTemperatureThawTime();
10845 }
10846
10851
10853 {
10854 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10855 }
10856
10858 {
10859 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10860 }
10861
10864 {
10866 }
10867
10869 {
10871 }
10872
10874 {
10876 }
10877
10880 {
10881 return null;
10882 }
10883
10886 {
10887 return false;
10888 }
10889
10891 {
10893 {
10896 if (!trg)
10897 {
10899 explosive = this;
10900 }
10901
10902 explosive.PairRemote(trg);
10904
10905 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10906 trg.SetPersistentPairID(persistentID);
10907 explosive.SetPersistentPairID(persistentID);
10908
10909 return true;
10910 }
10911 return false;
10912 }
10913
10916 {
10917 float ret = 1.0;
10920 ret *= GetHealth01();
10921
10922 return ret;
10923 }
10924
10925 #ifdef DEVELOPER
10926 override void SetDebugItem()
10927 {
10928 super.SetDebugItem();
10929 _itemBase = this;
10930 }
10931
10933 {
10934 string text = super.GetDebugText();
10935
10937 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10938
10939 return text;
10940 }
10941 #endif
10942
10944 {
10945 return true;
10946 }
10947
10949
10951
10953 {
10956 }
10957
10958
10966
10982
10983 [
Obsolete(
"Use ItemSoundHandler instead")]
10986 {
10987 if (!
g_Game.IsDedicatedServer())
10988 {
10989 if (ConfigIsExisting("attachSoundSet"))
10990 {
10991 string cfg_path = "";
10992 string soundset = "";
10993 string type_name =
GetType();
10994
10997 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10998 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10999
11000 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11001 {
11002 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11003 {
11004 if (cfg_slot_array[i] == slot_type)
11005 {
11006 soundset = cfg_soundset_array[i];
11007 break;
11008 }
11009 }
11010 }
11011
11012 if (soundset != "")
11013 {
11014 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11016 }
11017 }
11018 }
11019 }
11020
11022}
11023
11025{
11027 if (entity)
11028 {
11029 bool is_item = entity.IsInherited(
ItemBase);
11030 if (is_item && full_quantity)
11031 {
11034 }
11035 }
11036 else
11037 {
11039 return NULL;
11040 }
11041 return entity;
11042}
11043
11045{
11046 if (item)
11047 {
11048 if (health > 0)
11049 item.SetHealth("", "", health);
11050
11051 if (item.CanHaveTemperature())
11052 {
11054 if (item.CanFreeze())
11055 item.SetFrozen(false);
11056 }
11057
11058 if (item.HasEnergyManager())
11059 {
11060 if (quantity >= 0)
11061 {
11062 item.GetCompEM().SetEnergy0To1(quantity);
11063 }
11064 else
11065 {
11067 }
11068 }
11069 else if (item.IsMagazine())
11070 {
11071 Magazine mag = Magazine.Cast(item);
11072 if (quantity >= 0)
11073 {
11074 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11075 }
11076 else
11077 {
11079 }
11080
11081 }
11082 else
11083 {
11084 if (quantity >= 0)
11085 {
11086 item.SetQuantityNormalized(quantity, false);
11087 }
11088 else
11089 {
11091 }
11092
11093 }
11094 }
11095}
11096
11097#ifdef DEVELOPER
11099#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
bool SetAttachSoundEvent()
bool SetDetachSoundEvent()
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 IsPrepareToDelete()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
proto GizmoApi GetGizmoApi()
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
void StartItemSoundServer(int id, int slotId)
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)
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()
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)
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)
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 EntityAI GetAttachmentFromIndex(int index)
proto native bool GetCurrentInventoryLocation(out notnull InventoryLocation loc)
returns information about current item location
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
proto native int AttachmentCount()
Returns count of attachments attached to this item.
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
proto void SelectObject(Object object)
proto void SelectPhysics(Physics physics)
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 bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
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
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
void Obsolete(string msg="")
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
vector GetPosition()
Get the world position of the Effect.
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.