5879{
5881 {
5882 return true;
5883 }
5884};
5885
5887{
5888
5889};
5890
5891
5892
5894{
5898
5900
5903
5904
5905
5906
5907
5916
5922
5927
5932
5953 protected bool m_IsResultOfSplit
5954
5956
5961
5962
5963
5965
5969
5970
5971
5973
5976
5977
5978
5984
5985
5993
5996
5997
5999
6000
6002
6003
6008
6009
6014
6016
6017
6019
6020
6022 {
6027
6028 if (!
g_Game.IsDedicatedServer())
6029 {
6031 {
6033
6035 {
6037 }
6038 }
6039
6042 }
6043
6044 m_OldLocation = null;
6045
6047 {
6049 }
6050
6051 if (ConfigIsExisting("headSelectionsToHide"))
6052 {
6055 }
6056
6058 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6059 {
6061 }
6062
6064
6065 m_IsResultOfSplit = false;
6066
6068 }
6069
6071 {
6072 super.InitItemVariables();
6073
6079 m_Count = ConfigGetInt(
"count");
6080
6083
6088
6091
6096
6108
6112
6113
6116 if (ConfigIsExisting("canBeSplit"))
6117 {
6120 }
6121
6123 if (ConfigIsExisting("itemBehaviour"))
6125
6126
6129 RegisterNetSyncVariableInt("m_VarLiquidType");
6130 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6131
6132 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6133 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6134 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6135
6136 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6137 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6138 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6139 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6140
6141 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6142 RegisterNetSyncVariableBool("m_IsTakeable");
6143 RegisterNetSyncVariableBool("m_IsHologram");
6144
6147 {
6150 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
6151 }
6152
6154
6156 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6158
6160 }
6161
6163 {
6165 }
6166
6168 {
6171 {
6176 }
6177 }
6178
6179 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6180 {
6182 {
6185 }
6186
6188 }
6189
6191 {
6197 }
6198
6200
6202 {
6204
6205 if (!action)
6206 {
6207 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
6208 return;
6209 }
6210
6212 if (!ai)
6213 {
6215 return;
6216 }
6217
6219 if (!action_array)
6220 {
6221 action_array = new array<ActionBase_Basic>;
6223 }
6224 if (LogManager.IsActionLogEnable())
6225 {
6226 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
6227 }
6228
6229 if (action_array.Find(action) != -1)
6230 {
6231 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
6232 }
6233 else
6234 {
6235 action_array.Insert(action);
6236 }
6237 }
6238
6240 {
6241 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6242 ActionBase action = player.GetActionManager().GetAction(actionName);
6245
6246 if (action_array)
6247 {
6248 action_array.RemoveItem(action);
6249 }
6250 }
6251
6252
6253
6255 {
6256 ActionOverrideData overrideData = new ActionOverrideData();
6260
6262 if (!actionMap)
6263 {
6266 }
6267
6268 actionMap.Insert(this.
Type(), overrideData);
6269
6270 }
6271
6273
6275
6276
6278 {
6281
6284
6285 string config_to_search = "CfgVehicles";
6286 string muzzle_owner_config;
6287
6289 {
6290 if (IsInherited(Weapon))
6291 config_to_search = "CfgWeapons";
6292
6293 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6294
6295 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
6296
6297 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
6298
6299 if (config_OnFire_subclass_count > 0)
6300 {
6301 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
6302
6303 for (int i = 0; i < config_OnFire_subclass_count; i++)
6304 {
6305 string particle_class = "";
6306 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
6307 string config_OnFire_entry = config_OnFire_class + particle_class;
6308 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
6309 WPOF_array.Insert(WPOF);
6310 }
6311
6312
6314 }
6315 }
6316
6318 {
6319 config_to_search = "CfgWeapons";
6320 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6321
6322 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
6323
6324 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
6325
6326 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
6327 {
6328 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
6329
6330 for (i = 0; i < config_OnBulletCasingEject_count; i++)
6331 {
6332 string particle_class2 = "";
6333 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
6334 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
6335 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
6336 WPOBE_array.Insert(WPOBE);
6337 }
6338
6339
6341 }
6342 }
6343 }
6344
6345
6347 {
6350
6352 {
6353 string config_to_search = "CfgVehicles";
6354
6355 if (IsInherited(Weapon))
6356 config_to_search = "CfgWeapons";
6357
6358 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
6359 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
6360
6361 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
6362 {
6363
6365
6367 {
6369 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
6371 return;
6372 }
6373
6376
6377
6378
6379 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
6380 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
6381
6382 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
6383 {
6384 string particle_class = "";
6385 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
6386 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
6387 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
6388
6389 if (entry_type == CT_CLASS)
6390 {
6391 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
6392 WPOOH_array.Insert(WPOF);
6393 }
6394 }
6395
6396
6398 }
6399 }
6400 }
6401
6403 {
6405 }
6406
6408 {
6410 {
6412
6415
6418
6419 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6420 }
6421 }
6422
6424 {
6426 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6427
6429 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6430
6432 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6433
6435 {
6437 }
6438 }
6439
6441 {
6443 }
6444
6446 {
6449 else
6451
6453 {
6456 }
6457 else
6458 {
6461
6464 }
6465
6467 }
6468
6470 {
6472 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6473 }
6474
6476 {
6478 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
6480 }
6481
6483 {
6485 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
6486 }
6487
6489 {
6492
6493 OverheatingParticle OP = new OverheatingParticle();
6498
6500 }
6501
6503 {
6506
6507 return -1;
6508 }
6509
6511 {
6513 {
6516
6517 for (int i = count; i > 0; --i)
6518 {
6519 int id = i - 1;
6522
6525
6526 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
6527 {
6528 if (p)
6529 {
6532 }
6533 }
6534 }
6535 }
6536 }
6537
6539 {
6541 {
6543 {
6544 int id = i - 1;
6546
6547 if (OP)
6548 {
6550
6551 if (p)
6552 {
6554 }
6555
6556 delete OP;
6557 }
6558 }
6559
6562 }
6563 }
6564
6567 {
6568 return 0.0;
6569 }
6570
6571
6573 {
6574 return 250;
6575 }
6576
6578 {
6579 return 0;
6580 }
6581
6584 {
6586 return true;
6587
6588 return false;
6589 }
6590
6593 {
6596
6598 {
6600 }
6601 else
6602 {
6603
6605 }
6606
6608 }
6609
6616 {
6617 return -1;
6618 }
6619
6620
6621
6622
6624 {
6626 {
6627 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6628 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
6629
6630 if (r_index >= 0)
6631 {
6632 InventoryLocation r_il = new InventoryLocation;
6633 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
6634
6635 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
6638 {
6639 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
6640 }
6642 {
6643 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
6644 }
6645
6646 }
6647
6648 player.GetHumanInventory().ClearUserReservedLocation(this);
6649 }
6650
6653 }
6654
6655
6656
6657
6659 {
6660 return ItemBase.m_DebugActionsMask;
6661 }
6662
6664 {
6665 return ItemBase.m_DebugActionsMask & mask;
6666 }
6667
6669 {
6670 ItemBase.m_DebugActionsMask = mask;
6671 }
6672
6674 {
6675 ItemBase.m_DebugActionsMask |= mask;
6676 }
6677
6679 {
6680 ItemBase.m_DebugActionsMask &= ~mask;
6681 }
6682
6684 {
6686 {
6688 }
6689 else
6690 {
6692 }
6693 }
6694
6695
6697 {
6698 if (GetEconomyProfile())
6699 {
6700 float q_max = GetEconomyProfile().GetQuantityMax();
6701 if (q_max > 0)
6702 {
6703 float q_min = GetEconomyProfile().GetQuantityMin();
6704 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
6705
6707 {
6708 ComponentEnergyManager comp = GetCompEM();
6710 {
6712 }
6713 }
6715 {
6717
6718 }
6719
6720 }
6721 }
6722 }
6723
6726 {
6727 EntityAI parent = GetHierarchyParent();
6728
6729 if (parent)
6730 {
6731 InventoryLocation inventory_location_to_lock = new InventoryLocation;
6732 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
6733 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
6734 }
6735 }
6736
6739 {
6740 EntityAI parent = GetHierarchyParent();
6741
6742 if (parent)
6743 {
6744 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
6745 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
6746 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
6747 }
6748 }
6749
6751 {
6752
6753
6754
6755
6757
6759 {
6760 if (ScriptInputUserData.CanStoreInputUserData())
6761 {
6762 ScriptInputUserData ctx = new ScriptInputUserData;
6768 ctx.
Write(use_stack_max);
6771
6773 {
6774 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
6775 }
6776 }
6777 }
6778 else if (!
g_Game.IsMultiplayer())
6779 {
6781 }
6782 }
6783
6785 {
6787 }
6788
6790 {
6792 }
6793
6795 {
6797 }
6798
6800 {
6801
6802 return false;
6803 }
6804
6806 {
6807 return false;
6808 }
6809
6813 {
6814 return false;
6815 }
6816
6818 {
6819 return "";
6820 }
6821
6823
6825 {
6826 return false;
6827 }
6828
6830 {
6831 return true;
6832 }
6833
6834
6835
6837 {
6838 return true;
6839 }
6840
6842 {
6843 return true;
6844 }
6845
6847 {
6848 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
6850 }
6851
6853 {
6855 }
6856
6858 {
6860 if (!is_being_placed)
6862 SetSynchDirty();
6863 }
6864
6865
6867
6869 {
6871 }
6872
6874 {
6876 }
6877
6879 {
6880 return 1;
6881 }
6882
6884 {
6885 return false;
6886 }
6887
6889 {
6891 SetSynchDirty();
6892 }
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
6909
6910
6911
6912
6913
6914
6915
6916
6917
6918
6919
6920
6921
6922
6923
6924
6925
6926
6927
6929 {
6930 super.OnMovedInsideCargo(container);
6931
6932 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
6933 }
6934
6935 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
6936 {
6937 super.EEItemLocationChanged(oldLoc, newLoc);
6938
6939 PlayerBase newPlayer = null;
6940 PlayerBase oldPlayer = null;
6941
6942 if (newLoc.GetParent())
6943 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
6944
6945 if (oldLoc.GetParent())
6946 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
6947
6949 {
6950 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
6951
6952 if (rIndex >= 0)
6953 {
6954 InventoryLocation rIl = new InventoryLocation;
6955 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
6956
6957 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
6960 {
6961 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
6962 }
6964 {
6966 }
6967
6968 }
6969 }
6970
6972 {
6973 if (newPlayer)
6974 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
6975
6976 if (newPlayer == oldPlayer)
6977 {
6978 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
6979 {
6981 {
6982 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
6983 {
6984 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6985 }
6986 }
6987 else
6988 {
6989 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
6990 }
6991 }
6992
6993 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
6994 {
6995 int type = oldLoc.GetType();
6997 {
6998 oldLoc.GetParent().GetOnSetLock().Invoke(this);
6999 }
7001 {
7002 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7003 }
7004 }
7005 if (!m_OldLocation)
7006 {
7007 m_OldLocation = new InventoryLocation;
7008 }
7009 m_OldLocation.Copy(oldLoc);
7010 }
7011 else
7012 {
7013 if (m_OldLocation)
7014 {
7015 m_OldLocation.Reset();
7016 }
7017 }
7018
7019 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
7020 }
7021 else
7022 {
7023 if (newPlayer)
7024 {
7025 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7026 if (resIndex >= 0)
7027 {
7028 InventoryLocation il = new InventoryLocation;
7029 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
7031 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
7034 {
7035 il.
GetParent().GetOnReleaseLock().Invoke(it);
7036 }
7038 {
7040 }
7041
7042 }
7043 }
7045 {
7046
7048 }
7049
7050 if (m_OldLocation)
7051 {
7052 m_OldLocation.Reset();
7053 }
7054 }
7055
7057 {
7058 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
7059 }
7060
7062 {
7063 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
7064 }
7065 }
7066
7067 override void EOnContact(IEntity other, Contact extra)
7068 {
7070 {
7071 int liquidType = -1;
7073 if (impactSpeed > 0.0)
7074 {
7076 #ifndef SERVER
7078 #else
7080 SetSynchDirty();
7081 #endif
7083 }
7084 }
7085
7086 #ifdef SERVER
7087 if (GetCompEM() && GetCompEM().IsPlugged())
7088 {
7089 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7090 GetCompEM().UnplugThis();
7091 }
7092 #endif
7093 }
7094
7096
7098 {
7100 }
7101
7103 {
7104
7105 }
7106
7108 {
7109 super.OnItemLocationChanged(old_owner, new_owner);
7110
7111 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7112 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7113
7114 if (!relatedPlayer && playerNew)
7115 relatedPlayer = playerNew;
7116
7117 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7118 {
7120 if (actionMgr)
7121 {
7122 ActionBase currentAction = actionMgr.GetRunningAction();
7123 if (currentAction)
7125 }
7126 }
7127
7128 Man ownerPlayerOld = null;
7129 Man ownerPlayerNew = null;
7130
7131 if (old_owner)
7132 {
7133 if (old_owner.
IsMan())
7134 {
7135 ownerPlayerOld = Man.Cast(old_owner);
7136 }
7137 else
7138 {
7139 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7140 }
7141 }
7142 else
7143 {
7145 {
7147
7148 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7149 {
7150 GetCompEM().UnplugThis();
7151 }
7152 }
7153 }
7154
7155 if (new_owner)
7156 {
7157 if (new_owner.
IsMan())
7158 {
7159 ownerPlayerNew = Man.Cast(new_owner);
7160 }
7161 else
7162 {
7163 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7164 }
7165 }
7166
7167 if (ownerPlayerOld != ownerPlayerNew)
7168 {
7169 if (ownerPlayerOld)
7170 {
7171 array<EntityAI> subItemsExit = new array<EntityAI>;
7173 for (int i = 0; i < subItemsExit.Count(); i++)
7174 {
7177 }
7178 }
7179
7180 if (ownerPlayerNew)
7181 {
7182 array<EntityAI> subItemsEnter = new array<EntityAI>;
7184 for (int j = 0; j < subItemsEnter.Count(); j++)
7185 {
7188 }
7189 }
7190 }
7191 else if (ownerPlayerNew != null)
7192 {
7193 PlayerBase nplayer;
7194 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7195 {
7196 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7198 for (int k = 0; k < subItemsUpdate.Count(); k++)
7199 {
7201 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7202 }
7203 }
7204 }
7205
7206 if (old_owner)
7207 old_owner.OnChildItemRemoved(this);
7208 if (new_owner)
7209 new_owner.OnChildItemReceived(this);
7210 }
7211
7212
7214 {
7215 super.EEDelete(parent);
7216 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
7217 if (player)
7218 {
7220
7221 if (player.IsAlive())
7222 {
7223 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7224 if (r_index >= 0)
7225 {
7226 InventoryLocation r_il = new InventoryLocation;
7227 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7228
7229 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7232 {
7233 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7234 }
7236 {
7237 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7238 }
7239
7240 }
7241
7242 player.RemoveQuickBarEntityShortcut(this);
7243 }
7244 }
7245 }
7246
7248 {
7249 super.EEKilled(killer);
7250
7253 {
7254 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
7255 {
7256 if (IsMagazine())
7257 {
7258 if (Magazine.Cast(this).GetAmmoCount() > 0)
7259 {
7261 }
7262 }
7263 else
7264 {
7266 }
7267 }
7268 }
7269 }
7270
7272 {
7273 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7274
7275 super.OnWasAttached(parent, slot_id);
7276
7279
7282 }
7283
7285 {
7286 super.OnWasDetached(parent, slot_id);
7287
7290
7293 }
7294
7296 {
7297 int idx;
7300
7301 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7302 if (inventory_slots.Count() < 1)
7303 {
7304 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
7305 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
7306 }
7307 else
7308 {
7309 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
7310 }
7311
7312 idx = inventory_slots.Find(slot);
7313 if (idx < 0)
7314 return "";
7315
7316 return attach_types.Get(idx);
7317 }
7318
7320 {
7321 int idx = -1;
7322 string slot;
7323
7326
7327 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
7328 if (inventory_slots.Count() < 1)
7329 {
7330 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
7331 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7332 }
7333 else
7334 {
7335 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
7336 if (detach_types.Count() < 1)
7337 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
7338 }
7339
7340 for (int i = 0; i < inventory_slots.Count(); i++)
7341 {
7342 slot = inventory_slots.Get(i);
7343 }
7344
7345 if (slot != "")
7346 {
7347 if (detach_types.Count() == 1)
7348 idx = 0;
7349 else
7350 idx = inventory_slots.Find(slot);
7351 }
7352 if (idx < 0)
7353 return "";
7354
7355 return detach_types.Get(idx);
7356 }
7357
7359 {
7360
7362
7363
7364 float min_time = 1;
7365 float max_time = 3;
7366 float delay = Math.RandomFloat(min_time, max_time);
7367
7368 explode_timer.Run(delay, this, "DoAmmoExplosion");
7369 }
7370
7372 {
7373 Magazine magazine = Magazine.Cast(this);
7374 int pop_sounds_count = 6;
7375 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
7376
7377
7378 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
7379 string sound_name = pop_sounds[ sound_idx ];
7380 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
7381
7382
7383 magazine.ServerAddAmmoCount(-1);
7384
7385
7386 float min_temp_to_explode = 100;
7387
7388 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
7389 {
7391 }
7392 }
7393
7394
7395 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
7396 {
7397 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
7398
7399 const int CHANCE_DAMAGE_CARGO = 4;
7400 const int CHANCE_DAMAGE_ATTACHMENT = 1;
7401 const int CHANCE_DAMAGE_NOTHING = 2;
7402
7404 {
7405 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
7406 int chances;
7407 int rnd;
7408
7409 if (GetInventory().GetCargo())
7410 {
7411 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7412 rnd = Math.RandomInt(0,chances);
7413
7414 if (rnd < CHANCE_DAMAGE_CARGO)
7415 {
7417 }
7418 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
7419 {
7421 }
7422 }
7423 else
7424 {
7425 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
7426 rnd = Math.RandomInt(0,chances);
7427
7428 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
7429 {
7431 }
7432 }
7433 }
7434 }
7435
7437 {
7438 CargoBase cargo = GetInventory().GetCargo();
7439 if (cargo)
7440 {
7442 if (item_count > 0)
7443 {
7444 int random_pick = Math.RandomInt(0, item_count);
7446 if (!item.IsExplosive())
7447 {
7448 item.AddHealth("","",damage);
7449 return true;
7450 }
7451 }
7452 }
7453 return false;
7454 }
7455
7457 {
7458 GameInventory inventory = GetInventory();
7460 if (attachment_count > 0)
7461 {
7462 int random_pick = Math.RandomInt(0, attachment_count);
7464 if (!attachment.IsExplosive())
7465 {
7466 attachment.AddHealth("","",damage);
7467 return true;
7468 }
7469 }
7470 return false;
7471 }
7472
7474 {
7476 }
7477
7479 {
7481 return GetInventory().CanRemoveEntity();
7482
7483 return false;
7484 }
7485
7487 {
7488
7490 return false;
7491
7492
7494 return false;
7495
7496
7497
7499 if (delta == 0)
7500 return false;
7501
7502
7503 return true;
7504 }
7505
7507 {
7509 {
7510 if (ScriptInputUserData.CanStoreInputUserData())
7511 {
7512 ScriptInputUserData ctx = new ScriptInputUserData;
7517 ctx.
Write(destination_entity);
7521 }
7522 }
7523 else if (!
g_Game.IsMultiplayer())
7524 {
7526 }
7527 }
7528
7530 {
7531 float split_quantity_new;
7535 InventoryLocation loc = new InventoryLocation;
7536
7537 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7538 {
7540 split_quantity_new = stack_max;
7541 else
7543
7545 {
7546 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7547 if (new_item)
7548 {
7549 new_item.SetResultOfSplit(true);
7550 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7552 new_item.
SetQuantity(split_quantity_new,
false,
true);
7553 }
7554 }
7555 }
7556 else if (destination_entity && slot_id == -1)
7557 {
7558 if (quantity > stack_max)
7559 split_quantity_new = stack_max;
7560 else
7561 split_quantity_new = quantity;
7562
7564 {
7565 GameInventory destinationInventory = destination_entity.GetInventory();
7567 {
7570 }
7571
7572 if (new_item)
7573 {
7574 new_item.SetResultOfSplit(true);
7575 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7577 new_item.
SetQuantity(split_quantity_new,
false,
true);
7578 }
7579 }
7580 }
7581 else
7582 {
7583 if (stack_max != 0)
7584 {
7586 {
7588 }
7589
7590 if (split_quantity_new == 0)
7591 {
7592 if (!
g_Game.IsMultiplayer())
7593 player.PhysicalPredictiveDropItem(this);
7594 else
7595 player.ServerDropEntity(this);
7596 return;
7597 }
7598
7600 {
7602
7603 if (new_item)
7604 {
7605 new_item.SetResultOfSplit(true);
7606 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7609 new_item.PlaceOnSurface();
7610 }
7611 }
7612 }
7613 }
7614 }
7615
7617 {
7618 float split_quantity_new;
7622 InventoryLocation loc = new InventoryLocation;
7623
7624 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
7625 {
7627 split_quantity_new = stack_max;
7628 else
7630
7632 {
7633 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
7634 if (new_item)
7635 {
7636 new_item.SetResultOfSplit(true);
7637 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7639 new_item.
SetQuantity(split_quantity_new,
false,
true);
7640 }
7641 }
7642 }
7643 else if (destination_entity && slot_id == -1)
7644 {
7645 if (quantity > stack_max)
7646 split_quantity_new = stack_max;
7647 else
7648 split_quantity_new = quantity;
7649
7651 {
7652 GameInventory destinationInventory = destination_entity.GetInventory();
7654 {
7657 }
7658
7659 if (new_item)
7660 {
7661 new_item.SetResultOfSplit(true);
7662 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7664 new_item.
SetQuantity(split_quantity_new,
false,
true);
7665 }
7666 }
7667 }
7668 else
7669 {
7670 if (stack_max != 0)
7671 {
7673 {
7675 }
7676
7678 {
7680
7681 if (new_item)
7682 {
7683 new_item.SetResultOfSplit(true);
7684 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7687 new_item.PlaceOnSurface();
7688 }
7689 }
7690 }
7691 }
7692 }
7693
7695 {
7697 {
7698 if (ScriptInputUserData.CanStoreInputUserData())
7699 {
7700 ScriptInputUserData ctx = new ScriptInputUserData;
7705 dst.WriteToContext(ctx);
7707 }
7708 }
7709 else if (!
g_Game.IsMultiplayer())
7710 {
7712 }
7713 }
7714
7716 {
7718 {
7719 if (ScriptInputUserData.CanStoreInputUserData())
7720 {
7721 ScriptInputUserData ctx = new ScriptInputUserData;
7726 ctx.
Write(destination_entity);
7732 }
7733 }
7734 else if (!
g_Game.IsMultiplayer())
7735 {
7737 }
7738 }
7739
7741 {
7743 }
7744
7746 {
7748 float split_quantity_new;
7750 if (dst.IsValid())
7751 {
7752 int slot_id = dst.GetSlot();
7754
7755 if (quantity > stack_max)
7756 split_quantity_new = stack_max;
7757 else
7758 split_quantity_new = quantity;
7759
7761 {
7763
7764 if (new_item)
7765 {
7766 new_item.SetResultOfSplit(true);
7767 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7769 new_item.
SetQuantity(split_quantity_new,
false,
true);
7770 }
7771
7772 return new_item;
7773 }
7774 }
7775
7776 return null;
7777 }
7778
7780 {
7782 float split_quantity_new;
7784 if (destination_entity)
7785 {
7787 if (quantity > stackable)
7788 split_quantity_new = stackable;
7789 else
7790 split_quantity_new = quantity;
7791
7793 {
7794 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
7795 if (new_item)
7796 {
7797 new_item.SetResultOfSplit(true);
7798 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7800 new_item.
SetQuantity(split_quantity_new,
false,
true);
7801 }
7802 }
7803 }
7804 }
7805
7807 {
7809 {
7810 if (ScriptInputUserData.CanStoreInputUserData())
7811 {
7812 ScriptInputUserData ctx = new ScriptInputUserData;
7817 ItemBase destination_entity =
this;
7818 ctx.
Write(destination_entity);
7822 }
7823 }
7824 else if (!
g_Game.IsMultiplayer())
7825 {
7827 }
7828 }
7829
7831 {
7833 float split_quantity_new;
7835 if (player)
7836 {
7838 if (quantity > stackable)
7839 split_quantity_new = stackable;
7840 else
7841 split_quantity_new = quantity;
7842
7844 {
7845 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
7846 new_item =
ItemBase.Cast(in_hands);
7847 if (new_item)
7848 {
7849 new_item.SetResultOfSplit(true);
7850 MiscGameplayFunctions.TransferItemProperties(this,new_item);
7852 new_item.SetQuantity(split_quantity_new, false, true);
7853 }
7854 }
7855 }
7856 }
7857
7859 {
7861 float split_quantity_new = Math.Floor(quantity * 0.5);
7862
7864 return;
7865
7867
7868 if (new_item)
7869 {
7870 if (new_item.GetQuantityMax() < split_quantity_new)
7871 {
7872 split_quantity_new = new_item.GetQuantityMax();
7873 }
7874
7875 new_item.SetResultOfSplit(true);
7876 MiscGameplayFunctions.TransferItemProperties(this, new_item);
7877
7879 {
7882 }
7883 else
7884 {
7886 new_item.
SetQuantity(split_quantity_new,
false,
true);
7887 }
7888 }
7889 }
7890
7892 {
7894 float split_quantity_new = Math.Floor(quantity / 2);
7895
7897 return;
7898
7899 InventoryLocation invloc = new InventoryLocation;
7901
7903 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
7904
7905 if (new_item)
7906 {
7907 if (new_item.GetQuantityMax() < split_quantity_new)
7908 {
7909 split_quantity_new = new_item.GetQuantityMax();
7910 }
7912 {
7915 }
7916 else if (split_quantity_new > 1)
7917 {
7919 new_item.
SetQuantity(split_quantity_new,
false,
true);
7920 }
7921 }
7922 }
7923
7926 {
7927 SetWeightDirty();
7929
7930 if (parent)
7931 parent.OnAttachmentQuantityChangedEx(this, delta);
7932
7934 {
7936 {
7938 }
7940 {
7941 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
7943 }
7944 }
7945 }
7946
7949 {
7950
7951 }
7952
7955 {
7957 }
7958
7960 {
7961 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
7962
7964 {
7965 if (newLevel == GameConstants.STATE_RUINED)
7966 {
7968 EntityAI parent = GetHierarchyParent();
7969 if (parent && parent.IsFireplace())
7970 {
7971 CargoBase cargo = GetInventory().GetCargo();
7972 if (cargo)
7973 {
7975 {
7977 }
7978 }
7979 }
7980 }
7981
7983 {
7984
7986 return;
7987 }
7988
7989 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
7990 {
7992 }
7993 }
7994 }
7995
7996
7998 {
7999 super.OnRightClick();
8000
8002 {
8004 {
8005 if (ScriptInputUserData.CanStoreInputUserData())
8006 {
8007 EntityAI root = GetHierarchyRoot();
8008 Man playerOwner = GetHierarchyRootPlayer();
8009 InventoryLocation dst = new InventoryLocation;
8010
8011
8012 if (!playerOwner && root && root == this)
8013 {
8015 }
8016 else
8017 {
8018
8019 GetInventory().GetCurrentInventoryLocation(dst);
8021 {
8022 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8024 {
8026 }
8027 else
8028 {
8030
8031
8032 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8033 {
8035 }
8036 else
8037 {
8038 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8039 }
8040 }
8041 }
8042 }
8043
8044 ScriptInputUserData ctx = new ScriptInputUserData;
8052 }
8053 }
8054 else if (!
g_Game.IsMultiplayer())
8055 {
8057 }
8058 }
8059 }
8060
8062 {
8063 if (root)
8064 {
8065 vector m4[4];
8066 root.GetTransform(m4);
8067 dst.SetGround(this, m4);
8068 }
8069 else
8070 {
8071 GetInventory().GetCurrentInventoryLocation(dst);
8072 }
8073 }
8074
8075 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8076 {
8077
8078 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8079 return false;
8080
8081 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8082 return false;
8083
8084
8086 return false;
8087
8088
8089 Magazine mag = Magazine.Cast(this);
8090 if (mag)
8091 {
8092 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8093 return false;
8094
8095 if (stack_max_limit)
8096 {
8097 Magazine other_mag = Magazine.Cast(other_item);
8098 if (other_item)
8099 {
8100 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8101 return false;
8102 }
8103
8104 }
8105 }
8106 else
8107 {
8108
8110 return false;
8111
8113 return false;
8114 }
8115
8116 PlayerBase player = null;
8117 if (CastTo(player, GetHierarchyRootPlayer()))
8118 {
8119 if (player.GetInventory().HasAttachment(this))
8120 return false;
8121
8122 if (player.IsItemsToDelete())
8123 return false;
8124 }
8125
8126 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8127 return false;
8128
8129 int slotID;
8131 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8132 return false;
8133
8134 return true;
8135 }
8136
8138 {
8140 }
8141
8143 {
8144 return m_IsResultOfSplit;
8145 }
8146
8148 {
8149 m_IsResultOfSplit = value;
8150 }
8151
8153 {
8155 }
8156
8158 {
8159 float other_item_quantity = other_item.GetQuantity();
8160 float this_free_space;
8161
8163
8165
8166 if (other_item_quantity > this_free_space)
8167 {
8168 return this_free_space;
8169 }
8170 else
8171 {
8172 return other_item_quantity;
8173 }
8174 }
8175
8177 {
8179 }
8180
8182 {
8184 return;
8185
8186 if (!IsMagazine() && other_item)
8187 {
8189 if (quantity_used != 0)
8190 {
8191 float hp1 = GetHealth01("","");
8192 float hp2 = other_item.GetHealth01("","");
8193 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8194 hpResult = hpResult / (
GetQuantity() + quantity_used);
8195
8196 hpResult *= GetMaxHealth();
8197 Math.Round(hpResult);
8198 SetHealth("", "Health", hpResult);
8199
8201 other_item.AddQuantity(-quantity_used);
8202 }
8203 }
8205 }
8206
8208 {
8209 #ifdef SERVER
8210 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8211 GetHierarchyParent().IncreaseLifetimeUp();
8212 #endif
8213 };
8214
8216 {
8217 PlayerBase p = PlayerBase.Cast(player);
8218
8219 array<int> recipesIds = p.m_Recipes;
8220 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8221 if (moduleRecipesManager)
8222 {
8223 EntityAI itemInHands = player.GetEntityInHands();
8224 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8225 }
8226
8227 for (int i = 0;i < recipesIds.Count(); i++)
8228 {
8229 int key = recipesIds.Get(i);
8230 string recipeName = moduleRecipesManager.GetRecipeName(key);
8232 }
8233 }
8234
8235
8236 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
8237 {
8238 super.GetDebugActions(outputList);
8239
8240
8246
8247
8252
8257
8258
8262
8263
8265 {
8269 }
8270
8273
8274
8278
8280
8281 InventoryLocation loc = new InventoryLocation();
8282 GetInventory().GetCurrentInventoryLocation(loc);
8284 {
8285 if (Gizmo_IsSupported())
8288 }
8289
8291 }
8292
8293
8294
8295
8297 {
8298 super.OnAction(action_id, player, ctx);
8299
8301 {
8302 switch (action_id)
8303 {
8307 return true;
8311 return true;
8312 }
8313 }
8314
8316 {
8317 switch (action_id)
8318 {
8320 Delete();
8321 return true;
8322 }
8323 }
8324
8325 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
8326 {
8327 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8328 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
8329 PlayerBase p = PlayerBase.Cast(player);
8330 if (
EActions.RECIPES_RANGE_START < 1000)
8331 {
8332 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
8333 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
8334 }
8335 }
8336 #ifndef SERVER
8337 else if (action_id ==
EActions.WATCH_PLAYER)
8338 {
8339 PluginDeveloper.SetDeveloperItemClientEx(player);
8340 }
8341 #endif
8343 {
8344 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
8345 {
8346 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
8347 OnDebugButtonPressServer(id + 1);
8348 }
8349
8350 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
8351 {
8352 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
8354 }
8355
8356 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
8357 {
8358 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
8360 }
8361
8362 else if (action_id ==
EActions.ADD_QUANTITY)
8363 {
8364 if (IsMagazine())
8365 {
8366 Magazine mag = Magazine.Cast(this);
8367 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
8368 }
8369 else
8370 {
8372 }
8373
8374 if (m_EM)
8375 {
8376 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
8377 }
8378
8379 }
8380
8381 else if (action_id ==
EActions.REMOVE_QUANTITY)
8382 {
8383 if (IsMagazine())
8384 {
8385 Magazine mag2 = Magazine.Cast(this);
8386 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
8387 }
8388 else
8389 {
8391 }
8392 if (m_EM)
8393 {
8394 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
8395 }
8396
8397 }
8398
8399 else if (action_id ==
EActions.SET_QUANTITY_0)
8400 {
8402
8403 if (m_EM)
8404 {
8405 m_EM.SetEnergy(0);
8406 }
8407 }
8408
8409 else if (action_id ==
EActions.SET_MAX_QUANTITY)
8410 {
8412
8413 if (m_EM)
8414 {
8415 m_EM.SetEnergy(m_EM.GetEnergyMax());
8416 }
8417 }
8418
8419 else if (action_id ==
EActions.ADD_HEALTH)
8420 {
8421 AddHealth("","",GetMaxHealth("","Health")/5);
8422 }
8423 else if (action_id ==
EActions.REMOVE_HEALTH)
8424 {
8425 AddHealth("","",-GetMaxHealth("","Health")/5);
8426 }
8427 else if (action_id ==
EActions.DESTROY_HEALTH)
8428 {
8429 SetHealth01("","",0);
8430 }
8431 else if (action_id ==
EActions.WATCH_ITEM)
8432 {
8434 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
8435 #ifdef DEVELOPER
8436 SetDebugDeveloper_item(this);
8437 #endif
8438 }
8439
8440 else if (action_id ==
EActions.ADD_TEMPERATURE)
8441 {
8442 AddTemperature(20);
8443
8444 }
8445
8446 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
8447 {
8448 AddTemperature(-20);
8449
8450 }
8451
8452 else if (action_id ==
EActions.FLIP_FROZEN)
8453 {
8454 SetFrozen(!GetIsFrozen());
8455
8456 }
8457
8458 else if (action_id ==
EActions.ADD_WETNESS)
8459 {
8461
8462 }
8463
8464 else if (action_id ==
EActions.REMOVE_WETNESS)
8465 {
8467
8468 }
8469
8470 else if (action_id ==
EActions.LIQUIDTYPE_UP)
8471 {
8474
8475
8476 }
8477
8478 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
8479 {
8482 }
8483
8484 else if (action_id ==
EActions.MAKE_SPECIAL)
8485 {
8486 auto debugParams = DebugSpawnParams.WithPlayer(player);
8487 OnDebugSpawnEx(debugParams);
8488 }
8489
8490 }
8491
8492
8493 return false;
8494 }
8495
8496
8497
8498
8502
8505
8506
8507
8509 {
8510 return false;
8511 }
8512
8513
8515 {
8516 return true;
8517 }
8518
8519
8521 {
8522 return true;
8523 }
8524
8525
8526
8528 {
8529 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
8530 return g_Game.ConfigIsExisting(config_path);
8531 }
8532
8535 {
8536 return null;
8537 }
8538
8540 {
8541 return false;
8542 }
8543
8545 {
8546 return false;
8547 }
8548
8552
8553
8555 {
8556 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8557 return module_repairing.CanRepair(this, item_repair_kit);
8558 }
8559
8560
8561 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
8562 {
8563 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
8564 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
8565 }
8566
8567
8569 {
8570
8571
8572
8573
8574
8575
8576
8577
8578 return 1;
8579 }
8580
8581
8582
8584 {
8586 }
8587
8588
8589
8591 {
8593 }
8594
8595
8604 {
8605 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8606
8607 if (player)
8608 {
8609 player.MessageStatus(text);
8610 }
8611 }
8612
8613
8622 {
8623 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8624
8625 if (player)
8626 {
8627 player.MessageAction(text);
8628 }
8629 }
8630
8631
8640 {
8641 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8642
8643 if (player)
8644 {
8645 player.MessageFriendly(text);
8646 }
8647 }
8648
8649
8658 {
8659 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
8660
8661 if (player)
8662 {
8663 player.MessageImportant(text);
8664 }
8665 }
8666
8668 {
8669 return true;
8670 }
8671
8672
8673 override bool KindOf(
string tag)
8674 {
8675 bool found = false;
8676 string item_name = this.
GetType();
8678 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
8679
8680 int array_size = item_tag_array.Count();
8681 for (int i = 0; i < array_size; i++)
8682 {
8683 if (item_tag_array.Get(i) == tag)
8684 {
8685 found = true;
8686 break;
8687 }
8688 }
8689 return found;
8690 }
8691
8692
8694 {
8695
8696 super.OnRPC(sender, rpc_type,ctx);
8697
8698
8699 switch (rpc_type)
8700 {
8701 #ifndef SERVER
8702 case ERPCs.RPC_SOUND_LOCK_ATTACH:
8703 Param2<bool, string> p = new Param2<bool, string>(false, "");
8704
8706 return;
8707
8708 bool play = p.param1;
8709 string soundSet = p.param2;
8710
8711 if (play)
8712 {
8714 {
8716 {
8718 }
8719 }
8720 else
8721 {
8723 }
8724 }
8725 else
8726 {
8728 }
8729
8730 break;
8731 #endif
8732
8733 }
8734
8736 {
8738 }
8739 }
8740
8741
8742
8743
8745 {
8746 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8747 return plugin.GetID(
name);
8748 }
8749
8751 {
8752 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
8753 return plugin.GetName(id);
8754 }
8755
8758 {
8759
8760
8761 int varFlags;
8762 if (!ctx.
Read(varFlags))
8763 return;
8764
8765 if (varFlags & ItemVariableFlags.FLOAT)
8766 {
8768 }
8769 }
8770
8772 {
8773
8774 super.SerializeNumericalVars(floats_out);
8775
8776
8777
8779 {
8781 }
8782
8784 {
8786 }
8787
8789 {
8791 }
8792
8794 {
8799 }
8800
8802 {
8804 }
8805 }
8806
8808 {
8809
8810 super.DeSerializeNumericalVars(floats);
8811
8812
8813 int index = 0;
8814 int mask = Math.Round(floats.Get(index));
8815
8816 index++;
8817
8819 {
8821 {
8823 }
8824 else
8825 {
8826 float quantity = floats.Get(index);
8828 }
8829 index++;
8830 }
8831
8833 {
8834 float wet = floats.Get(index);
8836 index++;
8837 }
8838
8840 {
8841 int liquidtype = Math.Round(floats.Get(index));
8843 index++;
8844 }
8845
8847 {
8849 index++;
8851 index++;
8853 index++;
8855 index++;
8856 }
8857
8859 {
8860 int cleanness = Math.Round(floats.Get(index));
8862 index++;
8863 }
8864 }
8865
8867 {
8868 super.WriteVarsToCTX(ctx);
8869
8870
8872 {
8874 }
8875
8877 {
8879 }
8880
8882 {
8884 }
8885
8887 {
8888 int r,g,b,a;
8894 }
8895
8897 {
8899 }
8900 }
8901
8903 {
8904 if (!super.ReadVarsFromCTX(ctx,version))
8905 return false;
8906
8907 int intValue;
8908 float value;
8909
8910 if (version < 140)
8911 {
8912 if (!ctx.
Read(intValue))
8913 return false;
8914
8915 m_VariablesMask = intValue;
8916 }
8917
8919 {
8920 if (!ctx.
Read(value))
8921 return false;
8922
8924 {
8926 }
8927 else
8928 {
8930 }
8931 }
8932
8933 if (version < 140)
8934 {
8936 {
8937 if (!ctx.
Read(value))
8938 return false;
8939 SetTemperatureDirect(value);
8940 }
8941 }
8942
8944 {
8945 if (!ctx.
Read(value))
8946 return false;
8948 }
8949
8951 {
8952 if (!ctx.
Read(intValue))
8953 return false;
8955 }
8956
8958 {
8959 int r,g,b,a;
8961 return false;
8963 return false;
8965 return false;
8967 return false;
8968
8970 }
8971
8973 {
8974 if (!ctx.
Read(intValue))
8975 return false;
8977 }
8978
8979 if (version >= 138 && version < 140)
8980 {
8982 {
8983 if (!ctx.
Read(intValue))
8984 return false;
8985 SetFrozen(intValue);
8986 }
8987 }
8988
8989 return true;
8990 }
8991
8992
8994 {
8997 {
8999 }
9000
9001 if (!super.OnStoreLoad(ctx, version))
9002 {
9004 return false;
9005 }
9006
9007 if (version >= 114)
9008 {
9009 bool hasQuickBarIndexSaved;
9010
9011 if (!ctx.
Read(hasQuickBarIndexSaved))
9012 {
9014 return false;
9015 }
9016
9017 if (hasQuickBarIndexSaved)
9018 {
9019 int itmQBIndex;
9020
9021
9022 if (!ctx.
Read(itmQBIndex))
9023 {
9025 return false;
9026 }
9027
9028 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9029 if (itmQBIndex != -1 && parentPlayer)
9030 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9031 }
9032 }
9033 else
9034 {
9035
9036 PlayerBase player;
9037 int itemQBIndex;
9038 if (version ==
int.
MAX)
9039 {
9040 if (!ctx.
Read(itemQBIndex))
9041 {
9043 return false;
9044 }
9045 }
9046 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9047 {
9048
9049 if (!ctx.
Read(itemQBIndex))
9050 {
9052 return false;
9053 }
9054 if (itemQBIndex != -1 && player)
9055 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9056 }
9057 }
9058
9059 if (version < 140)
9060 {
9061
9062 if (!LoadVariables(ctx, version))
9063 {
9065 return false;
9066 }
9067 }
9068
9069
9071 {
9073 return false;
9074 }
9075 if (version >= 132)
9076 {
9078 if (raib)
9079 {
9081 {
9083 return false;
9084 }
9085 }
9086 }
9087
9089 return true;
9090 }
9091
9092
9093
9095 {
9096 super.OnStoreSave(ctx);
9097
9098 PlayerBase player;
9099 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9100 {
9102
9103 int itemQBIndex = -1;
9104 itemQBIndex = player.FindQuickBarEntityIndex(this);
9105 ctx.
Write(itemQBIndex);
9106 }
9107 else
9108 {
9110 }
9111
9113
9115 if (raib)
9116 {
9118 }
9119 }
9120
9121
9123 {
9124 super.AfterStoreLoad();
9125
9127 {
9129 }
9130
9132 {
9135 }
9136 }
9137
9139 {
9140 super.EEOnAfterLoad();
9141
9143 {
9145 }
9146
9149 }
9150
9152 {
9153 return false;
9154 }
9155
9156
9157
9159 {
9161 {
9162 #ifdef PLATFORM_CONSOLE
9163
9165 {
9167 if (menu)
9168 {
9170 }
9171 }
9172 #endif
9173 }
9174
9176 {
9179 }
9180
9182 {
9183 SetWeightDirty();
9185 }
9187 {
9190 }
9191
9193 {
9196
9199 }
9201 {
9205 }
9206
9207 super.OnVariablesSynchronized();
9208 }
9209
9210
9211
9213 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9214 {
9215 if (!IsServerCheck(allow_client))
9216 return false;
9217
9219 return false;
9220
9223
9224 if (value <= (min + 0.001))
9225 value = min;
9226
9227 if (value == min)
9228 {
9229 if (destroy_config)
9230 {
9231 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9232 if (dstr)
9233 {
9235 this.Delete();
9236 return true;
9237 }
9238 }
9239 else if (destroy_forced)
9240 {
9242 this.Delete();
9243 return true;
9244 }
9245
9247 }
9248
9251
9253 {
9254 EntityAI parent = GetHierarchyRoot();
9255 InventoryLocation iLoc = new InventoryLocation();
9256 GetInventory().GetCurrentInventoryLocation(iLoc);
9258 {
9259 int iLocSlot = iLoc.
GetSlot();
9261 {
9263 }
9265 {
9267 }
9268 }
9269 }
9270
9272 {
9274
9275 if (delta)
9277 }
9278
9280
9281 return false;
9282 }
9283
9284
9286 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9287 {
9289 }
9290
9292 {
9295 }
9296
9298 {
9301 }
9302
9304 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9305 {
9306 float value_clamped = Math.Clamp(value, 0, 1);
9308 SetQuantity(result, destroy_config, destroy_forced);
9309 }
9310
9311
9314 {
9316 }
9317
9319 {
9321 }
9322
9323
9324
9325
9326
9327
9328
9329
9330
9331
9333 {
9334 int slot = -1;
9335 GameInventory inventory = GetInventory();
9336 if (inventory)
9337 {
9338 InventoryLocation il = new InventoryLocation;
9341 }
9342
9344 }
9345
9347 {
9348 float quantity_max = 0;
9349
9351 {
9352 if (attSlotID != -1)
9353 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
9354
9355 if (quantity_max <= 0)
9357 }
9358
9359 if (quantity_max <= 0)
9361
9362 return quantity_max;
9363 }
9364
9366 {
9368 }
9369
9371 {
9373 }
9374
9375
9377 {
9379 }
9380
9382 {
9384 }
9385
9387 {
9389 }
9390
9391
9393 {
9394
9395 float weightEx = GetWeightEx();
9396 float special = GetInventoryAndCargoWeight();
9397 return weightEx - special;
9398 }
9399
9400
9402 {
9404 }
9405
9407 {
9409 {
9410 #ifdef DEVELOPER
9411 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9412 {
9413 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
9415 }
9416 #endif
9417
9419 }
9420 else if (HasEnergyManager())
9421 {
9422 #ifdef DEVELOPER
9423 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9424 {
9425 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
9426 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
9427 }
9428 #endif
9429 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
9430 }
9431 else
9432 {
9433 #ifdef DEVELOPER
9434 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
9435 {
9436 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
9437 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
9438 }
9439 #endif
9440 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
9441 }
9442 }
9443
9446 {
9447 int item_count = 0;
9449
9450 GameInventory inventory = GetInventory();
9451 CargoBase cargo = inventory.
GetCargo();
9452 if (cargo != NULL)
9453 {
9455 }
9456
9458 for (int i = 0; i < nAttachments; ++i)
9459 {
9461 if (item)
9462 item_count += item.GetNumberOfItems();
9463 }
9464 return item_count;
9465 }
9466
9469 {
9470 float weight = 0;
9471 float wetness = 1;
9472 if (include_wetness)
9475 {
9476 weight = wetness * m_ConfigWeight;
9477 }
9479 {
9480 weight = 1;
9481 }
9482 return weight;
9483 }
9484
9485
9486
9488 {
9489 GameInventory inventory = GetInventory();
9490 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
9491 {
9492 array<EntityAI> items = new array<EntityAI>;
9494 for (int i = 0; i < items.Count(); ++i)
9495 {
9497 if (item)
9498 {
9499 g_Game.ObjectDelete(item);
9500 }
9501 }
9502 }
9503 }
9504
9505
9506
9507
9509 {
9510 float energy = 0;
9511 if (HasEnergyManager())
9512 {
9513 energy = GetCompEM().GetEnergy();
9514 }
9515 return energy;
9516 }
9517
9518
9520 {
9521 super.OnEnergyConsumed();
9522
9524 }
9525
9527 {
9528 super.OnEnergyAdded();
9529
9531 }
9532
9533
9535 {
9536 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
9537 {
9539 {
9540 float energy_0to1 = GetCompEM().GetEnergy0To1();
9542 }
9543 }
9544 }
9545
9546
9548 {
9549 return ConfigGetFloat("heatIsolation");
9550 }
9551
9553 {
9555 }
9556
9558 {
9559 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
9560 if (
g_Game.ConfigIsExisting(paramPath))
9561 return g_Game.ConfigGetFloat(paramPath);
9562
9563 return 0.0;
9564 }
9565
9567 {
9568 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
9569 if (
g_Game.ConfigIsExisting(paramPath))
9570 return g_Game.ConfigGetFloat(paramPath);
9571
9572 return 0.0;
9573 }
9574
9575 override void SetWet(
float value,
bool allow_client =
false)
9576 {
9577 if (!IsServerCheck(allow_client))
9578 return;
9579
9582
9584
9585 m_VarWet = Math.Clamp(value, min, max);
9586
9588 {
9591 }
9592 }
9593
9594 override void AddWet(
float value)
9595 {
9597 }
9598
9600 {
9602 }
9603
9605 {
9607 }
9608
9610 {
9612 }
9613
9615 {
9617 }
9618
9620 {
9622 }
9623
9625 {
9628 if (newLevel != oldLevel)
9629 {
9631 }
9632 }
9633
9635 {
9636 SetWeightDirty();
9637 }
9638
9640 {
9641 return GetWetLevelInternal(
m_VarWet);
9642 }
9643
9644
9645
9647 {
9649 }
9650
9652 {
9654 }
9655
9657 {
9659 }
9660
9662 {
9664 }
9665
9666
9667
9669 {
9670 if (ConfigIsExisting("itemModelLength"))
9671 {
9672 return ConfigGetFloat("itemModelLength");
9673 }
9674 return 0;
9675 }
9676
9678 {
9679 if (ConfigIsExisting("itemAttachOffset"))
9680 {
9681 return ConfigGetFloat("itemAttachOffset");
9682 }
9683 return 0;
9684 }
9685
9686 override void SetCleanness(
int value,
bool allow_client =
false)
9687 {
9688 if (!IsServerCheck(allow_client))
9689 return;
9690
9692
9694
9697 }
9698
9700 {
9702 }
9703
9705 {
9706 return true;
9707 }
9708
9709
9710
9711
9713 {
9715 }
9716
9718 {
9720 }
9721
9722
9723
9724
9725 override void SetColor(
int r,
int g,
int b,
int a)
9726 {
9732 }
9734 override void GetColor(out
int r,out
int g,out
int b,out
int a)
9735 {
9740 }
9741
9743 {
9745 }
9746
9749 {
9750 int r,g,b,a;
9752 r = r/255;
9753 g = g/255;
9754 b = b/255;
9755 a = a/255;
9756 return MiscGameplayFunctions.GetColorString(r, g, b, a);
9757 }
9758
9759
9760
9761 override void SetLiquidType(
int value,
bool allow_client =
false)
9762 {
9763 if (!IsServerCheck(allow_client))
9764 return;
9765
9770 }
9771
9773 {
9774 return ConfigGetInt("varLiquidTypeInit");
9775 }
9776
9778 {
9780 }
9781
9783 {
9785 SetFrozen(false);
9786 }
9787
9790 {
9791 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9792 }
9793
9794
9797 {
9798 PlayerBase nplayer;
9799 if (PlayerBase.CastTo(nplayer, player))
9800 {
9802 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
9803 }
9804 }
9805
9806
9809 {
9810 PlayerBase nplayer;
9811 if (PlayerBase.CastTo(nplayer,player))
9812 {
9813 nplayer.SetEnableQuickBarEntityShortcut(this, false);
9814 }
9815
9816 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
9817
9818 if (HasEnergyManager())
9819 {
9820 GetCompEM().UpdatePlugState();
9821 }
9822 }
9823
9824
9826 {
9827 super.OnPlacementStarted(player);
9828
9830 }
9831
9832 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
9833 {
9835 {
9836 m_AdminLog.OnPlacementComplete(player,
this);
9837 }
9838
9839 super.OnPlacementComplete(player, position, orientation);
9840 }
9841
9842
9843
9844
9845
9847 {
9849 {
9850 return true;
9851 }
9852 else
9853 {
9854 return false;
9855 }
9856 }
9857
9858
9860 {
9862 {
9864 }
9865 }
9866
9867
9869 {
9871 }
9872
9874 {
9876 }
9877
9878 override void InsertAgent(
int agent,
float count = 1)
9879 {
9880 if (count < 1)
9881 return;
9882
9884 }
9885
9888 {
9890 }
9891
9892
9894 {
9896 }
9897
9898
9899
9900
9901
9902
9903
9904
9905
9906
9907
9908
9909
9910
9911
9912
9913
9914
9915
9916
9917
9918
9919
9920
9921
9922
9923
9924
9925
9926
9927
9928
9929
9930
9931
9932
9933
9934
9935
9936
9937
9938
9940 {
9942 return false;
9943 return true;
9944 }
9945
9947 {
9948
9950 }
9951
9952
9955 {
9956 super.CheckForRoofLimited(timeTresholdMS);
9957
9958 float time =
g_Game.GetTime();
9959 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
9960 {
9961 m_PreviousRoofTestTime = time;
9962 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
9963 }
9964 }
9965
9966
9968 {
9970 {
9971 return 0;
9972 }
9973
9974 if (GetInventory().GetAttachmentSlotsCount() != 0)
9975 {
9976 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
9977 if (filter)
9978 return filter.GetProtectionLevel(type, false, system);
9979 else
9980 return 0;
9981 }
9982
9983 string subclassPath, entryName;
9984
9985 switch (type)
9986 {
9988 entryName = "biological";
9989 break;
9991 entryName = "chemical";
9992 break;
9993 default:
9994 entryName = "biological";
9995 break;
9996 }
9997
9998 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
9999
10000 return g_Game.ConfigGetFloat(subclassPath + entryName);
10001 }
10002
10003
10004
10007 {
10008 if (!IsMagazine())
10010
10012 }
10013
10014
10015
10016
10017
10022 {
10023 return true;
10024 }
10025
10027 {
10029 }
10030
10031
10032
10033
10034
10036 {
10037 if (parent)
10038 {
10039 if (parent.IsInherited(DayZInfected))
10040 return true;
10041
10042 if (!parent.IsRuined())
10043 return true;
10044 }
10045
10046 return true;
10047 }
10048
10050 {
10051 if (!super.CanPutAsAttachment(parent))
10052 {
10053 return false;
10054 }
10055
10056 if (!IsRuined() && !parent.IsRuined())
10057 {
10058 return true;
10059 }
10060
10061 return false;
10062 }
10063
10065 {
10066
10067
10068
10069
10070 return super.CanReceiveItemIntoCargo(item);
10071 }
10072
10074 {
10075
10076
10077
10078
10079 GameInventory attachmentInv = attachment.GetInventory();
10081 {
10082 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10083 return false;
10084 }
10085
10086 InventoryLocation loc = new InventoryLocation();
10087 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10088 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10089 return false;
10090
10091 return super.CanReceiveAttachment(attachment, slotId);
10092 }
10093
10095 {
10096 if (!super.CanReleaseAttachment(attachment))
10097 return false;
10098
10099 return GetInventory().AreChildrenAccessible();
10100 }
10101
10102
10103
10104
10105
10106
10107
10108
10109
10110
10111
10112
10113
10114
10115
10116
10117
10118
10119
10120
10121
10123 {
10124 int id = muzzle_owner.GetMuzzleID();
10125 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10126
10127 if (WPOF_array)
10128 {
10129 for (int i = 0; i < WPOF_array.Count(); i++)
10130 {
10131 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10132
10133 if (WPOF)
10134 {
10135 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10136 }
10137 }
10138 }
10139 }
10140
10141
10143 {
10144 int id = muzzle_owner.GetMuzzleID();
10146
10147 if (WPOBE_array)
10148 {
10149 for (int i = 0; i < WPOBE_array.Count(); i++)
10150 {
10151 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10152
10153 if (WPOBE)
10154 {
10155 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10156 }
10157 }
10158 }
10159 }
10160
10161
10163 {
10164 int id = muzzle_owner.GetMuzzleID();
10165 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10166
10167 if (WPOOH_array)
10168 {
10169 for (int i = 0; i < WPOOH_array.Count(); i++)
10170 {
10171 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10172
10173 if (WPOOH)
10174 {
10175 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10176 }
10177 }
10178 }
10179 }
10180
10181
10183 {
10184 int id = muzzle_owner.GetMuzzleID();
10185 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10186
10187 if (WPOOH_array)
10188 {
10189 for (int i = 0; i < WPOOH_array.Count(); i++)
10190 {
10191 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10192
10193 if (WPOOH)
10194 {
10195 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10196 }
10197 }
10198 }
10199 }
10200
10201
10203 {
10204 int id = muzzle_owner.GetMuzzleID();
10205 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10206
10207 if (WPOOH_array)
10208 {
10209 for (int i = 0; i < WPOOH_array.Count(); i++)
10210 {
10211 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10212
10213 if (WPOOH)
10214 {
10215 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10216 }
10217 }
10218 }
10219 }
10220
10221
10222
10224 {
10226 {
10227 return true;
10228 }
10229
10230 return false;
10231 }
10232
10234 {
10236 {
10237 return true;
10238 }
10239
10240 return false;
10241 }
10242
10244 {
10246 {
10247 return true;
10248 }
10249
10250 return false;
10251 }
10252
10254 {
10255 return false;
10256 }
10257
10260 {
10261 return UATimeSpent.DEFAULT_DEPLOY;
10262 }
10263
10264
10265
10266
10268 {
10270 SetSynchDirty();
10271 }
10272
10274 {
10276 }
10277
10278
10280 {
10281 return false;
10282 }
10283
10286 {
10287 string att_type = "None";
10288
10289 if (ConfigIsExisting("soundAttType"))
10290 {
10291 att_type = ConfigGetString("soundAttType");
10292 }
10293
10295 }
10296
10298 {
10300 }
10301
10302
10303
10304
10305
10311
10313 {
10316
10318 }
10319
10320
10322 {
10324 return;
10325
10327
10330
10333
10334 SoundParameters params = new SoundParameters();
10338 }
10339
10340
10342 {
10344 {
10347
10348 SetSynchDirty();
10349
10352 }
10353 }
10354
10356 {
10358 }
10359
10360
10362 {
10364 return;
10365
10367 SetSynchDirty();
10368
10371 }
10372
10374 {
10377 }
10378
10380 {
10382 }
10383
10384 void OnApply(PlayerBase player);
10385
10387 {
10388 return 1.0;
10389 };
10390
10392 {
10394 }
10395
10397 {
10399 }
10400
10402
10404 {
10405 SetDynamicPhysicsLifeTime(0.01);
10407 }
10408
10410 {
10411 array<string> zone_names = new array<string>;
10412 GetDamageZones(zone_names);
10413 for (int i = 0; i < zone_names.Count(); i++)
10414 {
10415 SetHealthMax(zone_names.Get(i),"Health");
10416 }
10417 SetHealthMax("","Health");
10418 }
10419
10422 {
10423 float global_health = GetHealth01("","Health");
10424 array<string> zones = new array<string>;
10425 GetDamageZones(zones);
10426
10427 for (int i = 0; i < zones.Count(); i++)
10428 {
10429 SetHealth01(zones.Get(i),"Health",global_health);
10430 }
10431 }
10432
10435 {
10436 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
10437 }
10438
10440 {
10441 if (!hasRootAsPlayer)
10442 {
10443 if (refParentIB)
10444 {
10445
10446 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
10447 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
10448
10449 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
10450 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
10451
10454 }
10455 else
10456 {
10457
10460 }
10461 }
10462 }
10463
10465 {
10467 {
10468 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
10469 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
10470 {
10471 float heatPermCoef = 1.0;
10473 while (ent)
10474 {
10475 heatPermCoef *= ent.GetHeatPermeabilityCoef();
10476 ent = ent.GetHierarchyParent();
10477 }
10478
10479 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
10480 }
10481 }
10482 }
10483
10485 {
10486
10487 EntityAI parent = GetHierarchyParent();
10488 if (!parent)
10489 {
10490 hasParent = false;
10491 hasRootAsPlayer = false;
10492 }
10493 else
10494 {
10495 hasParent = true;
10496 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
10497 refParentIB =
ItemBase.Cast(parent);
10498 }
10499 }
10500
10501 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
10502 {
10503
10504 }
10505
10507 {
10508
10509 return false;
10510 }
10511
10513 {
10514
10515
10516 return false;
10517 }
10518
10520 {
10521
10522 return false;
10523 }
10524
10527 {
10528 return !GetIsFrozen() &&
IsOpen();
10529 }
10530
10532 {
10533 bool hasParent = false, hasRootAsPlayer = false;
10535
10536 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
10537 bool foodDecay =
g_Game.IsFoodDecayEnabled();
10538
10539 if (wwtu || foodDecay)
10540 {
10544
10545 if (processWetness || processTemperature || processDecay)
10546 {
10548
10549 if (processWetness)
10550 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
10551
10552 if (processTemperature)
10554
10555 if (processDecay)
10556 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
10557 }
10558 }
10559 }
10560
10563 {
10565 }
10566
10568 {
10571
10572 return super.GetTemperatureFreezeThreshold();
10573 }
10574
10576 {
10579
10580 return super.GetTemperatureThawThreshold();
10581 }
10582
10584 {
10587
10588 return super.GetItemOverheatThreshold();
10589 }
10590
10592 {
10594 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
10595
10596 return super.GetTemperatureFreezeTime();
10597 }
10598
10600 {
10602 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
10603
10604 return super.GetTemperatureThawTime();
10605 }
10606
10611
10613 {
10614 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
10615 }
10616
10618 {
10619 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
10620 }
10621
10624 {
10626 }
10627
10629 {
10631 }
10632
10634 {
10636 }
10637
10640 {
10641 return null;
10642 }
10643
10646 {
10647 return false;
10648 }
10649
10651 {
10653 {
10656 if (!trg)
10657 {
10659 explosive = this;
10660 }
10661
10662 explosive.PairRemote(trg);
10664
10665 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
10666 trg.SetPersistentPairID(persistentID);
10667 explosive.SetPersistentPairID(persistentID);
10668
10669 return true;
10670 }
10671 return false;
10672 }
10673
10676 {
10677 float ret = 1.0;
10680 ret *= GetHealth01();
10681
10682 return ret;
10683 }
10684
10685 #ifdef DEVELOPER
10686 override void SetDebugItem()
10687 {
10688 super.SetDebugItem();
10689 _itemBase = this;
10690 }
10691
10693 {
10694 string text = super.GetDebugText();
10695
10697 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
10698
10699 return text;
10700 }
10701 #endif
10702
10704 {
10705 return true;
10706 }
10707
10709
10711
10713 {
10716 }
10717
10718
10726
10742
10743 [
Obsolete(
"Use ItemSoundHandler instead")]
10746 {
10747 if (!
g_Game.IsDedicatedServer())
10748 {
10749 if (ConfigIsExisting("attachSoundSet"))
10750 {
10751 string cfg_path = "";
10752 string soundset = "";
10753 string type_name =
GetType();
10754
10757 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
10758 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
10759
10760 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
10761 {
10762 for (int i = 0; i < cfg_soundset_array.Count(); i++)
10763 {
10764 if (cfg_slot_array[i] == slot_type)
10765 {
10766 soundset = cfg_soundset_array[i];
10767 break;
10768 }
10769 }
10770 }
10771
10772 if (soundset != "")
10773 {
10774 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
10776 }
10777 }
10778 }
10779 }
10780
10782}
10783
10785{
10787 if (entity)
10788 {
10789 bool is_item = entity.IsInherited(
ItemBase);
10790 if (is_item && full_quantity)
10791 {
10794 }
10795 }
10796 else
10797 {
10799 return NULL;
10800 }
10801 return entity;
10802}
10803
10805{
10806 if (item)
10807 {
10808 if (health > 0)
10809 item.SetHealth("", "", health);
10810
10811 if (item.CanHaveTemperature())
10812 {
10814 if (item.CanFreeze())
10815 item.SetFrozen(false);
10816 }
10817
10818 if (item.HasEnergyManager())
10819 {
10820 if (quantity >= 0)
10821 {
10822 item.GetCompEM().SetEnergy0To1(quantity);
10823 }
10824 else
10825 {
10827 }
10828 }
10829 else if (item.IsMagazine())
10830 {
10831 Magazine mag = Magazine.Cast(item);
10832 if (quantity >= 0)
10833 {
10834 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
10835 }
10836 else
10837 {
10839 }
10840
10841 }
10842 else
10843 {
10844 if (quantity >= 0)
10845 {
10846 item.SetQuantityNormalized(quantity, false);
10847 }
10848 else
10849 {
10851 }
10852
10853 }
10854 }
10855}
10856
10857#ifdef DEVELOPER
10859#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.