5215{
5217 {
5218 return true;
5219 }
5220};
5221
5222
5223
5225{
5229
5231
5234
5235
5236
5237
5238
5247
5253
5258
5263
5284 protected bool m_IsResultOfSplit
5285
5287
5292
5293
5294
5296
5300
5301
5302
5304
5307
5308
5309
5315
5316
5324
5327
5328
5330
5331
5333
5334
5339
5340
5345
5346
5348
5349
5351 {
5356
5357 if (!
GetGame().IsDedicatedServer())
5358 {
5360 {
5362
5364 {
5366 }
5367 }
5368
5371 }
5372
5373 m_OldLocation = null;
5374
5376 {
5378 }
5379
5380 if (ConfigIsExisting("headSelectionsToHide"))
5381 {
5384 }
5385
5387 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5388 {
5390 }
5391
5393
5394 m_IsResultOfSplit = false;
5395
5397 }
5398
5400 {
5401 super.InitItemVariables();
5402
5408 m_Count = ConfigGetInt(
"count");
5409
5412
5417
5420
5425
5437
5441
5442
5445 if (ConfigIsExisting("canBeSplit"))
5446 {
5449 }
5450
5452 if (ConfigIsExisting("itemBehaviour"))
5454
5455
5458 RegisterNetSyncVariableInt("m_VarLiquidType");
5459 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5460
5461 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5462 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5463 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5464
5465 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5466 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5467 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5468 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5469
5470 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5471 RegisterNetSyncVariableBool("m_IsTakeable");
5472 RegisterNetSyncVariableBool("m_IsHologram");
5473
5476 {
5479 }
5480
5482
5484 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5486
5487 }
5488
5490 {
5492 }
5493
5495 {
5498 {
5503 }
5504 }
5505
5506 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5507 {
5509 {
5512 }
5513
5515 }
5516
5518 {
5524 }
5525
5527
5529 {
5531
5532 if (!action)
5533 {
5534 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5535 return;
5536 }
5537
5539 if (!ai)
5540 {
5542 return;
5543 }
5544
5546 if (!action_array)
5547 {
5548 action_array = new array<ActionBase_Basic>;
5550 }
5551 if (LogManager.IsActionLogEnable())
5552 {
5553 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5554 }
5555
5556 if (action_array.Find(action) != -1)
5557 {
5558 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5559 }
5560 else
5561 {
5562 action_array.Insert(action);
5563 }
5564 }
5565
5567 {
5569 ActionBase action = player.GetActionManager().GetAction(actionName);
5572
5573 if (action_array)
5574 {
5575 action_array.RemoveItem(action);
5576 }
5577 }
5578
5579
5580
5582 {
5583 ActionOverrideData overrideData = new ActionOverrideData();
5587
5589 if (!actionMap)
5590 {
5593 }
5594
5595 actionMap.Insert(this.
Type(), overrideData);
5596
5597 }
5598
5600
5602
5603
5605 {
5608
5611
5612 string config_to_search = "CfgVehicles";
5613 string muzzle_owner_config;
5614
5616 {
5617 if (IsInherited(Weapon))
5618 config_to_search = "CfgWeapons";
5619
5620 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5621
5622 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5623
5625
5626 if (config_OnFire_subclass_count > 0)
5627 {
5628 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5629
5630 for (int i = 0; i < config_OnFire_subclass_count; i++)
5631 {
5632 string particle_class = "";
5634 string config_OnFire_entry = config_OnFire_class + particle_class;
5635 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5636 WPOF_array.Insert(WPOF);
5637 }
5638
5639
5641 }
5642 }
5643
5645 {
5646 config_to_search = "CfgWeapons";
5647 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5648
5649 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5650
5652
5653 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
5654 {
5655 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
5656
5657 for (i = 0; i < config_OnBulletCasingEject_count; i++)
5658 {
5659 string particle_class2 = "";
5661 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
5662 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
5663 WPOBE_array.Insert(WPOBE);
5664 }
5665
5666
5668 }
5669 }
5670 }
5671
5672
5674 {
5677
5679 {
5680 string config_to_search = "CfgVehicles";
5681
5682 if (IsInherited(Weapon))
5683 config_to_search = "CfgWeapons";
5684
5685 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5686 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
5687
5688 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
5689 {
5690
5692
5694 {
5696 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
5698 return;
5699 }
5700
5703
5704
5705
5707 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
5708
5709 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
5710 {
5711 string particle_class = "";
5713 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
5715
5716 if (entry_type == CT_CLASS)
5717 {
5718 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
5719 WPOOH_array.Insert(WPOF);
5720 }
5721 }
5722
5723
5725 }
5726 }
5727 }
5728
5730 {
5732 }
5733
5735 {
5737 {
5739
5742
5745
5746 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5747 }
5748 }
5749
5751 {
5753 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5754
5756 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5757
5759 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5760
5762 {
5764 }
5765 }
5766
5768 {
5770 }
5771
5773 {
5776 else
5778
5780 {
5783 }
5784 else
5785 {
5788
5791 }
5792
5794 }
5795
5797 {
5799 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5800 }
5801
5803 {
5805 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5807 }
5808
5810 {
5812 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5813 }
5814
5816 {
5819
5820 OverheatingParticle OP = new OverheatingParticle();
5825
5827 }
5828
5830 {
5833
5834 return -1;
5835 }
5836
5838 {
5840 {
5843
5844 for (int i = count; i > 0; --i)
5845 {
5846 int id = i - 1;
5849
5852
5853 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
5854 {
5855 if (p)
5856 {
5859 }
5860 }
5861 }
5862 }
5863 }
5864
5866 {
5868 {
5870 {
5871 int id = i - 1;
5873
5874 if (OP)
5875 {
5877
5878 if (p)
5879 {
5881 }
5882
5883 delete OP;
5884 }
5885 }
5886
5889 }
5890 }
5891
5894 {
5895 return 0.0;
5896 }
5897
5898
5900 {
5901 return 250;
5902 }
5903
5905 {
5906 return 0;
5907 }
5908
5911 {
5913 return true;
5914
5915 return false;
5916 }
5917
5920 {
5923
5925 {
5927 }
5928 else
5929 {
5930
5932 }
5933
5935 }
5936
5943 {
5944 return -1;
5945 }
5946
5947
5948
5949
5951 {
5953 {
5955 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
5956
5957 if (r_index >= 0)
5958 {
5959 InventoryLocation r_il = new InventoryLocation;
5960 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
5961
5962 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
5965 {
5966 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
5967 }
5969 {
5970 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
5971 }
5972
5973 }
5974
5975 player.GetHumanInventory().ClearUserReservedLocation(this);
5976 }
5977
5980 }
5981
5982
5983
5984
5986 {
5987 return ItemBase.m_DebugActionsMask;
5988 }
5989
5991 {
5992 return ItemBase.m_DebugActionsMask & mask;
5993 }
5994
5996 {
5997 ItemBase.m_DebugActionsMask = mask;
5998 }
5999
6001 {
6002 ItemBase.m_DebugActionsMask |= mask;
6003 }
6004
6006 {
6007 ItemBase.m_DebugActionsMask &= ~mask;
6008 }
6009
6011 {
6013 {
6015 }
6016 else
6017 {
6019 }
6020 }
6021
6022
6024 {
6025 if (GetEconomyProfile())
6026 {
6027 float q_max = GetEconomyProfile().GetQuantityMax();
6028 if (q_max > 0)
6029 {
6030 float q_min = GetEconomyProfile().GetQuantityMin();
6031 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6032
6034 {
6035 ComponentEnergyManager comp = GetCompEM();
6037 {
6039 }
6040 }
6042 {
6044
6045 }
6046
6047 }
6048 }
6049 }
6050
6053 {
6054 EntityAI parent = GetHierarchyParent();
6055
6056 if (parent)
6057 {
6058 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6059 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6060 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6061 }
6062 }
6063
6066 {
6067 EntityAI parent = GetHierarchyParent();
6068
6069 if (parent)
6070 {
6071 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6072 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6073 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6074 }
6075 }
6076
6078 {
6079
6080
6081
6082
6084
6086 {
6087 if (ScriptInputUserData.CanStoreInputUserData())
6088 {
6089 ScriptInputUserData ctx = new ScriptInputUserData;
6095 ctx.
Write(use_stack_max);
6098
6100 {
6101 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6102 }
6103 }
6104 }
6105 else if (!
GetGame().IsMultiplayer())
6106 {
6108 }
6109 }
6110
6112 {
6114 }
6115
6117 {
6119 }
6120
6122 {
6124 }
6125
6127 {
6128
6129 return false;
6130 }
6131
6133 {
6134 return false;
6135 }
6136
6140 {
6141 return false;
6142 }
6143
6145 {
6146 return "";
6147 }
6148
6150
6152 {
6153 return false;
6154 }
6155
6157 {
6158 return true;
6159 }
6160
6161
6162
6164 {
6165 return true;
6166 }
6167
6169 {
6170 return true;
6171 }
6172
6174 {
6175 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6177 }
6178
6180 {
6182 }
6183
6185 {
6187 if (!is_being_placed)
6189 SetSynchDirty();
6190 }
6191
6192
6194
6196 {
6198 }
6199
6201 {
6203 }
6204
6206 {
6207 return 1;
6208 }
6209
6211 {
6212 return false;
6213 }
6214
6216 {
6218 SetSynchDirty();
6219 }
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6256 {
6257 super.OnMovedInsideCargo(container);
6258
6259 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6260 }
6261
6262 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6263 {
6264 super.EEItemLocationChanged(oldLoc,newLoc);
6265
6266 PlayerBase new_player = null;
6267 PlayerBase old_player = null;
6268
6269 if (newLoc.GetParent())
6270 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6271
6272 if (oldLoc.GetParent())
6273 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6274
6276 {
6277 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6278
6279 if (r_index >= 0)
6280 {
6281 InventoryLocation r_il = new InventoryLocation;
6282 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6283
6284 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6287 {
6288 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6289 }
6291 {
6292 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6293 }
6294
6295 }
6296 }
6297
6299 {
6300 if (new_player)
6301 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6302
6303 if (new_player == old_player)
6304 {
6305
6306 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6307 {
6309 {
6310 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6311 {
6312 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6313 }
6314 }
6315 else
6316 {
6317 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6318 }
6319 }
6320
6321 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6322 {
6323 int type = oldLoc.GetType();
6325 {
6326 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6327 }
6329 {
6330 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6331 }
6332 }
6333 if (!m_OldLocation)
6334 {
6335 m_OldLocation = new InventoryLocation;
6336 }
6337 m_OldLocation.Copy(oldLoc);
6338 }
6339 else
6340 {
6341 if (m_OldLocation)
6342 {
6343 m_OldLocation.Reset();
6344 }
6345 }
6346
6348 }
6349 else
6350 {
6351 if (new_player)
6352 {
6353 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6354 if (res_index >= 0)
6355 {
6356 InventoryLocation il = new InventoryLocation;
6357 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6359 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6362 {
6363 il.
GetParent().GetOnReleaseLock().Invoke(it);
6364 }
6366 {
6368 }
6369
6370 }
6371 }
6373 {
6374
6376 }
6377
6378 if (m_OldLocation)
6379 {
6380 m_OldLocation.Reset();
6381 }
6382 }
6383 }
6384
6385 override void EOnContact(IEntity other, Contact extra)
6386 {
6388 {
6389 int liquidType = -1;
6391 if (impactSpeed > 0.0)
6392 {
6394 #ifndef SERVER
6396 #else
6398 SetSynchDirty();
6399 #endif
6401 }
6402 }
6403
6404 #ifdef SERVER
6405 if (GetCompEM() && GetCompEM().IsPlugged())
6406 {
6407 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6408 GetCompEM().UnplugThis();
6409 }
6410 #endif
6411 }
6412
6414
6416 {
6418 }
6419
6421 {
6422
6423 }
6424
6426 {
6427 super.OnItemLocationChanged(old_owner, new_owner);
6428
6429 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6430 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6431
6432 if (!relatedPlayer && playerNew)
6433 relatedPlayer = playerNew;
6434
6435 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6436 {
6438 if (actionMgr)
6439 {
6440 ActionBase currentAction = actionMgr.GetRunningAction();
6441 if (currentAction)
6443 }
6444 }
6445
6446 Man ownerPlayerOld = null;
6447 Man ownerPlayerNew = null;
6448
6449 if (old_owner)
6450 {
6451 if (old_owner.
IsMan())
6452 {
6453 ownerPlayerOld = Man.Cast(old_owner);
6454 }
6455 else
6456 {
6457 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6458 }
6459 }
6460 else
6461 {
6463 {
6465
6466 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6467 {
6468 GetCompEM().UnplugThis();
6469 }
6470 }
6471 }
6472
6473 if (new_owner)
6474 {
6475 if (new_owner.
IsMan())
6476 {
6477 ownerPlayerNew = Man.Cast(new_owner);
6478 }
6479 else
6480 {
6481 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6482 }
6483 }
6484
6485 if (ownerPlayerOld != ownerPlayerNew)
6486 {
6487 if (ownerPlayerOld)
6488 {
6489 array<EntityAI> subItemsExit = new array<EntityAI>;
6491 for (int i = 0; i < subItemsExit.Count(); i++)
6492 {
6495 }
6496 }
6497
6498 if (ownerPlayerNew)
6499 {
6500 array<EntityAI> subItemsEnter = new array<EntityAI>;
6502 for (int j = 0; j < subItemsEnter.Count(); j++)
6503 {
6506 }
6507 }
6508 }
6509 else if (ownerPlayerNew != null)
6510 {
6511 PlayerBase nplayer;
6512 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6513 {
6514 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6516 for (int k = 0; k < subItemsUpdate.Count(); k++)
6517 {
6519 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6520 }
6521 }
6522 }
6523
6524 if (old_owner)
6525 old_owner.OnChildItemRemoved(this);
6526 if (new_owner)
6527 new_owner.OnChildItemReceived(this);
6528 }
6529
6530
6532 {
6533 super.EEDelete(parent);
6534 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6535 if (player)
6536 {
6538
6539 if (player.IsAlive())
6540 {
6541 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6542 if (r_index >= 0)
6543 {
6544 InventoryLocation r_il = new InventoryLocation;
6545 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6546
6547 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6550 {
6551 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6552 }
6554 {
6555 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6556 }
6557
6558 }
6559
6560 player.RemoveQuickBarEntityShortcut(this);
6561 }
6562 }
6563 }
6564
6566 {
6567 super.EEKilled(killer);
6568
6571 {
6572 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6573 {
6574 if (IsMagazine())
6575 {
6576 if (Magazine.Cast(this).GetAmmoCount() > 0)
6577 {
6579 }
6580 }
6581 else
6582 {
6584 }
6585 }
6586 }
6587 }
6588
6590 {
6591 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6592
6593 super.OnWasAttached(parent, slot_id);
6594
6597
6599 }
6600
6602 {
6603 super.OnWasDetached(parent, slot_id);
6604
6607 }
6608
6610 {
6611 int idx;
6614
6615 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6616 if (inventory_slots.Count() < 1)
6617 {
6618 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6619 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6620 }
6621 else
6622 {
6623 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6624 }
6625
6626 idx = inventory_slots.Find(slot);
6627 if (idx < 0)
6628 return "";
6629
6630 return attach_types.Get(idx);
6631 }
6632
6634 {
6635 int idx = -1;
6636 string slot;
6637
6640
6641 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6642 if (inventory_slots.Count() < 1)
6643 {
6644 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6645 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6646 }
6647 else
6648 {
6649 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6650 if (detach_types.Count() < 1)
6651 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6652 }
6653
6654 for (int i = 0; i < inventory_slots.Count(); i++)
6655 {
6656 slot = inventory_slots.Get(i);
6657 }
6658
6659 if (slot != "")
6660 {
6661 if (detach_types.Count() == 1)
6662 idx = 0;
6663 else
6664 idx = inventory_slots.Find(slot);
6665 }
6666 if (idx < 0)
6667 return "";
6668
6669 return detach_types.Get(idx);
6670 }
6671
6673 {
6674
6676
6677
6678 float min_time = 1;
6679 float max_time = 3;
6680 float delay = Math.RandomFloat(min_time, max_time);
6681
6682 explode_timer.Run(delay, this, "DoAmmoExplosion");
6683 }
6684
6686 {
6687 Magazine magazine = Magazine.Cast(this);
6688 int pop_sounds_count = 6;
6689 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
6690
6691
6692 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
6693 string sound_name = pop_sounds[ sound_idx ];
6695
6696
6697 magazine.ServerAddAmmoCount(-1);
6698
6699
6700 float min_temp_to_explode = 100;
6701
6702 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
6703 {
6705 }
6706 }
6707
6708
6709 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
6710 {
6711 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
6712
6713 const int CHANCE_DAMAGE_CARGO = 4;
6714 const int CHANCE_DAMAGE_ATTACHMENT = 1;
6715 const int CHANCE_DAMAGE_NOTHING = 2;
6716
6718 {
6719 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
6720 int chances;
6721 int rnd;
6722
6723 if (GetInventory().GetCargo())
6724 {
6725 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6726 rnd = Math.RandomInt(0,chances);
6727
6728 if (rnd < CHANCE_DAMAGE_CARGO)
6729 {
6731 }
6732 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
6733 {
6735 }
6736 }
6737 else
6738 {
6739 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6740 rnd = Math.RandomInt(0,chances);
6741
6742 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
6743 {
6745 }
6746 }
6747 }
6748 }
6749
6751 {
6752 if (GetInventory().GetCargo())
6753 {
6754 int item_count = GetInventory().GetCargo().GetItemCount();
6755 if (item_count > 0)
6756 {
6757 int random_pick = Math.RandomInt(0, item_count);
6759 if (!item.IsExplosive())
6760 {
6761 item.AddHealth("","",damage);
6762 return true;
6763 }
6764 }
6765 }
6766 return false;
6767 }
6768
6770 {
6771 int attachment_count = GetInventory().AttachmentCount();
6772 if (attachment_count > 0)
6773 {
6774 int random_pick = Math.RandomInt(0, attachment_count);
6775 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
6776 if (!attachment.IsExplosive())
6777 {
6778 attachment.AddHealth("","",damage);
6779 return true;
6780 }
6781 }
6782 return false;
6783 }
6784
6786 {
6788 }
6789
6791 {
6793 return GetInventory().CanRemoveEntity();
6794
6795 return false;
6796 }
6797
6799 {
6800
6802 return false;
6803
6804
6806 return false;
6807
6808
6809
6811 if (delta == 0)
6812 return false;
6813
6814
6815 return true;
6816 }
6817
6819 {
6821 {
6822 if (ScriptInputUserData.CanStoreInputUserData())
6823 {
6824 ScriptInputUserData ctx = new ScriptInputUserData;
6829 ctx.
Write(destination_entity);
6833 }
6834 }
6835 else if (!
GetGame().IsMultiplayer())
6836 {
6838 }
6839 }
6840
6842 {
6843 float split_quantity_new;
6847 InventoryLocation loc = new InventoryLocation;
6848
6849 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6850 {
6852 split_quantity_new = stack_max;
6853 else
6855
6857 {
6858 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6859 if (new_item)
6860 {
6861 new_item.SetResultOfSplit(true);
6862 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6864 new_item.
SetQuantity(split_quantity_new,
false,
true);
6865 }
6866 }
6867 }
6868 else if (destination_entity && slot_id == -1)
6869 {
6870 if (quantity > stack_max)
6871 split_quantity_new = stack_max;
6872 else
6873 split_quantity_new = quantity;
6874
6876 {
6878 {
6881 }
6882
6883 if (new_item)
6884 {
6885 new_item.SetResultOfSplit(true);
6886 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6888 new_item.
SetQuantity(split_quantity_new,
false,
true);
6889 }
6890 }
6891 }
6892 else
6893 {
6894 if (stack_max != 0)
6895 {
6897 {
6899 }
6900
6901 if (split_quantity_new == 0)
6902 {
6903 if (!
GetGame().IsMultiplayer())
6904 player.PhysicalPredictiveDropItem(this);
6905 else
6906 player.ServerDropEntity(this);
6907 return;
6908 }
6909
6911 {
6913
6914 if (new_item)
6915 {
6916 new_item.SetResultOfSplit(true);
6917 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6920 new_item.PlaceOnSurface();
6921 }
6922 }
6923 }
6924 }
6925 }
6926
6928 {
6929 float split_quantity_new;
6933 InventoryLocation loc = new InventoryLocation;
6934
6935 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6936 {
6938 split_quantity_new = stack_max;
6939 else
6941
6943 {
6944 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6945 if (new_item)
6946 {
6947 new_item.SetResultOfSplit(true);
6948 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6950 new_item.
SetQuantity(split_quantity_new,
false,
true);
6951 }
6952 }
6953 }
6954 else if (destination_entity && slot_id == -1)
6955 {
6956 if (quantity > stack_max)
6957 split_quantity_new = stack_max;
6958 else
6959 split_quantity_new = quantity;
6960
6962 {
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 (!
GetGame().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 (!
GetGame().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 (!
GetGame().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 }
7257
7260 {
7261
7262 }
7263
7266 {
7268 }
7269
7271 {
7272 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7273
7275 {
7276 if (newLevel == GameConstants.STATE_RUINED)
7277 {
7279 EntityAI parent = GetHierarchyParent();
7280 if (parent && parent.IsFireplace())
7281 {
7282 CargoBase cargo = GetInventory().GetCargo();
7283 if (cargo)
7284 {
7286 {
7288 }
7289 }
7290 }
7291 }
7292
7294 {
7295
7297 return;
7298 }
7299
7300 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7301 {
7303 }
7304 }
7305 }
7306
7307
7309 {
7310 super.OnRightClick();
7311
7313 {
7315 {
7316 if (ScriptInputUserData.CanStoreInputUserData())
7317 {
7318 EntityAI root = GetHierarchyRoot();
7319 Man playerOwner = GetHierarchyRootPlayer();
7320 InventoryLocation dst = new InventoryLocation;
7321
7322
7323 if (!playerOwner && root && root == this)
7324 {
7326 }
7327 else
7328 {
7329
7330 GetInventory().GetCurrentInventoryLocation(dst);
7332 {
7335 {
7337 }
7338 else
7339 {
7341
7342
7343 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7344 {
7346 }
7347 else
7348 {
7349 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7350 }
7351 }
7352 }
7353 }
7354
7355 ScriptInputUserData ctx = new ScriptInputUserData;
7363 }
7364 }
7365 else if (!
GetGame().IsMultiplayer())
7366 {
7368 }
7369 }
7370 }
7371
7373 {
7374 if (root)
7375 {
7376 vector m4[4];
7377 root.GetTransform(m4);
7378 dst.SetGround(this, m4);
7379 }
7380 else
7381 {
7382 GetInventory().GetCurrentInventoryLocation(dst);
7383 }
7384 }
7385
7386 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7387 {
7388
7389 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7390 return false;
7391
7392 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7393 return false;
7394
7395
7397 return false;
7398
7399
7400 Magazine mag = Magazine.Cast(this);
7401 if (mag)
7402 {
7403 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7404 return false;
7405
7406 if (stack_max_limit)
7407 {
7408 Magazine other_mag = Magazine.Cast(other_item);
7409 if (other_item)
7410 {
7411 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7412 return false;
7413 }
7414
7415 }
7416 }
7417 else
7418 {
7419
7421 return false;
7422
7424 return false;
7425 }
7426
7427 PlayerBase player = null;
7428 if (CastTo(player, GetHierarchyRootPlayer()))
7429 {
7430 if (player.GetInventory().HasAttachment(this))
7431 return false;
7432
7433 if (player.IsItemsToDelete())
7434 return false;
7435 }
7436
7437 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7438 return false;
7439
7440 int slotID;
7442 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7443 return false;
7444
7445 return true;
7446 }
7447
7449 {
7451 }
7452
7454 {
7455 return m_IsResultOfSplit;
7456 }
7457
7459 {
7460 m_IsResultOfSplit = value;
7461 }
7462
7464 {
7466 }
7467
7469 {
7470 float other_item_quantity = other_item.GetQuantity();
7471 float this_free_space;
7472
7474
7476
7477 if (other_item_quantity > this_free_space)
7478 {
7479 return this_free_space;
7480 }
7481 else
7482 {
7483 return other_item_quantity;
7484 }
7485 }
7486
7488 {
7490 }
7491
7493 {
7495 return;
7496
7497 if (!IsMagazine() && other_item)
7498 {
7500 if (quantity_used != 0)
7501 {
7502 float hp1 = GetHealth01("","");
7503 float hp2 = other_item.GetHealth01("","");
7504 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7505 hpResult = hpResult / (
GetQuantity() + quantity_used);
7506
7507 hpResult *= GetMaxHealth();
7508 Math.Round(hpResult);
7509 SetHealth("", "Health", hpResult);
7510
7512 other_item.AddQuantity(-quantity_used);
7513 }
7514 }
7516 }
7517
7519 {
7520 #ifdef SERVER
7521 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7522 GetHierarchyParent().IncreaseLifetimeUp();
7523 #endif
7524 };
7525
7527 {
7528 PlayerBase p = PlayerBase.Cast(player);
7529
7530 array<int> recipesIds = p.m_Recipes;
7531 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7532 if (moduleRecipesManager)
7533 {
7534 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
7535 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7536 }
7537
7538 for (int i = 0;i < recipesIds.Count(); i++)
7539 {
7540 int key = recipesIds.Get(i);
7541 string recipeName = moduleRecipesManager.GetRecipeName(key);
7543 }
7544 }
7545
7546
7547 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7548 {
7549 super.GetDebugActions(outputList);
7550
7551
7557
7558
7563
7568
7569
7573
7574
7576 {
7580 }
7581
7584
7585
7589
7591
7592 InventoryLocation loc = new InventoryLocation();
7593 GetInventory().GetCurrentInventoryLocation(loc);
7595 {
7596 if (Gizmo_IsSupported())
7599 }
7600
7602 }
7603
7604
7605
7606
7608 {
7609 super.OnAction(action_id, player, ctx);
7610
7612 {
7613 switch (action_id)
7614 {
7617 return true;
7620 return true;
7621 }
7622 }
7623
7625 {
7626 switch (action_id)
7627 {
7629 Delete();
7630 return true;
7631 }
7632 }
7633
7634 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
7635 {
7636 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7637 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
7638 PlayerBase p = PlayerBase.Cast(player);
7639 if (
EActions.RECIPES_RANGE_START < 1000)
7640 {
7641 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7642 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7643 }
7644 }
7645 #ifndef SERVER
7646 else if (action_id ==
EActions.WATCH_PLAYER)
7647 {
7648 PluginDeveloper.SetDeveloperItemClientEx(player);
7649 }
7650 #endif
7652 {
7653 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7654 {
7655 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7656 OnDebugButtonPressServer(id + 1);
7657 }
7658
7659 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7660 {
7661 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
7663 }
7664
7665 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
7666 {
7667 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
7669 }
7670
7671 else if (action_id ==
EActions.ADD_QUANTITY)
7672 {
7673 if (IsMagazine())
7674 {
7675 Magazine mag = Magazine.Cast(this);
7676 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
7677 }
7678 else
7679 {
7681 }
7682
7683 if (m_EM)
7684 {
7685 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
7686 }
7687
7688 }
7689
7690 else if (action_id ==
EActions.REMOVE_QUANTITY)
7691 {
7692 if (IsMagazine())
7693 {
7694 Magazine mag2 = Magazine.Cast(this);
7695 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
7696 }
7697 else
7698 {
7700 }
7701 if (m_EM)
7702 {
7703 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
7704 }
7705
7706 }
7707
7708 else if (action_id ==
EActions.SET_QUANTITY_0)
7709 {
7711
7712 if (m_EM)
7713 {
7714 m_EM.SetEnergy(0);
7715 }
7716 }
7717
7718 else if (action_id ==
EActions.SET_MAX_QUANTITY)
7719 {
7721
7722 if (m_EM)
7723 {
7724 m_EM.SetEnergy(m_EM.GetEnergyMax());
7725 }
7726 }
7727
7728 else if (action_id ==
EActions.ADD_HEALTH)
7729 {
7730 AddHealth("","",GetMaxHealth("","Health")/5);
7731 }
7732 else if (action_id ==
EActions.REMOVE_HEALTH)
7733 {
7734 AddHealth("","",-GetMaxHealth("","Health")/5);
7735 }
7736 else if (action_id ==
EActions.DESTROY_HEALTH)
7737 {
7738 SetHealth01("","",0);
7739 }
7740 else if (action_id ==
EActions.WATCH_ITEM)
7741 {
7743 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
7744 #ifdef DEVELOPER
7745 SetDebugDeveloper_item(this);
7746 #endif
7747 }
7748
7749 else if (action_id ==
EActions.ADD_TEMPERATURE)
7750 {
7751 AddTemperature(20);
7752
7753 }
7754
7755 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
7756 {
7757 AddTemperature(-20);
7758
7759 }
7760
7761 else if (action_id ==
EActions.FLIP_FROZEN)
7762 {
7763 SetFrozen(!GetIsFrozen());
7764
7765 }
7766
7767 else if (action_id ==
EActions.ADD_WETNESS)
7768 {
7770
7771 }
7772
7773 else if (action_id ==
EActions.REMOVE_WETNESS)
7774 {
7776
7777 }
7778
7779 else if (action_id ==
EActions.LIQUIDTYPE_UP)
7780 {
7783
7784
7785 }
7786
7787 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
7788 {
7791 }
7792
7793 else if (action_id ==
EActions.MAKE_SPECIAL)
7794 {
7795 auto debugParams = DebugSpawnParams.WithPlayer(player);
7796 OnDebugSpawnEx(debugParams);
7797 }
7798
7799 }
7800
7801
7802 return false;
7803 }
7804
7805
7806
7807
7811
7814
7815
7816
7818 {
7819 return false;
7820 }
7821
7822
7824 {
7825 return true;
7826 }
7827
7828
7830 {
7831 return true;
7832 }
7833
7834
7835
7837 {
7838 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
7840 }
7841
7844 {
7845 return null;
7846 }
7847
7849 {
7850 return false;
7851 }
7852
7854 {
7855 return false;
7856 }
7857
7861
7862
7864 {
7865 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7866 return module_repairing.CanRepair(this, item_repair_kit);
7867 }
7868
7869
7870 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
7871 {
7872 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7873 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
7874 }
7875
7876
7878 {
7879
7880
7881
7882
7883
7884
7885
7886
7887 return 1;
7888 }
7889
7890
7891
7893 {
7895 }
7896
7897
7898
7900 {
7902 }
7903
7904
7913 {
7914 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7915
7916 if (player)
7917 {
7918 player.MessageStatus(text);
7919 }
7920 }
7921
7922
7931 {
7932 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7933
7934 if (player)
7935 {
7936 player.MessageAction(text);
7937 }
7938 }
7939
7940
7949 {
7950 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7951
7952 if (player)
7953 {
7954 player.MessageFriendly(text);
7955 }
7956 }
7957
7958
7967 {
7968 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7969
7970 if (player)
7971 {
7972 player.MessageImportant(text);
7973 }
7974 }
7975
7977 {
7978 return true;
7979 }
7980
7981
7982 override bool KindOf(
string tag)
7983 {
7984 bool found = false;
7985 string item_name = this.
GetType();
7988
7989 int array_size = item_tag_array.Count();
7990 for (int i = 0; i < array_size; i++)
7991 {
7992 if (item_tag_array.Get(i) == tag)
7993 {
7994 found = true;
7995 break;
7996 }
7997 }
7998 return found;
7999 }
8000
8001
8003 {
8004
8005 super.OnRPC(sender, rpc_type,ctx);
8006
8007
8008 switch (rpc_type)
8009 {
8010 #ifndef SERVER
8011 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8012 Param2<bool, string> p = new Param2<bool, string>(false, "");
8013
8015 return;
8016
8017 bool play = p.param1;
8018 string soundSet = p.param2;
8019
8020 if (play)
8021 {
8023 {
8025 {
8027 }
8028 }
8029 else
8030 {
8032 }
8033 }
8034 else
8035 {
8037 }
8038
8039 break;
8040 #endif
8041
8042 }
8043
8045 {
8047 }
8048 }
8049
8050
8051
8052
8054 {
8055 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8056 return plugin.GetID(
name);
8057 }
8058
8060 {
8061 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8062 return plugin.GetName(id);
8063 }
8064
8067 {
8068
8069
8070 int varFlags;
8071 if (!ctx.
Read(varFlags))
8072 return;
8073
8074 if (varFlags & ItemVariableFlags.FLOAT)
8075 {
8077 }
8078 }
8079
8081 {
8082
8083 super.SerializeNumericalVars(floats_out);
8084
8085
8086
8088 {
8090 }
8091
8093 {
8095 }
8096
8098 {
8100 }
8101
8103 {
8108 }
8109
8111 {
8113 }
8114 }
8115
8117 {
8118
8119 super.DeSerializeNumericalVars(floats);
8120
8121
8122 int index = 0;
8123 int mask = Math.Round(floats.Get(index));
8124
8125 index++;
8126
8128 {
8130 {
8132 }
8133 else
8134 {
8135 float quantity = floats.Get(index);
8137 }
8138 index++;
8139 }
8140
8142 {
8143 float wet = floats.Get(index);
8145 index++;
8146 }
8147
8149 {
8150 int liquidtype = Math.Round(floats.Get(index));
8152 index++;
8153 }
8154
8156 {
8158 index++;
8160 index++;
8162 index++;
8164 index++;
8165 }
8166
8168 {
8169 int cleanness = Math.Round(floats.Get(index));
8171 index++;
8172 }
8173 }
8174
8176 {
8177 super.WriteVarsToCTX(ctx);
8178
8179
8181 {
8183 }
8184
8186 {
8188 }
8189
8191 {
8193 }
8194
8196 {
8197 int r,g,b,a;
8203 }
8204
8206 {
8208 }
8209 }
8210
8212 {
8213 if (!super.ReadVarsFromCTX(ctx,version))
8214 return false;
8215
8216 int intValue;
8217 float value;
8218
8219 if (version < 140)
8220 {
8221 if (!ctx.
Read(intValue))
8222 return false;
8223
8224 m_VariablesMask = intValue;
8225 }
8226
8228 {
8229 if (!ctx.
Read(value))
8230 return false;
8231
8233 {
8235 }
8236 else
8237 {
8239 }
8240 }
8241
8242 if (version < 140)
8243 {
8245 {
8246 if (!ctx.
Read(value))
8247 return false;
8248 SetTemperatureDirect(value);
8249 }
8250 }
8251
8253 {
8254 if (!ctx.
Read(value))
8255 return false;
8257 }
8258
8260 {
8261 if (!ctx.
Read(intValue))
8262 return false;
8264 }
8265
8267 {
8268 int r,g,b,a;
8270 return false;
8272 return false;
8274 return false;
8276 return false;
8277
8279 }
8280
8282 {
8283 if (!ctx.
Read(intValue))
8284 return false;
8286 }
8287
8288 if (version >= 138 && version < 140)
8289 {
8291 {
8292 if (!ctx.
Read(intValue))
8293 return false;
8294 SetFrozen(intValue);
8295 }
8296 }
8297
8298 return true;
8299 }
8300
8301
8303 {
8306 {
8308 }
8309
8310 if (!super.OnStoreLoad(ctx, version))
8311 {
8313 return false;
8314 }
8315
8316 if (version >= 114)
8317 {
8318 bool hasQuickBarIndexSaved;
8319
8320 if (!ctx.
Read(hasQuickBarIndexSaved))
8321 {
8323 return false;
8324 }
8325
8326 if (hasQuickBarIndexSaved)
8327 {
8328 int itmQBIndex;
8329
8330
8331 if (!ctx.
Read(itmQBIndex))
8332 {
8334 return false;
8335 }
8336
8337 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8338 if (itmQBIndex != -1 && parentPlayer)
8339 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8340 }
8341 }
8342 else
8343 {
8344
8345 PlayerBase player;
8346 int itemQBIndex;
8347 if (version ==
int.
MAX)
8348 {
8349 if (!ctx.
Read(itemQBIndex))
8350 {
8352 return false;
8353 }
8354 }
8355 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8356 {
8357
8358 if (!ctx.
Read(itemQBIndex))
8359 {
8361 return false;
8362 }
8363 if (itemQBIndex != -1 && player)
8364 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8365 }
8366 }
8367
8368 if (version < 140)
8369 {
8370
8371 if (!LoadVariables(ctx, version))
8372 {
8374 return false;
8375 }
8376 }
8377
8378
8380 {
8382 return false;
8383 }
8384 if (version >= 132)
8385 {
8387 if (raib)
8388 {
8390 {
8392 return false;
8393 }
8394 }
8395 }
8396
8398 return true;
8399 }
8400
8401
8402
8404 {
8405 super.OnStoreSave(ctx);
8406
8407 PlayerBase player;
8408 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8409 {
8411
8412 int itemQBIndex = -1;
8413 itemQBIndex = player.FindQuickBarEntityIndex(this);
8414 ctx.
Write(itemQBIndex);
8415 }
8416 else
8417 {
8419 }
8420
8422
8424 if (raib)
8425 {
8427 }
8428 }
8429
8430
8432 {
8433 super.AfterStoreLoad();
8434
8436 {
8438 }
8439
8441 {
8444 }
8445 }
8446
8448 {
8449 super.EEOnAfterLoad();
8450
8452 {
8454 }
8455
8458 }
8459
8461 {
8462 return false;
8463 }
8464
8465
8466
8468 {
8470 {
8471 #ifdef PLATFORM_CONSOLE
8472
8474 {
8476 if (menu)
8477 {
8479 }
8480 }
8481 #endif
8482 }
8483
8485 {
8488 }
8489
8491 {
8492 SetWeightDirty();
8494 }
8496 {
8499 }
8500
8502 {
8505 }
8507 {
8510 }
8511
8512 super.OnVariablesSynchronized();
8513 }
8514
8515
8516
8518 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8519 {
8520 if (!IsServerCheck(allow_client))
8521 return false;
8522
8524 return false;
8525
8528
8529 if (value <= (min + 0.001))
8530 value = min;
8531
8532 if (value == min)
8533 {
8534 if (destroy_config)
8535 {
8536 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8537 if (dstr)
8538 {
8540 this.Delete();
8541 return true;
8542 }
8543 }
8544 else if (destroy_forced)
8545 {
8547 this.Delete();
8548 return true;
8549 }
8550
8552 }
8553
8556
8558 {
8560
8561 if (delta)
8563 }
8564
8566
8567 return false;
8568 }
8569
8570
8572 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8573 {
8575 }
8576
8578 {
8581 }
8582
8584 {
8587 }
8588
8590 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8591 {
8592 float value_clamped = Math.Clamp(value, 0, 1);
8594 SetQuantity(result, destroy_config, destroy_forced);
8595 }
8596
8597
8600 {
8602 }
8603
8605 {
8607 }
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8619 {
8620 int slot = -1;
8621 if (GetInventory())
8622 {
8623 InventoryLocation il = new InventoryLocation;
8624 GetInventory().GetCurrentInventoryLocation(il);
8626 }
8627
8629 }
8630
8632 {
8633 float quantity_max = 0;
8634
8636 {
8637 if (attSlotID != -1)
8638 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8639
8640 if (quantity_max <= 0)
8642 }
8643
8644 if (quantity_max <= 0)
8646
8647 return quantity_max;
8648 }
8649
8651 {
8653 }
8654
8656 {
8658 }
8659
8660
8662 {
8664 }
8665
8667 {
8669 }
8670
8672 {
8674 }
8675
8676
8678 {
8679
8680 float weightEx = GetWeightEx();
8681 float special = GetInventoryAndCargoWeight();
8682 return weightEx - special;
8683 }
8684
8685
8687 {
8689 }
8690
8692 {
8694 {
8695 #ifdef DEVELOPER
8696 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8697 {
8698 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
8700 }
8701 #endif
8702
8704 }
8705 else if (HasEnergyManager())
8706 {
8707 #ifdef DEVELOPER
8708 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8709 {
8710 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
8711 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
8712 }
8713 #endif
8714 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
8715 }
8716 else
8717 {
8718 #ifdef DEVELOPER
8719 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8720 {
8721 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
8722 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
8723 }
8724 #endif
8725 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
8726 }
8727 }
8728
8731 {
8732 int item_count = 0;
8734
8735 if (GetInventory().GetCargo() != NULL)
8736 {
8737 item_count = GetInventory().GetCargo().GetItemCount();
8738 }
8739
8740 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
8741 {
8742 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
8743 if (item)
8744 item_count += item.GetNumberOfItems();
8745 }
8746 return item_count;
8747 }
8748
8751 {
8752 float weight = 0;
8753 float wetness = 1;
8754 if (include_wetness)
8757 {
8758 weight = wetness * m_ConfigWeight;
8759 }
8761 {
8762 weight = 1;
8763 }
8764 return weight;
8765 }
8766
8767
8768
8770 {
8771 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
8772 {
8773 GameInventory inv = GetInventory();
8774 array<EntityAI> items = new array<EntityAI>;
8776 for (int i = 0; i < items.Count(); i++)
8777 {
8779 if (item)
8780 {
8782 }
8783 }
8784 }
8785 }
8786
8787
8788
8789
8791 {
8792 float energy = 0;
8793 if (HasEnergyManager())
8794 {
8795 energy = GetCompEM().GetEnergy();
8796 }
8797 return energy;
8798 }
8799
8800
8802 {
8803 super.OnEnergyConsumed();
8804
8806 }
8807
8809 {
8810 super.OnEnergyAdded();
8811
8813 }
8814
8815
8817 {
8818 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
8819 {
8821 {
8822 float energy_0to1 = GetCompEM().GetEnergy0To1();
8824 }
8825 }
8826 }
8827
8828
8830 {
8831 return ConfigGetFloat("heatIsolation");
8832 }
8833
8835 {
8837 }
8838
8840 {
8841 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
8842 if (
GetGame().ConfigIsExisting(paramPath))
8844
8845 return 0.0;
8846 }
8847
8849 {
8850 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
8851 if (
GetGame().ConfigIsExisting(paramPath))
8853
8854 return 0.0;
8855 }
8856
8857 override void SetWet(
float value,
bool allow_client =
false)
8858 {
8859 if (!IsServerCheck(allow_client))
8860 return;
8861
8864
8866
8867 m_VarWet = Math.Clamp(value, min, max);
8868
8870 {
8873 }
8874 }
8875
8876 override void AddWet(
float value)
8877 {
8879 }
8880
8882 {
8884 }
8885
8887 {
8889 }
8890
8892 {
8894 }
8895
8897 {
8899 }
8900
8902 {
8904 }
8905
8907 {
8910 if (newLevel != oldLevel)
8911 {
8913 }
8914 }
8915
8917 {
8918 SetWeightDirty();
8919 }
8920
8922 {
8923 return GetWetLevelInternal(
m_VarWet);
8924 }
8925
8926
8927
8929 {
8931 }
8932
8934 {
8936 }
8937
8939 {
8941 }
8942
8944 {
8946 }
8947
8948
8949
8951 {
8952 if (ConfigIsExisting("itemModelLength"))
8953 {
8954 return ConfigGetFloat("itemModelLength");
8955 }
8956 return 0;
8957 }
8958
8960 {
8961 if (ConfigIsExisting("itemAttachOffset"))
8962 {
8963 return ConfigGetFloat("itemAttachOffset");
8964 }
8965 return 0;
8966 }
8967
8968 override void SetCleanness(
int value,
bool allow_client =
false)
8969 {
8970 if (!IsServerCheck(allow_client))
8971 return;
8972
8974
8976
8979 }
8980
8982 {
8984 }
8985
8987 {
8988 return true;
8989 }
8990
8991
8992
8993
8995 {
8997 }
8998
9000 {
9002 }
9003
9004
9005
9006
9007 override void SetColor(
int r,
int g,
int b,
int a)
9008 {
9014 }
9016 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9017 {
9022 }
9023
9025 {
9027 }
9028
9031 {
9032 int r,g,b,a;
9034 r = r/255;
9035 g = g/255;
9036 b = b/255;
9037 a = a/255;
9038 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9039 }
9040
9041
9042
9043 override void SetLiquidType(
int value,
bool allow_client =
false)
9044 {
9045 if (!IsServerCheck(allow_client))
9046 return;
9047
9052 }
9053
9055 {
9056 return ConfigGetInt("varLiquidTypeInit");
9057 }
9058
9060 {
9062 }
9063
9065 {
9067 SetFrozen(false);
9068 }
9069
9072 {
9073 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9074 }
9075
9076
9079 {
9080 PlayerBase nplayer;
9081 if (PlayerBase.CastTo(nplayer, player))
9082 {
9084
9085 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9086 }
9087 }
9088
9089
9092 {
9093 PlayerBase nplayer;
9094 if (PlayerBase.CastTo(nplayer,player))
9095 {
9096
9097 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9098
9099 }
9100
9101
9102 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9103
9104
9105 if (HasEnergyManager())
9106 {
9107 GetCompEM().UpdatePlugState();
9108 }
9109 }
9110
9111
9113 {
9114 super.OnPlacementStarted(player);
9115
9117 }
9118
9119 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9120 {
9122 {
9123 m_AdminLog.OnPlacementComplete(player,
this);
9124 }
9125
9126 super.OnPlacementComplete(player, position, orientation);
9127 }
9128
9129
9130
9131
9132
9134 {
9136 {
9137 return true;
9138 }
9139 else
9140 {
9141 return false;
9142 }
9143 }
9144
9145
9147 {
9149 {
9151 }
9152 }
9153
9154
9156 {
9158 }
9159
9161 {
9163 }
9164
9165 override void InsertAgent(
int agent,
float count = 1)
9166 {
9167 if (count < 1)
9168 return;
9169
9171 }
9172
9175 {
9177 }
9178
9179
9181 {
9183 }
9184
9185
9186
9187
9188
9189
9190
9191
9192
9193
9194
9195
9196
9197
9198
9199
9200
9201
9202
9203
9204
9205
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9227 {
9229 return false;
9230 return true;
9231 }
9232
9234 {
9235
9237 }
9238
9239
9242 {
9243 super.CheckForRoofLimited(timeTresholdMS);
9244
9246 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9247 {
9248 m_PreviousRoofTestTime = time;
9249 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9250 }
9251 }
9252
9253
9255 {
9257 {
9258 return 0;
9259 }
9260
9261 if (GetInventory().GetAttachmentSlotsCount() != 0)
9262 {
9263 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9264 if (filter)
9265 return filter.GetProtectionLevel(type, false, system);
9266 else
9267 return 0;
9268 }
9269
9270 string subclassPath, entryName;
9271
9272 switch (type)
9273 {
9275 entryName = "biological";
9276 break;
9278 entryName = "chemical";
9279 break;
9280 default:
9281 entryName = "biological";
9282 break;
9283 }
9284
9285 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9286
9288 }
9289
9290
9291
9294 {
9295 if (!IsMagazine())
9297
9299 }
9300
9301
9302
9303
9304
9309 {
9310 return true;
9311 }
9312
9314 {
9316 }
9317
9318
9319
9320
9321
9323 {
9324 if (parent)
9325 {
9326 if (parent.IsInherited(DayZInfected))
9327 return true;
9328
9329 if (!parent.IsRuined())
9330 return true;
9331 }
9332
9333 return true;
9334 }
9335
9337 {
9338 if (!super.CanPutAsAttachment(parent))
9339 {
9340 return false;
9341 }
9342
9343 if (!IsRuined() && !parent.IsRuined())
9344 {
9345 return true;
9346 }
9347
9348 return false;
9349 }
9350
9352 {
9353
9354
9355
9356
9357 return super.CanReceiveItemIntoCargo(item);
9358 }
9359
9361 {
9362
9363
9364
9365
9366 GameInventory attachmentInv = attachment.GetInventory();
9368 {
9369 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9370 return false;
9371 }
9372
9373 InventoryLocation loc = new InventoryLocation();
9374 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9375 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9376 return false;
9377
9378 return super.CanReceiveAttachment(attachment, slotId);
9379 }
9380
9382 {
9383 if (!super.CanReleaseAttachment(attachment))
9384 return false;
9385
9386 return GetInventory().AreChildrenAccessible();
9387 }
9388
9389
9390
9391
9392
9393
9394
9395
9396
9397
9398
9399
9400
9401
9402
9403
9404
9405
9406
9407
9408
9410 {
9411 int id = muzzle_owner.GetMuzzleID();
9412 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9413
9414 if (WPOF_array)
9415 {
9416 for (int i = 0; i < WPOF_array.Count(); i++)
9417 {
9418 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9419
9420 if (WPOF)
9421 {
9422 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9423 }
9424 }
9425 }
9426 }
9427
9428
9430 {
9431 int id = muzzle_owner.GetMuzzleID();
9433
9434 if (WPOBE_array)
9435 {
9436 for (int i = 0; i < WPOBE_array.Count(); i++)
9437 {
9438 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9439
9440 if (WPOBE)
9441 {
9442 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9443 }
9444 }
9445 }
9446 }
9447
9448
9450 {
9451 int id = muzzle_owner.GetMuzzleID();
9452 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9453
9454 if (WPOOH_array)
9455 {
9456 for (int i = 0; i < WPOOH_array.Count(); i++)
9457 {
9458 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9459
9460 if (WPOOH)
9461 {
9462 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9463 }
9464 }
9465 }
9466 }
9467
9468
9470 {
9471 int id = muzzle_owner.GetMuzzleID();
9472 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9473
9474 if (WPOOH_array)
9475 {
9476 for (int i = 0; i < WPOOH_array.Count(); i++)
9477 {
9478 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9479
9480 if (WPOOH)
9481 {
9482 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9483 }
9484 }
9485 }
9486 }
9487
9488
9490 {
9491 int id = muzzle_owner.GetMuzzleID();
9492 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9493
9494 if (WPOOH_array)
9495 {
9496 for (int i = 0; i < WPOOH_array.Count(); i++)
9497 {
9498 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9499
9500 if (WPOOH)
9501 {
9502 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9503 }
9504 }
9505 }
9506 }
9507
9508
9509
9511 {
9513 {
9514 return true;
9515 }
9516
9517 return false;
9518 }
9519
9521 {
9523 {
9524 return true;
9525 }
9526
9527 return false;
9528 }
9529
9531 {
9533 {
9534 return true;
9535 }
9536
9537 return false;
9538 }
9539
9541 {
9542 return false;
9543 }
9544
9547 {
9548 return UATimeSpent.DEFAULT_DEPLOY;
9549 }
9550
9551
9552
9553
9555 {
9557 SetSynchDirty();
9558 }
9559
9561 {
9563 }
9564
9565
9567 {
9568 return false;
9569 }
9570
9573 {
9574 string att_type = "None";
9575
9576 if (ConfigIsExisting("soundAttType"))
9577 {
9578 att_type = ConfigGetString("soundAttType");
9579 }
9580
9582 }
9583
9585 {
9587 }
9588
9589
9590
9591
9592
9598
9600 {
9603
9605 }
9606
9607
9609 {
9611 return;
9612
9614
9617
9620
9621 SoundParameters params = new SoundParameters();
9625 }
9626
9627
9629 {
9631 return;
9632
9634 SetSynchDirty();
9635
9638 }
9639
9640
9642 {
9644 return;
9645
9647 SetSynchDirty();
9648
9651 }
9652
9654 {
9656 }
9657
9659 {
9661 }
9662
9665 {
9666 if (!
GetGame().IsDedicatedServer())
9667 {
9668 if (ConfigIsExisting("attachSoundSet"))
9669 {
9670 string cfg_path = "";
9671 string soundset = "";
9673
9676 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
9677 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
9678
9679 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
9680 {
9681 for (int i = 0; i < cfg_soundset_array.Count(); i++)
9682 {
9683 if (cfg_slot_array[i] == slot_type)
9684 {
9685 soundset = cfg_soundset_array[i];
9686 break;
9687 }
9688 }
9689 }
9690
9691 if (soundset != "")
9692 {
9693 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
9695 }
9696 }
9697 }
9698 }
9699
9701 {
9702
9703 }
9704
9705 void OnApply(PlayerBase player);
9706
9708 {
9709 return 1.0;
9710 };
9711
9713 {
9715 }
9716
9718 {
9720 }
9721
9723
9725 {
9726 SetDynamicPhysicsLifeTime(0.01);
9728 }
9729
9731 {
9732 array<string> zone_names = new array<string>;
9733 GetDamageZones(zone_names);
9734 for (int i = 0; i < zone_names.Count(); i++)
9735 {
9736 SetHealthMax(zone_names.Get(i),"Health");
9737 }
9738 SetHealthMax("","Health");
9739 }
9740
9743 {
9744 float global_health = GetHealth01("","Health");
9745 array<string> zones = new array<string>;
9746 GetDamageZones(zones);
9747
9748 for (int i = 0; i < zones.Count(); i++)
9749 {
9750 SetHealth01(zones.Get(i),"Health",global_health);
9751 }
9752 }
9753
9756 {
9757 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
9758 }
9759
9761 {
9762 if (!hasRootAsPlayer)
9763 {
9764 if (refParentIB)
9765 {
9766
9767 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
9768 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
9769
9770 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
9771 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
9772
9775 }
9776 else
9777 {
9778
9781 }
9782 }
9783 }
9784
9786 {
9788 {
9789 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
9790 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
9791 {
9792 float heatPermCoef = 1.0;
9794 while (ent)
9795 {
9796 heatPermCoef *= ent.GetHeatPermeabilityCoef();
9797 ent = ent.GetHierarchyParent();
9798 }
9799
9800 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
9801 }
9802 }
9803 }
9804
9806 {
9807
9808 EntityAI parent = GetHierarchyParent();
9809 if (!parent)
9810 {
9811 hasParent = false;
9812 hasRootAsPlayer = false;
9813 }
9814 else
9815 {
9816 hasParent = true;
9817 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
9818 refParentIB =
ItemBase.Cast(parent);
9819 }
9820 }
9821
9822 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
9823 {
9824
9825 }
9826
9828 {
9829
9830 return false;
9831 }
9832
9834 {
9835
9836
9837 return false;
9838 }
9839
9841 {
9842
9843 return false;
9844 }
9845
9848 {
9849 return !GetIsFrozen() &&
IsOpen();
9850 }
9851
9853 {
9854 bool hasParent = false, hasRootAsPlayer = false;
9856
9857 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
9858 bool foodDecay =
g_Game.IsFoodDecayEnabled();
9859
9860 if (wwtu || foodDecay)
9861 {
9865
9866 if (processWetness || processTemperature || processDecay)
9867 {
9869
9870 if (processWetness)
9871 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
9872
9873 if (processTemperature)
9875
9876 if (processDecay)
9877 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
9878 }
9879 }
9880 }
9881
9884 {
9886 }
9887
9889 {
9892
9893 return super.GetTemperatureFreezeThreshold();
9894 }
9895
9897 {
9900
9901 return super.GetTemperatureThawThreshold();
9902 }
9903
9905 {
9908
9909 return super.GetItemOverheatThreshold();
9910 }
9911
9913 {
9915 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
9916
9917 return super.GetTemperatureFreezeTime();
9918 }
9919
9921 {
9923 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
9924
9925 return super.GetTemperatureThawTime();
9926 }
9927
9932
9934 {
9935 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
9936 }
9937
9939 {
9940 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
9941 }
9942
9945 {
9947 }
9948
9950 {
9952 }
9953
9955 {
9957 }
9958
9961 {
9962 return null;
9963 }
9964
9967 {
9968 return false;
9969 }
9970
9972 {
9974 {
9977 if (!trg)
9978 {
9980 explosive = this;
9981 }
9982
9983 explosive.PairRemote(trg);
9985
9986 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
9987 trg.SetPersistentPairID(persistentID);
9988 explosive.SetPersistentPairID(persistentID);
9989
9990 return true;
9991 }
9992 return false;
9993 }
9994
9997 {
9998 float ret = 1.0;
10001 ret *= GetHealth01();
10002
10003 return ret;
10004 }
10005
10006 #ifdef DEVELOPER
10007 override void SetDebugItem()
10008 {
10009 super.SetDebugItem();
10010 _itemBase = this;
10011 }
10012
10014 {
10015 string text = super.GetDebugText();
10016
10018 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10019
10020 return text;
10021 }
10022 #endif
10023
10025 {
10026 return true;
10027 }
10028
10030
10032
10034 {
10037 }
10038
10039
10047
10063}
10064
10066{
10068 if (entity)
10069 {
10070 bool is_item = entity.IsInherited(
ItemBase);
10071 if (is_item && full_quantity)
10072 {
10075 }
10076 }
10077 else
10078 {
10080 return NULL;
10081 }
10082 return entity;
10083}
10084
10086{
10087 if (item)
10088 {
10089 if (health > 0)
10090 item.SetHealth("", "", health);
10091
10092 if (item.CanHaveTemperature())
10093 {
10095 if (item.CanFreeze())
10096 item.SetFrozen(false);
10097 }
10098
10099 if (item.HasEnergyManager())
10100 {
10101 if (quantity >= 0)
10102 {
10103 item.GetCompEM().SetEnergy0To1(quantity);
10104 }
10105 else
10106 {
10108 }
10109 }
10110 else if (item.IsMagazine())
10111 {
10112 Magazine mag = Magazine.Cast(item);
10113 if (quantity >= 0)
10114 {
10115 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10116 }
10117 else
10118 {
10120 }
10121
10122 }
10123 else
10124 {
10125 if (quantity >= 0)
10126 {
10127 item.SetQuantityNormalized(quantity, false);
10128 }
10129 else
10130 {
10132 }
10133
10134 }
10135 }
10136}
10137
10138#ifdef DEVELOPER
10140#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.