5189{
5191 {
5192 return true;
5193 }
5194};
5195
5197{
5198
5199};
5200
5201
5202
5204{
5208
5210
5213
5214
5215
5216
5217
5226
5232
5237
5242
5263 protected bool m_IsResultOfSplit
5264
5266
5271
5272
5273
5275
5279
5280
5281
5283
5286
5287
5288
5294
5295
5303
5306
5307
5309
5310
5312
5313
5318
5319
5324
5326
5327
5329
5330
5332 {
5337
5338 if (!
g_Game.IsDedicatedServer())
5339 {
5341 {
5343
5345 {
5347 }
5348 }
5349
5352 }
5353
5354 m_OldLocation = null;
5355
5357 {
5359 }
5360
5361 if (ConfigIsExisting("headSelectionsToHide"))
5362 {
5365 }
5366
5368 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5369 {
5371 }
5372
5374
5375 m_IsResultOfSplit = false;
5376
5378 }
5379
5381 {
5382 super.InitItemVariables();
5383
5389 m_Count = ConfigGetInt(
"count");
5390
5393
5398
5401
5406
5418
5422
5423
5426 if (ConfigIsExisting("canBeSplit"))
5427 {
5430 }
5431
5433 if (ConfigIsExisting("itemBehaviour"))
5435
5436
5439 RegisterNetSyncVariableInt("m_VarLiquidType");
5440 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5441
5442 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5443 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5444 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5445
5446 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5447 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5448 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5449 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5450
5451 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5452 RegisterNetSyncVariableBool("m_IsTakeable");
5453 RegisterNetSyncVariableBool("m_IsHologram");
5454
5457 {
5460 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
5461 }
5462
5464
5466 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5468
5470 }
5471
5473 {
5475 }
5476
5478 {
5481 {
5486 }
5487 }
5488
5489 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5490 {
5492 {
5495 }
5496
5498 }
5499
5501 {
5507 }
5508
5510
5512 {
5514
5515 if (!action)
5516 {
5517 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5518 return;
5519 }
5520
5522 if (!ai)
5523 {
5525 return;
5526 }
5527
5529 if (!action_array)
5530 {
5531 action_array = new array<ActionBase_Basic>;
5533 }
5534 if (LogManager.IsActionLogEnable())
5535 {
5536 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5537 }
5538
5539 if (action_array.Find(action) != -1)
5540 {
5541 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5542 }
5543 else
5544 {
5545 action_array.Insert(action);
5546 }
5547 }
5548
5550 {
5551 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
5552 ActionBase action = player.GetActionManager().GetAction(actionName);
5555
5556 if (action_array)
5557 {
5558 action_array.RemoveItem(action);
5559 }
5560 }
5561
5562
5563
5565 {
5566 ActionOverrideData overrideData = new ActionOverrideData();
5570
5572 if (!actionMap)
5573 {
5576 }
5577
5578 actionMap.Insert(this.
Type(), overrideData);
5579
5580 }
5581
5583
5585
5586
5588 {
5591
5594
5595 string config_to_search = "CfgVehicles";
5596 string muzzle_owner_config;
5597
5599 {
5600 if (IsInherited(Weapon))
5601 config_to_search = "CfgWeapons";
5602
5603 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5604
5605 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5606
5607 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
5608
5609 if (config_OnFire_subclass_count > 0)
5610 {
5611 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5612
5613 for (int i = 0; i < config_OnFire_subclass_count; i++)
5614 {
5615 string particle_class = "";
5616 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
5617 string config_OnFire_entry = config_OnFire_class + particle_class;
5618 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5619 WPOF_array.Insert(WPOF);
5620 }
5621
5622
5624 }
5625 }
5626
5628 {
5629 config_to_search = "CfgWeapons";
5630 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5631
5632 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5633
5634 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
5635
5636 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
5637 {
5638 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
5639
5640 for (i = 0; i < config_OnBulletCasingEject_count; i++)
5641 {
5642 string particle_class2 = "";
5643 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
5644 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
5645 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
5646 WPOBE_array.Insert(WPOBE);
5647 }
5648
5649
5651 }
5652 }
5653 }
5654
5655
5657 {
5660
5662 {
5663 string config_to_search = "CfgVehicles";
5664
5665 if (IsInherited(Weapon))
5666 config_to_search = "CfgWeapons";
5667
5668 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5669 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
5670
5671 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
5672 {
5673
5675
5677 {
5679 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
5681 return;
5682 }
5683
5686
5687
5688
5689 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
5690 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
5691
5692 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
5693 {
5694 string particle_class = "";
5695 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
5696 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
5697 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
5698
5699 if (entry_type == CT_CLASS)
5700 {
5701 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
5702 WPOOH_array.Insert(WPOF);
5703 }
5704 }
5705
5706
5708 }
5709 }
5710 }
5711
5713 {
5715 }
5716
5718 {
5720 {
5722
5725
5728
5729 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5730 }
5731 }
5732
5734 {
5736 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5737
5739 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5740
5742 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5743
5745 {
5747 }
5748 }
5749
5751 {
5753 }
5754
5756 {
5759 else
5761
5763 {
5766 }
5767 else
5768 {
5771
5774 }
5775
5777 }
5778
5780 {
5782 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5783 }
5784
5786 {
5788 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5790 }
5791
5793 {
5795 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5796 }
5797
5799 {
5802
5803 OverheatingParticle OP = new OverheatingParticle();
5808
5810 }
5811
5813 {
5816
5817 return -1;
5818 }
5819
5821 {
5823 {
5826
5827 for (int i = count; i > 0; --i)
5828 {
5829 int id = i - 1;
5832
5835
5836 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
5837 {
5838 if (p)
5839 {
5842 }
5843 }
5844 }
5845 }
5846 }
5847
5849 {
5851 {
5853 {
5854 int id = i - 1;
5856
5857 if (OP)
5858 {
5860
5861 if (p)
5862 {
5864 }
5865
5866 delete OP;
5867 }
5868 }
5869
5872 }
5873 }
5874
5877 {
5878 return 0.0;
5879 }
5880
5881
5883 {
5884 return 250;
5885 }
5886
5888 {
5889 return 0;
5890 }
5891
5894 {
5896 return true;
5897
5898 return false;
5899 }
5900
5903 {
5906
5908 {
5910 }
5911 else
5912 {
5913
5915 }
5916
5918 }
5919
5926 {
5927 return -1;
5928 }
5929
5930
5931
5932
5934 {
5936 {
5937 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
5938 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
5939
5940 if (r_index >= 0)
5941 {
5942 InventoryLocation r_il = new InventoryLocation;
5943 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
5944
5945 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
5948 {
5949 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
5950 }
5952 {
5953 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
5954 }
5955
5956 }
5957
5958 player.GetHumanInventory().ClearUserReservedLocation(this);
5959 }
5960
5963 }
5964
5965
5966
5967
5969 {
5970 return ItemBase.m_DebugActionsMask;
5971 }
5972
5974 {
5975 return ItemBase.m_DebugActionsMask & mask;
5976 }
5977
5979 {
5980 ItemBase.m_DebugActionsMask = mask;
5981 }
5982
5984 {
5985 ItemBase.m_DebugActionsMask |= mask;
5986 }
5987
5989 {
5990 ItemBase.m_DebugActionsMask &= ~mask;
5991 }
5992
5994 {
5996 {
5998 }
5999 else
6000 {
6002 }
6003 }
6004
6005
6007 {
6008 if (GetEconomyProfile())
6009 {
6010 float q_max = GetEconomyProfile().GetQuantityMax();
6011 if (q_max > 0)
6012 {
6013 float q_min = GetEconomyProfile().GetQuantityMin();
6014 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6015
6017 {
6018 ComponentEnergyManager comp = GetCompEM();
6020 {
6022 }
6023 }
6025 {
6027
6028 }
6029
6030 }
6031 }
6032 }
6033
6036 {
6037 EntityAI parent = GetHierarchyParent();
6038
6039 if (parent)
6040 {
6041 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6042 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6043 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6044 }
6045 }
6046
6049 {
6050 EntityAI parent = GetHierarchyParent();
6051
6052 if (parent)
6053 {
6054 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6055 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6056 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6057 }
6058 }
6059
6061 {
6062
6063
6064
6065
6067
6069 {
6070 if (ScriptInputUserData.CanStoreInputUserData())
6071 {
6072 ScriptInputUserData ctx = new ScriptInputUserData;
6078 ctx.
Write(use_stack_max);
6081
6083 {
6084 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6085 }
6086 }
6087 }
6088 else if (!
g_Game.IsMultiplayer())
6089 {
6091 }
6092 }
6093
6095 {
6097 }
6098
6100 {
6102 }
6103
6105 {
6107 }
6108
6110 {
6111
6112 return false;
6113 }
6114
6116 {
6117 return false;
6118 }
6119
6123 {
6124 return false;
6125 }
6126
6128 {
6129 return "";
6130 }
6131
6133
6135 {
6136 return false;
6137 }
6138
6140 {
6141 return true;
6142 }
6143
6144
6145
6147 {
6148 return true;
6149 }
6150
6152 {
6153 return true;
6154 }
6155
6157 {
6158 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6160 }
6161
6163 {
6165 }
6166
6168 {
6170 if (!is_being_placed)
6172 SetSynchDirty();
6173 }
6174
6175
6177
6179 {
6181 }
6182
6184 {
6186 }
6187
6189 {
6190 return 1;
6191 }
6192
6194 {
6195 return false;
6196 }
6197
6199 {
6201 SetSynchDirty();
6202 }
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6239 {
6240 super.OnMovedInsideCargo(container);
6241
6242 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6243 }
6244
6245 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6246 {
6247 super.EEItemLocationChanged(oldLoc, newLoc);
6248
6249 PlayerBase newPlayer = null;
6250 PlayerBase oldPlayer = null;
6251
6252 if (newLoc.GetParent())
6253 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6254
6255 if (oldLoc.GetParent())
6256 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6257
6259 {
6260 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6261
6262 if (rIndex >= 0)
6263 {
6264 InventoryLocation rIl = new InventoryLocation;
6265 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6266
6267 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6270 {
6271 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6272 }
6274 {
6276 }
6277
6278 }
6279 }
6280
6282 {
6283 if (newPlayer)
6284 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6285
6286 if (newPlayer == oldPlayer)
6287 {
6288 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6289 {
6291 {
6292 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6293 {
6294 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6295 }
6296 }
6297 else
6298 {
6299 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6300 }
6301 }
6302
6303 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6304 {
6305 int type = oldLoc.GetType();
6307 {
6308 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6309 }
6311 {
6312 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6313 }
6314 }
6315 if (!m_OldLocation)
6316 {
6317 m_OldLocation = new InventoryLocation;
6318 }
6319 m_OldLocation.Copy(oldLoc);
6320 }
6321 else
6322 {
6323 if (m_OldLocation)
6324 {
6325 m_OldLocation.Reset();
6326 }
6327 }
6328
6329 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6330 }
6331 else
6332 {
6333 if (newPlayer)
6334 {
6335 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6336 if (resIndex >= 0)
6337 {
6338 InventoryLocation il = new InventoryLocation;
6339 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6341 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6344 {
6345 il.
GetParent().GetOnReleaseLock().Invoke(it);
6346 }
6348 {
6350 }
6351
6352 }
6353 }
6355 {
6356
6358 }
6359
6360 if (m_OldLocation)
6361 {
6362 m_OldLocation.Reset();
6363 }
6364 }
6365
6367 {
6368 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6369 }
6370
6372 {
6373 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6374 }
6375 }
6376
6377 override void EOnContact(IEntity other, Contact extra)
6378 {
6380 {
6381 int liquidType = -1;
6383 if (impactSpeed > 0.0)
6384 {
6386 #ifndef SERVER
6388 #else
6390 SetSynchDirty();
6391 #endif
6393 }
6394 }
6395
6396 #ifdef SERVER
6397 if (GetCompEM() && GetCompEM().IsPlugged())
6398 {
6399 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6400 GetCompEM().UnplugThis();
6401 }
6402 #endif
6403 }
6404
6406
6408 {
6410 }
6411
6413 {
6414
6415 }
6416
6418 {
6419 super.OnItemLocationChanged(old_owner, new_owner);
6420
6421 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6422 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6423
6424 if (!relatedPlayer && playerNew)
6425 relatedPlayer = playerNew;
6426
6427 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6428 {
6430 if (actionMgr)
6431 {
6432 ActionBase currentAction = actionMgr.GetRunningAction();
6433 if (currentAction)
6435 }
6436 }
6437
6438 Man ownerPlayerOld = null;
6439 Man ownerPlayerNew = null;
6440
6441 if (old_owner)
6442 {
6443 if (old_owner.
IsMan())
6444 {
6445 ownerPlayerOld = Man.Cast(old_owner);
6446 }
6447 else
6448 {
6449 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6450 }
6451 }
6452 else
6453 {
6455 {
6457
6458 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6459 {
6460 GetCompEM().UnplugThis();
6461 }
6462 }
6463 }
6464
6465 if (new_owner)
6466 {
6467 if (new_owner.
IsMan())
6468 {
6469 ownerPlayerNew = Man.Cast(new_owner);
6470 }
6471 else
6472 {
6473 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6474 }
6475 }
6476
6477 if (ownerPlayerOld != ownerPlayerNew)
6478 {
6479 if (ownerPlayerOld)
6480 {
6481 array<EntityAI> subItemsExit = new array<EntityAI>;
6483 for (int i = 0; i < subItemsExit.Count(); i++)
6484 {
6487 }
6488 }
6489
6490 if (ownerPlayerNew)
6491 {
6492 array<EntityAI> subItemsEnter = new array<EntityAI>;
6494 for (int j = 0; j < subItemsEnter.Count(); j++)
6495 {
6498 }
6499 }
6500 }
6501 else if (ownerPlayerNew != null)
6502 {
6503 PlayerBase nplayer;
6504 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6505 {
6506 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6508 for (int k = 0; k < subItemsUpdate.Count(); k++)
6509 {
6511 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6512 }
6513 }
6514 }
6515
6516 if (old_owner)
6517 old_owner.OnChildItemRemoved(this);
6518 if (new_owner)
6519 new_owner.OnChildItemReceived(this);
6520 }
6521
6522
6524 {
6525 super.EEDelete(parent);
6526 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6527 if (player)
6528 {
6530
6531 if (player.IsAlive())
6532 {
6533 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6534 if (r_index >= 0)
6535 {
6536 InventoryLocation r_il = new InventoryLocation;
6537 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6538
6539 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6542 {
6543 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6544 }
6546 {
6547 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6548 }
6549
6550 }
6551
6552 player.RemoveQuickBarEntityShortcut(this);
6553 }
6554 }
6555 }
6556
6558 {
6559 super.EEKilled(killer);
6560
6563 {
6564 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6565 {
6566 if (IsMagazine())
6567 {
6568 if (Magazine.Cast(this).GetAmmoCount() > 0)
6569 {
6571 }
6572 }
6573 else
6574 {
6576 }
6577 }
6578 }
6579 }
6580
6582 {
6583 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6584
6585 super.OnWasAttached(parent, slot_id);
6586
6589
6592 }
6593
6595 {
6596 super.OnWasDetached(parent, slot_id);
6597
6600
6603 }
6604
6606 {
6607 int idx;
6610
6611 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6612 if (inventory_slots.Count() < 1)
6613 {
6614 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6615 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6616 }
6617 else
6618 {
6619 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6620 }
6621
6622 idx = inventory_slots.Find(slot);
6623 if (idx < 0)
6624 return "";
6625
6626 return attach_types.Get(idx);
6627 }
6628
6630 {
6631 int idx = -1;
6632 string slot;
6633
6636
6637 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6638 if (inventory_slots.Count() < 1)
6639 {
6640 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6641 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6642 }
6643 else
6644 {
6645 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6646 if (detach_types.Count() < 1)
6647 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6648 }
6649
6650 for (int i = 0; i < inventory_slots.Count(); i++)
6651 {
6652 slot = inventory_slots.Get(i);
6653 }
6654
6655 if (slot != "")
6656 {
6657 if (detach_types.Count() == 1)
6658 idx = 0;
6659 else
6660 idx = inventory_slots.Find(slot);
6661 }
6662 if (idx < 0)
6663 return "";
6664
6665 return detach_types.Get(idx);
6666 }
6667
6669 {
6670
6672
6673
6674 float min_time = 1;
6675 float max_time = 3;
6676 float delay = Math.RandomFloat(min_time, max_time);
6677
6678 explode_timer.Run(delay, this, "DoAmmoExplosion");
6679 }
6680
6682 {
6683 Magazine magazine = Magazine.Cast(this);
6684 int pop_sounds_count = 6;
6685 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
6686
6687
6688 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
6689 string sound_name = pop_sounds[ sound_idx ];
6690 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
6691
6692
6693 magazine.ServerAddAmmoCount(-1);
6694
6695
6696 float min_temp_to_explode = 100;
6697
6698 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
6699 {
6701 }
6702 }
6703
6704
6705 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
6706 {
6707 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
6708
6709 const int CHANCE_DAMAGE_CARGO = 4;
6710 const int CHANCE_DAMAGE_ATTACHMENT = 1;
6711 const int CHANCE_DAMAGE_NOTHING = 2;
6712
6714 {
6715 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
6716 int chances;
6717 int rnd;
6718
6719 if (GetInventory().GetCargo())
6720 {
6721 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6722 rnd = Math.RandomInt(0,chances);
6723
6724 if (rnd < CHANCE_DAMAGE_CARGO)
6725 {
6727 }
6728 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
6729 {
6731 }
6732 }
6733 else
6734 {
6735 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6736 rnd = Math.RandomInt(0,chances);
6737
6738 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
6739 {
6741 }
6742 }
6743 }
6744 }
6745
6747 {
6748 CargoBase cargo = GetInventory().GetCargo();
6749 if (cargo)
6750 {
6752 if (item_count > 0)
6753 {
6754 int random_pick = Math.RandomInt(0, item_count);
6756 if (!item.IsExplosive())
6757 {
6758 item.AddHealth("","",damage);
6759 return true;
6760 }
6761 }
6762 }
6763 return false;
6764 }
6765
6767 {
6768 GameInventory inventory = GetInventory();
6770 if (attachment_count > 0)
6771 {
6772 int random_pick = Math.RandomInt(0, attachment_count);
6774 if (!attachment.IsExplosive())
6775 {
6776 attachment.AddHealth("","",damage);
6777 return true;
6778 }
6779 }
6780 return false;
6781 }
6782
6784 {
6786 }
6787
6789 {
6791 return GetInventory().CanRemoveEntity();
6792
6793 return false;
6794 }
6795
6797 {
6798
6800 return false;
6801
6802
6804 return false;
6805
6806
6807
6809 if (delta == 0)
6810 return false;
6811
6812
6813 return true;
6814 }
6815
6817 {
6819 {
6820 if (ScriptInputUserData.CanStoreInputUserData())
6821 {
6822 ScriptInputUserData ctx = new ScriptInputUserData;
6827 ctx.
Write(destination_entity);
6831 }
6832 }
6833 else if (!
g_Game.IsMultiplayer())
6834 {
6836 }
6837 }
6838
6840 {
6841 float split_quantity_new;
6845 InventoryLocation loc = new InventoryLocation;
6846
6847 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6848 {
6850 split_quantity_new = stack_max;
6851 else
6853
6855 {
6856 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6857 if (new_item)
6858 {
6859 new_item.SetResultOfSplit(true);
6860 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6862 new_item.
SetQuantity(split_quantity_new,
false,
true);
6863 }
6864 }
6865 }
6866 else if (destination_entity && slot_id == -1)
6867 {
6868 if (quantity > stack_max)
6869 split_quantity_new = stack_max;
6870 else
6871 split_quantity_new = quantity;
6872
6874 {
6875 GameInventory destinationInventory = destination_entity.GetInventory();
6877 {
6880 }
6881
6882 if (new_item)
6883 {
6884 new_item.SetResultOfSplit(true);
6885 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6887 new_item.
SetQuantity(split_quantity_new,
false,
true);
6888 }
6889 }
6890 }
6891 else
6892 {
6893 if (stack_max != 0)
6894 {
6896 {
6898 }
6899
6900 if (split_quantity_new == 0)
6901 {
6902 if (!
g_Game.IsMultiplayer())
6903 player.PhysicalPredictiveDropItem(this);
6904 else
6905 player.ServerDropEntity(this);
6906 return;
6907 }
6908
6910 {
6912
6913 if (new_item)
6914 {
6915 new_item.SetResultOfSplit(true);
6916 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6919 new_item.PlaceOnSurface();
6920 }
6921 }
6922 }
6923 }
6924 }
6925
6927 {
6928 float split_quantity_new;
6932 InventoryLocation loc = new InventoryLocation;
6933
6934 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6935 {
6937 split_quantity_new = stack_max;
6938 else
6940
6942 {
6943 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6944 if (new_item)
6945 {
6946 new_item.SetResultOfSplit(true);
6947 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6949 new_item.
SetQuantity(split_quantity_new,
false,
true);
6950 }
6951 }
6952 }
6953 else if (destination_entity && slot_id == -1)
6954 {
6955 if (quantity > stack_max)
6956 split_quantity_new = stack_max;
6957 else
6958 split_quantity_new = quantity;
6959
6961 {
6962 GameInventory destinationInventory = destination_entity.GetInventory();
6964 {
6967 }
6968
6969 if (new_item)
6970 {
6971 new_item.SetResultOfSplit(true);
6972 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6974 new_item.
SetQuantity(split_quantity_new,
false,
true);
6975 }
6976 }
6977 }
6978 else
6979 {
6980 if (stack_max != 0)
6981 {
6983 {
6985 }
6986
6988 {
6990
6991 if (new_item)
6992 {
6993 new_item.SetResultOfSplit(true);
6994 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6997 new_item.PlaceOnSurface();
6998 }
6999 }
7000 }
7001 }
7002 }
7003
7005 {
7007 {
7008 if (ScriptInputUserData.CanStoreInputUserData())
7009 {
7010 ScriptInputUserData ctx = new ScriptInputUserData;
7015 dst.WriteToContext(ctx);
7017 }
7018 }
7019 else if (!
g_Game.IsMultiplayer())
7020 {
7022 }
7023 }
7024
7026 {
7028 {
7029 if (ScriptInputUserData.CanStoreInputUserData())
7030 {
7031 ScriptInputUserData ctx = new ScriptInputUserData;
7036 ctx.
Write(destination_entity);
7042 }
7043 }
7044 else if (!
g_Game.IsMultiplayer())
7045 {
7047 }
7048 }
7049
7051 {
7053 }
7054
7056 {
7058 float split_quantity_new;
7060 if (dst.IsValid())
7061 {
7062 int slot_id = dst.GetSlot();
7064
7065 if (quantity > stack_max)
7066 split_quantity_new = stack_max;
7067 else
7068 split_quantity_new = quantity;
7069
7071 {
7073
7074 if (new_item)
7075 {
7076 new_item.SetResultOfSplit(true);
7077 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7079 new_item.
SetQuantity(split_quantity_new,
false,
true);
7080 }
7081
7082 return new_item;
7083 }
7084 }
7085
7086 return null;
7087 }
7088
7090 {
7092 float split_quantity_new;
7094 if (destination_entity)
7095 {
7097 if (quantity > stackable)
7098 split_quantity_new = stackable;
7099 else
7100 split_quantity_new = quantity;
7101
7103 {
7104 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7105 if (new_item)
7106 {
7107 new_item.SetResultOfSplit(true);
7108 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7110 new_item.
SetQuantity(split_quantity_new,
false,
true);
7111 }
7112 }
7113 }
7114 }
7115
7117 {
7119 {
7120 if (ScriptInputUserData.CanStoreInputUserData())
7121 {
7122 ScriptInputUserData ctx = new ScriptInputUserData;
7127 ItemBase destination_entity =
this;
7128 ctx.
Write(destination_entity);
7132 }
7133 }
7134 else if (!
g_Game.IsMultiplayer())
7135 {
7137 }
7138 }
7139
7141 {
7143 float split_quantity_new;
7145 if (player)
7146 {
7148 if (quantity > stackable)
7149 split_quantity_new = stackable;
7150 else
7151 split_quantity_new = quantity;
7152
7154 {
7155 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7156 new_item =
ItemBase.Cast(in_hands);
7157 if (new_item)
7158 {
7159 new_item.SetResultOfSplit(true);
7160 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7162 new_item.SetQuantity(split_quantity_new, false, true);
7163 }
7164 }
7165 }
7166 }
7167
7169 {
7171 float split_quantity_new = Math.Floor(quantity * 0.5);
7172
7174 return;
7175
7177
7178 if (new_item)
7179 {
7180 if (new_item.GetQuantityMax() < split_quantity_new)
7181 {
7182 split_quantity_new = new_item.GetQuantityMax();
7183 }
7184
7185 new_item.SetResultOfSplit(true);
7186 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7187
7189 {
7192 }
7193 else
7194 {
7196 new_item.
SetQuantity(split_quantity_new,
false,
true);
7197 }
7198 }
7199 }
7200
7202 {
7204 float split_quantity_new = Math.Floor(quantity / 2);
7205
7207 return;
7208
7209 InventoryLocation invloc = new InventoryLocation;
7211
7213 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7214
7215 if (new_item)
7216 {
7217 if (new_item.GetQuantityMax() < split_quantity_new)
7218 {
7219 split_quantity_new = new_item.GetQuantityMax();
7220 }
7222 {
7225 }
7226 else if (split_quantity_new > 1)
7227 {
7229 new_item.
SetQuantity(split_quantity_new,
false,
true);
7230 }
7231 }
7232 }
7233
7236 {
7237 SetWeightDirty();
7239
7240 if (parent)
7241 parent.OnAttachmentQuantityChangedEx(this, delta);
7242
7244 {
7246 {
7248 }
7250 {
7251 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7253 }
7254 }
7255 }
7256
7259 {
7260
7261 }
7262
7265 {
7267 }
7268
7270 {
7271 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7272
7274 {
7275 if (newLevel == GameConstants.STATE_RUINED)
7276 {
7278 EntityAI parent = GetHierarchyParent();
7279 if (parent && parent.IsFireplace())
7280 {
7281 CargoBase cargo = GetInventory().GetCargo();
7282 if (cargo)
7283 {
7285 {
7287 }
7288 }
7289 }
7290 }
7291
7293 {
7294
7296 return;
7297 }
7298
7299 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7300 {
7302 }
7303 }
7304 }
7305
7306
7308 {
7309 super.OnRightClick();
7310
7312 {
7314 {
7315 if (ScriptInputUserData.CanStoreInputUserData())
7316 {
7317 EntityAI root = GetHierarchyRoot();
7318 Man playerOwner = GetHierarchyRootPlayer();
7319 InventoryLocation dst = new InventoryLocation;
7320
7321
7322 if (!playerOwner && root && root == this)
7323 {
7325 }
7326 else
7327 {
7328
7329 GetInventory().GetCurrentInventoryLocation(dst);
7331 {
7332 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7334 {
7336 }
7337 else
7338 {
7340
7341
7342 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7343 {
7345 }
7346 else
7347 {
7348 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7349 }
7350 }
7351 }
7352 }
7353
7354 ScriptInputUserData ctx = new ScriptInputUserData;
7362 }
7363 }
7364 else if (!
g_Game.IsMultiplayer())
7365 {
7367 }
7368 }
7369 }
7370
7372 {
7373 if (root)
7374 {
7375 vector m4[4];
7376 root.GetTransform(m4);
7377 dst.SetGround(this, m4);
7378 }
7379 else
7380 {
7381 GetInventory().GetCurrentInventoryLocation(dst);
7382 }
7383 }
7384
7385 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7386 {
7387
7388 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7389 return false;
7390
7391 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7392 return false;
7393
7394
7396 return false;
7397
7398
7399 Magazine mag = Magazine.Cast(this);
7400 if (mag)
7401 {
7402 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7403 return false;
7404
7405 if (stack_max_limit)
7406 {
7407 Magazine other_mag = Magazine.Cast(other_item);
7408 if (other_item)
7409 {
7410 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7411 return false;
7412 }
7413
7414 }
7415 }
7416 else
7417 {
7418
7420 return false;
7421
7423 return false;
7424 }
7425
7426 PlayerBase player = null;
7427 if (CastTo(player, GetHierarchyRootPlayer()))
7428 {
7429 if (player.GetInventory().HasAttachment(this))
7430 return false;
7431
7432 if (player.IsItemsToDelete())
7433 return false;
7434 }
7435
7436 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7437 return false;
7438
7439 int slotID;
7441 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7442 return false;
7443
7444 return true;
7445 }
7446
7448 {
7450 }
7451
7453 {
7454 return m_IsResultOfSplit;
7455 }
7456
7458 {
7459 m_IsResultOfSplit = value;
7460 }
7461
7463 {
7465 }
7466
7468 {
7469 float other_item_quantity = other_item.GetQuantity();
7470 float this_free_space;
7471
7473
7475
7476 if (other_item_quantity > this_free_space)
7477 {
7478 return this_free_space;
7479 }
7480 else
7481 {
7482 return other_item_quantity;
7483 }
7484 }
7485
7487 {
7489 }
7490
7492 {
7494 return;
7495
7496 if (!IsMagazine() && other_item)
7497 {
7499 if (quantity_used != 0)
7500 {
7501 float hp1 = GetHealth01("","");
7502 float hp2 = other_item.GetHealth01("","");
7503 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7504 hpResult = hpResult / (
GetQuantity() + quantity_used);
7505
7506 hpResult *= GetMaxHealth();
7507 Math.Round(hpResult);
7508 SetHealth("", "Health", hpResult);
7509
7511 other_item.AddQuantity(-quantity_used);
7512 }
7513 }
7515 }
7516
7518 {
7519 #ifdef SERVER
7520 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7521 GetHierarchyParent().IncreaseLifetimeUp();
7522 #endif
7523 };
7524
7526 {
7527 PlayerBase p = PlayerBase.Cast(player);
7528
7529 array<int> recipesIds = p.m_Recipes;
7530 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7531 if (moduleRecipesManager)
7532 {
7533 EntityAI itemInHands = player.GetEntityInHands();
7534 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7535 }
7536
7537 for (int i = 0;i < recipesIds.Count(); i++)
7538 {
7539 int key = recipesIds.Get(i);
7540 string recipeName = moduleRecipesManager.GetRecipeName(key);
7542 }
7543 }
7544
7545
7546 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7547 {
7548 super.GetDebugActions(outputList);
7549
7550
7556
7557
7562
7567
7568
7572
7573
7575 {
7579 }
7580
7583
7584
7588
7590
7591 InventoryLocation loc = new InventoryLocation();
7592 GetInventory().GetCurrentInventoryLocation(loc);
7594 {
7595 if (Gizmo_IsSupported())
7598 }
7599
7601 }
7602
7603
7604
7605
7607 {
7608 super.OnAction(action_id, player, ctx);
7609
7611 {
7612 switch (action_id)
7613 {
7617 return true;
7621 return true;
7622 }
7623 }
7624
7626 {
7627 switch (action_id)
7628 {
7630 Delete();
7631 return true;
7632 }
7633 }
7634
7635 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
7636 {
7637 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7638 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
7639 PlayerBase p = PlayerBase.Cast(player);
7640 if (
EActions.RECIPES_RANGE_START < 1000)
7641 {
7642 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7643 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7644 }
7645 }
7646 #ifndef SERVER
7647 else if (action_id ==
EActions.WATCH_PLAYER)
7648 {
7649 PluginDeveloper.SetDeveloperItemClientEx(player);
7650 }
7651 #endif
7653 {
7654 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7655 {
7656 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7657 OnDebugButtonPressServer(id + 1);
7658 }
7659
7660 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7661 {
7662 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
7664 }
7665
7666 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
7667 {
7668 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
7670 }
7671
7672 else if (action_id ==
EActions.ADD_QUANTITY)
7673 {
7674 if (IsMagazine())
7675 {
7676 Magazine mag = Magazine.Cast(this);
7677 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
7678 }
7679 else
7680 {
7682 }
7683
7684 if (m_EM)
7685 {
7686 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
7687 }
7688
7689 }
7690
7691 else if (action_id ==
EActions.REMOVE_QUANTITY)
7692 {
7693 if (IsMagazine())
7694 {
7695 Magazine mag2 = Magazine.Cast(this);
7696 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
7697 }
7698 else
7699 {
7701 }
7702 if (m_EM)
7703 {
7704 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
7705 }
7706
7707 }
7708
7709 else if (action_id ==
EActions.SET_QUANTITY_0)
7710 {
7712
7713 if (m_EM)
7714 {
7715 m_EM.SetEnergy(0);
7716 }
7717 }
7718
7719 else if (action_id ==
EActions.SET_MAX_QUANTITY)
7720 {
7722
7723 if (m_EM)
7724 {
7725 m_EM.SetEnergy(m_EM.GetEnergyMax());
7726 }
7727 }
7728
7729 else if (action_id ==
EActions.ADD_HEALTH)
7730 {
7731 AddHealth("","",GetMaxHealth("","Health")/5);
7732 }
7733 else if (action_id ==
EActions.REMOVE_HEALTH)
7734 {
7735 AddHealth("","",-GetMaxHealth("","Health")/5);
7736 }
7737 else if (action_id ==
EActions.DESTROY_HEALTH)
7738 {
7739 SetHealth01("","",0);
7740 }
7741 else if (action_id ==
EActions.WATCH_ITEM)
7742 {
7744 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
7745 #ifdef DEVELOPER
7746 SetDebugDeveloper_item(this);
7747 #endif
7748 }
7749
7750 else if (action_id ==
EActions.ADD_TEMPERATURE)
7751 {
7752 AddTemperature(20);
7753
7754 }
7755
7756 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
7757 {
7758 AddTemperature(-20);
7759
7760 }
7761
7762 else if (action_id ==
EActions.FLIP_FROZEN)
7763 {
7764 SetFrozen(!GetIsFrozen());
7765
7766 }
7767
7768 else if (action_id ==
EActions.ADD_WETNESS)
7769 {
7771
7772 }
7773
7774 else if (action_id ==
EActions.REMOVE_WETNESS)
7775 {
7777
7778 }
7779
7780 else if (action_id ==
EActions.LIQUIDTYPE_UP)
7781 {
7784
7785
7786 }
7787
7788 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
7789 {
7792 }
7793
7794 else if (action_id ==
EActions.MAKE_SPECIAL)
7795 {
7796 auto debugParams = DebugSpawnParams.WithPlayer(player);
7797 OnDebugSpawnEx(debugParams);
7798 }
7799
7800 }
7801
7802
7803 return false;
7804 }
7805
7806
7807
7808
7812
7815
7816
7817
7819 {
7820 return false;
7821 }
7822
7823
7825 {
7826 return true;
7827 }
7828
7829
7831 {
7832 return true;
7833 }
7834
7835
7836
7838 {
7839 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
7840 return g_Game.ConfigIsExisting(config_path);
7841 }
7842
7845 {
7846 return null;
7847 }
7848
7850 {
7851 return false;
7852 }
7853
7855 {
7856 return false;
7857 }
7858
7862
7863
7865 {
7866 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7867 return module_repairing.CanRepair(this, item_repair_kit);
7868 }
7869
7870
7871 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
7872 {
7873 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7874 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
7875 }
7876
7877
7879 {
7880
7881
7882
7883
7884
7885
7886
7887
7888 return 1;
7889 }
7890
7891
7892
7894 {
7896 }
7897
7898
7899
7901 {
7903 }
7904
7905
7914 {
7915 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7916
7917 if (player)
7918 {
7919 player.MessageStatus(text);
7920 }
7921 }
7922
7923
7932 {
7933 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7934
7935 if (player)
7936 {
7937 player.MessageAction(text);
7938 }
7939 }
7940
7941
7950 {
7951 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7952
7953 if (player)
7954 {
7955 player.MessageFriendly(text);
7956 }
7957 }
7958
7959
7968 {
7969 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7970
7971 if (player)
7972 {
7973 player.MessageImportant(text);
7974 }
7975 }
7976
7978 {
7979 return true;
7980 }
7981
7982
7983 override bool KindOf(
string tag)
7984 {
7985 bool found = false;
7986 string item_name = this.
GetType();
7988 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
7989
7990 int array_size = item_tag_array.Count();
7991 for (int i = 0; i < array_size; i++)
7992 {
7993 if (item_tag_array.Get(i) == tag)
7994 {
7995 found = true;
7996 break;
7997 }
7998 }
7999 return found;
8000 }
8001
8002
8004 {
8005
8006 super.OnRPC(sender, rpc_type,ctx);
8007
8008
8009 switch (rpc_type)
8010 {
8011 #ifndef SERVER
8012 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8013 Param2<bool, string> p = new Param2<bool, string>(false, "");
8014
8016 return;
8017
8018 bool play = p.param1;
8019 string soundSet = p.param2;
8020
8021 if (play)
8022 {
8024 {
8026 {
8028 }
8029 }
8030 else
8031 {
8033 }
8034 }
8035 else
8036 {
8038 }
8039
8040 break;
8041 #endif
8042
8043 }
8044
8046 {
8048 }
8049 }
8050
8051
8052
8053
8055 {
8056 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8057 return plugin.GetID(
name);
8058 }
8059
8061 {
8062 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8063 return plugin.GetName(id);
8064 }
8065
8068 {
8069
8070
8071 int varFlags;
8072 if (!ctx.
Read(varFlags))
8073 return;
8074
8075 if (varFlags & ItemVariableFlags.FLOAT)
8076 {
8078 }
8079 }
8080
8082 {
8083
8084 super.SerializeNumericalVars(floats_out);
8085
8086
8087
8089 {
8091 }
8092
8094 {
8096 }
8097
8099 {
8101 }
8102
8104 {
8109 }
8110
8112 {
8114 }
8115 }
8116
8118 {
8119
8120 super.DeSerializeNumericalVars(floats);
8121
8122
8123 int index = 0;
8124 int mask = Math.Round(floats.Get(index));
8125
8126 index++;
8127
8129 {
8131 {
8133 }
8134 else
8135 {
8136 float quantity = floats.Get(index);
8138 }
8139 index++;
8140 }
8141
8143 {
8144 float wet = floats.Get(index);
8146 index++;
8147 }
8148
8150 {
8151 int liquidtype = Math.Round(floats.Get(index));
8153 index++;
8154 }
8155
8157 {
8159 index++;
8161 index++;
8163 index++;
8165 index++;
8166 }
8167
8169 {
8170 int cleanness = Math.Round(floats.Get(index));
8172 index++;
8173 }
8174 }
8175
8177 {
8178 super.WriteVarsToCTX(ctx);
8179
8180
8182 {
8184 }
8185
8187 {
8189 }
8190
8192 {
8194 }
8195
8197 {
8198 int r,g,b,a;
8204 }
8205
8207 {
8209 }
8210 }
8211
8213 {
8214 if (!super.ReadVarsFromCTX(ctx,version))
8215 return false;
8216
8217 int intValue;
8218 float value;
8219
8220 if (version < 140)
8221 {
8222 if (!ctx.
Read(intValue))
8223 return false;
8224
8225 m_VariablesMask = intValue;
8226 }
8227
8229 {
8230 if (!ctx.
Read(value))
8231 return false;
8232
8234 {
8236 }
8237 else
8238 {
8240 }
8241 }
8242
8243 if (version < 140)
8244 {
8246 {
8247 if (!ctx.
Read(value))
8248 return false;
8249 SetTemperatureDirect(value);
8250 }
8251 }
8252
8254 {
8255 if (!ctx.
Read(value))
8256 return false;
8258 }
8259
8261 {
8262 if (!ctx.
Read(intValue))
8263 return false;
8265 }
8266
8268 {
8269 int r,g,b,a;
8271 return false;
8273 return false;
8275 return false;
8277 return false;
8278
8280 }
8281
8283 {
8284 if (!ctx.
Read(intValue))
8285 return false;
8287 }
8288
8289 if (version >= 138 && version < 140)
8290 {
8292 {
8293 if (!ctx.
Read(intValue))
8294 return false;
8295 SetFrozen(intValue);
8296 }
8297 }
8298
8299 return true;
8300 }
8301
8302
8304 {
8307 {
8309 }
8310
8311 if (!super.OnStoreLoad(ctx, version))
8312 {
8314 return false;
8315 }
8316
8317 if (version >= 114)
8318 {
8319 bool hasQuickBarIndexSaved;
8320
8321 if (!ctx.
Read(hasQuickBarIndexSaved))
8322 {
8324 return false;
8325 }
8326
8327 if (hasQuickBarIndexSaved)
8328 {
8329 int itmQBIndex;
8330
8331
8332 if (!ctx.
Read(itmQBIndex))
8333 {
8335 return false;
8336 }
8337
8338 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8339 if (itmQBIndex != -1 && parentPlayer)
8340 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8341 }
8342 }
8343 else
8344 {
8345
8346 PlayerBase player;
8347 int itemQBIndex;
8348 if (version ==
int.
MAX)
8349 {
8350 if (!ctx.
Read(itemQBIndex))
8351 {
8353 return false;
8354 }
8355 }
8356 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8357 {
8358
8359 if (!ctx.
Read(itemQBIndex))
8360 {
8362 return false;
8363 }
8364 if (itemQBIndex != -1 && player)
8365 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8366 }
8367 }
8368
8369 if (version < 140)
8370 {
8371
8372 if (!LoadVariables(ctx, version))
8373 {
8375 return false;
8376 }
8377 }
8378
8379
8381 {
8383 return false;
8384 }
8385 if (version >= 132)
8386 {
8388 if (raib)
8389 {
8391 {
8393 return false;
8394 }
8395 }
8396 }
8397
8399 return true;
8400 }
8401
8402
8403
8405 {
8406 super.OnStoreSave(ctx);
8407
8408 PlayerBase player;
8409 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8410 {
8412
8413 int itemQBIndex = -1;
8414 itemQBIndex = player.FindQuickBarEntityIndex(this);
8415 ctx.
Write(itemQBIndex);
8416 }
8417 else
8418 {
8420 }
8421
8423
8425 if (raib)
8426 {
8428 }
8429 }
8430
8431
8433 {
8434 super.AfterStoreLoad();
8435
8437 {
8439 }
8440
8442 {
8445 }
8446 }
8447
8449 {
8450 super.EEOnAfterLoad();
8451
8453 {
8455 }
8456
8459 }
8460
8462 {
8463 return false;
8464 }
8465
8466
8467
8469 {
8471 {
8472 #ifdef PLATFORM_CONSOLE
8473
8475 {
8477 if (menu)
8478 {
8480 }
8481 }
8482 #endif
8483 }
8484
8486 {
8489 }
8490
8492 {
8493 SetWeightDirty();
8495 }
8497 {
8500 }
8501
8503 {
8506
8509 }
8511 {
8515 }
8516
8517 super.OnVariablesSynchronized();
8518 }
8519
8520
8521
8523 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8524 {
8525 if (!IsServerCheck(allow_client))
8526 return false;
8527
8529 return false;
8530
8533
8534 if (value <= (min + 0.001))
8535 value = min;
8536
8537 if (value == min)
8538 {
8539 if (destroy_config)
8540 {
8541 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8542 if (dstr)
8543 {
8545 this.Delete();
8546 return true;
8547 }
8548 }
8549 else if (destroy_forced)
8550 {
8552 this.Delete();
8553 return true;
8554 }
8555
8557 }
8558
8561
8563 {
8564 EntityAI parent = GetHierarchyRoot();
8565 InventoryLocation iLoc = new InventoryLocation();
8566 GetInventory().GetCurrentInventoryLocation(iLoc);
8568 {
8569 int iLocSlot = iLoc.
GetSlot();
8571 {
8573 }
8575 {
8577 }
8578 }
8579 }
8580
8582 {
8584
8585 if (delta)
8587 }
8588
8590
8591 return false;
8592 }
8593
8594
8596 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8597 {
8599 }
8600
8602 {
8605 }
8606
8608 {
8611 }
8612
8614 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8615 {
8616 float value_clamped = Math.Clamp(value, 0, 1);
8618 SetQuantity(result, destroy_config, destroy_forced);
8619 }
8620
8621
8624 {
8626 }
8627
8629 {
8631 }
8632
8633
8634
8635
8636
8637
8638
8639
8640
8641
8643 {
8644 int slot = -1;
8645 GameInventory inventory = GetInventory();
8646 if (inventory)
8647 {
8648 InventoryLocation il = new InventoryLocation;
8651 }
8652
8654 }
8655
8657 {
8658 float quantity_max = 0;
8659
8661 {
8662 if (attSlotID != -1)
8663 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8664
8665 if (quantity_max <= 0)
8667 }
8668
8669 if (quantity_max <= 0)
8671
8672 return quantity_max;
8673 }
8674
8676 {
8678 }
8679
8681 {
8683 }
8684
8685
8687 {
8689 }
8690
8692 {
8694 }
8695
8697 {
8699 }
8700
8701
8703 {
8704
8705 float weightEx = GetWeightEx();
8706 float special = GetInventoryAndCargoWeight();
8707 return weightEx - special;
8708 }
8709
8710
8712 {
8714 }
8715
8717 {
8719 {
8720 #ifdef DEVELOPER
8721 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8722 {
8723 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
8725 }
8726 #endif
8727
8729 }
8730 else if (HasEnergyManager())
8731 {
8732 #ifdef DEVELOPER
8733 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8734 {
8735 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
8736 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
8737 }
8738 #endif
8739 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
8740 }
8741 else
8742 {
8743 #ifdef DEVELOPER
8744 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8745 {
8746 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
8747 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
8748 }
8749 #endif
8750 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
8751 }
8752 }
8753
8756 {
8757 int item_count = 0;
8759
8760 GameInventory inventory = GetInventory();
8761 CargoBase cargo = inventory.
GetCargo();
8762 if (cargo != NULL)
8763 {
8765 }
8766
8768 for (int i = 0; i < nAttachments; ++i)
8769 {
8771 if (item)
8772 item_count += item.GetNumberOfItems();
8773 }
8774 return item_count;
8775 }
8776
8779 {
8780 float weight = 0;
8781 float wetness = 1;
8782 if (include_wetness)
8785 {
8786 weight = wetness * m_ConfigWeight;
8787 }
8789 {
8790 weight = 1;
8791 }
8792 return weight;
8793 }
8794
8795
8796
8798 {
8799 GameInventory inventory = GetInventory();
8800 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
8801 {
8802 array<EntityAI> items = new array<EntityAI>;
8804 for (int i = 0; i < items.Count(); ++i)
8805 {
8807 if (item)
8808 {
8809 g_Game.ObjectDelete(item);
8810 }
8811 }
8812 }
8813 }
8814
8815
8816
8817
8819 {
8820 float energy = 0;
8821 if (HasEnergyManager())
8822 {
8823 energy = GetCompEM().GetEnergy();
8824 }
8825 return energy;
8826 }
8827
8828
8830 {
8831 super.OnEnergyConsumed();
8832
8834 }
8835
8837 {
8838 super.OnEnergyAdded();
8839
8841 }
8842
8843
8845 {
8846 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
8847 {
8849 {
8850 float energy_0to1 = GetCompEM().GetEnergy0To1();
8852 }
8853 }
8854 }
8855
8856
8858 {
8859 return ConfigGetFloat("heatIsolation");
8860 }
8861
8863 {
8865 }
8866
8868 {
8869 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
8870 if (
g_Game.ConfigIsExisting(paramPath))
8871 return g_Game.ConfigGetFloat(paramPath);
8872
8873 return 0.0;
8874 }
8875
8877 {
8878 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
8879 if (
g_Game.ConfigIsExisting(paramPath))
8880 return g_Game.ConfigGetFloat(paramPath);
8881
8882 return 0.0;
8883 }
8884
8885 override void SetWet(
float value,
bool allow_client =
false)
8886 {
8887 if (!IsServerCheck(allow_client))
8888 return;
8889
8892
8894
8895 m_VarWet = Math.Clamp(value, min, max);
8896
8898 {
8901 }
8902 }
8903
8904 override void AddWet(
float value)
8905 {
8907 }
8908
8910 {
8912 }
8913
8915 {
8917 }
8918
8920 {
8922 }
8923
8925 {
8927 }
8928
8930 {
8932 }
8933
8935 {
8938 if (newLevel != oldLevel)
8939 {
8941 }
8942 }
8943
8945 {
8946 SetWeightDirty();
8947 }
8948
8950 {
8951 return GetWetLevelInternal(
m_VarWet);
8952 }
8953
8954
8955
8957 {
8959 }
8960
8962 {
8964 }
8965
8967 {
8969 }
8970
8972 {
8974 }
8975
8976
8977
8979 {
8980 if (ConfigIsExisting("itemModelLength"))
8981 {
8982 return ConfigGetFloat("itemModelLength");
8983 }
8984 return 0;
8985 }
8986
8988 {
8989 if (ConfigIsExisting("itemAttachOffset"))
8990 {
8991 return ConfigGetFloat("itemAttachOffset");
8992 }
8993 return 0;
8994 }
8995
8996 override void SetCleanness(
int value,
bool allow_client =
false)
8997 {
8998 if (!IsServerCheck(allow_client))
8999 return;
9000
9002
9004
9007 }
9008
9010 {
9012 }
9013
9015 {
9016 return true;
9017 }
9018
9019
9020
9021
9023 {
9025 }
9026
9028 {
9030 }
9031
9032
9033
9034
9035 override void SetColor(
int r,
int g,
int b,
int a)
9036 {
9042 }
9044 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9045 {
9050 }
9051
9053 {
9055 }
9056
9059 {
9060 int r,g,b,a;
9062 r = r/255;
9063 g = g/255;
9064 b = b/255;
9065 a = a/255;
9066 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9067 }
9068
9069
9070
9071 override void SetLiquidType(
int value,
bool allow_client =
false)
9072 {
9073 if (!IsServerCheck(allow_client))
9074 return;
9075
9080 }
9081
9083 {
9084 return ConfigGetInt("varLiquidTypeInit");
9085 }
9086
9088 {
9090 }
9091
9093 {
9095 SetFrozen(false);
9096 }
9097
9100 {
9101 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9102 }
9103
9104
9107 {
9108 PlayerBase nplayer;
9109 if (PlayerBase.CastTo(nplayer, player))
9110 {
9112 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9113 }
9114 }
9115
9116
9119 {
9120 PlayerBase nplayer;
9121 if (PlayerBase.CastTo(nplayer,player))
9122 {
9123 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9124 }
9125
9126 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9127
9128 if (HasEnergyManager())
9129 {
9130 GetCompEM().UpdatePlugState();
9131 }
9132 }
9133
9134
9136 {
9137 super.OnPlacementStarted(player);
9138
9140 }
9141
9142 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9143 {
9145 {
9146 m_AdminLog.OnPlacementComplete(player,
this);
9147 }
9148
9149 super.OnPlacementComplete(player, position, orientation);
9150 }
9151
9152
9153
9154
9155
9157 {
9159 {
9160 return true;
9161 }
9162 else
9163 {
9164 return false;
9165 }
9166 }
9167
9168
9170 {
9172 {
9174 }
9175 }
9176
9177
9179 {
9181 }
9182
9184 {
9186 }
9187
9188 override void InsertAgent(
int agent,
float count = 1)
9189 {
9190 if (count < 1)
9191 return;
9192
9194 }
9195
9198 {
9200 }
9201
9202
9204 {
9206 }
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9250 {
9252 return false;
9253 return true;
9254 }
9255
9257 {
9258
9260 }
9261
9262
9265 {
9266 super.CheckForRoofLimited(timeTresholdMS);
9267
9268 float time =
g_Game.GetTime();
9269 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9270 {
9271 m_PreviousRoofTestTime = time;
9272 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9273 }
9274 }
9275
9276
9278 {
9280 {
9281 return 0;
9282 }
9283
9284 if (GetInventory().GetAttachmentSlotsCount() != 0)
9285 {
9286 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9287 if (filter)
9288 return filter.GetProtectionLevel(type, false, system);
9289 else
9290 return 0;
9291 }
9292
9293 string subclassPath, entryName;
9294
9295 switch (type)
9296 {
9298 entryName = "biological";
9299 break;
9301 entryName = "chemical";
9302 break;
9303 default:
9304 entryName = "biological";
9305 break;
9306 }
9307
9308 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9309
9310 return g_Game.ConfigGetFloat(subclassPath + entryName);
9311 }
9312
9313
9314
9317 {
9318 if (!IsMagazine())
9320
9322 }
9323
9324
9325
9326
9327
9332 {
9333 return true;
9334 }
9335
9337 {
9339 }
9340
9341
9342
9343
9344
9346 {
9347 if (parent)
9348 {
9349 if (parent.IsInherited(DayZInfected))
9350 return true;
9351
9352 if (!parent.IsRuined())
9353 return true;
9354 }
9355
9356 return true;
9357 }
9358
9360 {
9361 if (!super.CanPutAsAttachment(parent))
9362 {
9363 return false;
9364 }
9365
9366 if (!IsRuined() && !parent.IsRuined())
9367 {
9368 return true;
9369 }
9370
9371 return false;
9372 }
9373
9375 {
9376
9377
9378
9379
9380 return super.CanReceiveItemIntoCargo(item);
9381 }
9382
9384 {
9385
9386
9387
9388
9389 GameInventory attachmentInv = attachment.GetInventory();
9391 {
9392 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9393 return false;
9394 }
9395
9396 InventoryLocation loc = new InventoryLocation();
9397 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9398 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9399 return false;
9400
9401 return super.CanReceiveAttachment(attachment, slotId);
9402 }
9403
9405 {
9406 if (!super.CanReleaseAttachment(attachment))
9407 return false;
9408
9409 return GetInventory().AreChildrenAccessible();
9410 }
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9433 {
9434 int id = muzzle_owner.GetMuzzleID();
9435 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9436
9437 if (WPOF_array)
9438 {
9439 for (int i = 0; i < WPOF_array.Count(); i++)
9440 {
9441 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9442
9443 if (WPOF)
9444 {
9445 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9446 }
9447 }
9448 }
9449 }
9450
9451
9453 {
9454 int id = muzzle_owner.GetMuzzleID();
9456
9457 if (WPOBE_array)
9458 {
9459 for (int i = 0; i < WPOBE_array.Count(); i++)
9460 {
9461 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9462
9463 if (WPOBE)
9464 {
9465 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9466 }
9467 }
9468 }
9469 }
9470
9471
9473 {
9474 int id = muzzle_owner.GetMuzzleID();
9475 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9476
9477 if (WPOOH_array)
9478 {
9479 for (int i = 0; i < WPOOH_array.Count(); i++)
9480 {
9481 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9482
9483 if (WPOOH)
9484 {
9485 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9486 }
9487 }
9488 }
9489 }
9490
9491
9493 {
9494 int id = muzzle_owner.GetMuzzleID();
9495 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9496
9497 if (WPOOH_array)
9498 {
9499 for (int i = 0; i < WPOOH_array.Count(); i++)
9500 {
9501 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9502
9503 if (WPOOH)
9504 {
9505 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9506 }
9507 }
9508 }
9509 }
9510
9511
9513 {
9514 int id = muzzle_owner.GetMuzzleID();
9515 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9516
9517 if (WPOOH_array)
9518 {
9519 for (int i = 0; i < WPOOH_array.Count(); i++)
9520 {
9521 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9522
9523 if (WPOOH)
9524 {
9525 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9526 }
9527 }
9528 }
9529 }
9530
9531
9532
9534 {
9536 {
9537 return true;
9538 }
9539
9540 return false;
9541 }
9542
9544 {
9546 {
9547 return true;
9548 }
9549
9550 return false;
9551 }
9552
9554 {
9556 {
9557 return true;
9558 }
9559
9560 return false;
9561 }
9562
9564 {
9565 return false;
9566 }
9567
9570 {
9571 return UATimeSpent.DEFAULT_DEPLOY;
9572 }
9573
9574
9575
9576
9578 {
9580 SetSynchDirty();
9581 }
9582
9584 {
9586 }
9587
9588
9590 {
9591 return false;
9592 }
9593
9596 {
9597 string att_type = "None";
9598
9599 if (ConfigIsExisting("soundAttType"))
9600 {
9601 att_type = ConfigGetString("soundAttType");
9602 }
9603
9605 }
9606
9608 {
9610 }
9611
9612
9613
9614
9615
9621
9623 {
9626
9628 }
9629
9630
9632 {
9634 return;
9635
9637
9640
9643
9644 SoundParameters params = new SoundParameters();
9648 }
9649
9650
9652 {
9654 {
9657
9658 SetSynchDirty();
9659
9662 }
9663 }
9664
9666 {
9668 }
9669
9670
9672 {
9674 return;
9675
9677 SetSynchDirty();
9678
9681 }
9682
9684 {
9687 }
9688
9690 {
9692 }
9693
9694 void OnApply(PlayerBase player);
9695
9697 {
9698 return 1.0;
9699 };
9700
9702 {
9704 }
9705
9707 {
9709 }
9710
9712
9714 {
9715 SetDynamicPhysicsLifeTime(0.01);
9717 }
9718
9720 {
9721 array<string> zone_names = new array<string>;
9722 GetDamageZones(zone_names);
9723 for (int i = 0; i < zone_names.Count(); i++)
9724 {
9725 SetHealthMax(zone_names.Get(i),"Health");
9726 }
9727 SetHealthMax("","Health");
9728 }
9729
9732 {
9733 float global_health = GetHealth01("","Health");
9734 array<string> zones = new array<string>;
9735 GetDamageZones(zones);
9736
9737 for (int i = 0; i < zones.Count(); i++)
9738 {
9739 SetHealth01(zones.Get(i),"Health",global_health);
9740 }
9741 }
9742
9745 {
9746 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
9747 }
9748
9750 {
9751 if (!hasRootAsPlayer)
9752 {
9753 if (refParentIB)
9754 {
9755
9756 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
9757 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
9758
9759 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
9760 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
9761
9764 }
9765 else
9766 {
9767
9770 }
9771 }
9772 }
9773
9775 {
9777 {
9778 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
9779 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
9780 {
9781 float heatPermCoef = 1.0;
9783 while (ent)
9784 {
9785 heatPermCoef *= ent.GetHeatPermeabilityCoef();
9786 ent = ent.GetHierarchyParent();
9787 }
9788
9789 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
9790 }
9791 }
9792 }
9793
9795 {
9796
9797 EntityAI parent = GetHierarchyParent();
9798 if (!parent)
9799 {
9800 hasParent = false;
9801 hasRootAsPlayer = false;
9802 }
9803 else
9804 {
9805 hasParent = true;
9806 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
9807 refParentIB =
ItemBase.Cast(parent);
9808 }
9809 }
9810
9811 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
9812 {
9813
9814 }
9815
9817 {
9818
9819 return false;
9820 }
9821
9823 {
9824
9825
9826 return false;
9827 }
9828
9830 {
9831
9832 return false;
9833 }
9834
9837 {
9838 return !GetIsFrozen() &&
IsOpen();
9839 }
9840
9842 {
9843 bool hasParent = false, hasRootAsPlayer = false;
9845
9846 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
9847 bool foodDecay =
g_Game.IsFoodDecayEnabled();
9848
9849 if (wwtu || foodDecay)
9850 {
9854
9855 if (processWetness || processTemperature || processDecay)
9856 {
9858
9859 if (processWetness)
9860 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
9861
9862 if (processTemperature)
9864
9865 if (processDecay)
9866 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
9867 }
9868 }
9869 }
9870
9873 {
9875 }
9876
9878 {
9881
9882 return super.GetTemperatureFreezeThreshold();
9883 }
9884
9886 {
9889
9890 return super.GetTemperatureThawThreshold();
9891 }
9892
9894 {
9897
9898 return super.GetItemOverheatThreshold();
9899 }
9900
9902 {
9904 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
9905
9906 return super.GetTemperatureFreezeTime();
9907 }
9908
9910 {
9912 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
9913
9914 return super.GetTemperatureThawTime();
9915 }
9916
9921
9923 {
9924 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
9925 }
9926
9928 {
9929 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
9930 }
9931
9934 {
9936 }
9937
9939 {
9941 }
9942
9944 {
9946 }
9947
9950 {
9951 return null;
9952 }
9953
9956 {
9957 return false;
9958 }
9959
9961 {
9963 {
9966 if (!trg)
9967 {
9969 explosive = this;
9970 }
9971
9972 explosive.PairRemote(trg);
9974
9975 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
9976 trg.SetPersistentPairID(persistentID);
9977 explosive.SetPersistentPairID(persistentID);
9978
9979 return true;
9980 }
9981 return false;
9982 }
9983
9986 {
9987 float ret = 1.0;
9990 ret *= GetHealth01();
9991
9992 return ret;
9993 }
9994
9995 #ifdef DEVELOPER
9996 override void SetDebugItem()
9997 {
9998 super.SetDebugItem();
9999 _itemBase = this;
10000 }
10001
10003 {
10004 string text = super.GetDebugText();
10005
10007 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10008
10009 return text;
10010 }
10011 #endif
10012
10014 {
10015 return true;
10016 }
10017
10019
10021
10023 {
10026 }
10027
10028
10036
10052
10053 [
Obsolete(
"Use ItemSoundHandler instead")]
10056 {
10057 if (!
g_Game.IsDedicatedServer())
10058 {
10059 if (ConfigIsExisting("attachSoundSet"))
10060 {
10061 string cfg_path = "";
10062 string soundset = "";
10063 string type_name =
GetType();
10064
10067 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10068 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10069
10070 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10071 {
10072 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10073 {
10074 if (cfg_slot_array[i] == slot_type)
10075 {
10076 soundset = cfg_soundset_array[i];
10077 break;
10078 }
10079 }
10080 }
10081
10082 if (soundset != "")
10083 {
10084 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10086 }
10087 }
10088 }
10089 }
10090
10092}
10093
10095{
10097 if (entity)
10098 {
10099 bool is_item = entity.IsInherited(
ItemBase);
10100 if (is_item && full_quantity)
10101 {
10104 }
10105 }
10106 else
10107 {
10109 return NULL;
10110 }
10111 return entity;
10112}
10113
10115{
10116 if (item)
10117 {
10118 if (health > 0)
10119 item.SetHealth("", "", health);
10120
10121 if (item.CanHaveTemperature())
10122 {
10124 if (item.CanFreeze())
10125 item.SetFrozen(false);
10126 }
10127
10128 if (item.HasEnergyManager())
10129 {
10130 if (quantity >= 0)
10131 {
10132 item.GetCompEM().SetEnergy0To1(quantity);
10133 }
10134 else
10135 {
10137 }
10138 }
10139 else if (item.IsMagazine())
10140 {
10141 Magazine mag = Magazine.Cast(item);
10142 if (quantity >= 0)
10143 {
10144 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10145 }
10146 else
10147 {
10149 }
10150
10151 }
10152 else
10153 {
10154 if (quantity >= 0)
10155 {
10156 item.SetQuantityNormalized(quantity, false);
10157 }
10158 else
10159 {
10161 }
10162
10163 }
10164 }
10165}
10166
10167#ifdef DEVELOPER
10169#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.