5888{
5890 {
5891 return true;
5892 }
5893};
5894
5896{
5897
5898};
5899
5900
5901
5903{
5907
5909
5912
5913
5914
5915
5916
5925
5931
5936
5941
5962 protected bool m_IsResultOfSplit
5963
5965
5970
5971
5972
5974
5978
5979
5980
5982
5985
5986
5987
5993
5994
6002
6005
6006
6008
6009
6011
6012
6017
6018
6023
6025
6026
6028
6029
6031 {
6036
6037 if (!
g_Game.IsDedicatedServer())
6038 {
6040 {
6042
6044 {
6046 }
6047 }
6048
6051 }
6052
6053 m_OldLocation = null;
6054
6056 {
6058 }
6059
6060 if (ConfigIsExisting("headSelectionsToHide"))
6061 {
6064 }
6065
6067 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6068 {
6070 }
6071
6073
6074 m_IsResultOfSplit = false;
6075
6077 }
6078
6080 {
6081 super.InitItemVariables();
6082
6088 m_Count = ConfigGetInt(
"count");
6089
6092
6097
6100
6105
6117
6121
6122
6125 if (ConfigIsExisting("canBeSplit"))
6126 {
6129 }
6130
6132 if (ConfigIsExisting("itemBehaviour"))
6134
6135
6138 RegisterNetSyncVariableInt("m_VarLiquidType");
6139 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6140
6141 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6142 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6143 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6144
6145 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6146 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6147 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6148 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6149
6150 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6151 RegisterNetSyncVariableBool("m_IsTakeable");
6152 RegisterNetSyncVariableBool("m_IsHologram");
6153
6156 {
6159 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6160 }
6161
6163
6165 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6167
6169 }
6170
6172 {
6174 }
6175
6177 {
6180 {
6185 }
6186 }
6187
6188 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6189 {
6191 {
6194 }
6195
6197 }
6198
6200 {
6206 }
6207
6209
6211 {
6213
6214 if (!action)
6215 {
6216 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6217 return;
6218 }
6219
6221 if (!ai)
6222 {
6224 return;
6225 }
6226
6228 if (!action_array)
6229 {
6230 action_array = new array<ActionBase_Basic>;
6232 }
6233 if (LogManager.IsActionLogEnable())
6234 {
6235 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6236 }
6237
6238 if (action_array.Find(action) != -1)
6239 {
6240 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6241 }
6242 else
6243 {
6244 action_array.Insert(action);
6245 }
6246 }
6247
6249 {
6250 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6251 ActionBase action = player.GetActionManager().GetAction(actionName);
6254
6255 if (action_array)
6256 {
6257 action_array.RemoveItem(action);
6258 }
6259 }
6260
6261
6262
6264 {
6265 ActionOverrideData overrideData = new ActionOverrideData();
6269
6271 if (!actionMap)
6272 {
6275 }
6276
6277 actionMap.Insert(this.
Type(), overrideData);
6278
6279 }
6280
6282
6284
6285
6287 {
6290
6293
6294 string config_to_search = "CfgVehicles";
6295 string muzzle_owner_config;
6296
6298 {
6299 if (IsInherited(Weapon))
6300 config_to_search = "CfgWeapons";
6301
6302 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6303
6304 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6305
6306 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6307
6308 if (config_OnFire_subclass_count > 0)
6309 {
6310 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6311
6312 for (int i = 0; i < config_OnFire_subclass_count; i++)
6313 {
6314 string particle_class = "";
6315 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6316 string config_OnFire_entry = config_OnFire_class + particle_class;
6317 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6318 WPOF_array.Insert(WPOF);
6319 }
6320
6321
6323 }
6324 }
6325
6327 {
6328 config_to_search = "CfgWeapons";
6329 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6330
6331 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6332
6333 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6334
6335 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6336 {
6337 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6338
6339 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6340 {
6341 string particle_class2 = "";
6342 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6343 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6344 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6345 WPOBE_array.Insert(WPOBE);
6346 }
6347
6348
6350 }
6351 }
6352 }
6353
6354
6356 {
6359
6361 {
6362 string config_to_search = "CfgVehicles";
6363
6364 if (IsInherited(Weapon))
6365 config_to_search = "CfgWeapons";
6366
6367 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6368 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6369
6370 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6371 {
6372
6374
6376 {
6378 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6380 return;
6381 }
6382
6385
6386
6387
6388 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6389 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6390
6391 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6392 {
6393 string particle_class = "";
6394 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6395 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6396 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6397
6398 if (entry_type == CT_CLASS)
6399 {
6400 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6401 WPOOH_array.Insert(WPOF);
6402 }
6403 }
6404
6405
6407 }
6408 }
6409 }
6410
6412 {
6414 }
6415
6417 {
6419 {
6421
6424
6427
6428 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6429 }
6430 }
6431
6433 {
6435 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6436
6438 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6439
6441 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6442
6444 {
6446 }
6447 }
6448
6450 {
6452 }
6453
6455 {
6458 else
6460
6462 {
6465 }
6466 else
6467 {
6470
6473 }
6474
6476 }
6477
6479 {
6481 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6482 }
6483
6485 {
6487 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6489 }
6490
6492 {
6494 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6495 }
6496
6498 {
6501
6502 OverheatingParticle OP = new OverheatingParticle();
6507
6509 }
6510
6512 {
6515
6516 return -1;
6517 }
6518
6520 {
6522 {
6525
6526 for (int i = count; i > 0; --i)
6527 {
6528 int id = i - 1;
6531
6534
6535 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6536 {
6537 if (p)
6538 {
6541 }
6542 }
6543 }
6544 }
6545 }
6546
6548 {
6550 {
6552 {
6553 int id = i - 1;
6555
6556 if (OP)
6557 {
6559
6560 if (p)
6561 {
6563 }
6564
6565 delete OP;
6566 }
6567 }
6568
6571 }
6572 }
6573
6576 {
6577 return 0.0;
6578 }
6579
6580
6582 {
6583 return 250;
6584 }
6585
6587 {
6588 return 0;
6589 }
6590
6593 {
6595 return true;
6596
6597 return false;
6598 }
6599
6602 {
6605
6607 {
6609 }
6610 else
6611 {
6612
6614 }
6615
6617 }
6618
6625 {
6626 return -1;
6627 }
6628
6629
6630
6631
6633 {
6635 {
6636 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6637 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6638
6639 if (r_index >= 0)
6640 {
6641 InventoryLocation r_il = new InventoryLocation;
6642 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6643
6644 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6647 {
6648 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6649 }
6651 {
6652 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6653 }
6654
6655 }
6656
6657 player.GetHumanInventory().ClearUserReservedLocation(this);
6658 }
6659
6662 }
6663
6664
6665
6666
6668 {
6669 return ItemBase.m_DebugActionsMask;
6670 }
6671
6673 {
6674 return ItemBase.m_DebugActionsMask & mask;
6675 }
6676
6678 {
6679 ItemBase.m_DebugActionsMask = mask;
6680 }
6681
6683 {
6684 ItemBase.m_DebugActionsMask |= mask;
6685 }
6686
6688 {
6689 ItemBase.m_DebugActionsMask &= ~mask;
6690 }
6691
6693 {
6695 {
6697 }
6698 else
6699 {
6701 }
6702 }
6703
6704
6706 {
6707 if (GetEconomyProfile())
6708 {
6709 float q_max = GetEconomyProfile().GetQuantityMax();
6710 if (q_max > 0)
6711 {
6712 float q_min = GetEconomyProfile().GetQuantityMin();
6713 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6714
6716 {
6717 ComponentEnergyManager comp = GetCompEM();
6719 {
6721 }
6722 }
6724 {
6726
6727 }
6728
6729 }
6730 }
6731 }
6732
6735 {
6736 EntityAI parent = GetHierarchyParent();
6737
6738 if (parent)
6739 {
6740 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6741 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6742 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6743 }
6744 }
6745
6748 {
6749 EntityAI parent = GetHierarchyParent();
6750
6751 if (parent)
6752 {
6753 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6754 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6755 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6756 }
6757 }
6758
6760 {
6761
6762
6763
6764
6766
6768 {
6769 if (ScriptInputUserData.CanStoreInputUserData())
6770 {
6771 ScriptInputUserData ctx = new ScriptInputUserData;
6777 ctx.
Write(use_stack_max);
6780
6782 {
6783 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6784 }
6785 }
6786 }
6787 else if (!
g_Game.IsMultiplayer())
6788 {
6790 }
6791 }
6792
6794 {
6796 }
6797
6799 {
6801 }
6802
6804 {
6806 }
6807
6809 {
6810
6811 return false;
6812 }
6813
6815 {
6816 return false;
6817 }
6818
6822 {
6823 return false;
6824 }
6825
6827 {
6828 return "";
6829 }
6830
6832
6834 {
6835 return false;
6836 }
6837
6839 {
6840 return true;
6841 }
6842
6843
6844
6846 {
6847 return true;
6848 }
6849
6851 {
6852 return true;
6853 }
6854
6856 {
6857 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6859 }
6860
6862 {
6864 }
6865
6867 {
6869 if (!is_being_placed)
6871 SetSynchDirty();
6872 }
6873
6874
6876
6878 {
6880 }
6881
6883 {
6885 }
6886
6888 {
6889 return 1;
6890 }
6891
6893 {
6894 return false;
6895 }
6896
6898 {
6900 SetSynchDirty();
6901 }
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6928
6929
6930
6931
6932
6933
6934
6935
6936
6938 {
6939 super.OnMovedInsideCargo(container);
6940
6941 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6942 }
6943
6944 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6945 {
6946 super.EEItemLocationChanged(oldLoc, newLoc);
6947
6948 PlayerBase newPlayer = null;
6949 PlayerBase oldPlayer = null;
6950
6951 if (newLoc.GetParent())
6952 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6953
6954 if (oldLoc.GetParent())
6955 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6956
6958 {
6959 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6960
6961 if (rIndex >= 0)
6962 {
6963 InventoryLocation rIl = new InventoryLocation;
6964 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6965
6966 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6969 {
6970 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6971 }
6973 {
6975 }
6976
6977 }
6978 }
6979
6981 {
6982 if (newPlayer)
6983 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6984
6985 if (newPlayer == oldPlayer)
6986 {
6987 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6988 {
6990 {
6991 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6992 {
6993 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6994 }
6995 }
6996 else
6997 {
6998 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6999 }
7000 }
7001
7002 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7003 {
7004 int type = oldLoc.GetType();
7006 {
7007 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7008 }
7010 {
7011 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7012 }
7013 }
7014 if (!m_OldLocation)
7015 {
7016 m_OldLocation = new InventoryLocation;
7017 }
7018 m_OldLocation.Copy(oldLoc);
7019 }
7020 else
7021 {
7022 if (m_OldLocation)
7023 {
7024 m_OldLocation.Reset();
7025 }
7026 }
7027
7028 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7029 }
7030 else
7031 {
7032 if (newPlayer)
7033 {
7034 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7035 if (resIndex >= 0)
7036 {
7037 InventoryLocation il = new InventoryLocation;
7038 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7040 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7043 {
7044 il.
GetParent().GetOnReleaseLock().Invoke(it);
7045 }
7047 {
7049 }
7050
7051 }
7052 }
7054 {
7055
7057 }
7058
7059 if (m_OldLocation)
7060 {
7061 m_OldLocation.Reset();
7062 }
7063 }
7064
7066 {
7067 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7068 }
7069
7071 {
7072 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7073 }
7074 }
7075
7076 override void EOnContact(IEntity other, Contact extra)
7077 {
7079 {
7080 int liquidType = -1;
7082 if (impactSpeed > 0.0)
7083 {
7085 #ifndef SERVER
7087 #else
7089 SetSynchDirty();
7090 #endif
7092 }
7093 }
7094
7095 #ifdef SERVER
7096 if (GetCompEM() && GetCompEM().IsPlugged())
7097 {
7098 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7099 GetCompEM().UnplugThis();
7100 }
7101 #endif
7102 }
7103
7105
7107 {
7109 }
7110
7112 {
7113
7114 }
7115
7117 {
7118 super.OnItemLocationChanged(old_owner, new_owner);
7119
7120 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7121 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7122
7123 if (!relatedPlayer && playerNew)
7124 relatedPlayer = playerNew;
7125
7126 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7127 {
7129 if (actionMgr)
7130 {
7131 ActionBase currentAction = actionMgr.GetRunningAction();
7132 if (currentAction)
7134 }
7135 }
7136
7137 Man ownerPlayerOld = null;
7138 Man ownerPlayerNew = null;
7139
7140 if (old_owner)
7141 {
7142 if (old_owner.
IsMan())
7143 {
7144 ownerPlayerOld = Man.Cast(old_owner);
7145 }
7146 else
7147 {
7148 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7149 }
7150 }
7151 else
7152 {
7154 {
7156
7157 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7158 {
7159 GetCompEM().UnplugThis();
7160 }
7161 }
7162 }
7163
7164 if (new_owner)
7165 {
7166 if (new_owner.
IsMan())
7167 {
7168 ownerPlayerNew = Man.Cast(new_owner);
7169 }
7170 else
7171 {
7172 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7173 }
7174 }
7175
7176 if (ownerPlayerOld != ownerPlayerNew)
7177 {
7178 if (ownerPlayerOld)
7179 {
7180 array<EntityAI> subItemsExit = new array<EntityAI>;
7182 for (int i = 0; i < subItemsExit.Count(); i++)
7183 {
7186 }
7187 }
7188
7189 if (ownerPlayerNew)
7190 {
7191 array<EntityAI> subItemsEnter = new array<EntityAI>;
7193 for (int j = 0; j < subItemsEnter.Count(); j++)
7194 {
7197 }
7198 }
7199 }
7200 else if (ownerPlayerNew != null)
7201 {
7202 PlayerBase nplayer;
7203 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7204 {
7205 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7207 for (int k = 0; k < subItemsUpdate.Count(); k++)
7208 {
7210 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7211 }
7212 }
7213 }
7214
7215 if (old_owner)
7216 old_owner.OnChildItemRemoved(this);
7217 if (new_owner)
7218 new_owner.OnChildItemReceived(this);
7219 }
7220
7221
7223 {
7224 super.EEDelete(parent);
7225 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7226 if (player)
7227 {
7229
7230 if (player.IsAlive())
7231 {
7232 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7233 if (r_index >= 0)
7234 {
7235 InventoryLocation r_il = new InventoryLocation;
7236 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7237
7238 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7241 {
7242 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7243 }
7245 {
7246 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7247 }
7248
7249 }
7250
7251 player.RemoveQuickBarEntityShortcut(this);
7252 }
7253 }
7254 }
7255
7257 {
7258 super.EEKilled(killer);
7259
7262 {
7263 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7264 {
7265 if (IsMagazine())
7266 {
7267 if (Magazine.Cast(this).GetAmmoCount() > 0)
7268 {
7270 }
7271 }
7272 else
7273 {
7275 }
7276 }
7277 }
7278 }
7279
7281 {
7282 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7283
7284 super.OnWasAttached(parent, slot_id);
7285
7288
7291 }
7292
7294 {
7295 super.OnWasDetached(parent, slot_id);
7296
7299
7302 }
7303
7305 {
7306 int idx;
7309
7310 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7311 if (inventory_slots.Count() < 1)
7312 {
7313 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7314 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7315 }
7316 else
7317 {
7318 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7319 }
7320
7321 idx = inventory_slots.Find(slot);
7322 if (idx < 0)
7323 return "";
7324
7325 return attach_types.Get(idx);
7326 }
7327
7329 {
7330 int idx = -1;
7331 string slot;
7332
7335
7336 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7337 if (inventory_slots.Count() < 1)
7338 {
7339 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7340 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7341 }
7342 else
7343 {
7344 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7345 if (detach_types.Count() < 1)
7346 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7347 }
7348
7349 for (int i = 0; i < inventory_slots.Count(); i++)
7350 {
7351 slot = inventory_slots.Get(i);
7352 }
7353
7354 if (slot != "")
7355 {
7356 if (detach_types.Count() == 1)
7357 idx = 0;
7358 else
7359 idx = inventory_slots.Find(slot);
7360 }
7361 if (idx < 0)
7362 return "";
7363
7364 return detach_types.Get(idx);
7365 }
7366
7368 {
7369
7371
7372
7373 float min_time = 1;
7374 float max_time = 3;
7375 float delay = Math.RandomFloat(min_time, max_time);
7376
7377 explode_timer.Run(delay, this, "DoAmmoExplosion");
7378 }
7379
7381 {
7382 Magazine magazine = Magazine.Cast(this);
7383 int pop_sounds_count = 6;
7384 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7385
7386
7387 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7388 string sound_name = pop_sounds[ sound_idx ];
7389 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7390
7391
7392 magazine.ServerAddAmmoCount(-1);
7393
7394
7395 float min_temp_to_explode = 100;
7396
7397 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7398 {
7400 }
7401 }
7402
7403
7404 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7405 {
7406 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7407
7408 const int CHANCE_DAMAGE_CARGO = 4;
7409 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7410 const int CHANCE_DAMAGE_NOTHING = 2;
7411
7413 {
7414 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7415 int chances;
7416 int rnd;
7417
7418 if (GetInventory().GetCargo())
7419 {
7420 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7421 rnd = Math.RandomInt(0,chances);
7422
7423 if (rnd < CHANCE_DAMAGE_CARGO)
7424 {
7426 }
7427 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7428 {
7430 }
7431 }
7432 else
7433 {
7434 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7435 rnd = Math.RandomInt(0,chances);
7436
7437 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7438 {
7440 }
7441 }
7442 }
7443 }
7444
7446 {
7447 CargoBase cargo = GetInventory().GetCargo();
7448 if (cargo)
7449 {
7451 if (item_count > 0)
7452 {
7453 int random_pick = Math.RandomInt(0, item_count);
7455 if (!item.IsExplosive())
7456 {
7457 item.AddHealth("","",damage);
7458 return true;
7459 }
7460 }
7461 }
7462 return false;
7463 }
7464
7466 {
7467 GameInventory inventory = GetInventory();
7469 if (attachment_count > 0)
7470 {
7471 int random_pick = Math.RandomInt(0, attachment_count);
7473 if (!attachment.IsExplosive())
7474 {
7475 attachment.AddHealth("","",damage);
7476 return true;
7477 }
7478 }
7479 return false;
7480 }
7481
7483 {
7485 }
7486
7488 {
7490 return GetInventory().CanRemoveEntity();
7491
7492 return false;
7493 }
7494
7496 {
7497
7499 return false;
7500
7501
7503 return false;
7504
7505
7506
7508 if (delta == 0)
7509 return false;
7510
7511
7512 return true;
7513 }
7514
7516 {
7518 {
7519 if (ScriptInputUserData.CanStoreInputUserData())
7520 {
7521 ScriptInputUserData ctx = new ScriptInputUserData;
7526 ctx.
Write(destination_entity);
7530 }
7531 }
7532 else if (!
g_Game.IsMultiplayer())
7533 {
7535 }
7536 }
7537
7539 {
7540 float split_quantity_new;
7544 InventoryLocation loc = new InventoryLocation;
7545
7546 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7547 {
7549 split_quantity_new = stack_max;
7550 else
7552
7554 {
7555 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7556 if (new_item)
7557 {
7558 new_item.SetResultOfSplit(true);
7559 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7561 new_item.
SetQuantity(split_quantity_new,
false,
true);
7562 }
7563 }
7564 }
7565 else if (destination_entity && slot_id == -1)
7566 {
7567 if (quantity > stack_max)
7568 split_quantity_new = stack_max;
7569 else
7570 split_quantity_new = quantity;
7571
7573 {
7574 GameInventory destinationInventory = destination_entity.GetInventory();
7576 {
7579 }
7580
7581 if (new_item)
7582 {
7583 new_item.SetResultOfSplit(true);
7584 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7586 new_item.
SetQuantity(split_quantity_new,
false,
true);
7587 }
7588 }
7589 }
7590 else
7591 {
7592 if (stack_max != 0)
7593 {
7595 {
7597 }
7598
7599 if (split_quantity_new == 0)
7600 {
7601 if (!
g_Game.IsMultiplayer())
7602 player.PhysicalPredictiveDropItem(this);
7603 else
7604 player.ServerDropEntity(this);
7605 return;
7606 }
7607
7609 {
7611
7612 if (new_item)
7613 {
7614 new_item.SetResultOfSplit(true);
7615 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7618 new_item.PlaceOnSurface();
7619 }
7620 }
7621 }
7622 }
7623 }
7624
7626 {
7627 float split_quantity_new;
7631 InventoryLocation loc = new InventoryLocation;
7632
7633 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7634 {
7636 split_quantity_new = stack_max;
7637 else
7639
7641 {
7642 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7643 if (new_item)
7644 {
7645 new_item.SetResultOfSplit(true);
7646 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7648 new_item.
SetQuantity(split_quantity_new,
false,
true);
7649 }
7650 }
7651 }
7652 else if (destination_entity && slot_id == -1)
7653 {
7654 if (quantity > stack_max)
7655 split_quantity_new = stack_max;
7656 else
7657 split_quantity_new = quantity;
7658
7660 {
7661 GameInventory destinationInventory = destination_entity.GetInventory();
7663 {
7666 }
7667
7668 if (new_item)
7669 {
7670 new_item.SetResultOfSplit(true);
7671 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7673 new_item.
SetQuantity(split_quantity_new,
false,
true);
7674 }
7675 }
7676 }
7677 else
7678 {
7679 if (stack_max != 0)
7680 {
7682 {
7684 }
7685
7687 {
7689
7690 if (new_item)
7691 {
7692 new_item.SetResultOfSplit(true);
7693 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7696 new_item.PlaceOnSurface();
7697 }
7698 }
7699 }
7700 }
7701 }
7702
7704 {
7706 {
7707 if (ScriptInputUserData.CanStoreInputUserData())
7708 {
7709 ScriptInputUserData ctx = new ScriptInputUserData;
7714 dst.WriteToContext(ctx);
7716 }
7717 }
7718 else if (!
g_Game.IsMultiplayer())
7719 {
7721 }
7722 }
7723
7725 {
7727 {
7728 if (ScriptInputUserData.CanStoreInputUserData())
7729 {
7730 ScriptInputUserData ctx = new ScriptInputUserData;
7735 ctx.
Write(destination_entity);
7741 }
7742 }
7743 else if (!
g_Game.IsMultiplayer())
7744 {
7746 }
7747 }
7748
7750 {
7752 }
7753
7755 {
7757 float split_quantity_new;
7759 if (dst.IsValid())
7760 {
7761 int slot_id = dst.GetSlot();
7763
7764 if (quantity > stack_max)
7765 split_quantity_new = stack_max;
7766 else
7767 split_quantity_new = quantity;
7768
7770 {
7772
7773 if (new_item)
7774 {
7775 new_item.SetResultOfSplit(true);
7776 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7778 new_item.
SetQuantity(split_quantity_new,
false,
true);
7779 }
7780
7781 return new_item;
7782 }
7783 }
7784
7785 return null;
7786 }
7787
7789 {
7791 float split_quantity_new;
7793 if (destination_entity)
7794 {
7796 if (quantity > stackable)
7797 split_quantity_new = stackable;
7798 else
7799 split_quantity_new = quantity;
7800
7802 {
7803 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7804 if (new_item)
7805 {
7806 new_item.SetResultOfSplit(true);
7807 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7809 new_item.
SetQuantity(split_quantity_new,
false,
true);
7810 }
7811 }
7812 }
7813 }
7814
7816 {
7818 {
7819 if (ScriptInputUserData.CanStoreInputUserData())
7820 {
7821 ScriptInputUserData ctx = new ScriptInputUserData;
7826 ItemBase destination_entity =
this;
7827 ctx.
Write(destination_entity);
7831 }
7832 }
7833 else if (!
g_Game.IsMultiplayer())
7834 {
7836 }
7837 }
7838
7840 {
7842 float split_quantity_new;
7844 if (player)
7845 {
7847 if (quantity > stackable)
7848 split_quantity_new = stackable;
7849 else
7850 split_quantity_new = quantity;
7851
7853 {
7854 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7855 new_item =
ItemBase.Cast(in_hands);
7856 if (new_item)
7857 {
7858 new_item.SetResultOfSplit(true);
7859 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7861 new_item.SetQuantity(split_quantity_new, false, true);
7862 }
7863 }
7864 }
7865 }
7866
7868 {
7870 float split_quantity_new = Math.Floor(quantity * 0.5);
7871
7873 return;
7874
7876
7877 if (new_item)
7878 {
7879 if (new_item.GetQuantityMax() < split_quantity_new)
7880 {
7881 split_quantity_new = new_item.GetQuantityMax();
7882 }
7883
7884 new_item.SetResultOfSplit(true);
7885 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7886
7888 {
7891 }
7892 else
7893 {
7895 new_item.
SetQuantity(split_quantity_new,
false,
true);
7896 }
7897 }
7898 }
7899
7901 {
7903 float split_quantity_new = Math.Floor(quantity / 2);
7904
7906 return;
7907
7908 InventoryLocation invloc = new InventoryLocation;
7910
7912 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7913
7914 if (new_item)
7915 {
7916 if (new_item.GetQuantityMax() < split_quantity_new)
7917 {
7918 split_quantity_new = new_item.GetQuantityMax();
7919 }
7921 {
7924 }
7925 else if (split_quantity_new > 1)
7926 {
7928 new_item.
SetQuantity(split_quantity_new,
false,
true);
7929 }
7930 }
7931 }
7932
7935 {
7936 SetWeightDirty();
7938
7939 if (parent)
7940 parent.OnAttachmentQuantityChangedEx(this, delta);
7941
7943 {
7945 {
7947 }
7949 {
7950 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7952 }
7953 }
7954 }
7955
7958 {
7959
7960 }
7961
7964 {
7966 }
7967
7969 {
7970 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7971
7973 {
7974 if (newLevel == GameConstants.STATE_RUINED)
7975 {
7977 EntityAI parent = GetHierarchyParent();
7978 if (parent && parent.IsFireplace())
7979 {
7980 CargoBase cargo = GetInventory().GetCargo();
7981 if (cargo)
7982 {
7984 {
7986 }
7987 }
7988 }
7989 }
7990
7992 {
7993
7995 return;
7996 }
7997
7998 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7999 {
8001 }
8002 }
8003 }
8004
8005
8007 {
8008 super.OnRightClick();
8009
8011 {
8013 {
8014 if (ScriptInputUserData.CanStoreInputUserData())
8015 {
8016 EntityAI root = GetHierarchyRoot();
8017 Man playerOwner = GetHierarchyRootPlayer();
8018 InventoryLocation dst = new InventoryLocation;
8019
8020
8021 if (!playerOwner && root && root == this)
8022 {
8024 }
8025 else
8026 {
8027
8028 GetInventory().GetCurrentInventoryLocation(dst);
8030 {
8031 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8033 {
8035 }
8036 else
8037 {
8039
8040
8041 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8042 {
8044 }
8045 else
8046 {
8047 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8048 }
8049 }
8050 }
8051 }
8052
8053 ScriptInputUserData ctx = new ScriptInputUserData;
8061 }
8062 }
8063 else if (!
g_Game.IsMultiplayer())
8064 {
8066 }
8067 }
8068 }
8069
8071 {
8072 if (root)
8073 {
8074 vector m4[4];
8075 root.GetTransform(m4);
8076 dst.SetGround(this, m4);
8077 }
8078 else
8079 {
8080 GetInventory().GetCurrentInventoryLocation(dst);
8081 }
8082 }
8083
8084 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8085 {
8086
8087 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8088 return false;
8089
8090 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8091 return false;
8092
8093
8095 return false;
8096
8097
8098 Magazine mag = Magazine.Cast(this);
8099 if (mag)
8100 {
8101 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8102 return false;
8103
8104 if (stack_max_limit)
8105 {
8106 Magazine other_mag = Magazine.Cast(other_item);
8107 if (other_item)
8108 {
8109 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8110 return false;
8111 }
8112
8113 }
8114 }
8115 else
8116 {
8117
8119 return false;
8120
8122 return false;
8123 }
8124
8125 PlayerBase player = null;
8126 if (CastTo(player, GetHierarchyRootPlayer()))
8127 {
8128 if (player.GetInventory().HasAttachment(this))
8129 return false;
8130
8131 if (player.IsItemsToDelete())
8132 return false;
8133 }
8134
8135 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8136 return false;
8137
8138 int slotID;
8140 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8141 return false;
8142
8143 return true;
8144 }
8145
8147 {
8149 }
8150
8152 {
8153 return m_IsResultOfSplit;
8154 }
8155
8157 {
8158 m_IsResultOfSplit = value;
8159 }
8160
8162 {
8164 }
8165
8167 {
8168 float other_item_quantity = other_item.GetQuantity();
8169 float this_free_space;
8170
8172
8174
8175 if (other_item_quantity > this_free_space)
8176 {
8177 return this_free_space;
8178 }
8179 else
8180 {
8181 return other_item_quantity;
8182 }
8183 }
8184
8186 {
8188 }
8189
8191 {
8193 return;
8194
8195 if (!IsMagazine() && other_item)
8196 {
8198 if (quantity_used != 0)
8199 {
8200 float hp1 = GetHealth01("","");
8201 float hp2 = other_item.GetHealth01("","");
8202 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8203 hpResult = hpResult / (
GetQuantity() + quantity_used);
8204
8205 hpResult *= GetMaxHealth();
8206 Math.Round(hpResult);
8207 SetHealth("", "Health", hpResult);
8208
8210 other_item.AddQuantity(-quantity_used);
8211 }
8212 }
8214 }
8215
8217 {
8218 #ifdef SERVER
8219 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8220 GetHierarchyParent().IncreaseLifetimeUp();
8221 #endif
8222 };
8223
8225 {
8226 PlayerBase p = PlayerBase.Cast(player);
8227
8228 array<int> recipesIds = p.m_Recipes;
8229 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8230 if (moduleRecipesManager)
8231 {
8232 EntityAI itemInHands = player.GetEntityInHands();
8233 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8234 }
8235
8236 for (int i = 0;i < recipesIds.Count(); i++)
8237 {
8238 int key = recipesIds.Get(i);
8239 string recipeName = moduleRecipesManager.GetRecipeName(key);
8241 }
8242 }
8243
8244
8245 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8246 {
8247 super.GetDebugActions(outputList);
8248
8249
8255
8256
8261
8266
8267
8271
8272
8274 {
8278 }
8279
8282
8283
8287
8289
8290 InventoryLocation loc = new InventoryLocation();
8291 GetInventory().GetCurrentInventoryLocation(loc);
8293 {
8294 if (Gizmo_IsSupported())
8297 }
8298
8300 }
8301
8302
8303
8304
8306 {
8307 super.OnAction(action_id, player, ctx);
8308
8310 {
8311 switch (action_id)
8312 {
8316 return true;
8320 return true;
8321 }
8322 }
8323
8325 {
8326 switch (action_id)
8327 {
8329 Delete();
8330 return true;
8331 }
8332 }
8333
8334 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8335 {
8336 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8337 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8338 PlayerBase p = PlayerBase.Cast(player);
8339 if (
EActions.RECIPES_RANGE_START < 1000)
8340 {
8341 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8342 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8343 }
8344 }
8345 #ifndef SERVER
8346 else if (action_id ==
EActions.WATCH_PLAYER)
8347 {
8348 PluginDeveloper.SetDeveloperItemClientEx(player);
8349 }
8350 #endif
8352 {
8353 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8354 {
8355 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8356 OnDebugButtonPressServer(id + 1);
8357 }
8358
8359 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8360 {
8361 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8363 }
8364
8365 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8366 {
8367 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8369 }
8370
8371 else if (action_id ==
EActions.ADD_QUANTITY)
8372 {
8373 if (IsMagazine())
8374 {
8375 Magazine mag = Magazine.Cast(this);
8376 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8377 }
8378 else
8379 {
8381 }
8382
8383 if (m_EM)
8384 {
8385 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8386 }
8387
8388 }
8389
8390 else if (action_id ==
EActions.REMOVE_QUANTITY)
8391 {
8392 if (IsMagazine())
8393 {
8394 Magazine mag2 = Magazine.Cast(this);
8395 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8396 }
8397 else
8398 {
8400 }
8401 if (m_EM)
8402 {
8403 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8404 }
8405
8406 }
8407
8408 else if (action_id ==
EActions.SET_QUANTITY_0)
8409 {
8411
8412 if (m_EM)
8413 {
8414 m_EM.SetEnergy(0);
8415 }
8416 }
8417
8418 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8419 {
8421
8422 if (m_EM)
8423 {
8424 m_EM.SetEnergy(m_EM.GetEnergyMax());
8425 }
8426 }
8427
8428 else if (action_id ==
EActions.ADD_HEALTH)
8429 {
8430 AddHealth("","",GetMaxHealth("","Health")/5);
8431 }
8432 else if (action_id ==
EActions.REMOVE_HEALTH)
8433 {
8434 AddHealth("","",-GetMaxHealth("","Health")/5);
8435 }
8436 else if (action_id ==
EActions.DESTROY_HEALTH)
8437 {
8438 SetHealth01("","",0);
8439 }
8440 else if (action_id ==
EActions.WATCH_ITEM)
8441 {
8443 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8444 #ifdef DEVELOPER
8445 SetDebugDeveloper_item(this);
8446 #endif
8447 }
8448
8449 else if (action_id ==
EActions.ADD_TEMPERATURE)
8450 {
8451 AddTemperature(20);
8452
8453 }
8454
8455 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8456 {
8457 AddTemperature(-20);
8458
8459 }
8460
8461 else if (action_id ==
EActions.FLIP_FROZEN)
8462 {
8463 SetFrozen(!GetIsFrozen());
8464
8465 }
8466
8467 else if (action_id ==
EActions.ADD_WETNESS)
8468 {
8470
8471 }
8472
8473 else if (action_id ==
EActions.REMOVE_WETNESS)
8474 {
8476
8477 }
8478
8479 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8480 {
8483
8484
8485 }
8486
8487 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8488 {
8491 }
8492
8493 else if (action_id ==
EActions.MAKE_SPECIAL)
8494 {
8495 auto debugParams = DebugSpawnParams.WithPlayer(player);
8496 OnDebugSpawnEx(debugParams);
8497 }
8498
8499 }
8500
8501
8502 return false;
8503 }
8504
8505
8506
8507
8511
8514
8515
8516
8518 {
8519 return false;
8520 }
8521
8522
8524 {
8525 return true;
8526 }
8527
8528
8530 {
8531 return true;
8532 }
8533
8534
8535
8537 {
8538 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8539 return g_Game.ConfigIsExisting(config_path);
8540 }
8541
8544 {
8545 return null;
8546 }
8547
8549 {
8550 return false;
8551 }
8552
8554 {
8555 return false;
8556 }
8557
8561
8562
8564 {
8565 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8566 return module_repairing.CanRepair(this, item_repair_kit);
8567 }
8568
8569
8570 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8571 {
8572 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8573 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8574 }
8575
8576
8578 {
8579
8580
8581
8582
8583
8584
8585
8586
8587 return 1;
8588 }
8589
8590
8591
8593 {
8595 }
8596
8597
8598
8600 {
8602 }
8603
8604
8613 {
8614 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8615
8616 if (player)
8617 {
8618 player.MessageStatus(text);
8619 }
8620 }
8621
8622
8631 {
8632 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8633
8634 if (player)
8635 {
8636 player.MessageAction(text);
8637 }
8638 }
8639
8640
8649 {
8650 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8651
8652 if (player)
8653 {
8654 player.MessageFriendly(text);
8655 }
8656 }
8657
8658
8667 {
8668 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8669
8670 if (player)
8671 {
8672 player.MessageImportant(text);
8673 }
8674 }
8675
8677 {
8678 return true;
8679 }
8680
8681
8682 override bool KindOf(
string tag)
8683 {
8684 bool found = false;
8685 string item_name = this.
GetType();
8687 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8688
8689 int array_size = item_tag_array.Count();
8690 for (int i = 0; i < array_size; i++)
8691 {
8692 if (item_tag_array.Get(i) == tag)
8693 {
8694 found = true;
8695 break;
8696 }
8697 }
8698 return found;
8699 }
8700
8701
8703 {
8704
8705 super.OnRPC(sender, rpc_type,ctx);
8706
8707
8708 switch (rpc_type)
8709 {
8710 #ifndef SERVER
8711 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8712 Param2<bool, string> p = new Param2<bool, string>(false, "");
8713
8715 return;
8716
8717 bool play = p.param1;
8718 string soundSet = p.param2;
8719
8720 if (play)
8721 {
8723 {
8725 {
8727 }
8728 }
8729 else
8730 {
8732 }
8733 }
8734 else
8735 {
8737 }
8738
8739 break;
8740 #endif
8741
8742 }
8743
8745 {
8747 }
8748 }
8749
8750
8751
8752
8754 {
8755 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8756 return plugin.GetID(
name);
8757 }
8758
8760 {
8761 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8762 return plugin.GetName(id);
8763 }
8764
8767 {
8768
8769
8770 int varFlags;
8771 if (!ctx.
Read(varFlags))
8772 return;
8773
8774 if (varFlags & ItemVariableFlags.FLOAT)
8775 {
8777 }
8778 }
8779
8781 {
8782
8783 super.SerializeNumericalVars(floats_out);
8784
8785
8786
8788 {
8790 }
8791
8793 {
8795 }
8796
8798 {
8800 }
8801
8803 {
8808 }
8809
8811 {
8813 }
8814 }
8815
8817 {
8818
8819 super.DeSerializeNumericalVars(floats);
8820
8821
8822 int index = 0;
8823 int mask = Math.Round(floats.Get(index));
8824
8825 index++;
8826
8828 {
8830 {
8832 }
8833 else
8834 {
8835 float quantity = floats.Get(index);
8837 }
8838 index++;
8839 }
8840
8842 {
8843 float wet = floats.Get(index);
8845 index++;
8846 }
8847
8849 {
8850 int liquidtype = Math.Round(floats.Get(index));
8852 index++;
8853 }
8854
8856 {
8858 index++;
8860 index++;
8862 index++;
8864 index++;
8865 }
8866
8868 {
8869 int cleanness = Math.Round(floats.Get(index));
8871 index++;
8872 }
8873 }
8874
8876 {
8877 super.WriteVarsToCTX(ctx);
8878
8879
8881 {
8883 }
8884
8886 {
8888 }
8889
8891 {
8893 }
8894
8896 {
8897 int r,g,b,a;
8903 }
8904
8906 {
8908 }
8909 }
8910
8912 {
8913 if (!super.ReadVarsFromCTX(ctx,version))
8914 return false;
8915
8916 int intValue;
8917 float value;
8918
8919 if (version < 140)
8920 {
8921 if (!ctx.
Read(intValue))
8922 return false;
8923
8924 m_VariablesMask = intValue;
8925 }
8926
8928 {
8929 if (!ctx.
Read(value))
8930 return false;
8931
8933 {
8935 }
8936 else
8937 {
8939 }
8940 }
8941
8942 if (version < 140)
8943 {
8945 {
8946 if (!ctx.
Read(value))
8947 return false;
8948 SetTemperatureDirect(value);
8949 }
8950 }
8951
8953 {
8954 if (!ctx.
Read(value))
8955 return false;
8957 }
8958
8960 {
8961 if (!ctx.
Read(intValue))
8962 return false;
8964 }
8965
8967 {
8968 int r,g,b,a;
8970 return false;
8972 return false;
8974 return false;
8976 return false;
8977
8979 }
8980
8982 {
8983 if (!ctx.
Read(intValue))
8984 return false;
8986 }
8987
8988 if (version >= 138 && version < 140)
8989 {
8991 {
8992 if (!ctx.
Read(intValue))
8993 return false;
8994 SetFrozen(intValue);
8995 }
8996 }
8997
8998 return true;
8999 }
9000
9001
9003 {
9006 {
9008 }
9009
9010 if (!super.OnStoreLoad(ctx, version))
9011 {
9013 return false;
9014 }
9015
9016 if (version >= 114)
9017 {
9018 bool hasQuickBarIndexSaved;
9019
9020 if (!ctx.
Read(hasQuickBarIndexSaved))
9021 {
9023 return false;
9024 }
9025
9026 if (hasQuickBarIndexSaved)
9027 {
9028 int itmQBIndex;
9029
9030
9031 if (!ctx.
Read(itmQBIndex))
9032 {
9034 return false;
9035 }
9036
9037 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9038 if (itmQBIndex != -1 && parentPlayer)
9039 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9040 }
9041 }
9042 else
9043 {
9044
9045 PlayerBase player;
9046 int itemQBIndex;
9047 if (version ==
int.
MAX)
9048 {
9049 if (!ctx.
Read(itemQBIndex))
9050 {
9052 return false;
9053 }
9054 }
9055 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9056 {
9057
9058 if (!ctx.
Read(itemQBIndex))
9059 {
9061 return false;
9062 }
9063 if (itemQBIndex != -1 && player)
9064 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9065 }
9066 }
9067
9068 if (version < 140)
9069 {
9070
9071 if (!LoadVariables(ctx, version))
9072 {
9074 return false;
9075 }
9076 }
9077
9078
9080 {
9082 return false;
9083 }
9084 if (version >= 132)
9085 {
9087 if (raib)
9088 {
9090 {
9092 return false;
9093 }
9094 }
9095 }
9096
9098 return true;
9099 }
9100
9101
9102
9104 {
9105 super.OnStoreSave(ctx);
9106
9107 PlayerBase player;
9108 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9109 {
9111
9112 int itemQBIndex = -1;
9113 itemQBIndex = player.FindQuickBarEntityIndex(this);
9114 ctx.
Write(itemQBIndex);
9115 }
9116 else
9117 {
9119 }
9120
9122
9124 if (raib)
9125 {
9127 }
9128 }
9129
9130
9132 {
9133 super.AfterStoreLoad();
9134
9136 {
9138 }
9139
9141 {
9144 }
9145 }
9146
9148 {
9149 super.EEOnAfterLoad();
9150
9152 {
9154 }
9155
9158 }
9159
9161 {
9162 return false;
9163 }
9164
9165
9166
9168 {
9170 {
9171 #ifdef PLATFORM_CONSOLE
9172
9174 {
9176 if (menu)
9177 {
9179 }
9180 }
9181 #endif
9182 }
9183
9185 {
9188 }
9189
9191 {
9192 SetWeightDirty();
9194 }
9196 {
9199 }
9200
9202 {
9205
9208 }
9210 {
9214 }
9215
9216 super.OnVariablesSynchronized();
9217 }
9218
9219
9220
9222 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9223 {
9224 if (!IsServerCheck(allow_client))
9225 return false;
9226
9228 return false;
9229
9232
9233 if (value <= (min + 0.001))
9234 value = min;
9235
9236 if (value == min)
9237 {
9238 if (destroy_config)
9239 {
9240 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9241 if (dstr)
9242 {
9244 this.Delete();
9245 return true;
9246 }
9247 }
9248 else if (destroy_forced)
9249 {
9251 this.Delete();
9252 return true;
9253 }
9254
9256 }
9257
9260
9262 {
9263 EntityAI parent = GetHierarchyRoot();
9264 InventoryLocation iLoc = new InventoryLocation();
9265 GetInventory().GetCurrentInventoryLocation(iLoc);
9267 {
9268 int iLocSlot = iLoc.
GetSlot();
9270 {
9272 }
9274 {
9276 }
9277 }
9278 }
9279
9281 {
9283
9284 if (delta)
9286 }
9287
9289
9290 return false;
9291 }
9292
9293
9295 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9296 {
9298 }
9299
9301 {
9304 }
9305
9307 {
9310 }
9311
9313 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9314 {
9315 float value_clamped = Math.Clamp(value, 0, 1);
9317 SetQuantity(result, destroy_config, destroy_forced);
9318 }
9319
9320
9323 {
9325 }
9326
9328 {
9330 }
9331
9332
9333
9334
9335
9336
9337
9338
9339
9340
9342 {
9343 int slot = -1;
9344 GameInventory inventory = GetInventory();
9345 if (inventory)
9346 {
9347 InventoryLocation il = new InventoryLocation;
9350 }
9351
9353 }
9354
9356 {
9357 float quantity_max = 0;
9358
9360 {
9361 if (attSlotID != -1)
9362 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9363
9364 if (quantity_max <= 0)
9366 }
9367
9368 if (quantity_max <= 0)
9370
9371 return quantity_max;
9372 }
9373
9375 {
9377 }
9378
9380 {
9382 }
9383
9384
9386 {
9388 }
9389
9391 {
9393 }
9394
9396 {
9398 }
9399
9400
9402 {
9403
9404 float weightEx = GetWeightEx();
9405 float special = GetInventoryAndCargoWeight();
9406 return weightEx - special;
9407 }
9408
9409
9411 {
9413 }
9414
9416 {
9418 {
9419 #ifdef DEVELOPER
9420 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9421 {
9422 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9424 }
9425 #endif
9426
9428 }
9429 else if (HasEnergyManager())
9430 {
9431 #ifdef DEVELOPER
9432 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9433 {
9434 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9435 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9436 }
9437 #endif
9438 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9439 }
9440 else
9441 {
9442 #ifdef DEVELOPER
9443 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9444 {
9445 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9446 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9447 }
9448 #endif
9449 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9450 }
9451 }
9452
9455 {
9456 int item_count = 0;
9458
9459 GameInventory inventory = GetInventory();
9460 CargoBase cargo = inventory.
GetCargo();
9461 if (cargo != NULL)
9462 {
9464 }
9465
9467 for (int i = 0; i < nAttachments; ++i)
9468 {
9470 if (item)
9471 item_count += item.GetNumberOfItems();
9472 }
9473 return item_count;
9474 }
9475
9478 {
9479 float weight = 0;
9480 float wetness = 1;
9481 if (include_wetness)
9484 {
9485 weight = wetness * m_ConfigWeight;
9486 }
9488 {
9489 weight = 1;
9490 }
9491 return weight;
9492 }
9493
9494
9495
9497 {
9498 GameInventory inventory = GetInventory();
9499 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9500 {
9501 array<EntityAI> items = new array<EntityAI>;
9503 for (int i = 0; i < items.Count(); ++i)
9504 {
9506 if (item)
9507 {
9508 g_Game.ObjectDelete(item);
9509 }
9510 }
9511 }
9512 }
9513
9514
9515
9516
9518 {
9519 float energy = 0;
9520 if (HasEnergyManager())
9521 {
9522 energy = GetCompEM().GetEnergy();
9523 }
9524 return energy;
9525 }
9526
9527
9529 {
9530 super.OnEnergyConsumed();
9531
9533 }
9534
9536 {
9537 super.OnEnergyAdded();
9538
9540 }
9541
9542
9544 {
9545 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9546 {
9548 {
9549 float energy_0to1 = GetCompEM().GetEnergy0To1();
9551 }
9552 }
9553 }
9554
9555
9557 {
9558 return ConfigGetFloat("heatIsolation");
9559 }
9560
9562 {
9564 }
9565
9567 {
9568 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9569 if (
g_Game.ConfigIsExisting(paramPath))
9570 return g_Game.ConfigGetFloat(paramPath);
9571
9572 return 0.0;
9573 }
9574
9576 {
9577 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9578 if (
g_Game.ConfigIsExisting(paramPath))
9579 return g_Game.ConfigGetFloat(paramPath);
9580
9581 return 0.0;
9582 }
9583
9584 override void SetWet(
float value,
bool allow_client =
false)
9585 {
9586 if (!IsServerCheck(allow_client))
9587 return;
9588
9591
9593
9594 m_VarWet = Math.Clamp(value, min, max);
9595
9597 {
9600 }
9601 }
9602
9603 override void AddWet(
float value)
9604 {
9606 }
9607
9609 {
9611 }
9612
9614 {
9616 }
9617
9619 {
9621 }
9622
9624 {
9626 }
9627
9629 {
9631 }
9632
9634 {
9637 if (newLevel != oldLevel)
9638 {
9640 }
9641 }
9642
9644 {
9645 SetWeightDirty();
9646 }
9647
9649 {
9650 return GetWetLevelInternal(
m_VarWet);
9651 }
9652
9653
9654
9656 {
9658 }
9659
9661 {
9663 }
9664
9666 {
9668 }
9669
9671 {
9673 }
9674
9675
9676
9678 {
9679 if (ConfigIsExisting("itemModelLength"))
9680 {
9681 return ConfigGetFloat("itemModelLength");
9682 }
9683 return 0;
9684 }
9685
9687 {
9688 if (ConfigIsExisting("itemAttachOffset"))
9689 {
9690 return ConfigGetFloat("itemAttachOffset");
9691 }
9692 return 0;
9693 }
9694
9695 override void SetCleanness(
int value,
bool allow_client =
false)
9696 {
9697 if (!IsServerCheck(allow_client))
9698 return;
9699
9701
9703
9706 }
9707
9709 {
9711 }
9712
9714 {
9715 return true;
9716 }
9717
9718
9719
9720
9722 {
9724 }
9725
9727 {
9729 }
9730
9731
9732
9733
9734 override void SetColor(
int r,
int g,
int b,
int a)
9735 {
9741 }
9743 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9744 {
9749 }
9750
9752 {
9754 }
9755
9758 {
9759 int r,g,b,a;
9761 r = r/255;
9762 g = g/255;
9763 b = b/255;
9764 a = a/255;
9765 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9766 }
9767
9768
9769
9770 override void SetLiquidType(
int value,
bool allow_client =
false)
9771 {
9772 if (!IsServerCheck(allow_client))
9773 return;
9774
9779 }
9780
9782 {
9783 return ConfigGetInt("varLiquidTypeInit");
9784 }
9785
9787 {
9789 }
9790
9792 {
9794 SetFrozen(false);
9795 }
9796
9799 {
9800 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9801 }
9802
9803
9806 {
9807 PlayerBase nplayer;
9808 if (PlayerBase.CastTo(nplayer, player))
9809 {
9811 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9812 }
9813 }
9814
9815
9818 {
9819 PlayerBase nplayer;
9820 if (PlayerBase.CastTo(nplayer,player))
9821 {
9822 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9823 }
9824
9825 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9826
9827 if (HasEnergyManager())
9828 {
9829 GetCompEM().UpdatePlugState();
9830 }
9831 }
9832
9833
9835 {
9836 super.OnPlacementStarted(player);
9837
9839 }
9840
9841 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9842 {
9844 {
9845 m_AdminLog.OnPlacementComplete(player,
this);
9846 }
9847
9848 super.OnPlacementComplete(player, position, orientation);
9849 }
9850
9851
9852
9853
9854
9856 {
9858 {
9859 return true;
9860 }
9861 else
9862 {
9863 return false;
9864 }
9865 }
9866
9867
9869 {
9871 {
9873 }
9874 }
9875
9876
9878 {
9880 }
9881
9883 {
9885 }
9886
9887 override void InsertAgent(
int agent,
float count = 1)
9888 {
9889 if (count < 1)
9890 return;
9891
9893 }
9894
9897 {
9899 }
9900
9901
9903 {
9905 }
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9939
9940
9941
9942
9943
9944
9945
9946
9947
9949 {
9951 return false;
9952 return true;
9953 }
9954
9956 {
9957
9959 }
9960
9961
9964 {
9965 super.CheckForRoofLimited(timeTresholdMS);
9966
9967 float time =
g_Game.GetTime();
9968 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9969 {
9970 m_PreviousRoofTestTime = time;
9971 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9972 }
9973 }
9974
9975
9977 {
9979 {
9980 return 0;
9981 }
9982
9983 if (GetInventory().GetAttachmentSlotsCount() != 0)
9984 {
9985 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9986 if (filter)
9987 return filter.GetProtectionLevel(type, false, system);
9988 else
9989 return 0;
9990 }
9991
9992 string subclassPath, entryName;
9993
9994 switch (type)
9995 {
9997 entryName = "biological";
9998 break;
10000 entryName = "chemical";
10001 break;
10002 default:
10003 entryName = "biological";
10004 break;
10005 }
10006
10007 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10008
10009 return g_Game.ConfigGetFloat(subclassPath + entryName);
10010 }
10011
10012
10013
10016 {
10017 if (!IsMagazine())
10019
10021 }
10022
10023
10024
10025
10026
10031 {
10032 return true;
10033 }
10034
10036 {
10038 }
10039
10040
10041
10042
10043
10045 {
10046 if (parent)
10047 {
10048 if (parent.IsInherited(DayZInfected))
10049 return true;
10050
10051 if (!parent.IsRuined())
10052 return true;
10053 }
10054
10055 return true;
10056 }
10057
10059 {
10060 if (!super.CanPutAsAttachment(parent))
10061 {
10062 return false;
10063 }
10064
10065 if (!IsRuined() && !parent.IsRuined())
10066 {
10067 return true;
10068 }
10069
10070 return false;
10071 }
10072
10074 {
10075
10076
10077
10078
10079 return super.CanReceiveItemIntoCargo(item);
10080 }
10081
10083 {
10084
10085
10086
10087
10088 GameInventory attachmentInv = attachment.GetInventory();
10090 {
10091 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10092 return false;
10093 }
10094
10095 InventoryLocation loc = new InventoryLocation();
10096 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10097 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10098 return false;
10099
10100 return super.CanReceiveAttachment(attachment, slotId);
10101 }
10102
10104 {
10105 if (!super.CanReleaseAttachment(attachment))
10106 return false;
10107
10108 return GetInventory().AreChildrenAccessible();
10109 }
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10122
10123
10124
10125
10126
10127
10128
10129
10130
10132 {
10133 int id = muzzle_owner.GetMuzzleID();
10134 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10135
10136 if (WPOF_array)
10137 {
10138 for (int i = 0; i < WPOF_array.Count(); i++)
10139 {
10140 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10141
10142 if (WPOF)
10143 {
10144 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10145 }
10146 }
10147 }
10148 }
10149
10150
10152 {
10153 int id = muzzle_owner.GetMuzzleID();
10155
10156 if (WPOBE_array)
10157 {
10158 for (int i = 0; i < WPOBE_array.Count(); i++)
10159 {
10160 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10161
10162 if (WPOBE)
10163 {
10164 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10165 }
10166 }
10167 }
10168 }
10169
10170
10172 {
10173 int id = muzzle_owner.GetMuzzleID();
10174 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10175
10176 if (WPOOH_array)
10177 {
10178 for (int i = 0; i < WPOOH_array.Count(); i++)
10179 {
10180 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10181
10182 if (WPOOH)
10183 {
10184 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10185 }
10186 }
10187 }
10188 }
10189
10190
10192 {
10193 int id = muzzle_owner.GetMuzzleID();
10194 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10195
10196 if (WPOOH_array)
10197 {
10198 for (int i = 0; i < WPOOH_array.Count(); i++)
10199 {
10200 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10201
10202 if (WPOOH)
10203 {
10204 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10205 }
10206 }
10207 }
10208 }
10209
10210
10212 {
10213 int id = muzzle_owner.GetMuzzleID();
10214 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10215
10216 if (WPOOH_array)
10217 {
10218 for (int i = 0; i < WPOOH_array.Count(); i++)
10219 {
10220 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10221
10222 if (WPOOH)
10223 {
10224 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10225 }
10226 }
10227 }
10228 }
10229
10230
10231
10233 {
10235 {
10236 return true;
10237 }
10238
10239 return false;
10240 }
10241
10243 {
10245 {
10246 return true;
10247 }
10248
10249 return false;
10250 }
10251
10253 {
10255 {
10256 return true;
10257 }
10258
10259 return false;
10260 }
10261
10263 {
10264 return false;
10265 }
10266
10269 {
10270 return UATimeSpent.DEFAULT_DEPLOY;
10271 }
10272
10273
10274
10275
10277 {
10279 SetSynchDirty();
10280 }
10281
10283 {
10285 }
10286
10287
10289 {
10290 return false;
10291 }
10292
10295 {
10296 string att_type = "None";
10297
10298 if (ConfigIsExisting("soundAttType"))
10299 {
10300 att_type = ConfigGetString("soundAttType");
10301 }
10302
10304 }
10305
10307 {
10309 }
10310
10311
10312
10313
10314
10320
10322 {
10325
10327 }
10328
10329
10331 {
10333 return;
10334
10336
10339
10342
10343 SoundParameters params = new SoundParameters();
10347 }
10348
10349
10351 {
10353 {
10356
10357 SetSynchDirty();
10358
10361 }
10362 }
10363
10365 {
10367 }
10368
10369
10371 {
10373 return;
10374
10376 SetSynchDirty();
10377
10380 }
10381
10383 {
10386 }
10387
10389 {
10391 }
10392
10393 void OnApply(PlayerBase player);
10394
10396 {
10397 return 1.0;
10398 };
10399
10401 {
10403 }
10404
10406 {
10408 }
10409
10411
10413 {
10414 SetDynamicPhysicsLifeTime(0.01);
10416 }
10417
10419 {
10420 array<string> zone_names = new array<string>;
10421 GetDamageZones(zone_names);
10422 for (int i = 0; i < zone_names.Count(); i++)
10423 {
10424 SetHealthMax(zone_names.Get(i),"Health");
10425 }
10426 SetHealthMax("","Health");
10427 }
10428
10431 {
10432 float global_health = GetHealth01("","Health");
10433 array<string> zones = new array<string>;
10434 GetDamageZones(zones);
10435
10436 for (int i = 0; i < zones.Count(); i++)
10437 {
10438 SetHealth01(zones.Get(i),"Health",global_health);
10439 }
10440 }
10441
10444 {
10445 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10446 }
10447
10449 {
10450 if (!hasRootAsPlayer)
10451 {
10452 if (refParentIB)
10453 {
10454
10455 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10456 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10457
10458 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10459 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10460
10463 }
10464 else
10465 {
10466
10469 }
10470 }
10471 }
10472
10474 {
10476 {
10477 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10478 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10479 {
10480 float heatPermCoef = 1.0;
10482 while (ent)
10483 {
10484 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10485 ent = ent.GetHierarchyParent();
10486 }
10487
10488 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10489 }
10490 }
10491 }
10492
10494 {
10495
10496 EntityAI parent = GetHierarchyParent();
10497 if (!parent)
10498 {
10499 hasParent = false;
10500 hasRootAsPlayer = false;
10501 }
10502 else
10503 {
10504 hasParent = true;
10505 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10506 refParentIB =
ItemBase.Cast(parent);
10507 }
10508 }
10509
10510 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10511 {
10512
10513 }
10514
10516 {
10517
10518 return false;
10519 }
10520
10522 {
10523
10524
10525 return false;
10526 }
10527
10529 {
10530
10531 return false;
10532 }
10533
10536 {
10537 return !GetIsFrozen() &&
IsOpen();
10538 }
10539
10541 {
10542 bool hasParent = false, hasRootAsPlayer = false;
10544
10545 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10546 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10547
10548 if (wwtu || foodDecay)
10549 {
10553
10554 if (processWetness || processTemperature || processDecay)
10555 {
10557
10558 if (processWetness)
10559 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10560
10561 if (processTemperature)
10563
10564 if (processDecay)
10565 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10566 }
10567 }
10568 }
10569
10572 {
10574 }
10575
10577 {
10580
10581 return super.GetTemperatureFreezeThreshold();
10582 }
10583
10585 {
10588
10589 return super.GetTemperatureThawThreshold();
10590 }
10591
10593 {
10596
10597 return super.GetItemOverheatThreshold();
10598 }
10599
10601 {
10603 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10604
10605 return super.GetTemperatureFreezeTime();
10606 }
10607
10609 {
10611 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10612
10613 return super.GetTemperatureThawTime();
10614 }
10615
10620
10622 {
10623 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10624 }
10625
10627 {
10628 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10629 }
10630
10633 {
10635 }
10636
10638 {
10640 }
10641
10643 {
10645 }
10646
10649 {
10650 return null;
10651 }
10652
10655 {
10656 return false;
10657 }
10658
10660 {
10662 {
10665 if (!trg)
10666 {
10668 explosive = this;
10669 }
10670
10671 explosive.PairRemote(trg);
10673
10674 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10675 trg.SetPersistentPairID(persistentID);
10676 explosive.SetPersistentPairID(persistentID);
10677
10678 return true;
10679 }
10680 return false;
10681 }
10682
10685 {
10686 float ret = 1.0;
10689 ret *= GetHealth01();
10690
10691 return ret;
10692 }
10693
10694 #ifdef DEVELOPER
10695 override void SetDebugItem()
10696 {
10697 super.SetDebugItem();
10698 _itemBase = this;
10699 }
10700
10702 {
10703 string text = super.GetDebugText();
10704
10706 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10707
10708 return text;
10709 }
10710 #endif
10711
10713 {
10714 return true;
10715 }
10716
10718
10720
10722 {
10725 }
10726
10727
10735
10751
10752 [
Obsolete(
"Use ItemSoundHandler instead")]
10755 {
10756 if (!
g_Game.IsDedicatedServer())
10757 {
10758 if (ConfigIsExisting("attachSoundSet"))
10759 {
10760 string cfg_path = "";
10761 string soundset = "";
10762 string type_name =
GetType();
10763
10766 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10767 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10768
10769 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10770 {
10771 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10772 {
10773 if (cfg_slot_array[i] == slot_type)
10774 {
10775 soundset = cfg_soundset_array[i];
10776 break;
10777 }
10778 }
10779 }
10780
10781 if (soundset != "")
10782 {
10783 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10785 }
10786 }
10787 }
10788 }
10789
10791}
10792
10794{
10796 if (entity)
10797 {
10798 bool is_item = entity.IsInherited(
ItemBase);
10799 if (is_item && full_quantity)
10800 {
10803 }
10804 }
10805 else
10806 {
10808 return NULL;
10809 }
10810 return entity;
10811}
10812
10814{
10815 if (item)
10816 {
10817 if (health > 0)
10818 item.SetHealth("", "", health);
10819
10820 if (item.CanHaveTemperature())
10821 {
10823 if (item.CanFreeze())
10824 item.SetFrozen(false);
10825 }
10826
10827 if (item.HasEnergyManager())
10828 {
10829 if (quantity >= 0)
10830 {
10831 item.GetCompEM().SetEnergy0To1(quantity);
10832 }
10833 else
10834 {
10836 }
10837 }
10838 else if (item.IsMagazine())
10839 {
10840 Magazine mag = Magazine.Cast(item);
10841 if (quantity >= 0)
10842 {
10843 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10844 }
10845 else
10846 {
10848 }
10849
10850 }
10851 else
10852 {
10853 if (quantity >= 0)
10854 {
10855 item.SetQuantityNormalized(quantity, false);
10856 }
10857 else
10858 {
10860 }
10861
10862 }
10863 }
10864}
10865
10866#ifdef DEVELOPER
10868#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.