5849{
5851 {
5852 return true;
5853 }
5854};
5855
5856
5857
5859{
5863
5865
5868
5869
5870
5871
5872
5881
5887
5892
5897
5918 protected bool m_IsResultOfSplit
5919
5921
5926
5927
5928
5930
5934
5935
5936
5938
5941
5942
5943
5949
5950
5958
5961
5962
5964
5965
5967
5968
5973
5974
5979
5980
5982
5983
5985 {
5990
5991 if (!
GetGame().IsDedicatedServer())
5992 {
5994 {
5996
5998 {
6000 }
6001 }
6002
6005 }
6006
6007 m_OldLocation = null;
6008
6010 {
6012 }
6013
6014 if (ConfigIsExisting("headSelectionsToHide"))
6015 {
6018 }
6019
6021 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6022 {
6024 }
6025
6027
6028 m_IsResultOfSplit = false;
6029
6031 }
6032
6034 {
6035 super.InitItemVariables();
6036
6042 m_Count = ConfigGetInt(
"count");
6043
6046
6051
6054
6059
6071
6075
6076
6079 if (ConfigIsExisting("canBeSplit"))
6080 {
6083 }
6084
6086 if (ConfigIsExisting("itemBehaviour"))
6088
6089
6092 RegisterNetSyncVariableInt("m_VarLiquidType");
6093 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6094
6095 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6096 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6097 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6098
6099 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6100 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6101 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6102 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6103
6104 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6105 RegisterNetSyncVariableBool("m_IsTakeable");
6106 RegisterNetSyncVariableBool("m_IsHologram");
6107
6110 {
6113 }
6114
6116
6118 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6120
6121 }
6122
6124 {
6126 }
6127
6129 {
6132 {
6137 }
6138 }
6139
6140 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6141 {
6143 {
6146 }
6147
6149 }
6150
6152 {
6158 }
6159
6161
6163 {
6165
6166 if (!action)
6167 {
6168 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6169 return;
6170 }
6171
6173 if (!ai)
6174 {
6176 return;
6177 }
6178
6180 if (!action_array)
6181 {
6182 action_array = new array<ActionBase_Basic>;
6184 }
6185 if (LogManager.IsActionLogEnable())
6186 {
6187 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6188 }
6189
6190 if (action_array.Find(action) != -1)
6191 {
6192 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6193 }
6194 else
6195 {
6196 action_array.Insert(action);
6197 }
6198 }
6199
6201 {
6203 ActionBase action = player.GetActionManager().GetAction(actionName);
6206
6207 if (action_array)
6208 {
6209 action_array.RemoveItem(action);
6210 }
6211 }
6212
6213
6214
6216 {
6217 ActionOverrideData overrideData = new ActionOverrideData();
6221
6223 if (!actionMap)
6224 {
6227 }
6228
6229 actionMap.Insert(this.
Type(), overrideData);
6230
6231 }
6232
6234
6236
6237
6239 {
6242
6245
6246 string config_to_search = "CfgVehicles";
6247 string muzzle_owner_config;
6248
6250 {
6251 if (IsInherited(Weapon))
6252 config_to_search = "CfgWeapons";
6253
6254 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6255
6256 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6257
6259
6260 if (config_OnFire_subclass_count > 0)
6261 {
6262 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6263
6264 for (int i = 0; i < config_OnFire_subclass_count; i++)
6265 {
6266 string particle_class = "";
6268 string config_OnFire_entry = config_OnFire_class + particle_class;
6269 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6270 WPOF_array.Insert(WPOF);
6271 }
6272
6273
6275 }
6276 }
6277
6279 {
6280 config_to_search = "CfgWeapons";
6281 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6282
6283 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6284
6286
6287 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6288 {
6289 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6290
6291 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6292 {
6293 string particle_class2 = "";
6295 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6296 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6297 WPOBE_array.Insert(WPOBE);
6298 }
6299
6300
6302 }
6303 }
6304 }
6305
6306
6308 {
6311
6313 {
6314 string config_to_search = "CfgVehicles";
6315
6316 if (IsInherited(Weapon))
6317 config_to_search = "CfgWeapons";
6318
6319 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6320 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6321
6322 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
6323 {
6324
6326
6328 {
6330 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6332 return;
6333 }
6334
6337
6338
6339
6341 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6342
6343 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6344 {
6345 string particle_class = "";
6347 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6349
6350 if (entry_type == CT_CLASS)
6351 {
6352 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6353 WPOOH_array.Insert(WPOF);
6354 }
6355 }
6356
6357
6359 }
6360 }
6361 }
6362
6364 {
6366 }
6367
6369 {
6371 {
6373
6376
6379
6380 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6381 }
6382 }
6383
6385 {
6387 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6388
6390 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6391
6393 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6394
6396 {
6398 }
6399 }
6400
6402 {
6404 }
6405
6407 {
6410 else
6412
6414 {
6417 }
6418 else
6419 {
6422
6425 }
6426
6428 }
6429
6431 {
6433 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6434 }
6435
6437 {
6439 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6441 }
6442
6444 {
6446 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6447 }
6448
6450 {
6453
6454 OverheatingParticle OP = new OverheatingParticle();
6459
6461 }
6462
6464 {
6467
6468 return -1;
6469 }
6470
6472 {
6474 {
6477
6478 for (int i = count; i > 0; --i)
6479 {
6480 int id = i - 1;
6483
6486
6487 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6488 {
6489 if (p)
6490 {
6493 }
6494 }
6495 }
6496 }
6497 }
6498
6500 {
6502 {
6504 {
6505 int id = i - 1;
6507
6508 if (OP)
6509 {
6511
6512 if (p)
6513 {
6515 }
6516
6517 delete OP;
6518 }
6519 }
6520
6523 }
6524 }
6525
6528 {
6529 return 0.0;
6530 }
6531
6532
6534 {
6535 return 250;
6536 }
6537
6539 {
6540 return 0;
6541 }
6542
6545 {
6547 return true;
6548
6549 return false;
6550 }
6551
6554 {
6557
6559 {
6561 }
6562 else
6563 {
6564
6566 }
6567
6569 }
6570
6577 {
6578 return -1;
6579 }
6580
6581
6582
6583
6585 {
6587 {
6589 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6590
6591 if (r_index >= 0)
6592 {
6593 InventoryLocation r_il = new InventoryLocation;
6594 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6595
6596 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6599 {
6600 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6601 }
6603 {
6604 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6605 }
6606
6607 }
6608
6609 player.GetHumanInventory().ClearUserReservedLocation(this);
6610 }
6611
6614 }
6615
6616
6617
6618
6620 {
6621 return ItemBase.m_DebugActionsMask;
6622 }
6623
6625 {
6626 return ItemBase.m_DebugActionsMask & mask;
6627 }
6628
6630 {
6631 ItemBase.m_DebugActionsMask = mask;
6632 }
6633
6635 {
6636 ItemBase.m_DebugActionsMask |= mask;
6637 }
6638
6640 {
6641 ItemBase.m_DebugActionsMask &= ~mask;
6642 }
6643
6645 {
6647 {
6649 }
6650 else
6651 {
6653 }
6654 }
6655
6656
6658 {
6659 if (GetEconomyProfile())
6660 {
6661 float q_max = GetEconomyProfile().GetQuantityMax();
6662 if (q_max > 0)
6663 {
6664 float q_min = GetEconomyProfile().GetQuantityMin();
6665 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6666
6668 {
6669 ComponentEnergyManager comp = GetCompEM();
6671 {
6673 }
6674 }
6676 {
6678
6679 }
6680
6681 }
6682 }
6683 }
6684
6687 {
6688 EntityAI parent = GetHierarchyParent();
6689
6690 if (parent)
6691 {
6692 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6693 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6694 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6695 }
6696 }
6697
6700 {
6701 EntityAI parent = GetHierarchyParent();
6702
6703 if (parent)
6704 {
6705 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6706 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6707 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6708 }
6709 }
6710
6712 {
6713
6714
6715
6716
6718
6720 {
6721 if (ScriptInputUserData.CanStoreInputUserData())
6722 {
6723 ScriptInputUserData ctx = new ScriptInputUserData;
6729 ctx.
Write(use_stack_max);
6732
6734 {
6735 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6736 }
6737 }
6738 }
6739 else if (!
GetGame().IsMultiplayer())
6740 {
6742 }
6743 }
6744
6746 {
6748 }
6749
6751 {
6753 }
6754
6756 {
6758 }
6759
6761 {
6762
6763 return false;
6764 }
6765
6767 {
6768 return false;
6769 }
6770
6774 {
6775 return false;
6776 }
6777
6779 {
6780 return "";
6781 }
6782
6784
6786 {
6787 return false;
6788 }
6789
6791 {
6792 return true;
6793 }
6794
6795
6796
6798 {
6799 return true;
6800 }
6801
6803 {
6804 return true;
6805 }
6806
6808 {
6809 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6811 }
6812
6814 {
6816 }
6817
6819 {
6821 if (!is_being_placed)
6823 SetSynchDirty();
6824 }
6825
6826
6828
6830 {
6832 }
6833
6835 {
6837 }
6838
6840 {
6841 return 1;
6842 }
6843
6845 {
6846 return false;
6847 }
6848
6850 {
6852 SetSynchDirty();
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
6883
6884
6885
6886
6887
6888
6890 {
6891 super.OnMovedInsideCargo(container);
6892
6893 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6894 }
6895
6896 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6897 {
6898 super.EEItemLocationChanged(oldLoc,newLoc);
6899
6900 PlayerBase new_player = null;
6901 PlayerBase old_player = null;
6902
6903 if (newLoc.GetParent())
6904 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6905
6906 if (oldLoc.GetParent())
6907 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6908
6910 {
6911 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
6912
6913 if (r_index >= 0)
6914 {
6915 InventoryLocation r_il = new InventoryLocation;
6916 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6917
6918 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6921 {
6922 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6923 }
6925 {
6926 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6927 }
6928
6929 }
6930 }
6931
6933 {
6934 if (new_player)
6935 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
6936
6937 if (new_player == old_player)
6938 {
6939
6940 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6941 {
6943 {
6944 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6945 {
6946 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6947 }
6948 }
6949 else
6950 {
6951 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6952 }
6953 }
6954
6955 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6956 {
6957 int type = oldLoc.GetType();
6959 {
6960 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6961 }
6963 {
6964 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6965 }
6966 }
6967 if (!m_OldLocation)
6968 {
6969 m_OldLocation = new InventoryLocation;
6970 }
6971 m_OldLocation.Copy(oldLoc);
6972 }
6973 else
6974 {
6975 if (m_OldLocation)
6976 {
6977 m_OldLocation.Reset();
6978 }
6979 }
6980
6982 }
6983 else
6984 {
6985 if (new_player)
6986 {
6987 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6988 if (res_index >= 0)
6989 {
6990 InventoryLocation il = new InventoryLocation;
6991 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
6993 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
6996 {
6997 il.
GetParent().GetOnReleaseLock().Invoke(it);
6998 }
7000 {
7002 }
7003
7004 }
7005 }
7007 {
7008
7010 }
7011
7012 if (m_OldLocation)
7013 {
7014 m_OldLocation.Reset();
7015 }
7016 }
7017 }
7018
7019 override void EOnContact(IEntity other, Contact extra)
7020 {
7022 {
7023 int liquidType = -1;
7025 if (impactSpeed > 0.0)
7026 {
7028 #ifndef SERVER
7030 #else
7032 SetSynchDirty();
7033 #endif
7035 }
7036 }
7037
7038 #ifdef SERVER
7039 if (GetCompEM() && GetCompEM().IsPlugged())
7040 {
7041 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7042 GetCompEM().UnplugThis();
7043 }
7044 #endif
7045 }
7046
7048
7050 {
7052 }
7053
7055 {
7056
7057 }
7058
7060 {
7061 super.OnItemLocationChanged(old_owner, new_owner);
7062
7063 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7064 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7065
7066 if (!relatedPlayer && playerNew)
7067 relatedPlayer = playerNew;
7068
7069 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7070 {
7072 if (actionMgr)
7073 {
7074 ActionBase currentAction = actionMgr.GetRunningAction();
7075 if (currentAction)
7077 }
7078 }
7079
7080 Man ownerPlayerOld = null;
7081 Man ownerPlayerNew = null;
7082
7083 if (old_owner)
7084 {
7085 if (old_owner.
IsMan())
7086 {
7087 ownerPlayerOld = Man.Cast(old_owner);
7088 }
7089 else
7090 {
7091 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7092 }
7093 }
7094 else
7095 {
7097 {
7099
7100 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7101 {
7102 GetCompEM().UnplugThis();
7103 }
7104 }
7105 }
7106
7107 if (new_owner)
7108 {
7109 if (new_owner.
IsMan())
7110 {
7111 ownerPlayerNew = Man.Cast(new_owner);
7112 }
7113 else
7114 {
7115 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7116 }
7117 }
7118
7119 if (ownerPlayerOld != ownerPlayerNew)
7120 {
7121 if (ownerPlayerOld)
7122 {
7123 array<EntityAI> subItemsExit = new array<EntityAI>;
7125 for (int i = 0; i < subItemsExit.Count(); i++)
7126 {
7129 }
7130 }
7131
7132 if (ownerPlayerNew)
7133 {
7134 array<EntityAI> subItemsEnter = new array<EntityAI>;
7136 for (int j = 0; j < subItemsEnter.Count(); j++)
7137 {
7140 }
7141 }
7142 }
7143 else if (ownerPlayerNew != null)
7144 {
7145 PlayerBase nplayer;
7146 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7147 {
7148 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7150 for (int k = 0; k < subItemsUpdate.Count(); k++)
7151 {
7153 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7154 }
7155 }
7156 }
7157
7158 if (old_owner)
7159 old_owner.OnChildItemRemoved(this);
7160 if (new_owner)
7161 new_owner.OnChildItemReceived(this);
7162 }
7163
7164
7166 {
7167 super.EEDelete(parent);
7168 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7169 if (player)
7170 {
7172
7173 if (player.IsAlive())
7174 {
7175 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7176 if (r_index >= 0)
7177 {
7178 InventoryLocation r_il = new InventoryLocation;
7179 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7180
7181 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7184 {
7185 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7186 }
7188 {
7189 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7190 }
7191
7192 }
7193
7194 player.RemoveQuickBarEntityShortcut(this);
7195 }
7196 }
7197 }
7198
7200 {
7201 super.EEKilled(killer);
7202
7205 {
7206 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7207 {
7208 if (IsMagazine())
7209 {
7210 if (Magazine.Cast(this).GetAmmoCount() > 0)
7211 {
7213 }
7214 }
7215 else
7216 {
7218 }
7219 }
7220 }
7221 }
7222
7224 {
7225 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7226
7227 super.OnWasAttached(parent, slot_id);
7228
7231
7233 }
7234
7236 {
7237 super.OnWasDetached(parent, slot_id);
7238
7241 }
7242
7244 {
7245 int idx;
7248
7249 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7250 if (inventory_slots.Count() < 1)
7251 {
7252 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7253 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7254 }
7255 else
7256 {
7257 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7258 }
7259
7260 idx = inventory_slots.Find(slot);
7261 if (idx < 0)
7262 return "";
7263
7264 return attach_types.Get(idx);
7265 }
7266
7268 {
7269 int idx = -1;
7270 string slot;
7271
7274
7275 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7276 if (inventory_slots.Count() < 1)
7277 {
7278 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7279 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7280 }
7281 else
7282 {
7283 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7284 if (detach_types.Count() < 1)
7285 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7286 }
7287
7288 for (int i = 0; i < inventory_slots.Count(); i++)
7289 {
7290 slot = inventory_slots.Get(i);
7291 }
7292
7293 if (slot != "")
7294 {
7295 if (detach_types.Count() == 1)
7296 idx = 0;
7297 else
7298 idx = inventory_slots.Find(slot);
7299 }
7300 if (idx < 0)
7301 return "";
7302
7303 return detach_types.Get(idx);
7304 }
7305
7307 {
7308
7310
7311
7312 float min_time = 1;
7313 float max_time = 3;
7314 float delay = Math.RandomFloat(min_time, max_time);
7315
7316 explode_timer.Run(delay, this, "DoAmmoExplosion");
7317 }
7318
7320 {
7321 Magazine magazine = Magazine.Cast(this);
7322 int pop_sounds_count = 6;
7323 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7324
7325
7326 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7327 string sound_name = pop_sounds[ sound_idx ];
7329
7330
7331 magazine.ServerAddAmmoCount(-1);
7332
7333
7334 float min_temp_to_explode = 100;
7335
7336 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7337 {
7339 }
7340 }
7341
7342
7343 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7344 {
7345 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7346
7347 const int CHANCE_DAMAGE_CARGO = 4;
7348 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7349 const int CHANCE_DAMAGE_NOTHING = 2;
7350
7352 {
7353 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7354 int chances;
7355 int rnd;
7356
7357 if (GetInventory().GetCargo())
7358 {
7359 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7360 rnd = Math.RandomInt(0,chances);
7361
7362 if (rnd < CHANCE_DAMAGE_CARGO)
7363 {
7365 }
7366 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7367 {
7369 }
7370 }
7371 else
7372 {
7373 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7374 rnd = Math.RandomInt(0,chances);
7375
7376 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7377 {
7379 }
7380 }
7381 }
7382 }
7383
7385 {
7386 if (GetInventory().GetCargo())
7387 {
7388 int item_count = GetInventory().GetCargo().GetItemCount();
7389 if (item_count > 0)
7390 {
7391 int random_pick = Math.RandomInt(0, item_count);
7393 if (!item.IsExplosive())
7394 {
7395 item.AddHealth("","",damage);
7396 return true;
7397 }
7398 }
7399 }
7400 return false;
7401 }
7402
7404 {
7405 int attachment_count = GetInventory().AttachmentCount();
7406 if (attachment_count > 0)
7407 {
7408 int random_pick = Math.RandomInt(0, attachment_count);
7409 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
7410 if (!attachment.IsExplosive())
7411 {
7412 attachment.AddHealth("","",damage);
7413 return true;
7414 }
7415 }
7416 return false;
7417 }
7418
7420 {
7422 }
7423
7425 {
7427 return GetInventory().CanRemoveEntity();
7428
7429 return false;
7430 }
7431
7433 {
7434
7436 return false;
7437
7438
7440 return false;
7441
7442
7443
7445 if (delta == 0)
7446 return false;
7447
7448
7449 return true;
7450 }
7451
7453 {
7455 {
7456 if (ScriptInputUserData.CanStoreInputUserData())
7457 {
7458 ScriptInputUserData ctx = new ScriptInputUserData;
7463 ctx.
Write(destination_entity);
7467 }
7468 }
7469 else if (!
GetGame().IsMultiplayer())
7470 {
7472 }
7473 }
7474
7476 {
7477 float split_quantity_new;
7481 InventoryLocation loc = new InventoryLocation;
7482
7483 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7484 {
7486 split_quantity_new = stack_max;
7487 else
7489
7491 {
7492 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7493 if (new_item)
7494 {
7495 new_item.SetResultOfSplit(true);
7496 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7498 new_item.
SetQuantity(split_quantity_new,
false,
true);
7499 }
7500 }
7501 }
7502 else if (destination_entity && slot_id == -1)
7503 {
7504 if (quantity > stack_max)
7505 split_quantity_new = stack_max;
7506 else
7507 split_quantity_new = quantity;
7508
7510 {
7512 {
7515 }
7516
7517 if (new_item)
7518 {
7519 new_item.SetResultOfSplit(true);
7520 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7522 new_item.
SetQuantity(split_quantity_new,
false,
true);
7523 }
7524 }
7525 }
7526 else
7527 {
7528 if (stack_max != 0)
7529 {
7531 {
7533 }
7534
7535 if (split_quantity_new == 0)
7536 {
7537 if (!
GetGame().IsMultiplayer())
7538 player.PhysicalPredictiveDropItem(this);
7539 else
7540 player.ServerDropEntity(this);
7541 return;
7542 }
7543
7545 {
7547
7548 if (new_item)
7549 {
7550 new_item.SetResultOfSplit(true);
7551 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7554 new_item.PlaceOnSurface();
7555 }
7556 }
7557 }
7558 }
7559 }
7560
7562 {
7563 float split_quantity_new;
7567 InventoryLocation loc = new InventoryLocation;
7568
7569 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7570 {
7572 split_quantity_new = stack_max;
7573 else
7575
7577 {
7578 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7579 if (new_item)
7580 {
7581 new_item.SetResultOfSplit(true);
7582 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7584 new_item.
SetQuantity(split_quantity_new,
false,
true);
7585 }
7586 }
7587 }
7588 else if (destination_entity && slot_id == -1)
7589 {
7590 if (quantity > stack_max)
7591 split_quantity_new = stack_max;
7592 else
7593 split_quantity_new = quantity;
7594
7596 {
7598 {
7601 }
7602
7603 if (new_item)
7604 {
7605 new_item.SetResultOfSplit(true);
7606 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7608 new_item.
SetQuantity(split_quantity_new,
false,
true);
7609 }
7610 }
7611 }
7612 else
7613 {
7614 if (stack_max != 0)
7615 {
7617 {
7619 }
7620
7622 {
7624
7625 if (new_item)
7626 {
7627 new_item.SetResultOfSplit(true);
7628 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7631 new_item.PlaceOnSurface();
7632 }
7633 }
7634 }
7635 }
7636 }
7637
7639 {
7641 {
7642 if (ScriptInputUserData.CanStoreInputUserData())
7643 {
7644 ScriptInputUserData ctx = new ScriptInputUserData;
7649 dst.WriteToContext(ctx);
7651 }
7652 }
7653 else if (!
GetGame().IsMultiplayer())
7654 {
7656 }
7657 }
7658
7660 {
7662 {
7663 if (ScriptInputUserData.CanStoreInputUserData())
7664 {
7665 ScriptInputUserData ctx = new ScriptInputUserData;
7670 ctx.
Write(destination_entity);
7676 }
7677 }
7678 else if (!
GetGame().IsMultiplayer())
7679 {
7681 }
7682 }
7683
7685 {
7687 }
7688
7690 {
7692 float split_quantity_new;
7694 if (dst.IsValid())
7695 {
7696 int slot_id = dst.GetSlot();
7698
7699 if (quantity > stack_max)
7700 split_quantity_new = stack_max;
7701 else
7702 split_quantity_new = quantity;
7703
7705 {
7707
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 return new_item;
7717 }
7718 }
7719
7720 return null;
7721 }
7722
7724 {
7726 float split_quantity_new;
7728 if (destination_entity)
7729 {
7731 if (quantity > stackable)
7732 split_quantity_new = stackable;
7733 else
7734 split_quantity_new = quantity;
7735
7737 {
7738 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7739 if (new_item)
7740 {
7741 new_item.SetResultOfSplit(true);
7742 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7744 new_item.
SetQuantity(split_quantity_new,
false,
true);
7745 }
7746 }
7747 }
7748 }
7749
7751 {
7753 {
7754 if (ScriptInputUserData.CanStoreInputUserData())
7755 {
7756 ScriptInputUserData ctx = new ScriptInputUserData;
7761 ItemBase destination_entity =
this;
7762 ctx.
Write(destination_entity);
7766 }
7767 }
7768 else if (!
GetGame().IsMultiplayer())
7769 {
7771 }
7772 }
7773
7775 {
7777 float split_quantity_new;
7779 if (player)
7780 {
7782 if (quantity > stackable)
7783 split_quantity_new = stackable;
7784 else
7785 split_quantity_new = quantity;
7786
7788 {
7789 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7790 new_item =
ItemBase.Cast(in_hands);
7791 if (new_item)
7792 {
7793 new_item.SetResultOfSplit(true);
7794 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7796 new_item.SetQuantity(split_quantity_new, false, true);
7797 }
7798 }
7799 }
7800 }
7801
7803 {
7805 float split_quantity_new = Math.Floor(quantity * 0.5);
7806
7808 return;
7809
7811
7812 if (new_item)
7813 {
7814 if (new_item.GetQuantityMax() < split_quantity_new)
7815 {
7816 split_quantity_new = new_item.GetQuantityMax();
7817 }
7818
7819 new_item.SetResultOfSplit(true);
7820 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7821
7823 {
7826 }
7827 else
7828 {
7830 new_item.
SetQuantity(split_quantity_new,
false,
true);
7831 }
7832 }
7833 }
7834
7836 {
7838 float split_quantity_new = Math.Floor(quantity / 2);
7839
7841 return;
7842
7843 InventoryLocation invloc = new InventoryLocation;
7845
7847 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7848
7849 if (new_item)
7850 {
7851 if (new_item.GetQuantityMax() < split_quantity_new)
7852 {
7853 split_quantity_new = new_item.GetQuantityMax();
7854 }
7856 {
7859 }
7860 else if (split_quantity_new > 1)
7861 {
7863 new_item.
SetQuantity(split_quantity_new,
false,
true);
7864 }
7865 }
7866 }
7867
7870 {
7871 SetWeightDirty();
7873
7874 if (parent)
7875 parent.OnAttachmentQuantityChangedEx(this, delta);
7876
7878 {
7880 {
7882 }
7884 {
7885 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7887 }
7888 }
7889
7890 }
7891
7894 {
7895
7896 }
7897
7900 {
7902 }
7903
7905 {
7906 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7907
7909 {
7910 if (newLevel == GameConstants.STATE_RUINED)
7911 {
7913 EntityAI parent = GetHierarchyParent();
7914 if (parent && parent.IsFireplace())
7915 {
7916 CargoBase cargo = GetInventory().GetCargo();
7917 if (cargo)
7918 {
7920 {
7922 }
7923 }
7924 }
7925 }
7926
7928 {
7929
7931 return;
7932 }
7933
7934 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7935 {
7937 }
7938 }
7939 }
7940
7941
7943 {
7944 super.OnRightClick();
7945
7947 {
7949 {
7950 if (ScriptInputUserData.CanStoreInputUserData())
7951 {
7952 EntityAI root = GetHierarchyRoot();
7953 Man playerOwner = GetHierarchyRootPlayer();
7954 InventoryLocation dst = new InventoryLocation;
7955
7956
7957 if (!playerOwner && root && root == this)
7958 {
7960 }
7961 else
7962 {
7963
7964 GetInventory().GetCurrentInventoryLocation(dst);
7966 {
7969 {
7971 }
7972 else
7973 {
7975
7976
7977 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7978 {
7980 }
7981 else
7982 {
7983 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7984 }
7985 }
7986 }
7987 }
7988
7989 ScriptInputUserData ctx = new ScriptInputUserData;
7997 }
7998 }
7999 else if (!
GetGame().IsMultiplayer())
8000 {
8002 }
8003 }
8004 }
8005
8007 {
8008 if (root)
8009 {
8010 vector m4[4];
8011 root.GetTransform(m4);
8012 dst.SetGround(this, m4);
8013 }
8014 else
8015 {
8016 GetInventory().GetCurrentInventoryLocation(dst);
8017 }
8018 }
8019
8020 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8021 {
8022
8023 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8024 return false;
8025
8026 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8027 return false;
8028
8029
8031 return false;
8032
8033
8034 Magazine mag = Magazine.Cast(this);
8035 if (mag)
8036 {
8037 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8038 return false;
8039
8040 if (stack_max_limit)
8041 {
8042 Magazine other_mag = Magazine.Cast(other_item);
8043 if (other_item)
8044 {
8045 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8046 return false;
8047 }
8048
8049 }
8050 }
8051 else
8052 {
8053
8055 return false;
8056
8058 return false;
8059 }
8060
8061 PlayerBase player = null;
8062 if (CastTo(player, GetHierarchyRootPlayer()))
8063 {
8064 if (player.GetInventory().HasAttachment(this))
8065 return false;
8066
8067 if (player.IsItemsToDelete())
8068 return false;
8069 }
8070
8071 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8072 return false;
8073
8074 int slotID;
8076 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8077 return false;
8078
8079 return true;
8080 }
8081
8083 {
8085 }
8086
8088 {
8089 return m_IsResultOfSplit;
8090 }
8091
8093 {
8094 m_IsResultOfSplit = value;
8095 }
8096
8098 {
8100 }
8101
8103 {
8104 float other_item_quantity = other_item.GetQuantity();
8105 float this_free_space;
8106
8108
8110
8111 if (other_item_quantity > this_free_space)
8112 {
8113 return this_free_space;
8114 }
8115 else
8116 {
8117 return other_item_quantity;
8118 }
8119 }
8120
8122 {
8124 }
8125
8127 {
8129 return;
8130
8131 if (!IsMagazine() && other_item)
8132 {
8134 if (quantity_used != 0)
8135 {
8136 float hp1 = GetHealth01("","");
8137 float hp2 = other_item.GetHealth01("","");
8138 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8139 hpResult = hpResult / (
GetQuantity() + quantity_used);
8140
8141 hpResult *= GetMaxHealth();
8142 Math.Round(hpResult);
8143 SetHealth("", "Health", hpResult);
8144
8146 other_item.AddQuantity(-quantity_used);
8147 }
8148 }
8150 }
8151
8153 {
8154 #ifdef SERVER
8155 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8156 GetHierarchyParent().IncreaseLifetimeUp();
8157 #endif
8158 };
8159
8161 {
8162 PlayerBase p = PlayerBase.Cast(player);
8163
8164 array<int> recipesIds = p.m_Recipes;
8165 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8166 if (moduleRecipesManager)
8167 {
8168 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8169 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8170 }
8171
8172 for (int i = 0;i < recipesIds.Count(); i++)
8173 {
8174 int key = recipesIds.Get(i);
8175 string recipeName = moduleRecipesManager.GetRecipeName(key);
8177 }
8178 }
8179
8180
8181 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8182 {
8183 super.GetDebugActions(outputList);
8184
8185
8191
8192
8197
8202
8203
8207
8208
8210 {
8214 }
8215
8218
8219
8223
8225
8226 InventoryLocation loc = new InventoryLocation();
8227 GetInventory().GetCurrentInventoryLocation(loc);
8229 {
8230 if (Gizmo_IsSupported())
8233 }
8234
8236 }
8237
8238
8239
8240
8242 {
8243 super.OnAction(action_id, player, ctx);
8244
8246 {
8247 switch (action_id)
8248 {
8251 return true;
8254 return true;
8255 }
8256 }
8257
8259 {
8260 switch (action_id)
8261 {
8263 Delete();
8264 return true;
8265 }
8266 }
8267
8268 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8269 {
8270 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8271 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8272 PlayerBase p = PlayerBase.Cast(player);
8273 if (
EActions.RECIPES_RANGE_START < 1000)
8274 {
8275 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8276 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8277 }
8278 }
8279 #ifndef SERVER
8280 else if (action_id ==
EActions.WATCH_PLAYER)
8281 {
8282 PluginDeveloper.SetDeveloperItemClientEx(player);
8283 }
8284 #endif
8286 {
8287 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8288 {
8289 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8290 OnDebugButtonPressServer(id + 1);
8291 }
8292
8293 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8294 {
8295 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8297 }
8298
8299 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8300 {
8301 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8303 }
8304
8305 else if (action_id ==
EActions.ADD_QUANTITY)
8306 {
8307 if (IsMagazine())
8308 {
8309 Magazine mag = Magazine.Cast(this);
8310 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8311 }
8312 else
8313 {
8315 }
8316
8317 if (m_EM)
8318 {
8319 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8320 }
8321
8322 }
8323
8324 else if (action_id ==
EActions.REMOVE_QUANTITY)
8325 {
8326 if (IsMagazine())
8327 {
8328 Magazine mag2 = Magazine.Cast(this);
8329 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8330 }
8331 else
8332 {
8334 }
8335 if (m_EM)
8336 {
8337 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8338 }
8339
8340 }
8341
8342 else if (action_id ==
EActions.SET_QUANTITY_0)
8343 {
8345
8346 if (m_EM)
8347 {
8348 m_EM.SetEnergy(0);
8349 }
8350 }
8351
8352 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8353 {
8355
8356 if (m_EM)
8357 {
8358 m_EM.SetEnergy(m_EM.GetEnergyMax());
8359 }
8360 }
8361
8362 else if (action_id ==
EActions.ADD_HEALTH)
8363 {
8364 AddHealth("","",GetMaxHealth("","Health")/5);
8365 }
8366 else if (action_id ==
EActions.REMOVE_HEALTH)
8367 {
8368 AddHealth("","",-GetMaxHealth("","Health")/5);
8369 }
8370 else if (action_id ==
EActions.DESTROY_HEALTH)
8371 {
8372 SetHealth01("","",0);
8373 }
8374 else if (action_id ==
EActions.WATCH_ITEM)
8375 {
8377 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8378 #ifdef DEVELOPER
8379 SetDebugDeveloper_item(this);
8380 #endif
8381 }
8382
8383 else if (action_id ==
EActions.ADD_TEMPERATURE)
8384 {
8385 AddTemperature(20);
8386
8387 }
8388
8389 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8390 {
8391 AddTemperature(-20);
8392
8393 }
8394
8395 else if (action_id ==
EActions.FLIP_FROZEN)
8396 {
8397 SetFrozen(!GetIsFrozen());
8398
8399 }
8400
8401 else if (action_id ==
EActions.ADD_WETNESS)
8402 {
8404
8405 }
8406
8407 else if (action_id ==
EActions.REMOVE_WETNESS)
8408 {
8410
8411 }
8412
8413 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8414 {
8417
8418
8419 }
8420
8421 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8422 {
8425 }
8426
8427 else if (action_id ==
EActions.MAKE_SPECIAL)
8428 {
8429 auto debugParams = DebugSpawnParams.WithPlayer(player);
8430 OnDebugSpawnEx(debugParams);
8431 }
8432
8433 }
8434
8435
8436 return false;
8437 }
8438
8439
8440
8441
8445
8448
8449
8450
8452 {
8453 return false;
8454 }
8455
8456
8458 {
8459 return true;
8460 }
8461
8462
8464 {
8465 return true;
8466 }
8467
8468
8469
8471 {
8472 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8474 }
8475
8478 {
8479 return null;
8480 }
8481
8483 {
8484 return false;
8485 }
8486
8488 {
8489 return false;
8490 }
8491
8495
8496
8498 {
8499 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8500 return module_repairing.CanRepair(this, item_repair_kit);
8501 }
8502
8503
8504 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8505 {
8506 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8507 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8508 }
8509
8510
8512 {
8513
8514
8515
8516
8517
8518
8519
8520
8521 return 1;
8522 }
8523
8524
8525
8527 {
8529 }
8530
8531
8532
8534 {
8536 }
8537
8538
8547 {
8548 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8549
8550 if (player)
8551 {
8552 player.MessageStatus(text);
8553 }
8554 }
8555
8556
8565 {
8566 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8567
8568 if (player)
8569 {
8570 player.MessageAction(text);
8571 }
8572 }
8573
8574
8583 {
8584 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8585
8586 if (player)
8587 {
8588 player.MessageFriendly(text);
8589 }
8590 }
8591
8592
8601 {
8602 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8603
8604 if (player)
8605 {
8606 player.MessageImportant(text);
8607 }
8608 }
8609
8611 {
8612 return true;
8613 }
8614
8615
8616 override bool KindOf(
string tag)
8617 {
8618 bool found = false;
8619 string item_name = this.
GetType();
8622
8623 int array_size = item_tag_array.Count();
8624 for (int i = 0; i < array_size; i++)
8625 {
8626 if (item_tag_array.Get(i) == tag)
8627 {
8628 found = true;
8629 break;
8630 }
8631 }
8632 return found;
8633 }
8634
8635
8637 {
8638
8639 super.OnRPC(sender, rpc_type,ctx);
8640
8641
8642 switch (rpc_type)
8643 {
8644 #ifndef SERVER
8645 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8646 Param2<bool, string> p = new Param2<bool, string>(false, "");
8647
8649 return;
8650
8651 bool play = p.param1;
8652 string soundSet = p.param2;
8653
8654 if (play)
8655 {
8657 {
8659 {
8661 }
8662 }
8663 else
8664 {
8666 }
8667 }
8668 else
8669 {
8671 }
8672
8673 break;
8674 #endif
8675
8676 }
8677
8679 {
8681 }
8682 }
8683
8684
8685
8686
8688 {
8689 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8690 return plugin.GetID(
name);
8691 }
8692
8694 {
8695 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8696 return plugin.GetName(id);
8697 }
8698
8701 {
8702
8703
8704 int varFlags;
8705 if (!ctx.
Read(varFlags))
8706 return;
8707
8708 if (varFlags & ItemVariableFlags.FLOAT)
8709 {
8711 }
8712 }
8713
8715 {
8716
8717 super.SerializeNumericalVars(floats_out);
8718
8719
8720
8722 {
8724 }
8725
8727 {
8729 }
8730
8732 {
8734 }
8735
8737 {
8742 }
8743
8745 {
8747 }
8748 }
8749
8751 {
8752
8753 super.DeSerializeNumericalVars(floats);
8754
8755
8756 int index = 0;
8757 int mask = Math.Round(floats.Get(index));
8758
8759 index++;
8760
8762 {
8764 {
8766 }
8767 else
8768 {
8769 float quantity = floats.Get(index);
8771 }
8772 index++;
8773 }
8774
8776 {
8777 float wet = floats.Get(index);
8779 index++;
8780 }
8781
8783 {
8784 int liquidtype = Math.Round(floats.Get(index));
8786 index++;
8787 }
8788
8790 {
8792 index++;
8794 index++;
8796 index++;
8798 index++;
8799 }
8800
8802 {
8803 int cleanness = Math.Round(floats.Get(index));
8805 index++;
8806 }
8807 }
8808
8810 {
8811 super.WriteVarsToCTX(ctx);
8812
8813
8815 {
8817 }
8818
8820 {
8822 }
8823
8825 {
8827 }
8828
8830 {
8831 int r,g,b,a;
8837 }
8838
8840 {
8842 }
8843 }
8844
8846 {
8847 if (!super.ReadVarsFromCTX(ctx,version))
8848 return false;
8849
8850 int intValue;
8851 float value;
8852
8853 if (version < 140)
8854 {
8855 if (!ctx.
Read(intValue))
8856 return false;
8857
8858 m_VariablesMask = intValue;
8859 }
8860
8862 {
8863 if (!ctx.
Read(value))
8864 return false;
8865
8867 {
8869 }
8870 else
8871 {
8873 }
8874 }
8875
8876 if (version < 140)
8877 {
8879 {
8880 if (!ctx.
Read(value))
8881 return false;
8882 SetTemperatureDirect(value);
8883 }
8884 }
8885
8887 {
8888 if (!ctx.
Read(value))
8889 return false;
8891 }
8892
8894 {
8895 if (!ctx.
Read(intValue))
8896 return false;
8898 }
8899
8901 {
8902 int r,g,b,a;
8904 return false;
8906 return false;
8908 return false;
8910 return false;
8911
8913 }
8914
8916 {
8917 if (!ctx.
Read(intValue))
8918 return false;
8920 }
8921
8922 if (version >= 138 && version < 140)
8923 {
8925 {
8926 if (!ctx.
Read(intValue))
8927 return false;
8928 SetFrozen(intValue);
8929 }
8930 }
8931
8932 return true;
8933 }
8934
8935
8937 {
8940 {
8942 }
8943
8944 if (!super.OnStoreLoad(ctx, version))
8945 {
8947 return false;
8948 }
8949
8950 if (version >= 114)
8951 {
8952 bool hasQuickBarIndexSaved;
8953
8954 if (!ctx.
Read(hasQuickBarIndexSaved))
8955 {
8957 return false;
8958 }
8959
8960 if (hasQuickBarIndexSaved)
8961 {
8962 int itmQBIndex;
8963
8964
8965 if (!ctx.
Read(itmQBIndex))
8966 {
8968 return false;
8969 }
8970
8971 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8972 if (itmQBIndex != -1 && parentPlayer)
8973 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8974 }
8975 }
8976 else
8977 {
8978
8979 PlayerBase player;
8980 int itemQBIndex;
8981 if (version ==
int.
MAX)
8982 {
8983 if (!ctx.
Read(itemQBIndex))
8984 {
8986 return false;
8987 }
8988 }
8989 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8990 {
8991
8992 if (!ctx.
Read(itemQBIndex))
8993 {
8995 return false;
8996 }
8997 if (itemQBIndex != -1 && player)
8998 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8999 }
9000 }
9001
9002 if (version < 140)
9003 {
9004
9005 if (!LoadVariables(ctx, version))
9006 {
9008 return false;
9009 }
9010 }
9011
9012
9014 {
9016 return false;
9017 }
9018 if (version >= 132)
9019 {
9021 if (raib)
9022 {
9024 {
9026 return false;
9027 }
9028 }
9029 }
9030
9032 return true;
9033 }
9034
9035
9036
9038 {
9039 super.OnStoreSave(ctx);
9040
9041 PlayerBase player;
9042 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9043 {
9045
9046 int itemQBIndex = -1;
9047 itemQBIndex = player.FindQuickBarEntityIndex(this);
9048 ctx.
Write(itemQBIndex);
9049 }
9050 else
9051 {
9053 }
9054
9056
9058 if (raib)
9059 {
9061 }
9062 }
9063
9064
9066 {
9067 super.AfterStoreLoad();
9068
9070 {
9072 }
9073
9075 {
9078 }
9079 }
9080
9082 {
9083 super.EEOnAfterLoad();
9084
9086 {
9088 }
9089
9092 }
9093
9095 {
9096 return false;
9097 }
9098
9099
9100
9102 {
9104 {
9105 #ifdef PLATFORM_CONSOLE
9106
9108 {
9110 if (menu)
9111 {
9113 }
9114 }
9115 #endif
9116 }
9117
9119 {
9122 }
9123
9125 {
9126 SetWeightDirty();
9128 }
9130 {
9133 }
9134
9136 {
9139 }
9141 {
9144 }
9145
9146 super.OnVariablesSynchronized();
9147 }
9148
9149
9150
9152 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9153 {
9154 if (!IsServerCheck(allow_client))
9155 return false;
9156
9158 return false;
9159
9162
9163 if (value <= (min + 0.001))
9164 value = min;
9165
9166 if (value == min)
9167 {
9168 if (destroy_config)
9169 {
9170 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9171 if (dstr)
9172 {
9174 this.Delete();
9175 return true;
9176 }
9177 }
9178 else if (destroy_forced)
9179 {
9181 this.Delete();
9182 return true;
9183 }
9184
9186 }
9187
9190
9192 {
9194
9195 if (delta)
9197 }
9198
9200
9201 return false;
9202 }
9203
9204
9206 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9207 {
9209 }
9210
9212 {
9215 }
9216
9218 {
9221 }
9222
9224 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9225 {
9226 float value_clamped = Math.Clamp(value, 0, 1);
9228 SetQuantity(result, destroy_config, destroy_forced);
9229 }
9230
9231
9234 {
9236 }
9237
9239 {
9241 }
9242
9243
9244
9245
9246
9247
9248
9249
9250
9251
9253 {
9254 int slot = -1;
9255 if (GetInventory())
9256 {
9257 InventoryLocation il = new InventoryLocation;
9258 GetInventory().GetCurrentInventoryLocation(il);
9260 }
9261
9263 }
9264
9266 {
9267 float quantity_max = 0;
9268
9270 {
9271 if (attSlotID != -1)
9272 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9273
9274 if (quantity_max <= 0)
9276 }
9277
9278 if (quantity_max <= 0)
9280
9281 return quantity_max;
9282 }
9283
9285 {
9287 }
9288
9290 {
9292 }
9293
9294
9296 {
9298 }
9299
9301 {
9303 }
9304
9306 {
9308 }
9309
9310
9312 {
9313
9314 float weightEx = GetWeightEx();
9315 float special = GetInventoryAndCargoWeight();
9316 return weightEx - special;
9317 }
9318
9319
9321 {
9323 }
9324
9326 {
9328 {
9329 #ifdef DEVELOPER
9330 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9331 {
9332 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9334 }
9335 #endif
9336
9338 }
9339 else if (HasEnergyManager())
9340 {
9341 #ifdef DEVELOPER
9342 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9343 {
9344 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9345 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9346 }
9347 #endif
9348 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9349 }
9350 else
9351 {
9352 #ifdef DEVELOPER
9353 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9354 {
9355 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9356 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9357 }
9358 #endif
9359 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9360 }
9361 }
9362
9365 {
9366 int item_count = 0;
9368
9369 if (GetInventory().GetCargo() != NULL)
9370 {
9371 item_count = GetInventory().GetCargo().GetItemCount();
9372 }
9373
9374 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
9375 {
9376 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
9377 if (item)
9378 item_count += item.GetNumberOfItems();
9379 }
9380 return item_count;
9381 }
9382
9385 {
9386 float weight = 0;
9387 float wetness = 1;
9388 if (include_wetness)
9391 {
9392 weight = wetness * m_ConfigWeight;
9393 }
9395 {
9396 weight = 1;
9397 }
9398 return weight;
9399 }
9400
9401
9402
9404 {
9405 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
9406 {
9407 GameInventory inv = GetInventory();
9408 array<EntityAI> items = new array<EntityAI>;
9410 for (int i = 0; i < items.Count(); i++)
9411 {
9413 if (item)
9414 {
9416 }
9417 }
9418 }
9419 }
9420
9421
9422
9423
9425 {
9426 float energy = 0;
9427 if (HasEnergyManager())
9428 {
9429 energy = GetCompEM().GetEnergy();
9430 }
9431 return energy;
9432 }
9433
9434
9436 {
9437 super.OnEnergyConsumed();
9438
9440 }
9441
9443 {
9444 super.OnEnergyAdded();
9445
9447 }
9448
9449
9451 {
9452 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9453 {
9455 {
9456 float energy_0to1 = GetCompEM().GetEnergy0To1();
9458 }
9459 }
9460 }
9461
9462
9464 {
9465 return ConfigGetFloat("heatIsolation");
9466 }
9467
9469 {
9471 }
9472
9474 {
9475 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9476 if (
GetGame().ConfigIsExisting(paramPath))
9478
9479 return 0.0;
9480 }
9481
9483 {
9484 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9485 if (
GetGame().ConfigIsExisting(paramPath))
9487
9488 return 0.0;
9489 }
9490
9491 override void SetWet(
float value,
bool allow_client =
false)
9492 {
9493 if (!IsServerCheck(allow_client))
9494 return;
9495
9498
9500
9501 m_VarWet = Math.Clamp(value, min, max);
9502
9504 {
9507 }
9508 }
9509
9510 override void AddWet(
float value)
9511 {
9513 }
9514
9516 {
9518 }
9519
9521 {
9523 }
9524
9526 {
9528 }
9529
9531 {
9533 }
9534
9536 {
9538 }
9539
9541 {
9544 if (newLevel != oldLevel)
9545 {
9547 }
9548 }
9549
9551 {
9552 SetWeightDirty();
9553 }
9554
9556 {
9557 return GetWetLevelInternal(
m_VarWet);
9558 }
9559
9560
9561
9563 {
9565 }
9566
9568 {
9570 }
9571
9573 {
9575 }
9576
9578 {
9580 }
9581
9582
9583
9585 {
9586 if (ConfigIsExisting("itemModelLength"))
9587 {
9588 return ConfigGetFloat("itemModelLength");
9589 }
9590 return 0;
9591 }
9592
9594 {
9595 if (ConfigIsExisting("itemAttachOffset"))
9596 {
9597 return ConfigGetFloat("itemAttachOffset");
9598 }
9599 return 0;
9600 }
9601
9602 override void SetCleanness(
int value,
bool allow_client =
false)
9603 {
9604 if (!IsServerCheck(allow_client))
9605 return;
9606
9608
9610
9613 }
9614
9616 {
9618 }
9619
9621 {
9622 return true;
9623 }
9624
9625
9626
9627
9629 {
9631 }
9632
9634 {
9636 }
9637
9638
9639
9640
9641 override void SetColor(
int r,
int g,
int b,
int a)
9642 {
9648 }
9650 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9651 {
9656 }
9657
9659 {
9661 }
9662
9665 {
9666 int r,g,b,a;
9668 r = r/255;
9669 g = g/255;
9670 b = b/255;
9671 a = a/255;
9672 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9673 }
9674
9675
9676
9677 override void SetLiquidType(
int value,
bool allow_client =
false)
9678 {
9679 if (!IsServerCheck(allow_client))
9680 return;
9681
9686 }
9687
9689 {
9690 return ConfigGetInt("varLiquidTypeInit");
9691 }
9692
9694 {
9696 }
9697
9699 {
9701 SetFrozen(false);
9702 }
9703
9706 {
9707 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9708 }
9709
9710
9713 {
9714 PlayerBase nplayer;
9715 if (PlayerBase.CastTo(nplayer, player))
9716 {
9718
9719 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9720 }
9721 }
9722
9723
9726 {
9727 PlayerBase nplayer;
9728 if (PlayerBase.CastTo(nplayer,player))
9729 {
9730
9731 nplayer.SetEnableQuickBarEntityShortcut(this,false);
9732
9733 }
9734
9735
9736 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9737
9738
9739 if (HasEnergyManager())
9740 {
9741 GetCompEM().UpdatePlugState();
9742 }
9743 }
9744
9745
9747 {
9748 super.OnPlacementStarted(player);
9749
9751 }
9752
9753 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9754 {
9756 {
9757 m_AdminLog.OnPlacementComplete(player,
this);
9758 }
9759
9760 super.OnPlacementComplete(player, position, orientation);
9761 }
9762
9763
9764
9765
9766
9768 {
9770 {
9771 return true;
9772 }
9773 else
9774 {
9775 return false;
9776 }
9777 }
9778
9779
9781 {
9783 {
9785 }
9786 }
9787
9788
9790 {
9792 }
9793
9795 {
9797 }
9798
9799 override void InsertAgent(
int agent,
float count = 1)
9800 {
9801 if (count < 1)
9802 return;
9803
9805 }
9806
9809 {
9811 }
9812
9813
9815 {
9817 }
9818
9819
9820
9821
9822
9823
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9861 {
9863 return false;
9864 return true;
9865 }
9866
9868 {
9869
9871 }
9872
9873
9876 {
9877 super.CheckForRoofLimited(timeTresholdMS);
9878
9880 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9881 {
9882 m_PreviousRoofTestTime = time;
9883 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9884 }
9885 }
9886
9887
9889 {
9891 {
9892 return 0;
9893 }
9894
9895 if (GetInventory().GetAttachmentSlotsCount() != 0)
9896 {
9897 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9898 if (filter)
9899 return filter.GetProtectionLevel(type, false, system);
9900 else
9901 return 0;
9902 }
9903
9904 string subclassPath, entryName;
9905
9906 switch (type)
9907 {
9909 entryName = "biological";
9910 break;
9912 entryName = "chemical";
9913 break;
9914 default:
9915 entryName = "biological";
9916 break;
9917 }
9918
9919 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9920
9922 }
9923
9924
9925
9928 {
9929 if (!IsMagazine())
9931
9933 }
9934
9935
9936
9937
9938
9943 {
9944 return true;
9945 }
9946
9948 {
9950 }
9951
9952
9953
9954
9955
9957 {
9958 if (parent)
9959 {
9960 if (parent.IsInherited(DayZInfected))
9961 return true;
9962
9963 if (!parent.IsRuined())
9964 return true;
9965 }
9966
9967 return true;
9968 }
9969
9971 {
9972 if (!super.CanPutAsAttachment(parent))
9973 {
9974 return false;
9975 }
9976
9977 if (!IsRuined() && !parent.IsRuined())
9978 {
9979 return true;
9980 }
9981
9982 return false;
9983 }
9984
9986 {
9987
9988
9989
9990
9991 return super.CanReceiveItemIntoCargo(item);
9992 }
9993
9995 {
9996
9997
9998
9999
10000 GameInventory attachmentInv = attachment.GetInventory();
10002 {
10003 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10004 return false;
10005 }
10006
10007 InventoryLocation loc = new InventoryLocation();
10008 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10009 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10010 return false;
10011
10012 return super.CanReceiveAttachment(attachment, slotId);
10013 }
10014
10016 {
10017 if (!super.CanReleaseAttachment(attachment))
10018 return false;
10019
10020 return GetInventory().AreChildrenAccessible();
10021 }
10022
10023
10024
10025
10026
10027
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10044 {
10045 int id = muzzle_owner.GetMuzzleID();
10046 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10047
10048 if (WPOF_array)
10049 {
10050 for (int i = 0; i < WPOF_array.Count(); i++)
10051 {
10052 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10053
10054 if (WPOF)
10055 {
10056 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10057 }
10058 }
10059 }
10060 }
10061
10062
10064 {
10065 int id = muzzle_owner.GetMuzzleID();
10067
10068 if (WPOBE_array)
10069 {
10070 for (int i = 0; i < WPOBE_array.Count(); i++)
10071 {
10072 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10073
10074 if (WPOBE)
10075 {
10076 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10077 }
10078 }
10079 }
10080 }
10081
10082
10084 {
10085 int id = muzzle_owner.GetMuzzleID();
10086 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10087
10088 if (WPOOH_array)
10089 {
10090 for (int i = 0; i < WPOOH_array.Count(); i++)
10091 {
10092 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10093
10094 if (WPOOH)
10095 {
10096 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10097 }
10098 }
10099 }
10100 }
10101
10102
10104 {
10105 int id = muzzle_owner.GetMuzzleID();
10106 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10107
10108 if (WPOOH_array)
10109 {
10110 for (int i = 0; i < WPOOH_array.Count(); i++)
10111 {
10112 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10113
10114 if (WPOOH)
10115 {
10116 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10117 }
10118 }
10119 }
10120 }
10121
10122
10124 {
10125 int id = muzzle_owner.GetMuzzleID();
10126 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10127
10128 if (WPOOH_array)
10129 {
10130 for (int i = 0; i < WPOOH_array.Count(); i++)
10131 {
10132 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10133
10134 if (WPOOH)
10135 {
10136 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10137 }
10138 }
10139 }
10140 }
10141
10142
10143
10145 {
10147 {
10148 return true;
10149 }
10150
10151 return false;
10152 }
10153
10155 {
10157 {
10158 return true;
10159 }
10160
10161 return false;
10162 }
10163
10165 {
10167 {
10168 return true;
10169 }
10170
10171 return false;
10172 }
10173
10175 {
10176 return false;
10177 }
10178
10181 {
10182 return UATimeSpent.DEFAULT_DEPLOY;
10183 }
10184
10185
10186
10187
10189 {
10191 SetSynchDirty();
10192 }
10193
10195 {
10197 }
10198
10199
10201 {
10202 return false;
10203 }
10204
10207 {
10208 string att_type = "None";
10209
10210 if (ConfigIsExisting("soundAttType"))
10211 {
10212 att_type = ConfigGetString("soundAttType");
10213 }
10214
10216 }
10217
10219 {
10221 }
10222
10223
10224
10225
10226
10232
10234 {
10237
10239 }
10240
10241
10243 {
10245 return;
10246
10248
10251
10254
10255 SoundParameters params = new SoundParameters();
10259 }
10260
10261
10263 {
10265 return;
10266
10268 SetSynchDirty();
10269
10272 }
10273
10274
10276 {
10278 return;
10279
10281 SetSynchDirty();
10282
10285 }
10286
10288 {
10290 }
10291
10293 {
10295 }
10296
10299 {
10300 if (!
GetGame().IsDedicatedServer())
10301 {
10302 if (ConfigIsExisting("attachSoundSet"))
10303 {
10304 string cfg_path = "";
10305 string soundset = "";
10306 string type_name =
GetType();
10307
10310 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10311 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10312
10313 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10314 {
10315 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10316 {
10317 if (cfg_slot_array[i] == slot_type)
10318 {
10319 soundset = cfg_soundset_array[i];
10320 break;
10321 }
10322 }
10323 }
10324
10325 if (soundset != "")
10326 {
10327 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10329 }
10330 }
10331 }
10332 }
10333
10335 {
10336
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
10700{
10702 if (entity)
10703 {
10704 bool is_item = entity.IsInherited(
ItemBase);
10705 if (is_item && full_quantity)
10706 {
10709 }
10710 }
10711 else
10712 {
10714 return NULL;
10715 }
10716 return entity;
10717}
10718
10720{
10721 if (item)
10722 {
10723 if (health > 0)
10724 item.SetHealth("", "", health);
10725
10726 if (item.CanHaveTemperature())
10727 {
10729 if (item.CanFreeze())
10730 item.SetFrozen(false);
10731 }
10732
10733 if (item.HasEnergyManager())
10734 {
10735 if (quantity >= 0)
10736 {
10737 item.GetCompEM().SetEnergy0To1(quantity);
10738 }
10739 else
10740 {
10742 }
10743 }
10744 else if (item.IsMagazine())
10745 {
10746 Magazine mag = Magazine.Cast(item);
10747 if (quantity >= 0)
10748 {
10749 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10750 }
10751 else
10752 {
10754 }
10755
10756 }
10757 else
10758 {
10759 if (quantity >= 0)
10760 {
10761 item.SetQuantityNormalized(quantity, false);
10762 }
10763 else
10764 {
10766 }
10767
10768 }
10769 }
10770}
10771
10772#ifdef DEVELOPER
10774#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.