5806{
5808 {
5809 return true;
5810 }
5811};
5812
5814{
5815
5816};
5817
5818
5819
5821{
5825
5827
5830
5831
5832
5833
5834
5843
5849
5854
5859
5880 protected bool m_IsResultOfSplit
5881
5883
5888
5889
5890
5892
5896
5897
5898
5900
5903
5904
5905
5911
5912
5920
5923
5924
5926
5927
5929
5930
5935
5936
5941
5943
5944
5946
5947
5949 {
5954
5955 if (!
g_Game.IsDedicatedServer())
5956 {
5958 {
5960
5962 {
5964 }
5965 }
5966
5969 }
5970
5971 m_OldLocation = null;
5972
5974 {
5976 }
5977
5978 if (ConfigIsExisting("headSelectionsToHide"))
5979 {
5982 }
5983
5985 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
5986 {
5988 }
5989
5991
5992 m_IsResultOfSplit = false;
5993
5995 }
5996
5998 {
5999 super.InitItemVariables();
6000
6006 m_Count = ConfigGetInt(
"count");
6007
6010
6015
6018
6023
6035
6039
6040
6043 if (ConfigIsExisting("canBeSplit"))
6044 {
6047 }
6048
6050 if (ConfigIsExisting("itemBehaviour"))
6052
6053
6056 RegisterNetSyncVariableInt("m_VarLiquidType");
6057 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6058
6059 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6060 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6061 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6062
6063 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6064 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6065 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6066 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6067
6068 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6069 RegisterNetSyncVariableBool("m_IsTakeable");
6070 RegisterNetSyncVariableBool("m_IsHologram");
6071
6074 {
6077 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6078 }
6079
6081
6083 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6085
6087 }
6088
6090 {
6092 }
6093
6095 {
6098 {
6103 }
6104 }
6105
6106 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6107 {
6109 {
6112 }
6113
6115 }
6116
6118 {
6124 }
6125
6127
6129 {
6131
6132 if (!action)
6133 {
6134 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6135 return;
6136 }
6137
6139 if (!ai)
6140 {
6142 return;
6143 }
6144
6146 if (!action_array)
6147 {
6148 action_array = new array<ActionBase_Basic>;
6150 }
6151 if (LogManager.IsActionLogEnable())
6152 {
6153 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6154 }
6155
6156 if (action_array.Find(action) != -1)
6157 {
6158 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6159 }
6160 else
6161 {
6162 action_array.Insert(action);
6163 }
6164 }
6165
6167 {
6168 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6169 ActionBase action = player.GetActionManager().GetAction(actionName);
6172
6173 if (action_array)
6174 {
6175 action_array.RemoveItem(action);
6176 }
6177 }
6178
6179
6180
6182 {
6183 ActionOverrideData overrideData = new ActionOverrideData();
6187
6189 if (!actionMap)
6190 {
6193 }
6194
6195 actionMap.Insert(this.
Type(), overrideData);
6196
6197 }
6198
6200
6202
6203
6205 {
6208
6211
6212 string config_to_search = "CfgVehicles";
6213 string muzzle_owner_config;
6214
6216 {
6217 if (IsInherited(Weapon))
6218 config_to_search = "CfgWeapons";
6219
6220 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6221
6222 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6223
6224 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6225
6226 if (config_OnFire_subclass_count > 0)
6227 {
6228 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6229
6230 for (int i = 0; i < config_OnFire_subclass_count; i++)
6231 {
6232 string particle_class = "";
6233 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6234 string config_OnFire_entry = config_OnFire_class + particle_class;
6235 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6236 WPOF_array.Insert(WPOF);
6237 }
6238
6239
6241 }
6242 }
6243
6245 {
6246 config_to_search = "CfgWeapons";
6247 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6248
6249 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6250
6251 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6252
6253 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6254 {
6255 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6256
6257 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6258 {
6259 string particle_class2 = "";
6260 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6261 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6262 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6263 WPOBE_array.Insert(WPOBE);
6264 }
6265
6266
6268 }
6269 }
6270 }
6271
6272
6274 {
6277
6279 {
6280 string config_to_search = "CfgVehicles";
6281
6282 if (IsInherited(Weapon))
6283 config_to_search = "CfgWeapons";
6284
6285 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6286 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6287
6288 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6289 {
6290
6292
6294 {
6296 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6298 return;
6299 }
6300
6303
6304
6305
6306 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6307 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6308
6309 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6310 {
6311 string particle_class = "";
6312 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6313 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6314 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6315
6316 if (entry_type == CT_CLASS)
6317 {
6318 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6319 WPOOH_array.Insert(WPOF);
6320 }
6321 }
6322
6323
6325 }
6326 }
6327 }
6328
6330 {
6332 }
6333
6335 {
6337 {
6339
6342
6345
6346 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6347 }
6348 }
6349
6351 {
6353 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6354
6356 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6357
6359 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6360
6362 {
6364 }
6365 }
6366
6368 {
6370 }
6371
6373 {
6376 else
6378
6380 {
6383 }
6384 else
6385 {
6388
6391 }
6392
6394 }
6395
6397 {
6399 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6400 }
6401
6403 {
6405 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6407 }
6408
6410 {
6412 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6413 }
6414
6416 {
6419
6420 OverheatingParticle OP = new OverheatingParticle();
6425
6427 }
6428
6430 {
6433
6434 return -1;
6435 }
6436
6438 {
6440 {
6443
6444 for (int i = count; i > 0; --i)
6445 {
6446 int id = i - 1;
6449
6452
6453 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6454 {
6455 if (p)
6456 {
6459 }
6460 }
6461 }
6462 }
6463 }
6464
6466 {
6468 {
6470 {
6471 int id = i - 1;
6473
6474 if (OP)
6475 {
6477
6478 if (p)
6479 {
6481 }
6482
6483 delete OP;
6484 }
6485 }
6486
6489 }
6490 }
6491
6494 {
6495 return 0.0;
6496 }
6497
6498
6500 {
6501 return 250;
6502 }
6503
6505 {
6506 return 0;
6507 }
6508
6511 {
6513 return true;
6514
6515 return false;
6516 }
6517
6520 {
6523
6525 {
6527 }
6528 else
6529 {
6530
6532 }
6533
6535 }
6536
6543 {
6544 return -1;
6545 }
6546
6547
6548
6549
6551 {
6553 {
6554 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6555 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6556
6557 if (r_index >= 0)
6558 {
6559 InventoryLocation r_il = new InventoryLocation;
6560 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6561
6562 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6565 {
6566 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6567 }
6569 {
6570 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6571 }
6572
6573 }
6574
6575 player.GetHumanInventory().ClearUserReservedLocation(this);
6576 }
6577
6580 }
6581
6582
6583
6584
6586 {
6587 return ItemBase.m_DebugActionsMask;
6588 }
6589
6591 {
6592 return ItemBase.m_DebugActionsMask & mask;
6593 }
6594
6596 {
6597 ItemBase.m_DebugActionsMask = mask;
6598 }
6599
6601 {
6602 ItemBase.m_DebugActionsMask |= mask;
6603 }
6604
6606 {
6607 ItemBase.m_DebugActionsMask &= ~mask;
6608 }
6609
6611 {
6613 {
6615 }
6616 else
6617 {
6619 }
6620 }
6621
6622
6624 {
6625 if (GetEconomyProfile())
6626 {
6627 float q_max = GetEconomyProfile().GetQuantityMax();
6628 if (q_max > 0)
6629 {
6630 float q_min = GetEconomyProfile().GetQuantityMin();
6631 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6632
6634 {
6635 ComponentEnergyManager comp = GetCompEM();
6637 {
6639 }
6640 }
6642 {
6644
6645 }
6646
6647 }
6648 }
6649 }
6650
6653 {
6654 EntityAI parent = GetHierarchyParent();
6655
6656 if (parent)
6657 {
6658 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6659 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6660 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6661 }
6662 }
6663
6666 {
6667 EntityAI parent = GetHierarchyParent();
6668
6669 if (parent)
6670 {
6671 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6672 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6673 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6674 }
6675 }
6676
6678 {
6679
6680
6681
6682
6684
6686 {
6687 if (ScriptInputUserData.CanStoreInputUserData())
6688 {
6689 ScriptInputUserData ctx = new ScriptInputUserData;
6695 ctx.
Write(use_stack_max);
6698
6700 {
6701 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6702 }
6703 }
6704 }
6705 else if (!
g_Game.IsMultiplayer())
6706 {
6708 }
6709 }
6710
6712 {
6714 }
6715
6717 {
6719 }
6720
6722 {
6724 }
6725
6727 {
6728
6729 return false;
6730 }
6731
6733 {
6734 return false;
6735 }
6736
6740 {
6741 return false;
6742 }
6743
6745 {
6746 return "";
6747 }
6748
6750
6752 {
6753 return false;
6754 }
6755
6757 {
6758 return true;
6759 }
6760
6761
6762
6764 {
6765 return true;
6766 }
6767
6769 {
6770 return true;
6771 }
6772
6774 {
6775 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6777 }
6778
6780 {
6782 }
6783
6785 {
6787 if (!is_being_placed)
6789 SetSynchDirty();
6790 }
6791
6792
6794
6796 {
6798 }
6799
6801 {
6803 }
6804
6806 {
6807 return 1;
6808 }
6809
6811 {
6812 return false;
6813 }
6814
6816 {
6818 SetSynchDirty();
6819 }
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6856 {
6857 super.OnMovedInsideCargo(container);
6858
6859 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6860 }
6861
6862 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6863 {
6864 super.EEItemLocationChanged(oldLoc, newLoc);
6865
6866 PlayerBase newPlayer = null;
6867 PlayerBase oldPlayer = null;
6868
6869 if (newLoc.GetParent())
6870 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6871
6872 if (oldLoc.GetParent())
6873 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6874
6876 {
6877 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6878
6879 if (rIndex >= 0)
6880 {
6881 InventoryLocation rIl = new InventoryLocation;
6882 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6883
6884 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6887 {
6888 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6889 }
6891 {
6893 }
6894
6895 }
6896 }
6897
6899 {
6900 if (newPlayer)
6901 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6902
6903 if (newPlayer == oldPlayer)
6904 {
6905 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6906 {
6908 {
6909 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6910 {
6911 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6912 }
6913 }
6914 else
6915 {
6916 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6917 }
6918 }
6919
6920 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6921 {
6922 int type = oldLoc.GetType();
6924 {
6925 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6926 }
6928 {
6929 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
6930 }
6931 }
6932 if (!m_OldLocation)
6933 {
6934 m_OldLocation = new InventoryLocation;
6935 }
6936 m_OldLocation.Copy(oldLoc);
6937 }
6938 else
6939 {
6940 if (m_OldLocation)
6941 {
6942 m_OldLocation.Reset();
6943 }
6944 }
6945
6946 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
6947 }
6948 else
6949 {
6950 if (newPlayer)
6951 {
6952 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
6953 if (resIndex >= 0)
6954 {
6955 InventoryLocation il = new InventoryLocation;
6956 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
6958 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
6961 {
6962 il.
GetParent().GetOnReleaseLock().Invoke(it);
6963 }
6965 {
6967 }
6968
6969 }
6970 }
6972 {
6973
6975 }
6976
6977 if (m_OldLocation)
6978 {
6979 m_OldLocation.Reset();
6980 }
6981 }
6982
6984 {
6985 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
6986 }
6987
6989 {
6990 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
6991 }
6992 }
6993
6994 override void EOnContact(IEntity other, Contact extra)
6995 {
6997 {
6998 int liquidType = -1;
7000 if (impactSpeed > 0.0)
7001 {
7003 #ifndef SERVER
7005 #else
7007 SetSynchDirty();
7008 #endif
7010 }
7011 }
7012
7013 #ifdef SERVER
7014 if (GetCompEM() && GetCompEM().IsPlugged())
7015 {
7016 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7017 GetCompEM().UnplugThis();
7018 }
7019 #endif
7020 }
7021
7023
7025 {
7027 }
7028
7030 {
7031
7032 }
7033
7035 {
7036 super.OnItemLocationChanged(old_owner, new_owner);
7037
7038 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7039 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7040
7041 if (!relatedPlayer && playerNew)
7042 relatedPlayer = playerNew;
7043
7044 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7045 {
7047 if (actionMgr)
7048 {
7049 ActionBase currentAction = actionMgr.GetRunningAction();
7050 if (currentAction)
7052 }
7053 }
7054
7055 Man ownerPlayerOld = null;
7056 Man ownerPlayerNew = null;
7057
7058 if (old_owner)
7059 {
7060 if (old_owner.
IsMan())
7061 {
7062 ownerPlayerOld = Man.Cast(old_owner);
7063 }
7064 else
7065 {
7066 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7067 }
7068 }
7069 else
7070 {
7072 {
7074
7075 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7076 {
7077 GetCompEM().UnplugThis();
7078 }
7079 }
7080 }
7081
7082 if (new_owner)
7083 {
7084 if (new_owner.
IsMan())
7085 {
7086 ownerPlayerNew = Man.Cast(new_owner);
7087 }
7088 else
7089 {
7090 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7091 }
7092 }
7093
7094 if (ownerPlayerOld != ownerPlayerNew)
7095 {
7096 if (ownerPlayerOld)
7097 {
7098 array<EntityAI> subItemsExit = new array<EntityAI>;
7100 for (int i = 0; i < subItemsExit.Count(); i++)
7101 {
7104 }
7105 }
7106
7107 if (ownerPlayerNew)
7108 {
7109 array<EntityAI> subItemsEnter = new array<EntityAI>;
7111 for (int j = 0; j < subItemsEnter.Count(); j++)
7112 {
7115 }
7116 }
7117 }
7118 else if (ownerPlayerNew != null)
7119 {
7120 PlayerBase nplayer;
7121 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7122 {
7123 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7125 for (int k = 0; k < subItemsUpdate.Count(); k++)
7126 {
7128 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7129 }
7130 }
7131 }
7132
7133 if (old_owner)
7134 old_owner.OnChildItemRemoved(this);
7135 if (new_owner)
7136 new_owner.OnChildItemReceived(this);
7137 }
7138
7139
7141 {
7142 super.EEDelete(parent);
7143 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7144 if (player)
7145 {
7147
7148 if (player.IsAlive())
7149 {
7150 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7151 if (r_index >= 0)
7152 {
7153 InventoryLocation r_il = new InventoryLocation;
7154 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7155
7156 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7159 {
7160 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7161 }
7163 {
7164 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7165 }
7166
7167 }
7168
7169 player.RemoveQuickBarEntityShortcut(this);
7170 }
7171 }
7172 }
7173
7175 {
7176 super.EEKilled(killer);
7177
7180 {
7181 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7182 {
7183 if (IsMagazine())
7184 {
7185 if (Magazine.Cast(this).GetAmmoCount() > 0)
7186 {
7188 }
7189 }
7190 else
7191 {
7193 }
7194 }
7195 }
7196 }
7197
7199 {
7200 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7201
7202 super.OnWasAttached(parent, slot_id);
7203
7206
7209 }
7210
7212 {
7213 super.OnWasDetached(parent, slot_id);
7214
7217
7220 }
7221
7223 {
7224 int idx;
7227
7228 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7229 if (inventory_slots.Count() < 1)
7230 {
7231 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7232 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7233 }
7234 else
7235 {
7236 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7237 }
7238
7239 idx = inventory_slots.Find(slot);
7240 if (idx < 0)
7241 return "";
7242
7243 return attach_types.Get(idx);
7244 }
7245
7247 {
7248 int idx = -1;
7249 string slot;
7250
7253
7254 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7255 if (inventory_slots.Count() < 1)
7256 {
7257 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7258 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7259 }
7260 else
7261 {
7262 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7263 if (detach_types.Count() < 1)
7264 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7265 }
7266
7267 for (int i = 0; i < inventory_slots.Count(); i++)
7268 {
7269 slot = inventory_slots.Get(i);
7270 }
7271
7272 if (slot != "")
7273 {
7274 if (detach_types.Count() == 1)
7275 idx = 0;
7276 else
7277 idx = inventory_slots.Find(slot);
7278 }
7279 if (idx < 0)
7280 return "";
7281
7282 return detach_types.Get(idx);
7283 }
7284
7286 {
7287
7289
7290
7291 float min_time = 1;
7292 float max_time = 3;
7293 float delay = Math.RandomFloat(min_time, max_time);
7294
7295 explode_timer.Run(delay, this, "DoAmmoExplosion");
7296 }
7297
7299 {
7300 Magazine magazine = Magazine.Cast(this);
7301 int pop_sounds_count = 6;
7302 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7303
7304
7305 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7306 string sound_name = pop_sounds[ sound_idx ];
7307 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7308
7309
7310 magazine.ServerAddAmmoCount(-1);
7311
7312
7313 float min_temp_to_explode = 100;
7314
7315 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7316 {
7318 }
7319 }
7320
7321
7322 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7323 {
7324 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7325
7326 const int CHANCE_DAMAGE_CARGO = 4;
7327 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7328 const int CHANCE_DAMAGE_NOTHING = 2;
7329
7331 {
7332 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7333 int chances;
7334 int rnd;
7335
7336 if (GetInventory().GetCargo())
7337 {
7338 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7339 rnd = Math.RandomInt(0,chances);
7340
7341 if (rnd < CHANCE_DAMAGE_CARGO)
7342 {
7344 }
7345 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7346 {
7348 }
7349 }
7350 else
7351 {
7352 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7353 rnd = Math.RandomInt(0,chances);
7354
7355 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7356 {
7358 }
7359 }
7360 }
7361 }
7362
7364 {
7365 CargoBase cargo = GetInventory().GetCargo();
7366 if (cargo)
7367 {
7369 if (item_count > 0)
7370 {
7371 int random_pick = Math.RandomInt(0, item_count);
7373 if (!item.IsExplosive())
7374 {
7375 item.AddHealth("","",damage);
7376 return true;
7377 }
7378 }
7379 }
7380 return false;
7381 }
7382
7384 {
7385 GameInventory inventory = GetInventory();
7387 if (attachment_count > 0)
7388 {
7389 int random_pick = Math.RandomInt(0, attachment_count);
7391 if (!attachment.IsExplosive())
7392 {
7393 attachment.AddHealth("","",damage);
7394 return true;
7395 }
7396 }
7397 return false;
7398 }
7399
7401 {
7403 }
7404
7406 {
7408 return GetInventory().CanRemoveEntity();
7409
7410 return false;
7411 }
7412
7414 {
7415
7417 return false;
7418
7419
7421 return false;
7422
7423
7424
7426 if (delta == 0)
7427 return false;
7428
7429
7430 return true;
7431 }
7432
7434 {
7436 {
7437 if (ScriptInputUserData.CanStoreInputUserData())
7438 {
7439 ScriptInputUserData ctx = new ScriptInputUserData;
7444 ctx.
Write(destination_entity);
7448 }
7449 }
7450 else if (!
g_Game.IsMultiplayer())
7451 {
7453 }
7454 }
7455
7457 {
7458 float split_quantity_new;
7462 InventoryLocation loc = new InventoryLocation;
7463
7464 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7465 {
7467 split_quantity_new = stack_max;
7468 else
7470
7472 {
7473 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7474 if (new_item)
7475 {
7476 new_item.SetResultOfSplit(true);
7477 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7479 new_item.
SetQuantity(split_quantity_new,
false,
true);
7480 }
7481 }
7482 }
7483 else if (destination_entity && slot_id == -1)
7484 {
7485 if (quantity > stack_max)
7486 split_quantity_new = stack_max;
7487 else
7488 split_quantity_new = quantity;
7489
7491 {
7492 GameInventory destinationInventory = destination_entity.GetInventory();
7494 {
7497 }
7498
7499 if (new_item)
7500 {
7501 new_item.SetResultOfSplit(true);
7502 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7504 new_item.
SetQuantity(split_quantity_new,
false,
true);
7505 }
7506 }
7507 }
7508 else
7509 {
7510 if (stack_max != 0)
7511 {
7513 {
7515 }
7516
7517 if (split_quantity_new == 0)
7518 {
7519 if (!
g_Game.IsMultiplayer())
7520 player.PhysicalPredictiveDropItem(this);
7521 else
7522 player.ServerDropEntity(this);
7523 return;
7524 }
7525
7527 {
7529
7530 if (new_item)
7531 {
7532 new_item.SetResultOfSplit(true);
7533 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7536 new_item.PlaceOnSurface();
7537 }
7538 }
7539 }
7540 }
7541 }
7542
7544 {
7545 float split_quantity_new;
7549 InventoryLocation loc = new InventoryLocation;
7550
7551 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7552 {
7554 split_quantity_new = stack_max;
7555 else
7557
7559 {
7560 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7561 if (new_item)
7562 {
7563 new_item.SetResultOfSplit(true);
7564 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7566 new_item.
SetQuantity(split_quantity_new,
false,
true);
7567 }
7568 }
7569 }
7570 else if (destination_entity && slot_id == -1)
7571 {
7572 if (quantity > stack_max)
7573 split_quantity_new = stack_max;
7574 else
7575 split_quantity_new = quantity;
7576
7578 {
7579 GameInventory destinationInventory = destination_entity.GetInventory();
7581 {
7584 }
7585
7586 if (new_item)
7587 {
7588 new_item.SetResultOfSplit(true);
7589 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7591 new_item.
SetQuantity(split_quantity_new,
false,
true);
7592 }
7593 }
7594 }
7595 else
7596 {
7597 if (stack_max != 0)
7598 {
7600 {
7602 }
7603
7605 {
7607
7608 if (new_item)
7609 {
7610 new_item.SetResultOfSplit(true);
7611 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7614 new_item.PlaceOnSurface();
7615 }
7616 }
7617 }
7618 }
7619 }
7620
7622 {
7624 {
7625 if (ScriptInputUserData.CanStoreInputUserData())
7626 {
7627 ScriptInputUserData ctx = new ScriptInputUserData;
7632 dst.WriteToContext(ctx);
7634 }
7635 }
7636 else if (!
g_Game.IsMultiplayer())
7637 {
7639 }
7640 }
7641
7643 {
7645 {
7646 if (ScriptInputUserData.CanStoreInputUserData())
7647 {
7648 ScriptInputUserData ctx = new ScriptInputUserData;
7653 ctx.
Write(destination_entity);
7659 }
7660 }
7661 else if (!
g_Game.IsMultiplayer())
7662 {
7664 }
7665 }
7666
7668 {
7670 }
7671
7673 {
7675 float split_quantity_new;
7677 if (dst.IsValid())
7678 {
7679 int slot_id = dst.GetSlot();
7681
7682 if (quantity > stack_max)
7683 split_quantity_new = stack_max;
7684 else
7685 split_quantity_new = quantity;
7686
7688 {
7690
7691 if (new_item)
7692 {
7693 new_item.SetResultOfSplit(true);
7694 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7696 new_item.
SetQuantity(split_quantity_new,
false,
true);
7697 }
7698
7699 return new_item;
7700 }
7701 }
7702
7703 return null;
7704 }
7705
7707 {
7709 float split_quantity_new;
7711 if (destination_entity)
7712 {
7714 if (quantity > stackable)
7715 split_quantity_new = stackable;
7716 else
7717 split_quantity_new = quantity;
7718
7720 {
7721 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7722 if (new_item)
7723 {
7724 new_item.SetResultOfSplit(true);
7725 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7727 new_item.
SetQuantity(split_quantity_new,
false,
true);
7728 }
7729 }
7730 }
7731 }
7732
7734 {
7736 {
7737 if (ScriptInputUserData.CanStoreInputUserData())
7738 {
7739 ScriptInputUserData ctx = new ScriptInputUserData;
7744 ItemBase destination_entity =
this;
7745 ctx.
Write(destination_entity);
7749 }
7750 }
7751 else if (!
g_Game.IsMultiplayer())
7752 {
7754 }
7755 }
7756
7758 {
7760 float split_quantity_new;
7762 if (player)
7763 {
7765 if (quantity > stackable)
7766 split_quantity_new = stackable;
7767 else
7768 split_quantity_new = quantity;
7769
7771 {
7772 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7773 new_item =
ItemBase.Cast(in_hands);
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 float split_quantity_new = Math.Floor(quantity * 0.5);
7789
7791 return;
7792
7794
7795 if (new_item)
7796 {
7797 if (new_item.GetQuantityMax() < split_quantity_new)
7798 {
7799 split_quantity_new = new_item.GetQuantityMax();
7800 }
7801
7802 new_item.SetResultOfSplit(true);
7803 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7804
7806 {
7809 }
7810 else
7811 {
7813 new_item.
SetQuantity(split_quantity_new,
false,
true);
7814 }
7815 }
7816 }
7817
7819 {
7821 float split_quantity_new = Math.Floor(quantity / 2);
7822
7824 return;
7825
7826 InventoryLocation invloc = new InventoryLocation;
7828
7830 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7831
7832 if (new_item)
7833 {
7834 if (new_item.GetQuantityMax() < split_quantity_new)
7835 {
7836 split_quantity_new = new_item.GetQuantityMax();
7837 }
7839 {
7842 }
7843 else if (split_quantity_new > 1)
7844 {
7846 new_item.
SetQuantity(split_quantity_new,
false,
true);
7847 }
7848 }
7849 }
7850
7853 {
7854 SetWeightDirty();
7856
7857 if (parent)
7858 parent.OnAttachmentQuantityChangedEx(this, delta);
7859
7861 {
7863 {
7865 }
7867 {
7868 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7870 }
7871 }
7872 }
7873
7876 {
7877
7878 }
7879
7882 {
7884 }
7885
7887 {
7888 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7889
7891 {
7892 if (newLevel == GameConstants.STATE_RUINED)
7893 {
7895 EntityAI parent = GetHierarchyParent();
7896 if (parent && parent.IsFireplace())
7897 {
7898 CargoBase cargo = GetInventory().GetCargo();
7899 if (cargo)
7900 {
7902 {
7904 }
7905 }
7906 }
7907 }
7908
7910 {
7911
7913 return;
7914 }
7915
7916 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7917 {
7919 }
7920 }
7921 }
7922
7923
7925 {
7926 super.OnRightClick();
7927
7929 {
7931 {
7932 if (ScriptInputUserData.CanStoreInputUserData())
7933 {
7934 EntityAI root = GetHierarchyRoot();
7935 Man playerOwner = GetHierarchyRootPlayer();
7936 InventoryLocation dst = new InventoryLocation;
7937
7938
7939 if (!playerOwner && root && root == this)
7940 {
7942 }
7943 else
7944 {
7945
7946 GetInventory().GetCurrentInventoryLocation(dst);
7948 {
7949 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7951 {
7953 }
7954 else
7955 {
7957
7958
7959 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
7960 {
7962 }
7963 else
7964 {
7965 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
7966 }
7967 }
7968 }
7969 }
7970
7971 ScriptInputUserData ctx = new ScriptInputUserData;
7979 }
7980 }
7981 else if (!
g_Game.IsMultiplayer())
7982 {
7984 }
7985 }
7986 }
7987
7989 {
7990 if (root)
7991 {
7992 vector m4[4];
7993 root.GetTransform(m4);
7994 dst.SetGround(this, m4);
7995 }
7996 else
7997 {
7998 GetInventory().GetCurrentInventoryLocation(dst);
7999 }
8000 }
8001
8002 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8003 {
8004
8005 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8006 return false;
8007
8008 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8009 return false;
8010
8011
8013 return false;
8014
8015
8016 Magazine mag = Magazine.Cast(this);
8017 if (mag)
8018 {
8019 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8020 return false;
8021
8022 if (stack_max_limit)
8023 {
8024 Magazine other_mag = Magazine.Cast(other_item);
8025 if (other_item)
8026 {
8027 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8028 return false;
8029 }
8030
8031 }
8032 }
8033 else
8034 {
8035
8037 return false;
8038
8040 return false;
8041 }
8042
8043 PlayerBase player = null;
8044 if (CastTo(player, GetHierarchyRootPlayer()))
8045 {
8046 if (player.GetInventory().HasAttachment(this))
8047 return false;
8048
8049 if (player.IsItemsToDelete())
8050 return false;
8051 }
8052
8053 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8054 return false;
8055
8056 int slotID;
8058 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8059 return false;
8060
8061 return true;
8062 }
8063
8065 {
8067 }
8068
8070 {
8071 return m_IsResultOfSplit;
8072 }
8073
8075 {
8076 m_IsResultOfSplit = value;
8077 }
8078
8080 {
8082 }
8083
8085 {
8086 float other_item_quantity = other_item.GetQuantity();
8087 float this_free_space;
8088
8090
8092
8093 if (other_item_quantity > this_free_space)
8094 {
8095 return this_free_space;
8096 }
8097 else
8098 {
8099 return other_item_quantity;
8100 }
8101 }
8102
8104 {
8106 }
8107
8109 {
8111 return;
8112
8113 if (!IsMagazine() && other_item)
8114 {
8116 if (quantity_used != 0)
8117 {
8118 float hp1 = GetHealth01("","");
8119 float hp2 = other_item.GetHealth01("","");
8120 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8121 hpResult = hpResult / (
GetQuantity() + quantity_used);
8122
8123 hpResult *= GetMaxHealth();
8124 Math.Round(hpResult);
8125 SetHealth("", "Health", hpResult);
8126
8128 other_item.AddQuantity(-quantity_used);
8129 }
8130 }
8132 }
8133
8135 {
8136 #ifdef SERVER
8137 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8138 GetHierarchyParent().IncreaseLifetimeUp();
8139 #endif
8140 };
8141
8143 {
8144 PlayerBase p = PlayerBase.Cast(player);
8145
8146 array<int> recipesIds = p.m_Recipes;
8147 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8148 if (moduleRecipesManager)
8149 {
8150 EntityAI itemInHands = player.GetEntityInHands();
8151 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8152 }
8153
8154 for (int i = 0;i < recipesIds.Count(); i++)
8155 {
8156 int key = recipesIds.Get(i);
8157 string recipeName = moduleRecipesManager.GetRecipeName(key);
8159 }
8160 }
8161
8162
8163 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8164 {
8165 super.GetDebugActions(outputList);
8166
8167
8173
8174
8179
8184
8185
8189
8190
8192 {
8196 }
8197
8200
8201
8205
8207
8208 InventoryLocation loc = new InventoryLocation();
8209 GetInventory().GetCurrentInventoryLocation(loc);
8211 {
8212 if (Gizmo_IsSupported())
8215 }
8216
8218 }
8219
8220
8221
8222
8224 {
8225 super.OnAction(action_id, player, ctx);
8226
8228 {
8229 switch (action_id)
8230 {
8234 return true;
8238 return true;
8239 }
8240 }
8241
8243 {
8244 switch (action_id)
8245 {
8247 Delete();
8248 return true;
8249 }
8250 }
8251
8252 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8253 {
8254 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8255 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8256 PlayerBase p = PlayerBase.Cast(player);
8257 if (
EActions.RECIPES_RANGE_START < 1000)
8258 {
8259 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8260 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8261 }
8262 }
8263 #ifndef SERVER
8264 else if (action_id ==
EActions.WATCH_PLAYER)
8265 {
8266 PluginDeveloper.SetDeveloperItemClientEx(player);
8267 }
8268 #endif
8270 {
8271 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8272 {
8273 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8274 OnDebugButtonPressServer(id + 1);
8275 }
8276
8277 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8278 {
8279 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8281 }
8282
8283 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8284 {
8285 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8287 }
8288
8289 else if (action_id ==
EActions.ADD_QUANTITY)
8290 {
8291 if (IsMagazine())
8292 {
8293 Magazine mag = Magazine.Cast(this);
8294 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8295 }
8296 else
8297 {
8299 }
8300
8301 if (m_EM)
8302 {
8303 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8304 }
8305
8306 }
8307
8308 else if (action_id ==
EActions.REMOVE_QUANTITY)
8309 {
8310 if (IsMagazine())
8311 {
8312 Magazine mag2 = Magazine.Cast(this);
8313 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8314 }
8315 else
8316 {
8318 }
8319 if (m_EM)
8320 {
8321 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8322 }
8323
8324 }
8325
8326 else if (action_id ==
EActions.SET_QUANTITY_0)
8327 {
8329
8330 if (m_EM)
8331 {
8332 m_EM.SetEnergy(0);
8333 }
8334 }
8335
8336 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8337 {
8339
8340 if (m_EM)
8341 {
8342 m_EM.SetEnergy(m_EM.GetEnergyMax());
8343 }
8344 }
8345
8346 else if (action_id ==
EActions.ADD_HEALTH)
8347 {
8348 AddHealth("","",GetMaxHealth("","Health")/5);
8349 }
8350 else if (action_id ==
EActions.REMOVE_HEALTH)
8351 {
8352 AddHealth("","",-GetMaxHealth("","Health")/5);
8353 }
8354 else if (action_id ==
EActions.DESTROY_HEALTH)
8355 {
8356 SetHealth01("","",0);
8357 }
8358 else if (action_id ==
EActions.WATCH_ITEM)
8359 {
8361 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8362 #ifdef DEVELOPER
8363 SetDebugDeveloper_item(this);
8364 #endif
8365 }
8366
8367 else if (action_id ==
EActions.ADD_TEMPERATURE)
8368 {
8369 AddTemperature(20);
8370
8371 }
8372
8373 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8374 {
8375 AddTemperature(-20);
8376
8377 }
8378
8379 else if (action_id ==
EActions.FLIP_FROZEN)
8380 {
8381 SetFrozen(!GetIsFrozen());
8382
8383 }
8384
8385 else if (action_id ==
EActions.ADD_WETNESS)
8386 {
8388
8389 }
8390
8391 else if (action_id ==
EActions.REMOVE_WETNESS)
8392 {
8394
8395 }
8396
8397 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8398 {
8401
8402
8403 }
8404
8405 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8406 {
8409 }
8410
8411 else if (action_id ==
EActions.MAKE_SPECIAL)
8412 {
8413 auto debugParams = DebugSpawnParams.WithPlayer(player);
8414 OnDebugSpawnEx(debugParams);
8415 }
8416
8417 }
8418
8419
8420 return false;
8421 }
8422
8423
8424
8425
8429
8432
8433
8434
8436 {
8437 return false;
8438 }
8439
8440
8442 {
8443 return true;
8444 }
8445
8446
8448 {
8449 return true;
8450 }
8451
8452
8453
8455 {
8456 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8457 return g_Game.ConfigIsExisting(config_path);
8458 }
8459
8462 {
8463 return null;
8464 }
8465
8467 {
8468 return false;
8469 }
8470
8472 {
8473 return false;
8474 }
8475
8479
8480
8482 {
8483 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8484 return module_repairing.CanRepair(this, item_repair_kit);
8485 }
8486
8487
8488 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8489 {
8490 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8491 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8492 }
8493
8494
8496 {
8497
8498
8499
8500
8501
8502
8503
8504
8505 return 1;
8506 }
8507
8508
8509
8511 {
8513 }
8514
8515
8516
8518 {
8520 }
8521
8522
8531 {
8532 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8533
8534 if (player)
8535 {
8536 player.MessageStatus(text);
8537 }
8538 }
8539
8540
8549 {
8550 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8551
8552 if (player)
8553 {
8554 player.MessageAction(text);
8555 }
8556 }
8557
8558
8567 {
8568 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8569
8570 if (player)
8571 {
8572 player.MessageFriendly(text);
8573 }
8574 }
8575
8576
8585 {
8586 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8587
8588 if (player)
8589 {
8590 player.MessageImportant(text);
8591 }
8592 }
8593
8595 {
8596 return true;
8597 }
8598
8599
8600 override bool KindOf(
string tag)
8601 {
8602 bool found = false;
8603 string item_name = this.
GetType();
8605 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8606
8607 int array_size = item_tag_array.Count();
8608 for (int i = 0; i < array_size; i++)
8609 {
8610 if (item_tag_array.Get(i) == tag)
8611 {
8612 found = true;
8613 break;
8614 }
8615 }
8616 return found;
8617 }
8618
8619
8621 {
8622
8623 super.OnRPC(sender, rpc_type,ctx);
8624
8625
8626 switch (rpc_type)
8627 {
8628 #ifndef SERVER
8629 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8630 Param2<bool, string> p = new Param2<bool, string>(false, "");
8631
8633 return;
8634
8635 bool play = p.param1;
8636 string soundSet = p.param2;
8637
8638 if (play)
8639 {
8641 {
8643 {
8645 }
8646 }
8647 else
8648 {
8650 }
8651 }
8652 else
8653 {
8655 }
8656
8657 break;
8658 #endif
8659
8660 }
8661
8663 {
8665 }
8666 }
8667
8668
8669
8670
8672 {
8673 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8674 return plugin.GetID(
name);
8675 }
8676
8678 {
8679 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8680 return plugin.GetName(id);
8681 }
8682
8685 {
8686
8687
8688 int varFlags;
8689 if (!ctx.
Read(varFlags))
8690 return;
8691
8692 if (varFlags & ItemVariableFlags.FLOAT)
8693 {
8695 }
8696 }
8697
8699 {
8700
8701 super.SerializeNumericalVars(floats_out);
8702
8703
8704
8706 {
8708 }
8709
8711 {
8713 }
8714
8716 {
8718 }
8719
8721 {
8726 }
8727
8729 {
8731 }
8732 }
8733
8735 {
8736
8737 super.DeSerializeNumericalVars(floats);
8738
8739
8740 int index = 0;
8741 int mask = Math.Round(floats.Get(index));
8742
8743 index++;
8744
8746 {
8748 {
8750 }
8751 else
8752 {
8753 float quantity = floats.Get(index);
8755 }
8756 index++;
8757 }
8758
8760 {
8761 float wet = floats.Get(index);
8763 index++;
8764 }
8765
8767 {
8768 int liquidtype = Math.Round(floats.Get(index));
8770 index++;
8771 }
8772
8774 {
8776 index++;
8778 index++;
8780 index++;
8782 index++;
8783 }
8784
8786 {
8787 int cleanness = Math.Round(floats.Get(index));
8789 index++;
8790 }
8791 }
8792
8794 {
8795 super.WriteVarsToCTX(ctx);
8796
8797
8799 {
8801 }
8802
8804 {
8806 }
8807
8809 {
8811 }
8812
8814 {
8815 int r,g,b,a;
8821 }
8822
8824 {
8826 }
8827 }
8828
8830 {
8831 if (!super.ReadVarsFromCTX(ctx,version))
8832 return false;
8833
8834 int intValue;
8835 float value;
8836
8837 if (version < 140)
8838 {
8839 if (!ctx.
Read(intValue))
8840 return false;
8841
8842 m_VariablesMask = intValue;
8843 }
8844
8846 {
8847 if (!ctx.
Read(value))
8848 return false;
8849
8851 {
8853 }
8854 else
8855 {
8857 }
8858 }
8859
8860 if (version < 140)
8861 {
8863 {
8864 if (!ctx.
Read(value))
8865 return false;
8866 SetTemperatureDirect(value);
8867 }
8868 }
8869
8871 {
8872 if (!ctx.
Read(value))
8873 return false;
8875 }
8876
8878 {
8879 if (!ctx.
Read(intValue))
8880 return false;
8882 }
8883
8885 {
8886 int r,g,b,a;
8888 return false;
8890 return false;
8892 return false;
8894 return false;
8895
8897 }
8898
8900 {
8901 if (!ctx.
Read(intValue))
8902 return false;
8904 }
8905
8906 if (version >= 138 && version < 140)
8907 {
8909 {
8910 if (!ctx.
Read(intValue))
8911 return false;
8912 SetFrozen(intValue);
8913 }
8914 }
8915
8916 return true;
8917 }
8918
8919
8921 {
8924 {
8926 }
8927
8928 if (!super.OnStoreLoad(ctx, version))
8929 {
8931 return false;
8932 }
8933
8934 if (version >= 114)
8935 {
8936 bool hasQuickBarIndexSaved;
8937
8938 if (!ctx.
Read(hasQuickBarIndexSaved))
8939 {
8941 return false;
8942 }
8943
8944 if (hasQuickBarIndexSaved)
8945 {
8946 int itmQBIndex;
8947
8948
8949 if (!ctx.
Read(itmQBIndex))
8950 {
8952 return false;
8953 }
8954
8955 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
8956 if (itmQBIndex != -1 && parentPlayer)
8957 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
8958 }
8959 }
8960 else
8961 {
8962
8963 PlayerBase player;
8964 int itemQBIndex;
8965 if (version ==
int.
MAX)
8966 {
8967 if (!ctx.
Read(itemQBIndex))
8968 {
8970 return false;
8971 }
8972 }
8973 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
8974 {
8975
8976 if (!ctx.
Read(itemQBIndex))
8977 {
8979 return false;
8980 }
8981 if (itemQBIndex != -1 && player)
8982 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
8983 }
8984 }
8985
8986 if (version < 140)
8987 {
8988
8989 if (!LoadVariables(ctx, version))
8990 {
8992 return false;
8993 }
8994 }
8995
8996
8998 {
9000 return false;
9001 }
9002 if (version >= 132)
9003 {
9005 if (raib)
9006 {
9008 {
9010 return false;
9011 }
9012 }
9013 }
9014
9016 return true;
9017 }
9018
9019
9020
9022 {
9023 super.OnStoreSave(ctx);
9024
9025 PlayerBase player;
9026 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9027 {
9029
9030 int itemQBIndex = -1;
9031 itemQBIndex = player.FindQuickBarEntityIndex(this);
9032 ctx.
Write(itemQBIndex);
9033 }
9034 else
9035 {
9037 }
9038
9040
9042 if (raib)
9043 {
9045 }
9046 }
9047
9048
9050 {
9051 super.AfterStoreLoad();
9052
9054 {
9056 }
9057
9059 {
9062 }
9063 }
9064
9066 {
9067 super.EEOnAfterLoad();
9068
9070 {
9072 }
9073
9076 }
9077
9079 {
9080 return false;
9081 }
9082
9083
9084
9086 {
9088 {
9089 #ifdef PLATFORM_CONSOLE
9090
9092 {
9094 if (menu)
9095 {
9097 }
9098 }
9099 #endif
9100 }
9101
9103 {
9106 }
9107
9109 {
9110 SetWeightDirty();
9112 }
9114 {
9117 }
9118
9120 {
9123
9126 }
9128 {
9132 }
9133
9134 super.OnVariablesSynchronized();
9135 }
9136
9137
9138
9140 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9141 {
9142 if (!IsServerCheck(allow_client))
9143 return false;
9144
9146 return false;
9147
9150
9151 if (value <= (min + 0.001))
9152 value = min;
9153
9154 if (value == min)
9155 {
9156 if (destroy_config)
9157 {
9158 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9159 if (dstr)
9160 {
9162 this.Delete();
9163 return true;
9164 }
9165 }
9166 else if (destroy_forced)
9167 {
9169 this.Delete();
9170 return true;
9171 }
9172
9174 }
9175
9178
9180 {
9181 EntityAI parent = GetHierarchyRoot();
9182 InventoryLocation iLoc = new InventoryLocation();
9183 GetInventory().GetCurrentInventoryLocation(iLoc);
9185 {
9186 int iLocSlot = iLoc.
GetSlot();
9188 {
9190 }
9192 {
9194 }
9195 }
9196 }
9197
9199 {
9201
9202 if (delta)
9204 }
9205
9207
9208 return false;
9209 }
9210
9211
9213 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9214 {
9216 }
9217
9219 {
9222 }
9223
9225 {
9228 }
9229
9231 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9232 {
9233 float value_clamped = Math.Clamp(value, 0, 1);
9235 SetQuantity(result, destroy_config, destroy_forced);
9236 }
9237
9238
9241 {
9243 }
9244
9246 {
9248 }
9249
9250
9251
9252
9253
9254
9255
9256
9257
9258
9260 {
9261 int slot = -1;
9262 GameInventory inventory = GetInventory();
9263 if (inventory)
9264 {
9265 InventoryLocation il = new InventoryLocation;
9268 }
9269
9271 }
9272
9274 {
9275 float quantity_max = 0;
9276
9278 {
9279 if (attSlotID != -1)
9280 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9281
9282 if (quantity_max <= 0)
9284 }
9285
9286 if (quantity_max <= 0)
9288
9289 return quantity_max;
9290 }
9291
9293 {
9295 }
9296
9298 {
9300 }
9301
9302
9304 {
9306 }
9307
9309 {
9311 }
9312
9314 {
9316 }
9317
9318
9320 {
9321
9322 float weightEx = GetWeightEx();
9323 float special = GetInventoryAndCargoWeight();
9324 return weightEx - special;
9325 }
9326
9327
9329 {
9331 }
9332
9334 {
9336 {
9337 #ifdef DEVELOPER
9338 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9339 {
9340 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9342 }
9343 #endif
9344
9346 }
9347 else if (HasEnergyManager())
9348 {
9349 #ifdef DEVELOPER
9350 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9351 {
9352 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9353 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9354 }
9355 #endif
9356 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9357 }
9358 else
9359 {
9360 #ifdef DEVELOPER
9361 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9362 {
9363 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9364 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9365 }
9366 #endif
9367 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9368 }
9369 }
9370
9373 {
9374 int item_count = 0;
9376
9377 GameInventory inventory = GetInventory();
9378 CargoBase cargo = inventory.
GetCargo();
9379 if (cargo != NULL)
9380 {
9382 }
9383
9385 for (int i = 0; i < nAttachments; ++i)
9386 {
9388 if (item)
9389 item_count += item.GetNumberOfItems();
9390 }
9391 return item_count;
9392 }
9393
9396 {
9397 float weight = 0;
9398 float wetness = 1;
9399 if (include_wetness)
9402 {
9403 weight = wetness * m_ConfigWeight;
9404 }
9406 {
9407 weight = 1;
9408 }
9409 return weight;
9410 }
9411
9412
9413
9415 {
9416 GameInventory inventory = GetInventory();
9417 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9418 {
9419 array<EntityAI> items = new array<EntityAI>;
9421 for (int i = 0; i < items.Count(); ++i)
9422 {
9424 if (item)
9425 {
9426 g_Game.ObjectDelete(item);
9427 }
9428 }
9429 }
9430 }
9431
9432
9433
9434
9436 {
9437 float energy = 0;
9438 if (HasEnergyManager())
9439 {
9440 energy = GetCompEM().GetEnergy();
9441 }
9442 return energy;
9443 }
9444
9445
9447 {
9448 super.OnEnergyConsumed();
9449
9451 }
9452
9454 {
9455 super.OnEnergyAdded();
9456
9458 }
9459
9460
9462 {
9463 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9464 {
9466 {
9467 float energy_0to1 = GetCompEM().GetEnergy0To1();
9469 }
9470 }
9471 }
9472
9473
9475 {
9476 return ConfigGetFloat("heatIsolation");
9477 }
9478
9480 {
9482 }
9483
9485 {
9486 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9487 if (
g_Game.ConfigIsExisting(paramPath))
9488 return g_Game.ConfigGetFloat(paramPath);
9489
9490 return 0.0;
9491 }
9492
9494 {
9495 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9496 if (
g_Game.ConfigIsExisting(paramPath))
9497 return g_Game.ConfigGetFloat(paramPath);
9498
9499 return 0.0;
9500 }
9501
9502 override void SetWet(
float value,
bool allow_client =
false)
9503 {
9504 if (!IsServerCheck(allow_client))
9505 return;
9506
9509
9511
9512 m_VarWet = Math.Clamp(value, min, max);
9513
9515 {
9518 }
9519 }
9520
9521 override void AddWet(
float value)
9522 {
9524 }
9525
9527 {
9529 }
9530
9532 {
9534 }
9535
9537 {
9539 }
9540
9542 {
9544 }
9545
9547 {
9549 }
9550
9552 {
9555 if (newLevel != oldLevel)
9556 {
9558 }
9559 }
9560
9562 {
9563 SetWeightDirty();
9564 }
9565
9567 {
9568 return GetWetLevelInternal(
m_VarWet);
9569 }
9570
9571
9572
9574 {
9576 }
9577
9579 {
9581 }
9582
9584 {
9586 }
9587
9589 {
9591 }
9592
9593
9594
9596 {
9597 if (ConfigIsExisting("itemModelLength"))
9598 {
9599 return ConfigGetFloat("itemModelLength");
9600 }
9601 return 0;
9602 }
9603
9605 {
9606 if (ConfigIsExisting("itemAttachOffset"))
9607 {
9608 return ConfigGetFloat("itemAttachOffset");
9609 }
9610 return 0;
9611 }
9612
9613 override void SetCleanness(
int value,
bool allow_client =
false)
9614 {
9615 if (!IsServerCheck(allow_client))
9616 return;
9617
9619
9621
9624 }
9625
9627 {
9629 }
9630
9632 {
9633 return true;
9634 }
9635
9636
9637
9638
9640 {
9642 }
9643
9645 {
9647 }
9648
9649
9650
9651
9652 override void SetColor(
int r,
int g,
int b,
int a)
9653 {
9659 }
9661 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9662 {
9667 }
9668
9670 {
9672 }
9673
9676 {
9677 int r,g,b,a;
9679 r = r/255;
9680 g = g/255;
9681 b = b/255;
9682 a = a/255;
9683 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9684 }
9685
9686
9687
9688 override void SetLiquidType(
int value,
bool allow_client =
false)
9689 {
9690 if (!IsServerCheck(allow_client))
9691 return;
9692
9697 }
9698
9700 {
9701 return ConfigGetInt("varLiquidTypeInit");
9702 }
9703
9705 {
9707 }
9708
9710 {
9712 SetFrozen(false);
9713 }
9714
9717 {
9718 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9719 }
9720
9721
9724 {
9725 PlayerBase nplayer;
9726 if (PlayerBase.CastTo(nplayer, player))
9727 {
9729 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9730 }
9731 }
9732
9733
9736 {
9737 PlayerBase nplayer;
9738 if (PlayerBase.CastTo(nplayer,player))
9739 {
9740 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9741 }
9742
9743 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9744
9745 if (HasEnergyManager())
9746 {
9747 GetCompEM().UpdatePlugState();
9748 }
9749 }
9750
9751
9753 {
9754 super.OnPlacementStarted(player);
9755
9757 }
9758
9759 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9760 {
9762 {
9763 m_AdminLog.OnPlacementComplete(player,
this);
9764 }
9765
9766 super.OnPlacementComplete(player, position, orientation);
9767 }
9768
9769
9770
9771
9772
9774 {
9776 {
9777 return true;
9778 }
9779 else
9780 {
9781 return false;
9782 }
9783 }
9784
9785
9787 {
9789 {
9791 }
9792 }
9793
9794
9796 {
9798 }
9799
9801 {
9803 }
9804
9805 override void InsertAgent(
int agent,
float count = 1)
9806 {
9807 if (count < 1)
9808 return;
9809
9811 }
9812
9815 {
9817 }
9818
9819
9821 {
9823 }
9824
9825
9826
9827
9828
9829
9830
9831
9832
9833
9834
9835
9836
9837
9838
9839
9840
9841
9842
9843
9844
9845
9846
9847
9848
9849
9850
9851
9852
9853
9854
9855
9856
9857
9858
9859
9860
9861
9862
9863
9864
9865
9867 {
9869 return false;
9870 return true;
9871 }
9872
9874 {
9875
9877 }
9878
9879
9882 {
9883 super.CheckForRoofLimited(timeTresholdMS);
9884
9885 float time =
g_Game.GetTime();
9886 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9887 {
9888 m_PreviousRoofTestTime = time;
9889 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9890 }
9891 }
9892
9893
9895 {
9897 {
9898 return 0;
9899 }
9900
9901 if (GetInventory().GetAttachmentSlotsCount() != 0)
9902 {
9903 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9904 if (filter)
9905 return filter.GetProtectionLevel(type, false, system);
9906 else
9907 return 0;
9908 }
9909
9910 string subclassPath, entryName;
9911
9912 switch (type)
9913 {
9915 entryName = "biological";
9916 break;
9918 entryName = "chemical";
9919 break;
9920 default:
9921 entryName = "biological";
9922 break;
9923 }
9924
9925 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9926
9927 return g_Game.ConfigGetFloat(subclassPath + entryName);
9928 }
9929
9930
9931
9934 {
9935 if (!IsMagazine())
9937
9939 }
9940
9941
9942
9943
9944
9949 {
9950 return true;
9951 }
9952
9954 {
9956 }
9957
9958
9959
9960
9961
9963 {
9964 if (parent)
9965 {
9966 if (parent.IsInherited(DayZInfected))
9967 return true;
9968
9969 if (!parent.IsRuined())
9970 return true;
9971 }
9972
9973 return true;
9974 }
9975
9977 {
9978 if (!super.CanPutAsAttachment(parent))
9979 {
9980 return false;
9981 }
9982
9983 if (!IsRuined() && !parent.IsRuined())
9984 {
9985 return true;
9986 }
9987
9988 return false;
9989 }
9990
9992 {
9993
9994
9995
9996
9997 return super.CanReceiveItemIntoCargo(item);
9998 }
9999
10001 {
10002
10003
10004
10005
10006 GameInventory attachmentInv = attachment.GetInventory();
10008 {
10009 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10010 return false;
10011 }
10012
10013 InventoryLocation loc = new InventoryLocation();
10014 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10015 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10016 return false;
10017
10018 return super.CanReceiveAttachment(attachment, slotId);
10019 }
10020
10022 {
10023 if (!super.CanReleaseAttachment(attachment))
10024 return false;
10025
10026 return GetInventory().AreChildrenAccessible();
10027 }
10028
10029
10030
10031
10032
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10043
10044
10045
10046
10047
10048
10050 {
10051 int id = muzzle_owner.GetMuzzleID();
10052 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10053
10054 if (WPOF_array)
10055 {
10056 for (int i = 0; i < WPOF_array.Count(); i++)
10057 {
10058 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10059
10060 if (WPOF)
10061 {
10062 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10063 }
10064 }
10065 }
10066 }
10067
10068
10070 {
10071 int id = muzzle_owner.GetMuzzleID();
10073
10074 if (WPOBE_array)
10075 {
10076 for (int i = 0; i < WPOBE_array.Count(); i++)
10077 {
10078 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10079
10080 if (WPOBE)
10081 {
10082 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10083 }
10084 }
10085 }
10086 }
10087
10088
10090 {
10091 int id = muzzle_owner.GetMuzzleID();
10092 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10093
10094 if (WPOOH_array)
10095 {
10096 for (int i = 0; i < WPOOH_array.Count(); i++)
10097 {
10098 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10099
10100 if (WPOOH)
10101 {
10102 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10103 }
10104 }
10105 }
10106 }
10107
10108
10110 {
10111 int id = muzzle_owner.GetMuzzleID();
10112 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10113
10114 if (WPOOH_array)
10115 {
10116 for (int i = 0; i < WPOOH_array.Count(); i++)
10117 {
10118 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10119
10120 if (WPOOH)
10121 {
10122 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10123 }
10124 }
10125 }
10126 }
10127
10128
10130 {
10131 int id = muzzle_owner.GetMuzzleID();
10132 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10133
10134 if (WPOOH_array)
10135 {
10136 for (int i = 0; i < WPOOH_array.Count(); i++)
10137 {
10138 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10139
10140 if (WPOOH)
10141 {
10142 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10143 }
10144 }
10145 }
10146 }
10147
10148
10149
10151 {
10153 {
10154 return true;
10155 }
10156
10157 return false;
10158 }
10159
10161 {
10163 {
10164 return true;
10165 }
10166
10167 return false;
10168 }
10169
10171 {
10173 {
10174 return true;
10175 }
10176
10177 return false;
10178 }
10179
10181 {
10182 return false;
10183 }
10184
10187 {
10188 return UATimeSpent.DEFAULT_DEPLOY;
10189 }
10190
10191
10192
10193
10195 {
10197 SetSynchDirty();
10198 }
10199
10201 {
10203 }
10204
10205
10207 {
10208 return false;
10209 }
10210
10213 {
10214 string att_type = "None";
10215
10216 if (ConfigIsExisting("soundAttType"))
10217 {
10218 att_type = ConfigGetString("soundAttType");
10219 }
10220
10222 }
10223
10225 {
10227 }
10228
10229
10230
10231
10232
10238
10240 {
10243
10245 }
10246
10247
10249 {
10251 return;
10252
10254
10257
10260
10261 SoundParameters params = new SoundParameters();
10265 }
10266
10267
10269 {
10271 {
10274
10275 SetSynchDirty();
10276
10279 }
10280 }
10281
10283 {
10285 }
10286
10287
10289 {
10291 return;
10292
10294 SetSynchDirty();
10295
10298 }
10299
10301 {
10304 }
10305
10307 {
10309 }
10310
10311 void OnApply(PlayerBase player);
10312
10314 {
10315 return 1.0;
10316 };
10317
10319 {
10321 }
10322
10324 {
10326 }
10327
10329
10331 {
10332 SetDynamicPhysicsLifeTime(0.01);
10334 }
10335
10337 {
10338 array<string> zone_names = new array<string>;
10339 GetDamageZones(zone_names);
10340 for (int i = 0; i < zone_names.Count(); i++)
10341 {
10342 SetHealthMax(zone_names.Get(i),"Health");
10343 }
10344 SetHealthMax("","Health");
10345 }
10346
10349 {
10350 float global_health = GetHealth01("","Health");
10351 array<string> zones = new array<string>;
10352 GetDamageZones(zones);
10353
10354 for (int i = 0; i < zones.Count(); i++)
10355 {
10356 SetHealth01(zones.Get(i),"Health",global_health);
10357 }
10358 }
10359
10362 {
10363 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10364 }
10365
10367 {
10368 if (!hasRootAsPlayer)
10369 {
10370 if (refParentIB)
10371 {
10372
10373 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10374 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10375
10376 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10377 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10378
10381 }
10382 else
10383 {
10384
10387 }
10388 }
10389 }
10390
10392 {
10394 {
10395 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10396 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10397 {
10398 float heatPermCoef = 1.0;
10400 while (ent)
10401 {
10402 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10403 ent = ent.GetHierarchyParent();
10404 }
10405
10406 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10407 }
10408 }
10409 }
10410
10412 {
10413
10414 EntityAI parent = GetHierarchyParent();
10415 if (!parent)
10416 {
10417 hasParent = false;
10418 hasRootAsPlayer = false;
10419 }
10420 else
10421 {
10422 hasParent = true;
10423 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10424 refParentIB =
ItemBase.Cast(parent);
10425 }
10426 }
10427
10428 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10429 {
10430
10431 }
10432
10434 {
10435
10436 return false;
10437 }
10438
10440 {
10441
10442
10443 return false;
10444 }
10445
10447 {
10448
10449 return false;
10450 }
10451
10454 {
10455 return !GetIsFrozen() &&
IsOpen();
10456 }
10457
10459 {
10460 bool hasParent = false, hasRootAsPlayer = false;
10462
10463 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10464 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10465
10466 if (wwtu || foodDecay)
10467 {
10471
10472 if (processWetness || processTemperature || processDecay)
10473 {
10475
10476 if (processWetness)
10477 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10478
10479 if (processTemperature)
10481
10482 if (processDecay)
10483 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10484 }
10485 }
10486 }
10487
10490 {
10492 }
10493
10495 {
10498
10499 return super.GetTemperatureFreezeThreshold();
10500 }
10501
10503 {
10506
10507 return super.GetTemperatureThawThreshold();
10508 }
10509
10511 {
10514
10515 return super.GetItemOverheatThreshold();
10516 }
10517
10519 {
10521 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10522
10523 return super.GetTemperatureFreezeTime();
10524 }
10525
10527 {
10529 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10530
10531 return super.GetTemperatureThawTime();
10532 }
10533
10538
10540 {
10541 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10542 }
10543
10545 {
10546 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10547 }
10548
10551 {
10553 }
10554
10556 {
10558 }
10559
10561 {
10563 }
10564
10567 {
10568 return null;
10569 }
10570
10573 {
10574 return false;
10575 }
10576
10578 {
10580 {
10583 if (!trg)
10584 {
10586 explosive = this;
10587 }
10588
10589 explosive.PairRemote(trg);
10591
10592 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10593 trg.SetPersistentPairID(persistentID);
10594 explosive.SetPersistentPairID(persistentID);
10595
10596 return true;
10597 }
10598 return false;
10599 }
10600
10603 {
10604 float ret = 1.0;
10607 ret *= GetHealth01();
10608
10609 return ret;
10610 }
10611
10612 #ifdef DEVELOPER
10613 override void SetDebugItem()
10614 {
10615 super.SetDebugItem();
10616 _itemBase = this;
10617 }
10618
10620 {
10621 string text = super.GetDebugText();
10622
10624 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10625
10626 return text;
10627 }
10628 #endif
10629
10631 {
10632 return true;
10633 }
10634
10636
10638
10640 {
10643 }
10644
10645
10653
10669
10670 [
Obsolete(
"Use ItemSoundHandler instead")]
10673 {
10674 if (!
g_Game.IsDedicatedServer())
10675 {
10676 if (ConfigIsExisting("attachSoundSet"))
10677 {
10678 string cfg_path = "";
10679 string soundset = "";
10680 string type_name =
GetType();
10681
10684 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10685 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10686
10687 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10688 {
10689 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10690 {
10691 if (cfg_slot_array[i] == slot_type)
10692 {
10693 soundset = cfg_soundset_array[i];
10694 break;
10695 }
10696 }
10697 }
10698
10699 if (soundset != "")
10700 {
10701 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10703 }
10704 }
10705 }
10706 }
10707
10709}
10710
10712{
10714 if (entity)
10715 {
10716 bool is_item = entity.IsInherited(
ItemBase);
10717 if (is_item && full_quantity)
10718 {
10721 }
10722 }
10723 else
10724 {
10726 return NULL;
10727 }
10728 return entity;
10729}
10730
10732{
10733 if (item)
10734 {
10735 if (health > 0)
10736 item.SetHealth("", "", health);
10737
10738 if (item.CanHaveTemperature())
10739 {
10741 if (item.CanFreeze())
10742 item.SetFrozen(false);
10743 }
10744
10745 if (item.HasEnergyManager())
10746 {
10747 if (quantity >= 0)
10748 {
10749 item.GetCompEM().SetEnergy0To1(quantity);
10750 }
10751 else
10752 {
10754 }
10755 }
10756 else if (item.IsMagazine())
10757 {
10758 Magazine mag = Magazine.Cast(item);
10759 if (quantity >= 0)
10760 {
10761 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10762 }
10763 else
10764 {
10766 }
10767
10768 }
10769 else
10770 {
10771 if (quantity >= 0)
10772 {
10773 item.SetQuantityNormalized(quantity, false);
10774 }
10775 else
10776 {
10778 }
10779
10780 }
10781 }
10782}
10783
10784#ifdef DEVELOPER
10786#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.