5212{
5214 {
5215 return true;
5216 }
5217};
5218
5220{
5221
5222};
5223
5224
5225
5227{
5231
5233
5236
5237
5238
5239
5240
5249
5255
5260
5265
5286 protected bool m_IsResultOfSplit
5287
5289
5294
5295
5296
5298
5302
5303
5304
5306
5309
5310
5311
5317
5318
5326
5329
5330
5332
5333
5335
5336
5341
5342
5347
5349
5350
5352
5353
5355 {
5360
5361 if (!
g_Game.IsDedicatedServer())
5362 {
5364 {
5366
5368 {
5370 }
5371 }
5372
5375 }
5376
5377 m_OldLocation = null;
5378
5380 {
5382 }
5383
5384 if (ConfigIsExisting("headSelectionsToHide"))
5385 {
5388 }
5389
5391 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5392 {
5394 }
5395
5397
5398 m_IsResultOfSplit = false;
5399
5401 }
5402
5404 {
5405 super.InitItemVariables();
5406
5412 m_Count = ConfigGetInt(
"count");
5413
5416
5421
5424
5429
5441
5445
5446
5449 if (ConfigIsExisting("canBeSplit"))
5450 {
5453 }
5454
5456 if (ConfigIsExisting("itemBehaviour"))
5458
5459
5462 RegisterNetSyncVariableInt("m_VarLiquidType");
5463 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5464
5465 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5466 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5467 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5468
5469 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5470 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5471 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5472 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5473
5474 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5475 RegisterNetSyncVariableBool("m_IsTakeable");
5476 RegisterNetSyncVariableBool("m_IsHologram");
5477
5480 {
5483 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
5484 }
5485
5487
5489 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5491
5493 }
5494
5496 {
5498 }
5499
5501 {
5504 {
5509 }
5510 }
5511
5512 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5513 {
5515 {
5518 }
5519
5521 }
5522
5524 {
5530 }
5531
5533
5535 {
5537
5538 if (!action)
5539 {
5540 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5541 return;
5542 }
5543
5545 if (!ai)
5546 {
5548 return;
5549 }
5550
5552 if (!action_array)
5553 {
5554 action_array = new array<ActionBase_Basic>;
5556 }
5557 if (LogManager.IsActionLogEnable())
5558 {
5559 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5560 }
5561
5562 if (action_array.Find(action) != -1)
5563 {
5564 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5565 }
5566 else
5567 {
5568 action_array.Insert(action);
5569 }
5570 }
5571
5573 {
5574 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
5575 ActionBase action = player.GetActionManager().GetAction(actionName);
5578
5579 if (action_array)
5580 {
5581 action_array.RemoveItem(action);
5582 }
5583 }
5584
5585
5586
5588 {
5589 ActionOverrideData overrideData = new ActionOverrideData();
5593
5595 if (!actionMap)
5596 {
5599 }
5600
5601 actionMap.Insert(this.
Type(), overrideData);
5602
5603 }
5604
5606
5608
5609
5611 {
5614
5617
5618 string config_to_search = "CfgVehicles";
5619 string muzzle_owner_config;
5620
5622 {
5623 if (IsInherited(Weapon))
5624 config_to_search = "CfgWeapons";
5625
5626 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5627
5628 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5629
5630 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
5631
5632 if (config_OnFire_subclass_count > 0)
5633 {
5634 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5635
5636 for (int i = 0; i < config_OnFire_subclass_count; i++)
5637 {
5638 string particle_class = "";
5639 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
5640 string config_OnFire_entry = config_OnFire_class + particle_class;
5641 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5642 WPOF_array.Insert(WPOF);
5643 }
5644
5645
5647 }
5648 }
5649
5651 {
5652 config_to_search = "CfgWeapons";
5653 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5654
5655 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5656
5657 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
5658
5659 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
5660 {
5661 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
5662
5663 for (i = 0; i < config_OnBulletCasingEject_count; i++)
5664 {
5665 string particle_class2 = "";
5666 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
5667 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
5668 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
5669 WPOBE_array.Insert(WPOBE);
5670 }
5671
5672
5674 }
5675 }
5676 }
5677
5678
5680 {
5683
5685 {
5686 string config_to_search = "CfgVehicles";
5687
5688 if (IsInherited(Weapon))
5689 config_to_search = "CfgWeapons";
5690
5691 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5692 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
5693
5694 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
5695 {
5696
5698
5700 {
5702 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
5704 return;
5705 }
5706
5709
5710
5711
5712 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
5713 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
5714
5715 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
5716 {
5717 string particle_class = "";
5718 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
5719 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
5720 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
5721
5722 if (entry_type == CT_CLASS)
5723 {
5724 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
5725 WPOOH_array.Insert(WPOF);
5726 }
5727 }
5728
5729
5731 }
5732 }
5733 }
5734
5736 {
5738 }
5739
5741 {
5743 {
5745
5748
5751
5752 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5753 }
5754 }
5755
5757 {
5759 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5760
5762 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5763
5765 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5766
5768 {
5770 }
5771 }
5772
5774 {
5776 }
5777
5779 {
5782 else
5784
5786 {
5789 }
5790 else
5791 {
5794
5797 }
5798
5800 }
5801
5803 {
5805 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5806 }
5807
5809 {
5811 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5813 }
5814
5816 {
5818 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5819 }
5820
5822 {
5825
5826 OverheatingParticle OP = new OverheatingParticle();
5831
5833 }
5834
5836 {
5839
5840 return -1;
5841 }
5842
5844 {
5846 {
5849
5850 for (int i = count; i > 0; --i)
5851 {
5852 int id = i - 1;
5855
5858
5859 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
5860 {
5861 if (p)
5862 {
5865 }
5866 }
5867 }
5868 }
5869 }
5870
5872 {
5874 {
5876 {
5877 int id = i - 1;
5879
5880 if (OP)
5881 {
5883
5884 if (p)
5885 {
5887 }
5888
5889 delete OP;
5890 }
5891 }
5892
5895 }
5896 }
5897
5900 {
5901 return 0.0;
5902 }
5903
5904
5906 {
5907 return 250;
5908 }
5909
5911 {
5912 return 0;
5913 }
5914
5917 {
5919 return true;
5920
5921 return false;
5922 }
5923
5926 {
5929
5931 {
5933 }
5934 else
5935 {
5936
5938 }
5939
5941 }
5942
5949 {
5950 return -1;
5951 }
5952
5953
5954
5955
5957 {
5959 {
5960 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
5961 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
5962
5963 if (r_index >= 0)
5964 {
5965 InventoryLocation r_il = new InventoryLocation;
5966 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
5967
5968 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
5971 {
5972 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
5973 }
5975 {
5976 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
5977 }
5978
5979 }
5980
5981 player.GetHumanInventory().ClearUserReservedLocation(this);
5982 }
5983
5986 }
5987
5988
5989
5990
5992 {
5993 return ItemBase.m_DebugActionsMask;
5994 }
5995
5997 {
5998 return ItemBase.m_DebugActionsMask & mask;
5999 }
6000
6002 {
6003 ItemBase.m_DebugActionsMask = mask;
6004 }
6005
6007 {
6008 ItemBase.m_DebugActionsMask |= mask;
6009 }
6010
6012 {
6013 ItemBase.m_DebugActionsMask &= ~mask;
6014 }
6015
6017 {
6019 {
6021 }
6022 else
6023 {
6025 }
6026 }
6027
6028
6030 {
6031 if (GetEconomyProfile())
6032 {
6033 float q_max = GetEconomyProfile().GetQuantityMax();
6034 if (q_max > 0)
6035 {
6036 float q_min = GetEconomyProfile().GetQuantityMin();
6037 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6038
6040 {
6041 ComponentEnergyManager comp = GetCompEM();
6043 {
6045 }
6046 }
6048 {
6050
6051 }
6052
6053 }
6054 }
6055 }
6056
6059 {
6060 EntityAI parent = GetHierarchyParent();
6061
6062 if (parent)
6063 {
6064 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6065 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6066 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6067 }
6068 }
6069
6072 {
6073 EntityAI parent = GetHierarchyParent();
6074
6075 if (parent)
6076 {
6077 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6078 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6079 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6080 }
6081 }
6082
6084 {
6085
6086
6087
6088
6090
6092 {
6093 if (ScriptInputUserData.CanStoreInputUserData())
6094 {
6095 ScriptInputUserData ctx = new ScriptInputUserData;
6101 ctx.
Write(use_stack_max);
6104
6106 {
6107 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6108 }
6109 }
6110 }
6111 else if (!
g_Game.IsMultiplayer())
6112 {
6114 }
6115 }
6116
6118 {
6120 }
6121
6123 {
6125 }
6126
6128 {
6130 }
6131
6133 {
6134
6135 return false;
6136 }
6137
6139 {
6140 return false;
6141 }
6142
6146 {
6147 return false;
6148 }
6149
6151 {
6152 return "";
6153 }
6154
6156
6158 {
6159 return false;
6160 }
6161
6163 {
6164 return true;
6165 }
6166
6167
6168
6170 {
6171 return true;
6172 }
6173
6175 {
6176 return true;
6177 }
6178
6180 {
6181 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6183 }
6184
6186 {
6188 }
6189
6191 {
6193 if (!is_being_placed)
6195 SetSynchDirty();
6196 }
6197
6198
6200
6202 {
6204 }
6205
6207 {
6209 }
6210
6212 {
6213 return 1;
6214 }
6215
6217 {
6218 return false;
6219 }
6220
6222 {
6224 SetSynchDirty();
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
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6262 {
6263 super.OnMovedInsideCargo(container);
6264
6265 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6266 }
6267
6268 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6269 {
6270 super.EEItemLocationChanged(oldLoc, newLoc);
6271
6272 PlayerBase newPlayer = null;
6273 PlayerBase oldPlayer = null;
6274
6275 if (newLoc.GetParent())
6276 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6277
6278 if (oldLoc.GetParent())
6279 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6280
6282 {
6283 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6284
6285 if (rIndex >= 0)
6286 {
6287 InventoryLocation rIl = new InventoryLocation;
6288 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6289
6290 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6293 {
6294 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6295 }
6297 {
6299 }
6300
6301 }
6302 }
6303
6305 {
6306 if (newPlayer)
6307 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6308
6309 if (newPlayer == oldPlayer)
6310 {
6311 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6312 {
6314 {
6315 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6316 {
6317 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6318 }
6319 }
6320 else
6321 {
6322 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6323 }
6324 }
6325
6326 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6327 {
6328 int type = oldLoc.GetType();
6330 {
6331 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6332 }
6334 {
6335 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6336 }
6337 }
6338 if (!m_OldLocation)
6339 {
6340 m_OldLocation = new InventoryLocation;
6341 }
6342 m_OldLocation.Copy(oldLoc);
6343 }
6344 else
6345 {
6346 if (m_OldLocation)
6347 {
6348 m_OldLocation.Reset();
6349 }
6350 }
6351
6352 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6353 }
6354 else
6355 {
6356 if (newPlayer)
6357 {
6358 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6359 if (resIndex >= 0)
6360 {
6361 InventoryLocation il = new InventoryLocation;
6362 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6364 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6367 {
6368 il.
GetParent().GetOnReleaseLock().Invoke(it);
6369 }
6371 {
6373 }
6374
6375 }
6376 }
6378 {
6379
6381 }
6382
6383 if (m_OldLocation)
6384 {
6385 m_OldLocation.Reset();
6386 }
6387 }
6388
6390 {
6391 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6392 }
6393
6395 {
6396 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6397 }
6398 }
6399
6400 override void EOnContact(IEntity other, Contact extra)
6401 {
6403 {
6404 int liquidType = -1;
6406 if (impactSpeed > 0.0)
6407 {
6409 #ifndef SERVER
6411 #else
6413 SetSynchDirty();
6414 #endif
6416 }
6417 }
6418
6419 #ifdef SERVER
6420 if (GetCompEM() && GetCompEM().IsPlugged())
6421 {
6422 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6423 GetCompEM().UnplugThis();
6424 }
6425 #endif
6426 }
6427
6429
6431 {
6433 }
6434
6436 {
6437
6438 }
6439
6441 {
6442 super.OnItemLocationChanged(old_owner, new_owner);
6443
6444 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6445 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6446
6447 if (!relatedPlayer && playerNew)
6448 relatedPlayer = playerNew;
6449
6450 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6451 {
6453 if (actionMgr)
6454 {
6455 ActionBase currentAction = actionMgr.GetRunningAction();
6456 if (currentAction)
6458 }
6459 }
6460
6461 Man ownerPlayerOld = null;
6462 Man ownerPlayerNew = null;
6463
6464 if (old_owner)
6465 {
6466 if (old_owner.
IsMan())
6467 {
6468 ownerPlayerOld = Man.Cast(old_owner);
6469 }
6470 else
6471 {
6472 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6473 }
6474 }
6475 else
6476 {
6478 {
6480
6481 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6482 {
6483 GetCompEM().UnplugThis();
6484 }
6485 }
6486 }
6487
6488 if (new_owner)
6489 {
6490 if (new_owner.
IsMan())
6491 {
6492 ownerPlayerNew = Man.Cast(new_owner);
6493 }
6494 else
6495 {
6496 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6497 }
6498 }
6499
6500 if (ownerPlayerOld != ownerPlayerNew)
6501 {
6502 if (ownerPlayerOld)
6503 {
6504 array<EntityAI> subItemsExit = new array<EntityAI>;
6506 for (int i = 0; i < subItemsExit.Count(); i++)
6507 {
6510 }
6511 }
6512
6513 if (ownerPlayerNew)
6514 {
6515 array<EntityAI> subItemsEnter = new array<EntityAI>;
6517 for (int j = 0; j < subItemsEnter.Count(); j++)
6518 {
6521 }
6522 }
6523 }
6524 else if (ownerPlayerNew != null)
6525 {
6526 PlayerBase nplayer;
6527 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6528 {
6529 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6531 for (int k = 0; k < subItemsUpdate.Count(); k++)
6532 {
6534 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6535 }
6536 }
6537 }
6538
6539 if (old_owner)
6540 old_owner.OnChildItemRemoved(this);
6541 if (new_owner)
6542 new_owner.OnChildItemReceived(this);
6543 }
6544
6545
6547 {
6548 super.EEDelete(parent);
6549 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6550 if (player)
6551 {
6553
6554 if (player.IsAlive())
6555 {
6556 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6557 if (r_index >= 0)
6558 {
6559 InventoryLocation r_il = new InventoryLocation;
6560 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6561
6562 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6565 {
6566 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6567 }
6569 {
6570 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6571 }
6572
6573 }
6574
6575 player.RemoveQuickBarEntityShortcut(this);
6576 }
6577 }
6578 }
6579
6581 {
6582 super.EEKilled(killer);
6583
6586 {
6587 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6588 {
6589 if (IsMagazine())
6590 {
6591 if (Magazine.Cast(this).GetAmmoCount() > 0)
6592 {
6594 }
6595 }
6596 else
6597 {
6599 }
6600 }
6601 }
6602 }
6603
6605 {
6606 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6607
6608 super.OnWasAttached(parent, slot_id);
6609
6612
6615 }
6616
6618 {
6619 super.OnWasDetached(parent, slot_id);
6620
6623
6626 }
6627
6629 {
6630 int idx;
6633
6634 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6635 if (inventory_slots.Count() < 1)
6636 {
6637 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6638 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6639 }
6640 else
6641 {
6642 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6643 }
6644
6645 idx = inventory_slots.Find(slot);
6646 if (idx < 0)
6647 return "";
6648
6649 return attach_types.Get(idx);
6650 }
6651
6653 {
6654 int idx = -1;
6655 string slot;
6656
6659
6660 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6661 if (inventory_slots.Count() < 1)
6662 {
6663 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6664 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6665 }
6666 else
6667 {
6668 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6669 if (detach_types.Count() < 1)
6670 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6671 }
6672
6673 for (int i = 0; i < inventory_slots.Count(); i++)
6674 {
6675 slot = inventory_slots.Get(i);
6676 }
6677
6678 if (slot != "")
6679 {
6680 if (detach_types.Count() == 1)
6681 idx = 0;
6682 else
6683 idx = inventory_slots.Find(slot);
6684 }
6685 if (idx < 0)
6686 return "";
6687
6688 return detach_types.Get(idx);
6689 }
6690
6692 {
6693
6695
6696
6697 float min_time = 1;
6698 float max_time = 3;
6699 float delay = Math.RandomFloat(min_time, max_time);
6700
6701 explode_timer.Run(delay, this, "DoAmmoExplosion");
6702 }
6703
6705 {
6706 Magazine magazine = Magazine.Cast(this);
6707 int pop_sounds_count = 6;
6708 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
6709
6710
6711 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
6712 string sound_name = pop_sounds[ sound_idx ];
6713 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
6714
6715
6716 magazine.ServerAddAmmoCount(-1);
6717
6718
6719 float min_temp_to_explode = 100;
6720
6721 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
6722 {
6724 }
6725 }
6726
6727
6728 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
6729 {
6730 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
6731
6732 const int CHANCE_DAMAGE_CARGO = 4;
6733 const int CHANCE_DAMAGE_ATTACHMENT = 1;
6734 const int CHANCE_DAMAGE_NOTHING = 2;
6735
6737 {
6738 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
6739 int chances;
6740 int rnd;
6741
6742 if (GetInventory().GetCargo())
6743 {
6744 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6745 rnd = Math.RandomInt(0,chances);
6746
6747 if (rnd < CHANCE_DAMAGE_CARGO)
6748 {
6750 }
6751 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
6752 {
6754 }
6755 }
6756 else
6757 {
6758 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6759 rnd = Math.RandomInt(0,chances);
6760
6761 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
6762 {
6764 }
6765 }
6766 }
6767 }
6768
6770 {
6771 CargoBase cargo = GetInventory().GetCargo();
6772 if (cargo)
6773 {
6775 if (item_count > 0)
6776 {
6777 int random_pick = Math.RandomInt(0, item_count);
6779 if (!item.IsExplosive())
6780 {
6781 item.AddHealth("","",damage);
6782 return true;
6783 }
6784 }
6785 }
6786 return false;
6787 }
6788
6790 {
6791 GameInventory inventory = GetInventory();
6793 if (attachment_count > 0)
6794 {
6795 int random_pick = Math.RandomInt(0, attachment_count);
6797 if (!attachment.IsExplosive())
6798 {
6799 attachment.AddHealth("","",damage);
6800 return true;
6801 }
6802 }
6803 return false;
6804 }
6805
6807 {
6809 }
6810
6812 {
6814 return GetInventory().CanRemoveEntity();
6815
6816 return false;
6817 }
6818
6820 {
6821
6823 return false;
6824
6825
6827 return false;
6828
6829
6830
6832 if (delta == 0)
6833 return false;
6834
6835
6836 return true;
6837 }
6838
6840 {
6842 {
6843 if (ScriptInputUserData.CanStoreInputUserData())
6844 {
6845 ScriptInputUserData ctx = new ScriptInputUserData;
6850 ctx.
Write(destination_entity);
6854 }
6855 }
6856 else if (!
g_Game.IsMultiplayer())
6857 {
6859 }
6860 }
6861
6863 {
6864 float split_quantity_new;
6868 InventoryLocation loc = new InventoryLocation;
6869
6870 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6871 {
6873 split_quantity_new = stack_max;
6874 else
6876
6878 {
6879 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6880 if (new_item)
6881 {
6882 new_item.SetResultOfSplit(true);
6883 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6885 new_item.
SetQuantity(split_quantity_new,
false,
true);
6886 }
6887 }
6888 }
6889 else if (destination_entity && slot_id == -1)
6890 {
6891 if (quantity > stack_max)
6892 split_quantity_new = stack_max;
6893 else
6894 split_quantity_new = quantity;
6895
6897 {
6898 GameInventory destinationInventory = destination_entity.GetInventory();
6900 {
6903 }
6904
6905 if (new_item)
6906 {
6907 new_item.SetResultOfSplit(true);
6908 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6910 new_item.
SetQuantity(split_quantity_new,
false,
true);
6911 }
6912 }
6913 }
6914 else
6915 {
6916 if (stack_max != 0)
6917 {
6919 {
6921 }
6922
6923 if (split_quantity_new == 0)
6924 {
6925 if (!
g_Game.IsMultiplayer())
6926 player.PhysicalPredictiveDropItem(this);
6927 else
6928 player.ServerDropEntity(this);
6929 return;
6930 }
6931
6933 {
6935
6936 if (new_item)
6937 {
6938 new_item.SetResultOfSplit(true);
6939 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6942 new_item.PlaceOnSurface();
6943 }
6944 }
6945 }
6946 }
6947 }
6948
6950 {
6951 float split_quantity_new;
6955 InventoryLocation loc = new InventoryLocation;
6956
6957 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6958 {
6960 split_quantity_new = stack_max;
6961 else
6963
6965 {
6966 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6967 if (new_item)
6968 {
6969 new_item.SetResultOfSplit(true);
6970 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6972 new_item.
SetQuantity(split_quantity_new,
false,
true);
6973 }
6974 }
6975 }
6976 else if (destination_entity && slot_id == -1)
6977 {
6978 if (quantity > stack_max)
6979 split_quantity_new = stack_max;
6980 else
6981 split_quantity_new = quantity;
6982
6984 {
6985 GameInventory destinationInventory = destination_entity.GetInventory();
6987 {
6990 }
6991
6992 if (new_item)
6993 {
6994 new_item.SetResultOfSplit(true);
6995 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6997 new_item.
SetQuantity(split_quantity_new,
false,
true);
6998 }
6999 }
7000 }
7001 else
7002 {
7003 if (stack_max != 0)
7004 {
7006 {
7008 }
7009
7011 {
7013
7014 if (new_item)
7015 {
7016 new_item.SetResultOfSplit(true);
7017 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7020 new_item.PlaceOnSurface();
7021 }
7022 }
7023 }
7024 }
7025 }
7026
7028 {
7030 {
7031 if (ScriptInputUserData.CanStoreInputUserData())
7032 {
7033 ScriptInputUserData ctx = new ScriptInputUserData;
7038 dst.WriteToContext(ctx);
7040 }
7041 }
7042 else if (!
g_Game.IsMultiplayer())
7043 {
7045 }
7046 }
7047
7049 {
7051 {
7052 if (ScriptInputUserData.CanStoreInputUserData())
7053 {
7054 ScriptInputUserData ctx = new ScriptInputUserData;
7059 ctx.
Write(destination_entity);
7065 }
7066 }
7067 else if (!
g_Game.IsMultiplayer())
7068 {
7070 }
7071 }
7072
7074 {
7076 }
7077
7079 {
7081 float split_quantity_new;
7083 if (dst.IsValid())
7084 {
7085 int slot_id = dst.GetSlot();
7087
7088 if (quantity > stack_max)
7089 split_quantity_new = stack_max;
7090 else
7091 split_quantity_new = quantity;
7092
7094 {
7096
7097 if (new_item)
7098 {
7099 new_item.SetResultOfSplit(true);
7100 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7102 new_item.
SetQuantity(split_quantity_new,
false,
true);
7103 }
7104
7105 return new_item;
7106 }
7107 }
7108
7109 return null;
7110 }
7111
7113 {
7115 float split_quantity_new;
7117 if (destination_entity)
7118 {
7120 if (quantity > stackable)
7121 split_quantity_new = stackable;
7122 else
7123 split_quantity_new = quantity;
7124
7126 {
7127 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7128 if (new_item)
7129 {
7130 new_item.SetResultOfSplit(true);
7131 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7133 new_item.
SetQuantity(split_quantity_new,
false,
true);
7134 }
7135 }
7136 }
7137 }
7138
7140 {
7142 {
7143 if (ScriptInputUserData.CanStoreInputUserData())
7144 {
7145 ScriptInputUserData ctx = new ScriptInputUserData;
7150 ItemBase destination_entity =
this;
7151 ctx.
Write(destination_entity);
7155 }
7156 }
7157 else if (!
g_Game.IsMultiplayer())
7158 {
7160 }
7161 }
7162
7164 {
7166 float split_quantity_new;
7168 if (player)
7169 {
7171 if (quantity > stackable)
7172 split_quantity_new = stackable;
7173 else
7174 split_quantity_new = quantity;
7175
7177 {
7178 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7179 new_item =
ItemBase.Cast(in_hands);
7180 if (new_item)
7181 {
7182 new_item.SetResultOfSplit(true);
7183 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7185 new_item.SetQuantity(split_quantity_new, false, true);
7186 }
7187 }
7188 }
7189 }
7190
7192 {
7194 float split_quantity_new = Math.Floor(quantity * 0.5);
7195
7197 return;
7198
7200
7201 if (new_item)
7202 {
7203 if (new_item.GetQuantityMax() < split_quantity_new)
7204 {
7205 split_quantity_new = new_item.GetQuantityMax();
7206 }
7207
7208 new_item.SetResultOfSplit(true);
7209 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7210
7212 {
7215 }
7216 else
7217 {
7219 new_item.
SetQuantity(split_quantity_new,
false,
true);
7220 }
7221 }
7222 }
7223
7225 {
7227 float split_quantity_new = Math.Floor(quantity / 2);
7228
7230 return;
7231
7232 InventoryLocation invloc = new InventoryLocation;
7234
7236 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7237
7238 if (new_item)
7239 {
7240 if (new_item.GetQuantityMax() < split_quantity_new)
7241 {
7242 split_quantity_new = new_item.GetQuantityMax();
7243 }
7245 {
7248 }
7249 else if (split_quantity_new > 1)
7250 {
7252 new_item.
SetQuantity(split_quantity_new,
false,
true);
7253 }
7254 }
7255 }
7256
7259 {
7260 SetWeightDirty();
7262
7263 if (parent)
7264 parent.OnAttachmentQuantityChangedEx(this, delta);
7265
7267 {
7269 {
7271 }
7273 {
7274 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7276 }
7277 }
7278 }
7279
7282 {
7283
7284 }
7285
7288 {
7290 }
7291
7293 {
7294 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7295
7297 {
7298 if (newLevel == GameConstants.STATE_RUINED)
7299 {
7301 EntityAI parent = GetHierarchyParent();
7302 if (parent && parent.IsFireplace())
7303 {
7304 CargoBase cargo = GetInventory().GetCargo();
7305 if (cargo)
7306 {
7308 {
7310 }
7311 }
7312 }
7313 }
7314
7316 {
7317
7319 return;
7320 }
7321
7322 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7323 {
7325 }
7326 }
7327 }
7328
7329
7331 {
7332 super.OnRightClick();
7333
7335 {
7337 {
7338 if (ScriptInputUserData.CanStoreInputUserData())
7339 {
7340 EntityAI root = GetHierarchyRoot();
7341 Man playerOwner = GetHierarchyRootPlayer();
7342 InventoryLocation dst = new InventoryLocation;
7343
7344
7345 if (!playerOwner && root && root == this)
7346 {
7348 }
7349 else
7350 {
7351
7352 GetInventory().GetCurrentInventoryLocation(dst);
7354 {
7355 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7357 {
7359 }
7360 else
7361 {
7363
7364
7365 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7366 {
7368 }
7369 else
7370 {
7371 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7372 }
7373 }
7374 }
7375 }
7376
7377 ScriptInputUserData ctx = new ScriptInputUserData;
7385 }
7386 }
7387 else if (!
g_Game.IsMultiplayer())
7388 {
7390 }
7391 }
7392 }
7393
7395 {
7396 if (root)
7397 {
7398 vector m4[4];
7399 root.GetTransform(m4);
7400 dst.SetGround(this, m4);
7401 }
7402 else
7403 {
7404 GetInventory().GetCurrentInventoryLocation(dst);
7405 }
7406 }
7407
7408 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7409 {
7410
7411 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7412 return false;
7413
7414 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7415 return false;
7416
7417
7419 return false;
7420
7421
7422 Magazine mag = Magazine.Cast(this);
7423 if (mag)
7424 {
7425 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7426 return false;
7427
7428 if (stack_max_limit)
7429 {
7430 Magazine other_mag = Magazine.Cast(other_item);
7431 if (other_item)
7432 {
7433 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7434 return false;
7435 }
7436
7437 }
7438 }
7439 else
7440 {
7441
7443 return false;
7444
7446 return false;
7447 }
7448
7449 PlayerBase player = null;
7450 if (CastTo(player, GetHierarchyRootPlayer()))
7451 {
7452 if (player.GetInventory().HasAttachment(this))
7453 return false;
7454
7455 if (player.IsItemsToDelete())
7456 return false;
7457 }
7458
7459 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7460 return false;
7461
7462 int slotID;
7464 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7465 return false;
7466
7467 return true;
7468 }
7469
7471 {
7473 }
7474
7476 {
7477 return m_IsResultOfSplit;
7478 }
7479
7481 {
7482 m_IsResultOfSplit = value;
7483 }
7484
7486 {
7488 }
7489
7491 {
7492 float other_item_quantity = other_item.GetQuantity();
7493 float this_free_space;
7494
7496
7498
7499 if (other_item_quantity > this_free_space)
7500 {
7501 return this_free_space;
7502 }
7503 else
7504 {
7505 return other_item_quantity;
7506 }
7507 }
7508
7510 {
7512 }
7513
7515 {
7517 return;
7518
7519 if (!IsMagazine() && other_item)
7520 {
7522 if (quantity_used != 0)
7523 {
7524 float hp1 = GetHealth01("","");
7525 float hp2 = other_item.GetHealth01("","");
7526 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7527 hpResult = hpResult / (
GetQuantity() + quantity_used);
7528
7529 hpResult *= GetMaxHealth();
7530 Math.Round(hpResult);
7531 SetHealth("", "Health", hpResult);
7532
7534 other_item.AddQuantity(-quantity_used);
7535 }
7536 }
7538 }
7539
7541 {
7542 #ifdef SERVER
7543 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7544 GetHierarchyParent().IncreaseLifetimeUp();
7545 #endif
7546 };
7547
7549 {
7550 PlayerBase p = PlayerBase.Cast(player);
7551
7552 array<int> recipesIds = p.m_Recipes;
7553 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7554 if (moduleRecipesManager)
7555 {
7556 EntityAI itemInHands = player.GetEntityInHands();
7557 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7558 }
7559
7560 for (int i = 0;i < recipesIds.Count(); i++)
7561 {
7562 int key = recipesIds.Get(i);
7563 string recipeName = moduleRecipesManager.GetRecipeName(key);
7565 }
7566 }
7567
7568
7569 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7570 {
7571 super.GetDebugActions(outputList);
7572
7573
7579
7580
7585
7590
7591
7595
7596
7598 {
7602 }
7603
7606
7607
7611
7613
7614 InventoryLocation loc = new InventoryLocation();
7615 GetInventory().GetCurrentInventoryLocation(loc);
7617 {
7618 if (Gizmo_IsSupported())
7621 }
7622
7624 }
7625
7626
7627
7628
7630 {
7631 super.OnAction(action_id, player, ctx);
7632
7634 {
7635 switch (action_id)
7636 {
7640 return true;
7644 return true;
7645 }
7646 }
7647
7649 {
7650 switch (action_id)
7651 {
7653 Delete();
7654 return true;
7655 }
7656 }
7657
7658 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
7659 {
7660 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7661 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
7662 PlayerBase p = PlayerBase.Cast(player);
7663 if (
EActions.RECIPES_RANGE_START < 1000)
7664 {
7665 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7666 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7667 }
7668 }
7669 #ifndef SERVER
7670 else if (action_id ==
EActions.WATCH_PLAYER)
7671 {
7672 PluginDeveloper.SetDeveloperItemClientEx(player);
7673 }
7674 #endif
7676 {
7677 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7678 {
7679 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7680 OnDebugButtonPressServer(id + 1);
7681 }
7682
7683 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7684 {
7685 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
7687 }
7688
7689 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
7690 {
7691 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
7693 }
7694
7695 else if (action_id ==
EActions.ADD_QUANTITY)
7696 {
7697 if (IsMagazine())
7698 {
7699 Magazine mag = Magazine.Cast(this);
7700 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
7701 }
7702 else
7703 {
7705 }
7706
7707 if (m_EM)
7708 {
7709 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
7710 }
7711
7712 }
7713
7714 else if (action_id ==
EActions.REMOVE_QUANTITY)
7715 {
7716 if (IsMagazine())
7717 {
7718 Magazine mag2 = Magazine.Cast(this);
7719 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
7720 }
7721 else
7722 {
7724 }
7725 if (m_EM)
7726 {
7727 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
7728 }
7729
7730 }
7731
7732 else if (action_id ==
EActions.SET_QUANTITY_0)
7733 {
7735
7736 if (m_EM)
7737 {
7738 m_EM.SetEnergy(0);
7739 }
7740 }
7741
7742 else if (action_id ==
EActions.SET_MAX_QUANTITY)
7743 {
7745
7746 if (m_EM)
7747 {
7748 m_EM.SetEnergy(m_EM.GetEnergyMax());
7749 }
7750 }
7751
7752 else if (action_id ==
EActions.ADD_HEALTH)
7753 {
7754 AddHealth("","",GetMaxHealth("","Health")/5);
7755 }
7756 else if (action_id ==
EActions.REMOVE_HEALTH)
7757 {
7758 AddHealth("","",-GetMaxHealth("","Health")/5);
7759 }
7760 else if (action_id ==
EActions.DESTROY_HEALTH)
7761 {
7762 SetHealth01("","",0);
7763 }
7764 else if (action_id ==
EActions.WATCH_ITEM)
7765 {
7767 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
7768 #ifdef DEVELOPER
7769 SetDebugDeveloper_item(this);
7770 #endif
7771 }
7772
7773 else if (action_id ==
EActions.ADD_TEMPERATURE)
7774 {
7775 AddTemperature(20);
7776
7777 }
7778
7779 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
7780 {
7781 AddTemperature(-20);
7782
7783 }
7784
7785 else if (action_id ==
EActions.FLIP_FROZEN)
7786 {
7787 SetFrozen(!GetIsFrozen());
7788
7789 }
7790
7791 else if (action_id ==
EActions.ADD_WETNESS)
7792 {
7794
7795 }
7796
7797 else if (action_id ==
EActions.REMOVE_WETNESS)
7798 {
7800
7801 }
7802
7803 else if (action_id ==
EActions.LIQUIDTYPE_UP)
7804 {
7807
7808
7809 }
7810
7811 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
7812 {
7815 }
7816
7817 else if (action_id ==
EActions.MAKE_SPECIAL)
7818 {
7819 auto debugParams = DebugSpawnParams.WithPlayer(player);
7820 OnDebugSpawnEx(debugParams);
7821 }
7822
7823 }
7824
7825
7826 return false;
7827 }
7828
7829
7830
7831
7835
7838
7839
7840
7842 {
7843 return false;
7844 }
7845
7846
7848 {
7849 return true;
7850 }
7851
7852
7854 {
7855 return true;
7856 }
7857
7858
7859
7861 {
7862 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
7863 return g_Game.ConfigIsExisting(config_path);
7864 }
7865
7868 {
7869 return null;
7870 }
7871
7873 {
7874 return false;
7875 }
7876
7878 {
7879 return false;
7880 }
7881
7885
7886
7888 {
7889 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7890 return module_repairing.CanRepair(this, item_repair_kit);
7891 }
7892
7893
7894 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
7895 {
7896 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7897 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
7898 }
7899
7900
7902 {
7903
7904
7905
7906
7907
7908
7909
7910
7911 return 1;
7912 }
7913
7914
7915
7917 {
7919 }
7920
7921
7922
7924 {
7926 }
7927
7928
7937 {
7938 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7939
7940 if (player)
7941 {
7942 player.MessageStatus(text);
7943 }
7944 }
7945
7946
7955 {
7956 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7957
7958 if (player)
7959 {
7960 player.MessageAction(text);
7961 }
7962 }
7963
7964
7973 {
7974 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7975
7976 if (player)
7977 {
7978 player.MessageFriendly(text);
7979 }
7980 }
7981
7982
7991 {
7992 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7993
7994 if (player)
7995 {
7996 player.MessageImportant(text);
7997 }
7998 }
7999
8001 {
8002 return true;
8003 }
8004
8005
8006 override bool KindOf(
string tag)
8007 {
8008 bool found = false;
8009 string item_name = this.
GetType();
8011 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8012
8013 int array_size = item_tag_array.Count();
8014 for (int i = 0; i < array_size; i++)
8015 {
8016 if (item_tag_array.Get(i) == tag)
8017 {
8018 found = true;
8019 break;
8020 }
8021 }
8022 return found;
8023 }
8024
8025
8027 {
8028
8029 super.OnRPC(sender, rpc_type,ctx);
8030
8031
8032 switch (rpc_type)
8033 {
8034 #ifndef SERVER
8035 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8036 Param2<bool, string> p = new Param2<bool, string>(false, "");
8037
8039 return;
8040
8041 bool play = p.param1;
8042 string soundSet = p.param2;
8043
8044 if (play)
8045 {
8047 {
8049 {
8051 }
8052 }
8053 else
8054 {
8056 }
8057 }
8058 else
8059 {
8061 }
8062
8063 break;
8064 #endif
8065
8066 }
8067
8069 {
8071 }
8072 }
8073
8074
8075
8076
8078 {
8079 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8080 return plugin.GetID(
name);
8081 }
8082
8084 {
8085 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8086 return plugin.GetName(id);
8087 }
8088
8091 {
8092
8093
8094 int varFlags;
8095 if (!ctx.
Read(varFlags))
8096 return;
8097
8098 if (varFlags & ItemVariableFlags.FLOAT)
8099 {
8101 }
8102 }
8103
8105 {
8106
8107 super.SerializeNumericalVars(floats_out);
8108
8109
8110
8112 {
8114 }
8115
8117 {
8119 }
8120
8122 {
8124 }
8125
8127 {
8132 }
8133
8135 {
8137 }
8138 }
8139
8141 {
8142
8143 super.DeSerializeNumericalVars(floats);
8144
8145
8146 int index = 0;
8147 int mask = Math.Round(floats.Get(index));
8148
8149 index++;
8150
8152 {
8154 {
8156 }
8157 else
8158 {
8159 float quantity = floats.Get(index);
8161 }
8162 index++;
8163 }
8164
8166 {
8167 float wet = floats.Get(index);
8169 index++;
8170 }
8171
8173 {
8174 int liquidtype = Math.Round(floats.Get(index));
8176 index++;
8177 }
8178
8180 {
8182 index++;
8184 index++;
8186 index++;
8188 index++;
8189 }
8190
8192 {
8193 int cleanness = Math.Round(floats.Get(index));
8195 index++;
8196 }
8197 }
8198
8200 {
8201 super.WriteVarsToCTX(ctx);
8202
8203
8205 {
8207 }
8208
8210 {
8212 }
8213
8215 {
8217 }
8218
8220 {
8221 int r,g,b,a;
8227 }
8228
8230 {
8232 }
8233 }
8234
8236 {
8237 if (!super.ReadVarsFromCTX(ctx,version))
8238 return false;
8239
8240 int intValue;
8241 float value;
8242
8243 if (version < 140)
8244 {
8245 if (!ctx.
Read(intValue))
8246 return false;
8247
8248 m_VariablesMask = intValue;
8249 }
8250
8252 {
8253 if (!ctx.
Read(value))
8254 return false;
8255
8257 {
8259 }
8260 else
8261 {
8263 }
8264 }
8265
8266 if (version < 140)
8267 {
8269 {
8270 if (!ctx.
Read(value))
8271 return false;
8272 SetTemperatureDirect(value);
8273 }
8274 }
8275
8277 {
8278 if (!ctx.
Read(value))
8279 return false;
8281 }
8282
8284 {
8285 if (!ctx.
Read(intValue))
8286 return false;
8288 }
8289
8291 {
8292 int r,g,b,a;
8294 return false;
8296 return false;
8298 return false;
8300 return false;
8301
8303 }
8304
8306 {
8307 if (!ctx.
Read(intValue))
8308 return false;
8310 }
8311
8312 if (version >= 138 && version < 140)
8313 {
8315 {
8316 if (!ctx.
Read(intValue))
8317 return false;
8318 SetFrozen(intValue);
8319 }
8320 }
8321
8322 return true;
8323 }
8324
8325
8327 {
8330 {
8332 }
8333
8334 if (!super.OnStoreLoad(ctx, version))
8335 {
8337 return false;
8338 }
8339
8340 if (version >= 114)
8341 {
8342 bool hasQuickBarIndexSaved;
8343
8344 if (!ctx.
Read(hasQuickBarIndexSaved))
8345 {
8347 return false;
8348 }
8349
8350 if (hasQuickBarIndexSaved)
8351 {
8352 int itmQBIndex;
8353
8354
8355 if (!ctx.
Read(itmQBIndex))
8356 {
8358 return false;
8359 }
8360
8361 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8362 if (itmQBIndex != -1 && parentPlayer)
8363 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8364 }
8365 }
8366 else
8367 {
8368
8369 PlayerBase player;
8370 int itemQBIndex;
8371 if (version ==
int.
MAX)
8372 {
8373 if (!ctx.
Read(itemQBIndex))
8374 {
8376 return false;
8377 }
8378 }
8379 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8380 {
8381
8382 if (!ctx.
Read(itemQBIndex))
8383 {
8385 return false;
8386 }
8387 if (itemQBIndex != -1 && player)
8388 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8389 }
8390 }
8391
8392 if (version < 140)
8393 {
8394
8395 if (!LoadVariables(ctx, version))
8396 {
8398 return false;
8399 }
8400 }
8401
8402
8404 {
8406 return false;
8407 }
8408 if (version >= 132)
8409 {
8411 if (raib)
8412 {
8414 {
8416 return false;
8417 }
8418 }
8419 }
8420
8422 return true;
8423 }
8424
8425
8426
8428 {
8429 super.OnStoreSave(ctx);
8430
8431 PlayerBase player;
8432 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8433 {
8435
8436 int itemQBIndex = -1;
8437 itemQBIndex = player.FindQuickBarEntityIndex(this);
8438 ctx.
Write(itemQBIndex);
8439 }
8440 else
8441 {
8443 }
8444
8446
8448 if (raib)
8449 {
8451 }
8452 }
8453
8454
8456 {
8457 super.AfterStoreLoad();
8458
8460 {
8462 }
8463
8465 {
8468 }
8469 }
8470
8472 {
8473 super.EEOnAfterLoad();
8474
8476 {
8478 }
8479
8482 }
8483
8485 {
8486 return false;
8487 }
8488
8489
8490
8492 {
8494 {
8495 #ifdef PLATFORM_CONSOLE
8496
8498 {
8500 if (menu)
8501 {
8503 }
8504 }
8505 #endif
8506 }
8507
8509 {
8512 }
8513
8515 {
8516 SetWeightDirty();
8518 }
8520 {
8523 }
8524
8526 {
8529
8532 }
8534 {
8538 }
8539
8540 super.OnVariablesSynchronized();
8541 }
8542
8543
8544
8546 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8547 {
8548 if (!IsServerCheck(allow_client))
8549 return false;
8550
8552 return false;
8553
8556
8557 if (value <= (min + 0.001))
8558 value = min;
8559
8560 if (value == min)
8561 {
8562 if (destroy_config)
8563 {
8564 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8565 if (dstr)
8566 {
8568 this.Delete();
8569 return true;
8570 }
8571 }
8572 else if (destroy_forced)
8573 {
8575 this.Delete();
8576 return true;
8577 }
8578
8580 }
8581
8584
8586 {
8587 EntityAI parent = GetHierarchyRoot();
8588 InventoryLocation iLoc = new InventoryLocation();
8589 GetInventory().GetCurrentInventoryLocation(iLoc);
8591 {
8592 int iLocSlot = iLoc.
GetSlot();
8594 {
8596 }
8598 {
8600 }
8601 }
8602 }
8603
8605 {
8607
8608 if (delta)
8610 }
8611
8613
8614 return false;
8615 }
8616
8617
8619 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8620 {
8622 }
8623
8625 {
8628 }
8629
8631 {
8634 }
8635
8637 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8638 {
8639 float value_clamped = Math.Clamp(value, 0, 1);
8641 SetQuantity(result, destroy_config, destroy_forced);
8642 }
8643
8644
8647 {
8649 }
8650
8652 {
8654 }
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8666 {
8667 int slot = -1;
8668 GameInventory inventory = GetInventory();
8669 if (inventory)
8670 {
8671 InventoryLocation il = new InventoryLocation;
8674 }
8675
8677 }
8678
8680 {
8681 float quantity_max = 0;
8682
8684 {
8685 if (attSlotID != -1)
8686 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8687
8688 if (quantity_max <= 0)
8690 }
8691
8692 if (quantity_max <= 0)
8694
8695 return quantity_max;
8696 }
8697
8699 {
8701 }
8702
8704 {
8706 }
8707
8708
8710 {
8712 }
8713
8715 {
8717 }
8718
8720 {
8722 }
8723
8724
8726 {
8727
8728 float weightEx = GetWeightEx();
8729 float special = GetInventoryAndCargoWeight();
8730 return weightEx - special;
8731 }
8732
8733
8735 {
8737 }
8738
8740 {
8742 {
8743 #ifdef DEVELOPER
8744 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8745 {
8746 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
8748 }
8749 #endif
8750
8752 }
8753 else if (HasEnergyManager())
8754 {
8755 #ifdef DEVELOPER
8756 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8757 {
8758 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
8759 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
8760 }
8761 #endif
8762 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
8763 }
8764 else
8765 {
8766 #ifdef DEVELOPER
8767 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8768 {
8769 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
8770 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
8771 }
8772 #endif
8773 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
8774 }
8775 }
8776
8779 {
8780 int item_count = 0;
8782
8783 GameInventory inventory = GetInventory();
8784 CargoBase cargo = inventory.
GetCargo();
8785 if (cargo != NULL)
8786 {
8788 }
8789
8791 for (int i = 0; i < nAttachments; ++i)
8792 {
8794 if (item)
8795 item_count += item.GetNumberOfItems();
8796 }
8797 return item_count;
8798 }
8799
8802 {
8803 float weight = 0;
8804 float wetness = 1;
8805 if (include_wetness)
8808 {
8809 weight = wetness * m_ConfigWeight;
8810 }
8812 {
8813 weight = 1;
8814 }
8815 return weight;
8816 }
8817
8818
8819
8821 {
8822 GameInventory inventory = GetInventory();
8823 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
8824 {
8825 array<EntityAI> items = new array<EntityAI>;
8827 for (int i = 0; i < items.Count(); ++i)
8828 {
8830 if (item)
8831 {
8832 g_Game.ObjectDelete(item);
8833 }
8834 }
8835 }
8836 }
8837
8838
8839
8840
8842 {
8843 float energy = 0;
8844 if (HasEnergyManager())
8845 {
8846 energy = GetCompEM().GetEnergy();
8847 }
8848 return energy;
8849 }
8850
8851
8853 {
8854 super.OnEnergyConsumed();
8855
8857 }
8858
8860 {
8861 super.OnEnergyAdded();
8862
8864 }
8865
8866
8868 {
8869 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
8870 {
8872 {
8873 float energy_0to1 = GetCompEM().GetEnergy0To1();
8875 }
8876 }
8877 }
8878
8879
8881 {
8882 return ConfigGetFloat("heatIsolation");
8883 }
8884
8886 {
8888 }
8889
8891 {
8892 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
8893 if (
g_Game.ConfigIsExisting(paramPath))
8894 return g_Game.ConfigGetFloat(paramPath);
8895
8896 return 0.0;
8897 }
8898
8900 {
8901 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
8902 if (
g_Game.ConfigIsExisting(paramPath))
8903 return g_Game.ConfigGetFloat(paramPath);
8904
8905 return 0.0;
8906 }
8907
8908 override void SetWet(
float value,
bool allow_client =
false)
8909 {
8910 if (!IsServerCheck(allow_client))
8911 return;
8912
8915
8917
8918 m_VarWet = Math.Clamp(value, min, max);
8919
8921 {
8924 }
8925 }
8926
8927 override void AddWet(
float value)
8928 {
8930 }
8931
8933 {
8935 }
8936
8938 {
8940 }
8941
8943 {
8945 }
8946
8948 {
8950 }
8951
8953 {
8955 }
8956
8958 {
8961 if (newLevel != oldLevel)
8962 {
8964 }
8965 }
8966
8968 {
8969 SetWeightDirty();
8970 }
8971
8973 {
8974 return GetWetLevelInternal(
m_VarWet);
8975 }
8976
8977
8978
8980 {
8982 }
8983
8985 {
8987 }
8988
8990 {
8992 }
8993
8995 {
8997 }
8998
8999
9000
9002 {
9003 if (ConfigIsExisting("itemModelLength"))
9004 {
9005 return ConfigGetFloat("itemModelLength");
9006 }
9007 return 0;
9008 }
9009
9011 {
9012 if (ConfigIsExisting("itemAttachOffset"))
9013 {
9014 return ConfigGetFloat("itemAttachOffset");
9015 }
9016 return 0;
9017 }
9018
9019 override void SetCleanness(
int value,
bool allow_client =
false)
9020 {
9021 if (!IsServerCheck(allow_client))
9022 return;
9023
9025
9027
9030 }
9031
9033 {
9035 }
9036
9038 {
9039 return true;
9040 }
9041
9042
9043
9044
9046 {
9048 }
9049
9051 {
9053 }
9054
9055
9056
9057
9058 override void SetColor(
int r,
int g,
int b,
int a)
9059 {
9065 }
9067 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9068 {
9073 }
9074
9076 {
9078 }
9079
9082 {
9083 int r,g,b,a;
9085 r = r/255;
9086 g = g/255;
9087 b = b/255;
9088 a = a/255;
9089 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9090 }
9091
9092
9093
9094 override void SetLiquidType(
int value,
bool allow_client =
false)
9095 {
9096 if (!IsServerCheck(allow_client))
9097 return;
9098
9103 }
9104
9106 {
9107 return ConfigGetInt("varLiquidTypeInit");
9108 }
9109
9111 {
9113 }
9114
9116 {
9118 SetFrozen(false);
9119 }
9120
9123 {
9124 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9125 }
9126
9127
9130 {
9131 PlayerBase nplayer;
9132 if (PlayerBase.CastTo(nplayer, player))
9133 {
9135 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9136 }
9137 }
9138
9139
9142 {
9143 PlayerBase nplayer;
9144 if (PlayerBase.CastTo(nplayer,player))
9145 {
9146 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9147 }
9148
9149 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9150
9151 if (HasEnergyManager())
9152 {
9153 GetCompEM().UpdatePlugState();
9154 }
9155 }
9156
9157
9159 {
9160 super.OnPlacementStarted(player);
9161
9163 }
9164
9165 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9166 {
9168 {
9169 m_AdminLog.OnPlacementComplete(player,
this);
9170 }
9171
9172 super.OnPlacementComplete(player, position, orientation);
9173 }
9174
9175
9176
9177
9178
9180 {
9182 {
9183 return true;
9184 }
9185 else
9186 {
9187 return false;
9188 }
9189 }
9190
9191
9193 {
9195 {
9197 }
9198 }
9199
9200
9202 {
9204 }
9205
9207 {
9209 }
9210
9211 override void InsertAgent(
int agent,
float count = 1)
9212 {
9213 if (count < 1)
9214 return;
9215
9217 }
9218
9221 {
9223 }
9224
9225
9227 {
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
9261
9262
9263
9264
9265
9266
9267
9268
9269
9270
9271
9273 {
9275 return false;
9276 return true;
9277 }
9278
9280 {
9281
9283 }
9284
9285
9288 {
9289 super.CheckForRoofLimited(timeTresholdMS);
9290
9291 float time =
g_Game.GetTime();
9292 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9293 {
9294 m_PreviousRoofTestTime = time;
9295 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9296 }
9297 }
9298
9299
9301 {
9303 {
9304 return 0;
9305 }
9306
9307 if (GetInventory().GetAttachmentSlotsCount() != 0)
9308 {
9309 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9310 if (filter)
9311 return filter.GetProtectionLevel(type, false, system);
9312 else
9313 return 0;
9314 }
9315
9316 string subclassPath, entryName;
9317
9318 switch (type)
9319 {
9321 entryName = "biological";
9322 break;
9324 entryName = "chemical";
9325 break;
9326 default:
9327 entryName = "biological";
9328 break;
9329 }
9330
9331 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9332
9333 return g_Game.ConfigGetFloat(subclassPath + entryName);
9334 }
9335
9336
9337
9340 {
9341 if (!IsMagazine())
9343
9345 }
9346
9347
9348
9349
9350
9355 {
9356 return true;
9357 }
9358
9360 {
9362 }
9363
9364
9365
9366
9367
9369 {
9370 if (parent)
9371 {
9372 if (parent.IsInherited(DayZInfected))
9373 return true;
9374
9375 if (!parent.IsRuined())
9376 return true;
9377 }
9378
9379 return true;
9380 }
9381
9383 {
9384 if (!super.CanPutAsAttachment(parent))
9385 {
9386 return false;
9387 }
9388
9389 if (!IsRuined() && !parent.IsRuined())
9390 {
9391 return true;
9392 }
9393
9394 return false;
9395 }
9396
9398 {
9399
9400
9401
9402
9403 return super.CanReceiveItemIntoCargo(item);
9404 }
9405
9407 {
9408
9409
9410
9411
9412 GameInventory attachmentInv = attachment.GetInventory();
9414 {
9415 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9416 return false;
9417 }
9418
9419 InventoryLocation loc = new InventoryLocation();
9420 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9421 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9422 return false;
9423
9424 return super.CanReceiveAttachment(attachment, slotId);
9425 }
9426
9428 {
9429 if (!super.CanReleaseAttachment(attachment))
9430 return false;
9431
9432 return GetInventory().AreChildrenAccessible();
9433 }
9434
9435
9436
9437
9438
9439
9440
9441
9442
9443
9444
9445
9446
9447
9448
9449
9450
9451
9452
9453
9454
9456 {
9457 int id = muzzle_owner.GetMuzzleID();
9458 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9459
9460 if (WPOF_array)
9461 {
9462 for (int i = 0; i < WPOF_array.Count(); i++)
9463 {
9464 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9465
9466 if (WPOF)
9467 {
9468 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9469 }
9470 }
9471 }
9472 }
9473
9474
9476 {
9477 int id = muzzle_owner.GetMuzzleID();
9479
9480 if (WPOBE_array)
9481 {
9482 for (int i = 0; i < WPOBE_array.Count(); i++)
9483 {
9484 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9485
9486 if (WPOBE)
9487 {
9488 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9489 }
9490 }
9491 }
9492 }
9493
9494
9496 {
9497 int id = muzzle_owner.GetMuzzleID();
9498 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9499
9500 if (WPOOH_array)
9501 {
9502 for (int i = 0; i < WPOOH_array.Count(); i++)
9503 {
9504 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9505
9506 if (WPOOH)
9507 {
9508 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9509 }
9510 }
9511 }
9512 }
9513
9514
9516 {
9517 int id = muzzle_owner.GetMuzzleID();
9518 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9519
9520 if (WPOOH_array)
9521 {
9522 for (int i = 0; i < WPOOH_array.Count(); i++)
9523 {
9524 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9525
9526 if (WPOOH)
9527 {
9528 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9529 }
9530 }
9531 }
9532 }
9533
9534
9536 {
9537 int id = muzzle_owner.GetMuzzleID();
9538 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9539
9540 if (WPOOH_array)
9541 {
9542 for (int i = 0; i < WPOOH_array.Count(); i++)
9543 {
9544 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9545
9546 if (WPOOH)
9547 {
9548 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9549 }
9550 }
9551 }
9552 }
9553
9554
9555
9557 {
9559 {
9560 return true;
9561 }
9562
9563 return false;
9564 }
9565
9567 {
9569 {
9570 return true;
9571 }
9572
9573 return false;
9574 }
9575
9577 {
9579 {
9580 return true;
9581 }
9582
9583 return false;
9584 }
9585
9587 {
9588 return false;
9589 }
9590
9593 {
9594 return UATimeSpent.DEFAULT_DEPLOY;
9595 }
9596
9597
9598
9599
9601 {
9603 SetSynchDirty();
9604 }
9605
9607 {
9609 }
9610
9611
9613 {
9614 return false;
9615 }
9616
9619 {
9620 string att_type = "None";
9621
9622 if (ConfigIsExisting("soundAttType"))
9623 {
9624 att_type = ConfigGetString("soundAttType");
9625 }
9626
9628 }
9629
9631 {
9633 }
9634
9635
9636
9637
9638
9644
9646 {
9649
9651 }
9652
9653
9655 {
9657 return;
9658
9660
9663
9666
9667 SoundParameters params = new SoundParameters();
9671 }
9672
9673
9675 {
9677 {
9680
9681 SetSynchDirty();
9682
9685 }
9686 }
9687
9689 {
9691 }
9692
9693
9695 {
9697 return;
9698
9700 SetSynchDirty();
9701
9704 }
9705
9707 {
9710 }
9711
9713 {
9715 }
9716
9717 void OnApply(PlayerBase player);
9718
9720 {
9721 return 1.0;
9722 };
9723
9725 {
9727 }
9728
9730 {
9732 }
9733
9735
9737 {
9738 SetDynamicPhysicsLifeTime(0.01);
9740 }
9741
9743 {
9744 array<string> zone_names = new array<string>;
9745 GetDamageZones(zone_names);
9746 for (int i = 0; i < zone_names.Count(); i++)
9747 {
9748 SetHealthMax(zone_names.Get(i),"Health");
9749 }
9750 SetHealthMax("","Health");
9751 }
9752
9755 {
9756 float global_health = GetHealth01("","Health");
9757 array<string> zones = new array<string>;
9758 GetDamageZones(zones);
9759
9760 for (int i = 0; i < zones.Count(); i++)
9761 {
9762 SetHealth01(zones.Get(i),"Health",global_health);
9763 }
9764 }
9765
9768 {
9769 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
9770 }
9771
9773 {
9774 if (!hasRootAsPlayer)
9775 {
9776 if (refParentIB)
9777 {
9778
9779 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
9780 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
9781
9782 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
9783 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
9784
9787 }
9788 else
9789 {
9790
9793 }
9794 }
9795 }
9796
9798 {
9800 {
9801 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
9802 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
9803 {
9804 float heatPermCoef = 1.0;
9806 while (ent)
9807 {
9808 heatPermCoef *= ent.GetHeatPermeabilityCoef();
9809 ent = ent.GetHierarchyParent();
9810 }
9811
9812 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
9813 }
9814 }
9815 }
9816
9818 {
9819
9820 EntityAI parent = GetHierarchyParent();
9821 if (!parent)
9822 {
9823 hasParent = false;
9824 hasRootAsPlayer = false;
9825 }
9826 else
9827 {
9828 hasParent = true;
9829 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
9830 refParentIB =
ItemBase.Cast(parent);
9831 }
9832 }
9833
9834 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
9835 {
9836
9837 }
9838
9840 {
9841
9842 return false;
9843 }
9844
9846 {
9847
9848
9849 return false;
9850 }
9851
9853 {
9854
9855 return false;
9856 }
9857
9860 {
9861 return !GetIsFrozen() &&
IsOpen();
9862 }
9863
9865 {
9866 bool hasParent = false, hasRootAsPlayer = false;
9868
9869 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
9870 bool foodDecay =
g_Game.IsFoodDecayEnabled();
9871
9872 if (wwtu || foodDecay)
9873 {
9877
9878 if (processWetness || processTemperature || processDecay)
9879 {
9881
9882 if (processWetness)
9883 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
9884
9885 if (processTemperature)
9887
9888 if (processDecay)
9889 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
9890 }
9891 }
9892 }
9893
9896 {
9898 }
9899
9901 {
9904
9905 return super.GetTemperatureFreezeThreshold();
9906 }
9907
9909 {
9912
9913 return super.GetTemperatureThawThreshold();
9914 }
9915
9917 {
9920
9921 return super.GetItemOverheatThreshold();
9922 }
9923
9925 {
9927 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
9928
9929 return super.GetTemperatureFreezeTime();
9930 }
9931
9933 {
9935 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
9936
9937 return super.GetTemperatureThawTime();
9938 }
9939
9944
9946 {
9947 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
9948 }
9949
9951 {
9952 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
9953 }
9954
9957 {
9959 }
9960
9962 {
9964 }
9965
9967 {
9969 }
9970
9973 {
9974 return null;
9975 }
9976
9979 {
9980 return false;
9981 }
9982
9984 {
9986 {
9989 if (!trg)
9990 {
9992 explosive = this;
9993 }
9994
9995 explosive.PairRemote(trg);
9997
9998 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
9999 trg.SetPersistentPairID(persistentID);
10000 explosive.SetPersistentPairID(persistentID);
10001
10002 return true;
10003 }
10004 return false;
10005 }
10006
10009 {
10010 float ret = 1.0;
10013 ret *= GetHealth01();
10014
10015 return ret;
10016 }
10017
10018 #ifdef DEVELOPER
10019 override void SetDebugItem()
10020 {
10021 super.SetDebugItem();
10022 _itemBase = this;
10023 }
10024
10026 {
10027 string text = super.GetDebugText();
10028
10030 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10031
10032 return text;
10033 }
10034 #endif
10035
10037 {
10038 return true;
10039 }
10040
10042
10044
10046 {
10049 }
10050
10051
10059
10075
10076 [
Obsolete(
"Use ItemSoundHandler instead")]
10079 {
10080 if (!
g_Game.IsDedicatedServer())
10081 {
10082 if (ConfigIsExisting("attachSoundSet"))
10083 {
10084 string cfg_path = "";
10085 string soundset = "";
10086 string type_name =
GetType();
10087
10090 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10091 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10092
10093 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10094 {
10095 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10096 {
10097 if (cfg_slot_array[i] == slot_type)
10098 {
10099 soundset = cfg_soundset_array[i];
10100 break;
10101 }
10102 }
10103 }
10104
10105 if (soundset != "")
10106 {
10107 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10109 }
10110 }
10111 }
10112 }
10113
10115}
10116
10118{
10120 if (entity)
10121 {
10122 bool is_item = entity.IsInherited(
ItemBase);
10123 if (is_item && full_quantity)
10124 {
10127 }
10128 }
10129 else
10130 {
10132 return NULL;
10133 }
10134 return entity;
10135}
10136
10138{
10139 if (item)
10140 {
10141 if (health > 0)
10142 item.SetHealth("", "", health);
10143
10144 if (item.CanHaveTemperature())
10145 {
10147 if (item.CanFreeze())
10148 item.SetFrozen(false);
10149 }
10150
10151 if (item.HasEnergyManager())
10152 {
10153 if (quantity >= 0)
10154 {
10155 item.GetCompEM().SetEnergy0To1(quantity);
10156 }
10157 else
10158 {
10160 }
10161 }
10162 else if (item.IsMagazine())
10163 {
10164 Magazine mag = Magazine.Cast(item);
10165 if (quantity >= 0)
10166 {
10167 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10168 }
10169 else
10170 {
10172 }
10173
10174 }
10175 else
10176 {
10177 if (quantity >= 0)
10178 {
10179 item.SetQuantityNormalized(quantity, false);
10180 }
10181 else
10182 {
10184 }
10185
10186 }
10187 }
10188}
10189
10190#ifdef DEVELOPER
10192#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.