5818{
5820 {
5821 return true;
5822 }
5823};
5824
5825
5826
5828{
5832
5834
5837
5838
5839
5840
5841
5850
5856
5861
5866
5887 protected bool m_IsResultOfSplit
5888
5890
5895
5896
5897
5899
5903
5904
5905
5907
5910
5911
5912
5918
5919
5927
5930
5931
5933
5934
5936
5937
5942
5943
5948
5949
5951
5952
5954 {
5959
5960 if (!
GetGame().IsDedicatedServer())
5961 {
5963 {
5965
5967 {
5969 }
5970 }
5971
5974 }
5975
5976 m_OldLocation = null;
5977
5979 {
5981 }
5982
5983 if (ConfigIsExisting("headSelectionsToHide"))
5984 {
5987 }
5988
5990 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5991 {
5993 }
5994
5996
5997 m_IsResultOfSplit = false;
5998
6000 }
6001
6003 {
6004 super.InitItemVariables();
6005
6011 m_Count = ConfigGetInt(
"count");
6012
6015
6020
6023
6028
6040
6044
6045
6048 if (ConfigIsExisting("canBeSplit"))
6049 {
6052 }
6053
6055 if (ConfigIsExisting("itemBehaviour"))
6057
6058
6061 RegisterNetSyncVariableInt("m_VarLiquidType");
6062 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6063
6064 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6065 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6066 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6067
6068 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6069 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6070 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6071 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6072
6073 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6074 RegisterNetSyncVariableBool("m_IsTakeable");
6075 RegisterNetSyncVariableBool("m_IsHologram");
6076
6079 {
6082 }
6083
6085
6087 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6089
6090 }
6091
6093 {
6095 }
6096
6098 {
6101 {
6106 }
6107 }
6108
6109 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6110 {
6112 {
6115 }
6116
6118 }
6119
6121 {
6127 }
6128
6130
6132 {
6134
6135 if (!action)
6136 {
6137 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6138 return;
6139 }
6140
6142 if (!ai)
6143 {
6145 return;
6146 }
6147
6149 if (!action_array)
6150 {
6151 action_array = new array<ActionBase_Basic>;
6153 }
6154 if (LogManager.IsActionLogEnable())
6155 {
6156 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6157 }
6158
6159 if (action_array.Find(action) != -1)
6160 {
6161 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6162 }
6163 else
6164 {
6165 action_array.Insert(action);
6166 }
6167 }
6168
6170 {
6172 ActionBase action = player.GetActionManager().GetAction(actionName);
6175
6176 if (action_array)
6177 {
6178 action_array.RemoveItem(action);
6179 }
6180 }
6181
6182
6183
6185 {
6186 ActionOverrideData overrideData = new ActionOverrideData();
6190
6192 if (!actionMap)
6193 {
6196 }
6197
6198 actionMap.Insert(this.
Type(), overrideData);
6199
6200 }
6201
6203
6205
6206
6208 {
6211
6214
6215 string config_to_search = "CfgVehicles";
6216 string muzzle_owner_config;
6217
6219 {
6220 if (IsInherited(Weapon))
6221 config_to_search = "CfgWeapons";
6222
6223 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6224
6225 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6226
6228
6229 if (config_OnFire_subclass_count > 0)
6230 {
6231 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6232
6233 for (int i = 0; i < config_OnFire_subclass_count; i++)
6234 {
6235 string particle_class = "";
6237 string config_OnFire_entry = config_OnFire_class + particle_class;
6238 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6239 WPOF_array.Insert(WPOF);
6240 }
6241
6242
6244 }
6245 }
6246
6248 {
6249 config_to_search = "CfgWeapons";
6250 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6251
6252 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6253
6255
6256 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6257 {
6258 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6259
6260 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6261 {
6262 string particle_class2 = "";
6264 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6265 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6266 WPOBE_array.Insert(WPOBE);
6267 }
6268
6269
6271 }
6272 }
6273 }
6274
6275
6277 {
6280
6282 {
6283 string config_to_search = "CfgVehicles";
6284
6285 if (IsInherited(Weapon))
6286 config_to_search = "CfgWeapons";
6287
6288 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6289 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6290
6291 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6292 {
6293
6295
6297 {
6299 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6301 return;
6302 }
6303
6306
6307
6308
6310 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6311
6312 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6313 {
6314 string particle_class = "";
6316 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6318
6319 if (entry_type == CT_CLASS)
6320 {
6321 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6322 WPOOH_array.Insert(WPOF);
6323 }
6324 }
6325
6326
6328 }
6329 }
6330 }
6331
6333 {
6335 }
6336
6338 {
6340 {
6342
6345
6348
6349 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6350 }
6351 }
6352
6354 {
6356 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6357
6359 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6360
6362 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6363
6365 {
6367 }
6368 }
6369
6371 {
6373 }
6374
6376 {
6379 else
6381
6383 {
6386 }
6387 else
6388 {
6391
6394 }
6395
6397 }
6398
6400 {
6402 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6403 }
6404
6406 {
6408 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6410 }
6411
6413 {
6415 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6416 }
6417
6419 {
6422
6423 OverheatingParticle OP = new OverheatingParticle();
6428
6430 }
6431
6433 {
6436
6437 return -1;
6438 }
6439
6441 {
6443 {
6446
6447 for (int i = count; i > 0; --i)
6448 {
6449 int id = i - 1;
6452
6455
6456 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6457 {
6458 if (p)
6459 {
6462 }
6463 }
6464 }
6465 }
6466 }
6467
6469 {
6471 {
6473 {
6474 int id = i - 1;
6476
6477 if (OP)
6478 {
6480
6481 if (p)
6482 {
6484 }
6485
6486 delete OP;
6487 }
6488 }
6489
6492 }
6493 }
6494
6497 {
6498 return 0.0;
6499 }
6500
6501
6503 {
6504 return 250;
6505 }
6506
6508 {
6509 return 0;
6510 }
6511
6514 {
6516 return true;
6517
6518 return false;
6519 }
6520
6523 {
6526
6528 {
6530 }
6531 else
6532 {
6533
6535 }
6536
6538 }
6539
6546 {
6547 return -1;
6548 }
6549
6550
6551
6552
6554 {
6556 {
6558 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6559
6560 if (r_index >= 0)
6561 {
6562 InventoryLocation r_il = new InventoryLocation;
6563 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6564
6565 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6568 {
6569 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6570 }
6572 {
6573 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6574 }
6575
6576 }
6577
6578 player.GetHumanInventory().ClearUserReservedLocation(this);
6579 }
6580
6583 }
6584
6585
6586
6587
6589 {
6590 return ItemBase.m_DebugActionsMask;
6591 }
6592
6594 {
6595 return ItemBase.m_DebugActionsMask & mask;
6596 }
6597
6599 {
6600 ItemBase.m_DebugActionsMask = mask;
6601 }
6602
6604 {
6605 ItemBase.m_DebugActionsMask |= mask;
6606 }
6607
6609 {
6610 ItemBase.m_DebugActionsMask &= ~mask;
6611 }
6612
6614 {
6616 {
6618 }
6619 else
6620 {
6622 }
6623 }
6624
6625
6627 {
6628 if (GetEconomyProfile())
6629 {
6630 float q_max = GetEconomyProfile().GetQuantityMax();
6631 if (q_max > 0)
6632 {
6633 float q_min = GetEconomyProfile().GetQuantityMin();
6634 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6635
6637 {
6638 ComponentEnergyManager comp = GetCompEM();
6640 {
6642 }
6643 }
6645 {
6647
6648 }
6649
6650 }
6651 }
6652 }
6653
6656 {
6657 EntityAI parent = GetHierarchyParent();
6658
6659 if (parent)
6660 {
6661 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6662 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6663 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6664 }
6665 }
6666
6669 {
6670 EntityAI parent = GetHierarchyParent();
6671
6672 if (parent)
6673 {
6674 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6675 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6676 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6677 }
6678 }
6679
6681 {
6682
6683
6684
6685
6687
6689 {
6690 if (ScriptInputUserData.CanStoreInputUserData())
6691 {
6692 ScriptInputUserData ctx = new ScriptInputUserData;
6698 ctx.
Write(use_stack_max);
6701
6703 {
6704 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6705 }
6706 }
6707 }
6708 else if (!
GetGame().IsMultiplayer())
6709 {
6711 }
6712 }
6713
6715 {
6717 }
6718
6720 {
6722 }
6723
6725 {
6727 }
6728
6730 {
6731
6732 return false;
6733 }
6734
6736 {
6737 return false;
6738 }
6739
6743 {
6744 return false;
6745 }
6746
6748 {
6749 return "";
6750 }
6751
6753
6755 {
6756 return false;
6757 }
6758
6760 {
6761 return true;
6762 }
6763
6764
6765
6767 {
6768 return true;
6769 }
6770
6772 {
6773 return true;
6774 }
6775
6777 {
6778 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6780 }
6781
6783 {
6785 }
6786
6788 {
6790 if (!is_being_placed)
6792 SetSynchDirty();
6793 }
6794
6795
6797
6799 {
6801 }
6802
6804 {
6806 }
6807
6809 {
6810 return 1;
6811 }
6812
6814 {
6815 return false;
6816 }
6817
6819 {
6821 SetSynchDirty();
6822 }
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6859 {
6860 super.OnMovedInsideCargo(container);
6861
6862 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6863 }
6864
6865 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6866 {
6867 super.EEItemLocationChanged(oldLoc,newLoc);
6868
6869 PlayerBase new_player = null;
6870 PlayerBase old_player = null;
6871
6872 if (newLoc.GetParent())
6873 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6874
6875 if (oldLoc.GetParent())
6876 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6877
6879 {
6880 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6881
6882 if (r_index >= 0)
6883 {
6884 InventoryLocation r_il = new InventoryLocation;
6885 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6886
6887 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6890 {
6891 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6892 }
6894 {
6895 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6896 }
6897
6898 }
6899 }
6900
6902 {
6903 if (new_player)
6904 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6905
6906 if (new_player == old_player)
6907 {
6908
6909 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6910 {
6912 {
6913 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6914 {
6915 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6916 }
6917 }
6918 else
6919 {
6920 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6921 }
6922 }
6923
6924 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6925 {
6926 int type = oldLoc.GetType();
6928 {
6929 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6930 }
6932 {
6933 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6934 }
6935 }
6936 if (!m_OldLocation)
6937 {
6938 m_OldLocation = new InventoryLocation;
6939 }
6940 m_OldLocation.Copy(oldLoc);
6941 }
6942 else
6943 {
6944 if (m_OldLocation)
6945 {
6946 m_OldLocation.Reset();
6947 }
6948 }
6949
6951 }
6952 else
6953 {
6954 if (new_player)
6955 {
6956 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6957 if (res_index >= 0)
6958 {
6959 InventoryLocation il = new InventoryLocation;
6960 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6962 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6965 {
6966 il.
GetParent().GetOnReleaseLock().Invoke(it);
6967 }
6969 {
6971 }
6972
6973 }
6974 }
6976 {
6977
6979 }
6980
6981 if (m_OldLocation)
6982 {
6983 m_OldLocation.Reset();
6984 }
6985 }
6986 }
6987
6988 override void EOnContact(IEntity other, Contact extra)
6989 {
6991 {
6992 int liquidType = -1;
6994 if (impactSpeed > 0.0)
6995 {
6997 #ifndef SERVER
6999 #else
7001 SetSynchDirty();
7002 #endif
7004 }
7005 }
7006
7007 #ifdef SERVER
7008 if (GetCompEM() && GetCompEM().IsPlugged())
7009 {
7010 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7011 GetCompEM().UnplugThis();
7012 }
7013 #endif
7014 }
7015
7017
7019 {
7021 }
7022
7024 {
7025
7026 }
7027
7029 {
7030 super.OnItemLocationChanged(old_owner, new_owner);
7031
7032 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7033 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7034
7035 if (!relatedPlayer && playerNew)
7036 relatedPlayer = playerNew;
7037
7038 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7039 {
7041 if (actionMgr)
7042 {
7043 ActionBase currentAction = actionMgr.GetRunningAction();
7044 if (currentAction)
7046 }
7047 }
7048
7049 Man ownerPlayerOld = null;
7050 Man ownerPlayerNew = null;
7051
7052 if (old_owner)
7053 {
7054 if (old_owner.
IsMan())
7055 {
7056 ownerPlayerOld = Man.Cast(old_owner);
7057 }
7058 else
7059 {
7060 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7061 }
7062 }
7063 else
7064 {
7066 {
7068
7069 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7070 {
7071 GetCompEM().UnplugThis();
7072 }
7073 }
7074 }
7075
7076 if (new_owner)
7077 {
7078 if (new_owner.
IsMan())
7079 {
7080 ownerPlayerNew = Man.Cast(new_owner);
7081 }
7082 else
7083 {
7084 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7085 }
7086 }
7087
7088 if (ownerPlayerOld != ownerPlayerNew)
7089 {
7090 if (ownerPlayerOld)
7091 {
7092 array<EntityAI> subItemsExit = new array<EntityAI>;
7094 for (int i = 0; i < subItemsExit.Count(); i++)
7095 {
7098 }
7099 }
7100
7101 if (ownerPlayerNew)
7102 {
7103 array<EntityAI> subItemsEnter = new array<EntityAI>;
7105 for (int j = 0; j < subItemsEnter.Count(); j++)
7106 {
7109 }
7110 }
7111 }
7112 else if (ownerPlayerNew != null)
7113 {
7114 PlayerBase nplayer;
7115 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7116 {
7117 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7119 for (int k = 0; k < subItemsUpdate.Count(); k++)
7120 {
7122 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7123 }
7124 }
7125 }
7126
7127 if (old_owner)
7128 old_owner.OnChildItemRemoved(this);
7129 if (new_owner)
7130 new_owner.OnChildItemReceived(this);
7131 }
7132
7133
7135 {
7136 super.EEDelete(parent);
7137 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7138 if (player)
7139 {
7141
7142 if (player.IsAlive())
7143 {
7144 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7145 if (r_index >= 0)
7146 {
7147 InventoryLocation r_il = new InventoryLocation;
7148 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7149
7150 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7153 {
7154 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7155 }
7157 {
7158 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7159 }
7160
7161 }
7162
7163 player.RemoveQuickBarEntityShortcut(this);
7164 }
7165 }
7166 }
7167
7169 {
7170 super.EEKilled(killer);
7171
7174 {
7175 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7176 {
7177 if (IsMagazine())
7178 {
7179 if (Magazine.Cast(this).GetAmmoCount() > 0)
7180 {
7182 }
7183 }
7184 else
7185 {
7187 }
7188 }
7189 }
7190 }
7191
7193 {
7194 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7195
7196 super.OnWasAttached(parent, slot_id);
7197
7200
7202 }
7203
7205 {
7206 super.OnWasDetached(parent, slot_id);
7207
7210 }
7211
7213 {
7214 int idx;
7217
7218 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7219 if (inventory_slots.Count() < 1)
7220 {
7221 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7222 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7223 }
7224 else
7225 {
7226 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7227 }
7228
7229 idx = inventory_slots.Find(slot);
7230 if (idx < 0)
7231 return "";
7232
7233 return attach_types.Get(idx);
7234 }
7235
7237 {
7238 int idx = -1;
7239 string slot;
7240
7243
7244 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7245 if (inventory_slots.Count() < 1)
7246 {
7247 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7248 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7249 }
7250 else
7251 {
7252 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7253 if (detach_types.Count() < 1)
7254 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7255 }
7256
7257 for (int i = 0; i < inventory_slots.Count(); i++)
7258 {
7259 slot = inventory_slots.Get(i);
7260 }
7261
7262 if (slot != "")
7263 {
7264 if (detach_types.Count() == 1)
7265 idx = 0;
7266 else
7267 idx = inventory_slots.Find(slot);
7268 }
7269 if (idx < 0)
7270 return "";
7271
7272 return detach_types.Get(idx);
7273 }
7274
7276 {
7277
7279
7280
7281 float min_time = 1;
7282 float max_time = 3;
7283 float delay = Math.RandomFloat(min_time, max_time);
7284
7285 explode_timer.Run(delay, this, "DoAmmoExplosion");
7286 }
7287
7289 {
7290 Magazine magazine = Magazine.Cast(this);
7291 int pop_sounds_count = 6;
7292 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7293
7294
7295 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7296 string sound_name = pop_sounds[ sound_idx ];
7298
7299
7300 magazine.ServerAddAmmoCount(-1);
7301
7302
7303 float min_temp_to_explode = 100;
7304
7305 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7306 {
7308 }
7309 }
7310
7311
7312 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7313 {
7314 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7315
7316 const int CHANCE_DAMAGE_CARGO = 4;
7317 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7318 const int CHANCE_DAMAGE_NOTHING = 2;
7319
7321 {
7322 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7323 int chances;
7324 int rnd;
7325
7326 if (GetInventory().GetCargo())
7327 {
7328 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7329 rnd = Math.RandomInt(0,chances);
7330
7331 if (rnd < CHANCE_DAMAGE_CARGO)
7332 {
7334 }
7335 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7336 {
7338 }
7339 }
7340 else
7341 {
7342 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7343 rnd = Math.RandomInt(0,chances);
7344
7345 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7346 {
7348 }
7349 }
7350 }
7351 }
7352
7354 {
7355 if (GetInventory().GetCargo())
7356 {
7357 int item_count = GetInventory().GetCargo().GetItemCount();
7358 if (item_count > 0)
7359 {
7360 int random_pick = Math.RandomInt(0, item_count);
7362 if (!item.IsExplosive())
7363 {
7364 item.AddHealth("","",damage);
7365 return true;
7366 }
7367 }
7368 }
7369 return false;
7370 }
7371
7373 {
7374 int attachment_count = GetInventory().AttachmentCount();
7375 if (attachment_count > 0)
7376 {
7377 int random_pick = Math.RandomInt(0, attachment_count);
7378 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7379 if (!attachment.IsExplosive())
7380 {
7381 attachment.AddHealth("","",damage);
7382 return true;
7383 }
7384 }
7385 return false;
7386 }
7387
7389 {
7391 }
7392
7394 {
7396 return GetInventory().CanRemoveEntity();
7397
7398 return false;
7399 }
7400
7402 {
7403
7405 return false;
7406
7407
7409 return false;
7410
7411
7412
7414 if (delta == 0)
7415 return false;
7416
7417
7418 return true;
7419 }
7420
7422 {
7424 {
7425 if (ScriptInputUserData.CanStoreInputUserData())
7426 {
7427 ScriptInputUserData ctx = new ScriptInputUserData;
7432 ctx.
Write(destination_entity);
7436 }
7437 }
7438 else if (!
GetGame().IsMultiplayer())
7439 {
7441 }
7442 }
7443
7445 {
7446 float split_quantity_new;
7450 InventoryLocation loc = new InventoryLocation;
7451
7452 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7453 {
7455 split_quantity_new = stack_max;
7456 else
7458
7460 {
7461 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7462 if (new_item)
7463 {
7464 new_item.SetResultOfSplit(true);
7465 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7467 new_item.
SetQuantity(split_quantity_new,
false,
true);
7468 }
7469 }
7470 }
7471 else if (destination_entity && slot_id == -1)
7472 {
7473 if (quantity > stack_max)
7474 split_quantity_new = stack_max;
7475 else
7476 split_quantity_new = quantity;
7477
7479 {
7481 {
7484 }
7485
7486 if (new_item)
7487 {
7488 new_item.SetResultOfSplit(true);
7489 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7491 new_item.
SetQuantity(split_quantity_new,
false,
true);
7492 }
7493 }
7494 }
7495 else
7496 {
7497 if (stack_max != 0)
7498 {
7500 {
7502 }
7503
7504 if (split_quantity_new == 0)
7505 {
7506 if (!
GetGame().IsMultiplayer())
7507 player.PhysicalPredictiveDropItem(this);
7508 else
7509 player.ServerDropEntity(this);
7510 return;
7511 }
7512
7514 {
7516
7517 if (new_item)
7518 {
7519 new_item.SetResultOfSplit(true);
7520 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7523 new_item.PlaceOnSurface();
7524 }
7525 }
7526 }
7527 }
7528 }
7529
7531 {
7532 float split_quantity_new;
7536 InventoryLocation loc = new InventoryLocation;
7537
7538 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7539 {
7541 split_quantity_new = stack_max;
7542 else
7544
7546 {
7547 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7548 if (new_item)
7549 {
7550 new_item.SetResultOfSplit(true);
7551 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7553 new_item.
SetQuantity(split_quantity_new,
false,
true);
7554 }
7555 }
7556 }
7557 else if (destination_entity && slot_id == -1)
7558 {
7559 if (quantity > stack_max)
7560 split_quantity_new = stack_max;
7561 else
7562 split_quantity_new = quantity;
7563
7565 {
7567 {
7570 }
7571
7572 if (new_item)
7573 {
7574 new_item.SetResultOfSplit(true);
7575 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7577 new_item.
SetQuantity(split_quantity_new,
false,
true);
7578 }
7579 }
7580 }
7581 else
7582 {
7583 if (stack_max != 0)
7584 {
7586 {
7588 }
7589
7591 {
7593
7594 if (new_item)
7595 {
7596 new_item.SetResultOfSplit(true);
7597 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7600 new_item.PlaceOnSurface();
7601 }
7602 }
7603 }
7604 }
7605 }
7606
7608 {
7610 {
7611 if (ScriptInputUserData.CanStoreInputUserData())
7612 {
7613 ScriptInputUserData ctx = new ScriptInputUserData;
7618 dst.WriteToContext(ctx);
7620 }
7621 }
7622 else if (!
GetGame().IsMultiplayer())
7623 {
7625 }
7626 }
7627
7629 {
7631 {
7632 if (ScriptInputUserData.CanStoreInputUserData())
7633 {
7634 ScriptInputUserData ctx = new ScriptInputUserData;
7639 ctx.
Write(destination_entity);
7645 }
7646 }
7647 else if (!
GetGame().IsMultiplayer())
7648 {
7650 }
7651 }
7652
7654 {
7656 }
7657
7659 {
7661 float split_quantity_new;
7663 if (dst.IsValid())
7664 {
7665 int slot_id = dst.GetSlot();
7667
7668 if (quantity > stack_max)
7669 split_quantity_new = stack_max;
7670 else
7671 split_quantity_new = quantity;
7672
7674 {
7676
7677 if (new_item)
7678 {
7679 new_item.SetResultOfSplit(true);
7680 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7682 new_item.
SetQuantity(split_quantity_new,
false,
true);
7683 }
7684
7685 return new_item;
7686 }
7687 }
7688
7689 return null;
7690 }
7691
7693 {
7695 float split_quantity_new;
7697 if (destination_entity)
7698 {
7700 if (quantity > stackable)
7701 split_quantity_new = stackable;
7702 else
7703 split_quantity_new = quantity;
7704
7706 {
7707 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7708 if (new_item)
7709 {
7710 new_item.SetResultOfSplit(true);
7711 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7713 new_item.
SetQuantity(split_quantity_new,
false,
true);
7714 }
7715 }
7716 }
7717 }
7718
7720 {
7722 {
7723 if (ScriptInputUserData.CanStoreInputUserData())
7724 {
7725 ScriptInputUserData ctx = new ScriptInputUserData;
7730 ItemBase destination_entity =
this;
7731 ctx.
Write(destination_entity);
7735 }
7736 }
7737 else if (!
GetGame().IsMultiplayer())
7738 {
7740 }
7741 }
7742
7744 {
7746 float split_quantity_new;
7748 if (player)
7749 {
7751 if (quantity > stackable)
7752 split_quantity_new = stackable;
7753 else
7754 split_quantity_new = quantity;
7755
7757 {
7758 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7759 new_item =
ItemBase.Cast(in_hands);
7760 if (new_item)
7761 {
7762 new_item.SetResultOfSplit(true);
7763 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7765 new_item.SetQuantity(split_quantity_new, false, true);
7766 }
7767 }
7768 }
7769 }
7770
7772 {
7774 float split_quantity_new = Math.Floor(quantity * 0.5);
7775
7777 return;
7778
7780
7781 if (new_item)
7782 {
7783 if (new_item.GetQuantityMax() < split_quantity_new)
7784 {
7785 split_quantity_new = new_item.GetQuantityMax();
7786 }
7787
7788 new_item.SetResultOfSplit(true);
7789 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7790
7792 {
7795 }
7796 else
7797 {
7799 new_item.
SetQuantity(split_quantity_new,
false,
true);
7800 }
7801 }
7802 }
7803
7805 {
7807 float split_quantity_new = Math.Floor(quantity / 2);
7808
7810 return;
7811
7812 InventoryLocation invloc = new InventoryLocation;
7814
7816 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7817
7818 if (new_item)
7819 {
7820 if (new_item.GetQuantityMax() < split_quantity_new)
7821 {
7822 split_quantity_new = new_item.GetQuantityMax();
7823 }
7825 {
7828 }
7829 else if (split_quantity_new > 1)
7830 {
7832 new_item.
SetQuantity(split_quantity_new,
false,
true);
7833 }
7834 }
7835 }
7836
7839 {
7840 SetWeightDirty();
7842
7843 if (parent)
7844 parent.OnAttachmentQuantityChangedEx(this, delta);
7845
7847 {
7849 {
7851 }
7853 {
7854 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7856 }
7857 }
7858
7859 }
7860
7863 {
7864
7865 }
7866
7869 {
7871 }
7872
7874 {
7875 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7876
7878 {
7879 if (newLevel == GameConstants.STATE_RUINED)
7880 {
7882 EntityAI parent = GetHierarchyParent();
7883 if (parent && parent.IsFireplace())
7884 {
7885 CargoBase cargo = GetInventory().GetCargo();
7886 if (cargo)
7887 {
7889 {
7891 }
7892 }
7893 }
7894 }
7895
7897 {
7898
7900 return;
7901 }
7902
7903 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7904 {
7906 }
7907 }
7908 }
7909
7910
7912 {
7913 super.OnRightClick();
7914
7916 {
7918 {
7919 if (ScriptInputUserData.CanStoreInputUserData())
7920 {
7921 EntityAI root = GetHierarchyRoot();
7922 Man playerOwner = GetHierarchyRootPlayer();
7923 InventoryLocation dst = new InventoryLocation;
7924
7925
7926 if (!playerOwner && root && root == this)
7927 {
7929 }
7930 else
7931 {
7932
7933 GetInventory().GetCurrentInventoryLocation(dst);
7935 {
7938 {
7940 }
7941 else
7942 {
7944
7945
7946 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7947 {
7949 }
7950 else
7951 {
7952 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7953 }
7954 }
7955 }
7956 }
7957
7958 ScriptInputUserData ctx = new ScriptInputUserData;
7966 }
7967 }
7968 else if (!
GetGame().IsMultiplayer())
7969 {
7971 }
7972 }
7973 }
7974
7976 {
7977 if (root)
7978 {
7979 vector m4[4];
7980 root.GetTransform(m4);
7981 dst.SetGround(this, m4);
7982 }
7983 else
7984 {
7985 GetInventory().GetCurrentInventoryLocation(dst);
7986 }
7987 }
7988
7989 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
7990 {
7991
7992 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
7993 return false;
7994
7995 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
7996 return false;
7997
7998
8000 return false;
8001
8002
8003 Magazine mag = Magazine.Cast(this);
8004 if (mag)
8005 {
8006 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8007 return false;
8008
8009 if (stack_max_limit)
8010 {
8011 Magazine other_mag = Magazine.Cast(other_item);
8012 if (other_item)
8013 {
8014 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8015 return false;
8016 }
8017
8018 }
8019 }
8020 else
8021 {
8022
8024 return false;
8025
8027 return false;
8028 }
8029
8030 PlayerBase player = null;
8031 if (CastTo(player, GetHierarchyRootPlayer()))
8032 {
8033 if (player.GetInventory().HasAttachment(this))
8034 return false;
8035
8036 if (player.IsItemsToDelete())
8037 return false;
8038 }
8039
8040 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8041 return false;
8042
8043 int slotID;
8045 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8046 return false;
8047
8048 return true;
8049 }
8050
8052 {
8054 }
8055
8057 {
8058 return m_IsResultOfSplit;
8059 }
8060
8062 {
8063 m_IsResultOfSplit = value;
8064 }
8065
8067 {
8069 }
8070
8072 {
8073 float other_item_quantity = other_item.GetQuantity();
8074 float this_free_space;
8075
8077
8079
8080 if (other_item_quantity > this_free_space)
8081 {
8082 return this_free_space;
8083 }
8084 else
8085 {
8086 return other_item_quantity;
8087 }
8088 }
8089
8091 {
8093 }
8094
8096 {
8098 return;
8099
8100 if (!IsMagazine() && other_item)
8101 {
8103 if (quantity_used != 0)
8104 {
8105 float hp1 = GetHealth01("","");
8106 float hp2 = other_item.GetHealth01("","");
8107 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8108 hpResult = hpResult / (
GetQuantity() + quantity_used);
8109
8110 hpResult *= GetMaxHealth();
8111 Math.Round(hpResult);
8112 SetHealth("", "Health", hpResult);
8113
8115 other_item.AddQuantity(-quantity_used);
8116 }
8117 }
8119 }
8120
8122 {
8123 #ifdef SERVER
8124 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8125 GetHierarchyParent().IncreaseLifetimeUp();
8126 #endif
8127 };
8128
8130 {
8131 PlayerBase p = PlayerBase.Cast(player);
8132
8133 array<int> recipesIds = p.m_Recipes;
8134 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8135 if (moduleRecipesManager)
8136 {
8137 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8138 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8139 }
8140
8141 for (int i = 0;i < recipesIds.Count(); i++)
8142 {
8143 int key = recipesIds.Get(i);
8144 string recipeName = moduleRecipesManager.GetRecipeName(key);
8146 }
8147 }
8148
8149
8150 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8151 {
8152 super.GetDebugActions(outputList);
8153
8154
8160
8161
8166
8171
8172
8176
8177
8179 {
8183 }
8184
8187
8188
8192
8194
8195 InventoryLocation loc = new InventoryLocation();
8196 GetInventory().GetCurrentInventoryLocation(loc);
8198 {
8199 if (Gizmo_IsSupported())
8202 }
8203
8205 }
8206
8207
8208
8209
8211 {
8212 super.OnAction(action_id, player, ctx);
8213
8215 {
8216 switch (action_id)
8217 {
8220 return true;
8223 return true;
8224 }
8225 }
8226
8228 {
8229 switch (action_id)
8230 {
8232 Delete();
8233 return true;
8234 }
8235 }
8236
8237 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8238 {
8239 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8240 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8241 PlayerBase p = PlayerBase.Cast(player);
8242 if (
EActions.RECIPES_RANGE_START < 1000)
8243 {
8244 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8245 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8246 }
8247 }
8248 #ifndef SERVER
8249 else if (action_id ==
EActions.WATCH_PLAYER)
8250 {
8251 PluginDeveloper.SetDeveloperItemClientEx(player);
8252 }
8253 #endif
8255 {
8256 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8257 {
8258 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8259 OnDebugButtonPressServer(id + 1);
8260 }
8261
8262 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8263 {
8264 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8266 }
8267
8268 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8269 {
8270 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8272 }
8273
8274 else if (action_id ==
EActions.ADD_QUANTITY)
8275 {
8276 if (IsMagazine())
8277 {
8278 Magazine mag = Magazine.Cast(this);
8279 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8280 }
8281 else
8282 {
8284 }
8285
8286 if (m_EM)
8287 {
8288 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8289 }
8290
8291 }
8292
8293 else if (action_id ==
EActions.REMOVE_QUANTITY)
8294 {
8295 if (IsMagazine())
8296 {
8297 Magazine mag2 = Magazine.Cast(this);
8298 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8299 }
8300 else
8301 {
8303 }
8304 if (m_EM)
8305 {
8306 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8307 }
8308
8309 }
8310
8311 else if (action_id ==
EActions.SET_QUANTITY_0)
8312 {
8314
8315 if (m_EM)
8316 {
8317 m_EM.SetEnergy(0);
8318 }
8319 }
8320
8321 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8322 {
8324
8325 if (m_EM)
8326 {
8327 m_EM.SetEnergy(m_EM.GetEnergyMax());
8328 }
8329 }
8330
8331 else if (action_id ==
EActions.ADD_HEALTH)
8332 {
8333 AddHealth("","",GetMaxHealth("","Health")/5);
8334 }
8335 else if (action_id ==
EActions.REMOVE_HEALTH)
8336 {
8337 AddHealth("","",-GetMaxHealth("","Health")/5);
8338 }
8339 else if (action_id ==
EActions.DESTROY_HEALTH)
8340 {
8341 SetHealth01("","",0);
8342 }
8343 else if (action_id ==
EActions.WATCH_ITEM)
8344 {
8346 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8347 #ifdef DEVELOPER
8348 SetDebugDeveloper_item(this);
8349 #endif
8350 }
8351
8352 else if (action_id ==
EActions.ADD_TEMPERATURE)
8353 {
8354 AddTemperature(20);
8355
8356 }
8357
8358 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8359 {
8360 AddTemperature(-20);
8361
8362 }
8363
8364 else if (action_id ==
EActions.FLIP_FROZEN)
8365 {
8366 SetFrozen(!GetIsFrozen());
8367
8368 }
8369
8370 else if (action_id ==
EActions.ADD_WETNESS)
8371 {
8373
8374 }
8375
8376 else if (action_id ==
EActions.REMOVE_WETNESS)
8377 {
8379
8380 }
8381
8382 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8383 {
8386
8387
8388 }
8389
8390 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8391 {
8394 }
8395
8396 else if (action_id ==
EActions.MAKE_SPECIAL)
8397 {
8398 auto debugParams = DebugSpawnParams.WithPlayer(player);
8399 OnDebugSpawnEx(debugParams);
8400 }
8401
8402 }
8403
8404
8405 return false;
8406 }
8407
8408
8409
8410
8414
8417
8418
8419
8421 {
8422 return false;
8423 }
8424
8425
8427 {
8428 return true;
8429 }
8430
8431
8433 {
8434 return true;
8435 }
8436
8437
8438
8440 {
8441 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8443 }
8444
8447 {
8448 return null;
8449 }
8450
8452 {
8453 return false;
8454 }
8455
8457 {
8458 return false;
8459 }
8460
8464
8465
8467 {
8468 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8469 return module_repairing.CanRepair(this, item_repair_kit);
8470 }
8471
8472
8473 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8474 {
8475 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8476 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8477 }
8478
8479
8481 {
8482
8483
8484
8485
8486
8487
8488
8489
8490 return 1;
8491 }
8492
8493
8494
8496 {
8498 }
8499
8500
8501
8503 {
8505 }
8506
8507
8516 {
8517 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8518
8519 if (player)
8520 {
8521 player.MessageStatus(text);
8522 }
8523 }
8524
8525
8534 {
8535 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8536
8537 if (player)
8538 {
8539 player.MessageAction(text);
8540 }
8541 }
8542
8543
8552 {
8553 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8554
8555 if (player)
8556 {
8557 player.MessageFriendly(text);
8558 }
8559 }
8560
8561
8570 {
8571 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8572
8573 if (player)
8574 {
8575 player.MessageImportant(text);
8576 }
8577 }
8578
8580 {
8581 return true;
8582 }
8583
8584
8585 override bool KindOf(
string tag)
8586 {
8587 bool found = false;
8588 string item_name = this.
GetType();
8591
8592 int array_size = item_tag_array.Count();
8593 for (int i = 0; i < array_size; i++)
8594 {
8595 if (item_tag_array.Get(i) == tag)
8596 {
8597 found = true;
8598 break;
8599 }
8600 }
8601 return found;
8602 }
8603
8604
8606 {
8607
8608 super.OnRPC(sender, rpc_type,ctx);
8609
8610
8611 switch (rpc_type)
8612 {
8613 #ifndef SERVER
8614 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8615 Param2<bool, string> p = new Param2<bool, string>(false, "");
8616
8618 return;
8619
8620 bool play = p.param1;
8621 string soundSet = p.param2;
8622
8623 if (play)
8624 {
8626 {
8628 {
8630 }
8631 }
8632 else
8633 {
8635 }
8636 }
8637 else
8638 {
8640 }
8641
8642 break;
8643 #endif
8644
8645 }
8646
8648 {
8650 }
8651 }
8652
8653
8654
8655
8657 {
8658 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8659 return plugin.GetID(
name);
8660 }
8661
8663 {
8664 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8665 return plugin.GetName(id);
8666 }
8667
8670 {
8671
8672
8673 int varFlags;
8674 if (!ctx.
Read(varFlags))
8675 return;
8676
8677 if (varFlags & ItemVariableFlags.FLOAT)
8678 {
8680 }
8681 }
8682
8684 {
8685
8686 super.SerializeNumericalVars(floats_out);
8687
8688
8689
8691 {
8693 }
8694
8696 {
8698 }
8699
8701 {
8703 }
8704
8706 {
8711 }
8712
8714 {
8716 }
8717 }
8718
8720 {
8721
8722 super.DeSerializeNumericalVars(floats);
8723
8724
8725 int index = 0;
8726 int mask = Math.Round(floats.Get(index));
8727
8728 index++;
8729
8731 {
8733 {
8735 }
8736 else
8737 {
8738 float quantity = floats.Get(index);
8740 }
8741 index++;
8742 }
8743
8745 {
8746 float wet = floats.Get(index);
8748 index++;
8749 }
8750
8752 {
8753 int liquidtype = Math.Round(floats.Get(index));
8755 index++;
8756 }
8757
8759 {
8761 index++;
8763 index++;
8765 index++;
8767 index++;
8768 }
8769
8771 {
8772 int cleanness = Math.Round(floats.Get(index));
8774 index++;
8775 }
8776 }
8777
8779 {
8780 super.WriteVarsToCTX(ctx);
8781
8782
8784 {
8786 }
8787
8789 {
8791 }
8792
8794 {
8796 }
8797
8799 {
8800 int r,g,b,a;
8806 }
8807
8809 {
8811 }
8812 }
8813
8815 {
8816 if (!super.ReadVarsFromCTX(ctx,version))
8817 return false;
8818
8819 int intValue;
8820 float value;
8821
8822 if (version < 140)
8823 {
8824 if (!ctx.
Read(intValue))
8825 return false;
8826
8827 m_VariablesMask = intValue;
8828 }
8829
8831 {
8832 if (!ctx.
Read(value))
8833 return false;
8834
8836 {
8838 }
8839 else
8840 {
8842 }
8843 }
8844
8845 if (version < 140)
8846 {
8848 {
8849 if (!ctx.
Read(value))
8850 return false;
8851 SetTemperatureDirect(value);
8852 }
8853 }
8854
8856 {
8857 if (!ctx.
Read(value))
8858 return false;
8860 }
8861
8863 {
8864 if (!ctx.
Read(intValue))
8865 return false;
8867 }
8868
8870 {
8871 int r,g,b,a;
8873 return false;
8875 return false;
8877 return false;
8879 return false;
8880
8882 }
8883
8885 {
8886 if (!ctx.
Read(intValue))
8887 return false;
8889 }
8890
8891 if (version >= 138 && version < 140)
8892 {
8894 {
8895 if (!ctx.
Read(intValue))
8896 return false;
8897 SetFrozen(intValue);
8898 }
8899 }
8900
8901 return true;
8902 }
8903
8904
8906 {
8909 {
8911 }
8912
8913 if (!super.OnStoreLoad(ctx, version))
8914 {
8916 return false;
8917 }
8918
8919 if (version >= 114)
8920 {
8921 bool hasQuickBarIndexSaved;
8922
8923 if (!ctx.
Read(hasQuickBarIndexSaved))
8924 {
8926 return false;
8927 }
8928
8929 if (hasQuickBarIndexSaved)
8930 {
8931 int itmQBIndex;
8932
8933
8934 if (!ctx.
Read(itmQBIndex))
8935 {
8937 return false;
8938 }
8939
8940 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8941 if (itmQBIndex != -1 && parentPlayer)
8942 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8943 }
8944 }
8945 else
8946 {
8947
8948 PlayerBase player;
8949 int itemQBIndex;
8950 if (version ==
int.
MAX)
8951 {
8952 if (!ctx.
Read(itemQBIndex))
8953 {
8955 return false;
8956 }
8957 }
8958 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8959 {
8960
8961 if (!ctx.
Read(itemQBIndex))
8962 {
8964 return false;
8965 }
8966 if (itemQBIndex != -1 && player)
8967 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8968 }
8969 }
8970
8971 if (version < 140)
8972 {
8973
8974 if (!LoadVariables(ctx, version))
8975 {
8977 return false;
8978 }
8979 }
8980
8981
8983 {
8985 return false;
8986 }
8987 if (version >= 132)
8988 {
8990 if (raib)
8991 {
8993 {
8995 return false;
8996 }
8997 }
8998 }
8999
9001 return true;
9002 }
9003
9004
9005
9007 {
9008 super.OnStoreSave(ctx);
9009
9010 PlayerBase player;
9011 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9012 {
9014
9015 int itemQBIndex = -1;
9016 itemQBIndex = player.FindQuickBarEntityIndex(this);
9017 ctx.
Write(itemQBIndex);
9018 }
9019 else
9020 {
9022 }
9023
9025
9027 if (raib)
9028 {
9030 }
9031 }
9032
9033
9035 {
9036 super.AfterStoreLoad();
9037
9039 {
9041 }
9042
9044 {
9047 }
9048 }
9049
9051 {
9052 super.EEOnAfterLoad();
9053
9055 {
9057 }
9058
9061 }
9062
9064 {
9065 return false;
9066 }
9067
9068
9069
9071 {
9073 {
9074 #ifdef PLATFORM_CONSOLE
9075
9077 {
9079 if (menu)
9080 {
9082 }
9083 }
9084 #endif
9085 }
9086
9088 {
9091 }
9092
9094 {
9095 SetWeightDirty();
9097 }
9099 {
9102 }
9103
9105 {
9108 }
9110 {
9113 }
9114
9115 super.OnVariablesSynchronized();
9116 }
9117
9118
9119
9121 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9122 {
9123 if (!IsServerCheck(allow_client))
9124 return false;
9125
9127 return false;
9128
9131
9132 if (value <= (min + 0.001))
9133 value = min;
9134
9135 if (value == min)
9136 {
9137 if (destroy_config)
9138 {
9139 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9140 if (dstr)
9141 {
9143 this.Delete();
9144 return true;
9145 }
9146 }
9147 else if (destroy_forced)
9148 {
9150 this.Delete();
9151 return true;
9152 }
9153
9155 }
9156
9159
9161 {
9163
9164 if (delta)
9166 }
9167
9169
9170 return false;
9171 }
9172
9173
9175 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9176 {
9178 }
9179
9181 {
9184 }
9185
9187 {
9190 }
9191
9193 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9194 {
9195 float value_clamped = Math.Clamp(value, 0, 1);
9197 SetQuantity(result, destroy_config, destroy_forced);
9198 }
9199
9200
9203 {
9205 }
9206
9208 {
9210 }
9211
9212
9213
9214
9215
9216
9217
9218
9219
9220
9222 {
9223 int slot = -1;
9224 if (GetInventory())
9225 {
9226 InventoryLocation il = new InventoryLocation;
9227 GetInventory().GetCurrentInventoryLocation(il);
9229 }
9230
9232 }
9233
9235 {
9236 float quantity_max = 0;
9237
9239 {
9240 if (attSlotID != -1)
9241 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9242
9243 if (quantity_max <= 0)
9245 }
9246
9247 if (quantity_max <= 0)
9249
9250 return quantity_max;
9251 }
9252
9254 {
9256 }
9257
9259 {
9261 }
9262
9263
9265 {
9267 }
9268
9270 {
9272 }
9273
9275 {
9277 }
9278
9279
9281 {
9282
9283 float weightEx = GetWeightEx();
9284 float special = GetInventoryAndCargoWeight();
9285 return weightEx - special;
9286 }
9287
9288
9290 {
9292 }
9293
9295 {
9297 {
9298 #ifdef DEVELOPER
9299 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9300 {
9301 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9303 }
9304 #endif
9305
9307 }
9308 else if (HasEnergyManager())
9309 {
9310 #ifdef DEVELOPER
9311 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9312 {
9313 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9314 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9315 }
9316 #endif
9317 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9318 }
9319 else
9320 {
9321 #ifdef DEVELOPER
9322 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9323 {
9324 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9325 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9326 }
9327 #endif
9328 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9329 }
9330 }
9331
9334 {
9335 int item_count = 0;
9337
9338 if (GetInventory().GetCargo() != NULL)
9339 {
9340 item_count = GetInventory().GetCargo().GetItemCount();
9341 }
9342
9343 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9344 {
9345 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9346 if (item)
9347 item_count += item.GetNumberOfItems();
9348 }
9349 return item_count;
9350 }
9351
9354 {
9355 float weight = 0;
9356 float wetness = 1;
9357 if (include_wetness)
9360 {
9361 weight = wetness * m_ConfigWeight;
9362 }
9364 {
9365 weight = 1;
9366 }
9367 return weight;
9368 }
9369
9370
9371
9373 {
9374 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9375 {
9376 GameInventory inv = GetInventory();
9377 array<EntityAI> items = new array<EntityAI>;
9379 for (int i = 0; i < items.Count(); i++)
9380 {
9382 if (item)
9383 {
9385 }
9386 }
9387 }
9388 }
9389
9390
9391
9392
9394 {
9395 float energy = 0;
9396 if (HasEnergyManager())
9397 {
9398 energy = GetCompEM().GetEnergy();
9399 }
9400 return energy;
9401 }
9402
9403
9405 {
9406 super.OnEnergyConsumed();
9407
9409 }
9410
9412 {
9413 super.OnEnergyAdded();
9414
9416 }
9417
9418
9420 {
9421 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9422 {
9424 {
9425 float energy_0to1 = GetCompEM().GetEnergy0To1();
9427 }
9428 }
9429 }
9430
9431
9433 {
9434 return ConfigGetFloat("heatIsolation");
9435 }
9436
9438 {
9440 }
9441
9443 {
9444 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9445 if (
GetGame().ConfigIsExisting(paramPath))
9447
9448 return 0.0;
9449 }
9450
9452 {
9453 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9454 if (
GetGame().ConfigIsExisting(paramPath))
9456
9457 return 0.0;
9458 }
9459
9460 override void SetWet(
float value,
bool allow_client =
false)
9461 {
9462 if (!IsServerCheck(allow_client))
9463 return;
9464
9467
9469
9470 m_VarWet = Math.Clamp(value, min, max);
9471
9473 {
9476 }
9477 }
9478
9479 override void AddWet(
float value)
9480 {
9482 }
9483
9485 {
9487 }
9488
9490 {
9492 }
9493
9495 {
9497 }
9498
9500 {
9502 }
9503
9505 {
9507 }
9508
9510 {
9513 if (newLevel != oldLevel)
9514 {
9516 }
9517 }
9518
9520 {
9521 SetWeightDirty();
9522 }
9523
9525 {
9526 return GetWetLevelInternal(
m_VarWet);
9527 }
9528
9529
9530
9532 {
9534 }
9535
9537 {
9539 }
9540
9542 {
9544 }
9545
9547 {
9549 }
9550
9551
9552
9554 {
9555 if (ConfigIsExisting("itemModelLength"))
9556 {
9557 return ConfigGetFloat("itemModelLength");
9558 }
9559 return 0;
9560 }
9561
9563 {
9564 if (ConfigIsExisting("itemAttachOffset"))
9565 {
9566 return ConfigGetFloat("itemAttachOffset");
9567 }
9568 return 0;
9569 }
9570
9571 override void SetCleanness(
int value,
bool allow_client =
false)
9572 {
9573 if (!IsServerCheck(allow_client))
9574 return;
9575
9577
9579
9582 }
9583
9585 {
9587 }
9588
9590 {
9591 return true;
9592 }
9593
9594
9595
9596
9598 {
9600 }
9601
9603 {
9605 }
9606
9607
9608
9609
9610 override void SetColor(
int r,
int g,
int b,
int a)
9611 {
9617 }
9619 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9620 {
9625 }
9626
9628 {
9630 }
9631
9634 {
9635 int r,g,b,a;
9637 r = r/255;
9638 g = g/255;
9639 b = b/255;
9640 a = a/255;
9641 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9642 }
9643
9644
9645
9646 override void SetLiquidType(
int value,
bool allow_client =
false)
9647 {
9648 if (!IsServerCheck(allow_client))
9649 return;
9650
9655 }
9656
9658 {
9659 return ConfigGetInt("varLiquidTypeInit");
9660 }
9661
9663 {
9665 }
9666
9668 {
9670 SetFrozen(false);
9671 }
9672
9675 {
9676 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9677 }
9678
9679
9682 {
9683 PlayerBase nplayer;
9684 if (PlayerBase.CastTo(nplayer, player))
9685 {
9687
9688 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9689 }
9690 }
9691
9692
9695 {
9696 PlayerBase nplayer;
9697 if (PlayerBase.CastTo(nplayer,player))
9698 {
9699
9700 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9701
9702 }
9703
9704
9705 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9706
9707
9708 if (HasEnergyManager())
9709 {
9710 GetCompEM().UpdatePlugState();
9711 }
9712 }
9713
9714
9716 {
9717 super.OnPlacementStarted(player);
9718
9720 }
9721
9722 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9723 {
9725 {
9726 m_AdminLog.OnPlacementComplete(player,
this);
9727 }
9728
9729 super.OnPlacementComplete(player, position, orientation);
9730 }
9731
9732
9733
9734
9735
9737 {
9739 {
9740 return true;
9741 }
9742 else
9743 {
9744 return false;
9745 }
9746 }
9747
9748
9750 {
9752 {
9754 }
9755 }
9756
9757
9759 {
9761 }
9762
9764 {
9766 }
9767
9768 override void InsertAgent(
int agent,
float count = 1)
9769 {
9770 if (count < 1)
9771 return;
9772
9774 }
9775
9778 {
9780 }
9781
9782
9784 {
9786 }
9787
9788
9789
9790
9791
9792
9793
9794
9795
9796
9797
9798
9799
9800
9801
9802
9803
9804
9805
9806
9807
9808
9809
9810
9811
9812
9813
9814
9815
9816
9817
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9830 {
9832 return false;
9833 return true;
9834 }
9835
9837 {
9838
9840 }
9841
9842
9845 {
9846 super.CheckForRoofLimited(timeTresholdMS);
9847
9849 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9850 {
9851 m_PreviousRoofTestTime = time;
9852 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9853 }
9854 }
9855
9856
9858 {
9860 {
9861 return 0;
9862 }
9863
9864 if (GetInventory().GetAttachmentSlotsCount() != 0)
9865 {
9866 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9867 if (filter)
9868 return filter.GetProtectionLevel(type, false, system);
9869 else
9870 return 0;
9871 }
9872
9873 string subclassPath, entryName;
9874
9875 switch (type)
9876 {
9878 entryName = "biological";
9879 break;
9881 entryName = "chemical";
9882 break;
9883 default:
9884 entryName = "biological";
9885 break;
9886 }
9887
9888 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9889
9891 }
9892
9893
9894
9897 {
9898 if (!IsMagazine())
9900
9902 }
9903
9904
9905
9906
9907
9912 {
9913 return true;
9914 }
9915
9917 {
9919 }
9920
9921
9922
9923
9924
9926 {
9927 if (parent)
9928 {
9929 if (parent.IsInherited(DayZInfected))
9930 return true;
9931
9932 if (!parent.IsRuined())
9933 return true;
9934 }
9935
9936 return true;
9937 }
9938
9940 {
9941 if (!super.CanPutAsAttachment(parent))
9942 {
9943 return false;
9944 }
9945
9946 if (!IsRuined() && !parent.IsRuined())
9947 {
9948 return true;
9949 }
9950
9951 return false;
9952 }
9953
9955 {
9956
9957
9958
9959
9960 return super.CanReceiveItemIntoCargo(item);
9961 }
9962
9964 {
9965
9966
9967
9968
9969 GameInventory attachmentInv = attachment.GetInventory();
9971 {
9972 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
9973 return false;
9974 }
9975
9976 InventoryLocation loc = new InventoryLocation();
9977 attachment.GetInventory().GetCurrentInventoryLocation(loc);
9978 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
9979 return false;
9980
9981 return super.CanReceiveAttachment(attachment, slotId);
9982 }
9983
9985 {
9986 if (!super.CanReleaseAttachment(attachment))
9987 return false;
9988
9989 return GetInventory().AreChildrenAccessible();
9990 }
9991
9992
9993
9994
9995
9996
9997
9998
9999
10000
10001
10002
10003
10004
10005
10006
10007
10008
10009
10010
10011
10013 {
10014 int id = muzzle_owner.GetMuzzleID();
10015 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10016
10017 if (WPOF_array)
10018 {
10019 for (int i = 0; i < WPOF_array.Count(); i++)
10020 {
10021 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10022
10023 if (WPOF)
10024 {
10025 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10026 }
10027 }
10028 }
10029 }
10030
10031
10033 {
10034 int id = muzzle_owner.GetMuzzleID();
10036
10037 if (WPOBE_array)
10038 {
10039 for (int i = 0; i < WPOBE_array.Count(); i++)
10040 {
10041 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10042
10043 if (WPOBE)
10044 {
10045 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10046 }
10047 }
10048 }
10049 }
10050
10051
10053 {
10054 int id = muzzle_owner.GetMuzzleID();
10055 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10056
10057 if (WPOOH_array)
10058 {
10059 for (int i = 0; i < WPOOH_array.Count(); i++)
10060 {
10061 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10062
10063 if (WPOOH)
10064 {
10065 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10066 }
10067 }
10068 }
10069 }
10070
10071
10073 {
10074 int id = muzzle_owner.GetMuzzleID();
10075 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10076
10077 if (WPOOH_array)
10078 {
10079 for (int i = 0; i < WPOOH_array.Count(); i++)
10080 {
10081 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10082
10083 if (WPOOH)
10084 {
10085 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10086 }
10087 }
10088 }
10089 }
10090
10091
10093 {
10094 int id = muzzle_owner.GetMuzzleID();
10095 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10096
10097 if (WPOOH_array)
10098 {
10099 for (int i = 0; i < WPOOH_array.Count(); i++)
10100 {
10101 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10102
10103 if (WPOOH)
10104 {
10105 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10106 }
10107 }
10108 }
10109 }
10110
10111
10112
10114 {
10116 {
10117 return true;
10118 }
10119
10120 return false;
10121 }
10122
10124 {
10126 {
10127 return true;
10128 }
10129
10130 return false;
10131 }
10132
10134 {
10136 {
10137 return true;
10138 }
10139
10140 return false;
10141 }
10142
10144 {
10145 return false;
10146 }
10147
10150 {
10151 return UATimeSpent.DEFAULT_DEPLOY;
10152 }
10153
10154
10155
10156
10158 {
10160 SetSynchDirty();
10161 }
10162
10164 {
10166 }
10167
10168
10170 {
10171 return false;
10172 }
10173
10176 {
10177 string att_type = "None";
10178
10179 if (ConfigIsExisting("soundAttType"))
10180 {
10181 att_type = ConfigGetString("soundAttType");
10182 }
10183
10185 }
10186
10188 {
10190 }
10191
10192
10193
10194
10195
10201
10203 {
10206
10208 }
10209
10210
10212 {
10214 return;
10215
10217
10220
10223
10224 SoundParameters params = new SoundParameters();
10228 }
10229
10230
10232 {
10234 return;
10235
10237 SetSynchDirty();
10238
10241 }
10242
10243
10245 {
10247 return;
10248
10250 SetSynchDirty();
10251
10254 }
10255
10257 {
10259 }
10260
10262 {
10264 }
10265
10268 {
10269 if (!
GetGame().IsDedicatedServer())
10270 {
10271 if (ConfigIsExisting("attachSoundSet"))
10272 {
10273 string cfg_path = "";
10274 string soundset = "";
10275 string type_name =
GetType();
10276
10279 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10280 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10281
10282 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10283 {
10284 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10285 {
10286 if (cfg_slot_array[i] == slot_type)
10287 {
10288 soundset = cfg_soundset_array[i];
10289 break;
10290 }
10291 }
10292 }
10293
10294 if (soundset != "")
10295 {
10296 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10298 }
10299 }
10300 }
10301 }
10302
10304 {
10305
10306 }
10307
10308 void OnApply(PlayerBase player);
10309
10311 {
10312 return 1.0;
10313 };
10314
10316 {
10318 }
10319
10321 {
10323 }
10324
10326
10328 {
10329 SetDynamicPhysicsLifeTime(0.01);
10331 }
10332
10334 {
10335 array<string> zone_names = new array<string>;
10336 GetDamageZones(zone_names);
10337 for (int i = 0; i < zone_names.Count(); i++)
10338 {
10339 SetHealthMax(zone_names.Get(i),"Health");
10340 }
10341 SetHealthMax("","Health");
10342 }
10343
10346 {
10347 float global_health = GetHealth01("","Health");
10348 array<string> zones = new array<string>;
10349 GetDamageZones(zones);
10350
10351 for (int i = 0; i < zones.Count(); i++)
10352 {
10353 SetHealth01(zones.Get(i),"Health",global_health);
10354 }
10355 }
10356
10359 {
10360 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10361 }
10362
10364 {
10365 if (!hasRootAsPlayer)
10366 {
10367 if (refParentIB)
10368 {
10369
10370 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10371 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10372
10373 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10374 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10375
10378 }
10379 else
10380 {
10381
10384 }
10385 }
10386 }
10387
10389 {
10391 {
10392 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10393 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10394 {
10395 float heatPermCoef = 1.0;
10397 while (ent)
10398 {
10399 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10400 ent = ent.GetHierarchyParent();
10401 }
10402
10403 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10404 }
10405 }
10406 }
10407
10409 {
10410
10411 EntityAI parent = GetHierarchyParent();
10412 if (!parent)
10413 {
10414 hasParent = false;
10415 hasRootAsPlayer = false;
10416 }
10417 else
10418 {
10419 hasParent = true;
10420 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10421 refParentIB =
ItemBase.Cast(parent);
10422 }
10423 }
10424
10425 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10426 {
10427
10428 }
10429
10431 {
10432
10433 return false;
10434 }
10435
10437 {
10438
10439
10440 return false;
10441 }
10442
10444 {
10445
10446 return false;
10447 }
10448
10451 {
10452 return !GetIsFrozen() &&
IsOpen();
10453 }
10454
10456 {
10457 bool hasParent = false, hasRootAsPlayer = false;
10459
10460 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10461 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10462
10463 if (wwtu || foodDecay)
10464 {
10468
10469 if (processWetness || processTemperature || processDecay)
10470 {
10472
10473 if (processWetness)
10474 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10475
10476 if (processTemperature)
10478
10479 if (processDecay)
10480 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10481 }
10482 }
10483 }
10484
10487 {
10489 }
10490
10492 {
10495
10496 return super.GetTemperatureFreezeThreshold();
10497 }
10498
10500 {
10503
10504 return super.GetTemperatureThawThreshold();
10505 }
10506
10508 {
10511
10512 return super.GetItemOverheatThreshold();
10513 }
10514
10516 {
10518 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10519
10520 return super.GetTemperatureFreezeTime();
10521 }
10522
10524 {
10526 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10527
10528 return super.GetTemperatureThawTime();
10529 }
10530
10535
10537 {
10538 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10539 }
10540
10542 {
10543 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10544 }
10545
10548 {
10550 }
10551
10553 {
10555 }
10556
10558 {
10560 }
10561
10564 {
10565 return null;
10566 }
10567
10570 {
10571 return false;
10572 }
10573
10575 {
10577 {
10580 if (!trg)
10581 {
10583 explosive = this;
10584 }
10585
10586 explosive.PairRemote(trg);
10588
10589 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10590 trg.SetPersistentPairID(persistentID);
10591 explosive.SetPersistentPairID(persistentID);
10592
10593 return true;
10594 }
10595 return false;
10596 }
10597
10600 {
10601 float ret = 1.0;
10604 ret *= GetHealth01();
10605
10606 return ret;
10607 }
10608
10609 #ifdef DEVELOPER
10610 override void SetDebugItem()
10611 {
10612 super.SetDebugItem();
10613 _itemBase = this;
10614 }
10615
10617 {
10618 string text = super.GetDebugText();
10619
10621 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10622
10623 return text;
10624 }
10625 #endif
10626
10628 {
10629 return true;
10630 }
10631
10633
10635
10637 {
10640 }
10641
10642
10650
10666}
10667
10669{
10671 if (entity)
10672 {
10673 bool is_item = entity.IsInherited(
ItemBase);
10674 if (is_item && full_quantity)
10675 {
10678 }
10679 }
10680 else
10681 {
10683 return NULL;
10684 }
10685 return entity;
10686}
10687
10689{
10690 if (item)
10691 {
10692 if (health > 0)
10693 item.SetHealth("", "", health);
10694
10695 if (item.CanHaveTemperature())
10696 {
10698 if (item.CanFreeze())
10699 item.SetFrozen(false);
10700 }
10701
10702 if (item.HasEnergyManager())
10703 {
10704 if (quantity >= 0)
10705 {
10706 item.GetCompEM().SetEnergy0To1(quantity);
10707 }
10708 else
10709 {
10711 }
10712 }
10713 else if (item.IsMagazine())
10714 {
10715 Magazine mag = Magazine.Cast(item);
10716 if (quantity >= 0)
10717 {
10718 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10719 }
10720 else
10721 {
10723 }
10724
10725 }
10726 else
10727 {
10728 if (quantity >= 0)
10729 {
10730 item.SetQuantityNormalized(quantity, false);
10731 }
10732 else
10733 {
10735 }
10736
10737 }
10738 }
10739}
10740
10741#ifdef DEVELOPER
10743#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
void ActionManagerBase(PlayerBase player)
map< typename, ref array< ActionBase_Basic > > TInputActionMap
void AddAction(typename actionName)
void RemoveAction(typename actionName)
TInputActionMap m_InputActionMap
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
const int ECE_PLACE_ON_SURFACE
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
Open
Implementations only.
override void EEOnCECreate()
DamageType
exposed from C++ (do not change)
PluginAdminLog m_AdminLog
override bool IsExplosive()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
static bool HasDebugActionsMask(int mask)
bool HidesSelectionBySlot()
void SplitItem(PlayerBase player)
void CopyScriptPropertiesFrom(EntityAI oldItem)
override void InsertAgent(int agent, float count=1)
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
static void SetDebugActionsMask(int mask)
void SetIsDeploySound(bool is_deploy_sound)
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
override bool IsHeavyBehaviour()
override void SetWetMax()
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
void ClearStartItemSoundServer()
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
override void RemoveAllAgentsExcept(int agent_to_keep)
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
bool CanBeMovedOverride()
override void SetWet(float value, bool allow_client=false)
ref TIntArray m_SingleUseActions
override void ProcessVariables()
ref TStringArray m_HeadHidingSelections
float GetWeightSpecialized(bool forceRecalc=false)
bool LoadAgents(ParamsReadContext ctx, int version)
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
ref array< ref OverheatingParticle > m_OverheatingParticles
override float GetTemperatureFreezeThreshold()
bool m_IsSoundSynchRemote
void StopItemSoundServer(int id)
static void ToggleDebugActionsMask(int mask)
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetTemperatureFreezeTime()
ref array< int > m_CompatibleLocks
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
float m_TemperaturePerQuantityWeight
bool m_RecipesInitialized
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
override float GetTemperatureThawThreshold()
override void OnEnergyConsumed()
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
override EWetnessLevel GetWetLevel()
float GetSingleInventoryItemWeight()
ref TIntArray m_InteractActions
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
bool CanPlayDeployLoopSound()
override float GetWetMax()
bool CanBeUsedForSuicide()
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
void StartItemSoundServer(int id)
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
bool m_CanBeMovedOverride
override string ChangeIntoOnAttach(string slot)
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
ScriptedLightBase GetLight()
string GetPlaceSoundset()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
override float GetQuantity()
int m_ShotsToStartOverheating
override void OnWetChanged(float newVal, float oldVal)
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void OnOverheatingDecay()
float GetDryingIncrement(string pIncrementName)
void SoundSynchRemoteReset()
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
override bool CanReleaseAttachment(EntityAI attachment)
override void OnMovedInsideCargo(EntityAI container)
void SetCEBasedQuantity()
bool m_CanPlayImpactSound
override string GetAttachmentSoundType()
float GetOverheatingCoef()
array< string > GetHeadHidingSelection()
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
override bool IsStoreLoad()
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
void SetResultOfSplit(bool value)
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
void UpdateAllOverheatingParticles()
float GetSoakingIncrement(string pIncrementName)
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetStoreLoadedQuantity()
const int ITEM_SOUNDS_MAX
float GetItemModelLength()
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
void CombineItems(ItemBase other_item, bool use_stack_max=true)
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
void TransferAgents(int agents)
transfer agents from another item
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
float GetHeatIsolationInit()
void SetCanBeMovedOverride(bool setting)
override bool HasQuantity()
bool IsCargoException4x3(EntityAI item)
ref TIntArray m_ContinuousActions
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
void LoadParticleConfigOnFire(int id)
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
override float GetWetInit()
int m_ImpactSoundSurfaceHash
int m_MaxOverheatingValue
void SetupSpawnedItem(ItemBase item, float health, float quantity)
bool ShouldSplitQuantity(float quantity)
static ref map< string, int > m_WeaponTypeToID
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
array< int > GetValidFinishers()
returns an array of possible finishers
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
ItemSoundHandler GetItemSoundHandler()
override int GetQuantityMin()
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
override int GetQuickBarBonus()
override void SetTakeable(bool pState)
float m_OverheatingDecayInterval
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
void RemoveAudioVisualsOnClient()
static void AddDebugActionsMask(int mask)
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
bool CanRepair(ItemBase item_repair_kit)
bool can_this_be_combined
EffectSound m_SoundDeploy
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
float GetDeployTime()
how long it takes to deploy this item in seconds
override bool IsSplitable()
bool DamageItemAttachments(float damage)
override void WriteVarsToCTX(ParamsWriteContext ctx)
void ConvertEnergyToQuantity()
override void RemoveAllAgents()
override void SetQuantityToMinimum()
bool m_WantPlayImpactSound
override float GetTemperatureThawTime()
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
float m_StoreLoadedQuantity
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
float GetFilterDamageRatio()
override void SetLiquidType(int value, bool allow_client=false)
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
void OnApply(PlayerBase player)
override void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
ref Timer m_CheckOverheating
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override bool IsOneHandedBehaviour()
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
override float GetSingleInventoryItemWeightEx()
void SaveAgents(ParamsWriteContext ctx)
override int GetTargetQuantityMax(int attSlotID=-1)
float GetDisinfectQuantity(int system=0, Param param1=null)
override bool IsHologram()
float GetItemAttachOffset()
static int GetDebugActionsMask()
void ProcessDecay(float delta, bool hasRootAsPlayer)
override bool IsItemBase()
override bool IsTwoHandedBehaviour()
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override void OnEnergyAdded()
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
EffectSound m_DeployLoopSoundEx
override void DeSerializeNumericalVars(array< float > floats)
void StopItemDynamicPhysics()
override void SetStoreLoad(bool value)
float GetOverheatingValue()
bool ContainsAgent(int agent_id)
override void AddWet(float value)
override void EOnContact(IEntity other, Contact extra)
void SplitIntoStackMaxHands(PlayerBase player)
void SplitIntoStackMaxHandsClient(PlayerBase player)
ref Timer m_PhysDropTimer
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
override void SetStoreLoadedQuantity(float value)
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
void OnLiquidTypeChanged(int oldType, int newType)
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void PlayDeployFinishSound()
bool AllowFoodConsumption()
bool m_IsOverheatingEffectActive
int m_LiquidContainerMask
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override int GetCleanness()
bool PairWithDevice(notnull ItemBase otherDevice)
static void RemoveDebugActionsMask(int mask)
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void PerformDamageSystemReinit()
override void ClearInventory()
static int m_LastRegisteredWeaponID
ItemBase GetLightSourceItem()
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
override float GetItemOverheatThreshold()
void StopDeployLoopSoundEx()
override void SerializeNumericalVars(array< float > floats_out)
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
static int m_DebugActionsMask
void KillAllOverheatingParticles()
bool CanBeCookedOnStick()
override int GetQuantityMax()
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
void OnActivatedByTripWire()
override void RemoveAgent(int agent_id)
bool m_ItemBeingDroppedPhys
override bool CanPutAsAttachment(EntityAI parent)
void PlayDetachSound(string slot_type)
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override bool IsBeingPlaced()
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
bool m_FixDamageSystemInit
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
void LoadParticleConfigOnOverheating(int id)
bool IsSoundSynchRemote()
override void OnRightClick()
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
bool IsActionTargetVisible()
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
int NameToID(string name)
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
void ClearStopItemSoundServer()
override string ChangeIntoOnDetach()
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
EffectSound m_SoundDeployFinish
float GetQuantityNormalizedScripted()
override void SetCleanness(int value, bool allow_client=false)
override float GetWetMin()
ref ItemSoundHandler m_ItemSoundHandler
override bool KindOf(string tag)
void ItemSoundHandler(ItemBase parent)
EffectSound m_LockingSound
void PluginItemDiagnostic()
PluginBase GetPlugin(typename plugin_type)
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
void RemoteDetonatorTrigger()
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
override void Explode(int damageType, string ammoType="")
void OnItemLocationChanged(ItemBase item)
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
proto native void GizmoSelectObject(Object object)
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto native void GizmoSelectPhysics(Physics physics)
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
bool WriteToContext(ParamsWriteContext ctx)
proto native int GetType()
returns type of InventoryLocation
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native bool GetFlip()
returns flip status of cargo
proto native EntityAI GetItem()
returns item of current inventory location
override bool CanDisplayCargo()
override void OnInventoryEnter(Man player)
override string GetFoldSoundset()
override bool CanPutAsAttachment(EntityAI parent)
override bool CanReceiveItemIntoCargo(EntityAI item)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override void OnWasDetached(EntityAI parent, int slot_id)
override void EEOnAfterLoad()
override void EEDelete(EntityAI parent)
override bool CanBeRepairedByCrafting()
override void OnPlacementStarted(Man player)
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
override bool IsElectricAppliance()
override bool IsItemTent()
override void SetActions()
override string GetLoopFoldSoundset()
override bool CanMakeGardenplot()
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override WrittenNoteData GetWrittenNoteData()
override int GetDamageSystemVersionChange()
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
override void InitItemVariables()
override void SetActionAnimOverrides()
override void OnCreatePhysics()
override string GetDeploySoundset()
override float GetBandagingEffectivity()
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
override void OnStoreSave(ParamsWriteContext ctx)
override void AfterStoreLoad()
override int GetOnDigWormsAmount()
override bool IsSelfAdjustingTemperature()
override bool IsPlayerInside(PlayerBase player, string selection)
override void OnVariablesSynchronized()
override void RefreshPhysics()
override bool CanObstruct()
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override bool CanPutInCargo(EntityAI parent)
override string GetLoopDeploySoundset()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
override void OnInventoryExit(Man player)
override bool IsTakeable()
override bool IsIgnoredByConstruction()
override void InitItemSounds()
override void EEKilled(Object killer)
override void OnCombine(ItemBase other_item)
override bool CanExplodeInFire()
override bool IsFacingPlayer(PlayerBase player, string selection)
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
override bool IsBloodContainer()
override bool IsClothing()
override bool CanBeSplit()
override bool IsDeployable()
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
override bool CanBeDisinfected()
override float GetInfectionChance(int system=0, Param param=null)
override void OnEndPlacement()
float GetOverheatingLimitMax()
void SetOverheatingLimitMax(float max)
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
float GetOverheatingLimitMin()
void SetOverheatingLimitMin(float min)
void RegisterParticle(Particle p)
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
void SetControlledDevice(EntityAI pDevice)
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
proto void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
void SetCalcDetails(string details)
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Serializer ParamsReadContext
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
proto native CGame GetGame()
Serializer ParamsWriteContext
const int COMP_TYPE_ENERGY_MANAGER
void Error(string err)
Messagebox with error message.
proto native void SetColor(int color)
array< string > TStringArray
EntityEvent
Entity events for event-mask, or throwing event from code.
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
const int VARIABLE_LIQUIDTYPE
const int VARIABLE_CLEANNESS
const int VARIABLE_TEMPERATURE
const int VARIABLE_QUANTITY
static proto float AbsFloat(float f)
Returns absolute value.
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_DEBUG_ACTION
class JsonUndergroundAreaTriggerData GetPosition
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.