5043{
5045 {
5046 return true;
5047 }
5048};
5049
5051{
5052
5053};
5054
5055
5056
5058{
5062
5064
5067
5068
5069
5070
5071
5080
5086
5091
5096
5117 protected bool m_IsResultOfSplit
5118
5120
5125
5126
5127
5129
5133
5134
5135
5137
5140
5141
5142
5148
5149
5157
5160
5161
5163
5164
5166
5167
5172
5173
5178
5180
5181
5183
5184
5186 {
5191
5192 if (!
g_Game.IsDedicatedServer())
5193 {
5195 {
5197
5199 {
5201 }
5202 }
5203
5206 }
5207
5208 m_OldLocation = null;
5209
5211 {
5213 }
5214
5215 if (ConfigIsExisting("headSelectionsToHide"))
5216 {
5219 }
5220
5222 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5223 {
5225 }
5226
5228
5229 m_IsResultOfSplit = false;
5230
5232 }
5233
5235 {
5236 super.InitItemVariables();
5237
5243 m_Count = ConfigGetInt(
"count");
5244
5247
5252
5255
5260
5272
5276
5277
5280 if (ConfigIsExisting("canBeSplit"))
5281 {
5284 }
5285
5287 if (ConfigIsExisting("itemBehaviour"))
5289
5290
5293 RegisterNetSyncVariableInt("m_VarLiquidType");
5294 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5295
5296 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5297 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5298 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5299
5300 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5301 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5302 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5303 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5304
5305 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5306 RegisterNetSyncVariableBool("m_IsTakeable");
5307 RegisterNetSyncVariableBool("m_IsHologram");
5308
5311 {
5314 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
5315 }
5316
5318
5320 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5322
5324 }
5325
5327 {
5329 }
5330
5332 {
5335 {
5340 }
5341 }
5342
5343 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5344 {
5346 {
5349 }
5350
5352 }
5353
5355 {
5361 }
5362
5364
5366 {
5368
5369 if (!action)
5370 {
5371 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5372 return;
5373 }
5374
5376 if (!ai)
5377 {
5379 return;
5380 }
5381
5383 if (!action_array)
5384 {
5385 action_array = new array<ActionBase_Basic>;
5387 }
5388 if (LogManager.IsActionLogEnable())
5389 {
5390 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5391 }
5392
5393 if (action_array.Find(action) != -1)
5394 {
5395 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5396 }
5397 else
5398 {
5399 action_array.Insert(action);
5400 }
5401 }
5402
5404 {
5405 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
5406 ActionBase action = player.GetActionManager().GetAction(actionName);
5409
5410 if (action_array)
5411 {
5412 action_array.RemoveItem(action);
5413 }
5414 }
5415
5416
5417
5419 {
5420 ActionOverrideData overrideData = new ActionOverrideData();
5424
5426 if (!actionMap)
5427 {
5430 }
5431
5432 actionMap.Insert(this.
Type(), overrideData);
5433
5434 }
5435
5437
5439
5440
5442 {
5445
5448
5449 string config_to_search = "CfgVehicles";
5450 string muzzle_owner_config;
5451
5453 {
5454 if (IsInherited(Weapon))
5455 config_to_search = "CfgWeapons";
5456
5457 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5458
5459 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5460
5461 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
5462
5463 if (config_OnFire_subclass_count > 0)
5464 {
5465 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5466
5467 for (int i = 0; i < config_OnFire_subclass_count; i++)
5468 {
5469 string particle_class = "";
5470 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
5471 string config_OnFire_entry = config_OnFire_class + particle_class;
5472 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5473 WPOF_array.Insert(WPOF);
5474 }
5475
5476
5478 }
5479 }
5480
5482 {
5483 config_to_search = "CfgWeapons";
5484 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5485
5486 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5487
5488 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
5489
5490 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
5491 {
5492 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
5493
5494 for (i = 0; i < config_OnBulletCasingEject_count; i++)
5495 {
5496 string particle_class2 = "";
5497 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
5498 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
5499 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
5500 WPOBE_array.Insert(WPOBE);
5501 }
5502
5503
5505 }
5506 }
5507 }
5508
5509
5511 {
5514
5516 {
5517 string config_to_search = "CfgVehicles";
5518
5519 if (IsInherited(Weapon))
5520 config_to_search = "CfgWeapons";
5521
5522 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5523 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
5524
5525 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
5526 {
5527
5529
5531 {
5533 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
5535 return;
5536 }
5537
5540
5541
5542
5543 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
5544 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
5545
5546 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
5547 {
5548 string particle_class = "";
5549 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
5550 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
5551 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
5552
5553 if (entry_type == CT_CLASS)
5554 {
5555 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
5556 WPOOH_array.Insert(WPOF);
5557 }
5558 }
5559
5560
5562 }
5563 }
5564 }
5565
5567 {
5569 }
5570
5572 {
5574 {
5576
5579
5582
5583 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5584 }
5585 }
5586
5588 {
5590 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5591
5593 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5594
5596 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5597
5599 {
5601 }
5602 }
5603
5605 {
5607 }
5608
5610 {
5613 else
5615
5617 {
5620 }
5621 else
5622 {
5625
5628 }
5629
5631 }
5632
5634 {
5636 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5637 }
5638
5640 {
5642 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
5644 }
5645
5647 {
5649 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5650 }
5651
5653 {
5656
5657 OverheatingParticle OP = new OverheatingParticle();
5662
5664 }
5665
5667 {
5670
5671 return -1;
5672 }
5673
5675 {
5677 {
5680
5681 for (int i = count; i > 0; --i)
5682 {
5683 int id = i - 1;
5686
5689
5690 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
5691 {
5692 if (p)
5693 {
5696 }
5697 }
5698 }
5699 }
5700 }
5701
5703 {
5705 {
5707 {
5708 int id = i - 1;
5710
5711 if (OP)
5712 {
5714
5715 if (p)
5716 {
5718 }
5719
5720 delete OP;
5721 }
5722 }
5723
5726 }
5727 }
5728
5731 {
5732 return 0.0;
5733 }
5734
5735
5737 {
5738 return 250;
5739 }
5740
5742 {
5743 return 0;
5744 }
5745
5748 {
5750 return true;
5751
5752 return false;
5753 }
5754
5757 {
5760
5762 {
5764 }
5765 else
5766 {
5767
5769 }
5770
5772 }
5773
5780 {
5781 return -1;
5782 }
5783
5784
5785
5786
5788 {
5790 {
5791 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
5792 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
5793
5794 if (r_index >= 0)
5795 {
5796 InventoryLocation r_il = new InventoryLocation;
5797 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
5798
5799 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
5802 {
5803 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
5804 }
5806 {
5807 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
5808 }
5809
5810 }
5811
5812 player.GetHumanInventory().ClearUserReservedLocation(this);
5813 }
5814
5817 }
5818
5819
5820
5821
5823 {
5824 return ItemBase.m_DebugActionsMask;
5825 }
5826
5828 {
5829 return ItemBase.m_DebugActionsMask & mask;
5830 }
5831
5833 {
5834 ItemBase.m_DebugActionsMask = mask;
5835 }
5836
5838 {
5839 ItemBase.m_DebugActionsMask |= mask;
5840 }
5841
5843 {
5844 ItemBase.m_DebugActionsMask &= ~mask;
5845 }
5846
5848 {
5850 {
5852 }
5853 else
5854 {
5856 }
5857 }
5858
5859
5861 {
5862 if (GetEconomyProfile())
5863 {
5864 float q_max = GetEconomyProfile().GetQuantityMax();
5865 if (q_max > 0)
5866 {
5867 float q_min = GetEconomyProfile().GetQuantityMin();
5868 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
5869
5871 {
5872 ComponentEnergyManager comp = GetCompEM();
5874 {
5876 }
5877 }
5879 {
5881
5882 }
5883
5884 }
5885 }
5886 }
5887
5890 {
5891 EntityAI parent = GetHierarchyParent();
5892
5893 if (parent)
5894 {
5895 InventoryLocation inventory_location_to_lock = new InventoryLocation;
5896 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
5897 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
5898 }
5899 }
5900
5903 {
5904 EntityAI parent = GetHierarchyParent();
5905
5906 if (parent)
5907 {
5908 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
5909 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
5910 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
5911 }
5912 }
5913
5915 {
5916
5917
5918
5919
5921
5923 {
5924 if (ScriptInputUserData.CanStoreInputUserData())
5925 {
5926 ScriptInputUserData ctx = new ScriptInputUserData;
5932 ctx.
Write(use_stack_max);
5935
5937 {
5938 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
5939 }
5940 }
5941 }
5942 else if (!
g_Game.IsMultiplayer())
5943 {
5945 }
5946 }
5947
5949 {
5951 }
5952
5954 {
5956 }
5957
5959 {
5961 }
5962
5964 {
5965
5966 return false;
5967 }
5968
5970 {
5971 return false;
5972 }
5973
5977 {
5978 return false;
5979 }
5980
5982 {
5983 return "";
5984 }
5985
5987
5989 {
5990 return false;
5991 }
5992
5994 {
5995 return true;
5996 }
5997
5998
5999
6001 {
6002 return true;
6003 }
6004
6006 {
6007 return true;
6008 }
6009
6011 {
6012 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6014 }
6015
6017 {
6019 }
6020
6022 {
6024 if (!is_being_placed)
6026 SetSynchDirty();
6027 }
6028
6029
6031
6033 {
6035 }
6036
6038 {
6040 }
6041
6043 {
6044 return 1;
6045 }
6046
6048 {
6049 return false;
6050 }
6051
6053 {
6055 SetSynchDirty();
6056 }
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6093 {
6094 super.OnMovedInsideCargo(container);
6095
6096 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6097 }
6098
6099 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6100 {
6101 super.EEItemLocationChanged(oldLoc, newLoc);
6102
6103 PlayerBase newPlayer = null;
6104 PlayerBase oldPlayer = null;
6105
6106 if (newLoc.GetParent())
6107 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6108
6109 if (oldLoc.GetParent())
6110 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6111
6113 {
6114 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6115
6116 if (rIndex >= 0)
6117 {
6118 InventoryLocation rIl = new InventoryLocation;
6119 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6120
6121 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6124 {
6125 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6126 }
6128 {
6130 }
6131
6132 }
6133 }
6134
6136 {
6137 if (newPlayer)
6138 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6139
6140 if (newPlayer == oldPlayer)
6141 {
6142 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6143 {
6145 {
6146 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6147 {
6148 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6149 }
6150 }
6151 else
6152 {
6153 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6154 }
6155 }
6156
6157 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6158 {
6159 int type = oldLoc.GetType();
6161 {
6162 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6163 }
6165 {
6166 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6167 }
6168 }
6169 if (!m_OldLocation)
6170 {
6171 m_OldLocation = new InventoryLocation;
6172 }
6173 m_OldLocation.Copy(oldLoc);
6174 }
6175 else
6176 {
6177 if (m_OldLocation)
6178 {
6179 m_OldLocation.Reset();
6180 }
6181 }
6182
6183 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6184 }
6185 else
6186 {
6187 if (newPlayer)
6188 {
6189 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6190 if (resIndex >= 0)
6191 {
6192 InventoryLocation il = new InventoryLocation;
6193 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6195 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6198 {
6199 il.
GetParent().GetOnReleaseLock().Invoke(it);
6200 }
6202 {
6204 }
6205
6206 }
6207 }
6209 {
6210
6212 }
6213
6214 if (m_OldLocation)
6215 {
6216 m_OldLocation.Reset();
6217 }
6218 }
6219
6221 {
6222 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6223 }
6224
6226 {
6227 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6228 }
6229 }
6230
6231 override void EOnContact(IEntity other, Contact extra)
6232 {
6234 {
6235 int liquidType = -1;
6237 if (impactSpeed > 0.0)
6238 {
6240 #ifndef SERVER
6242 #else
6244 SetSynchDirty();
6245 #endif
6247 }
6248 }
6249
6250 #ifdef SERVER
6251 if (GetCompEM() && GetCompEM().IsPlugged())
6252 {
6253 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6254 GetCompEM().UnplugThis();
6255 }
6256 #endif
6257 }
6258
6260
6262 {
6264 }
6265
6267 {
6268
6269 }
6270
6272 {
6273 super.OnItemLocationChanged(old_owner, new_owner);
6274
6275 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6276 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6277
6278 if (!relatedPlayer && playerNew)
6279 relatedPlayer = playerNew;
6280
6281 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6282 {
6284 if (actionMgr)
6285 {
6286 ActionBase currentAction = actionMgr.GetRunningAction();
6287 if (currentAction)
6289 }
6290 }
6291
6292 Man ownerPlayerOld = null;
6293 Man ownerPlayerNew = null;
6294
6295 if (old_owner)
6296 {
6297 if (old_owner.
IsMan())
6298 {
6299 ownerPlayerOld = Man.Cast(old_owner);
6300 }
6301 else
6302 {
6303 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6304 }
6305 }
6306 else
6307 {
6309 {
6311
6312 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6313 {
6314 GetCompEM().UnplugThis();
6315 }
6316 }
6317 }
6318
6319 if (new_owner)
6320 {
6321 if (new_owner.
IsMan())
6322 {
6323 ownerPlayerNew = Man.Cast(new_owner);
6324 }
6325 else
6326 {
6327 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6328 }
6329 }
6330
6331 if (ownerPlayerOld != ownerPlayerNew)
6332 {
6333 if (ownerPlayerOld)
6334 {
6335 array<EntityAI> subItemsExit = new array<EntityAI>;
6337 for (int i = 0; i < subItemsExit.Count(); i++)
6338 {
6341 }
6342 }
6343
6344 if (ownerPlayerNew)
6345 {
6346 array<EntityAI> subItemsEnter = new array<EntityAI>;
6348 for (int j = 0; j < subItemsEnter.Count(); j++)
6349 {
6352 }
6353 }
6354 }
6355 else if (ownerPlayerNew != null)
6356 {
6357 PlayerBase nplayer;
6358 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6359 {
6360 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6362 for (int k = 0; k < subItemsUpdate.Count(); k++)
6363 {
6365 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6366 }
6367 }
6368 }
6369
6370 if (old_owner)
6371 old_owner.OnChildItemRemoved(this);
6372 if (new_owner)
6373 new_owner.OnChildItemReceived(this);
6374 }
6375
6376
6378 {
6379 super.EEDelete(parent);
6380 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6381 if (player)
6382 {
6384
6385 if (player.IsAlive())
6386 {
6387 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6388 if (r_index >= 0)
6389 {
6390 InventoryLocation r_il = new InventoryLocation;
6391 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6392
6393 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6396 {
6397 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6398 }
6400 {
6401 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6402 }
6403
6404 }
6405
6406 player.RemoveQuickBarEntityShortcut(this);
6407 }
6408 }
6409 }
6410
6412 {
6413 super.EEKilled(killer);
6414
6417 {
6418 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6419 {
6420 if (IsMagazine())
6421 {
6422 if (Magazine.Cast(this).GetAmmoCount() > 0)
6423 {
6425 }
6426 }
6427 else
6428 {
6430 }
6431 }
6432 }
6433 }
6434
6436 {
6437 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6438
6439 super.OnWasAttached(parent, slot_id);
6440
6443
6446 }
6447
6449 {
6450 super.OnWasDetached(parent, slot_id);
6451
6454
6457 }
6458
6460 {
6461 int idx;
6464
6465 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6466 if (inventory_slots.Count() < 1)
6467 {
6468 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6469 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6470 }
6471 else
6472 {
6473 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6474 }
6475
6476 idx = inventory_slots.Find(slot);
6477 if (idx < 0)
6478 return "";
6479
6480 return attach_types.Get(idx);
6481 }
6482
6484 {
6485 int idx = -1;
6486 string slot;
6487
6490
6491 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6492 if (inventory_slots.Count() < 1)
6493 {
6494 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6495 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6496 }
6497 else
6498 {
6499 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6500 if (detach_types.Count() < 1)
6501 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6502 }
6503
6504 for (int i = 0; i < inventory_slots.Count(); i++)
6505 {
6506 slot = inventory_slots.Get(i);
6507 }
6508
6509 if (slot != "")
6510 {
6511 if (detach_types.Count() == 1)
6512 idx = 0;
6513 else
6514 idx = inventory_slots.Find(slot);
6515 }
6516 if (idx < 0)
6517 return "";
6518
6519 return detach_types.Get(idx);
6520 }
6521
6523 {
6524
6526
6527
6528 float min_time = 1;
6529 float max_time = 3;
6530 float delay = Math.RandomFloat(min_time, max_time);
6531
6532 explode_timer.Run(delay, this, "DoAmmoExplosion");
6533 }
6534
6536 {
6537 Magazine magazine = Magazine.Cast(this);
6538 int pop_sounds_count = 6;
6539 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
6540
6541
6542 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
6543 string sound_name = pop_sounds[ sound_idx ];
6544 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
6545
6546
6547 magazine.ServerAddAmmoCount(-1);
6548
6549
6550 float min_temp_to_explode = 100;
6551
6552 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
6553 {
6555 }
6556 }
6557
6558
6559 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
6560 {
6561 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
6562
6563 const int CHANCE_DAMAGE_CARGO = 4;
6564 const int CHANCE_DAMAGE_ATTACHMENT = 1;
6565 const int CHANCE_DAMAGE_NOTHING = 2;
6566
6568 {
6569 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
6570 int chances;
6571 int rnd;
6572
6573 if (GetInventory().GetCargo())
6574 {
6575 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6576 rnd = Math.RandomInt(0,chances);
6577
6578 if (rnd < CHANCE_DAMAGE_CARGO)
6579 {
6581 }
6582 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
6583 {
6585 }
6586 }
6587 else
6588 {
6589 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6590 rnd = Math.RandomInt(0,chances);
6591
6592 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
6593 {
6595 }
6596 }
6597 }
6598 }
6599
6601 {
6602 CargoBase cargo = GetInventory().GetCargo();
6603 if (cargo)
6604 {
6606 if (item_count > 0)
6607 {
6608 int random_pick = Math.RandomInt(0, item_count);
6610 if (!item.IsExplosive())
6611 {
6612 item.AddHealth("","",damage);
6613 return true;
6614 }
6615 }
6616 }
6617 return false;
6618 }
6619
6621 {
6622 GameInventory inventory = GetInventory();
6624 if (attachment_count > 0)
6625 {
6626 int random_pick = Math.RandomInt(0, attachment_count);
6628 if (!attachment.IsExplosive())
6629 {
6630 attachment.AddHealth("","",damage);
6631 return true;
6632 }
6633 }
6634 return false;
6635 }
6636
6638 {
6640 }
6641
6643 {
6645 return GetInventory().CanRemoveEntity();
6646
6647 return false;
6648 }
6649
6651 {
6652
6654 return false;
6655
6656
6658 return false;
6659
6660
6661
6663 if (delta == 0)
6664 return false;
6665
6666
6667 return true;
6668 }
6669
6671 {
6673 {
6674 if (ScriptInputUserData.CanStoreInputUserData())
6675 {
6676 ScriptInputUserData ctx = new ScriptInputUserData;
6681 ctx.
Write(destination_entity);
6685 }
6686 }
6687 else if (!
g_Game.IsMultiplayer())
6688 {
6690 }
6691 }
6692
6694 {
6695 float split_quantity_new;
6699 InventoryLocation loc = new InventoryLocation;
6700
6701 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6702 {
6704 split_quantity_new = stack_max;
6705 else
6707
6709 {
6710 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6711 if (new_item)
6712 {
6713 new_item.SetResultOfSplit(true);
6714 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6716 new_item.
SetQuantity(split_quantity_new,
false,
true);
6717 }
6718 }
6719 }
6720 else if (destination_entity && slot_id == -1)
6721 {
6722 if (quantity > stack_max)
6723 split_quantity_new = stack_max;
6724 else
6725 split_quantity_new = quantity;
6726
6728 {
6729 GameInventory destinationInventory = destination_entity.GetInventory();
6731 {
6734 }
6735
6736 if (new_item)
6737 {
6738 new_item.SetResultOfSplit(true);
6739 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6741 new_item.
SetQuantity(split_quantity_new,
false,
true);
6742 }
6743 }
6744 }
6745 else
6746 {
6747 if (stack_max != 0)
6748 {
6750 {
6752 }
6753
6754 if (split_quantity_new == 0)
6755 {
6756 if (!
g_Game.IsMultiplayer())
6757 player.PhysicalPredictiveDropItem(this);
6758 else
6759 player.ServerDropEntity(this);
6760 return;
6761 }
6762
6764 {
6766
6767 if (new_item)
6768 {
6769 new_item.SetResultOfSplit(true);
6770 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6773 new_item.PlaceOnSurface();
6774 }
6775 }
6776 }
6777 }
6778 }
6779
6781 {
6782 float split_quantity_new;
6786 InventoryLocation loc = new InventoryLocation;
6787
6788 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
6789 {
6791 split_quantity_new = stack_max;
6792 else
6794
6796 {
6797 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
6798 if (new_item)
6799 {
6800 new_item.SetResultOfSplit(true);
6801 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6803 new_item.
SetQuantity(split_quantity_new,
false,
true);
6804 }
6805 }
6806 }
6807 else if (destination_entity && slot_id == -1)
6808 {
6809 if (quantity > stack_max)
6810 split_quantity_new = stack_max;
6811 else
6812 split_quantity_new = quantity;
6813
6815 {
6816 GameInventory destinationInventory = destination_entity.GetInventory();
6818 {
6821 }
6822
6823 if (new_item)
6824 {
6825 new_item.SetResultOfSplit(true);
6826 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6828 new_item.
SetQuantity(split_quantity_new,
false,
true);
6829 }
6830 }
6831 }
6832 else
6833 {
6834 if (stack_max != 0)
6835 {
6837 {
6839 }
6840
6842 {
6844
6845 if (new_item)
6846 {
6847 new_item.SetResultOfSplit(true);
6848 MiscGameplayFunctions.TransferItemProperties(this, new_item);
6851 new_item.PlaceOnSurface();
6852 }
6853 }
6854 }
6855 }
6856 }
6857
6859 {
6861 {
6862 if (ScriptInputUserData.CanStoreInputUserData())
6863 {
6864 ScriptInputUserData ctx = new ScriptInputUserData;
6869 dst.WriteToContext(ctx);
6871 }
6872 }
6873 else if (!
g_Game.IsMultiplayer())
6874 {
6876 }
6877 }
6878
6880 {
6882 {
6883 if (ScriptInputUserData.CanStoreInputUserData())
6884 {
6885 ScriptInputUserData ctx = new ScriptInputUserData;
6890 ctx.
Write(destination_entity);
6896 }
6897 }
6898 else if (!
g_Game.IsMultiplayer())
6899 {
6901 }
6902 }
6903
6905 {
6907 }
6908
6910 {
6912 float split_quantity_new;
6914 if (dst.IsValid())
6915 {
6916 int slot_id = dst.GetSlot();
6918
6919 if (quantity > stack_max)
6920 split_quantity_new = stack_max;
6921 else
6922 split_quantity_new = quantity;
6923
6925 {
6927
6928 if (new_item)
6929 {
6930 new_item.SetResultOfSplit(true);
6931 MiscGameplayFunctions.TransferItemProperties(this,new_item);
6933 new_item.
SetQuantity(split_quantity_new,
false,
true);
6934 }
6935
6936 return new_item;
6937 }
6938 }
6939
6940 return null;
6941 }
6942
6944 {
6946 float split_quantity_new;
6948 if (destination_entity)
6949 {
6951 if (quantity > stackable)
6952 split_quantity_new = stackable;
6953 else
6954 split_quantity_new = quantity;
6955
6957 {
6958 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
6959 if (new_item)
6960 {
6961 new_item.SetResultOfSplit(true);
6962 MiscGameplayFunctions.TransferItemProperties(this,new_item);
6964 new_item.
SetQuantity(split_quantity_new,
false,
true);
6965 }
6966 }
6967 }
6968 }
6969
6971 {
6973 {
6974 if (ScriptInputUserData.CanStoreInputUserData())
6975 {
6976 ScriptInputUserData ctx = new ScriptInputUserData;
6981 ItemBase destination_entity =
this;
6982 ctx.
Write(destination_entity);
6986 }
6987 }
6988 else if (!
g_Game.IsMultiplayer())
6989 {
6991 }
6992 }
6993
6995 {
6997 float split_quantity_new;
6999 if (player)
7000 {
7002 if (quantity > stackable)
7003 split_quantity_new = stackable;
7004 else
7005 split_quantity_new = quantity;
7006
7008 {
7009 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7010 new_item =
ItemBase.Cast(in_hands);
7011 if (new_item)
7012 {
7013 new_item.SetResultOfSplit(true);
7014 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7016 new_item.SetQuantity(split_quantity_new, false, true);
7017 }
7018 }
7019 }
7020 }
7021
7023 {
7025 float split_quantity_new = Math.Floor(quantity * 0.5);
7026
7028 return;
7029
7031
7032 if (new_item)
7033 {
7034 if (new_item.GetQuantityMax() < split_quantity_new)
7035 {
7036 split_quantity_new = new_item.GetQuantityMax();
7037 }
7038
7039 new_item.SetResultOfSplit(true);
7040 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7041
7043 {
7046 }
7047 else
7048 {
7050 new_item.
SetQuantity(split_quantity_new,
false,
true);
7051 }
7052 }
7053 }
7054
7056 {
7058 float split_quantity_new = Math.Floor(quantity / 2);
7059
7061 return;
7062
7063 InventoryLocation invloc = new InventoryLocation;
7065
7067 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7068
7069 if (new_item)
7070 {
7071 if (new_item.GetQuantityMax() < split_quantity_new)
7072 {
7073 split_quantity_new = new_item.GetQuantityMax();
7074 }
7076 {
7079 }
7080 else if (split_quantity_new > 1)
7081 {
7083 new_item.
SetQuantity(split_quantity_new,
false,
true);
7084 }
7085 }
7086 }
7087
7090 {
7091 SetWeightDirty();
7093
7094 if (parent)
7095 parent.OnAttachmentQuantityChangedEx(this, delta);
7096
7098 {
7100 {
7102 }
7104 {
7105 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7107 }
7108 }
7109 }
7110
7113 {
7114
7115 }
7116
7119 {
7121 }
7122
7124 {
7125 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7126
7128 {
7129 if (newLevel == GameConstants.STATE_RUINED)
7130 {
7132 EntityAI parent = GetHierarchyParent();
7133 if (parent && parent.IsFireplace())
7134 {
7135 CargoBase cargo = GetInventory().GetCargo();
7136 if (cargo)
7137 {
7139 {
7141 }
7142 }
7143 }
7144 }
7145
7147 {
7148
7150 return;
7151 }
7152
7153 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7154 {
7156 }
7157 }
7158 }
7159
7160
7162 {
7163 super.OnRightClick();
7164
7166 {
7168 {
7169 if (ScriptInputUserData.CanStoreInputUserData())
7170 {
7171 EntityAI root = GetHierarchyRoot();
7172 Man playerOwner = GetHierarchyRootPlayer();
7173 InventoryLocation dst = new InventoryLocation;
7174
7175
7176 if (!playerOwner && root && root == this)
7177 {
7179 }
7180 else
7181 {
7182
7183 GetInventory().GetCurrentInventoryLocation(dst);
7185 {
7186 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7188 {
7190 }
7191 else
7192 {
7194
7195
7196 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7197 {
7199 }
7200 else
7201 {
7202 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7203 }
7204 }
7205 }
7206 }
7207
7208 ScriptInputUserData ctx = new ScriptInputUserData;
7216 }
7217 }
7218 else if (!
g_Game.IsMultiplayer())
7219 {
7221 }
7222 }
7223 }
7224
7226 {
7227 if (root)
7228 {
7229 vector m4[4];
7230 root.GetTransform(m4);
7231 dst.SetGround(this, m4);
7232 }
7233 else
7234 {
7235 GetInventory().GetCurrentInventoryLocation(dst);
7236 }
7237 }
7238
7239 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7240 {
7241
7242 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7243 return false;
7244
7245 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7246 return false;
7247
7248
7250 return false;
7251
7252
7253 Magazine mag = Magazine.Cast(this);
7254 if (mag)
7255 {
7256 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7257 return false;
7258
7259 if (stack_max_limit)
7260 {
7261 Magazine other_mag = Magazine.Cast(other_item);
7262 if (other_item)
7263 {
7264 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7265 return false;
7266 }
7267
7268 }
7269 }
7270 else
7271 {
7272
7274 return false;
7275
7277 return false;
7278 }
7279
7280 PlayerBase player = null;
7281 if (CastTo(player, GetHierarchyRootPlayer()))
7282 {
7283 if (player.GetInventory().HasAttachment(this))
7284 return false;
7285
7286 if (player.IsItemsToDelete())
7287 return false;
7288 }
7289
7290 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7291 return false;
7292
7293 int slotID;
7295 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7296 return false;
7297
7298 return true;
7299 }
7300
7302 {
7304 }
7305
7307 {
7308 return m_IsResultOfSplit;
7309 }
7310
7312 {
7313 m_IsResultOfSplit = value;
7314 }
7315
7317 {
7319 }
7320
7322 {
7323 float other_item_quantity = other_item.GetQuantity();
7324 float this_free_space;
7325
7327
7329
7330 if (other_item_quantity > this_free_space)
7331 {
7332 return this_free_space;
7333 }
7334 else
7335 {
7336 return other_item_quantity;
7337 }
7338 }
7339
7341 {
7343 }
7344
7346 {
7348 return;
7349
7350 if (!IsMagazine() && other_item)
7351 {
7353 if (quantity_used != 0)
7354 {
7355 float hp1 = GetHealth01("","");
7356 float hp2 = other_item.GetHealth01("","");
7357 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7358 hpResult = hpResult / (
GetQuantity() + quantity_used);
7359
7360 hpResult *= GetMaxHealth();
7361 Math.Round(hpResult);
7362 SetHealth("", "Health", hpResult);
7363
7365 other_item.AddQuantity(-quantity_used);
7366 }
7367 }
7369 }
7370
7372 {
7373 #ifdef SERVER
7374 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7375 GetHierarchyParent().IncreaseLifetimeUp();
7376 #endif
7377 };
7378
7380 {
7381 PlayerBase p = PlayerBase.Cast(player);
7382
7383 array<int> recipesIds = p.m_Recipes;
7384 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7385 if (moduleRecipesManager)
7386 {
7387 EntityAI itemInHands = player.GetEntityInHands();
7388 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7389 }
7390
7391 for (int i = 0;i < recipesIds.Count(); i++)
7392 {
7393 int key = recipesIds.Get(i);
7394 string recipeName = moduleRecipesManager.GetRecipeName(key);
7396 }
7397 }
7398
7399
7400 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7401 {
7402 super.GetDebugActions(outputList);
7403
7404
7410
7411
7416
7421
7422
7426
7427
7429 {
7433 }
7434
7437
7438
7442
7444
7445 InventoryLocation loc = new InventoryLocation();
7446 GetInventory().GetCurrentInventoryLocation(loc);
7448 {
7449 if (Gizmo_IsSupported())
7452 }
7453
7455 }
7456
7457
7458
7459
7461 {
7462 super.OnAction(action_id, player, ctx);
7463
7465 {
7466 switch (action_id)
7467 {
7471 return true;
7475 return true;
7476 }
7477 }
7478
7480 {
7481 switch (action_id)
7482 {
7484 Delete();
7485 return true;
7486 }
7487 }
7488
7489 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
7490 {
7491 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7492 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
7493 PlayerBase p = PlayerBase.Cast(player);
7494 if (
EActions.RECIPES_RANGE_START < 1000)
7495 {
7496 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7497 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7498 }
7499 }
7500 #ifndef SERVER
7501 else if (action_id ==
EActions.WATCH_PLAYER)
7502 {
7503 PluginDeveloper.SetDeveloperItemClientEx(player);
7504 }
7505 #endif
7507 {
7508 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7509 {
7510 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7511 OnDebugButtonPressServer(id + 1);
7512 }
7513
7514 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7515 {
7516 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
7518 }
7519
7520 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
7521 {
7522 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
7524 }
7525
7526 else if (action_id ==
EActions.ADD_QUANTITY)
7527 {
7528 if (IsMagazine())
7529 {
7530 Magazine mag = Magazine.Cast(this);
7531 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
7532 }
7533 else
7534 {
7536 }
7537
7538 if (m_EM)
7539 {
7540 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
7541 }
7542
7543 }
7544
7545 else if (action_id ==
EActions.REMOVE_QUANTITY)
7546 {
7547 if (IsMagazine())
7548 {
7549 Magazine mag2 = Magazine.Cast(this);
7550 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
7551 }
7552 else
7553 {
7555 }
7556 if (m_EM)
7557 {
7558 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
7559 }
7560
7561 }
7562
7563 else if (action_id ==
EActions.SET_QUANTITY_0)
7564 {
7566
7567 if (m_EM)
7568 {
7569 m_EM.SetEnergy(0);
7570 }
7571 }
7572
7573 else if (action_id ==
EActions.SET_MAX_QUANTITY)
7574 {
7576
7577 if (m_EM)
7578 {
7579 m_EM.SetEnergy(m_EM.GetEnergyMax());
7580 }
7581 }
7582
7583 else if (action_id ==
EActions.ADD_HEALTH)
7584 {
7585 AddHealth("","",GetMaxHealth("","Health")/5);
7586 }
7587 else if (action_id ==
EActions.REMOVE_HEALTH)
7588 {
7589 AddHealth("","",-GetMaxHealth("","Health")/5);
7590 }
7591 else if (action_id ==
EActions.DESTROY_HEALTH)
7592 {
7593 SetHealth01("","",0);
7594 }
7595 else if (action_id ==
EActions.WATCH_ITEM)
7596 {
7598 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
7599 #ifdef DEVELOPER
7600 SetDebugDeveloper_item(this);
7601 #endif
7602 }
7603
7604 else if (action_id ==
EActions.ADD_TEMPERATURE)
7605 {
7606 AddTemperature(20);
7607
7608 }
7609
7610 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
7611 {
7612 AddTemperature(-20);
7613
7614 }
7615
7616 else if (action_id ==
EActions.FLIP_FROZEN)
7617 {
7618 SetFrozen(!GetIsFrozen());
7619
7620 }
7621
7622 else if (action_id ==
EActions.ADD_WETNESS)
7623 {
7625
7626 }
7627
7628 else if (action_id ==
EActions.REMOVE_WETNESS)
7629 {
7631
7632 }
7633
7634 else if (action_id ==
EActions.LIQUIDTYPE_UP)
7635 {
7638
7639
7640 }
7641
7642 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
7643 {
7646 }
7647
7648 else if (action_id ==
EActions.MAKE_SPECIAL)
7649 {
7650 auto debugParams = DebugSpawnParams.WithPlayer(player);
7651 OnDebugSpawnEx(debugParams);
7652 }
7653
7654 }
7655
7656
7657 return false;
7658 }
7659
7660
7661
7662
7666
7669
7670
7671
7673 {
7674 return false;
7675 }
7676
7677
7679 {
7680 return true;
7681 }
7682
7683
7685 {
7686 return true;
7687 }
7688
7689
7690
7692 {
7693 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
7694 return g_Game.ConfigIsExisting(config_path);
7695 }
7696
7699 {
7700 return null;
7701 }
7702
7704 {
7705 return false;
7706 }
7707
7709 {
7710 return false;
7711 }
7712
7716
7717
7719 {
7720 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7721 return module_repairing.CanRepair(this, item_repair_kit);
7722 }
7723
7724
7725 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
7726 {
7727 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
7728 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
7729 }
7730
7731
7733 {
7734
7735
7736
7737
7738
7739
7740
7741
7742 return 1;
7743 }
7744
7745
7746
7748 {
7750 }
7751
7752
7753
7755 {
7757 }
7758
7759
7768 {
7769 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7770
7771 if (player)
7772 {
7773 player.MessageStatus(text);
7774 }
7775 }
7776
7777
7786 {
7787 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7788
7789 if (player)
7790 {
7791 player.MessageAction(text);
7792 }
7793 }
7794
7795
7804 {
7805 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7806
7807 if (player)
7808 {
7809 player.MessageFriendly(text);
7810 }
7811 }
7812
7813
7822 {
7823 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
7824
7825 if (player)
7826 {
7827 player.MessageImportant(text);
7828 }
7829 }
7830
7832 {
7833 return true;
7834 }
7835
7836
7837 override bool KindOf(
string tag)
7838 {
7839 bool found = false;
7840 string item_name = this.
GetType();
7842 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
7843
7844 int array_size = item_tag_array.Count();
7845 for (int i = 0; i < array_size; i++)
7846 {
7847 if (item_tag_array.Get(i) == tag)
7848 {
7849 found = true;
7850 break;
7851 }
7852 }
7853 return found;
7854 }
7855
7856
7858 {
7859
7860 super.OnRPC(sender, rpc_type,ctx);
7861
7862
7863 switch (rpc_type)
7864 {
7865 #ifndef SERVER
7866 case ERPCs.RPC_SOUND_LOCK_ATTACH:
7867 Param2<bool, string> p = new Param2<bool, string>(false, "");
7868
7870 return;
7871
7872 bool play = p.param1;
7873 string soundSet = p.param2;
7874
7875 if (play)
7876 {
7878 {
7880 {
7882 }
7883 }
7884 else
7885 {
7887 }
7888 }
7889 else
7890 {
7892 }
7893
7894 break;
7895 #endif
7896
7897 }
7898
7900 {
7902 }
7903 }
7904
7905
7906
7907
7909 {
7910 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
7911 return plugin.GetID(
name);
7912 }
7913
7915 {
7916 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
7917 return plugin.GetName(id);
7918 }
7919
7922 {
7923
7924
7925 int varFlags;
7926 if (!ctx.
Read(varFlags))
7927 return;
7928
7929 if (varFlags & ItemVariableFlags.FLOAT)
7930 {
7932 }
7933 }
7934
7936 {
7937
7938 super.SerializeNumericalVars(floats_out);
7939
7940
7941
7943 {
7945 }
7946
7948 {
7950 }
7951
7953 {
7955 }
7956
7958 {
7963 }
7964
7966 {
7968 }
7969 }
7970
7972 {
7973
7974 super.DeSerializeNumericalVars(floats);
7975
7976
7977 int index = 0;
7978 int mask = Math.Round(floats.Get(index));
7979
7980 index++;
7981
7983 {
7985 {
7987 }
7988 else
7989 {
7990 float quantity = floats.Get(index);
7992 }
7993 index++;
7994 }
7995
7997 {
7998 float wet = floats.Get(index);
8000 index++;
8001 }
8002
8004 {
8005 int liquidtype = Math.Round(floats.Get(index));
8007 index++;
8008 }
8009
8011 {
8013 index++;
8015 index++;
8017 index++;
8019 index++;
8020 }
8021
8023 {
8024 int cleanness = Math.Round(floats.Get(index));
8026 index++;
8027 }
8028 }
8029
8031 {
8032 super.WriteVarsToCTX(ctx);
8033
8034
8036 {
8038 }
8039
8041 {
8043 }
8044
8046 {
8048 }
8049
8051 {
8052 int r,g,b,a;
8058 }
8059
8061 {
8063 }
8064 }
8065
8067 {
8068 if (!super.ReadVarsFromCTX(ctx,version))
8069 return false;
8070
8071 int intValue;
8072 float value;
8073
8074 if (version < 140)
8075 {
8076 if (!ctx.
Read(intValue))
8077 return false;
8078
8079 m_VariablesMask = intValue;
8080 }
8081
8083 {
8084 if (!ctx.
Read(value))
8085 return false;
8086
8088 {
8090 }
8091 else
8092 {
8094 }
8095 }
8096
8097 if (version < 140)
8098 {
8100 {
8101 if (!ctx.
Read(value))
8102 return false;
8103 SetTemperatureDirect(value);
8104 }
8105 }
8106
8108 {
8109 if (!ctx.
Read(value))
8110 return false;
8112 }
8113
8115 {
8116 if (!ctx.
Read(intValue))
8117 return false;
8119 }
8120
8122 {
8123 int r,g,b,a;
8125 return false;
8127 return false;
8129 return false;
8131 return false;
8132
8134 }
8135
8137 {
8138 if (!ctx.
Read(intValue))
8139 return false;
8141 }
8142
8143 if (version >= 138 && version < 140)
8144 {
8146 {
8147 if (!ctx.
Read(intValue))
8148 return false;
8149 SetFrozen(intValue);
8150 }
8151 }
8152
8153 return true;
8154 }
8155
8156
8158 {
8161 {
8163 }
8164
8165 if (!super.OnStoreLoad(ctx, version))
8166 {
8168 return false;
8169 }
8170
8171 if (version >= 114)
8172 {
8173 bool hasQuickBarIndexSaved;
8174
8175 if (!ctx.
Read(hasQuickBarIndexSaved))
8176 {
8178 return false;
8179 }
8180
8181 if (hasQuickBarIndexSaved)
8182 {
8183 int itmQBIndex;
8184
8185
8186 if (!ctx.
Read(itmQBIndex))
8187 {
8189 return false;
8190 }
8191
8192 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8193 if (itmQBIndex != -1 && parentPlayer)
8194 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8195 }
8196 }
8197 else
8198 {
8199
8200 PlayerBase player;
8201 int itemQBIndex;
8202 if (version ==
int.
MAX)
8203 {
8204 if (!ctx.
Read(itemQBIndex))
8205 {
8207 return false;
8208 }
8209 }
8210 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8211 {
8212
8213 if (!ctx.
Read(itemQBIndex))
8214 {
8216 return false;
8217 }
8218 if (itemQBIndex != -1 && player)
8219 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8220 }
8221 }
8222
8223 if (version < 140)
8224 {
8225
8226 if (!LoadVariables(ctx, version))
8227 {
8229 return false;
8230 }
8231 }
8232
8233
8235 {
8237 return false;
8238 }
8239 if (version >= 132)
8240 {
8242 if (raib)
8243 {
8245 {
8247 return false;
8248 }
8249 }
8250 }
8251
8253 return true;
8254 }
8255
8256
8257
8259 {
8260 super.OnStoreSave(ctx);
8261
8262 PlayerBase player;
8263 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8264 {
8266
8267 int itemQBIndex = -1;
8268 itemQBIndex = player.FindQuickBarEntityIndex(this);
8269 ctx.
Write(itemQBIndex);
8270 }
8271 else
8272 {
8274 }
8275
8277
8279 if (raib)
8280 {
8282 }
8283 }
8284
8285
8287 {
8288 super.AfterStoreLoad();
8289
8291 {
8293 }
8294
8296 {
8299 }
8300 }
8301
8303 {
8304 super.EEOnAfterLoad();
8305
8307 {
8309 }
8310
8313 }
8314
8316 {
8317 return false;
8318 }
8319
8320
8321
8323 {
8325 {
8326 #ifdef PLATFORM_CONSOLE
8327
8329 {
8331 if (menu)
8332 {
8334 }
8335 }
8336 #endif
8337 }
8338
8340 {
8343 }
8344
8346 {
8347 SetWeightDirty();
8349 }
8351 {
8354 }
8355
8357 {
8360
8363 }
8365 {
8369 }
8370
8371 super.OnVariablesSynchronized();
8372 }
8373
8374
8375
8377 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8378 {
8379 if (!IsServerCheck(allow_client))
8380 return false;
8381
8383 return false;
8384
8387
8388 if (value <= (min + 0.001))
8389 value = min;
8390
8391 if (value == min)
8392 {
8393 if (destroy_config)
8394 {
8395 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8396 if (dstr)
8397 {
8399 this.Delete();
8400 return true;
8401 }
8402 }
8403 else if (destroy_forced)
8404 {
8406 this.Delete();
8407 return true;
8408 }
8409
8411 }
8412
8415
8417 {
8418 EntityAI parent = GetHierarchyRoot();
8419 InventoryLocation iLoc = new InventoryLocation();
8420 GetInventory().GetCurrentInventoryLocation(iLoc);
8422 {
8423 int iLocSlot = iLoc.
GetSlot();
8425 {
8427 }
8429 {
8431 }
8432 }
8433 }
8434
8436 {
8438
8439 if (delta)
8441 }
8442
8444
8445 return false;
8446 }
8447
8448
8450 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8451 {
8453 }
8454
8456 {
8459 }
8460
8462 {
8465 }
8466
8468 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8469 {
8470 float value_clamped = Math.Clamp(value, 0, 1);
8472 SetQuantity(result, destroy_config, destroy_forced);
8473 }
8474
8475
8478 {
8480 }
8481
8483 {
8485 }
8486
8487
8488
8489
8490
8491
8492
8493
8494
8495
8497 {
8498 int slot = -1;
8499 GameInventory inventory = GetInventory();
8500 if (inventory)
8501 {
8502 InventoryLocation il = new InventoryLocation;
8505 }
8506
8508 }
8509
8511 {
8512 float quantity_max = 0;
8513
8515 {
8516 if (attSlotID != -1)
8517 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8518
8519 if (quantity_max <= 0)
8521 }
8522
8523 if (quantity_max <= 0)
8525
8526 return quantity_max;
8527 }
8528
8530 {
8532 }
8533
8535 {
8537 }
8538
8539
8541 {
8543 }
8544
8546 {
8548 }
8549
8551 {
8553 }
8554
8555
8557 {
8558
8559 float weightEx = GetWeightEx();
8560 float special = GetInventoryAndCargoWeight();
8561 return weightEx - special;
8562 }
8563
8564
8566 {
8568 }
8569
8571 {
8573 {
8574 #ifdef DEVELOPER
8575 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8576 {
8577 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
8579 }
8580 #endif
8581
8583 }
8584 else if (HasEnergyManager())
8585 {
8586 #ifdef DEVELOPER
8587 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8588 {
8589 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
8590 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
8591 }
8592 #endif
8593 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
8594 }
8595 else
8596 {
8597 #ifdef DEVELOPER
8598 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8599 {
8600 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
8601 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
8602 }
8603 #endif
8604 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
8605 }
8606 }
8607
8610 {
8611 int item_count = 0;
8613
8614 GameInventory inventory = GetInventory();
8615 CargoBase cargo = inventory.
GetCargo();
8616 if (cargo != NULL)
8617 {
8619 }
8620
8622 for (int i = 0; i < nAttachments; ++i)
8623 {
8625 if (item)
8626 item_count += item.GetNumberOfItems();
8627 }
8628 return item_count;
8629 }
8630
8633 {
8634 float weight = 0;
8635 float wetness = 1;
8636 if (include_wetness)
8639 {
8640 weight = wetness * m_ConfigWeight;
8641 }
8643 {
8644 weight = 1;
8645 }
8646 return weight;
8647 }
8648
8649
8650
8652 {
8653 GameInventory inventory = GetInventory();
8654 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
8655 {
8656 array<EntityAI> items = new array<EntityAI>;
8658 for (int i = 0; i < items.Count(); ++i)
8659 {
8661 if (item)
8662 {
8663 g_Game.ObjectDelete(item);
8664 }
8665 }
8666 }
8667 }
8668
8669
8670
8671
8673 {
8674 float energy = 0;
8675 if (HasEnergyManager())
8676 {
8677 energy = GetCompEM().GetEnergy();
8678 }
8679 return energy;
8680 }
8681
8682
8684 {
8685 super.OnEnergyConsumed();
8686
8688 }
8689
8691 {
8692 super.OnEnergyAdded();
8693
8695 }
8696
8697
8699 {
8700 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
8701 {
8703 {
8704 float energy_0to1 = GetCompEM().GetEnergy0To1();
8706 }
8707 }
8708 }
8709
8710
8712 {
8713 return ConfigGetFloat("heatIsolation");
8714 }
8715
8717 {
8719 }
8720
8722 {
8723 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
8724 if (
g_Game.ConfigIsExisting(paramPath))
8725 return g_Game.ConfigGetFloat(paramPath);
8726
8727 return 0.0;
8728 }
8729
8731 {
8732 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
8733 if (
g_Game.ConfigIsExisting(paramPath))
8734 return g_Game.ConfigGetFloat(paramPath);
8735
8736 return 0.0;
8737 }
8738
8739 override void SetWet(
float value,
bool allow_client =
false)
8740 {
8741 if (!IsServerCheck(allow_client))
8742 return;
8743
8746
8748
8749 m_VarWet = Math.Clamp(value, min, max);
8750
8752 {
8755 }
8756 }
8757
8758 override void AddWet(
float value)
8759 {
8761 }
8762
8764 {
8766 }
8767
8769 {
8771 }
8772
8774 {
8776 }
8777
8779 {
8781 }
8782
8784 {
8786 }
8787
8789 {
8792 if (newLevel != oldLevel)
8793 {
8795 }
8796 }
8797
8799 {
8800 SetWeightDirty();
8801 }
8802
8804 {
8805 return GetWetLevelInternal(
m_VarWet);
8806 }
8807
8808
8809
8811 {
8813 }
8814
8816 {
8818 }
8819
8821 {
8823 }
8824
8826 {
8828 }
8829
8830
8831
8833 {
8834 if (ConfigIsExisting("itemModelLength"))
8835 {
8836 return ConfigGetFloat("itemModelLength");
8837 }
8838 return 0;
8839 }
8840
8842 {
8843 if (ConfigIsExisting("itemAttachOffset"))
8844 {
8845 return ConfigGetFloat("itemAttachOffset");
8846 }
8847 return 0;
8848 }
8849
8850 override void SetCleanness(
int value,
bool allow_client =
false)
8851 {
8852 if (!IsServerCheck(allow_client))
8853 return;
8854
8856
8858
8861 }
8862
8864 {
8866 }
8867
8869 {
8870 return true;
8871 }
8872
8873
8874
8875
8877 {
8879 }
8880
8882 {
8884 }
8885
8886
8887
8888
8889 override void SetColor(
int r,
int g,
int b,
int a)
8890 {
8896 }
8898 override void GetColor(out
int r,out
int g,out
int b,out
int a)
8899 {
8904 }
8905
8907 {
8909 }
8910
8913 {
8914 int r,g,b,a;
8916 r = r/255;
8917 g = g/255;
8918 b = b/255;
8919 a = a/255;
8920 return MiscGameplayFunctions.GetColorString(r, g, b, a);
8921 }
8922
8923
8924
8925 override void SetLiquidType(
int value,
bool allow_client =
false)
8926 {
8927 if (!IsServerCheck(allow_client))
8928 return;
8929
8934 }
8935
8937 {
8938 return ConfigGetInt("varLiquidTypeInit");
8939 }
8940
8942 {
8944 }
8945
8947 {
8949 SetFrozen(false);
8950 }
8951
8954 {
8955 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
8956 }
8957
8958
8961 {
8962 PlayerBase nplayer;
8963 if (PlayerBase.CastTo(nplayer, player))
8964 {
8966 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
8967 }
8968 }
8969
8970
8973 {
8974 PlayerBase nplayer;
8975 if (PlayerBase.CastTo(nplayer,player))
8976 {
8977 nplayer.SetEnableQuickBarEntityShortcut(this, false);
8978 }
8979
8980 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
8981
8982 if (HasEnergyManager())
8983 {
8984 GetCompEM().UpdatePlugState();
8985 }
8986 }
8987
8988
8990 {
8991 super.OnPlacementStarted(player);
8992
8994 }
8995
8996 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
8997 {
8999 {
9000 m_AdminLog.OnPlacementComplete(player,
this);
9001 }
9002
9003 super.OnPlacementComplete(player, position, orientation);
9004 }
9005
9006
9007
9008
9009
9011 {
9013 {
9014 return true;
9015 }
9016 else
9017 {
9018 return false;
9019 }
9020 }
9021
9022
9024 {
9026 {
9028 }
9029 }
9030
9031
9033 {
9035 }
9036
9038 {
9040 }
9041
9042 override void InsertAgent(
int agent,
float count = 1)
9043 {
9044 if (count < 1)
9045 return;
9046
9048 }
9049
9052 {
9054 }
9055
9056
9058 {
9060 }
9061
9062
9063
9064
9065
9066
9067
9068
9069
9070
9071
9072
9073
9074
9075
9076
9077
9078
9079
9080
9081
9082
9083
9084
9085
9086
9087
9088
9089
9090
9091
9092
9093
9094
9095
9096
9097
9098
9099
9100
9101
9102
9104 {
9106 return false;
9107 return true;
9108 }
9109
9111 {
9112
9114 }
9115
9116
9119 {
9120 super.CheckForRoofLimited(timeTresholdMS);
9121
9122 float time =
g_Game.GetTime();
9123 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9124 {
9125 m_PreviousRoofTestTime = time;
9126 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9127 }
9128 }
9129
9130
9132 {
9134 {
9135 return 0;
9136 }
9137
9138 if (GetInventory().GetAttachmentSlotsCount() != 0)
9139 {
9140 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9141 if (filter)
9142 return filter.GetProtectionLevel(type, false, system);
9143 else
9144 return 0;
9145 }
9146
9147 string subclassPath, entryName;
9148
9149 switch (type)
9150 {
9152 entryName = "biological";
9153 break;
9155 entryName = "chemical";
9156 break;
9157 default:
9158 entryName = "biological";
9159 break;
9160 }
9161
9162 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9163
9164 return g_Game.ConfigGetFloat(subclassPath + entryName);
9165 }
9166
9167
9168
9171 {
9172 if (!IsMagazine())
9174
9176 }
9177
9178
9179
9180
9181
9186 {
9187 return true;
9188 }
9189
9191 {
9193 }
9194
9195
9196
9197
9198
9200 {
9201 if (parent)
9202 {
9203 if (parent.IsInherited(DayZInfected))
9204 return true;
9205
9206 if (!parent.IsRuined())
9207 return true;
9208 }
9209
9210 return true;
9211 }
9212
9214 {
9215 if (!super.CanPutAsAttachment(parent))
9216 {
9217 return false;
9218 }
9219
9220 if (!IsRuined() && !parent.IsRuined())
9221 {
9222 return true;
9223 }
9224
9225 return false;
9226 }
9227
9229 {
9230
9231
9232
9233
9234 return super.CanReceiveItemIntoCargo(item);
9235 }
9236
9238 {
9239
9240
9241
9242
9243 GameInventory attachmentInv = attachment.GetInventory();
9245 {
9246 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9247 return false;
9248 }
9249
9250 InventoryLocation loc = new InventoryLocation();
9251 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9252 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9253 return false;
9254
9255 return super.CanReceiveAttachment(attachment, slotId);
9256 }
9257
9259 {
9260 if (!super.CanReleaseAttachment(attachment))
9261 return false;
9262
9263 return GetInventory().AreChildrenAccessible();
9264 }
9265
9266
9267
9268
9269
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9280
9281
9282
9283
9284
9285
9287 {
9288 int id = muzzle_owner.GetMuzzleID();
9289 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9290
9291 if (WPOF_array)
9292 {
9293 for (int i = 0; i < WPOF_array.Count(); i++)
9294 {
9295 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9296
9297 if (WPOF)
9298 {
9299 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9300 }
9301 }
9302 }
9303 }
9304
9305
9307 {
9308 int id = muzzle_owner.GetMuzzleID();
9310
9311 if (WPOBE_array)
9312 {
9313 for (int i = 0; i < WPOBE_array.Count(); i++)
9314 {
9315 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9316
9317 if (WPOBE)
9318 {
9319 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9320 }
9321 }
9322 }
9323 }
9324
9325
9327 {
9328 int id = muzzle_owner.GetMuzzleID();
9329 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9330
9331 if (WPOOH_array)
9332 {
9333 for (int i = 0; i < WPOOH_array.Count(); i++)
9334 {
9335 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9336
9337 if (WPOOH)
9338 {
9339 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9340 }
9341 }
9342 }
9343 }
9344
9345
9347 {
9348 int id = muzzle_owner.GetMuzzleID();
9349 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9350
9351 if (WPOOH_array)
9352 {
9353 for (int i = 0; i < WPOOH_array.Count(); i++)
9354 {
9355 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9356
9357 if (WPOOH)
9358 {
9359 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9360 }
9361 }
9362 }
9363 }
9364
9365
9367 {
9368 int id = muzzle_owner.GetMuzzleID();
9369 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9370
9371 if (WPOOH_array)
9372 {
9373 for (int i = 0; i < WPOOH_array.Count(); i++)
9374 {
9375 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9376
9377 if (WPOOH)
9378 {
9379 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9380 }
9381 }
9382 }
9383 }
9384
9385
9386
9388 {
9390 {
9391 return true;
9392 }
9393
9394 return false;
9395 }
9396
9398 {
9400 {
9401 return true;
9402 }
9403
9404 return false;
9405 }
9406
9408 {
9410 {
9411 return true;
9412 }
9413
9414 return false;
9415 }
9416
9418 {
9419 return false;
9420 }
9421
9424 {
9425 return UATimeSpent.DEFAULT_DEPLOY;
9426 }
9427
9428
9429
9430
9432 {
9434 SetSynchDirty();
9435 }
9436
9438 {
9440 }
9441
9442
9444 {
9445 return false;
9446 }
9447
9450 {
9451 string att_type = "None";
9452
9453 if (ConfigIsExisting("soundAttType"))
9454 {
9455 att_type = ConfigGetString("soundAttType");
9456 }
9457
9459 }
9460
9462 {
9464 }
9465
9466
9467
9468
9469
9475
9477 {
9480
9482 }
9483
9484
9486 {
9488 return;
9489
9491
9494
9497
9498 SoundParameters params = new SoundParameters();
9502 }
9503
9504
9506 {
9508 {
9511
9512 SetSynchDirty();
9513
9516 }
9517 }
9518
9520 {
9522 }
9523
9524
9526 {
9528 return;
9529
9531 SetSynchDirty();
9532
9535 }
9536
9538 {
9541 }
9542
9544 {
9546 }
9547
9548 void OnApply(PlayerBase player);
9549
9551 {
9552 return 1.0;
9553 };
9554
9556 {
9558 }
9559
9561 {
9563 }
9564
9566
9568 {
9569 SetDynamicPhysicsLifeTime(0.01);
9571 }
9572
9574 {
9575 array<string> zone_names = new array<string>;
9576 GetDamageZones(zone_names);
9577 for (int i = 0; i < zone_names.Count(); i++)
9578 {
9579 SetHealthMax(zone_names.Get(i),"Health");
9580 }
9581 SetHealthMax("","Health");
9582 }
9583
9586 {
9587 float global_health = GetHealth01("","Health");
9588 array<string> zones = new array<string>;
9589 GetDamageZones(zones);
9590
9591 for (int i = 0; i < zones.Count(); i++)
9592 {
9593 SetHealth01(zones.Get(i),"Health",global_health);
9594 }
9595 }
9596
9599 {
9600 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
9601 }
9602
9604 {
9605 if (!hasRootAsPlayer)
9606 {
9607 if (refParentIB)
9608 {
9609
9610 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
9611 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
9612
9613 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
9614 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
9615
9618 }
9619 else
9620 {
9621
9624 }
9625 }
9626 }
9627
9629 {
9631 {
9632 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
9633 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
9634 {
9635 float heatPermCoef = 1.0;
9637 while (ent)
9638 {
9639 heatPermCoef *= ent.GetHeatPermeabilityCoef();
9640 ent = ent.GetHierarchyParent();
9641 }
9642
9643 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
9644 }
9645 }
9646 }
9647
9649 {
9650
9651 EntityAI parent = GetHierarchyParent();
9652 if (!parent)
9653 {
9654 hasParent = false;
9655 hasRootAsPlayer = false;
9656 }
9657 else
9658 {
9659 hasParent = true;
9660 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
9661 refParentIB =
ItemBase.Cast(parent);
9662 }
9663 }
9664
9665 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
9666 {
9667
9668 }
9669
9671 {
9672
9673 return false;
9674 }
9675
9677 {
9678
9679
9680 return false;
9681 }
9682
9684 {
9685
9686 return false;
9687 }
9688
9691 {
9692 return !GetIsFrozen() &&
IsOpen();
9693 }
9694
9696 {
9697 bool hasParent = false, hasRootAsPlayer = false;
9699
9700 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
9701 bool foodDecay =
g_Game.IsFoodDecayEnabled();
9702
9703 if (wwtu || foodDecay)
9704 {
9708
9709 if (processWetness || processTemperature || processDecay)
9710 {
9712
9713 if (processWetness)
9714 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
9715
9716 if (processTemperature)
9718
9719 if (processDecay)
9720 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
9721 }
9722 }
9723 }
9724
9727 {
9729 }
9730
9732 {
9735
9736 return super.GetTemperatureFreezeThreshold();
9737 }
9738
9740 {
9743
9744 return super.GetTemperatureThawThreshold();
9745 }
9746
9748 {
9751
9752 return super.GetItemOverheatThreshold();
9753 }
9754
9756 {
9758 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
9759
9760 return super.GetTemperatureFreezeTime();
9761 }
9762
9764 {
9766 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
9767
9768 return super.GetTemperatureThawTime();
9769 }
9770
9775
9777 {
9778 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
9779 }
9780
9782 {
9783 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
9784 }
9785
9788 {
9790 }
9791
9793 {
9795 }
9796
9798 {
9800 }
9801
9804 {
9805 return null;
9806 }
9807
9810 {
9811 return false;
9812 }
9813
9815 {
9817 {
9820 if (!trg)
9821 {
9823 explosive = this;
9824 }
9825
9826 explosive.PairRemote(trg);
9828
9829 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
9830 trg.SetPersistentPairID(persistentID);
9831 explosive.SetPersistentPairID(persistentID);
9832
9833 return true;
9834 }
9835 return false;
9836 }
9837
9840 {
9841 float ret = 1.0;
9844 ret *= GetHealth01();
9845
9846 return ret;
9847 }
9848
9849 #ifdef DEVELOPER
9850 override void SetDebugItem()
9851 {
9852 super.SetDebugItem();
9853 _itemBase = this;
9854 }
9855
9857 {
9858 string text = super.GetDebugText();
9859
9861 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
9862
9863 return text;
9864 }
9865 #endif
9866
9868 {
9869 return true;
9870 }
9871
9873
9875
9877 {
9880 }
9881
9882
9890
9906
9907 [
Obsolete(
"Use ItemSoundHandler instead")]
9910 {
9911 if (!
g_Game.IsDedicatedServer())
9912 {
9913 if (ConfigIsExisting("attachSoundSet"))
9914 {
9915 string cfg_path = "";
9916 string soundset = "";
9918
9921 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
9922 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
9923
9924 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
9925 {
9926 for (int i = 0; i < cfg_soundset_array.Count(); i++)
9927 {
9928 if (cfg_slot_array[i] == slot_type)
9929 {
9930 soundset = cfg_soundset_array[i];
9931 break;
9932 }
9933 }
9934 }
9935
9936 if (soundset != "")
9937 {
9938 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
9940 }
9941 }
9942 }
9943 }
9944
9946}
9947
9949{
9951 if (entity)
9952 {
9953 bool is_item = entity.IsInherited(
ItemBase);
9954 if (is_item && full_quantity)
9955 {
9958 }
9959 }
9960 else
9961 {
9963 return NULL;
9964 }
9965 return entity;
9966}
9967
9969{
9970 if (item)
9971 {
9972 if (health > 0)
9973 item.SetHealth("", "", health);
9974
9975 if (item.CanHaveTemperature())
9976 {
9978 if (item.CanFreeze())
9979 item.SetFrozen(false);
9980 }
9981
9982 if (item.HasEnergyManager())
9983 {
9984 if (quantity >= 0)
9985 {
9986 item.GetCompEM().SetEnergy0To1(quantity);
9987 }
9988 else
9989 {
9991 }
9992 }
9993 else if (item.IsMagazine())
9994 {
9995 Magazine mag = Magazine.Cast(item);
9996 if (quantity >= 0)
9997 {
9998 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
9999 }
10000 else
10001 {
10003 }
10004
10005 }
10006 else
10007 {
10008 if (quantity >= 0)
10009 {
10010 item.SetQuantityNormalized(quantity, false);
10011 }
10012 else
10013 {
10015 }
10016
10017 }
10018 }
10019}
10020
10021#ifdef DEVELOPER
10023#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.