5162{
5164 {
5165 return true;
5166 }
5167};
5168
5169
5170
5172{
5176
5178
5181
5182
5183
5184
5185
5194
5200
5205
5210
5231 protected bool m_IsResultOfSplit
5232
5234
5239
5240
5241
5243
5247
5248
5249
5251
5254
5255
5256
5262
5263
5271
5274
5275
5277
5278
5280
5281
5286
5287
5292
5293
5295
5296
5298 {
5303
5304 if (!
GetGame().IsDedicatedServer())
5305 {
5307 {
5309
5311 {
5313 }
5314 }
5315
5318 }
5319
5320 m_OldLocation = null;
5321
5323 {
5325 }
5326
5327 if (ConfigIsExisting("headSelectionsToHide"))
5328 {
5331 }
5332
5334 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5335 {
5337 }
5338
5340
5341 m_IsResultOfSplit = false;
5342
5344 }
5345
5347 {
5348 super.InitItemVariables();
5349
5355 m_Count = ConfigGetInt(
"count");
5356
5359
5364
5367
5372
5384
5388
5389
5392 if (ConfigIsExisting("canBeSplit"))
5393 {
5396 }
5397
5399 if (ConfigIsExisting("itemBehaviour"))
5401
5402
5405 RegisterNetSyncVariableInt("m_VarLiquidType");
5406 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5407
5408 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5409 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5410 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5411
5412 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5413 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5414 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5415 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5416
5417 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5418 RegisterNetSyncVariableBool("m_IsTakeable");
5419 RegisterNetSyncVariableBool("m_IsHologram");
5420
5423 {
5426 }
5427
5429
5431 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5433
5434 }
5435
5437 {
5439 }
5440
5442 {
5445 {
5450 }
5451 }
5452
5453 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5454 {
5456 {
5459 }
5460
5462 }
5463
5465 {
5471 }
5472
5474
5476 {
5478
5479 if (!action)
5480 {
5481 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5482 return;
5483 }
5484
5486 if (!ai)
5487 {
5489 return;
5490 }
5491
5493 if (!action_array)
5494 {
5495 action_array = new array<ActionBase_Basic>;
5497 }
5498 if (LogManager.IsActionLogEnable())
5499 {
5500 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5501 }
5502
5503 if (action_array.Find(action) != -1)
5504 {
5505 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5506 }
5507 else
5508 {
5509 action_array.Insert(action);
5510 }
5511 }
5512
5514 {
5516 ActionBase action = player.GetActionManager().GetAction(actionName);
5519
5520 if (action_array)
5521 {
5522 action_array.RemoveItem(action);
5523 }
5524 }
5525
5526
5527
5529 {
5530 ActionOverrideData overrideData = new ActionOverrideData();
5534
5536 if (!actionMap)
5537 {
5540 }
5541
5542 actionMap.Insert(this.
Type(), overrideData);
5543
5544 }
5545
5547
5549
5550
5552 {
5555
5558
5559 string config_to_search = "CfgVehicles";
5560 string muzzle_owner_config;
5561
5563 {
5564 if (IsInherited(Weapon))
5565 config_to_search = "CfgWeapons";
5566
5567 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5568
5569 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5570
5572
5573 if (config_OnFire_subclass_count > 0)
5574 {
5575 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5576
5577 for (int i = 0; i < config_OnFire_subclass_count; i++)
5578 {
5579 string particle_class = "";
5581 string config_OnFire_entry = config_OnFire_class + particle_class;
5582 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5583 WPOF_array.Insert(WPOF);
5584 }
5585
5586
5588 }
5589 }
5590
5592 {
5593 config_to_search = "CfgWeapons";
5594 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5595
5596 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5597
5599
5600 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
5601 {
5602 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
5603
5604 for (i = 0; i < config_OnBulletCasingEject_count; i++)
5605 {
5606 string particle_class2 = "";
5608 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
5609 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
5610 WPOBE_array.Insert(WPOBE);
5611 }
5612
5613
5615 }
5616 }
5617 }
5618
5619
5621 {
5624
5626 {
5627 string config_to_search = "CfgVehicles";
5628
5629 if (IsInherited(Weapon))
5630 config_to_search = "CfgWeapons";
5631
5632 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5633 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
5634
5635 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
5636 {
5637
5639
5641 {
5643 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
5645 return;
5646 }
5647
5650
5651
5652
5654 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
5655
5656 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
5657 {
5658 string particle_class = "";
5660 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
5662
5663 if (entry_type == CT_CLASS)
5664 {
5665 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
5666 WPOOH_array.Insert(WPOF);
5667 }
5668 }
5669
5670
5672 }
5673 }
5674 }
5675
5677 {
5679 }
5680
5682 {
5684 {
5686
5689
5692
5693 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5694 }
5695 }
5696
5698 {
5700 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5701
5703 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5704
5706 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5707
5709 {
5711 }
5712 }
5713
5715 {
5717 }
5718
5720 {
5723 else
5725
5727 {
5730 }
5731 else
5732 {
5735
5738 }
5739
5741 }
5742
5744 {
5746 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5747 }
5748
5750 {
5752 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5754 }
5755
5757 {
5759 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5760 }
5761
5763 {
5766
5767 OverheatingParticle OP = new OverheatingParticle();
5772
5774 }
5775
5777 {
5780
5781 return -1;
5782 }
5783
5785 {
5787 {
5790
5791 for (int i = count; i > 0; --i)
5792 {
5793 int id = i - 1;
5796
5799
5800 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
5801 {
5802 if (p)
5803 {
5806 }
5807 }
5808 }
5809 }
5810 }
5811
5813 {
5815 {
5817 {
5818 int id = i - 1;
5820
5821 if (OP)
5822 {
5824
5825 if (p)
5826 {
5828 }
5829
5830 delete OP;
5831 }
5832 }
5833
5836 }
5837 }
5838
5841 {
5842 return 0.0;
5843 }
5844
5845
5847 {
5848 return 250;
5849 }
5850
5852 {
5853 return 0;
5854 }
5855
5858 {
5860 return true;
5861
5862 return false;
5863 }
5864
5867 {
5870
5872 {
5874 }
5875 else
5876 {
5877
5879 }
5880
5882 }
5883
5890 {
5891 return -1;
5892 }
5893
5894
5895
5896
5898 {
5900 {
5902 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
5903
5904 if (r_index >= 0)
5905 {
5906 InventoryLocation r_il = new InventoryLocation;
5907 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
5908
5909 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
5912 {
5913 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
5914 }
5916 {
5917 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
5918 }
5919
5920 }
5921
5922 player.GetHumanInventory().ClearUserReservedLocation(this);
5923 }
5924
5927 }
5928
5929
5930
5931
5933 {
5934 return ItemBase.m_DebugActionsMask;
5935 }
5936
5938 {
5939 return ItemBase.m_DebugActionsMask & mask;
5940 }
5941
5943 {
5944 ItemBase.m_DebugActionsMask = mask;
5945 }
5946
5948 {
5949 ItemBase.m_DebugActionsMask |= mask;
5950 }
5951
5953 {
5954 ItemBase.m_DebugActionsMask &= ~mask;
5955 }
5956
5958 {
5960 {
5962 }
5963 else
5964 {
5966 }
5967 }
5968
5969
5971 {
5972 if (GetEconomyProfile())
5973 {
5974 float q_max = GetEconomyProfile().GetQuantityMax();
5975 if (q_max > 0)
5976 {
5977 float q_min = GetEconomyProfile().GetQuantityMin();
5978 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
5979
5981 {
5982 ComponentEnergyManager comp = GetCompEM();
5984 {
5986 }
5987 }
5989 {
5991
5992 }
5993
5994 }
5995 }
5996 }
5997
6000 {
6001 EntityAI parent = GetHierarchyParent();
6002
6003 if (parent)
6004 {
6005 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6006 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6007 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6008 }
6009 }
6010
6013 {
6014 EntityAI parent = GetHierarchyParent();
6015
6016 if (parent)
6017 {
6018 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6019 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6020 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6021 }
6022 }
6023
6025 {
6026
6027
6028
6029
6031
6033 {
6034 if (ScriptInputUserData.CanStoreInputUserData())
6035 {
6036 ScriptInputUserData ctx = new ScriptInputUserData;
6042 ctx.
Write(use_stack_max);
6045
6047 {
6048 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6049 }
6050 }
6051 }
6052 else if (!
GetGame().IsMultiplayer())
6053 {
6055 }
6056 }
6057
6059 {
6061 }
6062
6064 {
6066 }
6067
6069 {
6071 }
6072
6074 {
6075
6076 return false;
6077 }
6078
6080 {
6081 return false;
6082 }
6083
6087 {
6088 return false;
6089 }
6090
6092 {
6093 return "";
6094 }
6095
6097
6099 {
6100 return false;
6101 }
6102
6104 {
6105 return true;
6106 }
6107
6108
6109
6111 {
6112 return true;
6113 }
6114
6116 {
6117 return true;
6118 }
6119
6121 {
6122 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6124 }
6125
6127 {
6129 }
6130
6132 {
6134 if (!is_being_placed)
6136 SetSynchDirty();
6137 }
6138
6139
6141
6143 {
6145 }
6146
6148 {
6150 }
6151
6153 {
6154 return 1;
6155 }
6156
6158 {
6159 return false;
6160 }
6161
6163 {
6165 SetSynchDirty();
6166 }
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6203 {
6204 super.OnMovedInsideCargo(container);
6205
6206 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6207 }
6208
6209 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6210 {
6211 super.EEItemLocationChanged(oldLoc,newLoc);
6212
6213 PlayerBase new_player = null;
6214 PlayerBase old_player = null;
6215
6216 if (newLoc.GetParent())
6217 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6218
6219 if (oldLoc.GetParent())
6220 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6221
6223 {
6224 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6225
6226 if (r_index >= 0)
6227 {
6228 InventoryLocation r_il = new InventoryLocation;
6229 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6230
6231 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6234 {
6235 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6236 }
6238 {
6239 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6240 }
6241
6242 }
6243 }
6244
6246 {
6247 if (new_player)
6248 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6249
6250 if (new_player == old_player)
6251 {
6252
6253 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6254 {
6256 {
6257 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6258 {
6259 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6260 }
6261 }
6262 else
6263 {
6264 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6265 }
6266 }
6267
6268 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6269 {
6270 int type = oldLoc.GetType();
6272 {
6273 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6274 }
6276 {
6277 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6278 }
6279 }
6280 if (!m_OldLocation)
6281 {
6282 m_OldLocation = new InventoryLocation;
6283 }
6284 m_OldLocation.Copy(oldLoc);
6285 }
6286 else
6287 {
6288 if (m_OldLocation)
6289 {
6290 m_OldLocation.Reset();
6291 }
6292 }
6293
6295 }
6296 else
6297 {
6298 if (new_player)
6299 {
6300 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6301 if (res_index >= 0)
6302 {
6303 InventoryLocation il = new InventoryLocation;
6304 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6306 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6309 {
6310 il.
GetParent().GetOnReleaseLock().Invoke(it);
6311 }
6313 {
6315 }
6316
6317 }
6318 }
6320 {
6321
6323 }
6324
6325 if (m_OldLocation)
6326 {
6327 m_OldLocation.Reset();
6328 }
6329 }
6330 }
6331
6332 override void EOnContact(IEntity other, Contact extra)
6333 {
6335 {
6336 int liquidType = -1;
6338 if (impactSpeed > 0.0)
6339 {
6341 #ifndef SERVER
6343 #else
6345 SetSynchDirty();
6346 #endif
6348 }
6349 }
6350
6351 #ifdef SERVER
6352 if (GetCompEM() && GetCompEM().IsPlugged())
6353 {
6354 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6355 GetCompEM().UnplugThis();
6356 }
6357 #endif
6358 }
6359
6361
6363 {
6365 }
6366
6368 {
6369
6370 }
6371
6373 {
6374 super.OnItemLocationChanged(old_owner, new_owner);
6375
6376 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6377 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6378
6379 if (!relatedPlayer && playerNew)
6380 relatedPlayer = playerNew;
6381
6382 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6383 {
6385 if (actionMgr)
6386 {
6387 ActionBase currentAction = actionMgr.GetRunningAction();
6388 if (currentAction)
6390 }
6391 }
6392
6393 Man ownerPlayerOld = null;
6394 Man ownerPlayerNew = null;
6395
6396 if (old_owner)
6397 {
6398 if (old_owner.
IsMan())
6399 {
6400 ownerPlayerOld = Man.Cast(old_owner);
6401 }
6402 else
6403 {
6404 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6405 }
6406 }
6407 else
6408 {
6410 {
6412
6413 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6414 {
6415 GetCompEM().UnplugThis();
6416 }
6417 }
6418 }
6419
6420 if (new_owner)
6421 {
6422 if (new_owner.
IsMan())
6423 {
6424 ownerPlayerNew = Man.Cast(new_owner);
6425 }
6426 else
6427 {
6428 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6429 }
6430 }
6431
6432 if (ownerPlayerOld != ownerPlayerNew)
6433 {
6434 if (ownerPlayerOld)
6435 {
6436 array<EntityAI> subItemsExit = new array<EntityAI>;
6438 for (int i = 0; i < subItemsExit.Count(); i++)
6439 {
6442 }
6443 }
6444
6445 if (ownerPlayerNew)
6446 {
6447 array<EntityAI> subItemsEnter = new array<EntityAI>;
6449 for (int j = 0; j < subItemsEnter.Count(); j++)
6450 {
6453 }
6454 }
6455 }
6456 else if (ownerPlayerNew != null)
6457 {
6458 PlayerBase nplayer;
6459 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6460 {
6461 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6463 for (int k = 0; k < subItemsUpdate.Count(); k++)
6464 {
6466 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6467 }
6468 }
6469 }
6470
6471 if (old_owner)
6472 old_owner.OnChildItemRemoved(this);
6473 if (new_owner)
6474 new_owner.OnChildItemReceived(this);
6475 }
6476
6477
6479 {
6480 super.EEDelete(parent);
6481 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6482 if (player)
6483 {
6485
6486 if (player.IsAlive())
6487 {
6488 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6489 if (r_index >= 0)
6490 {
6491 InventoryLocation r_il = new InventoryLocation;
6492 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6493
6494 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6497 {
6498 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6499 }
6501 {
6502 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6503 }
6504
6505 }
6506
6507 player.RemoveQuickBarEntityShortcut(this);
6508 }
6509 }
6510 }
6511
6513 {
6514 super.EEKilled(killer);
6515
6518 {
6519 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6520 {
6521 if (IsMagazine())
6522 {
6523 if (Magazine.Cast(this).GetAmmoCount() > 0)
6524 {
6526 }
6527 }
6528 else
6529 {
6531 }
6532 }
6533 }
6534 }
6535
6537 {
6538 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6539
6540 super.OnWasAttached(parent, slot_id);
6541
6544
6546 }
6547
6549 {
6550 super.OnWasDetached(parent, slot_id);
6551
6554 }
6555
6557 {
6558 int idx;
6561
6562 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6563 if (inventory_slots.Count() < 1)
6564 {
6565 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6566 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6567 }
6568 else
6569 {
6570 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6571 }
6572
6573 idx = inventory_slots.Find(slot);
6574 if (idx < 0)
6575 return "";
6576
6577 return attach_types.Get(idx);
6578 }
6579
6581 {
6582 int idx = -1;
6583 string slot;
6584
6587
6588 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6589 if (inventory_slots.Count() < 1)
6590 {
6591 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6592 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6593 }
6594 else
6595 {
6596 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6597 if (detach_types.Count() < 1)
6598 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6599 }
6600
6601 for (int i = 0; i < inventory_slots.Count(); i++)
6602 {
6603 slot = inventory_slots.Get(i);
6604 }
6605
6606 if (slot != "")
6607 {
6608 if (detach_types.Count() == 1)
6609 idx = 0;
6610 else
6611 idx = inventory_slots.Find(slot);
6612 }
6613 if (idx < 0)
6614 return "";
6615
6616 return detach_types.Get(idx);
6617 }
6618
6620 {
6621
6623
6624
6625 float min_time = 1;
6626 float max_time = 3;
6627 float delay = Math.RandomFloat(min_time, max_time);
6628
6629 explode_timer.Run(delay, this, "DoAmmoExplosion");
6630 }
6631
6633 {
6634 Magazine magazine = Magazine.Cast(this);
6635 int pop_sounds_count = 6;
6636 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
6637
6638
6639 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
6640 string sound_name = pop_sounds[ sound_idx ];
6642
6643
6644 magazine.ServerAddAmmoCount(-1);
6645
6646
6647 float min_temp_to_explode = 100;
6648
6649 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
6650 {
6652 }
6653 }
6654
6655
6656 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
6657 {
6658 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
6659
6660 const int CHANCE_DAMAGE_CARGO = 4;
6661 const int CHANCE_DAMAGE_ATTACHMENT = 1;
6662 const int CHANCE_DAMAGE_NOTHING = 2;
6663
6665 {
6666 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
6667 int chances;
6668 int rnd;
6669
6670 if (GetInventory().GetCargo())
6671 {
6672 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6673 rnd = Math.RandomInt(0,chances);
6674
6675 if (rnd < CHANCE_DAMAGE_CARGO)
6676 {
6678 }
6679 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
6680 {
6682 }
6683 }
6684 else
6685 {
6686 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6687 rnd = Math.RandomInt(0,chances);
6688
6689 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
6690 {
6692 }
6693 }
6694 }
6695 }
6696
6698 {
6699 if (GetInventory().GetCargo())
6700 {
6701 int item_count = GetInventory().GetCargo().GetItemCount();
6702 if (item_count > 0)
6703 {
6704 int random_pick = Math.RandomInt(0, item_count);
6706 if (!item.IsExplosive())
6707 {
6708 item.AddHealth("","",damage);
6709 return true;
6710 }
6711 }
6712 }
6713 return false;
6714 }
6715
6717 {
6718 int attachment_count = GetInventory().AttachmentCount();
6719 if (attachment_count > 0)
6720 {
6721 int random_pick = Math.RandomInt(0, attachment_count);
6722 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
6723 if (!attachment.IsExplosive())
6724 {
6725 attachment.AddHealth("","",damage);
6726 return true;
6727 }
6728 }
6729 return false;
6730 }
6731
6733 {
6735 }
6736
6738 {
6740 return GetInventory().CanRemoveEntity();
6741
6742 return false;
6743 }
6744
6746 {
6747
6749 return false;
6750
6751
6753 return false;
6754
6755
6756
6758 if (delta == 0)
6759 return false;
6760
6761
6762 return true;
6763 }
6764
6766 {
6768 {
6769 if (ScriptInputUserData.CanStoreInputUserData())
6770 {
6771 ScriptInputUserData ctx = new ScriptInputUserData;
6776 ctx.
Write(destination_entity);
6780 }
6781 }
6782 else if (!
GetGame().IsMultiplayer())
6783 {
6785 }
6786 }
6787
6789 {
6790 float split_quantity_new;
6794 InventoryLocation loc = new InventoryLocation;
6795
6796 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6797 {
6799 split_quantity_new = stack_max;
6800 else
6802
6804 {
6805 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6806 if (new_item)
6807 {
6808 new_item.SetResultOfSplit(true);
6809 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6811 new_item.
SetQuantity(split_quantity_new,
false,
true);
6812 }
6813 }
6814 }
6815 else if (destination_entity && slot_id == -1)
6816 {
6817 if (quantity > stack_max)
6818 split_quantity_new = stack_max;
6819 else
6820 split_quantity_new = quantity;
6821
6823 {
6825 {
6828 }
6829
6830 if (new_item)
6831 {
6832 new_item.SetResultOfSplit(true);
6833 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6835 new_item.
SetQuantity(split_quantity_new,
false,
true);
6836 }
6837 }
6838 }
6839 else
6840 {
6841 if (stack_max != 0)
6842 {
6844 {
6846 }
6847
6848 if (split_quantity_new == 0)
6849 {
6850 if (!
GetGame().IsMultiplayer())
6851 player.PhysicalPredictiveDropItem(this);
6852 else
6853 player.ServerDropEntity(this);
6854 return;
6855 }
6856
6858 {
6860
6861 if (new_item)
6862 {
6863 new_item.SetResultOfSplit(true);
6864 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6867 new_item.PlaceOnSurface();
6868 }
6869 }
6870 }
6871 }
6872 }
6873
6875 {
6876 float split_quantity_new;
6880 InventoryLocation loc = new InventoryLocation;
6881
6882 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6883 {
6885 split_quantity_new = stack_max;
6886 else
6888
6890 {
6891 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6892 if (new_item)
6893 {
6894 new_item.SetResultOfSplit(true);
6895 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6897 new_item.
SetQuantity(split_quantity_new,
false,
true);
6898 }
6899 }
6900 }
6901 else if (destination_entity && slot_id == -1)
6902 {
6903 if (quantity > stack_max)
6904 split_quantity_new = stack_max;
6905 else
6906 split_quantity_new = quantity;
6907
6909 {
6911 {
6914 }
6915
6916 if (new_item)
6917 {
6918 new_item.SetResultOfSplit(true);
6919 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6921 new_item.
SetQuantity(split_quantity_new,
false,
true);
6922 }
6923 }
6924 }
6925 else
6926 {
6927 if (stack_max != 0)
6928 {
6930 {
6932 }
6933
6935 {
6937
6938 if (new_item)
6939 {
6940 new_item.SetResultOfSplit(true);
6941 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6944 new_item.PlaceOnSurface();
6945 }
6946 }
6947 }
6948 }
6949 }
6950
6952 {
6954 {
6955 if (ScriptInputUserData.CanStoreInputUserData())
6956 {
6957 ScriptInputUserData ctx = new ScriptInputUserData;
6962 dst.WriteToContext(ctx);
6964 }
6965 }
6966 else if (!
GetGame().IsMultiplayer())
6967 {
6969 }
6970 }
6971
6973 {
6975 {
6976 if (ScriptInputUserData.CanStoreInputUserData())
6977 {
6978 ScriptInputUserData ctx = new ScriptInputUserData;
6983 ctx.
Write(destination_entity);
6989 }
6990 }
6991 else if (!
GetGame().IsMultiplayer())
6992 {
6994 }
6995 }
6996
6998 {
7000 }
7001
7003 {
7005 float split_quantity_new;
7007 if (dst.IsValid())
7008 {
7009 int slot_id = dst.GetSlot();
7011
7012 if (quantity > stack_max)
7013 split_quantity_new = stack_max;
7014 else
7015 split_quantity_new = quantity;
7016
7018 {
7020
7021 if (new_item)
7022 {
7023 new_item.SetResultOfSplit(true);
7024 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7026 new_item.
SetQuantity(split_quantity_new,
false,
true);
7027 }
7028
7029 return new_item;
7030 }
7031 }
7032
7033 return null;
7034 }
7035
7037 {
7039 float split_quantity_new;
7041 if (destination_entity)
7042 {
7044 if (quantity > stackable)
7045 split_quantity_new = stackable;
7046 else
7047 split_quantity_new = quantity;
7048
7050 {
7051 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7052 if (new_item)
7053 {
7054 new_item.SetResultOfSplit(true);
7055 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7057 new_item.
SetQuantity(split_quantity_new,
false,
true);
7058 }
7059 }
7060 }
7061 }
7062
7064 {
7066 {
7067 if (ScriptInputUserData.CanStoreInputUserData())
7068 {
7069 ScriptInputUserData ctx = new ScriptInputUserData;
7074 ItemBase destination_entity =
this;
7075 ctx.
Write(destination_entity);
7079 }
7080 }
7081 else if (!
GetGame().IsMultiplayer())
7082 {
7084 }
7085 }
7086
7088 {
7090 float split_quantity_new;
7092 if (player)
7093 {
7095 if (quantity > stackable)
7096 split_quantity_new = stackable;
7097 else
7098 split_quantity_new = quantity;
7099
7101 {
7102 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7103 new_item =
ItemBase.Cast(in_hands);
7104 if (new_item)
7105 {
7106 new_item.SetResultOfSplit(true);
7107 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7109 new_item.SetQuantity(split_quantity_new, false, true);
7110 }
7111 }
7112 }
7113 }
7114
7116 {
7118 float split_quantity_new = Math.Floor(quantity * 0.5);
7119
7121 return;
7122
7124
7125 if (new_item)
7126 {
7127 if (new_item.GetQuantityMax() < split_quantity_new)
7128 {
7129 split_quantity_new = new_item.GetQuantityMax();
7130 }
7131
7132 new_item.SetResultOfSplit(true);
7133 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7134
7136 {
7139 }
7140 else
7141 {
7143 new_item.
SetQuantity(split_quantity_new,
false,
true);
7144 }
7145 }
7146 }
7147
7149 {
7151 float split_quantity_new = Math.Floor(quantity / 2);
7152
7154 return;
7155
7156 InventoryLocation invloc = new InventoryLocation;
7158
7160 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7161
7162 if (new_item)
7163 {
7164 if (new_item.GetQuantityMax() < split_quantity_new)
7165 {
7166 split_quantity_new = new_item.GetQuantityMax();
7167 }
7169 {
7172 }
7173 else if (split_quantity_new > 1)
7174 {
7176 new_item.
SetQuantity(split_quantity_new,
false,
true);
7177 }
7178 }
7179 }
7180
7183 {
7184 SetWeightDirty();
7186
7187 if (parent)
7188 parent.OnAttachmentQuantityChangedEx(this, delta);
7189
7191 {
7193 {
7195 }
7197 {
7198 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7200 }
7201 }
7202
7203 }
7204
7207 {
7208
7209 }
7210
7213 {
7215 }
7216
7218 {
7219 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7220
7222 {
7223 if (newLevel == GameConstants.STATE_RUINED)
7224 {
7226 EntityAI parent = GetHierarchyParent();
7227 if (parent && parent.IsFireplace())
7228 {
7229 CargoBase cargo = GetInventory().GetCargo();
7230 if (cargo)
7231 {
7233 {
7235 }
7236 }
7237 }
7238 }
7239
7241 {
7242
7244 return;
7245 }
7246
7247 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7248 {
7250 }
7251 }
7252 }
7253
7254
7256 {
7257 super.OnRightClick();
7258
7260 {
7262 {
7263 if (ScriptInputUserData.CanStoreInputUserData())
7264 {
7265 EntityAI root = GetHierarchyRoot();
7266 Man playerOwner = GetHierarchyRootPlayer();
7267 InventoryLocation dst = new InventoryLocation;
7268
7269
7270 if (!playerOwner && root && root == this)
7271 {
7273 }
7274 else
7275 {
7276
7277 GetInventory().GetCurrentInventoryLocation(dst);
7279 {
7282 {
7284 }
7285 else
7286 {
7288
7289
7290 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7291 {
7293 }
7294 else
7295 {
7296 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7297 }
7298 }
7299 }
7300 }
7301
7302 ScriptInputUserData ctx = new ScriptInputUserData;
7310 }
7311 }
7312 else if (!
GetGame().IsMultiplayer())
7313 {
7315 }
7316 }
7317 }
7318
7320 {
7321 if (root)
7322 {
7323 vector m4[4];
7324 root.GetTransform(m4);
7325 dst.SetGround(this, m4);
7326 }
7327 else
7328 {
7329 GetInventory().GetCurrentInventoryLocation(dst);
7330 }
7331 }
7332
7333 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7334 {
7335
7336 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7337 return false;
7338
7339 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7340 return false;
7341
7342
7344 return false;
7345
7346
7347 Magazine mag = Magazine.Cast(this);
7348 if (mag)
7349 {
7350 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7351 return false;
7352
7353 if (stack_max_limit)
7354 {
7355 Magazine other_mag = Magazine.Cast(other_item);
7356 if (other_item)
7357 {
7358 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7359 return false;
7360 }
7361
7362 }
7363 }
7364 else
7365 {
7366
7368 return false;
7369
7371 return false;
7372 }
7373
7374 PlayerBase player = null;
7375 if (CastTo(player, GetHierarchyRootPlayer()))
7376 {
7377 if (player.GetInventory().HasAttachment(this))
7378 return false;
7379
7380 if (player.IsItemsToDelete())
7381 return false;
7382 }
7383
7384 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7385 return false;
7386
7387 int slotID;
7389 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7390 return false;
7391
7392 return true;
7393 }
7394
7396 {
7398 }
7399
7401 {
7402 return m_IsResultOfSplit;
7403 }
7404
7406 {
7407 m_IsResultOfSplit = value;
7408 }
7409
7411 {
7413 }
7414
7416 {
7417 float other_item_quantity = other_item.GetQuantity();
7418 float this_free_space;
7419
7421
7423
7424 if (other_item_quantity > this_free_space)
7425 {
7426 return this_free_space;
7427 }
7428 else
7429 {
7430 return other_item_quantity;
7431 }
7432 }
7433
7435 {
7437 }
7438
7440 {
7442 return;
7443
7444 if (!IsMagazine() && other_item)
7445 {
7447 if (quantity_used != 0)
7448 {
7449 float hp1 = GetHealth01("","");
7450 float hp2 = other_item.GetHealth01("","");
7451 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7452 hpResult = hpResult / (
GetQuantity() + quantity_used);
7453
7454 hpResult *= GetMaxHealth();
7455 Math.Round(hpResult);
7456 SetHealth("", "Health", hpResult);
7457
7459 other_item.AddQuantity(-quantity_used);
7460 }
7461 }
7463 }
7464
7466 {
7467 #ifdef SERVER
7468 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7469 GetHierarchyParent().IncreaseLifetimeUp();
7470 #endif
7471 };
7472
7474 {
7475 PlayerBase p = PlayerBase.Cast(player);
7476
7477 array<int> recipesIds = p.m_Recipes;
7478 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7479 if (moduleRecipesManager)
7480 {
7481 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
7482 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7483 }
7484
7485 for (int i = 0;i < recipesIds.Count(); i++)
7486 {
7487 int key = recipesIds.Get(i);
7488 string recipeName = moduleRecipesManager.GetRecipeName(key);
7490 }
7491 }
7492
7493
7494 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7495 {
7496 super.GetDebugActions(outputList);
7497
7498
7504
7505
7510
7515
7516
7520
7521
7523 {
7527 }
7528
7531
7532
7536
7538
7539 InventoryLocation loc = new InventoryLocation();
7540 GetInventory().GetCurrentInventoryLocation(loc);
7542 {
7543 if (Gizmo_IsSupported())
7546 }
7547
7549 }
7550
7551
7552
7553
7555 {
7556 super.OnAction(action_id, player, ctx);
7557
7559 {
7560 switch (action_id)
7561 {
7564 return true;
7567 return true;
7568 }
7569 }
7570
7572 {
7573 switch (action_id)
7574 {
7576 Delete();
7577 return true;
7578 }
7579 }
7580
7581 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
7582 {
7583 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7584 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
7585 PlayerBase p = PlayerBase.Cast(player);
7586 if (
EActions.RECIPES_RANGE_START < 1000)
7587 {
7588 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7589 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7590 }
7591 }
7592 #ifndef SERVER
7593 else if (action_id ==
EActions.WATCH_PLAYER)
7594 {
7595 PluginDeveloper.SetDeveloperItemClientEx(player);
7596 }
7597 #endif
7599 {
7600 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7601 {
7602 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7603 OnDebugButtonPressServer(id + 1);
7604 }
7605
7606 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7607 {
7608 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
7610 }
7611
7612 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
7613 {
7614 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
7616 }
7617
7618 else if (action_id ==
EActions.ADD_QUANTITY)
7619 {
7620 if (IsMagazine())
7621 {
7622 Magazine mag = Magazine.Cast(this);
7623 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
7624 }
7625 else
7626 {
7628 }
7629
7630 if (m_EM)
7631 {
7632 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
7633 }
7634
7635 }
7636
7637 else if (action_id ==
EActions.REMOVE_QUANTITY)
7638 {
7639 if (IsMagazine())
7640 {
7641 Magazine mag2 = Magazine.Cast(this);
7642 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
7643 }
7644 else
7645 {
7647 }
7648 if (m_EM)
7649 {
7650 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
7651 }
7652
7653 }
7654
7655 else if (action_id ==
EActions.SET_QUANTITY_0)
7656 {
7658
7659 if (m_EM)
7660 {
7661 m_EM.SetEnergy(0);
7662 }
7663 }
7664
7665 else if (action_id ==
EActions.SET_MAX_QUANTITY)
7666 {
7668
7669 if (m_EM)
7670 {
7671 m_EM.SetEnergy(m_EM.GetEnergyMax());
7672 }
7673 }
7674
7675 else if (action_id ==
EActions.ADD_HEALTH)
7676 {
7677 AddHealth("","",GetMaxHealth("","Health")/5);
7678 }
7679 else if (action_id ==
EActions.REMOVE_HEALTH)
7680 {
7681 AddHealth("","",-GetMaxHealth("","Health")/5);
7682 }
7683 else if (action_id ==
EActions.DESTROY_HEALTH)
7684 {
7685 SetHealth01("","",0);
7686 }
7687 else if (action_id ==
EActions.WATCH_ITEM)
7688 {
7690 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
7691 #ifdef DEVELOPER
7692 SetDebugDeveloper_item(this);
7693 #endif
7694 }
7695
7696 else if (action_id ==
EActions.ADD_TEMPERATURE)
7697 {
7698 AddTemperature(20);
7699
7700 }
7701
7702 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
7703 {
7704 AddTemperature(-20);
7705
7706 }
7707
7708 else if (action_id ==
EActions.FLIP_FROZEN)
7709 {
7710 SetFrozen(!GetIsFrozen());
7711
7712 }
7713
7714 else if (action_id ==
EActions.ADD_WETNESS)
7715 {
7717
7718 }
7719
7720 else if (action_id ==
EActions.REMOVE_WETNESS)
7721 {
7723
7724 }
7725
7726 else if (action_id ==
EActions.LIQUIDTYPE_UP)
7727 {
7730
7731
7732 }
7733
7734 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
7735 {
7738 }
7739
7740 else if (action_id ==
EActions.MAKE_SPECIAL)
7741 {
7742 auto debugParams = DebugSpawnParams.WithPlayer(player);
7743 OnDebugSpawnEx(debugParams);
7744 }
7745
7746 }
7747
7748
7749 return false;
7750 }
7751
7752
7753
7754
7758
7761
7762
7763
7765 {
7766 return false;
7767 }
7768
7769
7771 {
7772 return true;
7773 }
7774
7775
7777 {
7778 return true;
7779 }
7780
7781
7782
7784 {
7785 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
7787 }
7788
7791 {
7792 return null;
7793 }
7794
7796 {
7797 return false;
7798 }
7799
7801 {
7802 return false;
7803 }
7804
7808
7809
7811 {
7812 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7813 return module_repairing.CanRepair(this, item_repair_kit);
7814 }
7815
7816
7817 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
7818 {
7819 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7820 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
7821 }
7822
7823
7825 {
7826
7827
7828
7829
7830
7831
7832
7833
7834 return 1;
7835 }
7836
7837
7838
7840 {
7842 }
7843
7844
7845
7847 {
7849 }
7850
7851
7860 {
7861 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7862
7863 if (player)
7864 {
7865 player.MessageStatus(text);
7866 }
7867 }
7868
7869
7878 {
7879 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7880
7881 if (player)
7882 {
7883 player.MessageAction(text);
7884 }
7885 }
7886
7887
7896 {
7897 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7898
7899 if (player)
7900 {
7901 player.MessageFriendly(text);
7902 }
7903 }
7904
7905
7914 {
7915 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7916
7917 if (player)
7918 {
7919 player.MessageImportant(text);
7920 }
7921 }
7922
7924 {
7925 return true;
7926 }
7927
7928
7929 override bool KindOf(
string tag)
7930 {
7931 bool found = false;
7932 string item_name = this.
GetType();
7935
7936 int array_size = item_tag_array.Count();
7937 for (int i = 0; i < array_size; i++)
7938 {
7939 if (item_tag_array.Get(i) == tag)
7940 {
7941 found = true;
7942 break;
7943 }
7944 }
7945 return found;
7946 }
7947
7948
7950 {
7951
7952 super.OnRPC(sender, rpc_type,ctx);
7953
7954
7955 switch (rpc_type)
7956 {
7957 #ifndef SERVER
7958 case ERPCs.RPC_SOUND_LOCK_ATTACH:
7959 Param2<bool, string> p = new Param2<bool, string>(false, "");
7960
7962 return;
7963
7964 bool play = p.param1;
7965 string soundSet = p.param2;
7966
7967 if (play)
7968 {
7970 {
7972 {
7974 }
7975 }
7976 else
7977 {
7979 }
7980 }
7981 else
7982 {
7984 }
7985
7986 break;
7987 #endif
7988
7989 }
7990
7992 {
7994 }
7995 }
7996
7997
7998
7999
8001 {
8002 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8003 return plugin.GetID(
name);
8004 }
8005
8007 {
8008 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8009 return plugin.GetName(id);
8010 }
8011
8014 {
8015
8016
8017 int varFlags;
8018 if (!ctx.
Read(varFlags))
8019 return;
8020
8021 if (varFlags & ItemVariableFlags.FLOAT)
8022 {
8024 }
8025 }
8026
8028 {
8029
8030 super.SerializeNumericalVars(floats_out);
8031
8032
8033
8035 {
8037 }
8038
8040 {
8042 }
8043
8045 {
8047 }
8048
8050 {
8055 }
8056
8058 {
8060 }
8061 }
8062
8064 {
8065
8066 super.DeSerializeNumericalVars(floats);
8067
8068
8069 int index = 0;
8070 int mask = Math.Round(floats.Get(index));
8071
8072 index++;
8073
8075 {
8077 {
8079 }
8080 else
8081 {
8082 float quantity = floats.Get(index);
8084 }
8085 index++;
8086 }
8087
8089 {
8090 float wet = floats.Get(index);
8092 index++;
8093 }
8094
8096 {
8097 int liquidtype = Math.Round(floats.Get(index));
8099 index++;
8100 }
8101
8103 {
8105 index++;
8107 index++;
8109 index++;
8111 index++;
8112 }
8113
8115 {
8116 int cleanness = Math.Round(floats.Get(index));
8118 index++;
8119 }
8120 }
8121
8123 {
8124 super.WriteVarsToCTX(ctx);
8125
8126
8128 {
8130 }
8131
8133 {
8135 }
8136
8138 {
8140 }
8141
8143 {
8144 int r,g,b,a;
8150 }
8151
8153 {
8155 }
8156 }
8157
8159 {
8160 if (!super.ReadVarsFromCTX(ctx,version))
8161 return false;
8162
8163 int intValue;
8164 float value;
8165
8166 if (version < 140)
8167 {
8168 if (!ctx.
Read(intValue))
8169 return false;
8170
8171 m_VariablesMask = intValue;
8172 }
8173
8175 {
8176 if (!ctx.
Read(value))
8177 return false;
8178
8180 {
8182 }
8183 else
8184 {
8186 }
8187 }
8188
8189 if (version < 140)
8190 {
8192 {
8193 if (!ctx.
Read(value))
8194 return false;
8195 SetTemperatureDirect(value);
8196 }
8197 }
8198
8200 {
8201 if (!ctx.
Read(value))
8202 return false;
8204 }
8205
8207 {
8208 if (!ctx.
Read(intValue))
8209 return false;
8211 }
8212
8214 {
8215 int r,g,b,a;
8217 return false;
8219 return false;
8221 return false;
8223 return false;
8224
8226 }
8227
8229 {
8230 if (!ctx.
Read(intValue))
8231 return false;
8233 }
8234
8235 if (version >= 138 && version < 140)
8236 {
8238 {
8239 if (!ctx.
Read(intValue))
8240 return false;
8241 SetFrozen(intValue);
8242 }
8243 }
8244
8245 return true;
8246 }
8247
8248
8250 {
8253 {
8255 }
8256
8257 if (!super.OnStoreLoad(ctx, version))
8258 {
8260 return false;
8261 }
8262
8263 if (version >= 114)
8264 {
8265 bool hasQuickBarIndexSaved;
8266
8267 if (!ctx.
Read(hasQuickBarIndexSaved))
8268 {
8270 return false;
8271 }
8272
8273 if (hasQuickBarIndexSaved)
8274 {
8275 int itmQBIndex;
8276
8277
8278 if (!ctx.
Read(itmQBIndex))
8279 {
8281 return false;
8282 }
8283
8284 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8285 if (itmQBIndex != -1 && parentPlayer)
8286 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8287 }
8288 }
8289 else
8290 {
8291
8292 PlayerBase player;
8293 int itemQBIndex;
8294 if (version ==
int.
MAX)
8295 {
8296 if (!ctx.
Read(itemQBIndex))
8297 {
8299 return false;
8300 }
8301 }
8302 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8303 {
8304
8305 if (!ctx.
Read(itemQBIndex))
8306 {
8308 return false;
8309 }
8310 if (itemQBIndex != -1 && player)
8311 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8312 }
8313 }
8314
8315 if (version < 140)
8316 {
8317
8318 if (!LoadVariables(ctx, version))
8319 {
8321 return false;
8322 }
8323 }
8324
8325
8327 {
8329 return false;
8330 }
8331 if (version >= 132)
8332 {
8334 if (raib)
8335 {
8337 {
8339 return false;
8340 }
8341 }
8342 }
8343
8345 return true;
8346 }
8347
8348
8349
8351 {
8352 super.OnStoreSave(ctx);
8353
8354 PlayerBase player;
8355 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8356 {
8358
8359 int itemQBIndex = -1;
8360 itemQBIndex = player.FindQuickBarEntityIndex(this);
8361 ctx.
Write(itemQBIndex);
8362 }
8363 else
8364 {
8366 }
8367
8369
8371 if (raib)
8372 {
8374 }
8375 }
8376
8377
8379 {
8380 super.AfterStoreLoad();
8381
8383 {
8385 }
8386
8388 {
8391 }
8392 }
8393
8395 {
8396 super.EEOnAfterLoad();
8397
8399 {
8401 }
8402
8405 }
8406
8408 {
8409 return false;
8410 }
8411
8412
8413
8415 {
8417 {
8418 #ifdef PLATFORM_CONSOLE
8419
8421 {
8423 if (menu)
8424 {
8426 }
8427 }
8428 #endif
8429 }
8430
8432 {
8435 }
8436
8438 {
8439 SetWeightDirty();
8441 }
8443 {
8446 }
8447
8449 {
8452 }
8454 {
8457 }
8458
8459 super.OnVariablesSynchronized();
8460 }
8461
8462
8463
8465 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8466 {
8467 if (!IsServerCheck(allow_client))
8468 return false;
8469
8471 return false;
8472
8475
8476 if (value <= (min + 0.001))
8477 value = min;
8478
8479 if (value == min)
8480 {
8481 if (destroy_config)
8482 {
8483 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8484 if (dstr)
8485 {
8487 this.Delete();
8488 return true;
8489 }
8490 }
8491 else if (destroy_forced)
8492 {
8494 this.Delete();
8495 return true;
8496 }
8497
8499 }
8500
8503
8505 {
8507
8508 if (delta)
8510 }
8511
8513
8514 return false;
8515 }
8516
8517
8519 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8520 {
8522 }
8523
8525 {
8528 }
8529
8531 {
8534 }
8535
8537 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8538 {
8539 float value_clamped = Math.Clamp(value, 0, 1);
8541 SetQuantity(result, destroy_config, destroy_forced);
8542 }
8543
8544
8547 {
8549 }
8550
8552 {
8554 }
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8566 {
8567 int slot = -1;
8568 if (GetInventory())
8569 {
8570 InventoryLocation il = new InventoryLocation;
8571 GetInventory().GetCurrentInventoryLocation(il);
8573 }
8574
8576 }
8577
8579 {
8580 float quantity_max = 0;
8581
8583 {
8584 if (attSlotID != -1)
8585 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8586
8587 if (quantity_max <= 0)
8589 }
8590
8591 if (quantity_max <= 0)
8593
8594 return quantity_max;
8595 }
8596
8598 {
8600 }
8601
8603 {
8605 }
8606
8607
8609 {
8611 }
8612
8614 {
8616 }
8617
8619 {
8621 }
8622
8623
8625 {
8626
8627 float weightEx = GetWeightEx();
8628 float special = GetInventoryAndCargoWeight();
8629 return weightEx - special;
8630 }
8631
8632
8634 {
8636 }
8637
8639 {
8641 {
8642 #ifdef DEVELOPER
8643 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8644 {
8645 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
8647 }
8648 #endif
8649
8651 }
8652 else if (HasEnergyManager())
8653 {
8654 #ifdef DEVELOPER
8655 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8656 {
8657 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
8658 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
8659 }
8660 #endif
8661 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
8662 }
8663 else
8664 {
8665 #ifdef DEVELOPER
8666 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8667 {
8668 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
8669 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
8670 }
8671 #endif
8672 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
8673 }
8674 }
8675
8678 {
8679 int item_count = 0;
8681
8682 if (GetInventory().GetCargo() != NULL)
8683 {
8684 item_count = GetInventory().GetCargo().GetItemCount();
8685 }
8686
8687 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
8688 {
8689 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
8690 if (item)
8691 item_count += item.GetNumberOfItems();
8692 }
8693 return item_count;
8694 }
8695
8698 {
8699 float weight = 0;
8700 float wetness = 1;
8701 if (include_wetness)
8704 {
8705 weight = wetness * m_ConfigWeight;
8706 }
8708 {
8709 weight = 1;
8710 }
8711 return weight;
8712 }
8713
8714
8715
8717 {
8718 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
8719 {
8720 GameInventory inv = GetInventory();
8721 array<EntityAI> items = new array<EntityAI>;
8723 for (int i = 0; i < items.Count(); i++)
8724 {
8726 if (item)
8727 {
8729 }
8730 }
8731 }
8732 }
8733
8734
8735
8736
8738 {
8739 float energy = 0;
8740 if (HasEnergyManager())
8741 {
8742 energy = GetCompEM().GetEnergy();
8743 }
8744 return energy;
8745 }
8746
8747
8749 {
8750 super.OnEnergyConsumed();
8751
8753 }
8754
8756 {
8757 super.OnEnergyAdded();
8758
8760 }
8761
8762
8764 {
8765 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
8766 {
8768 {
8769 float energy_0to1 = GetCompEM().GetEnergy0To1();
8771 }
8772 }
8773 }
8774
8775
8777 {
8778 return ConfigGetFloat("heatIsolation");
8779 }
8780
8782 {
8784 }
8785
8787 {
8788 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
8789 if (
GetGame().ConfigIsExisting(paramPath))
8791
8792 return 0.0;
8793 }
8794
8796 {
8797 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
8798 if (
GetGame().ConfigIsExisting(paramPath))
8800
8801 return 0.0;
8802 }
8803
8804 override void SetWet(
float value,
bool allow_client =
false)
8805 {
8806 if (!IsServerCheck(allow_client))
8807 return;
8808
8811
8813
8814 m_VarWet = Math.Clamp(value, min, max);
8815
8817 {
8820 }
8821 }
8822
8823 override void AddWet(
float value)
8824 {
8826 }
8827
8829 {
8831 }
8832
8834 {
8836 }
8837
8839 {
8841 }
8842
8844 {
8846 }
8847
8849 {
8851 }
8852
8854 {
8857 if (newLevel != oldLevel)
8858 {
8860 }
8861 }
8862
8864 {
8865 SetWeightDirty();
8866 }
8867
8869 {
8870 return GetWetLevelInternal(
m_VarWet);
8871 }
8872
8873
8874
8876 {
8878 }
8879
8881 {
8883 }
8884
8886 {
8888 }
8889
8891 {
8893 }
8894
8895
8896
8898 {
8899 if (ConfigIsExisting("itemModelLength"))
8900 {
8901 return ConfigGetFloat("itemModelLength");
8902 }
8903 return 0;
8904 }
8905
8907 {
8908 if (ConfigIsExisting("itemAttachOffset"))
8909 {
8910 return ConfigGetFloat("itemAttachOffset");
8911 }
8912 return 0;
8913 }
8914
8915 override void SetCleanness(
int value,
bool allow_client =
false)
8916 {
8917 if (!IsServerCheck(allow_client))
8918 return;
8919
8921
8923
8926 }
8927
8929 {
8931 }
8932
8934 {
8935 return true;
8936 }
8937
8938
8939
8940
8942 {
8944 }
8945
8947 {
8949 }
8950
8951
8952
8953
8954 override void SetColor(
int r,
int g,
int b,
int a)
8955 {
8961 }
8963 override void GetColor(out
int r,out
int g,out
int b,out
int a)
8964 {
8969 }
8970
8972 {
8974 }
8975
8978 {
8979 int r,g,b,a;
8981 r = r/255;
8982 g = g/255;
8983 b = b/255;
8984 a = a/255;
8985 return MiscGameplayFunctions.GetColorString(r, g, b, a);
8986 }
8987
8988
8989
8990 override void SetLiquidType(
int value,
bool allow_client =
false)
8991 {
8992 if (!IsServerCheck(allow_client))
8993 return;
8994
8999 }
9000
9002 {
9003 return ConfigGetInt("varLiquidTypeInit");
9004 }
9005
9007 {
9009 }
9010
9012 {
9014 SetFrozen(false);
9015 }
9016
9019 {
9020 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9021 }
9022
9023
9026 {
9027 PlayerBase nplayer;
9028 if (PlayerBase.CastTo(nplayer, player))
9029 {
9031
9032 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9033 }
9034 }
9035
9036
9039 {
9040 PlayerBase nplayer;
9041 if (PlayerBase.CastTo(nplayer,player))
9042 {
9043
9044 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9045
9046 }
9047
9048
9049 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9050
9051
9052 if (HasEnergyManager())
9053 {
9054 GetCompEM().UpdatePlugState();
9055 }
9056 }
9057
9058
9060 {
9061 super.OnPlacementStarted(player);
9062
9064 }
9065
9066 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9067 {
9069 {
9070 m_AdminLog.OnPlacementComplete(player,
this);
9071 }
9072
9073 super.OnPlacementComplete(player, position, orientation);
9074 }
9075
9076
9077
9078
9079
9081 {
9083 {
9084 return true;
9085 }
9086 else
9087 {
9088 return false;
9089 }
9090 }
9091
9092
9094 {
9096 {
9098 }
9099 }
9100
9101
9103 {
9105 }
9106
9108 {
9110 }
9111
9112 override void InsertAgent(
int agent,
float count = 1)
9113 {
9114 if (count < 1)
9115 return;
9116
9118 }
9119
9122 {
9124 }
9125
9126
9128 {
9130 }
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9151
9152
9153
9154
9155
9156
9157
9158
9159
9160
9161
9162
9163
9164
9165
9166
9167
9168
9169
9170
9171
9172
9174 {
9176 return false;
9177 return true;
9178 }
9179
9181 {
9182
9184 }
9185
9186
9189 {
9190 super.CheckForRoofLimited(timeTresholdMS);
9191
9193 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9194 {
9195 m_PreviousRoofTestTime = time;
9196 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9197 }
9198 }
9199
9200
9202 {
9204 {
9205 return 0;
9206 }
9207
9208 if (GetInventory().GetAttachmentSlotsCount() != 0)
9209 {
9210 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9211 if (filter)
9212 return filter.GetProtectionLevel(type, false, system);
9213 else
9214 return 0;
9215 }
9216
9217 string subclassPath, entryName;
9218
9219 switch (type)
9220 {
9222 entryName = "biological";
9223 break;
9225 entryName = "chemical";
9226 break;
9227 default:
9228 entryName = "biological";
9229 break;
9230 }
9231
9232 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9233
9235 }
9236
9237
9238
9241 {
9242 if (!IsMagazine())
9244
9246 }
9247
9248
9249
9250
9251
9256 {
9257 return true;
9258 }
9259
9261 {
9263 }
9264
9265
9266
9267
9268
9270 {
9271 if (parent)
9272 {
9273 if (parent.IsInherited(DayZInfected))
9274 return true;
9275
9276 if (!parent.IsRuined())
9277 return true;
9278 }
9279
9280 return true;
9281 }
9282
9284 {
9285 if (!super.CanPutAsAttachment(parent))
9286 {
9287 return false;
9288 }
9289
9290 if (!IsRuined() && !parent.IsRuined())
9291 {
9292 return true;
9293 }
9294
9295 return false;
9296 }
9297
9299 {
9300
9301
9302
9303
9304 return super.CanReceiveItemIntoCargo(item);
9305 }
9306
9308 {
9309
9310
9311
9312
9313 GameInventory attachmentInv = attachment.GetInventory();
9315 {
9316 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9317 return false;
9318 }
9319
9320 InventoryLocation loc = new InventoryLocation();
9321 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9322 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9323 return false;
9324
9325 return super.CanReceiveAttachment(attachment, slotId);
9326 }
9327
9329 {
9330 if (!super.CanReleaseAttachment(attachment))
9331 return false;
9332
9333 return GetInventory().AreChildrenAccessible();
9334 }
9335
9336
9337
9338
9339
9340
9341
9342
9343
9344
9345
9346
9347
9348
9349
9350
9351
9352
9353
9354
9355
9357 {
9358 int id = muzzle_owner.GetMuzzleID();
9359 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9360
9361 if (WPOF_array)
9362 {
9363 for (int i = 0; i < WPOF_array.Count(); i++)
9364 {
9365 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9366
9367 if (WPOF)
9368 {
9369 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9370 }
9371 }
9372 }
9373 }
9374
9375
9377 {
9378 int id = muzzle_owner.GetMuzzleID();
9380
9381 if (WPOBE_array)
9382 {
9383 for (int i = 0; i < WPOBE_array.Count(); i++)
9384 {
9385 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9386
9387 if (WPOBE)
9388 {
9389 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9390 }
9391 }
9392 }
9393 }
9394
9395
9397 {
9398 int id = muzzle_owner.GetMuzzleID();
9399 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9400
9401 if (WPOOH_array)
9402 {
9403 for (int i = 0; i < WPOOH_array.Count(); i++)
9404 {
9405 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9406
9407 if (WPOOH)
9408 {
9409 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9410 }
9411 }
9412 }
9413 }
9414
9415
9417 {
9418 int id = muzzle_owner.GetMuzzleID();
9419 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9420
9421 if (WPOOH_array)
9422 {
9423 for (int i = 0; i < WPOOH_array.Count(); i++)
9424 {
9425 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9426
9427 if (WPOOH)
9428 {
9429 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9430 }
9431 }
9432 }
9433 }
9434
9435
9437 {
9438 int id = muzzle_owner.GetMuzzleID();
9439 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9440
9441 if (WPOOH_array)
9442 {
9443 for (int i = 0; i < WPOOH_array.Count(); i++)
9444 {
9445 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9446
9447 if (WPOOH)
9448 {
9449 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9450 }
9451 }
9452 }
9453 }
9454
9455
9456
9458 {
9460 {
9461 return true;
9462 }
9463
9464 return false;
9465 }
9466
9468 {
9470 {
9471 return true;
9472 }
9473
9474 return false;
9475 }
9476
9478 {
9480 {
9481 return true;
9482 }
9483
9484 return false;
9485 }
9486
9488 {
9489 return false;
9490 }
9491
9494 {
9495 return UATimeSpent.DEFAULT_DEPLOY;
9496 }
9497
9498
9499
9500
9502 {
9504 SetSynchDirty();
9505 }
9506
9508 {
9510 }
9511
9512
9514 {
9515 return false;
9516 }
9517
9520 {
9521 string att_type = "None";
9522
9523 if (ConfigIsExisting("soundAttType"))
9524 {
9525 att_type = ConfigGetString("soundAttType");
9526 }
9527
9529 }
9530
9532 {
9534 }
9535
9536
9537
9538
9539
9545
9547 {
9550
9552 }
9553
9554
9556 {
9558 return;
9559
9561
9564
9567
9568 SoundParameters params = new SoundParameters();
9572 }
9573
9574
9576 {
9578 return;
9579
9581 SetSynchDirty();
9582
9585 }
9586
9587
9589 {
9591 return;
9592
9594 SetSynchDirty();
9595
9598 }
9599
9601 {
9603 }
9604
9606 {
9608 }
9609
9612 {
9613 if (!
GetGame().IsDedicatedServer())
9614 {
9615 if (ConfigIsExisting("attachSoundSet"))
9616 {
9617 string cfg_path = "";
9618 string soundset = "";
9620
9623 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
9624 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
9625
9626 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
9627 {
9628 for (int i = 0; i < cfg_soundset_array.Count(); i++)
9629 {
9630 if (cfg_slot_array[i] == slot_type)
9631 {
9632 soundset = cfg_soundset_array[i];
9633 break;
9634 }
9635 }
9636 }
9637
9638 if (soundset != "")
9639 {
9640 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
9642 }
9643 }
9644 }
9645 }
9646
9648 {
9649
9650 }
9651
9652 void OnApply(PlayerBase player);
9653
9655 {
9656 return 1.0;
9657 };
9658
9660 {
9662 }
9663
9665 {
9667 }
9668
9670
9672 {
9673 SetDynamicPhysicsLifeTime(0.01);
9675 }
9676
9678 {
9679 array<string> zone_names = new array<string>;
9680 GetDamageZones(zone_names);
9681 for (int i = 0; i < zone_names.Count(); i++)
9682 {
9683 SetHealthMax(zone_names.Get(i),"Health");
9684 }
9685 SetHealthMax("","Health");
9686 }
9687
9690 {
9691 float global_health = GetHealth01("","Health");
9692 array<string> zones = new array<string>;
9693 GetDamageZones(zones);
9694
9695 for (int i = 0; i < zones.Count(); i++)
9696 {
9697 SetHealth01(zones.Get(i),"Health",global_health);
9698 }
9699 }
9700
9703 {
9704 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
9705 }
9706
9708 {
9709 if (!hasRootAsPlayer)
9710 {
9711 if (refParentIB)
9712 {
9713
9714 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
9715 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
9716
9717 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
9718 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
9719
9722 }
9723 else
9724 {
9725
9728 }
9729 }
9730 }
9731
9733 {
9735 {
9736 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
9737 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
9738 {
9739 float heatPermCoef = 1.0;
9741 while (ent)
9742 {
9743 heatPermCoef *= ent.GetHeatPermeabilityCoef();
9744 ent = ent.GetHierarchyParent();
9745 }
9746
9747 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
9748 }
9749 }
9750 }
9751
9753 {
9754
9755 EntityAI parent = GetHierarchyParent();
9756 if (!parent)
9757 {
9758 hasParent = false;
9759 hasRootAsPlayer = false;
9760 }
9761 else
9762 {
9763 hasParent = true;
9764 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
9765 refParentIB =
ItemBase.Cast(parent);
9766 }
9767 }
9768
9769 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
9770 {
9771
9772 }
9773
9775 {
9776
9777 return false;
9778 }
9779
9781 {
9782
9783
9784 return false;
9785 }
9786
9788 {
9789
9790 return false;
9791 }
9792
9795 {
9796 return !GetIsFrozen() &&
IsOpen();
9797 }
9798
9800 {
9801 bool hasParent = false, hasRootAsPlayer = false;
9803
9804 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
9805 bool foodDecay =
g_Game.IsFoodDecayEnabled();
9806
9807 if (wwtu || foodDecay)
9808 {
9812
9813 if (processWetness || processTemperature || processDecay)
9814 {
9816
9817 if (processWetness)
9818 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
9819
9820 if (processTemperature)
9822
9823 if (processDecay)
9824 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
9825 }
9826 }
9827 }
9828
9831 {
9833 }
9834
9836 {
9839
9840 return super.GetTemperatureFreezeThreshold();
9841 }
9842
9844 {
9847
9848 return super.GetTemperatureThawThreshold();
9849 }
9850
9852 {
9855
9856 return super.GetItemOverheatThreshold();
9857 }
9858
9860 {
9862 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
9863
9864 return super.GetTemperatureFreezeTime();
9865 }
9866
9868 {
9870 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
9871
9872 return super.GetTemperatureThawTime();
9873 }
9874
9879
9881 {
9882 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
9883 }
9884
9886 {
9887 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
9888 }
9889
9892 {
9894 }
9895
9897 {
9899 }
9900
9902 {
9904 }
9905
9908 {
9909 return null;
9910 }
9911
9914 {
9915 return false;
9916 }
9917
9919 {
9921 {
9924 if (!trg)
9925 {
9927 explosive = this;
9928 }
9929
9930 explosive.PairRemote(trg);
9932
9933 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
9934 trg.SetPersistentPairID(persistentID);
9935 explosive.SetPersistentPairID(persistentID);
9936
9937 return true;
9938 }
9939 return false;
9940 }
9941
9944 {
9945 float ret = 1.0;
9948 ret *= GetHealth01();
9949
9950 return ret;
9951 }
9952
9953 #ifdef DEVELOPER
9954 override void SetDebugItem()
9955 {
9956 super.SetDebugItem();
9957 _itemBase = this;
9958 }
9959
9961 {
9962 string text = super.GetDebugText();
9963
9965 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
9966
9967 return text;
9968 }
9969 #endif
9970
9972 {
9973 return true;
9974 }
9975
9977
9979
9981 {
9984 }
9985
9986
9994
10010}
10011
10013{
10015 if (entity)
10016 {
10017 bool is_item = entity.IsInherited(
ItemBase);
10018 if (is_item && full_quantity)
10019 {
10022 }
10023 }
10024 else
10025 {
10027 return NULL;
10028 }
10029 return entity;
10030}
10031
10033{
10034 if (item)
10035 {
10036 if (health > 0)
10037 item.SetHealth("", "", health);
10038
10039 if (item.CanHaveTemperature())
10040 {
10042 if (item.CanFreeze())
10043 item.SetFrozen(false);
10044 }
10045
10046 if (item.HasEnergyManager())
10047 {
10048 if (quantity >= 0)
10049 {
10050 item.GetCompEM().SetEnergy0To1(quantity);
10051 }
10052 else
10053 {
10055 }
10056 }
10057 else if (item.IsMagazine())
10058 {
10059 Magazine mag = Magazine.Cast(item);
10060 if (quantity >= 0)
10061 {
10062 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10063 }
10064 else
10065 {
10067 }
10068
10069 }
10070 else
10071 {
10072 if (quantity >= 0)
10073 {
10074 item.SetQuantityNormalized(quantity, false);
10075 }
10076 else
10077 {
10079 }
10080
10081 }
10082 }
10083}
10084
10085#ifdef DEVELOPER
10087#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.