5033{
5035 {
5036 return true;
5037 }
5038};
5039
5040
5041
5043{
5047
5049
5052
5053
5054
5055
5056
5065
5071
5076
5081
5102 protected bool m_IsResultOfSplit
5103
5105
5110
5111
5112
5114
5118
5119
5120
5122
5125
5126
5127
5133
5134
5142
5145
5146
5148
5149
5151
5152
5157
5158
5163
5164
5166
5167
5169 {
5174
5175 if (!
GetGame().IsDedicatedServer())
5176 {
5178 {
5180
5182 {
5184 }
5185 }
5186
5189 }
5190
5191 m_OldLocation = null;
5192
5194 {
5196 }
5197
5198 if (ConfigIsExisting("headSelectionsToHide"))
5199 {
5202 }
5203
5205 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5206 {
5208 }
5209
5211
5212 m_IsResultOfSplit = false;
5213
5215 }
5216
5218 {
5219 super.InitItemVariables();
5220
5226 m_Count = ConfigGetInt(
"count");
5227
5230
5235
5238
5243
5255
5259
5260
5263 if (ConfigIsExisting("canBeSplit"))
5264 {
5267 }
5268
5270 if (ConfigIsExisting("itemBehaviour"))
5272
5273
5276 RegisterNetSyncVariableInt("m_VarLiquidType");
5277 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5278
5279 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5280 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5281 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5282
5283 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5284 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5285 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5286 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5287
5288 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5289 RegisterNetSyncVariableBool("m_IsTakeable");
5290 RegisterNetSyncVariableBool("m_IsHologram");
5291
5294 {
5297 }
5298
5300
5302 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5304
5305 }
5306
5308 {
5310 }
5311
5313 {
5316 {
5321 }
5322 }
5323
5324 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5325 {
5327 {
5330 }
5331
5333 }
5334
5336 {
5342 }
5343
5345
5347 {
5349
5350 if (!action)
5351 {
5352 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5353 return;
5354 }
5355
5357 if (!ai)
5358 {
5360 return;
5361 }
5362
5364 if (!action_array)
5365 {
5366 action_array = new array<ActionBase_Basic>;
5368 }
5369 if (LogManager.IsActionLogEnable())
5370 {
5371 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5372 }
5373
5374 if (action_array.Find(action) != -1)
5375 {
5376 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5377 }
5378 else
5379 {
5380 action_array.Insert(action);
5381 }
5382 }
5383
5385 {
5387 ActionBase action = player.GetActionManager().GetAction(actionName);
5390
5391 if (action_array)
5392 {
5393 action_array.RemoveItem(action);
5394 }
5395 }
5396
5397
5398
5400 {
5401 ActionOverrideData overrideData = new ActionOverrideData();
5405
5407 if (!actionMap)
5408 {
5411 }
5412
5413 actionMap.Insert(this.
Type(), overrideData);
5414
5415 }
5416
5418
5420
5421
5423 {
5426
5429
5430 string config_to_search = "CfgVehicles";
5431 string muzzle_owner_config;
5432
5434 {
5435 if (IsInherited(Weapon))
5436 config_to_search = "CfgWeapons";
5437
5438 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5439
5440 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5441
5443
5444 if (config_OnFire_subclass_count > 0)
5445 {
5446 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5447
5448 for (int i = 0; i < config_OnFire_subclass_count; i++)
5449 {
5450 string particle_class = "";
5452 string config_OnFire_entry = config_OnFire_class + particle_class;
5453 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5454 WPOF_array.Insert(WPOF);
5455 }
5456
5457
5459 }
5460 }
5461
5463 {
5464 config_to_search = "CfgWeapons";
5465 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5466
5467 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5468
5470
5471 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
5472 {
5473 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
5474
5475 for (i = 0; i < config_OnBulletCasingEject_count; i++)
5476 {
5477 string particle_class2 = "";
5479 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
5480 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
5481 WPOBE_array.Insert(WPOBE);
5482 }
5483
5484
5486 }
5487 }
5488 }
5489
5490
5492 {
5495
5497 {
5498 string config_to_search = "CfgVehicles";
5499
5500 if (IsInherited(Weapon))
5501 config_to_search = "CfgWeapons";
5502
5503 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5504 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
5505
5506 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
5507 {
5508
5510
5512 {
5514 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
5516 return;
5517 }
5518
5521
5522
5523
5525 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
5526
5527 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
5528 {
5529 string particle_class = "";
5531 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
5533
5534 if (entry_type == CT_CLASS)
5535 {
5536 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
5537 WPOOH_array.Insert(WPOF);
5538 }
5539 }
5540
5541
5543 }
5544 }
5545 }
5546
5548 {
5550 }
5551
5553 {
5555 {
5557
5560
5563
5564 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5565 }
5566 }
5567
5569 {
5571 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5572
5574 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5575
5577 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5578
5580 {
5582 }
5583 }
5584
5586 {
5588 }
5589
5591 {
5594 else
5596
5598 {
5601 }
5602 else
5603 {
5606
5609 }
5610
5612 }
5613
5615 {
5617 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5618 }
5619
5621 {
5623 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5625 }
5626
5628 {
5630 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5631 }
5632
5634 {
5637
5638 OverheatingParticle OP = new OverheatingParticle();
5643
5645 }
5646
5648 {
5651
5652 return -1;
5653 }
5654
5656 {
5658 {
5661
5662 for (int i = count; i > 0; --i)
5663 {
5664 int id = i - 1;
5667
5670
5671 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
5672 {
5673 if (p)
5674 {
5677 }
5678 }
5679 }
5680 }
5681 }
5682
5684 {
5686 {
5688 {
5689 int id = i - 1;
5691
5692 if (OP)
5693 {
5695
5696 if (p)
5697 {
5699 }
5700
5701 delete OP;
5702 }
5703 }
5704
5707 }
5708 }
5709
5712 {
5713 return 0.0;
5714 }
5715
5716
5718 {
5719 return 250;
5720 }
5721
5723 {
5724 return 0;
5725 }
5726
5729 {
5731 return true;
5732
5733 return false;
5734 }
5735
5738 {
5741
5743 {
5745 }
5746 else
5747 {
5748
5750 }
5751
5753 }
5754
5761 {
5762 return -1;
5763 }
5764
5765
5766
5767
5769 {
5771 {
5773 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
5774
5775 if (r_index >= 0)
5776 {
5777 InventoryLocation r_il = new InventoryLocation;
5778 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
5779
5780 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
5783 {
5784 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
5785 }
5787 {
5788 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
5789 }
5790
5791 }
5792
5793 player.GetHumanInventory().ClearUserReservedLocation(this);
5794 }
5795
5798 }
5799
5800
5801
5802
5804 {
5805 return ItemBase.m_DebugActionsMask;
5806 }
5807
5809 {
5810 return ItemBase.m_DebugActionsMask & mask;
5811 }
5812
5814 {
5815 ItemBase.m_DebugActionsMask = mask;
5816 }
5817
5819 {
5820 ItemBase.m_DebugActionsMask |= mask;
5821 }
5822
5824 {
5825 ItemBase.m_DebugActionsMask &= ~mask;
5826 }
5827
5829 {
5831 {
5833 }
5834 else
5835 {
5837 }
5838 }
5839
5840
5842 {
5843 if (GetEconomyProfile())
5844 {
5845 float q_max = GetEconomyProfile().GetQuantityMax();
5846 if (q_max > 0)
5847 {
5848 float q_min = GetEconomyProfile().GetQuantityMin();
5849 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
5850
5852 {
5853 ComponentEnergyManager comp = GetCompEM();
5855 {
5857 }
5858 }
5860 {
5862
5863 }
5864
5865 }
5866 }
5867 }
5868
5871 {
5872 EntityAI parent = GetHierarchyParent();
5873
5874 if (parent)
5875 {
5876 InventoryLocation inventory_location_to_lock = new InventoryLocation;
5877 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
5878 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
5879 }
5880 }
5881
5884 {
5885 EntityAI parent = GetHierarchyParent();
5886
5887 if (parent)
5888 {
5889 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
5890 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
5891 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
5892 }
5893 }
5894
5896 {
5897
5898
5899
5900
5902
5904 {
5905 if (ScriptInputUserData.CanStoreInputUserData())
5906 {
5907 ScriptInputUserData ctx = new ScriptInputUserData;
5913 ctx.
Write(use_stack_max);
5916
5918 {
5919 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
5920 }
5921 }
5922 }
5923 else if (!
GetGame().IsMultiplayer())
5924 {
5926 }
5927 }
5928
5930 {
5932 }
5933
5935 {
5937 }
5938
5940 {
5942 }
5943
5945 {
5946
5947 return false;
5948 }
5949
5951 {
5952 return false;
5953 }
5954
5958 {
5959 return false;
5960 }
5961
5963 {
5964 return "";
5965 }
5966
5968
5970 {
5971 return false;
5972 }
5973
5975 {
5976 return true;
5977 }
5978
5979
5980
5982 {
5983 return true;
5984 }
5985
5987 {
5988 return true;
5989 }
5990
5992 {
5993 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
5995 }
5996
5998 {
6000 }
6001
6003 {
6005 if (!is_being_placed)
6007 SetSynchDirty();
6008 }
6009
6010
6012
6014 {
6016 }
6017
6019 {
6021 }
6022
6024 {
6025 return 1;
6026 }
6027
6029 {
6030 return false;
6031 }
6032
6034 {
6036 SetSynchDirty();
6037 }
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6074 {
6075 super.OnMovedInsideCargo(container);
6076
6077 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6078 }
6079
6080 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6081 {
6082 super.EEItemLocationChanged(oldLoc,newLoc);
6083
6084 PlayerBase new_player = null;
6085 PlayerBase old_player = null;
6086
6087 if (newLoc.GetParent())
6088 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6089
6090 if (oldLoc.GetParent())
6091 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6092
6094 {
6095 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6096
6097 if (r_index >= 0)
6098 {
6099 InventoryLocation r_il = new InventoryLocation;
6100 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6101
6102 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6105 {
6106 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6107 }
6109 {
6110 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6111 }
6112
6113 }
6114 }
6115
6117 {
6118 if (new_player)
6119 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6120
6121 if (new_player == old_player)
6122 {
6123
6124 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6125 {
6127 {
6128 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6129 {
6130 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6131 }
6132 }
6133 else
6134 {
6135 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6136 }
6137 }
6138
6139 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6140 {
6141 int type = oldLoc.GetType();
6143 {
6144 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6145 }
6147 {
6148 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6149 }
6150 }
6151 if (!m_OldLocation)
6152 {
6153 m_OldLocation = new InventoryLocation;
6154 }
6155 m_OldLocation.Copy(oldLoc);
6156 }
6157 else
6158 {
6159 if (m_OldLocation)
6160 {
6161 m_OldLocation.Reset();
6162 }
6163 }
6164
6166 }
6167 else
6168 {
6169 if (new_player)
6170 {
6171 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6172 if (res_index >= 0)
6173 {
6174 InventoryLocation il = new InventoryLocation;
6175 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6177 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6180 {
6181 il.
GetParent().GetOnReleaseLock().Invoke(it);
6182 }
6184 {
6186 }
6187
6188 }
6189 }
6191 {
6192
6194 }
6195
6196 if (m_OldLocation)
6197 {
6198 m_OldLocation.Reset();
6199 }
6200 }
6201 }
6202
6203 override void EOnContact(IEntity other, Contact extra)
6204 {
6206 {
6207 int liquidType = -1;
6209 if (impactSpeed > 0.0)
6210 {
6212 #ifndef SERVER
6214 #else
6216 SetSynchDirty();
6217 #endif
6219 }
6220 }
6221
6222 #ifdef SERVER
6223 if (GetCompEM() && GetCompEM().IsPlugged())
6224 {
6225 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6226 GetCompEM().UnplugThis();
6227 }
6228 #endif
6229 }
6230
6232
6234 {
6236 }
6237
6239 {
6240
6241 }
6242
6244 {
6245 super.OnItemLocationChanged(old_owner, new_owner);
6246
6247 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6248 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6249
6250 if (!relatedPlayer && playerNew)
6251 relatedPlayer = playerNew;
6252
6253 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6254 {
6256 if (actionMgr)
6257 {
6258 ActionBase currentAction = actionMgr.GetRunningAction();
6259 if (currentAction)
6261 }
6262 }
6263
6264 Man ownerPlayerOld = null;
6265 Man ownerPlayerNew = null;
6266
6267 if (old_owner)
6268 {
6269 if (old_owner.
IsMan())
6270 {
6271 ownerPlayerOld = Man.Cast(old_owner);
6272 }
6273 else
6274 {
6275 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6276 }
6277 }
6278 else
6279 {
6281 {
6283
6284 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6285 {
6286 GetCompEM().UnplugThis();
6287 }
6288 }
6289 }
6290
6291 if (new_owner)
6292 {
6293 if (new_owner.
IsMan())
6294 {
6295 ownerPlayerNew = Man.Cast(new_owner);
6296 }
6297 else
6298 {
6299 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6300 }
6301 }
6302
6303 if (ownerPlayerOld != ownerPlayerNew)
6304 {
6305 if (ownerPlayerOld)
6306 {
6307 array<EntityAI> subItemsExit = new array<EntityAI>;
6309 for (int i = 0; i < subItemsExit.Count(); i++)
6310 {
6313 }
6314 }
6315
6316 if (ownerPlayerNew)
6317 {
6318 array<EntityAI> subItemsEnter = new array<EntityAI>;
6320 for (int j = 0; j < subItemsEnter.Count(); j++)
6321 {
6324 }
6325 }
6326 }
6327 else if (ownerPlayerNew != null)
6328 {
6329 PlayerBase nplayer;
6330 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6331 {
6332 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6334 for (int k = 0; k < subItemsUpdate.Count(); k++)
6335 {
6337 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6338 }
6339 }
6340 }
6341
6342 if (old_owner)
6343 old_owner.OnChildItemRemoved(this);
6344 if (new_owner)
6345 new_owner.OnChildItemReceived(this);
6346 }
6347
6348
6350 {
6351 super.EEDelete(parent);
6352 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6353 if (player)
6354 {
6356
6357 if (player.IsAlive())
6358 {
6359 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6360 if (r_index >= 0)
6361 {
6362 InventoryLocation r_il = new InventoryLocation;
6363 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6364
6365 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6368 {
6369 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6370 }
6372 {
6373 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6374 }
6375
6376 }
6377
6378 player.RemoveQuickBarEntityShortcut(this);
6379 }
6380 }
6381 }
6382
6384 {
6385 super.EEKilled(killer);
6386
6389 {
6390 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6391 {
6392 if (IsMagazine())
6393 {
6394 if (Magazine.Cast(this).GetAmmoCount() > 0)
6395 {
6397 }
6398 }
6399 else
6400 {
6402 }
6403 }
6404 }
6405 }
6406
6408 {
6409 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6410
6411 super.OnWasAttached(parent, slot_id);
6412
6415
6417 }
6418
6420 {
6421 super.OnWasDetached(parent, slot_id);
6422
6425 }
6426
6428 {
6429 int idx;
6432
6433 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6434 if (inventory_slots.Count() < 1)
6435 {
6436 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6437 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6438 }
6439 else
6440 {
6441 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6442 }
6443
6444 idx = inventory_slots.Find(slot);
6445 if (idx < 0)
6446 return "";
6447
6448 return attach_types.Get(idx);
6449 }
6450
6452 {
6453 int idx = -1;
6454 string slot;
6455
6458
6459 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6460 if (inventory_slots.Count() < 1)
6461 {
6462 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6463 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6464 }
6465 else
6466 {
6467 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6468 if (detach_types.Count() < 1)
6469 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6470 }
6471
6472 for (int i = 0; i < inventory_slots.Count(); i++)
6473 {
6474 slot = inventory_slots.Get(i);
6475 }
6476
6477 if (slot != "")
6478 {
6479 if (detach_types.Count() == 1)
6480 idx = 0;
6481 else
6482 idx = inventory_slots.Find(slot);
6483 }
6484 if (idx < 0)
6485 return "";
6486
6487 return detach_types.Get(idx);
6488 }
6489
6491 {
6492
6494
6495
6496 float min_time = 1;
6497 float max_time = 3;
6498 float delay = Math.RandomFloat(min_time, max_time);
6499
6500 explode_timer.Run(delay, this, "DoAmmoExplosion");
6501 }
6502
6504 {
6505 Magazine magazine = Magazine.Cast(this);
6506 int pop_sounds_count = 6;
6507 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
6508
6509
6510 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
6511 string sound_name = pop_sounds[ sound_idx ];
6513
6514
6515 magazine.ServerAddAmmoCount(-1);
6516
6517
6518 float min_temp_to_explode = 100;
6519
6520 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
6521 {
6523 }
6524 }
6525
6526
6527 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
6528 {
6529 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
6530
6531 const int CHANCE_DAMAGE_CARGO = 4;
6532 const int CHANCE_DAMAGE_ATTACHMENT = 1;
6533 const int CHANCE_DAMAGE_NOTHING = 2;
6534
6536 {
6537 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
6538 int chances;
6539 int rnd;
6540
6541 if (GetInventory().GetCargo())
6542 {
6543 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6544 rnd = Math.RandomInt(0,chances);
6545
6546 if (rnd < CHANCE_DAMAGE_CARGO)
6547 {
6549 }
6550 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
6551 {
6553 }
6554 }
6555 else
6556 {
6557 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6558 rnd = Math.RandomInt(0,chances);
6559
6560 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
6561 {
6563 }
6564 }
6565 }
6566 }
6567
6569 {
6570 if (GetInventory().GetCargo())
6571 {
6572 int item_count = GetInventory().GetCargo().GetItemCount();
6573 if (item_count > 0)
6574 {
6575 int random_pick = Math.RandomInt(0, item_count);
6577 if (!item.IsExplosive())
6578 {
6579 item.AddHealth("","",damage);
6580 return true;
6581 }
6582 }
6583 }
6584 return false;
6585 }
6586
6588 {
6589 int attachment_count = GetInventory().AttachmentCount();
6590 if (attachment_count > 0)
6591 {
6592 int random_pick = Math.RandomInt(0, attachment_count);
6593 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
6594 if (!attachment.IsExplosive())
6595 {
6596 attachment.AddHealth("","",damage);
6597 return true;
6598 }
6599 }
6600 return false;
6601 }
6602
6604 {
6606 }
6607
6609 {
6611 return GetInventory().CanRemoveEntity();
6612
6613 return false;
6614 }
6615
6617 {
6618
6620 return false;
6621
6622
6624 return false;
6625
6626
6627
6629 if (delta == 0)
6630 return false;
6631
6632
6633 return true;
6634 }
6635
6637 {
6639 {
6640 if (ScriptInputUserData.CanStoreInputUserData())
6641 {
6642 ScriptInputUserData ctx = new ScriptInputUserData;
6647 ctx.
Write(destination_entity);
6651 }
6652 }
6653 else if (!
GetGame().IsMultiplayer())
6654 {
6656 }
6657 }
6658
6660 {
6661 float split_quantity_new;
6665 InventoryLocation loc = new InventoryLocation;
6666
6667 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6668 {
6670 split_quantity_new = stack_max;
6671 else
6673
6675 {
6676 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6677 if (new_item)
6678 {
6679 new_item.SetResultOfSplit(true);
6680 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6682 new_item.
SetQuantity(split_quantity_new,
false,
true);
6683 }
6684 }
6685 }
6686 else if (destination_entity && slot_id == -1)
6687 {
6688 if (quantity > stack_max)
6689 split_quantity_new = stack_max;
6690 else
6691 split_quantity_new = quantity;
6692
6694 {
6696 {
6699 }
6700
6701 if (new_item)
6702 {
6703 new_item.SetResultOfSplit(true);
6704 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6706 new_item.
SetQuantity(split_quantity_new,
false,
true);
6707 }
6708 }
6709 }
6710 else
6711 {
6712 if (stack_max != 0)
6713 {
6715 {
6717 }
6718
6719 if (split_quantity_new == 0)
6720 {
6721 if (!
GetGame().IsMultiplayer())
6722 player.PhysicalPredictiveDropItem(this);
6723 else
6724 player.ServerDropEntity(this);
6725 return;
6726 }
6727
6729 {
6731
6732 if (new_item)
6733 {
6734 new_item.SetResultOfSplit(true);
6735 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6738 new_item.PlaceOnSurface();
6739 }
6740 }
6741 }
6742 }
6743 }
6744
6746 {
6747 float split_quantity_new;
6751 InventoryLocation loc = new InventoryLocation;
6752
6753 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6754 {
6756 split_quantity_new = stack_max;
6757 else
6759
6761 {
6762 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6763 if (new_item)
6764 {
6765 new_item.SetResultOfSplit(true);
6766 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6768 new_item.
SetQuantity(split_quantity_new,
false,
true);
6769 }
6770 }
6771 }
6772 else if (destination_entity && slot_id == -1)
6773 {
6774 if (quantity > stack_max)
6775 split_quantity_new = stack_max;
6776 else
6777 split_quantity_new = quantity;
6778
6780 {
6782 {
6785 }
6786
6787 if (new_item)
6788 {
6789 new_item.SetResultOfSplit(true);
6790 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6792 new_item.
SetQuantity(split_quantity_new,
false,
true);
6793 }
6794 }
6795 }
6796 else
6797 {
6798 if (stack_max != 0)
6799 {
6801 {
6803 }
6804
6806 {
6808
6809 if (new_item)
6810 {
6811 new_item.SetResultOfSplit(true);
6812 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6815 new_item.PlaceOnSurface();
6816 }
6817 }
6818 }
6819 }
6820 }
6821
6823 {
6825 {
6826 if (ScriptInputUserData.CanStoreInputUserData())
6827 {
6828 ScriptInputUserData ctx = new ScriptInputUserData;
6833 dst.WriteToContext(ctx);
6835 }
6836 }
6837 else if (!
GetGame().IsMultiplayer())
6838 {
6840 }
6841 }
6842
6844 {
6846 {
6847 if (ScriptInputUserData.CanStoreInputUserData())
6848 {
6849 ScriptInputUserData ctx = new ScriptInputUserData;
6854 ctx.
Write(destination_entity);
6860 }
6861 }
6862 else if (!
GetGame().IsMultiplayer())
6863 {
6865 }
6866 }
6867
6869 {
6871 }
6872
6874 {
6876 float split_quantity_new;
6878 if (dst.IsValid())
6879 {
6880 int slot_id = dst.GetSlot();
6882
6883 if (quantity > stack_max)
6884 split_quantity_new = stack_max;
6885 else
6886 split_quantity_new = quantity;
6887
6889 {
6891
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 return new_item;
6901 }
6902 }
6903
6904 return null;
6905 }
6906
6908 {
6910 float split_quantity_new;
6912 if (destination_entity)
6913 {
6915 if (quantity > stackable)
6916 split_quantity_new = stackable;
6917 else
6918 split_quantity_new = quantity;
6919
6921 {
6922 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
6923 if (new_item)
6924 {
6925 new_item.SetResultOfSplit(true);
6926 MiscGameplayFunctions.TransferItemProperties(this,new_item);
6928 new_item.
SetQuantity(split_quantity_new,
false,
true);
6929 }
6930 }
6931 }
6932 }
6933
6935 {
6937 {
6938 if (ScriptInputUserData.CanStoreInputUserData())
6939 {
6940 ScriptInputUserData ctx = new ScriptInputUserData;
6945 ItemBase destination_entity =
this;
6946 ctx.
Write(destination_entity);
6950 }
6951 }
6952 else if (!
GetGame().IsMultiplayer())
6953 {
6955 }
6956 }
6957
6959 {
6961 float split_quantity_new;
6963 if (player)
6964 {
6966 if (quantity > stackable)
6967 split_quantity_new = stackable;
6968 else
6969 split_quantity_new = quantity;
6970
6972 {
6973 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
6974 new_item =
ItemBase.Cast(in_hands);
6975 if (new_item)
6976 {
6977 new_item.SetResultOfSplit(true);
6978 MiscGameplayFunctions.TransferItemProperties(this,new_item);
6980 new_item.SetQuantity(split_quantity_new, false, true);
6981 }
6982 }
6983 }
6984 }
6985
6987 {
6989 float split_quantity_new = Math.Floor(quantity * 0.5);
6990
6992 return;
6993
6995
6996 if (new_item)
6997 {
6998 if (new_item.GetQuantityMax() < split_quantity_new)
6999 {
7000 split_quantity_new = new_item.GetQuantityMax();
7001 }
7002
7003 new_item.SetResultOfSplit(true);
7004 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7005
7007 {
7010 }
7011 else
7012 {
7014 new_item.
SetQuantity(split_quantity_new,
false,
true);
7015 }
7016 }
7017 }
7018
7020 {
7022 float split_quantity_new = Math.Floor(quantity / 2);
7023
7025 return;
7026
7027 InventoryLocation invloc = new InventoryLocation;
7029
7031 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7032
7033 if (new_item)
7034 {
7035 if (new_item.GetQuantityMax() < split_quantity_new)
7036 {
7037 split_quantity_new = new_item.GetQuantityMax();
7038 }
7040 {
7043 }
7044 else if (split_quantity_new > 1)
7045 {
7047 new_item.
SetQuantity(split_quantity_new,
false,
true);
7048 }
7049 }
7050 }
7051
7054 {
7055 SetWeightDirty();
7057
7058 if (parent)
7059 parent.OnAttachmentQuantityChangedEx(this, delta);
7060
7062 {
7064 {
7066 }
7068 {
7069 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7071 }
7072 }
7073
7074 }
7075
7078 {
7079
7080 }
7081
7084 {
7086 }
7087
7089 {
7090 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7091
7093 {
7094 if (newLevel == GameConstants.STATE_RUINED)
7095 {
7097 EntityAI parent = GetHierarchyParent();
7098 if (parent && parent.IsFireplace())
7099 {
7100 CargoBase cargo = GetInventory().GetCargo();
7101 if (cargo)
7102 {
7104 {
7106 }
7107 }
7108 }
7109 }
7110
7112 {
7113
7115 return;
7116 }
7117
7118 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7119 {
7121 }
7122 }
7123 }
7124
7125
7127 {
7128 super.OnRightClick();
7129
7131 {
7133 {
7134 if (ScriptInputUserData.CanStoreInputUserData())
7135 {
7136 EntityAI root = GetHierarchyRoot();
7137 Man playerOwner = GetHierarchyRootPlayer();
7138 InventoryLocation dst = new InventoryLocation;
7139
7140
7141 if (!playerOwner && root && root == this)
7142 {
7144 }
7145 else
7146 {
7147
7148 GetInventory().GetCurrentInventoryLocation(dst);
7150 {
7153 {
7155 }
7156 else
7157 {
7159
7160
7161 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7162 {
7164 }
7165 else
7166 {
7167 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7168 }
7169 }
7170 }
7171 }
7172
7173 ScriptInputUserData ctx = new ScriptInputUserData;
7181 }
7182 }
7183 else if (!
GetGame().IsMultiplayer())
7184 {
7186 }
7187 }
7188 }
7189
7191 {
7192 if (root)
7193 {
7194 vector m4[4];
7195 root.GetTransform(m4);
7196 dst.SetGround(this, m4);
7197 }
7198 else
7199 {
7200 GetInventory().GetCurrentInventoryLocation(dst);
7201 }
7202 }
7203
7204 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7205 {
7206
7207 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7208 return false;
7209
7210 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7211 return false;
7212
7213
7215 return false;
7216
7217
7218 Magazine mag = Magazine.Cast(this);
7219 if (mag)
7220 {
7221 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7222 return false;
7223
7224 if (stack_max_limit)
7225 {
7226 Magazine other_mag = Magazine.Cast(other_item);
7227 if (other_item)
7228 {
7229 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7230 return false;
7231 }
7232
7233 }
7234 }
7235 else
7236 {
7237
7239 return false;
7240
7242 return false;
7243 }
7244
7245 PlayerBase player = null;
7246 if (CastTo(player, GetHierarchyRootPlayer()))
7247 {
7248 if (player.GetInventory().HasAttachment(this))
7249 return false;
7250
7251 if (player.IsItemsToDelete())
7252 return false;
7253 }
7254
7255 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7256 return false;
7257
7258 int slotID;
7260 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7261 return false;
7262
7263 return true;
7264 }
7265
7267 {
7269 }
7270
7272 {
7273 return m_IsResultOfSplit;
7274 }
7275
7277 {
7278 m_IsResultOfSplit = value;
7279 }
7280
7282 {
7284 }
7285
7287 {
7288 float other_item_quantity = other_item.GetQuantity();
7289 float this_free_space;
7290
7292
7294
7295 if (other_item_quantity > this_free_space)
7296 {
7297 return this_free_space;
7298 }
7299 else
7300 {
7301 return other_item_quantity;
7302 }
7303 }
7304
7306 {
7308 }
7309
7311 {
7313 return;
7314
7315 if (!IsMagazine() && other_item)
7316 {
7318 if (quantity_used != 0)
7319 {
7320 float hp1 = GetHealth01("","");
7321 float hp2 = other_item.GetHealth01("","");
7322 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7323 hpResult = hpResult / (
GetQuantity() + quantity_used);
7324
7325 hpResult *= GetMaxHealth();
7326 Math.Round(hpResult);
7327 SetHealth("", "Health", hpResult);
7328
7330 other_item.AddQuantity(-quantity_used);
7331 }
7332 }
7334 }
7335
7337 {
7338 #ifdef SERVER
7339 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7340 GetHierarchyParent().IncreaseLifetimeUp();
7341 #endif
7342 };
7343
7345 {
7346 PlayerBase p = PlayerBase.Cast(player);
7347
7348 array<int> recipesIds = p.m_Recipes;
7349 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7350 if (moduleRecipesManager)
7351 {
7352 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
7353 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7354 }
7355
7356 for (int i = 0;i < recipesIds.Count(); i++)
7357 {
7358 int key = recipesIds.Get(i);
7359 string recipeName = moduleRecipesManager.GetRecipeName(key);
7361 }
7362 }
7363
7364
7365 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7366 {
7367 super.GetDebugActions(outputList);
7368
7369
7375
7376
7381
7386
7387
7391
7392
7394 {
7398 }
7399
7402
7403
7407
7409
7410 InventoryLocation loc = new InventoryLocation();
7411 GetInventory().GetCurrentInventoryLocation(loc);
7413 {
7414 if (Gizmo_IsSupported())
7417 }
7418
7420 }
7421
7422
7423
7424
7426 {
7427 super.OnAction(action_id, player, ctx);
7428
7430 {
7431 switch (action_id)
7432 {
7435 return true;
7438 return true;
7439 }
7440 }
7441
7443 {
7444 switch (action_id)
7445 {
7447 Delete();
7448 return true;
7449 }
7450 }
7451
7452 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
7453 {
7454 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7455 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
7456 PlayerBase p = PlayerBase.Cast(player);
7457 if (
EActions.RECIPES_RANGE_START < 1000)
7458 {
7459 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7460 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7461 }
7462 }
7463 #ifndef SERVER
7464 else if (action_id ==
EActions.WATCH_PLAYER)
7465 {
7466 PluginDeveloper.SetDeveloperItemClientEx(player);
7467 }
7468 #endif
7470 {
7471 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7472 {
7473 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7474 OnDebugButtonPressServer(id + 1);
7475 }
7476
7477 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7478 {
7479 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
7481 }
7482
7483 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
7484 {
7485 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
7487 }
7488
7489 else if (action_id ==
EActions.ADD_QUANTITY)
7490 {
7491 if (IsMagazine())
7492 {
7493 Magazine mag = Magazine.Cast(this);
7494 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
7495 }
7496 else
7497 {
7499 }
7500
7501 if (m_EM)
7502 {
7503 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
7504 }
7505
7506 }
7507
7508 else if (action_id ==
EActions.REMOVE_QUANTITY)
7509 {
7510 if (IsMagazine())
7511 {
7512 Magazine mag2 = Magazine.Cast(this);
7513 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
7514 }
7515 else
7516 {
7518 }
7519 if (m_EM)
7520 {
7521 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
7522 }
7523
7524 }
7525
7526 else if (action_id ==
EActions.SET_QUANTITY_0)
7527 {
7529
7530 if (m_EM)
7531 {
7532 m_EM.SetEnergy(0);
7533 }
7534 }
7535
7536 else if (action_id ==
EActions.SET_MAX_QUANTITY)
7537 {
7539
7540 if (m_EM)
7541 {
7542 m_EM.SetEnergy(m_EM.GetEnergyMax());
7543 }
7544 }
7545
7546 else if (action_id ==
EActions.ADD_HEALTH)
7547 {
7548 AddHealth("","",GetMaxHealth("","Health")/5);
7549 }
7550 else if (action_id ==
EActions.REMOVE_HEALTH)
7551 {
7552 AddHealth("","",-GetMaxHealth("","Health")/5);
7553 }
7554 else if (action_id ==
EActions.DESTROY_HEALTH)
7555 {
7556 SetHealth01("","",0);
7557 }
7558 else if (action_id ==
EActions.WATCH_ITEM)
7559 {
7561 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
7562 #ifdef DEVELOPER
7563 SetDebugDeveloper_item(this);
7564 #endif
7565 }
7566
7567 else if (action_id ==
EActions.ADD_TEMPERATURE)
7568 {
7569 AddTemperature(20);
7570
7571 }
7572
7573 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
7574 {
7575 AddTemperature(-20);
7576
7577 }
7578
7579 else if (action_id ==
EActions.FLIP_FROZEN)
7580 {
7581 SetFrozen(!GetIsFrozen());
7582
7583 }
7584
7585 else if (action_id ==
EActions.ADD_WETNESS)
7586 {
7588
7589 }
7590
7591 else if (action_id ==
EActions.REMOVE_WETNESS)
7592 {
7594
7595 }
7596
7597 else if (action_id ==
EActions.LIQUIDTYPE_UP)
7598 {
7601
7602
7603 }
7604
7605 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
7606 {
7609 }
7610
7611 else if (action_id ==
EActions.MAKE_SPECIAL)
7612 {
7613 auto debugParams = DebugSpawnParams.WithPlayer(player);
7614 OnDebugSpawnEx(debugParams);
7615 }
7616
7617 }
7618
7619
7620 return false;
7621 }
7622
7623
7624
7625
7629
7632
7633
7634
7636 {
7637 return false;
7638 }
7639
7640
7642 {
7643 return true;
7644 }
7645
7646
7648 {
7649 return true;
7650 }
7651
7652
7653
7655 {
7656 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
7658 }
7659
7662 {
7663 return null;
7664 }
7665
7667 {
7668 return false;
7669 }
7670
7672 {
7673 return false;
7674 }
7675
7679
7680
7682 {
7683 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7684 return module_repairing.CanRepair(this, item_repair_kit);
7685 }
7686
7687
7688 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
7689 {
7690 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7691 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
7692 }
7693
7694
7696 {
7697
7698
7699
7700
7701
7702
7703
7704
7705 return 1;
7706 }
7707
7708
7709
7711 {
7713 }
7714
7715
7716
7718 {
7720 }
7721
7722
7731 {
7732 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7733
7734 if (player)
7735 {
7736 player.MessageStatus(text);
7737 }
7738 }
7739
7740
7749 {
7750 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7751
7752 if (player)
7753 {
7754 player.MessageAction(text);
7755 }
7756 }
7757
7758
7767 {
7768 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7769
7770 if (player)
7771 {
7772 player.MessageFriendly(text);
7773 }
7774 }
7775
7776
7785 {
7786 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7787
7788 if (player)
7789 {
7790 player.MessageImportant(text);
7791 }
7792 }
7793
7795 {
7796 return true;
7797 }
7798
7799
7800 override bool KindOf(
string tag)
7801 {
7802 bool found = false;
7803 string item_name = this.
GetType();
7806
7807 int array_size = item_tag_array.Count();
7808 for (int i = 0; i < array_size; i++)
7809 {
7810 if (item_tag_array.Get(i) == tag)
7811 {
7812 found = true;
7813 break;
7814 }
7815 }
7816 return found;
7817 }
7818
7819
7821 {
7822
7823 super.OnRPC(sender, rpc_type,ctx);
7824
7825
7826 switch (rpc_type)
7827 {
7828 #ifndef SERVER
7829 case ERPCs.RPC_SOUND_LOCK_ATTACH:
7830 Param2<bool, string> p = new Param2<bool, string>(false, "");
7831
7833 return;
7834
7835 bool play = p.param1;
7836 string soundSet = p.param2;
7837
7838 if (play)
7839 {
7841 {
7843 {
7845 }
7846 }
7847 else
7848 {
7850 }
7851 }
7852 else
7853 {
7855 }
7856
7857 break;
7858 #endif
7859
7860 }
7861
7863 {
7865 }
7866 }
7867
7868
7869
7870
7872 {
7873 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
7874 return plugin.GetID(
name);
7875 }
7876
7878 {
7879 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
7880 return plugin.GetName(id);
7881 }
7882
7885 {
7886
7887
7888 int varFlags;
7889 if (!ctx.
Read(varFlags))
7890 return;
7891
7892 if (varFlags & ItemVariableFlags.FLOAT)
7893 {
7895 }
7896 }
7897
7899 {
7900
7901 super.SerializeNumericalVars(floats_out);
7902
7903
7904
7906 {
7908 }
7909
7911 {
7913 }
7914
7916 {
7918 }
7919
7921 {
7926 }
7927
7929 {
7931 }
7932 }
7933
7935 {
7936
7937 super.DeSerializeNumericalVars(floats);
7938
7939
7940 int index = 0;
7941 int mask = Math.Round(floats.Get(index));
7942
7943 index++;
7944
7946 {
7948 {
7950 }
7951 else
7952 {
7953 float quantity = floats.Get(index);
7955 }
7956 index++;
7957 }
7958
7960 {
7961 float wet = floats.Get(index);
7963 index++;
7964 }
7965
7967 {
7968 int liquidtype = Math.Round(floats.Get(index));
7970 index++;
7971 }
7972
7974 {
7976 index++;
7978 index++;
7980 index++;
7982 index++;
7983 }
7984
7986 {
7987 int cleanness = Math.Round(floats.Get(index));
7989 index++;
7990 }
7991 }
7992
7994 {
7995 super.WriteVarsToCTX(ctx);
7996
7997
7999 {
8001 }
8002
8004 {
8006 }
8007
8009 {
8011 }
8012
8014 {
8015 int r,g,b,a;
8021 }
8022
8024 {
8026 }
8027 }
8028
8030 {
8031 if (!super.ReadVarsFromCTX(ctx,version))
8032 return false;
8033
8034 int intValue;
8035 float value;
8036
8037 if (version < 140)
8038 {
8039 if (!ctx.
Read(intValue))
8040 return false;
8041
8042 m_VariablesMask = intValue;
8043 }
8044
8046 {
8047 if (!ctx.
Read(value))
8048 return false;
8049
8051 {
8053 }
8054 else
8055 {
8057 }
8058 }
8059
8060 if (version < 140)
8061 {
8063 {
8064 if (!ctx.
Read(value))
8065 return false;
8066 SetTemperatureDirect(value);
8067 }
8068 }
8069
8071 {
8072 if (!ctx.
Read(value))
8073 return false;
8075 }
8076
8078 {
8079 if (!ctx.
Read(intValue))
8080 return false;
8082 }
8083
8085 {
8086 int r,g,b,a;
8088 return false;
8090 return false;
8092 return false;
8094 return false;
8095
8097 }
8098
8100 {
8101 if (!ctx.
Read(intValue))
8102 return false;
8104 }
8105
8106 if (version >= 138 && version < 140)
8107 {
8109 {
8110 if (!ctx.
Read(intValue))
8111 return false;
8112 SetFrozen(intValue);
8113 }
8114 }
8115
8116 return true;
8117 }
8118
8119
8121 {
8124 {
8126 }
8127
8128 if (!super.OnStoreLoad(ctx, version))
8129 {
8131 return false;
8132 }
8133
8134 if (version >= 114)
8135 {
8136 bool hasQuickBarIndexSaved;
8137
8138 if (!ctx.
Read(hasQuickBarIndexSaved))
8139 {
8141 return false;
8142 }
8143
8144 if (hasQuickBarIndexSaved)
8145 {
8146 int itmQBIndex;
8147
8148
8149 if (!ctx.
Read(itmQBIndex))
8150 {
8152 return false;
8153 }
8154
8155 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8156 if (itmQBIndex != -1 && parentPlayer)
8157 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8158 }
8159 }
8160 else
8161 {
8162
8163 PlayerBase player;
8164 int itemQBIndex;
8165 if (version ==
int.
MAX)
8166 {
8167 if (!ctx.
Read(itemQBIndex))
8168 {
8170 return false;
8171 }
8172 }
8173 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8174 {
8175
8176 if (!ctx.
Read(itemQBIndex))
8177 {
8179 return false;
8180 }
8181 if (itemQBIndex != -1 && player)
8182 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8183 }
8184 }
8185
8186 if (version < 140)
8187 {
8188
8189 if (!LoadVariables(ctx, version))
8190 {
8192 return false;
8193 }
8194 }
8195
8196
8198 {
8200 return false;
8201 }
8202 if (version >= 132)
8203 {
8205 if (raib)
8206 {
8208 {
8210 return false;
8211 }
8212 }
8213 }
8214
8216 return true;
8217 }
8218
8219
8220
8222 {
8223 super.OnStoreSave(ctx);
8224
8225 PlayerBase player;
8226 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8227 {
8229
8230 int itemQBIndex = -1;
8231 itemQBIndex = player.FindQuickBarEntityIndex(this);
8232 ctx.
Write(itemQBIndex);
8233 }
8234 else
8235 {
8237 }
8238
8240
8242 if (raib)
8243 {
8245 }
8246 }
8247
8248
8250 {
8251 super.AfterStoreLoad();
8252
8254 {
8256 }
8257
8259 {
8262 }
8263 }
8264
8266 {
8267 super.EEOnAfterLoad();
8268
8270 {
8272 }
8273
8276 }
8277
8279 {
8280 return false;
8281 }
8282
8283
8284
8286 {
8288 {
8289 #ifdef PLATFORM_CONSOLE
8290
8292 {
8294 if (menu)
8295 {
8297 }
8298 }
8299 #endif
8300 }
8301
8303 {
8306 }
8307
8309 {
8310 SetWeightDirty();
8312 }
8314 {
8317 }
8318
8320 {
8323 }
8325 {
8328 }
8329
8330 super.OnVariablesSynchronized();
8331 }
8332
8333
8334
8336 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8337 {
8338 if (!IsServerCheck(allow_client))
8339 return false;
8340
8342 return false;
8343
8346
8347 if (value <= (min + 0.001))
8348 value = min;
8349
8350 if (value == min)
8351 {
8352 if (destroy_config)
8353 {
8354 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8355 if (dstr)
8356 {
8358 this.Delete();
8359 return true;
8360 }
8361 }
8362 else if (destroy_forced)
8363 {
8365 this.Delete();
8366 return true;
8367 }
8368
8370 }
8371
8374
8376 {
8378
8379 if (delta)
8381 }
8382
8384
8385 return false;
8386 }
8387
8388
8390 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8391 {
8393 }
8394
8396 {
8399 }
8400
8402 {
8405 }
8406
8408 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8409 {
8410 float value_clamped = Math.Clamp(value, 0, 1);
8412 SetQuantity(result, destroy_config, destroy_forced);
8413 }
8414
8415
8418 {
8420 }
8421
8423 {
8425 }
8426
8427
8428
8429
8430
8431
8432
8433
8434
8435
8437 {
8438 int slot = -1;
8439 if (GetInventory())
8440 {
8441 InventoryLocation il = new InventoryLocation;
8442 GetInventory().GetCurrentInventoryLocation(il);
8444 }
8445
8447 }
8448
8450 {
8451 float quantity_max = 0;
8452
8454 {
8455 if (attSlotID != -1)
8456 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8457
8458 if (quantity_max <= 0)
8460 }
8461
8462 if (quantity_max <= 0)
8464
8465 return quantity_max;
8466 }
8467
8469 {
8471 }
8472
8474 {
8476 }
8477
8478
8480 {
8482 }
8483
8485 {
8487 }
8488
8490 {
8492 }
8493
8494
8496 {
8497
8498 float weightEx = GetWeightEx();
8499 float special = GetInventoryAndCargoWeight();
8500 return weightEx - special;
8501 }
8502
8503
8505 {
8507 }
8508
8510 {
8512 {
8513 #ifdef DEVELOPER
8514 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8515 {
8516 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
8518 }
8519 #endif
8520
8522 }
8523 else if (HasEnergyManager())
8524 {
8525 #ifdef DEVELOPER
8526 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8527 {
8528 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
8529 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
8530 }
8531 #endif
8532 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
8533 }
8534 else
8535 {
8536 #ifdef DEVELOPER
8537 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8538 {
8539 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
8540 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
8541 }
8542 #endif
8543 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
8544 }
8545 }
8546
8549 {
8550 int item_count = 0;
8552
8553 if (GetInventory().GetCargo() != NULL)
8554 {
8555 item_count = GetInventory().GetCargo().GetItemCount();
8556 }
8557
8558 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
8559 {
8560 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
8561 if (item)
8562 item_count += item.GetNumberOfItems();
8563 }
8564 return item_count;
8565 }
8566
8569 {
8570 float weight = 0;
8571 float wetness = 1;
8572 if (include_wetness)
8575 {
8576 weight = wetness * m_ConfigWeight;
8577 }
8579 {
8580 weight = 1;
8581 }
8582 return weight;
8583 }
8584
8585
8586
8588 {
8589 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
8590 {
8591 GameInventory inv = GetInventory();
8592 array<EntityAI> items = new array<EntityAI>;
8594 for (int i = 0; i < items.Count(); i++)
8595 {
8597 if (item)
8598 {
8600 }
8601 }
8602 }
8603 }
8604
8605
8606
8607
8609 {
8610 float energy = 0;
8611 if (HasEnergyManager())
8612 {
8613 energy = GetCompEM().GetEnergy();
8614 }
8615 return energy;
8616 }
8617
8618
8620 {
8621 super.OnEnergyConsumed();
8622
8624 }
8625
8627 {
8628 super.OnEnergyAdded();
8629
8631 }
8632
8633
8635 {
8636 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
8637 {
8639 {
8640 float energy_0to1 = GetCompEM().GetEnergy0To1();
8642 }
8643 }
8644 }
8645
8646
8648 {
8649 return ConfigGetFloat("heatIsolation");
8650 }
8651
8653 {
8655 }
8656
8658 {
8659 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
8660 if (
GetGame().ConfigIsExisting(paramPath))
8662
8663 return 0.0;
8664 }
8665
8667 {
8668 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
8669 if (
GetGame().ConfigIsExisting(paramPath))
8671
8672 return 0.0;
8673 }
8674
8675 override void SetWet(
float value,
bool allow_client =
false)
8676 {
8677 if (!IsServerCheck(allow_client))
8678 return;
8679
8682
8684
8685 m_VarWet = Math.Clamp(value, min, max);
8686
8688 {
8691 }
8692 }
8693
8694 override void AddWet(
float value)
8695 {
8697 }
8698
8700 {
8702 }
8703
8705 {
8707 }
8708
8710 {
8712 }
8713
8715 {
8717 }
8718
8720 {
8722 }
8723
8725 {
8728 if (newLevel != oldLevel)
8729 {
8731 }
8732 }
8733
8735 {
8736 SetWeightDirty();
8737 }
8738
8740 {
8741 return GetWetLevelInternal(
m_VarWet);
8742 }
8743
8744
8745
8747 {
8749 }
8750
8752 {
8754 }
8755
8757 {
8759 }
8760
8762 {
8764 }
8765
8766
8767
8769 {
8770 if (ConfigIsExisting("itemModelLength"))
8771 {
8772 return ConfigGetFloat("itemModelLength");
8773 }
8774 return 0;
8775 }
8776
8778 {
8779 if (ConfigIsExisting("itemAttachOffset"))
8780 {
8781 return ConfigGetFloat("itemAttachOffset");
8782 }
8783 return 0;
8784 }
8785
8786 override void SetCleanness(
int value,
bool allow_client =
false)
8787 {
8788 if (!IsServerCheck(allow_client))
8789 return;
8790
8792
8794
8797 }
8798
8800 {
8802 }
8803
8805 {
8806 return true;
8807 }
8808
8809
8810
8811
8813 {
8815 }
8816
8818 {
8820 }
8821
8822
8823
8824
8825 override void SetColor(
int r,
int g,
int b,
int a)
8826 {
8832 }
8834 override void GetColor(out
int r,out
int g,out
int b,out
int a)
8835 {
8840 }
8841
8843 {
8845 }
8846
8849 {
8850 int r,g,b,a;
8852 r = r/255;
8853 g = g/255;
8854 b = b/255;
8855 a = a/255;
8856 return MiscGameplayFunctions.GetColorString(r, g, b, a);
8857 }
8858
8859
8860
8861 override void SetLiquidType(
int value,
bool allow_client =
false)
8862 {
8863 if (!IsServerCheck(allow_client))
8864 return;
8865
8870 }
8871
8873 {
8874 return ConfigGetInt("varLiquidTypeInit");
8875 }
8876
8878 {
8880 }
8881
8883 {
8885 SetFrozen(false);
8886 }
8887
8890 {
8891 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
8892 }
8893
8894
8897 {
8898 PlayerBase nplayer;
8899 if (PlayerBase.CastTo(nplayer, player))
8900 {
8902
8903 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
8904 }
8905 }
8906
8907
8910 {
8911 PlayerBase nplayer;
8912 if (PlayerBase.CastTo(nplayer,player))
8913 {
8914
8915 nplayer.SetEnableQuickBarEntityShortcut(this,false);
8916
8917 }
8918
8919
8920 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
8921
8922
8923 if (HasEnergyManager())
8924 {
8925 GetCompEM().UpdatePlugState();
8926 }
8927 }
8928
8929
8931 {
8932 super.OnPlacementStarted(player);
8933
8935 }
8936
8937 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
8938 {
8940 {
8941 m_AdminLog.OnPlacementComplete(player,
this);
8942 }
8943
8944 super.OnPlacementComplete(player, position, orientation);
8945 }
8946
8947
8948
8949
8950
8952 {
8954 {
8955 return true;
8956 }
8957 else
8958 {
8959 return false;
8960 }
8961 }
8962
8963
8965 {
8967 {
8969 }
8970 }
8971
8972
8974 {
8976 }
8977
8979 {
8981 }
8982
8983 override void InsertAgent(
int agent,
float count = 1)
8984 {
8985 if (count < 1)
8986 return;
8987
8989 }
8990
8993 {
8995 }
8996
8997
8999 {
9001 }
9002
9003
9004
9005
9006
9007
9008
9009
9010
9011
9012
9013
9014
9015
9016
9017
9018
9019
9020
9021
9022
9023
9024
9025
9026
9027
9028
9029
9030
9031
9032
9033
9034
9035
9036
9037
9038
9039
9040
9041
9042
9043
9045 {
9047 return false;
9048 return true;
9049 }
9050
9052 {
9053
9055 }
9056
9057
9060 {
9061 super.CheckForRoofLimited(timeTresholdMS);
9062
9064 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9065 {
9066 m_PreviousRoofTestTime = time;
9067 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9068 }
9069 }
9070
9071
9073 {
9075 {
9076 return 0;
9077 }
9078
9079 if (GetInventory().GetAttachmentSlotsCount() != 0)
9080 {
9081 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9082 if (filter)
9083 return filter.GetProtectionLevel(type, false, system);
9084 else
9085 return 0;
9086 }
9087
9088 string subclassPath, entryName;
9089
9090 switch (type)
9091 {
9093 entryName = "biological";
9094 break;
9096 entryName = "chemical";
9097 break;
9098 default:
9099 entryName = "biological";
9100 break;
9101 }
9102
9103 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9104
9106 }
9107
9108
9109
9112 {
9113 if (!IsMagazine())
9115
9117 }
9118
9119
9120
9121
9122
9127 {
9128 return true;
9129 }
9130
9132 {
9134 }
9135
9136
9137
9138
9139
9141 {
9142 if (parent)
9143 {
9144 if (parent.IsInherited(DayZInfected))
9145 return true;
9146
9147 if (!parent.IsRuined())
9148 return true;
9149 }
9150
9151 return true;
9152 }
9153
9155 {
9156 if (!super.CanPutAsAttachment(parent))
9157 {
9158 return false;
9159 }
9160
9161 if (!IsRuined() && !parent.IsRuined())
9162 {
9163 return true;
9164 }
9165
9166 return false;
9167 }
9168
9170 {
9171
9172
9173
9174
9175 return super.CanReceiveItemIntoCargo(item);
9176 }
9177
9179 {
9180
9181
9182
9183
9184 GameInventory attachmentInv = attachment.GetInventory();
9186 {
9187 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9188 return false;
9189 }
9190
9191 InventoryLocation loc = new InventoryLocation();
9192 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9193 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9194 return false;
9195
9196 return super.CanReceiveAttachment(attachment, slotId);
9197 }
9198
9200 {
9201 if (!super.CanReleaseAttachment(attachment))
9202 return false;
9203
9204 return GetInventory().AreChildrenAccessible();
9205 }
9206
9207
9208
9209
9210
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9221
9222
9223
9224
9225
9226
9228 {
9229 int id = muzzle_owner.GetMuzzleID();
9230 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9231
9232 if (WPOF_array)
9233 {
9234 for (int i = 0; i < WPOF_array.Count(); i++)
9235 {
9236 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9237
9238 if (WPOF)
9239 {
9240 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9241 }
9242 }
9243 }
9244 }
9245
9246
9248 {
9249 int id = muzzle_owner.GetMuzzleID();
9251
9252 if (WPOBE_array)
9253 {
9254 for (int i = 0; i < WPOBE_array.Count(); i++)
9255 {
9256 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9257
9258 if (WPOBE)
9259 {
9260 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9261 }
9262 }
9263 }
9264 }
9265
9266
9268 {
9269 int id = muzzle_owner.GetMuzzleID();
9270 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9271
9272 if (WPOOH_array)
9273 {
9274 for (int i = 0; i < WPOOH_array.Count(); i++)
9275 {
9276 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9277
9278 if (WPOOH)
9279 {
9280 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9281 }
9282 }
9283 }
9284 }
9285
9286
9288 {
9289 int id = muzzle_owner.GetMuzzleID();
9290 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9291
9292 if (WPOOH_array)
9293 {
9294 for (int i = 0; i < WPOOH_array.Count(); i++)
9295 {
9296 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9297
9298 if (WPOOH)
9299 {
9300 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9301 }
9302 }
9303 }
9304 }
9305
9306
9308 {
9309 int id = muzzle_owner.GetMuzzleID();
9310 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9311
9312 if (WPOOH_array)
9313 {
9314 for (int i = 0; i < WPOOH_array.Count(); i++)
9315 {
9316 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9317
9318 if (WPOOH)
9319 {
9320 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9321 }
9322 }
9323 }
9324 }
9325
9326
9327
9329 {
9331 {
9332 return true;
9333 }
9334
9335 return false;
9336 }
9337
9339 {
9341 {
9342 return true;
9343 }
9344
9345 return false;
9346 }
9347
9349 {
9351 {
9352 return true;
9353 }
9354
9355 return false;
9356 }
9357
9359 {
9360 return false;
9361 }
9362
9365 {
9366 return UATimeSpent.DEFAULT_DEPLOY;
9367 }
9368
9369
9370
9371
9373 {
9375 SetSynchDirty();
9376 }
9377
9379 {
9381 }
9382
9383
9385 {
9386 return false;
9387 }
9388
9391 {
9392 string att_type = "None";
9393
9394 if (ConfigIsExisting("soundAttType"))
9395 {
9396 att_type = ConfigGetString("soundAttType");
9397 }
9398
9400 }
9401
9403 {
9405 }
9406
9407
9408
9409
9410
9416
9418 {
9421
9423 }
9424
9425
9427 {
9429 return;
9430
9432
9435
9438
9439 SoundParameters params = new SoundParameters();
9443 }
9444
9445
9447 {
9449 return;
9450
9452 SetSynchDirty();
9453
9456 }
9457
9458
9460 {
9462 return;
9463
9465 SetSynchDirty();
9466
9469 }
9470
9472 {
9474 }
9475
9477 {
9479 }
9480
9483 {
9484 if (!
GetGame().IsDedicatedServer())
9485 {
9486 if (ConfigIsExisting("attachSoundSet"))
9487 {
9488 string cfg_path = "";
9489 string soundset = "";
9491
9494 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
9495 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
9496
9497 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
9498 {
9499 for (int i = 0; i < cfg_soundset_array.Count(); i++)
9500 {
9501 if (cfg_slot_array[i] == slot_type)
9502 {
9503 soundset = cfg_soundset_array[i];
9504 break;
9505 }
9506 }
9507 }
9508
9509 if (soundset != "")
9510 {
9511 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
9513 }
9514 }
9515 }
9516 }
9517
9519 {
9520
9521 }
9522
9523 void OnApply(PlayerBase player);
9524
9526 {
9527 return 1.0;
9528 };
9529
9531 {
9533 }
9534
9536 {
9538 }
9539
9541
9543 {
9544 SetDynamicPhysicsLifeTime(0.01);
9546 }
9547
9549 {
9550 array<string> zone_names = new array<string>;
9551 GetDamageZones(zone_names);
9552 for (int i = 0; i < zone_names.Count(); i++)
9553 {
9554 SetHealthMax(zone_names.Get(i),"Health");
9555 }
9556 SetHealthMax("","Health");
9557 }
9558
9561 {
9562 float global_health = GetHealth01("","Health");
9563 array<string> zones = new array<string>;
9564 GetDamageZones(zones);
9565
9566 for (int i = 0; i < zones.Count(); i++)
9567 {
9568 SetHealth01(zones.Get(i),"Health",global_health);
9569 }
9570 }
9571
9574 {
9575 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
9576 }
9577
9579 {
9580 if (!hasRootAsPlayer)
9581 {
9582 if (refParentIB)
9583 {
9584
9585 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
9586 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
9587
9588 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
9589 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
9590
9593 }
9594 else
9595 {
9596
9599 }
9600 }
9601 }
9602
9604 {
9606 {
9607 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
9608 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
9609 {
9610 float heatPermCoef = 1.0;
9612 while (ent)
9613 {
9614 heatPermCoef *= ent.GetHeatPermeabilityCoef();
9615 ent = ent.GetHierarchyParent();
9616 }
9617
9618 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
9619 }
9620 }
9621 }
9622
9624 {
9625
9626 EntityAI parent = GetHierarchyParent();
9627 if (!parent)
9628 {
9629 hasParent = false;
9630 hasRootAsPlayer = false;
9631 }
9632 else
9633 {
9634 hasParent = true;
9635 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
9636 refParentIB =
ItemBase.Cast(parent);
9637 }
9638 }
9639
9640 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
9641 {
9642
9643 }
9644
9646 {
9647
9648 return false;
9649 }
9650
9652 {
9653
9654
9655 return false;
9656 }
9657
9659 {
9660
9661 return false;
9662 }
9663
9666 {
9667 return !GetIsFrozen() &&
IsOpen();
9668 }
9669
9671 {
9672 bool hasParent = false, hasRootAsPlayer = false;
9674
9675 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
9676 bool foodDecay =
g_Game.IsFoodDecayEnabled();
9677
9678 if (wwtu || foodDecay)
9679 {
9683
9684 if (processWetness || processTemperature || processDecay)
9685 {
9687
9688 if (processWetness)
9689 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
9690
9691 if (processTemperature)
9693
9694 if (processDecay)
9695 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
9696 }
9697 }
9698 }
9699
9702 {
9704 }
9705
9707 {
9710
9711 return super.GetTemperatureFreezeThreshold();
9712 }
9713
9715 {
9718
9719 return super.GetTemperatureThawThreshold();
9720 }
9721
9723 {
9726
9727 return super.GetItemOverheatThreshold();
9728 }
9729
9731 {
9733 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
9734
9735 return super.GetTemperatureFreezeTime();
9736 }
9737
9739 {
9741 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
9742
9743 return super.GetTemperatureThawTime();
9744 }
9745
9750
9752 {
9753 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
9754 }
9755
9757 {
9758 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
9759 }
9760
9763 {
9765 }
9766
9768 {
9770 }
9771
9773 {
9775 }
9776
9779 {
9780 return null;
9781 }
9782
9785 {
9786 return false;
9787 }
9788
9790 {
9792 {
9795 if (!trg)
9796 {
9798 explosive = this;
9799 }
9800
9801 explosive.PairRemote(trg);
9803
9804 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
9805 trg.SetPersistentPairID(persistentID);
9806 explosive.SetPersistentPairID(persistentID);
9807
9808 return true;
9809 }
9810 return false;
9811 }
9812
9815 {
9816 float ret = 1.0;
9819 ret *= GetHealth01();
9820
9821 return ret;
9822 }
9823
9824 #ifdef DEVELOPER
9825 override void SetDebugItem()
9826 {
9827 super.SetDebugItem();
9828 _itemBase = this;
9829 }
9830
9832 {
9833 string text = super.GetDebugText();
9834
9836 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
9837
9838 return text;
9839 }
9840 #endif
9841
9843 {
9844 return true;
9845 }
9846
9848
9850
9852 {
9855 }
9856
9857
9865
9881}
9882
9884{
9886 if (entity)
9887 {
9888 bool is_item = entity.IsInherited(
ItemBase);
9889 if (is_item && full_quantity)
9890 {
9893 }
9894 }
9895 else
9896 {
9898 return NULL;
9899 }
9900 return entity;
9901}
9902
9904{
9905 if (item)
9906 {
9907 if (health > 0)
9908 item.SetHealth("", "", health);
9909
9910 if (item.CanHaveTemperature())
9911 {
9913 if (item.CanFreeze())
9914 item.SetFrozen(false);
9915 }
9916
9917 if (item.HasEnergyManager())
9918 {
9919 if (quantity >= 0)
9920 {
9921 item.GetCompEM().SetEnergy0To1(quantity);
9922 }
9923 else
9924 {
9926 }
9927 }
9928 else if (item.IsMagazine())
9929 {
9930 Magazine mag = Magazine.Cast(item);
9931 if (quantity >= 0)
9932 {
9933 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
9934 }
9935 else
9936 {
9938 }
9939
9940 }
9941 else
9942 {
9943 if (quantity >= 0)
9944 {
9945 item.SetQuantityNormalized(quantity, false);
9946 }
9947 else
9948 {
9950 }
9951
9952 }
9953 }
9954}
9955
9956#ifdef DEVELOPER
9958#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.