5184{
5186 {
5187 return true;
5188 }
5189};
5190
5192{
5193
5194};
5195
5196
5197
5199{
5203
5205
5208
5209
5210
5211
5212
5221
5227
5232
5237
5258 protected bool m_IsResultOfSplit
5259
5261
5266
5267
5268
5270
5274
5275
5276
5278
5281
5282
5283
5289
5290
5298
5301
5302
5304
5305
5307
5308
5313
5314
5319
5321
5322
5324
5325
5327 {
5332
5333 if (!
g_Game.IsDedicatedServer())
5334 {
5336 {
5338
5340 {
5342 }
5343 }
5344
5347 }
5348
5349 m_OldLocation = null;
5350
5352 {
5354 }
5355
5356 if (ConfigIsExisting("headSelectionsToHide"))
5357 {
5360 }
5361
5363 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5364 {
5366 }
5367
5369
5370 m_IsResultOfSplit = false;
5371
5373 }
5374
5376 {
5377 super.InitItemVariables();
5378
5384 m_Count = ConfigGetInt(
"count");
5385
5388
5393
5396
5401
5413
5417
5418
5421 if (ConfigIsExisting("canBeSplit"))
5422 {
5425 }
5426
5428 if (ConfigIsExisting("itemBehaviour"))
5430
5431
5434 RegisterNetSyncVariableInt("m_VarLiquidType");
5435 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5436
5437 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5438 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5439 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5440
5441 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5442 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5443 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5444 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5445
5446 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5447 RegisterNetSyncVariableBool("m_IsTakeable");
5448 RegisterNetSyncVariableBool("m_IsHologram");
5449
5452 {
5455 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
5456 }
5457
5459
5461 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5463
5465 }
5466
5468 {
5470 }
5471
5473 {
5476 {
5481 }
5482 }
5483
5484 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5485 {
5487 {
5490 }
5491
5493 }
5494
5496 {
5502 }
5503
5505
5507 {
5509
5510 if (!action)
5511 {
5512 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5513 return;
5514 }
5515
5517 if (!ai)
5518 {
5520 return;
5521 }
5522
5524 if (!action_array)
5525 {
5526 action_array = new array<ActionBase_Basic>;
5528 }
5529 if (LogManager.IsActionLogEnable())
5530 {
5531 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5532 }
5533
5534 if (action_array.Find(action) != -1)
5535 {
5536 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5537 }
5538 else
5539 {
5540 action_array.Insert(action);
5541 }
5542 }
5543
5545 {
5546 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
5547 ActionBase action = player.GetActionManager().GetAction(actionName);
5550
5551 if (action_array)
5552 {
5553 action_array.RemoveItem(action);
5554 }
5555 }
5556
5557
5558
5560 {
5561 ActionOverrideData overrideData = new ActionOverrideData();
5565
5567 if (!actionMap)
5568 {
5571 }
5572
5573 actionMap.Insert(this.
Type(), overrideData);
5574
5575 }
5576
5578
5580
5581
5583 {
5586
5589
5590 string config_to_search = "CfgVehicles";
5591 string muzzle_owner_config;
5592
5594 {
5595 if (IsInherited(Weapon))
5596 config_to_search = "CfgWeapons";
5597
5598 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5599
5600 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5601
5602 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
5603
5604 if (config_OnFire_subclass_count > 0)
5605 {
5606 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5607
5608 for (int i = 0; i < config_OnFire_subclass_count; i++)
5609 {
5610 string particle_class = "";
5611 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
5612 string config_OnFire_entry = config_OnFire_class + particle_class;
5613 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5614 WPOF_array.Insert(WPOF);
5615 }
5616
5617
5619 }
5620 }
5621
5623 {
5624 config_to_search = "CfgWeapons";
5625 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5626
5627 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5628
5629 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
5630
5631 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
5632 {
5633 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
5634
5635 for (i = 0; i < config_OnBulletCasingEject_count; i++)
5636 {
5637 string particle_class2 = "";
5638 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
5639 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
5640 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
5641 WPOBE_array.Insert(WPOBE);
5642 }
5643
5644
5646 }
5647 }
5648 }
5649
5650
5652 {
5655
5657 {
5658 string config_to_search = "CfgVehicles";
5659
5660 if (IsInherited(Weapon))
5661 config_to_search = "CfgWeapons";
5662
5663 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5664 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
5665
5666 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
5667 {
5668
5670
5672 {
5674 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
5676 return;
5677 }
5678
5681
5682
5683
5684 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
5685 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
5686
5687 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
5688 {
5689 string particle_class = "";
5690 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
5691 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
5692 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
5693
5694 if (entry_type == CT_CLASS)
5695 {
5696 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
5697 WPOOH_array.Insert(WPOF);
5698 }
5699 }
5700
5701
5703 }
5704 }
5705 }
5706
5708 {
5710 }
5711
5713 {
5715 {
5717
5720
5723
5724 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5725 }
5726 }
5727
5729 {
5731 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5732
5734 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5735
5737 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5738
5740 {
5742 }
5743 }
5744
5746 {
5748 }
5749
5751 {
5754 else
5756
5758 {
5761 }
5762 else
5763 {
5766
5769 }
5770
5772 }
5773
5775 {
5777 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5778 }
5779
5781 {
5783 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5785 }
5786
5788 {
5790 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5791 }
5792
5794 {
5797
5798 OverheatingParticle OP = new OverheatingParticle();
5803
5805 }
5806
5808 {
5811
5812 return -1;
5813 }
5814
5816 {
5818 {
5821
5822 for (int i = count; i > 0; --i)
5823 {
5824 int id = i - 1;
5827
5830
5831 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
5832 {
5833 if (p)
5834 {
5837 }
5838 }
5839 }
5840 }
5841 }
5842
5844 {
5846 {
5848 {
5849 int id = i - 1;
5851
5852 if (OP)
5853 {
5855
5856 if (p)
5857 {
5859 }
5860
5861 delete OP;
5862 }
5863 }
5864
5867 }
5868 }
5869
5872 {
5873 return 0.0;
5874 }
5875
5876
5878 {
5879 return 250;
5880 }
5881
5883 {
5884 return 0;
5885 }
5886
5889 {
5891 return true;
5892
5893 return false;
5894 }
5895
5898 {
5901
5903 {
5905 }
5906 else
5907 {
5908
5910 }
5911
5913 }
5914
5921 {
5922 return -1;
5923 }
5924
5925
5926
5927
5929 {
5931 {
5932 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
5933 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
5934
5935 if (r_index >= 0)
5936 {
5937 InventoryLocation r_il = new InventoryLocation;
5938 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
5939
5940 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
5943 {
5944 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
5945 }
5947 {
5948 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
5949 }
5950
5951 }
5952
5953 player.GetHumanInventory().ClearUserReservedLocation(this);
5954 }
5955
5958 }
5959
5960
5961
5962
5964 {
5965 return ItemBase.m_DebugActionsMask;
5966 }
5967
5969 {
5970 return ItemBase.m_DebugActionsMask & mask;
5971 }
5972
5974 {
5975 ItemBase.m_DebugActionsMask = mask;
5976 }
5977
5979 {
5980 ItemBase.m_DebugActionsMask |= mask;
5981 }
5982
5984 {
5985 ItemBase.m_DebugActionsMask &= ~mask;
5986 }
5987
5989 {
5991 {
5993 }
5994 else
5995 {
5997 }
5998 }
5999
6000
6002 {
6003 if (GetEconomyProfile())
6004 {
6005 float q_max = GetEconomyProfile().GetQuantityMax();
6006 if (q_max > 0)
6007 {
6008 float q_min = GetEconomyProfile().GetQuantityMin();
6009 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6010
6012 {
6013 ComponentEnergyManager comp = GetCompEM();
6015 {
6017 }
6018 }
6020 {
6022
6023 }
6024
6025 }
6026 }
6027 }
6028
6031 {
6032 EntityAI parent = GetHierarchyParent();
6033
6034 if (parent)
6035 {
6036 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6037 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6038 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6039 }
6040 }
6041
6044 {
6045 EntityAI parent = GetHierarchyParent();
6046
6047 if (parent)
6048 {
6049 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6050 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6051 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6052 }
6053 }
6054
6056 {
6057
6058
6059
6060
6062
6064 {
6065 if (ScriptInputUserData.CanStoreInputUserData())
6066 {
6067 ScriptInputUserData ctx = new ScriptInputUserData;
6073 ctx.
Write(use_stack_max);
6076
6078 {
6079 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6080 }
6081 }
6082 }
6083 else if (!
g_Game.IsMultiplayer())
6084 {
6086 }
6087 }
6088
6090 {
6092 }
6093
6095 {
6097 }
6098
6100 {
6102 }
6103
6105 {
6106
6107 return false;
6108 }
6109
6111 {
6112 return false;
6113 }
6114
6118 {
6119 return false;
6120 }
6121
6123 {
6124 return "";
6125 }
6126
6128
6130 {
6131 return false;
6132 }
6133
6135 {
6136 return true;
6137 }
6138
6139
6140
6142 {
6143 return true;
6144 }
6145
6147 {
6148 return true;
6149 }
6150
6152 {
6153 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6155 }
6156
6158 {
6160 }
6161
6163 {
6165 if (!is_being_placed)
6167 SetSynchDirty();
6168 }
6169
6170
6172
6174 {
6176 }
6177
6179 {
6181 }
6182
6184 {
6185 return 1;
6186 }
6187
6189 {
6190 return false;
6191 }
6192
6194 {
6196 SetSynchDirty();
6197 }
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6234 {
6235 super.OnMovedInsideCargo(container);
6236
6237 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6238 }
6239
6240 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6241 {
6242 super.EEItemLocationChanged(oldLoc, newLoc);
6243
6244 PlayerBase newPlayer = null;
6245 PlayerBase oldPlayer = null;
6246
6247 if (newLoc.GetParent())
6248 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6249
6250 if (oldLoc.GetParent())
6251 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6252
6254 {
6255 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6256
6257 if (rIndex >= 0)
6258 {
6259 InventoryLocation rIl = new InventoryLocation;
6260 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6261
6262 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6265 {
6266 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6267 }
6269 {
6271 }
6272
6273 }
6274 }
6275
6277 {
6278 if (newPlayer)
6279 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6280
6281 if (newPlayer == oldPlayer)
6282 {
6283 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6284 {
6286 {
6287 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6288 {
6289 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6290 }
6291 }
6292 else
6293 {
6294 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6295 }
6296 }
6297
6298 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6299 {
6300 int type = oldLoc.GetType();
6302 {
6303 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6304 }
6306 {
6307 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6308 }
6309 }
6310 if (!m_OldLocation)
6311 {
6312 m_OldLocation = new InventoryLocation;
6313 }
6314 m_OldLocation.Copy(oldLoc);
6315 }
6316 else
6317 {
6318 if (m_OldLocation)
6319 {
6320 m_OldLocation.Reset();
6321 }
6322 }
6323
6324 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6325 }
6326 else
6327 {
6328 if (newPlayer)
6329 {
6330 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6331 if (resIndex >= 0)
6332 {
6333 InventoryLocation il = new InventoryLocation;
6334 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6336 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6339 {
6340 il.
GetParent().GetOnReleaseLock().Invoke(it);
6341 }
6343 {
6345 }
6346
6347 }
6348 }
6350 {
6351
6353 }
6354
6355 if (m_OldLocation)
6356 {
6357 m_OldLocation.Reset();
6358 }
6359 }
6360
6362 {
6363 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6364 }
6365
6367 {
6368 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6369 }
6370 }
6371
6372 override void EOnContact(IEntity other, Contact extra)
6373 {
6375 {
6376 int liquidType = -1;
6378 if (impactSpeed > 0.0)
6379 {
6381 #ifndef SERVER
6383 #else
6385 SetSynchDirty();
6386 #endif
6388 }
6389 }
6390
6391 #ifdef SERVER
6392 if (GetCompEM() && GetCompEM().IsPlugged())
6393 {
6394 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6395 GetCompEM().UnplugThis();
6396 }
6397 #endif
6398 }
6399
6401
6403 {
6405 }
6406
6408 {
6409
6410 }
6411
6413 {
6414 super.OnItemLocationChanged(old_owner, new_owner);
6415
6416 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6417 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6418
6419 if (!relatedPlayer && playerNew)
6420 relatedPlayer = playerNew;
6421
6422 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6423 {
6425 if (actionMgr)
6426 {
6427 ActionBase currentAction = actionMgr.GetRunningAction();
6428 if (currentAction)
6430 }
6431 }
6432
6433 Man ownerPlayerOld = null;
6434 Man ownerPlayerNew = null;
6435
6436 if (old_owner)
6437 {
6438 if (old_owner.
IsMan())
6439 {
6440 ownerPlayerOld = Man.Cast(old_owner);
6441 }
6442 else
6443 {
6444 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6445 }
6446 }
6447 else
6448 {
6450 {
6452
6453 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6454 {
6455 GetCompEM().UnplugThis();
6456 }
6457 }
6458 }
6459
6460 if (new_owner)
6461 {
6462 if (new_owner.
IsMan())
6463 {
6464 ownerPlayerNew = Man.Cast(new_owner);
6465 }
6466 else
6467 {
6468 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6469 }
6470 }
6471
6472 if (ownerPlayerOld != ownerPlayerNew)
6473 {
6474 if (ownerPlayerOld)
6475 {
6476 array<EntityAI> subItemsExit = new array<EntityAI>;
6478 for (int i = 0; i < subItemsExit.Count(); i++)
6479 {
6482 }
6483 }
6484
6485 if (ownerPlayerNew)
6486 {
6487 array<EntityAI> subItemsEnter = new array<EntityAI>;
6489 for (int j = 0; j < subItemsEnter.Count(); j++)
6490 {
6493 }
6494 }
6495 }
6496 else if (ownerPlayerNew != null)
6497 {
6498 PlayerBase nplayer;
6499 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6500 {
6501 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6503 for (int k = 0; k < subItemsUpdate.Count(); k++)
6504 {
6506 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6507 }
6508 }
6509 }
6510
6511 if (old_owner)
6512 old_owner.OnChildItemRemoved(this);
6513 if (new_owner)
6514 new_owner.OnChildItemReceived(this);
6515 }
6516
6517
6519 {
6520 super.EEDelete(parent);
6521 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6522 if (player)
6523 {
6525
6526 if (player.IsAlive())
6527 {
6528 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6529 if (r_index >= 0)
6530 {
6531 InventoryLocation r_il = new InventoryLocation;
6532 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6533
6534 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6537 {
6538 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6539 }
6541 {
6542 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6543 }
6544
6545 }
6546
6547 player.RemoveQuickBarEntityShortcut(this);
6548 }
6549 }
6550 }
6551
6553 {
6554 super.EEKilled(killer);
6555
6558 {
6559 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6560 {
6561 if (IsMagazine())
6562 {
6563 if (Magazine.Cast(this).GetAmmoCount() > 0)
6564 {
6566 }
6567 }
6568 else
6569 {
6571 }
6572 }
6573 }
6574 }
6575
6577 {
6578 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6579
6580 super.OnWasAttached(parent, slot_id);
6581
6584
6587 }
6588
6590 {
6591 super.OnWasDetached(parent, slot_id);
6592
6595
6598 }
6599
6601 {
6602 int idx;
6605
6606 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6607 if (inventory_slots.Count() < 1)
6608 {
6609 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6610 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6611 }
6612 else
6613 {
6614 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6615 }
6616
6617 idx = inventory_slots.Find(slot);
6618 if (idx < 0)
6619 return "";
6620
6621 return attach_types.Get(idx);
6622 }
6623
6625 {
6626 int idx = -1;
6627 string slot;
6628
6631
6632 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6633 if (inventory_slots.Count() < 1)
6634 {
6635 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6636 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6637 }
6638 else
6639 {
6640 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6641 if (detach_types.Count() < 1)
6642 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6643 }
6644
6645 for (int i = 0; i < inventory_slots.Count(); i++)
6646 {
6647 slot = inventory_slots.Get(i);
6648 }
6649
6650 if (slot != "")
6651 {
6652 if (detach_types.Count() == 1)
6653 idx = 0;
6654 else
6655 idx = inventory_slots.Find(slot);
6656 }
6657 if (idx < 0)
6658 return "";
6659
6660 return detach_types.Get(idx);
6661 }
6662
6664 {
6665
6667
6668
6669 float min_time = 1;
6670 float max_time = 3;
6671 float delay = Math.RandomFloat(min_time, max_time);
6672
6673 explode_timer.Run(delay, this, "DoAmmoExplosion");
6674 }
6675
6677 {
6678 Magazine magazine = Magazine.Cast(this);
6679 int pop_sounds_count = 6;
6680 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
6681
6682
6683 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
6684 string sound_name = pop_sounds[ sound_idx ];
6685 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
6686
6687
6688 magazine.ServerAddAmmoCount(-1);
6689
6690
6691 float min_temp_to_explode = 100;
6692
6693 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
6694 {
6696 }
6697 }
6698
6699
6700 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
6701 {
6702 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
6703
6704 const int CHANCE_DAMAGE_CARGO = 4;
6705 const int CHANCE_DAMAGE_ATTACHMENT = 1;
6706 const int CHANCE_DAMAGE_NOTHING = 2;
6707
6709 {
6710 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
6711 int chances;
6712 int rnd;
6713
6714 if (GetInventory().GetCargo())
6715 {
6716 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6717 rnd = Math.RandomInt(0,chances);
6718
6719 if (rnd < CHANCE_DAMAGE_CARGO)
6720 {
6722 }
6723 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
6724 {
6726 }
6727 }
6728 else
6729 {
6730 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6731 rnd = Math.RandomInt(0,chances);
6732
6733 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
6734 {
6736 }
6737 }
6738 }
6739 }
6740
6742 {
6743 CargoBase cargo = GetInventory().GetCargo();
6744 if (cargo)
6745 {
6747 if (item_count > 0)
6748 {
6749 int random_pick = Math.RandomInt(0, item_count);
6751 if (!item.IsExplosive())
6752 {
6753 item.AddHealth("","",damage);
6754 return true;
6755 }
6756 }
6757 }
6758 return false;
6759 }
6760
6762 {
6763 GameInventory inventory = GetInventory();
6765 if (attachment_count > 0)
6766 {
6767 int random_pick = Math.RandomInt(0, attachment_count);
6769 if (!attachment.IsExplosive())
6770 {
6771 attachment.AddHealth("","",damage);
6772 return true;
6773 }
6774 }
6775 return false;
6776 }
6777
6779 {
6781 }
6782
6784 {
6786 return GetInventory().CanRemoveEntity();
6787
6788 return false;
6789 }
6790
6792 {
6793
6795 return false;
6796
6797
6799 return false;
6800
6801
6802
6804 if (delta == 0)
6805 return false;
6806
6807
6808 return true;
6809 }
6810
6812 {
6814 {
6815 if (ScriptInputUserData.CanStoreInputUserData())
6816 {
6817 ScriptInputUserData ctx = new ScriptInputUserData;
6822 ctx.
Write(destination_entity);
6826 }
6827 }
6828 else if (!
g_Game.IsMultiplayer())
6829 {
6831 }
6832 }
6833
6835 {
6836 float split_quantity_new;
6840 InventoryLocation loc = new InventoryLocation;
6841
6842 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6843 {
6845 split_quantity_new = stack_max;
6846 else
6848
6850 {
6851 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6852 if (new_item)
6853 {
6854 new_item.SetResultOfSplit(true);
6855 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6857 new_item.
SetQuantity(split_quantity_new,
false,
true);
6858 }
6859 }
6860 }
6861 else if (destination_entity && slot_id == -1)
6862 {
6863 if (quantity > stack_max)
6864 split_quantity_new = stack_max;
6865 else
6866 split_quantity_new = quantity;
6867
6869 {
6870 GameInventory destinationInventory = destination_entity.GetInventory();
6872 {
6875 }
6876
6877 if (new_item)
6878 {
6879 new_item.SetResultOfSplit(true);
6880 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6882 new_item.
SetQuantity(split_quantity_new,
false,
true);
6883 }
6884 }
6885 }
6886 else
6887 {
6888 if (stack_max != 0)
6889 {
6891 {
6893 }
6894
6895 if (split_quantity_new == 0)
6896 {
6897 if (!
g_Game.IsMultiplayer())
6898 player.PhysicalPredictiveDropItem(this);
6899 else
6900 player.ServerDropEntity(this);
6901 return;
6902 }
6903
6905 {
6907
6908 if (new_item)
6909 {
6910 new_item.SetResultOfSplit(true);
6911 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6914 new_item.PlaceOnSurface();
6915 }
6916 }
6917 }
6918 }
6919 }
6920
6922 {
6923 float split_quantity_new;
6927 InventoryLocation loc = new InventoryLocation;
6928
6929 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6930 {
6932 split_quantity_new = stack_max;
6933 else
6935
6937 {
6938 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6939 if (new_item)
6940 {
6941 new_item.SetResultOfSplit(true);
6942 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6944 new_item.
SetQuantity(split_quantity_new,
false,
true);
6945 }
6946 }
6947 }
6948 else if (destination_entity && slot_id == -1)
6949 {
6950 if (quantity > stack_max)
6951 split_quantity_new = stack_max;
6952 else
6953 split_quantity_new = quantity;
6954
6956 {
6957 GameInventory destinationInventory = destination_entity.GetInventory();
6959 {
6962 }
6963
6964 if (new_item)
6965 {
6966 new_item.SetResultOfSplit(true);
6967 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6969 new_item.
SetQuantity(split_quantity_new,
false,
true);
6970 }
6971 }
6972 }
6973 else
6974 {
6975 if (stack_max != 0)
6976 {
6978 {
6980 }
6981
6983 {
6985
6986 if (new_item)
6987 {
6988 new_item.SetResultOfSplit(true);
6989 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6992 new_item.PlaceOnSurface();
6993 }
6994 }
6995 }
6996 }
6997 }
6998
7000 {
7002 {
7003 if (ScriptInputUserData.CanStoreInputUserData())
7004 {
7005 ScriptInputUserData ctx = new ScriptInputUserData;
7010 dst.WriteToContext(ctx);
7012 }
7013 }
7014 else if (!
g_Game.IsMultiplayer())
7015 {
7017 }
7018 }
7019
7021 {
7023 {
7024 if (ScriptInputUserData.CanStoreInputUserData())
7025 {
7026 ScriptInputUserData ctx = new ScriptInputUserData;
7031 ctx.
Write(destination_entity);
7037 }
7038 }
7039 else if (!
g_Game.IsMultiplayer())
7040 {
7042 }
7043 }
7044
7046 {
7048 }
7049
7051 {
7053 float split_quantity_new;
7055 if (dst.IsValid())
7056 {
7057 int slot_id = dst.GetSlot();
7059
7060 if (quantity > stack_max)
7061 split_quantity_new = stack_max;
7062 else
7063 split_quantity_new = quantity;
7064
7066 {
7068
7069 if (new_item)
7070 {
7071 new_item.SetResultOfSplit(true);
7072 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7074 new_item.
SetQuantity(split_quantity_new,
false,
true);
7075 }
7076
7077 return new_item;
7078 }
7079 }
7080
7081 return null;
7082 }
7083
7085 {
7087 float split_quantity_new;
7089 if (destination_entity)
7090 {
7092 if (quantity > stackable)
7093 split_quantity_new = stackable;
7094 else
7095 split_quantity_new = quantity;
7096
7098 {
7099 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7100 if (new_item)
7101 {
7102 new_item.SetResultOfSplit(true);
7103 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7105 new_item.
SetQuantity(split_quantity_new,
false,
true);
7106 }
7107 }
7108 }
7109 }
7110
7112 {
7114 {
7115 if (ScriptInputUserData.CanStoreInputUserData())
7116 {
7117 ScriptInputUserData ctx = new ScriptInputUserData;
7122 ItemBase destination_entity =
this;
7123 ctx.
Write(destination_entity);
7127 }
7128 }
7129 else if (!
g_Game.IsMultiplayer())
7130 {
7132 }
7133 }
7134
7136 {
7138 float split_quantity_new;
7140 if (player)
7141 {
7143 if (quantity > stackable)
7144 split_quantity_new = stackable;
7145 else
7146 split_quantity_new = quantity;
7147
7149 {
7150 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7151 new_item =
ItemBase.Cast(in_hands);
7152 if (new_item)
7153 {
7154 new_item.SetResultOfSplit(true);
7155 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7157 new_item.SetQuantity(split_quantity_new, false, true);
7158 }
7159 }
7160 }
7161 }
7162
7164 {
7166 float split_quantity_new = Math.Floor(quantity * 0.5);
7167
7169 return;
7170
7172
7173 if (new_item)
7174 {
7175 if (new_item.GetQuantityMax() < split_quantity_new)
7176 {
7177 split_quantity_new = new_item.GetQuantityMax();
7178 }
7179
7180 new_item.SetResultOfSplit(true);
7181 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7182
7184 {
7187 }
7188 else
7189 {
7191 new_item.
SetQuantity(split_quantity_new,
false,
true);
7192 }
7193 }
7194 }
7195
7197 {
7199 float split_quantity_new = Math.Floor(quantity / 2);
7200
7202 return;
7203
7204 InventoryLocation invloc = new InventoryLocation;
7206
7208 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7209
7210 if (new_item)
7211 {
7212 if (new_item.GetQuantityMax() < split_quantity_new)
7213 {
7214 split_quantity_new = new_item.GetQuantityMax();
7215 }
7217 {
7220 }
7221 else if (split_quantity_new > 1)
7222 {
7224 new_item.
SetQuantity(split_quantity_new,
false,
true);
7225 }
7226 }
7227 }
7228
7231 {
7232 SetWeightDirty();
7234
7235 if (parent)
7236 parent.OnAttachmentQuantityChangedEx(this, delta);
7237
7239 {
7241 {
7243 }
7245 {
7246 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7248 }
7249 }
7250 }
7251
7254 {
7255
7256 }
7257
7260 {
7262 }
7263
7265 {
7266 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7267
7269 {
7270 if (newLevel == GameConstants.STATE_RUINED)
7271 {
7273 EntityAI parent = GetHierarchyParent();
7274 if (parent && parent.IsFireplace())
7275 {
7276 CargoBase cargo = GetInventory().GetCargo();
7277 if (cargo)
7278 {
7280 {
7282 }
7283 }
7284 }
7285 }
7286
7288 {
7289
7291 return;
7292 }
7293
7294 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7295 {
7297 }
7298 }
7299 }
7300
7301
7303 {
7304 super.OnRightClick();
7305
7307 {
7309 {
7310 if (ScriptInputUserData.CanStoreInputUserData())
7311 {
7312 EntityAI root = GetHierarchyRoot();
7313 Man playerOwner = GetHierarchyRootPlayer();
7314 InventoryLocation dst = new InventoryLocation;
7315
7316
7317 if (!playerOwner && root && root == this)
7318 {
7320 }
7321 else
7322 {
7323
7324 GetInventory().GetCurrentInventoryLocation(dst);
7326 {
7327 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7329 {
7331 }
7332 else
7333 {
7335
7336
7337 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7338 {
7340 }
7341 else
7342 {
7343 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7344 }
7345 }
7346 }
7347 }
7348
7349 ScriptInputUserData ctx = new ScriptInputUserData;
7357 }
7358 }
7359 else if (!
g_Game.IsMultiplayer())
7360 {
7362 }
7363 }
7364 }
7365
7367 {
7368 if (root)
7369 {
7370 vector m4[4];
7371 root.GetTransform(m4);
7372 dst.SetGround(this, m4);
7373 }
7374 else
7375 {
7376 GetInventory().GetCurrentInventoryLocation(dst);
7377 }
7378 }
7379
7380 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7381 {
7382
7383 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7384 return false;
7385
7386 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7387 return false;
7388
7389
7391 return false;
7392
7393
7394 Magazine mag = Magazine.Cast(this);
7395 if (mag)
7396 {
7397 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7398 return false;
7399
7400 if (stack_max_limit)
7401 {
7402 Magazine other_mag = Magazine.Cast(other_item);
7403 if (other_item)
7404 {
7405 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7406 return false;
7407 }
7408
7409 }
7410 }
7411 else
7412 {
7413
7415 return false;
7416
7418 return false;
7419 }
7420
7421 PlayerBase player = null;
7422 if (CastTo(player, GetHierarchyRootPlayer()))
7423 {
7424 if (player.GetInventory().HasAttachment(this))
7425 return false;
7426
7427 if (player.IsItemsToDelete())
7428 return false;
7429 }
7430
7431 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7432 return false;
7433
7434 int slotID;
7436 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7437 return false;
7438
7439 return true;
7440 }
7441
7443 {
7445 }
7446
7448 {
7449 return m_IsResultOfSplit;
7450 }
7451
7453 {
7454 m_IsResultOfSplit = value;
7455 }
7456
7458 {
7460 }
7461
7463 {
7464 float other_item_quantity = other_item.GetQuantity();
7465 float this_free_space;
7466
7468
7470
7471 if (other_item_quantity > this_free_space)
7472 {
7473 return this_free_space;
7474 }
7475 else
7476 {
7477 return other_item_quantity;
7478 }
7479 }
7480
7482 {
7484 }
7485
7487 {
7489 return;
7490
7491 if (!IsMagazine() && other_item)
7492 {
7494 if (quantity_used != 0)
7495 {
7496 float hp1 = GetHealth01("","");
7497 float hp2 = other_item.GetHealth01("","");
7498 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7499 hpResult = hpResult / (
GetQuantity() + quantity_used);
7500
7501 hpResult *= GetMaxHealth();
7502 Math.Round(hpResult);
7503 SetHealth("", "Health", hpResult);
7504
7506 other_item.AddQuantity(-quantity_used);
7507 }
7508 }
7510 }
7511
7513 {
7514 #ifdef SERVER
7515 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7516 GetHierarchyParent().IncreaseLifetimeUp();
7517 #endif
7518 };
7519
7521 {
7522 PlayerBase p = PlayerBase.Cast(player);
7523
7524 array<int> recipesIds = p.m_Recipes;
7525 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7526 if (moduleRecipesManager)
7527 {
7528 EntityAI itemInHands = player.GetEntityInHands();
7529 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7530 }
7531
7532 for (int i = 0;i < recipesIds.Count(); i++)
7533 {
7534 int key = recipesIds.Get(i);
7535 string recipeName = moduleRecipesManager.GetRecipeName(key);
7537 }
7538 }
7539
7540
7541 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7542 {
7543 super.GetDebugActions(outputList);
7544
7545
7551
7552
7557
7562
7563
7567
7568
7570 {
7574 }
7575
7578
7579
7583
7585
7586 InventoryLocation loc = new InventoryLocation();
7587 GetInventory().GetCurrentInventoryLocation(loc);
7589 {
7590 if (Gizmo_IsSupported())
7593 }
7594
7596 }
7597
7598
7599
7600
7602 {
7603 super.OnAction(action_id, player, ctx);
7604
7606 {
7607 switch (action_id)
7608 {
7612 return true;
7616 return true;
7617 }
7618 }
7619
7621 {
7622 switch (action_id)
7623 {
7625 Delete();
7626 return true;
7627 }
7628 }
7629
7630 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
7631 {
7632 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7633 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
7634 PlayerBase p = PlayerBase.Cast(player);
7635 if (
EActions.RECIPES_RANGE_START < 1000)
7636 {
7637 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7638 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7639 }
7640 }
7641 #ifndef SERVER
7642 else if (action_id ==
EActions.WATCH_PLAYER)
7643 {
7644 PluginDeveloper.SetDeveloperItemClientEx(player);
7645 }
7646 #endif
7648 {
7649 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7650 {
7651 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7652 OnDebugButtonPressServer(id + 1);
7653 }
7654
7655 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7656 {
7657 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
7659 }
7660
7661 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
7662 {
7663 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
7665 }
7666
7667 else if (action_id ==
EActions.ADD_QUANTITY)
7668 {
7669 if (IsMagazine())
7670 {
7671 Magazine mag = Magazine.Cast(this);
7672 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
7673 }
7674 else
7675 {
7677 }
7678
7679 if (m_EM)
7680 {
7681 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
7682 }
7683
7684 }
7685
7686 else if (action_id ==
EActions.REMOVE_QUANTITY)
7687 {
7688 if (IsMagazine())
7689 {
7690 Magazine mag2 = Magazine.Cast(this);
7691 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
7692 }
7693 else
7694 {
7696 }
7697 if (m_EM)
7698 {
7699 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
7700 }
7701
7702 }
7703
7704 else if (action_id ==
EActions.SET_QUANTITY_0)
7705 {
7707
7708 if (m_EM)
7709 {
7710 m_EM.SetEnergy(0);
7711 }
7712 }
7713
7714 else if (action_id ==
EActions.SET_MAX_QUANTITY)
7715 {
7717
7718 if (m_EM)
7719 {
7720 m_EM.SetEnergy(m_EM.GetEnergyMax());
7721 }
7722 }
7723
7724 else if (action_id ==
EActions.ADD_HEALTH)
7725 {
7726 AddHealth("","",GetMaxHealth("","Health")/5);
7727 }
7728 else if (action_id ==
EActions.REMOVE_HEALTH)
7729 {
7730 AddHealth("","",-GetMaxHealth("","Health")/5);
7731 }
7732 else if (action_id ==
EActions.DESTROY_HEALTH)
7733 {
7734 SetHealth01("","",0);
7735 }
7736 else if (action_id ==
EActions.WATCH_ITEM)
7737 {
7739 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
7740 #ifdef DEVELOPER
7741 SetDebugDeveloper_item(this);
7742 #endif
7743 }
7744
7745 else if (action_id ==
EActions.ADD_TEMPERATURE)
7746 {
7747 AddTemperature(20);
7748
7749 }
7750
7751 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
7752 {
7753 AddTemperature(-20);
7754
7755 }
7756
7757 else if (action_id ==
EActions.FLIP_FROZEN)
7758 {
7759 SetFrozen(!GetIsFrozen());
7760
7761 }
7762
7763 else if (action_id ==
EActions.ADD_WETNESS)
7764 {
7766
7767 }
7768
7769 else if (action_id ==
EActions.REMOVE_WETNESS)
7770 {
7772
7773 }
7774
7775 else if (action_id ==
EActions.LIQUIDTYPE_UP)
7776 {
7779
7780
7781 }
7782
7783 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
7784 {
7787 }
7788
7789 else if (action_id ==
EActions.MAKE_SPECIAL)
7790 {
7791 auto debugParams = DebugSpawnParams.WithPlayer(player);
7792 OnDebugSpawnEx(debugParams);
7793 }
7794
7795 }
7796
7797
7798 return false;
7799 }
7800
7801
7802
7803
7807
7810
7811
7812
7814 {
7815 return false;
7816 }
7817
7818
7820 {
7821 return true;
7822 }
7823
7824
7826 {
7827 return true;
7828 }
7829
7830
7831
7833 {
7834 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
7835 return g_Game.ConfigIsExisting(config_path);
7836 }
7837
7840 {
7841 return null;
7842 }
7843
7845 {
7846 return false;
7847 }
7848
7850 {
7851 return false;
7852 }
7853
7857
7858
7860 {
7861 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7862 return module_repairing.CanRepair(this, item_repair_kit);
7863 }
7864
7865
7866 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
7867 {
7868 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7869 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
7870 }
7871
7872
7874 {
7875
7876
7877
7878
7879
7880
7881
7882
7883 return 1;
7884 }
7885
7886
7887
7889 {
7891 }
7892
7893
7894
7896 {
7898 }
7899
7900
7909 {
7910 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7911
7912 if (player)
7913 {
7914 player.MessageStatus(text);
7915 }
7916 }
7917
7918
7927 {
7928 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7929
7930 if (player)
7931 {
7932 player.MessageAction(text);
7933 }
7934 }
7935
7936
7945 {
7946 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7947
7948 if (player)
7949 {
7950 player.MessageFriendly(text);
7951 }
7952 }
7953
7954
7963 {
7964 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7965
7966 if (player)
7967 {
7968 player.MessageImportant(text);
7969 }
7970 }
7971
7973 {
7974 return true;
7975 }
7976
7977
7978 override bool KindOf(
string tag)
7979 {
7980 bool found = false;
7981 string item_name = this.
GetType();
7983 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
7984
7985 int array_size = item_tag_array.Count();
7986 for (int i = 0; i < array_size; i++)
7987 {
7988 if (item_tag_array.Get(i) == tag)
7989 {
7990 found = true;
7991 break;
7992 }
7993 }
7994 return found;
7995 }
7996
7997
7999 {
8000
8001 super.OnRPC(sender, rpc_type,ctx);
8002
8003
8004 switch (rpc_type)
8005 {
8006 #ifndef SERVER
8007 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8008 Param2<bool, string> p = new Param2<bool, string>(false, "");
8009
8011 return;
8012
8013 bool play = p.param1;
8014 string soundSet = p.param2;
8015
8016 if (play)
8017 {
8019 {
8021 {
8023 }
8024 }
8025 else
8026 {
8028 }
8029 }
8030 else
8031 {
8033 }
8034
8035 break;
8036 #endif
8037
8038 }
8039
8041 {
8043 }
8044 }
8045
8046
8047
8048
8050 {
8051 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8052 return plugin.GetID(
name);
8053 }
8054
8056 {
8057 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8058 return plugin.GetName(id);
8059 }
8060
8063 {
8064
8065
8066 int varFlags;
8067 if (!ctx.
Read(varFlags))
8068 return;
8069
8070 if (varFlags & ItemVariableFlags.FLOAT)
8071 {
8073 }
8074 }
8075
8077 {
8078
8079 super.SerializeNumericalVars(floats_out);
8080
8081
8082
8084 {
8086 }
8087
8089 {
8091 }
8092
8094 {
8096 }
8097
8099 {
8104 }
8105
8107 {
8109 }
8110 }
8111
8113 {
8114
8115 super.DeSerializeNumericalVars(floats);
8116
8117
8118 int index = 0;
8119 int mask = Math.Round(floats.Get(index));
8120
8121 index++;
8122
8124 {
8126 {
8128 }
8129 else
8130 {
8131 float quantity = floats.Get(index);
8133 }
8134 index++;
8135 }
8136
8138 {
8139 float wet = floats.Get(index);
8141 index++;
8142 }
8143
8145 {
8146 int liquidtype = Math.Round(floats.Get(index));
8148 index++;
8149 }
8150
8152 {
8154 index++;
8156 index++;
8158 index++;
8160 index++;
8161 }
8162
8164 {
8165 int cleanness = Math.Round(floats.Get(index));
8167 index++;
8168 }
8169 }
8170
8172 {
8173 super.WriteVarsToCTX(ctx);
8174
8175
8177 {
8179 }
8180
8182 {
8184 }
8185
8187 {
8189 }
8190
8192 {
8193 int r,g,b,a;
8199 }
8200
8202 {
8204 }
8205 }
8206
8208 {
8209 if (!super.ReadVarsFromCTX(ctx,version))
8210 return false;
8211
8212 int intValue;
8213 float value;
8214
8215 if (version < 140)
8216 {
8217 if (!ctx.
Read(intValue))
8218 return false;
8219
8220 m_VariablesMask = intValue;
8221 }
8222
8224 {
8225 if (!ctx.
Read(value))
8226 return false;
8227
8229 {
8231 }
8232 else
8233 {
8235 }
8236 }
8237
8238 if (version < 140)
8239 {
8241 {
8242 if (!ctx.
Read(value))
8243 return false;
8244 SetTemperatureDirect(value);
8245 }
8246 }
8247
8249 {
8250 if (!ctx.
Read(value))
8251 return false;
8253 }
8254
8256 {
8257 if (!ctx.
Read(intValue))
8258 return false;
8260 }
8261
8263 {
8264 int r,g,b,a;
8266 return false;
8268 return false;
8270 return false;
8272 return false;
8273
8275 }
8276
8278 {
8279 if (!ctx.
Read(intValue))
8280 return false;
8282 }
8283
8284 if (version >= 138 && version < 140)
8285 {
8287 {
8288 if (!ctx.
Read(intValue))
8289 return false;
8290 SetFrozen(intValue);
8291 }
8292 }
8293
8294 return true;
8295 }
8296
8297
8299 {
8302 {
8304 }
8305
8306 if (!super.OnStoreLoad(ctx, version))
8307 {
8309 return false;
8310 }
8311
8312 if (version >= 114)
8313 {
8314 bool hasQuickBarIndexSaved;
8315
8316 if (!ctx.
Read(hasQuickBarIndexSaved))
8317 {
8319 return false;
8320 }
8321
8322 if (hasQuickBarIndexSaved)
8323 {
8324 int itmQBIndex;
8325
8326
8327 if (!ctx.
Read(itmQBIndex))
8328 {
8330 return false;
8331 }
8332
8333 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8334 if (itmQBIndex != -1 && parentPlayer)
8335 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8336 }
8337 }
8338 else
8339 {
8340
8341 PlayerBase player;
8342 int itemQBIndex;
8343 if (version ==
int.
MAX)
8344 {
8345 if (!ctx.
Read(itemQBIndex))
8346 {
8348 return false;
8349 }
8350 }
8351 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8352 {
8353
8354 if (!ctx.
Read(itemQBIndex))
8355 {
8357 return false;
8358 }
8359 if (itemQBIndex != -1 && player)
8360 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8361 }
8362 }
8363
8364 if (version < 140)
8365 {
8366
8367 if (!LoadVariables(ctx, version))
8368 {
8370 return false;
8371 }
8372 }
8373
8374
8376 {
8378 return false;
8379 }
8380 if (version >= 132)
8381 {
8383 if (raib)
8384 {
8386 {
8388 return false;
8389 }
8390 }
8391 }
8392
8394 return true;
8395 }
8396
8397
8398
8400 {
8401 super.OnStoreSave(ctx);
8402
8403 PlayerBase player;
8404 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8405 {
8407
8408 int itemQBIndex = -1;
8409 itemQBIndex = player.FindQuickBarEntityIndex(this);
8410 ctx.
Write(itemQBIndex);
8411 }
8412 else
8413 {
8415 }
8416
8418
8420 if (raib)
8421 {
8423 }
8424 }
8425
8426
8428 {
8429 super.AfterStoreLoad();
8430
8432 {
8434 }
8435
8437 {
8440 }
8441 }
8442
8444 {
8445 super.EEOnAfterLoad();
8446
8448 {
8450 }
8451
8454 }
8455
8457 {
8458 return false;
8459 }
8460
8461
8462
8464 {
8466 {
8467 #ifdef PLATFORM_CONSOLE
8468
8470 {
8472 if (menu)
8473 {
8475 }
8476 }
8477 #endif
8478 }
8479
8481 {
8484 }
8485
8487 {
8488 SetWeightDirty();
8490 }
8492 {
8495 }
8496
8498 {
8501
8504 }
8506 {
8510 }
8511
8512 super.OnVariablesSynchronized();
8513 }
8514
8515
8516
8518 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8519 {
8520 if (!IsServerCheck(allow_client))
8521 return false;
8522
8524 return false;
8525
8528
8529 if (value <= (min + 0.001))
8530 value = min;
8531
8532 if (value == min)
8533 {
8534 if (destroy_config)
8535 {
8536 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8537 if (dstr)
8538 {
8540 this.Delete();
8541 return true;
8542 }
8543 }
8544 else if (destroy_forced)
8545 {
8547 this.Delete();
8548 return true;
8549 }
8550
8552 }
8553
8556
8558 {
8559 EntityAI parent = GetHierarchyRoot();
8560 InventoryLocation iLoc = new InventoryLocation();
8561 GetInventory().GetCurrentInventoryLocation(iLoc);
8563 {
8564 int iLocSlot = iLoc.
GetSlot();
8566 {
8568 }
8570 {
8572 }
8573 }
8574 }
8575
8577 {
8579
8580 if (delta)
8582 }
8583
8585
8586 return false;
8587 }
8588
8589
8591 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8592 {
8594 }
8595
8597 {
8600 }
8601
8603 {
8606 }
8607
8609 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8610 {
8611 float value_clamped = Math.Clamp(value, 0, 1);
8613 SetQuantity(result, destroy_config, destroy_forced);
8614 }
8615
8616
8619 {
8621 }
8622
8624 {
8626 }
8627
8628
8629
8630
8631
8632
8633
8634
8635
8636
8638 {
8639 int slot = -1;
8640 GameInventory inventory = GetInventory();
8641 if (inventory)
8642 {
8643 InventoryLocation il = new InventoryLocation;
8646 }
8647
8649 }
8650
8652 {
8653 float quantity_max = 0;
8654
8656 {
8657 if (attSlotID != -1)
8658 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8659
8660 if (quantity_max <= 0)
8662 }
8663
8664 if (quantity_max <= 0)
8666
8667 return quantity_max;
8668 }
8669
8671 {
8673 }
8674
8676 {
8678 }
8679
8680
8682 {
8684 }
8685
8687 {
8689 }
8690
8692 {
8694 }
8695
8696
8698 {
8699
8700 float weightEx = GetWeightEx();
8701 float special = GetInventoryAndCargoWeight();
8702 return weightEx - special;
8703 }
8704
8705
8707 {
8709 }
8710
8712 {
8714 {
8715 #ifdef DEVELOPER
8716 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8717 {
8718 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
8720 }
8721 #endif
8722
8724 }
8725 else if (HasEnergyManager())
8726 {
8727 #ifdef DEVELOPER
8728 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8729 {
8730 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
8731 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
8732 }
8733 #endif
8734 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
8735 }
8736 else
8737 {
8738 #ifdef DEVELOPER
8739 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8740 {
8741 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
8742 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
8743 }
8744 #endif
8745 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
8746 }
8747 }
8748
8751 {
8752 int item_count = 0;
8754
8755 GameInventory inventory = GetInventory();
8756 CargoBase cargo = inventory.
GetCargo();
8757 if (cargo != NULL)
8758 {
8760 }
8761
8763 for (int i = 0; i < nAttachments; ++i)
8764 {
8766 if (item)
8767 item_count += item.GetNumberOfItems();
8768 }
8769 return item_count;
8770 }
8771
8774 {
8775 float weight = 0;
8776 float wetness = 1;
8777 if (include_wetness)
8780 {
8781 weight = wetness * m_ConfigWeight;
8782 }
8784 {
8785 weight = 1;
8786 }
8787 return weight;
8788 }
8789
8790
8791
8793 {
8794 GameInventory inventory = GetInventory();
8795 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
8796 {
8797 array<EntityAI> items = new array<EntityAI>;
8799 for (int i = 0; i < items.Count(); ++i)
8800 {
8802 if (item)
8803 {
8804 g_Game.ObjectDelete(item);
8805 }
8806 }
8807 }
8808 }
8809
8810
8811
8812
8814 {
8815 float energy = 0;
8816 if (HasEnergyManager())
8817 {
8818 energy = GetCompEM().GetEnergy();
8819 }
8820 return energy;
8821 }
8822
8823
8825 {
8826 super.OnEnergyConsumed();
8827
8829 }
8830
8832 {
8833 super.OnEnergyAdded();
8834
8836 }
8837
8838
8840 {
8841 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
8842 {
8844 {
8845 float energy_0to1 = GetCompEM().GetEnergy0To1();
8847 }
8848 }
8849 }
8850
8851
8853 {
8854 return ConfigGetFloat("heatIsolation");
8855 }
8856
8858 {
8860 }
8861
8863 {
8864 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
8865 if (
g_Game.ConfigIsExisting(paramPath))
8866 return g_Game.ConfigGetFloat(paramPath);
8867
8868 return 0.0;
8869 }
8870
8872 {
8873 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
8874 if (
g_Game.ConfigIsExisting(paramPath))
8875 return g_Game.ConfigGetFloat(paramPath);
8876
8877 return 0.0;
8878 }
8879
8880 override void SetWet(
float value,
bool allow_client =
false)
8881 {
8882 if (!IsServerCheck(allow_client))
8883 return;
8884
8887
8889
8890 m_VarWet = Math.Clamp(value, min, max);
8891
8893 {
8896 }
8897 }
8898
8899 override void AddWet(
float value)
8900 {
8902 }
8903
8905 {
8907 }
8908
8910 {
8912 }
8913
8915 {
8917 }
8918
8920 {
8922 }
8923
8925 {
8927 }
8928
8930 {
8933 if (newLevel != oldLevel)
8934 {
8936 }
8937 }
8938
8940 {
8941 SetWeightDirty();
8942 }
8943
8945 {
8946 return GetWetLevelInternal(
m_VarWet);
8947 }
8948
8949
8950
8952 {
8954 }
8955
8957 {
8959 }
8960
8962 {
8964 }
8965
8967 {
8969 }
8970
8971
8972
8974 {
8975 if (ConfigIsExisting("itemModelLength"))
8976 {
8977 return ConfigGetFloat("itemModelLength");
8978 }
8979 return 0;
8980 }
8981
8983 {
8984 if (ConfigIsExisting("itemAttachOffset"))
8985 {
8986 return ConfigGetFloat("itemAttachOffset");
8987 }
8988 return 0;
8989 }
8990
8991 override void SetCleanness(
int value,
bool allow_client =
false)
8992 {
8993 if (!IsServerCheck(allow_client))
8994 return;
8995
8997
8999
9002 }
9003
9005 {
9007 }
9008
9010 {
9011 return true;
9012 }
9013
9014
9015
9016
9018 {
9020 }
9021
9023 {
9025 }
9026
9027
9028
9029
9030 override void SetColor(
int r,
int g,
int b,
int a)
9031 {
9037 }
9039 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9040 {
9045 }
9046
9048 {
9050 }
9051
9054 {
9055 int r,g,b,a;
9057 r = r/255;
9058 g = g/255;
9059 b = b/255;
9060 a = a/255;
9061 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9062 }
9063
9064
9065
9066 override void SetLiquidType(
int value,
bool allow_client =
false)
9067 {
9068 if (!IsServerCheck(allow_client))
9069 return;
9070
9075 }
9076
9078 {
9079 return ConfigGetInt("varLiquidTypeInit");
9080 }
9081
9083 {
9085 }
9086
9088 {
9090 SetFrozen(false);
9091 }
9092
9095 {
9096 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9097 }
9098
9099
9102 {
9103 PlayerBase nplayer;
9104 if (PlayerBase.CastTo(nplayer, player))
9105 {
9107 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9108 }
9109 }
9110
9111
9114 {
9115 PlayerBase nplayer;
9116 if (PlayerBase.CastTo(nplayer,player))
9117 {
9118 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9119 }
9120
9121 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9122
9123 if (HasEnergyManager())
9124 {
9125 GetCompEM().UpdatePlugState();
9126 }
9127 }
9128
9129
9131 {
9132 super.OnPlacementStarted(player);
9133
9135 }
9136
9137 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9138 {
9140 {
9141 m_AdminLog.OnPlacementComplete(player,
this);
9142 }
9143
9144 super.OnPlacementComplete(player, position, orientation);
9145 }
9146
9147
9148
9149
9150
9152 {
9154 {
9155 return true;
9156 }
9157 else
9158 {
9159 return false;
9160 }
9161 }
9162
9163
9165 {
9167 {
9169 }
9170 }
9171
9172
9174 {
9176 }
9177
9179 {
9181 }
9182
9183 override void InsertAgent(
int agent,
float count = 1)
9184 {
9185 if (count < 1)
9186 return;
9187
9189 }
9190
9193 {
9195 }
9196
9197
9199 {
9201 }
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9245 {
9247 return false;
9248 return true;
9249 }
9250
9252 {
9253
9255 }
9256
9257
9260 {
9261 super.CheckForRoofLimited(timeTresholdMS);
9262
9263 float time =
g_Game.GetTime();
9264 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9265 {
9266 m_PreviousRoofTestTime = time;
9267 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9268 }
9269 }
9270
9271
9273 {
9275 {
9276 return 0;
9277 }
9278
9279 if (GetInventory().GetAttachmentSlotsCount() != 0)
9280 {
9281 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9282 if (filter)
9283 return filter.GetProtectionLevel(type, false, system);
9284 else
9285 return 0;
9286 }
9287
9288 string subclassPath, entryName;
9289
9290 switch (type)
9291 {
9293 entryName = "biological";
9294 break;
9296 entryName = "chemical";
9297 break;
9298 default:
9299 entryName = "biological";
9300 break;
9301 }
9302
9303 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9304
9305 return g_Game.ConfigGetFloat(subclassPath + entryName);
9306 }
9307
9308
9309
9312 {
9313 if (!IsMagazine())
9315
9317 }
9318
9319
9320
9321
9322
9327 {
9328 return true;
9329 }
9330
9332 {
9334 }
9335
9336
9337
9338
9339
9341 {
9342 if (parent)
9343 {
9344 if (parent.IsInherited(DayZInfected))
9345 return true;
9346
9347 if (!parent.IsRuined())
9348 return true;
9349 }
9350
9351 return true;
9352 }
9353
9355 {
9356 if (!super.CanPutAsAttachment(parent))
9357 {
9358 return false;
9359 }
9360
9361 if (!IsRuined() && !parent.IsRuined())
9362 {
9363 return true;
9364 }
9365
9366 return false;
9367 }
9368
9370 {
9371
9372
9373
9374
9375 return super.CanReceiveItemIntoCargo(item);
9376 }
9377
9379 {
9380
9381
9382
9383
9384 GameInventory attachmentInv = attachment.GetInventory();
9386 {
9387 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9388 return false;
9389 }
9390
9391 InventoryLocation loc = new InventoryLocation();
9392 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9393 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9394 return false;
9395
9396 return super.CanReceiveAttachment(attachment, slotId);
9397 }
9398
9400 {
9401 if (!super.CanReleaseAttachment(attachment))
9402 return false;
9403
9404 return GetInventory().AreChildrenAccessible();
9405 }
9406
9407
9408
9409
9410
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9428 {
9429 int id = muzzle_owner.GetMuzzleID();
9430 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9431
9432 if (WPOF_array)
9433 {
9434 for (int i = 0; i < WPOF_array.Count(); i++)
9435 {
9436 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9437
9438 if (WPOF)
9439 {
9440 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9441 }
9442 }
9443 }
9444 }
9445
9446
9448 {
9449 int id = muzzle_owner.GetMuzzleID();
9451
9452 if (WPOBE_array)
9453 {
9454 for (int i = 0; i < WPOBE_array.Count(); i++)
9455 {
9456 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9457
9458 if (WPOBE)
9459 {
9460 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9461 }
9462 }
9463 }
9464 }
9465
9466
9468 {
9469 int id = muzzle_owner.GetMuzzleID();
9470 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9471
9472 if (WPOOH_array)
9473 {
9474 for (int i = 0; i < WPOOH_array.Count(); i++)
9475 {
9476 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9477
9478 if (WPOOH)
9479 {
9480 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9481 }
9482 }
9483 }
9484 }
9485
9486
9488 {
9489 int id = muzzle_owner.GetMuzzleID();
9490 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9491
9492 if (WPOOH_array)
9493 {
9494 for (int i = 0; i < WPOOH_array.Count(); i++)
9495 {
9496 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9497
9498 if (WPOOH)
9499 {
9500 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9501 }
9502 }
9503 }
9504 }
9505
9506
9508 {
9509 int id = muzzle_owner.GetMuzzleID();
9510 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9511
9512 if (WPOOH_array)
9513 {
9514 for (int i = 0; i < WPOOH_array.Count(); i++)
9515 {
9516 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9517
9518 if (WPOOH)
9519 {
9520 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9521 }
9522 }
9523 }
9524 }
9525
9526
9527
9529 {
9531 {
9532 return true;
9533 }
9534
9535 return false;
9536 }
9537
9539 {
9541 {
9542 return true;
9543 }
9544
9545 return false;
9546 }
9547
9549 {
9551 {
9552 return true;
9553 }
9554
9555 return false;
9556 }
9557
9559 {
9560 return false;
9561 }
9562
9565 {
9566 return UATimeSpent.DEFAULT_DEPLOY;
9567 }
9568
9569
9570
9571
9573 {
9575 SetSynchDirty();
9576 }
9577
9579 {
9581 }
9582
9583
9585 {
9586 return false;
9587 }
9588
9591 {
9592 string att_type = "None";
9593
9594 if (ConfigIsExisting("soundAttType"))
9595 {
9596 att_type = ConfigGetString("soundAttType");
9597 }
9598
9600 }
9601
9603 {
9605 }
9606
9607
9608
9609
9610
9616
9618 {
9621
9623 }
9624
9625
9627 {
9629 return;
9630
9632
9635
9638
9639 SoundParameters params = new SoundParameters();
9643 }
9644
9645
9647 {
9649 {
9652
9653 SetSynchDirty();
9654
9657 }
9658 }
9659
9661 {
9663 }
9664
9665
9667 {
9669 return;
9670
9672 SetSynchDirty();
9673
9676 }
9677
9679 {
9682 }
9683
9685 {
9687 }
9688
9689 void OnApply(PlayerBase player);
9690
9692 {
9693 return 1.0;
9694 };
9695
9697 {
9699 }
9700
9702 {
9704 }
9705
9707
9709 {
9710 SetDynamicPhysicsLifeTime(0.01);
9712 }
9713
9715 {
9716 array<string> zone_names = new array<string>;
9717 GetDamageZones(zone_names);
9718 for (int i = 0; i < zone_names.Count(); i++)
9719 {
9720 SetHealthMax(zone_names.Get(i),"Health");
9721 }
9722 SetHealthMax("","Health");
9723 }
9724
9727 {
9728 float global_health = GetHealth01("","Health");
9729 array<string> zones = new array<string>;
9730 GetDamageZones(zones);
9731
9732 for (int i = 0; i < zones.Count(); i++)
9733 {
9734 SetHealth01(zones.Get(i),"Health",global_health);
9735 }
9736 }
9737
9740 {
9741 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
9742 }
9743
9745 {
9746 if (!hasRootAsPlayer)
9747 {
9748 if (refParentIB)
9749 {
9750
9751 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
9752 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
9753
9754 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
9755 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
9756
9759 }
9760 else
9761 {
9762
9765 }
9766 }
9767 }
9768
9770 {
9772 {
9773 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
9774 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
9775 {
9776 float heatPermCoef = 1.0;
9778 while (ent)
9779 {
9780 heatPermCoef *= ent.GetHeatPermeabilityCoef();
9781 ent = ent.GetHierarchyParent();
9782 }
9783
9784 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
9785 }
9786 }
9787 }
9788
9790 {
9791
9792 EntityAI parent = GetHierarchyParent();
9793 if (!parent)
9794 {
9795 hasParent = false;
9796 hasRootAsPlayer = false;
9797 }
9798 else
9799 {
9800 hasParent = true;
9801 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
9802 refParentIB =
ItemBase.Cast(parent);
9803 }
9804 }
9805
9806 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
9807 {
9808
9809 }
9810
9812 {
9813
9814 return false;
9815 }
9816
9818 {
9819
9820
9821 return false;
9822 }
9823
9825 {
9826
9827 return false;
9828 }
9829
9832 {
9833 return !GetIsFrozen() &&
IsOpen();
9834 }
9835
9837 {
9838 bool hasParent = false, hasRootAsPlayer = false;
9840
9841 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
9842 bool foodDecay =
g_Game.IsFoodDecayEnabled();
9843
9844 if (wwtu || foodDecay)
9845 {
9849
9850 if (processWetness || processTemperature || processDecay)
9851 {
9853
9854 if (processWetness)
9855 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
9856
9857 if (processTemperature)
9859
9860 if (processDecay)
9861 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
9862 }
9863 }
9864 }
9865
9868 {
9870 }
9871
9873 {
9876
9877 return super.GetTemperatureFreezeThreshold();
9878 }
9879
9881 {
9884
9885 return super.GetTemperatureThawThreshold();
9886 }
9887
9889 {
9892
9893 return super.GetItemOverheatThreshold();
9894 }
9895
9897 {
9899 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
9900
9901 return super.GetTemperatureFreezeTime();
9902 }
9903
9905 {
9907 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
9908
9909 return super.GetTemperatureThawTime();
9910 }
9911
9916
9918 {
9919 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
9920 }
9921
9923 {
9924 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
9925 }
9926
9929 {
9931 }
9932
9934 {
9936 }
9937
9939 {
9941 }
9942
9945 {
9946 return null;
9947 }
9948
9951 {
9952 return false;
9953 }
9954
9956 {
9958 {
9961 if (!trg)
9962 {
9964 explosive = this;
9965 }
9966
9967 explosive.PairRemote(trg);
9969
9970 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
9971 trg.SetPersistentPairID(persistentID);
9972 explosive.SetPersistentPairID(persistentID);
9973
9974 return true;
9975 }
9976 return false;
9977 }
9978
9981 {
9982 float ret = 1.0;
9985 ret *= GetHealth01();
9986
9987 return ret;
9988 }
9989
9990 #ifdef DEVELOPER
9991 override void SetDebugItem()
9992 {
9993 super.SetDebugItem();
9994 _itemBase = this;
9995 }
9996
9998 {
9999 string text = super.GetDebugText();
10000
10002 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10003
10004 return text;
10005 }
10006 #endif
10007
10009 {
10010 return true;
10011 }
10012
10014
10016
10018 {
10021 }
10022
10023
10031
10047
10048 [
Obsolete(
"Use ItemSoundHandler instead")]
10051 {
10052 if (!
g_Game.IsDedicatedServer())
10053 {
10054 if (ConfigIsExisting("attachSoundSet"))
10055 {
10056 string cfg_path = "";
10057 string soundset = "";
10058 string type_name =
GetType();
10059
10062 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10063 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10064
10065 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10066 {
10067 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10068 {
10069 if (cfg_slot_array[i] == slot_type)
10070 {
10071 soundset = cfg_soundset_array[i];
10072 break;
10073 }
10074 }
10075 }
10076
10077 if (soundset != "")
10078 {
10079 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10081 }
10082 }
10083 }
10084 }
10085
10087}
10088
10090{
10092 if (entity)
10093 {
10094 bool is_item = entity.IsInherited(
ItemBase);
10095 if (is_item && full_quantity)
10096 {
10099 }
10100 }
10101 else
10102 {
10104 return NULL;
10105 }
10106 return entity;
10107}
10108
10110{
10111 if (item)
10112 {
10113 if (health > 0)
10114 item.SetHealth("", "", health);
10115
10116 if (item.CanHaveTemperature())
10117 {
10119 if (item.CanFreeze())
10120 item.SetFrozen(false);
10121 }
10122
10123 if (item.HasEnergyManager())
10124 {
10125 if (quantity >= 0)
10126 {
10127 item.GetCompEM().SetEnergy0To1(quantity);
10128 }
10129 else
10130 {
10132 }
10133 }
10134 else if (item.IsMagazine())
10135 {
10136 Magazine mag = Magazine.Cast(item);
10137 if (quantity >= 0)
10138 {
10139 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10140 }
10141 else
10142 {
10144 }
10145
10146 }
10147 else
10148 {
10149 if (quantity >= 0)
10150 {
10151 item.SetQuantityNormalized(quantity, false);
10152 }
10153 else
10154 {
10156 }
10157
10158 }
10159 }
10160}
10161
10162#ifdef DEVELOPER
10164#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.