5092{
5094 {
5095 return true;
5096 }
5097};
5098
5100{
5101
5102};
5103
5104
5105
5107{
5111
5113
5116
5117
5118
5119
5120
5129
5135
5140
5145
5166 protected bool m_IsResultOfSplit
5167
5169
5174
5175
5176
5178
5182
5183
5184
5186
5189
5190
5191
5197
5198
5206
5209
5210
5212
5213
5215
5216
5221
5222
5227
5229
5230
5232
5233
5235 {
5240
5241 if (!
g_Game.IsDedicatedServer())
5242 {
5244 {
5246
5248 {
5250 }
5251 }
5252
5255 }
5256
5257 m_OldLocation = null;
5258
5260 {
5262 }
5263
5264 if (ConfigIsExisting("headSelectionsToHide"))
5265 {
5268 }
5269
5271 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5272 {
5274 }
5275
5277
5278 m_IsResultOfSplit = false;
5279
5281 }
5282
5284 {
5285 super.InitItemVariables();
5286
5292 m_Count = ConfigGetInt(
"count");
5293
5296
5301
5304
5309
5321
5325
5326
5329 if (ConfigIsExisting("canBeSplit"))
5330 {
5333 }
5334
5336 if (ConfigIsExisting("itemBehaviour"))
5338
5339
5342 RegisterNetSyncVariableInt("m_VarLiquidType");
5343 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5344
5345 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5346 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5347 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5348
5349 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5350 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5351 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5352 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5353
5354 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5355 RegisterNetSyncVariableBool("m_IsTakeable");
5356 RegisterNetSyncVariableBool("m_IsHologram");
5357
5360 {
5363 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
5364 }
5365
5367
5369 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5371
5373 }
5374
5376 {
5378 }
5379
5381 {
5384 {
5389 }
5390 }
5391
5392 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5393 {
5395 {
5398 }
5399
5401 }
5402
5404 {
5410 }
5411
5413
5415 {
5417
5418 if (!action)
5419 {
5420 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5421 return;
5422 }
5423
5425 if (!ai)
5426 {
5428 return;
5429 }
5430
5432 if (!action_array)
5433 {
5434 action_array = new array<ActionBase_Basic>;
5436 }
5437 if (LogManager.IsActionLogEnable())
5438 {
5439 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5440 }
5441
5442 if (action_array.Find(action) != -1)
5443 {
5444 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5445 }
5446 else
5447 {
5448 action_array.Insert(action);
5449 }
5450 }
5451
5453 {
5454 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
5455 ActionBase action = player.GetActionManager().GetAction(actionName);
5458
5459 if (action_array)
5460 {
5461 action_array.RemoveItem(action);
5462 }
5463 }
5464
5465
5466
5468 {
5469 ActionOverrideData overrideData = new ActionOverrideData();
5473
5475 if (!actionMap)
5476 {
5479 }
5480
5481 actionMap.Insert(this.
Type(), overrideData);
5482
5483 }
5484
5486
5488
5489
5491 {
5494
5497
5498 string config_to_search = "CfgVehicles";
5499 string muzzle_owner_config;
5500
5502 {
5503 if (IsInherited(Weapon))
5504 config_to_search = "CfgWeapons";
5505
5506 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5507
5508 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5509
5510 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
5511
5512 if (config_OnFire_subclass_count > 0)
5513 {
5514 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5515
5516 for (int i = 0; i < config_OnFire_subclass_count; i++)
5517 {
5518 string particle_class = "";
5519 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
5520 string config_OnFire_entry = config_OnFire_class + particle_class;
5521 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5522 WPOF_array.Insert(WPOF);
5523 }
5524
5525
5527 }
5528 }
5529
5531 {
5532 config_to_search = "CfgWeapons";
5533 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5534
5535 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5536
5537 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
5538
5539 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
5540 {
5541 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
5542
5543 for (i = 0; i < config_OnBulletCasingEject_count; i++)
5544 {
5545 string particle_class2 = "";
5546 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
5547 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
5548 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
5549 WPOBE_array.Insert(WPOBE);
5550 }
5551
5552
5554 }
5555 }
5556 }
5557
5558
5560 {
5563
5565 {
5566 string config_to_search = "CfgVehicles";
5567
5568 if (IsInherited(Weapon))
5569 config_to_search = "CfgWeapons";
5570
5571 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5572 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
5573
5574 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
5575 {
5576
5578
5580 {
5582 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
5584 return;
5585 }
5586
5589
5590
5591
5592 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
5593 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
5594
5595 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
5596 {
5597 string particle_class = "";
5598 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
5599 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
5600 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
5601
5602 if (entry_type == CT_CLASS)
5603 {
5604 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
5605 WPOOH_array.Insert(WPOF);
5606 }
5607 }
5608
5609
5611 }
5612 }
5613 }
5614
5616 {
5618 }
5619
5621 {
5623 {
5625
5628
5631
5632 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5633 }
5634 }
5635
5637 {
5639 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5640
5642 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5643
5645 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5646
5648 {
5650 }
5651 }
5652
5654 {
5656 }
5657
5659 {
5662 else
5664
5666 {
5669 }
5670 else
5671 {
5674
5677 }
5678
5680 }
5681
5683 {
5685 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5686 }
5687
5689 {
5691 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5693 }
5694
5696 {
5698 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5699 }
5700
5702 {
5705
5706 OverheatingParticle OP = new OverheatingParticle();
5711
5713 }
5714
5716 {
5719
5720 return -1;
5721 }
5722
5724 {
5726 {
5729
5730 for (int i = count; i > 0; --i)
5731 {
5732 int id = i - 1;
5735
5738
5739 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
5740 {
5741 if (p)
5742 {
5745 }
5746 }
5747 }
5748 }
5749 }
5750
5752 {
5754 {
5756 {
5757 int id = i - 1;
5759
5760 if (OP)
5761 {
5763
5764 if (p)
5765 {
5767 }
5768
5769 delete OP;
5770 }
5771 }
5772
5775 }
5776 }
5777
5780 {
5781 return 0.0;
5782 }
5783
5784
5786 {
5787 return 250;
5788 }
5789
5791 {
5792 return 0;
5793 }
5794
5797 {
5799 return true;
5800
5801 return false;
5802 }
5803
5806 {
5809
5811 {
5813 }
5814 else
5815 {
5816
5818 }
5819
5821 }
5822
5829 {
5830 return -1;
5831 }
5832
5833
5834
5835
5837 {
5839 {
5840 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
5841 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
5842
5843 if (r_index >= 0)
5844 {
5845 InventoryLocation r_il = new InventoryLocation;
5846 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
5847
5848 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
5851 {
5852 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
5853 }
5855 {
5856 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
5857 }
5858
5859 }
5860
5861 player.GetHumanInventory().ClearUserReservedLocation(this);
5862 }
5863
5866 }
5867
5868
5869
5870
5872 {
5873 return ItemBase.m_DebugActionsMask;
5874 }
5875
5877 {
5878 return ItemBase.m_DebugActionsMask & mask;
5879 }
5880
5882 {
5883 ItemBase.m_DebugActionsMask = mask;
5884 }
5885
5887 {
5888 ItemBase.m_DebugActionsMask |= mask;
5889 }
5890
5892 {
5893 ItemBase.m_DebugActionsMask &= ~mask;
5894 }
5895
5897 {
5899 {
5901 }
5902 else
5903 {
5905 }
5906 }
5907
5908
5910 {
5911 if (GetEconomyProfile())
5912 {
5913 float q_max = GetEconomyProfile().GetQuantityMax();
5914 if (q_max > 0)
5915 {
5916 float q_min = GetEconomyProfile().GetQuantityMin();
5917 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
5918
5920 {
5921 ComponentEnergyManager comp = GetCompEM();
5923 {
5925 }
5926 }
5928 {
5930
5931 }
5932
5933 }
5934 }
5935 }
5936
5939 {
5940 EntityAI parent = GetHierarchyParent();
5941
5942 if (parent)
5943 {
5944 InventoryLocation inventory_location_to_lock = new InventoryLocation;
5945 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
5946 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
5947 }
5948 }
5949
5952 {
5953 EntityAI parent = GetHierarchyParent();
5954
5955 if (parent)
5956 {
5957 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
5958 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
5959 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
5960 }
5961 }
5962
5964 {
5965
5966
5967
5968
5970
5972 {
5973 if (ScriptInputUserData.CanStoreInputUserData())
5974 {
5975 ScriptInputUserData ctx = new ScriptInputUserData;
5981 ctx.
Write(use_stack_max);
5984
5986 {
5987 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
5988 }
5989 }
5990 }
5991 else if (!
g_Game.IsMultiplayer())
5992 {
5994 }
5995 }
5996
5998 {
6000 }
6001
6003 {
6005 }
6006
6008 {
6010 }
6011
6013 {
6014
6015 return false;
6016 }
6017
6019 {
6020 return false;
6021 }
6022
6026 {
6027 return false;
6028 }
6029
6031 {
6032 return "";
6033 }
6034
6036
6038 {
6039 return false;
6040 }
6041
6043 {
6044 return true;
6045 }
6046
6047
6048
6050 {
6051 return true;
6052 }
6053
6055 {
6056 return true;
6057 }
6058
6060 {
6061 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6063 }
6064
6066 {
6068 }
6069
6071 {
6073 if (!is_being_placed)
6075 SetSynchDirty();
6076 }
6077
6078
6080
6082 {
6084 }
6085
6087 {
6089 }
6090
6092 {
6093 return 1;
6094 }
6095
6097 {
6098 return false;
6099 }
6100
6102 {
6104 SetSynchDirty();
6105 }
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6142 {
6143 super.OnMovedInsideCargo(container);
6144
6145 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6146 }
6147
6148 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6149 {
6150 super.EEItemLocationChanged(oldLoc, newLoc);
6151
6152 PlayerBase newPlayer = null;
6153 PlayerBase oldPlayer = null;
6154
6155 if (newLoc.GetParent())
6156 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6157
6158 if (oldLoc.GetParent())
6159 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6160
6162 {
6163 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6164
6165 if (rIndex >= 0)
6166 {
6167 InventoryLocation rIl = new InventoryLocation;
6168 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6169
6170 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6173 {
6174 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6175 }
6177 {
6179 }
6180
6181 }
6182 }
6183
6185 {
6186 if (newPlayer)
6187 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6188
6189 if (newPlayer == oldPlayer)
6190 {
6191 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6192 {
6194 {
6195 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6196 {
6197 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6198 }
6199 }
6200 else
6201 {
6202 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6203 }
6204 }
6205
6206 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6207 {
6208 int type = oldLoc.GetType();
6210 {
6211 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6212 }
6214 {
6215 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6216 }
6217 }
6218 if (!m_OldLocation)
6219 {
6220 m_OldLocation = new InventoryLocation;
6221 }
6222 m_OldLocation.Copy(oldLoc);
6223 }
6224 else
6225 {
6226 if (m_OldLocation)
6227 {
6228 m_OldLocation.Reset();
6229 }
6230 }
6231
6232 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6233 }
6234 else
6235 {
6236 if (newPlayer)
6237 {
6238 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6239 if (resIndex >= 0)
6240 {
6241 InventoryLocation il = new InventoryLocation;
6242 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6244 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6247 {
6248 il.
GetParent().GetOnReleaseLock().Invoke(it);
6249 }
6251 {
6253 }
6254
6255 }
6256 }
6258 {
6259
6261 }
6262
6263 if (m_OldLocation)
6264 {
6265 m_OldLocation.Reset();
6266 }
6267 }
6268
6270 {
6271 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6272 }
6273
6275 {
6276 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6277 }
6278 }
6279
6280 override void EOnContact(IEntity other, Contact extra)
6281 {
6283 {
6284 int liquidType = -1;
6286 if (impactSpeed > 0.0)
6287 {
6289 #ifndef SERVER
6291 #else
6293 SetSynchDirty();
6294 #endif
6296 }
6297 }
6298
6299 #ifdef SERVER
6300 if (GetCompEM() && GetCompEM().IsPlugged())
6301 {
6302 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6303 GetCompEM().UnplugThis();
6304 }
6305 #endif
6306 }
6307
6309
6311 {
6313 }
6314
6316 {
6317
6318 }
6319
6321 {
6322 super.OnItemLocationChanged(old_owner, new_owner);
6323
6324 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6325 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6326
6327 if (!relatedPlayer && playerNew)
6328 relatedPlayer = playerNew;
6329
6330 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6331 {
6333 if (actionMgr)
6334 {
6335 ActionBase currentAction = actionMgr.GetRunningAction();
6336 if (currentAction)
6338 }
6339 }
6340
6341 Man ownerPlayerOld = null;
6342 Man ownerPlayerNew = null;
6343
6344 if (old_owner)
6345 {
6346 if (old_owner.
IsMan())
6347 {
6348 ownerPlayerOld = Man.Cast(old_owner);
6349 }
6350 else
6351 {
6352 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6353 }
6354 }
6355 else
6356 {
6358 {
6360
6361 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6362 {
6363 GetCompEM().UnplugThis();
6364 }
6365 }
6366 }
6367
6368 if (new_owner)
6369 {
6370 if (new_owner.
IsMan())
6371 {
6372 ownerPlayerNew = Man.Cast(new_owner);
6373 }
6374 else
6375 {
6376 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6377 }
6378 }
6379
6380 if (ownerPlayerOld != ownerPlayerNew)
6381 {
6382 if (ownerPlayerOld)
6383 {
6384 array<EntityAI> subItemsExit = new array<EntityAI>;
6386 for (int i = 0; i < subItemsExit.Count(); i++)
6387 {
6390 }
6391 }
6392
6393 if (ownerPlayerNew)
6394 {
6395 array<EntityAI> subItemsEnter = new array<EntityAI>;
6397 for (int j = 0; j < subItemsEnter.Count(); j++)
6398 {
6401 }
6402 }
6403 }
6404 else if (ownerPlayerNew != null)
6405 {
6406 PlayerBase nplayer;
6407 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6408 {
6409 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6411 for (int k = 0; k < subItemsUpdate.Count(); k++)
6412 {
6414 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6415 }
6416 }
6417 }
6418
6419 if (old_owner)
6420 old_owner.OnChildItemRemoved(this);
6421 if (new_owner)
6422 new_owner.OnChildItemReceived(this);
6423 }
6424
6425
6427 {
6428 super.EEDelete(parent);
6429 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6430 if (player)
6431 {
6433
6434 if (player.IsAlive())
6435 {
6436 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6437 if (r_index >= 0)
6438 {
6439 InventoryLocation r_il = new InventoryLocation;
6440 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6441
6442 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6445 {
6446 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6447 }
6449 {
6450 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6451 }
6452
6453 }
6454
6455 player.RemoveQuickBarEntityShortcut(this);
6456 }
6457 }
6458 }
6459
6461 {
6462 super.EEKilled(killer);
6463
6466 {
6467 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6468 {
6469 if (IsMagazine())
6470 {
6471 if (Magazine.Cast(this).GetAmmoCount() > 0)
6472 {
6474 }
6475 }
6476 else
6477 {
6479 }
6480 }
6481 }
6482 }
6483
6485 {
6486 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6487
6488 super.OnWasAttached(parent, slot_id);
6489
6492
6495 }
6496
6498 {
6499 super.OnWasDetached(parent, slot_id);
6500
6503
6506 }
6507
6509 {
6510 int idx;
6513
6514 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6515 if (inventory_slots.Count() < 1)
6516 {
6517 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6518 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6519 }
6520 else
6521 {
6522 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6523 }
6524
6525 idx = inventory_slots.Find(slot);
6526 if (idx < 0)
6527 return "";
6528
6529 return attach_types.Get(idx);
6530 }
6531
6533 {
6534 int idx = -1;
6535 string slot;
6536
6539
6540 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6541 if (inventory_slots.Count() < 1)
6542 {
6543 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6544 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6545 }
6546 else
6547 {
6548 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6549 if (detach_types.Count() < 1)
6550 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6551 }
6552
6553 for (int i = 0; i < inventory_slots.Count(); i++)
6554 {
6555 slot = inventory_slots.Get(i);
6556 }
6557
6558 if (slot != "")
6559 {
6560 if (detach_types.Count() == 1)
6561 idx = 0;
6562 else
6563 idx = inventory_slots.Find(slot);
6564 }
6565 if (idx < 0)
6566 return "";
6567
6568 return detach_types.Get(idx);
6569 }
6570
6572 {
6573
6575
6576
6577 float min_time = 1;
6578 float max_time = 3;
6579 float delay = Math.RandomFloat(min_time, max_time);
6580
6581 explode_timer.Run(delay, this, "DoAmmoExplosion");
6582 }
6583
6585 {
6586 Magazine magazine = Magazine.Cast(this);
6587 int pop_sounds_count = 6;
6588 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
6589
6590
6591 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
6592 string sound_name = pop_sounds[ sound_idx ];
6593 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
6594
6595
6596 magazine.ServerAddAmmoCount(-1);
6597
6598
6599 float min_temp_to_explode = 100;
6600
6601 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
6602 {
6604 }
6605 }
6606
6607
6608 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
6609 {
6610 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
6611
6612 const int CHANCE_DAMAGE_CARGO = 4;
6613 const int CHANCE_DAMAGE_ATTACHMENT = 1;
6614 const int CHANCE_DAMAGE_NOTHING = 2;
6615
6617 {
6618 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
6619 int chances;
6620 int rnd;
6621
6622 if (GetInventory().GetCargo())
6623 {
6624 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6625 rnd = Math.RandomInt(0,chances);
6626
6627 if (rnd < CHANCE_DAMAGE_CARGO)
6628 {
6630 }
6631 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
6632 {
6634 }
6635 }
6636 else
6637 {
6638 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6639 rnd = Math.RandomInt(0,chances);
6640
6641 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
6642 {
6644 }
6645 }
6646 }
6647 }
6648
6650 {
6651 CargoBase cargo = GetInventory().GetCargo();
6652 if (cargo)
6653 {
6655 if (item_count > 0)
6656 {
6657 int random_pick = Math.RandomInt(0, item_count);
6659 if (!item.IsExplosive())
6660 {
6661 item.AddHealth("","",damage);
6662 return true;
6663 }
6664 }
6665 }
6666 return false;
6667 }
6668
6670 {
6671 GameInventory inventory = GetInventory();
6673 if (attachment_count > 0)
6674 {
6675 int random_pick = Math.RandomInt(0, attachment_count);
6677 if (!attachment.IsExplosive())
6678 {
6679 attachment.AddHealth("","",damage);
6680 return true;
6681 }
6682 }
6683 return false;
6684 }
6685
6687 {
6689 }
6690
6692 {
6694 return GetInventory().CanRemoveEntity();
6695
6696 return false;
6697 }
6698
6700 {
6701
6703 return false;
6704
6705
6707 return false;
6708
6709
6710
6712 if (delta == 0)
6713 return false;
6714
6715
6716 return true;
6717 }
6718
6720 {
6722 {
6723 if (ScriptInputUserData.CanStoreInputUserData())
6724 {
6725 ScriptInputUserData ctx = new ScriptInputUserData;
6730 ctx.
Write(destination_entity);
6734 }
6735 }
6736 else if (!
g_Game.IsMultiplayer())
6737 {
6739 }
6740 }
6741
6743 {
6744 float split_quantity_new;
6748 InventoryLocation loc = new InventoryLocation;
6749
6750 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6751 {
6753 split_quantity_new = stack_max;
6754 else
6756
6758 {
6759 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6760 if (new_item)
6761 {
6762 new_item.SetResultOfSplit(true);
6763 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6765 new_item.
SetQuantity(split_quantity_new,
false,
true);
6766 }
6767 }
6768 }
6769 else if (destination_entity && slot_id == -1)
6770 {
6771 if (quantity > stack_max)
6772 split_quantity_new = stack_max;
6773 else
6774 split_quantity_new = quantity;
6775
6777 {
6778 GameInventory destinationInventory = destination_entity.GetInventory();
6780 {
6783 }
6784
6785 if (new_item)
6786 {
6787 new_item.SetResultOfSplit(true);
6788 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6790 new_item.
SetQuantity(split_quantity_new,
false,
true);
6791 }
6792 }
6793 }
6794 else
6795 {
6796 if (stack_max != 0)
6797 {
6799 {
6801 }
6802
6803 if (split_quantity_new == 0)
6804 {
6805 if (!
g_Game.IsMultiplayer())
6806 player.PhysicalPredictiveDropItem(this);
6807 else
6808 player.ServerDropEntity(this);
6809 return;
6810 }
6811
6813 {
6815
6816 if (new_item)
6817 {
6818 new_item.SetResultOfSplit(true);
6819 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6822 new_item.PlaceOnSurface();
6823 }
6824 }
6825 }
6826 }
6827 }
6828
6830 {
6831 float split_quantity_new;
6835 InventoryLocation loc = new InventoryLocation;
6836
6837 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6838 {
6840 split_quantity_new = stack_max;
6841 else
6843
6845 {
6846 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6847 if (new_item)
6848 {
6849 new_item.SetResultOfSplit(true);
6850 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6852 new_item.
SetQuantity(split_quantity_new,
false,
true);
6853 }
6854 }
6855 }
6856 else if (destination_entity && slot_id == -1)
6857 {
6858 if (quantity > stack_max)
6859 split_quantity_new = stack_max;
6860 else
6861 split_quantity_new = quantity;
6862
6864 {
6865 GameInventory destinationInventory = destination_entity.GetInventory();
6867 {
6870 }
6871
6872 if (new_item)
6873 {
6874 new_item.SetResultOfSplit(true);
6875 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6877 new_item.
SetQuantity(split_quantity_new,
false,
true);
6878 }
6879 }
6880 }
6881 else
6882 {
6883 if (stack_max != 0)
6884 {
6886 {
6888 }
6889
6891 {
6893
6894 if (new_item)
6895 {
6896 new_item.SetResultOfSplit(true);
6897 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6900 new_item.PlaceOnSurface();
6901 }
6902 }
6903 }
6904 }
6905 }
6906
6908 {
6910 {
6911 if (ScriptInputUserData.CanStoreInputUserData())
6912 {
6913 ScriptInputUserData ctx = new ScriptInputUserData;
6918 dst.WriteToContext(ctx);
6920 }
6921 }
6922 else if (!
g_Game.IsMultiplayer())
6923 {
6925 }
6926 }
6927
6929 {
6931 {
6932 if (ScriptInputUserData.CanStoreInputUserData())
6933 {
6934 ScriptInputUserData ctx = new ScriptInputUserData;
6939 ctx.
Write(destination_entity);
6945 }
6946 }
6947 else if (!
g_Game.IsMultiplayer())
6948 {
6950 }
6951 }
6952
6954 {
6956 }
6957
6959 {
6961 float split_quantity_new;
6963 if (dst.IsValid())
6964 {
6965 int slot_id = dst.GetSlot();
6967
6968 if (quantity > stack_max)
6969 split_quantity_new = stack_max;
6970 else
6971 split_quantity_new = quantity;
6972
6974 {
6976
6977 if (new_item)
6978 {
6979 new_item.SetResultOfSplit(true);
6980 MiscGameplayFunctions.TransferItemProperties(this,new_item);
6982 new_item.
SetQuantity(split_quantity_new,
false,
true);
6983 }
6984
6985 return new_item;
6986 }
6987 }
6988
6989 return null;
6990 }
6991
6993 {
6995 float split_quantity_new;
6997 if (destination_entity)
6998 {
7000 if (quantity > stackable)
7001 split_quantity_new = stackable;
7002 else
7003 split_quantity_new = quantity;
7004
7006 {
7007 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7008 if (new_item)
7009 {
7010 new_item.SetResultOfSplit(true);
7011 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7013 new_item.
SetQuantity(split_quantity_new,
false,
true);
7014 }
7015 }
7016 }
7017 }
7018
7020 {
7022 {
7023 if (ScriptInputUserData.CanStoreInputUserData())
7024 {
7025 ScriptInputUserData ctx = new ScriptInputUserData;
7030 ItemBase destination_entity =
this;
7031 ctx.
Write(destination_entity);
7035 }
7036 }
7037 else if (!
g_Game.IsMultiplayer())
7038 {
7040 }
7041 }
7042
7044 {
7046 float split_quantity_new;
7048 if (player)
7049 {
7051 if (quantity > stackable)
7052 split_quantity_new = stackable;
7053 else
7054 split_quantity_new = quantity;
7055
7057 {
7058 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7059 new_item =
ItemBase.Cast(in_hands);
7060 if (new_item)
7061 {
7062 new_item.SetResultOfSplit(true);
7063 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7065 new_item.SetQuantity(split_quantity_new, false, true);
7066 }
7067 }
7068 }
7069 }
7070
7072 {
7074 float split_quantity_new = Math.Floor(quantity * 0.5);
7075
7077 return;
7078
7080
7081 if (new_item)
7082 {
7083 if (new_item.GetQuantityMax() < split_quantity_new)
7084 {
7085 split_quantity_new = new_item.GetQuantityMax();
7086 }
7087
7088 new_item.SetResultOfSplit(true);
7089 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7090
7092 {
7095 }
7096 else
7097 {
7099 new_item.
SetQuantity(split_quantity_new,
false,
true);
7100 }
7101 }
7102 }
7103
7105 {
7107 float split_quantity_new = Math.Floor(quantity / 2);
7108
7110 return;
7111
7112 InventoryLocation invloc = new InventoryLocation;
7114
7116 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7117
7118 if (new_item)
7119 {
7120 if (new_item.GetQuantityMax() < split_quantity_new)
7121 {
7122 split_quantity_new = new_item.GetQuantityMax();
7123 }
7125 {
7128 }
7129 else if (split_quantity_new > 1)
7130 {
7132 new_item.
SetQuantity(split_quantity_new,
false,
true);
7133 }
7134 }
7135 }
7136
7139 {
7140 SetWeightDirty();
7142
7143 if (parent)
7144 parent.OnAttachmentQuantityChangedEx(this, delta);
7145
7147 {
7149 {
7151 }
7153 {
7154 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7156 }
7157 }
7158 }
7159
7162 {
7163
7164 }
7165
7168 {
7170 }
7171
7173 {
7174 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7175
7177 {
7178 if (newLevel == GameConstants.STATE_RUINED)
7179 {
7181 EntityAI parent = GetHierarchyParent();
7182 if (parent && parent.IsFireplace())
7183 {
7184 CargoBase cargo = GetInventory().GetCargo();
7185 if (cargo)
7186 {
7188 {
7190 }
7191 }
7192 }
7193 }
7194
7196 {
7197
7199 return;
7200 }
7201
7202 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7203 {
7205 }
7206 }
7207 }
7208
7209
7211 {
7212 super.OnRightClick();
7213
7215 {
7217 {
7218 if (ScriptInputUserData.CanStoreInputUserData())
7219 {
7220 EntityAI root = GetHierarchyRoot();
7221 Man playerOwner = GetHierarchyRootPlayer();
7222 InventoryLocation dst = new InventoryLocation;
7223
7224
7225 if (!playerOwner && root && root == this)
7226 {
7228 }
7229 else
7230 {
7231
7232 GetInventory().GetCurrentInventoryLocation(dst);
7234 {
7235 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7237 {
7239 }
7240 else
7241 {
7243
7244
7245 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7246 {
7248 }
7249 else
7250 {
7251 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7252 }
7253 }
7254 }
7255 }
7256
7257 ScriptInputUserData ctx = new ScriptInputUserData;
7265 }
7266 }
7267 else if (!
g_Game.IsMultiplayer())
7268 {
7270 }
7271 }
7272 }
7273
7275 {
7276 if (root)
7277 {
7278 vector m4[4];
7279 root.GetTransform(m4);
7280 dst.SetGround(this, m4);
7281 }
7282 else
7283 {
7284 GetInventory().GetCurrentInventoryLocation(dst);
7285 }
7286 }
7287
7288 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7289 {
7290
7291 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7292 return false;
7293
7294 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7295 return false;
7296
7297
7299 return false;
7300
7301
7302 Magazine mag = Magazine.Cast(this);
7303 if (mag)
7304 {
7305 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7306 return false;
7307
7308 if (stack_max_limit)
7309 {
7310 Magazine other_mag = Magazine.Cast(other_item);
7311 if (other_item)
7312 {
7313 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7314 return false;
7315 }
7316
7317 }
7318 }
7319 else
7320 {
7321
7323 return false;
7324
7326 return false;
7327 }
7328
7329 PlayerBase player = null;
7330 if (CastTo(player, GetHierarchyRootPlayer()))
7331 {
7332 if (player.GetInventory().HasAttachment(this))
7333 return false;
7334
7335 if (player.IsItemsToDelete())
7336 return false;
7337 }
7338
7339 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7340 return false;
7341
7342 int slotID;
7344 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7345 return false;
7346
7347 return true;
7348 }
7349
7351 {
7353 }
7354
7356 {
7357 return m_IsResultOfSplit;
7358 }
7359
7361 {
7362 m_IsResultOfSplit = value;
7363 }
7364
7366 {
7368 }
7369
7371 {
7372 float other_item_quantity = other_item.GetQuantity();
7373 float this_free_space;
7374
7376
7378
7379 if (other_item_quantity > this_free_space)
7380 {
7381 return this_free_space;
7382 }
7383 else
7384 {
7385 return other_item_quantity;
7386 }
7387 }
7388
7390 {
7392 }
7393
7395 {
7397 return;
7398
7399 if (!IsMagazine() && other_item)
7400 {
7402 if (quantity_used != 0)
7403 {
7404 float hp1 = GetHealth01("","");
7405 float hp2 = other_item.GetHealth01("","");
7406 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7407 hpResult = hpResult / (
GetQuantity() + quantity_used);
7408
7409 hpResult *= GetMaxHealth();
7410 Math.Round(hpResult);
7411 SetHealth("", "Health", hpResult);
7412
7414 other_item.AddQuantity(-quantity_used);
7415 }
7416 }
7418 }
7419
7421 {
7422 #ifdef SERVER
7423 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7424 GetHierarchyParent().IncreaseLifetimeUp();
7425 #endif
7426 };
7427
7429 {
7430 PlayerBase p = PlayerBase.Cast(player);
7431
7432 array<int> recipesIds = p.m_Recipes;
7433 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7434 if (moduleRecipesManager)
7435 {
7436 EntityAI itemInHands = player.GetEntityInHands();
7437 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7438 }
7439
7440 for (int i = 0;i < recipesIds.Count(); i++)
7441 {
7442 int key = recipesIds.Get(i);
7443 string recipeName = moduleRecipesManager.GetRecipeName(key);
7445 }
7446 }
7447
7448
7449 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7450 {
7451 super.GetDebugActions(outputList);
7452
7453
7459
7460
7465
7470
7471
7475
7476
7478 {
7482 }
7483
7486
7487
7491
7493
7494 InventoryLocation loc = new InventoryLocation();
7495 GetInventory().GetCurrentInventoryLocation(loc);
7497 {
7498 if (Gizmo_IsSupported())
7501 }
7502
7504 }
7505
7506
7507
7508
7510 {
7511 super.OnAction(action_id, player, ctx);
7512
7514 {
7515 switch (action_id)
7516 {
7520 return true;
7524 return true;
7525 }
7526 }
7527
7529 {
7530 switch (action_id)
7531 {
7533 Delete();
7534 return true;
7535 }
7536 }
7537
7538 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
7539 {
7540 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7541 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
7542 PlayerBase p = PlayerBase.Cast(player);
7543 if (
EActions.RECIPES_RANGE_START < 1000)
7544 {
7545 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7546 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7547 }
7548 }
7549 #ifndef SERVER
7550 else if (action_id ==
EActions.WATCH_PLAYER)
7551 {
7552 PluginDeveloper.SetDeveloperItemClientEx(player);
7553 }
7554 #endif
7556 {
7557 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7558 {
7559 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7560 OnDebugButtonPressServer(id + 1);
7561 }
7562
7563 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7564 {
7565 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
7567 }
7568
7569 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
7570 {
7571 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
7573 }
7574
7575 else if (action_id ==
EActions.ADD_QUANTITY)
7576 {
7577 if (IsMagazine())
7578 {
7579 Magazine mag = Magazine.Cast(this);
7580 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
7581 }
7582 else
7583 {
7585 }
7586
7587 if (m_EM)
7588 {
7589 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
7590 }
7591
7592 }
7593
7594 else if (action_id ==
EActions.REMOVE_QUANTITY)
7595 {
7596 if (IsMagazine())
7597 {
7598 Magazine mag2 = Magazine.Cast(this);
7599 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
7600 }
7601 else
7602 {
7604 }
7605 if (m_EM)
7606 {
7607 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
7608 }
7609
7610 }
7611
7612 else if (action_id ==
EActions.SET_QUANTITY_0)
7613 {
7615
7616 if (m_EM)
7617 {
7618 m_EM.SetEnergy(0);
7619 }
7620 }
7621
7622 else if (action_id ==
EActions.SET_MAX_QUANTITY)
7623 {
7625
7626 if (m_EM)
7627 {
7628 m_EM.SetEnergy(m_EM.GetEnergyMax());
7629 }
7630 }
7631
7632 else if (action_id ==
EActions.ADD_HEALTH)
7633 {
7634 AddHealth("","",GetMaxHealth("","Health")/5);
7635 }
7636 else if (action_id ==
EActions.REMOVE_HEALTH)
7637 {
7638 AddHealth("","",-GetMaxHealth("","Health")/5);
7639 }
7640 else if (action_id ==
EActions.DESTROY_HEALTH)
7641 {
7642 SetHealth01("","",0);
7643 }
7644 else if (action_id ==
EActions.WATCH_ITEM)
7645 {
7647 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
7648 #ifdef DEVELOPER
7649 SetDebugDeveloper_item(this);
7650 #endif
7651 }
7652
7653 else if (action_id ==
EActions.ADD_TEMPERATURE)
7654 {
7655 AddTemperature(20);
7656
7657 }
7658
7659 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
7660 {
7661 AddTemperature(-20);
7662
7663 }
7664
7665 else if (action_id ==
EActions.FLIP_FROZEN)
7666 {
7667 SetFrozen(!GetIsFrozen());
7668
7669 }
7670
7671 else if (action_id ==
EActions.ADD_WETNESS)
7672 {
7674
7675 }
7676
7677 else if (action_id ==
EActions.REMOVE_WETNESS)
7678 {
7680
7681 }
7682
7683 else if (action_id ==
EActions.LIQUIDTYPE_UP)
7684 {
7687
7688
7689 }
7690
7691 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
7692 {
7695 }
7696
7697 else if (action_id ==
EActions.MAKE_SPECIAL)
7698 {
7699 auto debugParams = DebugSpawnParams.WithPlayer(player);
7700 OnDebugSpawnEx(debugParams);
7701 }
7702
7703 }
7704
7705
7706 return false;
7707 }
7708
7709
7710
7711
7715
7718
7719
7720
7722 {
7723 return false;
7724 }
7725
7726
7728 {
7729 return true;
7730 }
7731
7732
7734 {
7735 return true;
7736 }
7737
7738
7739
7741 {
7742 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
7743 return g_Game.ConfigIsExisting(config_path);
7744 }
7745
7748 {
7749 return null;
7750 }
7751
7753 {
7754 return false;
7755 }
7756
7758 {
7759 return false;
7760 }
7761
7765
7766
7768 {
7769 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7770 return module_repairing.CanRepair(this, item_repair_kit);
7771 }
7772
7773
7774 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
7775 {
7776 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7777 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
7778 }
7779
7780
7782 {
7783
7784
7785
7786
7787
7788
7789
7790
7791 return 1;
7792 }
7793
7794
7795
7797 {
7799 }
7800
7801
7802
7804 {
7806 }
7807
7808
7817 {
7818 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7819
7820 if (player)
7821 {
7822 player.MessageStatus(text);
7823 }
7824 }
7825
7826
7835 {
7836 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7837
7838 if (player)
7839 {
7840 player.MessageAction(text);
7841 }
7842 }
7843
7844
7853 {
7854 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7855
7856 if (player)
7857 {
7858 player.MessageFriendly(text);
7859 }
7860 }
7861
7862
7871 {
7872 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7873
7874 if (player)
7875 {
7876 player.MessageImportant(text);
7877 }
7878 }
7879
7881 {
7882 return true;
7883 }
7884
7885
7886 override bool KindOf(
string tag)
7887 {
7888 bool found = false;
7889 string item_name = this.
GetType();
7891 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
7892
7893 int array_size = item_tag_array.Count();
7894 for (int i = 0; i < array_size; i++)
7895 {
7896 if (item_tag_array.Get(i) == tag)
7897 {
7898 found = true;
7899 break;
7900 }
7901 }
7902 return found;
7903 }
7904
7905
7907 {
7908
7909 super.OnRPC(sender, rpc_type,ctx);
7910
7911
7912 switch (rpc_type)
7913 {
7914 #ifndef SERVER
7915 case ERPCs.RPC_SOUND_LOCK_ATTACH:
7916 Param2<bool, string> p = new Param2<bool, string>(false, "");
7917
7919 return;
7920
7921 bool play = p.param1;
7922 string soundSet = p.param2;
7923
7924 if (play)
7925 {
7927 {
7929 {
7931 }
7932 }
7933 else
7934 {
7936 }
7937 }
7938 else
7939 {
7941 }
7942
7943 break;
7944 #endif
7945
7946 }
7947
7949 {
7951 }
7952 }
7953
7954
7955
7956
7958 {
7959 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
7960 return plugin.GetID(
name);
7961 }
7962
7964 {
7965 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
7966 return plugin.GetName(id);
7967 }
7968
7971 {
7972
7973
7974 int varFlags;
7975 if (!ctx.
Read(varFlags))
7976 return;
7977
7978 if (varFlags & ItemVariableFlags.FLOAT)
7979 {
7981 }
7982 }
7983
7985 {
7986
7987 super.SerializeNumericalVars(floats_out);
7988
7989
7990
7992 {
7994 }
7995
7997 {
7999 }
8000
8002 {
8004 }
8005
8007 {
8012 }
8013
8015 {
8017 }
8018 }
8019
8021 {
8022
8023 super.DeSerializeNumericalVars(floats);
8024
8025
8026 int index = 0;
8027 int mask = Math.Round(floats.Get(index));
8028
8029 index++;
8030
8032 {
8034 {
8036 }
8037 else
8038 {
8039 float quantity = floats.Get(index);
8041 }
8042 index++;
8043 }
8044
8046 {
8047 float wet = floats.Get(index);
8049 index++;
8050 }
8051
8053 {
8054 int liquidtype = Math.Round(floats.Get(index));
8056 index++;
8057 }
8058
8060 {
8062 index++;
8064 index++;
8066 index++;
8068 index++;
8069 }
8070
8072 {
8073 int cleanness = Math.Round(floats.Get(index));
8075 index++;
8076 }
8077 }
8078
8080 {
8081 super.WriteVarsToCTX(ctx);
8082
8083
8085 {
8087 }
8088
8090 {
8092 }
8093
8095 {
8097 }
8098
8100 {
8101 int r,g,b,a;
8107 }
8108
8110 {
8112 }
8113 }
8114
8116 {
8117 if (!super.ReadVarsFromCTX(ctx,version))
8118 return false;
8119
8120 int intValue;
8121 float value;
8122
8123 if (version < 140)
8124 {
8125 if (!ctx.
Read(intValue))
8126 return false;
8127
8128 m_VariablesMask = intValue;
8129 }
8130
8132 {
8133 if (!ctx.
Read(value))
8134 return false;
8135
8137 {
8139 }
8140 else
8141 {
8143 }
8144 }
8145
8146 if (version < 140)
8147 {
8149 {
8150 if (!ctx.
Read(value))
8151 return false;
8152 SetTemperatureDirect(value);
8153 }
8154 }
8155
8157 {
8158 if (!ctx.
Read(value))
8159 return false;
8161 }
8162
8164 {
8165 if (!ctx.
Read(intValue))
8166 return false;
8168 }
8169
8171 {
8172 int r,g,b,a;
8174 return false;
8176 return false;
8178 return false;
8180 return false;
8181
8183 }
8184
8186 {
8187 if (!ctx.
Read(intValue))
8188 return false;
8190 }
8191
8192 if (version >= 138 && version < 140)
8193 {
8195 {
8196 if (!ctx.
Read(intValue))
8197 return false;
8198 SetFrozen(intValue);
8199 }
8200 }
8201
8202 return true;
8203 }
8204
8205
8207 {
8210 {
8212 }
8213
8214 if (!super.OnStoreLoad(ctx, version))
8215 {
8217 return false;
8218 }
8219
8220 if (version >= 114)
8221 {
8222 bool hasQuickBarIndexSaved;
8223
8224 if (!ctx.
Read(hasQuickBarIndexSaved))
8225 {
8227 return false;
8228 }
8229
8230 if (hasQuickBarIndexSaved)
8231 {
8232 int itmQBIndex;
8233
8234
8235 if (!ctx.
Read(itmQBIndex))
8236 {
8238 return false;
8239 }
8240
8241 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8242 if (itmQBIndex != -1 && parentPlayer)
8243 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8244 }
8245 }
8246 else
8247 {
8248
8249 PlayerBase player;
8250 int itemQBIndex;
8251 if (version ==
int.
MAX)
8252 {
8253 if (!ctx.
Read(itemQBIndex))
8254 {
8256 return false;
8257 }
8258 }
8259 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8260 {
8261
8262 if (!ctx.
Read(itemQBIndex))
8263 {
8265 return false;
8266 }
8267 if (itemQBIndex != -1 && player)
8268 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8269 }
8270 }
8271
8272 if (version < 140)
8273 {
8274
8275 if (!LoadVariables(ctx, version))
8276 {
8278 return false;
8279 }
8280 }
8281
8282
8284 {
8286 return false;
8287 }
8288 if (version >= 132)
8289 {
8291 if (raib)
8292 {
8294 {
8296 return false;
8297 }
8298 }
8299 }
8300
8302 return true;
8303 }
8304
8305
8306
8308 {
8309 super.OnStoreSave(ctx);
8310
8311 PlayerBase player;
8312 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8313 {
8315
8316 int itemQBIndex = -1;
8317 itemQBIndex = player.FindQuickBarEntityIndex(this);
8318 ctx.
Write(itemQBIndex);
8319 }
8320 else
8321 {
8323 }
8324
8326
8328 if (raib)
8329 {
8331 }
8332 }
8333
8334
8336 {
8337 super.AfterStoreLoad();
8338
8340 {
8342 }
8343
8345 {
8348 }
8349 }
8350
8352 {
8353 super.EEOnAfterLoad();
8354
8356 {
8358 }
8359
8362 }
8363
8365 {
8366 return false;
8367 }
8368
8369
8370
8372 {
8374 {
8375 #ifdef PLATFORM_CONSOLE
8376
8378 {
8380 if (menu)
8381 {
8383 }
8384 }
8385 #endif
8386 }
8387
8389 {
8392 }
8393
8395 {
8396 SetWeightDirty();
8398 }
8400 {
8403 }
8404
8406 {
8409
8412 }
8414 {
8418 }
8419
8420 super.OnVariablesSynchronized();
8421 }
8422
8423
8424
8426 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8427 {
8428 if (!IsServerCheck(allow_client))
8429 return false;
8430
8432 return false;
8433
8436
8437 if (value <= (min + 0.001))
8438 value = min;
8439
8440 if (value == min)
8441 {
8442 if (destroy_config)
8443 {
8444 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8445 if (dstr)
8446 {
8448 this.Delete();
8449 return true;
8450 }
8451 }
8452 else if (destroy_forced)
8453 {
8455 this.Delete();
8456 return true;
8457 }
8458
8460 }
8461
8464
8466 {
8467 EntityAI parent = GetHierarchyRoot();
8468 InventoryLocation iLoc = new InventoryLocation();
8469 GetInventory().GetCurrentInventoryLocation(iLoc);
8471 {
8472 int iLocSlot = iLoc.
GetSlot();
8474 {
8476 }
8478 {
8480 }
8481 }
8482 }
8483
8485 {
8487
8488 if (delta)
8490 }
8491
8493
8494 return false;
8495 }
8496
8497
8499 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8500 {
8502 }
8503
8505 {
8508 }
8509
8511 {
8514 }
8515
8517 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8518 {
8519 float value_clamped = Math.Clamp(value, 0, 1);
8521 SetQuantity(result, destroy_config, destroy_forced);
8522 }
8523
8524
8527 {
8529 }
8530
8532 {
8534 }
8535
8536
8537
8538
8539
8540
8541
8542
8543
8544
8546 {
8547 int slot = -1;
8548 GameInventory inventory = GetInventory();
8549 if (inventory)
8550 {
8551 InventoryLocation il = new InventoryLocation;
8554 }
8555
8557 }
8558
8560 {
8561 float quantity_max = 0;
8562
8564 {
8565 if (attSlotID != -1)
8566 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8567
8568 if (quantity_max <= 0)
8570 }
8571
8572 if (quantity_max <= 0)
8574
8575 return quantity_max;
8576 }
8577
8579 {
8581 }
8582
8584 {
8586 }
8587
8588
8590 {
8592 }
8593
8595 {
8597 }
8598
8600 {
8602 }
8603
8604
8606 {
8607
8608 float weightEx = GetWeightEx();
8609 float special = GetInventoryAndCargoWeight();
8610 return weightEx - special;
8611 }
8612
8613
8615 {
8617 }
8618
8620 {
8622 {
8623 #ifdef DEVELOPER
8624 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8625 {
8626 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
8628 }
8629 #endif
8630
8632 }
8633 else if (HasEnergyManager())
8634 {
8635 #ifdef DEVELOPER
8636 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8637 {
8638 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
8639 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
8640 }
8641 #endif
8642 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
8643 }
8644 else
8645 {
8646 #ifdef DEVELOPER
8647 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8648 {
8649 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
8650 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
8651 }
8652 #endif
8653 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
8654 }
8655 }
8656
8659 {
8660 int item_count = 0;
8662
8663 GameInventory inventory = GetInventory();
8664 CargoBase cargo = inventory.
GetCargo();
8665 if (cargo != NULL)
8666 {
8668 }
8669
8671 for (int i = 0; i < nAttachments; ++i)
8672 {
8674 if (item)
8675 item_count += item.GetNumberOfItems();
8676 }
8677 return item_count;
8678 }
8679
8682 {
8683 float weight = 0;
8684 float wetness = 1;
8685 if (include_wetness)
8688 {
8689 weight = wetness * m_ConfigWeight;
8690 }
8692 {
8693 weight = 1;
8694 }
8695 return weight;
8696 }
8697
8698
8699
8701 {
8702 GameInventory inventory = GetInventory();
8703 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
8704 {
8705 array<EntityAI> items = new array<EntityAI>;
8707 for (int i = 0; i < items.Count(); ++i)
8708 {
8710 if (item)
8711 {
8712 g_Game.ObjectDelete(item);
8713 }
8714 }
8715 }
8716 }
8717
8718
8719
8720
8722 {
8723 float energy = 0;
8724 if (HasEnergyManager())
8725 {
8726 energy = GetCompEM().GetEnergy();
8727 }
8728 return energy;
8729 }
8730
8731
8733 {
8734 super.OnEnergyConsumed();
8735
8737 }
8738
8740 {
8741 super.OnEnergyAdded();
8742
8744 }
8745
8746
8748 {
8749 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
8750 {
8752 {
8753 float energy_0to1 = GetCompEM().GetEnergy0To1();
8755 }
8756 }
8757 }
8758
8759
8761 {
8762 return ConfigGetFloat("heatIsolation");
8763 }
8764
8766 {
8768 }
8769
8771 {
8772 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
8773 if (
g_Game.ConfigIsExisting(paramPath))
8774 return g_Game.ConfigGetFloat(paramPath);
8775
8776 return 0.0;
8777 }
8778
8780 {
8781 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
8782 if (
g_Game.ConfigIsExisting(paramPath))
8783 return g_Game.ConfigGetFloat(paramPath);
8784
8785 return 0.0;
8786 }
8787
8788 override void SetWet(
float value,
bool allow_client =
false)
8789 {
8790 if (!IsServerCheck(allow_client))
8791 return;
8792
8795
8797
8798 m_VarWet = Math.Clamp(value, min, max);
8799
8801 {
8804 }
8805 }
8806
8807 override void AddWet(
float value)
8808 {
8810 }
8811
8813 {
8815 }
8816
8818 {
8820 }
8821
8823 {
8825 }
8826
8828 {
8830 }
8831
8833 {
8835 }
8836
8838 {
8841 if (newLevel != oldLevel)
8842 {
8844 }
8845 }
8846
8848 {
8849 SetWeightDirty();
8850 }
8851
8853 {
8854 return GetWetLevelInternal(
m_VarWet);
8855 }
8856
8857
8858
8860 {
8862 }
8863
8865 {
8867 }
8868
8870 {
8872 }
8873
8875 {
8877 }
8878
8879
8880
8882 {
8883 if (ConfigIsExisting("itemModelLength"))
8884 {
8885 return ConfigGetFloat("itemModelLength");
8886 }
8887 return 0;
8888 }
8889
8891 {
8892 if (ConfigIsExisting("itemAttachOffset"))
8893 {
8894 return ConfigGetFloat("itemAttachOffset");
8895 }
8896 return 0;
8897 }
8898
8899 override void SetCleanness(
int value,
bool allow_client =
false)
8900 {
8901 if (!IsServerCheck(allow_client))
8902 return;
8903
8905
8907
8910 }
8911
8913 {
8915 }
8916
8918 {
8919 return true;
8920 }
8921
8922
8923
8924
8926 {
8928 }
8929
8931 {
8933 }
8934
8935
8936
8937
8938 override void SetColor(
int r,
int g,
int b,
int a)
8939 {
8945 }
8947 override void GetColor(out
int r,out
int g,out
int b,out
int a)
8948 {
8953 }
8954
8956 {
8958 }
8959
8962 {
8963 int r,g,b,a;
8965 r = r/255;
8966 g = g/255;
8967 b = b/255;
8968 a = a/255;
8969 return MiscGameplayFunctions.GetColorString(r, g, b, a);
8970 }
8971
8972
8973
8974 override void SetLiquidType(
int value,
bool allow_client =
false)
8975 {
8976 if (!IsServerCheck(allow_client))
8977 return;
8978
8983 }
8984
8986 {
8987 return ConfigGetInt("varLiquidTypeInit");
8988 }
8989
8991 {
8993 }
8994
8996 {
8998 SetFrozen(false);
8999 }
9000
9003 {
9004 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9005 }
9006
9007
9010 {
9011 PlayerBase nplayer;
9012 if (PlayerBase.CastTo(nplayer, player))
9013 {
9015 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9016 }
9017 }
9018
9019
9022 {
9023 PlayerBase nplayer;
9024 if (PlayerBase.CastTo(nplayer,player))
9025 {
9026 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9027 }
9028
9029 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9030
9031 if (HasEnergyManager())
9032 {
9033 GetCompEM().UpdatePlugState();
9034 }
9035 }
9036
9037
9039 {
9040 super.OnPlacementStarted(player);
9041
9043 }
9044
9045 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9046 {
9048 {
9049 m_AdminLog.OnPlacementComplete(player,
this);
9050 }
9051
9052 super.OnPlacementComplete(player, position, orientation);
9053 }
9054
9055
9056
9057
9058
9060 {
9062 {
9063 return true;
9064 }
9065 else
9066 {
9067 return false;
9068 }
9069 }
9070
9071
9073 {
9075 {
9077 }
9078 }
9079
9080
9082 {
9084 }
9085
9087 {
9089 }
9090
9091 override void InsertAgent(
int agent,
float count = 1)
9092 {
9093 if (count < 1)
9094 return;
9095
9097 }
9098
9101 {
9103 }
9104
9105
9107 {
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
9151
9153 {
9155 return false;
9156 return true;
9157 }
9158
9160 {
9161
9163 }
9164
9165
9168 {
9169 super.CheckForRoofLimited(timeTresholdMS);
9170
9171 float time =
g_Game.GetTime();
9172 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9173 {
9174 m_PreviousRoofTestTime = time;
9175 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9176 }
9177 }
9178
9179
9181 {
9183 {
9184 return 0;
9185 }
9186
9187 if (GetInventory().GetAttachmentSlotsCount() != 0)
9188 {
9189 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9190 if (filter)
9191 return filter.GetProtectionLevel(type, false, system);
9192 else
9193 return 0;
9194 }
9195
9196 string subclassPath, entryName;
9197
9198 switch (type)
9199 {
9201 entryName = "biological";
9202 break;
9204 entryName = "chemical";
9205 break;
9206 default:
9207 entryName = "biological";
9208 break;
9209 }
9210
9211 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9212
9213 return g_Game.ConfigGetFloat(subclassPath + entryName);
9214 }
9215
9216
9217
9220 {
9221 if (!IsMagazine())
9223
9225 }
9226
9227
9228
9229
9230
9235 {
9236 return true;
9237 }
9238
9240 {
9242 }
9243
9244
9245
9246
9247
9249 {
9250 if (parent)
9251 {
9252 if (parent.IsInherited(DayZInfected))
9253 return true;
9254
9255 if (!parent.IsRuined())
9256 return true;
9257 }
9258
9259 return true;
9260 }
9261
9263 {
9264 if (!super.CanPutAsAttachment(parent))
9265 {
9266 return false;
9267 }
9268
9269 if (!IsRuined() && !parent.IsRuined())
9270 {
9271 return true;
9272 }
9273
9274 return false;
9275 }
9276
9278 {
9279
9280
9281
9282
9283 return super.CanReceiveItemIntoCargo(item);
9284 }
9285
9287 {
9288
9289
9290
9291
9292 GameInventory attachmentInv = attachment.GetInventory();
9294 {
9295 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9296 return false;
9297 }
9298
9299 InventoryLocation loc = new InventoryLocation();
9300 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9301 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9302 return false;
9303
9304 return super.CanReceiveAttachment(attachment, slotId);
9305 }
9306
9308 {
9309 if (!super.CanReleaseAttachment(attachment))
9310 return false;
9311
9312 return GetInventory().AreChildrenAccessible();
9313 }
9314
9315
9316
9317
9318
9319
9320
9321
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9332
9333
9334
9336 {
9337 int id = muzzle_owner.GetMuzzleID();
9338 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9339
9340 if (WPOF_array)
9341 {
9342 for (int i = 0; i < WPOF_array.Count(); i++)
9343 {
9344 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9345
9346 if (WPOF)
9347 {
9348 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9349 }
9350 }
9351 }
9352 }
9353
9354
9356 {
9357 int id = muzzle_owner.GetMuzzleID();
9359
9360 if (WPOBE_array)
9361 {
9362 for (int i = 0; i < WPOBE_array.Count(); i++)
9363 {
9364 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9365
9366 if (WPOBE)
9367 {
9368 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9369 }
9370 }
9371 }
9372 }
9373
9374
9376 {
9377 int id = muzzle_owner.GetMuzzleID();
9378 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9379
9380 if (WPOOH_array)
9381 {
9382 for (int i = 0; i < WPOOH_array.Count(); i++)
9383 {
9384 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9385
9386 if (WPOOH)
9387 {
9388 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9389 }
9390 }
9391 }
9392 }
9393
9394
9396 {
9397 int id = muzzle_owner.GetMuzzleID();
9398 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9399
9400 if (WPOOH_array)
9401 {
9402 for (int i = 0; i < WPOOH_array.Count(); i++)
9403 {
9404 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9405
9406 if (WPOOH)
9407 {
9408 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9409 }
9410 }
9411 }
9412 }
9413
9414
9416 {
9417 int id = muzzle_owner.GetMuzzleID();
9418 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9419
9420 if (WPOOH_array)
9421 {
9422 for (int i = 0; i < WPOOH_array.Count(); i++)
9423 {
9424 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9425
9426 if (WPOOH)
9427 {
9428 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9429 }
9430 }
9431 }
9432 }
9433
9434
9435
9437 {
9439 {
9440 return true;
9441 }
9442
9443 return false;
9444 }
9445
9447 {
9449 {
9450 return true;
9451 }
9452
9453 return false;
9454 }
9455
9457 {
9459 {
9460 return true;
9461 }
9462
9463 return false;
9464 }
9465
9467 {
9468 return false;
9469 }
9470
9473 {
9474 return UATimeSpent.DEFAULT_DEPLOY;
9475 }
9476
9477
9478
9479
9481 {
9483 SetSynchDirty();
9484 }
9485
9487 {
9489 }
9490
9491
9493 {
9494 return false;
9495 }
9496
9499 {
9500 string att_type = "None";
9501
9502 if (ConfigIsExisting("soundAttType"))
9503 {
9504 att_type = ConfigGetString("soundAttType");
9505 }
9506
9508 }
9509
9511 {
9513 }
9514
9515
9516
9517
9518
9524
9526 {
9529
9531 }
9532
9533
9535 {
9537 return;
9538
9540
9543
9546
9547 SoundParameters params = new SoundParameters();
9551 }
9552
9553
9555 {
9557 {
9560
9561 SetSynchDirty();
9562
9565 }
9566 }
9567
9569 {
9571 }
9572
9573
9575 {
9577 return;
9578
9580 SetSynchDirty();
9581
9584 }
9585
9587 {
9590 }
9591
9593 {
9595 }
9596
9597 void OnApply(PlayerBase player);
9598
9600 {
9601 return 1.0;
9602 };
9603
9605 {
9607 }
9608
9610 {
9612 }
9613
9615
9617 {
9618 SetDynamicPhysicsLifeTime(0.01);
9620 }
9621
9623 {
9624 array<string> zone_names = new array<string>;
9625 GetDamageZones(zone_names);
9626 for (int i = 0; i < zone_names.Count(); i++)
9627 {
9628 SetHealthMax(zone_names.Get(i),"Health");
9629 }
9630 SetHealthMax("","Health");
9631 }
9632
9635 {
9636 float global_health = GetHealth01("","Health");
9637 array<string> zones = new array<string>;
9638 GetDamageZones(zones);
9639
9640 for (int i = 0; i < zones.Count(); i++)
9641 {
9642 SetHealth01(zones.Get(i),"Health",global_health);
9643 }
9644 }
9645
9648 {
9649 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
9650 }
9651
9653 {
9654 if (!hasRootAsPlayer)
9655 {
9656 if (refParentIB)
9657 {
9658
9659 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
9660 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
9661
9662 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
9663 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
9664
9667 }
9668 else
9669 {
9670
9673 }
9674 }
9675 }
9676
9678 {
9680 {
9681 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
9682 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
9683 {
9684 float heatPermCoef = 1.0;
9686 while (ent)
9687 {
9688 heatPermCoef *= ent.GetHeatPermeabilityCoef();
9689 ent = ent.GetHierarchyParent();
9690 }
9691
9692 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
9693 }
9694 }
9695 }
9696
9698 {
9699
9700 EntityAI parent = GetHierarchyParent();
9701 if (!parent)
9702 {
9703 hasParent = false;
9704 hasRootAsPlayer = false;
9705 }
9706 else
9707 {
9708 hasParent = true;
9709 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
9710 refParentIB =
ItemBase.Cast(parent);
9711 }
9712 }
9713
9714 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
9715 {
9716
9717 }
9718
9720 {
9721
9722 return false;
9723 }
9724
9726 {
9727
9728
9729 return false;
9730 }
9731
9733 {
9734
9735 return false;
9736 }
9737
9740 {
9741 return !GetIsFrozen() &&
IsOpen();
9742 }
9743
9745 {
9746 bool hasParent = false, hasRootAsPlayer = false;
9748
9749 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
9750 bool foodDecay =
g_Game.IsFoodDecayEnabled();
9751
9752 if (wwtu || foodDecay)
9753 {
9757
9758 if (processWetness || processTemperature || processDecay)
9759 {
9761
9762 if (processWetness)
9763 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
9764
9765 if (processTemperature)
9767
9768 if (processDecay)
9769 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
9770 }
9771 }
9772 }
9773
9776 {
9778 }
9779
9781 {
9784
9785 return super.GetTemperatureFreezeThreshold();
9786 }
9787
9789 {
9792
9793 return super.GetTemperatureThawThreshold();
9794 }
9795
9797 {
9800
9801 return super.GetItemOverheatThreshold();
9802 }
9803
9805 {
9807 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
9808
9809 return super.GetTemperatureFreezeTime();
9810 }
9811
9813 {
9815 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
9816
9817 return super.GetTemperatureThawTime();
9818 }
9819
9824
9826 {
9827 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
9828 }
9829
9831 {
9832 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
9833 }
9834
9837 {
9839 }
9840
9842 {
9844 }
9845
9847 {
9849 }
9850
9853 {
9854 return null;
9855 }
9856
9859 {
9860 return false;
9861 }
9862
9864 {
9866 {
9869 if (!trg)
9870 {
9872 explosive = this;
9873 }
9874
9875 explosive.PairRemote(trg);
9877
9878 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
9879 trg.SetPersistentPairID(persistentID);
9880 explosive.SetPersistentPairID(persistentID);
9881
9882 return true;
9883 }
9884 return false;
9885 }
9886
9889 {
9890 float ret = 1.0;
9893 ret *= GetHealth01();
9894
9895 return ret;
9896 }
9897
9898 #ifdef DEVELOPER
9899 override void SetDebugItem()
9900 {
9901 super.SetDebugItem();
9902 _itemBase = this;
9903 }
9904
9906 {
9907 string text = super.GetDebugText();
9908
9910 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
9911
9912 return text;
9913 }
9914 #endif
9915
9917 {
9918 return true;
9919 }
9920
9922
9924
9926 {
9929 }
9930
9931
9939
9955
9956 [
Obsolete(
"Use ItemSoundHandler instead")]
9959 {
9960 if (!
g_Game.IsDedicatedServer())
9961 {
9962 if (ConfigIsExisting("attachSoundSet"))
9963 {
9964 string cfg_path = "";
9965 string soundset = "";
9967
9970 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
9971 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
9972
9973 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
9974 {
9975 for (int i = 0; i < cfg_soundset_array.Count(); i++)
9976 {
9977 if (cfg_slot_array[i] == slot_type)
9978 {
9979 soundset = cfg_soundset_array[i];
9980 break;
9981 }
9982 }
9983 }
9984
9985 if (soundset != "")
9986 {
9987 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
9989 }
9990 }
9991 }
9992 }
9993
9995}
9996
9998{
10000 if (entity)
10001 {
10002 bool is_item = entity.IsInherited(
ItemBase);
10003 if (is_item && full_quantity)
10004 {
10007 }
10008 }
10009 else
10010 {
10012 return NULL;
10013 }
10014 return entity;
10015}
10016
10018{
10019 if (item)
10020 {
10021 if (health > 0)
10022 item.SetHealth("", "", health);
10023
10024 if (item.CanHaveTemperature())
10025 {
10027 if (item.CanFreeze())
10028 item.SetFrozen(false);
10029 }
10030
10031 if (item.HasEnergyManager())
10032 {
10033 if (quantity >= 0)
10034 {
10035 item.GetCompEM().SetEnergy0To1(quantity);
10036 }
10037 else
10038 {
10040 }
10041 }
10042 else if (item.IsMagazine())
10043 {
10044 Magazine mag = Magazine.Cast(item);
10045 if (quantity >= 0)
10046 {
10047 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10048 }
10049 else
10050 {
10052 }
10053
10054 }
10055 else
10056 {
10057 if (quantity >= 0)
10058 {
10059 item.SetQuantityNormalized(quantity, false);
10060 }
10061 else
10062 {
10064 }
10065
10066 }
10067 }
10068}
10069
10070#ifdef DEVELOPER
10072#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
bool SetAttachSoundEvent()
bool SetDetachSoundEvent()
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 IsPrepareToDelete()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
proto GizmoApi GetGizmoApi()
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
void StartItemSoundServer(int id, int slotId)
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)
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()
override int GetLiquidType()
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)
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 EntityAI GetAttachmentFromIndex(int index)
proto native bool GetCurrentInventoryLocation(out notnull InventoryLocation loc)
returns information about current item location
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
proto native int AttachmentCount()
Returns count of attachments attached to this item.
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
proto void SelectObject(Object object)
proto void SelectPhysics(Physics physics)
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 bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
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
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
void Obsolete(string msg="")
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
vector GetPosition()
Get the world position of the Effect.
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.