5821{
5823 {
5824 return true;
5825 }
5826};
5827
5829{
5830
5831};
5832
5833
5834
5836{
5840
5842
5845
5846
5847
5848
5849
5858
5864
5869
5874
5895 protected bool m_IsResultOfSplit
5896
5898
5903
5904
5905
5907
5911
5912
5913
5915
5918
5919
5920
5926
5927
5935
5938
5939
5941
5942
5944
5945
5950
5951
5956
5958
5959
5961
5962
5964 {
5969
5970 if (!
g_Game.IsDedicatedServer())
5971 {
5973 {
5975
5977 {
5979 }
5980 }
5981
5984 }
5985
5986 m_OldLocation = null;
5987
5989 {
5991 }
5992
5993 if (ConfigIsExisting("headSelectionsToHide"))
5994 {
5997 }
5998
6000 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6001 {
6003 }
6004
6006
6007 m_IsResultOfSplit = false;
6008
6010 }
6011
6013 {
6014 super.InitItemVariables();
6015
6021 m_Count = ConfigGetInt(
"count");
6022
6025
6030
6033
6038
6050
6054
6055
6058 if (ConfigIsExisting("canBeSplit"))
6059 {
6062 }
6063
6065 if (ConfigIsExisting("itemBehaviour"))
6067
6068
6071 RegisterNetSyncVariableInt("m_VarLiquidType");
6072 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6073
6074 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6075 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6076 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6077
6078 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6079 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6080 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6081 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6082
6083 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6084 RegisterNetSyncVariableBool("m_IsTakeable");
6085 RegisterNetSyncVariableBool("m_IsHologram");
6086
6089 {
6092 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6093 }
6094
6096
6098 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6100
6102 }
6103
6105 {
6107 }
6108
6110 {
6113 {
6118 }
6119 }
6120
6121 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6122 {
6124 {
6127 }
6128
6130 }
6131
6133 {
6139 }
6140
6142
6144 {
6146
6147 if (!action)
6148 {
6149 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6150 return;
6151 }
6152
6154 if (!ai)
6155 {
6157 return;
6158 }
6159
6161 if (!action_array)
6162 {
6163 action_array = new array<ActionBase_Basic>;
6165 }
6166 if (LogManager.IsActionLogEnable())
6167 {
6168 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6169 }
6170
6171 if (action_array.Find(action) != -1)
6172 {
6173 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6174 }
6175 else
6176 {
6177 action_array.Insert(action);
6178 }
6179 }
6180
6182 {
6183 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6184 ActionBase action = player.GetActionManager().GetAction(actionName);
6187
6188 if (action_array)
6189 {
6190 action_array.RemoveItem(action);
6191 }
6192 }
6193
6194
6195
6197 {
6198 ActionOverrideData overrideData = new ActionOverrideData();
6202
6204 if (!actionMap)
6205 {
6208 }
6209
6210 actionMap.Insert(this.
Type(), overrideData);
6211
6212 }
6213
6215
6217
6218
6220 {
6223
6226
6227 string config_to_search = "CfgVehicles";
6228 string muzzle_owner_config;
6229
6231 {
6232 if (IsInherited(Weapon))
6233 config_to_search = "CfgWeapons";
6234
6235 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6236
6237 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6238
6239 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6240
6241 if (config_OnFire_subclass_count > 0)
6242 {
6243 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6244
6245 for (int i = 0; i < config_OnFire_subclass_count; i++)
6246 {
6247 string particle_class = "";
6248 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6249 string config_OnFire_entry = config_OnFire_class + particle_class;
6250 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6251 WPOF_array.Insert(WPOF);
6252 }
6253
6254
6256 }
6257 }
6258
6260 {
6261 config_to_search = "CfgWeapons";
6262 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6263
6264 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6265
6266 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6267
6268 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6269 {
6270 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6271
6272 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6273 {
6274 string particle_class2 = "";
6275 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6276 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6277 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6278 WPOBE_array.Insert(WPOBE);
6279 }
6280
6281
6283 }
6284 }
6285 }
6286
6287
6289 {
6292
6294 {
6295 string config_to_search = "CfgVehicles";
6296
6297 if (IsInherited(Weapon))
6298 config_to_search = "CfgWeapons";
6299
6300 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6301 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6302
6303 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6304 {
6305
6307
6309 {
6311 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6313 return;
6314 }
6315
6318
6319
6320
6321 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6322 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6323
6324 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6325 {
6326 string particle_class = "";
6327 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6328 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6329 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6330
6331 if (entry_type == CT_CLASS)
6332 {
6333 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6334 WPOOH_array.Insert(WPOF);
6335 }
6336 }
6337
6338
6340 }
6341 }
6342 }
6343
6345 {
6347 }
6348
6350 {
6352 {
6354
6357
6360
6361 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6362 }
6363 }
6364
6366 {
6368 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6369
6371 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6372
6374 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6375
6377 {
6379 }
6380 }
6381
6383 {
6385 }
6386
6388 {
6391 else
6393
6395 {
6398 }
6399 else
6400 {
6403
6406 }
6407
6409 }
6410
6412 {
6414 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6415 }
6416
6418 {
6420 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6422 }
6423
6425 {
6427 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6428 }
6429
6431 {
6434
6435 OverheatingParticle OP = new OverheatingParticle();
6440
6442 }
6443
6445 {
6448
6449 return -1;
6450 }
6451
6453 {
6455 {
6458
6459 for (int i = count; i > 0; --i)
6460 {
6461 int id = i - 1;
6464
6467
6468 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6469 {
6470 if (p)
6471 {
6474 }
6475 }
6476 }
6477 }
6478 }
6479
6481 {
6483 {
6485 {
6486 int id = i - 1;
6488
6489 if (OP)
6490 {
6492
6493 if (p)
6494 {
6496 }
6497
6498 delete OP;
6499 }
6500 }
6501
6504 }
6505 }
6506
6509 {
6510 return 0.0;
6511 }
6512
6513
6515 {
6516 return 250;
6517 }
6518
6520 {
6521 return 0;
6522 }
6523
6526 {
6528 return true;
6529
6530 return false;
6531 }
6532
6535 {
6538
6540 {
6542 }
6543 else
6544 {
6545
6547 }
6548
6550 }
6551
6558 {
6559 return -1;
6560 }
6561
6562
6563
6564
6566 {
6568 {
6569 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6570 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6571
6572 if (r_index >= 0)
6573 {
6574 InventoryLocation r_il = new InventoryLocation;
6575 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6576
6577 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6580 {
6581 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6582 }
6584 {
6585 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6586 }
6587
6588 }
6589
6590 player.GetHumanInventory().ClearUserReservedLocation(this);
6591 }
6592
6595 }
6596
6597
6598
6599
6601 {
6602 return ItemBase.m_DebugActionsMask;
6603 }
6604
6606 {
6607 return ItemBase.m_DebugActionsMask & mask;
6608 }
6609
6611 {
6612 ItemBase.m_DebugActionsMask = mask;
6613 }
6614
6616 {
6617 ItemBase.m_DebugActionsMask |= mask;
6618 }
6619
6621 {
6622 ItemBase.m_DebugActionsMask &= ~mask;
6623 }
6624
6626 {
6628 {
6630 }
6631 else
6632 {
6634 }
6635 }
6636
6637
6639 {
6640 if (GetEconomyProfile())
6641 {
6642 float q_max = GetEconomyProfile().GetQuantityMax();
6643 if (q_max > 0)
6644 {
6645 float q_min = GetEconomyProfile().GetQuantityMin();
6646 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6647
6649 {
6650 ComponentEnergyManager comp = GetCompEM();
6652 {
6654 }
6655 }
6657 {
6659
6660 }
6661
6662 }
6663 }
6664 }
6665
6668 {
6669 EntityAI parent = GetHierarchyParent();
6670
6671 if (parent)
6672 {
6673 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6674 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6675 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6676 }
6677 }
6678
6681 {
6682 EntityAI parent = GetHierarchyParent();
6683
6684 if (parent)
6685 {
6686 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6687 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6688 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6689 }
6690 }
6691
6693 {
6694
6695
6696
6697
6699
6701 {
6702 if (ScriptInputUserData.CanStoreInputUserData())
6703 {
6704 ScriptInputUserData ctx = new ScriptInputUserData;
6710 ctx.
Write(use_stack_max);
6713
6715 {
6716 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6717 }
6718 }
6719 }
6720 else if (!
g_Game.IsMultiplayer())
6721 {
6723 }
6724 }
6725
6727 {
6729 }
6730
6732 {
6734 }
6735
6737 {
6739 }
6740
6742 {
6743
6744 return false;
6745 }
6746
6748 {
6749 return false;
6750 }
6751
6755 {
6756 return false;
6757 }
6758
6760 {
6761 return "";
6762 }
6763
6765
6767 {
6768 return false;
6769 }
6770
6772 {
6773 return true;
6774 }
6775
6776
6777
6779 {
6780 return true;
6781 }
6782
6784 {
6785 return true;
6786 }
6787
6789 {
6790 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6792 }
6793
6795 {
6797 }
6798
6800 {
6802 if (!is_being_placed)
6804 SetSynchDirty();
6805 }
6806
6807
6809
6811 {
6813 }
6814
6816 {
6818 }
6819
6821 {
6822 return 1;
6823 }
6824
6826 {
6827 return false;
6828 }
6829
6831 {
6833 SetSynchDirty();
6834 }
6835
6836
6837
6838
6839
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
6871 {
6872 super.OnMovedInsideCargo(container);
6873
6874 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6875 }
6876
6877 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6878 {
6879 super.EEItemLocationChanged(oldLoc, newLoc);
6880
6881 PlayerBase newPlayer = null;
6882 PlayerBase oldPlayer = null;
6883
6884 if (newLoc.GetParent())
6885 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6886
6887 if (oldLoc.GetParent())
6888 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6889
6891 {
6892 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6893
6894 if (rIndex >= 0)
6895 {
6896 InventoryLocation rIl = new InventoryLocation;
6897 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6898
6899 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6902 {
6903 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6904 }
6906 {
6908 }
6909
6910 }
6911 }
6912
6914 {
6915 if (newPlayer)
6916 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6917
6918 if (newPlayer == oldPlayer)
6919 {
6920 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6921 {
6923 {
6924 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6925 {
6926 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6927 }
6928 }
6929 else
6930 {
6931 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6932 }
6933 }
6934
6935 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6936 {
6937 int type = oldLoc.GetType();
6939 {
6940 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6941 }
6943 {
6944 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6945 }
6946 }
6947 if (!m_OldLocation)
6948 {
6949 m_OldLocation = new InventoryLocation;
6950 }
6951 m_OldLocation.Copy(oldLoc);
6952 }
6953 else
6954 {
6955 if (m_OldLocation)
6956 {
6957 m_OldLocation.Reset();
6958 }
6959 }
6960
6961 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6962 }
6963 else
6964 {
6965 if (newPlayer)
6966 {
6967 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6968 if (resIndex >= 0)
6969 {
6970 InventoryLocation il = new InventoryLocation;
6971 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6973 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6976 {
6977 il.
GetParent().GetOnReleaseLock().Invoke(it);
6978 }
6980 {
6982 }
6983
6984 }
6985 }
6987 {
6988
6990 }
6991
6992 if (m_OldLocation)
6993 {
6994 m_OldLocation.Reset();
6995 }
6996 }
6997
6999 {
7000 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7001 }
7002
7004 {
7005 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7006 }
7007 }
7008
7009 override void EOnContact(IEntity other, Contact extra)
7010 {
7012 {
7013 int liquidType = -1;
7015 if (impactSpeed > 0.0)
7016 {
7018 #ifndef SERVER
7020 #else
7022 SetSynchDirty();
7023 #endif
7025 }
7026 }
7027
7028 #ifdef SERVER
7029 if (GetCompEM() && GetCompEM().IsPlugged())
7030 {
7031 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7032 GetCompEM().UnplugThis();
7033 }
7034 #endif
7035 }
7036
7038
7040 {
7042 }
7043
7045 {
7046
7047 }
7048
7050 {
7051 super.OnItemLocationChanged(old_owner, new_owner);
7052
7053 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7054 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7055
7056 if (!relatedPlayer && playerNew)
7057 relatedPlayer = playerNew;
7058
7059 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7060 {
7062 if (actionMgr)
7063 {
7064 ActionBase currentAction = actionMgr.GetRunningAction();
7065 if (currentAction)
7067 }
7068 }
7069
7070 Man ownerPlayerOld = null;
7071 Man ownerPlayerNew = null;
7072
7073 if (old_owner)
7074 {
7075 if (old_owner.
IsMan())
7076 {
7077 ownerPlayerOld = Man.Cast(old_owner);
7078 }
7079 else
7080 {
7081 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7082 }
7083 }
7084 else
7085 {
7087 {
7089
7090 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7091 {
7092 GetCompEM().UnplugThis();
7093 }
7094 }
7095 }
7096
7097 if (new_owner)
7098 {
7099 if (new_owner.
IsMan())
7100 {
7101 ownerPlayerNew = Man.Cast(new_owner);
7102 }
7103 else
7104 {
7105 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7106 }
7107 }
7108
7109 if (ownerPlayerOld != ownerPlayerNew)
7110 {
7111 if (ownerPlayerOld)
7112 {
7113 array<EntityAI> subItemsExit = new array<EntityAI>;
7115 for (int i = 0; i < subItemsExit.Count(); i++)
7116 {
7119 }
7120 }
7121
7122 if (ownerPlayerNew)
7123 {
7124 array<EntityAI> subItemsEnter = new array<EntityAI>;
7126 for (int j = 0; j < subItemsEnter.Count(); j++)
7127 {
7130 }
7131 }
7132 }
7133 else if (ownerPlayerNew != null)
7134 {
7135 PlayerBase nplayer;
7136 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7137 {
7138 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7140 for (int k = 0; k < subItemsUpdate.Count(); k++)
7141 {
7143 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7144 }
7145 }
7146 }
7147
7148 if (old_owner)
7149 old_owner.OnChildItemRemoved(this);
7150 if (new_owner)
7151 new_owner.OnChildItemReceived(this);
7152 }
7153
7154
7156 {
7157 super.EEDelete(parent);
7158 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7159 if (player)
7160 {
7162
7163 if (player.IsAlive())
7164 {
7165 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7166 if (r_index >= 0)
7167 {
7168 InventoryLocation r_il = new InventoryLocation;
7169 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7170
7171 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7174 {
7175 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7176 }
7178 {
7179 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7180 }
7181
7182 }
7183
7184 player.RemoveQuickBarEntityShortcut(this);
7185 }
7186 }
7187 }
7188
7190 {
7191 super.EEKilled(killer);
7192
7195 {
7196 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7197 {
7198 if (IsMagazine())
7199 {
7200 if (Magazine.Cast(this).GetAmmoCount() > 0)
7201 {
7203 }
7204 }
7205 else
7206 {
7208 }
7209 }
7210 }
7211 }
7212
7214 {
7215 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7216
7217 super.OnWasAttached(parent, slot_id);
7218
7221
7224 }
7225
7227 {
7228 super.OnWasDetached(parent, slot_id);
7229
7232
7235 }
7236
7238 {
7239 int idx;
7242
7243 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7244 if (inventory_slots.Count() < 1)
7245 {
7246 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7247 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7248 }
7249 else
7250 {
7251 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7252 }
7253
7254 idx = inventory_slots.Find(slot);
7255 if (idx < 0)
7256 return "";
7257
7258 return attach_types.Get(idx);
7259 }
7260
7262 {
7263 int idx = -1;
7264 string slot;
7265
7268
7269 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7270 if (inventory_slots.Count() < 1)
7271 {
7272 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7273 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7274 }
7275 else
7276 {
7277 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7278 if (detach_types.Count() < 1)
7279 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7280 }
7281
7282 for (int i = 0; i < inventory_slots.Count(); i++)
7283 {
7284 slot = inventory_slots.Get(i);
7285 }
7286
7287 if (slot != "")
7288 {
7289 if (detach_types.Count() == 1)
7290 idx = 0;
7291 else
7292 idx = inventory_slots.Find(slot);
7293 }
7294 if (idx < 0)
7295 return "";
7296
7297 return detach_types.Get(idx);
7298 }
7299
7301 {
7302
7304
7305
7306 float min_time = 1;
7307 float max_time = 3;
7308 float delay = Math.RandomFloat(min_time, max_time);
7309
7310 explode_timer.Run(delay, this, "DoAmmoExplosion");
7311 }
7312
7314 {
7315 Magazine magazine = Magazine.Cast(this);
7316 int pop_sounds_count = 6;
7317 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7318
7319
7320 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7321 string sound_name = pop_sounds[ sound_idx ];
7322 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7323
7324
7325 magazine.ServerAddAmmoCount(-1);
7326
7327
7328 float min_temp_to_explode = 100;
7329
7330 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7331 {
7333 }
7334 }
7335
7336
7337 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7338 {
7339 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7340
7341 const int CHANCE_DAMAGE_CARGO = 4;
7342 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7343 const int CHANCE_DAMAGE_NOTHING = 2;
7344
7346 {
7347 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7348 int chances;
7349 int rnd;
7350
7351 if (GetInventory().GetCargo())
7352 {
7353 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7354 rnd = Math.RandomInt(0,chances);
7355
7356 if (rnd < CHANCE_DAMAGE_CARGO)
7357 {
7359 }
7360 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7361 {
7363 }
7364 }
7365 else
7366 {
7367 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7368 rnd = Math.RandomInt(0,chances);
7369
7370 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7371 {
7373 }
7374 }
7375 }
7376 }
7377
7379 {
7380 CargoBase cargo = GetInventory().GetCargo();
7381 if (cargo)
7382 {
7384 if (item_count > 0)
7385 {
7386 int random_pick = Math.RandomInt(0, item_count);
7388 if (!item.IsExplosive())
7389 {
7390 item.AddHealth("","",damage);
7391 return true;
7392 }
7393 }
7394 }
7395 return false;
7396 }
7397
7399 {
7400 GameInventory inventory = GetInventory();
7402 if (attachment_count > 0)
7403 {
7404 int random_pick = Math.RandomInt(0, attachment_count);
7406 if (!attachment.IsExplosive())
7407 {
7408 attachment.AddHealth("","",damage);
7409 return true;
7410 }
7411 }
7412 return false;
7413 }
7414
7416 {
7418 }
7419
7421 {
7423 return GetInventory().CanRemoveEntity();
7424
7425 return false;
7426 }
7427
7429 {
7430
7432 return false;
7433
7434
7436 return false;
7437
7438
7439
7441 if (delta == 0)
7442 return false;
7443
7444
7445 return true;
7446 }
7447
7449 {
7451 {
7452 if (ScriptInputUserData.CanStoreInputUserData())
7453 {
7454 ScriptInputUserData ctx = new ScriptInputUserData;
7459 ctx.
Write(destination_entity);
7463 }
7464 }
7465 else if (!
g_Game.IsMultiplayer())
7466 {
7468 }
7469 }
7470
7472 {
7473 float split_quantity_new;
7477 InventoryLocation loc = new InventoryLocation;
7478
7479 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7480 {
7482 split_quantity_new = stack_max;
7483 else
7485
7487 {
7488 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7489 if (new_item)
7490 {
7491 new_item.SetResultOfSplit(true);
7492 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7494 new_item.
SetQuantity(split_quantity_new,
false,
true);
7495 }
7496 }
7497 }
7498 else if (destination_entity && slot_id == -1)
7499 {
7500 if (quantity > stack_max)
7501 split_quantity_new = stack_max;
7502 else
7503 split_quantity_new = quantity;
7504
7506 {
7507 GameInventory destinationInventory = destination_entity.GetInventory();
7509 {
7512 }
7513
7514 if (new_item)
7515 {
7516 new_item.SetResultOfSplit(true);
7517 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7519 new_item.
SetQuantity(split_quantity_new,
false,
true);
7520 }
7521 }
7522 }
7523 else
7524 {
7525 if (stack_max != 0)
7526 {
7528 {
7530 }
7531
7532 if (split_quantity_new == 0)
7533 {
7534 if (!
g_Game.IsMultiplayer())
7535 player.PhysicalPredictiveDropItem(this);
7536 else
7537 player.ServerDropEntity(this);
7538 return;
7539 }
7540
7542 {
7544
7545 if (new_item)
7546 {
7547 new_item.SetResultOfSplit(true);
7548 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7551 new_item.PlaceOnSurface();
7552 }
7553 }
7554 }
7555 }
7556 }
7557
7559 {
7560 float split_quantity_new;
7564 InventoryLocation loc = new InventoryLocation;
7565
7566 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7567 {
7569 split_quantity_new = stack_max;
7570 else
7572
7574 {
7575 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7576 if (new_item)
7577 {
7578 new_item.SetResultOfSplit(true);
7579 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7581 new_item.
SetQuantity(split_quantity_new,
false,
true);
7582 }
7583 }
7584 }
7585 else if (destination_entity && slot_id == -1)
7586 {
7587 if (quantity > stack_max)
7588 split_quantity_new = stack_max;
7589 else
7590 split_quantity_new = quantity;
7591
7593 {
7594 GameInventory destinationInventory = destination_entity.GetInventory();
7596 {
7599 }
7600
7601 if (new_item)
7602 {
7603 new_item.SetResultOfSplit(true);
7604 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7606 new_item.
SetQuantity(split_quantity_new,
false,
true);
7607 }
7608 }
7609 }
7610 else
7611 {
7612 if (stack_max != 0)
7613 {
7615 {
7617 }
7618
7620 {
7622
7623 if (new_item)
7624 {
7625 new_item.SetResultOfSplit(true);
7626 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7629 new_item.PlaceOnSurface();
7630 }
7631 }
7632 }
7633 }
7634 }
7635
7637 {
7639 {
7640 if (ScriptInputUserData.CanStoreInputUserData())
7641 {
7642 ScriptInputUserData ctx = new ScriptInputUserData;
7647 dst.WriteToContext(ctx);
7649 }
7650 }
7651 else if (!
g_Game.IsMultiplayer())
7652 {
7654 }
7655 }
7656
7658 {
7660 {
7661 if (ScriptInputUserData.CanStoreInputUserData())
7662 {
7663 ScriptInputUserData ctx = new ScriptInputUserData;
7668 ctx.
Write(destination_entity);
7674 }
7675 }
7676 else if (!
g_Game.IsMultiplayer())
7677 {
7679 }
7680 }
7681
7683 {
7685 }
7686
7688 {
7690 float split_quantity_new;
7692 if (dst.IsValid())
7693 {
7694 int slot_id = dst.GetSlot();
7696
7697 if (quantity > stack_max)
7698 split_quantity_new = stack_max;
7699 else
7700 split_quantity_new = quantity;
7701
7703 {
7705
7706 if (new_item)
7707 {
7708 new_item.SetResultOfSplit(true);
7709 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7711 new_item.
SetQuantity(split_quantity_new,
false,
true);
7712 }
7713
7714 return new_item;
7715 }
7716 }
7717
7718 return null;
7719 }
7720
7722 {
7724 float split_quantity_new;
7726 if (destination_entity)
7727 {
7729 if (quantity > stackable)
7730 split_quantity_new = stackable;
7731 else
7732 split_quantity_new = quantity;
7733
7735 {
7736 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7737 if (new_item)
7738 {
7739 new_item.SetResultOfSplit(true);
7740 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7742 new_item.
SetQuantity(split_quantity_new,
false,
true);
7743 }
7744 }
7745 }
7746 }
7747
7749 {
7751 {
7752 if (ScriptInputUserData.CanStoreInputUserData())
7753 {
7754 ScriptInputUserData ctx = new ScriptInputUserData;
7759 ItemBase destination_entity =
this;
7760 ctx.
Write(destination_entity);
7764 }
7765 }
7766 else if (!
g_Game.IsMultiplayer())
7767 {
7769 }
7770 }
7771
7773 {
7775 float split_quantity_new;
7777 if (player)
7778 {
7780 if (quantity > stackable)
7781 split_quantity_new = stackable;
7782 else
7783 split_quantity_new = quantity;
7784
7786 {
7787 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7788 new_item =
ItemBase.Cast(in_hands);
7789 if (new_item)
7790 {
7791 new_item.SetResultOfSplit(true);
7792 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7794 new_item.SetQuantity(split_quantity_new, false, true);
7795 }
7796 }
7797 }
7798 }
7799
7801 {
7803 float split_quantity_new = Math.Floor(quantity * 0.5);
7804
7806 return;
7807
7809
7810 if (new_item)
7811 {
7812 if (new_item.GetQuantityMax() < split_quantity_new)
7813 {
7814 split_quantity_new = new_item.GetQuantityMax();
7815 }
7816
7817 new_item.SetResultOfSplit(true);
7818 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7819
7821 {
7824 }
7825 else
7826 {
7828 new_item.
SetQuantity(split_quantity_new,
false,
true);
7829 }
7830 }
7831 }
7832
7834 {
7836 float split_quantity_new = Math.Floor(quantity / 2);
7837
7839 return;
7840
7841 InventoryLocation invloc = new InventoryLocation;
7843
7845 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7846
7847 if (new_item)
7848 {
7849 if (new_item.GetQuantityMax() < split_quantity_new)
7850 {
7851 split_quantity_new = new_item.GetQuantityMax();
7852 }
7854 {
7857 }
7858 else if (split_quantity_new > 1)
7859 {
7861 new_item.
SetQuantity(split_quantity_new,
false,
true);
7862 }
7863 }
7864 }
7865
7868 {
7869 SetWeightDirty();
7871
7872 if (parent)
7873 parent.OnAttachmentQuantityChangedEx(this, delta);
7874
7876 {
7878 {
7880 }
7882 {
7883 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7885 }
7886 }
7887 }
7888
7891 {
7892
7893 }
7894
7897 {
7899 }
7900
7902 {
7903 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7904
7906 {
7907 if (newLevel == GameConstants.STATE_RUINED)
7908 {
7910 EntityAI parent = GetHierarchyParent();
7911 if (parent && parent.IsFireplace())
7912 {
7913 CargoBase cargo = GetInventory().GetCargo();
7914 if (cargo)
7915 {
7917 {
7919 }
7920 }
7921 }
7922 }
7923
7925 {
7926
7928 return;
7929 }
7930
7931 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7932 {
7934 }
7935 }
7936 }
7937
7938
7940 {
7941 super.OnRightClick();
7942
7944 {
7946 {
7947 if (ScriptInputUserData.CanStoreInputUserData())
7948 {
7949 EntityAI root = GetHierarchyRoot();
7950 Man playerOwner = GetHierarchyRootPlayer();
7951 InventoryLocation dst = new InventoryLocation;
7952
7953
7954 if (!playerOwner && root && root == this)
7955 {
7957 }
7958 else
7959 {
7960
7961 GetInventory().GetCurrentInventoryLocation(dst);
7963 {
7964 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7966 {
7968 }
7969 else
7970 {
7972
7973
7974 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7975 {
7977 }
7978 else
7979 {
7980 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7981 }
7982 }
7983 }
7984 }
7985
7986 ScriptInputUserData ctx = new ScriptInputUserData;
7994 }
7995 }
7996 else if (!
g_Game.IsMultiplayer())
7997 {
7999 }
8000 }
8001 }
8002
8004 {
8005 if (root)
8006 {
8007 vector m4[4];
8008 root.GetTransform(m4);
8009 dst.SetGround(this, m4);
8010 }
8011 else
8012 {
8013 GetInventory().GetCurrentInventoryLocation(dst);
8014 }
8015 }
8016
8017 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8018 {
8019
8020 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8021 return false;
8022
8023 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8024 return false;
8025
8026
8028 return false;
8029
8030
8031 Magazine mag = Magazine.Cast(this);
8032 if (mag)
8033 {
8034 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8035 return false;
8036
8037 if (stack_max_limit)
8038 {
8039 Magazine other_mag = Magazine.Cast(other_item);
8040 if (other_item)
8041 {
8042 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8043 return false;
8044 }
8045
8046 }
8047 }
8048 else
8049 {
8050
8052 return false;
8053
8055 return false;
8056 }
8057
8058 PlayerBase player = null;
8059 if (CastTo(player, GetHierarchyRootPlayer()))
8060 {
8061 if (player.GetInventory().HasAttachment(this))
8062 return false;
8063
8064 if (player.IsItemsToDelete())
8065 return false;
8066 }
8067
8068 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8069 return false;
8070
8071 int slotID;
8073 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8074 return false;
8075
8076 return true;
8077 }
8078
8080 {
8082 }
8083
8085 {
8086 return m_IsResultOfSplit;
8087 }
8088
8090 {
8091 m_IsResultOfSplit = value;
8092 }
8093
8095 {
8097 }
8098
8100 {
8101 float other_item_quantity = other_item.GetQuantity();
8102 float this_free_space;
8103
8105
8107
8108 if (other_item_quantity > this_free_space)
8109 {
8110 return this_free_space;
8111 }
8112 else
8113 {
8114 return other_item_quantity;
8115 }
8116 }
8117
8119 {
8121 }
8122
8124 {
8126 return;
8127
8128 if (!IsMagazine() && other_item)
8129 {
8131 if (quantity_used != 0)
8132 {
8133 float hp1 = GetHealth01("","");
8134 float hp2 = other_item.GetHealth01("","");
8135 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8136 hpResult = hpResult / (
GetQuantity() + quantity_used);
8137
8138 hpResult *= GetMaxHealth();
8139 Math.Round(hpResult);
8140 SetHealth("", "Health", hpResult);
8141
8143 other_item.AddQuantity(-quantity_used);
8144 }
8145 }
8147 }
8148
8150 {
8151 #ifdef SERVER
8152 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8153 GetHierarchyParent().IncreaseLifetimeUp();
8154 #endif
8155 };
8156
8158 {
8159 PlayerBase p = PlayerBase.Cast(player);
8160
8161 array<int> recipesIds = p.m_Recipes;
8162 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8163 if (moduleRecipesManager)
8164 {
8165 EntityAI itemInHands = player.GetEntityInHands();
8166 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8167 }
8168
8169 for (int i = 0;i < recipesIds.Count(); i++)
8170 {
8171 int key = recipesIds.Get(i);
8172 string recipeName = moduleRecipesManager.GetRecipeName(key);
8174 }
8175 }
8176
8177
8178 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8179 {
8180 super.GetDebugActions(outputList);
8181
8182
8188
8189
8194
8199
8200
8204
8205
8207 {
8211 }
8212
8215
8216
8220
8222
8223 InventoryLocation loc = new InventoryLocation();
8224 GetInventory().GetCurrentInventoryLocation(loc);
8226 {
8227 if (Gizmo_IsSupported())
8230 }
8231
8233 }
8234
8235
8236
8237
8239 {
8240 super.OnAction(action_id, player, ctx);
8241
8243 {
8244 switch (action_id)
8245 {
8249 return true;
8253 return true;
8254 }
8255 }
8256
8258 {
8259 switch (action_id)
8260 {
8262 Delete();
8263 return true;
8264 }
8265 }
8266
8267 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8268 {
8269 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8270 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8271 PlayerBase p = PlayerBase.Cast(player);
8272 if (
EActions.RECIPES_RANGE_START < 1000)
8273 {
8274 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8275 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8276 }
8277 }
8278 #ifndef SERVER
8279 else if (action_id ==
EActions.WATCH_PLAYER)
8280 {
8281 PluginDeveloper.SetDeveloperItemClientEx(player);
8282 }
8283 #endif
8285 {
8286 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8287 {
8288 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8289 OnDebugButtonPressServer(id + 1);
8290 }
8291
8292 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8293 {
8294 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8296 }
8297
8298 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8299 {
8300 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8302 }
8303
8304 else if (action_id ==
EActions.ADD_QUANTITY)
8305 {
8306 if (IsMagazine())
8307 {
8308 Magazine mag = Magazine.Cast(this);
8309 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8310 }
8311 else
8312 {
8314 }
8315
8316 if (m_EM)
8317 {
8318 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8319 }
8320
8321 }
8322
8323 else if (action_id ==
EActions.REMOVE_QUANTITY)
8324 {
8325 if (IsMagazine())
8326 {
8327 Magazine mag2 = Magazine.Cast(this);
8328 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8329 }
8330 else
8331 {
8333 }
8334 if (m_EM)
8335 {
8336 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8337 }
8338
8339 }
8340
8341 else if (action_id ==
EActions.SET_QUANTITY_0)
8342 {
8344
8345 if (m_EM)
8346 {
8347 m_EM.SetEnergy(0);
8348 }
8349 }
8350
8351 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8352 {
8354
8355 if (m_EM)
8356 {
8357 m_EM.SetEnergy(m_EM.GetEnergyMax());
8358 }
8359 }
8360
8361 else if (action_id ==
EActions.ADD_HEALTH)
8362 {
8363 AddHealth("","",GetMaxHealth("","Health")/5);
8364 }
8365 else if (action_id ==
EActions.REMOVE_HEALTH)
8366 {
8367 AddHealth("","",-GetMaxHealth("","Health")/5);
8368 }
8369 else if (action_id ==
EActions.DESTROY_HEALTH)
8370 {
8371 SetHealth01("","",0);
8372 }
8373 else if (action_id ==
EActions.WATCH_ITEM)
8374 {
8376 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8377 #ifdef DEVELOPER
8378 SetDebugDeveloper_item(this);
8379 #endif
8380 }
8381
8382 else if (action_id ==
EActions.ADD_TEMPERATURE)
8383 {
8384 AddTemperature(20);
8385
8386 }
8387
8388 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8389 {
8390 AddTemperature(-20);
8391
8392 }
8393
8394 else if (action_id ==
EActions.FLIP_FROZEN)
8395 {
8396 SetFrozen(!GetIsFrozen());
8397
8398 }
8399
8400 else if (action_id ==
EActions.ADD_WETNESS)
8401 {
8403
8404 }
8405
8406 else if (action_id ==
EActions.REMOVE_WETNESS)
8407 {
8409
8410 }
8411
8412 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8413 {
8416
8417
8418 }
8419
8420 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8421 {
8424 }
8425
8426 else if (action_id ==
EActions.MAKE_SPECIAL)
8427 {
8428 auto debugParams = DebugSpawnParams.WithPlayer(player);
8429 OnDebugSpawnEx(debugParams);
8430 }
8431
8432 }
8433
8434
8435 return false;
8436 }
8437
8438
8439
8440
8444
8447
8448
8449
8451 {
8452 return false;
8453 }
8454
8455
8457 {
8458 return true;
8459 }
8460
8461
8463 {
8464 return true;
8465 }
8466
8467
8468
8470 {
8471 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8472 return g_Game.ConfigIsExisting(config_path);
8473 }
8474
8477 {
8478 return null;
8479 }
8480
8482 {
8483 return false;
8484 }
8485
8487 {
8488 return false;
8489 }
8490
8494
8495
8497 {
8498 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8499 return module_repairing.CanRepair(this, item_repair_kit);
8500 }
8501
8502
8503 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8504 {
8505 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8506 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8507 }
8508
8509
8511 {
8512
8513
8514
8515
8516
8517
8518
8519
8520 return 1;
8521 }
8522
8523
8524
8526 {
8528 }
8529
8530
8531
8533 {
8535 }
8536
8537
8546 {
8547 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8548
8549 if (player)
8550 {
8551 player.MessageStatus(text);
8552 }
8553 }
8554
8555
8564 {
8565 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8566
8567 if (player)
8568 {
8569 player.MessageAction(text);
8570 }
8571 }
8572
8573
8582 {
8583 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8584
8585 if (player)
8586 {
8587 player.MessageFriendly(text);
8588 }
8589 }
8590
8591
8600 {
8601 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8602
8603 if (player)
8604 {
8605 player.MessageImportant(text);
8606 }
8607 }
8608
8610 {
8611 return true;
8612 }
8613
8614
8615 override bool KindOf(
string tag)
8616 {
8617 bool found = false;
8618 string item_name = this.
GetType();
8620 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8621
8622 int array_size = item_tag_array.Count();
8623 for (int i = 0; i < array_size; i++)
8624 {
8625 if (item_tag_array.Get(i) == tag)
8626 {
8627 found = true;
8628 break;
8629 }
8630 }
8631 return found;
8632 }
8633
8634
8636 {
8637
8638 super.OnRPC(sender, rpc_type,ctx);
8639
8640
8641 switch (rpc_type)
8642 {
8643 #ifndef SERVER
8644 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8645 Param2<bool, string> p = new Param2<bool, string>(false, "");
8646
8648 return;
8649
8650 bool play = p.param1;
8651 string soundSet = p.param2;
8652
8653 if (play)
8654 {
8656 {
8658 {
8660 }
8661 }
8662 else
8663 {
8665 }
8666 }
8667 else
8668 {
8670 }
8671
8672 break;
8673 #endif
8674
8675 }
8676
8678 {
8680 }
8681 }
8682
8683
8684
8685
8687 {
8688 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8689 return plugin.GetID(
name);
8690 }
8691
8693 {
8694 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8695 return plugin.GetName(id);
8696 }
8697
8700 {
8701
8702
8703 int varFlags;
8704 if (!ctx.
Read(varFlags))
8705 return;
8706
8707 if (varFlags & ItemVariableFlags.FLOAT)
8708 {
8710 }
8711 }
8712
8714 {
8715
8716 super.SerializeNumericalVars(floats_out);
8717
8718
8719
8721 {
8723 }
8724
8726 {
8728 }
8729
8731 {
8733 }
8734
8736 {
8741 }
8742
8744 {
8746 }
8747 }
8748
8750 {
8751
8752 super.DeSerializeNumericalVars(floats);
8753
8754
8755 int index = 0;
8756 int mask = Math.Round(floats.Get(index));
8757
8758 index++;
8759
8761 {
8763 {
8765 }
8766 else
8767 {
8768 float quantity = floats.Get(index);
8770 }
8771 index++;
8772 }
8773
8775 {
8776 float wet = floats.Get(index);
8778 index++;
8779 }
8780
8782 {
8783 int liquidtype = Math.Round(floats.Get(index));
8785 index++;
8786 }
8787
8789 {
8791 index++;
8793 index++;
8795 index++;
8797 index++;
8798 }
8799
8801 {
8802 int cleanness = Math.Round(floats.Get(index));
8804 index++;
8805 }
8806 }
8807
8809 {
8810 super.WriteVarsToCTX(ctx);
8811
8812
8814 {
8816 }
8817
8819 {
8821 }
8822
8824 {
8826 }
8827
8829 {
8830 int r,g,b,a;
8836 }
8837
8839 {
8841 }
8842 }
8843
8845 {
8846 if (!super.ReadVarsFromCTX(ctx,version))
8847 return false;
8848
8849 int intValue;
8850 float value;
8851
8852 if (version < 140)
8853 {
8854 if (!ctx.
Read(intValue))
8855 return false;
8856
8857 m_VariablesMask = intValue;
8858 }
8859
8861 {
8862 if (!ctx.
Read(value))
8863 return false;
8864
8866 {
8868 }
8869 else
8870 {
8872 }
8873 }
8874
8875 if (version < 140)
8876 {
8878 {
8879 if (!ctx.
Read(value))
8880 return false;
8881 SetTemperatureDirect(value);
8882 }
8883 }
8884
8886 {
8887 if (!ctx.
Read(value))
8888 return false;
8890 }
8891
8893 {
8894 if (!ctx.
Read(intValue))
8895 return false;
8897 }
8898
8900 {
8901 int r,g,b,a;
8903 return false;
8905 return false;
8907 return false;
8909 return false;
8910
8912 }
8913
8915 {
8916 if (!ctx.
Read(intValue))
8917 return false;
8919 }
8920
8921 if (version >= 138 && version < 140)
8922 {
8924 {
8925 if (!ctx.
Read(intValue))
8926 return false;
8927 SetFrozen(intValue);
8928 }
8929 }
8930
8931 return true;
8932 }
8933
8934
8936 {
8939 {
8941 }
8942
8943 if (!super.OnStoreLoad(ctx, version))
8944 {
8946 return false;
8947 }
8948
8949 if (version >= 114)
8950 {
8951 bool hasQuickBarIndexSaved;
8952
8953 if (!ctx.
Read(hasQuickBarIndexSaved))
8954 {
8956 return false;
8957 }
8958
8959 if (hasQuickBarIndexSaved)
8960 {
8961 int itmQBIndex;
8962
8963
8964 if (!ctx.
Read(itmQBIndex))
8965 {
8967 return false;
8968 }
8969
8970 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8971 if (itmQBIndex != -1 && parentPlayer)
8972 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8973 }
8974 }
8975 else
8976 {
8977
8978 PlayerBase player;
8979 int itemQBIndex;
8980 if (version ==
int.
MAX)
8981 {
8982 if (!ctx.
Read(itemQBIndex))
8983 {
8985 return false;
8986 }
8987 }
8988 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8989 {
8990
8991 if (!ctx.
Read(itemQBIndex))
8992 {
8994 return false;
8995 }
8996 if (itemQBIndex != -1 && player)
8997 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8998 }
8999 }
9000
9001 if (version < 140)
9002 {
9003
9004 if (!LoadVariables(ctx, version))
9005 {
9007 return false;
9008 }
9009 }
9010
9011
9013 {
9015 return false;
9016 }
9017 if (version >= 132)
9018 {
9020 if (raib)
9021 {
9023 {
9025 return false;
9026 }
9027 }
9028 }
9029
9031 return true;
9032 }
9033
9034
9035
9037 {
9038 super.OnStoreSave(ctx);
9039
9040 PlayerBase player;
9041 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9042 {
9044
9045 int itemQBIndex = -1;
9046 itemQBIndex = player.FindQuickBarEntityIndex(this);
9047 ctx.
Write(itemQBIndex);
9048 }
9049 else
9050 {
9052 }
9053
9055
9057 if (raib)
9058 {
9060 }
9061 }
9062
9063
9065 {
9066 super.AfterStoreLoad();
9067
9069 {
9071 }
9072
9074 {
9077 }
9078 }
9079
9081 {
9082 super.EEOnAfterLoad();
9083
9085 {
9087 }
9088
9091 }
9092
9094 {
9095 return false;
9096 }
9097
9098
9099
9101 {
9103 {
9104 #ifdef PLATFORM_CONSOLE
9105
9107 {
9109 if (menu)
9110 {
9112 }
9113 }
9114 #endif
9115 }
9116
9118 {
9121 }
9122
9124 {
9125 SetWeightDirty();
9127 }
9129 {
9132 }
9133
9135 {
9138
9141 }
9143 {
9147 }
9148
9149 super.OnVariablesSynchronized();
9150 }
9151
9152
9153
9155 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9156 {
9157 if (!IsServerCheck(allow_client))
9158 return false;
9159
9161 return false;
9162
9165
9166 if (value <= (min + 0.001))
9167 value = min;
9168
9169 if (value == min)
9170 {
9171 if (destroy_config)
9172 {
9173 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9174 if (dstr)
9175 {
9177 this.Delete();
9178 return true;
9179 }
9180 }
9181 else if (destroy_forced)
9182 {
9184 this.Delete();
9185 return true;
9186 }
9187
9189 }
9190
9193
9195 {
9196 EntityAI parent = GetHierarchyRoot();
9197 InventoryLocation iLoc = new InventoryLocation();
9198 GetInventory().GetCurrentInventoryLocation(iLoc);
9200 {
9201 int iLocSlot = iLoc.
GetSlot();
9203 {
9205 }
9207 {
9209 }
9210 }
9211 }
9212
9214 {
9216
9217 if (delta)
9219 }
9220
9222
9223 return false;
9224 }
9225
9226
9228 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9229 {
9231 }
9232
9234 {
9237 }
9238
9240 {
9243 }
9244
9246 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9247 {
9248 float value_clamped = Math.Clamp(value, 0, 1);
9250 SetQuantity(result, destroy_config, destroy_forced);
9251 }
9252
9253
9256 {
9258 }
9259
9261 {
9263 }
9264
9265
9266
9267
9268
9269
9270
9271
9272
9273
9275 {
9276 int slot = -1;
9277 GameInventory inventory = GetInventory();
9278 if (inventory)
9279 {
9280 InventoryLocation il = new InventoryLocation;
9283 }
9284
9286 }
9287
9289 {
9290 float quantity_max = 0;
9291
9293 {
9294 if (attSlotID != -1)
9295 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9296
9297 if (quantity_max <= 0)
9299 }
9300
9301 if (quantity_max <= 0)
9303
9304 return quantity_max;
9305 }
9306
9308 {
9310 }
9311
9313 {
9315 }
9316
9317
9319 {
9321 }
9322
9324 {
9326 }
9327
9329 {
9331 }
9332
9333
9335 {
9336
9337 float weightEx = GetWeightEx();
9338 float special = GetInventoryAndCargoWeight();
9339 return weightEx - special;
9340 }
9341
9342
9344 {
9346 }
9347
9349 {
9351 {
9352 #ifdef DEVELOPER
9353 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9354 {
9355 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9357 }
9358 #endif
9359
9361 }
9362 else if (HasEnergyManager())
9363 {
9364 #ifdef DEVELOPER
9365 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9366 {
9367 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9368 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9369 }
9370 #endif
9371 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9372 }
9373 else
9374 {
9375 #ifdef DEVELOPER
9376 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9377 {
9378 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9379 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9380 }
9381 #endif
9382 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9383 }
9384 }
9385
9388 {
9389 int item_count = 0;
9391
9392 GameInventory inventory = GetInventory();
9393 CargoBase cargo = inventory.
GetCargo();
9394 if (cargo != NULL)
9395 {
9397 }
9398
9400 for (int i = 0; i < nAttachments; ++i)
9401 {
9403 if (item)
9404 item_count += item.GetNumberOfItems();
9405 }
9406 return item_count;
9407 }
9408
9411 {
9412 float weight = 0;
9413 float wetness = 1;
9414 if (include_wetness)
9417 {
9418 weight = wetness * m_ConfigWeight;
9419 }
9421 {
9422 weight = 1;
9423 }
9424 return weight;
9425 }
9426
9427
9428
9430 {
9431 GameInventory inventory = GetInventory();
9432 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9433 {
9434 array<EntityAI> items = new array<EntityAI>;
9436 for (int i = 0; i < items.Count(); ++i)
9437 {
9439 if (item)
9440 {
9441 g_Game.ObjectDelete(item);
9442 }
9443 }
9444 }
9445 }
9446
9447
9448
9449
9451 {
9452 float energy = 0;
9453 if (HasEnergyManager())
9454 {
9455 energy = GetCompEM().GetEnergy();
9456 }
9457 return energy;
9458 }
9459
9460
9462 {
9463 super.OnEnergyConsumed();
9464
9466 }
9467
9469 {
9470 super.OnEnergyAdded();
9471
9473 }
9474
9475
9477 {
9478 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9479 {
9481 {
9482 float energy_0to1 = GetCompEM().GetEnergy0To1();
9484 }
9485 }
9486 }
9487
9488
9490 {
9491 return ConfigGetFloat("heatIsolation");
9492 }
9493
9495 {
9497 }
9498
9500 {
9501 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9502 if (
g_Game.ConfigIsExisting(paramPath))
9503 return g_Game.ConfigGetFloat(paramPath);
9504
9505 return 0.0;
9506 }
9507
9509 {
9510 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9511 if (
g_Game.ConfigIsExisting(paramPath))
9512 return g_Game.ConfigGetFloat(paramPath);
9513
9514 return 0.0;
9515 }
9516
9517 override void SetWet(
float value,
bool allow_client =
false)
9518 {
9519 if (!IsServerCheck(allow_client))
9520 return;
9521
9524
9526
9527 m_VarWet = Math.Clamp(value, min, max);
9528
9530 {
9533 }
9534 }
9535
9536 override void AddWet(
float value)
9537 {
9539 }
9540
9542 {
9544 }
9545
9547 {
9549 }
9550
9552 {
9554 }
9555
9557 {
9559 }
9560
9562 {
9564 }
9565
9567 {
9570 if (newLevel != oldLevel)
9571 {
9573 }
9574 }
9575
9577 {
9578 SetWeightDirty();
9579 }
9580
9582 {
9583 return GetWetLevelInternal(
m_VarWet);
9584 }
9585
9586
9587
9589 {
9591 }
9592
9594 {
9596 }
9597
9599 {
9601 }
9602
9604 {
9606 }
9607
9608
9609
9611 {
9612 if (ConfigIsExisting("itemModelLength"))
9613 {
9614 return ConfigGetFloat("itemModelLength");
9615 }
9616 return 0;
9617 }
9618
9620 {
9621 if (ConfigIsExisting("itemAttachOffset"))
9622 {
9623 return ConfigGetFloat("itemAttachOffset");
9624 }
9625 return 0;
9626 }
9627
9628 override void SetCleanness(
int value,
bool allow_client =
false)
9629 {
9630 if (!IsServerCheck(allow_client))
9631 return;
9632
9634
9636
9639 }
9640
9642 {
9644 }
9645
9647 {
9648 return true;
9649 }
9650
9651
9652
9653
9655 {
9657 }
9658
9660 {
9662 }
9663
9664
9665
9666
9667 override void SetColor(
int r,
int g,
int b,
int a)
9668 {
9674 }
9676 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9677 {
9682 }
9683
9685 {
9687 }
9688
9691 {
9692 int r,g,b,a;
9694 r = r/255;
9695 g = g/255;
9696 b = b/255;
9697 a = a/255;
9698 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9699 }
9700
9701
9702
9703 override void SetLiquidType(
int value,
bool allow_client =
false)
9704 {
9705 if (!IsServerCheck(allow_client))
9706 return;
9707
9712 }
9713
9715 {
9716 return ConfigGetInt("varLiquidTypeInit");
9717 }
9718
9720 {
9722 }
9723
9725 {
9727 SetFrozen(false);
9728 }
9729
9732 {
9733 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9734 }
9735
9736
9739 {
9740 PlayerBase nplayer;
9741 if (PlayerBase.CastTo(nplayer, player))
9742 {
9744 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9745 }
9746 }
9747
9748
9751 {
9752 PlayerBase nplayer;
9753 if (PlayerBase.CastTo(nplayer,player))
9754 {
9755 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9756 }
9757
9758 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9759
9760 if (HasEnergyManager())
9761 {
9762 GetCompEM().UpdatePlugState();
9763 }
9764 }
9765
9766
9768 {
9769 super.OnPlacementStarted(player);
9770
9772 }
9773
9774 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9775 {
9777 {
9778 m_AdminLog.OnPlacementComplete(player,
this);
9779 }
9780
9781 super.OnPlacementComplete(player, position, orientation);
9782 }
9783
9784
9785
9786
9787
9789 {
9791 {
9792 return true;
9793 }
9794 else
9795 {
9796 return false;
9797 }
9798 }
9799
9800
9802 {
9804 {
9806 }
9807 }
9808
9809
9811 {
9813 }
9814
9816 {
9818 }
9819
9820 override void InsertAgent(
int agent,
float count = 1)
9821 {
9822 if (count < 1)
9823 return;
9824
9826 }
9827
9830 {
9832 }
9833
9834
9836 {
9838 }
9839
9840
9841
9842
9843
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
9882 {
9884 return false;
9885 return true;
9886 }
9887
9889 {
9890
9892 }
9893
9894
9897 {
9898 super.CheckForRoofLimited(timeTresholdMS);
9899
9900 float time =
g_Game.GetTime();
9901 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9902 {
9903 m_PreviousRoofTestTime = time;
9904 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9905 }
9906 }
9907
9908
9910 {
9912 {
9913 return 0;
9914 }
9915
9916 if (GetInventory().GetAttachmentSlotsCount() != 0)
9917 {
9918 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9919 if (filter)
9920 return filter.GetProtectionLevel(type, false, system);
9921 else
9922 return 0;
9923 }
9924
9925 string subclassPath, entryName;
9926
9927 switch (type)
9928 {
9930 entryName = "biological";
9931 break;
9933 entryName = "chemical";
9934 break;
9935 default:
9936 entryName = "biological";
9937 break;
9938 }
9939
9940 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9941
9942 return g_Game.ConfigGetFloat(subclassPath + entryName);
9943 }
9944
9945
9946
9949 {
9950 if (!IsMagazine())
9952
9954 }
9955
9956
9957
9958
9959
9964 {
9965 return true;
9966 }
9967
9969 {
9971 }
9972
9973
9974
9975
9976
9978 {
9979 if (parent)
9980 {
9981 if (parent.IsInherited(DayZInfected))
9982 return true;
9983
9984 if (!parent.IsRuined())
9985 return true;
9986 }
9987
9988 return true;
9989 }
9990
9992 {
9993 if (!super.CanPutAsAttachment(parent))
9994 {
9995 return false;
9996 }
9997
9998 if (!IsRuined() && !parent.IsRuined())
9999 {
10000 return true;
10001 }
10002
10003 return false;
10004 }
10005
10007 {
10008
10009
10010
10011
10012 return super.CanReceiveItemIntoCargo(item);
10013 }
10014
10016 {
10017
10018
10019
10020
10021 GameInventory attachmentInv = attachment.GetInventory();
10023 {
10024 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10025 return false;
10026 }
10027
10028 InventoryLocation loc = new InventoryLocation();
10029 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10030 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10031 return false;
10032
10033 return super.CanReceiveAttachment(attachment, slotId);
10034 }
10035
10037 {
10038 if (!super.CanReleaseAttachment(attachment))
10039 return false;
10040
10041 return GetInventory().AreChildrenAccessible();
10042 }
10043
10044
10045
10046
10047
10048
10049
10050
10051
10052
10053
10054
10055
10056
10057
10058
10059
10060
10061
10062
10063
10065 {
10066 int id = muzzle_owner.GetMuzzleID();
10067 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10068
10069 if (WPOF_array)
10070 {
10071 for (int i = 0; i < WPOF_array.Count(); i++)
10072 {
10073 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10074
10075 if (WPOF)
10076 {
10077 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10078 }
10079 }
10080 }
10081 }
10082
10083
10085 {
10086 int id = muzzle_owner.GetMuzzleID();
10088
10089 if (WPOBE_array)
10090 {
10091 for (int i = 0; i < WPOBE_array.Count(); i++)
10092 {
10093 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10094
10095 if (WPOBE)
10096 {
10097 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10098 }
10099 }
10100 }
10101 }
10102
10103
10105 {
10106 int id = muzzle_owner.GetMuzzleID();
10107 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10108
10109 if (WPOOH_array)
10110 {
10111 for (int i = 0; i < WPOOH_array.Count(); i++)
10112 {
10113 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10114
10115 if (WPOOH)
10116 {
10117 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10118 }
10119 }
10120 }
10121 }
10122
10123
10125 {
10126 int id = muzzle_owner.GetMuzzleID();
10127 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10128
10129 if (WPOOH_array)
10130 {
10131 for (int i = 0; i < WPOOH_array.Count(); i++)
10132 {
10133 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10134
10135 if (WPOOH)
10136 {
10137 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10138 }
10139 }
10140 }
10141 }
10142
10143
10145 {
10146 int id = muzzle_owner.GetMuzzleID();
10147 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10148
10149 if (WPOOH_array)
10150 {
10151 for (int i = 0; i < WPOOH_array.Count(); i++)
10152 {
10153 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10154
10155 if (WPOOH)
10156 {
10157 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10158 }
10159 }
10160 }
10161 }
10162
10163
10164
10166 {
10168 {
10169 return true;
10170 }
10171
10172 return false;
10173 }
10174
10176 {
10178 {
10179 return true;
10180 }
10181
10182 return false;
10183 }
10184
10186 {
10188 {
10189 return true;
10190 }
10191
10192 return false;
10193 }
10194
10196 {
10197 return false;
10198 }
10199
10202 {
10203 return UATimeSpent.DEFAULT_DEPLOY;
10204 }
10205
10206
10207
10208
10210 {
10212 SetSynchDirty();
10213 }
10214
10216 {
10218 }
10219
10220
10222 {
10223 return false;
10224 }
10225
10228 {
10229 string att_type = "None";
10230
10231 if (ConfigIsExisting("soundAttType"))
10232 {
10233 att_type = ConfigGetString("soundAttType");
10234 }
10235
10237 }
10238
10240 {
10242 }
10243
10244
10245
10246
10247
10253
10255 {
10258
10260 }
10261
10262
10264 {
10266 return;
10267
10269
10272
10275
10276 SoundParameters params = new SoundParameters();
10280 }
10281
10282
10284 {
10286 {
10289
10290 SetSynchDirty();
10291
10294 }
10295 }
10296
10298 {
10300 }
10301
10302
10304 {
10306 return;
10307
10309 SetSynchDirty();
10310
10313 }
10314
10316 {
10319 }
10320
10322 {
10324 }
10325
10326 void OnApply(PlayerBase player);
10327
10329 {
10330 return 1.0;
10331 };
10332
10334 {
10336 }
10337
10339 {
10341 }
10342
10344
10346 {
10347 SetDynamicPhysicsLifeTime(0.01);
10349 }
10350
10352 {
10353 array<string> zone_names = new array<string>;
10354 GetDamageZones(zone_names);
10355 for (int i = 0; i < zone_names.Count(); i++)
10356 {
10357 SetHealthMax(zone_names.Get(i),"Health");
10358 }
10359 SetHealthMax("","Health");
10360 }
10361
10364 {
10365 float global_health = GetHealth01("","Health");
10366 array<string> zones = new array<string>;
10367 GetDamageZones(zones);
10368
10369 for (int i = 0; i < zones.Count(); i++)
10370 {
10371 SetHealth01(zones.Get(i),"Health",global_health);
10372 }
10373 }
10374
10377 {
10378 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10379 }
10380
10382 {
10383 if (!hasRootAsPlayer)
10384 {
10385 if (refParentIB)
10386 {
10387
10388 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10389 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10390
10391 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10392 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10393
10396 }
10397 else
10398 {
10399
10402 }
10403 }
10404 }
10405
10407 {
10409 {
10410 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10411 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10412 {
10413 float heatPermCoef = 1.0;
10415 while (ent)
10416 {
10417 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10418 ent = ent.GetHierarchyParent();
10419 }
10420
10421 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10422 }
10423 }
10424 }
10425
10427 {
10428
10429 EntityAI parent = GetHierarchyParent();
10430 if (!parent)
10431 {
10432 hasParent = false;
10433 hasRootAsPlayer = false;
10434 }
10435 else
10436 {
10437 hasParent = true;
10438 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10439 refParentIB =
ItemBase.Cast(parent);
10440 }
10441 }
10442
10443 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10444 {
10445
10446 }
10447
10449 {
10450
10451 return false;
10452 }
10453
10455 {
10456
10457
10458 return false;
10459 }
10460
10462 {
10463
10464 return false;
10465 }
10466
10469 {
10470 return !GetIsFrozen() &&
IsOpen();
10471 }
10472
10474 {
10475 bool hasParent = false, hasRootAsPlayer = false;
10477
10478 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10479 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10480
10481 if (wwtu || foodDecay)
10482 {
10486
10487 if (processWetness || processTemperature || processDecay)
10488 {
10490
10491 if (processWetness)
10492 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10493
10494 if (processTemperature)
10496
10497 if (processDecay)
10498 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10499 }
10500 }
10501 }
10502
10505 {
10507 }
10508
10510 {
10513
10514 return super.GetTemperatureFreezeThreshold();
10515 }
10516
10518 {
10521
10522 return super.GetTemperatureThawThreshold();
10523 }
10524
10526 {
10529
10530 return super.GetItemOverheatThreshold();
10531 }
10532
10534 {
10536 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10537
10538 return super.GetTemperatureFreezeTime();
10539 }
10540
10542 {
10544 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10545
10546 return super.GetTemperatureThawTime();
10547 }
10548
10553
10555 {
10556 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10557 }
10558
10560 {
10561 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10562 }
10563
10566 {
10568 }
10569
10571 {
10573 }
10574
10576 {
10578 }
10579
10582 {
10583 return null;
10584 }
10585
10588 {
10589 return false;
10590 }
10591
10593 {
10595 {
10598 if (!trg)
10599 {
10601 explosive = this;
10602 }
10603
10604 explosive.PairRemote(trg);
10606
10607 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10608 trg.SetPersistentPairID(persistentID);
10609 explosive.SetPersistentPairID(persistentID);
10610
10611 return true;
10612 }
10613 return false;
10614 }
10615
10618 {
10619 float ret = 1.0;
10622 ret *= GetHealth01();
10623
10624 return ret;
10625 }
10626
10627 #ifdef DEVELOPER
10628 override void SetDebugItem()
10629 {
10630 super.SetDebugItem();
10631 _itemBase = this;
10632 }
10633
10635 {
10636 string text = super.GetDebugText();
10637
10639 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10640
10641 return text;
10642 }
10643 #endif
10644
10646 {
10647 return true;
10648 }
10649
10651
10653
10655 {
10658 }
10659
10660
10668
10684
10685 [
Obsolete(
"Use ItemSoundHandler instead")]
10688 {
10689 if (!
g_Game.IsDedicatedServer())
10690 {
10691 if (ConfigIsExisting("attachSoundSet"))
10692 {
10693 string cfg_path = "";
10694 string soundset = "";
10695 string type_name =
GetType();
10696
10699 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10700 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10701
10702 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10703 {
10704 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10705 {
10706 if (cfg_slot_array[i] == slot_type)
10707 {
10708 soundset = cfg_soundset_array[i];
10709 break;
10710 }
10711 }
10712 }
10713
10714 if (soundset != "")
10715 {
10716 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10718 }
10719 }
10720 }
10721 }
10722
10724}
10725
10727{
10729 if (entity)
10730 {
10731 bool is_item = entity.IsInherited(
ItemBase);
10732 if (is_item && full_quantity)
10733 {
10736 }
10737 }
10738 else
10739 {
10741 return NULL;
10742 }
10743 return entity;
10744}
10745
10747{
10748 if (item)
10749 {
10750 if (health > 0)
10751 item.SetHealth("", "", health);
10752
10753 if (item.CanHaveTemperature())
10754 {
10756 if (item.CanFreeze())
10757 item.SetFrozen(false);
10758 }
10759
10760 if (item.HasEnergyManager())
10761 {
10762 if (quantity >= 0)
10763 {
10764 item.GetCompEM().SetEnergy0To1(quantity);
10765 }
10766 else
10767 {
10769 }
10770 }
10771 else if (item.IsMagazine())
10772 {
10773 Magazine mag = Magazine.Cast(item);
10774 if (quantity >= 0)
10775 {
10776 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10777 }
10778 else
10779 {
10781 }
10782
10783 }
10784 else
10785 {
10786 if (quantity >= 0)
10787 {
10788 item.SetQuantityNormalized(quantity, false);
10789 }
10790 else
10791 {
10793 }
10794
10795 }
10796 }
10797}
10798
10799#ifdef DEVELOPER
10801#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.