5858{
5860 {
5861 return true;
5862 }
5863};
5864
5866{
5867
5868};
5869
5870
5871
5873{
5877
5879
5882
5883
5884
5885
5886
5895
5901
5906
5911
5932 protected bool m_IsResultOfSplit
5933
5935
5940
5941
5942
5944
5948
5949
5950
5952
5955
5956
5957
5963
5964
5972
5975
5976
5978
5979
5981
5982
5987
5988
5993
5995
5996
5998
5999
6001 {
6006
6007 if (!
g_Game.IsDedicatedServer())
6008 {
6010 {
6012
6014 {
6016 }
6017 }
6018
6021 }
6022
6023 m_OldLocation = null;
6024
6026 {
6028 }
6029
6030 if (ConfigIsExisting("headSelectionsToHide"))
6031 {
6034 }
6035
6037 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6038 {
6040 }
6041
6043
6044 m_IsResultOfSplit = false;
6045
6047 }
6048
6050 {
6051 super.InitItemVariables();
6052
6058 m_Count = ConfigGetInt(
"count");
6059
6062
6067
6070
6075
6087
6091
6092
6095 if (ConfigIsExisting("canBeSplit"))
6096 {
6099 }
6100
6102 if (ConfigIsExisting("itemBehaviour"))
6104
6105
6108 RegisterNetSyncVariableInt("m_VarLiquidType");
6109 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6110
6111 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6112 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6113 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6114
6115 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6116 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6117 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6118 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6119
6120 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6121 RegisterNetSyncVariableBool("m_IsTakeable");
6122 RegisterNetSyncVariableBool("m_IsHologram");
6123
6126 {
6129 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6130 }
6131
6133
6135 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6137
6139 }
6140
6142 {
6144 }
6145
6147 {
6150 {
6155 }
6156 }
6157
6158 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6159 {
6161 {
6164 }
6165
6167 }
6168
6170 {
6176 }
6177
6179
6181 {
6183
6184 if (!action)
6185 {
6186 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6187 return;
6188 }
6189
6191 if (!ai)
6192 {
6194 return;
6195 }
6196
6198 if (!action_array)
6199 {
6200 action_array = new array<ActionBase_Basic>;
6202 }
6203 if (LogManager.IsActionLogEnable())
6204 {
6205 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6206 }
6207
6208 if (action_array.Find(action) != -1)
6209 {
6210 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6211 }
6212 else
6213 {
6214 action_array.Insert(action);
6215 }
6216 }
6217
6219 {
6220 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6221 ActionBase action = player.GetActionManager().GetAction(actionName);
6224
6225 if (action_array)
6226 {
6227 action_array.RemoveItem(action);
6228 }
6229 }
6230
6231
6232
6234 {
6235 ActionOverrideData overrideData = new ActionOverrideData();
6239
6241 if (!actionMap)
6242 {
6245 }
6246
6247 actionMap.Insert(this.
Type(), overrideData);
6248
6249 }
6250
6252
6254
6255
6257 {
6260
6263
6264 string config_to_search = "CfgVehicles";
6265 string muzzle_owner_config;
6266
6268 {
6269 if (IsInherited(Weapon))
6270 config_to_search = "CfgWeapons";
6271
6272 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6273
6274 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6275
6276 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6277
6278 if (config_OnFire_subclass_count > 0)
6279 {
6280 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6281
6282 for (int i = 0; i < config_OnFire_subclass_count; i++)
6283 {
6284 string particle_class = "";
6285 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6286 string config_OnFire_entry = config_OnFire_class + particle_class;
6287 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6288 WPOF_array.Insert(WPOF);
6289 }
6290
6291
6293 }
6294 }
6295
6297 {
6298 config_to_search = "CfgWeapons";
6299 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6300
6301 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6302
6303 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6304
6305 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6306 {
6307 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6308
6309 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6310 {
6311 string particle_class2 = "";
6312 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6313 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6314 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6315 WPOBE_array.Insert(WPOBE);
6316 }
6317
6318
6320 }
6321 }
6322 }
6323
6324
6326 {
6329
6331 {
6332 string config_to_search = "CfgVehicles";
6333
6334 if (IsInherited(Weapon))
6335 config_to_search = "CfgWeapons";
6336
6337 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6338 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6339
6340 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6341 {
6342
6344
6346 {
6348 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6350 return;
6351 }
6352
6355
6356
6357
6358 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6359 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6360
6361 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6362 {
6363 string particle_class = "";
6364 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6365 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6366 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6367
6368 if (entry_type == CT_CLASS)
6369 {
6370 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6371 WPOOH_array.Insert(WPOF);
6372 }
6373 }
6374
6375
6377 }
6378 }
6379 }
6380
6382 {
6384 }
6385
6387 {
6389 {
6391
6394
6397
6398 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6399 }
6400 }
6401
6403 {
6405 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6406
6408 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6409
6411 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6412
6414 {
6416 }
6417 }
6418
6420 {
6422 }
6423
6425 {
6428 else
6430
6432 {
6435 }
6436 else
6437 {
6440
6443 }
6444
6446 }
6447
6449 {
6451 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6452 }
6453
6455 {
6457 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6459 }
6460
6462 {
6464 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6465 }
6466
6468 {
6471
6472 OverheatingParticle OP = new OverheatingParticle();
6477
6479 }
6480
6482 {
6485
6486 return -1;
6487 }
6488
6490 {
6492 {
6495
6496 for (int i = count; i > 0; --i)
6497 {
6498 int id = i - 1;
6501
6504
6505 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6506 {
6507 if (p)
6508 {
6511 }
6512 }
6513 }
6514 }
6515 }
6516
6518 {
6520 {
6522 {
6523 int id = i - 1;
6525
6526 if (OP)
6527 {
6529
6530 if (p)
6531 {
6533 }
6534
6535 delete OP;
6536 }
6537 }
6538
6541 }
6542 }
6543
6546 {
6547 return 0.0;
6548 }
6549
6550
6552 {
6553 return 250;
6554 }
6555
6557 {
6558 return 0;
6559 }
6560
6563 {
6565 return true;
6566
6567 return false;
6568 }
6569
6572 {
6575
6577 {
6579 }
6580 else
6581 {
6582
6584 }
6585
6587 }
6588
6595 {
6596 return -1;
6597 }
6598
6599
6600
6601
6603 {
6605 {
6606 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6607 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6608
6609 if (r_index >= 0)
6610 {
6611 InventoryLocation r_il = new InventoryLocation;
6612 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6613
6614 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6617 {
6618 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6619 }
6621 {
6622 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6623 }
6624
6625 }
6626
6627 player.GetHumanInventory().ClearUserReservedLocation(this);
6628 }
6629
6632 }
6633
6634
6635
6636
6638 {
6639 return ItemBase.m_DebugActionsMask;
6640 }
6641
6643 {
6644 return ItemBase.m_DebugActionsMask & mask;
6645 }
6646
6648 {
6649 ItemBase.m_DebugActionsMask = mask;
6650 }
6651
6653 {
6654 ItemBase.m_DebugActionsMask |= mask;
6655 }
6656
6658 {
6659 ItemBase.m_DebugActionsMask &= ~mask;
6660 }
6661
6663 {
6665 {
6667 }
6668 else
6669 {
6671 }
6672 }
6673
6674
6676 {
6677 if (GetEconomyProfile())
6678 {
6679 float q_max = GetEconomyProfile().GetQuantityMax();
6680 if (q_max > 0)
6681 {
6682 float q_min = GetEconomyProfile().GetQuantityMin();
6683 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6684
6686 {
6687 ComponentEnergyManager comp = GetCompEM();
6689 {
6691 }
6692 }
6694 {
6696
6697 }
6698
6699 }
6700 }
6701 }
6702
6705 {
6706 EntityAI parent = GetHierarchyParent();
6707
6708 if (parent)
6709 {
6710 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6711 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6712 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6713 }
6714 }
6715
6718 {
6719 EntityAI parent = GetHierarchyParent();
6720
6721 if (parent)
6722 {
6723 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6724 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6725 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6726 }
6727 }
6728
6730 {
6731
6732
6733
6734
6736
6738 {
6739 if (ScriptInputUserData.CanStoreInputUserData())
6740 {
6741 ScriptInputUserData ctx = new ScriptInputUserData;
6747 ctx.
Write(use_stack_max);
6750
6752 {
6753 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6754 }
6755 }
6756 }
6757 else if (!
g_Game.IsMultiplayer())
6758 {
6760 }
6761 }
6762
6764 {
6766 }
6767
6769 {
6771 }
6772
6774 {
6776 }
6777
6779 {
6780
6781 return false;
6782 }
6783
6785 {
6786 return false;
6787 }
6788
6792 {
6793 return false;
6794 }
6795
6797 {
6798 return "";
6799 }
6800
6802
6804 {
6805 return false;
6806 }
6807
6809 {
6810 return true;
6811 }
6812
6813
6814
6816 {
6817 return true;
6818 }
6819
6821 {
6822 return true;
6823 }
6824
6826 {
6827 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6829 }
6830
6832 {
6834 }
6835
6837 {
6839 if (!is_being_placed)
6841 SetSynchDirty();
6842 }
6843
6844
6846
6848 {
6850 }
6851
6853 {
6855 }
6856
6858 {
6859 return 1;
6860 }
6861
6863 {
6864 return false;
6865 }
6866
6868 {
6870 SetSynchDirty();
6871 }
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6908 {
6909 super.OnMovedInsideCargo(container);
6910
6911 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6912 }
6913
6914 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6915 {
6916 super.EEItemLocationChanged(oldLoc, newLoc);
6917
6918 PlayerBase newPlayer = null;
6919 PlayerBase oldPlayer = null;
6920
6921 if (newLoc.GetParent())
6922 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6923
6924 if (oldLoc.GetParent())
6925 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6926
6928 {
6929 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6930
6931 if (rIndex >= 0)
6932 {
6933 InventoryLocation rIl = new InventoryLocation;
6934 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6935
6936 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6939 {
6940 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6941 }
6943 {
6945 }
6946
6947 }
6948 }
6949
6951 {
6952 if (newPlayer)
6953 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6954
6955 if (newPlayer == oldPlayer)
6956 {
6957 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6958 {
6960 {
6961 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6962 {
6963 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6964 }
6965 }
6966 else
6967 {
6968 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6969 }
6970 }
6971
6972 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6973 {
6974 int type = oldLoc.GetType();
6976 {
6977 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6978 }
6980 {
6981 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6982 }
6983 }
6984 if (!m_OldLocation)
6985 {
6986 m_OldLocation = new InventoryLocation;
6987 }
6988 m_OldLocation.Copy(oldLoc);
6989 }
6990 else
6991 {
6992 if (m_OldLocation)
6993 {
6994 m_OldLocation.Reset();
6995 }
6996 }
6997
6998 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6999 }
7000 else
7001 {
7002 if (newPlayer)
7003 {
7004 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7005 if (resIndex >= 0)
7006 {
7007 InventoryLocation il = new InventoryLocation;
7008 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7010 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7013 {
7014 il.
GetParent().GetOnReleaseLock().Invoke(it);
7015 }
7017 {
7019 }
7020
7021 }
7022 }
7024 {
7025
7027 }
7028
7029 if (m_OldLocation)
7030 {
7031 m_OldLocation.Reset();
7032 }
7033 }
7034
7036 {
7037 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7038 }
7039
7041 {
7042 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7043 }
7044 }
7045
7046 override void EOnContact(IEntity other, Contact extra)
7047 {
7049 {
7050 int liquidType = -1;
7052 if (impactSpeed > 0.0)
7053 {
7055 #ifndef SERVER
7057 #else
7059 SetSynchDirty();
7060 #endif
7062 }
7063 }
7064
7065 #ifdef SERVER
7066 if (GetCompEM() && GetCompEM().IsPlugged())
7067 {
7068 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7069 GetCompEM().UnplugThis();
7070 }
7071 #endif
7072 }
7073
7075
7077 {
7079 }
7080
7082 {
7083
7084 }
7085
7087 {
7088 super.OnItemLocationChanged(old_owner, new_owner);
7089
7090 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7091 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7092
7093 if (!relatedPlayer && playerNew)
7094 relatedPlayer = playerNew;
7095
7096 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7097 {
7099 if (actionMgr)
7100 {
7101 ActionBase currentAction = actionMgr.GetRunningAction();
7102 if (currentAction)
7104 }
7105 }
7106
7107 Man ownerPlayerOld = null;
7108 Man ownerPlayerNew = null;
7109
7110 if (old_owner)
7111 {
7112 if (old_owner.
IsMan())
7113 {
7114 ownerPlayerOld = Man.Cast(old_owner);
7115 }
7116 else
7117 {
7118 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7119 }
7120 }
7121 else
7122 {
7124 {
7126
7127 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7128 {
7129 GetCompEM().UnplugThis();
7130 }
7131 }
7132 }
7133
7134 if (new_owner)
7135 {
7136 if (new_owner.
IsMan())
7137 {
7138 ownerPlayerNew = Man.Cast(new_owner);
7139 }
7140 else
7141 {
7142 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7143 }
7144 }
7145
7146 if (ownerPlayerOld != ownerPlayerNew)
7147 {
7148 if (ownerPlayerOld)
7149 {
7150 array<EntityAI> subItemsExit = new array<EntityAI>;
7152 for (int i = 0; i < subItemsExit.Count(); i++)
7153 {
7156 }
7157 }
7158
7159 if (ownerPlayerNew)
7160 {
7161 array<EntityAI> subItemsEnter = new array<EntityAI>;
7163 for (int j = 0; j < subItemsEnter.Count(); j++)
7164 {
7167 }
7168 }
7169 }
7170 else if (ownerPlayerNew != null)
7171 {
7172 PlayerBase nplayer;
7173 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7174 {
7175 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7177 for (int k = 0; k < subItemsUpdate.Count(); k++)
7178 {
7180 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7181 }
7182 }
7183 }
7184
7185 if (old_owner)
7186 old_owner.OnChildItemRemoved(this);
7187 if (new_owner)
7188 new_owner.OnChildItemReceived(this);
7189 }
7190
7191
7193 {
7194 super.EEDelete(parent);
7195 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7196 if (player)
7197 {
7199
7200 if (player.IsAlive())
7201 {
7202 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7203 if (r_index >= 0)
7204 {
7205 InventoryLocation r_il = new InventoryLocation;
7206 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7207
7208 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7211 {
7212 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7213 }
7215 {
7216 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7217 }
7218
7219 }
7220
7221 player.RemoveQuickBarEntityShortcut(this);
7222 }
7223 }
7224 }
7225
7227 {
7228 super.EEKilled(killer);
7229
7232 {
7233 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7234 {
7235 if (IsMagazine())
7236 {
7237 if (Magazine.Cast(this).GetAmmoCount() > 0)
7238 {
7240 }
7241 }
7242 else
7243 {
7245 }
7246 }
7247 }
7248 }
7249
7251 {
7252 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7253
7254 super.OnWasAttached(parent, slot_id);
7255
7258
7261 }
7262
7264 {
7265 super.OnWasDetached(parent, slot_id);
7266
7269
7272 }
7273
7275 {
7276 int idx;
7279
7280 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7281 if (inventory_slots.Count() < 1)
7282 {
7283 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7284 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7285 }
7286 else
7287 {
7288 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7289 }
7290
7291 idx = inventory_slots.Find(slot);
7292 if (idx < 0)
7293 return "";
7294
7295 return attach_types.Get(idx);
7296 }
7297
7299 {
7300 int idx = -1;
7301 string slot;
7302
7305
7306 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7307 if (inventory_slots.Count() < 1)
7308 {
7309 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7310 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7311 }
7312 else
7313 {
7314 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7315 if (detach_types.Count() < 1)
7316 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7317 }
7318
7319 for (int i = 0; i < inventory_slots.Count(); i++)
7320 {
7321 slot = inventory_slots.Get(i);
7322 }
7323
7324 if (slot != "")
7325 {
7326 if (detach_types.Count() == 1)
7327 idx = 0;
7328 else
7329 idx = inventory_slots.Find(slot);
7330 }
7331 if (idx < 0)
7332 return "";
7333
7334 return detach_types.Get(idx);
7335 }
7336
7338 {
7339
7341
7342
7343 float min_time = 1;
7344 float max_time = 3;
7345 float delay = Math.RandomFloat(min_time, max_time);
7346
7347 explode_timer.Run(delay, this, "DoAmmoExplosion");
7348 }
7349
7351 {
7352 Magazine magazine = Magazine.Cast(this);
7353 int pop_sounds_count = 6;
7354 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7355
7356
7357 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7358 string sound_name = pop_sounds[ sound_idx ];
7359 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7360
7361
7362 magazine.ServerAddAmmoCount(-1);
7363
7364
7365 float min_temp_to_explode = 100;
7366
7367 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7368 {
7370 }
7371 }
7372
7373
7374 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7375 {
7376 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7377
7378 const int CHANCE_DAMAGE_CARGO = 4;
7379 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7380 const int CHANCE_DAMAGE_NOTHING = 2;
7381
7383 {
7384 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7385 int chances;
7386 int rnd;
7387
7388 if (GetInventory().GetCargo())
7389 {
7390 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7391 rnd = Math.RandomInt(0,chances);
7392
7393 if (rnd < CHANCE_DAMAGE_CARGO)
7394 {
7396 }
7397 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7398 {
7400 }
7401 }
7402 else
7403 {
7404 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7405 rnd = Math.RandomInt(0,chances);
7406
7407 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7408 {
7410 }
7411 }
7412 }
7413 }
7414
7416 {
7417 CargoBase cargo = GetInventory().GetCargo();
7418 if (cargo)
7419 {
7421 if (item_count > 0)
7422 {
7423 int random_pick = Math.RandomInt(0, item_count);
7425 if (!item.IsExplosive())
7426 {
7427 item.AddHealth("","",damage);
7428 return true;
7429 }
7430 }
7431 }
7432 return false;
7433 }
7434
7436 {
7437 GameInventory inventory = GetInventory();
7439 if (attachment_count > 0)
7440 {
7441 int random_pick = Math.RandomInt(0, attachment_count);
7443 if (!attachment.IsExplosive())
7444 {
7445 attachment.AddHealth("","",damage);
7446 return true;
7447 }
7448 }
7449 return false;
7450 }
7451
7453 {
7455 }
7456
7458 {
7460 return GetInventory().CanRemoveEntity();
7461
7462 return false;
7463 }
7464
7466 {
7467
7469 return false;
7470
7471
7473 return false;
7474
7475
7476
7478 if (delta == 0)
7479 return false;
7480
7481
7482 return true;
7483 }
7484
7486 {
7488 {
7489 if (ScriptInputUserData.CanStoreInputUserData())
7490 {
7491 ScriptInputUserData ctx = new ScriptInputUserData;
7496 ctx.
Write(destination_entity);
7500 }
7501 }
7502 else if (!
g_Game.IsMultiplayer())
7503 {
7505 }
7506 }
7507
7509 {
7510 float split_quantity_new;
7514 InventoryLocation loc = new InventoryLocation;
7515
7516 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7517 {
7519 split_quantity_new = stack_max;
7520 else
7522
7524 {
7525 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7526 if (new_item)
7527 {
7528 new_item.SetResultOfSplit(true);
7529 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7531 new_item.
SetQuantity(split_quantity_new,
false,
true);
7532 }
7533 }
7534 }
7535 else if (destination_entity && slot_id == -1)
7536 {
7537 if (quantity > stack_max)
7538 split_quantity_new = stack_max;
7539 else
7540 split_quantity_new = quantity;
7541
7543 {
7544 GameInventory destinationInventory = destination_entity.GetInventory();
7546 {
7549 }
7550
7551 if (new_item)
7552 {
7553 new_item.SetResultOfSplit(true);
7554 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7556 new_item.
SetQuantity(split_quantity_new,
false,
true);
7557 }
7558 }
7559 }
7560 else
7561 {
7562 if (stack_max != 0)
7563 {
7565 {
7567 }
7568
7569 if (split_quantity_new == 0)
7570 {
7571 if (!
g_Game.IsMultiplayer())
7572 player.PhysicalPredictiveDropItem(this);
7573 else
7574 player.ServerDropEntity(this);
7575 return;
7576 }
7577
7579 {
7581
7582 if (new_item)
7583 {
7584 new_item.SetResultOfSplit(true);
7585 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7588 new_item.PlaceOnSurface();
7589 }
7590 }
7591 }
7592 }
7593 }
7594
7596 {
7597 float split_quantity_new;
7601 InventoryLocation loc = new InventoryLocation;
7602
7603 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7604 {
7606 split_quantity_new = stack_max;
7607 else
7609
7611 {
7612 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7613 if (new_item)
7614 {
7615 new_item.SetResultOfSplit(true);
7616 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7618 new_item.
SetQuantity(split_quantity_new,
false,
true);
7619 }
7620 }
7621 }
7622 else if (destination_entity && slot_id == -1)
7623 {
7624 if (quantity > stack_max)
7625 split_quantity_new = stack_max;
7626 else
7627 split_quantity_new = quantity;
7628
7630 {
7631 GameInventory destinationInventory = destination_entity.GetInventory();
7633 {
7636 }
7637
7638 if (new_item)
7639 {
7640 new_item.SetResultOfSplit(true);
7641 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7643 new_item.
SetQuantity(split_quantity_new,
false,
true);
7644 }
7645 }
7646 }
7647 else
7648 {
7649 if (stack_max != 0)
7650 {
7652 {
7654 }
7655
7657 {
7659
7660 if (new_item)
7661 {
7662 new_item.SetResultOfSplit(true);
7663 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7666 new_item.PlaceOnSurface();
7667 }
7668 }
7669 }
7670 }
7671 }
7672
7674 {
7676 {
7677 if (ScriptInputUserData.CanStoreInputUserData())
7678 {
7679 ScriptInputUserData ctx = new ScriptInputUserData;
7684 dst.WriteToContext(ctx);
7686 }
7687 }
7688 else if (!
g_Game.IsMultiplayer())
7689 {
7691 }
7692 }
7693
7695 {
7697 {
7698 if (ScriptInputUserData.CanStoreInputUserData())
7699 {
7700 ScriptInputUserData ctx = new ScriptInputUserData;
7705 ctx.
Write(destination_entity);
7711 }
7712 }
7713 else if (!
g_Game.IsMultiplayer())
7714 {
7716 }
7717 }
7718
7720 {
7722 }
7723
7725 {
7727 float split_quantity_new;
7729 if (dst.IsValid())
7730 {
7731 int slot_id = dst.GetSlot();
7733
7734 if (quantity > stack_max)
7735 split_quantity_new = stack_max;
7736 else
7737 split_quantity_new = quantity;
7738
7740 {
7742
7743 if (new_item)
7744 {
7745 new_item.SetResultOfSplit(true);
7746 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7748 new_item.
SetQuantity(split_quantity_new,
false,
true);
7749 }
7750
7751 return new_item;
7752 }
7753 }
7754
7755 return null;
7756 }
7757
7759 {
7761 float split_quantity_new;
7763 if (destination_entity)
7764 {
7766 if (quantity > stackable)
7767 split_quantity_new = stackable;
7768 else
7769 split_quantity_new = quantity;
7770
7772 {
7773 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7774 if (new_item)
7775 {
7776 new_item.SetResultOfSplit(true);
7777 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7779 new_item.
SetQuantity(split_quantity_new,
false,
true);
7780 }
7781 }
7782 }
7783 }
7784
7786 {
7788 {
7789 if (ScriptInputUserData.CanStoreInputUserData())
7790 {
7791 ScriptInputUserData ctx = new ScriptInputUserData;
7796 ItemBase destination_entity =
this;
7797 ctx.
Write(destination_entity);
7801 }
7802 }
7803 else if (!
g_Game.IsMultiplayer())
7804 {
7806 }
7807 }
7808
7810 {
7812 float split_quantity_new;
7814 if (player)
7815 {
7817 if (quantity > stackable)
7818 split_quantity_new = stackable;
7819 else
7820 split_quantity_new = quantity;
7821
7823 {
7824 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7825 new_item =
ItemBase.Cast(in_hands);
7826 if (new_item)
7827 {
7828 new_item.SetResultOfSplit(true);
7829 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7831 new_item.SetQuantity(split_quantity_new, false, true);
7832 }
7833 }
7834 }
7835 }
7836
7838 {
7840 float split_quantity_new = Math.Floor(quantity * 0.5);
7841
7843 return;
7844
7846
7847 if (new_item)
7848 {
7849 if (new_item.GetQuantityMax() < split_quantity_new)
7850 {
7851 split_quantity_new = new_item.GetQuantityMax();
7852 }
7853
7854 new_item.SetResultOfSplit(true);
7855 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7856
7858 {
7861 }
7862 else
7863 {
7865 new_item.
SetQuantity(split_quantity_new,
false,
true);
7866 }
7867 }
7868 }
7869
7871 {
7873 float split_quantity_new = Math.Floor(quantity / 2);
7874
7876 return;
7877
7878 InventoryLocation invloc = new InventoryLocation;
7880
7882 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7883
7884 if (new_item)
7885 {
7886 if (new_item.GetQuantityMax() < split_quantity_new)
7887 {
7888 split_quantity_new = new_item.GetQuantityMax();
7889 }
7891 {
7894 }
7895 else if (split_quantity_new > 1)
7896 {
7898 new_item.
SetQuantity(split_quantity_new,
false,
true);
7899 }
7900 }
7901 }
7902
7905 {
7906 SetWeightDirty();
7908
7909 if (parent)
7910 parent.OnAttachmentQuantityChangedEx(this, delta);
7911
7913 {
7915 {
7917 }
7919 {
7920 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7922 }
7923 }
7924 }
7925
7928 {
7929
7930 }
7931
7934 {
7936 }
7937
7939 {
7940 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7941
7943 {
7944 if (newLevel == GameConstants.STATE_RUINED)
7945 {
7947 EntityAI parent = GetHierarchyParent();
7948 if (parent && parent.IsFireplace())
7949 {
7950 CargoBase cargo = GetInventory().GetCargo();
7951 if (cargo)
7952 {
7954 {
7956 }
7957 }
7958 }
7959 }
7960
7962 {
7963
7965 return;
7966 }
7967
7968 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7969 {
7971 }
7972 }
7973 }
7974
7975
7977 {
7978 super.OnRightClick();
7979
7981 {
7983 {
7984 if (ScriptInputUserData.CanStoreInputUserData())
7985 {
7986 EntityAI root = GetHierarchyRoot();
7987 Man playerOwner = GetHierarchyRootPlayer();
7988 InventoryLocation dst = new InventoryLocation;
7989
7990
7991 if (!playerOwner && root && root == this)
7992 {
7994 }
7995 else
7996 {
7997
7998 GetInventory().GetCurrentInventoryLocation(dst);
8000 {
8001 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8003 {
8005 }
8006 else
8007 {
8009
8010
8011 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8012 {
8014 }
8015 else
8016 {
8017 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8018 }
8019 }
8020 }
8021 }
8022
8023 ScriptInputUserData ctx = new ScriptInputUserData;
8031 }
8032 }
8033 else if (!
g_Game.IsMultiplayer())
8034 {
8036 }
8037 }
8038 }
8039
8041 {
8042 if (root)
8043 {
8044 vector m4[4];
8045 root.GetTransform(m4);
8046 dst.SetGround(this, m4);
8047 }
8048 else
8049 {
8050 GetInventory().GetCurrentInventoryLocation(dst);
8051 }
8052 }
8053
8054 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8055 {
8056
8057 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8058 return false;
8059
8060 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8061 return false;
8062
8063
8065 return false;
8066
8067
8068 Magazine mag = Magazine.Cast(this);
8069 if (mag)
8070 {
8071 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8072 return false;
8073
8074 if (stack_max_limit)
8075 {
8076 Magazine other_mag = Magazine.Cast(other_item);
8077 if (other_item)
8078 {
8079 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8080 return false;
8081 }
8082
8083 }
8084 }
8085 else
8086 {
8087
8089 return false;
8090
8092 return false;
8093 }
8094
8095 PlayerBase player = null;
8096 if (CastTo(player, GetHierarchyRootPlayer()))
8097 {
8098 if (player.GetInventory().HasAttachment(this))
8099 return false;
8100
8101 if (player.IsItemsToDelete())
8102 return false;
8103 }
8104
8105 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8106 return false;
8107
8108 int slotID;
8110 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8111 return false;
8112
8113 return true;
8114 }
8115
8117 {
8119 }
8120
8122 {
8123 return m_IsResultOfSplit;
8124 }
8125
8127 {
8128 m_IsResultOfSplit = value;
8129 }
8130
8132 {
8134 }
8135
8137 {
8138 float other_item_quantity = other_item.GetQuantity();
8139 float this_free_space;
8140
8142
8144
8145 if (other_item_quantity > this_free_space)
8146 {
8147 return this_free_space;
8148 }
8149 else
8150 {
8151 return other_item_quantity;
8152 }
8153 }
8154
8156 {
8158 }
8159
8161 {
8163 return;
8164
8165 if (!IsMagazine() && other_item)
8166 {
8168 if (quantity_used != 0)
8169 {
8170 float hp1 = GetHealth01("","");
8171 float hp2 = other_item.GetHealth01("","");
8172 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8173 hpResult = hpResult / (
GetQuantity() + quantity_used);
8174
8175 hpResult *= GetMaxHealth();
8176 Math.Round(hpResult);
8177 SetHealth("", "Health", hpResult);
8178
8180 other_item.AddQuantity(-quantity_used);
8181 }
8182 }
8184 }
8185
8187 {
8188 #ifdef SERVER
8189 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8190 GetHierarchyParent().IncreaseLifetimeUp();
8191 #endif
8192 };
8193
8195 {
8196 PlayerBase p = PlayerBase.Cast(player);
8197
8198 array<int> recipesIds = p.m_Recipes;
8199 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8200 if (moduleRecipesManager)
8201 {
8202 EntityAI itemInHands = player.GetEntityInHands();
8203 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8204 }
8205
8206 for (int i = 0;i < recipesIds.Count(); i++)
8207 {
8208 int key = recipesIds.Get(i);
8209 string recipeName = moduleRecipesManager.GetRecipeName(key);
8211 }
8212 }
8213
8214
8215 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8216 {
8217 super.GetDebugActions(outputList);
8218
8219
8225
8226
8231
8236
8237
8241
8242
8244 {
8248 }
8249
8252
8253
8257
8259
8260 InventoryLocation loc = new InventoryLocation();
8261 GetInventory().GetCurrentInventoryLocation(loc);
8263 {
8264 if (Gizmo_IsSupported())
8267 }
8268
8270 }
8271
8272
8273
8274
8276 {
8277 super.OnAction(action_id, player, ctx);
8278
8280 {
8281 switch (action_id)
8282 {
8286 return true;
8290 return true;
8291 }
8292 }
8293
8295 {
8296 switch (action_id)
8297 {
8299 Delete();
8300 return true;
8301 }
8302 }
8303
8304 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8305 {
8306 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8307 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8308 PlayerBase p = PlayerBase.Cast(player);
8309 if (
EActions.RECIPES_RANGE_START < 1000)
8310 {
8311 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8312 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8313 }
8314 }
8315 #ifndef SERVER
8316 else if (action_id ==
EActions.WATCH_PLAYER)
8317 {
8318 PluginDeveloper.SetDeveloperItemClientEx(player);
8319 }
8320 #endif
8322 {
8323 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8324 {
8325 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8326 OnDebugButtonPressServer(id + 1);
8327 }
8328
8329 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8330 {
8331 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8333 }
8334
8335 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8336 {
8337 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8339 }
8340
8341 else if (action_id ==
EActions.ADD_QUANTITY)
8342 {
8343 if (IsMagazine())
8344 {
8345 Magazine mag = Magazine.Cast(this);
8346 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8347 }
8348 else
8349 {
8351 }
8352
8353 if (m_EM)
8354 {
8355 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8356 }
8357
8358 }
8359
8360 else if (action_id ==
EActions.REMOVE_QUANTITY)
8361 {
8362 if (IsMagazine())
8363 {
8364 Magazine mag2 = Magazine.Cast(this);
8365 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8366 }
8367 else
8368 {
8370 }
8371 if (m_EM)
8372 {
8373 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8374 }
8375
8376 }
8377
8378 else if (action_id ==
EActions.SET_QUANTITY_0)
8379 {
8381
8382 if (m_EM)
8383 {
8384 m_EM.SetEnergy(0);
8385 }
8386 }
8387
8388 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8389 {
8391
8392 if (m_EM)
8393 {
8394 m_EM.SetEnergy(m_EM.GetEnergyMax());
8395 }
8396 }
8397
8398 else if (action_id ==
EActions.ADD_HEALTH)
8399 {
8400 AddHealth("","",GetMaxHealth("","Health")/5);
8401 }
8402 else if (action_id ==
EActions.REMOVE_HEALTH)
8403 {
8404 AddHealth("","",-GetMaxHealth("","Health")/5);
8405 }
8406 else if (action_id ==
EActions.DESTROY_HEALTH)
8407 {
8408 SetHealth01("","",0);
8409 }
8410 else if (action_id ==
EActions.WATCH_ITEM)
8411 {
8413 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8414 #ifdef DEVELOPER
8415 SetDebugDeveloper_item(this);
8416 #endif
8417 }
8418
8419 else if (action_id ==
EActions.ADD_TEMPERATURE)
8420 {
8421 AddTemperature(20);
8422
8423 }
8424
8425 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8426 {
8427 AddTemperature(-20);
8428
8429 }
8430
8431 else if (action_id ==
EActions.FLIP_FROZEN)
8432 {
8433 SetFrozen(!GetIsFrozen());
8434
8435 }
8436
8437 else if (action_id ==
EActions.ADD_WETNESS)
8438 {
8440
8441 }
8442
8443 else if (action_id ==
EActions.REMOVE_WETNESS)
8444 {
8446
8447 }
8448
8449 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8450 {
8453
8454
8455 }
8456
8457 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8458 {
8461 }
8462
8463 else if (action_id ==
EActions.MAKE_SPECIAL)
8464 {
8465 auto debugParams = DebugSpawnParams.WithPlayer(player);
8466 OnDebugSpawnEx(debugParams);
8467 }
8468
8469 }
8470
8471
8472 return false;
8473 }
8474
8475
8476
8477
8481
8484
8485
8486
8488 {
8489 return false;
8490 }
8491
8492
8494 {
8495 return true;
8496 }
8497
8498
8500 {
8501 return true;
8502 }
8503
8504
8505
8507 {
8508 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8509 return g_Game.ConfigIsExisting(config_path);
8510 }
8511
8514 {
8515 return null;
8516 }
8517
8519 {
8520 return false;
8521 }
8522
8524 {
8525 return false;
8526 }
8527
8531
8532
8534 {
8535 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8536 return module_repairing.CanRepair(this, item_repair_kit);
8537 }
8538
8539
8540 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8541 {
8542 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8543 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8544 }
8545
8546
8548 {
8549
8550
8551
8552
8553
8554
8555
8556
8557 return 1;
8558 }
8559
8560
8561
8563 {
8565 }
8566
8567
8568
8570 {
8572 }
8573
8574
8583 {
8584 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8585
8586 if (player)
8587 {
8588 player.MessageStatus(text);
8589 }
8590 }
8591
8592
8601 {
8602 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8603
8604 if (player)
8605 {
8606 player.MessageAction(text);
8607 }
8608 }
8609
8610
8619 {
8620 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8621
8622 if (player)
8623 {
8624 player.MessageFriendly(text);
8625 }
8626 }
8627
8628
8637 {
8638 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8639
8640 if (player)
8641 {
8642 player.MessageImportant(text);
8643 }
8644 }
8645
8647 {
8648 return true;
8649 }
8650
8651
8652 override bool KindOf(
string tag)
8653 {
8654 bool found = false;
8655 string item_name = this.
GetType();
8657 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8658
8659 int array_size = item_tag_array.Count();
8660 for (int i = 0; i < array_size; i++)
8661 {
8662 if (item_tag_array.Get(i) == tag)
8663 {
8664 found = true;
8665 break;
8666 }
8667 }
8668 return found;
8669 }
8670
8671
8673 {
8674
8675 super.OnRPC(sender, rpc_type,ctx);
8676
8677
8678 switch (rpc_type)
8679 {
8680 #ifndef SERVER
8681 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8682 Param2<bool, string> p = new Param2<bool, string>(false, "");
8683
8685 return;
8686
8687 bool play = p.param1;
8688 string soundSet = p.param2;
8689
8690 if (play)
8691 {
8693 {
8695 {
8697 }
8698 }
8699 else
8700 {
8702 }
8703 }
8704 else
8705 {
8707 }
8708
8709 break;
8710 #endif
8711
8712 }
8713
8715 {
8717 }
8718 }
8719
8720
8721
8722
8724 {
8725 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8726 return plugin.GetID(
name);
8727 }
8728
8730 {
8731 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8732 return plugin.GetName(id);
8733 }
8734
8737 {
8738
8739
8740 int varFlags;
8741 if (!ctx.
Read(varFlags))
8742 return;
8743
8744 if (varFlags & ItemVariableFlags.FLOAT)
8745 {
8747 }
8748 }
8749
8751 {
8752
8753 super.SerializeNumericalVars(floats_out);
8754
8755
8756
8758 {
8760 }
8761
8763 {
8765 }
8766
8768 {
8770 }
8771
8773 {
8778 }
8779
8781 {
8783 }
8784 }
8785
8787 {
8788
8789 super.DeSerializeNumericalVars(floats);
8790
8791
8792 int index = 0;
8793 int mask = Math.Round(floats.Get(index));
8794
8795 index++;
8796
8798 {
8800 {
8802 }
8803 else
8804 {
8805 float quantity = floats.Get(index);
8807 }
8808 index++;
8809 }
8810
8812 {
8813 float wet = floats.Get(index);
8815 index++;
8816 }
8817
8819 {
8820 int liquidtype = Math.Round(floats.Get(index));
8822 index++;
8823 }
8824
8826 {
8828 index++;
8830 index++;
8832 index++;
8834 index++;
8835 }
8836
8838 {
8839 int cleanness = Math.Round(floats.Get(index));
8841 index++;
8842 }
8843 }
8844
8846 {
8847 super.WriteVarsToCTX(ctx);
8848
8849
8851 {
8853 }
8854
8856 {
8858 }
8859
8861 {
8863 }
8864
8866 {
8867 int r,g,b,a;
8873 }
8874
8876 {
8878 }
8879 }
8880
8882 {
8883 if (!super.ReadVarsFromCTX(ctx,version))
8884 return false;
8885
8886 int intValue;
8887 float value;
8888
8889 if (version < 140)
8890 {
8891 if (!ctx.
Read(intValue))
8892 return false;
8893
8894 m_VariablesMask = intValue;
8895 }
8896
8898 {
8899 if (!ctx.
Read(value))
8900 return false;
8901
8903 {
8905 }
8906 else
8907 {
8909 }
8910 }
8911
8912 if (version < 140)
8913 {
8915 {
8916 if (!ctx.
Read(value))
8917 return false;
8918 SetTemperatureDirect(value);
8919 }
8920 }
8921
8923 {
8924 if (!ctx.
Read(value))
8925 return false;
8927 }
8928
8930 {
8931 if (!ctx.
Read(intValue))
8932 return false;
8934 }
8935
8937 {
8938 int r,g,b,a;
8940 return false;
8942 return false;
8944 return false;
8946 return false;
8947
8949 }
8950
8952 {
8953 if (!ctx.
Read(intValue))
8954 return false;
8956 }
8957
8958 if (version >= 138 && version < 140)
8959 {
8961 {
8962 if (!ctx.
Read(intValue))
8963 return false;
8964 SetFrozen(intValue);
8965 }
8966 }
8967
8968 return true;
8969 }
8970
8971
8973 {
8976 {
8978 }
8979
8980 if (!super.OnStoreLoad(ctx, version))
8981 {
8983 return false;
8984 }
8985
8986 if (version >= 114)
8987 {
8988 bool hasQuickBarIndexSaved;
8989
8990 if (!ctx.
Read(hasQuickBarIndexSaved))
8991 {
8993 return false;
8994 }
8995
8996 if (hasQuickBarIndexSaved)
8997 {
8998 int itmQBIndex;
8999
9000
9001 if (!ctx.
Read(itmQBIndex))
9002 {
9004 return false;
9005 }
9006
9007 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9008 if (itmQBIndex != -1 && parentPlayer)
9009 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9010 }
9011 }
9012 else
9013 {
9014
9015 PlayerBase player;
9016 int itemQBIndex;
9017 if (version ==
int.
MAX)
9018 {
9019 if (!ctx.
Read(itemQBIndex))
9020 {
9022 return false;
9023 }
9024 }
9025 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9026 {
9027
9028 if (!ctx.
Read(itemQBIndex))
9029 {
9031 return false;
9032 }
9033 if (itemQBIndex != -1 && player)
9034 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9035 }
9036 }
9037
9038 if (version < 140)
9039 {
9040
9041 if (!LoadVariables(ctx, version))
9042 {
9044 return false;
9045 }
9046 }
9047
9048
9050 {
9052 return false;
9053 }
9054 if (version >= 132)
9055 {
9057 if (raib)
9058 {
9060 {
9062 return false;
9063 }
9064 }
9065 }
9066
9068 return true;
9069 }
9070
9071
9072
9074 {
9075 super.OnStoreSave(ctx);
9076
9077 PlayerBase player;
9078 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9079 {
9081
9082 int itemQBIndex = -1;
9083 itemQBIndex = player.FindQuickBarEntityIndex(this);
9084 ctx.
Write(itemQBIndex);
9085 }
9086 else
9087 {
9089 }
9090
9092
9094 if (raib)
9095 {
9097 }
9098 }
9099
9100
9102 {
9103 super.AfterStoreLoad();
9104
9106 {
9108 }
9109
9111 {
9114 }
9115 }
9116
9118 {
9119 super.EEOnAfterLoad();
9120
9122 {
9124 }
9125
9128 }
9129
9131 {
9132 return false;
9133 }
9134
9135
9136
9138 {
9140 {
9141 #ifdef PLATFORM_CONSOLE
9142
9144 {
9146 if (menu)
9147 {
9149 }
9150 }
9151 #endif
9152 }
9153
9155 {
9158 }
9159
9161 {
9162 SetWeightDirty();
9164 }
9166 {
9169 }
9170
9172 {
9175
9178 }
9180 {
9184 }
9185
9186 super.OnVariablesSynchronized();
9187 }
9188
9189
9190
9192 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9193 {
9194 if (!IsServerCheck(allow_client))
9195 return false;
9196
9198 return false;
9199
9202
9203 if (value <= (min + 0.001))
9204 value = min;
9205
9206 if (value == min)
9207 {
9208 if (destroy_config)
9209 {
9210 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9211 if (dstr)
9212 {
9214 this.Delete();
9215 return true;
9216 }
9217 }
9218 else if (destroy_forced)
9219 {
9221 this.Delete();
9222 return true;
9223 }
9224
9226 }
9227
9230
9232 {
9233 EntityAI parent = GetHierarchyRoot();
9234 InventoryLocation iLoc = new InventoryLocation();
9235 GetInventory().GetCurrentInventoryLocation(iLoc);
9237 {
9238 int iLocSlot = iLoc.
GetSlot();
9240 {
9242 }
9244 {
9246 }
9247 }
9248 }
9249
9251 {
9253
9254 if (delta)
9256 }
9257
9259
9260 return false;
9261 }
9262
9263
9265 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9266 {
9268 }
9269
9271 {
9274 }
9275
9277 {
9280 }
9281
9283 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9284 {
9285 float value_clamped = Math.Clamp(value, 0, 1);
9287 SetQuantity(result, destroy_config, destroy_forced);
9288 }
9289
9290
9293 {
9295 }
9296
9298 {
9300 }
9301
9302
9303
9304
9305
9306
9307
9308
9309
9310
9312 {
9313 int slot = -1;
9314 GameInventory inventory = GetInventory();
9315 if (inventory)
9316 {
9317 InventoryLocation il = new InventoryLocation;
9320 }
9321
9323 }
9324
9326 {
9327 float quantity_max = 0;
9328
9330 {
9331 if (attSlotID != -1)
9332 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9333
9334 if (quantity_max <= 0)
9336 }
9337
9338 if (quantity_max <= 0)
9340
9341 return quantity_max;
9342 }
9343
9345 {
9347 }
9348
9350 {
9352 }
9353
9354
9356 {
9358 }
9359
9361 {
9363 }
9364
9366 {
9368 }
9369
9370
9372 {
9373
9374 float weightEx = GetWeightEx();
9375 float special = GetInventoryAndCargoWeight();
9376 return weightEx - special;
9377 }
9378
9379
9381 {
9383 }
9384
9386 {
9388 {
9389 #ifdef DEVELOPER
9390 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9391 {
9392 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9394 }
9395 #endif
9396
9398 }
9399 else if (HasEnergyManager())
9400 {
9401 #ifdef DEVELOPER
9402 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9403 {
9404 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9405 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9406 }
9407 #endif
9408 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9409 }
9410 else
9411 {
9412 #ifdef DEVELOPER
9413 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9414 {
9415 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9416 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9417 }
9418 #endif
9419 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9420 }
9421 }
9422
9425 {
9426 int item_count = 0;
9428
9429 GameInventory inventory = GetInventory();
9430 CargoBase cargo = inventory.
GetCargo();
9431 if (cargo != NULL)
9432 {
9434 }
9435
9437 for (int i = 0; i < nAttachments; ++i)
9438 {
9440 if (item)
9441 item_count += item.GetNumberOfItems();
9442 }
9443 return item_count;
9444 }
9445
9448 {
9449 float weight = 0;
9450 float wetness = 1;
9451 if (include_wetness)
9454 {
9455 weight = wetness * m_ConfigWeight;
9456 }
9458 {
9459 weight = 1;
9460 }
9461 return weight;
9462 }
9463
9464
9465
9467 {
9468 GameInventory inventory = GetInventory();
9469 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9470 {
9471 array<EntityAI> items = new array<EntityAI>;
9473 for (int i = 0; i < items.Count(); ++i)
9474 {
9476 if (item)
9477 {
9478 g_Game.ObjectDelete(item);
9479 }
9480 }
9481 }
9482 }
9483
9484
9485
9486
9488 {
9489 float energy = 0;
9490 if (HasEnergyManager())
9491 {
9492 energy = GetCompEM().GetEnergy();
9493 }
9494 return energy;
9495 }
9496
9497
9499 {
9500 super.OnEnergyConsumed();
9501
9503 }
9504
9506 {
9507 super.OnEnergyAdded();
9508
9510 }
9511
9512
9514 {
9515 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9516 {
9518 {
9519 float energy_0to1 = GetCompEM().GetEnergy0To1();
9521 }
9522 }
9523 }
9524
9525
9527 {
9528 return ConfigGetFloat("heatIsolation");
9529 }
9530
9532 {
9534 }
9535
9537 {
9538 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9539 if (
g_Game.ConfigIsExisting(paramPath))
9540 return g_Game.ConfigGetFloat(paramPath);
9541
9542 return 0.0;
9543 }
9544
9546 {
9547 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9548 if (
g_Game.ConfigIsExisting(paramPath))
9549 return g_Game.ConfigGetFloat(paramPath);
9550
9551 return 0.0;
9552 }
9553
9554 override void SetWet(
float value,
bool allow_client =
false)
9555 {
9556 if (!IsServerCheck(allow_client))
9557 return;
9558
9561
9563
9564 m_VarWet = Math.Clamp(value, min, max);
9565
9567 {
9570 }
9571 }
9572
9573 override void AddWet(
float value)
9574 {
9576 }
9577
9579 {
9581 }
9582
9584 {
9586 }
9587
9589 {
9591 }
9592
9594 {
9596 }
9597
9599 {
9601 }
9602
9604 {
9607 if (newLevel != oldLevel)
9608 {
9610 }
9611 }
9612
9614 {
9615 SetWeightDirty();
9616 }
9617
9619 {
9620 return GetWetLevelInternal(
m_VarWet);
9621 }
9622
9623
9624
9626 {
9628 }
9629
9631 {
9633 }
9634
9636 {
9638 }
9639
9641 {
9643 }
9644
9645
9646
9648 {
9649 if (ConfigIsExisting("itemModelLength"))
9650 {
9651 return ConfigGetFloat("itemModelLength");
9652 }
9653 return 0;
9654 }
9655
9657 {
9658 if (ConfigIsExisting("itemAttachOffset"))
9659 {
9660 return ConfigGetFloat("itemAttachOffset");
9661 }
9662 return 0;
9663 }
9664
9665 override void SetCleanness(
int value,
bool allow_client =
false)
9666 {
9667 if (!IsServerCheck(allow_client))
9668 return;
9669
9671
9673
9676 }
9677
9679 {
9681 }
9682
9684 {
9685 return true;
9686 }
9687
9688
9689
9690
9692 {
9694 }
9695
9697 {
9699 }
9700
9701
9702
9703
9704 override void SetColor(
int r,
int g,
int b,
int a)
9705 {
9711 }
9713 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9714 {
9719 }
9720
9722 {
9724 }
9725
9728 {
9729 int r,g,b,a;
9731 r = r/255;
9732 g = g/255;
9733 b = b/255;
9734 a = a/255;
9735 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9736 }
9737
9738
9739
9740 override void SetLiquidType(
int value,
bool allow_client =
false)
9741 {
9742 if (!IsServerCheck(allow_client))
9743 return;
9744
9749 }
9750
9752 {
9753 return ConfigGetInt("varLiquidTypeInit");
9754 }
9755
9757 {
9759 }
9760
9762 {
9764 SetFrozen(false);
9765 }
9766
9769 {
9770 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9771 }
9772
9773
9776 {
9777 PlayerBase nplayer;
9778 if (PlayerBase.CastTo(nplayer, player))
9779 {
9781 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9782 }
9783 }
9784
9785
9788 {
9789 PlayerBase nplayer;
9790 if (PlayerBase.CastTo(nplayer,player))
9791 {
9792 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9793 }
9794
9795 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9796
9797 if (HasEnergyManager())
9798 {
9799 GetCompEM().UpdatePlugState();
9800 }
9801 }
9802
9803
9805 {
9806 super.OnPlacementStarted(player);
9807
9809 }
9810
9811 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9812 {
9814 {
9815 m_AdminLog.OnPlacementComplete(player,
this);
9816 }
9817
9818 super.OnPlacementComplete(player, position, orientation);
9819 }
9820
9821
9822
9823
9824
9826 {
9828 {
9829 return true;
9830 }
9831 else
9832 {
9833 return false;
9834 }
9835 }
9836
9837
9839 {
9841 {
9843 }
9844 }
9845
9846
9848 {
9850 }
9851
9853 {
9855 }
9856
9857 override void InsertAgent(
int agent,
float count = 1)
9858 {
9859 if (count < 1)
9860 return;
9861
9863 }
9864
9867 {
9869 }
9870
9871
9873 {
9875 }
9876
9877
9878
9879
9880
9881
9882
9883
9884
9885
9886
9887
9888
9889
9890
9891
9892
9893
9894
9895
9896
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9919 {
9921 return false;
9922 return true;
9923 }
9924
9926 {
9927
9929 }
9930
9931
9934 {
9935 super.CheckForRoofLimited(timeTresholdMS);
9936
9937 float time =
g_Game.GetTime();
9938 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9939 {
9940 m_PreviousRoofTestTime = time;
9941 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9942 }
9943 }
9944
9945
9947 {
9949 {
9950 return 0;
9951 }
9952
9953 if (GetInventory().GetAttachmentSlotsCount() != 0)
9954 {
9955 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9956 if (filter)
9957 return filter.GetProtectionLevel(type, false, system);
9958 else
9959 return 0;
9960 }
9961
9962 string subclassPath, entryName;
9963
9964 switch (type)
9965 {
9967 entryName = "biological";
9968 break;
9970 entryName = "chemical";
9971 break;
9972 default:
9973 entryName = "biological";
9974 break;
9975 }
9976
9977 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9978
9979 return g_Game.ConfigGetFloat(subclassPath + entryName);
9980 }
9981
9982
9983
9986 {
9987 if (!IsMagazine())
9989
9991 }
9992
9993
9994
9995
9996
10001 {
10002 return true;
10003 }
10004
10006 {
10008 }
10009
10010
10011
10012
10013
10015 {
10016 if (parent)
10017 {
10018 if (parent.IsInherited(DayZInfected))
10019 return true;
10020
10021 if (!parent.IsRuined())
10022 return true;
10023 }
10024
10025 return true;
10026 }
10027
10029 {
10030 if (!super.CanPutAsAttachment(parent))
10031 {
10032 return false;
10033 }
10034
10035 if (!IsRuined() && !parent.IsRuined())
10036 {
10037 return true;
10038 }
10039
10040 return false;
10041 }
10042
10044 {
10045
10046
10047
10048
10049 return super.CanReceiveItemIntoCargo(item);
10050 }
10051
10053 {
10054
10055
10056
10057
10058 GameInventory attachmentInv = attachment.GetInventory();
10060 {
10061 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10062 return false;
10063 }
10064
10065 InventoryLocation loc = new InventoryLocation();
10066 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10067 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10068 return false;
10069
10070 return super.CanReceiveAttachment(attachment, slotId);
10071 }
10072
10074 {
10075 if (!super.CanReleaseAttachment(attachment))
10076 return false;
10077
10078 return GetInventory().AreChildrenAccessible();
10079 }
10080
10081
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10092
10093
10094
10095
10096
10097
10098
10099
10100
10102 {
10103 int id = muzzle_owner.GetMuzzleID();
10104 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10105
10106 if (WPOF_array)
10107 {
10108 for (int i = 0; i < WPOF_array.Count(); i++)
10109 {
10110 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10111
10112 if (WPOF)
10113 {
10114 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10115 }
10116 }
10117 }
10118 }
10119
10120
10122 {
10123 int id = muzzle_owner.GetMuzzleID();
10125
10126 if (WPOBE_array)
10127 {
10128 for (int i = 0; i < WPOBE_array.Count(); i++)
10129 {
10130 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10131
10132 if (WPOBE)
10133 {
10134 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10135 }
10136 }
10137 }
10138 }
10139
10140
10142 {
10143 int id = muzzle_owner.GetMuzzleID();
10144 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10145
10146 if (WPOOH_array)
10147 {
10148 for (int i = 0; i < WPOOH_array.Count(); i++)
10149 {
10150 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10151
10152 if (WPOOH)
10153 {
10154 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10155 }
10156 }
10157 }
10158 }
10159
10160
10162 {
10163 int id = muzzle_owner.GetMuzzleID();
10164 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10165
10166 if (WPOOH_array)
10167 {
10168 for (int i = 0; i < WPOOH_array.Count(); i++)
10169 {
10170 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10171
10172 if (WPOOH)
10173 {
10174 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10175 }
10176 }
10177 }
10178 }
10179
10180
10182 {
10183 int id = muzzle_owner.GetMuzzleID();
10184 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10185
10186 if (WPOOH_array)
10187 {
10188 for (int i = 0; i < WPOOH_array.Count(); i++)
10189 {
10190 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10191
10192 if (WPOOH)
10193 {
10194 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10195 }
10196 }
10197 }
10198 }
10199
10200
10201
10203 {
10205 {
10206 return true;
10207 }
10208
10209 return false;
10210 }
10211
10213 {
10215 {
10216 return true;
10217 }
10218
10219 return false;
10220 }
10221
10223 {
10225 {
10226 return true;
10227 }
10228
10229 return false;
10230 }
10231
10233 {
10234 return false;
10235 }
10236
10239 {
10240 return UATimeSpent.DEFAULT_DEPLOY;
10241 }
10242
10243
10244
10245
10247 {
10249 SetSynchDirty();
10250 }
10251
10253 {
10255 }
10256
10257
10259 {
10260 return false;
10261 }
10262
10265 {
10266 string att_type = "None";
10267
10268 if (ConfigIsExisting("soundAttType"))
10269 {
10270 att_type = ConfigGetString("soundAttType");
10271 }
10272
10274 }
10275
10277 {
10279 }
10280
10281
10282
10283
10284
10290
10292 {
10295
10297 }
10298
10299
10301 {
10303 return;
10304
10306
10309
10312
10313 SoundParameters params = new SoundParameters();
10317 }
10318
10319
10321 {
10323 {
10326
10327 SetSynchDirty();
10328
10331 }
10332 }
10333
10335 {
10337 }
10338
10339
10341 {
10343 return;
10344
10346 SetSynchDirty();
10347
10350 }
10351
10353 {
10356 }
10357
10359 {
10361 }
10362
10363 void OnApply(PlayerBase player);
10364
10366 {
10367 return 1.0;
10368 };
10369
10371 {
10373 }
10374
10376 {
10378 }
10379
10381
10383 {
10384 SetDynamicPhysicsLifeTime(0.01);
10386 }
10387
10389 {
10390 array<string> zone_names = new array<string>;
10391 GetDamageZones(zone_names);
10392 for (int i = 0; i < zone_names.Count(); i++)
10393 {
10394 SetHealthMax(zone_names.Get(i),"Health");
10395 }
10396 SetHealthMax("","Health");
10397 }
10398
10401 {
10402 float global_health = GetHealth01("","Health");
10403 array<string> zones = new array<string>;
10404 GetDamageZones(zones);
10405
10406 for (int i = 0; i < zones.Count(); i++)
10407 {
10408 SetHealth01(zones.Get(i),"Health",global_health);
10409 }
10410 }
10411
10414 {
10415 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10416 }
10417
10419 {
10420 if (!hasRootAsPlayer)
10421 {
10422 if (refParentIB)
10423 {
10424
10425 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10426 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10427
10428 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10429 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10430
10433 }
10434 else
10435 {
10436
10439 }
10440 }
10441 }
10442
10444 {
10446 {
10447 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10448 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10449 {
10450 float heatPermCoef = 1.0;
10452 while (ent)
10453 {
10454 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10455 ent = ent.GetHierarchyParent();
10456 }
10457
10458 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10459 }
10460 }
10461 }
10462
10464 {
10465
10466 EntityAI parent = GetHierarchyParent();
10467 if (!parent)
10468 {
10469 hasParent = false;
10470 hasRootAsPlayer = false;
10471 }
10472 else
10473 {
10474 hasParent = true;
10475 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10476 refParentIB =
ItemBase.Cast(parent);
10477 }
10478 }
10479
10480 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10481 {
10482
10483 }
10484
10486 {
10487
10488 return false;
10489 }
10490
10492 {
10493
10494
10495 return false;
10496 }
10497
10499 {
10500
10501 return false;
10502 }
10503
10506 {
10507 return !GetIsFrozen() &&
IsOpen();
10508 }
10509
10511 {
10512 bool hasParent = false, hasRootAsPlayer = false;
10514
10515 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10516 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10517
10518 if (wwtu || foodDecay)
10519 {
10523
10524 if (processWetness || processTemperature || processDecay)
10525 {
10527
10528 if (processWetness)
10529 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10530
10531 if (processTemperature)
10533
10534 if (processDecay)
10535 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10536 }
10537 }
10538 }
10539
10542 {
10544 }
10545
10547 {
10550
10551 return super.GetTemperatureFreezeThreshold();
10552 }
10553
10555 {
10558
10559 return super.GetTemperatureThawThreshold();
10560 }
10561
10563 {
10566
10567 return super.GetItemOverheatThreshold();
10568 }
10569
10571 {
10573 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10574
10575 return super.GetTemperatureFreezeTime();
10576 }
10577
10579 {
10581 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10582
10583 return super.GetTemperatureThawTime();
10584 }
10585
10590
10592 {
10593 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10594 }
10595
10597 {
10598 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10599 }
10600
10603 {
10605 }
10606
10608 {
10610 }
10611
10613 {
10615 }
10616
10619 {
10620 return null;
10621 }
10622
10625 {
10626 return false;
10627 }
10628
10630 {
10632 {
10635 if (!trg)
10636 {
10638 explosive = this;
10639 }
10640
10641 explosive.PairRemote(trg);
10643
10644 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10645 trg.SetPersistentPairID(persistentID);
10646 explosive.SetPersistentPairID(persistentID);
10647
10648 return true;
10649 }
10650 return false;
10651 }
10652
10655 {
10656 float ret = 1.0;
10659 ret *= GetHealth01();
10660
10661 return ret;
10662 }
10663
10664 #ifdef DEVELOPER
10665 override void SetDebugItem()
10666 {
10667 super.SetDebugItem();
10668 _itemBase = this;
10669 }
10670
10672 {
10673 string text = super.GetDebugText();
10674
10676 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10677
10678 return text;
10679 }
10680 #endif
10681
10683 {
10684 return true;
10685 }
10686
10688
10690
10692 {
10695 }
10696
10697
10705
10721
10722 [
Obsolete(
"Use ItemSoundHandler instead")]
10725 {
10726 if (!
g_Game.IsDedicatedServer())
10727 {
10728 if (ConfigIsExisting("attachSoundSet"))
10729 {
10730 string cfg_path = "";
10731 string soundset = "";
10732 string type_name =
GetType();
10733
10736 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10737 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10738
10739 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10740 {
10741 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10742 {
10743 if (cfg_slot_array[i] == slot_type)
10744 {
10745 soundset = cfg_soundset_array[i];
10746 break;
10747 }
10748 }
10749 }
10750
10751 if (soundset != "")
10752 {
10753 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10755 }
10756 }
10757 }
10758 }
10759
10761}
10762
10764{
10766 if (entity)
10767 {
10768 bool is_item = entity.IsInherited(
ItemBase);
10769 if (is_item && full_quantity)
10770 {
10773 }
10774 }
10775 else
10776 {
10778 return NULL;
10779 }
10780 return entity;
10781}
10782
10784{
10785 if (item)
10786 {
10787 if (health > 0)
10788 item.SetHealth("", "", health);
10789
10790 if (item.CanHaveTemperature())
10791 {
10793 if (item.CanFreeze())
10794 item.SetFrozen(false);
10795 }
10796
10797 if (item.HasEnergyManager())
10798 {
10799 if (quantity >= 0)
10800 {
10801 item.GetCompEM().SetEnergy0To1(quantity);
10802 }
10803 else
10804 {
10806 }
10807 }
10808 else if (item.IsMagazine())
10809 {
10810 Magazine mag = Magazine.Cast(item);
10811 if (quantity >= 0)
10812 {
10813 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10814 }
10815 else
10816 {
10818 }
10819
10820 }
10821 else
10822 {
10823 if (quantity >= 0)
10824 {
10825 item.SetQuantityNormalized(quantity, false);
10826 }
10827 else
10828 {
10830 }
10831
10832 }
10833 }
10834}
10835
10836#ifdef DEVELOPER
10838#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.