5123{
5125 {
5126 return true;
5127 }
5128};
5129
5130
5131
5133{
5137
5139
5142
5143
5144
5145
5146
5155
5161
5166
5171
5192 protected bool m_IsResultOfSplit
5193
5195
5200
5201
5202
5204
5208
5209
5210
5212
5215
5216
5217
5223
5224
5232
5235
5236
5238
5239
5241
5242
5247
5248
5253
5254
5256
5257
5259 {
5264
5265 if (!
GetGame().IsDedicatedServer())
5266 {
5268 {
5270
5272 {
5274 }
5275 }
5276
5279 }
5280
5281 m_OldLocation = null;
5282
5284 {
5286 }
5287
5288 if (ConfigIsExisting("headSelectionsToHide"))
5289 {
5292 }
5293
5295 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5296 {
5298 }
5299
5301
5302 m_IsResultOfSplit = false;
5303
5305 }
5306
5308 {
5309 super.InitItemVariables();
5310
5316 m_Count = ConfigGetInt(
"count");
5317
5320
5325
5328
5333
5345
5349
5350
5353 if (ConfigIsExisting("canBeSplit"))
5354 {
5357 }
5358
5360 if (ConfigIsExisting("itemBehaviour"))
5362
5363
5366 RegisterNetSyncVariableInt("m_VarLiquidType");
5367 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5368
5369 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5370 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5371 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5372
5373 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5374 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5375 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5376 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5377
5378 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5379 RegisterNetSyncVariableBool("m_IsTakeable");
5380 RegisterNetSyncVariableBool("m_IsHologram");
5381
5384 {
5387 }
5388
5390
5392 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5394
5395 }
5396
5398 {
5400 }
5401
5403 {
5406 {
5411 }
5412 }
5413
5414 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5415 {
5417 {
5420 }
5421
5423 }
5424
5426 {
5432 }
5433
5435
5437 {
5439
5440 if (!action)
5441 {
5442 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5443 return;
5444 }
5445
5447 if (!ai)
5448 {
5450 return;
5451 }
5452
5454 if (!action_array)
5455 {
5456 action_array = new array<ActionBase_Basic>;
5458 }
5459 if (LogManager.IsActionLogEnable())
5460 {
5461 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5462 }
5463
5464 if (action_array.Find(action) != -1)
5465 {
5466 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5467 }
5468 else
5469 {
5470 action_array.Insert(action);
5471 }
5472 }
5473
5475 {
5477 ActionBase action = player.GetActionManager().GetAction(actionName);
5480
5481 if (action_array)
5482 {
5483 action_array.RemoveItem(action);
5484 }
5485 }
5486
5487
5488
5490 {
5491 ActionOverrideData overrideData = new ActionOverrideData();
5495
5497 if (!actionMap)
5498 {
5501 }
5502
5503 actionMap.Insert(this.
Type(), overrideData);
5504
5505 }
5506
5508
5510
5511
5513 {
5516
5519
5520 string config_to_search = "CfgVehicles";
5521 string muzzle_owner_config;
5522
5524 {
5525 if (IsInherited(Weapon))
5526 config_to_search = "CfgWeapons";
5527
5528 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5529
5530 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5531
5533
5534 if (config_OnFire_subclass_count > 0)
5535 {
5536 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5537
5538 for (int i = 0; i < config_OnFire_subclass_count; i++)
5539 {
5540 string particle_class = "";
5542 string config_OnFire_entry = config_OnFire_class + particle_class;
5543 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5544 WPOF_array.Insert(WPOF);
5545 }
5546
5547
5549 }
5550 }
5551
5553 {
5554 config_to_search = "CfgWeapons";
5555 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5556
5557 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5558
5560
5561 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
5562 {
5563 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
5564
5565 for (i = 0; i < config_OnBulletCasingEject_count; i++)
5566 {
5567 string particle_class2 = "";
5569 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
5570 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
5571 WPOBE_array.Insert(WPOBE);
5572 }
5573
5574
5576 }
5577 }
5578 }
5579
5580
5582 {
5585
5587 {
5588 string config_to_search = "CfgVehicles";
5589
5590 if (IsInherited(Weapon))
5591 config_to_search = "CfgWeapons";
5592
5593 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5594 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
5595
5596 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
5597 {
5598
5600
5602 {
5604 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
5606 return;
5607 }
5608
5611
5612
5613
5615 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
5616
5617 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
5618 {
5619 string particle_class = "";
5621 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
5623
5624 if (entry_type == CT_CLASS)
5625 {
5626 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
5627 WPOOH_array.Insert(WPOF);
5628 }
5629 }
5630
5631
5633 }
5634 }
5635 }
5636
5638 {
5640 }
5641
5643 {
5645 {
5647
5650
5653
5654 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5655 }
5656 }
5657
5659 {
5661 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5662
5664 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5665
5667 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5668
5670 {
5672 }
5673 }
5674
5676 {
5678 }
5679
5681 {
5684 else
5686
5688 {
5691 }
5692 else
5693 {
5696
5699 }
5700
5702 }
5703
5705 {
5707 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5708 }
5709
5711 {
5713 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5715 }
5716
5718 {
5720 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5721 }
5722
5724 {
5727
5728 OverheatingParticle OP = new OverheatingParticle();
5733
5735 }
5736
5738 {
5741
5742 return -1;
5743 }
5744
5746 {
5748 {
5751
5752 for (int i = count; i > 0; --i)
5753 {
5754 int id = i - 1;
5757
5760
5761 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
5762 {
5763 if (p)
5764 {
5767 }
5768 }
5769 }
5770 }
5771 }
5772
5774 {
5776 {
5778 {
5779 int id = i - 1;
5781
5782 if (OP)
5783 {
5785
5786 if (p)
5787 {
5789 }
5790
5791 delete OP;
5792 }
5793 }
5794
5797 }
5798 }
5799
5802 {
5803 return 0.0;
5804 }
5805
5806
5808 {
5809 return 250;
5810 }
5811
5813 {
5814 return 0;
5815 }
5816
5819 {
5821 return true;
5822
5823 return false;
5824 }
5825
5828 {
5831
5833 {
5835 }
5836 else
5837 {
5838
5840 }
5841
5843 }
5844
5851 {
5852 return -1;
5853 }
5854
5855
5856
5857
5859 {
5861 {
5863 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
5864
5865 if (r_index >= 0)
5866 {
5867 InventoryLocation r_il = new InventoryLocation;
5868 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
5869
5870 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
5873 {
5874 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
5875 }
5877 {
5878 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
5879 }
5880
5881 }
5882
5883 player.GetHumanInventory().ClearUserReservedLocation(this);
5884 }
5885
5888 }
5889
5890
5891
5892
5894 {
5895 return ItemBase.m_DebugActionsMask;
5896 }
5897
5899 {
5900 return ItemBase.m_DebugActionsMask & mask;
5901 }
5902
5904 {
5905 ItemBase.m_DebugActionsMask = mask;
5906 }
5907
5909 {
5910 ItemBase.m_DebugActionsMask |= mask;
5911 }
5912
5914 {
5915 ItemBase.m_DebugActionsMask &= ~mask;
5916 }
5917
5919 {
5921 {
5923 }
5924 else
5925 {
5927 }
5928 }
5929
5930
5932 {
5933 if (GetEconomyProfile())
5934 {
5935 float q_max = GetEconomyProfile().GetQuantityMax();
5936 if (q_max > 0)
5937 {
5938 float q_min = GetEconomyProfile().GetQuantityMin();
5939 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
5940
5942 {
5943 ComponentEnergyManager comp = GetCompEM();
5945 {
5947 }
5948 }
5950 {
5952
5953 }
5954
5955 }
5956 }
5957 }
5958
5961 {
5962 EntityAI parent = GetHierarchyParent();
5963
5964 if (parent)
5965 {
5966 InventoryLocation inventory_location_to_lock = new InventoryLocation;
5967 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
5968 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
5969 }
5970 }
5971
5974 {
5975 EntityAI parent = GetHierarchyParent();
5976
5977 if (parent)
5978 {
5979 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
5980 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
5981 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
5982 }
5983 }
5984
5986 {
5987
5988
5989
5990
5992
5994 {
5995 if (ScriptInputUserData.CanStoreInputUserData())
5996 {
5997 ScriptInputUserData ctx = new ScriptInputUserData;
6003 ctx.
Write(use_stack_max);
6006
6008 {
6009 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6010 }
6011 }
6012 }
6013 else if (!
GetGame().IsMultiplayer())
6014 {
6016 }
6017 }
6018
6020 {
6022 }
6023
6025 {
6027 }
6028
6030 {
6032 }
6033
6035 {
6036
6037 return false;
6038 }
6039
6041 {
6042 return false;
6043 }
6044
6048 {
6049 return false;
6050 }
6051
6053 {
6054 return "";
6055 }
6056
6058
6060 {
6061 return false;
6062 }
6063
6065 {
6066 return true;
6067 }
6068
6069
6070
6072 {
6073 return true;
6074 }
6075
6077 {
6078 return true;
6079 }
6080
6082 {
6083 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6085 }
6086
6088 {
6090 }
6091
6093 {
6095 if (!is_being_placed)
6097 SetSynchDirty();
6098 }
6099
6100
6102
6104 {
6106 }
6107
6109 {
6111 }
6112
6114 {
6115 return 1;
6116 }
6117
6119 {
6120 return false;
6121 }
6122
6124 {
6126 SetSynchDirty();
6127 }
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6164 {
6165 super.OnMovedInsideCargo(container);
6166
6167 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6168 }
6169
6170 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6171 {
6172 super.EEItemLocationChanged(oldLoc,newLoc);
6173
6174 PlayerBase new_player = null;
6175 PlayerBase old_player = null;
6176
6177 if (newLoc.GetParent())
6178 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6179
6180 if (oldLoc.GetParent())
6181 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6182
6184 {
6185 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6186
6187 if (r_index >= 0)
6188 {
6189 InventoryLocation r_il = new InventoryLocation;
6190 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6191
6192 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6195 {
6196 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6197 }
6199 {
6200 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6201 }
6202
6203 }
6204 }
6205
6207 {
6208 if (new_player)
6209 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6210
6211 if (new_player == old_player)
6212 {
6213
6214 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6215 {
6217 {
6218 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6219 {
6220 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6221 }
6222 }
6223 else
6224 {
6225 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6226 }
6227 }
6228
6229 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6230 {
6231 int type = oldLoc.GetType();
6233 {
6234 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6235 }
6237 {
6238 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6239 }
6240 }
6241 if (!m_OldLocation)
6242 {
6243 m_OldLocation = new InventoryLocation;
6244 }
6245 m_OldLocation.Copy(oldLoc);
6246 }
6247 else
6248 {
6249 if (m_OldLocation)
6250 {
6251 m_OldLocation.Reset();
6252 }
6253 }
6254
6256 }
6257 else
6258 {
6259 if (new_player)
6260 {
6261 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6262 if (res_index >= 0)
6263 {
6264 InventoryLocation il = new InventoryLocation;
6265 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6267 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6270 {
6271 il.
GetParent().GetOnReleaseLock().Invoke(it);
6272 }
6274 {
6276 }
6277
6278 }
6279 }
6281 {
6282
6284 }
6285
6286 if (m_OldLocation)
6287 {
6288 m_OldLocation.Reset();
6289 }
6290 }
6291 }
6292
6293 override void EOnContact(IEntity other, Contact extra)
6294 {
6296 {
6297 int liquidType = -1;
6299 if (impactSpeed > 0.0)
6300 {
6302 #ifndef SERVER
6304 #else
6306 SetSynchDirty();
6307 #endif
6309 }
6310 }
6311
6312 #ifdef SERVER
6313 if (GetCompEM() && GetCompEM().IsPlugged())
6314 {
6315 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6316 GetCompEM().UnplugThis();
6317 }
6318 #endif
6319 }
6320
6322
6324 {
6326 }
6327
6329 {
6330
6331 }
6332
6334 {
6335 super.OnItemLocationChanged(old_owner, new_owner);
6336
6337 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6338 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6339
6340 if (!relatedPlayer && playerNew)
6341 relatedPlayer = playerNew;
6342
6343 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6344 {
6346 if (actionMgr)
6347 {
6348 ActionBase currentAction = actionMgr.GetRunningAction();
6349 if (currentAction)
6351 }
6352 }
6353
6354 Man ownerPlayerOld = null;
6355 Man ownerPlayerNew = null;
6356
6357 if (old_owner)
6358 {
6359 if (old_owner.
IsMan())
6360 {
6361 ownerPlayerOld = Man.Cast(old_owner);
6362 }
6363 else
6364 {
6365 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6366 }
6367 }
6368 else
6369 {
6371 {
6373
6374 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6375 {
6376 GetCompEM().UnplugThis();
6377 }
6378 }
6379 }
6380
6381 if (new_owner)
6382 {
6383 if (new_owner.
IsMan())
6384 {
6385 ownerPlayerNew = Man.Cast(new_owner);
6386 }
6387 else
6388 {
6389 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6390 }
6391 }
6392
6393 if (ownerPlayerOld != ownerPlayerNew)
6394 {
6395 if (ownerPlayerOld)
6396 {
6397 array<EntityAI> subItemsExit = new array<EntityAI>;
6399 for (int i = 0; i < subItemsExit.Count(); i++)
6400 {
6403 }
6404 }
6405
6406 if (ownerPlayerNew)
6407 {
6408 array<EntityAI> subItemsEnter = new array<EntityAI>;
6410 for (int j = 0; j < subItemsEnter.Count(); j++)
6411 {
6414 }
6415 }
6416 }
6417 else if (ownerPlayerNew != null)
6418 {
6419 PlayerBase nplayer;
6420 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6421 {
6422 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6424 for (int k = 0; k < subItemsUpdate.Count(); k++)
6425 {
6427 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6428 }
6429 }
6430 }
6431
6432 if (old_owner)
6433 old_owner.OnChildItemRemoved(this);
6434 if (new_owner)
6435 new_owner.OnChildItemReceived(this);
6436 }
6437
6438
6440 {
6441 super.EEDelete(parent);
6442 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6443 if (player)
6444 {
6446
6447 if (player.IsAlive())
6448 {
6449 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6450 if (r_index >= 0)
6451 {
6452 InventoryLocation r_il = new InventoryLocation;
6453 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6454
6455 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6458 {
6459 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6460 }
6462 {
6463 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6464 }
6465
6466 }
6467
6468 player.RemoveQuickBarEntityShortcut(this);
6469 }
6470 }
6471 }
6472
6474 {
6475 super.EEKilled(killer);
6476
6479 {
6480 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6481 {
6482 if (IsMagazine())
6483 {
6484 if (Magazine.Cast(this).GetAmmoCount() > 0)
6485 {
6487 }
6488 }
6489 else
6490 {
6492 }
6493 }
6494 }
6495 }
6496
6498 {
6499 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6500
6501 super.OnWasAttached(parent, slot_id);
6502
6505
6507 }
6508
6510 {
6511 super.OnWasDetached(parent, slot_id);
6512
6515 }
6516
6518 {
6519 int idx;
6522
6523 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6524 if (inventory_slots.Count() < 1)
6525 {
6526 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6527 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6528 }
6529 else
6530 {
6531 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6532 }
6533
6534 idx = inventory_slots.Find(slot);
6535 if (idx < 0)
6536 return "";
6537
6538 return attach_types.Get(idx);
6539 }
6540
6542 {
6543 int idx = -1;
6544 string slot;
6545
6548
6549 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6550 if (inventory_slots.Count() < 1)
6551 {
6552 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6553 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6554 }
6555 else
6556 {
6557 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6558 if (detach_types.Count() < 1)
6559 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6560 }
6561
6562 for (int i = 0; i < inventory_slots.Count(); i++)
6563 {
6564 slot = inventory_slots.Get(i);
6565 }
6566
6567 if (slot != "")
6568 {
6569 if (detach_types.Count() == 1)
6570 idx = 0;
6571 else
6572 idx = inventory_slots.Find(slot);
6573 }
6574 if (idx < 0)
6575 return "";
6576
6577 return detach_types.Get(idx);
6578 }
6579
6581 {
6582
6584
6585
6586 float min_time = 1;
6587 float max_time = 3;
6588 float delay = Math.RandomFloat(min_time, max_time);
6589
6590 explode_timer.Run(delay, this, "DoAmmoExplosion");
6591 }
6592
6594 {
6595 Magazine magazine = Magazine.Cast(this);
6596 int pop_sounds_count = 6;
6597 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
6598
6599
6600 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
6601 string sound_name = pop_sounds[ sound_idx ];
6603
6604
6605 magazine.ServerAddAmmoCount(-1);
6606
6607
6608 float min_temp_to_explode = 100;
6609
6610 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
6611 {
6613 }
6614 }
6615
6616
6617 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
6618 {
6619 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
6620
6621 const int CHANCE_DAMAGE_CARGO = 4;
6622 const int CHANCE_DAMAGE_ATTACHMENT = 1;
6623 const int CHANCE_DAMAGE_NOTHING = 2;
6624
6626 {
6627 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
6628 int chances;
6629 int rnd;
6630
6631 if (GetInventory().GetCargo())
6632 {
6633 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6634 rnd = Math.RandomInt(0,chances);
6635
6636 if (rnd < CHANCE_DAMAGE_CARGO)
6637 {
6639 }
6640 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
6641 {
6643 }
6644 }
6645 else
6646 {
6647 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6648 rnd = Math.RandomInt(0,chances);
6649
6650 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
6651 {
6653 }
6654 }
6655 }
6656 }
6657
6659 {
6660 if (GetInventory().GetCargo())
6661 {
6662 int item_count = GetInventory().GetCargo().GetItemCount();
6663 if (item_count > 0)
6664 {
6665 int random_pick = Math.RandomInt(0, item_count);
6667 if (!item.IsExplosive())
6668 {
6669 item.AddHealth("","",damage);
6670 return true;
6671 }
6672 }
6673 }
6674 return false;
6675 }
6676
6678 {
6679 int attachment_count = GetInventory().AttachmentCount();
6680 if (attachment_count > 0)
6681 {
6682 int random_pick = Math.RandomInt(0, attachment_count);
6683 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
6684 if (!attachment.IsExplosive())
6685 {
6686 attachment.AddHealth("","",damage);
6687 return true;
6688 }
6689 }
6690 return false;
6691 }
6692
6694 {
6696 }
6697
6699 {
6701 return GetInventory().CanRemoveEntity();
6702
6703 return false;
6704 }
6705
6707 {
6708
6710 return false;
6711
6712
6714 return false;
6715
6716
6717
6719 if (delta == 0)
6720 return false;
6721
6722
6723 return true;
6724 }
6725
6727 {
6729 {
6730 if (ScriptInputUserData.CanStoreInputUserData())
6731 {
6732 ScriptInputUserData ctx = new ScriptInputUserData;
6737 ctx.
Write(destination_entity);
6741 }
6742 }
6743 else if (!
GetGame().IsMultiplayer())
6744 {
6746 }
6747 }
6748
6750 {
6751 float split_quantity_new;
6755 InventoryLocation loc = new InventoryLocation;
6756
6757 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6758 {
6760 split_quantity_new = stack_max;
6761 else
6763
6765 {
6766 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6767 if (new_item)
6768 {
6769 new_item.SetResultOfSplit(true);
6770 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6772 new_item.
SetQuantity(split_quantity_new,
false,
true);
6773 }
6774 }
6775 }
6776 else if (destination_entity && slot_id == -1)
6777 {
6778 if (quantity > stack_max)
6779 split_quantity_new = stack_max;
6780 else
6781 split_quantity_new = quantity;
6782
6784 {
6786 {
6789 }
6790
6791 if (new_item)
6792 {
6793 new_item.SetResultOfSplit(true);
6794 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6796 new_item.
SetQuantity(split_quantity_new,
false,
true);
6797 }
6798 }
6799 }
6800 else
6801 {
6802 if (stack_max != 0)
6803 {
6805 {
6807 }
6808
6809 if (split_quantity_new == 0)
6810 {
6811 if (!
GetGame().IsMultiplayer())
6812 player.PhysicalPredictiveDropItem(this);
6813 else
6814 player.ServerDropEntity(this);
6815 return;
6816 }
6817
6819 {
6821
6822 if (new_item)
6823 {
6824 new_item.SetResultOfSplit(true);
6825 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6828 new_item.PlaceOnSurface();
6829 }
6830 }
6831 }
6832 }
6833 }
6834
6836 {
6837 float split_quantity_new;
6841 InventoryLocation loc = new InventoryLocation;
6842
6843 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6844 {
6846 split_quantity_new = stack_max;
6847 else
6849
6851 {
6852 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6853 if (new_item)
6854 {
6855 new_item.SetResultOfSplit(true);
6856 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6858 new_item.
SetQuantity(split_quantity_new,
false,
true);
6859 }
6860 }
6861 }
6862 else if (destination_entity && slot_id == -1)
6863 {
6864 if (quantity > stack_max)
6865 split_quantity_new = stack_max;
6866 else
6867 split_quantity_new = quantity;
6868
6870 {
6872 {
6875 }
6876
6877 if (new_item)
6878 {
6879 new_item.SetResultOfSplit(true);
6880 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6882 new_item.
SetQuantity(split_quantity_new,
false,
true);
6883 }
6884 }
6885 }
6886 else
6887 {
6888 if (stack_max != 0)
6889 {
6891 {
6893 }
6894
6896 {
6898
6899 if (new_item)
6900 {
6901 new_item.SetResultOfSplit(true);
6902 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6905 new_item.PlaceOnSurface();
6906 }
6907 }
6908 }
6909 }
6910 }
6911
6913 {
6915 {
6916 if (ScriptInputUserData.CanStoreInputUserData())
6917 {
6918 ScriptInputUserData ctx = new ScriptInputUserData;
6923 dst.WriteToContext(ctx);
6925 }
6926 }
6927 else if (!
GetGame().IsMultiplayer())
6928 {
6930 }
6931 }
6932
6934 {
6936 {
6937 if (ScriptInputUserData.CanStoreInputUserData())
6938 {
6939 ScriptInputUserData ctx = new ScriptInputUserData;
6944 ctx.
Write(destination_entity);
6950 }
6951 }
6952 else if (!
GetGame().IsMultiplayer())
6953 {
6955 }
6956 }
6957
6959 {
6961 }
6962
6964 {
6966 float split_quantity_new;
6968 if (dst.IsValid())
6969 {
6970 int slot_id = dst.GetSlot();
6972
6973 if (quantity > stack_max)
6974 split_quantity_new = stack_max;
6975 else
6976 split_quantity_new = quantity;
6977
6979 {
6981
6982 if (new_item)
6983 {
6984 new_item.SetResultOfSplit(true);
6985 MiscGameplayFunctions.TransferItemProperties(this,new_item);
6987 new_item.
SetQuantity(split_quantity_new,
false,
true);
6988 }
6989
6990 return new_item;
6991 }
6992 }
6993
6994 return null;
6995 }
6996
6998 {
7000 float split_quantity_new;
7002 if (destination_entity)
7003 {
7005 if (quantity > stackable)
7006 split_quantity_new = stackable;
7007 else
7008 split_quantity_new = quantity;
7009
7011 {
7012 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7013 if (new_item)
7014 {
7015 new_item.SetResultOfSplit(true);
7016 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7018 new_item.
SetQuantity(split_quantity_new,
false,
true);
7019 }
7020 }
7021 }
7022 }
7023
7025 {
7027 {
7028 if (ScriptInputUserData.CanStoreInputUserData())
7029 {
7030 ScriptInputUserData ctx = new ScriptInputUserData;
7035 ItemBase destination_entity =
this;
7036 ctx.
Write(destination_entity);
7040 }
7041 }
7042 else if (!
GetGame().IsMultiplayer())
7043 {
7045 }
7046 }
7047
7049 {
7051 float split_quantity_new;
7053 if (player)
7054 {
7056 if (quantity > stackable)
7057 split_quantity_new = stackable;
7058 else
7059 split_quantity_new = quantity;
7060
7062 {
7063 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7064 new_item =
ItemBase.Cast(in_hands);
7065 if (new_item)
7066 {
7067 new_item.SetResultOfSplit(true);
7068 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7070 new_item.SetQuantity(split_quantity_new, false, true);
7071 }
7072 }
7073 }
7074 }
7075
7077 {
7079 float split_quantity_new = Math.Floor(quantity * 0.5);
7080
7082 return;
7083
7085
7086 if (new_item)
7087 {
7088 if (new_item.GetQuantityMax() < split_quantity_new)
7089 {
7090 split_quantity_new = new_item.GetQuantityMax();
7091 }
7092
7093 new_item.SetResultOfSplit(true);
7094 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7095
7097 {
7100 }
7101 else
7102 {
7104 new_item.
SetQuantity(split_quantity_new,
false,
true);
7105 }
7106 }
7107 }
7108
7110 {
7112 float split_quantity_new = Math.Floor(quantity / 2);
7113
7115 return;
7116
7117 InventoryLocation invloc = new InventoryLocation;
7119
7121 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7122
7123 if (new_item)
7124 {
7125 if (new_item.GetQuantityMax() < split_quantity_new)
7126 {
7127 split_quantity_new = new_item.GetQuantityMax();
7128 }
7130 {
7133 }
7134 else if (split_quantity_new > 1)
7135 {
7137 new_item.
SetQuantity(split_quantity_new,
false,
true);
7138 }
7139 }
7140 }
7141
7144 {
7145 SetWeightDirty();
7147
7148 if (parent)
7149 parent.OnAttachmentQuantityChangedEx(this, delta);
7150
7152 {
7154 {
7156 }
7158 {
7159 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7161 }
7162 }
7163
7164 }
7165
7168 {
7169
7170 }
7171
7174 {
7176 }
7177
7179 {
7180 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7181
7183 {
7184 if (newLevel == GameConstants.STATE_RUINED)
7185 {
7187 EntityAI parent = GetHierarchyParent();
7188 if (parent && parent.IsFireplace())
7189 {
7190 CargoBase cargo = GetInventory().GetCargo();
7191 if (cargo)
7192 {
7194 {
7196 }
7197 }
7198 }
7199 }
7200
7202 {
7203
7205 return;
7206 }
7207
7208 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7209 {
7211 }
7212 }
7213 }
7214
7215
7217 {
7218 super.OnRightClick();
7219
7221 {
7223 {
7224 if (ScriptInputUserData.CanStoreInputUserData())
7225 {
7226 EntityAI root = GetHierarchyRoot();
7227 Man playerOwner = GetHierarchyRootPlayer();
7228 InventoryLocation dst = new InventoryLocation;
7229
7230
7231 if (!playerOwner && root && root == this)
7232 {
7234 }
7235 else
7236 {
7237
7238 GetInventory().GetCurrentInventoryLocation(dst);
7240 {
7243 {
7245 }
7246 else
7247 {
7249
7250
7251 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7252 {
7254 }
7255 else
7256 {
7257 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7258 }
7259 }
7260 }
7261 }
7262
7263 ScriptInputUserData ctx = new ScriptInputUserData;
7271 }
7272 }
7273 else if (!
GetGame().IsMultiplayer())
7274 {
7276 }
7277 }
7278 }
7279
7281 {
7282 if (root)
7283 {
7284 vector m4[4];
7285 root.GetTransform(m4);
7286 dst.SetGround(this, m4);
7287 }
7288 else
7289 {
7290 GetInventory().GetCurrentInventoryLocation(dst);
7291 }
7292 }
7293
7294 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7295 {
7296
7297 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7298 return false;
7299
7300 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7301 return false;
7302
7303
7305 return false;
7306
7307
7308 Magazine mag = Magazine.Cast(this);
7309 if (mag)
7310 {
7311 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7312 return false;
7313
7314 if (stack_max_limit)
7315 {
7316 Magazine other_mag = Magazine.Cast(other_item);
7317 if (other_item)
7318 {
7319 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7320 return false;
7321 }
7322
7323 }
7324 }
7325 else
7326 {
7327
7329 return false;
7330
7332 return false;
7333 }
7334
7335 PlayerBase player = null;
7336 if (CastTo(player, GetHierarchyRootPlayer()))
7337 {
7338 if (player.GetInventory().HasAttachment(this))
7339 return false;
7340
7341 if (player.IsItemsToDelete())
7342 return false;
7343 }
7344
7345 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7346 return false;
7347
7348 int slotID;
7350 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7351 return false;
7352
7353 return true;
7354 }
7355
7357 {
7359 }
7360
7362 {
7363 return m_IsResultOfSplit;
7364 }
7365
7367 {
7368 m_IsResultOfSplit = value;
7369 }
7370
7372 {
7374 }
7375
7377 {
7378 float other_item_quantity = other_item.GetQuantity();
7379 float this_free_space;
7380
7382
7384
7385 if (other_item_quantity > this_free_space)
7386 {
7387 return this_free_space;
7388 }
7389 else
7390 {
7391 return other_item_quantity;
7392 }
7393 }
7394
7396 {
7398 }
7399
7401 {
7403 return;
7404
7405 if (!IsMagazine() && other_item)
7406 {
7408 if (quantity_used != 0)
7409 {
7410 float hp1 = GetHealth01("","");
7411 float hp2 = other_item.GetHealth01("","");
7412 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7413 hpResult = hpResult / (
GetQuantity() + quantity_used);
7414
7415 hpResult *= GetMaxHealth();
7416 Math.Round(hpResult);
7417 SetHealth("", "Health", hpResult);
7418
7420 other_item.AddQuantity(-quantity_used);
7421 }
7422 }
7424 }
7425
7427 {
7428 #ifdef SERVER
7429 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7430 GetHierarchyParent().IncreaseLifetimeUp();
7431 #endif
7432 };
7433
7435 {
7436 PlayerBase p = PlayerBase.Cast(player);
7437
7438 array<int> recipesIds = p.m_Recipes;
7439 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7440 if (moduleRecipesManager)
7441 {
7442 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
7443 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7444 }
7445
7446 for (int i = 0;i < recipesIds.Count(); i++)
7447 {
7448 int key = recipesIds.Get(i);
7449 string recipeName = moduleRecipesManager.GetRecipeName(key);
7451 }
7452 }
7453
7454
7455 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7456 {
7457 super.GetDebugActions(outputList);
7458
7459
7465
7466
7471
7476
7477
7481
7482
7484 {
7488 }
7489
7492
7493
7497
7499
7500 InventoryLocation loc = new InventoryLocation();
7501 GetInventory().GetCurrentInventoryLocation(loc);
7503 {
7504 if (Gizmo_IsSupported())
7507 }
7508
7510 }
7511
7512
7513
7514
7516 {
7517 super.OnAction(action_id, player, ctx);
7518
7520 {
7521 switch (action_id)
7522 {
7525 return true;
7528 return true;
7529 }
7530 }
7531
7533 {
7534 switch (action_id)
7535 {
7537 Delete();
7538 return true;
7539 }
7540 }
7541
7542 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
7543 {
7544 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7545 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
7546 PlayerBase p = PlayerBase.Cast(player);
7547 if (
EActions.RECIPES_RANGE_START < 1000)
7548 {
7549 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7550 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7551 }
7552 }
7553 #ifndef SERVER
7554 else if (action_id ==
EActions.WATCH_PLAYER)
7555 {
7556 PluginDeveloper.SetDeveloperItemClientEx(player);
7557 }
7558 #endif
7560 {
7561 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7562 {
7563 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7564 OnDebugButtonPressServer(id + 1);
7565 }
7566
7567 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7568 {
7569 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
7571 }
7572
7573 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
7574 {
7575 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
7577 }
7578
7579 else if (action_id ==
EActions.ADD_QUANTITY)
7580 {
7581 if (IsMagazine())
7582 {
7583 Magazine mag = Magazine.Cast(this);
7584 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
7585 }
7586 else
7587 {
7589 }
7590
7591 if (m_EM)
7592 {
7593 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
7594 }
7595
7596 }
7597
7598 else if (action_id ==
EActions.REMOVE_QUANTITY)
7599 {
7600 if (IsMagazine())
7601 {
7602 Magazine mag2 = Magazine.Cast(this);
7603 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
7604 }
7605 else
7606 {
7608 }
7609 if (m_EM)
7610 {
7611 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
7612 }
7613
7614 }
7615
7616 else if (action_id ==
EActions.SET_QUANTITY_0)
7617 {
7619
7620 if (m_EM)
7621 {
7622 m_EM.SetEnergy(0);
7623 }
7624 }
7625
7626 else if (action_id ==
EActions.SET_MAX_QUANTITY)
7627 {
7629
7630 if (m_EM)
7631 {
7632 m_EM.SetEnergy(m_EM.GetEnergyMax());
7633 }
7634 }
7635
7636 else if (action_id ==
EActions.ADD_HEALTH)
7637 {
7638 AddHealth("","",GetMaxHealth("","Health")/5);
7639 }
7640 else if (action_id ==
EActions.REMOVE_HEALTH)
7641 {
7642 AddHealth("","",-GetMaxHealth("","Health")/5);
7643 }
7644 else if (action_id ==
EActions.DESTROY_HEALTH)
7645 {
7646 SetHealth01("","",0);
7647 }
7648 else if (action_id ==
EActions.WATCH_ITEM)
7649 {
7651 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
7652 #ifdef DEVELOPER
7653 SetDebugDeveloper_item(this);
7654 #endif
7655 }
7656
7657 else if (action_id ==
EActions.ADD_TEMPERATURE)
7658 {
7659 AddTemperature(20);
7660
7661 }
7662
7663 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
7664 {
7665 AddTemperature(-20);
7666
7667 }
7668
7669 else if (action_id ==
EActions.FLIP_FROZEN)
7670 {
7671 SetFrozen(!GetIsFrozen());
7672
7673 }
7674
7675 else if (action_id ==
EActions.ADD_WETNESS)
7676 {
7678
7679 }
7680
7681 else if (action_id ==
EActions.REMOVE_WETNESS)
7682 {
7684
7685 }
7686
7687 else if (action_id ==
EActions.LIQUIDTYPE_UP)
7688 {
7691
7692
7693 }
7694
7695 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
7696 {
7699 }
7700
7701 else if (action_id ==
EActions.MAKE_SPECIAL)
7702 {
7703 auto debugParams = DebugSpawnParams.WithPlayer(player);
7704 OnDebugSpawnEx(debugParams);
7705 }
7706
7707 }
7708
7709
7710 return false;
7711 }
7712
7713
7714
7715
7719
7722
7723
7724
7726 {
7727 return false;
7728 }
7729
7730
7732 {
7733 return true;
7734 }
7735
7736
7738 {
7739 return true;
7740 }
7741
7742
7743
7745 {
7746 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
7748 }
7749
7752 {
7753 return null;
7754 }
7755
7757 {
7758 return false;
7759 }
7760
7762 {
7763 return false;
7764 }
7765
7769
7770
7772 {
7773 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7774 return module_repairing.CanRepair(this, item_repair_kit);
7775 }
7776
7777
7778 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
7779 {
7780 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7781 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
7782 }
7783
7784
7786 {
7787
7788
7789
7790
7791
7792
7793
7794
7795 return 1;
7796 }
7797
7798
7799
7801 {
7803 }
7804
7805
7806
7808 {
7810 }
7811
7812
7821 {
7822 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7823
7824 if (player)
7825 {
7826 player.MessageStatus(text);
7827 }
7828 }
7829
7830
7839 {
7840 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7841
7842 if (player)
7843 {
7844 player.MessageAction(text);
7845 }
7846 }
7847
7848
7857 {
7858 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7859
7860 if (player)
7861 {
7862 player.MessageFriendly(text);
7863 }
7864 }
7865
7866
7875 {
7876 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7877
7878 if (player)
7879 {
7880 player.MessageImportant(text);
7881 }
7882 }
7883
7885 {
7886 return true;
7887 }
7888
7889
7890 override bool KindOf(
string tag)
7891 {
7892 bool found = false;
7893 string item_name = this.
GetType();
7896
7897 int array_size = item_tag_array.Count();
7898 for (int i = 0; i < array_size; i++)
7899 {
7900 if (item_tag_array.Get(i) == tag)
7901 {
7902 found = true;
7903 break;
7904 }
7905 }
7906 return found;
7907 }
7908
7909
7911 {
7912
7913 super.OnRPC(sender, rpc_type,ctx);
7914
7915
7916 switch (rpc_type)
7917 {
7918 #ifndef SERVER
7919 case ERPCs.RPC_SOUND_LOCK_ATTACH:
7920 Param2<bool, string> p = new Param2<bool, string>(false, "");
7921
7923 return;
7924
7925 bool play = p.param1;
7926 string soundSet = p.param2;
7927
7928 if (play)
7929 {
7931 {
7933 {
7935 }
7936 }
7937 else
7938 {
7940 }
7941 }
7942 else
7943 {
7945 }
7946
7947 break;
7948 #endif
7949
7950 }
7951
7953 {
7955 }
7956 }
7957
7958
7959
7960
7962 {
7963 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
7964 return plugin.GetID(
name);
7965 }
7966
7968 {
7969 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
7970 return plugin.GetName(id);
7971 }
7972
7975 {
7976
7977
7978 int varFlags;
7979 if (!ctx.
Read(varFlags))
7980 return;
7981
7982 if (varFlags & ItemVariableFlags.FLOAT)
7983 {
7985 }
7986 }
7987
7989 {
7990
7991 super.SerializeNumericalVars(floats_out);
7992
7993
7994
7996 {
7998 }
7999
8001 {
8003 }
8004
8006 {
8008 }
8009
8011 {
8016 }
8017
8019 {
8021 }
8022 }
8023
8025 {
8026
8027 super.DeSerializeNumericalVars(floats);
8028
8029
8030 int index = 0;
8031 int mask = Math.Round(floats.Get(index));
8032
8033 index++;
8034
8036 {
8038 {
8040 }
8041 else
8042 {
8043 float quantity = floats.Get(index);
8045 }
8046 index++;
8047 }
8048
8050 {
8051 float wet = floats.Get(index);
8053 index++;
8054 }
8055
8057 {
8058 int liquidtype = Math.Round(floats.Get(index));
8060 index++;
8061 }
8062
8064 {
8066 index++;
8068 index++;
8070 index++;
8072 index++;
8073 }
8074
8076 {
8077 int cleanness = Math.Round(floats.Get(index));
8079 index++;
8080 }
8081 }
8082
8084 {
8085 super.WriteVarsToCTX(ctx);
8086
8087
8089 {
8091 }
8092
8094 {
8096 }
8097
8099 {
8101 }
8102
8104 {
8105 int r,g,b,a;
8111 }
8112
8114 {
8116 }
8117 }
8118
8120 {
8121 if (!super.ReadVarsFromCTX(ctx,version))
8122 return false;
8123
8124 int intValue;
8125 float value;
8126
8127 if (version < 140)
8128 {
8129 if (!ctx.
Read(intValue))
8130 return false;
8131
8132 m_VariablesMask = intValue;
8133 }
8134
8136 {
8137 if (!ctx.
Read(value))
8138 return false;
8139
8141 {
8143 }
8144 else
8145 {
8147 }
8148 }
8149
8150 if (version < 140)
8151 {
8153 {
8154 if (!ctx.
Read(value))
8155 return false;
8156 SetTemperatureDirect(value);
8157 }
8158 }
8159
8161 {
8162 if (!ctx.
Read(value))
8163 return false;
8165 }
8166
8168 {
8169 if (!ctx.
Read(intValue))
8170 return false;
8172 }
8173
8175 {
8176 int r,g,b,a;
8178 return false;
8180 return false;
8182 return false;
8184 return false;
8185
8187 }
8188
8190 {
8191 if (!ctx.
Read(intValue))
8192 return false;
8194 }
8195
8196 if (version >= 138 && version < 140)
8197 {
8199 {
8200 if (!ctx.
Read(intValue))
8201 return false;
8202 SetFrozen(intValue);
8203 }
8204 }
8205
8206 return true;
8207 }
8208
8209
8211 {
8214 {
8216 }
8217
8218 if (!super.OnStoreLoad(ctx, version))
8219 {
8221 return false;
8222 }
8223
8224 if (version >= 114)
8225 {
8226 bool hasQuickBarIndexSaved;
8227
8228 if (!ctx.
Read(hasQuickBarIndexSaved))
8229 {
8231 return false;
8232 }
8233
8234 if (hasQuickBarIndexSaved)
8235 {
8236 int itmQBIndex;
8237
8238
8239 if (!ctx.
Read(itmQBIndex))
8240 {
8242 return false;
8243 }
8244
8245 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8246 if (itmQBIndex != -1 && parentPlayer)
8247 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8248 }
8249 }
8250 else
8251 {
8252
8253 PlayerBase player;
8254 int itemQBIndex;
8255 if (version ==
int.
MAX)
8256 {
8257 if (!ctx.
Read(itemQBIndex))
8258 {
8260 return false;
8261 }
8262 }
8263 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8264 {
8265
8266 if (!ctx.
Read(itemQBIndex))
8267 {
8269 return false;
8270 }
8271 if (itemQBIndex != -1 && player)
8272 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8273 }
8274 }
8275
8276 if (version < 140)
8277 {
8278
8279 if (!LoadVariables(ctx, version))
8280 {
8282 return false;
8283 }
8284 }
8285
8286
8288 {
8290 return false;
8291 }
8292 if (version >= 132)
8293 {
8295 if (raib)
8296 {
8298 {
8300 return false;
8301 }
8302 }
8303 }
8304
8306 return true;
8307 }
8308
8309
8310
8312 {
8313 super.OnStoreSave(ctx);
8314
8315 PlayerBase player;
8316 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8317 {
8319
8320 int itemQBIndex = -1;
8321 itemQBIndex = player.FindQuickBarEntityIndex(this);
8322 ctx.
Write(itemQBIndex);
8323 }
8324 else
8325 {
8327 }
8328
8330
8332 if (raib)
8333 {
8335 }
8336 }
8337
8338
8340 {
8341 super.AfterStoreLoad();
8342
8344 {
8346 }
8347
8349 {
8352 }
8353 }
8354
8356 {
8357 super.EEOnAfterLoad();
8358
8360 {
8362 }
8363
8366 }
8367
8369 {
8370 return false;
8371 }
8372
8373
8374
8376 {
8378 {
8379 #ifdef PLATFORM_CONSOLE
8380
8382 {
8384 if (menu)
8385 {
8387 }
8388 }
8389 #endif
8390 }
8391
8393 {
8396 }
8397
8399 {
8400 SetWeightDirty();
8402 }
8404 {
8407 }
8408
8410 {
8413 }
8415 {
8418 }
8419
8420 super.OnVariablesSynchronized();
8421 }
8422
8423
8424
8426 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8427 {
8428 if (!IsServerCheck(allow_client))
8429 return false;
8430
8432 return false;
8433
8436
8437 if (value <= (min + 0.001))
8438 value = min;
8439
8440 if (value == min)
8441 {
8442 if (destroy_config)
8443 {
8444 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8445 if (dstr)
8446 {
8448 this.Delete();
8449 return true;
8450 }
8451 }
8452 else if (destroy_forced)
8453 {
8455 this.Delete();
8456 return true;
8457 }
8458
8460 }
8461
8464
8466 {
8468
8469 if (delta)
8471 }
8472
8474
8475 return false;
8476 }
8477
8478
8480 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8481 {
8483 }
8484
8486 {
8489 }
8490
8492 {
8495 }
8496
8498 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8499 {
8500 float value_clamped = Math.Clamp(value, 0, 1);
8502 SetQuantity(result, destroy_config, destroy_forced);
8503 }
8504
8505
8508 {
8510 }
8511
8513 {
8515 }
8516
8517
8518
8519
8520
8521
8522
8523
8524
8525
8527 {
8528 int slot = -1;
8529 if (GetInventory())
8530 {
8531 InventoryLocation il = new InventoryLocation;
8532 GetInventory().GetCurrentInventoryLocation(il);
8534 }
8535
8537 }
8538
8540 {
8541 float quantity_max = 0;
8542
8544 {
8545 if (attSlotID != -1)
8546 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8547
8548 if (quantity_max <= 0)
8550 }
8551
8552 if (quantity_max <= 0)
8554
8555 return quantity_max;
8556 }
8557
8559 {
8561 }
8562
8564 {
8566 }
8567
8568
8570 {
8572 }
8573
8575 {
8577 }
8578
8580 {
8582 }
8583
8584
8586 {
8587
8588 float weightEx = GetWeightEx();
8589 float special = GetInventoryAndCargoWeight();
8590 return weightEx - special;
8591 }
8592
8593
8595 {
8597 }
8598
8600 {
8602 {
8603 #ifdef DEVELOPER
8604 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8605 {
8606 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
8608 }
8609 #endif
8610
8612 }
8613 else if (HasEnergyManager())
8614 {
8615 #ifdef DEVELOPER
8616 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8617 {
8618 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
8619 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
8620 }
8621 #endif
8622 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
8623 }
8624 else
8625 {
8626 #ifdef DEVELOPER
8627 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8628 {
8629 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
8630 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
8631 }
8632 #endif
8633 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
8634 }
8635 }
8636
8639 {
8640 int item_count = 0;
8642
8643 if (GetInventory().GetCargo() != NULL)
8644 {
8645 item_count = GetInventory().GetCargo().GetItemCount();
8646 }
8647
8648 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
8649 {
8650 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
8651 if (item)
8652 item_count += item.GetNumberOfItems();
8653 }
8654 return item_count;
8655 }
8656
8659 {
8660 float weight = 0;
8661 float wetness = 1;
8662 if (include_wetness)
8665 {
8666 weight = wetness * m_ConfigWeight;
8667 }
8669 {
8670 weight = 1;
8671 }
8672 return weight;
8673 }
8674
8675
8676
8678 {
8679 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
8680 {
8681 GameInventory inv = GetInventory();
8682 array<EntityAI> items = new array<EntityAI>;
8684 for (int i = 0; i < items.Count(); i++)
8685 {
8687 if (item)
8688 {
8690 }
8691 }
8692 }
8693 }
8694
8695
8696
8697
8699 {
8700 float energy = 0;
8701 if (HasEnergyManager())
8702 {
8703 energy = GetCompEM().GetEnergy();
8704 }
8705 return energy;
8706 }
8707
8708
8710 {
8711 super.OnEnergyConsumed();
8712
8714 }
8715
8717 {
8718 super.OnEnergyAdded();
8719
8721 }
8722
8723
8725 {
8726 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
8727 {
8729 {
8730 float energy_0to1 = GetCompEM().GetEnergy0To1();
8732 }
8733 }
8734 }
8735
8736
8738 {
8739 return ConfigGetFloat("heatIsolation");
8740 }
8741
8743 {
8745 }
8746
8748 {
8749 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
8750 if (
GetGame().ConfigIsExisting(paramPath))
8752
8753 return 0.0;
8754 }
8755
8757 {
8758 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
8759 if (
GetGame().ConfigIsExisting(paramPath))
8761
8762 return 0.0;
8763 }
8764
8765 override void SetWet(
float value,
bool allow_client =
false)
8766 {
8767 if (!IsServerCheck(allow_client))
8768 return;
8769
8772
8774
8775 m_VarWet = Math.Clamp(value, min, max);
8776
8778 {
8781 }
8782 }
8783
8784 override void AddWet(
float value)
8785 {
8787 }
8788
8790 {
8792 }
8793
8795 {
8797 }
8798
8800 {
8802 }
8803
8805 {
8807 }
8808
8810 {
8812 }
8813
8815 {
8818 if (newLevel != oldLevel)
8819 {
8821 }
8822 }
8823
8825 {
8826 SetWeightDirty();
8827 }
8828
8830 {
8831 return GetWetLevelInternal(
m_VarWet);
8832 }
8833
8834
8835
8837 {
8839 }
8840
8842 {
8844 }
8845
8847 {
8849 }
8850
8852 {
8854 }
8855
8856
8857
8859 {
8860 if (ConfigIsExisting("itemModelLength"))
8861 {
8862 return ConfigGetFloat("itemModelLength");
8863 }
8864 return 0;
8865 }
8866
8868 {
8869 if (ConfigIsExisting("itemAttachOffset"))
8870 {
8871 return ConfigGetFloat("itemAttachOffset");
8872 }
8873 return 0;
8874 }
8875
8876 override void SetCleanness(
int value,
bool allow_client =
false)
8877 {
8878 if (!IsServerCheck(allow_client))
8879 return;
8880
8882
8884
8887 }
8888
8890 {
8892 }
8893
8895 {
8896 return true;
8897 }
8898
8899
8900
8901
8903 {
8905 }
8906
8908 {
8910 }
8911
8912
8913
8914
8915 override void SetColor(
int r,
int g,
int b,
int a)
8916 {
8922 }
8924 override void GetColor(out
int r,out
int g,out
int b,out
int a)
8925 {
8930 }
8931
8933 {
8935 }
8936
8939 {
8940 int r,g,b,a;
8942 r = r/255;
8943 g = g/255;
8944 b = b/255;
8945 a = a/255;
8946 return MiscGameplayFunctions.GetColorString(r, g, b, a);
8947 }
8948
8949
8950
8951 override void SetLiquidType(
int value,
bool allow_client =
false)
8952 {
8953 if (!IsServerCheck(allow_client))
8954 return;
8955
8960 }
8961
8963 {
8964 return ConfigGetInt("varLiquidTypeInit");
8965 }
8966
8968 {
8970 }
8971
8973 {
8975 SetFrozen(false);
8976 }
8977
8980 {
8981 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
8982 }
8983
8984
8987 {
8988 PlayerBase nplayer;
8989 if (PlayerBase.CastTo(nplayer, player))
8990 {
8992
8993 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
8994 }
8995 }
8996
8997
9000 {
9001 PlayerBase nplayer;
9002 if (PlayerBase.CastTo(nplayer,player))
9003 {
9004
9005 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9006
9007 }
9008
9009
9010 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9011
9012
9013 if (HasEnergyManager())
9014 {
9015 GetCompEM().UpdatePlugState();
9016 }
9017 }
9018
9019
9021 {
9022 super.OnPlacementStarted(player);
9023
9025 }
9026
9027 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9028 {
9030 {
9031 m_AdminLog.OnPlacementComplete(player,
this);
9032 }
9033
9034 super.OnPlacementComplete(player, position, orientation);
9035 }
9036
9037
9038
9039
9040
9042 {
9044 {
9045 return true;
9046 }
9047 else
9048 {
9049 return false;
9050 }
9051 }
9052
9053
9055 {
9057 {
9059 }
9060 }
9061
9062
9064 {
9066 }
9067
9069 {
9071 }
9072
9073 override void InsertAgent(
int agent,
float count = 1)
9074 {
9075 if (count < 1)
9076 return;
9077
9079 }
9080
9083 {
9085 }
9086
9087
9089 {
9091 }
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9103
9104
9105
9106
9107
9108
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9135 {
9137 return false;
9138 return true;
9139 }
9140
9142 {
9143
9145 }
9146
9147
9150 {
9151 super.CheckForRoofLimited(timeTresholdMS);
9152
9154 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9155 {
9156 m_PreviousRoofTestTime = time;
9157 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9158 }
9159 }
9160
9161
9163 {
9165 {
9166 return 0;
9167 }
9168
9169 if (GetInventory().GetAttachmentSlotsCount() != 0)
9170 {
9171 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9172 if (filter)
9173 return filter.GetProtectionLevel(type, false, system);
9174 else
9175 return 0;
9176 }
9177
9178 string subclassPath, entryName;
9179
9180 switch (type)
9181 {
9183 entryName = "biological";
9184 break;
9186 entryName = "chemical";
9187 break;
9188 default:
9189 entryName = "biological";
9190 break;
9191 }
9192
9193 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9194
9196 }
9197
9198
9199
9202 {
9203 if (!IsMagazine())
9205
9207 }
9208
9209
9210
9211
9212
9217 {
9218 return true;
9219 }
9220
9222 {
9224 }
9225
9226
9227
9228
9229
9231 {
9232 if (parent)
9233 {
9234 if (parent.IsInherited(DayZInfected))
9235 return true;
9236
9237 if (!parent.IsRuined())
9238 return true;
9239 }
9240
9241 return true;
9242 }
9243
9245 {
9246 if (!super.CanPutAsAttachment(parent))
9247 {
9248 return false;
9249 }
9250
9251 if (!IsRuined() && !parent.IsRuined())
9252 {
9253 return true;
9254 }
9255
9256 return false;
9257 }
9258
9260 {
9261
9262
9263
9264
9265 return super.CanReceiveItemIntoCargo(item);
9266 }
9267
9269 {
9270
9271
9272
9273
9274 GameInventory attachmentInv = attachment.GetInventory();
9276 {
9277 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9278 return false;
9279 }
9280
9281 InventoryLocation loc = new InventoryLocation();
9282 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9283 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9284 return false;
9285
9286 return super.CanReceiveAttachment(attachment, slotId);
9287 }
9288
9290 {
9291 if (!super.CanReleaseAttachment(attachment))
9292 return false;
9293
9294 return GetInventory().AreChildrenAccessible();
9295 }
9296
9297
9298
9299
9300
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9311
9312
9313
9314
9315
9316
9318 {
9319 int id = muzzle_owner.GetMuzzleID();
9320 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9321
9322 if (WPOF_array)
9323 {
9324 for (int i = 0; i < WPOF_array.Count(); i++)
9325 {
9326 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9327
9328 if (WPOF)
9329 {
9330 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9331 }
9332 }
9333 }
9334 }
9335
9336
9338 {
9339 int id = muzzle_owner.GetMuzzleID();
9341
9342 if (WPOBE_array)
9343 {
9344 for (int i = 0; i < WPOBE_array.Count(); i++)
9345 {
9346 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9347
9348 if (WPOBE)
9349 {
9350 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9351 }
9352 }
9353 }
9354 }
9355
9356
9358 {
9359 int id = muzzle_owner.GetMuzzleID();
9360 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9361
9362 if (WPOOH_array)
9363 {
9364 for (int i = 0; i < WPOOH_array.Count(); i++)
9365 {
9366 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9367
9368 if (WPOOH)
9369 {
9370 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9371 }
9372 }
9373 }
9374 }
9375
9376
9378 {
9379 int id = muzzle_owner.GetMuzzleID();
9380 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9381
9382 if (WPOOH_array)
9383 {
9384 for (int i = 0; i < WPOOH_array.Count(); i++)
9385 {
9386 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9387
9388 if (WPOOH)
9389 {
9390 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9391 }
9392 }
9393 }
9394 }
9395
9396
9398 {
9399 int id = muzzle_owner.GetMuzzleID();
9400 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9401
9402 if (WPOOH_array)
9403 {
9404 for (int i = 0; i < WPOOH_array.Count(); i++)
9405 {
9406 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9407
9408 if (WPOOH)
9409 {
9410 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9411 }
9412 }
9413 }
9414 }
9415
9416
9417
9419 {
9421 {
9422 return true;
9423 }
9424
9425 return false;
9426 }
9427
9429 {
9431 {
9432 return true;
9433 }
9434
9435 return false;
9436 }
9437
9439 {
9441 {
9442 return true;
9443 }
9444
9445 return false;
9446 }
9447
9449 {
9450 return false;
9451 }
9452
9455 {
9456 return UATimeSpent.DEFAULT_DEPLOY;
9457 }
9458
9459
9460
9461
9463 {
9465 SetSynchDirty();
9466 }
9467
9469 {
9471 }
9472
9473
9475 {
9476 return false;
9477 }
9478
9481 {
9482 string att_type = "None";
9483
9484 if (ConfigIsExisting("soundAttType"))
9485 {
9486 att_type = ConfigGetString("soundAttType");
9487 }
9488
9490 }
9491
9493 {
9495 }
9496
9497
9498
9499
9500
9506
9508 {
9511
9513 }
9514
9515
9517 {
9519 return;
9520
9522
9525
9528
9529 SoundParameters params = new SoundParameters();
9533 }
9534
9535
9537 {
9539 return;
9540
9542 SetSynchDirty();
9543
9546 }
9547
9548
9550 {
9552 return;
9553
9555 SetSynchDirty();
9556
9559 }
9560
9562 {
9564 }
9565
9567 {
9569 }
9570
9573 {
9574 if (!
GetGame().IsDedicatedServer())
9575 {
9576 if (ConfigIsExisting("attachSoundSet"))
9577 {
9578 string cfg_path = "";
9579 string soundset = "";
9581
9584 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
9585 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
9586
9587 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
9588 {
9589 for (int i = 0; i < cfg_soundset_array.Count(); i++)
9590 {
9591 if (cfg_slot_array[i] == slot_type)
9592 {
9593 soundset = cfg_soundset_array[i];
9594 break;
9595 }
9596 }
9597 }
9598
9599 if (soundset != "")
9600 {
9601 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
9603 }
9604 }
9605 }
9606 }
9607
9609 {
9610
9611 }
9612
9613 void OnApply(PlayerBase player);
9614
9616 {
9617 return 1.0;
9618 };
9619
9621 {
9623 }
9624
9626 {
9628 }
9629
9631
9633 {
9634 SetDynamicPhysicsLifeTime(0.01);
9636 }
9637
9639 {
9640 array<string> zone_names = new array<string>;
9641 GetDamageZones(zone_names);
9642 for (int i = 0; i < zone_names.Count(); i++)
9643 {
9644 SetHealthMax(zone_names.Get(i),"Health");
9645 }
9646 SetHealthMax("","Health");
9647 }
9648
9651 {
9652 float global_health = GetHealth01("","Health");
9653 array<string> zones = new array<string>;
9654 GetDamageZones(zones);
9655
9656 for (int i = 0; i < zones.Count(); i++)
9657 {
9658 SetHealth01(zones.Get(i),"Health",global_health);
9659 }
9660 }
9661
9664 {
9665 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
9666 }
9667
9669 {
9670 if (!hasRootAsPlayer)
9671 {
9672 if (refParentIB)
9673 {
9674
9675 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
9676 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
9677
9678 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
9679 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
9680
9683 }
9684 else
9685 {
9686
9689 }
9690 }
9691 }
9692
9694 {
9696 {
9697 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
9698 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
9699 {
9700 float heatPermCoef = 1.0;
9702 while (ent)
9703 {
9704 heatPermCoef *= ent.GetHeatPermeabilityCoef();
9705 ent = ent.GetHierarchyParent();
9706 }
9707
9708 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
9709 }
9710 }
9711 }
9712
9714 {
9715
9716 EntityAI parent = GetHierarchyParent();
9717 if (!parent)
9718 {
9719 hasParent = false;
9720 hasRootAsPlayer = false;
9721 }
9722 else
9723 {
9724 hasParent = true;
9725 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
9726 refParentIB =
ItemBase.Cast(parent);
9727 }
9728 }
9729
9730 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
9731 {
9732
9733 }
9734
9736 {
9737
9738 return false;
9739 }
9740
9742 {
9743
9744
9745 return false;
9746 }
9747
9749 {
9750
9751 return false;
9752 }
9753
9756 {
9757 return !GetIsFrozen() &&
IsOpen();
9758 }
9759
9761 {
9762 bool hasParent = false, hasRootAsPlayer = false;
9764
9765 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
9766 bool foodDecay =
g_Game.IsFoodDecayEnabled();
9767
9768 if (wwtu || foodDecay)
9769 {
9773
9774 if (processWetness || processTemperature || processDecay)
9775 {
9777
9778 if (processWetness)
9779 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
9780
9781 if (processTemperature)
9783
9784 if (processDecay)
9785 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
9786 }
9787 }
9788 }
9789
9792 {
9794 }
9795
9797 {
9800
9801 return super.GetTemperatureFreezeThreshold();
9802 }
9803
9805 {
9808
9809 return super.GetTemperatureThawThreshold();
9810 }
9811
9813 {
9816
9817 return super.GetItemOverheatThreshold();
9818 }
9819
9821 {
9823 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
9824
9825 return super.GetTemperatureFreezeTime();
9826 }
9827
9829 {
9831 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
9832
9833 return super.GetTemperatureThawTime();
9834 }
9835
9840
9842 {
9843 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
9844 }
9845
9847 {
9848 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
9849 }
9850
9853 {
9855 }
9856
9858 {
9860 }
9861
9863 {
9865 }
9866
9869 {
9870 return null;
9871 }
9872
9875 {
9876 return false;
9877 }
9878
9880 {
9882 {
9885 if (!trg)
9886 {
9888 explosive = this;
9889 }
9890
9891 explosive.PairRemote(trg);
9893
9894 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
9895 trg.SetPersistentPairID(persistentID);
9896 explosive.SetPersistentPairID(persistentID);
9897
9898 return true;
9899 }
9900 return false;
9901 }
9902
9905 {
9906 float ret = 1.0;
9909 ret *= GetHealth01();
9910
9911 return ret;
9912 }
9913
9914 #ifdef DEVELOPER
9915 override void SetDebugItem()
9916 {
9917 super.SetDebugItem();
9918 _itemBase = this;
9919 }
9920
9922 {
9923 string text = super.GetDebugText();
9924
9926 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
9927
9928 return text;
9929 }
9930 #endif
9931
9933 {
9934 return true;
9935 }
9936
9938
9940
9942 {
9945 }
9946
9947
9955
9971}
9972
9974{
9976 if (entity)
9977 {
9978 bool is_item = entity.IsInherited(
ItemBase);
9979 if (is_item && full_quantity)
9980 {
9983 }
9984 }
9985 else
9986 {
9988 return NULL;
9989 }
9990 return entity;
9991}
9992
9994{
9995 if (item)
9996 {
9997 if (health > 0)
9998 item.SetHealth("", "", health);
9999
10000 if (item.CanHaveTemperature())
10001 {
10003 if (item.CanFreeze())
10004 item.SetFrozen(false);
10005 }
10006
10007 if (item.HasEnergyManager())
10008 {
10009 if (quantity >= 0)
10010 {
10011 item.GetCompEM().SetEnergy0To1(quantity);
10012 }
10013 else
10014 {
10016 }
10017 }
10018 else if (item.IsMagazine())
10019 {
10020 Magazine mag = Magazine.Cast(item);
10021 if (quantity >= 0)
10022 {
10023 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10024 }
10025 else
10026 {
10028 }
10029
10030 }
10031 else
10032 {
10033 if (quantity >= 0)
10034 {
10035 item.SetQuantityNormalized(quantity, false);
10036 }
10037 else
10038 {
10040 }
10041
10042 }
10043 }
10044}
10045
10046#ifdef DEVELOPER
10048#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
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 CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
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
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)
void StartItemSoundServer(int id)
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()
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)
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
proto native void GizmoSelectObject(Object object)
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto native void GizmoSelectPhysics(Physics physics)
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
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 bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
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 void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, 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)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
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
proto native CGame GetGame()
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
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
class JsonUndergroundAreaTriggerData GetPosition
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.