5238{
5240 {
5241 return true;
5242 }
5243};
5244
5245
5246
5248{
5252
5254
5257
5258
5259
5260
5261
5270
5276
5281
5286
5307 protected bool m_IsResultOfSplit
5308
5310
5315
5316
5317
5319
5323
5324
5325
5327
5330
5331
5332
5338
5339
5347
5350
5351
5353
5354
5356
5357
5362
5363
5368
5369
5371
5372
5374 {
5379
5380 if (!
GetGame().IsDedicatedServer())
5381 {
5383 {
5385
5387 {
5389 }
5390 }
5391
5394 }
5395
5396 m_OldLocation = null;
5397
5399 {
5401 }
5402
5403 if (ConfigIsExisting("headSelectionsToHide"))
5404 {
5407 }
5408
5410 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5411 {
5413 }
5414
5416
5417 m_IsResultOfSplit = false;
5418
5420 }
5421
5423 {
5424 super.InitItemVariables();
5425
5431 m_Count = ConfigGetInt(
"count");
5432
5435
5440
5443
5448
5460
5464
5465
5468 if (ConfigIsExisting("canBeSplit"))
5469 {
5472 }
5473
5475 if (ConfigIsExisting("itemBehaviour"))
5477
5478
5481 RegisterNetSyncVariableInt("m_VarLiquidType");
5482 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5483
5484 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5485 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5486 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5487
5488 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5489 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5490 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5491 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5492
5493 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5494 RegisterNetSyncVariableBool("m_IsTakeable");
5495 RegisterNetSyncVariableBool("m_IsHologram");
5496
5499 {
5502 }
5503
5505
5507 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5509
5510 }
5511
5513 {
5515 }
5516
5518 {
5521 {
5526 }
5527 }
5528
5529 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5530 {
5532 {
5535 }
5536
5538 }
5539
5541 {
5547 }
5548
5550
5552 {
5554
5555 if (!action)
5556 {
5557 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5558 return;
5559 }
5560
5562 if (!ai)
5563 {
5565 return;
5566 }
5567
5569 if (!action_array)
5570 {
5571 action_array = new array<ActionBase_Basic>;
5573 }
5574 if (LogManager.IsActionLogEnable())
5575 {
5576 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5577 }
5578
5579 if (action_array.Find(action) != -1)
5580 {
5581 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5582 }
5583 else
5584 {
5585 action_array.Insert(action);
5586 }
5587 }
5588
5590 {
5592 ActionBase action = player.GetActionManager().GetAction(actionName);
5595
5596 if (action_array)
5597 {
5598 action_array.RemoveItem(action);
5599 }
5600 }
5601
5602
5603
5605 {
5606 ActionOverrideData overrideData = new ActionOverrideData();
5610
5612 if (!actionMap)
5613 {
5616 }
5617
5618 actionMap.Insert(this.
Type(), overrideData);
5619
5620 }
5621
5623
5625
5626
5628 {
5631
5634
5635 string config_to_search = "CfgVehicles";
5636 string muzzle_owner_config;
5637
5639 {
5640 if (IsInherited(Weapon))
5641 config_to_search = "CfgWeapons";
5642
5643 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5644
5645 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5646
5648
5649 if (config_OnFire_subclass_count > 0)
5650 {
5651 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5652
5653 for (int i = 0; i < config_OnFire_subclass_count; i++)
5654 {
5655 string particle_class = "";
5657 string config_OnFire_entry = config_OnFire_class + particle_class;
5658 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5659 WPOF_array.Insert(WPOF);
5660 }
5661
5662
5664 }
5665 }
5666
5668 {
5669 config_to_search = "CfgWeapons";
5670 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5671
5672 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5673
5675
5676 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
5677 {
5678 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
5679
5680 for (i = 0; i < config_OnBulletCasingEject_count; i++)
5681 {
5682 string particle_class2 = "";
5684 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
5685 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
5686 WPOBE_array.Insert(WPOBE);
5687 }
5688
5689
5691 }
5692 }
5693 }
5694
5695
5697 {
5700
5702 {
5703 string config_to_search = "CfgVehicles";
5704
5705 if (IsInherited(Weapon))
5706 config_to_search = "CfgWeapons";
5707
5708 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5709 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
5710
5711 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
5712 {
5713
5715
5717 {
5719 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
5721 return;
5722 }
5723
5726
5727
5728
5730 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
5731
5732 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
5733 {
5734 string particle_class = "";
5736 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
5738
5739 if (entry_type == CT_CLASS)
5740 {
5741 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
5742 WPOOH_array.Insert(WPOF);
5743 }
5744 }
5745
5746
5748 }
5749 }
5750 }
5751
5753 {
5755 }
5756
5758 {
5760 {
5762
5765
5768
5769 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5770 }
5771 }
5772
5774 {
5776 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5777
5779 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5780
5782 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5783
5785 {
5787 }
5788 }
5789
5791 {
5793 }
5794
5796 {
5799 else
5801
5803 {
5806 }
5807 else
5808 {
5811
5814 }
5815
5817 }
5818
5820 {
5822 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5823 }
5824
5826 {
5828 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5830 }
5831
5833 {
5835 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5836 }
5837
5839 {
5842
5843 OverheatingParticle OP = new OverheatingParticle();
5848
5850 }
5851
5853 {
5856
5857 return -1;
5858 }
5859
5861 {
5863 {
5866
5867 for (int i = count; i > 0; --i)
5868 {
5869 int id = i - 1;
5872
5875
5876 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
5877 {
5878 if (p)
5879 {
5882 }
5883 }
5884 }
5885 }
5886 }
5887
5889 {
5891 {
5893 {
5894 int id = i - 1;
5896
5897 if (OP)
5898 {
5900
5901 if (p)
5902 {
5904 }
5905
5906 delete OP;
5907 }
5908 }
5909
5912 }
5913 }
5914
5917 {
5918 return 0.0;
5919 }
5920
5921
5923 {
5924 return 250;
5925 }
5926
5928 {
5929 return 0;
5930 }
5931
5934 {
5936 return true;
5937
5938 return false;
5939 }
5940
5943 {
5946
5948 {
5950 }
5951 else
5952 {
5953
5955 }
5956
5958 }
5959
5966 {
5967 return -1;
5968 }
5969
5970
5971
5972
5974 {
5976 {
5978 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
5979
5980 if (r_index >= 0)
5981 {
5982 InventoryLocation r_il = new InventoryLocation;
5983 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
5984
5985 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
5988 {
5989 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
5990 }
5992 {
5993 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
5994 }
5995
5996 }
5997
5998 player.GetHumanInventory().ClearUserReservedLocation(this);
5999 }
6000
6003 }
6004
6005
6006
6007
6009 {
6010 return ItemBase.m_DebugActionsMask;
6011 }
6012
6014 {
6015 return ItemBase.m_DebugActionsMask & mask;
6016 }
6017
6019 {
6020 ItemBase.m_DebugActionsMask = mask;
6021 }
6022
6024 {
6025 ItemBase.m_DebugActionsMask |= mask;
6026 }
6027
6029 {
6030 ItemBase.m_DebugActionsMask &= ~mask;
6031 }
6032
6034 {
6036 {
6038 }
6039 else
6040 {
6042 }
6043 }
6044
6045
6047 {
6048 if (GetEconomyProfile())
6049 {
6050 float q_max = GetEconomyProfile().GetQuantityMax();
6051 if (q_max > 0)
6052 {
6053 float q_min = GetEconomyProfile().GetQuantityMin();
6054 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6055
6057 {
6058 ComponentEnergyManager comp = GetCompEM();
6060 {
6062 }
6063 }
6065 {
6067
6068 }
6069
6070 }
6071 }
6072 }
6073
6076 {
6077 EntityAI parent = GetHierarchyParent();
6078
6079 if (parent)
6080 {
6081 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6082 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6083 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6084 }
6085 }
6086
6089 {
6090 EntityAI parent = GetHierarchyParent();
6091
6092 if (parent)
6093 {
6094 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6095 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6096 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6097 }
6098 }
6099
6101 {
6102
6103
6104
6105
6107
6109 {
6110 if (ScriptInputUserData.CanStoreInputUserData())
6111 {
6112 ScriptInputUserData ctx = new ScriptInputUserData;
6118 ctx.
Write(use_stack_max);
6121
6123 {
6124 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6125 }
6126 }
6127 }
6128 else if (!
GetGame().IsMultiplayer())
6129 {
6131 }
6132 }
6133
6135 {
6137 }
6138
6140 {
6142 }
6143
6145 {
6147 }
6148
6150 {
6151
6152 return false;
6153 }
6154
6156 {
6157 return false;
6158 }
6159
6163 {
6164 return false;
6165 }
6166
6168 {
6169 return "";
6170 }
6171
6173
6175 {
6176 return false;
6177 }
6178
6180 {
6181 return true;
6182 }
6183
6184
6185
6187 {
6188 return true;
6189 }
6190
6192 {
6193 return true;
6194 }
6195
6197 {
6198 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6200 }
6201
6203 {
6205 }
6206
6208 {
6210 if (!is_being_placed)
6212 SetSynchDirty();
6213 }
6214
6215
6217
6219 {
6221 }
6222
6224 {
6226 }
6227
6229 {
6230 return 1;
6231 }
6232
6234 {
6235 return false;
6236 }
6237
6239 {
6241 SetSynchDirty();
6242 }
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6279 {
6280 super.OnMovedInsideCargo(container);
6281
6282 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6283 }
6284
6285 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6286 {
6287 super.EEItemLocationChanged(oldLoc,newLoc);
6288
6289 PlayerBase new_player = null;
6290 PlayerBase old_player = null;
6291
6292 if (newLoc.GetParent())
6293 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6294
6295 if (oldLoc.GetParent())
6296 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6297
6299 {
6300 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6301
6302 if (r_index >= 0)
6303 {
6304 InventoryLocation r_il = new InventoryLocation;
6305 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6306
6307 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6310 {
6311 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6312 }
6314 {
6315 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6316 }
6317
6318 }
6319 }
6320
6322 {
6323 if (new_player)
6324 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6325
6326 if (new_player == old_player)
6327 {
6328
6329 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6330 {
6332 {
6333 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6334 {
6335 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6336 }
6337 }
6338 else
6339 {
6340 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6341 }
6342 }
6343
6344 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6345 {
6346 int type = oldLoc.GetType();
6348 {
6349 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6350 }
6352 {
6353 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6354 }
6355 }
6356 if (!m_OldLocation)
6357 {
6358 m_OldLocation = new InventoryLocation;
6359 }
6360 m_OldLocation.Copy(oldLoc);
6361 }
6362 else
6363 {
6364 if (m_OldLocation)
6365 {
6366 m_OldLocation.Reset();
6367 }
6368 }
6369
6371 }
6372 else
6373 {
6374 if (new_player)
6375 {
6376 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6377 if (res_index >= 0)
6378 {
6379 InventoryLocation il = new InventoryLocation;
6380 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6382 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6385 {
6386 il.
GetParent().GetOnReleaseLock().Invoke(it);
6387 }
6389 {
6391 }
6392
6393 }
6394 }
6396 {
6397
6399 }
6400
6401 if (m_OldLocation)
6402 {
6403 m_OldLocation.Reset();
6404 }
6405 }
6406 }
6407
6408 override void EOnContact(IEntity other, Contact extra)
6409 {
6411 {
6412 int liquidType = -1;
6414 if (impactSpeed > 0.0)
6415 {
6417 #ifndef SERVER
6419 #else
6421 SetSynchDirty();
6422 #endif
6424 }
6425 }
6426
6427 #ifdef SERVER
6428 if (GetCompEM() && GetCompEM().IsPlugged())
6429 {
6430 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6431 GetCompEM().UnplugThis();
6432 }
6433 #endif
6434 }
6435
6437
6439 {
6441 }
6442
6444 {
6445
6446 }
6447
6449 {
6450 super.OnItemLocationChanged(old_owner, new_owner);
6451
6452 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6453 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6454
6455 if (!relatedPlayer && playerNew)
6456 relatedPlayer = playerNew;
6457
6458 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6459 {
6461 if (actionMgr)
6462 {
6463 ActionBase currentAction = actionMgr.GetRunningAction();
6464 if (currentAction)
6466 }
6467 }
6468
6469 Man ownerPlayerOld = null;
6470 Man ownerPlayerNew = null;
6471
6472 if (old_owner)
6473 {
6474 if (old_owner.
IsMan())
6475 {
6476 ownerPlayerOld = Man.Cast(old_owner);
6477 }
6478 else
6479 {
6480 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6481 }
6482 }
6483 else
6484 {
6486 {
6488
6489 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6490 {
6491 GetCompEM().UnplugThis();
6492 }
6493 }
6494 }
6495
6496 if (new_owner)
6497 {
6498 if (new_owner.
IsMan())
6499 {
6500 ownerPlayerNew = Man.Cast(new_owner);
6501 }
6502 else
6503 {
6504 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6505 }
6506 }
6507
6508 if (ownerPlayerOld != ownerPlayerNew)
6509 {
6510 if (ownerPlayerOld)
6511 {
6512 array<EntityAI> subItemsExit = new array<EntityAI>;
6514 for (int i = 0; i < subItemsExit.Count(); i++)
6515 {
6518 }
6519 }
6520
6521 if (ownerPlayerNew)
6522 {
6523 array<EntityAI> subItemsEnter = new array<EntityAI>;
6525 for (int j = 0; j < subItemsEnter.Count(); j++)
6526 {
6529 }
6530 }
6531 }
6532 else if (ownerPlayerNew != null)
6533 {
6534 PlayerBase nplayer;
6535 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6536 {
6537 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6539 for (int k = 0; k < subItemsUpdate.Count(); k++)
6540 {
6542 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6543 }
6544 }
6545 }
6546
6547 if (old_owner)
6548 old_owner.OnChildItemRemoved(this);
6549 if (new_owner)
6550 new_owner.OnChildItemReceived(this);
6551 }
6552
6553
6555 {
6556 super.EEDelete(parent);
6557 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6558 if (player)
6559 {
6561
6562 if (player.IsAlive())
6563 {
6564 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6565 if (r_index >= 0)
6566 {
6567 InventoryLocation r_il = new InventoryLocation;
6568 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6569
6570 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6573 {
6574 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6575 }
6577 {
6578 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6579 }
6580
6581 }
6582
6583 player.RemoveQuickBarEntityShortcut(this);
6584 }
6585 }
6586 }
6587
6589 {
6590 super.EEKilled(killer);
6591
6594 {
6595 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6596 {
6597 if (IsMagazine())
6598 {
6599 if (Magazine.Cast(this).GetAmmoCount() > 0)
6600 {
6602 }
6603 }
6604 else
6605 {
6607 }
6608 }
6609 }
6610 }
6611
6613 {
6614 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6615
6616 super.OnWasAttached(parent, slot_id);
6617
6620
6622 }
6623
6625 {
6626 super.OnWasDetached(parent, slot_id);
6627
6630 }
6631
6633 {
6634 int idx;
6637
6638 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6639 if (inventory_slots.Count() < 1)
6640 {
6641 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6642 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6643 }
6644 else
6645 {
6646 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6647 }
6648
6649 idx = inventory_slots.Find(slot);
6650 if (idx < 0)
6651 return "";
6652
6653 return attach_types.Get(idx);
6654 }
6655
6657 {
6658 int idx = -1;
6659 string slot;
6660
6663
6664 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6665 if (inventory_slots.Count() < 1)
6666 {
6667 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6668 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6669 }
6670 else
6671 {
6672 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6673 if (detach_types.Count() < 1)
6674 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6675 }
6676
6677 for (int i = 0; i < inventory_slots.Count(); i++)
6678 {
6679 slot = inventory_slots.Get(i);
6680 }
6681
6682 if (slot != "")
6683 {
6684 if (detach_types.Count() == 1)
6685 idx = 0;
6686 else
6687 idx = inventory_slots.Find(slot);
6688 }
6689 if (idx < 0)
6690 return "";
6691
6692 return detach_types.Get(idx);
6693 }
6694
6696 {
6697
6699
6700
6701 float min_time = 1;
6702 float max_time = 3;
6703 float delay = Math.RandomFloat(min_time, max_time);
6704
6705 explode_timer.Run(delay, this, "DoAmmoExplosion");
6706 }
6707
6709 {
6710 Magazine magazine = Magazine.Cast(this);
6711 int pop_sounds_count = 6;
6712 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
6713
6714
6715 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
6716 string sound_name = pop_sounds[ sound_idx ];
6718
6719
6720 magazine.ServerAddAmmoCount(-1);
6721
6722
6723 float min_temp_to_explode = 100;
6724
6725 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
6726 {
6728 }
6729 }
6730
6731
6732 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
6733 {
6734 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
6735
6736 const int CHANCE_DAMAGE_CARGO = 4;
6737 const int CHANCE_DAMAGE_ATTACHMENT = 1;
6738 const int CHANCE_DAMAGE_NOTHING = 2;
6739
6741 {
6742 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
6743 int chances;
6744 int rnd;
6745
6746 if (GetInventory().GetCargo())
6747 {
6748 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6749 rnd = Math.RandomInt(0,chances);
6750
6751 if (rnd < CHANCE_DAMAGE_CARGO)
6752 {
6754 }
6755 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
6756 {
6758 }
6759 }
6760 else
6761 {
6762 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6763 rnd = Math.RandomInt(0,chances);
6764
6765 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
6766 {
6768 }
6769 }
6770 }
6771 }
6772
6774 {
6775 if (GetInventory().GetCargo())
6776 {
6777 int item_count = GetInventory().GetCargo().GetItemCount();
6778 if (item_count > 0)
6779 {
6780 int random_pick = Math.RandomInt(0, item_count);
6782 if (!item.IsExplosive())
6783 {
6784 item.AddHealth("","",damage);
6785 return true;
6786 }
6787 }
6788 }
6789 return false;
6790 }
6791
6793 {
6794 int attachment_count = GetInventory().AttachmentCount();
6795 if (attachment_count > 0)
6796 {
6797 int random_pick = Math.RandomInt(0, attachment_count);
6798 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
6799 if (!attachment.IsExplosive())
6800 {
6801 attachment.AddHealth("","",damage);
6802 return true;
6803 }
6804 }
6805 return false;
6806 }
6807
6809 {
6811 }
6812
6814 {
6816 return GetInventory().CanRemoveEntity();
6817
6818 return false;
6819 }
6820
6822 {
6823
6825 return false;
6826
6827
6829 return false;
6830
6831
6832
6834 if (delta == 0)
6835 return false;
6836
6837
6838 return true;
6839 }
6840
6842 {
6844 {
6845 if (ScriptInputUserData.CanStoreInputUserData())
6846 {
6847 ScriptInputUserData ctx = new ScriptInputUserData;
6852 ctx.
Write(destination_entity);
6856 }
6857 }
6858 else if (!
GetGame().IsMultiplayer())
6859 {
6861 }
6862 }
6863
6865 {
6866 float split_quantity_new;
6870 InventoryLocation loc = new InventoryLocation;
6871
6872 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6873 {
6875 split_quantity_new = stack_max;
6876 else
6878
6880 {
6881 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6882 if (new_item)
6883 {
6884 new_item.SetResultOfSplit(true);
6885 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6887 new_item.
SetQuantity(split_quantity_new,
false,
true);
6888 }
6889 }
6890 }
6891 else if (destination_entity && slot_id == -1)
6892 {
6893 if (quantity > stack_max)
6894 split_quantity_new = stack_max;
6895 else
6896 split_quantity_new = quantity;
6897
6899 {
6901 {
6904 }
6905
6906 if (new_item)
6907 {
6908 new_item.SetResultOfSplit(true);
6909 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6911 new_item.
SetQuantity(split_quantity_new,
false,
true);
6912 }
6913 }
6914 }
6915 else
6916 {
6917 if (stack_max != 0)
6918 {
6920 {
6922 }
6923
6924 if (split_quantity_new == 0)
6925 {
6926 if (!
GetGame().IsMultiplayer())
6927 player.PhysicalPredictiveDropItem(this);
6928 else
6929 player.ServerDropEntity(this);
6930 return;
6931 }
6932
6934 {
6936
6937 if (new_item)
6938 {
6939 new_item.SetResultOfSplit(true);
6940 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6943 new_item.PlaceOnSurface();
6944 }
6945 }
6946 }
6947 }
6948 }
6949
6951 {
6952 float split_quantity_new;
6956 InventoryLocation loc = new InventoryLocation;
6957
6958 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6959 {
6961 split_quantity_new = stack_max;
6962 else
6964
6966 {
6967 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6968 if (new_item)
6969 {
6970 new_item.SetResultOfSplit(true);
6971 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6973 new_item.
SetQuantity(split_quantity_new,
false,
true);
6974 }
6975 }
6976 }
6977 else if (destination_entity && slot_id == -1)
6978 {
6979 if (quantity > stack_max)
6980 split_quantity_new = stack_max;
6981 else
6982 split_quantity_new = quantity;
6983
6985 {
6987 {
6990 }
6991
6992 if (new_item)
6993 {
6994 new_item.SetResultOfSplit(true);
6995 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6997 new_item.
SetQuantity(split_quantity_new,
false,
true);
6998 }
6999 }
7000 }
7001 else
7002 {
7003 if (stack_max != 0)
7004 {
7006 {
7008 }
7009
7011 {
7013
7014 if (new_item)
7015 {
7016 new_item.SetResultOfSplit(true);
7017 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7020 new_item.PlaceOnSurface();
7021 }
7022 }
7023 }
7024 }
7025 }
7026
7028 {
7030 {
7031 if (ScriptInputUserData.CanStoreInputUserData())
7032 {
7033 ScriptInputUserData ctx = new ScriptInputUserData;
7038 dst.WriteToContext(ctx);
7040 }
7041 }
7042 else if (!
GetGame().IsMultiplayer())
7043 {
7045 }
7046 }
7047
7049 {
7051 {
7052 if (ScriptInputUserData.CanStoreInputUserData())
7053 {
7054 ScriptInputUserData ctx = new ScriptInputUserData;
7059 ctx.
Write(destination_entity);
7065 }
7066 }
7067 else if (!
GetGame().IsMultiplayer())
7068 {
7070 }
7071 }
7072
7074 {
7076 }
7077
7079 {
7081 float split_quantity_new;
7083 if (dst.IsValid())
7084 {
7085 int slot_id = dst.GetSlot();
7087
7088 if (quantity > stack_max)
7089 split_quantity_new = stack_max;
7090 else
7091 split_quantity_new = quantity;
7092
7094 {
7096
7097 if (new_item)
7098 {
7099 new_item.SetResultOfSplit(true);
7100 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7102 new_item.
SetQuantity(split_quantity_new,
false,
true);
7103 }
7104
7105 return new_item;
7106 }
7107 }
7108
7109 return null;
7110 }
7111
7113 {
7115 float split_quantity_new;
7117 if (destination_entity)
7118 {
7120 if (quantity > stackable)
7121 split_quantity_new = stackable;
7122 else
7123 split_quantity_new = quantity;
7124
7126 {
7127 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7128 if (new_item)
7129 {
7130 new_item.SetResultOfSplit(true);
7131 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7133 new_item.
SetQuantity(split_quantity_new,
false,
true);
7134 }
7135 }
7136 }
7137 }
7138
7140 {
7142 {
7143 if (ScriptInputUserData.CanStoreInputUserData())
7144 {
7145 ScriptInputUserData ctx = new ScriptInputUserData;
7150 ItemBase destination_entity =
this;
7151 ctx.
Write(destination_entity);
7155 }
7156 }
7157 else if (!
GetGame().IsMultiplayer())
7158 {
7160 }
7161 }
7162
7164 {
7166 float split_quantity_new;
7168 if (player)
7169 {
7171 if (quantity > stackable)
7172 split_quantity_new = stackable;
7173 else
7174 split_quantity_new = quantity;
7175
7177 {
7178 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7179 new_item =
ItemBase.Cast(in_hands);
7180 if (new_item)
7181 {
7182 new_item.SetResultOfSplit(true);
7183 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7185 new_item.SetQuantity(split_quantity_new, false, true);
7186 }
7187 }
7188 }
7189 }
7190
7192 {
7194 float split_quantity_new = Math.Floor(quantity * 0.5);
7195
7197 return;
7198
7200
7201 if (new_item)
7202 {
7203 if (new_item.GetQuantityMax() < split_quantity_new)
7204 {
7205 split_quantity_new = new_item.GetQuantityMax();
7206 }
7207
7208 new_item.SetResultOfSplit(true);
7209 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7210
7212 {
7215 }
7216 else
7217 {
7219 new_item.
SetQuantity(split_quantity_new,
false,
true);
7220 }
7221 }
7222 }
7223
7225 {
7227 float split_quantity_new = Math.Floor(quantity / 2);
7228
7230 return;
7231
7232 InventoryLocation invloc = new InventoryLocation;
7234
7236 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7237
7238 if (new_item)
7239 {
7240 if (new_item.GetQuantityMax() < split_quantity_new)
7241 {
7242 split_quantity_new = new_item.GetQuantityMax();
7243 }
7245 {
7248 }
7249 else if (split_quantity_new > 1)
7250 {
7252 new_item.
SetQuantity(split_quantity_new,
false,
true);
7253 }
7254 }
7255 }
7256
7259 {
7260 SetWeightDirty();
7262
7263 if (parent)
7264 parent.OnAttachmentQuantityChangedEx(this, delta);
7265
7267 {
7269 {
7271 }
7273 {
7274 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7276 }
7277 }
7278
7279 }
7280
7283 {
7284
7285 }
7286
7289 {
7291 }
7292
7294 {
7295 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7296
7298 {
7299 if (newLevel == GameConstants.STATE_RUINED)
7300 {
7302 EntityAI parent = GetHierarchyParent();
7303 if (parent && parent.IsFireplace())
7304 {
7305 CargoBase cargo = GetInventory().GetCargo();
7306 if (cargo)
7307 {
7309 {
7311 }
7312 }
7313 }
7314 }
7315
7317 {
7318
7320 return;
7321 }
7322
7323 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7324 {
7326 }
7327 }
7328 }
7329
7330
7332 {
7333 super.OnRightClick();
7334
7336 {
7338 {
7339 if (ScriptInputUserData.CanStoreInputUserData())
7340 {
7341 EntityAI root = GetHierarchyRoot();
7342 Man playerOwner = GetHierarchyRootPlayer();
7343 InventoryLocation dst = new InventoryLocation;
7344
7345
7346 if (!playerOwner && root && root == this)
7347 {
7349 }
7350 else
7351 {
7352
7353 GetInventory().GetCurrentInventoryLocation(dst);
7355 {
7358 {
7360 }
7361 else
7362 {
7364
7365
7366 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7367 {
7369 }
7370 else
7371 {
7372 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7373 }
7374 }
7375 }
7376 }
7377
7378 ScriptInputUserData ctx = new ScriptInputUserData;
7386 }
7387 }
7388 else if (!
GetGame().IsMultiplayer())
7389 {
7391 }
7392 }
7393 }
7394
7396 {
7397 if (root)
7398 {
7399 vector m4[4];
7400 root.GetTransform(m4);
7401 dst.SetGround(this, m4);
7402 }
7403 else
7404 {
7405 GetInventory().GetCurrentInventoryLocation(dst);
7406 }
7407 }
7408
7409 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7410 {
7411
7412 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7413 return false;
7414
7415 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7416 return false;
7417
7418
7420 return false;
7421
7422
7423 Magazine mag = Magazine.Cast(this);
7424 if (mag)
7425 {
7426 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7427 return false;
7428
7429 if (stack_max_limit)
7430 {
7431 Magazine other_mag = Magazine.Cast(other_item);
7432 if (other_item)
7433 {
7434 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7435 return false;
7436 }
7437
7438 }
7439 }
7440 else
7441 {
7442
7444 return false;
7445
7447 return false;
7448 }
7449
7450 PlayerBase player = null;
7451 if (CastTo(player, GetHierarchyRootPlayer()))
7452 {
7453 if (player.GetInventory().HasAttachment(this))
7454 return false;
7455
7456 if (player.IsItemsToDelete())
7457 return false;
7458 }
7459
7460 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7461 return false;
7462
7463 int slotID;
7465 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7466 return false;
7467
7468 return true;
7469 }
7470
7472 {
7474 }
7475
7477 {
7478 return m_IsResultOfSplit;
7479 }
7480
7482 {
7483 m_IsResultOfSplit = value;
7484 }
7485
7487 {
7489 }
7490
7492 {
7493 float other_item_quantity = other_item.GetQuantity();
7494 float this_free_space;
7495
7497
7499
7500 if (other_item_quantity > this_free_space)
7501 {
7502 return this_free_space;
7503 }
7504 else
7505 {
7506 return other_item_quantity;
7507 }
7508 }
7509
7511 {
7513 }
7514
7516 {
7518 return;
7519
7520 if (!IsMagazine() && other_item)
7521 {
7523 if (quantity_used != 0)
7524 {
7525 float hp1 = GetHealth01("","");
7526 float hp2 = other_item.GetHealth01("","");
7527 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7528 hpResult = hpResult / (
GetQuantity() + quantity_used);
7529
7530 hpResult *= GetMaxHealth();
7531 Math.Round(hpResult);
7532 SetHealth("", "Health", hpResult);
7533
7535 other_item.AddQuantity(-quantity_used);
7536 }
7537 }
7539 }
7540
7542 {
7543 #ifdef SERVER
7544 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7545 GetHierarchyParent().IncreaseLifetimeUp();
7546 #endif
7547 };
7548
7550 {
7551 PlayerBase p = PlayerBase.Cast(player);
7552
7553 array<int> recipesIds = p.m_Recipes;
7554 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7555 if (moduleRecipesManager)
7556 {
7557 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
7558 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7559 }
7560
7561 for (int i = 0;i < recipesIds.Count(); i++)
7562 {
7563 int key = recipesIds.Get(i);
7564 string recipeName = moduleRecipesManager.GetRecipeName(key);
7566 }
7567 }
7568
7569
7570 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7571 {
7572 super.GetDebugActions(outputList);
7573
7574
7580
7581
7586
7591
7592
7596
7597
7599 {
7603 }
7604
7607
7608
7612
7614
7615 InventoryLocation loc = new InventoryLocation();
7616 GetInventory().GetCurrentInventoryLocation(loc);
7618 {
7619 if (Gizmo_IsSupported())
7622 }
7623
7625 }
7626
7627
7628
7629
7631 {
7632 super.OnAction(action_id, player, ctx);
7633
7635 {
7636 switch (action_id)
7637 {
7640 return true;
7643 return true;
7644 }
7645 }
7646
7648 {
7649 switch (action_id)
7650 {
7652 Delete();
7653 return true;
7654 }
7655 }
7656
7657 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
7658 {
7659 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7660 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
7661 PlayerBase p = PlayerBase.Cast(player);
7662 if (
EActions.RECIPES_RANGE_START < 1000)
7663 {
7664 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7665 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7666 }
7667 }
7668 #ifndef SERVER
7669 else if (action_id ==
EActions.WATCH_PLAYER)
7670 {
7671 PluginDeveloper.SetDeveloperItemClientEx(player);
7672 }
7673 #endif
7675 {
7676 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7677 {
7678 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7679 OnDebugButtonPressServer(id + 1);
7680 }
7681
7682 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7683 {
7684 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
7686 }
7687
7688 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
7689 {
7690 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
7692 }
7693
7694 else if (action_id ==
EActions.ADD_QUANTITY)
7695 {
7696 if (IsMagazine())
7697 {
7698 Magazine mag = Magazine.Cast(this);
7699 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
7700 }
7701 else
7702 {
7704 }
7705
7706 if (m_EM)
7707 {
7708 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
7709 }
7710
7711 }
7712
7713 else if (action_id ==
EActions.REMOVE_QUANTITY)
7714 {
7715 if (IsMagazine())
7716 {
7717 Magazine mag2 = Magazine.Cast(this);
7718 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
7719 }
7720 else
7721 {
7723 }
7724 if (m_EM)
7725 {
7726 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
7727 }
7728
7729 }
7730
7731 else if (action_id ==
EActions.SET_QUANTITY_0)
7732 {
7734
7735 if (m_EM)
7736 {
7737 m_EM.SetEnergy(0);
7738 }
7739 }
7740
7741 else if (action_id ==
EActions.SET_MAX_QUANTITY)
7742 {
7744
7745 if (m_EM)
7746 {
7747 m_EM.SetEnergy(m_EM.GetEnergyMax());
7748 }
7749 }
7750
7751 else if (action_id ==
EActions.ADD_HEALTH)
7752 {
7753 AddHealth("","",GetMaxHealth("","Health")/5);
7754 }
7755 else if (action_id ==
EActions.REMOVE_HEALTH)
7756 {
7757 AddHealth("","",-GetMaxHealth("","Health")/5);
7758 }
7759 else if (action_id ==
EActions.DESTROY_HEALTH)
7760 {
7761 SetHealth01("","",0);
7762 }
7763 else if (action_id ==
EActions.WATCH_ITEM)
7764 {
7766 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
7767 #ifdef DEVELOPER
7768 SetDebugDeveloper_item(this);
7769 #endif
7770 }
7771
7772 else if (action_id ==
EActions.ADD_TEMPERATURE)
7773 {
7774 AddTemperature(20);
7775
7776 }
7777
7778 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
7779 {
7780 AddTemperature(-20);
7781
7782 }
7783
7784 else if (action_id ==
EActions.FLIP_FROZEN)
7785 {
7786 SetFrozen(!GetIsFrozen());
7787
7788 }
7789
7790 else if (action_id ==
EActions.ADD_WETNESS)
7791 {
7793
7794 }
7795
7796 else if (action_id ==
EActions.REMOVE_WETNESS)
7797 {
7799
7800 }
7801
7802 else if (action_id ==
EActions.LIQUIDTYPE_UP)
7803 {
7806
7807
7808 }
7809
7810 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
7811 {
7814 }
7815
7816 else if (action_id ==
EActions.MAKE_SPECIAL)
7817 {
7818 auto debugParams = DebugSpawnParams.WithPlayer(player);
7819 OnDebugSpawnEx(debugParams);
7820 }
7821
7822 }
7823
7824
7825 return false;
7826 }
7827
7828
7829
7830
7834
7837
7838
7839
7841 {
7842 return false;
7843 }
7844
7845
7847 {
7848 return true;
7849 }
7850
7851
7853 {
7854 return true;
7855 }
7856
7857
7858
7860 {
7861 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
7863 }
7864
7867 {
7868 return null;
7869 }
7870
7872 {
7873 return false;
7874 }
7875
7877 {
7878 return false;
7879 }
7880
7884
7885
7887 {
7888 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7889 return module_repairing.CanRepair(this, item_repair_kit);
7890 }
7891
7892
7893 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
7894 {
7895 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7896 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
7897 }
7898
7899
7901 {
7902
7903
7904
7905
7906
7907
7908
7909
7910 return 1;
7911 }
7912
7913
7914
7916 {
7918 }
7919
7920
7921
7923 {
7925 }
7926
7927
7936 {
7937 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7938
7939 if (player)
7940 {
7941 player.MessageStatus(text);
7942 }
7943 }
7944
7945
7954 {
7955 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7956
7957 if (player)
7958 {
7959 player.MessageAction(text);
7960 }
7961 }
7962
7963
7972 {
7973 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7974
7975 if (player)
7976 {
7977 player.MessageFriendly(text);
7978 }
7979 }
7980
7981
7990 {
7991 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7992
7993 if (player)
7994 {
7995 player.MessageImportant(text);
7996 }
7997 }
7998
8000 {
8001 return true;
8002 }
8003
8004
8005 override bool KindOf(
string tag)
8006 {
8007 bool found = false;
8008 string item_name = this.
GetType();
8011
8012 int array_size = item_tag_array.Count();
8013 for (int i = 0; i < array_size; i++)
8014 {
8015 if (item_tag_array.Get(i) == tag)
8016 {
8017 found = true;
8018 break;
8019 }
8020 }
8021 return found;
8022 }
8023
8024
8026 {
8027
8028 super.OnRPC(sender, rpc_type,ctx);
8029
8030
8031 switch (rpc_type)
8032 {
8033 #ifndef SERVER
8034 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8035 Param2<bool, string> p = new Param2<bool, string>(false, "");
8036
8038 return;
8039
8040 bool play = p.param1;
8041 string soundSet = p.param2;
8042
8043 if (play)
8044 {
8046 {
8048 {
8050 }
8051 }
8052 else
8053 {
8055 }
8056 }
8057 else
8058 {
8060 }
8061
8062 break;
8063 #endif
8064
8065 }
8066
8068 {
8070 }
8071 }
8072
8073
8074
8075
8077 {
8078 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8079 return plugin.GetID(
name);
8080 }
8081
8083 {
8084 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8085 return plugin.GetName(id);
8086 }
8087
8090 {
8091
8092
8093 int varFlags;
8094 if (!ctx.
Read(varFlags))
8095 return;
8096
8097 if (varFlags & ItemVariableFlags.FLOAT)
8098 {
8100 }
8101 }
8102
8104 {
8105
8106 super.SerializeNumericalVars(floats_out);
8107
8108
8109
8111 {
8113 }
8114
8116 {
8118 }
8119
8121 {
8123 }
8124
8126 {
8131 }
8132
8134 {
8136 }
8137 }
8138
8140 {
8141
8142 super.DeSerializeNumericalVars(floats);
8143
8144
8145 int index = 0;
8146 int mask = Math.Round(floats.Get(index));
8147
8148 index++;
8149
8151 {
8153 {
8155 }
8156 else
8157 {
8158 float quantity = floats.Get(index);
8160 }
8161 index++;
8162 }
8163
8165 {
8166 float wet = floats.Get(index);
8168 index++;
8169 }
8170
8172 {
8173 int liquidtype = Math.Round(floats.Get(index));
8175 index++;
8176 }
8177
8179 {
8181 index++;
8183 index++;
8185 index++;
8187 index++;
8188 }
8189
8191 {
8192 int cleanness = Math.Round(floats.Get(index));
8194 index++;
8195 }
8196 }
8197
8199 {
8200 super.WriteVarsToCTX(ctx);
8201
8202
8204 {
8206 }
8207
8209 {
8211 }
8212
8214 {
8216 }
8217
8219 {
8220 int r,g,b,a;
8226 }
8227
8229 {
8231 }
8232 }
8233
8235 {
8236 if (!super.ReadVarsFromCTX(ctx,version))
8237 return false;
8238
8239 int intValue;
8240 float value;
8241
8242 if (version < 140)
8243 {
8244 if (!ctx.
Read(intValue))
8245 return false;
8246
8247 m_VariablesMask = intValue;
8248 }
8249
8251 {
8252 if (!ctx.
Read(value))
8253 return false;
8254
8256 {
8258 }
8259 else
8260 {
8262 }
8263 }
8264
8265 if (version < 140)
8266 {
8268 {
8269 if (!ctx.
Read(value))
8270 return false;
8271 SetTemperatureDirect(value);
8272 }
8273 }
8274
8276 {
8277 if (!ctx.
Read(value))
8278 return false;
8280 }
8281
8283 {
8284 if (!ctx.
Read(intValue))
8285 return false;
8287 }
8288
8290 {
8291 int r,g,b,a;
8293 return false;
8295 return false;
8297 return false;
8299 return false;
8300
8302 }
8303
8305 {
8306 if (!ctx.
Read(intValue))
8307 return false;
8309 }
8310
8311 if (version >= 138 && version < 140)
8312 {
8314 {
8315 if (!ctx.
Read(intValue))
8316 return false;
8317 SetFrozen(intValue);
8318 }
8319 }
8320
8321 return true;
8322 }
8323
8324
8326 {
8329 {
8331 }
8332
8333 if (!super.OnStoreLoad(ctx, version))
8334 {
8336 return false;
8337 }
8338
8339 if (version >= 114)
8340 {
8341 bool hasQuickBarIndexSaved;
8342
8343 if (!ctx.
Read(hasQuickBarIndexSaved))
8344 {
8346 return false;
8347 }
8348
8349 if (hasQuickBarIndexSaved)
8350 {
8351 int itmQBIndex;
8352
8353
8354 if (!ctx.
Read(itmQBIndex))
8355 {
8357 return false;
8358 }
8359
8360 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8361 if (itmQBIndex != -1 && parentPlayer)
8362 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8363 }
8364 }
8365 else
8366 {
8367
8368 PlayerBase player;
8369 int itemQBIndex;
8370 if (version ==
int.
MAX)
8371 {
8372 if (!ctx.
Read(itemQBIndex))
8373 {
8375 return false;
8376 }
8377 }
8378 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8379 {
8380
8381 if (!ctx.
Read(itemQBIndex))
8382 {
8384 return false;
8385 }
8386 if (itemQBIndex != -1 && player)
8387 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8388 }
8389 }
8390
8391 if (version < 140)
8392 {
8393
8394 if (!LoadVariables(ctx, version))
8395 {
8397 return false;
8398 }
8399 }
8400
8401
8403 {
8405 return false;
8406 }
8407 if (version >= 132)
8408 {
8410 if (raib)
8411 {
8413 {
8415 return false;
8416 }
8417 }
8418 }
8419
8421 return true;
8422 }
8423
8424
8425
8427 {
8428 super.OnStoreSave(ctx);
8429
8430 PlayerBase player;
8431 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8432 {
8434
8435 int itemQBIndex = -1;
8436 itemQBIndex = player.FindQuickBarEntityIndex(this);
8437 ctx.
Write(itemQBIndex);
8438 }
8439 else
8440 {
8442 }
8443
8445
8447 if (raib)
8448 {
8450 }
8451 }
8452
8453
8455 {
8456 super.AfterStoreLoad();
8457
8459 {
8461 }
8462
8464 {
8467 }
8468 }
8469
8471 {
8472 super.EEOnAfterLoad();
8473
8475 {
8477 }
8478
8481 }
8482
8484 {
8485 return false;
8486 }
8487
8488
8489
8491 {
8493 {
8494 #ifdef PLATFORM_CONSOLE
8495
8497 {
8499 if (menu)
8500 {
8502 }
8503 }
8504 #endif
8505 }
8506
8508 {
8511 }
8512
8514 {
8515 SetWeightDirty();
8517 }
8519 {
8522 }
8523
8525 {
8528 }
8530 {
8533 }
8534
8535 super.OnVariablesSynchronized();
8536 }
8537
8538
8539
8541 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8542 {
8543 if (!IsServerCheck(allow_client))
8544 return false;
8545
8547 return false;
8548
8551
8552 if (value <= (min + 0.001))
8553 value = min;
8554
8555 if (value == min)
8556 {
8557 if (destroy_config)
8558 {
8559 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8560 if (dstr)
8561 {
8563 this.Delete();
8564 return true;
8565 }
8566 }
8567 else if (destroy_forced)
8568 {
8570 this.Delete();
8571 return true;
8572 }
8573
8575 }
8576
8579
8581 {
8583
8584 if (delta)
8586 }
8587
8589
8590 return false;
8591 }
8592
8593
8595 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8596 {
8598 }
8599
8601 {
8604 }
8605
8607 {
8610 }
8611
8613 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8614 {
8615 float value_clamped = Math.Clamp(value, 0, 1);
8617 SetQuantity(result, destroy_config, destroy_forced);
8618 }
8619
8620
8623 {
8625 }
8626
8628 {
8630 }
8631
8632
8633
8634
8635
8636
8637
8638
8639
8640
8642 {
8643 int slot = -1;
8644 if (GetInventory())
8645 {
8646 InventoryLocation il = new InventoryLocation;
8647 GetInventory().GetCurrentInventoryLocation(il);
8649 }
8650
8652 }
8653
8655 {
8656 float quantity_max = 0;
8657
8659 {
8660 if (attSlotID != -1)
8661 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8662
8663 if (quantity_max <= 0)
8665 }
8666
8667 if (quantity_max <= 0)
8669
8670 return quantity_max;
8671 }
8672
8674 {
8676 }
8677
8679 {
8681 }
8682
8683
8685 {
8687 }
8688
8690 {
8692 }
8693
8695 {
8697 }
8698
8699
8701 {
8702
8703 float weightEx = GetWeightEx();
8704 float special = GetInventoryAndCargoWeight();
8705 return weightEx - special;
8706 }
8707
8708
8710 {
8712 }
8713
8715 {
8717 {
8718 #ifdef DEVELOPER
8719 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8720 {
8721 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
8723 }
8724 #endif
8725
8727 }
8728 else if (HasEnergyManager())
8729 {
8730 #ifdef DEVELOPER
8731 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8732 {
8733 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
8734 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
8735 }
8736 #endif
8737 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
8738 }
8739 else
8740 {
8741 #ifdef DEVELOPER
8742 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8743 {
8744 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
8745 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
8746 }
8747 #endif
8748 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
8749 }
8750 }
8751
8754 {
8755 int item_count = 0;
8757
8758 if (GetInventory().GetCargo() != NULL)
8759 {
8760 item_count = GetInventory().GetCargo().GetItemCount();
8761 }
8762
8763 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
8764 {
8765 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
8766 if (item)
8767 item_count += item.GetNumberOfItems();
8768 }
8769 return item_count;
8770 }
8771
8774 {
8775 float weight = 0;
8776 float wetness = 1;
8777 if (include_wetness)
8780 {
8781 weight = wetness * m_ConfigWeight;
8782 }
8784 {
8785 weight = 1;
8786 }
8787 return weight;
8788 }
8789
8790
8791
8793 {
8794 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
8795 {
8796 GameInventory inv = GetInventory();
8797 array<EntityAI> items = new array<EntityAI>;
8799 for (int i = 0; i < items.Count(); i++)
8800 {
8802 if (item)
8803 {
8805 }
8806 }
8807 }
8808 }
8809
8810
8811
8812
8814 {
8815 float energy = 0;
8816 if (HasEnergyManager())
8817 {
8818 energy = GetCompEM().GetEnergy();
8819 }
8820 return energy;
8821 }
8822
8823
8825 {
8826 super.OnEnergyConsumed();
8827
8829 }
8830
8832 {
8833 super.OnEnergyAdded();
8834
8836 }
8837
8838
8840 {
8841 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
8842 {
8844 {
8845 float energy_0to1 = GetCompEM().GetEnergy0To1();
8847 }
8848 }
8849 }
8850
8851
8853 {
8854 return ConfigGetFloat("heatIsolation");
8855 }
8856
8858 {
8860 }
8861
8863 {
8864 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
8865 if (
GetGame().ConfigIsExisting(paramPath))
8867
8868 return 0.0;
8869 }
8870
8872 {
8873 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
8874 if (
GetGame().ConfigIsExisting(paramPath))
8876
8877 return 0.0;
8878 }
8879
8880 override void SetWet(
float value,
bool allow_client =
false)
8881 {
8882 if (!IsServerCheck(allow_client))
8883 return;
8884
8887
8889
8890 m_VarWet = Math.Clamp(value, min, max);
8891
8893 {
8896 }
8897 }
8898
8899 override void AddWet(
float value)
8900 {
8902 }
8903
8905 {
8907 }
8908
8910 {
8912 }
8913
8915 {
8917 }
8918
8920 {
8922 }
8923
8925 {
8927 }
8928
8930 {
8933 if (newLevel != oldLevel)
8934 {
8936 }
8937 }
8938
8940 {
8941 SetWeightDirty();
8942 }
8943
8945 {
8946 return GetWetLevelInternal(
m_VarWet);
8947 }
8948
8949
8950
8952 {
8954 }
8955
8957 {
8959 }
8960
8962 {
8964 }
8965
8967 {
8969 }
8970
8971
8972
8974 {
8975 if (ConfigIsExisting("itemModelLength"))
8976 {
8977 return ConfigGetFloat("itemModelLength");
8978 }
8979 return 0;
8980 }
8981
8983 {
8984 if (ConfigIsExisting("itemAttachOffset"))
8985 {
8986 return ConfigGetFloat("itemAttachOffset");
8987 }
8988 return 0;
8989 }
8990
8991 override void SetCleanness(
int value,
bool allow_client =
false)
8992 {
8993 if (!IsServerCheck(allow_client))
8994 return;
8995
8997
8999
9002 }
9003
9005 {
9007 }
9008
9010 {
9011 return true;
9012 }
9013
9014
9015
9016
9018 {
9020 }
9021
9023 {
9025 }
9026
9027
9028
9029
9030 override void SetColor(
int r,
int g,
int b,
int a)
9031 {
9037 }
9039 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9040 {
9045 }
9046
9048 {
9050 }
9051
9054 {
9055 int r,g,b,a;
9057 r = r/255;
9058 g = g/255;
9059 b = b/255;
9060 a = a/255;
9061 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9062 }
9063
9064
9065
9066 override void SetLiquidType(
int value,
bool allow_client =
false)
9067 {
9068 if (!IsServerCheck(allow_client))
9069 return;
9070
9075 }
9076
9078 {
9079 return ConfigGetInt("varLiquidTypeInit");
9080 }
9081
9083 {
9085 }
9086
9088 {
9090 SetFrozen(false);
9091 }
9092
9095 {
9096 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9097 }
9098
9099
9102 {
9103 PlayerBase nplayer;
9104 if (PlayerBase.CastTo(nplayer, player))
9105 {
9107
9108 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9109 }
9110 }
9111
9112
9115 {
9116 PlayerBase nplayer;
9117 if (PlayerBase.CastTo(nplayer,player))
9118 {
9119
9120 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9121
9122 }
9123
9124
9125 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9126
9127
9128 if (HasEnergyManager())
9129 {
9130 GetCompEM().UpdatePlugState();
9131 }
9132 }
9133
9134
9136 {
9137 super.OnPlacementStarted(player);
9138
9140 }
9141
9142 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9143 {
9145 {
9146 m_AdminLog.OnPlacementComplete(player,
this);
9147 }
9148
9149 super.OnPlacementComplete(player, position, orientation);
9150 }
9151
9152
9153
9154
9155
9157 {
9159 {
9160 return true;
9161 }
9162 else
9163 {
9164 return false;
9165 }
9166 }
9167
9168
9170 {
9172 {
9174 }
9175 }
9176
9177
9179 {
9181 }
9182
9184 {
9186 }
9187
9188 override void InsertAgent(
int agent,
float count = 1)
9189 {
9190 if (count < 1)
9191 return;
9192
9194 }
9195
9198 {
9200 }
9201
9202
9204 {
9206 }
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9227
9228
9229
9230
9231
9232
9233
9234
9235
9236
9237
9238
9239
9240
9241
9242
9243
9244
9245
9246
9247
9248
9250 {
9252 return false;
9253 return true;
9254 }
9255
9257 {
9258
9260 }
9261
9262
9265 {
9266 super.CheckForRoofLimited(timeTresholdMS);
9267
9269 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9270 {
9271 m_PreviousRoofTestTime = time;
9272 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9273 }
9274 }
9275
9276
9278 {
9280 {
9281 return 0;
9282 }
9283
9284 if (GetInventory().GetAttachmentSlotsCount() != 0)
9285 {
9286 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9287 if (filter)
9288 return filter.GetProtectionLevel(type, false, system);
9289 else
9290 return 0;
9291 }
9292
9293 string subclassPath, entryName;
9294
9295 switch (type)
9296 {
9298 entryName = "biological";
9299 break;
9301 entryName = "chemical";
9302 break;
9303 default:
9304 entryName = "biological";
9305 break;
9306 }
9307
9308 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9309
9311 }
9312
9313
9314
9317 {
9318 if (!IsMagazine())
9320
9322 }
9323
9324
9325
9326
9327
9332 {
9333 return true;
9334 }
9335
9337 {
9339 }
9340
9341
9342
9343
9344
9346 {
9347 if (parent)
9348 {
9349 if (parent.IsInherited(DayZInfected))
9350 return true;
9351
9352 if (!parent.IsRuined())
9353 return true;
9354 }
9355
9356 return true;
9357 }
9358
9360 {
9361 if (!super.CanPutAsAttachment(parent))
9362 {
9363 return false;
9364 }
9365
9366 if (!IsRuined() && !parent.IsRuined())
9367 {
9368 return true;
9369 }
9370
9371 return false;
9372 }
9373
9375 {
9376
9377
9378
9379
9380 return super.CanReceiveItemIntoCargo(item);
9381 }
9382
9384 {
9385
9386
9387
9388
9389 GameInventory attachmentInv = attachment.GetInventory();
9391 {
9392 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9393 return false;
9394 }
9395
9396 InventoryLocation loc = new InventoryLocation();
9397 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9398 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9399 return false;
9400
9401 return super.CanReceiveAttachment(attachment, slotId);
9402 }
9403
9405 {
9406 if (!super.CanReleaseAttachment(attachment))
9407 return false;
9408
9409 return GetInventory().AreChildrenAccessible();
9410 }
9411
9412
9413
9414
9415
9416
9417
9418
9419
9420
9421
9422
9423
9424
9425
9426
9427
9428
9429
9430
9431
9433 {
9434 int id = muzzle_owner.GetMuzzleID();
9435 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9436
9437 if (WPOF_array)
9438 {
9439 for (int i = 0; i < WPOF_array.Count(); i++)
9440 {
9441 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9442
9443 if (WPOF)
9444 {
9445 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9446 }
9447 }
9448 }
9449 }
9450
9451
9453 {
9454 int id = muzzle_owner.GetMuzzleID();
9456
9457 if (WPOBE_array)
9458 {
9459 for (int i = 0; i < WPOBE_array.Count(); i++)
9460 {
9461 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9462
9463 if (WPOBE)
9464 {
9465 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9466 }
9467 }
9468 }
9469 }
9470
9471
9473 {
9474 int id = muzzle_owner.GetMuzzleID();
9475 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9476
9477 if (WPOOH_array)
9478 {
9479 for (int i = 0; i < WPOOH_array.Count(); i++)
9480 {
9481 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9482
9483 if (WPOOH)
9484 {
9485 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9486 }
9487 }
9488 }
9489 }
9490
9491
9493 {
9494 int id = muzzle_owner.GetMuzzleID();
9495 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9496
9497 if (WPOOH_array)
9498 {
9499 for (int i = 0; i < WPOOH_array.Count(); i++)
9500 {
9501 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9502
9503 if (WPOOH)
9504 {
9505 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9506 }
9507 }
9508 }
9509 }
9510
9511
9513 {
9514 int id = muzzle_owner.GetMuzzleID();
9515 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9516
9517 if (WPOOH_array)
9518 {
9519 for (int i = 0; i < WPOOH_array.Count(); i++)
9520 {
9521 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9522
9523 if (WPOOH)
9524 {
9525 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9526 }
9527 }
9528 }
9529 }
9530
9531
9532
9534 {
9536 {
9537 return true;
9538 }
9539
9540 return false;
9541 }
9542
9544 {
9546 {
9547 return true;
9548 }
9549
9550 return false;
9551 }
9552
9554 {
9556 {
9557 return true;
9558 }
9559
9560 return false;
9561 }
9562
9564 {
9565 return false;
9566 }
9567
9570 {
9571 return UATimeSpent.DEFAULT_DEPLOY;
9572 }
9573
9574
9575
9576
9578 {
9580 SetSynchDirty();
9581 }
9582
9584 {
9586 }
9587
9588
9590 {
9591 return false;
9592 }
9593
9596 {
9597 string att_type = "None";
9598
9599 if (ConfigIsExisting("soundAttType"))
9600 {
9601 att_type = ConfigGetString("soundAttType");
9602 }
9603
9605 }
9606
9608 {
9610 }
9611
9612
9613
9614
9615
9621
9623 {
9626
9628 }
9629
9630
9632 {
9634 return;
9635
9637
9640
9643
9644 SoundParameters params = new SoundParameters();
9648 }
9649
9650
9652 {
9654 return;
9655
9657 SetSynchDirty();
9658
9661 }
9662
9663
9665 {
9667 return;
9668
9670 SetSynchDirty();
9671
9674 }
9675
9677 {
9679 }
9680
9682 {
9684 }
9685
9688 {
9689 if (!
GetGame().IsDedicatedServer())
9690 {
9691 if (ConfigIsExisting("attachSoundSet"))
9692 {
9693 string cfg_path = "";
9694 string soundset = "";
9696
9699 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
9700 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
9701
9702 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
9703 {
9704 for (int i = 0; i < cfg_soundset_array.Count(); i++)
9705 {
9706 if (cfg_slot_array[i] == slot_type)
9707 {
9708 soundset = cfg_soundset_array[i];
9709 break;
9710 }
9711 }
9712 }
9713
9714 if (soundset != "")
9715 {
9716 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
9718 }
9719 }
9720 }
9721 }
9722
9724 {
9725
9726 }
9727
9728 void OnApply(PlayerBase player);
9729
9731 {
9732 return 1.0;
9733 };
9734
9736 {
9738 }
9739
9741 {
9743 }
9744
9746
9748 {
9749 SetDynamicPhysicsLifeTime(0.01);
9751 }
9752
9754 {
9755 array<string> zone_names = new array<string>;
9756 GetDamageZones(zone_names);
9757 for (int i = 0; i < zone_names.Count(); i++)
9758 {
9759 SetHealthMax(zone_names.Get(i),"Health");
9760 }
9761 SetHealthMax("","Health");
9762 }
9763
9766 {
9767 float global_health = GetHealth01("","Health");
9768 array<string> zones = new array<string>;
9769 GetDamageZones(zones);
9770
9771 for (int i = 0; i < zones.Count(); i++)
9772 {
9773 SetHealth01(zones.Get(i),"Health",global_health);
9774 }
9775 }
9776
9779 {
9780 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
9781 }
9782
9784 {
9785 if (!hasRootAsPlayer)
9786 {
9787 if (refParentIB)
9788 {
9789
9790 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
9791 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
9792
9793 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
9794 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
9795
9798 }
9799 else
9800 {
9801
9804 }
9805 }
9806 }
9807
9809 {
9811 {
9812 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
9813 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
9814 {
9815 float heatPermCoef = 1.0;
9817 while (ent)
9818 {
9819 heatPermCoef *= ent.GetHeatPermeabilityCoef();
9820 ent = ent.GetHierarchyParent();
9821 }
9822
9823 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
9824 }
9825 }
9826 }
9827
9829 {
9830
9831 EntityAI parent = GetHierarchyParent();
9832 if (!parent)
9833 {
9834 hasParent = false;
9835 hasRootAsPlayer = false;
9836 }
9837 else
9838 {
9839 hasParent = true;
9840 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
9841 refParentIB =
ItemBase.Cast(parent);
9842 }
9843 }
9844
9845 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
9846 {
9847
9848 }
9849
9851 {
9852
9853 return false;
9854 }
9855
9857 {
9858
9859
9860 return false;
9861 }
9862
9864 {
9865
9866 return false;
9867 }
9868
9871 {
9872 return !GetIsFrozen() &&
IsOpen();
9873 }
9874
9876 {
9877 bool hasParent = false, hasRootAsPlayer = false;
9879
9880 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
9881 bool foodDecay =
g_Game.IsFoodDecayEnabled();
9882
9883 if (wwtu || foodDecay)
9884 {
9888
9889 if (processWetness || processTemperature || processDecay)
9890 {
9892
9893 if (processWetness)
9894 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
9895
9896 if (processTemperature)
9898
9899 if (processDecay)
9900 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
9901 }
9902 }
9903 }
9904
9907 {
9909 }
9910
9912 {
9915
9916 return super.GetTemperatureFreezeThreshold();
9917 }
9918
9920 {
9923
9924 return super.GetTemperatureThawThreshold();
9925 }
9926
9928 {
9931
9932 return super.GetItemOverheatThreshold();
9933 }
9934
9936 {
9938 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
9939
9940 return super.GetTemperatureFreezeTime();
9941 }
9942
9944 {
9946 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
9947
9948 return super.GetTemperatureThawTime();
9949 }
9950
9955
9957 {
9958 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
9959 }
9960
9962 {
9963 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
9964 }
9965
9968 {
9970 }
9971
9973 {
9975 }
9976
9978 {
9980 }
9981
9984 {
9985 return null;
9986 }
9987
9990 {
9991 return false;
9992 }
9993
9995 {
9997 {
10000 if (!trg)
10001 {
10003 explosive = this;
10004 }
10005
10006 explosive.PairRemote(trg);
10008
10009 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10010 trg.SetPersistentPairID(persistentID);
10011 explosive.SetPersistentPairID(persistentID);
10012
10013 return true;
10014 }
10015 return false;
10016 }
10017
10020 {
10021 float ret = 1.0;
10024 ret *= GetHealth01();
10025
10026 return ret;
10027 }
10028
10029 #ifdef DEVELOPER
10030 override void SetDebugItem()
10031 {
10032 super.SetDebugItem();
10033 _itemBase = this;
10034 }
10035
10037 {
10038 string text = super.GetDebugText();
10039
10041 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10042
10043 return text;
10044 }
10045 #endif
10046
10048 {
10049 return true;
10050 }
10051
10053
10055
10057 {
10060 }
10061
10062
10070
10086}
10087
10089{
10091 if (entity)
10092 {
10093 bool is_item = entity.IsInherited(
ItemBase);
10094 if (is_item && full_quantity)
10095 {
10098 }
10099 }
10100 else
10101 {
10103 return NULL;
10104 }
10105 return entity;
10106}
10107
10109{
10110 if (item)
10111 {
10112 if (health > 0)
10113 item.SetHealth("", "", health);
10114
10115 if (item.CanHaveTemperature())
10116 {
10118 if (item.CanFreeze())
10119 item.SetFrozen(false);
10120 }
10121
10122 if (item.HasEnergyManager())
10123 {
10124 if (quantity >= 0)
10125 {
10126 item.GetCompEM().SetEnergy0To1(quantity);
10127 }
10128 else
10129 {
10131 }
10132 }
10133 else if (item.IsMagazine())
10134 {
10135 Magazine mag = Magazine.Cast(item);
10136 if (quantity >= 0)
10137 {
10138 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10139 }
10140 else
10141 {
10143 }
10144
10145 }
10146 else
10147 {
10148 if (quantity >= 0)
10149 {
10150 item.SetQuantityNormalized(quantity, false);
10151 }
10152 else
10153 {
10155 }
10156
10157 }
10158 }
10159}
10160
10161#ifdef DEVELOPER
10163#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.