5140{
5142 {
5143 return true;
5144 }
5145};
5146
5147
5148
5150{
5154
5156
5159
5160
5161
5162
5163
5172
5178
5183
5188
5209 protected bool m_IsResultOfSplit
5210
5212
5217
5218
5219
5221
5225
5226
5227
5229
5232
5233
5234
5240
5241
5249
5252
5253
5255
5256
5258
5259
5264
5265
5270
5271
5273
5274
5276 {
5281
5282 if (!
GetGame().IsDedicatedServer())
5283 {
5285 {
5287
5289 {
5291 }
5292 }
5293
5296 }
5297
5298 m_OldLocation = null;
5299
5301 {
5303 }
5304
5305 if (ConfigIsExisting("headSelectionsToHide"))
5306 {
5309 }
5310
5312 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5313 {
5315 }
5316
5318
5319 m_IsResultOfSplit = false;
5320
5322 }
5323
5325 {
5326 super.InitItemVariables();
5327
5333 m_Count = ConfigGetInt(
"count");
5334
5337
5342
5345
5350
5362
5366
5367
5370 if (ConfigIsExisting("canBeSplit"))
5371 {
5374 }
5375
5377 if (ConfigIsExisting("itemBehaviour"))
5379
5380
5383 RegisterNetSyncVariableInt("m_VarLiquidType");
5384 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5385
5386 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5387 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5388 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5389
5390 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5391 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5392 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5393 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5394
5395 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5396 RegisterNetSyncVariableBool("m_IsTakeable");
5397 RegisterNetSyncVariableBool("m_IsHologram");
5398
5401 {
5404 }
5405
5407
5409 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5411
5412 }
5413
5415 {
5417 }
5418
5420 {
5423 {
5428 }
5429 }
5430
5431 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5432 {
5434 {
5437 }
5438
5440 }
5441
5443 {
5449 }
5450
5452
5454 {
5456
5457 if (!action)
5458 {
5459 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5460 return;
5461 }
5462
5464 if (!ai)
5465 {
5467 return;
5468 }
5469
5471 if (!action_array)
5472 {
5473 action_array = new array<ActionBase_Basic>;
5475 }
5476 if (LogManager.IsActionLogEnable())
5477 {
5478 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5479 }
5480
5481 if (action_array.Find(action) != -1)
5482 {
5483 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5484 }
5485 else
5486 {
5487 action_array.Insert(action);
5488 }
5489 }
5490
5492 {
5494 ActionBase action = player.GetActionManager().GetAction(actionName);
5497
5498 if (action_array)
5499 {
5500 action_array.RemoveItem(action);
5501 }
5502 }
5503
5504
5505
5507 {
5508 ActionOverrideData overrideData = new ActionOverrideData();
5512
5514 if (!actionMap)
5515 {
5518 }
5519
5520 actionMap.Insert(this.
Type(), overrideData);
5521
5522 }
5523
5525
5527
5528
5530 {
5533
5536
5537 string config_to_search = "CfgVehicles";
5538 string muzzle_owner_config;
5539
5541 {
5542 if (IsInherited(Weapon))
5543 config_to_search = "CfgWeapons";
5544
5545 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5546
5547 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5548
5550
5551 if (config_OnFire_subclass_count > 0)
5552 {
5553 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5554
5555 for (int i = 0; i < config_OnFire_subclass_count; i++)
5556 {
5557 string particle_class = "";
5559 string config_OnFire_entry = config_OnFire_class + particle_class;
5560 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5561 WPOF_array.Insert(WPOF);
5562 }
5563
5564
5566 }
5567 }
5568
5570 {
5571 config_to_search = "CfgWeapons";
5572 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5573
5574 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5575
5577
5578 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
5579 {
5580 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
5581
5582 for (i = 0; i < config_OnBulletCasingEject_count; i++)
5583 {
5584 string particle_class2 = "";
5586 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
5587 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
5588 WPOBE_array.Insert(WPOBE);
5589 }
5590
5591
5593 }
5594 }
5595 }
5596
5597
5599 {
5602
5604 {
5605 string config_to_search = "CfgVehicles";
5606
5607 if (IsInherited(Weapon))
5608 config_to_search = "CfgWeapons";
5609
5610 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5611 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
5612
5613 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
5614 {
5615
5617
5619 {
5621 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
5623 return;
5624 }
5625
5628
5629
5630
5632 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
5633
5634 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
5635 {
5636 string particle_class = "";
5638 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
5640
5641 if (entry_type == CT_CLASS)
5642 {
5643 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
5644 WPOOH_array.Insert(WPOF);
5645 }
5646 }
5647
5648
5650 }
5651 }
5652 }
5653
5655 {
5657 }
5658
5660 {
5662 {
5664
5667
5670
5671 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5672 }
5673 }
5674
5676 {
5678 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5679
5681 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5682
5684 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5685
5687 {
5689 }
5690 }
5691
5693 {
5695 }
5696
5698 {
5701 else
5703
5705 {
5708 }
5709 else
5710 {
5713
5716 }
5717
5719 }
5720
5722 {
5724 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5725 }
5726
5728 {
5730 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5732 }
5733
5735 {
5737 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5738 }
5739
5741 {
5744
5745 OverheatingParticle OP = new OverheatingParticle();
5750
5752 }
5753
5755 {
5758
5759 return -1;
5760 }
5761
5763 {
5765 {
5768
5769 for (int i = count; i > 0; --i)
5770 {
5771 int id = i - 1;
5774
5777
5778 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
5779 {
5780 if (p)
5781 {
5784 }
5785 }
5786 }
5787 }
5788 }
5789
5791 {
5793 {
5795 {
5796 int id = i - 1;
5798
5799 if (OP)
5800 {
5802
5803 if (p)
5804 {
5806 }
5807
5808 delete OP;
5809 }
5810 }
5811
5814 }
5815 }
5816
5819 {
5820 return 0.0;
5821 }
5822
5823
5825 {
5826 return 250;
5827 }
5828
5830 {
5831 return 0;
5832 }
5833
5836 {
5838 return true;
5839
5840 return false;
5841 }
5842
5845 {
5848
5850 {
5852 }
5853 else
5854 {
5855
5857 }
5858
5860 }
5861
5868 {
5869 return -1;
5870 }
5871
5872
5873
5874
5876 {
5878 {
5880 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
5881
5882 if (r_index >= 0)
5883 {
5884 InventoryLocation r_il = new InventoryLocation;
5885 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
5886
5887 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
5890 {
5891 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
5892 }
5894 {
5895 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
5896 }
5897
5898 }
5899
5900 player.GetHumanInventory().ClearUserReservedLocation(this);
5901 }
5902
5905 }
5906
5907
5908
5909
5911 {
5912 return ItemBase.m_DebugActionsMask;
5913 }
5914
5916 {
5917 return ItemBase.m_DebugActionsMask & mask;
5918 }
5919
5921 {
5922 ItemBase.m_DebugActionsMask = mask;
5923 }
5924
5926 {
5927 ItemBase.m_DebugActionsMask |= mask;
5928 }
5929
5931 {
5932 ItemBase.m_DebugActionsMask &= ~mask;
5933 }
5934
5936 {
5938 {
5940 }
5941 else
5942 {
5944 }
5945 }
5946
5947
5949 {
5950 if (GetEconomyProfile())
5951 {
5952 float q_max = GetEconomyProfile().GetQuantityMax();
5953 if (q_max > 0)
5954 {
5955 float q_min = GetEconomyProfile().GetQuantityMin();
5956 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
5957
5959 {
5960 ComponentEnergyManager comp = GetCompEM();
5962 {
5964 }
5965 }
5967 {
5969
5970 }
5971
5972 }
5973 }
5974 }
5975
5978 {
5979 EntityAI parent = GetHierarchyParent();
5980
5981 if (parent)
5982 {
5983 InventoryLocation inventory_location_to_lock = new InventoryLocation;
5984 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
5985 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
5986 }
5987 }
5988
5991 {
5992 EntityAI parent = GetHierarchyParent();
5993
5994 if (parent)
5995 {
5996 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
5997 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
5998 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
5999 }
6000 }
6001
6003 {
6004
6005
6006
6007
6009
6011 {
6012 if (ScriptInputUserData.CanStoreInputUserData())
6013 {
6014 ScriptInputUserData ctx = new ScriptInputUserData;
6020 ctx.
Write(use_stack_max);
6023
6025 {
6026 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6027 }
6028 }
6029 }
6030 else if (!
GetGame().IsMultiplayer())
6031 {
6033 }
6034 }
6035
6037 {
6039 }
6040
6042 {
6044 }
6045
6047 {
6049 }
6050
6052 {
6053
6054 return false;
6055 }
6056
6058 {
6059 return false;
6060 }
6061
6065 {
6066 return false;
6067 }
6068
6070 {
6071 return "";
6072 }
6073
6075
6077 {
6078 return false;
6079 }
6080
6082 {
6083 return true;
6084 }
6085
6086
6087
6089 {
6090 return true;
6091 }
6092
6094 {
6095 return true;
6096 }
6097
6099 {
6100 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6102 }
6103
6105 {
6107 }
6108
6110 {
6112 if (!is_being_placed)
6114 SetSynchDirty();
6115 }
6116
6117
6119
6121 {
6123 }
6124
6126 {
6128 }
6129
6131 {
6132 return 1;
6133 }
6134
6136 {
6137 return false;
6138 }
6139
6141 {
6143 SetSynchDirty();
6144 }
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6181 {
6182 super.OnMovedInsideCargo(container);
6183
6184 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6185 }
6186
6187 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6188 {
6189 super.EEItemLocationChanged(oldLoc,newLoc);
6190
6191 PlayerBase new_player = null;
6192 PlayerBase old_player = null;
6193
6194 if (newLoc.GetParent())
6195 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6196
6197 if (oldLoc.GetParent())
6198 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6199
6201 {
6202 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6203
6204 if (r_index >= 0)
6205 {
6206 InventoryLocation r_il = new InventoryLocation;
6207 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6208
6209 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6212 {
6213 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6214 }
6216 {
6217 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6218 }
6219
6220 }
6221 }
6222
6224 {
6225 if (new_player)
6226 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6227
6228 if (new_player == old_player)
6229 {
6230
6231 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6232 {
6234 {
6235 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6236 {
6237 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6238 }
6239 }
6240 else
6241 {
6242 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6243 }
6244 }
6245
6246 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6247 {
6248 int type = oldLoc.GetType();
6250 {
6251 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6252 }
6254 {
6255 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6256 }
6257 }
6258 if (!m_OldLocation)
6259 {
6260 m_OldLocation = new InventoryLocation;
6261 }
6262 m_OldLocation.Copy(oldLoc);
6263 }
6264 else
6265 {
6266 if (m_OldLocation)
6267 {
6268 m_OldLocation.Reset();
6269 }
6270 }
6271
6273 }
6274 else
6275 {
6276 if (new_player)
6277 {
6278 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6279 if (res_index >= 0)
6280 {
6281 InventoryLocation il = new InventoryLocation;
6282 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6284 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6287 {
6288 il.
GetParent().GetOnReleaseLock().Invoke(it);
6289 }
6291 {
6293 }
6294
6295 }
6296 }
6298 {
6299
6301 }
6302
6303 if (m_OldLocation)
6304 {
6305 m_OldLocation.Reset();
6306 }
6307 }
6308 }
6309
6310 override void EOnContact(IEntity other, Contact extra)
6311 {
6313 {
6314 int liquidType = -1;
6316 if (impactSpeed > 0.0)
6317 {
6319 #ifndef SERVER
6321 #else
6323 SetSynchDirty();
6324 #endif
6326 }
6327 }
6328
6329 #ifdef SERVER
6330 if (GetCompEM() && GetCompEM().IsPlugged())
6331 {
6332 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6333 GetCompEM().UnplugThis();
6334 }
6335 #endif
6336 }
6337
6339
6341 {
6343 }
6344
6346 {
6347
6348 }
6349
6351 {
6352 super.OnItemLocationChanged(old_owner, new_owner);
6353
6354 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6355 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6356
6357 if (!relatedPlayer && playerNew)
6358 relatedPlayer = playerNew;
6359
6360 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6361 {
6363 if (actionMgr)
6364 {
6365 ActionBase currentAction = actionMgr.GetRunningAction();
6366 if (currentAction)
6368 }
6369 }
6370
6371 Man ownerPlayerOld = null;
6372 Man ownerPlayerNew = null;
6373
6374 if (old_owner)
6375 {
6376 if (old_owner.
IsMan())
6377 {
6378 ownerPlayerOld = Man.Cast(old_owner);
6379 }
6380 else
6381 {
6382 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6383 }
6384 }
6385 else
6386 {
6388 {
6390
6391 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6392 {
6393 GetCompEM().UnplugThis();
6394 }
6395 }
6396 }
6397
6398 if (new_owner)
6399 {
6400 if (new_owner.
IsMan())
6401 {
6402 ownerPlayerNew = Man.Cast(new_owner);
6403 }
6404 else
6405 {
6406 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6407 }
6408 }
6409
6410 if (ownerPlayerOld != ownerPlayerNew)
6411 {
6412 if (ownerPlayerOld)
6413 {
6414 array<EntityAI> subItemsExit = new array<EntityAI>;
6416 for (int i = 0; i < subItemsExit.Count(); i++)
6417 {
6420 }
6421 }
6422
6423 if (ownerPlayerNew)
6424 {
6425 array<EntityAI> subItemsEnter = new array<EntityAI>;
6427 for (int j = 0; j < subItemsEnter.Count(); j++)
6428 {
6431 }
6432 }
6433 }
6434 else if (ownerPlayerNew != null)
6435 {
6436 PlayerBase nplayer;
6437 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6438 {
6439 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6441 for (int k = 0; k < subItemsUpdate.Count(); k++)
6442 {
6444 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6445 }
6446 }
6447 }
6448
6449 if (old_owner)
6450 old_owner.OnChildItemRemoved(this);
6451 if (new_owner)
6452 new_owner.OnChildItemReceived(this);
6453 }
6454
6455
6457 {
6458 super.EEDelete(parent);
6459 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6460 if (player)
6461 {
6463
6464 if (player.IsAlive())
6465 {
6466 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6467 if (r_index >= 0)
6468 {
6469 InventoryLocation r_il = new InventoryLocation;
6470 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6471
6472 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6475 {
6476 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6477 }
6479 {
6480 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6481 }
6482
6483 }
6484
6485 player.RemoveQuickBarEntityShortcut(this);
6486 }
6487 }
6488 }
6489
6491 {
6492 super.EEKilled(killer);
6493
6496 {
6497 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6498 {
6499 if (IsMagazine())
6500 {
6501 if (Magazine.Cast(this).GetAmmoCount() > 0)
6502 {
6504 }
6505 }
6506 else
6507 {
6509 }
6510 }
6511 }
6512 }
6513
6515 {
6516 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6517
6518 super.OnWasAttached(parent, slot_id);
6519
6522
6524 }
6525
6527 {
6528 super.OnWasDetached(parent, slot_id);
6529
6532 }
6533
6535 {
6536 int idx;
6539
6540 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6541 if (inventory_slots.Count() < 1)
6542 {
6543 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6544 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6545 }
6546 else
6547 {
6548 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6549 }
6550
6551 idx = inventory_slots.Find(slot);
6552 if (idx < 0)
6553 return "";
6554
6555 return attach_types.Get(idx);
6556 }
6557
6559 {
6560 int idx = -1;
6561 string slot;
6562
6565
6566 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6567 if (inventory_slots.Count() < 1)
6568 {
6569 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6570 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6571 }
6572 else
6573 {
6574 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6575 if (detach_types.Count() < 1)
6576 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6577 }
6578
6579 for (int i = 0; i < inventory_slots.Count(); i++)
6580 {
6581 slot = inventory_slots.Get(i);
6582 }
6583
6584 if (slot != "")
6585 {
6586 if (detach_types.Count() == 1)
6587 idx = 0;
6588 else
6589 idx = inventory_slots.Find(slot);
6590 }
6591 if (idx < 0)
6592 return "";
6593
6594 return detach_types.Get(idx);
6595 }
6596
6598 {
6599
6601
6602
6603 float min_time = 1;
6604 float max_time = 3;
6605 float delay = Math.RandomFloat(min_time, max_time);
6606
6607 explode_timer.Run(delay, this, "DoAmmoExplosion");
6608 }
6609
6611 {
6612 Magazine magazine = Magazine.Cast(this);
6613 int pop_sounds_count = 6;
6614 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
6615
6616
6617 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
6618 string sound_name = pop_sounds[ sound_idx ];
6620
6621
6622 magazine.ServerAddAmmoCount(-1);
6623
6624
6625 float min_temp_to_explode = 100;
6626
6627 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
6628 {
6630 }
6631 }
6632
6633
6634 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
6635 {
6636 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
6637
6638 const int CHANCE_DAMAGE_CARGO = 4;
6639 const int CHANCE_DAMAGE_ATTACHMENT = 1;
6640 const int CHANCE_DAMAGE_NOTHING = 2;
6641
6643 {
6644 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
6645 int chances;
6646 int rnd;
6647
6648 if (GetInventory().GetCargo())
6649 {
6650 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6651 rnd = Math.RandomInt(0,chances);
6652
6653 if (rnd < CHANCE_DAMAGE_CARGO)
6654 {
6656 }
6657 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
6658 {
6660 }
6661 }
6662 else
6663 {
6664 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6665 rnd = Math.RandomInt(0,chances);
6666
6667 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
6668 {
6670 }
6671 }
6672 }
6673 }
6674
6676 {
6677 if (GetInventory().GetCargo())
6678 {
6679 int item_count = GetInventory().GetCargo().GetItemCount();
6680 if (item_count > 0)
6681 {
6682 int random_pick = Math.RandomInt(0, item_count);
6684 if (!item.IsExplosive())
6685 {
6686 item.AddHealth("","",damage);
6687 return true;
6688 }
6689 }
6690 }
6691 return false;
6692 }
6693
6695 {
6696 int attachment_count = GetInventory().AttachmentCount();
6697 if (attachment_count > 0)
6698 {
6699 int random_pick = Math.RandomInt(0, attachment_count);
6700 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
6701 if (!attachment.IsExplosive())
6702 {
6703 attachment.AddHealth("","",damage);
6704 return true;
6705 }
6706 }
6707 return false;
6708 }
6709
6711 {
6713 }
6714
6716 {
6718 return GetInventory().CanRemoveEntity();
6719
6720 return false;
6721 }
6722
6724 {
6725
6727 return false;
6728
6729
6731 return false;
6732
6733
6734
6736 if (delta == 0)
6737 return false;
6738
6739
6740 return true;
6741 }
6742
6744 {
6746 {
6747 if (ScriptInputUserData.CanStoreInputUserData())
6748 {
6749 ScriptInputUserData ctx = new ScriptInputUserData;
6754 ctx.
Write(destination_entity);
6758 }
6759 }
6760 else if (!
GetGame().IsMultiplayer())
6761 {
6763 }
6764 }
6765
6767 {
6768 float split_quantity_new;
6772 InventoryLocation loc = new InventoryLocation;
6773
6774 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6775 {
6777 split_quantity_new = stack_max;
6778 else
6780
6782 {
6783 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6784 if (new_item)
6785 {
6786 new_item.SetResultOfSplit(true);
6787 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6789 new_item.
SetQuantity(split_quantity_new,
false,
true);
6790 }
6791 }
6792 }
6793 else if (destination_entity && slot_id == -1)
6794 {
6795 if (quantity > stack_max)
6796 split_quantity_new = stack_max;
6797 else
6798 split_quantity_new = quantity;
6799
6801 {
6803 {
6806 }
6807
6808 if (new_item)
6809 {
6810 new_item.SetResultOfSplit(true);
6811 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6813 new_item.
SetQuantity(split_quantity_new,
false,
true);
6814 }
6815 }
6816 }
6817 else
6818 {
6819 if (stack_max != 0)
6820 {
6822 {
6824 }
6825
6826 if (split_quantity_new == 0)
6827 {
6828 if (!
GetGame().IsMultiplayer())
6829 player.PhysicalPredictiveDropItem(this);
6830 else
6831 player.ServerDropEntity(this);
6832 return;
6833 }
6834
6836 {
6838
6839 if (new_item)
6840 {
6841 new_item.SetResultOfSplit(true);
6842 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6845 new_item.PlaceOnSurface();
6846 }
6847 }
6848 }
6849 }
6850 }
6851
6853 {
6854 float split_quantity_new;
6858 InventoryLocation loc = new InventoryLocation;
6859
6860 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6861 {
6863 split_quantity_new = stack_max;
6864 else
6866
6868 {
6869 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6870 if (new_item)
6871 {
6872 new_item.SetResultOfSplit(true);
6873 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6875 new_item.
SetQuantity(split_quantity_new,
false,
true);
6876 }
6877 }
6878 }
6879 else if (destination_entity && slot_id == -1)
6880 {
6881 if (quantity > stack_max)
6882 split_quantity_new = stack_max;
6883 else
6884 split_quantity_new = quantity;
6885
6887 {
6889 {
6892 }
6893
6894 if (new_item)
6895 {
6896 new_item.SetResultOfSplit(true);
6897 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6899 new_item.
SetQuantity(split_quantity_new,
false,
true);
6900 }
6901 }
6902 }
6903 else
6904 {
6905 if (stack_max != 0)
6906 {
6908 {
6910 }
6911
6913 {
6915
6916 if (new_item)
6917 {
6918 new_item.SetResultOfSplit(true);
6919 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6922 new_item.PlaceOnSurface();
6923 }
6924 }
6925 }
6926 }
6927 }
6928
6930 {
6932 {
6933 if (ScriptInputUserData.CanStoreInputUserData())
6934 {
6935 ScriptInputUserData ctx = new ScriptInputUserData;
6940 dst.WriteToContext(ctx);
6942 }
6943 }
6944 else if (!
GetGame().IsMultiplayer())
6945 {
6947 }
6948 }
6949
6951 {
6953 {
6954 if (ScriptInputUserData.CanStoreInputUserData())
6955 {
6956 ScriptInputUserData ctx = new ScriptInputUserData;
6961 ctx.
Write(destination_entity);
6967 }
6968 }
6969 else if (!
GetGame().IsMultiplayer())
6970 {
6972 }
6973 }
6974
6976 {
6978 }
6979
6981 {
6983 float split_quantity_new;
6985 if (dst.IsValid())
6986 {
6987 int slot_id = dst.GetSlot();
6989
6990 if (quantity > stack_max)
6991 split_quantity_new = stack_max;
6992 else
6993 split_quantity_new = quantity;
6994
6996 {
6998
6999 if (new_item)
7000 {
7001 new_item.SetResultOfSplit(true);
7002 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7004 new_item.
SetQuantity(split_quantity_new,
false,
true);
7005 }
7006
7007 return new_item;
7008 }
7009 }
7010
7011 return null;
7012 }
7013
7015 {
7017 float split_quantity_new;
7019 if (destination_entity)
7020 {
7022 if (quantity > stackable)
7023 split_quantity_new = stackable;
7024 else
7025 split_quantity_new = quantity;
7026
7028 {
7029 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7030 if (new_item)
7031 {
7032 new_item.SetResultOfSplit(true);
7033 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7035 new_item.
SetQuantity(split_quantity_new,
false,
true);
7036 }
7037 }
7038 }
7039 }
7040
7042 {
7044 {
7045 if (ScriptInputUserData.CanStoreInputUserData())
7046 {
7047 ScriptInputUserData ctx = new ScriptInputUserData;
7052 ItemBase destination_entity =
this;
7053 ctx.
Write(destination_entity);
7057 }
7058 }
7059 else if (!
GetGame().IsMultiplayer())
7060 {
7062 }
7063 }
7064
7066 {
7068 float split_quantity_new;
7070 if (player)
7071 {
7073 if (quantity > stackable)
7074 split_quantity_new = stackable;
7075 else
7076 split_quantity_new = quantity;
7077
7079 {
7080 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7081 new_item =
ItemBase.Cast(in_hands);
7082 if (new_item)
7083 {
7084 new_item.SetResultOfSplit(true);
7085 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7087 new_item.SetQuantity(split_quantity_new, false, true);
7088 }
7089 }
7090 }
7091 }
7092
7094 {
7096 float split_quantity_new = Math.Floor(quantity * 0.5);
7097
7099 return;
7100
7102
7103 if (new_item)
7104 {
7105 if (new_item.GetQuantityMax() < split_quantity_new)
7106 {
7107 split_quantity_new = new_item.GetQuantityMax();
7108 }
7109
7110 new_item.SetResultOfSplit(true);
7111 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7112
7114 {
7117 }
7118 else
7119 {
7121 new_item.
SetQuantity(split_quantity_new,
false,
true);
7122 }
7123 }
7124 }
7125
7127 {
7129 float split_quantity_new = Math.Floor(quantity / 2);
7130
7132 return;
7133
7134 InventoryLocation invloc = new InventoryLocation;
7136
7138 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7139
7140 if (new_item)
7141 {
7142 if (new_item.GetQuantityMax() < split_quantity_new)
7143 {
7144 split_quantity_new = new_item.GetQuantityMax();
7145 }
7147 {
7150 }
7151 else if (split_quantity_new > 1)
7152 {
7154 new_item.
SetQuantity(split_quantity_new,
false,
true);
7155 }
7156 }
7157 }
7158
7161 {
7162 SetWeightDirty();
7164
7165 if (parent)
7166 parent.OnAttachmentQuantityChangedEx(this, delta);
7167
7169 {
7171 {
7173 }
7175 {
7176 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7178 }
7179 }
7180
7181 }
7182
7185 {
7186
7187 }
7188
7191 {
7193 }
7194
7196 {
7197 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7198
7200 {
7201 if (newLevel == GameConstants.STATE_RUINED)
7202 {
7204 EntityAI parent = GetHierarchyParent();
7205 if (parent && parent.IsFireplace())
7206 {
7207 CargoBase cargo = GetInventory().GetCargo();
7208 if (cargo)
7209 {
7211 {
7213 }
7214 }
7215 }
7216 }
7217
7219 {
7220
7222 return;
7223 }
7224
7225 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7226 {
7228 }
7229 }
7230 }
7231
7232
7234 {
7235 super.OnRightClick();
7236
7238 {
7240 {
7241 if (ScriptInputUserData.CanStoreInputUserData())
7242 {
7243 EntityAI root = GetHierarchyRoot();
7244 Man playerOwner = GetHierarchyRootPlayer();
7245 InventoryLocation dst = new InventoryLocation;
7246
7247
7248 if (!playerOwner && root && root == this)
7249 {
7251 }
7252 else
7253 {
7254
7255 GetInventory().GetCurrentInventoryLocation(dst);
7257 {
7260 {
7262 }
7263 else
7264 {
7266
7267
7268 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7269 {
7271 }
7272 else
7273 {
7274 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7275 }
7276 }
7277 }
7278 }
7279
7280 ScriptInputUserData ctx = new ScriptInputUserData;
7288 }
7289 }
7290 else if (!
GetGame().IsMultiplayer())
7291 {
7293 }
7294 }
7295 }
7296
7298 {
7299 if (root)
7300 {
7301 vector m4[4];
7302 root.GetTransform(m4);
7303 dst.SetGround(this, m4);
7304 }
7305 else
7306 {
7307 GetInventory().GetCurrentInventoryLocation(dst);
7308 }
7309 }
7310
7311 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7312 {
7313
7314 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7315 return false;
7316
7317 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7318 return false;
7319
7320
7322 return false;
7323
7324
7325 Magazine mag = Magazine.Cast(this);
7326 if (mag)
7327 {
7328 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7329 return false;
7330
7331 if (stack_max_limit)
7332 {
7333 Magazine other_mag = Magazine.Cast(other_item);
7334 if (other_item)
7335 {
7336 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7337 return false;
7338 }
7339
7340 }
7341 }
7342 else
7343 {
7344
7346 return false;
7347
7349 return false;
7350 }
7351
7352 PlayerBase player = null;
7353 if (CastTo(player, GetHierarchyRootPlayer()))
7354 {
7355 if (player.GetInventory().HasAttachment(this))
7356 return false;
7357
7358 if (player.IsItemsToDelete())
7359 return false;
7360 }
7361
7362 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7363 return false;
7364
7365 int slotID;
7367 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7368 return false;
7369
7370 return true;
7371 }
7372
7374 {
7376 }
7377
7379 {
7380 return m_IsResultOfSplit;
7381 }
7382
7384 {
7385 m_IsResultOfSplit = value;
7386 }
7387
7389 {
7391 }
7392
7394 {
7395 float other_item_quantity = other_item.GetQuantity();
7396 float this_free_space;
7397
7399
7401
7402 if (other_item_quantity > this_free_space)
7403 {
7404 return this_free_space;
7405 }
7406 else
7407 {
7408 return other_item_quantity;
7409 }
7410 }
7411
7413 {
7415 }
7416
7418 {
7420 return;
7421
7422 if (!IsMagazine() && other_item)
7423 {
7425 if (quantity_used != 0)
7426 {
7427 float hp1 = GetHealth01("","");
7428 float hp2 = other_item.GetHealth01("","");
7429 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7430 hpResult = hpResult / (
GetQuantity() + quantity_used);
7431
7432 hpResult *= GetMaxHealth();
7433 Math.Round(hpResult);
7434 SetHealth("", "Health", hpResult);
7435
7437 other_item.AddQuantity(-quantity_used);
7438 }
7439 }
7441 }
7442
7444 {
7445 #ifdef SERVER
7446 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7447 GetHierarchyParent().IncreaseLifetimeUp();
7448 #endif
7449 };
7450
7452 {
7453 PlayerBase p = PlayerBase.Cast(player);
7454
7455 array<int> recipesIds = p.m_Recipes;
7456 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7457 if (moduleRecipesManager)
7458 {
7459 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
7460 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7461 }
7462
7463 for (int i = 0;i < recipesIds.Count(); i++)
7464 {
7465 int key = recipesIds.Get(i);
7466 string recipeName = moduleRecipesManager.GetRecipeName(key);
7468 }
7469 }
7470
7471
7472 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7473 {
7474 super.GetDebugActions(outputList);
7475
7476
7482
7483
7488
7493
7494
7498
7499
7501 {
7505 }
7506
7509
7510
7514
7516
7517 InventoryLocation loc = new InventoryLocation();
7518 GetInventory().GetCurrentInventoryLocation(loc);
7520 {
7521 if (Gizmo_IsSupported())
7524 }
7525
7527 }
7528
7529
7530
7531
7533 {
7534 super.OnAction(action_id, player, ctx);
7535
7537 {
7538 switch (action_id)
7539 {
7542 return true;
7545 return true;
7546 }
7547 }
7548
7550 {
7551 switch (action_id)
7552 {
7554 Delete();
7555 return true;
7556 }
7557 }
7558
7559 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
7560 {
7561 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7562 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
7563 PlayerBase p = PlayerBase.Cast(player);
7564 if (
EActions.RECIPES_RANGE_START < 1000)
7565 {
7566 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7567 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7568 }
7569 }
7570 #ifndef SERVER
7571 else if (action_id ==
EActions.WATCH_PLAYER)
7572 {
7573 PluginDeveloper.SetDeveloperItemClientEx(player);
7574 }
7575 #endif
7577 {
7578 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7579 {
7580 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7581 OnDebugButtonPressServer(id + 1);
7582 }
7583
7584 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7585 {
7586 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
7588 }
7589
7590 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
7591 {
7592 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
7594 }
7595
7596 else if (action_id ==
EActions.ADD_QUANTITY)
7597 {
7598 if (IsMagazine())
7599 {
7600 Magazine mag = Magazine.Cast(this);
7601 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
7602 }
7603 else
7604 {
7606 }
7607
7608 if (m_EM)
7609 {
7610 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
7611 }
7612
7613 }
7614
7615 else if (action_id ==
EActions.REMOVE_QUANTITY)
7616 {
7617 if (IsMagazine())
7618 {
7619 Magazine mag2 = Magazine.Cast(this);
7620 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
7621 }
7622 else
7623 {
7625 }
7626 if (m_EM)
7627 {
7628 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
7629 }
7630
7631 }
7632
7633 else if (action_id ==
EActions.SET_QUANTITY_0)
7634 {
7636
7637 if (m_EM)
7638 {
7639 m_EM.SetEnergy(0);
7640 }
7641 }
7642
7643 else if (action_id ==
EActions.SET_MAX_QUANTITY)
7644 {
7646
7647 if (m_EM)
7648 {
7649 m_EM.SetEnergy(m_EM.GetEnergyMax());
7650 }
7651 }
7652
7653 else if (action_id ==
EActions.ADD_HEALTH)
7654 {
7655 AddHealth("","",GetMaxHealth("","Health")/5);
7656 }
7657 else if (action_id ==
EActions.REMOVE_HEALTH)
7658 {
7659 AddHealth("","",-GetMaxHealth("","Health")/5);
7660 }
7661 else if (action_id ==
EActions.DESTROY_HEALTH)
7662 {
7663 SetHealth01("","",0);
7664 }
7665 else if (action_id ==
EActions.WATCH_ITEM)
7666 {
7668 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
7669 #ifdef DEVELOPER
7670 SetDebugDeveloper_item(this);
7671 #endif
7672 }
7673
7674 else if (action_id ==
EActions.ADD_TEMPERATURE)
7675 {
7676 AddTemperature(20);
7677
7678 }
7679
7680 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
7681 {
7682 AddTemperature(-20);
7683
7684 }
7685
7686 else if (action_id ==
EActions.FLIP_FROZEN)
7687 {
7688 SetFrozen(!GetIsFrozen());
7689
7690 }
7691
7692 else if (action_id ==
EActions.ADD_WETNESS)
7693 {
7695
7696 }
7697
7698 else if (action_id ==
EActions.REMOVE_WETNESS)
7699 {
7701
7702 }
7703
7704 else if (action_id ==
EActions.LIQUIDTYPE_UP)
7705 {
7708
7709
7710 }
7711
7712 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
7713 {
7716 }
7717
7718 else if (action_id ==
EActions.MAKE_SPECIAL)
7719 {
7720 auto debugParams = DebugSpawnParams.WithPlayer(player);
7721 OnDebugSpawnEx(debugParams);
7722 }
7723
7724 }
7725
7726
7727 return false;
7728 }
7729
7730
7731
7732
7736
7739
7740
7741
7743 {
7744 return false;
7745 }
7746
7747
7749 {
7750 return true;
7751 }
7752
7753
7755 {
7756 return true;
7757 }
7758
7759
7760
7762 {
7763 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
7765 }
7766
7769 {
7770 return null;
7771 }
7772
7774 {
7775 return false;
7776 }
7777
7779 {
7780 return false;
7781 }
7782
7786
7787
7789 {
7790 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7791 return module_repairing.CanRepair(this, item_repair_kit);
7792 }
7793
7794
7795 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
7796 {
7797 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7798 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
7799 }
7800
7801
7803 {
7804
7805
7806
7807
7808
7809
7810
7811
7812 return 1;
7813 }
7814
7815
7816
7818 {
7820 }
7821
7822
7823
7825 {
7827 }
7828
7829
7838 {
7839 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7840
7841 if (player)
7842 {
7843 player.MessageStatus(text);
7844 }
7845 }
7846
7847
7856 {
7857 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7858
7859 if (player)
7860 {
7861 player.MessageAction(text);
7862 }
7863 }
7864
7865
7874 {
7875 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7876
7877 if (player)
7878 {
7879 player.MessageFriendly(text);
7880 }
7881 }
7882
7883
7892 {
7893 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7894
7895 if (player)
7896 {
7897 player.MessageImportant(text);
7898 }
7899 }
7900
7902 {
7903 return true;
7904 }
7905
7906
7907 override bool KindOf(
string tag)
7908 {
7909 bool found = false;
7910 string item_name = this.
GetType();
7913
7914 int array_size = item_tag_array.Count();
7915 for (int i = 0; i < array_size; i++)
7916 {
7917 if (item_tag_array.Get(i) == tag)
7918 {
7919 found = true;
7920 break;
7921 }
7922 }
7923 return found;
7924 }
7925
7926
7928 {
7929
7930 super.OnRPC(sender, rpc_type,ctx);
7931
7932
7933 switch (rpc_type)
7934 {
7935 #ifndef SERVER
7936 case ERPCs.RPC_SOUND_LOCK_ATTACH:
7937 Param2<bool, string> p = new Param2<bool, string>(false, "");
7938
7940 return;
7941
7942 bool play = p.param1;
7943 string soundSet = p.param2;
7944
7945 if (play)
7946 {
7948 {
7950 {
7952 }
7953 }
7954 else
7955 {
7957 }
7958 }
7959 else
7960 {
7962 }
7963
7964 break;
7965 #endif
7966
7967 }
7968
7970 {
7972 }
7973 }
7974
7975
7976
7977
7979 {
7980 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
7981 return plugin.GetID(
name);
7982 }
7983
7985 {
7986 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
7987 return plugin.GetName(id);
7988 }
7989
7992 {
7993
7994
7995 int varFlags;
7996 if (!ctx.
Read(varFlags))
7997 return;
7998
7999 if (varFlags & ItemVariableFlags.FLOAT)
8000 {
8002 }
8003 }
8004
8006 {
8007
8008 super.SerializeNumericalVars(floats_out);
8009
8010
8011
8013 {
8015 }
8016
8018 {
8020 }
8021
8023 {
8025 }
8026
8028 {
8033 }
8034
8036 {
8038 }
8039 }
8040
8042 {
8043
8044 super.DeSerializeNumericalVars(floats);
8045
8046
8047 int index = 0;
8048 int mask = Math.Round(floats.Get(index));
8049
8050 index++;
8051
8053 {
8055 {
8057 }
8058 else
8059 {
8060 float quantity = floats.Get(index);
8062 }
8063 index++;
8064 }
8065
8067 {
8068 float wet = floats.Get(index);
8070 index++;
8071 }
8072
8074 {
8075 int liquidtype = Math.Round(floats.Get(index));
8077 index++;
8078 }
8079
8081 {
8083 index++;
8085 index++;
8087 index++;
8089 index++;
8090 }
8091
8093 {
8094 int cleanness = Math.Round(floats.Get(index));
8096 index++;
8097 }
8098 }
8099
8101 {
8102 super.WriteVarsToCTX(ctx);
8103
8104
8106 {
8108 }
8109
8111 {
8113 }
8114
8116 {
8118 }
8119
8121 {
8122 int r,g,b,a;
8128 }
8129
8131 {
8133 }
8134 }
8135
8137 {
8138 if (!super.ReadVarsFromCTX(ctx,version))
8139 return false;
8140
8141 int intValue;
8142 float value;
8143
8144 if (version < 140)
8145 {
8146 if (!ctx.
Read(intValue))
8147 return false;
8148
8149 m_VariablesMask = intValue;
8150 }
8151
8153 {
8154 if (!ctx.
Read(value))
8155 return false;
8156
8158 {
8160 }
8161 else
8162 {
8164 }
8165 }
8166
8167 if (version < 140)
8168 {
8170 {
8171 if (!ctx.
Read(value))
8172 return false;
8173 SetTemperatureDirect(value);
8174 }
8175 }
8176
8178 {
8179 if (!ctx.
Read(value))
8180 return false;
8182 }
8183
8185 {
8186 if (!ctx.
Read(intValue))
8187 return false;
8189 }
8190
8192 {
8193 int r,g,b,a;
8195 return false;
8197 return false;
8199 return false;
8201 return false;
8202
8204 }
8205
8207 {
8208 if (!ctx.
Read(intValue))
8209 return false;
8211 }
8212
8213 if (version >= 138 && version < 140)
8214 {
8216 {
8217 if (!ctx.
Read(intValue))
8218 return false;
8219 SetFrozen(intValue);
8220 }
8221 }
8222
8223 return true;
8224 }
8225
8226
8228 {
8231 {
8233 }
8234
8235 if (!super.OnStoreLoad(ctx, version))
8236 {
8238 return false;
8239 }
8240
8241 if (version >= 114)
8242 {
8243 bool hasQuickBarIndexSaved;
8244
8245 if (!ctx.
Read(hasQuickBarIndexSaved))
8246 {
8248 return false;
8249 }
8250
8251 if (hasQuickBarIndexSaved)
8252 {
8253 int itmQBIndex;
8254
8255
8256 if (!ctx.
Read(itmQBIndex))
8257 {
8259 return false;
8260 }
8261
8262 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8263 if (itmQBIndex != -1 && parentPlayer)
8264 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8265 }
8266 }
8267 else
8268 {
8269
8270 PlayerBase player;
8271 int itemQBIndex;
8272 if (version ==
int.
MAX)
8273 {
8274 if (!ctx.
Read(itemQBIndex))
8275 {
8277 return false;
8278 }
8279 }
8280 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8281 {
8282
8283 if (!ctx.
Read(itemQBIndex))
8284 {
8286 return false;
8287 }
8288 if (itemQBIndex != -1 && player)
8289 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8290 }
8291 }
8292
8293 if (version < 140)
8294 {
8295
8296 if (!LoadVariables(ctx, version))
8297 {
8299 return false;
8300 }
8301 }
8302
8303
8305 {
8307 return false;
8308 }
8309 if (version >= 132)
8310 {
8312 if (raib)
8313 {
8315 {
8317 return false;
8318 }
8319 }
8320 }
8321
8323 return true;
8324 }
8325
8326
8327
8329 {
8330 super.OnStoreSave(ctx);
8331
8332 PlayerBase player;
8333 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8334 {
8336
8337 int itemQBIndex = -1;
8338 itemQBIndex = player.FindQuickBarEntityIndex(this);
8339 ctx.
Write(itemQBIndex);
8340 }
8341 else
8342 {
8344 }
8345
8347
8349 if (raib)
8350 {
8352 }
8353 }
8354
8355
8357 {
8358 super.AfterStoreLoad();
8359
8361 {
8363 }
8364
8366 {
8369 }
8370 }
8371
8373 {
8374 super.EEOnAfterLoad();
8375
8377 {
8379 }
8380
8383 }
8384
8386 {
8387 return false;
8388 }
8389
8390
8391
8393 {
8395 {
8396 #ifdef PLATFORM_CONSOLE
8397
8399 {
8401 if (menu)
8402 {
8404 }
8405 }
8406 #endif
8407 }
8408
8410 {
8413 }
8414
8416 {
8417 SetWeightDirty();
8419 }
8421 {
8424 }
8425
8427 {
8430 }
8432 {
8435 }
8436
8437 super.OnVariablesSynchronized();
8438 }
8439
8440
8441
8443 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8444 {
8445 if (!IsServerCheck(allow_client))
8446 return false;
8447
8449 return false;
8450
8453
8454 if (value <= (min + 0.001))
8455 value = min;
8456
8457 if (value == min)
8458 {
8459 if (destroy_config)
8460 {
8461 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8462 if (dstr)
8463 {
8465 this.Delete();
8466 return true;
8467 }
8468 }
8469 else if (destroy_forced)
8470 {
8472 this.Delete();
8473 return true;
8474 }
8475
8477 }
8478
8481
8483 {
8485
8486 if (delta)
8488 }
8489
8491
8492 return false;
8493 }
8494
8495
8497 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8498 {
8500 }
8501
8503 {
8506 }
8507
8509 {
8512 }
8513
8515 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8516 {
8517 float value_clamped = Math.Clamp(value, 0, 1);
8519 SetQuantity(result, destroy_config, destroy_forced);
8520 }
8521
8522
8525 {
8527 }
8528
8530 {
8532 }
8533
8534
8535
8536
8537
8538
8539
8540
8541
8542
8544 {
8545 int slot = -1;
8546 if (GetInventory())
8547 {
8548 InventoryLocation il = new InventoryLocation;
8549 GetInventory().GetCurrentInventoryLocation(il);
8551 }
8552
8554 }
8555
8557 {
8558 float quantity_max = 0;
8559
8561 {
8562 if (attSlotID != -1)
8563 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8564
8565 if (quantity_max <= 0)
8567 }
8568
8569 if (quantity_max <= 0)
8571
8572 return quantity_max;
8573 }
8574
8576 {
8578 }
8579
8581 {
8583 }
8584
8585
8587 {
8589 }
8590
8592 {
8594 }
8595
8597 {
8599 }
8600
8601
8603 {
8604
8605 float weightEx = GetWeightEx();
8606 float special = GetInventoryAndCargoWeight();
8607 return weightEx - special;
8608 }
8609
8610
8612 {
8614 }
8615
8617 {
8619 {
8620 #ifdef DEVELOPER
8621 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8622 {
8623 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
8625 }
8626 #endif
8627
8629 }
8630 else if (HasEnergyManager())
8631 {
8632 #ifdef DEVELOPER
8633 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8634 {
8635 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
8636 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
8637 }
8638 #endif
8639 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
8640 }
8641 else
8642 {
8643 #ifdef DEVELOPER
8644 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8645 {
8646 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
8647 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
8648 }
8649 #endif
8650 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
8651 }
8652 }
8653
8656 {
8657 int item_count = 0;
8659
8660 if (GetInventory().GetCargo() != NULL)
8661 {
8662 item_count = GetInventory().GetCargo().GetItemCount();
8663 }
8664
8665 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
8666 {
8667 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
8668 if (item)
8669 item_count += item.GetNumberOfItems();
8670 }
8671 return item_count;
8672 }
8673
8676 {
8677 float weight = 0;
8678 float wetness = 1;
8679 if (include_wetness)
8682 {
8683 weight = wetness * m_ConfigWeight;
8684 }
8686 {
8687 weight = 1;
8688 }
8689 return weight;
8690 }
8691
8692
8693
8695 {
8696 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
8697 {
8698 GameInventory inv = GetInventory();
8699 array<EntityAI> items = new array<EntityAI>;
8701 for (int i = 0; i < items.Count(); i++)
8702 {
8704 if (item)
8705 {
8707 }
8708 }
8709 }
8710 }
8711
8712
8713
8714
8716 {
8717 float energy = 0;
8718 if (HasEnergyManager())
8719 {
8720 energy = GetCompEM().GetEnergy();
8721 }
8722 return energy;
8723 }
8724
8725
8727 {
8728 super.OnEnergyConsumed();
8729
8731 }
8732
8734 {
8735 super.OnEnergyAdded();
8736
8738 }
8739
8740
8742 {
8743 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
8744 {
8746 {
8747 float energy_0to1 = GetCompEM().GetEnergy0To1();
8749 }
8750 }
8751 }
8752
8753
8755 {
8756 return ConfigGetFloat("heatIsolation");
8757 }
8758
8760 {
8762 }
8763
8765 {
8766 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
8767 if (
GetGame().ConfigIsExisting(paramPath))
8769
8770 return 0.0;
8771 }
8772
8774 {
8775 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
8776 if (
GetGame().ConfigIsExisting(paramPath))
8778
8779 return 0.0;
8780 }
8781
8782 override void SetWet(
float value,
bool allow_client =
false)
8783 {
8784 if (!IsServerCheck(allow_client))
8785 return;
8786
8789
8791
8792 m_VarWet = Math.Clamp(value, min, max);
8793
8795 {
8798 }
8799 }
8800
8801 override void AddWet(
float value)
8802 {
8804 }
8805
8807 {
8809 }
8810
8812 {
8814 }
8815
8817 {
8819 }
8820
8822 {
8824 }
8825
8827 {
8829 }
8830
8832 {
8835 if (newLevel != oldLevel)
8836 {
8838 }
8839 }
8840
8842 {
8843 SetWeightDirty();
8844 }
8845
8847 {
8848 return GetWetLevelInternal(
m_VarWet);
8849 }
8850
8851
8852
8854 {
8856 }
8857
8859 {
8861 }
8862
8864 {
8866 }
8867
8869 {
8871 }
8872
8873
8874
8876 {
8877 if (ConfigIsExisting("itemModelLength"))
8878 {
8879 return ConfigGetFloat("itemModelLength");
8880 }
8881 return 0;
8882 }
8883
8885 {
8886 if (ConfigIsExisting("itemAttachOffset"))
8887 {
8888 return ConfigGetFloat("itemAttachOffset");
8889 }
8890 return 0;
8891 }
8892
8893 override void SetCleanness(
int value,
bool allow_client =
false)
8894 {
8895 if (!IsServerCheck(allow_client))
8896 return;
8897
8899
8901
8904 }
8905
8907 {
8909 }
8910
8912 {
8913 return true;
8914 }
8915
8916
8917
8918
8920 {
8922 }
8923
8925 {
8927 }
8928
8929
8930
8931
8932 override void SetColor(
int r,
int g,
int b,
int a)
8933 {
8939 }
8941 override void GetColor(out
int r,out
int g,out
int b,out
int a)
8942 {
8947 }
8948
8950 {
8952 }
8953
8956 {
8957 int r,g,b,a;
8959 r = r/255;
8960 g = g/255;
8961 b = b/255;
8962 a = a/255;
8963 return MiscGameplayFunctions.GetColorString(r, g, b, a);
8964 }
8965
8966
8967
8968 override void SetLiquidType(
int value,
bool allow_client =
false)
8969 {
8970 if (!IsServerCheck(allow_client))
8971 return;
8972
8977 }
8978
8980 {
8981 return ConfigGetInt("varLiquidTypeInit");
8982 }
8983
8985 {
8987 }
8988
8990 {
8992 SetFrozen(false);
8993 }
8994
8997 {
8998 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
8999 }
9000
9001
9004 {
9005 PlayerBase nplayer;
9006 if (PlayerBase.CastTo(nplayer, player))
9007 {
9009
9010 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9011 }
9012 }
9013
9014
9017 {
9018 PlayerBase nplayer;
9019 if (PlayerBase.CastTo(nplayer,player))
9020 {
9021
9022 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9023
9024 }
9025
9026
9027 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9028
9029
9030 if (HasEnergyManager())
9031 {
9032 GetCompEM().UpdatePlugState();
9033 }
9034 }
9035
9036
9038 {
9039 super.OnPlacementStarted(player);
9040
9042 }
9043
9044 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9045 {
9047 {
9048 m_AdminLog.OnPlacementComplete(player,
this);
9049 }
9050
9051 super.OnPlacementComplete(player, position, orientation);
9052 }
9053
9054
9055
9056
9057
9059 {
9061 {
9062 return true;
9063 }
9064 else
9065 {
9066 return false;
9067 }
9068 }
9069
9070
9072 {
9074 {
9076 }
9077 }
9078
9079
9081 {
9083 }
9084
9086 {
9088 }
9089
9090 override void InsertAgent(
int agent,
float count = 1)
9091 {
9092 if (count < 1)
9093 return;
9094
9096 }
9097
9100 {
9102 }
9103
9104
9106 {
9108 }
9109
9110
9111
9112
9113
9114
9115
9116
9117
9118
9119
9120
9121
9122
9123
9124
9125
9126
9127
9128
9129
9130
9131
9132
9133
9134
9135
9136
9137
9138
9139
9140
9141
9142
9143
9144
9145
9146
9147
9148
9149
9150
9152 {
9154 return false;
9155 return true;
9156 }
9157
9159 {
9160
9162 }
9163
9164
9167 {
9168 super.CheckForRoofLimited(timeTresholdMS);
9169
9171 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9172 {
9173 m_PreviousRoofTestTime = time;
9174 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9175 }
9176 }
9177
9178
9180 {
9182 {
9183 return 0;
9184 }
9185
9186 if (GetInventory().GetAttachmentSlotsCount() != 0)
9187 {
9188 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9189 if (filter)
9190 return filter.GetProtectionLevel(type, false, system);
9191 else
9192 return 0;
9193 }
9194
9195 string subclassPath, entryName;
9196
9197 switch (type)
9198 {
9200 entryName = "biological";
9201 break;
9203 entryName = "chemical";
9204 break;
9205 default:
9206 entryName = "biological";
9207 break;
9208 }
9209
9210 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9211
9213 }
9214
9215
9216
9219 {
9220 if (!IsMagazine())
9222
9224 }
9225
9226
9227
9228
9229
9234 {
9235 return true;
9236 }
9237
9239 {
9241 }
9242
9243
9244
9245
9246
9248 {
9249 if (parent)
9250 {
9251 if (parent.IsInherited(DayZInfected))
9252 return true;
9253
9254 if (!parent.IsRuined())
9255 return true;
9256 }
9257
9258 return true;
9259 }
9260
9262 {
9263 if (!super.CanPutAsAttachment(parent))
9264 {
9265 return false;
9266 }
9267
9268 if (!IsRuined() && !parent.IsRuined())
9269 {
9270 return true;
9271 }
9272
9273 return false;
9274 }
9275
9277 {
9278
9279
9280
9281
9282 return super.CanReceiveItemIntoCargo(item);
9283 }
9284
9286 {
9287
9288
9289
9290
9291 GameInventory attachmentInv = attachment.GetInventory();
9293 {
9294 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9295 return false;
9296 }
9297
9298 InventoryLocation loc = new InventoryLocation();
9299 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9300 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9301 return false;
9302
9303 return super.CanReceiveAttachment(attachment, slotId);
9304 }
9305
9307 {
9308 if (!super.CanReleaseAttachment(attachment))
9309 return false;
9310
9311 return GetInventory().AreChildrenAccessible();
9312 }
9313
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9335 {
9336 int id = muzzle_owner.GetMuzzleID();
9337 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9338
9339 if (WPOF_array)
9340 {
9341 for (int i = 0; i < WPOF_array.Count(); i++)
9342 {
9343 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9344
9345 if (WPOF)
9346 {
9347 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9348 }
9349 }
9350 }
9351 }
9352
9353
9355 {
9356 int id = muzzle_owner.GetMuzzleID();
9358
9359 if (WPOBE_array)
9360 {
9361 for (int i = 0; i < WPOBE_array.Count(); i++)
9362 {
9363 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9364
9365 if (WPOBE)
9366 {
9367 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9368 }
9369 }
9370 }
9371 }
9372
9373
9375 {
9376 int id = muzzle_owner.GetMuzzleID();
9377 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9378
9379 if (WPOOH_array)
9380 {
9381 for (int i = 0; i < WPOOH_array.Count(); i++)
9382 {
9383 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9384
9385 if (WPOOH)
9386 {
9387 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9388 }
9389 }
9390 }
9391 }
9392
9393
9395 {
9396 int id = muzzle_owner.GetMuzzleID();
9397 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9398
9399 if (WPOOH_array)
9400 {
9401 for (int i = 0; i < WPOOH_array.Count(); i++)
9402 {
9403 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9404
9405 if (WPOOH)
9406 {
9407 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9408 }
9409 }
9410 }
9411 }
9412
9413
9415 {
9416 int id = muzzle_owner.GetMuzzleID();
9417 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9418
9419 if (WPOOH_array)
9420 {
9421 for (int i = 0; i < WPOOH_array.Count(); i++)
9422 {
9423 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9424
9425 if (WPOOH)
9426 {
9427 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9428 }
9429 }
9430 }
9431 }
9432
9433
9434
9436 {
9438 {
9439 return true;
9440 }
9441
9442 return false;
9443 }
9444
9446 {
9448 {
9449 return true;
9450 }
9451
9452 return false;
9453 }
9454
9456 {
9458 {
9459 return true;
9460 }
9461
9462 return false;
9463 }
9464
9466 {
9467 return false;
9468 }
9469
9472 {
9473 return UATimeSpent.DEFAULT_DEPLOY;
9474 }
9475
9476
9477
9478
9480 {
9482 SetSynchDirty();
9483 }
9484
9486 {
9488 }
9489
9490
9492 {
9493 return false;
9494 }
9495
9498 {
9499 string att_type = "None";
9500
9501 if (ConfigIsExisting("soundAttType"))
9502 {
9503 att_type = ConfigGetString("soundAttType");
9504 }
9505
9507 }
9508
9510 {
9512 }
9513
9514
9515
9516
9517
9523
9525 {
9528
9530 }
9531
9532
9534 {
9536 return;
9537
9539
9542
9545
9546 SoundParameters params = new SoundParameters();
9550 }
9551
9552
9554 {
9556 return;
9557
9559 SetSynchDirty();
9560
9563 }
9564
9565
9567 {
9569 return;
9570
9572 SetSynchDirty();
9573
9576 }
9577
9579 {
9581 }
9582
9584 {
9586 }
9587
9590 {
9591 if (!
GetGame().IsDedicatedServer())
9592 {
9593 if (ConfigIsExisting("attachSoundSet"))
9594 {
9595 string cfg_path = "";
9596 string soundset = "";
9598
9601 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
9602 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
9603
9604 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
9605 {
9606 for (int i = 0; i < cfg_soundset_array.Count(); i++)
9607 {
9608 if (cfg_slot_array[i] == slot_type)
9609 {
9610 soundset = cfg_soundset_array[i];
9611 break;
9612 }
9613 }
9614 }
9615
9616 if (soundset != "")
9617 {
9618 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
9620 }
9621 }
9622 }
9623 }
9624
9626 {
9627
9628 }
9629
9630 void OnApply(PlayerBase player);
9631
9633 {
9634 return 1.0;
9635 };
9636
9638 {
9640 }
9641
9643 {
9645 }
9646
9648
9650 {
9651 SetDynamicPhysicsLifeTime(0.01);
9653 }
9654
9656 {
9657 array<string> zone_names = new array<string>;
9658 GetDamageZones(zone_names);
9659 for (int i = 0; i < zone_names.Count(); i++)
9660 {
9661 SetHealthMax(zone_names.Get(i),"Health");
9662 }
9663 SetHealthMax("","Health");
9664 }
9665
9668 {
9669 float global_health = GetHealth01("","Health");
9670 array<string> zones = new array<string>;
9671 GetDamageZones(zones);
9672
9673 for (int i = 0; i < zones.Count(); i++)
9674 {
9675 SetHealth01(zones.Get(i),"Health",global_health);
9676 }
9677 }
9678
9681 {
9682 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
9683 }
9684
9686 {
9687 if (!hasRootAsPlayer)
9688 {
9689 if (refParentIB)
9690 {
9691
9692 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
9693 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
9694
9695 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
9696 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
9697
9700 }
9701 else
9702 {
9703
9706 }
9707 }
9708 }
9709
9711 {
9713 {
9714 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
9715 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
9716 {
9717 float heatPermCoef = 1.0;
9719 while (ent)
9720 {
9721 heatPermCoef *= ent.GetHeatPermeabilityCoef();
9722 ent = ent.GetHierarchyParent();
9723 }
9724
9725 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
9726 }
9727 }
9728 }
9729
9731 {
9732
9733 EntityAI parent = GetHierarchyParent();
9734 if (!parent)
9735 {
9736 hasParent = false;
9737 hasRootAsPlayer = false;
9738 }
9739 else
9740 {
9741 hasParent = true;
9742 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
9743 refParentIB =
ItemBase.Cast(parent);
9744 }
9745 }
9746
9747 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
9748 {
9749
9750 }
9751
9753 {
9754
9755 return false;
9756 }
9757
9759 {
9760
9761
9762 return false;
9763 }
9764
9766 {
9767
9768 return false;
9769 }
9770
9773 {
9774 return !GetIsFrozen() &&
IsOpen();
9775 }
9776
9778 {
9779 bool hasParent = false, hasRootAsPlayer = false;
9781
9782 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
9783 bool foodDecay =
g_Game.IsFoodDecayEnabled();
9784
9785 if (wwtu || foodDecay)
9786 {
9790
9791 if (processWetness || processTemperature || processDecay)
9792 {
9794
9795 if (processWetness)
9796 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
9797
9798 if (processTemperature)
9800
9801 if (processDecay)
9802 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
9803 }
9804 }
9805 }
9806
9809 {
9811 }
9812
9814 {
9817
9818 return super.GetTemperatureFreezeThreshold();
9819 }
9820
9822 {
9825
9826 return super.GetTemperatureThawThreshold();
9827 }
9828
9830 {
9833
9834 return super.GetItemOverheatThreshold();
9835 }
9836
9838 {
9840 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
9841
9842 return super.GetTemperatureFreezeTime();
9843 }
9844
9846 {
9848 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
9849
9850 return super.GetTemperatureThawTime();
9851 }
9852
9857
9859 {
9860 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
9861 }
9862
9864 {
9865 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
9866 }
9867
9870 {
9872 }
9873
9875 {
9877 }
9878
9880 {
9882 }
9883
9886 {
9887 return null;
9888 }
9889
9892 {
9893 return false;
9894 }
9895
9897 {
9899 {
9902 if (!trg)
9903 {
9905 explosive = this;
9906 }
9907
9908 explosive.PairRemote(trg);
9910
9911 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
9912 trg.SetPersistentPairID(persistentID);
9913 explosive.SetPersistentPairID(persistentID);
9914
9915 return true;
9916 }
9917 return false;
9918 }
9919
9922 {
9923 float ret = 1.0;
9926 ret *= GetHealth01();
9927
9928 return ret;
9929 }
9930
9931 #ifdef DEVELOPER
9932 override void SetDebugItem()
9933 {
9934 super.SetDebugItem();
9935 _itemBase = this;
9936 }
9937
9939 {
9940 string text = super.GetDebugText();
9941
9943 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
9944
9945 return text;
9946 }
9947 #endif
9948
9950 {
9951 return true;
9952 }
9953
9955
9957
9959 {
9962 }
9963
9964
9972
9988}
9989
9991{
9993 if (entity)
9994 {
9995 bool is_item = entity.IsInherited(
ItemBase);
9996 if (is_item && full_quantity)
9997 {
10000 }
10001 }
10002 else
10003 {
10005 return NULL;
10006 }
10007 return entity;
10008}
10009
10011{
10012 if (item)
10013 {
10014 if (health > 0)
10015 item.SetHealth("", "", health);
10016
10017 if (item.CanHaveTemperature())
10018 {
10020 if (item.CanFreeze())
10021 item.SetFrozen(false);
10022 }
10023
10024 if (item.HasEnergyManager())
10025 {
10026 if (quantity >= 0)
10027 {
10028 item.GetCompEM().SetEnergy0To1(quantity);
10029 }
10030 else
10031 {
10033 }
10034 }
10035 else if (item.IsMagazine())
10036 {
10037 Magazine mag = Magazine.Cast(item);
10038 if (quantity >= 0)
10039 {
10040 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10041 }
10042 else
10043 {
10045 }
10046
10047 }
10048 else
10049 {
10050 if (quantity >= 0)
10051 {
10052 item.SetQuantityNormalized(quantity, false);
10053 }
10054 else
10055 {
10057 }
10058
10059 }
10060 }
10061}
10062
10063#ifdef DEVELOPER
10065#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.