5429{
5431 {
5432 return true;
5433 }
5434};
5435
5437{
5438
5439};
5440
5441
5442
5444{
5448
5450
5453
5454
5455
5456
5457
5466
5472
5477
5482
5503 protected bool m_IsResultOfSplit
5504
5506
5511
5512
5513
5515
5519
5520
5521
5523
5526
5527
5528
5534
5535
5543
5546
5547
5549
5550
5552
5553
5558
5559
5564
5566
5567
5569
5570
5572 {
5577
5578 if (!
g_Game.IsDedicatedServer())
5579 {
5581 {
5583
5585 {
5587 }
5588 }
5589
5592 }
5593
5594 m_OldLocation = null;
5595
5597 {
5599 }
5600
5601 if (ConfigIsExisting("headSelectionsToHide"))
5602 {
5605 }
5606
5608 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5609 {
5611 }
5612
5614
5615 m_IsResultOfSplit = false;
5616
5618 }
5619
5621 {
5622 super.InitItemVariables();
5623
5629 m_Count = ConfigGetInt(
"count");
5630
5633
5638
5641
5646
5658
5662
5663
5666 if (ConfigIsExisting("canBeSplit"))
5667 {
5670 }
5671
5673 if (ConfigIsExisting("itemBehaviour"))
5675
5676
5679 RegisterNetSyncVariableInt("m_VarLiquidType");
5680 RegisterNetSyncVariableInt("m_Cleanness",0,1);
5681
5682 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
5683 RegisterNetSyncVariableFloat("m_ImpactSpeed");
5684 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
5685
5686 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
5687 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
5688 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
5689 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
5690
5691 RegisterNetSyncVariableBool("m_IsBeingPlaced");
5692 RegisterNetSyncVariableBool("m_IsTakeable");
5693 RegisterNetSyncVariableBool("m_IsHologram");
5694
5697 {
5700 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
5701 }
5702
5704
5706 if (ConfigIsExisting("temperaturePerQuantityWeight"))
5708
5710 }
5711
5713 {
5715 }
5716
5718 {
5721 {
5726 }
5727 }
5728
5729 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
5730 {
5732 {
5735 }
5736
5738 }
5739
5741 {
5747 }
5748
5750
5752 {
5754
5755 if (!action)
5756 {
5757 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
5758 return;
5759 }
5760
5762 if (!ai)
5763 {
5765 return;
5766 }
5767
5769 if (!action_array)
5770 {
5771 action_array = new array<ActionBase_Basic>;
5773 }
5774 if (LogManager.IsActionLogEnable())
5775 {
5776 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
5777 }
5778
5779 if (action_array.Find(action) != -1)
5780 {
5781 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
5782 }
5783 else
5784 {
5785 action_array.Insert(action);
5786 }
5787 }
5788
5790 {
5791 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
5792 ActionBase action = player.GetActionManager().GetAction(actionName);
5795
5796 if (action_array)
5797 {
5798 action_array.RemoveItem(action);
5799 }
5800 }
5801
5802
5803
5805 {
5806 ActionOverrideData overrideData = new ActionOverrideData();
5810
5812 if (!actionMap)
5813 {
5816 }
5817
5818 actionMap.Insert(this.
Type(), overrideData);
5819
5820 }
5821
5823
5825
5826
5828 {
5831
5834
5835 string config_to_search = "CfgVehicles";
5836 string muzzle_owner_config;
5837
5839 {
5840 if (IsInherited(Weapon))
5841 config_to_search = "CfgWeapons";
5842
5843 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5844
5845 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
5846
5847 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
5848
5849 if (config_OnFire_subclass_count > 0)
5850 {
5851 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
5852
5853 for (int i = 0; i < config_OnFire_subclass_count; i++)
5854 {
5855 string particle_class = "";
5856 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
5857 string config_OnFire_entry = config_OnFire_class + particle_class;
5858 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
5859 WPOF_array.Insert(WPOF);
5860 }
5861
5862
5864 }
5865 }
5866
5868 {
5869 config_to_search = "CfgWeapons";
5870 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5871
5872 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
5873
5874 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
5875
5876 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
5877 {
5878 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
5879
5880 for (i = 0; i < config_OnBulletCasingEject_count; i++)
5881 {
5882 string particle_class2 = "";
5883 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
5884 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
5885 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
5886 WPOBE_array.Insert(WPOBE);
5887 }
5888
5889
5891 }
5892 }
5893 }
5894
5895
5897 {
5900
5902 {
5903 string config_to_search = "CfgVehicles";
5904
5905 if (IsInherited(Weapon))
5906 config_to_search = "CfgWeapons";
5907
5908 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
5909 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
5910
5911 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
5912 {
5913
5915
5917 {
5919 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
5921 return;
5922 }
5923
5926
5927
5928
5929 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
5930 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
5931
5932 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
5933 {
5934 string particle_class = "";
5935 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
5936 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
5937 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
5938
5939 if (entry_type == CT_CLASS)
5940 {
5941 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
5942 WPOOH_array.Insert(WPOF);
5943 }
5944 }
5945
5946
5948 }
5949 }
5950 }
5951
5953 {
5955 }
5956
5958 {
5960 {
5962
5965
5968
5969 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5970 }
5971 }
5972
5974 {
5976 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5977
5979 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5980
5982 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
5983
5985 {
5987 }
5988 }
5989
5991 {
5993 }
5994
5996 {
5999 else
6001
6003 {
6006 }
6007 else
6008 {
6011
6014 }
6015
6017 }
6018
6020 {
6022 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6023 }
6024
6026 {
6028 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6030 }
6031
6033 {
6035 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6036 }
6037
6039 {
6042
6043 OverheatingParticle OP = new OverheatingParticle();
6048
6050 }
6051
6053 {
6056
6057 return -1;
6058 }
6059
6061 {
6063 {
6066
6067 for (int i = count; i > 0; --i)
6068 {
6069 int id = i - 1;
6072
6075
6076 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6077 {
6078 if (p)
6079 {
6082 }
6083 }
6084 }
6085 }
6086 }
6087
6089 {
6091 {
6093 {
6094 int id = i - 1;
6096
6097 if (OP)
6098 {
6100
6101 if (p)
6102 {
6104 }
6105
6106 delete OP;
6107 }
6108 }
6109
6112 }
6113 }
6114
6117 {
6118 return 0.0;
6119 }
6120
6121
6123 {
6124 return 250;
6125 }
6126
6128 {
6129 return 0;
6130 }
6131
6134 {
6136 return true;
6137
6138 return false;
6139 }
6140
6143 {
6146
6148 {
6150 }
6151 else
6152 {
6153
6155 }
6156
6158 }
6159
6166 {
6167 return -1;
6168 }
6169
6170
6171
6172
6174 {
6176 {
6177 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6178 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6179
6180 if (r_index >= 0)
6181 {
6182 InventoryLocation r_il = new InventoryLocation;
6183 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6184
6185 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6188 {
6189 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6190 }
6192 {
6193 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6194 }
6195
6196 }
6197
6198 player.GetHumanInventory().ClearUserReservedLocation(this);
6199 }
6200
6203 }
6204
6205
6206
6207
6209 {
6210 return ItemBase.m_DebugActionsMask;
6211 }
6212
6214 {
6215 return ItemBase.m_DebugActionsMask & mask;
6216 }
6217
6219 {
6220 ItemBase.m_DebugActionsMask = mask;
6221 }
6222
6224 {
6225 ItemBase.m_DebugActionsMask |= mask;
6226 }
6227
6229 {
6230 ItemBase.m_DebugActionsMask &= ~mask;
6231 }
6232
6234 {
6236 {
6238 }
6239 else
6240 {
6242 }
6243 }
6244
6245
6247 {
6248 if (GetEconomyProfile())
6249 {
6250 float q_max = GetEconomyProfile().GetQuantityMax();
6251 if (q_max > 0)
6252 {
6253 float q_min = GetEconomyProfile().GetQuantityMin();
6254 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6255
6257 {
6258 ComponentEnergyManager comp = GetCompEM();
6260 {
6262 }
6263 }
6265 {
6267
6268 }
6269
6270 }
6271 }
6272 }
6273
6276 {
6277 EntityAI parent = GetHierarchyParent();
6278
6279 if (parent)
6280 {
6281 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6282 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6283 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6284 }
6285 }
6286
6289 {
6290 EntityAI parent = GetHierarchyParent();
6291
6292 if (parent)
6293 {
6294 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6295 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6296 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6297 }
6298 }
6299
6301 {
6302
6303
6304
6305
6307
6309 {
6310 if (ScriptInputUserData.CanStoreInputUserData())
6311 {
6312 ScriptInputUserData ctx = new ScriptInputUserData;
6318 ctx.
Write(use_stack_max);
6321
6323 {
6324 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6325 }
6326 }
6327 }
6328 else if (!
g_Game.IsMultiplayer())
6329 {
6331 }
6332 }
6333
6335 {
6337 }
6338
6340 {
6342 }
6343
6345 {
6347 }
6348
6350 {
6351
6352 return false;
6353 }
6354
6356 {
6357 return false;
6358 }
6359
6363 {
6364 return false;
6365 }
6366
6368 {
6369 return "";
6370 }
6371
6373
6375 {
6376 return false;
6377 }
6378
6380 {
6381 return true;
6382 }
6383
6384
6385
6387 {
6388 return true;
6389 }
6390
6392 {
6393 return true;
6394 }
6395
6397 {
6398 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6400 }
6401
6403 {
6405 }
6406
6408 {
6410 if (!is_being_placed)
6412 SetSynchDirty();
6413 }
6414
6415
6417
6419 {
6421 }
6422
6424 {
6426 }
6427
6429 {
6430 return 1;
6431 }
6432
6434 {
6435 return false;
6436 }
6437
6439 {
6441 SetSynchDirty();
6442 }
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6479 {
6480 super.OnMovedInsideCargo(container);
6481
6482 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6483 }
6484
6485 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6486 {
6487 super.EEItemLocationChanged(oldLoc, newLoc);
6488
6489 PlayerBase newPlayer = null;
6490 PlayerBase oldPlayer = null;
6491
6492 if (newLoc.GetParent())
6493 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6494
6495 if (oldLoc.GetParent())
6496 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6497
6499 {
6500 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6501
6502 if (rIndex >= 0)
6503 {
6504 InventoryLocation rIl = new InventoryLocation;
6505 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6506
6507 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6510 {
6511 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6512 }
6514 {
6516 }
6517
6518 }
6519 }
6520
6522 {
6523 if (newPlayer)
6524 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6525
6526 if (newPlayer == oldPlayer)
6527 {
6528 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6529 {
6531 {
6532 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6533 {
6534 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6535 }
6536 }
6537 else
6538 {
6539 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6540 }
6541 }
6542
6543 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6544 {
6545 int type = oldLoc.GetType();
6547 {
6548 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6549 }
6551 {
6552 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6553 }
6554 }
6555 if (!m_OldLocation)
6556 {
6557 m_OldLocation = new InventoryLocation;
6558 }
6559 m_OldLocation.Copy(oldLoc);
6560 }
6561 else
6562 {
6563 if (m_OldLocation)
6564 {
6565 m_OldLocation.Reset();
6566 }
6567 }
6568
6569 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6570 }
6571 else
6572 {
6573 if (newPlayer)
6574 {
6575 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6576 if (resIndex >= 0)
6577 {
6578 InventoryLocation il = new InventoryLocation;
6579 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6581 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6584 {
6585 il.
GetParent().GetOnReleaseLock().Invoke(it);
6586 }
6588 {
6590 }
6591
6592 }
6593 }
6595 {
6596
6598 }
6599
6600 if (m_OldLocation)
6601 {
6602 m_OldLocation.Reset();
6603 }
6604 }
6605
6607 {
6608 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6609 }
6610
6612 {
6613 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6614 }
6615 }
6616
6617 override void EOnContact(IEntity other, Contact extra)
6618 {
6620 {
6621 int liquidType = -1;
6623 if (impactSpeed > 0.0)
6624 {
6626 #ifndef SERVER
6628 #else
6630 SetSynchDirty();
6631 #endif
6633 }
6634 }
6635
6636 #ifdef SERVER
6637 if (GetCompEM() && GetCompEM().IsPlugged())
6638 {
6639 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
6640 GetCompEM().UnplugThis();
6641 }
6642 #endif
6643 }
6644
6646
6648 {
6650 }
6651
6653 {
6654
6655 }
6656
6658 {
6659 super.OnItemLocationChanged(old_owner, new_owner);
6660
6661 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
6662 PlayerBase playerNew = PlayerBase.Cast(new_owner);
6663
6664 if (!relatedPlayer && playerNew)
6665 relatedPlayer = playerNew;
6666
6667 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
6668 {
6670 if (actionMgr)
6671 {
6672 ActionBase currentAction = actionMgr.GetRunningAction();
6673 if (currentAction)
6675 }
6676 }
6677
6678 Man ownerPlayerOld = null;
6679 Man ownerPlayerNew = null;
6680
6681 if (old_owner)
6682 {
6683 if (old_owner.
IsMan())
6684 {
6685 ownerPlayerOld = Man.Cast(old_owner);
6686 }
6687 else
6688 {
6689 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
6690 }
6691 }
6692 else
6693 {
6695 {
6697
6698 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
6699 {
6700 GetCompEM().UnplugThis();
6701 }
6702 }
6703 }
6704
6705 if (new_owner)
6706 {
6707 if (new_owner.
IsMan())
6708 {
6709 ownerPlayerNew = Man.Cast(new_owner);
6710 }
6711 else
6712 {
6713 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
6714 }
6715 }
6716
6717 if (ownerPlayerOld != ownerPlayerNew)
6718 {
6719 if (ownerPlayerOld)
6720 {
6721 array<EntityAI> subItemsExit = new array<EntityAI>;
6723 for (int i = 0; i < subItemsExit.Count(); i++)
6724 {
6727 }
6728 }
6729
6730 if (ownerPlayerNew)
6731 {
6732 array<EntityAI> subItemsEnter = new array<EntityAI>;
6734 for (int j = 0; j < subItemsEnter.Count(); j++)
6735 {
6738 }
6739 }
6740 }
6741 else if (ownerPlayerNew != null)
6742 {
6743 PlayerBase nplayer;
6744 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
6745 {
6746 array<EntityAI> subItemsUpdate = new array<EntityAI>;
6748 for (int k = 0; k < subItemsUpdate.Count(); k++)
6749 {
6751 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
6752 }
6753 }
6754 }
6755
6756 if (old_owner)
6757 old_owner.OnChildItemRemoved(this);
6758 if (new_owner)
6759 new_owner.OnChildItemReceived(this);
6760 }
6761
6762
6764 {
6765 super.EEDelete(parent);
6766 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
6767 if (player)
6768 {
6770
6771 if (player.IsAlive())
6772 {
6773 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6774 if (r_index >= 0)
6775 {
6776 InventoryLocation r_il = new InventoryLocation;
6777 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6778
6779 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6782 {
6783 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6784 }
6786 {
6787 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6788 }
6789
6790 }
6791
6792 player.RemoveQuickBarEntityShortcut(this);
6793 }
6794 }
6795 }
6796
6798 {
6799 super.EEKilled(killer);
6800
6803 {
6804 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
6805 {
6806 if (IsMagazine())
6807 {
6808 if (Magazine.Cast(this).GetAmmoCount() > 0)
6809 {
6811 }
6812 }
6813 else
6814 {
6816 }
6817 }
6818 }
6819 }
6820
6822 {
6823 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6824
6825 super.OnWasAttached(parent, slot_id);
6826
6829
6832 }
6833
6835 {
6836 super.OnWasDetached(parent, slot_id);
6837
6840
6843 }
6844
6846 {
6847 int idx;
6850
6851 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6852 if (inventory_slots.Count() < 1)
6853 {
6854 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
6855 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
6856 }
6857 else
6858 {
6859 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
6860 }
6861
6862 idx = inventory_slots.Find(slot);
6863 if (idx < 0)
6864 return "";
6865
6866 return attach_types.Get(idx);
6867 }
6868
6870 {
6871 int idx = -1;
6872 string slot;
6873
6876
6877 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
6878 if (inventory_slots.Count() < 1)
6879 {
6880 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
6881 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6882 }
6883 else
6884 {
6885 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
6886 if (detach_types.Count() < 1)
6887 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
6888 }
6889
6890 for (int i = 0; i < inventory_slots.Count(); i++)
6891 {
6892 slot = inventory_slots.Get(i);
6893 }
6894
6895 if (slot != "")
6896 {
6897 if (detach_types.Count() == 1)
6898 idx = 0;
6899 else
6900 idx = inventory_slots.Find(slot);
6901 }
6902 if (idx < 0)
6903 return "";
6904
6905 return detach_types.Get(idx);
6906 }
6907
6909 {
6910
6912
6913
6914 float min_time = 1;
6915 float max_time = 3;
6916 float delay = Math.RandomFloat(min_time, max_time);
6917
6918 explode_timer.Run(delay, this, "DoAmmoExplosion");
6919 }
6920
6922 {
6923 Magazine magazine = Magazine.Cast(this);
6924 int pop_sounds_count = 6;
6925 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
6926
6927
6928 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
6929 string sound_name = pop_sounds[ sound_idx ];
6930 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
6931
6932
6933 magazine.ServerAddAmmoCount(-1);
6934
6935
6936 float min_temp_to_explode = 100;
6937
6938 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
6939 {
6941 }
6942 }
6943
6944
6945 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
6946 {
6947 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
6948
6949 const int CHANCE_DAMAGE_CARGO = 4;
6950 const int CHANCE_DAMAGE_ATTACHMENT = 1;
6951 const int CHANCE_DAMAGE_NOTHING = 2;
6952
6954 {
6955 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
6956 int chances;
6957 int rnd;
6958
6959 if (GetInventory().GetCargo())
6960 {
6961 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6962 rnd = Math.RandomInt(0,chances);
6963
6964 if (rnd < CHANCE_DAMAGE_CARGO)
6965 {
6967 }
6968 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
6969 {
6971 }
6972 }
6973 else
6974 {
6975 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
6976 rnd = Math.RandomInt(0,chances);
6977
6978 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
6979 {
6981 }
6982 }
6983 }
6984 }
6985
6987 {
6988 CargoBase cargo = GetInventory().GetCargo();
6989 if (cargo)
6990 {
6992 if (item_count > 0)
6993 {
6994 int random_pick = Math.RandomInt(0, item_count);
6996 if (!item.IsExplosive())
6997 {
6998 item.AddHealth("","",damage);
6999 return true;
7000 }
7001 }
7002 }
7003 return false;
7004 }
7005
7007 {
7008 GameInventory inventory = GetInventory();
7010 if (attachment_count > 0)
7011 {
7012 int random_pick = Math.RandomInt(0, attachment_count);
7014 if (!attachment.IsExplosive())
7015 {
7016 attachment.AddHealth("","",damage);
7017 return true;
7018 }
7019 }
7020 return false;
7021 }
7022
7024 {
7026 }
7027
7029 {
7031 return GetInventory().CanRemoveEntity();
7032
7033 return false;
7034 }
7035
7037 {
7038
7040 return false;
7041
7042
7044 return false;
7045
7046
7047
7049 if (delta == 0)
7050 return false;
7051
7052
7053 return true;
7054 }
7055
7057 {
7059 {
7060 if (ScriptInputUserData.CanStoreInputUserData())
7061 {
7062 ScriptInputUserData ctx = new ScriptInputUserData;
7067 ctx.
Write(destination_entity);
7071 }
7072 }
7073 else if (!
g_Game.IsMultiplayer())
7074 {
7076 }
7077 }
7078
7080 {
7081 float split_quantity_new;
7085 InventoryLocation loc = new InventoryLocation;
7086
7087 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7088 {
7090 split_quantity_new = stack_max;
7091 else
7093
7095 {
7096 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7097 if (new_item)
7098 {
7099 new_item.SetResultOfSplit(true);
7100 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7102 new_item.
SetQuantity(split_quantity_new,
false,
true);
7103 }
7104 }
7105 }
7106 else if (destination_entity && slot_id == -1)
7107 {
7108 if (quantity > stack_max)
7109 split_quantity_new = stack_max;
7110 else
7111 split_quantity_new = quantity;
7112
7114 {
7115 GameInventory destinationInventory = destination_entity.GetInventory();
7117 {
7120 }
7121
7122 if (new_item)
7123 {
7124 new_item.SetResultOfSplit(true);
7125 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7127 new_item.
SetQuantity(split_quantity_new,
false,
true);
7128 }
7129 }
7130 }
7131 else
7132 {
7133 if (stack_max != 0)
7134 {
7136 {
7138 }
7139
7140 if (split_quantity_new == 0)
7141 {
7142 if (!
g_Game.IsMultiplayer())
7143 player.PhysicalPredictiveDropItem(this);
7144 else
7145 player.ServerDropEntity(this);
7146 return;
7147 }
7148
7150 {
7152
7153 if (new_item)
7154 {
7155 new_item.SetResultOfSplit(true);
7156 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7159 new_item.PlaceOnSurface();
7160 }
7161 }
7162 }
7163 }
7164 }
7165
7167 {
7168 float split_quantity_new;
7172 InventoryLocation loc = new InventoryLocation;
7173
7174 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7175 {
7177 split_quantity_new = stack_max;
7178 else
7180
7182 {
7183 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7184 if (new_item)
7185 {
7186 new_item.SetResultOfSplit(true);
7187 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7189 new_item.
SetQuantity(split_quantity_new,
false,
true);
7190 }
7191 }
7192 }
7193 else if (destination_entity && slot_id == -1)
7194 {
7195 if (quantity > stack_max)
7196 split_quantity_new = stack_max;
7197 else
7198 split_quantity_new = quantity;
7199
7201 {
7202 GameInventory destinationInventory = destination_entity.GetInventory();
7204 {
7207 }
7208
7209 if (new_item)
7210 {
7211 new_item.SetResultOfSplit(true);
7212 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7214 new_item.
SetQuantity(split_quantity_new,
false,
true);
7215 }
7216 }
7217 }
7218 else
7219 {
7220 if (stack_max != 0)
7221 {
7223 {
7225 }
7226
7228 {
7230
7231 if (new_item)
7232 {
7233 new_item.SetResultOfSplit(true);
7234 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7237 new_item.PlaceOnSurface();
7238 }
7239 }
7240 }
7241 }
7242 }
7243
7245 {
7247 {
7248 if (ScriptInputUserData.CanStoreInputUserData())
7249 {
7250 ScriptInputUserData ctx = new ScriptInputUserData;
7255 dst.WriteToContext(ctx);
7257 }
7258 }
7259 else if (!
g_Game.IsMultiplayer())
7260 {
7262 }
7263 }
7264
7266 {
7268 {
7269 if (ScriptInputUserData.CanStoreInputUserData())
7270 {
7271 ScriptInputUserData ctx = new ScriptInputUserData;
7276 ctx.
Write(destination_entity);
7282 }
7283 }
7284 else if (!
g_Game.IsMultiplayer())
7285 {
7287 }
7288 }
7289
7291 {
7293 }
7294
7296 {
7298 float split_quantity_new;
7300 if (dst.IsValid())
7301 {
7302 int slot_id = dst.GetSlot();
7304
7305 if (quantity > stack_max)
7306 split_quantity_new = stack_max;
7307 else
7308 split_quantity_new = quantity;
7309
7311 {
7313
7314 if (new_item)
7315 {
7316 new_item.SetResultOfSplit(true);
7317 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7319 new_item.
SetQuantity(split_quantity_new,
false,
true);
7320 }
7321
7322 return new_item;
7323 }
7324 }
7325
7326 return null;
7327 }
7328
7330 {
7332 float split_quantity_new;
7334 if (destination_entity)
7335 {
7337 if (quantity > stackable)
7338 split_quantity_new = stackable;
7339 else
7340 split_quantity_new = quantity;
7341
7343 {
7344 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7345 if (new_item)
7346 {
7347 new_item.SetResultOfSplit(true);
7348 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7350 new_item.
SetQuantity(split_quantity_new,
false,
true);
7351 }
7352 }
7353 }
7354 }
7355
7357 {
7359 {
7360 if (ScriptInputUserData.CanStoreInputUserData())
7361 {
7362 ScriptInputUserData ctx = new ScriptInputUserData;
7367 ItemBase destination_entity =
this;
7368 ctx.
Write(destination_entity);
7372 }
7373 }
7374 else if (!
g_Game.IsMultiplayer())
7375 {
7377 }
7378 }
7379
7381 {
7383 float split_quantity_new;
7385 if (player)
7386 {
7388 if (quantity > stackable)
7389 split_quantity_new = stackable;
7390 else
7391 split_quantity_new = quantity;
7392
7394 {
7395 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7396 new_item =
ItemBase.Cast(in_hands);
7397 if (new_item)
7398 {
7399 new_item.SetResultOfSplit(true);
7400 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7402 new_item.SetQuantity(split_quantity_new, false, true);
7403 }
7404 }
7405 }
7406 }
7407
7409 {
7411 float split_quantity_new = Math.Floor(quantity * 0.5);
7412
7414 return;
7415
7417
7418 if (new_item)
7419 {
7420 if (new_item.GetQuantityMax() < split_quantity_new)
7421 {
7422 split_quantity_new = new_item.GetQuantityMax();
7423 }
7424
7425 new_item.SetResultOfSplit(true);
7426 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7427
7429 {
7432 }
7433 else
7434 {
7436 new_item.
SetQuantity(split_quantity_new,
false,
true);
7437 }
7438 }
7439 }
7440
7442 {
7444 float split_quantity_new = Math.Floor(quantity / 2);
7445
7447 return;
7448
7449 InventoryLocation invloc = new InventoryLocation;
7451
7453 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7454
7455 if (new_item)
7456 {
7457 if (new_item.GetQuantityMax() < split_quantity_new)
7458 {
7459 split_quantity_new = new_item.GetQuantityMax();
7460 }
7462 {
7465 }
7466 else if (split_quantity_new > 1)
7467 {
7469 new_item.
SetQuantity(split_quantity_new,
false,
true);
7470 }
7471 }
7472 }
7473
7476 {
7477 SetWeightDirty();
7479
7480 if (parent)
7481 parent.OnAttachmentQuantityChangedEx(this, delta);
7482
7484 {
7486 {
7488 }
7490 {
7491 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7493 }
7494 }
7495 }
7496
7499 {
7500
7501 }
7502
7505 {
7507 }
7508
7510 {
7511 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7512
7514 {
7515 if (newLevel == GameConstants.STATE_RUINED)
7516 {
7518 EntityAI parent = GetHierarchyParent();
7519 if (parent && parent.IsFireplace())
7520 {
7521 CargoBase cargo = GetInventory().GetCargo();
7522 if (cargo)
7523 {
7525 {
7527 }
7528 }
7529 }
7530 }
7531
7533 {
7534
7536 return;
7537 }
7538
7539 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7540 {
7542 }
7543 }
7544 }
7545
7546
7548 {
7549 super.OnRightClick();
7550
7552 {
7554 {
7555 if (ScriptInputUserData.CanStoreInputUserData())
7556 {
7557 EntityAI root = GetHierarchyRoot();
7558 Man playerOwner = GetHierarchyRootPlayer();
7559 InventoryLocation dst = new InventoryLocation;
7560
7561
7562 if (!playerOwner && root && root == this)
7563 {
7565 }
7566 else
7567 {
7568
7569 GetInventory().GetCurrentInventoryLocation(dst);
7571 {
7572 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7574 {
7576 }
7577 else
7578 {
7580
7581
7582 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7583 {
7585 }
7586 else
7587 {
7588 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7589 }
7590 }
7591 }
7592 }
7593
7594 ScriptInputUserData ctx = new ScriptInputUserData;
7602 }
7603 }
7604 else if (!
g_Game.IsMultiplayer())
7605 {
7607 }
7608 }
7609 }
7610
7612 {
7613 if (root)
7614 {
7615 vector m4[4];
7616 root.GetTransform(m4);
7617 dst.SetGround(this, m4);
7618 }
7619 else
7620 {
7621 GetInventory().GetCurrentInventoryLocation(dst);
7622 }
7623 }
7624
7625 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7626 {
7627
7628 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7629 return false;
7630
7631 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7632 return false;
7633
7634
7636 return false;
7637
7638
7639 Magazine mag = Magazine.Cast(this);
7640 if (mag)
7641 {
7642 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
7643 return false;
7644
7645 if (stack_max_limit)
7646 {
7647 Magazine other_mag = Magazine.Cast(other_item);
7648 if (other_item)
7649 {
7650 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
7651 return false;
7652 }
7653
7654 }
7655 }
7656 else
7657 {
7658
7660 return false;
7661
7663 return false;
7664 }
7665
7666 PlayerBase player = null;
7667 if (CastTo(player, GetHierarchyRootPlayer()))
7668 {
7669 if (player.GetInventory().HasAttachment(this))
7670 return false;
7671
7672 if (player.IsItemsToDelete())
7673 return false;
7674 }
7675
7676 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
7677 return false;
7678
7679 int slotID;
7681 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
7682 return false;
7683
7684 return true;
7685 }
7686
7688 {
7690 }
7691
7693 {
7694 return m_IsResultOfSplit;
7695 }
7696
7698 {
7699 m_IsResultOfSplit = value;
7700 }
7701
7703 {
7705 }
7706
7708 {
7709 float other_item_quantity = other_item.GetQuantity();
7710 float this_free_space;
7711
7713
7715
7716 if (other_item_quantity > this_free_space)
7717 {
7718 return this_free_space;
7719 }
7720 else
7721 {
7722 return other_item_quantity;
7723 }
7724 }
7725
7727 {
7729 }
7730
7732 {
7734 return;
7735
7736 if (!IsMagazine() && other_item)
7737 {
7739 if (quantity_used != 0)
7740 {
7741 float hp1 = GetHealth01("","");
7742 float hp2 = other_item.GetHealth01("","");
7743 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
7744 hpResult = hpResult / (
GetQuantity() + quantity_used);
7745
7746 hpResult *= GetMaxHealth();
7747 Math.Round(hpResult);
7748 SetHealth("", "Health", hpResult);
7749
7751 other_item.AddQuantity(-quantity_used);
7752 }
7753 }
7755 }
7756
7758 {
7759 #ifdef SERVER
7760 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
7761 GetHierarchyParent().IncreaseLifetimeUp();
7762 #endif
7763 };
7764
7766 {
7767 PlayerBase p = PlayerBase.Cast(player);
7768
7769 array<int> recipesIds = p.m_Recipes;
7770 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7771 if (moduleRecipesManager)
7772 {
7773 EntityAI itemInHands = player.GetEntityInHands();
7774 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
7775 }
7776
7777 for (int i = 0;i < recipesIds.Count(); i++)
7778 {
7779 int key = recipesIds.Get(i);
7780 string recipeName = moduleRecipesManager.GetRecipeName(key);
7782 }
7783 }
7784
7785
7786 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
7787 {
7788 super.GetDebugActions(outputList);
7789
7790
7796
7797
7802
7807
7808
7812
7813
7815 {
7819 }
7820
7823
7824
7828
7830
7831 InventoryLocation loc = new InventoryLocation();
7832 GetInventory().GetCurrentInventoryLocation(loc);
7834 {
7835 if (Gizmo_IsSupported())
7838 }
7839
7841 }
7842
7843
7844
7845
7847 {
7848 super.OnAction(action_id, player, ctx);
7849
7851 {
7852 switch (action_id)
7853 {
7857 return true;
7861 return true;
7862 }
7863 }
7864
7866 {
7867 switch (action_id)
7868 {
7870 Delete();
7871 return true;
7872 }
7873 }
7874
7875 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
7876 {
7877 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
7878 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
7879 PlayerBase p = PlayerBase.Cast(player);
7880 if (
EActions.RECIPES_RANGE_START < 1000)
7881 {
7882 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
7883 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
7884 }
7885 }
7886 #ifndef SERVER
7887 else if (action_id ==
EActions.WATCH_PLAYER)
7888 {
7889 PluginDeveloper.SetDeveloperItemClientEx(player);
7890 }
7891 #endif
7893 {
7894 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
7895 {
7896 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
7897 OnDebugButtonPressServer(id + 1);
7898 }
7899
7900 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
7901 {
7902 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
7904 }
7905
7906 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
7907 {
7908 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
7910 }
7911
7912 else if (action_id ==
EActions.ADD_QUANTITY)
7913 {
7914 if (IsMagazine())
7915 {
7916 Magazine mag = Magazine.Cast(this);
7917 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
7918 }
7919 else
7920 {
7922 }
7923
7924 if (m_EM)
7925 {
7926 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
7927 }
7928
7929 }
7930
7931 else if (action_id ==
EActions.REMOVE_QUANTITY)
7932 {
7933 if (IsMagazine())
7934 {
7935 Magazine mag2 = Magazine.Cast(this);
7936 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
7937 }
7938 else
7939 {
7941 }
7942 if (m_EM)
7943 {
7944 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
7945 }
7946
7947 }
7948
7949 else if (action_id ==
EActions.SET_QUANTITY_0)
7950 {
7952
7953 if (m_EM)
7954 {
7955 m_EM.SetEnergy(0);
7956 }
7957 }
7958
7959 else if (action_id ==
EActions.SET_MAX_QUANTITY)
7960 {
7962
7963 if (m_EM)
7964 {
7965 m_EM.SetEnergy(m_EM.GetEnergyMax());
7966 }
7967 }
7968
7969 else if (action_id ==
EActions.ADD_HEALTH)
7970 {
7971 AddHealth("","",GetMaxHealth("","Health")/5);
7972 }
7973 else if (action_id ==
EActions.REMOVE_HEALTH)
7974 {
7975 AddHealth("","",-GetMaxHealth("","Health")/5);
7976 }
7977 else if (action_id ==
EActions.DESTROY_HEALTH)
7978 {
7979 SetHealth01("","",0);
7980 }
7981 else if (action_id ==
EActions.WATCH_ITEM)
7982 {
7984 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
7985 #ifdef DEVELOPER
7986 SetDebugDeveloper_item(this);
7987 #endif
7988 }
7989
7990 else if (action_id ==
EActions.ADD_TEMPERATURE)
7991 {
7992 AddTemperature(20);
7993
7994 }
7995
7996 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
7997 {
7998 AddTemperature(-20);
7999
8000 }
8001
8002 else if (action_id ==
EActions.FLIP_FROZEN)
8003 {
8004 SetFrozen(!GetIsFrozen());
8005
8006 }
8007
8008 else if (action_id ==
EActions.ADD_WETNESS)
8009 {
8011
8012 }
8013
8014 else if (action_id ==
EActions.REMOVE_WETNESS)
8015 {
8017
8018 }
8019
8020 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8021 {
8024
8025
8026 }
8027
8028 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8029 {
8032 }
8033
8034 else if (action_id ==
EActions.MAKE_SPECIAL)
8035 {
8036 auto debugParams = DebugSpawnParams.WithPlayer(player);
8037 OnDebugSpawnEx(debugParams);
8038 }
8039
8040 }
8041
8042
8043 return false;
8044 }
8045
8046
8047
8048
8052
8055
8056
8057
8059 {
8060 return false;
8061 }
8062
8063
8065 {
8066 return true;
8067 }
8068
8069
8071 {
8072 return true;
8073 }
8074
8075
8076
8078 {
8079 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8080 return g_Game.ConfigIsExisting(config_path);
8081 }
8082
8085 {
8086 return null;
8087 }
8088
8090 {
8091 return false;
8092 }
8093
8095 {
8096 return false;
8097 }
8098
8102
8103
8105 {
8106 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8107 return module_repairing.CanRepair(this, item_repair_kit);
8108 }
8109
8110
8111 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8112 {
8113 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8114 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8115 }
8116
8117
8119 {
8120
8121
8122
8123
8124
8125
8126
8127
8128 return 1;
8129 }
8130
8131
8132
8134 {
8136 }
8137
8138
8139
8141 {
8143 }
8144
8145
8154 {
8155 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8156
8157 if (player)
8158 {
8159 player.MessageStatus(text);
8160 }
8161 }
8162
8163
8172 {
8173 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8174
8175 if (player)
8176 {
8177 player.MessageAction(text);
8178 }
8179 }
8180
8181
8190 {
8191 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8192
8193 if (player)
8194 {
8195 player.MessageFriendly(text);
8196 }
8197 }
8198
8199
8208 {
8209 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8210
8211 if (player)
8212 {
8213 player.MessageImportant(text);
8214 }
8215 }
8216
8218 {
8219 return true;
8220 }
8221
8222
8223 override bool KindOf(
string tag)
8224 {
8225 bool found = false;
8226 string item_name = this.
GetType();
8228 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8229
8230 int array_size = item_tag_array.Count();
8231 for (int i = 0; i < array_size; i++)
8232 {
8233 if (item_tag_array.Get(i) == tag)
8234 {
8235 found = true;
8236 break;
8237 }
8238 }
8239 return found;
8240 }
8241
8242
8244 {
8245
8246 super.OnRPC(sender, rpc_type,ctx);
8247
8248
8249 switch (rpc_type)
8250 {
8251 #ifndef SERVER
8252 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8253 Param2<bool, string> p = new Param2<bool, string>(false, "");
8254
8256 return;
8257
8258 bool play = p.param1;
8259 string soundSet = p.param2;
8260
8261 if (play)
8262 {
8264 {
8266 {
8268 }
8269 }
8270 else
8271 {
8273 }
8274 }
8275 else
8276 {
8278 }
8279
8280 break;
8281 #endif
8282
8283 }
8284
8286 {
8288 }
8289 }
8290
8291
8292
8293
8295 {
8296 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8297 return plugin.GetID(
name);
8298 }
8299
8301 {
8302 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8303 return plugin.GetName(id);
8304 }
8305
8308 {
8309
8310
8311 int varFlags;
8312 if (!ctx.
Read(varFlags))
8313 return;
8314
8315 if (varFlags & ItemVariableFlags.FLOAT)
8316 {
8318 }
8319 }
8320
8322 {
8323
8324 super.SerializeNumericalVars(floats_out);
8325
8326
8327
8329 {
8331 }
8332
8334 {
8336 }
8337
8339 {
8341 }
8342
8344 {
8349 }
8350
8352 {
8354 }
8355 }
8356
8358 {
8359
8360 super.DeSerializeNumericalVars(floats);
8361
8362
8363 int index = 0;
8364 int mask = Math.Round(floats.Get(index));
8365
8366 index++;
8367
8369 {
8371 {
8373 }
8374 else
8375 {
8376 float quantity = floats.Get(index);
8378 }
8379 index++;
8380 }
8381
8383 {
8384 float wet = floats.Get(index);
8386 index++;
8387 }
8388
8390 {
8391 int liquidtype = Math.Round(floats.Get(index));
8393 index++;
8394 }
8395
8397 {
8399 index++;
8401 index++;
8403 index++;
8405 index++;
8406 }
8407
8409 {
8410 int cleanness = Math.Round(floats.Get(index));
8412 index++;
8413 }
8414 }
8415
8417 {
8418 super.WriteVarsToCTX(ctx);
8419
8420
8422 {
8424 }
8425
8427 {
8429 }
8430
8432 {
8434 }
8435
8437 {
8438 int r,g,b,a;
8444 }
8445
8447 {
8449 }
8450 }
8451
8453 {
8454 if (!super.ReadVarsFromCTX(ctx,version))
8455 return false;
8456
8457 int intValue;
8458 float value;
8459
8460 if (version < 140)
8461 {
8462 if (!ctx.
Read(intValue))
8463 return false;
8464
8465 m_VariablesMask = intValue;
8466 }
8467
8469 {
8470 if (!ctx.
Read(value))
8471 return false;
8472
8474 {
8476 }
8477 else
8478 {
8480 }
8481 }
8482
8483 if (version < 140)
8484 {
8486 {
8487 if (!ctx.
Read(value))
8488 return false;
8489 SetTemperatureDirect(value);
8490 }
8491 }
8492
8494 {
8495 if (!ctx.
Read(value))
8496 return false;
8498 }
8499
8501 {
8502 if (!ctx.
Read(intValue))
8503 return false;
8505 }
8506
8508 {
8509 int r,g,b,a;
8511 return false;
8513 return false;
8515 return false;
8517 return false;
8518
8520 }
8521
8523 {
8524 if (!ctx.
Read(intValue))
8525 return false;
8527 }
8528
8529 if (version >= 138 && version < 140)
8530 {
8532 {
8533 if (!ctx.
Read(intValue))
8534 return false;
8535 SetFrozen(intValue);
8536 }
8537 }
8538
8539 return true;
8540 }
8541
8542
8544 {
8547 {
8549 }
8550
8551 if (!super.OnStoreLoad(ctx, version))
8552 {
8554 return false;
8555 }
8556
8557 if (version >= 114)
8558 {
8559 bool hasQuickBarIndexSaved;
8560
8561 if (!ctx.
Read(hasQuickBarIndexSaved))
8562 {
8564 return false;
8565 }
8566
8567 if (hasQuickBarIndexSaved)
8568 {
8569 int itmQBIndex;
8570
8571
8572 if (!ctx.
Read(itmQBIndex))
8573 {
8575 return false;
8576 }
8577
8578 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8579 if (itmQBIndex != -1 && parentPlayer)
8580 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8581 }
8582 }
8583 else
8584 {
8585
8586 PlayerBase player;
8587 int itemQBIndex;
8588 if (version ==
int.
MAX)
8589 {
8590 if (!ctx.
Read(itemQBIndex))
8591 {
8593 return false;
8594 }
8595 }
8596 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8597 {
8598
8599 if (!ctx.
Read(itemQBIndex))
8600 {
8602 return false;
8603 }
8604 if (itemQBIndex != -1 && player)
8605 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8606 }
8607 }
8608
8609 if (version < 140)
8610 {
8611
8612 if (!LoadVariables(ctx, version))
8613 {
8615 return false;
8616 }
8617 }
8618
8619
8621 {
8623 return false;
8624 }
8625 if (version >= 132)
8626 {
8628 if (raib)
8629 {
8631 {
8633 return false;
8634 }
8635 }
8636 }
8637
8639 return true;
8640 }
8641
8642
8643
8645 {
8646 super.OnStoreSave(ctx);
8647
8648 PlayerBase player;
8649 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
8650 {
8652
8653 int itemQBIndex = -1;
8654 itemQBIndex = player.FindQuickBarEntityIndex(this);
8655 ctx.
Write(itemQBIndex);
8656 }
8657 else
8658 {
8660 }
8661
8663
8665 if (raib)
8666 {
8668 }
8669 }
8670
8671
8673 {
8674 super.AfterStoreLoad();
8675
8677 {
8679 }
8680
8682 {
8685 }
8686 }
8687
8689 {
8690 super.EEOnAfterLoad();
8691
8693 {
8695 }
8696
8699 }
8700
8702 {
8703 return false;
8704 }
8705
8706
8707
8709 {
8711 {
8712 #ifdef PLATFORM_CONSOLE
8713
8715 {
8717 if (menu)
8718 {
8720 }
8721 }
8722 #endif
8723 }
8724
8726 {
8729 }
8730
8732 {
8733 SetWeightDirty();
8735 }
8737 {
8740 }
8741
8743 {
8746
8749 }
8751 {
8755 }
8756
8757 super.OnVariablesSynchronized();
8758 }
8759
8760
8761
8763 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
8764 {
8765 if (!IsServerCheck(allow_client))
8766 return false;
8767
8769 return false;
8770
8773
8774 if (value <= (min + 0.001))
8775 value = min;
8776
8777 if (value == min)
8778 {
8779 if (destroy_config)
8780 {
8781 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
8782 if (dstr)
8783 {
8785 this.Delete();
8786 return true;
8787 }
8788 }
8789 else if (destroy_forced)
8790 {
8792 this.Delete();
8793 return true;
8794 }
8795
8797 }
8798
8801
8803 {
8804 EntityAI parent = GetHierarchyRoot();
8805 InventoryLocation iLoc = new InventoryLocation();
8806 GetInventory().GetCurrentInventoryLocation(iLoc);
8808 {
8809 int iLocSlot = iLoc.
GetSlot();
8811 {
8813 }
8815 {
8817 }
8818 }
8819 }
8820
8822 {
8824
8825 if (delta)
8827 }
8828
8830
8831 return false;
8832 }
8833
8834
8836 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8837 {
8839 }
8840
8842 {
8845 }
8846
8848 {
8851 }
8852
8854 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
8855 {
8856 float value_clamped = Math.Clamp(value, 0, 1);
8858 SetQuantity(result, destroy_config, destroy_forced);
8859 }
8860
8861
8864 {
8866 }
8867
8869 {
8871 }
8872
8873
8874
8875
8876
8877
8878
8879
8880
8881
8883 {
8884 int slot = -1;
8885 GameInventory inventory = GetInventory();
8886 if (inventory)
8887 {
8888 InventoryLocation il = new InventoryLocation;
8891 }
8892
8894 }
8895
8897 {
8898 float quantity_max = 0;
8899
8901 {
8902 if (attSlotID != -1)
8903 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
8904
8905 if (quantity_max <= 0)
8907 }
8908
8909 if (quantity_max <= 0)
8911
8912 return quantity_max;
8913 }
8914
8916 {
8918 }
8919
8921 {
8923 }
8924
8925
8927 {
8929 }
8930
8932 {
8934 }
8935
8937 {
8939 }
8940
8941
8943 {
8944
8945 float weightEx = GetWeightEx();
8946 float special = GetInventoryAndCargoWeight();
8947 return weightEx - special;
8948 }
8949
8950
8952 {
8954 }
8955
8957 {
8959 {
8960 #ifdef DEVELOPER
8961 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8962 {
8963 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
8965 }
8966 #endif
8967
8969 }
8970 else if (HasEnergyManager())
8971 {
8972 #ifdef DEVELOPER
8973 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8974 {
8975 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
8976 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
8977 }
8978 #endif
8979 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
8980 }
8981 else
8982 {
8983 #ifdef DEVELOPER
8984 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
8985 {
8986 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
8987 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
8988 }
8989 #endif
8990 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
8991 }
8992 }
8993
8996 {
8997 int item_count = 0;
8999
9000 GameInventory inventory = GetInventory();
9001 CargoBase cargo = inventory.
GetCargo();
9002 if (cargo != NULL)
9003 {
9005 }
9006
9008 for (int i = 0; i < nAttachments; ++i)
9009 {
9011 if (item)
9012 item_count += item.GetNumberOfItems();
9013 }
9014 return item_count;
9015 }
9016
9019 {
9020 float weight = 0;
9021 float wetness = 1;
9022 if (include_wetness)
9025 {
9026 weight = wetness * m_ConfigWeight;
9027 }
9029 {
9030 weight = 1;
9031 }
9032 return weight;
9033 }
9034
9035
9036
9038 {
9039 GameInventory inventory = GetInventory();
9040 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9041 {
9042 array<EntityAI> items = new array<EntityAI>;
9044 for (int i = 0; i < items.Count(); ++i)
9045 {
9047 if (item)
9048 {
9049 g_Game.ObjectDelete(item);
9050 }
9051 }
9052 }
9053 }
9054
9055
9056
9057
9059 {
9060 float energy = 0;
9061 if (HasEnergyManager())
9062 {
9063 energy = GetCompEM().GetEnergy();
9064 }
9065 return energy;
9066 }
9067
9068
9070 {
9071 super.OnEnergyConsumed();
9072
9074 }
9075
9077 {
9078 super.OnEnergyAdded();
9079
9081 }
9082
9083
9085 {
9086 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9087 {
9089 {
9090 float energy_0to1 = GetCompEM().GetEnergy0To1();
9092 }
9093 }
9094 }
9095
9096
9098 {
9099 return ConfigGetFloat("heatIsolation");
9100 }
9101
9103 {
9105 }
9106
9108 {
9109 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9110 if (
g_Game.ConfigIsExisting(paramPath))
9111 return g_Game.ConfigGetFloat(paramPath);
9112
9113 return 0.0;
9114 }
9115
9117 {
9118 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9119 if (
g_Game.ConfigIsExisting(paramPath))
9120 return g_Game.ConfigGetFloat(paramPath);
9121
9122 return 0.0;
9123 }
9124
9125 override void SetWet(
float value,
bool allow_client =
false)
9126 {
9127 if (!IsServerCheck(allow_client))
9128 return;
9129
9132
9134
9135 m_VarWet = Math.Clamp(value, min, max);
9136
9138 {
9141 }
9142 }
9143
9144 override void AddWet(
float value)
9145 {
9147 }
9148
9150 {
9152 }
9153
9155 {
9157 }
9158
9160 {
9162 }
9163
9165 {
9167 }
9168
9170 {
9172 }
9173
9175 {
9178 if (newLevel != oldLevel)
9179 {
9181 }
9182 }
9183
9185 {
9186 SetWeightDirty();
9187 }
9188
9190 {
9191 return GetWetLevelInternal(
m_VarWet);
9192 }
9193
9194
9195
9197 {
9199 }
9200
9202 {
9204 }
9205
9207 {
9209 }
9210
9212 {
9214 }
9215
9216
9217
9219 {
9220 if (ConfigIsExisting("itemModelLength"))
9221 {
9222 return ConfigGetFloat("itemModelLength");
9223 }
9224 return 0;
9225 }
9226
9228 {
9229 if (ConfigIsExisting("itemAttachOffset"))
9230 {
9231 return ConfigGetFloat("itemAttachOffset");
9232 }
9233 return 0;
9234 }
9235
9236 override void SetCleanness(
int value,
bool allow_client =
false)
9237 {
9238 if (!IsServerCheck(allow_client))
9239 return;
9240
9242
9244
9247 }
9248
9250 {
9252 }
9253
9255 {
9256 return true;
9257 }
9258
9259
9260
9261
9263 {
9265 }
9266
9268 {
9270 }
9271
9272
9273
9274
9275 override void SetColor(
int r,
int g,
int b,
int a)
9276 {
9282 }
9284 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9285 {
9290 }
9291
9293 {
9295 }
9296
9299 {
9300 int r,g,b,a;
9302 r = r/255;
9303 g = g/255;
9304 b = b/255;
9305 a = a/255;
9306 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9307 }
9308
9309
9310
9311 override void SetLiquidType(
int value,
bool allow_client =
false)
9312 {
9313 if (!IsServerCheck(allow_client))
9314 return;
9315
9320 }
9321
9323 {
9324 return ConfigGetInt("varLiquidTypeInit");
9325 }
9326
9328 {
9330 }
9331
9333 {
9335 SetFrozen(false);
9336 }
9337
9340 {
9341 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9342 }
9343
9344
9347 {
9348 PlayerBase nplayer;
9349 if (PlayerBase.CastTo(nplayer, player))
9350 {
9352 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9353 }
9354 }
9355
9356
9359 {
9360 PlayerBase nplayer;
9361 if (PlayerBase.CastTo(nplayer,player))
9362 {
9363 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9364 }
9365
9366 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9367
9368 if (HasEnergyManager())
9369 {
9370 GetCompEM().UpdatePlugState();
9371 }
9372 }
9373
9374
9376 {
9377 super.OnPlacementStarted(player);
9378
9380 }
9381
9382 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9383 {
9385 {
9386 m_AdminLog.OnPlacementComplete(player,
this);
9387 }
9388
9389 super.OnPlacementComplete(player, position, orientation);
9390 }
9391
9392
9393
9394
9395
9397 {
9399 {
9400 return true;
9401 }
9402 else
9403 {
9404 return false;
9405 }
9406 }
9407
9408
9410 {
9412 {
9414 }
9415 }
9416
9417
9419 {
9421 }
9422
9424 {
9426 }
9427
9428 override void InsertAgent(
int agent,
float count = 1)
9429 {
9430 if (count < 1)
9431 return;
9432
9434 }
9435
9438 {
9440 }
9441
9442
9444 {
9446 }
9447
9448
9449
9450
9451
9452
9453
9454
9455
9456
9457
9458
9459
9460
9461
9462
9463
9464
9465
9466
9467
9468
9469
9470
9471
9472
9473
9474
9475
9476
9477
9478
9479
9480
9481
9482
9483
9484
9485
9486
9487
9488
9490 {
9492 return false;
9493 return true;
9494 }
9495
9497 {
9498
9500 }
9501
9502
9505 {
9506 super.CheckForRoofLimited(timeTresholdMS);
9507
9508 float time =
g_Game.GetTime();
9509 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9510 {
9511 m_PreviousRoofTestTime = time;
9512 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9513 }
9514 }
9515
9516
9518 {
9520 {
9521 return 0;
9522 }
9523
9524 if (GetInventory().GetAttachmentSlotsCount() != 0)
9525 {
9526 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9527 if (filter)
9528 return filter.GetProtectionLevel(type, false, system);
9529 else
9530 return 0;
9531 }
9532
9533 string subclassPath, entryName;
9534
9535 switch (type)
9536 {
9538 entryName = "biological";
9539 break;
9541 entryName = "chemical";
9542 break;
9543 default:
9544 entryName = "biological";
9545 break;
9546 }
9547
9548 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9549
9550 return g_Game.ConfigGetFloat(subclassPath + entryName);
9551 }
9552
9553
9554
9557 {
9558 if (!IsMagazine())
9560
9562 }
9563
9564
9565
9566
9567
9572 {
9573 return true;
9574 }
9575
9577 {
9579 }
9580
9581
9582
9583
9584
9586 {
9587 if (parent)
9588 {
9589 if (parent.IsInherited(DayZInfected))
9590 return true;
9591
9592 if (!parent.IsRuined())
9593 return true;
9594 }
9595
9596 return true;
9597 }
9598
9600 {
9601 if (!super.CanPutAsAttachment(parent))
9602 {
9603 return false;
9604 }
9605
9606 if (!IsRuined() && !parent.IsRuined())
9607 {
9608 return true;
9609 }
9610
9611 return false;
9612 }
9613
9615 {
9616
9617
9618
9619
9620 return super.CanReceiveItemIntoCargo(item);
9621 }
9622
9624 {
9625
9626
9627
9628
9629 GameInventory attachmentInv = attachment.GetInventory();
9631 {
9632 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9633 return false;
9634 }
9635
9636 InventoryLocation loc = new InventoryLocation();
9637 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9638 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9639 return false;
9640
9641 return super.CanReceiveAttachment(attachment, slotId);
9642 }
9643
9645 {
9646 if (!super.CanReleaseAttachment(attachment))
9647 return false;
9648
9649 return GetInventory().AreChildrenAccessible();
9650 }
9651
9652
9653
9654
9655
9656
9657
9658
9659
9660
9661
9662
9663
9664
9665
9666
9667
9668
9669
9670
9671
9673 {
9674 int id = muzzle_owner.GetMuzzleID();
9675 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
9676
9677 if (WPOF_array)
9678 {
9679 for (int i = 0; i < WPOF_array.Count(); i++)
9680 {
9681 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
9682
9683 if (WPOF)
9684 {
9685 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
9686 }
9687 }
9688 }
9689 }
9690
9691
9693 {
9694 int id = muzzle_owner.GetMuzzleID();
9696
9697 if (WPOBE_array)
9698 {
9699 for (int i = 0; i < WPOBE_array.Count(); i++)
9700 {
9701 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
9702
9703 if (WPOBE)
9704 {
9705 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9706 }
9707 }
9708 }
9709 }
9710
9711
9713 {
9714 int id = muzzle_owner.GetMuzzleID();
9715 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9716
9717 if (WPOOH_array)
9718 {
9719 for (int i = 0; i < WPOOH_array.Count(); i++)
9720 {
9721 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9722
9723 if (WPOOH)
9724 {
9725 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
9726 }
9727 }
9728 }
9729 }
9730
9731
9733 {
9734 int id = muzzle_owner.GetMuzzleID();
9735 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9736
9737 if (WPOOH_array)
9738 {
9739 for (int i = 0; i < WPOOH_array.Count(); i++)
9740 {
9741 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9742
9743 if (WPOOH)
9744 {
9745 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9746 }
9747 }
9748 }
9749 }
9750
9751
9753 {
9754 int id = muzzle_owner.GetMuzzleID();
9755 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
9756
9757 if (WPOOH_array)
9758 {
9759 for (int i = 0; i < WPOOH_array.Count(); i++)
9760 {
9761 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
9762
9763 if (WPOOH)
9764 {
9765 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
9766 }
9767 }
9768 }
9769 }
9770
9771
9772
9774 {
9776 {
9777 return true;
9778 }
9779
9780 return false;
9781 }
9782
9784 {
9786 {
9787 return true;
9788 }
9789
9790 return false;
9791 }
9792
9794 {
9796 {
9797 return true;
9798 }
9799
9800 return false;
9801 }
9802
9804 {
9805 return false;
9806 }
9807
9810 {
9811 return UATimeSpent.DEFAULT_DEPLOY;
9812 }
9813
9814
9815
9816
9818 {
9820 SetSynchDirty();
9821 }
9822
9824 {
9826 }
9827
9828
9830 {
9831 return false;
9832 }
9833
9836 {
9837 string att_type = "None";
9838
9839 if (ConfigIsExisting("soundAttType"))
9840 {
9841 att_type = ConfigGetString("soundAttType");
9842 }
9843
9845 }
9846
9848 {
9850 }
9851
9852
9853
9854
9855
9861
9863 {
9866
9868 }
9869
9870
9872 {
9874 return;
9875
9877
9880
9883
9884 SoundParameters params = new SoundParameters();
9888 }
9889
9890
9892 {
9894 {
9897
9898 SetSynchDirty();
9899
9902 }
9903 }
9904
9906 {
9908 }
9909
9910
9912 {
9914 return;
9915
9917 SetSynchDirty();
9918
9921 }
9922
9924 {
9927 }
9928
9930 {
9932 }
9933
9934 void OnApply(PlayerBase player);
9935
9937 {
9938 return 1.0;
9939 };
9940
9942 {
9944 }
9945
9947 {
9949 }
9950
9952
9954 {
9955 SetDynamicPhysicsLifeTime(0.01);
9957 }
9958
9960 {
9961 array<string> zone_names = new array<string>;
9962 GetDamageZones(zone_names);
9963 for (int i = 0; i < zone_names.Count(); i++)
9964 {
9965 SetHealthMax(zone_names.Get(i),"Health");
9966 }
9967 SetHealthMax("","Health");
9968 }
9969
9972 {
9973 float global_health = GetHealth01("","Health");
9974 array<string> zones = new array<string>;
9975 GetDamageZones(zones);
9976
9977 for (int i = 0; i < zones.Count(); i++)
9978 {
9979 SetHealth01(zones.Get(i),"Health",global_health);
9980 }
9981 }
9982
9985 {
9986 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
9987 }
9988
9990 {
9991 if (!hasRootAsPlayer)
9992 {
9993 if (refParentIB)
9994 {
9995
9996 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
9997 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
9998
9999 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10000 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10001
10004 }
10005 else
10006 {
10007
10010 }
10011 }
10012 }
10013
10015 {
10017 {
10018 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10019 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10020 {
10021 float heatPermCoef = 1.0;
10023 while (ent)
10024 {
10025 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10026 ent = ent.GetHierarchyParent();
10027 }
10028
10029 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10030 }
10031 }
10032 }
10033
10035 {
10036
10037 EntityAI parent = GetHierarchyParent();
10038 if (!parent)
10039 {
10040 hasParent = false;
10041 hasRootAsPlayer = false;
10042 }
10043 else
10044 {
10045 hasParent = true;
10046 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10047 refParentIB =
ItemBase.Cast(parent);
10048 }
10049 }
10050
10051 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10052 {
10053
10054 }
10055
10057 {
10058
10059 return false;
10060 }
10061
10063 {
10064
10065
10066 return false;
10067 }
10068
10070 {
10071
10072 return false;
10073 }
10074
10077 {
10078 return !GetIsFrozen() &&
IsOpen();
10079 }
10080
10082 {
10083 bool hasParent = false, hasRootAsPlayer = false;
10085
10086 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10087 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10088
10089 if (wwtu || foodDecay)
10090 {
10094
10095 if (processWetness || processTemperature || processDecay)
10096 {
10098
10099 if (processWetness)
10100 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10101
10102 if (processTemperature)
10104
10105 if (processDecay)
10106 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10107 }
10108 }
10109 }
10110
10113 {
10115 }
10116
10118 {
10121
10122 return super.GetTemperatureFreezeThreshold();
10123 }
10124
10126 {
10129
10130 return super.GetTemperatureThawThreshold();
10131 }
10132
10134 {
10137
10138 return super.GetItemOverheatThreshold();
10139 }
10140
10142 {
10144 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10145
10146 return super.GetTemperatureFreezeTime();
10147 }
10148
10150 {
10152 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10153
10154 return super.GetTemperatureThawTime();
10155 }
10156
10161
10163 {
10164 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10165 }
10166
10168 {
10169 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10170 }
10171
10174 {
10176 }
10177
10179 {
10181 }
10182
10184 {
10186 }
10187
10190 {
10191 return null;
10192 }
10193
10196 {
10197 return false;
10198 }
10199
10201 {
10203 {
10206 if (!trg)
10207 {
10209 explosive = this;
10210 }
10211
10212 explosive.PairRemote(trg);
10214
10215 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10216 trg.SetPersistentPairID(persistentID);
10217 explosive.SetPersistentPairID(persistentID);
10218
10219 return true;
10220 }
10221 return false;
10222 }
10223
10226 {
10227 float ret = 1.0;
10230 ret *= GetHealth01();
10231
10232 return ret;
10233 }
10234
10235 #ifdef DEVELOPER
10236 override void SetDebugItem()
10237 {
10238 super.SetDebugItem();
10239 _itemBase = this;
10240 }
10241
10243 {
10244 string text = super.GetDebugText();
10245
10247 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10248
10249 return text;
10250 }
10251 #endif
10252
10254 {
10255 return true;
10256 }
10257
10259
10261
10263 {
10266 }
10267
10268
10276
10292
10293 [
Obsolete(
"Use ItemSoundHandler instead")]
10296 {
10297 if (!
g_Game.IsDedicatedServer())
10298 {
10299 if (ConfigIsExisting("attachSoundSet"))
10300 {
10301 string cfg_path = "";
10302 string soundset = "";
10303 string type_name =
GetType();
10304
10307 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10308 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10309
10310 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10311 {
10312 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10313 {
10314 if (cfg_slot_array[i] == slot_type)
10315 {
10316 soundset = cfg_soundset_array[i];
10317 break;
10318 }
10319 }
10320 }
10321
10322 if (soundset != "")
10323 {
10324 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10326 }
10327 }
10328 }
10329 }
10330
10332}
10333
10335{
10337 if (entity)
10338 {
10339 bool is_item = entity.IsInherited(
ItemBase);
10340 if (is_item && full_quantity)
10341 {
10344 }
10345 }
10346 else
10347 {
10349 return NULL;
10350 }
10351 return entity;
10352}
10353
10355{
10356 if (item)
10357 {
10358 if (health > 0)
10359 item.SetHealth("", "", health);
10360
10361 if (item.CanHaveTemperature())
10362 {
10364 if (item.CanFreeze())
10365 item.SetFrozen(false);
10366 }
10367
10368 if (item.HasEnergyManager())
10369 {
10370 if (quantity >= 0)
10371 {
10372 item.GetCompEM().SetEnergy0To1(quantity);
10373 }
10374 else
10375 {
10377 }
10378 }
10379 else if (item.IsMagazine())
10380 {
10381 Magazine mag = Magazine.Cast(item);
10382 if (quantity >= 0)
10383 {
10384 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10385 }
10386 else
10387 {
10389 }
10390
10391 }
10392 else
10393 {
10394 if (quantity >= 0)
10395 {
10396 item.SetQuantityNormalized(quantity, false);
10397 }
10398 else
10399 {
10401 }
10402
10403 }
10404 }
10405}
10406
10407#ifdef DEVELOPER
10409#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.