5201{
5203 {
5204 return true;
5205 }
5206};
5207
5209{
5210
5211};
5212
5213
5214
5216{
5220
5222
5225
5226
5227
5228
5229
5238
5244
5249
5254
5275 protected bool m_IsResultOfSplit
5276
5278
5283
5284
5285
5287
5291
5292
5293
5295
5298
5299
5300
5306
5307
5315
5318
5319
5321
5322
5324
5325
5330
5331
5336
5338
5339
5341
5342
5344 {
5349
5350 if (!
g_Game.IsDedicatedServer())
5351 {
5353 {
5355
5357 {
5359 }
5360 }
5361
5364 }
5365
5366 m_OldLocation = null;
5367
5369 {
5371 }
5372
5373 if (ConfigIsExisting("headSelectionsToHide"))
5374 {
5377 }
5378
5380 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5381 {
5383 }
5384
5386
5387 m_IsResultOfSplit = false;
5388
5390 }
5391
5393 {
5394 super.InitItemVariables();
5395
5401 m_Count = ConfigGetInt(
"count");
5402
5405
5410
5413
5418
5430
5434
5435
5438 if (ConfigIsExisting("canBeSplit"))
5439 {
5442 }
5443
5445 if (ConfigIsExisting("itemBehaviour"))
5447
5448
5451 RegisterNetSyncVariableInt("m_VarLiquidType");
5452 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5453
5454 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5455 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5456 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5457
5458 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5459 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5460 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5461 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5462
5463 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5464 RegisterNetSyncVariableBool("m_IsTakeable");
5465 RegisterNetSyncVariableBool("m_IsHologram");
5466
5469 {
5472 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
5473 }
5474
5476
5478 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5480
5482 }
5483
5485 {
5487 }
5488
5490 {
5493 {
5498 }
5499 }
5500
5501 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5502 {
5504 {
5507 }
5508
5510 }
5511
5513 {
5519 }
5520
5522
5524 {
5526
5527 if (!action)
5528 {
5529 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5530 return;
5531 }
5532
5534 if (!ai)
5535 {
5537 return;
5538 }
5539
5541 if (!action_array)
5542 {
5543 action_array = new array<ActionBase_Basic>;
5545 }
5546 if (LogManager.IsActionLogEnable())
5547 {
5548 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5549 }
5550
5551 if (action_array.Find(action) != -1)
5552 {
5553 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5554 }
5555 else
5556 {
5557 action_array.Insert(action);
5558 }
5559 }
5560
5562 {
5563 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
5564 ActionBase action = player.GetActionManager().GetAction(actionName);
5567
5568 if (action_array)
5569 {
5570 action_array.RemoveItem(action);
5571 }
5572 }
5573
5574
5575
5577 {
5578 ActionOverrideData overrideData = new ActionOverrideData();
5582
5584 if (!actionMap)
5585 {
5588 }
5589
5590 actionMap.Insert(this.
Type(), overrideData);
5591
5592 }
5593
5595
5597
5598
5600 {
5603
5606
5607 string config_to_search = "CfgVehicles";
5608 string muzzle_owner_config;
5609
5611 {
5612 if (IsInherited(Weapon))
5613 config_to_search = "CfgWeapons";
5614
5615 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5616
5617 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5618
5619 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
5620
5621 if (config_OnFire_subclass_count > 0)
5622 {
5623 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5624
5625 for (int i = 0; i < config_OnFire_subclass_count; i++)
5626 {
5627 string particle_class = "";
5628 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
5629 string config_OnFire_entry = config_OnFire_class + particle_class;
5630 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5631 WPOF_array.Insert(WPOF);
5632 }
5633
5634
5636 }
5637 }
5638
5640 {
5641 config_to_search = "CfgWeapons";
5642 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5643
5644 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5645
5646 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
5647
5648 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
5649 {
5650 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
5651
5652 for (i = 0; i < config_OnBulletCasingEject_count; i++)
5653 {
5654 string particle_class2 = "";
5655 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
5656 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
5657 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
5658 WPOBE_array.Insert(WPOBE);
5659 }
5660
5661
5663 }
5664 }
5665 }
5666
5667
5669 {
5672
5674 {
5675 string config_to_search = "CfgVehicles";
5676
5677 if (IsInherited(Weapon))
5678 config_to_search = "CfgWeapons";
5679
5680 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5681 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
5682
5683 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
5684 {
5685
5687
5689 {
5691 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
5693 return;
5694 }
5695
5698
5699
5700
5701 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
5702 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
5703
5704 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
5705 {
5706 string particle_class = "";
5707 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
5708 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
5709 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
5710
5711 if (entry_type == CT_CLASS)
5712 {
5713 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
5714 WPOOH_array.Insert(WPOF);
5715 }
5716 }
5717
5718
5720 }
5721 }
5722 }
5723
5725 {
5727 }
5728
5730 {
5732 {
5734
5737
5740
5741 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5742 }
5743 }
5744
5746 {
5748 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5749
5751 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5752
5754 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5755
5757 {
5759 }
5760 }
5761
5763 {
5765 }
5766
5768 {
5771 else
5773
5775 {
5778 }
5779 else
5780 {
5783
5786 }
5787
5789 }
5790
5792 {
5794 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5795 }
5796
5798 {
5800 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5802 }
5803
5805 {
5807 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5808 }
5809
5811 {
5814
5815 OverheatingParticle OP = new OverheatingParticle();
5820
5822 }
5823
5825 {
5828
5829 return -1;
5830 }
5831
5833 {
5835 {
5838
5839 for (int i = count; i > 0; --i)
5840 {
5841 int id = i - 1;
5844
5847
5848 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
5849 {
5850 if (p)
5851 {
5854 }
5855 }
5856 }
5857 }
5858 }
5859
5861 {
5863 {
5865 {
5866 int id = i - 1;
5868
5869 if (OP)
5870 {
5872
5873 if (p)
5874 {
5876 }
5877
5878 delete OP;
5879 }
5880 }
5881
5884 }
5885 }
5886
5889 {
5890 return 0.0;
5891 }
5892
5893
5895 {
5896 return 250;
5897 }
5898
5900 {
5901 return 0;
5902 }
5903
5906 {
5908 return true;
5909
5910 return false;
5911 }
5912
5915 {
5918
5920 {
5922 }
5923 else
5924 {
5925
5927 }
5928
5930 }
5931
5938 {
5939 return -1;
5940 }
5941
5942
5943
5944
5946 {
5948 {
5949 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
5950 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
5951
5952 if (r_index >= 0)
5953 {
5954 InventoryLocation r_il = new InventoryLocation;
5955 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
5956
5957 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
5960 {
5961 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
5962 }
5964 {
5965 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
5966 }
5967
5968 }
5969
5970 player.GetHumanInventory().ClearUserReservedLocation(this);
5971 }
5972
5975 }
5976
5977
5978
5979
5981 {
5982 return ItemBase.m_DebugActionsMask;
5983 }
5984
5986 {
5987 return ItemBase.m_DebugActionsMask & mask;
5988 }
5989
5991 {
5992 ItemBase.m_DebugActionsMask = mask;
5993 }
5994
5996 {
5997 ItemBase.m_DebugActionsMask |= mask;
5998 }
5999
6001 {
6002 ItemBase.m_DebugActionsMask &= ~mask;
6003 }
6004
6006 {
6008 {
6010 }
6011 else
6012 {
6014 }
6015 }
6016
6017
6019 {
6020 if (GetEconomyProfile())
6021 {
6022 float q_max = GetEconomyProfile().GetQuantityMax();
6023 if (q_max > 0)
6024 {
6025 float q_min = GetEconomyProfile().GetQuantityMin();
6026 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6027
6029 {
6030 ComponentEnergyManager comp = GetCompEM();
6032 {
6034 }
6035 }
6037 {
6039
6040 }
6041
6042 }
6043 }
6044 }
6045
6048 {
6049 EntityAI parent = GetHierarchyParent();
6050
6051 if (parent)
6052 {
6053 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6054 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6055 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6056 }
6057 }
6058
6061 {
6062 EntityAI parent = GetHierarchyParent();
6063
6064 if (parent)
6065 {
6066 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6067 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6068 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6069 }
6070 }
6071
6073 {
6074
6075
6076
6077
6079
6081 {
6082 if (ScriptInputUserData.CanStoreInputUserData())
6083 {
6084 ScriptInputUserData ctx = new ScriptInputUserData;
6090 ctx.
Write(use_stack_max);
6093
6095 {
6096 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6097 }
6098 }
6099 }
6100 else if (!
g_Game.IsMultiplayer())
6101 {
6103 }
6104 }
6105
6107 {
6109 }
6110
6112 {
6114 }
6115
6117 {
6119 }
6120
6122 {
6123
6124 return false;
6125 }
6126
6128 {
6129 return false;
6130 }
6131
6135 {
6136 return false;
6137 }
6138
6140 {
6141 return "";
6142 }
6143
6145
6147 {
6148 return false;
6149 }
6150
6152 {
6153 return true;
6154 }
6155
6156
6157
6159 {
6160 return true;
6161 }
6162
6164 {
6165 return true;
6166 }
6167
6169 {
6170 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6172 }
6173
6175 {
6177 }
6178
6180 {
6182 if (!is_being_placed)
6184 SetSynchDirty();
6185 }
6186
6187
6189
6191 {
6193 }
6194
6196 {
6198 }
6199
6201 {
6202 return 1;
6203 }
6204
6206 {
6207 return false;
6208 }
6209
6211 {
6213 SetSynchDirty();
6214 }
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6251 {
6252 super.OnMovedInsideCargo(container);
6253
6254 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6255 }
6256
6257 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6258 {
6259 super.EEItemLocationChanged(oldLoc, newLoc);
6260
6261 PlayerBase newPlayer = null;
6262 PlayerBase oldPlayer = null;
6263
6264 if (newLoc.GetParent())
6265 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6266
6267 if (oldLoc.GetParent())
6268 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6269
6271 {
6272 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6273
6274 if (rIndex >= 0)
6275 {
6276 InventoryLocation rIl = new InventoryLocation;
6277 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6278
6279 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6282 {
6283 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6284 }
6286 {
6288 }
6289
6290 }
6291 }
6292
6294 {
6295 if (newPlayer)
6296 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6297
6298 if (newPlayer == oldPlayer)
6299 {
6300 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6301 {
6303 {
6304 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6305 {
6306 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6307 }
6308 }
6309 else
6310 {
6311 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6312 }
6313 }
6314
6315 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6316 {
6317 int type = oldLoc.GetType();
6319 {
6320 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6321 }
6323 {
6324 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6325 }
6326 }
6327 if (!m_OldLocation)
6328 {
6329 m_OldLocation = new InventoryLocation;
6330 }
6331 m_OldLocation.Copy(oldLoc);
6332 }
6333 else
6334 {
6335 if (m_OldLocation)
6336 {
6337 m_OldLocation.Reset();
6338 }
6339 }
6340
6341 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6342 }
6343 else
6344 {
6345 if (newPlayer)
6346 {
6347 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6348 if (resIndex >= 0)
6349 {
6350 InventoryLocation il = new InventoryLocation;
6351 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6353 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6356 {
6357 il.
GetParent().GetOnReleaseLock().Invoke(it);
6358 }
6360 {
6362 }
6363
6364 }
6365 }
6367 {
6368
6370 }
6371
6372 if (m_OldLocation)
6373 {
6374 m_OldLocation.Reset();
6375 }
6376 }
6377
6379 {
6380 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6381 }
6382
6384 {
6385 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6386 }
6387 }
6388
6389 override void EOnContact(IEntity other, Contact extra)
6390 {
6392 {
6393 int liquidType = -1;
6395 if (impactSpeed > 0.0)
6396 {
6398 #ifndef SERVER
6400 #else
6402 SetSynchDirty();
6403 #endif
6405 }
6406 }
6407
6408 #ifdef SERVER
6409 if (GetCompEM() && GetCompEM().IsPlugged())
6410 {
6411 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6412 GetCompEM().UnplugThis();
6413 }
6414 #endif
6415 }
6416
6418
6420 {
6422 }
6423
6425 {
6426
6427 }
6428
6430 {
6431 super.OnItemLocationChanged(old_owner, new_owner);
6432
6433 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6434 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6435
6436 if (!relatedPlayer && playerNew)
6437 relatedPlayer = playerNew;
6438
6439 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6440 {
6442 if (actionMgr)
6443 {
6444 ActionBase currentAction = actionMgr.GetRunningAction();
6445 if (currentAction)
6447 }
6448 }
6449
6450 Man ownerPlayerOld = null;
6451 Man ownerPlayerNew = null;
6452
6453 if (old_owner)
6454 {
6455 if (old_owner.
IsMan())
6456 {
6457 ownerPlayerOld = Man.Cast(old_owner);
6458 }
6459 else
6460 {
6461 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6462 }
6463 }
6464 else
6465 {
6467 {
6469
6470 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6471 {
6472 GetCompEM().UnplugThis();
6473 }
6474 }
6475 }
6476
6477 if (new_owner)
6478 {
6479 if (new_owner.
IsMan())
6480 {
6481 ownerPlayerNew = Man.Cast(new_owner);
6482 }
6483 else
6484 {
6485 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6486 }
6487 }
6488
6489 if (ownerPlayerOld != ownerPlayerNew)
6490 {
6491 if (ownerPlayerOld)
6492 {
6493 array<EntityAI> subItemsExit = new array<EntityAI>;
6495 for (int i = 0; i < subItemsExit.Count(); i++)
6496 {
6499 }
6500 }
6501
6502 if (ownerPlayerNew)
6503 {
6504 array<EntityAI> subItemsEnter = new array<EntityAI>;
6506 for (int j = 0; j < subItemsEnter.Count(); j++)
6507 {
6510 }
6511 }
6512 }
6513 else if (ownerPlayerNew != null)
6514 {
6515 PlayerBase nplayer;
6516 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6517 {
6518 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6520 for (int k = 0; k < subItemsUpdate.Count(); k++)
6521 {
6523 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6524 }
6525 }
6526 }
6527
6528 if (old_owner)
6529 old_owner.OnChildItemRemoved(this);
6530 if (new_owner)
6531 new_owner.OnChildItemReceived(this);
6532 }
6533
6534
6536 {
6537 super.EEDelete(parent);
6538 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6539 if (player)
6540 {
6542
6543 if (player.IsAlive())
6544 {
6545 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6546 if (r_index >= 0)
6547 {
6548 InventoryLocation r_il = new InventoryLocation;
6549 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6550
6551 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6554 {
6555 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6556 }
6558 {
6559 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6560 }
6561
6562 }
6563
6564 player.RemoveQuickBarEntityShortcut(this);
6565 }
6566 }
6567 }
6568
6570 {
6571 super.EEKilled(killer);
6572
6575 {
6576 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6577 {
6578 if (IsMagazine())
6579 {
6580 if (Magazine.Cast(this).GetAmmoCount() > 0)
6581 {
6583 }
6584 }
6585 else
6586 {
6588 }
6589 }
6590 }
6591 }
6592
6594 {
6595 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6596
6597 super.OnWasAttached(parent, slot_id);
6598
6601
6604 }
6605
6607 {
6608 super.OnWasDetached(parent, slot_id);
6609
6612
6615 }
6616
6618 {
6619 int idx;
6622
6623 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6624 if (inventory_slots.Count() < 1)
6625 {
6626 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6627 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6628 }
6629 else
6630 {
6631 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6632 }
6633
6634 idx = inventory_slots.Find(slot);
6635 if (idx < 0)
6636 return "";
6637
6638 return attach_types.Get(idx);
6639 }
6640
6642 {
6643 int idx = -1;
6644 string slot;
6645
6648
6649 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6650 if (inventory_slots.Count() < 1)
6651 {
6652 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6653 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6654 }
6655 else
6656 {
6657 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6658 if (detach_types.Count() < 1)
6659 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6660 }
6661
6662 for (int i = 0; i < inventory_slots.Count(); i++)
6663 {
6664 slot = inventory_slots.Get(i);
6665 }
6666
6667 if (slot != "")
6668 {
6669 if (detach_types.Count() == 1)
6670 idx = 0;
6671 else
6672 idx = inventory_slots.Find(slot);
6673 }
6674 if (idx < 0)
6675 return "";
6676
6677 return detach_types.Get(idx);
6678 }
6679
6681 {
6682
6684
6685
6686 float min_time = 1;
6687 float max_time = 3;
6688 float delay = Math.RandomFloat(min_time, max_time);
6689
6690 explode_timer.Run(delay, this, "DoAmmoExplosion");
6691 }
6692
6694 {
6695 Magazine magazine = Magazine.Cast(this);
6696 int pop_sounds_count = 6;
6697 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
6698
6699
6700 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
6701 string sound_name = pop_sounds[ sound_idx ];
6702 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
6703
6704
6705 magazine.ServerAddAmmoCount(-1);
6706
6707
6708 float min_temp_to_explode = 100;
6709
6710 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
6711 {
6713 }
6714 }
6715
6716
6717 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
6718 {
6719 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
6720
6721 const int CHANCE_DAMAGE_CARGO = 4;
6722 const int CHANCE_DAMAGE_ATTACHMENT = 1;
6723 const int CHANCE_DAMAGE_NOTHING = 2;
6724
6726 {
6727 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
6728 int chances;
6729 int rnd;
6730
6731 if (GetInventory().GetCargo())
6732 {
6733 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6734 rnd = Math.RandomInt(0,chances);
6735
6736 if (rnd < CHANCE_DAMAGE_CARGO)
6737 {
6739 }
6740 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
6741 {
6743 }
6744 }
6745 else
6746 {
6747 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6748 rnd = Math.RandomInt(0,chances);
6749
6750 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
6751 {
6753 }
6754 }
6755 }
6756 }
6757
6759 {
6760 CargoBase cargo = GetInventory().GetCargo();
6761 if (cargo)
6762 {
6764 if (item_count > 0)
6765 {
6766 int random_pick = Math.RandomInt(0, item_count);
6768 if (!item.IsExplosive())
6769 {
6770 item.AddHealth("","",damage);
6771 return true;
6772 }
6773 }
6774 }
6775 return false;
6776 }
6777
6779 {
6780 GameInventory inventory = GetInventory();
6782 if (attachment_count > 0)
6783 {
6784 int random_pick = Math.RandomInt(0, attachment_count);
6786 if (!attachment.IsExplosive())
6787 {
6788 attachment.AddHealth("","",damage);
6789 return true;
6790 }
6791 }
6792 return false;
6793 }
6794
6796 {
6798 }
6799
6801 {
6803 return GetInventory().CanRemoveEntity();
6804
6805 return false;
6806 }
6807
6809 {
6810
6812 return false;
6813
6814
6816 return false;
6817
6818
6819
6821 if (delta == 0)
6822 return false;
6823
6824
6825 return true;
6826 }
6827
6829 {
6831 {
6832 if (ScriptInputUserData.CanStoreInputUserData())
6833 {
6834 ScriptInputUserData ctx = new ScriptInputUserData;
6839 ctx.
Write(destination_entity);
6843 }
6844 }
6845 else if (!
g_Game.IsMultiplayer())
6846 {
6848 }
6849 }
6850
6852 {
6853 float split_quantity_new;
6857 InventoryLocation loc = new InventoryLocation;
6858
6859 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6860 {
6862 split_quantity_new = stack_max;
6863 else
6865
6867 {
6868 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6869 if (new_item)
6870 {
6871 new_item.SetResultOfSplit(true);
6872 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6874 new_item.
SetQuantity(split_quantity_new,
false,
true);
6875 }
6876 }
6877 }
6878 else if (destination_entity && slot_id == -1)
6879 {
6880 if (quantity > stack_max)
6881 split_quantity_new = stack_max;
6882 else
6883 split_quantity_new = quantity;
6884
6886 {
6887 GameInventory destinationInventory = destination_entity.GetInventory();
6889 {
6892 }
6893
6894 if (new_item)
6895 {
6896 new_item.SetResultOfSplit(true);
6897 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6899 new_item.
SetQuantity(split_quantity_new,
false,
true);
6900 }
6901 }
6902 }
6903 else
6904 {
6905 if (stack_max != 0)
6906 {
6908 {
6910 }
6911
6912 if (split_quantity_new == 0)
6913 {
6914 if (!
g_Game.IsMultiplayer())
6915 player.PhysicalPredictiveDropItem(this);
6916 else
6917 player.ServerDropEntity(this);
6918 return;
6919 }
6920
6922 {
6924
6925 if (new_item)
6926 {
6927 new_item.SetResultOfSplit(true);
6928 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6931 new_item.PlaceOnSurface();
6932 }
6933 }
6934 }
6935 }
6936 }
6937
6939 {
6940 float split_quantity_new;
6944 InventoryLocation loc = new InventoryLocation;
6945
6946 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6947 {
6949 split_quantity_new = stack_max;
6950 else
6952
6954 {
6955 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6956 if (new_item)
6957 {
6958 new_item.SetResultOfSplit(true);
6959 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6961 new_item.
SetQuantity(split_quantity_new,
false,
true);
6962 }
6963 }
6964 }
6965 else if (destination_entity && slot_id == -1)
6966 {
6967 if (quantity > stack_max)
6968 split_quantity_new = stack_max;
6969 else
6970 split_quantity_new = quantity;
6971
6973 {
6974 GameInventory destinationInventory = destination_entity.GetInventory();
6976 {
6979 }
6980
6981 if (new_item)
6982 {
6983 new_item.SetResultOfSplit(true);
6984 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6986 new_item.
SetQuantity(split_quantity_new,
false,
true);
6987 }
6988 }
6989 }
6990 else
6991 {
6992 if (stack_max != 0)
6993 {
6995 {
6997 }
6998
7000 {
7002
7003 if (new_item)
7004 {
7005 new_item.SetResultOfSplit(true);
7006 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7009 new_item.PlaceOnSurface();
7010 }
7011 }
7012 }
7013 }
7014 }
7015
7017 {
7019 {
7020 if (ScriptInputUserData.CanStoreInputUserData())
7021 {
7022 ScriptInputUserData ctx = new ScriptInputUserData;
7027 dst.WriteToContext(ctx);
7029 }
7030 }
7031 else if (!
g_Game.IsMultiplayer())
7032 {
7034 }
7035 }
7036
7038 {
7040 {
7041 if (ScriptInputUserData.CanStoreInputUserData())
7042 {
7043 ScriptInputUserData ctx = new ScriptInputUserData;
7048 ctx.
Write(destination_entity);
7054 }
7055 }
7056 else if (!
g_Game.IsMultiplayer())
7057 {
7059 }
7060 }
7061
7063 {
7065 }
7066
7068 {
7070 float split_quantity_new;
7072 if (dst.IsValid())
7073 {
7074 int slot_id = dst.GetSlot();
7076
7077 if (quantity > stack_max)
7078 split_quantity_new = stack_max;
7079 else
7080 split_quantity_new = quantity;
7081
7083 {
7085
7086 if (new_item)
7087 {
7088 new_item.SetResultOfSplit(true);
7089 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7091 new_item.
SetQuantity(split_quantity_new,
false,
true);
7092 }
7093
7094 return new_item;
7095 }
7096 }
7097
7098 return null;
7099 }
7100
7102 {
7104 float split_quantity_new;
7106 if (destination_entity)
7107 {
7109 if (quantity > stackable)
7110 split_quantity_new = stackable;
7111 else
7112 split_quantity_new = quantity;
7113
7115 {
7116 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7117 if (new_item)
7118 {
7119 new_item.SetResultOfSplit(true);
7120 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7122 new_item.
SetQuantity(split_quantity_new,
false,
true);
7123 }
7124 }
7125 }
7126 }
7127
7129 {
7131 {
7132 if (ScriptInputUserData.CanStoreInputUserData())
7133 {
7134 ScriptInputUserData ctx = new ScriptInputUserData;
7139 ItemBase destination_entity =
this;
7140 ctx.
Write(destination_entity);
7144 }
7145 }
7146 else if (!
g_Game.IsMultiplayer())
7147 {
7149 }
7150 }
7151
7153 {
7155 float split_quantity_new;
7157 if (player)
7158 {
7160 if (quantity > stackable)
7161 split_quantity_new = stackable;
7162 else
7163 split_quantity_new = quantity;
7164
7166 {
7167 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7168 new_item =
ItemBase.Cast(in_hands);
7169 if (new_item)
7170 {
7171 new_item.SetResultOfSplit(true);
7172 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7174 new_item.SetQuantity(split_quantity_new, false, true);
7175 }
7176 }
7177 }
7178 }
7179
7181 {
7183 float split_quantity_new = Math.Floor(quantity * 0.5);
7184
7186 return;
7187
7189
7190 if (new_item)
7191 {
7192 if (new_item.GetQuantityMax() < split_quantity_new)
7193 {
7194 split_quantity_new = new_item.GetQuantityMax();
7195 }
7196
7197 new_item.SetResultOfSplit(true);
7198 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7199
7201 {
7204 }
7205 else
7206 {
7208 new_item.
SetQuantity(split_quantity_new,
false,
true);
7209 }
7210 }
7211 }
7212
7214 {
7216 float split_quantity_new = Math.Floor(quantity / 2);
7217
7219 return;
7220
7221 InventoryLocation invloc = new InventoryLocation;
7223
7225 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7226
7227 if (new_item)
7228 {
7229 if (new_item.GetQuantityMax() < split_quantity_new)
7230 {
7231 split_quantity_new = new_item.GetQuantityMax();
7232 }
7234 {
7237 }
7238 else if (split_quantity_new > 1)
7239 {
7241 new_item.
SetQuantity(split_quantity_new,
false,
true);
7242 }
7243 }
7244 }
7245
7248 {
7249 SetWeightDirty();
7251
7252 if (parent)
7253 parent.OnAttachmentQuantityChangedEx(this, delta);
7254
7256 {
7258 {
7260 }
7262 {
7263 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7265 }
7266 }
7267 }
7268
7271 {
7272
7273 }
7274
7277 {
7279 }
7280
7282 {
7283 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7284
7286 {
7287 if (newLevel == GameConstants.STATE_RUINED)
7288 {
7290 EntityAI parent = GetHierarchyParent();
7291 if (parent && parent.IsFireplace())
7292 {
7293 CargoBase cargo = GetInventory().GetCargo();
7294 if (cargo)
7295 {
7297 {
7299 }
7300 }
7301 }
7302 }
7303
7305 {
7306
7308 return;
7309 }
7310
7311 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7312 {
7314 }
7315 }
7316 }
7317
7318
7320 {
7321 super.OnRightClick();
7322
7324 {
7326 {
7327 if (ScriptInputUserData.CanStoreInputUserData())
7328 {
7329 EntityAI root = GetHierarchyRoot();
7330 Man playerOwner = GetHierarchyRootPlayer();
7331 InventoryLocation dst = new InventoryLocation;
7332
7333
7334 if (!playerOwner && root && root == this)
7335 {
7337 }
7338 else
7339 {
7340
7341 GetInventory().GetCurrentInventoryLocation(dst);
7343 {
7344 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7346 {
7348 }
7349 else
7350 {
7352
7353
7354 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7355 {
7357 }
7358 else
7359 {
7360 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7361 }
7362 }
7363 }
7364 }
7365
7366 ScriptInputUserData ctx = new ScriptInputUserData;
7374 }
7375 }
7376 else if (!
g_Game.IsMultiplayer())
7377 {
7379 }
7380 }
7381 }
7382
7384 {
7385 if (root)
7386 {
7387 vector m4[4];
7388 root.GetTransform(m4);
7389 dst.SetGround(this, m4);
7390 }
7391 else
7392 {
7393 GetInventory().GetCurrentInventoryLocation(dst);
7394 }
7395 }
7396
7397 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7398 {
7399
7400 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7401 return false;
7402
7403 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7404 return false;
7405
7406
7408 return false;
7409
7410
7411 Magazine mag = Magazine.Cast(this);
7412 if (mag)
7413 {
7414 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7415 return false;
7416
7417 if (stack_max_limit)
7418 {
7419 Magazine other_mag = Magazine.Cast(other_item);
7420 if (other_item)
7421 {
7422 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7423 return false;
7424 }
7425
7426 }
7427 }
7428 else
7429 {
7430
7432 return false;
7433
7435 return false;
7436 }
7437
7438 PlayerBase player = null;
7439 if (CastTo(player, GetHierarchyRootPlayer()))
7440 {
7441 if (player.GetInventory().HasAttachment(this))
7442 return false;
7443
7444 if (player.IsItemsToDelete())
7445 return false;
7446 }
7447
7448 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7449 return false;
7450
7451 int slotID;
7453 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7454 return false;
7455
7456 return true;
7457 }
7458
7460 {
7462 }
7463
7465 {
7466 return m_IsResultOfSplit;
7467 }
7468
7470 {
7471 m_IsResultOfSplit = value;
7472 }
7473
7475 {
7477 }
7478
7480 {
7481 float other_item_quantity = other_item.GetQuantity();
7482 float this_free_space;
7483
7485
7487
7488 if (other_item_quantity > this_free_space)
7489 {
7490 return this_free_space;
7491 }
7492 else
7493 {
7494 return other_item_quantity;
7495 }
7496 }
7497
7499 {
7501 }
7502
7504 {
7506 return;
7507
7508 if (!IsMagazine() && other_item)
7509 {
7511 if (quantity_used != 0)
7512 {
7513 float hp1 = GetHealth01("","");
7514 float hp2 = other_item.GetHealth01("","");
7515 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7516 hpResult = hpResult / (
GetQuantity() + quantity_used);
7517
7518 hpResult *= GetMaxHealth();
7519 Math.Round(hpResult);
7520 SetHealth("", "Health", hpResult);
7521
7523 other_item.AddQuantity(-quantity_used);
7524 }
7525 }
7527 }
7528
7530 {
7531 #ifdef SERVER
7532 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7533 GetHierarchyParent().IncreaseLifetimeUp();
7534 #endif
7535 };
7536
7538 {
7539 PlayerBase p = PlayerBase.Cast(player);
7540
7541 array<int> recipesIds = p.m_Recipes;
7542 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7543 if (moduleRecipesManager)
7544 {
7545 EntityAI itemInHands = player.GetEntityInHands();
7546 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7547 }
7548
7549 for (int i = 0;i < recipesIds.Count(); i++)
7550 {
7551 int key = recipesIds.Get(i);
7552 string recipeName = moduleRecipesManager.GetRecipeName(key);
7554 }
7555 }
7556
7557
7558 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7559 {
7560 super.GetDebugActions(outputList);
7561
7562
7568
7569
7574
7579
7580
7584
7585
7587 {
7591 }
7592
7595
7596
7600
7602
7603 InventoryLocation loc = new InventoryLocation();
7604 GetInventory().GetCurrentInventoryLocation(loc);
7606 {
7607 if (Gizmo_IsSupported())
7610 }
7611
7613 }
7614
7615
7616
7617
7619 {
7620 super.OnAction(action_id, player, ctx);
7621
7623 {
7624 switch (action_id)
7625 {
7629 return true;
7633 return true;
7634 }
7635 }
7636
7638 {
7639 switch (action_id)
7640 {
7642 Delete();
7643 return true;
7644 }
7645 }
7646
7647 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
7648 {
7649 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7650 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
7651 PlayerBase p = PlayerBase.Cast(player);
7652 if (
EActions.RECIPES_RANGE_START < 1000)
7653 {
7654 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7655 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7656 }
7657 }
7658 #ifndef SERVER
7659 else if (action_id ==
EActions.WATCH_PLAYER)
7660 {
7661 PluginDeveloper.SetDeveloperItemClientEx(player);
7662 }
7663 #endif
7665 {
7666 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7667 {
7668 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7669 OnDebugButtonPressServer(id + 1);
7670 }
7671
7672 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7673 {
7674 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
7676 }
7677
7678 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
7679 {
7680 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
7682 }
7683
7684 else if (action_id ==
EActions.ADD_QUANTITY)
7685 {
7686 if (IsMagazine())
7687 {
7688 Magazine mag = Magazine.Cast(this);
7689 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
7690 }
7691 else
7692 {
7694 }
7695
7696 if (m_EM)
7697 {
7698 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
7699 }
7700
7701 }
7702
7703 else if (action_id ==
EActions.REMOVE_QUANTITY)
7704 {
7705 if (IsMagazine())
7706 {
7707 Magazine mag2 = Magazine.Cast(this);
7708 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
7709 }
7710 else
7711 {
7713 }
7714 if (m_EM)
7715 {
7716 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
7717 }
7718
7719 }
7720
7721 else if (action_id ==
EActions.SET_QUANTITY_0)
7722 {
7724
7725 if (m_EM)
7726 {
7727 m_EM.SetEnergy(0);
7728 }
7729 }
7730
7731 else if (action_id ==
EActions.SET_MAX_QUANTITY)
7732 {
7734
7735 if (m_EM)
7736 {
7737 m_EM.SetEnergy(m_EM.GetEnergyMax());
7738 }
7739 }
7740
7741 else if (action_id ==
EActions.ADD_HEALTH)
7742 {
7743 AddHealth("","",GetMaxHealth("","Health")/5);
7744 }
7745 else if (action_id ==
EActions.REMOVE_HEALTH)
7746 {
7747 AddHealth("","",-GetMaxHealth("","Health")/5);
7748 }
7749 else if (action_id ==
EActions.DESTROY_HEALTH)
7750 {
7751 SetHealth01("","",0);
7752 }
7753 else if (action_id ==
EActions.WATCH_ITEM)
7754 {
7756 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
7757 #ifdef DEVELOPER
7758 SetDebugDeveloper_item(this);
7759 #endif
7760 }
7761
7762 else if (action_id ==
EActions.ADD_TEMPERATURE)
7763 {
7764 AddTemperature(20);
7765
7766 }
7767
7768 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
7769 {
7770 AddTemperature(-20);
7771
7772 }
7773
7774 else if (action_id ==
EActions.FLIP_FROZEN)
7775 {
7776 SetFrozen(!GetIsFrozen());
7777
7778 }
7779
7780 else if (action_id ==
EActions.ADD_WETNESS)
7781 {
7783
7784 }
7785
7786 else if (action_id ==
EActions.REMOVE_WETNESS)
7787 {
7789
7790 }
7791
7792 else if (action_id ==
EActions.LIQUIDTYPE_UP)
7793 {
7796
7797
7798 }
7799
7800 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
7801 {
7804 }
7805
7806 else if (action_id ==
EActions.MAKE_SPECIAL)
7807 {
7808 auto debugParams = DebugSpawnParams.WithPlayer(player);
7809 OnDebugSpawnEx(debugParams);
7810 }
7811
7812 }
7813
7814
7815 return false;
7816 }
7817
7818
7819
7820
7824
7827
7828
7829
7831 {
7832 return false;
7833 }
7834
7835
7837 {
7838 return true;
7839 }
7840
7841
7843 {
7844 return true;
7845 }
7846
7847
7848
7850 {
7851 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
7852 return g_Game.ConfigIsExisting(config_path);
7853 }
7854
7857 {
7858 return null;
7859 }
7860
7862 {
7863 return false;
7864 }
7865
7867 {
7868 return false;
7869 }
7870
7874
7875
7877 {
7878 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7879 return module_repairing.CanRepair(this, item_repair_kit);
7880 }
7881
7882
7883 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
7884 {
7885 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7886 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
7887 }
7888
7889
7891 {
7892
7893
7894
7895
7896
7897
7898
7899
7900 return 1;
7901 }
7902
7903
7904
7906 {
7908 }
7909
7910
7911
7913 {
7915 }
7916
7917
7926 {
7927 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7928
7929 if (player)
7930 {
7931 player.MessageStatus(text);
7932 }
7933 }
7934
7935
7944 {
7945 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7946
7947 if (player)
7948 {
7949 player.MessageAction(text);
7950 }
7951 }
7952
7953
7962 {
7963 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7964
7965 if (player)
7966 {
7967 player.MessageFriendly(text);
7968 }
7969 }
7970
7971
7980 {
7981 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7982
7983 if (player)
7984 {
7985 player.MessageImportant(text);
7986 }
7987 }
7988
7990 {
7991 return true;
7992 }
7993
7994
7995 override bool KindOf(
string tag)
7996 {
7997 bool found = false;
7998 string item_name = this.
GetType();
8000 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8001
8002 int array_size = item_tag_array.Count();
8003 for (int i = 0; i < array_size; i++)
8004 {
8005 if (item_tag_array.Get(i) == tag)
8006 {
8007 found = true;
8008 break;
8009 }
8010 }
8011 return found;
8012 }
8013
8014
8016 {
8017
8018 super.OnRPC(sender, rpc_type,ctx);
8019
8020
8021 switch (rpc_type)
8022 {
8023 #ifndef SERVER
8024 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8025 Param2<bool, string> p = new Param2<bool, string>(false, "");
8026
8028 return;
8029
8030 bool play = p.param1;
8031 string soundSet = p.param2;
8032
8033 if (play)
8034 {
8036 {
8038 {
8040 }
8041 }
8042 else
8043 {
8045 }
8046 }
8047 else
8048 {
8050 }
8051
8052 break;
8053 #endif
8054
8055 }
8056
8058 {
8060 }
8061 }
8062
8063
8064
8065
8067 {
8068 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8069 return plugin.GetID(
name);
8070 }
8071
8073 {
8074 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8075 return plugin.GetName(id);
8076 }
8077
8080 {
8081
8082
8083 int varFlags;
8084 if (!ctx.
Read(varFlags))
8085 return;
8086
8087 if (varFlags & ItemVariableFlags.FLOAT)
8088 {
8090 }
8091 }
8092
8094 {
8095
8096 super.SerializeNumericalVars(floats_out);
8097
8098
8099
8101 {
8103 }
8104
8106 {
8108 }
8109
8111 {
8113 }
8114
8116 {
8121 }
8122
8124 {
8126 }
8127 }
8128
8130 {
8131
8132 super.DeSerializeNumericalVars(floats);
8133
8134
8135 int index = 0;
8136 int mask = Math.Round(floats.Get(index));
8137
8138 index++;
8139
8141 {
8143 {
8145 }
8146 else
8147 {
8148 float quantity = floats.Get(index);
8150 }
8151 index++;
8152 }
8153
8155 {
8156 float wet = floats.Get(index);
8158 index++;
8159 }
8160
8162 {
8163 int liquidtype = Math.Round(floats.Get(index));
8165 index++;
8166 }
8167
8169 {
8171 index++;
8173 index++;
8175 index++;
8177 index++;
8178 }
8179
8181 {
8182 int cleanness = Math.Round(floats.Get(index));
8184 index++;
8185 }
8186 }
8187
8189 {
8190 super.WriteVarsToCTX(ctx);
8191
8192
8194 {
8196 }
8197
8199 {
8201 }
8202
8204 {
8206 }
8207
8209 {
8210 int r,g,b,a;
8216 }
8217
8219 {
8221 }
8222 }
8223
8225 {
8226 if (!super.ReadVarsFromCTX(ctx,version))
8227 return false;
8228
8229 int intValue;
8230 float value;
8231
8232 if (version < 140)
8233 {
8234 if (!ctx.
Read(intValue))
8235 return false;
8236
8237 m_VariablesMask = intValue;
8238 }
8239
8241 {
8242 if (!ctx.
Read(value))
8243 return false;
8244
8246 {
8248 }
8249 else
8250 {
8252 }
8253 }
8254
8255 if (version < 140)
8256 {
8258 {
8259 if (!ctx.
Read(value))
8260 return false;
8261 SetTemperatureDirect(value);
8262 }
8263 }
8264
8266 {
8267 if (!ctx.
Read(value))
8268 return false;
8270 }
8271
8273 {
8274 if (!ctx.
Read(intValue))
8275 return false;
8277 }
8278
8280 {
8281 int r,g,b,a;
8283 return false;
8285 return false;
8287 return false;
8289 return false;
8290
8292 }
8293
8295 {
8296 if (!ctx.
Read(intValue))
8297 return false;
8299 }
8300
8301 if (version >= 138 && version < 140)
8302 {
8304 {
8305 if (!ctx.
Read(intValue))
8306 return false;
8307 SetFrozen(intValue);
8308 }
8309 }
8310
8311 return true;
8312 }
8313
8314
8316 {
8319 {
8321 }
8322
8323 if (!super.OnStoreLoad(ctx, version))
8324 {
8326 return false;
8327 }
8328
8329 if (version >= 114)
8330 {
8331 bool hasQuickBarIndexSaved;
8332
8333 if (!ctx.
Read(hasQuickBarIndexSaved))
8334 {
8336 return false;
8337 }
8338
8339 if (hasQuickBarIndexSaved)
8340 {
8341 int itmQBIndex;
8342
8343
8344 if (!ctx.
Read(itmQBIndex))
8345 {
8347 return false;
8348 }
8349
8350 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8351 if (itmQBIndex != -1 && parentPlayer)
8352 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8353 }
8354 }
8355 else
8356 {
8357
8358 PlayerBase player;
8359 int itemQBIndex;
8360 if (version ==
int.
MAX)
8361 {
8362 if (!ctx.
Read(itemQBIndex))
8363 {
8365 return false;
8366 }
8367 }
8368 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8369 {
8370
8371 if (!ctx.
Read(itemQBIndex))
8372 {
8374 return false;
8375 }
8376 if (itemQBIndex != -1 && player)
8377 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8378 }
8379 }
8380
8381 if (version < 140)
8382 {
8383
8384 if (!LoadVariables(ctx, version))
8385 {
8387 return false;
8388 }
8389 }
8390
8391
8393 {
8395 return false;
8396 }
8397 if (version >= 132)
8398 {
8400 if (raib)
8401 {
8403 {
8405 return false;
8406 }
8407 }
8408 }
8409
8411 return true;
8412 }
8413
8414
8415
8417 {
8418 super.OnStoreSave(ctx);
8419
8420 PlayerBase player;
8421 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8422 {
8424
8425 int itemQBIndex = -1;
8426 itemQBIndex = player.FindQuickBarEntityIndex(this);
8427 ctx.
Write(itemQBIndex);
8428 }
8429 else
8430 {
8432 }
8433
8435
8437 if (raib)
8438 {
8440 }
8441 }
8442
8443
8445 {
8446 super.AfterStoreLoad();
8447
8449 {
8451 }
8452
8454 {
8457 }
8458 }
8459
8461 {
8462 super.EEOnAfterLoad();
8463
8465 {
8467 }
8468
8471 }
8472
8474 {
8475 return false;
8476 }
8477
8478
8479
8481 {
8483 {
8484 #ifdef PLATFORM_CONSOLE
8485
8487 {
8489 if (menu)
8490 {
8492 }
8493 }
8494 #endif
8495 }
8496
8498 {
8501 }
8502
8504 {
8505 SetWeightDirty();
8507 }
8509 {
8512 }
8513
8515 {
8518
8521 }
8523 {
8527 }
8528
8529 super.OnVariablesSynchronized();
8530 }
8531
8532
8533
8535 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8536 {
8537 if (!IsServerCheck(allow_client))
8538 return false;
8539
8541 return false;
8542
8545
8546 if (value <= (min + 0.001))
8547 value = min;
8548
8549 if (value == min)
8550 {
8551 if (destroy_config)
8552 {
8553 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8554 if (dstr)
8555 {
8557 this.Delete();
8558 return true;
8559 }
8560 }
8561 else if (destroy_forced)
8562 {
8564 this.Delete();
8565 return true;
8566 }
8567
8569 }
8570
8573
8575 {
8576 EntityAI parent = GetHierarchyRoot();
8577 InventoryLocation iLoc = new InventoryLocation();
8578 GetInventory().GetCurrentInventoryLocation(iLoc);
8580 {
8581 int iLocSlot = iLoc.
GetSlot();
8583 {
8585 }
8587 {
8589 }
8590 }
8591 }
8592
8594 {
8596
8597 if (delta)
8599 }
8600
8602
8603 return false;
8604 }
8605
8606
8608 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8609 {
8611 }
8612
8614 {
8617 }
8618
8620 {
8623 }
8624
8626 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8627 {
8628 float value_clamped = Math.Clamp(value, 0, 1);
8630 SetQuantity(result, destroy_config, destroy_forced);
8631 }
8632
8633
8636 {
8638 }
8639
8641 {
8643 }
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8655 {
8656 int slot = -1;
8657 GameInventory inventory = GetInventory();
8658 if (inventory)
8659 {
8660 InventoryLocation il = new InventoryLocation;
8663 }
8664
8666 }
8667
8669 {
8670 float quantity_max = 0;
8671
8673 {
8674 if (attSlotID != -1)
8675 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8676
8677 if (quantity_max <= 0)
8679 }
8680
8681 if (quantity_max <= 0)
8683
8684 return quantity_max;
8685 }
8686
8688 {
8690 }
8691
8693 {
8695 }
8696
8697
8699 {
8701 }
8702
8704 {
8706 }
8707
8709 {
8711 }
8712
8713
8715 {
8716
8717 float weightEx = GetWeightEx();
8718 float special = GetInventoryAndCargoWeight();
8719 return weightEx - special;
8720 }
8721
8722
8724 {
8726 }
8727
8729 {
8731 {
8732 #ifdef DEVELOPER
8733 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8734 {
8735 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
8737 }
8738 #endif
8739
8741 }
8742 else if (HasEnergyManager())
8743 {
8744 #ifdef DEVELOPER
8745 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8746 {
8747 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
8748 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
8749 }
8750 #endif
8751 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
8752 }
8753 else
8754 {
8755 #ifdef DEVELOPER
8756 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8757 {
8758 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
8759 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
8760 }
8761 #endif
8762 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
8763 }
8764 }
8765
8768 {
8769 int item_count = 0;
8771
8772 GameInventory inventory = GetInventory();
8773 CargoBase cargo = inventory.
GetCargo();
8774 if (cargo != NULL)
8775 {
8777 }
8778
8780 for (int i = 0; i < nAttachments; ++i)
8781 {
8783 if (item)
8784 item_count += item.GetNumberOfItems();
8785 }
8786 return item_count;
8787 }
8788
8791 {
8792 float weight = 0;
8793 float wetness = 1;
8794 if (include_wetness)
8797 {
8798 weight = wetness * m_ConfigWeight;
8799 }
8801 {
8802 weight = 1;
8803 }
8804 return weight;
8805 }
8806
8807
8808
8810 {
8811 GameInventory inventory = GetInventory();
8812 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
8813 {
8814 array<EntityAI> items = new array<EntityAI>;
8816 for (int i = 0; i < items.Count(); ++i)
8817 {
8819 if (item)
8820 {
8821 g_Game.ObjectDelete(item);
8822 }
8823 }
8824 }
8825 }
8826
8827
8828
8829
8831 {
8832 float energy = 0;
8833 if (HasEnergyManager())
8834 {
8835 energy = GetCompEM().GetEnergy();
8836 }
8837 return energy;
8838 }
8839
8840
8842 {
8843 super.OnEnergyConsumed();
8844
8846 }
8847
8849 {
8850 super.OnEnergyAdded();
8851
8853 }
8854
8855
8857 {
8858 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
8859 {
8861 {
8862 float energy_0to1 = GetCompEM().GetEnergy0To1();
8864 }
8865 }
8866 }
8867
8868
8870 {
8871 return ConfigGetFloat("heatIsolation");
8872 }
8873
8875 {
8877 }
8878
8880 {
8881 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
8882 if (
g_Game.ConfigIsExisting(paramPath))
8883 return g_Game.ConfigGetFloat(paramPath);
8884
8885 return 0.0;
8886 }
8887
8889 {
8890 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
8891 if (
g_Game.ConfigIsExisting(paramPath))
8892 return g_Game.ConfigGetFloat(paramPath);
8893
8894 return 0.0;
8895 }
8896
8897 override void SetWet(
float value,
bool allow_client =
false)
8898 {
8899 if (!IsServerCheck(allow_client))
8900 return;
8901
8904
8906
8907 m_VarWet = Math.Clamp(value, min, max);
8908
8910 {
8913 }
8914 }
8915
8916 override void AddWet(
float value)
8917 {
8919 }
8920
8922 {
8924 }
8925
8927 {
8929 }
8930
8932 {
8934 }
8935
8937 {
8939 }
8940
8942 {
8944 }
8945
8947 {
8950 if (newLevel != oldLevel)
8951 {
8953 }
8954 }
8955
8957 {
8958 SetWeightDirty();
8959 }
8960
8962 {
8963 return GetWetLevelInternal(
m_VarWet);
8964 }
8965
8966
8967
8969 {
8971 }
8972
8974 {
8976 }
8977
8979 {
8981 }
8982
8984 {
8986 }
8987
8988
8989
8991 {
8992 if (ConfigIsExisting("itemModelLength"))
8993 {
8994 return ConfigGetFloat("itemModelLength");
8995 }
8996 return 0;
8997 }
8998
9000 {
9001 if (ConfigIsExisting("itemAttachOffset"))
9002 {
9003 return ConfigGetFloat("itemAttachOffset");
9004 }
9005 return 0;
9006 }
9007
9008 override void SetCleanness(
int value,
bool allow_client =
false)
9009 {
9010 if (!IsServerCheck(allow_client))
9011 return;
9012
9014
9016
9019 }
9020
9022 {
9024 }
9025
9027 {
9028 return true;
9029 }
9030
9031
9032
9033
9035 {
9037 }
9038
9040 {
9042 }
9043
9044
9045
9046
9047 override void SetColor(
int r,
int g,
int b,
int a)
9048 {
9054 }
9056 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9057 {
9062 }
9063
9065 {
9067 }
9068
9071 {
9072 int r,g,b,a;
9074 r = r/255;
9075 g = g/255;
9076 b = b/255;
9077 a = a/255;
9078 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9079 }
9080
9081
9082
9083 override void SetLiquidType(
int value,
bool allow_client =
false)
9084 {
9085 if (!IsServerCheck(allow_client))
9086 return;
9087
9092 }
9093
9095 {
9096 return ConfigGetInt("varLiquidTypeInit");
9097 }
9098
9100 {
9102 }
9103
9105 {
9107 SetFrozen(false);
9108 }
9109
9112 {
9113 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9114 }
9115
9116
9119 {
9120 PlayerBase nplayer;
9121 if (PlayerBase.CastTo(nplayer, player))
9122 {
9124 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9125 }
9126 }
9127
9128
9131 {
9132 PlayerBase nplayer;
9133 if (PlayerBase.CastTo(nplayer,player))
9134 {
9135 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9136 }
9137
9138 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9139
9140 if (HasEnergyManager())
9141 {
9142 GetCompEM().UpdatePlugState();
9143 }
9144 }
9145
9146
9148 {
9149 super.OnPlacementStarted(player);
9150
9152 }
9153
9154 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9155 {
9157 {
9158 m_AdminLog.OnPlacementComplete(player,
this);
9159 }
9160
9161 super.OnPlacementComplete(player, position, orientation);
9162 }
9163
9164
9165
9166
9167
9169 {
9171 {
9172 return true;
9173 }
9174 else
9175 {
9176 return false;
9177 }
9178 }
9179
9180
9182 {
9184 {
9186 }
9187 }
9188
9189
9191 {
9193 }
9194
9196 {
9198 }
9199
9200 override void InsertAgent(
int agent,
float count = 1)
9201 {
9202 if (count < 1)
9203 return;
9204
9206 }
9207
9210 {
9212 }
9213
9214
9216 {
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
9244
9245
9246
9247
9248
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9259
9260
9262 {
9264 return false;
9265 return true;
9266 }
9267
9269 {
9270
9272 }
9273
9274
9277 {
9278 super.CheckForRoofLimited(timeTresholdMS);
9279
9280 float time =
g_Game.GetTime();
9281 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9282 {
9283 m_PreviousRoofTestTime = time;
9284 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9285 }
9286 }
9287
9288
9290 {
9292 {
9293 return 0;
9294 }
9295
9296 if (GetInventory().GetAttachmentSlotsCount() != 0)
9297 {
9298 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9299 if (filter)
9300 return filter.GetProtectionLevel(type, false, system);
9301 else
9302 return 0;
9303 }
9304
9305 string subclassPath, entryName;
9306
9307 switch (type)
9308 {
9310 entryName = "biological";
9311 break;
9313 entryName = "chemical";
9314 break;
9315 default:
9316 entryName = "biological";
9317 break;
9318 }
9319
9320 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9321
9322 return g_Game.ConfigGetFloat(subclassPath + entryName);
9323 }
9324
9325
9326
9329 {
9330 if (!IsMagazine())
9332
9334 }
9335
9336
9337
9338
9339
9344 {
9345 return true;
9346 }
9347
9349 {
9351 }
9352
9353
9354
9355
9356
9358 {
9359 if (parent)
9360 {
9361 if (parent.IsInherited(DayZInfected))
9362 return true;
9363
9364 if (!parent.IsRuined())
9365 return true;
9366 }
9367
9368 return true;
9369 }
9370
9372 {
9373 if (!super.CanPutAsAttachment(parent))
9374 {
9375 return false;
9376 }
9377
9378 if (!IsRuined() && !parent.IsRuined())
9379 {
9380 return true;
9381 }
9382
9383 return false;
9384 }
9385
9387 {
9388
9389
9390
9391
9392 return super.CanReceiveItemIntoCargo(item);
9393 }
9394
9396 {
9397
9398
9399
9400
9401 GameInventory attachmentInv = attachment.GetInventory();
9403 {
9404 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9405 return false;
9406 }
9407
9408 InventoryLocation loc = new InventoryLocation();
9409 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9410 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9411 return false;
9412
9413 return super.CanReceiveAttachment(attachment, slotId);
9414 }
9415
9417 {
9418 if (!super.CanReleaseAttachment(attachment))
9419 return false;
9420
9421 return GetInventory().AreChildrenAccessible();
9422 }
9423
9424
9425
9426
9427
9428
9429
9430
9431
9432
9433
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9445 {
9446 int id = muzzle_owner.GetMuzzleID();
9447 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9448
9449 if (WPOF_array)
9450 {
9451 for (int i = 0; i < WPOF_array.Count(); i++)
9452 {
9453 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9454
9455 if (WPOF)
9456 {
9457 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9458 }
9459 }
9460 }
9461 }
9462
9463
9465 {
9466 int id = muzzle_owner.GetMuzzleID();
9468
9469 if (WPOBE_array)
9470 {
9471 for (int i = 0; i < WPOBE_array.Count(); i++)
9472 {
9473 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9474
9475 if (WPOBE)
9476 {
9477 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9478 }
9479 }
9480 }
9481 }
9482
9483
9485 {
9486 int id = muzzle_owner.GetMuzzleID();
9487 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9488
9489 if (WPOOH_array)
9490 {
9491 for (int i = 0; i < WPOOH_array.Count(); i++)
9492 {
9493 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9494
9495 if (WPOOH)
9496 {
9497 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9498 }
9499 }
9500 }
9501 }
9502
9503
9505 {
9506 int id = muzzle_owner.GetMuzzleID();
9507 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9508
9509 if (WPOOH_array)
9510 {
9511 for (int i = 0; i < WPOOH_array.Count(); i++)
9512 {
9513 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9514
9515 if (WPOOH)
9516 {
9517 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9518 }
9519 }
9520 }
9521 }
9522
9523
9525 {
9526 int id = muzzle_owner.GetMuzzleID();
9527 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9528
9529 if (WPOOH_array)
9530 {
9531 for (int i = 0; i < WPOOH_array.Count(); i++)
9532 {
9533 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9534
9535 if (WPOOH)
9536 {
9537 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9538 }
9539 }
9540 }
9541 }
9542
9543
9544
9546 {
9548 {
9549 return true;
9550 }
9551
9552 return false;
9553 }
9554
9556 {
9558 {
9559 return true;
9560 }
9561
9562 return false;
9563 }
9564
9566 {
9568 {
9569 return true;
9570 }
9571
9572 return false;
9573 }
9574
9576 {
9577 return false;
9578 }
9579
9582 {
9583 return UATimeSpent.DEFAULT_DEPLOY;
9584 }
9585
9586
9587
9588
9590 {
9592 SetSynchDirty();
9593 }
9594
9596 {
9598 }
9599
9600
9602 {
9603 return false;
9604 }
9605
9608 {
9609 string att_type = "None";
9610
9611 if (ConfigIsExisting("soundAttType"))
9612 {
9613 att_type = ConfigGetString("soundAttType");
9614 }
9615
9617 }
9618
9620 {
9622 }
9623
9624
9625
9626
9627
9633
9635 {
9638
9640 }
9641
9642
9644 {
9646 return;
9647
9649
9652
9655
9656 SoundParameters params = new SoundParameters();
9660 }
9661
9662
9664 {
9666 {
9669
9670 SetSynchDirty();
9671
9674 }
9675 }
9676
9678 {
9680 }
9681
9682
9684 {
9686 return;
9687
9689 SetSynchDirty();
9690
9693 }
9694
9696 {
9699 }
9700
9702 {
9704 }
9705
9706 void OnApply(PlayerBase player);
9707
9709 {
9710 return 1.0;
9711 };
9712
9714 {
9716 }
9717
9719 {
9721 }
9722
9724
9726 {
9727 SetDynamicPhysicsLifeTime(0.01);
9729 }
9730
9732 {
9733 array<string> zone_names = new array<string>;
9734 GetDamageZones(zone_names);
9735 for (int i = 0; i < zone_names.Count(); i++)
9736 {
9737 SetHealthMax(zone_names.Get(i),"Health");
9738 }
9739 SetHealthMax("","Health");
9740 }
9741
9744 {
9745 float global_health = GetHealth01("","Health");
9746 array<string> zones = new array<string>;
9747 GetDamageZones(zones);
9748
9749 for (int i = 0; i < zones.Count(); i++)
9750 {
9751 SetHealth01(zones.Get(i),"Health",global_health);
9752 }
9753 }
9754
9757 {
9758 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
9759 }
9760
9762 {
9763 if (!hasRootAsPlayer)
9764 {
9765 if (refParentIB)
9766 {
9767
9768 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
9769 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
9770
9771 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
9772 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
9773
9776 }
9777 else
9778 {
9779
9782 }
9783 }
9784 }
9785
9787 {
9789 {
9790 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
9791 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
9792 {
9793 float heatPermCoef = 1.0;
9795 while (ent)
9796 {
9797 heatPermCoef *= ent.GetHeatPermeabilityCoef();
9798 ent = ent.GetHierarchyParent();
9799 }
9800
9801 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
9802 }
9803 }
9804 }
9805
9807 {
9808
9809 EntityAI parent = GetHierarchyParent();
9810 if (!parent)
9811 {
9812 hasParent = false;
9813 hasRootAsPlayer = false;
9814 }
9815 else
9816 {
9817 hasParent = true;
9818 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
9819 refParentIB =
ItemBase.Cast(parent);
9820 }
9821 }
9822
9823 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
9824 {
9825
9826 }
9827
9829 {
9830
9831 return false;
9832 }
9833
9835 {
9836
9837
9838 return false;
9839 }
9840
9842 {
9843
9844 return false;
9845 }
9846
9849 {
9850 return !GetIsFrozen() &&
IsOpen();
9851 }
9852
9854 {
9855 bool hasParent = false, hasRootAsPlayer = false;
9857
9858 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
9859 bool foodDecay =
g_Game.IsFoodDecayEnabled();
9860
9861 if (wwtu || foodDecay)
9862 {
9866
9867 if (processWetness || processTemperature || processDecay)
9868 {
9870
9871 if (processWetness)
9872 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
9873
9874 if (processTemperature)
9876
9877 if (processDecay)
9878 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
9879 }
9880 }
9881 }
9882
9885 {
9887 }
9888
9890 {
9893
9894 return super.GetTemperatureFreezeThreshold();
9895 }
9896
9898 {
9901
9902 return super.GetTemperatureThawThreshold();
9903 }
9904
9906 {
9909
9910 return super.GetItemOverheatThreshold();
9911 }
9912
9914 {
9916 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
9917
9918 return super.GetTemperatureFreezeTime();
9919 }
9920
9922 {
9924 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
9925
9926 return super.GetTemperatureThawTime();
9927 }
9928
9933
9935 {
9936 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
9937 }
9938
9940 {
9941 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
9942 }
9943
9946 {
9948 }
9949
9951 {
9953 }
9954
9956 {
9958 }
9959
9962 {
9963 return null;
9964 }
9965
9968 {
9969 return false;
9970 }
9971
9973 {
9975 {
9978 if (!trg)
9979 {
9981 explosive = this;
9982 }
9983
9984 explosive.PairRemote(trg);
9986
9987 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
9988 trg.SetPersistentPairID(persistentID);
9989 explosive.SetPersistentPairID(persistentID);
9990
9991 return true;
9992 }
9993 return false;
9994 }
9995
9998 {
9999 float ret = 1.0;
10002 ret *= GetHealth01();
10003
10004 return ret;
10005 }
10006
10007 #ifdef DEVELOPER
10008 override void SetDebugItem()
10009 {
10010 super.SetDebugItem();
10011 _itemBase = this;
10012 }
10013
10015 {
10016 string text = super.GetDebugText();
10017
10019 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10020
10021 return text;
10022 }
10023 #endif
10024
10026 {
10027 return true;
10028 }
10029
10031
10033
10035 {
10038 }
10039
10040
10048
10064
10065 [
Obsolete(
"Use ItemSoundHandler instead")]
10068 {
10069 if (!
g_Game.IsDedicatedServer())
10070 {
10071 if (ConfigIsExisting("attachSoundSet"))
10072 {
10073 string cfg_path = "";
10074 string soundset = "";
10075 string type_name =
GetType();
10076
10079 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10080 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10081
10082 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10083 {
10084 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10085 {
10086 if (cfg_slot_array[i] == slot_type)
10087 {
10088 soundset = cfg_soundset_array[i];
10089 break;
10090 }
10091 }
10092 }
10093
10094 if (soundset != "")
10095 {
10096 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10098 }
10099 }
10100 }
10101 }
10102
10104}
10105
10107{
10109 if (entity)
10110 {
10111 bool is_item = entity.IsInherited(
ItemBase);
10112 if (is_item && full_quantity)
10113 {
10116 }
10117 }
10118 else
10119 {
10121 return NULL;
10122 }
10123 return entity;
10124}
10125
10127{
10128 if (item)
10129 {
10130 if (health > 0)
10131 item.SetHealth("", "", health);
10132
10133 if (item.CanHaveTemperature())
10134 {
10136 if (item.CanFreeze())
10137 item.SetFrozen(false);
10138 }
10139
10140 if (item.HasEnergyManager())
10141 {
10142 if (quantity >= 0)
10143 {
10144 item.GetCompEM().SetEnergy0To1(quantity);
10145 }
10146 else
10147 {
10149 }
10150 }
10151 else if (item.IsMagazine())
10152 {
10153 Magazine mag = Magazine.Cast(item);
10154 if (quantity >= 0)
10155 {
10156 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10157 }
10158 else
10159 {
10161 }
10162
10163 }
10164 else
10165 {
10166 if (quantity >= 0)
10167 {
10168 item.SetQuantityNormalized(quantity, false);
10169 }
10170 else
10171 {
10173 }
10174
10175 }
10176 }
10177}
10178
10179#ifdef DEVELOPER
10181#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.