5827{
5829 {
5830 return true;
5831 }
5832};
5833
5835{
5836
5837};
5838
5839
5840
5842{
5846
5848
5851
5852
5853
5854
5855
5864
5870
5875
5880
5901 protected bool m_IsResultOfSplit
5902
5904
5909
5910
5911
5913
5917
5918
5919
5921
5924
5925
5926
5932
5933
5941
5944
5945
5947
5948
5950
5951
5956
5957
5962
5964
5965
5967
5968
5970 {
5975
5976 if (!
g_Game.IsDedicatedServer())
5977 {
5979 {
5981
5983 {
5985 }
5986 }
5987
5990 }
5991
5992 m_OldLocation = null;
5993
5995 {
5997 }
5998
5999 if (ConfigIsExisting("headSelectionsToHide"))
6000 {
6003 }
6004
6006 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6007 {
6009 }
6010
6012
6013 m_IsResultOfSplit = false;
6014
6016 }
6017
6019 {
6020 super.InitItemVariables();
6021
6027 m_Count = ConfigGetInt(
"count");
6028
6031
6036
6039
6044
6056
6060
6061
6064 if (ConfigIsExisting("canBeSplit"))
6065 {
6068 }
6069
6071 if (ConfigIsExisting("itemBehaviour"))
6073
6074
6077 RegisterNetSyncVariableInt("m_VarLiquidType");
6078 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6079
6080 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6081 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6082 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6083
6084 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6085 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6086 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6087 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6088
6089 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6090 RegisterNetSyncVariableBool("m_IsTakeable");
6091 RegisterNetSyncVariableBool("m_IsHologram");
6092
6095 {
6098 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6099 }
6100
6102
6104 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6106
6108 }
6109
6111 {
6113 }
6114
6116 {
6119 {
6124 }
6125 }
6126
6127 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6128 {
6130 {
6133 }
6134
6136 }
6137
6139 {
6145 }
6146
6148
6150 {
6152
6153 if (!action)
6154 {
6155 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6156 return;
6157 }
6158
6160 if (!ai)
6161 {
6163 return;
6164 }
6165
6167 if (!action_array)
6168 {
6169 action_array = new array<ActionBase_Basic>;
6171 }
6172 if (LogManager.IsActionLogEnable())
6173 {
6174 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6175 }
6176
6177 if (action_array.Find(action) != -1)
6178 {
6179 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6180 }
6181 else
6182 {
6183 action_array.Insert(action);
6184 }
6185 }
6186
6188 {
6189 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6190 ActionBase action = player.GetActionManager().GetAction(actionName);
6193
6194 if (action_array)
6195 {
6196 action_array.RemoveItem(action);
6197 }
6198 }
6199
6200
6201
6203 {
6204 ActionOverrideData overrideData = new ActionOverrideData();
6208
6210 if (!actionMap)
6211 {
6214 }
6215
6216 actionMap.Insert(this.
Type(), overrideData);
6217
6218 }
6219
6221
6223
6224
6226 {
6229
6232
6233 string config_to_search = "CfgVehicles";
6234 string muzzle_owner_config;
6235
6237 {
6238 if (IsInherited(Weapon))
6239 config_to_search = "CfgWeapons";
6240
6241 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6242
6243 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6244
6245 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6246
6247 if (config_OnFire_subclass_count > 0)
6248 {
6249 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6250
6251 for (int i = 0; i < config_OnFire_subclass_count; i++)
6252 {
6253 string particle_class = "";
6254 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6255 string config_OnFire_entry = config_OnFire_class + particle_class;
6256 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6257 WPOF_array.Insert(WPOF);
6258 }
6259
6260
6262 }
6263 }
6264
6266 {
6267 config_to_search = "CfgWeapons";
6268 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6269
6270 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6271
6272 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6273
6274 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6275 {
6276 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6277
6278 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6279 {
6280 string particle_class2 = "";
6281 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6282 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6283 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6284 WPOBE_array.Insert(WPOBE);
6285 }
6286
6287
6289 }
6290 }
6291 }
6292
6293
6295 {
6298
6300 {
6301 string config_to_search = "CfgVehicles";
6302
6303 if (IsInherited(Weapon))
6304 config_to_search = "CfgWeapons";
6305
6306 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6307 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6308
6309 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6310 {
6311
6313
6315 {
6317 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6319 return;
6320 }
6321
6324
6325
6326
6327 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6328 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6329
6330 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6331 {
6332 string particle_class = "";
6333 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6334 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6335 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6336
6337 if (entry_type == CT_CLASS)
6338 {
6339 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6340 WPOOH_array.Insert(WPOF);
6341 }
6342 }
6343
6344
6346 }
6347 }
6348 }
6349
6351 {
6353 }
6354
6356 {
6358 {
6360
6363
6366
6367 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6368 }
6369 }
6370
6372 {
6374 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6375
6377 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6378
6380 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6381
6383 {
6385 }
6386 }
6387
6389 {
6391 }
6392
6394 {
6397 else
6399
6401 {
6404 }
6405 else
6406 {
6409
6412 }
6413
6415 }
6416
6418 {
6420 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6421 }
6422
6424 {
6426 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6428 }
6429
6431 {
6433 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6434 }
6435
6437 {
6440
6441 OverheatingParticle OP = new OverheatingParticle();
6446
6448 }
6449
6451 {
6454
6455 return -1;
6456 }
6457
6459 {
6461 {
6464
6465 for (int i = count; i > 0; --i)
6466 {
6467 int id = i - 1;
6470
6473
6474 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6475 {
6476 if (p)
6477 {
6480 }
6481 }
6482 }
6483 }
6484 }
6485
6487 {
6489 {
6491 {
6492 int id = i - 1;
6494
6495 if (OP)
6496 {
6498
6499 if (p)
6500 {
6502 }
6503
6504 delete OP;
6505 }
6506 }
6507
6510 }
6511 }
6512
6515 {
6516 return 0.0;
6517 }
6518
6519
6521 {
6522 return 250;
6523 }
6524
6526 {
6527 return 0;
6528 }
6529
6532 {
6534 return true;
6535
6536 return false;
6537 }
6538
6541 {
6544
6546 {
6548 }
6549 else
6550 {
6551
6553 }
6554
6556 }
6557
6564 {
6565 return -1;
6566 }
6567
6568
6569
6570
6572 {
6574 {
6575 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6576 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6577
6578 if (r_index >= 0)
6579 {
6580 InventoryLocation r_il = new InventoryLocation;
6581 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6582
6583 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6586 {
6587 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6588 }
6590 {
6591 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6592 }
6593
6594 }
6595
6596 player.GetHumanInventory().ClearUserReservedLocation(this);
6597 }
6598
6601 }
6602
6603
6604
6605
6607 {
6608 return ItemBase.m_DebugActionsMask;
6609 }
6610
6612 {
6613 return ItemBase.m_DebugActionsMask & mask;
6614 }
6615
6617 {
6618 ItemBase.m_DebugActionsMask = mask;
6619 }
6620
6622 {
6623 ItemBase.m_DebugActionsMask |= mask;
6624 }
6625
6627 {
6628 ItemBase.m_DebugActionsMask &= ~mask;
6629 }
6630
6632 {
6634 {
6636 }
6637 else
6638 {
6640 }
6641 }
6642
6643
6645 {
6646 if (GetEconomyProfile())
6647 {
6648 float q_max = GetEconomyProfile().GetQuantityMax();
6649 if (q_max > 0)
6650 {
6651 float q_min = GetEconomyProfile().GetQuantityMin();
6652 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6653
6655 {
6656 ComponentEnergyManager comp = GetCompEM();
6658 {
6660 }
6661 }
6663 {
6665
6666 }
6667
6668 }
6669 }
6670 }
6671
6674 {
6675 EntityAI parent = GetHierarchyParent();
6676
6677 if (parent)
6678 {
6679 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6680 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6681 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6682 }
6683 }
6684
6687 {
6688 EntityAI parent = GetHierarchyParent();
6689
6690 if (parent)
6691 {
6692 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6693 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6694 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6695 }
6696 }
6697
6699 {
6700
6701
6702
6703
6705
6707 {
6708 if (ScriptInputUserData.CanStoreInputUserData())
6709 {
6710 ScriptInputUserData ctx = new ScriptInputUserData;
6716 ctx.
Write(use_stack_max);
6719
6721 {
6722 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6723 }
6724 }
6725 }
6726 else if (!
g_Game.IsMultiplayer())
6727 {
6729 }
6730 }
6731
6733 {
6735 }
6736
6738 {
6740 }
6741
6743 {
6745 }
6746
6748 {
6749
6750 return false;
6751 }
6752
6754 {
6755 return false;
6756 }
6757
6761 {
6762 return false;
6763 }
6764
6766 {
6767 return "";
6768 }
6769
6771
6773 {
6774 return false;
6775 }
6776
6778 {
6779 return true;
6780 }
6781
6782
6783
6785 {
6786 return true;
6787 }
6788
6790 {
6791 return true;
6792 }
6793
6795 {
6796 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6798 }
6799
6801 {
6803 }
6804
6806 {
6808 if (!is_being_placed)
6810 SetSynchDirty();
6811 }
6812
6813
6815
6817 {
6819 }
6820
6822 {
6824 }
6825
6827 {
6828 return 1;
6829 }
6830
6832 {
6833 return false;
6834 }
6835
6837 {
6839 SetSynchDirty();
6840 }
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6877 {
6878 super.OnMovedInsideCargo(container);
6879
6880 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6881 }
6882
6883 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6884 {
6885 super.EEItemLocationChanged(oldLoc, newLoc);
6886
6887 PlayerBase newPlayer = null;
6888 PlayerBase oldPlayer = null;
6889
6890 if (newLoc.GetParent())
6891 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6892
6893 if (oldLoc.GetParent())
6894 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6895
6897 {
6898 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6899
6900 if (rIndex >= 0)
6901 {
6902 InventoryLocation rIl = new InventoryLocation;
6903 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6904
6905 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6908 {
6909 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6910 }
6912 {
6914 }
6915
6916 }
6917 }
6918
6920 {
6921 if (newPlayer)
6922 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6923
6924 if (newPlayer == oldPlayer)
6925 {
6926 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6927 {
6929 {
6930 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6931 {
6932 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6933 }
6934 }
6935 else
6936 {
6937 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6938 }
6939 }
6940
6941 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6942 {
6943 int type = oldLoc.GetType();
6945 {
6946 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6947 }
6949 {
6950 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6951 }
6952 }
6953 if (!m_OldLocation)
6954 {
6955 m_OldLocation = new InventoryLocation;
6956 }
6957 m_OldLocation.Copy(oldLoc);
6958 }
6959 else
6960 {
6961 if (m_OldLocation)
6962 {
6963 m_OldLocation.Reset();
6964 }
6965 }
6966
6967 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6968 }
6969 else
6970 {
6971 if (newPlayer)
6972 {
6973 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6974 if (resIndex >= 0)
6975 {
6976 InventoryLocation il = new InventoryLocation;
6977 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6979 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6982 {
6983 il.
GetParent().GetOnReleaseLock().Invoke(it);
6984 }
6986 {
6988 }
6989
6990 }
6991 }
6993 {
6994
6996 }
6997
6998 if (m_OldLocation)
6999 {
7000 m_OldLocation.Reset();
7001 }
7002 }
7003
7005 {
7006 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7007 }
7008
7010 {
7011 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7012 }
7013 }
7014
7015 override void EOnContact(IEntity other, Contact extra)
7016 {
7018 {
7019 int liquidType = -1;
7021 if (impactSpeed > 0.0)
7022 {
7024 #ifndef SERVER
7026 #else
7028 SetSynchDirty();
7029 #endif
7031 }
7032 }
7033
7034 #ifdef SERVER
7035 if (GetCompEM() && GetCompEM().IsPlugged())
7036 {
7037 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7038 GetCompEM().UnplugThis();
7039 }
7040 #endif
7041 }
7042
7044
7046 {
7048 }
7049
7051 {
7052
7053 }
7054
7056 {
7057 super.OnItemLocationChanged(old_owner, new_owner);
7058
7059 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7060 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7061
7062 if (!relatedPlayer && playerNew)
7063 relatedPlayer = playerNew;
7064
7065 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7066 {
7068 if (actionMgr)
7069 {
7070 ActionBase currentAction = actionMgr.GetRunningAction();
7071 if (currentAction)
7073 }
7074 }
7075
7076 Man ownerPlayerOld = null;
7077 Man ownerPlayerNew = null;
7078
7079 if (old_owner)
7080 {
7081 if (old_owner.
IsMan())
7082 {
7083 ownerPlayerOld = Man.Cast(old_owner);
7084 }
7085 else
7086 {
7087 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7088 }
7089 }
7090 else
7091 {
7093 {
7095
7096 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7097 {
7098 GetCompEM().UnplugThis();
7099 }
7100 }
7101 }
7102
7103 if (new_owner)
7104 {
7105 if (new_owner.
IsMan())
7106 {
7107 ownerPlayerNew = Man.Cast(new_owner);
7108 }
7109 else
7110 {
7111 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7112 }
7113 }
7114
7115 if (ownerPlayerOld != ownerPlayerNew)
7116 {
7117 if (ownerPlayerOld)
7118 {
7119 array<EntityAI> subItemsExit = new array<EntityAI>;
7121 for (int i = 0; i < subItemsExit.Count(); i++)
7122 {
7125 }
7126 }
7127
7128 if (ownerPlayerNew)
7129 {
7130 array<EntityAI> subItemsEnter = new array<EntityAI>;
7132 for (int j = 0; j < subItemsEnter.Count(); j++)
7133 {
7136 }
7137 }
7138 }
7139 else if (ownerPlayerNew != null)
7140 {
7141 PlayerBase nplayer;
7142 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7143 {
7144 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7146 for (int k = 0; k < subItemsUpdate.Count(); k++)
7147 {
7149 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7150 }
7151 }
7152 }
7153
7154 if (old_owner)
7155 old_owner.OnChildItemRemoved(this);
7156 if (new_owner)
7157 new_owner.OnChildItemReceived(this);
7158 }
7159
7160
7162 {
7163 super.EEDelete(parent);
7164 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7165 if (player)
7166 {
7168
7169 if (player.IsAlive())
7170 {
7171 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7172 if (r_index >= 0)
7173 {
7174 InventoryLocation r_il = new InventoryLocation;
7175 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7176
7177 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7180 {
7181 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7182 }
7184 {
7185 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7186 }
7187
7188 }
7189
7190 player.RemoveQuickBarEntityShortcut(this);
7191 }
7192 }
7193 }
7194
7196 {
7197 super.EEKilled(killer);
7198
7201 {
7202 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7203 {
7204 if (IsMagazine())
7205 {
7206 if (Magazine.Cast(this).GetAmmoCount() > 0)
7207 {
7209 }
7210 }
7211 else
7212 {
7214 }
7215 }
7216 }
7217 }
7218
7220 {
7221 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7222
7223 super.OnWasAttached(parent, slot_id);
7224
7227
7230 }
7231
7233 {
7234 super.OnWasDetached(parent, slot_id);
7235
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 ];
7328 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
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 CargoBase cargo = GetInventory().GetCargo();
7387 if (cargo)
7388 {
7390 if (item_count > 0)
7391 {
7392 int random_pick = Math.RandomInt(0, item_count);
7394 if (!item.IsExplosive())
7395 {
7396 item.AddHealth("","",damage);
7397 return true;
7398 }
7399 }
7400 }
7401 return false;
7402 }
7403
7405 {
7406 GameInventory inventory = GetInventory();
7408 if (attachment_count > 0)
7409 {
7410 int random_pick = Math.RandomInt(0, attachment_count);
7412 if (!attachment.IsExplosive())
7413 {
7414 attachment.AddHealth("","",damage);
7415 return true;
7416 }
7417 }
7418 return false;
7419 }
7420
7422 {
7424 }
7425
7427 {
7429 return GetInventory().CanRemoveEntity();
7430
7431 return false;
7432 }
7433
7435 {
7436
7438 return false;
7439
7440
7442 return false;
7443
7444
7445
7447 if (delta == 0)
7448 return false;
7449
7450
7451 return true;
7452 }
7453
7455 {
7457 {
7458 if (ScriptInputUserData.CanStoreInputUserData())
7459 {
7460 ScriptInputUserData ctx = new ScriptInputUserData;
7465 ctx.
Write(destination_entity);
7469 }
7470 }
7471 else if (!
g_Game.IsMultiplayer())
7472 {
7474 }
7475 }
7476
7478 {
7479 float split_quantity_new;
7483 InventoryLocation loc = new InventoryLocation;
7484
7485 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7486 {
7488 split_quantity_new = stack_max;
7489 else
7491
7493 {
7494 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7495 if (new_item)
7496 {
7497 new_item.SetResultOfSplit(true);
7498 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7500 new_item.
SetQuantity(split_quantity_new,
false,
true);
7501 }
7502 }
7503 }
7504 else if (destination_entity && slot_id == -1)
7505 {
7506 if (quantity > stack_max)
7507 split_quantity_new = stack_max;
7508 else
7509 split_quantity_new = quantity;
7510
7512 {
7513 GameInventory destinationInventory = destination_entity.GetInventory();
7515 {
7518 }
7519
7520 if (new_item)
7521 {
7522 new_item.SetResultOfSplit(true);
7523 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7525 new_item.
SetQuantity(split_quantity_new,
false,
true);
7526 }
7527 }
7528 }
7529 else
7530 {
7531 if (stack_max != 0)
7532 {
7534 {
7536 }
7537
7538 if (split_quantity_new == 0)
7539 {
7540 if (!
g_Game.IsMultiplayer())
7541 player.PhysicalPredictiveDropItem(this);
7542 else
7543 player.ServerDropEntity(this);
7544 return;
7545 }
7546
7548 {
7550
7551 if (new_item)
7552 {
7553 new_item.SetResultOfSplit(true);
7554 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7557 new_item.PlaceOnSurface();
7558 }
7559 }
7560 }
7561 }
7562 }
7563
7565 {
7566 float split_quantity_new;
7570 InventoryLocation loc = new InventoryLocation;
7571
7572 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7573 {
7575 split_quantity_new = stack_max;
7576 else
7578
7580 {
7581 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7582 if (new_item)
7583 {
7584 new_item.SetResultOfSplit(true);
7585 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7587 new_item.
SetQuantity(split_quantity_new,
false,
true);
7588 }
7589 }
7590 }
7591 else if (destination_entity && slot_id == -1)
7592 {
7593 if (quantity > stack_max)
7594 split_quantity_new = stack_max;
7595 else
7596 split_quantity_new = quantity;
7597
7599 {
7600 GameInventory destinationInventory = destination_entity.GetInventory();
7602 {
7605 }
7606
7607 if (new_item)
7608 {
7609 new_item.SetResultOfSplit(true);
7610 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7612 new_item.
SetQuantity(split_quantity_new,
false,
true);
7613 }
7614 }
7615 }
7616 else
7617 {
7618 if (stack_max != 0)
7619 {
7621 {
7623 }
7624
7626 {
7628
7629 if (new_item)
7630 {
7631 new_item.SetResultOfSplit(true);
7632 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7635 new_item.PlaceOnSurface();
7636 }
7637 }
7638 }
7639 }
7640 }
7641
7643 {
7645 {
7646 if (ScriptInputUserData.CanStoreInputUserData())
7647 {
7648 ScriptInputUserData ctx = new ScriptInputUserData;
7653 dst.WriteToContext(ctx);
7655 }
7656 }
7657 else if (!
g_Game.IsMultiplayer())
7658 {
7660 }
7661 }
7662
7664 {
7666 {
7667 if (ScriptInputUserData.CanStoreInputUserData())
7668 {
7669 ScriptInputUserData ctx = new ScriptInputUserData;
7674 ctx.
Write(destination_entity);
7680 }
7681 }
7682 else if (!
g_Game.IsMultiplayer())
7683 {
7685 }
7686 }
7687
7689 {
7691 }
7692
7694 {
7696 float split_quantity_new;
7698 if (dst.IsValid())
7699 {
7700 int slot_id = dst.GetSlot();
7702
7703 if (quantity > stack_max)
7704 split_quantity_new = stack_max;
7705 else
7706 split_quantity_new = quantity;
7707
7709 {
7711
7712 if (new_item)
7713 {
7714 new_item.SetResultOfSplit(true);
7715 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7717 new_item.
SetQuantity(split_quantity_new,
false,
true);
7718 }
7719
7720 return new_item;
7721 }
7722 }
7723
7724 return null;
7725 }
7726
7728 {
7730 float split_quantity_new;
7732 if (destination_entity)
7733 {
7735 if (quantity > stackable)
7736 split_quantity_new = stackable;
7737 else
7738 split_quantity_new = quantity;
7739
7741 {
7742 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7743 if (new_item)
7744 {
7745 new_item.SetResultOfSplit(true);
7746 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7748 new_item.
SetQuantity(split_quantity_new,
false,
true);
7749 }
7750 }
7751 }
7752 }
7753
7755 {
7757 {
7758 if (ScriptInputUserData.CanStoreInputUserData())
7759 {
7760 ScriptInputUserData ctx = new ScriptInputUserData;
7765 ItemBase destination_entity =
this;
7766 ctx.
Write(destination_entity);
7770 }
7771 }
7772 else if (!
g_Game.IsMultiplayer())
7773 {
7775 }
7776 }
7777
7779 {
7781 float split_quantity_new;
7783 if (player)
7784 {
7786 if (quantity > stackable)
7787 split_quantity_new = stackable;
7788 else
7789 split_quantity_new = quantity;
7790
7792 {
7793 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7794 new_item =
ItemBase.Cast(in_hands);
7795 if (new_item)
7796 {
7797 new_item.SetResultOfSplit(true);
7798 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7800 new_item.SetQuantity(split_quantity_new, false, true);
7801 }
7802 }
7803 }
7804 }
7805
7807 {
7809 float split_quantity_new = Math.Floor(quantity * 0.5);
7810
7812 return;
7813
7815
7816 if (new_item)
7817 {
7818 if (new_item.GetQuantityMax() < split_quantity_new)
7819 {
7820 split_quantity_new = new_item.GetQuantityMax();
7821 }
7822
7823 new_item.SetResultOfSplit(true);
7824 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7825
7827 {
7830 }
7831 else
7832 {
7834 new_item.
SetQuantity(split_quantity_new,
false,
true);
7835 }
7836 }
7837 }
7838
7840 {
7842 float split_quantity_new = Math.Floor(quantity / 2);
7843
7845 return;
7846
7847 InventoryLocation invloc = new InventoryLocation;
7849
7851 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7852
7853 if (new_item)
7854 {
7855 if (new_item.GetQuantityMax() < split_quantity_new)
7856 {
7857 split_quantity_new = new_item.GetQuantityMax();
7858 }
7860 {
7863 }
7864 else if (split_quantity_new > 1)
7865 {
7867 new_item.
SetQuantity(split_quantity_new,
false,
true);
7868 }
7869 }
7870 }
7871
7874 {
7875 SetWeightDirty();
7877
7878 if (parent)
7879 parent.OnAttachmentQuantityChangedEx(this, delta);
7880
7882 {
7884 {
7886 }
7888 {
7889 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7891 }
7892 }
7893 }
7894
7897 {
7898
7899 }
7900
7903 {
7905 }
7906
7908 {
7909 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7910
7912 {
7913 if (newLevel == GameConstants.STATE_RUINED)
7914 {
7916 EntityAI parent = GetHierarchyParent();
7917 if (parent && parent.IsFireplace())
7918 {
7919 CargoBase cargo = GetInventory().GetCargo();
7920 if (cargo)
7921 {
7923 {
7925 }
7926 }
7927 }
7928 }
7929
7931 {
7932
7934 return;
7935 }
7936
7937 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7938 {
7940 }
7941 }
7942 }
7943
7944
7946 {
7947 super.OnRightClick();
7948
7950 {
7952 {
7953 if (ScriptInputUserData.CanStoreInputUserData())
7954 {
7955 EntityAI root = GetHierarchyRoot();
7956 Man playerOwner = GetHierarchyRootPlayer();
7957 InventoryLocation dst = new InventoryLocation;
7958
7959
7960 if (!playerOwner && root && root == this)
7961 {
7963 }
7964 else
7965 {
7966
7967 GetInventory().GetCurrentInventoryLocation(dst);
7969 {
7970 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7972 {
7974 }
7975 else
7976 {
7978
7979
7980 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7981 {
7983 }
7984 else
7985 {
7986 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7987 }
7988 }
7989 }
7990 }
7991
7992 ScriptInputUserData ctx = new ScriptInputUserData;
8000 }
8001 }
8002 else if (!
g_Game.IsMultiplayer())
8003 {
8005 }
8006 }
8007 }
8008
8010 {
8011 if (root)
8012 {
8013 vector m4[4];
8014 root.GetTransform(m4);
8015 dst.SetGround(this, m4);
8016 }
8017 else
8018 {
8019 GetInventory().GetCurrentInventoryLocation(dst);
8020 }
8021 }
8022
8023 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8024 {
8025
8026 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8027 return false;
8028
8029 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8030 return false;
8031
8032
8034 return false;
8035
8036
8037 Magazine mag = Magazine.Cast(this);
8038 if (mag)
8039 {
8040 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8041 return false;
8042
8043 if (stack_max_limit)
8044 {
8045 Magazine other_mag = Magazine.Cast(other_item);
8046 if (other_item)
8047 {
8048 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8049 return false;
8050 }
8051
8052 }
8053 }
8054 else
8055 {
8056
8058 return false;
8059
8061 return false;
8062 }
8063
8064 PlayerBase player = null;
8065 if (CastTo(player, GetHierarchyRootPlayer()))
8066 {
8067 if (player.GetInventory().HasAttachment(this))
8068 return false;
8069
8070 if (player.IsItemsToDelete())
8071 return false;
8072 }
8073
8074 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8075 return false;
8076
8077 int slotID;
8079 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8080 return false;
8081
8082 return true;
8083 }
8084
8086 {
8088 }
8089
8091 {
8092 return m_IsResultOfSplit;
8093 }
8094
8096 {
8097 m_IsResultOfSplit = value;
8098 }
8099
8101 {
8103 }
8104
8106 {
8107 float other_item_quantity = other_item.GetQuantity();
8108 float this_free_space;
8109
8111
8113
8114 if (other_item_quantity > this_free_space)
8115 {
8116 return this_free_space;
8117 }
8118 else
8119 {
8120 return other_item_quantity;
8121 }
8122 }
8123
8125 {
8127 }
8128
8130 {
8132 return;
8133
8134 if (!IsMagazine() && other_item)
8135 {
8137 if (quantity_used != 0)
8138 {
8139 float hp1 = GetHealth01("","");
8140 float hp2 = other_item.GetHealth01("","");
8141 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8142 hpResult = hpResult / (
GetQuantity() + quantity_used);
8143
8144 hpResult *= GetMaxHealth();
8145 Math.Round(hpResult);
8146 SetHealth("", "Health", hpResult);
8147
8149 other_item.AddQuantity(-quantity_used);
8150 }
8151 }
8153 }
8154
8156 {
8157 #ifdef SERVER
8158 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8159 GetHierarchyParent().IncreaseLifetimeUp();
8160 #endif
8161 };
8162
8164 {
8165 PlayerBase p = PlayerBase.Cast(player);
8166
8167 array<int> recipesIds = p.m_Recipes;
8168 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8169 if (moduleRecipesManager)
8170 {
8171 EntityAI itemInHands = player.GetEntityInHands();
8172 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8173 }
8174
8175 for (int i = 0;i < recipesIds.Count(); i++)
8176 {
8177 int key = recipesIds.Get(i);
8178 string recipeName = moduleRecipesManager.GetRecipeName(key);
8180 }
8181 }
8182
8183
8184 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8185 {
8186 super.GetDebugActions(outputList);
8187
8188
8194
8195
8200
8205
8206
8210
8211
8213 {
8217 }
8218
8221
8222
8226
8228
8229 InventoryLocation loc = new InventoryLocation();
8230 GetInventory().GetCurrentInventoryLocation(loc);
8232 {
8233 if (Gizmo_IsSupported())
8236 }
8237
8239 }
8240
8241
8242
8243
8245 {
8246 super.OnAction(action_id, player, ctx);
8247
8249 {
8250 switch (action_id)
8251 {
8255 return true;
8259 return true;
8260 }
8261 }
8262
8264 {
8265 switch (action_id)
8266 {
8268 Delete();
8269 return true;
8270 }
8271 }
8272
8273 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8274 {
8275 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8276 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8277 PlayerBase p = PlayerBase.Cast(player);
8278 if (
EActions.RECIPES_RANGE_START < 1000)
8279 {
8280 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8281 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8282 }
8283 }
8284 #ifndef SERVER
8285 else if (action_id ==
EActions.WATCH_PLAYER)
8286 {
8287 PluginDeveloper.SetDeveloperItemClientEx(player);
8288 }
8289 #endif
8291 {
8292 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8293 {
8294 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8295 OnDebugButtonPressServer(id + 1);
8296 }
8297
8298 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8299 {
8300 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8302 }
8303
8304 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8305 {
8306 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8308 }
8309
8310 else if (action_id ==
EActions.ADD_QUANTITY)
8311 {
8312 if (IsMagazine())
8313 {
8314 Magazine mag = Magazine.Cast(this);
8315 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8316 }
8317 else
8318 {
8320 }
8321
8322 if (m_EM)
8323 {
8324 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8325 }
8326
8327 }
8328
8329 else if (action_id ==
EActions.REMOVE_QUANTITY)
8330 {
8331 if (IsMagazine())
8332 {
8333 Magazine mag2 = Magazine.Cast(this);
8334 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8335 }
8336 else
8337 {
8339 }
8340 if (m_EM)
8341 {
8342 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8343 }
8344
8345 }
8346
8347 else if (action_id ==
EActions.SET_QUANTITY_0)
8348 {
8350
8351 if (m_EM)
8352 {
8353 m_EM.SetEnergy(0);
8354 }
8355 }
8356
8357 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8358 {
8360
8361 if (m_EM)
8362 {
8363 m_EM.SetEnergy(m_EM.GetEnergyMax());
8364 }
8365 }
8366
8367 else if (action_id ==
EActions.ADD_HEALTH)
8368 {
8369 AddHealth("","",GetMaxHealth("","Health")/5);
8370 }
8371 else if (action_id ==
EActions.REMOVE_HEALTH)
8372 {
8373 AddHealth("","",-GetMaxHealth("","Health")/5);
8374 }
8375 else if (action_id ==
EActions.DESTROY_HEALTH)
8376 {
8377 SetHealth01("","",0);
8378 }
8379 else if (action_id ==
EActions.WATCH_ITEM)
8380 {
8382 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8383 #ifdef DEVELOPER
8384 SetDebugDeveloper_item(this);
8385 #endif
8386 }
8387
8388 else if (action_id ==
EActions.ADD_TEMPERATURE)
8389 {
8390 AddTemperature(20);
8391
8392 }
8393
8394 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8395 {
8396 AddTemperature(-20);
8397
8398 }
8399
8400 else if (action_id ==
EActions.FLIP_FROZEN)
8401 {
8402 SetFrozen(!GetIsFrozen());
8403
8404 }
8405
8406 else if (action_id ==
EActions.ADD_WETNESS)
8407 {
8409
8410 }
8411
8412 else if (action_id ==
EActions.REMOVE_WETNESS)
8413 {
8415
8416 }
8417
8418 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8419 {
8422
8423
8424 }
8425
8426 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8427 {
8430 }
8431
8432 else if (action_id ==
EActions.MAKE_SPECIAL)
8433 {
8434 auto debugParams = DebugSpawnParams.WithPlayer(player);
8435 OnDebugSpawnEx(debugParams);
8436 }
8437
8438 }
8439
8440
8441 return false;
8442 }
8443
8444
8445
8446
8450
8453
8454
8455
8457 {
8458 return false;
8459 }
8460
8461
8463 {
8464 return true;
8465 }
8466
8467
8469 {
8470 return true;
8471 }
8472
8473
8474
8476 {
8477 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8478 return g_Game.ConfigIsExisting(config_path);
8479 }
8480
8483 {
8484 return null;
8485 }
8486
8488 {
8489 return false;
8490 }
8491
8493 {
8494 return false;
8495 }
8496
8500
8501
8503 {
8504 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8505 return module_repairing.CanRepair(this, item_repair_kit);
8506 }
8507
8508
8509 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8510 {
8511 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8512 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8513 }
8514
8515
8517 {
8518
8519
8520
8521
8522
8523
8524
8525
8526 return 1;
8527 }
8528
8529
8530
8532 {
8534 }
8535
8536
8537
8539 {
8541 }
8542
8543
8552 {
8553 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8554
8555 if (player)
8556 {
8557 player.MessageStatus(text);
8558 }
8559 }
8560
8561
8570 {
8571 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8572
8573 if (player)
8574 {
8575 player.MessageAction(text);
8576 }
8577 }
8578
8579
8588 {
8589 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8590
8591 if (player)
8592 {
8593 player.MessageFriendly(text);
8594 }
8595 }
8596
8597
8606 {
8607 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8608
8609 if (player)
8610 {
8611 player.MessageImportant(text);
8612 }
8613 }
8614
8616 {
8617 return true;
8618 }
8619
8620
8621 override bool KindOf(
string tag)
8622 {
8623 bool found = false;
8624 string item_name = this.
GetType();
8626 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8627
8628 int array_size = item_tag_array.Count();
8629 for (int i = 0; i < array_size; i++)
8630 {
8631 if (item_tag_array.Get(i) == tag)
8632 {
8633 found = true;
8634 break;
8635 }
8636 }
8637 return found;
8638 }
8639
8640
8642 {
8643
8644 super.OnRPC(sender, rpc_type,ctx);
8645
8646
8647 switch (rpc_type)
8648 {
8649 #ifndef SERVER
8650 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8651 Param2<bool, string> p = new Param2<bool, string>(false, "");
8652
8654 return;
8655
8656 bool play = p.param1;
8657 string soundSet = p.param2;
8658
8659 if (play)
8660 {
8662 {
8664 {
8666 }
8667 }
8668 else
8669 {
8671 }
8672 }
8673 else
8674 {
8676 }
8677
8678 break;
8679 #endif
8680
8681 }
8682
8684 {
8686 }
8687 }
8688
8689
8690
8691
8693 {
8694 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8695 return plugin.GetID(
name);
8696 }
8697
8699 {
8700 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8701 return plugin.GetName(id);
8702 }
8703
8706 {
8707
8708
8709 int varFlags;
8710 if (!ctx.
Read(varFlags))
8711 return;
8712
8713 if (varFlags & ItemVariableFlags.FLOAT)
8714 {
8716 }
8717 }
8718
8720 {
8721
8722 super.SerializeNumericalVars(floats_out);
8723
8724
8725
8727 {
8729 }
8730
8732 {
8734 }
8735
8737 {
8739 }
8740
8742 {
8747 }
8748
8750 {
8752 }
8753 }
8754
8756 {
8757
8758 super.DeSerializeNumericalVars(floats);
8759
8760
8761 int index = 0;
8762 int mask = Math.Round(floats.Get(index));
8763
8764 index++;
8765
8767 {
8769 {
8771 }
8772 else
8773 {
8774 float quantity = floats.Get(index);
8776 }
8777 index++;
8778 }
8779
8781 {
8782 float wet = floats.Get(index);
8784 index++;
8785 }
8786
8788 {
8789 int liquidtype = Math.Round(floats.Get(index));
8791 index++;
8792 }
8793
8795 {
8797 index++;
8799 index++;
8801 index++;
8803 index++;
8804 }
8805
8807 {
8808 int cleanness = Math.Round(floats.Get(index));
8810 index++;
8811 }
8812 }
8813
8815 {
8816 super.WriteVarsToCTX(ctx);
8817
8818
8820 {
8822 }
8823
8825 {
8827 }
8828
8830 {
8832 }
8833
8835 {
8836 int r,g,b,a;
8842 }
8843
8845 {
8847 }
8848 }
8849
8851 {
8852 if (!super.ReadVarsFromCTX(ctx,version))
8853 return false;
8854
8855 int intValue;
8856 float value;
8857
8858 if (version < 140)
8859 {
8860 if (!ctx.
Read(intValue))
8861 return false;
8862
8863 m_VariablesMask = intValue;
8864 }
8865
8867 {
8868 if (!ctx.
Read(value))
8869 return false;
8870
8872 {
8874 }
8875 else
8876 {
8878 }
8879 }
8880
8881 if (version < 140)
8882 {
8884 {
8885 if (!ctx.
Read(value))
8886 return false;
8887 SetTemperatureDirect(value);
8888 }
8889 }
8890
8892 {
8893 if (!ctx.
Read(value))
8894 return false;
8896 }
8897
8899 {
8900 if (!ctx.
Read(intValue))
8901 return false;
8903 }
8904
8906 {
8907 int r,g,b,a;
8909 return false;
8911 return false;
8913 return false;
8915 return false;
8916
8918 }
8919
8921 {
8922 if (!ctx.
Read(intValue))
8923 return false;
8925 }
8926
8927 if (version >= 138 && version < 140)
8928 {
8930 {
8931 if (!ctx.
Read(intValue))
8932 return false;
8933 SetFrozen(intValue);
8934 }
8935 }
8936
8937 return true;
8938 }
8939
8940
8942 {
8945 {
8947 }
8948
8949 if (!super.OnStoreLoad(ctx, version))
8950 {
8952 return false;
8953 }
8954
8955 if (version >= 114)
8956 {
8957 bool hasQuickBarIndexSaved;
8958
8959 if (!ctx.
Read(hasQuickBarIndexSaved))
8960 {
8962 return false;
8963 }
8964
8965 if (hasQuickBarIndexSaved)
8966 {
8967 int itmQBIndex;
8968
8969
8970 if (!ctx.
Read(itmQBIndex))
8971 {
8973 return false;
8974 }
8975
8976 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8977 if (itmQBIndex != -1 && parentPlayer)
8978 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8979 }
8980 }
8981 else
8982 {
8983
8984 PlayerBase player;
8985 int itemQBIndex;
8986 if (version ==
int.
MAX)
8987 {
8988 if (!ctx.
Read(itemQBIndex))
8989 {
8991 return false;
8992 }
8993 }
8994 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8995 {
8996
8997 if (!ctx.
Read(itemQBIndex))
8998 {
9000 return false;
9001 }
9002 if (itemQBIndex != -1 && player)
9003 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9004 }
9005 }
9006
9007 if (version < 140)
9008 {
9009
9010 if (!LoadVariables(ctx, version))
9011 {
9013 return false;
9014 }
9015 }
9016
9017
9019 {
9021 return false;
9022 }
9023 if (version >= 132)
9024 {
9026 if (raib)
9027 {
9029 {
9031 return false;
9032 }
9033 }
9034 }
9035
9037 return true;
9038 }
9039
9040
9041
9043 {
9044 super.OnStoreSave(ctx);
9045
9046 PlayerBase player;
9047 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9048 {
9050
9051 int itemQBIndex = -1;
9052 itemQBIndex = player.FindQuickBarEntityIndex(this);
9053 ctx.
Write(itemQBIndex);
9054 }
9055 else
9056 {
9058 }
9059
9061
9063 if (raib)
9064 {
9066 }
9067 }
9068
9069
9071 {
9072 super.AfterStoreLoad();
9073
9075 {
9077 }
9078
9080 {
9083 }
9084 }
9085
9087 {
9088 super.EEOnAfterLoad();
9089
9091 {
9093 }
9094
9097 }
9098
9100 {
9101 return false;
9102 }
9103
9104
9105
9107 {
9109 {
9110 #ifdef PLATFORM_CONSOLE
9111
9113 {
9115 if (menu)
9116 {
9118 }
9119 }
9120 #endif
9121 }
9122
9124 {
9127 }
9128
9130 {
9131 SetWeightDirty();
9133 }
9135 {
9138 }
9139
9141 {
9144
9147 }
9149 {
9153 }
9154
9155 super.OnVariablesSynchronized();
9156 }
9157
9158
9159
9161 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9162 {
9163 if (!IsServerCheck(allow_client))
9164 return false;
9165
9167 return false;
9168
9171
9172 if (value <= (min + 0.001))
9173 value = min;
9174
9175 if (value == min)
9176 {
9177 if (destroy_config)
9178 {
9179 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9180 if (dstr)
9181 {
9183 this.Delete();
9184 return true;
9185 }
9186 }
9187 else if (destroy_forced)
9188 {
9190 this.Delete();
9191 return true;
9192 }
9193
9195 }
9196
9199
9201 {
9202 EntityAI parent = GetHierarchyRoot();
9203 InventoryLocation iLoc = new InventoryLocation();
9204 GetInventory().GetCurrentInventoryLocation(iLoc);
9206 {
9207 int iLocSlot = iLoc.
GetSlot();
9209 {
9211 }
9213 {
9215 }
9216 }
9217 }
9218
9220 {
9222
9223 if (delta)
9225 }
9226
9228
9229 return false;
9230 }
9231
9232
9234 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9235 {
9237 }
9238
9240 {
9243 }
9244
9246 {
9249 }
9250
9252 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9253 {
9254 float value_clamped = Math.Clamp(value, 0, 1);
9256 SetQuantity(result, destroy_config, destroy_forced);
9257 }
9258
9259
9262 {
9264 }
9265
9267 {
9269 }
9270
9271
9272
9273
9274
9275
9276
9277
9278
9279
9281 {
9282 int slot = -1;
9283 GameInventory inventory = GetInventory();
9284 if (inventory)
9285 {
9286 InventoryLocation il = new InventoryLocation;
9289 }
9290
9292 }
9293
9295 {
9296 float quantity_max = 0;
9297
9299 {
9300 if (attSlotID != -1)
9301 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9302
9303 if (quantity_max <= 0)
9305 }
9306
9307 if (quantity_max <= 0)
9309
9310 return quantity_max;
9311 }
9312
9314 {
9316 }
9317
9319 {
9321 }
9322
9323
9325 {
9327 }
9328
9330 {
9332 }
9333
9335 {
9337 }
9338
9339
9341 {
9342
9343 float weightEx = GetWeightEx();
9344 float special = GetInventoryAndCargoWeight();
9345 return weightEx - special;
9346 }
9347
9348
9350 {
9352 }
9353
9355 {
9357 {
9358 #ifdef DEVELOPER
9359 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9360 {
9361 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9363 }
9364 #endif
9365
9367 }
9368 else if (HasEnergyManager())
9369 {
9370 #ifdef DEVELOPER
9371 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9372 {
9373 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9374 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9375 }
9376 #endif
9377 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9378 }
9379 else
9380 {
9381 #ifdef DEVELOPER
9382 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9383 {
9384 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9385 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9386 }
9387 #endif
9388 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9389 }
9390 }
9391
9394 {
9395 int item_count = 0;
9397
9398 GameInventory inventory = GetInventory();
9399 CargoBase cargo = inventory.
GetCargo();
9400 if (cargo != NULL)
9401 {
9403 }
9404
9406 for (int i = 0; i < nAttachments; ++i)
9407 {
9409 if (item)
9410 item_count += item.GetNumberOfItems();
9411 }
9412 return item_count;
9413 }
9414
9417 {
9418 float weight = 0;
9419 float wetness = 1;
9420 if (include_wetness)
9423 {
9424 weight = wetness * m_ConfigWeight;
9425 }
9427 {
9428 weight = 1;
9429 }
9430 return weight;
9431 }
9432
9433
9434
9436 {
9437 GameInventory inventory = GetInventory();
9438 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9439 {
9440 array<EntityAI> items = new array<EntityAI>;
9442 for (int i = 0; i < items.Count(); ++i)
9443 {
9445 if (item)
9446 {
9447 g_Game.ObjectDelete(item);
9448 }
9449 }
9450 }
9451 }
9452
9453
9454
9455
9457 {
9458 float energy = 0;
9459 if (HasEnergyManager())
9460 {
9461 energy = GetCompEM().GetEnergy();
9462 }
9463 return energy;
9464 }
9465
9466
9468 {
9469 super.OnEnergyConsumed();
9470
9472 }
9473
9475 {
9476 super.OnEnergyAdded();
9477
9479 }
9480
9481
9483 {
9484 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9485 {
9487 {
9488 float energy_0to1 = GetCompEM().GetEnergy0To1();
9490 }
9491 }
9492 }
9493
9494
9496 {
9497 return ConfigGetFloat("heatIsolation");
9498 }
9499
9501 {
9503 }
9504
9506 {
9507 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9508 if (
g_Game.ConfigIsExisting(paramPath))
9509 return g_Game.ConfigGetFloat(paramPath);
9510
9511 return 0.0;
9512 }
9513
9515 {
9516 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9517 if (
g_Game.ConfigIsExisting(paramPath))
9518 return g_Game.ConfigGetFloat(paramPath);
9519
9520 return 0.0;
9521 }
9522
9523 override void SetWet(
float value,
bool allow_client =
false)
9524 {
9525 if (!IsServerCheck(allow_client))
9526 return;
9527
9530
9532
9533 m_VarWet = Math.Clamp(value, min, max);
9534
9536 {
9539 }
9540 }
9541
9542 override void AddWet(
float value)
9543 {
9545 }
9546
9548 {
9550 }
9551
9553 {
9555 }
9556
9558 {
9560 }
9561
9563 {
9565 }
9566
9568 {
9570 }
9571
9573 {
9576 if (newLevel != oldLevel)
9577 {
9579 }
9580 }
9581
9583 {
9584 SetWeightDirty();
9585 }
9586
9588 {
9589 return GetWetLevelInternal(
m_VarWet);
9590 }
9591
9592
9593
9595 {
9597 }
9598
9600 {
9602 }
9603
9605 {
9607 }
9608
9610 {
9612 }
9613
9614
9615
9617 {
9618 if (ConfigIsExisting("itemModelLength"))
9619 {
9620 return ConfigGetFloat("itemModelLength");
9621 }
9622 return 0;
9623 }
9624
9626 {
9627 if (ConfigIsExisting("itemAttachOffset"))
9628 {
9629 return ConfigGetFloat("itemAttachOffset");
9630 }
9631 return 0;
9632 }
9633
9634 override void SetCleanness(
int value,
bool allow_client =
false)
9635 {
9636 if (!IsServerCheck(allow_client))
9637 return;
9638
9640
9642
9645 }
9646
9648 {
9650 }
9651
9653 {
9654 return true;
9655 }
9656
9657
9658
9659
9661 {
9663 }
9664
9666 {
9668 }
9669
9670
9671
9672
9673 override void SetColor(
int r,
int g,
int b,
int a)
9674 {
9680 }
9682 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9683 {
9688 }
9689
9691 {
9693 }
9694
9697 {
9698 int r,g,b,a;
9700 r = r/255;
9701 g = g/255;
9702 b = b/255;
9703 a = a/255;
9704 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9705 }
9706
9707
9708
9709 override void SetLiquidType(
int value,
bool allow_client =
false)
9710 {
9711 if (!IsServerCheck(allow_client))
9712 return;
9713
9718 }
9719
9721 {
9722 return ConfigGetInt("varLiquidTypeInit");
9723 }
9724
9726 {
9728 }
9729
9731 {
9733 SetFrozen(false);
9734 }
9735
9738 {
9739 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9740 }
9741
9742
9745 {
9746 PlayerBase nplayer;
9747 if (PlayerBase.CastTo(nplayer, player))
9748 {
9750 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9751 }
9752 }
9753
9754
9757 {
9758 PlayerBase nplayer;
9759 if (PlayerBase.CastTo(nplayer,player))
9760 {
9761 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9762 }
9763
9764 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9765
9766 if (HasEnergyManager())
9767 {
9768 GetCompEM().UpdatePlugState();
9769 }
9770 }
9771
9772
9774 {
9775 super.OnPlacementStarted(player);
9776
9778 }
9779
9780 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9781 {
9783 {
9784 m_AdminLog.OnPlacementComplete(player,
this);
9785 }
9786
9787 super.OnPlacementComplete(player, position, orientation);
9788 }
9789
9790
9791
9792
9793
9795 {
9797 {
9798 return true;
9799 }
9800 else
9801 {
9802 return false;
9803 }
9804 }
9805
9806
9808 {
9810 {
9812 }
9813 }
9814
9815
9817 {
9819 }
9820
9822 {
9824 }
9825
9826 override void InsertAgent(
int agent,
float count = 1)
9827 {
9828 if (count < 1)
9829 return;
9830
9832 }
9833
9836 {
9838 }
9839
9840
9842 {
9844 }
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9866
9867
9868
9869
9870
9871
9872
9873
9874
9875
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9888 {
9890 return false;
9891 return true;
9892 }
9893
9895 {
9896
9898 }
9899
9900
9903 {
9904 super.CheckForRoofLimited(timeTresholdMS);
9905
9906 float time =
g_Game.GetTime();
9907 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9908 {
9909 m_PreviousRoofTestTime = time;
9910 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9911 }
9912 }
9913
9914
9916 {
9918 {
9919 return 0;
9920 }
9921
9922 if (GetInventory().GetAttachmentSlotsCount() != 0)
9923 {
9924 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9925 if (filter)
9926 return filter.GetProtectionLevel(type, false, system);
9927 else
9928 return 0;
9929 }
9930
9931 string subclassPath, entryName;
9932
9933 switch (type)
9934 {
9936 entryName = "biological";
9937 break;
9939 entryName = "chemical";
9940 break;
9941 default:
9942 entryName = "biological";
9943 break;
9944 }
9945
9946 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9947
9948 return g_Game.ConfigGetFloat(subclassPath + entryName);
9949 }
9950
9951
9952
9955 {
9956 if (!IsMagazine())
9958
9960 }
9961
9962
9963
9964
9965
9970 {
9971 return true;
9972 }
9973
9975 {
9977 }
9978
9979
9980
9981
9982
9984 {
9985 if (parent)
9986 {
9987 if (parent.IsInherited(DayZInfected))
9988 return true;
9989
9990 if (!parent.IsRuined())
9991 return true;
9992 }
9993
9994 return true;
9995 }
9996
9998 {
9999 if (!super.CanPutAsAttachment(parent))
10000 {
10001 return false;
10002 }
10003
10004 if (!IsRuined() && !parent.IsRuined())
10005 {
10006 return true;
10007 }
10008
10009 return false;
10010 }
10011
10013 {
10014
10015
10016
10017
10018 return super.CanReceiveItemIntoCargo(item);
10019 }
10020
10022 {
10023
10024
10025
10026
10027 GameInventory attachmentInv = attachment.GetInventory();
10029 {
10030 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10031 return false;
10032 }
10033
10034 InventoryLocation loc = new InventoryLocation();
10035 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10036 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10037 return false;
10038
10039 return super.CanReceiveAttachment(attachment, slotId);
10040 }
10041
10043 {
10044 if (!super.CanReleaseAttachment(attachment))
10045 return false;
10046
10047 return GetInventory().AreChildrenAccessible();
10048 }
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10064
10065
10066
10067
10068
10069
10071 {
10072 int id = muzzle_owner.GetMuzzleID();
10073 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10074
10075 if (WPOF_array)
10076 {
10077 for (int i = 0; i < WPOF_array.Count(); i++)
10078 {
10079 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10080
10081 if (WPOF)
10082 {
10083 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10084 }
10085 }
10086 }
10087 }
10088
10089
10091 {
10092 int id = muzzle_owner.GetMuzzleID();
10094
10095 if (WPOBE_array)
10096 {
10097 for (int i = 0; i < WPOBE_array.Count(); i++)
10098 {
10099 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10100
10101 if (WPOBE)
10102 {
10103 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10104 }
10105 }
10106 }
10107 }
10108
10109
10111 {
10112 int id = muzzle_owner.GetMuzzleID();
10113 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10114
10115 if (WPOOH_array)
10116 {
10117 for (int i = 0; i < WPOOH_array.Count(); i++)
10118 {
10119 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10120
10121 if (WPOOH)
10122 {
10123 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10124 }
10125 }
10126 }
10127 }
10128
10129
10131 {
10132 int id = muzzle_owner.GetMuzzleID();
10133 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10134
10135 if (WPOOH_array)
10136 {
10137 for (int i = 0; i < WPOOH_array.Count(); i++)
10138 {
10139 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10140
10141 if (WPOOH)
10142 {
10143 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10144 }
10145 }
10146 }
10147 }
10148
10149
10151 {
10152 int id = muzzle_owner.GetMuzzleID();
10153 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10154
10155 if (WPOOH_array)
10156 {
10157 for (int i = 0; i < WPOOH_array.Count(); i++)
10158 {
10159 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10160
10161 if (WPOOH)
10162 {
10163 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10164 }
10165 }
10166 }
10167 }
10168
10169
10170
10172 {
10174 {
10175 return true;
10176 }
10177
10178 return false;
10179 }
10180
10182 {
10184 {
10185 return true;
10186 }
10187
10188 return false;
10189 }
10190
10192 {
10194 {
10195 return true;
10196 }
10197
10198 return false;
10199 }
10200
10202 {
10203 return false;
10204 }
10205
10208 {
10209 return UATimeSpent.DEFAULT_DEPLOY;
10210 }
10211
10212
10213
10214
10216 {
10218 SetSynchDirty();
10219 }
10220
10222 {
10224 }
10225
10226
10228 {
10229 return false;
10230 }
10231
10234 {
10235 string att_type = "None";
10236
10237 if (ConfigIsExisting("soundAttType"))
10238 {
10239 att_type = ConfigGetString("soundAttType");
10240 }
10241
10243 }
10244
10246 {
10248 }
10249
10250
10251
10252
10253
10259
10261 {
10264
10266 }
10267
10268
10270 {
10272 return;
10273
10275
10278
10281
10282 SoundParameters params = new SoundParameters();
10286 }
10287
10288
10290 {
10292 {
10295
10296 SetSynchDirty();
10297
10300 }
10301 }
10302
10304 {
10306 }
10307
10308
10310 {
10312 return;
10313
10315 SetSynchDirty();
10316
10319 }
10320
10322 {
10325 }
10326
10328 {
10330 }
10331
10332 void OnApply(PlayerBase player);
10333
10335 {
10336 return 1.0;
10337 };
10338
10340 {
10342 }
10343
10345 {
10347 }
10348
10350
10352 {
10353 SetDynamicPhysicsLifeTime(0.01);
10355 }
10356
10358 {
10359 array<string> zone_names = new array<string>;
10360 GetDamageZones(zone_names);
10361 for (int i = 0; i < zone_names.Count(); i++)
10362 {
10363 SetHealthMax(zone_names.Get(i),"Health");
10364 }
10365 SetHealthMax("","Health");
10366 }
10367
10370 {
10371 float global_health = GetHealth01("","Health");
10372 array<string> zones = new array<string>;
10373 GetDamageZones(zones);
10374
10375 for (int i = 0; i < zones.Count(); i++)
10376 {
10377 SetHealth01(zones.Get(i),"Health",global_health);
10378 }
10379 }
10380
10383 {
10384 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10385 }
10386
10388 {
10389 if (!hasRootAsPlayer)
10390 {
10391 if (refParentIB)
10392 {
10393
10394 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10395 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10396
10397 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10398 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10399
10402 }
10403 else
10404 {
10405
10408 }
10409 }
10410 }
10411
10413 {
10415 {
10416 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10417 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10418 {
10419 float heatPermCoef = 1.0;
10421 while (ent)
10422 {
10423 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10424 ent = ent.GetHierarchyParent();
10425 }
10426
10427 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10428 }
10429 }
10430 }
10431
10433 {
10434
10435 EntityAI parent = GetHierarchyParent();
10436 if (!parent)
10437 {
10438 hasParent = false;
10439 hasRootAsPlayer = false;
10440 }
10441 else
10442 {
10443 hasParent = true;
10444 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10445 refParentIB =
ItemBase.Cast(parent);
10446 }
10447 }
10448
10449 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10450 {
10451
10452 }
10453
10455 {
10456
10457 return false;
10458 }
10459
10461 {
10462
10463
10464 return false;
10465 }
10466
10468 {
10469
10470 return false;
10471 }
10472
10475 {
10476 return !GetIsFrozen() &&
IsOpen();
10477 }
10478
10480 {
10481 bool hasParent = false, hasRootAsPlayer = false;
10483
10484 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10485 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10486
10487 if (wwtu || foodDecay)
10488 {
10492
10493 if (processWetness || processTemperature || processDecay)
10494 {
10496
10497 if (processWetness)
10498 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10499
10500 if (processTemperature)
10502
10503 if (processDecay)
10504 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10505 }
10506 }
10507 }
10508
10511 {
10513 }
10514
10516 {
10519
10520 return super.GetTemperatureFreezeThreshold();
10521 }
10522
10524 {
10527
10528 return super.GetTemperatureThawThreshold();
10529 }
10530
10532 {
10535
10536 return super.GetItemOverheatThreshold();
10537 }
10538
10540 {
10542 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10543
10544 return super.GetTemperatureFreezeTime();
10545 }
10546
10548 {
10550 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10551
10552 return super.GetTemperatureThawTime();
10553 }
10554
10559
10561 {
10562 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10563 }
10564
10566 {
10567 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10568 }
10569
10572 {
10574 }
10575
10577 {
10579 }
10580
10582 {
10584 }
10585
10588 {
10589 return null;
10590 }
10591
10594 {
10595 return false;
10596 }
10597
10599 {
10601 {
10604 if (!trg)
10605 {
10607 explosive = this;
10608 }
10609
10610 explosive.PairRemote(trg);
10612
10613 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10614 trg.SetPersistentPairID(persistentID);
10615 explosive.SetPersistentPairID(persistentID);
10616
10617 return true;
10618 }
10619 return false;
10620 }
10621
10624 {
10625 float ret = 1.0;
10628 ret *= GetHealth01();
10629
10630 return ret;
10631 }
10632
10633 #ifdef DEVELOPER
10634 override void SetDebugItem()
10635 {
10636 super.SetDebugItem();
10637 _itemBase = this;
10638 }
10639
10641 {
10642 string text = super.GetDebugText();
10643
10645 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10646
10647 return text;
10648 }
10649 #endif
10650
10652 {
10653 return true;
10654 }
10655
10657
10659
10661 {
10664 }
10665
10666
10674
10690
10691 [
Obsolete(
"Use ItemSoundHandler instead")]
10694 {
10695 if (!
g_Game.IsDedicatedServer())
10696 {
10697 if (ConfigIsExisting("attachSoundSet"))
10698 {
10699 string cfg_path = "";
10700 string soundset = "";
10701 string type_name =
GetType();
10702
10705 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10706 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10707
10708 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10709 {
10710 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10711 {
10712 if (cfg_slot_array[i] == slot_type)
10713 {
10714 soundset = cfg_soundset_array[i];
10715 break;
10716 }
10717 }
10718 }
10719
10720 if (soundset != "")
10721 {
10722 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10724 }
10725 }
10726 }
10727 }
10728
10730}
10731
10733{
10735 if (entity)
10736 {
10737 bool is_item = entity.IsInherited(
ItemBase);
10738 if (is_item && full_quantity)
10739 {
10742 }
10743 }
10744 else
10745 {
10747 return NULL;
10748 }
10749 return entity;
10750}
10751
10753{
10754 if (item)
10755 {
10756 if (health > 0)
10757 item.SetHealth("", "", health);
10758
10759 if (item.CanHaveTemperature())
10760 {
10762 if (item.CanFreeze())
10763 item.SetFrozen(false);
10764 }
10765
10766 if (item.HasEnergyManager())
10767 {
10768 if (quantity >= 0)
10769 {
10770 item.GetCompEM().SetEnergy0To1(quantity);
10771 }
10772 else
10773 {
10775 }
10776 }
10777 else if (item.IsMagazine())
10778 {
10779 Magazine mag = Magazine.Cast(item);
10780 if (quantity >= 0)
10781 {
10782 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10783 }
10784 else
10785 {
10787 }
10788
10789 }
10790 else
10791 {
10792 if (quantity >= 0)
10793 {
10794 item.SetQuantityNormalized(quantity, false);
10795 }
10796 else
10797 {
10799 }
10800
10801 }
10802 }
10803}
10804
10805#ifdef DEVELOPER
10807#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
bool SetAttachSoundEvent()
bool SetDetachSoundEvent()
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
void ActionManagerBase(PlayerBase player)
map< typename, ref array< ActionBase_Basic > > TInputActionMap
void AddAction(typename actionName)
void RemoveAction(typename actionName)
TInputActionMap m_InputActionMap
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
const int ECE_PLACE_ON_SURFACE
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
Open
Implementations only.
override void EEOnCECreate()
DamageType
exposed from C++ (do not change)
PluginAdminLog m_AdminLog
override bool IsExplosive()
override bool IsPrepareToDelete()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
proto GizmoApi GetGizmoApi()
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
static bool HasDebugActionsMask(int mask)
bool HidesSelectionBySlot()
void SplitItem(PlayerBase player)
void CopyScriptPropertiesFrom(EntityAI oldItem)
override void InsertAgent(int agent, float count=1)
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
static void SetDebugActionsMask(int mask)
void SetIsDeploySound(bool is_deploy_sound)
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
override bool IsHeavyBehaviour()
override void SetWetMax()
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
void ClearStartItemSoundServer()
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
override void RemoveAllAgentsExcept(int agent_to_keep)
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
bool CanBeMovedOverride()
override void SetWet(float value, bool allow_client=false)
ref TIntArray m_SingleUseActions
void StartItemSoundServer(int id, int slotId)
override void ProcessVariables()
ref TStringArray m_HeadHidingSelections
float GetWeightSpecialized(bool forceRecalc=false)
bool LoadAgents(ParamsReadContext ctx, int version)
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
ref array< ref OverheatingParticle > m_OverheatingParticles
override float GetTemperatureFreezeThreshold()
bool m_IsSoundSynchRemote
void StopItemSoundServer(int id)
static void ToggleDebugActionsMask(int mask)
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetTemperatureFreezeTime()
ref array< int > m_CompatibleLocks
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
float m_TemperaturePerQuantityWeight
bool m_RecipesInitialized
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
override float GetTemperatureThawThreshold()
override void OnEnergyConsumed()
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
override EWetnessLevel GetWetLevel()
float GetSingleInventoryItemWeight()
ref TIntArray m_InteractActions
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
bool CanPlayDeployLoopSound()
override float GetWetMax()
bool CanBeUsedForSuicide()
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
bool m_CanBeMovedOverride
override string ChangeIntoOnAttach(string slot)
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
ScriptedLightBase GetLight()
string GetPlaceSoundset()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
override float GetQuantity()
int m_ShotsToStartOverheating
override void OnWetChanged(float newVal, float oldVal)
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void OnOverheatingDecay()
float GetDryingIncrement(string pIncrementName)
void SoundSynchRemoteReset()
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
override bool CanReleaseAttachment(EntityAI attachment)
override void OnMovedInsideCargo(EntityAI container)
void SetCEBasedQuantity()
bool m_CanPlayImpactSound
override string GetAttachmentSoundType()
float GetOverheatingCoef()
array< string > GetHeadHidingSelection()
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
override bool IsStoreLoad()
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
void SetResultOfSplit(bool value)
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
void UpdateAllOverheatingParticles()
float GetSoakingIncrement(string pIncrementName)
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetStoreLoadedQuantity()
const int ITEM_SOUNDS_MAX
float GetItemModelLength()
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
void CombineItems(ItemBase other_item, bool use_stack_max=true)
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
void TransferAgents(int agents)
transfer agents from another item
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
float GetHeatIsolationInit()
void SetCanBeMovedOverride(bool setting)
override bool HasQuantity()
bool IsCargoException4x3(EntityAI item)
ref TIntArray m_ContinuousActions
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
void LoadParticleConfigOnFire(int id)
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
override float GetWetInit()
int m_ImpactSoundSurfaceHash
int m_MaxOverheatingValue
void SetupSpawnedItem(ItemBase item, float health, float quantity)
bool ShouldSplitQuantity(float quantity)
static ref map< string, int > m_WeaponTypeToID
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
array< int > GetValidFinishers()
returns an array of possible finishers
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
ItemSoundHandler GetItemSoundHandler()
override int GetQuantityMin()
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
override int GetQuickBarBonus()
override void SetTakeable(bool pState)
float m_OverheatingDecayInterval
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
void RemoveAudioVisualsOnClient()
static void AddDebugActionsMask(int mask)
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
bool CanRepair(ItemBase item_repair_kit)
bool can_this_be_combined
EffectSound m_SoundDeploy
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
float GetDeployTime()
how long it takes to deploy this item in seconds
override bool IsSplitable()
bool DamageItemAttachments(float damage)
override void WriteVarsToCTX(ParamsWriteContext ctx)
void ConvertEnergyToQuantity()
override void RemoveAllAgents()
override void SetQuantityToMinimum()
bool m_WantPlayImpactSound
override float GetTemperatureThawTime()
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
float m_StoreLoadedQuantity
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
float GetFilterDamageRatio()
override void SetLiquidType(int value, bool allow_client=false)
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
void OnApply(PlayerBase player)
override void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
ref Timer m_CheckOverheating
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override bool IsOneHandedBehaviour()
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
override float GetSingleInventoryItemWeightEx()
void SaveAgents(ParamsWriteContext ctx)
override int GetTargetQuantityMax(int attSlotID=-1)
float GetDisinfectQuantity(int system=0, Param param1=null)
override bool IsHologram()
float GetItemAttachOffset()
static int GetDebugActionsMask()
override int GetLiquidType()
void ProcessDecay(float delta, bool hasRootAsPlayer)
override bool IsItemBase()
override bool IsTwoHandedBehaviour()
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override void OnEnergyAdded()
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
EffectSound m_DeployLoopSoundEx
override void DeSerializeNumericalVars(array< float > floats)
void StopItemDynamicPhysics()
override void SetStoreLoad(bool value)
float GetOverheatingValue()
bool ContainsAgent(int agent_id)
override void AddWet(float value)
override void EOnContact(IEntity other, Contact extra)
void SplitIntoStackMaxHands(PlayerBase player)
void SplitIntoStackMaxHandsClient(PlayerBase player)
ref Timer m_PhysDropTimer
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
override void SetStoreLoadedQuantity(float value)
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
void OnLiquidTypeChanged(int oldType, int newType)
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void PlayDeployFinishSound()
bool AllowFoodConsumption()
bool m_IsOverheatingEffectActive
int m_LiquidContainerMask
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override int GetCleanness()
bool PairWithDevice(notnull ItemBase otherDevice)
static void RemoveDebugActionsMask(int mask)
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void PerformDamageSystemReinit()
override void ClearInventory()
static int m_LastRegisteredWeaponID
ItemBase GetLightSourceItem()
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
override float GetItemOverheatThreshold()
void StopDeployLoopSoundEx()
override void SerializeNumericalVars(array< float > floats_out)
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
static int m_DebugActionsMask
void KillAllOverheatingParticles()
bool CanBeCookedOnStick()
override int GetQuantityMax()
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
void OnActivatedByTripWire()
override void RemoveAgent(int agent_id)
bool m_ItemBeingDroppedPhys
override bool CanPutAsAttachment(EntityAI parent)
void PlayDetachSound(string slot_type)
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override bool IsBeingPlaced()
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
bool m_FixDamageSystemInit
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
void LoadParticleConfigOnOverheating(int id)
bool IsSoundSynchRemote()
override void OnRightClick()
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
bool IsActionTargetVisible()
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
int NameToID(string name)
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
void ClearStopItemSoundServer()
override string ChangeIntoOnDetach()
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
EffectSound m_SoundDeployFinish
float GetQuantityNormalizedScripted()
override void SetCleanness(int value, bool allow_client=false)
override float GetWetMin()
ref ItemSoundHandler m_ItemSoundHandler
override bool KindOf(string tag)
void ItemSoundHandler(ItemBase parent)
EffectSound m_LockingSound
void PluginItemDiagnostic()
PluginBase GetPlugin(typename plugin_type)
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
void RemoteDetonatorTrigger()
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
override void Explode(int damageType, string ammoType="")
void OnItemLocationChanged(ItemBase item)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
proto native EntityAI GetAttachmentFromIndex(int index)
proto native bool GetCurrentInventoryLocation(out notnull InventoryLocation loc)
returns information about current item location
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
proto native int AttachmentCount()
Returns count of attachments attached to this item.
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
proto void SelectObject(Object object)
proto void SelectPhysics(Physics physics)
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
bool WriteToContext(ParamsWriteContext ctx)
proto native int GetType()
returns type of InventoryLocation
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native bool GetFlip()
returns flip status of cargo
proto native EntityAI GetItem()
returns item of current inventory location
override bool CanDisplayCargo()
override void OnInventoryEnter(Man player)
override string GetFoldSoundset()
override bool CanPutAsAttachment(EntityAI parent)
override bool CanReceiveItemIntoCargo(EntityAI item)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override void OnWasDetached(EntityAI parent, int slot_id)
override void EEOnAfterLoad()
override void EEDelete(EntityAI parent)
override bool CanBeRepairedByCrafting()
override void OnPlacementStarted(Man player)
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
override bool IsElectricAppliance()
override bool IsItemTent()
override void SetActions()
override string GetLoopFoldSoundset()
override bool CanMakeGardenplot()
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override WrittenNoteData GetWrittenNoteData()
override int GetDamageSystemVersionChange()
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
override void InitItemVariables()
override void SetActionAnimOverrides()
override void OnCreatePhysics()
override string GetDeploySoundset()
override float GetBandagingEffectivity()
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
override void OnStoreSave(ParamsWriteContext ctx)
override void AfterStoreLoad()
override int GetOnDigWormsAmount()
override bool IsSelfAdjustingTemperature()
override bool IsPlayerInside(PlayerBase player, string selection)
override void OnVariablesSynchronized()
override void RefreshPhysics()
override bool CanObstruct()
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override bool CanPutInCargo(EntityAI parent)
override string GetLoopDeploySoundset()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
override void OnInventoryExit(Man player)
override bool IsTakeable()
override bool IsIgnoredByConstruction()
override void InitItemSounds()
override void EEKilled(Object killer)
override void OnCombine(ItemBase other_item)
override bool CanExplodeInFire()
override bool IsFacingPlayer(PlayerBase player, string selection)
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
override bool IsBloodContainer()
override bool IsClothing()
override bool CanBeSplit()
override bool IsDeployable()
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
override bool CanBeDisinfected()
override float GetInfectionChance(int system=0, Param param=null)
override void OnEndPlacement()
float GetOverheatingLimitMax()
void SetOverheatingLimitMax(float max)
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
float GetOverheatingLimitMin()
void SetOverheatingLimitMin(float min)
void RegisterParticle(Particle p)
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
void SetControlledDevice(EntityAI pDevice)
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
void SetCalcDetails(string details)
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Serializer ParamsReadContext
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Serializer ParamsWriteContext
const int COMP_TYPE_ENERGY_MANAGER
void Error(string err)
Messagebox with error message.
proto native void SetColor(int color)
array< string > TStringArray
void Obsolete(string msg="")
EntityEvent
Entity events for event-mask, or throwing event from code.
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
const int VARIABLE_LIQUIDTYPE
const int VARIABLE_CLEANNESS
const int VARIABLE_TEMPERATURE
const int VARIABLE_QUANTITY
static proto float AbsFloat(float f)
Returns absolute value.
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_DEBUG_ACTION
vector GetPosition()
Get the world position of the Effect.
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.