5223{
5225 {
5226 return true;
5227 }
5228};
5229
5231{
5232
5233};
5234
5235
5236
5238{
5242
5244
5247
5248
5249
5250
5251
5260
5266
5271
5276
5297 protected bool m_IsResultOfSplit
5298
5300
5305
5306
5307
5309
5313
5314
5315
5317
5320
5321
5322
5328
5329
5337
5340
5341
5343
5344
5346
5347
5352
5353
5358
5360
5361
5363
5364
5366 {
5371
5372 if (!
g_Game.IsDedicatedServer())
5373 {
5375 {
5377
5379 {
5381 }
5382 }
5383
5386 }
5387
5388 m_OldLocation = null;
5389
5391 {
5393 }
5394
5395 if (ConfigIsExisting("headSelectionsToHide"))
5396 {
5399 }
5400
5402 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5403 {
5405 }
5406
5408
5409 m_IsResultOfSplit = false;
5410
5412 }
5413
5415 {
5416 super.InitItemVariables();
5417
5423 m_Count = ConfigGetInt(
"count");
5424
5427
5432
5435
5440
5452
5456
5457
5460 if (ConfigIsExisting("canBeSplit"))
5461 {
5464 }
5465
5467 if (ConfigIsExisting("itemBehaviour"))
5469
5470
5473 RegisterNetSyncVariableInt("m_VarLiquidType");
5474 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5475
5476 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5477 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5478 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5479
5480 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5481 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5482 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5483 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5484
5485 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5486 RegisterNetSyncVariableBool("m_IsTakeable");
5487 RegisterNetSyncVariableBool("m_IsHologram");
5488
5491 {
5494 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
5495 }
5496
5498
5500 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5502
5504 }
5505
5507 {
5509 }
5510
5512 {
5515 {
5520 }
5521 }
5522
5523 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5524 {
5526 {
5529 }
5530
5532 }
5533
5535 {
5541 }
5542
5544
5546 {
5548
5549 if (!action)
5550 {
5551 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5552 return;
5553 }
5554
5556 if (!ai)
5557 {
5559 return;
5560 }
5561
5563 if (!action_array)
5564 {
5565 action_array = new array<ActionBase_Basic>;
5567 }
5568 if (LogManager.IsActionLogEnable())
5569 {
5570 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5571 }
5572
5573 if (action_array.Find(action) != -1)
5574 {
5575 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5576 }
5577 else
5578 {
5579 action_array.Insert(action);
5580 }
5581 }
5582
5584 {
5585 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
5586 ActionBase action = player.GetActionManager().GetAction(actionName);
5589
5590 if (action_array)
5591 {
5592 action_array.RemoveItem(action);
5593 }
5594 }
5595
5596
5597
5599 {
5600 ActionOverrideData overrideData = new ActionOverrideData();
5604
5606 if (!actionMap)
5607 {
5610 }
5611
5612 actionMap.Insert(this.
Type(), overrideData);
5613
5614 }
5615
5617
5619
5620
5622 {
5625
5628
5629 string config_to_search = "CfgVehicles";
5630 string muzzle_owner_config;
5631
5633 {
5634 if (IsInherited(Weapon))
5635 config_to_search = "CfgWeapons";
5636
5637 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5638
5639 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5640
5641 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
5642
5643 if (config_OnFire_subclass_count > 0)
5644 {
5645 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5646
5647 for (int i = 0; i < config_OnFire_subclass_count; i++)
5648 {
5649 string particle_class = "";
5650 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
5651 string config_OnFire_entry = config_OnFire_class + particle_class;
5652 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5653 WPOF_array.Insert(WPOF);
5654 }
5655
5656
5658 }
5659 }
5660
5662 {
5663 config_to_search = "CfgWeapons";
5664 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5665
5666 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5667
5668 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
5669
5670 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
5671 {
5672 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
5673
5674 for (i = 0; i < config_OnBulletCasingEject_count; i++)
5675 {
5676 string particle_class2 = "";
5677 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
5678 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
5679 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
5680 WPOBE_array.Insert(WPOBE);
5681 }
5682
5683
5685 }
5686 }
5687 }
5688
5689
5691 {
5694
5696 {
5697 string config_to_search = "CfgVehicles";
5698
5699 if (IsInherited(Weapon))
5700 config_to_search = "CfgWeapons";
5701
5702 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5703 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
5704
5705 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
5706 {
5707
5709
5711 {
5713 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
5715 return;
5716 }
5717
5720
5721
5722
5723 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
5724 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
5725
5726 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
5727 {
5728 string particle_class = "";
5729 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
5730 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
5731 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
5732
5733 if (entry_type == CT_CLASS)
5734 {
5735 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
5736 WPOOH_array.Insert(WPOF);
5737 }
5738 }
5739
5740
5742 }
5743 }
5744 }
5745
5747 {
5749 }
5750
5752 {
5754 {
5756
5759
5762
5763 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5764 }
5765 }
5766
5768 {
5770 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5771
5773 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5774
5776 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5777
5779 {
5781 }
5782 }
5783
5785 {
5787 }
5788
5790 {
5793 else
5795
5797 {
5800 }
5801 else
5802 {
5805
5808 }
5809
5811 }
5812
5814 {
5816 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5817 }
5818
5820 {
5822 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5824 }
5825
5827 {
5829 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5830 }
5831
5833 {
5836
5837 OverheatingParticle OP = new OverheatingParticle();
5842
5844 }
5845
5847 {
5850
5851 return -1;
5852 }
5853
5855 {
5857 {
5860
5861 for (int i = count; i > 0; --i)
5862 {
5863 int id = i - 1;
5866
5869
5870 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
5871 {
5872 if (p)
5873 {
5876 }
5877 }
5878 }
5879 }
5880 }
5881
5883 {
5885 {
5887 {
5888 int id = i - 1;
5890
5891 if (OP)
5892 {
5894
5895 if (p)
5896 {
5898 }
5899
5900 delete OP;
5901 }
5902 }
5903
5906 }
5907 }
5908
5911 {
5912 return 0.0;
5913 }
5914
5915
5917 {
5918 return 250;
5919 }
5920
5922 {
5923 return 0;
5924 }
5925
5928 {
5930 return true;
5931
5932 return false;
5933 }
5934
5937 {
5940
5942 {
5944 }
5945 else
5946 {
5947
5949 }
5950
5952 }
5953
5960 {
5961 return -1;
5962 }
5963
5964
5965
5966
5968 {
5970 {
5971 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
5972 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
5973
5974 if (r_index >= 0)
5975 {
5976 InventoryLocation r_il = new InventoryLocation;
5977 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
5978
5979 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
5982 {
5983 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
5984 }
5986 {
5987 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
5988 }
5989
5990 }
5991
5992 player.GetHumanInventory().ClearUserReservedLocation(this);
5993 }
5994
5997 }
5998
5999
6000
6001
6003 {
6004 return ItemBase.m_DebugActionsMask;
6005 }
6006
6008 {
6009 return ItemBase.m_DebugActionsMask & mask;
6010 }
6011
6013 {
6014 ItemBase.m_DebugActionsMask = mask;
6015 }
6016
6018 {
6019 ItemBase.m_DebugActionsMask |= mask;
6020 }
6021
6023 {
6024 ItemBase.m_DebugActionsMask &= ~mask;
6025 }
6026
6028 {
6030 {
6032 }
6033 else
6034 {
6036 }
6037 }
6038
6039
6041 {
6042 if (GetEconomyProfile())
6043 {
6044 float q_max = GetEconomyProfile().GetQuantityMax();
6045 if (q_max > 0)
6046 {
6047 float q_min = GetEconomyProfile().GetQuantityMin();
6048 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6049
6051 {
6052 ComponentEnergyManager comp = GetCompEM();
6054 {
6056 }
6057 }
6059 {
6061
6062 }
6063
6064 }
6065 }
6066 }
6067
6070 {
6071 EntityAI parent = GetHierarchyParent();
6072
6073 if (parent)
6074 {
6075 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6076 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6077 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6078 }
6079 }
6080
6083 {
6084 EntityAI parent = GetHierarchyParent();
6085
6086 if (parent)
6087 {
6088 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6089 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6090 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6091 }
6092 }
6093
6095 {
6096
6097
6098
6099
6101
6103 {
6104 if (ScriptInputUserData.CanStoreInputUserData())
6105 {
6106 ScriptInputUserData ctx = new ScriptInputUserData;
6112 ctx.
Write(use_stack_max);
6115
6117 {
6118 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6119 }
6120 }
6121 }
6122 else if (!
g_Game.IsMultiplayer())
6123 {
6125 }
6126 }
6127
6129 {
6131 }
6132
6134 {
6136 }
6137
6139 {
6141 }
6142
6144 {
6145
6146 return false;
6147 }
6148
6150 {
6151 return false;
6152 }
6153
6157 {
6158 return false;
6159 }
6160
6162 {
6163 return "";
6164 }
6165
6167
6169 {
6170 return false;
6171 }
6172
6174 {
6175 return true;
6176 }
6177
6178
6179
6181 {
6182 return true;
6183 }
6184
6186 {
6187 return true;
6188 }
6189
6191 {
6192 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6194 }
6195
6197 {
6199 }
6200
6202 {
6204 if (!is_being_placed)
6206 SetSynchDirty();
6207 }
6208
6209
6211
6213 {
6215 }
6216
6218 {
6220 }
6221
6223 {
6224 return 1;
6225 }
6226
6228 {
6229 return false;
6230 }
6231
6233 {
6235 SetSynchDirty();
6236 }
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6273 {
6274 super.OnMovedInsideCargo(container);
6275
6276 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6277 }
6278
6279 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6280 {
6281 super.EEItemLocationChanged(oldLoc, newLoc);
6282
6283 PlayerBase newPlayer = null;
6284 PlayerBase oldPlayer = null;
6285
6286 if (newLoc.GetParent())
6287 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6288
6289 if (oldLoc.GetParent())
6290 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6291
6293 {
6294 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6295
6296 if (rIndex >= 0)
6297 {
6298 InventoryLocation rIl = new InventoryLocation;
6299 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6300
6301 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6304 {
6305 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6306 }
6308 {
6310 }
6311
6312 }
6313 }
6314
6316 {
6317 if (newPlayer)
6318 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6319
6320 if (newPlayer == oldPlayer)
6321 {
6322 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6323 {
6325 {
6326 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6327 {
6328 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6329 }
6330 }
6331 else
6332 {
6333 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6334 }
6335 }
6336
6337 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6338 {
6339 int type = oldLoc.GetType();
6341 {
6342 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6343 }
6345 {
6346 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6347 }
6348 }
6349 if (!m_OldLocation)
6350 {
6351 m_OldLocation = new InventoryLocation;
6352 }
6353 m_OldLocation.Copy(oldLoc);
6354 }
6355 else
6356 {
6357 if (m_OldLocation)
6358 {
6359 m_OldLocation.Reset();
6360 }
6361 }
6362
6363 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6364 }
6365 else
6366 {
6367 if (newPlayer)
6368 {
6369 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6370 if (resIndex >= 0)
6371 {
6372 InventoryLocation il = new InventoryLocation;
6373 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6375 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6378 {
6379 il.
GetParent().GetOnReleaseLock().Invoke(it);
6380 }
6382 {
6384 }
6385
6386 }
6387 }
6389 {
6390
6392 }
6393
6394 if (m_OldLocation)
6395 {
6396 m_OldLocation.Reset();
6397 }
6398 }
6399
6401 {
6402 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6403 }
6404
6406 {
6407 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6408 }
6409 }
6410
6411 override void EOnContact(IEntity other, Contact extra)
6412 {
6414 {
6415 int liquidType = -1;
6417 if (impactSpeed > 0.0)
6418 {
6420 #ifndef SERVER
6422 #else
6424 SetSynchDirty();
6425 #endif
6427 }
6428 }
6429
6430 #ifdef SERVER
6431 if (GetCompEM() && GetCompEM().IsPlugged())
6432 {
6433 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6434 GetCompEM().UnplugThis();
6435 }
6436 #endif
6437 }
6438
6440
6442 {
6444 }
6445
6447 {
6448
6449 }
6450
6452 {
6453 super.OnItemLocationChanged(old_owner, new_owner);
6454
6455 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6456 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6457
6458 if (!relatedPlayer && playerNew)
6459 relatedPlayer = playerNew;
6460
6461 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6462 {
6464 if (actionMgr)
6465 {
6466 ActionBase currentAction = actionMgr.GetRunningAction();
6467 if (currentAction)
6469 }
6470 }
6471
6472 Man ownerPlayerOld = null;
6473 Man ownerPlayerNew = null;
6474
6475 if (old_owner)
6476 {
6477 if (old_owner.
IsMan())
6478 {
6479 ownerPlayerOld = Man.Cast(old_owner);
6480 }
6481 else
6482 {
6483 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6484 }
6485 }
6486 else
6487 {
6489 {
6491
6492 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6493 {
6494 GetCompEM().UnplugThis();
6495 }
6496 }
6497 }
6498
6499 if (new_owner)
6500 {
6501 if (new_owner.
IsMan())
6502 {
6503 ownerPlayerNew = Man.Cast(new_owner);
6504 }
6505 else
6506 {
6507 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6508 }
6509 }
6510
6511 if (ownerPlayerOld != ownerPlayerNew)
6512 {
6513 if (ownerPlayerOld)
6514 {
6515 array<EntityAI> subItemsExit = new array<EntityAI>;
6517 for (int i = 0; i < subItemsExit.Count(); i++)
6518 {
6521 }
6522 }
6523
6524 if (ownerPlayerNew)
6525 {
6526 array<EntityAI> subItemsEnter = new array<EntityAI>;
6528 for (int j = 0; j < subItemsEnter.Count(); j++)
6529 {
6532 }
6533 }
6534 }
6535 else if (ownerPlayerNew != null)
6536 {
6537 PlayerBase nplayer;
6538 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6539 {
6540 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6542 for (int k = 0; k < subItemsUpdate.Count(); k++)
6543 {
6545 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6546 }
6547 }
6548 }
6549
6550 if (old_owner)
6551 old_owner.OnChildItemRemoved(this);
6552 if (new_owner)
6553 new_owner.OnChildItemReceived(this);
6554 }
6555
6556
6558 {
6559 super.EEDelete(parent);
6560 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6561 if (player)
6562 {
6564
6565 if (player.IsAlive())
6566 {
6567 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6568 if (r_index >= 0)
6569 {
6570 InventoryLocation r_il = new InventoryLocation;
6571 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6572
6573 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6576 {
6577 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6578 }
6580 {
6581 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6582 }
6583
6584 }
6585
6586 player.RemoveQuickBarEntityShortcut(this);
6587 }
6588 }
6589 }
6590
6592 {
6593 super.EEKilled(killer);
6594
6597 {
6598 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6599 {
6600 if (IsMagazine())
6601 {
6602 if (Magazine.Cast(this).GetAmmoCount() > 0)
6603 {
6605 }
6606 }
6607 else
6608 {
6610 }
6611 }
6612 }
6613 }
6614
6616 {
6617 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6618
6619 super.OnWasAttached(parent, slot_id);
6620
6623
6626 }
6627
6629 {
6630 super.OnWasDetached(parent, slot_id);
6631
6634
6637 }
6638
6640 {
6641 int idx;
6644
6645 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6646 if (inventory_slots.Count() < 1)
6647 {
6648 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6649 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6650 }
6651 else
6652 {
6653 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6654 }
6655
6656 idx = inventory_slots.Find(slot);
6657 if (idx < 0)
6658 return "";
6659
6660 return attach_types.Get(idx);
6661 }
6662
6664 {
6665 int idx = -1;
6666 string slot;
6667
6670
6671 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6672 if (inventory_slots.Count() < 1)
6673 {
6674 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6675 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6676 }
6677 else
6678 {
6679 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6680 if (detach_types.Count() < 1)
6681 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6682 }
6683
6684 for (int i = 0; i < inventory_slots.Count(); i++)
6685 {
6686 slot = inventory_slots.Get(i);
6687 }
6688
6689 if (slot != "")
6690 {
6691 if (detach_types.Count() == 1)
6692 idx = 0;
6693 else
6694 idx = inventory_slots.Find(slot);
6695 }
6696 if (idx < 0)
6697 return "";
6698
6699 return detach_types.Get(idx);
6700 }
6701
6703 {
6704
6706
6707
6708 float min_time = 1;
6709 float max_time = 3;
6710 float delay = Math.RandomFloat(min_time, max_time);
6711
6712 explode_timer.Run(delay, this, "DoAmmoExplosion");
6713 }
6714
6716 {
6717 Magazine magazine = Magazine.Cast(this);
6718 int pop_sounds_count = 6;
6719 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
6720
6721
6722 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
6723 string sound_name = pop_sounds[ sound_idx ];
6724 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
6725
6726
6727 magazine.ServerAddAmmoCount(-1);
6728
6729
6730 float min_temp_to_explode = 100;
6731
6732 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
6733 {
6735 }
6736 }
6737
6738
6739 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
6740 {
6741 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
6742
6743 const int CHANCE_DAMAGE_CARGO = 4;
6744 const int CHANCE_DAMAGE_ATTACHMENT = 1;
6745 const int CHANCE_DAMAGE_NOTHING = 2;
6746
6748 {
6749 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
6750 int chances;
6751 int rnd;
6752
6753 if (GetInventory().GetCargo())
6754 {
6755 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6756 rnd = Math.RandomInt(0,chances);
6757
6758 if (rnd < CHANCE_DAMAGE_CARGO)
6759 {
6761 }
6762 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
6763 {
6765 }
6766 }
6767 else
6768 {
6769 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6770 rnd = Math.RandomInt(0,chances);
6771
6772 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
6773 {
6775 }
6776 }
6777 }
6778 }
6779
6781 {
6782 CargoBase cargo = GetInventory().GetCargo();
6783 if (cargo)
6784 {
6786 if (item_count > 0)
6787 {
6788 int random_pick = Math.RandomInt(0, item_count);
6790 if (!item.IsExplosive())
6791 {
6792 item.AddHealth("","",damage);
6793 return true;
6794 }
6795 }
6796 }
6797 return false;
6798 }
6799
6801 {
6802 GameInventory inventory = GetInventory();
6804 if (attachment_count > 0)
6805 {
6806 int random_pick = Math.RandomInt(0, attachment_count);
6808 if (!attachment.IsExplosive())
6809 {
6810 attachment.AddHealth("","",damage);
6811 return true;
6812 }
6813 }
6814 return false;
6815 }
6816
6818 {
6820 }
6821
6823 {
6825 return GetInventory().CanRemoveEntity();
6826
6827 return false;
6828 }
6829
6831 {
6832
6834 return false;
6835
6836
6838 return false;
6839
6840
6841
6843 if (delta == 0)
6844 return false;
6845
6846
6847 return true;
6848 }
6849
6851 {
6853 {
6854 if (ScriptInputUserData.CanStoreInputUserData())
6855 {
6856 ScriptInputUserData ctx = new ScriptInputUserData;
6861 ctx.
Write(destination_entity);
6865 }
6866 }
6867 else if (!
g_Game.IsMultiplayer())
6868 {
6870 }
6871 }
6872
6874 {
6875 float split_quantity_new;
6879 InventoryLocation loc = new InventoryLocation;
6880
6881 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6882 {
6884 split_quantity_new = stack_max;
6885 else
6887
6889 {
6890 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6891 if (new_item)
6892 {
6893 new_item.SetResultOfSplit(true);
6894 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6896 new_item.
SetQuantity(split_quantity_new,
false,
true);
6897 }
6898 }
6899 }
6900 else if (destination_entity && slot_id == -1)
6901 {
6902 if (quantity > stack_max)
6903 split_quantity_new = stack_max;
6904 else
6905 split_quantity_new = quantity;
6906
6908 {
6909 GameInventory destinationInventory = destination_entity.GetInventory();
6911 {
6914 }
6915
6916 if (new_item)
6917 {
6918 new_item.SetResultOfSplit(true);
6919 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6921 new_item.
SetQuantity(split_quantity_new,
false,
true);
6922 }
6923 }
6924 }
6925 else
6926 {
6927 if (stack_max != 0)
6928 {
6930 {
6932 }
6933
6934 if (split_quantity_new == 0)
6935 {
6936 if (!
g_Game.IsMultiplayer())
6937 player.PhysicalPredictiveDropItem(this);
6938 else
6939 player.ServerDropEntity(this);
6940 return;
6941 }
6942
6944 {
6946
6947 if (new_item)
6948 {
6949 new_item.SetResultOfSplit(true);
6950 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6953 new_item.PlaceOnSurface();
6954 }
6955 }
6956 }
6957 }
6958 }
6959
6961 {
6962 float split_quantity_new;
6966 InventoryLocation loc = new InventoryLocation;
6967
6968 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6969 {
6971 split_quantity_new = stack_max;
6972 else
6974
6976 {
6977 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6978 if (new_item)
6979 {
6980 new_item.SetResultOfSplit(true);
6981 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6983 new_item.
SetQuantity(split_quantity_new,
false,
true);
6984 }
6985 }
6986 }
6987 else if (destination_entity && slot_id == -1)
6988 {
6989 if (quantity > stack_max)
6990 split_quantity_new = stack_max;
6991 else
6992 split_quantity_new = quantity;
6993
6995 {
6996 GameInventory destinationInventory = destination_entity.GetInventory();
6998 {
7001 }
7002
7003 if (new_item)
7004 {
7005 new_item.SetResultOfSplit(true);
7006 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7008 new_item.
SetQuantity(split_quantity_new,
false,
true);
7009 }
7010 }
7011 }
7012 else
7013 {
7014 if (stack_max != 0)
7015 {
7017 {
7019 }
7020
7022 {
7024
7025 if (new_item)
7026 {
7027 new_item.SetResultOfSplit(true);
7028 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7031 new_item.PlaceOnSurface();
7032 }
7033 }
7034 }
7035 }
7036 }
7037
7039 {
7041 {
7042 if (ScriptInputUserData.CanStoreInputUserData())
7043 {
7044 ScriptInputUserData ctx = new ScriptInputUserData;
7049 dst.WriteToContext(ctx);
7051 }
7052 }
7053 else if (!
g_Game.IsMultiplayer())
7054 {
7056 }
7057 }
7058
7060 {
7062 {
7063 if (ScriptInputUserData.CanStoreInputUserData())
7064 {
7065 ScriptInputUserData ctx = new ScriptInputUserData;
7070 ctx.
Write(destination_entity);
7076 }
7077 }
7078 else if (!
g_Game.IsMultiplayer())
7079 {
7081 }
7082 }
7083
7085 {
7087 }
7088
7090 {
7092 float split_quantity_new;
7094 if (dst.IsValid())
7095 {
7096 int slot_id = dst.GetSlot();
7098
7099 if (quantity > stack_max)
7100 split_quantity_new = stack_max;
7101 else
7102 split_quantity_new = quantity;
7103
7105 {
7107
7108 if (new_item)
7109 {
7110 new_item.SetResultOfSplit(true);
7111 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7113 new_item.
SetQuantity(split_quantity_new,
false,
true);
7114 }
7115
7116 return new_item;
7117 }
7118 }
7119
7120 return null;
7121 }
7122
7124 {
7126 float split_quantity_new;
7128 if (destination_entity)
7129 {
7131 if (quantity > stackable)
7132 split_quantity_new = stackable;
7133 else
7134 split_quantity_new = quantity;
7135
7137 {
7138 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7139 if (new_item)
7140 {
7141 new_item.SetResultOfSplit(true);
7142 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7144 new_item.
SetQuantity(split_quantity_new,
false,
true);
7145 }
7146 }
7147 }
7148 }
7149
7151 {
7153 {
7154 if (ScriptInputUserData.CanStoreInputUserData())
7155 {
7156 ScriptInputUserData ctx = new ScriptInputUserData;
7161 ItemBase destination_entity =
this;
7162 ctx.
Write(destination_entity);
7166 }
7167 }
7168 else if (!
g_Game.IsMultiplayer())
7169 {
7171 }
7172 }
7173
7175 {
7177 float split_quantity_new;
7179 if (player)
7180 {
7182 if (quantity > stackable)
7183 split_quantity_new = stackable;
7184 else
7185 split_quantity_new = quantity;
7186
7188 {
7189 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7190 new_item =
ItemBase.Cast(in_hands);
7191 if (new_item)
7192 {
7193 new_item.SetResultOfSplit(true);
7194 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7196 new_item.SetQuantity(split_quantity_new, false, true);
7197 }
7198 }
7199 }
7200 }
7201
7203 {
7205 float split_quantity_new = Math.Floor(quantity * 0.5);
7206
7208 return;
7209
7211
7212 if (new_item)
7213 {
7214 if (new_item.GetQuantityMax() < split_quantity_new)
7215 {
7216 split_quantity_new = new_item.GetQuantityMax();
7217 }
7218
7219 new_item.SetResultOfSplit(true);
7220 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7221
7223 {
7226 }
7227 else
7228 {
7230 new_item.
SetQuantity(split_quantity_new,
false,
true);
7231 }
7232 }
7233 }
7234
7236 {
7238 float split_quantity_new = Math.Floor(quantity / 2);
7239
7241 return;
7242
7243 InventoryLocation invloc = new InventoryLocation;
7245
7247 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7248
7249 if (new_item)
7250 {
7251 if (new_item.GetQuantityMax() < split_quantity_new)
7252 {
7253 split_quantity_new = new_item.GetQuantityMax();
7254 }
7256 {
7259 }
7260 else if (split_quantity_new > 1)
7261 {
7263 new_item.
SetQuantity(split_quantity_new,
false,
true);
7264 }
7265 }
7266 }
7267
7270 {
7271 SetWeightDirty();
7273
7274 if (parent)
7275 parent.OnAttachmentQuantityChangedEx(this, delta);
7276
7278 {
7280 {
7282 }
7284 {
7285 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7287 }
7288 }
7289 }
7290
7293 {
7294
7295 }
7296
7299 {
7301 }
7302
7304 {
7305 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7306
7308 {
7309 if (newLevel == GameConstants.STATE_RUINED)
7310 {
7312 EntityAI parent = GetHierarchyParent();
7313 if (parent && parent.IsFireplace())
7314 {
7315 CargoBase cargo = GetInventory().GetCargo();
7316 if (cargo)
7317 {
7319 {
7321 }
7322 }
7323 }
7324 }
7325
7327 {
7328
7330 return;
7331 }
7332
7333 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7334 {
7336 }
7337 }
7338 }
7339
7340
7342 {
7343 super.OnRightClick();
7344
7346 {
7348 {
7349 if (ScriptInputUserData.CanStoreInputUserData())
7350 {
7351 EntityAI root = GetHierarchyRoot();
7352 Man playerOwner = GetHierarchyRootPlayer();
7353 InventoryLocation dst = new InventoryLocation;
7354
7355
7356 if (!playerOwner && root && root == this)
7357 {
7359 }
7360 else
7361 {
7362
7363 GetInventory().GetCurrentInventoryLocation(dst);
7365 {
7366 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7368 {
7370 }
7371 else
7372 {
7374
7375
7376 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7377 {
7379 }
7380 else
7381 {
7382 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7383 }
7384 }
7385 }
7386 }
7387
7388 ScriptInputUserData ctx = new ScriptInputUserData;
7396 }
7397 }
7398 else if (!
g_Game.IsMultiplayer())
7399 {
7401 }
7402 }
7403 }
7404
7406 {
7407 if (root)
7408 {
7409 vector m4[4];
7410 root.GetTransform(m4);
7411 dst.SetGround(this, m4);
7412 }
7413 else
7414 {
7415 GetInventory().GetCurrentInventoryLocation(dst);
7416 }
7417 }
7418
7419 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7420 {
7421
7422 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7423 return false;
7424
7425 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7426 return false;
7427
7428
7430 return false;
7431
7432
7433 Magazine mag = Magazine.Cast(this);
7434 if (mag)
7435 {
7436 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7437 return false;
7438
7439 if (stack_max_limit)
7440 {
7441 Magazine other_mag = Magazine.Cast(other_item);
7442 if (other_item)
7443 {
7444 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7445 return false;
7446 }
7447
7448 }
7449 }
7450 else
7451 {
7452
7454 return false;
7455
7457 return false;
7458 }
7459
7460 PlayerBase player = null;
7461 if (CastTo(player, GetHierarchyRootPlayer()))
7462 {
7463 if (player.GetInventory().HasAttachment(this))
7464 return false;
7465
7466 if (player.IsItemsToDelete())
7467 return false;
7468 }
7469
7470 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7471 return false;
7472
7473 int slotID;
7475 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7476 return false;
7477
7478 return true;
7479 }
7480
7482 {
7484 }
7485
7487 {
7488 return m_IsResultOfSplit;
7489 }
7490
7492 {
7493 m_IsResultOfSplit = value;
7494 }
7495
7497 {
7499 }
7500
7502 {
7503 float other_item_quantity = other_item.GetQuantity();
7504 float this_free_space;
7505
7507
7509
7510 if (other_item_quantity > this_free_space)
7511 {
7512 return this_free_space;
7513 }
7514 else
7515 {
7516 return other_item_quantity;
7517 }
7518 }
7519
7521 {
7523 }
7524
7526 {
7528 return;
7529
7530 if (!IsMagazine() && other_item)
7531 {
7533 if (quantity_used != 0)
7534 {
7535 float hp1 = GetHealth01("","");
7536 float hp2 = other_item.GetHealth01("","");
7537 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7538 hpResult = hpResult / (
GetQuantity() + quantity_used);
7539
7540 hpResult *= GetMaxHealth();
7541 Math.Round(hpResult);
7542 SetHealth("", "Health", hpResult);
7543
7545 other_item.AddQuantity(-quantity_used);
7546 }
7547 }
7549 }
7550
7552 {
7553 #ifdef SERVER
7554 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7555 GetHierarchyParent().IncreaseLifetimeUp();
7556 #endif
7557 };
7558
7560 {
7561 PlayerBase p = PlayerBase.Cast(player);
7562
7563 array<int> recipesIds = p.m_Recipes;
7564 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7565 if (moduleRecipesManager)
7566 {
7567 EntityAI itemInHands = player.GetEntityInHands();
7568 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7569 }
7570
7571 for (int i = 0;i < recipesIds.Count(); i++)
7572 {
7573 int key = recipesIds.Get(i);
7574 string recipeName = moduleRecipesManager.GetRecipeName(key);
7576 }
7577 }
7578
7579
7580 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7581 {
7582 super.GetDebugActions(outputList);
7583
7584
7590
7591
7596
7601
7602
7606
7607
7609 {
7613 }
7614
7617
7618
7622
7624
7625 InventoryLocation loc = new InventoryLocation();
7626 GetInventory().GetCurrentInventoryLocation(loc);
7628 {
7629 if (Gizmo_IsSupported())
7632 }
7633
7635 }
7636
7637
7638
7639
7641 {
7642 super.OnAction(action_id, player, ctx);
7643
7645 {
7646 switch (action_id)
7647 {
7651 return true;
7655 return true;
7656 }
7657 }
7658
7660 {
7661 switch (action_id)
7662 {
7664 Delete();
7665 return true;
7666 }
7667 }
7668
7669 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
7670 {
7671 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7672 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
7673 PlayerBase p = PlayerBase.Cast(player);
7674 if (
EActions.RECIPES_RANGE_START < 1000)
7675 {
7676 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7677 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7678 }
7679 }
7680 #ifndef SERVER
7681 else if (action_id ==
EActions.WATCH_PLAYER)
7682 {
7683 PluginDeveloper.SetDeveloperItemClientEx(player);
7684 }
7685 #endif
7687 {
7688 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7689 {
7690 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7691 OnDebugButtonPressServer(id + 1);
7692 }
7693
7694 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7695 {
7696 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
7698 }
7699
7700 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
7701 {
7702 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
7704 }
7705
7706 else if (action_id ==
EActions.ADD_QUANTITY)
7707 {
7708 if (IsMagazine())
7709 {
7710 Magazine mag = Magazine.Cast(this);
7711 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
7712 }
7713 else
7714 {
7716 }
7717
7718 if (m_EM)
7719 {
7720 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
7721 }
7722
7723 }
7724
7725 else if (action_id ==
EActions.REMOVE_QUANTITY)
7726 {
7727 if (IsMagazine())
7728 {
7729 Magazine mag2 = Magazine.Cast(this);
7730 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
7731 }
7732 else
7733 {
7735 }
7736 if (m_EM)
7737 {
7738 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
7739 }
7740
7741 }
7742
7743 else if (action_id ==
EActions.SET_QUANTITY_0)
7744 {
7746
7747 if (m_EM)
7748 {
7749 m_EM.SetEnergy(0);
7750 }
7751 }
7752
7753 else if (action_id ==
EActions.SET_MAX_QUANTITY)
7754 {
7756
7757 if (m_EM)
7758 {
7759 m_EM.SetEnergy(m_EM.GetEnergyMax());
7760 }
7761 }
7762
7763 else if (action_id ==
EActions.ADD_HEALTH)
7764 {
7765 AddHealth("","",GetMaxHealth("","Health")/5);
7766 }
7767 else if (action_id ==
EActions.REMOVE_HEALTH)
7768 {
7769 AddHealth("","",-GetMaxHealth("","Health")/5);
7770 }
7771 else if (action_id ==
EActions.DESTROY_HEALTH)
7772 {
7773 SetHealth01("","",0);
7774 }
7775 else if (action_id ==
EActions.WATCH_ITEM)
7776 {
7778 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
7779 #ifdef DEVELOPER
7780 SetDebugDeveloper_item(this);
7781 #endif
7782 }
7783
7784 else if (action_id ==
EActions.ADD_TEMPERATURE)
7785 {
7786 AddTemperature(20);
7787
7788 }
7789
7790 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
7791 {
7792 AddTemperature(-20);
7793
7794 }
7795
7796 else if (action_id ==
EActions.FLIP_FROZEN)
7797 {
7798 SetFrozen(!GetIsFrozen());
7799
7800 }
7801
7802 else if (action_id ==
EActions.ADD_WETNESS)
7803 {
7805
7806 }
7807
7808 else if (action_id ==
EActions.REMOVE_WETNESS)
7809 {
7811
7812 }
7813
7814 else if (action_id ==
EActions.LIQUIDTYPE_UP)
7815 {
7818
7819
7820 }
7821
7822 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
7823 {
7826 }
7827
7828 else if (action_id ==
EActions.MAKE_SPECIAL)
7829 {
7830 auto debugParams = DebugSpawnParams.WithPlayer(player);
7831 OnDebugSpawnEx(debugParams);
7832 }
7833
7834 }
7835
7836
7837 return false;
7838 }
7839
7840
7841
7842
7846
7849
7850
7851
7853 {
7854 return false;
7855 }
7856
7857
7859 {
7860 return true;
7861 }
7862
7863
7865 {
7866 return true;
7867 }
7868
7869
7870
7872 {
7873 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
7874 return g_Game.ConfigIsExisting(config_path);
7875 }
7876
7879 {
7880 return null;
7881 }
7882
7884 {
7885 return false;
7886 }
7887
7889 {
7890 return false;
7891 }
7892
7896
7897
7899 {
7900 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7901 return module_repairing.CanRepair(this, item_repair_kit);
7902 }
7903
7904
7905 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
7906 {
7907 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7908 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
7909 }
7910
7911
7913 {
7914
7915
7916
7917
7918
7919
7920
7921
7922 return 1;
7923 }
7924
7925
7926
7928 {
7930 }
7931
7932
7933
7935 {
7937 }
7938
7939
7948 {
7949 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7950
7951 if (player)
7952 {
7953 player.MessageStatus(text);
7954 }
7955 }
7956
7957
7966 {
7967 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7968
7969 if (player)
7970 {
7971 player.MessageAction(text);
7972 }
7973 }
7974
7975
7984 {
7985 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7986
7987 if (player)
7988 {
7989 player.MessageFriendly(text);
7990 }
7991 }
7992
7993
8002 {
8003 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8004
8005 if (player)
8006 {
8007 player.MessageImportant(text);
8008 }
8009 }
8010
8012 {
8013 return true;
8014 }
8015
8016
8017 override bool KindOf(
string tag)
8018 {
8019 bool found = false;
8020 string item_name = this.
GetType();
8022 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8023
8024 int array_size = item_tag_array.Count();
8025 for (int i = 0; i < array_size; i++)
8026 {
8027 if (item_tag_array.Get(i) == tag)
8028 {
8029 found = true;
8030 break;
8031 }
8032 }
8033 return found;
8034 }
8035
8036
8038 {
8039
8040 super.OnRPC(sender, rpc_type,ctx);
8041
8042
8043 switch (rpc_type)
8044 {
8045 #ifndef SERVER
8046 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8047 Param2<bool, string> p = new Param2<bool, string>(false, "");
8048
8050 return;
8051
8052 bool play = p.param1;
8053 string soundSet = p.param2;
8054
8055 if (play)
8056 {
8058 {
8060 {
8062 }
8063 }
8064 else
8065 {
8067 }
8068 }
8069 else
8070 {
8072 }
8073
8074 break;
8075 #endif
8076
8077 }
8078
8080 {
8082 }
8083 }
8084
8085
8086
8087
8089 {
8090 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8091 return plugin.GetID(
name);
8092 }
8093
8095 {
8096 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8097 return plugin.GetName(id);
8098 }
8099
8102 {
8103
8104
8105 int varFlags;
8106 if (!ctx.
Read(varFlags))
8107 return;
8108
8109 if (varFlags & ItemVariableFlags.FLOAT)
8110 {
8112 }
8113 }
8114
8116 {
8117
8118 super.SerializeNumericalVars(floats_out);
8119
8120
8121
8123 {
8125 }
8126
8128 {
8130 }
8131
8133 {
8135 }
8136
8138 {
8143 }
8144
8146 {
8148 }
8149 }
8150
8152 {
8153
8154 super.DeSerializeNumericalVars(floats);
8155
8156
8157 int index = 0;
8158 int mask = Math.Round(floats.Get(index));
8159
8160 index++;
8161
8163 {
8165 {
8167 }
8168 else
8169 {
8170 float quantity = floats.Get(index);
8172 }
8173 index++;
8174 }
8175
8177 {
8178 float wet = floats.Get(index);
8180 index++;
8181 }
8182
8184 {
8185 int liquidtype = Math.Round(floats.Get(index));
8187 index++;
8188 }
8189
8191 {
8193 index++;
8195 index++;
8197 index++;
8199 index++;
8200 }
8201
8203 {
8204 int cleanness = Math.Round(floats.Get(index));
8206 index++;
8207 }
8208 }
8209
8211 {
8212 super.WriteVarsToCTX(ctx);
8213
8214
8216 {
8218 }
8219
8221 {
8223 }
8224
8226 {
8228 }
8229
8231 {
8232 int r,g,b,a;
8238 }
8239
8241 {
8243 }
8244 }
8245
8247 {
8248 if (!super.ReadVarsFromCTX(ctx,version))
8249 return false;
8250
8251 int intValue;
8252 float value;
8253
8254 if (version < 140)
8255 {
8256 if (!ctx.
Read(intValue))
8257 return false;
8258
8259 m_VariablesMask = intValue;
8260 }
8261
8263 {
8264 if (!ctx.
Read(value))
8265 return false;
8266
8268 {
8270 }
8271 else
8272 {
8274 }
8275 }
8276
8277 if (version < 140)
8278 {
8280 {
8281 if (!ctx.
Read(value))
8282 return false;
8283 SetTemperatureDirect(value);
8284 }
8285 }
8286
8288 {
8289 if (!ctx.
Read(value))
8290 return false;
8292 }
8293
8295 {
8296 if (!ctx.
Read(intValue))
8297 return false;
8299 }
8300
8302 {
8303 int r,g,b,a;
8305 return false;
8307 return false;
8309 return false;
8311 return false;
8312
8314 }
8315
8317 {
8318 if (!ctx.
Read(intValue))
8319 return false;
8321 }
8322
8323 if (version >= 138 && version < 140)
8324 {
8326 {
8327 if (!ctx.
Read(intValue))
8328 return false;
8329 SetFrozen(intValue);
8330 }
8331 }
8332
8333 return true;
8334 }
8335
8336
8338 {
8341 {
8343 }
8344
8345 if (!super.OnStoreLoad(ctx, version))
8346 {
8348 return false;
8349 }
8350
8351 if (version >= 114)
8352 {
8353 bool hasQuickBarIndexSaved;
8354
8355 if (!ctx.
Read(hasQuickBarIndexSaved))
8356 {
8358 return false;
8359 }
8360
8361 if (hasQuickBarIndexSaved)
8362 {
8363 int itmQBIndex;
8364
8365
8366 if (!ctx.
Read(itmQBIndex))
8367 {
8369 return false;
8370 }
8371
8372 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8373 if (itmQBIndex != -1 && parentPlayer)
8374 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8375 }
8376 }
8377 else
8378 {
8379
8380 PlayerBase player;
8381 int itemQBIndex;
8382 if (version ==
int.
MAX)
8383 {
8384 if (!ctx.
Read(itemQBIndex))
8385 {
8387 return false;
8388 }
8389 }
8390 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8391 {
8392
8393 if (!ctx.
Read(itemQBIndex))
8394 {
8396 return false;
8397 }
8398 if (itemQBIndex != -1 && player)
8399 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8400 }
8401 }
8402
8403 if (version < 140)
8404 {
8405
8406 if (!LoadVariables(ctx, version))
8407 {
8409 return false;
8410 }
8411 }
8412
8413
8415 {
8417 return false;
8418 }
8419 if (version >= 132)
8420 {
8422 if (raib)
8423 {
8425 {
8427 return false;
8428 }
8429 }
8430 }
8431
8433 return true;
8434 }
8435
8436
8437
8439 {
8440 super.OnStoreSave(ctx);
8441
8442 PlayerBase player;
8443 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8444 {
8446
8447 int itemQBIndex = -1;
8448 itemQBIndex = player.FindQuickBarEntityIndex(this);
8449 ctx.
Write(itemQBIndex);
8450 }
8451 else
8452 {
8454 }
8455
8457
8459 if (raib)
8460 {
8462 }
8463 }
8464
8465
8467 {
8468 super.AfterStoreLoad();
8469
8471 {
8473 }
8474
8476 {
8479 }
8480 }
8481
8483 {
8484 super.EEOnAfterLoad();
8485
8487 {
8489 }
8490
8493 }
8494
8496 {
8497 return false;
8498 }
8499
8500
8501
8503 {
8505 {
8506 #ifdef PLATFORM_CONSOLE
8507
8509 {
8511 if (menu)
8512 {
8514 }
8515 }
8516 #endif
8517 }
8518
8520 {
8523 }
8524
8526 {
8527 SetWeightDirty();
8529 }
8531 {
8534 }
8535
8537 {
8540
8543 }
8545 {
8549 }
8550
8551 super.OnVariablesSynchronized();
8552 }
8553
8554
8555
8557 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8558 {
8559 if (!IsServerCheck(allow_client))
8560 return false;
8561
8563 return false;
8564
8567
8568 if (value <= (min + 0.001))
8569 value = min;
8570
8571 if (value == min)
8572 {
8573 if (destroy_config)
8574 {
8575 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8576 if (dstr)
8577 {
8579 this.Delete();
8580 return true;
8581 }
8582 }
8583 else if (destroy_forced)
8584 {
8586 this.Delete();
8587 return true;
8588 }
8589
8591 }
8592
8595
8597 {
8598 EntityAI parent = GetHierarchyRoot();
8599 InventoryLocation iLoc = new InventoryLocation();
8600 GetInventory().GetCurrentInventoryLocation(iLoc);
8602 {
8603 int iLocSlot = iLoc.
GetSlot();
8605 {
8607 }
8609 {
8611 }
8612 }
8613 }
8614
8616 {
8618
8619 if (delta)
8621 }
8622
8624
8625 return false;
8626 }
8627
8628
8630 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8631 {
8633 }
8634
8636 {
8639 }
8640
8642 {
8645 }
8646
8648 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8649 {
8650 float value_clamped = Math.Clamp(value, 0, 1);
8652 SetQuantity(result, destroy_config, destroy_forced);
8653 }
8654
8655
8658 {
8660 }
8661
8663 {
8665 }
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8677 {
8678 int slot = -1;
8679 GameInventory inventory = GetInventory();
8680 if (inventory)
8681 {
8682 InventoryLocation il = new InventoryLocation;
8685 }
8686
8688 }
8689
8691 {
8692 float quantity_max = 0;
8693
8695 {
8696 if (attSlotID != -1)
8697 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8698
8699 if (quantity_max <= 0)
8701 }
8702
8703 if (quantity_max <= 0)
8705
8706 return quantity_max;
8707 }
8708
8710 {
8712 }
8713
8715 {
8717 }
8718
8719
8721 {
8723 }
8724
8726 {
8728 }
8729
8731 {
8733 }
8734
8735
8737 {
8738
8739 float weightEx = GetWeightEx();
8740 float special = GetInventoryAndCargoWeight();
8741 return weightEx - special;
8742 }
8743
8744
8746 {
8748 }
8749
8751 {
8753 {
8754 #ifdef DEVELOPER
8755 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8756 {
8757 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
8759 }
8760 #endif
8761
8763 }
8764 else if (HasEnergyManager())
8765 {
8766 #ifdef DEVELOPER
8767 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8768 {
8769 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
8770 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
8771 }
8772 #endif
8773 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
8774 }
8775 else
8776 {
8777 #ifdef DEVELOPER
8778 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8779 {
8780 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
8781 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
8782 }
8783 #endif
8784 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
8785 }
8786 }
8787
8790 {
8791 int item_count = 0;
8793
8794 GameInventory inventory = GetInventory();
8795 CargoBase cargo = inventory.
GetCargo();
8796 if (cargo != NULL)
8797 {
8799 }
8800
8802 for (int i = 0; i < nAttachments; ++i)
8803 {
8805 if (item)
8806 item_count += item.GetNumberOfItems();
8807 }
8808 return item_count;
8809 }
8810
8813 {
8814 float weight = 0;
8815 float wetness = 1;
8816 if (include_wetness)
8819 {
8820 weight = wetness * m_ConfigWeight;
8821 }
8823 {
8824 weight = 1;
8825 }
8826 return weight;
8827 }
8828
8829
8830
8832 {
8833 GameInventory inventory = GetInventory();
8834 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
8835 {
8836 array<EntityAI> items = new array<EntityAI>;
8838 for (int i = 0; i < items.Count(); ++i)
8839 {
8841 if (item)
8842 {
8843 g_Game.ObjectDelete(item);
8844 }
8845 }
8846 }
8847 }
8848
8849
8850
8851
8853 {
8854 float energy = 0;
8855 if (HasEnergyManager())
8856 {
8857 energy = GetCompEM().GetEnergy();
8858 }
8859 return energy;
8860 }
8861
8862
8864 {
8865 super.OnEnergyConsumed();
8866
8868 }
8869
8871 {
8872 super.OnEnergyAdded();
8873
8875 }
8876
8877
8879 {
8880 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
8881 {
8883 {
8884 float energy_0to1 = GetCompEM().GetEnergy0To1();
8886 }
8887 }
8888 }
8889
8890
8892 {
8893 return ConfigGetFloat("heatIsolation");
8894 }
8895
8897 {
8899 }
8900
8902 {
8903 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
8904 if (
g_Game.ConfigIsExisting(paramPath))
8905 return g_Game.ConfigGetFloat(paramPath);
8906
8907 return 0.0;
8908 }
8909
8911 {
8912 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
8913 if (
g_Game.ConfigIsExisting(paramPath))
8914 return g_Game.ConfigGetFloat(paramPath);
8915
8916 return 0.0;
8917 }
8918
8919 override void SetWet(
float value,
bool allow_client =
false)
8920 {
8921 if (!IsServerCheck(allow_client))
8922 return;
8923
8926
8928
8929 m_VarWet = Math.Clamp(value, min, max);
8930
8932 {
8935 }
8936 }
8937
8938 override void AddWet(
float value)
8939 {
8941 }
8942
8944 {
8946 }
8947
8949 {
8951 }
8952
8954 {
8956 }
8957
8959 {
8961 }
8962
8964 {
8966 }
8967
8969 {
8972 if (newLevel != oldLevel)
8973 {
8975 }
8976 }
8977
8979 {
8980 SetWeightDirty();
8981 }
8982
8984 {
8985 return GetWetLevelInternal(
m_VarWet);
8986 }
8987
8988
8989
8991 {
8993 }
8994
8996 {
8998 }
8999
9001 {
9003 }
9004
9006 {
9008 }
9009
9010
9011
9013 {
9014 if (ConfigIsExisting("itemModelLength"))
9015 {
9016 return ConfigGetFloat("itemModelLength");
9017 }
9018 return 0;
9019 }
9020
9022 {
9023 if (ConfigIsExisting("itemAttachOffset"))
9024 {
9025 return ConfigGetFloat("itemAttachOffset");
9026 }
9027 return 0;
9028 }
9029
9030 override void SetCleanness(
int value,
bool allow_client =
false)
9031 {
9032 if (!IsServerCheck(allow_client))
9033 return;
9034
9036
9038
9041 }
9042
9044 {
9046 }
9047
9049 {
9050 return true;
9051 }
9052
9053
9054
9055
9057 {
9059 }
9060
9062 {
9064 }
9065
9066
9067
9068
9069 override void SetColor(
int r,
int g,
int b,
int a)
9070 {
9076 }
9078 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9079 {
9084 }
9085
9087 {
9089 }
9090
9093 {
9094 int r,g,b,a;
9096 r = r/255;
9097 g = g/255;
9098 b = b/255;
9099 a = a/255;
9100 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9101 }
9102
9103
9104
9105 override void SetLiquidType(
int value,
bool allow_client =
false)
9106 {
9107 if (!IsServerCheck(allow_client))
9108 return;
9109
9114 }
9115
9117 {
9118 return ConfigGetInt("varLiquidTypeInit");
9119 }
9120
9122 {
9124 }
9125
9127 {
9129 SetFrozen(false);
9130 }
9131
9134 {
9135 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9136 }
9137
9138
9141 {
9142 PlayerBase nplayer;
9143 if (PlayerBase.CastTo(nplayer, player))
9144 {
9146 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9147 }
9148 }
9149
9150
9153 {
9154 PlayerBase nplayer;
9155 if (PlayerBase.CastTo(nplayer,player))
9156 {
9157 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9158 }
9159
9160 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9161
9162 if (HasEnergyManager())
9163 {
9164 GetCompEM().UpdatePlugState();
9165 }
9166 }
9167
9168
9170 {
9171 super.OnPlacementStarted(player);
9172
9174 }
9175
9176 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9177 {
9179 {
9180 m_AdminLog.OnPlacementComplete(player,
this);
9181 }
9182
9183 super.OnPlacementComplete(player, position, orientation);
9184 }
9185
9186
9187
9188
9189
9191 {
9193 {
9194 return true;
9195 }
9196 else
9197 {
9198 return false;
9199 }
9200 }
9201
9202
9204 {
9206 {
9208 }
9209 }
9210
9211
9213 {
9215 }
9216
9218 {
9220 }
9221
9222 override void InsertAgent(
int agent,
float count = 1)
9223 {
9224 if (count < 1)
9225 return;
9226
9228 }
9229
9232 {
9234 }
9235
9236
9238 {
9240 }
9241
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9284 {
9286 return false;
9287 return true;
9288 }
9289
9291 {
9292
9294 }
9295
9296
9299 {
9300 super.CheckForRoofLimited(timeTresholdMS);
9301
9302 float time =
g_Game.GetTime();
9303 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9304 {
9305 m_PreviousRoofTestTime = time;
9306 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9307 }
9308 }
9309
9310
9312 {
9314 {
9315 return 0;
9316 }
9317
9318 if (GetInventory().GetAttachmentSlotsCount() != 0)
9319 {
9320 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9321 if (filter)
9322 return filter.GetProtectionLevel(type, false, system);
9323 else
9324 return 0;
9325 }
9326
9327 string subclassPath, entryName;
9328
9329 switch (type)
9330 {
9332 entryName = "biological";
9333 break;
9335 entryName = "chemical";
9336 break;
9337 default:
9338 entryName = "biological";
9339 break;
9340 }
9341
9342 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9343
9344 return g_Game.ConfigGetFloat(subclassPath + entryName);
9345 }
9346
9347
9348
9351 {
9352 if (!IsMagazine())
9354
9356 }
9357
9358
9359
9360
9361
9366 {
9367 return true;
9368 }
9369
9371 {
9373 }
9374
9375
9376
9377
9378
9380 {
9381 if (parent)
9382 {
9383 if (parent.IsInherited(DayZInfected))
9384 return true;
9385
9386 if (!parent.IsRuined())
9387 return true;
9388 }
9389
9390 return true;
9391 }
9392
9394 {
9395 if (!super.CanPutAsAttachment(parent))
9396 {
9397 return false;
9398 }
9399
9400 if (!IsRuined() && !parent.IsRuined())
9401 {
9402 return true;
9403 }
9404
9405 return false;
9406 }
9407
9409 {
9410
9411
9412
9413
9414 return super.CanReceiveItemIntoCargo(item);
9415 }
9416
9418 {
9419
9420
9421
9422
9423 GameInventory attachmentInv = attachment.GetInventory();
9425 {
9426 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9427 return false;
9428 }
9429
9430 InventoryLocation loc = new InventoryLocation();
9431 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9432 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9433 return false;
9434
9435 return super.CanReceiveAttachment(attachment, slotId);
9436 }
9437
9439 {
9440 if (!super.CanReleaseAttachment(attachment))
9441 return false;
9442
9443 return GetInventory().AreChildrenAccessible();
9444 }
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9467 {
9468 int id = muzzle_owner.GetMuzzleID();
9469 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9470
9471 if (WPOF_array)
9472 {
9473 for (int i = 0; i < WPOF_array.Count(); i++)
9474 {
9475 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9476
9477 if (WPOF)
9478 {
9479 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9480 }
9481 }
9482 }
9483 }
9484
9485
9487 {
9488 int id = muzzle_owner.GetMuzzleID();
9490
9491 if (WPOBE_array)
9492 {
9493 for (int i = 0; i < WPOBE_array.Count(); i++)
9494 {
9495 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9496
9497 if (WPOBE)
9498 {
9499 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9500 }
9501 }
9502 }
9503 }
9504
9505
9507 {
9508 int id = muzzle_owner.GetMuzzleID();
9509 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9510
9511 if (WPOOH_array)
9512 {
9513 for (int i = 0; i < WPOOH_array.Count(); i++)
9514 {
9515 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9516
9517 if (WPOOH)
9518 {
9519 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9520 }
9521 }
9522 }
9523 }
9524
9525
9527 {
9528 int id = muzzle_owner.GetMuzzleID();
9529 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9530
9531 if (WPOOH_array)
9532 {
9533 for (int i = 0; i < WPOOH_array.Count(); i++)
9534 {
9535 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9536
9537 if (WPOOH)
9538 {
9539 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9540 }
9541 }
9542 }
9543 }
9544
9545
9547 {
9548 int id = muzzle_owner.GetMuzzleID();
9549 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9550
9551 if (WPOOH_array)
9552 {
9553 for (int i = 0; i < WPOOH_array.Count(); i++)
9554 {
9555 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9556
9557 if (WPOOH)
9558 {
9559 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9560 }
9561 }
9562 }
9563 }
9564
9565
9566
9568 {
9570 {
9571 return true;
9572 }
9573
9574 return false;
9575 }
9576
9578 {
9580 {
9581 return true;
9582 }
9583
9584 return false;
9585 }
9586
9588 {
9590 {
9591 return true;
9592 }
9593
9594 return false;
9595 }
9596
9598 {
9599 return false;
9600 }
9601
9604 {
9605 return UATimeSpent.DEFAULT_DEPLOY;
9606 }
9607
9608
9609
9610
9612 {
9614 SetSynchDirty();
9615 }
9616
9618 {
9620 }
9621
9622
9624 {
9625 return false;
9626 }
9627
9630 {
9631 string att_type = "None";
9632
9633 if (ConfigIsExisting("soundAttType"))
9634 {
9635 att_type = ConfigGetString("soundAttType");
9636 }
9637
9639 }
9640
9642 {
9644 }
9645
9646
9647
9648
9649
9655
9657 {
9660
9662 }
9663
9664
9666 {
9668 return;
9669
9671
9674
9677
9678 SoundParameters params = new SoundParameters();
9682 }
9683
9684
9686 {
9688 {
9691
9692 SetSynchDirty();
9693
9696 }
9697 }
9698
9700 {
9702 }
9703
9704
9706 {
9708 return;
9709
9711 SetSynchDirty();
9712
9715 }
9716
9718 {
9721 }
9722
9724 {
9726 }
9727
9728 void OnApply(PlayerBase player);
9729
9731 {
9732 return 1.0;
9733 };
9734
9736 {
9738 }
9739
9741 {
9743 }
9744
9746
9748 {
9749 SetDynamicPhysicsLifeTime(0.01);
9751 }
9752
9754 {
9755 array<string> zone_names = new array<string>;
9756 GetDamageZones(zone_names);
9757 for (int i = 0; i < zone_names.Count(); i++)
9758 {
9759 SetHealthMax(zone_names.Get(i),"Health");
9760 }
9761 SetHealthMax("","Health");
9762 }
9763
9766 {
9767 float global_health = GetHealth01("","Health");
9768 array<string> zones = new array<string>;
9769 GetDamageZones(zones);
9770
9771 for (int i = 0; i < zones.Count(); i++)
9772 {
9773 SetHealth01(zones.Get(i),"Health",global_health);
9774 }
9775 }
9776
9779 {
9780 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
9781 }
9782
9784 {
9785 if (!hasRootAsPlayer)
9786 {
9787 if (refParentIB)
9788 {
9789
9790 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
9791 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
9792
9793 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
9794 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
9795
9798 }
9799 else
9800 {
9801
9804 }
9805 }
9806 }
9807
9809 {
9811 {
9812 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
9813 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
9814 {
9815 float heatPermCoef = 1.0;
9817 while (ent)
9818 {
9819 heatPermCoef *= ent.GetHeatPermeabilityCoef();
9820 ent = ent.GetHierarchyParent();
9821 }
9822
9823 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
9824 }
9825 }
9826 }
9827
9829 {
9830
9831 EntityAI parent = GetHierarchyParent();
9832 if (!parent)
9833 {
9834 hasParent = false;
9835 hasRootAsPlayer = false;
9836 }
9837 else
9838 {
9839 hasParent = true;
9840 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
9841 refParentIB =
ItemBase.Cast(parent);
9842 }
9843 }
9844
9845 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
9846 {
9847
9848 }
9849
9851 {
9852
9853 return false;
9854 }
9855
9857 {
9858
9859
9860 return false;
9861 }
9862
9864 {
9865
9866 return false;
9867 }
9868
9871 {
9872 return !GetIsFrozen() &&
IsOpen();
9873 }
9874
9876 {
9877 bool hasParent = false, hasRootAsPlayer = false;
9879
9880 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
9881 bool foodDecay =
g_Game.IsFoodDecayEnabled();
9882
9883 if (wwtu || foodDecay)
9884 {
9888
9889 if (processWetness || processTemperature || processDecay)
9890 {
9892
9893 if (processWetness)
9894 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
9895
9896 if (processTemperature)
9898
9899 if (processDecay)
9900 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
9901 }
9902 }
9903 }
9904
9907 {
9909 }
9910
9912 {
9915
9916 return super.GetTemperatureFreezeThreshold();
9917 }
9918
9920 {
9923
9924 return super.GetTemperatureThawThreshold();
9925 }
9926
9928 {
9931
9932 return super.GetItemOverheatThreshold();
9933 }
9934
9936 {
9938 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
9939
9940 return super.GetTemperatureFreezeTime();
9941 }
9942
9944 {
9946 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
9947
9948 return super.GetTemperatureThawTime();
9949 }
9950
9955
9957 {
9958 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
9959 }
9960
9962 {
9963 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
9964 }
9965
9968 {
9970 }
9971
9973 {
9975 }
9976
9978 {
9980 }
9981
9984 {
9985 return null;
9986 }
9987
9990 {
9991 return false;
9992 }
9993
9995 {
9997 {
10000 if (!trg)
10001 {
10003 explosive = this;
10004 }
10005
10006 explosive.PairRemote(trg);
10008
10009 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10010 trg.SetPersistentPairID(persistentID);
10011 explosive.SetPersistentPairID(persistentID);
10012
10013 return true;
10014 }
10015 return false;
10016 }
10017
10020 {
10021 float ret = 1.0;
10024 ret *= GetHealth01();
10025
10026 return ret;
10027 }
10028
10029 #ifdef DEVELOPER
10030 override void SetDebugItem()
10031 {
10032 super.SetDebugItem();
10033 _itemBase = this;
10034 }
10035
10037 {
10038 string text = super.GetDebugText();
10039
10041 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10042
10043 return text;
10044 }
10045 #endif
10046
10048 {
10049 return true;
10050 }
10051
10053
10055
10057 {
10060 }
10061
10062
10070
10086
10087 [
Obsolete(
"Use ItemSoundHandler instead")]
10090 {
10091 if (!
g_Game.IsDedicatedServer())
10092 {
10093 if (ConfigIsExisting("attachSoundSet"))
10094 {
10095 string cfg_path = "";
10096 string soundset = "";
10097 string type_name =
GetType();
10098
10101 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10102 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10103
10104 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10105 {
10106 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10107 {
10108 if (cfg_slot_array[i] == slot_type)
10109 {
10110 soundset = cfg_soundset_array[i];
10111 break;
10112 }
10113 }
10114 }
10115
10116 if (soundset != "")
10117 {
10118 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10120 }
10121 }
10122 }
10123 }
10124
10126}
10127
10129{
10131 if (entity)
10132 {
10133 bool is_item = entity.IsInherited(
ItemBase);
10134 if (is_item && full_quantity)
10135 {
10138 }
10139 }
10140 else
10141 {
10143 return NULL;
10144 }
10145 return entity;
10146}
10147
10149{
10150 if (item)
10151 {
10152 if (health > 0)
10153 item.SetHealth("", "", health);
10154
10155 if (item.CanHaveTemperature())
10156 {
10158 if (item.CanFreeze())
10159 item.SetFrozen(false);
10160 }
10161
10162 if (item.HasEnergyManager())
10163 {
10164 if (quantity >= 0)
10165 {
10166 item.GetCompEM().SetEnergy0To1(quantity);
10167 }
10168 else
10169 {
10171 }
10172 }
10173 else if (item.IsMagazine())
10174 {
10175 Magazine mag = Magazine.Cast(item);
10176 if (quantity >= 0)
10177 {
10178 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10179 }
10180 else
10181 {
10183 }
10184
10185 }
10186 else
10187 {
10188 if (quantity >= 0)
10189 {
10190 item.SetQuantityNormalized(quantity, false);
10191 }
10192 else
10193 {
10195 }
10196
10197 }
10198 }
10199}
10200
10201#ifdef DEVELOPER
10203#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.