5834{
5836 {
5837 return true;
5838 }
5839};
5840
5842{
5843
5844};
5845
5846
5847
5849{
5853
5855
5858
5859
5860
5861
5862
5871
5877
5882
5887
5908 protected bool m_IsResultOfSplit
5909
5911
5916
5917
5918
5920
5924
5925
5926
5928
5931
5932
5933
5939
5940
5948
5951
5952
5954
5955
5957
5958
5963
5964
5969
5971
5972
5974
5975
5977 {
5982
5983 if (!
g_Game.IsDedicatedServer())
5984 {
5986 {
5988
5990 {
5992 }
5993 }
5994
5997 }
5998
5999 m_OldLocation = null;
6000
6002 {
6004 }
6005
6006 if (ConfigIsExisting("headSelectionsToHide"))
6007 {
6010 }
6011
6013 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6014 {
6016 }
6017
6019
6020 m_IsResultOfSplit = false;
6021
6023 }
6024
6026 {
6027 super.InitItemVariables();
6028
6034 m_Count = ConfigGetInt(
"count");
6035
6038
6043
6046
6051
6063
6067
6068
6071 if (ConfigIsExisting("canBeSplit"))
6072 {
6075 }
6076
6078 if (ConfigIsExisting("itemBehaviour"))
6080
6081
6084 RegisterNetSyncVariableInt("m_VarLiquidType");
6085 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6086
6087 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6088 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6089 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6090
6091 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6092 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6093 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6094 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6095
6096 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6097 RegisterNetSyncVariableBool("m_IsTakeable");
6098 RegisterNetSyncVariableBool("m_IsHologram");
6099
6102 {
6105 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6106 }
6107
6109
6111 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6113
6115 }
6116
6118 {
6120 }
6121
6123 {
6126 {
6131 }
6132 }
6133
6134 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6135 {
6137 {
6140 }
6141
6143 }
6144
6146 {
6152 }
6153
6155
6157 {
6159
6160 if (!action)
6161 {
6162 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6163 return;
6164 }
6165
6167 if (!ai)
6168 {
6170 return;
6171 }
6172
6174 if (!action_array)
6175 {
6176 action_array = new array<ActionBase_Basic>;
6178 }
6179 if (LogManager.IsActionLogEnable())
6180 {
6181 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6182 }
6183
6184 if (action_array.Find(action) != -1)
6185 {
6186 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6187 }
6188 else
6189 {
6190 action_array.Insert(action);
6191 }
6192 }
6193
6195 {
6196 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6197 ActionBase action = player.GetActionManager().GetAction(actionName);
6200
6201 if (action_array)
6202 {
6203 action_array.RemoveItem(action);
6204 }
6205 }
6206
6207
6208
6210 {
6211 ActionOverrideData overrideData = new ActionOverrideData();
6215
6217 if (!actionMap)
6218 {
6221 }
6222
6223 actionMap.Insert(this.
Type(), overrideData);
6224
6225 }
6226
6228
6230
6231
6233 {
6236
6239
6240 string config_to_search = "CfgVehicles";
6241 string muzzle_owner_config;
6242
6244 {
6245 if (IsInherited(Weapon))
6246 config_to_search = "CfgWeapons";
6247
6248 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6249
6250 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6251
6252 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6253
6254 if (config_OnFire_subclass_count > 0)
6255 {
6256 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6257
6258 for (int i = 0; i < config_OnFire_subclass_count; i++)
6259 {
6260 string particle_class = "";
6261 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6262 string config_OnFire_entry = config_OnFire_class + particle_class;
6263 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6264 WPOF_array.Insert(WPOF);
6265 }
6266
6267
6269 }
6270 }
6271
6273 {
6274 config_to_search = "CfgWeapons";
6275 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6276
6277 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6278
6279 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6280
6281 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6282 {
6283 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6284
6285 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6286 {
6287 string particle_class2 = "";
6288 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6289 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6290 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6291 WPOBE_array.Insert(WPOBE);
6292 }
6293
6294
6296 }
6297 }
6298 }
6299
6300
6302 {
6305
6307 {
6308 string config_to_search = "CfgVehicles";
6309
6310 if (IsInherited(Weapon))
6311 config_to_search = "CfgWeapons";
6312
6313 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6314 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6315
6316 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6317 {
6318
6320
6322 {
6324 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6326 return;
6327 }
6328
6331
6332
6333
6334 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6335 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6336
6337 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6338 {
6339 string particle_class = "";
6340 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6341 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6342 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6343
6344 if (entry_type == CT_CLASS)
6345 {
6346 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6347 WPOOH_array.Insert(WPOF);
6348 }
6349 }
6350
6351
6353 }
6354 }
6355 }
6356
6358 {
6360 }
6361
6363 {
6365 {
6367
6370
6373
6374 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6375 }
6376 }
6377
6379 {
6381 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6382
6384 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6385
6387 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6388
6390 {
6392 }
6393 }
6394
6396 {
6398 }
6399
6401 {
6404 else
6406
6408 {
6411 }
6412 else
6413 {
6416
6419 }
6420
6422 }
6423
6425 {
6427 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6428 }
6429
6431 {
6433 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6435 }
6436
6438 {
6440 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6441 }
6442
6444 {
6447
6448 OverheatingParticle OP = new OverheatingParticle();
6453
6455 }
6456
6458 {
6461
6462 return -1;
6463 }
6464
6466 {
6468 {
6471
6472 for (int i = count; i > 0; --i)
6473 {
6474 int id = i - 1;
6477
6480
6481 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6482 {
6483 if (p)
6484 {
6487 }
6488 }
6489 }
6490 }
6491 }
6492
6494 {
6496 {
6498 {
6499 int id = i - 1;
6501
6502 if (OP)
6503 {
6505
6506 if (p)
6507 {
6509 }
6510
6511 delete OP;
6512 }
6513 }
6514
6517 }
6518 }
6519
6522 {
6523 return 0.0;
6524 }
6525
6526
6528 {
6529 return 250;
6530 }
6531
6533 {
6534 return 0;
6535 }
6536
6539 {
6541 return true;
6542
6543 return false;
6544 }
6545
6548 {
6551
6553 {
6555 }
6556 else
6557 {
6558
6560 }
6561
6563 }
6564
6571 {
6572 return -1;
6573 }
6574
6575
6576
6577
6579 {
6581 {
6582 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6583 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6584
6585 if (r_index >= 0)
6586 {
6587 InventoryLocation r_il = new InventoryLocation;
6588 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6589
6590 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6593 {
6594 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6595 }
6597 {
6598 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6599 }
6600
6601 }
6602
6603 player.GetHumanInventory().ClearUserReservedLocation(this);
6604 }
6605
6608 }
6609
6610
6611
6612
6614 {
6615 return ItemBase.m_DebugActionsMask;
6616 }
6617
6619 {
6620 return ItemBase.m_DebugActionsMask & mask;
6621 }
6622
6624 {
6625 ItemBase.m_DebugActionsMask = mask;
6626 }
6627
6629 {
6630 ItemBase.m_DebugActionsMask |= mask;
6631 }
6632
6634 {
6635 ItemBase.m_DebugActionsMask &= ~mask;
6636 }
6637
6639 {
6641 {
6643 }
6644 else
6645 {
6647 }
6648 }
6649
6650
6652 {
6653 if (GetEconomyProfile())
6654 {
6655 float q_max = GetEconomyProfile().GetQuantityMax();
6656 if (q_max > 0)
6657 {
6658 float q_min = GetEconomyProfile().GetQuantityMin();
6659 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6660
6662 {
6663 ComponentEnergyManager comp = GetCompEM();
6665 {
6667 }
6668 }
6670 {
6672
6673 }
6674
6675 }
6676 }
6677 }
6678
6681 {
6682 EntityAI parent = GetHierarchyParent();
6683
6684 if (parent)
6685 {
6686 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6687 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6688 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6689 }
6690 }
6691
6694 {
6695 EntityAI parent = GetHierarchyParent();
6696
6697 if (parent)
6698 {
6699 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6700 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6701 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6702 }
6703 }
6704
6706 {
6707
6708
6709
6710
6712
6714 {
6715 if (ScriptInputUserData.CanStoreInputUserData())
6716 {
6717 ScriptInputUserData ctx = new ScriptInputUserData;
6723 ctx.
Write(use_stack_max);
6726
6728 {
6729 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6730 }
6731 }
6732 }
6733 else if (!
g_Game.IsMultiplayer())
6734 {
6736 }
6737 }
6738
6740 {
6742 }
6743
6745 {
6747 }
6748
6750 {
6752 }
6753
6755 {
6756
6757 return false;
6758 }
6759
6761 {
6762 return false;
6763 }
6764
6768 {
6769 return false;
6770 }
6771
6773 {
6774 return "";
6775 }
6776
6778
6780 {
6781 return false;
6782 }
6783
6785 {
6786 return true;
6787 }
6788
6789
6790
6792 {
6793 return true;
6794 }
6795
6797 {
6798 return true;
6799 }
6800
6802 {
6803 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6805 }
6806
6808 {
6810 }
6811
6813 {
6815 if (!is_being_placed)
6817 SetSynchDirty();
6818 }
6819
6820
6822
6824 {
6826 }
6827
6829 {
6831 }
6832
6834 {
6835 return 1;
6836 }
6837
6839 {
6840 return false;
6841 }
6842
6844 {
6846 SetSynchDirty();
6847 }
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6884 {
6885 super.OnMovedInsideCargo(container);
6886
6887 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6888 }
6889
6890 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6891 {
6892 super.EEItemLocationChanged(oldLoc, newLoc);
6893
6894 PlayerBase newPlayer = null;
6895 PlayerBase oldPlayer = null;
6896
6897 if (newLoc.GetParent())
6898 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6899
6900 if (oldLoc.GetParent())
6901 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6902
6904 {
6905 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6906
6907 if (rIndex >= 0)
6908 {
6909 InventoryLocation rIl = new InventoryLocation;
6910 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6911
6912 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6915 {
6916 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6917 }
6919 {
6921 }
6922
6923 }
6924 }
6925
6927 {
6928 if (newPlayer)
6929 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6930
6931 if (newPlayer == oldPlayer)
6932 {
6933 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6934 {
6936 {
6937 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6938 {
6939 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6940 }
6941 }
6942 else
6943 {
6944 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6945 }
6946 }
6947
6948 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6949 {
6950 int type = oldLoc.GetType();
6952 {
6953 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6954 }
6956 {
6957 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6958 }
6959 }
6960 if (!m_OldLocation)
6961 {
6962 m_OldLocation = new InventoryLocation;
6963 }
6964 m_OldLocation.Copy(oldLoc);
6965 }
6966 else
6967 {
6968 if (m_OldLocation)
6969 {
6970 m_OldLocation.Reset();
6971 }
6972 }
6973
6974 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6975 }
6976 else
6977 {
6978 if (newPlayer)
6979 {
6980 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6981 if (resIndex >= 0)
6982 {
6983 InventoryLocation il = new InventoryLocation;
6984 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6986 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6989 {
6990 il.
GetParent().GetOnReleaseLock().Invoke(it);
6991 }
6993 {
6995 }
6996
6997 }
6998 }
7000 {
7001
7003 }
7004
7005 if (m_OldLocation)
7006 {
7007 m_OldLocation.Reset();
7008 }
7009 }
7010
7012 {
7013 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7014 }
7015
7017 {
7018 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7019 }
7020 }
7021
7022 override void EOnContact(IEntity other, Contact extra)
7023 {
7025 {
7026 int liquidType = -1;
7028 if (impactSpeed > 0.0)
7029 {
7031 #ifndef SERVER
7033 #else
7035 SetSynchDirty();
7036 #endif
7038 }
7039 }
7040
7041 #ifdef SERVER
7042 if (GetCompEM() && GetCompEM().IsPlugged())
7043 {
7044 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7045 GetCompEM().UnplugThis();
7046 }
7047 #endif
7048 }
7049
7051
7053 {
7055 }
7056
7058 {
7059
7060 }
7061
7063 {
7064 super.OnItemLocationChanged(old_owner, new_owner);
7065
7066 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7067 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7068
7069 if (!relatedPlayer && playerNew)
7070 relatedPlayer = playerNew;
7071
7072 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7073 {
7075 if (actionMgr)
7076 {
7077 ActionBase currentAction = actionMgr.GetRunningAction();
7078 if (currentAction)
7080 }
7081 }
7082
7083 Man ownerPlayerOld = null;
7084 Man ownerPlayerNew = null;
7085
7086 if (old_owner)
7087 {
7088 if (old_owner.
IsMan())
7089 {
7090 ownerPlayerOld = Man.Cast(old_owner);
7091 }
7092 else
7093 {
7094 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7095 }
7096 }
7097 else
7098 {
7100 {
7102
7103 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7104 {
7105 GetCompEM().UnplugThis();
7106 }
7107 }
7108 }
7109
7110 if (new_owner)
7111 {
7112 if (new_owner.
IsMan())
7113 {
7114 ownerPlayerNew = Man.Cast(new_owner);
7115 }
7116 else
7117 {
7118 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7119 }
7120 }
7121
7122 if (ownerPlayerOld != ownerPlayerNew)
7123 {
7124 if (ownerPlayerOld)
7125 {
7126 array<EntityAI> subItemsExit = new array<EntityAI>;
7128 for (int i = 0; i < subItemsExit.Count(); i++)
7129 {
7132 }
7133 }
7134
7135 if (ownerPlayerNew)
7136 {
7137 array<EntityAI> subItemsEnter = new array<EntityAI>;
7139 for (int j = 0; j < subItemsEnter.Count(); j++)
7140 {
7143 }
7144 }
7145 }
7146 else if (ownerPlayerNew != null)
7147 {
7148 PlayerBase nplayer;
7149 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7150 {
7151 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7153 for (int k = 0; k < subItemsUpdate.Count(); k++)
7154 {
7156 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7157 }
7158 }
7159 }
7160
7161 if (old_owner)
7162 old_owner.OnChildItemRemoved(this);
7163 if (new_owner)
7164 new_owner.OnChildItemReceived(this);
7165 }
7166
7167
7169 {
7170 super.EEDelete(parent);
7171 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7172 if (player)
7173 {
7175
7176 if (player.IsAlive())
7177 {
7178 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7179 if (r_index >= 0)
7180 {
7181 InventoryLocation r_il = new InventoryLocation;
7182 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7183
7184 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7187 {
7188 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7189 }
7191 {
7192 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7193 }
7194
7195 }
7196
7197 player.RemoveQuickBarEntityShortcut(this);
7198 }
7199 }
7200 }
7201
7203 {
7204 super.EEKilled(killer);
7205
7208 {
7209 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7210 {
7211 if (IsMagazine())
7212 {
7213 if (Magazine.Cast(this).GetAmmoCount() > 0)
7214 {
7216 }
7217 }
7218 else
7219 {
7221 }
7222 }
7223 }
7224 }
7225
7227 {
7228 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7229
7230 super.OnWasAttached(parent, slot_id);
7231
7234
7237 }
7238
7240 {
7241 super.OnWasDetached(parent, slot_id);
7242
7245
7248 }
7249
7251 {
7252 int idx;
7255
7256 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7257 if (inventory_slots.Count() < 1)
7258 {
7259 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7260 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7261 }
7262 else
7263 {
7264 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7265 }
7266
7267 idx = inventory_slots.Find(slot);
7268 if (idx < 0)
7269 return "";
7270
7271 return attach_types.Get(idx);
7272 }
7273
7275 {
7276 int idx = -1;
7277 string slot;
7278
7281
7282 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7283 if (inventory_slots.Count() < 1)
7284 {
7285 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7286 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7287 }
7288 else
7289 {
7290 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7291 if (detach_types.Count() < 1)
7292 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7293 }
7294
7295 for (int i = 0; i < inventory_slots.Count(); i++)
7296 {
7297 slot = inventory_slots.Get(i);
7298 }
7299
7300 if (slot != "")
7301 {
7302 if (detach_types.Count() == 1)
7303 idx = 0;
7304 else
7305 idx = inventory_slots.Find(slot);
7306 }
7307 if (idx < 0)
7308 return "";
7309
7310 return detach_types.Get(idx);
7311 }
7312
7314 {
7315
7317
7318
7319 float min_time = 1;
7320 float max_time = 3;
7321 float delay = Math.RandomFloat(min_time, max_time);
7322
7323 explode_timer.Run(delay, this, "DoAmmoExplosion");
7324 }
7325
7327 {
7328 Magazine magazine = Magazine.Cast(this);
7329 int pop_sounds_count = 6;
7330 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7331
7332
7333 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7334 string sound_name = pop_sounds[ sound_idx ];
7335 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7336
7337
7338 magazine.ServerAddAmmoCount(-1);
7339
7340
7341 float min_temp_to_explode = 100;
7342
7343 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7344 {
7346 }
7347 }
7348
7349
7350 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7351 {
7352 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7353
7354 const int CHANCE_DAMAGE_CARGO = 4;
7355 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7356 const int CHANCE_DAMAGE_NOTHING = 2;
7357
7359 {
7360 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7361 int chances;
7362 int rnd;
7363
7364 if (GetInventory().GetCargo())
7365 {
7366 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7367 rnd = Math.RandomInt(0,chances);
7368
7369 if (rnd < CHANCE_DAMAGE_CARGO)
7370 {
7372 }
7373 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7374 {
7376 }
7377 }
7378 else
7379 {
7380 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7381 rnd = Math.RandomInt(0,chances);
7382
7383 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7384 {
7386 }
7387 }
7388 }
7389 }
7390
7392 {
7393 CargoBase cargo = GetInventory().GetCargo();
7394 if (cargo)
7395 {
7397 if (item_count > 0)
7398 {
7399 int random_pick = Math.RandomInt(0, item_count);
7401 if (!item.IsExplosive())
7402 {
7403 item.AddHealth("","",damage);
7404 return true;
7405 }
7406 }
7407 }
7408 return false;
7409 }
7410
7412 {
7413 GameInventory inventory = GetInventory();
7415 if (attachment_count > 0)
7416 {
7417 int random_pick = Math.RandomInt(0, attachment_count);
7419 if (!attachment.IsExplosive())
7420 {
7421 attachment.AddHealth("","",damage);
7422 return true;
7423 }
7424 }
7425 return false;
7426 }
7427
7429 {
7431 }
7432
7434 {
7436 return GetInventory().CanRemoveEntity();
7437
7438 return false;
7439 }
7440
7442 {
7443
7445 return false;
7446
7447
7449 return false;
7450
7451
7452
7454 if (delta == 0)
7455 return false;
7456
7457
7458 return true;
7459 }
7460
7462 {
7464 {
7465 if (ScriptInputUserData.CanStoreInputUserData())
7466 {
7467 ScriptInputUserData ctx = new ScriptInputUserData;
7472 ctx.
Write(destination_entity);
7476 }
7477 }
7478 else if (!
g_Game.IsMultiplayer())
7479 {
7481 }
7482 }
7483
7485 {
7486 float split_quantity_new;
7490 InventoryLocation loc = new InventoryLocation;
7491
7492 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7493 {
7495 split_quantity_new = stack_max;
7496 else
7498
7500 {
7501 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7502 if (new_item)
7503 {
7504 new_item.SetResultOfSplit(true);
7505 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7507 new_item.
SetQuantity(split_quantity_new,
false,
true);
7508 }
7509 }
7510 }
7511 else if (destination_entity && slot_id == -1)
7512 {
7513 if (quantity > stack_max)
7514 split_quantity_new = stack_max;
7515 else
7516 split_quantity_new = quantity;
7517
7519 {
7520 GameInventory destinationInventory = destination_entity.GetInventory();
7522 {
7525 }
7526
7527 if (new_item)
7528 {
7529 new_item.SetResultOfSplit(true);
7530 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7532 new_item.
SetQuantity(split_quantity_new,
false,
true);
7533 }
7534 }
7535 }
7536 else
7537 {
7538 if (stack_max != 0)
7539 {
7541 {
7543 }
7544
7545 if (split_quantity_new == 0)
7546 {
7547 if (!
g_Game.IsMultiplayer())
7548 player.PhysicalPredictiveDropItem(this);
7549 else
7550 player.ServerDropEntity(this);
7551 return;
7552 }
7553
7555 {
7557
7558 if (new_item)
7559 {
7560 new_item.SetResultOfSplit(true);
7561 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7564 new_item.PlaceOnSurface();
7565 }
7566 }
7567 }
7568 }
7569 }
7570
7572 {
7573 float split_quantity_new;
7577 InventoryLocation loc = new InventoryLocation;
7578
7579 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7580 {
7582 split_quantity_new = stack_max;
7583 else
7585
7587 {
7588 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7589 if (new_item)
7590 {
7591 new_item.SetResultOfSplit(true);
7592 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7594 new_item.
SetQuantity(split_quantity_new,
false,
true);
7595 }
7596 }
7597 }
7598 else if (destination_entity && slot_id == -1)
7599 {
7600 if (quantity > stack_max)
7601 split_quantity_new = stack_max;
7602 else
7603 split_quantity_new = quantity;
7604
7606 {
7607 GameInventory destinationInventory = destination_entity.GetInventory();
7609 {
7612 }
7613
7614 if (new_item)
7615 {
7616 new_item.SetResultOfSplit(true);
7617 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7619 new_item.
SetQuantity(split_quantity_new,
false,
true);
7620 }
7621 }
7622 }
7623 else
7624 {
7625 if (stack_max != 0)
7626 {
7628 {
7630 }
7631
7633 {
7635
7636 if (new_item)
7637 {
7638 new_item.SetResultOfSplit(true);
7639 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7642 new_item.PlaceOnSurface();
7643 }
7644 }
7645 }
7646 }
7647 }
7648
7650 {
7652 {
7653 if (ScriptInputUserData.CanStoreInputUserData())
7654 {
7655 ScriptInputUserData ctx = new ScriptInputUserData;
7660 dst.WriteToContext(ctx);
7662 }
7663 }
7664 else if (!
g_Game.IsMultiplayer())
7665 {
7667 }
7668 }
7669
7671 {
7673 {
7674 if (ScriptInputUserData.CanStoreInputUserData())
7675 {
7676 ScriptInputUserData ctx = new ScriptInputUserData;
7681 ctx.
Write(destination_entity);
7687 }
7688 }
7689 else if (!
g_Game.IsMultiplayer())
7690 {
7692 }
7693 }
7694
7696 {
7698 }
7699
7701 {
7703 float split_quantity_new;
7705 if (dst.IsValid())
7706 {
7707 int slot_id = dst.GetSlot();
7709
7710 if (quantity > stack_max)
7711 split_quantity_new = stack_max;
7712 else
7713 split_quantity_new = quantity;
7714
7716 {
7718
7719 if (new_item)
7720 {
7721 new_item.SetResultOfSplit(true);
7722 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7724 new_item.
SetQuantity(split_quantity_new,
false,
true);
7725 }
7726
7727 return new_item;
7728 }
7729 }
7730
7731 return null;
7732 }
7733
7735 {
7737 float split_quantity_new;
7739 if (destination_entity)
7740 {
7742 if (quantity > stackable)
7743 split_quantity_new = stackable;
7744 else
7745 split_quantity_new = quantity;
7746
7748 {
7749 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7750 if (new_item)
7751 {
7752 new_item.SetResultOfSplit(true);
7753 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7755 new_item.
SetQuantity(split_quantity_new,
false,
true);
7756 }
7757 }
7758 }
7759 }
7760
7762 {
7764 {
7765 if (ScriptInputUserData.CanStoreInputUserData())
7766 {
7767 ScriptInputUserData ctx = new ScriptInputUserData;
7772 ItemBase destination_entity =
this;
7773 ctx.
Write(destination_entity);
7777 }
7778 }
7779 else if (!
g_Game.IsMultiplayer())
7780 {
7782 }
7783 }
7784
7786 {
7788 float split_quantity_new;
7790 if (player)
7791 {
7793 if (quantity > stackable)
7794 split_quantity_new = stackable;
7795 else
7796 split_quantity_new = quantity;
7797
7799 {
7800 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7801 new_item =
ItemBase.Cast(in_hands);
7802 if (new_item)
7803 {
7804 new_item.SetResultOfSplit(true);
7805 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7807 new_item.SetQuantity(split_quantity_new, false, true);
7808 }
7809 }
7810 }
7811 }
7812
7814 {
7816 float split_quantity_new = Math.Floor(quantity * 0.5);
7817
7819 return;
7820
7822
7823 if (new_item)
7824 {
7825 if (new_item.GetQuantityMax() < split_quantity_new)
7826 {
7827 split_quantity_new = new_item.GetQuantityMax();
7828 }
7829
7830 new_item.SetResultOfSplit(true);
7831 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7832
7834 {
7837 }
7838 else
7839 {
7841 new_item.
SetQuantity(split_quantity_new,
false,
true);
7842 }
7843 }
7844 }
7845
7847 {
7849 float split_quantity_new = Math.Floor(quantity / 2);
7850
7852 return;
7853
7854 InventoryLocation invloc = new InventoryLocation;
7856
7858 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7859
7860 if (new_item)
7861 {
7862 if (new_item.GetQuantityMax() < split_quantity_new)
7863 {
7864 split_quantity_new = new_item.GetQuantityMax();
7865 }
7867 {
7870 }
7871 else if (split_quantity_new > 1)
7872 {
7874 new_item.
SetQuantity(split_quantity_new,
false,
true);
7875 }
7876 }
7877 }
7878
7881 {
7882 SetWeightDirty();
7884
7885 if (parent)
7886 parent.OnAttachmentQuantityChangedEx(this, delta);
7887
7889 {
7891 {
7893 }
7895 {
7896 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7898 }
7899 }
7900 }
7901
7904 {
7905
7906 }
7907
7910 {
7912 }
7913
7915 {
7916 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7917
7919 {
7920 if (newLevel == GameConstants.STATE_RUINED)
7921 {
7923 EntityAI parent = GetHierarchyParent();
7924 if (parent && parent.IsFireplace())
7925 {
7926 CargoBase cargo = GetInventory().GetCargo();
7927 if (cargo)
7928 {
7930 {
7932 }
7933 }
7934 }
7935 }
7936
7938 {
7939
7941 return;
7942 }
7943
7944 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7945 {
7947 }
7948 }
7949 }
7950
7951
7953 {
7954 super.OnRightClick();
7955
7957 {
7959 {
7960 if (ScriptInputUserData.CanStoreInputUserData())
7961 {
7962 EntityAI root = GetHierarchyRoot();
7963 Man playerOwner = GetHierarchyRootPlayer();
7964 InventoryLocation dst = new InventoryLocation;
7965
7966
7967 if (!playerOwner && root && root == this)
7968 {
7970 }
7971 else
7972 {
7973
7974 GetInventory().GetCurrentInventoryLocation(dst);
7976 {
7977 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7979 {
7981 }
7982 else
7983 {
7985
7986
7987 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7988 {
7990 }
7991 else
7992 {
7993 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7994 }
7995 }
7996 }
7997 }
7998
7999 ScriptInputUserData ctx = new ScriptInputUserData;
8007 }
8008 }
8009 else if (!
g_Game.IsMultiplayer())
8010 {
8012 }
8013 }
8014 }
8015
8017 {
8018 if (root)
8019 {
8020 vector m4[4];
8021 root.GetTransform(m4);
8022 dst.SetGround(this, m4);
8023 }
8024 else
8025 {
8026 GetInventory().GetCurrentInventoryLocation(dst);
8027 }
8028 }
8029
8030 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8031 {
8032
8033 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8034 return false;
8035
8036 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8037 return false;
8038
8039
8041 return false;
8042
8043
8044 Magazine mag = Magazine.Cast(this);
8045 if (mag)
8046 {
8047 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8048 return false;
8049
8050 if (stack_max_limit)
8051 {
8052 Magazine other_mag = Magazine.Cast(other_item);
8053 if (other_item)
8054 {
8055 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8056 return false;
8057 }
8058
8059 }
8060 }
8061 else
8062 {
8063
8065 return false;
8066
8068 return false;
8069 }
8070
8071 PlayerBase player = null;
8072 if (CastTo(player, GetHierarchyRootPlayer()))
8073 {
8074 if (player.GetInventory().HasAttachment(this))
8075 return false;
8076
8077 if (player.IsItemsToDelete())
8078 return false;
8079 }
8080
8081 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8082 return false;
8083
8084 int slotID;
8086 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8087 return false;
8088
8089 return true;
8090 }
8091
8093 {
8095 }
8096
8098 {
8099 return m_IsResultOfSplit;
8100 }
8101
8103 {
8104 m_IsResultOfSplit = value;
8105 }
8106
8108 {
8110 }
8111
8113 {
8114 float other_item_quantity = other_item.GetQuantity();
8115 float this_free_space;
8116
8118
8120
8121 if (other_item_quantity > this_free_space)
8122 {
8123 return this_free_space;
8124 }
8125 else
8126 {
8127 return other_item_quantity;
8128 }
8129 }
8130
8132 {
8134 }
8135
8137 {
8139 return;
8140
8141 if (!IsMagazine() && other_item)
8142 {
8144 if (quantity_used != 0)
8145 {
8146 float hp1 = GetHealth01("","");
8147 float hp2 = other_item.GetHealth01("","");
8148 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8149 hpResult = hpResult / (
GetQuantity() + quantity_used);
8150
8151 hpResult *= GetMaxHealth();
8152 Math.Round(hpResult);
8153 SetHealth("", "Health", hpResult);
8154
8156 other_item.AddQuantity(-quantity_used);
8157 }
8158 }
8160 }
8161
8163 {
8164 #ifdef SERVER
8165 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8166 GetHierarchyParent().IncreaseLifetimeUp();
8167 #endif
8168 };
8169
8171 {
8172 PlayerBase p = PlayerBase.Cast(player);
8173
8174 array<int> recipesIds = p.m_Recipes;
8175 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8176 if (moduleRecipesManager)
8177 {
8178 EntityAI itemInHands = player.GetEntityInHands();
8179 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8180 }
8181
8182 for (int i = 0;i < recipesIds.Count(); i++)
8183 {
8184 int key = recipesIds.Get(i);
8185 string recipeName = moduleRecipesManager.GetRecipeName(key);
8187 }
8188 }
8189
8190
8191 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8192 {
8193 super.GetDebugActions(outputList);
8194
8195
8201
8202
8207
8212
8213
8217
8218
8220 {
8224 }
8225
8228
8229
8233
8235
8236 InventoryLocation loc = new InventoryLocation();
8237 GetInventory().GetCurrentInventoryLocation(loc);
8239 {
8240 if (Gizmo_IsSupported())
8243 }
8244
8246 }
8247
8248
8249
8250
8252 {
8253 super.OnAction(action_id, player, ctx);
8254
8256 {
8257 switch (action_id)
8258 {
8262 return true;
8266 return true;
8267 }
8268 }
8269
8271 {
8272 switch (action_id)
8273 {
8275 Delete();
8276 return true;
8277 }
8278 }
8279
8280 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8281 {
8282 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8283 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8284 PlayerBase p = PlayerBase.Cast(player);
8285 if (
EActions.RECIPES_RANGE_START < 1000)
8286 {
8287 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8288 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8289 }
8290 }
8291 #ifndef SERVER
8292 else if (action_id ==
EActions.WATCH_PLAYER)
8293 {
8294 PluginDeveloper.SetDeveloperItemClientEx(player);
8295 }
8296 #endif
8298 {
8299 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8300 {
8301 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8302 OnDebugButtonPressServer(id + 1);
8303 }
8304
8305 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8306 {
8307 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8309 }
8310
8311 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8312 {
8313 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8315 }
8316
8317 else if (action_id ==
EActions.ADD_QUANTITY)
8318 {
8319 if (IsMagazine())
8320 {
8321 Magazine mag = Magazine.Cast(this);
8322 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8323 }
8324 else
8325 {
8327 }
8328
8329 if (m_EM)
8330 {
8331 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8332 }
8333
8334 }
8335
8336 else if (action_id ==
EActions.REMOVE_QUANTITY)
8337 {
8338 if (IsMagazine())
8339 {
8340 Magazine mag2 = Magazine.Cast(this);
8341 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8342 }
8343 else
8344 {
8346 }
8347 if (m_EM)
8348 {
8349 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8350 }
8351
8352 }
8353
8354 else if (action_id ==
EActions.SET_QUANTITY_0)
8355 {
8357
8358 if (m_EM)
8359 {
8360 m_EM.SetEnergy(0);
8361 }
8362 }
8363
8364 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8365 {
8367
8368 if (m_EM)
8369 {
8370 m_EM.SetEnergy(m_EM.GetEnergyMax());
8371 }
8372 }
8373
8374 else if (action_id ==
EActions.ADD_HEALTH)
8375 {
8376 AddHealth("","",GetMaxHealth("","Health")/5);
8377 }
8378 else if (action_id ==
EActions.REMOVE_HEALTH)
8379 {
8380 AddHealth("","",-GetMaxHealth("","Health")/5);
8381 }
8382 else if (action_id ==
EActions.DESTROY_HEALTH)
8383 {
8384 SetHealth01("","",0);
8385 }
8386 else if (action_id ==
EActions.WATCH_ITEM)
8387 {
8389 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8390 #ifdef DEVELOPER
8391 SetDebugDeveloper_item(this);
8392 #endif
8393 }
8394
8395 else if (action_id ==
EActions.ADD_TEMPERATURE)
8396 {
8397 AddTemperature(20);
8398
8399 }
8400
8401 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8402 {
8403 AddTemperature(-20);
8404
8405 }
8406
8407 else if (action_id ==
EActions.FLIP_FROZEN)
8408 {
8409 SetFrozen(!GetIsFrozen());
8410
8411 }
8412
8413 else if (action_id ==
EActions.ADD_WETNESS)
8414 {
8416
8417 }
8418
8419 else if (action_id ==
EActions.REMOVE_WETNESS)
8420 {
8422
8423 }
8424
8425 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8426 {
8429
8430
8431 }
8432
8433 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8434 {
8437 }
8438
8439 else if (action_id ==
EActions.MAKE_SPECIAL)
8440 {
8441 auto debugParams = DebugSpawnParams.WithPlayer(player);
8442 OnDebugSpawnEx(debugParams);
8443 }
8444
8445 }
8446
8447
8448 return false;
8449 }
8450
8451
8452
8453
8457
8460
8461
8462
8464 {
8465 return false;
8466 }
8467
8468
8470 {
8471 return true;
8472 }
8473
8474
8476 {
8477 return true;
8478 }
8479
8480
8481
8483 {
8484 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8485 return g_Game.ConfigIsExisting(config_path);
8486 }
8487
8490 {
8491 return null;
8492 }
8493
8495 {
8496 return false;
8497 }
8498
8500 {
8501 return false;
8502 }
8503
8507
8508
8510 {
8511 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8512 return module_repairing.CanRepair(this, item_repair_kit);
8513 }
8514
8515
8516 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8517 {
8518 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8519 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8520 }
8521
8522
8524 {
8525
8526
8527
8528
8529
8530
8531
8532
8533 return 1;
8534 }
8535
8536
8537
8539 {
8541 }
8542
8543
8544
8546 {
8548 }
8549
8550
8559 {
8560 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8561
8562 if (player)
8563 {
8564 player.MessageStatus(text);
8565 }
8566 }
8567
8568
8577 {
8578 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8579
8580 if (player)
8581 {
8582 player.MessageAction(text);
8583 }
8584 }
8585
8586
8595 {
8596 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8597
8598 if (player)
8599 {
8600 player.MessageFriendly(text);
8601 }
8602 }
8603
8604
8613 {
8614 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8615
8616 if (player)
8617 {
8618 player.MessageImportant(text);
8619 }
8620 }
8621
8623 {
8624 return true;
8625 }
8626
8627
8628 override bool KindOf(
string tag)
8629 {
8630 bool found = false;
8631 string item_name = this.
GetType();
8633 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8634
8635 int array_size = item_tag_array.Count();
8636 for (int i = 0; i < array_size; i++)
8637 {
8638 if (item_tag_array.Get(i) == tag)
8639 {
8640 found = true;
8641 break;
8642 }
8643 }
8644 return found;
8645 }
8646
8647
8649 {
8650
8651 super.OnRPC(sender, rpc_type,ctx);
8652
8653
8654 switch (rpc_type)
8655 {
8656 #ifndef SERVER
8657 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8658 Param2<bool, string> p = new Param2<bool, string>(false, "");
8659
8661 return;
8662
8663 bool play = p.param1;
8664 string soundSet = p.param2;
8665
8666 if (play)
8667 {
8669 {
8671 {
8673 }
8674 }
8675 else
8676 {
8678 }
8679 }
8680 else
8681 {
8683 }
8684
8685 break;
8686 #endif
8687
8688 }
8689
8691 {
8693 }
8694 }
8695
8696
8697
8698
8700 {
8701 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8702 return plugin.GetID(
name);
8703 }
8704
8706 {
8707 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8708 return plugin.GetName(id);
8709 }
8710
8713 {
8714
8715
8716 int varFlags;
8717 if (!ctx.
Read(varFlags))
8718 return;
8719
8720 if (varFlags & ItemVariableFlags.FLOAT)
8721 {
8723 }
8724 }
8725
8727 {
8728
8729 super.SerializeNumericalVars(floats_out);
8730
8731
8732
8734 {
8736 }
8737
8739 {
8741 }
8742
8744 {
8746 }
8747
8749 {
8754 }
8755
8757 {
8759 }
8760 }
8761
8763 {
8764
8765 super.DeSerializeNumericalVars(floats);
8766
8767
8768 int index = 0;
8769 int mask = Math.Round(floats.Get(index));
8770
8771 index++;
8772
8774 {
8776 {
8778 }
8779 else
8780 {
8781 float quantity = floats.Get(index);
8783 }
8784 index++;
8785 }
8786
8788 {
8789 float wet = floats.Get(index);
8791 index++;
8792 }
8793
8795 {
8796 int liquidtype = Math.Round(floats.Get(index));
8798 index++;
8799 }
8800
8802 {
8804 index++;
8806 index++;
8808 index++;
8810 index++;
8811 }
8812
8814 {
8815 int cleanness = Math.Round(floats.Get(index));
8817 index++;
8818 }
8819 }
8820
8822 {
8823 super.WriteVarsToCTX(ctx);
8824
8825
8827 {
8829 }
8830
8832 {
8834 }
8835
8837 {
8839 }
8840
8842 {
8843 int r,g,b,a;
8849 }
8850
8852 {
8854 }
8855 }
8856
8858 {
8859 if (!super.ReadVarsFromCTX(ctx,version))
8860 return false;
8861
8862 int intValue;
8863 float value;
8864
8865 if (version < 140)
8866 {
8867 if (!ctx.
Read(intValue))
8868 return false;
8869
8870 m_VariablesMask = intValue;
8871 }
8872
8874 {
8875 if (!ctx.
Read(value))
8876 return false;
8877
8879 {
8881 }
8882 else
8883 {
8885 }
8886 }
8887
8888 if (version < 140)
8889 {
8891 {
8892 if (!ctx.
Read(value))
8893 return false;
8894 SetTemperatureDirect(value);
8895 }
8896 }
8897
8899 {
8900 if (!ctx.
Read(value))
8901 return false;
8903 }
8904
8906 {
8907 if (!ctx.
Read(intValue))
8908 return false;
8910 }
8911
8913 {
8914 int r,g,b,a;
8916 return false;
8918 return false;
8920 return false;
8922 return false;
8923
8925 }
8926
8928 {
8929 if (!ctx.
Read(intValue))
8930 return false;
8932 }
8933
8934 if (version >= 138 && version < 140)
8935 {
8937 {
8938 if (!ctx.
Read(intValue))
8939 return false;
8940 SetFrozen(intValue);
8941 }
8942 }
8943
8944 return true;
8945 }
8946
8947
8949 {
8952 {
8954 }
8955
8956 if (!super.OnStoreLoad(ctx, version))
8957 {
8959 return false;
8960 }
8961
8962 if (version >= 114)
8963 {
8964 bool hasQuickBarIndexSaved;
8965
8966 if (!ctx.
Read(hasQuickBarIndexSaved))
8967 {
8969 return false;
8970 }
8971
8972 if (hasQuickBarIndexSaved)
8973 {
8974 int itmQBIndex;
8975
8976
8977 if (!ctx.
Read(itmQBIndex))
8978 {
8980 return false;
8981 }
8982
8983 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8984 if (itmQBIndex != -1 && parentPlayer)
8985 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8986 }
8987 }
8988 else
8989 {
8990
8991 PlayerBase player;
8992 int itemQBIndex;
8993 if (version ==
int.
MAX)
8994 {
8995 if (!ctx.
Read(itemQBIndex))
8996 {
8998 return false;
8999 }
9000 }
9001 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9002 {
9003
9004 if (!ctx.
Read(itemQBIndex))
9005 {
9007 return false;
9008 }
9009 if (itemQBIndex != -1 && player)
9010 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9011 }
9012 }
9013
9014 if (version < 140)
9015 {
9016
9017 if (!LoadVariables(ctx, version))
9018 {
9020 return false;
9021 }
9022 }
9023
9024
9026 {
9028 return false;
9029 }
9030 if (version >= 132)
9031 {
9033 if (raib)
9034 {
9036 {
9038 return false;
9039 }
9040 }
9041 }
9042
9044 return true;
9045 }
9046
9047
9048
9050 {
9051 super.OnStoreSave(ctx);
9052
9053 PlayerBase player;
9054 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9055 {
9057
9058 int itemQBIndex = -1;
9059 itemQBIndex = player.FindQuickBarEntityIndex(this);
9060 ctx.
Write(itemQBIndex);
9061 }
9062 else
9063 {
9065 }
9066
9068
9070 if (raib)
9071 {
9073 }
9074 }
9075
9076
9078 {
9079 super.AfterStoreLoad();
9080
9082 {
9084 }
9085
9087 {
9090 }
9091 }
9092
9094 {
9095 super.EEOnAfterLoad();
9096
9098 {
9100 }
9101
9104 }
9105
9107 {
9108 return false;
9109 }
9110
9111
9112
9114 {
9116 {
9117 #ifdef PLATFORM_CONSOLE
9118
9120 {
9122 if (menu)
9123 {
9125 }
9126 }
9127 #endif
9128 }
9129
9131 {
9134 }
9135
9137 {
9138 SetWeightDirty();
9140 }
9142 {
9145 }
9146
9148 {
9151
9154 }
9156 {
9160 }
9161
9162 super.OnVariablesSynchronized();
9163 }
9164
9165
9166
9168 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9169 {
9170 if (!IsServerCheck(allow_client))
9171 return false;
9172
9174 return false;
9175
9178
9179 if (value <= (min + 0.001))
9180 value = min;
9181
9182 if (value == min)
9183 {
9184 if (destroy_config)
9185 {
9186 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9187 if (dstr)
9188 {
9190 this.Delete();
9191 return true;
9192 }
9193 }
9194 else if (destroy_forced)
9195 {
9197 this.Delete();
9198 return true;
9199 }
9200
9202 }
9203
9206
9208 {
9209 EntityAI parent = GetHierarchyRoot();
9210 InventoryLocation iLoc = new InventoryLocation();
9211 GetInventory().GetCurrentInventoryLocation(iLoc);
9213 {
9214 int iLocSlot = iLoc.
GetSlot();
9216 {
9218 }
9220 {
9222 }
9223 }
9224 }
9225
9227 {
9229
9230 if (delta)
9232 }
9233
9235
9236 return false;
9237 }
9238
9239
9241 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9242 {
9244 }
9245
9247 {
9250 }
9251
9253 {
9256 }
9257
9259 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9260 {
9261 float value_clamped = Math.Clamp(value, 0, 1);
9263 SetQuantity(result, destroy_config, destroy_forced);
9264 }
9265
9266
9269 {
9271 }
9272
9274 {
9276 }
9277
9278
9279
9280
9281
9282
9283
9284
9285
9286
9288 {
9289 int slot = -1;
9290 GameInventory inventory = GetInventory();
9291 if (inventory)
9292 {
9293 InventoryLocation il = new InventoryLocation;
9296 }
9297
9299 }
9300
9302 {
9303 float quantity_max = 0;
9304
9306 {
9307 if (attSlotID != -1)
9308 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9309
9310 if (quantity_max <= 0)
9312 }
9313
9314 if (quantity_max <= 0)
9316
9317 return quantity_max;
9318 }
9319
9321 {
9323 }
9324
9326 {
9328 }
9329
9330
9332 {
9334 }
9335
9337 {
9339 }
9340
9342 {
9344 }
9345
9346
9348 {
9349
9350 float weightEx = GetWeightEx();
9351 float special = GetInventoryAndCargoWeight();
9352 return weightEx - special;
9353 }
9354
9355
9357 {
9359 }
9360
9362 {
9364 {
9365 #ifdef DEVELOPER
9366 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9367 {
9368 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9370 }
9371 #endif
9372
9374 }
9375 else if (HasEnergyManager())
9376 {
9377 #ifdef DEVELOPER
9378 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9379 {
9380 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9381 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9382 }
9383 #endif
9384 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9385 }
9386 else
9387 {
9388 #ifdef DEVELOPER
9389 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9390 {
9391 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9392 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9393 }
9394 #endif
9395 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9396 }
9397 }
9398
9401 {
9402 int item_count = 0;
9404
9405 GameInventory inventory = GetInventory();
9406 CargoBase cargo = inventory.
GetCargo();
9407 if (cargo != NULL)
9408 {
9410 }
9411
9413 for (int i = 0; i < nAttachments; ++i)
9414 {
9416 if (item)
9417 item_count += item.GetNumberOfItems();
9418 }
9419 return item_count;
9420 }
9421
9424 {
9425 float weight = 0;
9426 float wetness = 1;
9427 if (include_wetness)
9430 {
9431 weight = wetness * m_ConfigWeight;
9432 }
9434 {
9435 weight = 1;
9436 }
9437 return weight;
9438 }
9439
9440
9441
9443 {
9444 GameInventory inventory = GetInventory();
9445 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9446 {
9447 array<EntityAI> items = new array<EntityAI>;
9449 for (int i = 0; i < items.Count(); ++i)
9450 {
9452 if (item)
9453 {
9454 g_Game.ObjectDelete(item);
9455 }
9456 }
9457 }
9458 }
9459
9460
9461
9462
9464 {
9465 float energy = 0;
9466 if (HasEnergyManager())
9467 {
9468 energy = GetCompEM().GetEnergy();
9469 }
9470 return energy;
9471 }
9472
9473
9475 {
9476 super.OnEnergyConsumed();
9477
9479 }
9480
9482 {
9483 super.OnEnergyAdded();
9484
9486 }
9487
9488
9490 {
9491 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9492 {
9494 {
9495 float energy_0to1 = GetCompEM().GetEnergy0To1();
9497 }
9498 }
9499 }
9500
9501
9503 {
9504 return ConfigGetFloat("heatIsolation");
9505 }
9506
9508 {
9510 }
9511
9513 {
9514 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9515 if (
g_Game.ConfigIsExisting(paramPath))
9516 return g_Game.ConfigGetFloat(paramPath);
9517
9518 return 0.0;
9519 }
9520
9522 {
9523 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9524 if (
g_Game.ConfigIsExisting(paramPath))
9525 return g_Game.ConfigGetFloat(paramPath);
9526
9527 return 0.0;
9528 }
9529
9530 override void SetWet(
float value,
bool allow_client =
false)
9531 {
9532 if (!IsServerCheck(allow_client))
9533 return;
9534
9537
9539
9540 m_VarWet = Math.Clamp(value, min, max);
9541
9543 {
9546 }
9547 }
9548
9549 override void AddWet(
float value)
9550 {
9552 }
9553
9555 {
9557 }
9558
9560 {
9562 }
9563
9565 {
9567 }
9568
9570 {
9572 }
9573
9575 {
9577 }
9578
9580 {
9583 if (newLevel != oldLevel)
9584 {
9586 }
9587 }
9588
9590 {
9591 SetWeightDirty();
9592 }
9593
9595 {
9596 return GetWetLevelInternal(
m_VarWet);
9597 }
9598
9599
9600
9602 {
9604 }
9605
9607 {
9609 }
9610
9612 {
9614 }
9615
9617 {
9619 }
9620
9621
9622
9624 {
9625 if (ConfigIsExisting("itemModelLength"))
9626 {
9627 return ConfigGetFloat("itemModelLength");
9628 }
9629 return 0;
9630 }
9631
9633 {
9634 if (ConfigIsExisting("itemAttachOffset"))
9635 {
9636 return ConfigGetFloat("itemAttachOffset");
9637 }
9638 return 0;
9639 }
9640
9641 override void SetCleanness(
int value,
bool allow_client =
false)
9642 {
9643 if (!IsServerCheck(allow_client))
9644 return;
9645
9647
9649
9652 }
9653
9655 {
9657 }
9658
9660 {
9661 return true;
9662 }
9663
9664
9665
9666
9668 {
9670 }
9671
9673 {
9675 }
9676
9677
9678
9679
9680 override void SetColor(
int r,
int g,
int b,
int a)
9681 {
9687 }
9689 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9690 {
9695 }
9696
9698 {
9700 }
9701
9704 {
9705 int r,g,b,a;
9707 r = r/255;
9708 g = g/255;
9709 b = b/255;
9710 a = a/255;
9711 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9712 }
9713
9714
9715
9716 override void SetLiquidType(
int value,
bool allow_client =
false)
9717 {
9718 if (!IsServerCheck(allow_client))
9719 return;
9720
9725 }
9726
9728 {
9729 return ConfigGetInt("varLiquidTypeInit");
9730 }
9731
9733 {
9735 }
9736
9738 {
9740 SetFrozen(false);
9741 }
9742
9745 {
9746 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9747 }
9748
9749
9752 {
9753 PlayerBase nplayer;
9754 if (PlayerBase.CastTo(nplayer, player))
9755 {
9757 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9758 }
9759 }
9760
9761
9764 {
9765 PlayerBase nplayer;
9766 if (PlayerBase.CastTo(nplayer,player))
9767 {
9768 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9769 }
9770
9771 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9772
9773 if (HasEnergyManager())
9774 {
9775 GetCompEM().UpdatePlugState();
9776 }
9777 }
9778
9779
9781 {
9782 super.OnPlacementStarted(player);
9783
9785 }
9786
9787 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9788 {
9790 {
9791 m_AdminLog.OnPlacementComplete(player,
this);
9792 }
9793
9794 super.OnPlacementComplete(player, position, orientation);
9795 }
9796
9797
9798
9799
9800
9802 {
9804 {
9805 return true;
9806 }
9807 else
9808 {
9809 return false;
9810 }
9811 }
9812
9813
9815 {
9817 {
9819 }
9820 }
9821
9822
9824 {
9826 }
9827
9829 {
9831 }
9832
9833 override void InsertAgent(
int agent,
float count = 1)
9834 {
9835 if (count < 1)
9836 return;
9837
9839 }
9840
9843 {
9845 }
9846
9847
9849 {
9851 }
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9895 {
9897 return false;
9898 return true;
9899 }
9900
9902 {
9903
9905 }
9906
9907
9910 {
9911 super.CheckForRoofLimited(timeTresholdMS);
9912
9913 float time =
g_Game.GetTime();
9914 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9915 {
9916 m_PreviousRoofTestTime = time;
9917 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9918 }
9919 }
9920
9921
9923 {
9925 {
9926 return 0;
9927 }
9928
9929 if (GetInventory().GetAttachmentSlotsCount() != 0)
9930 {
9931 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9932 if (filter)
9933 return filter.GetProtectionLevel(type, false, system);
9934 else
9935 return 0;
9936 }
9937
9938 string subclassPath, entryName;
9939
9940 switch (type)
9941 {
9943 entryName = "biological";
9944 break;
9946 entryName = "chemical";
9947 break;
9948 default:
9949 entryName = "biological";
9950 break;
9951 }
9952
9953 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9954
9955 return g_Game.ConfigGetFloat(subclassPath + entryName);
9956 }
9957
9958
9959
9962 {
9963 if (!IsMagazine())
9965
9967 }
9968
9969
9970
9971
9972
9977 {
9978 return true;
9979 }
9980
9982 {
9984 }
9985
9986
9987
9988
9989
9991 {
9992 if (parent)
9993 {
9994 if (parent.IsInherited(DayZInfected))
9995 return true;
9996
9997 if (!parent.IsRuined())
9998 return true;
9999 }
10000
10001 return true;
10002 }
10003
10005 {
10006 if (!super.CanPutAsAttachment(parent))
10007 {
10008 return false;
10009 }
10010
10011 if (!IsRuined() && !parent.IsRuined())
10012 {
10013 return true;
10014 }
10015
10016 return false;
10017 }
10018
10020 {
10021
10022
10023
10024
10025 return super.CanReceiveItemIntoCargo(item);
10026 }
10027
10029 {
10030
10031
10032
10033
10034 GameInventory attachmentInv = attachment.GetInventory();
10036 {
10037 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10038 return false;
10039 }
10040
10041 InventoryLocation loc = new InventoryLocation();
10042 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10043 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10044 return false;
10045
10046 return super.CanReceiveAttachment(attachment, slotId);
10047 }
10048
10050 {
10051 if (!super.CanReleaseAttachment(attachment))
10052 return false;
10053
10054 return GetInventory().AreChildrenAccessible();
10055 }
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10070
10071
10072
10073
10074
10075
10076
10078 {
10079 int id = muzzle_owner.GetMuzzleID();
10080 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10081
10082 if (WPOF_array)
10083 {
10084 for (int i = 0; i < WPOF_array.Count(); i++)
10085 {
10086 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10087
10088 if (WPOF)
10089 {
10090 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10091 }
10092 }
10093 }
10094 }
10095
10096
10098 {
10099 int id = muzzle_owner.GetMuzzleID();
10101
10102 if (WPOBE_array)
10103 {
10104 for (int i = 0; i < WPOBE_array.Count(); i++)
10105 {
10106 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10107
10108 if (WPOBE)
10109 {
10110 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10111 }
10112 }
10113 }
10114 }
10115
10116
10118 {
10119 int id = muzzle_owner.GetMuzzleID();
10120 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10121
10122 if (WPOOH_array)
10123 {
10124 for (int i = 0; i < WPOOH_array.Count(); i++)
10125 {
10126 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10127
10128 if (WPOOH)
10129 {
10130 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10131 }
10132 }
10133 }
10134 }
10135
10136
10138 {
10139 int id = muzzle_owner.GetMuzzleID();
10140 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10141
10142 if (WPOOH_array)
10143 {
10144 for (int i = 0; i < WPOOH_array.Count(); i++)
10145 {
10146 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10147
10148 if (WPOOH)
10149 {
10150 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10151 }
10152 }
10153 }
10154 }
10155
10156
10158 {
10159 int id = muzzle_owner.GetMuzzleID();
10160 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10161
10162 if (WPOOH_array)
10163 {
10164 for (int i = 0; i < WPOOH_array.Count(); i++)
10165 {
10166 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10167
10168 if (WPOOH)
10169 {
10170 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10171 }
10172 }
10173 }
10174 }
10175
10176
10177
10179 {
10181 {
10182 return true;
10183 }
10184
10185 return false;
10186 }
10187
10189 {
10191 {
10192 return true;
10193 }
10194
10195 return false;
10196 }
10197
10199 {
10201 {
10202 return true;
10203 }
10204
10205 return false;
10206 }
10207
10209 {
10210 return false;
10211 }
10212
10215 {
10216 return UATimeSpent.DEFAULT_DEPLOY;
10217 }
10218
10219
10220
10221
10223 {
10225 SetSynchDirty();
10226 }
10227
10229 {
10231 }
10232
10233
10235 {
10236 return false;
10237 }
10238
10241 {
10242 string att_type = "None";
10243
10244 if (ConfigIsExisting("soundAttType"))
10245 {
10246 att_type = ConfigGetString("soundAttType");
10247 }
10248
10250 }
10251
10253 {
10255 }
10256
10257
10258
10259
10260
10266
10268 {
10271
10273 }
10274
10275
10277 {
10279 return;
10280
10282
10285
10288
10289 SoundParameters params = new SoundParameters();
10293 }
10294
10295
10297 {
10299 {
10302
10303 SetSynchDirty();
10304
10307 }
10308 }
10309
10311 {
10313 }
10314
10315
10317 {
10319 return;
10320
10322 SetSynchDirty();
10323
10326 }
10327
10329 {
10332 }
10333
10335 {
10337 }
10338
10339 void OnApply(PlayerBase player);
10340
10342 {
10343 return 1.0;
10344 };
10345
10347 {
10349 }
10350
10352 {
10354 }
10355
10357
10359 {
10360 SetDynamicPhysicsLifeTime(0.01);
10362 }
10363
10365 {
10366 array<string> zone_names = new array<string>;
10367 GetDamageZones(zone_names);
10368 for (int i = 0; i < zone_names.Count(); i++)
10369 {
10370 SetHealthMax(zone_names.Get(i),"Health");
10371 }
10372 SetHealthMax("","Health");
10373 }
10374
10377 {
10378 float global_health = GetHealth01("","Health");
10379 array<string> zones = new array<string>;
10380 GetDamageZones(zones);
10381
10382 for (int i = 0; i < zones.Count(); i++)
10383 {
10384 SetHealth01(zones.Get(i),"Health",global_health);
10385 }
10386 }
10387
10390 {
10391 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10392 }
10393
10395 {
10396 if (!hasRootAsPlayer)
10397 {
10398 if (refParentIB)
10399 {
10400
10401 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10402 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10403
10404 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10405 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10406
10409 }
10410 else
10411 {
10412
10415 }
10416 }
10417 }
10418
10420 {
10422 {
10423 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10424 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10425 {
10426 float heatPermCoef = 1.0;
10428 while (ent)
10429 {
10430 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10431 ent = ent.GetHierarchyParent();
10432 }
10433
10434 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10435 }
10436 }
10437 }
10438
10440 {
10441
10442 EntityAI parent = GetHierarchyParent();
10443 if (!parent)
10444 {
10445 hasParent = false;
10446 hasRootAsPlayer = false;
10447 }
10448 else
10449 {
10450 hasParent = true;
10451 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10452 refParentIB =
ItemBase.Cast(parent);
10453 }
10454 }
10455
10456 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10457 {
10458
10459 }
10460
10462 {
10463
10464 return false;
10465 }
10466
10468 {
10469
10470
10471 return false;
10472 }
10473
10475 {
10476
10477 return false;
10478 }
10479
10482 {
10483 return !GetIsFrozen() &&
IsOpen();
10484 }
10485
10487 {
10488 bool hasParent = false, hasRootAsPlayer = false;
10490
10491 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10492 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10493
10494 if (wwtu || foodDecay)
10495 {
10499
10500 if (processWetness || processTemperature || processDecay)
10501 {
10503
10504 if (processWetness)
10505 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10506
10507 if (processTemperature)
10509
10510 if (processDecay)
10511 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10512 }
10513 }
10514 }
10515
10518 {
10520 }
10521
10523 {
10526
10527 return super.GetTemperatureFreezeThreshold();
10528 }
10529
10531 {
10534
10535 return super.GetTemperatureThawThreshold();
10536 }
10537
10539 {
10542
10543 return super.GetItemOverheatThreshold();
10544 }
10545
10547 {
10549 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10550
10551 return super.GetTemperatureFreezeTime();
10552 }
10553
10555 {
10557 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10558
10559 return super.GetTemperatureThawTime();
10560 }
10561
10566
10568 {
10569 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10570 }
10571
10573 {
10574 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10575 }
10576
10579 {
10581 }
10582
10584 {
10586 }
10587
10589 {
10591 }
10592
10595 {
10596 return null;
10597 }
10598
10601 {
10602 return false;
10603 }
10604
10606 {
10608 {
10611 if (!trg)
10612 {
10614 explosive = this;
10615 }
10616
10617 explosive.PairRemote(trg);
10619
10620 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10621 trg.SetPersistentPairID(persistentID);
10622 explosive.SetPersistentPairID(persistentID);
10623
10624 return true;
10625 }
10626 return false;
10627 }
10628
10631 {
10632 float ret = 1.0;
10635 ret *= GetHealth01();
10636
10637 return ret;
10638 }
10639
10640 #ifdef DEVELOPER
10641 override void SetDebugItem()
10642 {
10643 super.SetDebugItem();
10644 _itemBase = this;
10645 }
10646
10648 {
10649 string text = super.GetDebugText();
10650
10652 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10653
10654 return text;
10655 }
10656 #endif
10657
10659 {
10660 return true;
10661 }
10662
10664
10666
10668 {
10671 }
10672
10673
10681
10697
10698 [
Obsolete(
"Use ItemSoundHandler instead")]
10701 {
10702 if (!
g_Game.IsDedicatedServer())
10703 {
10704 if (ConfigIsExisting("attachSoundSet"))
10705 {
10706 string cfg_path = "";
10707 string soundset = "";
10708 string type_name =
GetType();
10709
10712 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10713 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10714
10715 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10716 {
10717 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10718 {
10719 if (cfg_slot_array[i] == slot_type)
10720 {
10721 soundset = cfg_soundset_array[i];
10722 break;
10723 }
10724 }
10725 }
10726
10727 if (soundset != "")
10728 {
10729 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10731 }
10732 }
10733 }
10734 }
10735
10737}
10738
10740{
10742 if (entity)
10743 {
10744 bool is_item = entity.IsInherited(
ItemBase);
10745 if (is_item && full_quantity)
10746 {
10749 }
10750 }
10751 else
10752 {
10754 return NULL;
10755 }
10756 return entity;
10757}
10758
10760{
10761 if (item)
10762 {
10763 if (health > 0)
10764 item.SetHealth("", "", health);
10765
10766 if (item.CanHaveTemperature())
10767 {
10769 if (item.CanFreeze())
10770 item.SetFrozen(false);
10771 }
10772
10773 if (item.HasEnergyManager())
10774 {
10775 if (quantity >= 0)
10776 {
10777 item.GetCompEM().SetEnergy0To1(quantity);
10778 }
10779 else
10780 {
10782 }
10783 }
10784 else if (item.IsMagazine())
10785 {
10786 Magazine mag = Magazine.Cast(item);
10787 if (quantity >= 0)
10788 {
10789 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10790 }
10791 else
10792 {
10794 }
10795
10796 }
10797 else
10798 {
10799 if (quantity >= 0)
10800 {
10801 item.SetQuantityNormalized(quantity, false);
10802 }
10803 else
10804 {
10806 }
10807
10808 }
10809 }
10810}
10811
10812#ifdef DEVELOPER
10814#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.