Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChanged(item); first when overriding this event.
6976{
6978 {
6979 return true;
6980 }
6981};
6982
6984{
6985
6986};
6987
6988
6989
6991{
6995
6997
7000
7001
7002
7003
7004
7013
7019
7024
7029
7050 protected bool m_IsResultOfSplit
7051
7053
7058
7059
7060
7062
7066
7067
7068
7070
7073
7074
7075
7081
7082
7090
7093
7094
7096
7097
7099
7100
7105
7106
7111
7113
7114
7116
7117
7119 {
7124
7125 if (!
g_Game.IsDedicatedServer())
7126 {
7128 {
7130
7132 {
7134 }
7135 }
7136
7139 }
7140
7141 m_OldLocation = null;
7142
7144 {
7146 }
7147
7148 if (ConfigIsExisting("headSelectionsToHide"))
7149 {
7152 }
7153
7155 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7156 {
7158 }
7159
7161
7162 m_IsResultOfSplit = false;
7163
7165 }
7166
7168 {
7169 super.InitItemVariables();
7170
7176 m_Count = ConfigGetInt(
"count");
7177
7180
7185
7188
7193
7205
7209
7210
7213 if (ConfigIsExisting("canBeSplit"))
7214 {
7217 }
7218
7220 if (ConfigIsExisting("itemBehaviour"))
7222
7223
7226 RegisterNetSyncVariableInt("m_VarLiquidType");
7227 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7228
7229 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7230 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7231 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7232
7233 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7234 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7235 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7236 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7237
7238 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7239 RegisterNetSyncVariableBool("m_IsTakeable");
7240 RegisterNetSyncVariableBool("m_IsHologram");
7241
7244 {
7247 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7248 }
7249
7251
7253 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7255
7257 }
7258
7260 {
7262 }
7263
7265 {
7268 {
7273 }
7274 }
7275
7276 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7277 {
7279 {
7282 }
7283
7285 }
7286
7288 {
7294 }
7295
7297
7299 {
7301
7302 if (!action)
7303 {
7304 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7305 return;
7306 }
7307
7309 if (!ai)
7310 {
7312 return;
7313 }
7314
7316 if (!action_array)
7317 {
7318 action_array = new array<ActionBase_Basic>;
7320 }
7321 if (LogManager.IsActionLogEnable())
7322 {
7323 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7324 }
7325
7326 if (action_array.Find(action) != -1)
7327 {
7328 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7329 }
7330 else
7331 {
7332 action_array.Insert(action);
7333 }
7334 }
7335
7337 {
7338 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7339 ActionBase action = player.GetActionManager().GetAction(actionName);
7342
7343 if (action_array)
7344 {
7345 action_array.RemoveItem(action);
7346 }
7347 }
7348
7349
7350
7352 {
7353 ActionOverrideData overrideData = new ActionOverrideData();
7357
7359 if (!actionMap)
7360 {
7363 }
7364
7365 actionMap.Insert(this.
Type(), overrideData);
7366
7367 }
7368
7370
7372
7373
7375 {
7378
7381
7382 string config_to_search = "CfgVehicles";
7383 string muzzle_owner_config;
7384
7386 {
7387 if (IsInherited(Weapon))
7388 config_to_search = "CfgWeapons";
7389
7390 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7391
7392 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7393
7394 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7395
7396 if (config_OnFire_subclass_count > 0)
7397 {
7398 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7399
7400 for (int i = 0; i < config_OnFire_subclass_count; i++)
7401 {
7402 string particle_class = "";
7403 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7404 string config_OnFire_entry = config_OnFire_class + particle_class;
7405 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7406 WPOF_array.Insert(WPOF);
7407 }
7408
7409
7411 }
7412 }
7413
7415 {
7416 config_to_search = "CfgWeapons";
7417 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7418
7419 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7420
7421 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7422
7423 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7424 {
7425 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7426
7427 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7428 {
7429 string particle_class2 = "";
7430 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7431 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7432 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7433 WPOBE_array.Insert(WPOBE);
7434 }
7435
7436
7438 }
7439 }
7440 }
7441
7442
7444 {
7447
7449 {
7450 string config_to_search = "CfgVehicles";
7451
7452 if (IsInherited(Weapon))
7453 config_to_search = "CfgWeapons";
7454
7455 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7456 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7457
7458 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7459 {
7460
7462
7464 {
7466 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7468 return;
7469 }
7470
7473
7474
7475
7476 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7477 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7478
7479 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7480 {
7481 string particle_class = "";
7482 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7483 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7484 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7485
7486 if (entry_type == CT_CLASS)
7487 {
7488 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7489 WPOOH_array.Insert(WPOF);
7490 }
7491 }
7492
7493
7495 }
7496 }
7497 }
7498
7500 {
7502 }
7503
7505 {
7507 {
7509
7512
7515
7516 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7517 }
7518 }
7519
7521 {
7523 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7524
7526 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7527
7529 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7530
7532 {
7534 }
7535 }
7536
7538 {
7540 }
7541
7543 {
7546 else
7548
7550 {
7553 }
7554 else
7555 {
7558
7561 }
7562
7564 }
7565
7567 {
7569 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7570 }
7571
7573 {
7575 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7577 }
7578
7580 {
7582 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7583 }
7584
7586 {
7589
7590 OverheatingParticle OP = new OverheatingParticle();
7595
7597 }
7598
7600 {
7603
7604 return -1;
7605 }
7606
7608 {
7610 {
7613
7614 for (int i = count; i > 0; --i)
7615 {
7616 int id = i - 1;
7619
7622
7623 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7624 {
7625 if (p)
7626 {
7629 }
7630 }
7631 }
7632 }
7633 }
7634
7636 {
7638 {
7640 {
7641 int id = i - 1;
7643
7644 if (OP)
7645 {
7647
7648 if (p)
7649 {
7651 }
7652
7653 delete OP;
7654 }
7655 }
7656
7659 }
7660 }
7661
7664 {
7665 return 0.0;
7666 }
7667
7668
7670 {
7671 return 250;
7672 }
7673
7675 {
7676 return 0;
7677 }
7678
7681 {
7683 return true;
7684
7685 return false;
7686 }
7687
7690 {
7693
7695 {
7697 }
7698 else
7699 {
7700
7702 }
7703
7705 }
7706
7713 {
7714 return -1;
7715 }
7716
7717
7718
7719
7721 {
7723 {
7724 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7725 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7726
7727 if (r_index >= 0)
7728 {
7729 InventoryLocation r_il = new InventoryLocation;
7730 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7731
7732 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7735 {
7736 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7737 }
7739 {
7740 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7741 }
7742
7743 }
7744
7745 player.GetHumanInventory().ClearUserReservedLocation(this);
7746 }
7747
7750 }
7751
7752
7753
7754
7756 {
7757 return ItemBase.m_DebugActionsMask;
7758 }
7759
7761 {
7762 return ItemBase.m_DebugActionsMask & mask;
7763 }
7764
7766 {
7767 ItemBase.m_DebugActionsMask = mask;
7768 }
7769
7771 {
7772 ItemBase.m_DebugActionsMask |= mask;
7773 }
7774
7776 {
7777 ItemBase.m_DebugActionsMask &= ~mask;
7778 }
7779
7781 {
7783 {
7785 }
7786 else
7787 {
7789 }
7790 }
7791
7792
7794 {
7795 if (GetEconomyProfile())
7796 {
7797 float q_max = GetEconomyProfile().GetQuantityMax();
7798 if (q_max > 0)
7799 {
7800 float q_min = GetEconomyProfile().GetQuantityMin();
7801 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7802
7804 {
7805 ComponentEnergyManager comp = GetCompEM();
7807 {
7809 }
7810 }
7812 {
7814
7815 }
7816
7817 }
7818 }
7819 }
7820
7823 {
7824 EntityAI parent = GetHierarchyParent();
7825
7826 if (parent)
7827 {
7828 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7829 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7830 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7831 }
7832 }
7833
7836 {
7837 EntityAI parent = GetHierarchyParent();
7838
7839 if (parent)
7840 {
7841 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7842 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7843 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7844 }
7845 }
7846
7848 {
7849
7850
7851
7852
7854
7856 {
7857 if (ScriptInputUserData.CanStoreInputUserData())
7858 {
7859 ScriptInputUserData ctx = new ScriptInputUserData;
7865 ctx.
Write(use_stack_max);
7868
7870 {
7871 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7872 }
7873 }
7874 }
7875 else if (!
g_Game.IsMultiplayer())
7876 {
7878 }
7879 }
7880
7882 {
7884 }
7885
7887 {
7889 }
7890
7892 {
7894 }
7895
7897 {
7898
7899 return false;
7900 }
7901
7903 {
7904 return false;
7905 }
7906
7910 {
7911 return false;
7912 }
7913
7915 {
7916 return "";
7917 }
7918
7920
7922 {
7923 return false;
7924 }
7925
7927 {
7928 return true;
7929 }
7930
7931
7932
7934 {
7935 return true;
7936 }
7937
7939 {
7940 return true;
7941 }
7942
7944 {
7945 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7947 }
7948
7950 {
7952 }
7953
7955 {
7957 if (!is_being_placed)
7959 SetSynchDirty();
7960 }
7961
7962
7964
7966 {
7968 }
7969
7971 {
7973 }
7974
7976 {
7977 return 1;
7978 }
7979
7981 {
7982 return false;
7983 }
7984
7986 {
7988 SetSynchDirty();
7989 }
7990
7991
7992
7993
7994
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8026 {
8027 super.OnMovedInsideCargo(container);
8028
8029 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8030 }
8031
8032 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8033 {
8034 super.EEItemLocationChanged(oldLoc, newLoc);
8035
8036 PlayerBase newPlayer = null;
8037 PlayerBase oldPlayer = null;
8038
8039 if (newLoc.GetParent())
8040 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8041
8042 if (oldLoc.GetParent())
8043 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8044
8046 {
8047 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8048
8049 if (rIndex >= 0)
8050 {
8051 InventoryLocation rIl = new InventoryLocation;
8052 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8053
8054 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8057 {
8058 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8059 }
8061 {
8063 }
8064
8065 }
8066 }
8067
8069 {
8070 if (newPlayer)
8071 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8072
8073 if (newPlayer == oldPlayer)
8074 {
8075 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8076 {
8078 {
8079 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8080 {
8081 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8082 }
8083 }
8084 else
8085 {
8086 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8087 }
8088 }
8089
8090 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8091 {
8092 int type = oldLoc.GetType();
8094 {
8095 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8096 }
8098 {
8099 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8100 }
8101 }
8102 if (!m_OldLocation)
8103 {
8104 m_OldLocation = new InventoryLocation;
8105 }
8106 m_OldLocation.Copy(oldLoc);
8107 }
8108 else
8109 {
8110 if (m_OldLocation)
8111 {
8112 m_OldLocation.Reset();
8113 }
8114 }
8115
8116 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8117 }
8118 else
8119 {
8120 if (newPlayer)
8121 {
8122 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8123 if (resIndex >= 0)
8124 {
8125 InventoryLocation il = new InventoryLocation;
8126 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8128 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8131 {
8132 il.
GetParent().GetOnReleaseLock().Invoke(it);
8133 }
8135 {
8137 }
8138
8139 }
8140 }
8142 {
8143
8145 }
8146
8147 if (m_OldLocation)
8148 {
8149 m_OldLocation.Reset();
8150 }
8151 }
8152
8154 {
8155 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8156 }
8157
8159 {
8160 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8161 }
8162 }
8163
8164 override void EOnContact(IEntity other, Contact extra)
8165 {
8167 {
8168 int liquidType = -1;
8170 if (impactSpeed > 0.0)
8171 {
8173 #ifndef SERVER
8175 #else
8177 SetSynchDirty();
8178 #endif
8180 }
8181 }
8182
8183 #ifdef SERVER
8184 if (GetCompEM() && GetCompEM().IsPlugged())
8185 {
8186 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8187 GetCompEM().UnplugThis();
8188 }
8189 #endif
8190 }
8191
8193
8195 {
8197 }
8198
8200 {
8201
8202 }
8203
8205 {
8206 super.OnItemLocationChanged(old_owner, new_owner);
8207
8208 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8209 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8210
8211 if (!relatedPlayer && playerNew)
8212 relatedPlayer = playerNew;
8213
8214 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8215 {
8217 if (actionMgr)
8218 {
8219 ActionBase currentAction = actionMgr.GetRunningAction();
8220 if (currentAction)
8222 }
8223 }
8224
8225 Man ownerPlayerOld = null;
8226 Man ownerPlayerNew = null;
8227
8228 if (old_owner)
8229 {
8230 if (old_owner.
IsMan())
8231 {
8232 ownerPlayerOld = Man.Cast(old_owner);
8233 }
8234 else
8235 {
8236 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8237 }
8238 }
8239 else
8240 {
8242 {
8244
8245 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8246 {
8247 GetCompEM().UnplugThis();
8248 }
8249 }
8250 }
8251
8252 if (new_owner)
8253 {
8254 if (new_owner.
IsMan())
8255 {
8256 ownerPlayerNew = Man.Cast(new_owner);
8257 }
8258 else
8259 {
8260 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8261 }
8262 }
8263
8264 if (ownerPlayerOld != ownerPlayerNew)
8265 {
8266 if (ownerPlayerOld)
8267 {
8268 array<EntityAI> subItemsExit = new array<EntityAI>;
8270 for (int i = 0; i < subItemsExit.Count(); i++)
8271 {
8274 }
8275 }
8276
8277 if (ownerPlayerNew)
8278 {
8279 array<EntityAI> subItemsEnter = new array<EntityAI>;
8281 for (int j = 0; j < subItemsEnter.Count(); j++)
8282 {
8285 }
8286 }
8287 }
8288 else if (ownerPlayerNew != null)
8289 {
8290 PlayerBase nplayer;
8291 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8292 {
8293 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8295 for (int k = 0; k < subItemsUpdate.Count(); k++)
8296 {
8298 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8299 }
8300 }
8301 }
8302
8303 if (old_owner)
8304 old_owner.OnChildItemRemoved(this);
8305 if (new_owner)
8306 new_owner.OnChildItemReceived(this);
8307 }
8308
8309
8311 {
8312 super.EEDelete(parent);
8313 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8314 if (player)
8315 {
8317
8318 if (player.IsAlive())
8319 {
8320 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8321 if (r_index >= 0)
8322 {
8323 InventoryLocation r_il = new InventoryLocation;
8324 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8325
8326 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8329 {
8330 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8331 }
8333 {
8334 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8335 }
8336
8337 }
8338
8339 player.RemoveQuickBarEntityShortcut(this);
8340 }
8341 }
8342 }
8343
8345 {
8346 super.EEKilled(killer);
8347
8350 {
8351 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8352 {
8353 if (IsMagazine())
8354 {
8355 if (Magazine.Cast(this).GetAmmoCount() > 0)
8356 {
8358 }
8359 }
8360 else
8361 {
8363 }
8364 }
8365 }
8366 }
8367
8369 {
8370 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8371
8372 super.OnWasAttached(parent, slot_id);
8373
8376
8379 }
8380
8382 {
8383 super.OnWasDetached(parent, slot_id);
8384
8387
8390 }
8391
8393 {
8394 int idx;
8397
8398 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8399 if (inventory_slots.Count() < 1)
8400 {
8401 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8402 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8403 }
8404 else
8405 {
8406 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8407 }
8408
8409 idx = inventory_slots.Find(slot);
8410 if (idx < 0)
8411 return "";
8412
8413 return attach_types.Get(idx);
8414 }
8415
8417 {
8418 int idx = -1;
8419 string slot;
8420
8423
8424 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8425 if (inventory_slots.Count() < 1)
8426 {
8427 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8428 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8429 }
8430 else
8431 {
8432 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8433 if (detach_types.Count() < 1)
8434 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8435 }
8436
8437 for (int i = 0; i < inventory_slots.Count(); i++)
8438 {
8439 slot = inventory_slots.Get(i);
8440 }
8441
8442 if (slot != "")
8443 {
8444 if (detach_types.Count() == 1)
8445 idx = 0;
8446 else
8447 idx = inventory_slots.Find(slot);
8448 }
8449 if (idx < 0)
8450 return "";
8451
8452 return detach_types.Get(idx);
8453 }
8454
8456 {
8457
8459
8460
8461 float min_time = 1;
8462 float max_time = 3;
8463 float delay = Math.RandomFloat(min_time, max_time);
8464
8465 explode_timer.Run(delay, this, "DoAmmoExplosion");
8466 }
8467
8469 {
8470 Magazine magazine = Magazine.Cast(this);
8471 int pop_sounds_count = 6;
8472 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8473
8474
8475 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8476 string sound_name = pop_sounds[ sound_idx ];
8477 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8478
8479
8480 magazine.ServerAddAmmoCount(-1);
8481
8482
8483 float min_temp_to_explode = 100;
8484
8485 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8486 {
8488 }
8489 }
8490
8491
8492 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8493 {
8494 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8495
8496 const int CHANCE_DAMAGE_CARGO = 4;
8497 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8498 const int CHANCE_DAMAGE_NOTHING = 2;
8499
8501 {
8502 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8503 int chances;
8504 int rnd;
8505
8506 if (GetInventory().GetCargo())
8507 {
8508 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8509 rnd = Math.RandomInt(0,chances);
8510
8511 if (rnd < CHANCE_DAMAGE_CARGO)
8512 {
8514 }
8515 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8516 {
8518 }
8519 }
8520 else
8521 {
8522 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8523 rnd = Math.RandomInt(0,chances);
8524
8525 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8526 {
8528 }
8529 }
8530 }
8531 }
8532
8534 {
8535 CargoBase cargo = GetInventory().GetCargo();
8536 if (cargo)
8537 {
8539 if (item_count > 0)
8540 {
8541 int random_pick = Math.RandomInt(0, item_count);
8543 if (!item.IsExplosive())
8544 {
8545 item.AddHealth("","",damage);
8546 return true;
8547 }
8548 }
8549 }
8550 return false;
8551 }
8552
8554 {
8555 GameInventory inventory = GetInventory();
8557 if (attachment_count > 0)
8558 {
8559 int random_pick = Math.RandomInt(0, attachment_count);
8561 if (!attachment.IsExplosive())
8562 {
8563 attachment.AddHealth("","",damage);
8564 return true;
8565 }
8566 }
8567 return false;
8568 }
8569
8571 {
8573 }
8574
8576 {
8578 return GetInventory().CanRemoveEntity();
8579
8580 return false;
8581 }
8582
8584 {
8585
8587 return false;
8588
8589
8591 return false;
8592
8593
8594
8596 if (delta == 0)
8597 return false;
8598
8599
8600 return true;
8601 }
8602
8604 {
8606 {
8607 if (ScriptInputUserData.CanStoreInputUserData())
8608 {
8609 ScriptInputUserData ctx = new ScriptInputUserData;
8614 ctx.
Write(destination_entity);
8618 }
8619 }
8620 else if (!
g_Game.IsMultiplayer())
8621 {
8623 }
8624 }
8625
8627 {
8628 float split_quantity_new;
8632 InventoryLocation loc = new InventoryLocation;
8633
8634 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8635 {
8637 split_quantity_new = stack_max;
8638 else
8640
8642 {
8643 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8644 if (new_item)
8645 {
8646 new_item.SetResultOfSplit(true);
8647 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8649 new_item.
SetQuantity(split_quantity_new,
false,
true);
8650 }
8651 }
8652 }
8653 else if (destination_entity && slot_id == -1)
8654 {
8655 if (quantity > stack_max)
8656 split_quantity_new = stack_max;
8657 else
8658 split_quantity_new = quantity;
8659
8661 {
8662 GameInventory destinationInventory = destination_entity.GetInventory();
8664 {
8667 }
8668
8669 if (new_item)
8670 {
8671 new_item.SetResultOfSplit(true);
8672 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8674 new_item.
SetQuantity(split_quantity_new,
false,
true);
8675 }
8676 }
8677 }
8678 else
8679 {
8680 if (stack_max != 0)
8681 {
8683 {
8685 }
8686
8687 if (split_quantity_new == 0)
8688 {
8689 if (!
g_Game.IsMultiplayer())
8690 player.PhysicalPredictiveDropItem(this);
8691 else
8692 player.ServerDropEntity(this);
8693 return;
8694 }
8695
8697 {
8699
8700 if (new_item)
8701 {
8702 new_item.SetResultOfSplit(true);
8703 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8706 new_item.PlaceOnSurface();
8707 }
8708 }
8709 }
8710 }
8711 }
8712
8714 {
8715 float split_quantity_new;
8719 InventoryLocation loc = new InventoryLocation;
8720
8721 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8722 {
8724 split_quantity_new = stack_max;
8725 else
8727
8729 {
8730 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8731 if (new_item)
8732 {
8733 new_item.SetResultOfSplit(true);
8734 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8736 new_item.
SetQuantity(split_quantity_new,
false,
true);
8737 }
8738 }
8739 }
8740 else if (destination_entity && slot_id == -1)
8741 {
8742 if (quantity > stack_max)
8743 split_quantity_new = stack_max;
8744 else
8745 split_quantity_new = quantity;
8746
8748 {
8749 GameInventory destinationInventory = destination_entity.GetInventory();
8751 {
8754 }
8755
8756 if (new_item)
8757 {
8758 new_item.SetResultOfSplit(true);
8759 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8761 new_item.
SetQuantity(split_quantity_new,
false,
true);
8762 }
8763 }
8764 }
8765 else
8766 {
8767 if (stack_max != 0)
8768 {
8770 {
8772 }
8773
8775 {
8777
8778 if (new_item)
8779 {
8780 new_item.SetResultOfSplit(true);
8781 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8784 new_item.PlaceOnSurface();
8785 }
8786 }
8787 }
8788 }
8789 }
8790
8792 {
8794 {
8795 if (ScriptInputUserData.CanStoreInputUserData())
8796 {
8797 ScriptInputUserData ctx = new ScriptInputUserData;
8802 dst.WriteToContext(ctx);
8804 }
8805 }
8806 else if (!
g_Game.IsMultiplayer())
8807 {
8809 }
8810 }
8811
8813 {
8815 {
8816 if (ScriptInputUserData.CanStoreInputUserData())
8817 {
8818 ScriptInputUserData ctx = new ScriptInputUserData;
8823 ctx.
Write(destination_entity);
8829 }
8830 }
8831 else if (!
g_Game.IsMultiplayer())
8832 {
8834 }
8835 }
8836
8838 {
8840 }
8841
8843 {
8845 float split_quantity_new;
8847 if (dst.IsValid())
8848 {
8849 int slot_id = dst.GetSlot();
8851
8852 if (quantity > stack_max)
8853 split_quantity_new = stack_max;
8854 else
8855 split_quantity_new = quantity;
8856
8858 {
8860
8861 if (new_item)
8862 {
8863 new_item.SetResultOfSplit(true);
8864 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8866 new_item.
SetQuantity(split_quantity_new,
false,
true);
8867 }
8868
8869 return new_item;
8870 }
8871 }
8872
8873 return null;
8874 }
8875
8877 {
8879 float split_quantity_new;
8881 if (destination_entity)
8882 {
8884 if (quantity > stackable)
8885 split_quantity_new = stackable;
8886 else
8887 split_quantity_new = quantity;
8888
8890 {
8891 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8892 if (new_item)
8893 {
8894 new_item.SetResultOfSplit(true);
8895 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8897 new_item.
SetQuantity(split_quantity_new,
false,
true);
8898 }
8899 }
8900 }
8901 }
8902
8904 {
8906 {
8907 if (ScriptInputUserData.CanStoreInputUserData())
8908 {
8909 ScriptInputUserData ctx = new ScriptInputUserData;
8914 ItemBase destination_entity =
this;
8915 ctx.
Write(destination_entity);
8919 }
8920 }
8921 else if (!
g_Game.IsMultiplayer())
8922 {
8924 }
8925 }
8926
8928 {
8930 float split_quantity_new;
8932 if (player)
8933 {
8935 if (quantity > stackable)
8936 split_quantity_new = stackable;
8937 else
8938 split_quantity_new = quantity;
8939
8941 {
8942 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8943 new_item =
ItemBase.Cast(in_hands);
8944 if (new_item)
8945 {
8946 new_item.SetResultOfSplit(true);
8947 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8949 new_item.SetQuantity(split_quantity_new, false, true);
8950 }
8951 }
8952 }
8953 }
8954
8956 {
8958 float split_quantity_new = Math.Floor(quantity * 0.5);
8959
8961 return;
8962
8964
8965 if (new_item)
8966 {
8967 if (new_item.GetQuantityMax() < split_quantity_new)
8968 {
8969 split_quantity_new = new_item.GetQuantityMax();
8970 }
8971
8972 new_item.SetResultOfSplit(true);
8973 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8974
8976 {
8979 }
8980 else
8981 {
8983 new_item.
SetQuantity(split_quantity_new,
false,
true);
8984 }
8985 }
8986 }
8987
8989 {
8991 float split_quantity_new = Math.Floor(quantity / 2);
8992
8994 return;
8995
8996 InventoryLocation invloc = new InventoryLocation;
8998
9000 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9001
9002 if (new_item)
9003 {
9004 if (new_item.GetQuantityMax() < split_quantity_new)
9005 {
9006 split_quantity_new = new_item.GetQuantityMax();
9007 }
9009 {
9012 }
9013 else if (split_quantity_new > 1)
9014 {
9016 new_item.
SetQuantity(split_quantity_new,
false,
true);
9017 }
9018 }
9019 }
9020
9023 {
9024 SetWeightDirty();
9026
9027 if (parent)
9028 parent.OnAttachmentQuantityChangedEx(this, delta);
9029
9031 {
9033 {
9035 }
9037 {
9038 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9040 }
9041 }
9042 }
9043
9046 {
9047
9048 }
9049
9052 {
9054 }
9055
9057 {
9058 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9059
9061 {
9062 if (newLevel == GameConstants.STATE_RUINED)
9063 {
9065 EntityAI parent = GetHierarchyParent();
9066 if (parent && parent.IsFireplace())
9067 {
9068 CargoBase cargo = GetInventory().GetCargo();
9069 if (cargo)
9070 {
9072 {
9074 }
9075 }
9076 }
9077 }
9078
9080 {
9081
9083 return;
9084 }
9085
9086 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9087 {
9089 }
9090 }
9091 }
9092
9093
9095 {
9096 super.OnRightClick();
9097
9099 {
9101 {
9102 if (ScriptInputUserData.CanStoreInputUserData())
9103 {
9104 EntityAI root = GetHierarchyRoot();
9105 Man playerOwner = GetHierarchyRootPlayer();
9106 InventoryLocation dst = new InventoryLocation;
9107
9108
9109 if (!playerOwner && root && root == this)
9110 {
9112 }
9113 else
9114 {
9115
9116 GetInventory().GetCurrentInventoryLocation(dst);
9118 {
9119 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9121 {
9123 }
9124 else
9125 {
9127
9128
9129 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9130 {
9132 }
9133 else
9134 {
9135 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9136 }
9137 }
9138 }
9139 }
9140
9141 ScriptInputUserData ctx = new ScriptInputUserData;
9149 }
9150 }
9151 else if (!
g_Game.IsMultiplayer())
9152 {
9154 }
9155 }
9156 }
9157
9159 {
9160 if (root)
9161 {
9162 vector m4[4];
9163 root.GetTransform(m4);
9164 dst.SetGround(this, m4);
9165 }
9166 else
9167 {
9168 GetInventory().GetCurrentInventoryLocation(dst);
9169 }
9170 }
9171
9172 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9173 {
9174
9175 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9176 return false;
9177
9178 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9179 return false;
9180
9181
9183 return false;
9184
9185
9186 Magazine mag = Magazine.Cast(this);
9187 if (mag)
9188 {
9189 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9190 return false;
9191
9192 if (stack_max_limit)
9193 {
9194 Magazine other_mag = Magazine.Cast(other_item);
9195 if (other_item)
9196 {
9197 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9198 return false;
9199 }
9200
9201 }
9202 }
9203 else
9204 {
9205
9207 return false;
9208
9210 return false;
9211 }
9212
9213 PlayerBase player = null;
9214 if (CastTo(player, GetHierarchyRootPlayer()))
9215 {
9216 if (player.GetInventory().HasAttachment(this))
9217 return false;
9218
9219 if (player.IsItemsToDelete())
9220 return false;
9221 }
9222
9223 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9224 return false;
9225
9226 int slotID;
9228 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9229 return false;
9230
9231 return true;
9232 }
9233
9235 {
9237 }
9238
9240 {
9241 return m_IsResultOfSplit;
9242 }
9243
9245 {
9246 m_IsResultOfSplit = value;
9247 }
9248
9250 {
9252 }
9253
9255 {
9256 float other_item_quantity = other_item.GetQuantity();
9257 float this_free_space;
9258
9260
9262
9263 if (other_item_quantity > this_free_space)
9264 {
9265 return this_free_space;
9266 }
9267 else
9268 {
9269 return other_item_quantity;
9270 }
9271 }
9272
9274 {
9276 }
9277
9279 {
9281 return;
9282
9283 if (!IsMagazine() && other_item)
9284 {
9286 if (quantity_used != 0)
9287 {
9288 float hp1 = GetHealth01("","");
9289 float hp2 = other_item.GetHealth01("","");
9290 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9291 hpResult = hpResult / (
GetQuantity() + quantity_used);
9292
9293 hpResult *= GetMaxHealth();
9294 Math.Round(hpResult);
9295 SetHealth("", "Health", hpResult);
9296
9298 other_item.AddQuantity(-quantity_used);
9299 }
9300 }
9302 }
9303
9305 {
9306 #ifdef SERVER
9307 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9308 GetHierarchyParent().IncreaseLifetimeUp();
9309 #endif
9310 };
9311
9313 {
9314 PlayerBase p = PlayerBase.Cast(player);
9315
9316 array<int> recipesIds = p.m_Recipes;
9317 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9318 if (moduleRecipesManager)
9319 {
9320 EntityAI itemInHands = player.GetEntityInHands();
9321 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9322 }
9323
9324 for (int i = 0;i < recipesIds.Count(); i++)
9325 {
9326 int key = recipesIds.Get(i);
9327 string recipeName = moduleRecipesManager.GetRecipeName(key);
9329 }
9330 }
9331
9332
9333 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9334 {
9335 super.GetDebugActions(outputList);
9336
9337
9343
9344
9349
9354
9355
9359
9360
9362 {
9366 }
9367
9370
9371
9375
9377
9378 InventoryLocation loc = new InventoryLocation();
9379 GetInventory().GetCurrentInventoryLocation(loc);
9381 {
9382 if (Gizmo_IsSupported())
9385 }
9386
9388 }
9389
9390
9391
9392
9394 {
9395 super.OnAction(action_id, player, ctx);
9396
9398 {
9399 switch (action_id)
9400 {
9404 return true;
9408 return true;
9409 }
9410 }
9411
9413 {
9414 switch (action_id)
9415 {
9417 Delete();
9418 return true;
9419 }
9420 }
9421
9422 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9423 {
9424 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9425 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9426 PlayerBase p = PlayerBase.Cast(player);
9427 if (
EActions.RECIPES_RANGE_START < 1000)
9428 {
9429 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9430 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9431 }
9432 }
9433 #ifndef SERVER
9434 else if (action_id ==
EActions.WATCH_PLAYER)
9435 {
9436 PluginDeveloper.SetDeveloperItemClientEx(player);
9437 }
9438 #endif
9440 {
9441 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9442 {
9443 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9444 OnDebugButtonPressServer(id + 1);
9445 }
9446
9447 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9448 {
9449 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9451 }
9452
9453 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9454 {
9455 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9457 }
9458
9459 else if (action_id ==
EActions.ADD_QUANTITY)
9460 {
9461 if (IsMagazine())
9462 {
9463 Magazine mag = Magazine.Cast(this);
9464 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9465 }
9466 else
9467 {
9469 }
9470
9471 if (m_EM)
9472 {
9473 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9474 }
9475
9476 }
9477
9478 else if (action_id ==
EActions.REMOVE_QUANTITY)
9479 {
9480 if (IsMagazine())
9481 {
9482 Magazine mag2 = Magazine.Cast(this);
9483 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9484 }
9485 else
9486 {
9488 }
9489 if (m_EM)
9490 {
9491 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9492 }
9493
9494 }
9495
9496 else if (action_id ==
EActions.SET_QUANTITY_0)
9497 {
9499
9500 if (m_EM)
9501 {
9502 m_EM.SetEnergy(0);
9503 }
9504 }
9505
9506 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9507 {
9509
9510 if (m_EM)
9511 {
9512 m_EM.SetEnergy(m_EM.GetEnergyMax());
9513 }
9514 }
9515
9516 else if (action_id ==
EActions.ADD_HEALTH)
9517 {
9518 AddHealth("","",GetMaxHealth("","Health")/5);
9519 }
9520 else if (action_id ==
EActions.REMOVE_HEALTH)
9521 {
9522 AddHealth("","",-GetMaxHealth("","Health")/5);
9523 }
9524 else if (action_id ==
EActions.DESTROY_HEALTH)
9525 {
9526 SetHealth01("","",0);
9527 }
9528 else if (action_id ==
EActions.WATCH_ITEM)
9529 {
9531 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9532 #ifdef DEVELOPER
9533 SetDebugDeveloper_item(this);
9534 #endif
9535 }
9536
9537 else if (action_id ==
EActions.ADD_TEMPERATURE)
9538 {
9539 AddTemperature(20);
9540
9541 }
9542
9543 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9544 {
9545 AddTemperature(-20);
9546
9547 }
9548
9549 else if (action_id ==
EActions.FLIP_FROZEN)
9550 {
9551 SetFrozen(!GetIsFrozen());
9552
9553 }
9554
9555 else if (action_id ==
EActions.ADD_WETNESS)
9556 {
9558
9559 }
9560
9561 else if (action_id ==
EActions.REMOVE_WETNESS)
9562 {
9564
9565 }
9566
9567 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9568 {
9571
9572
9573 }
9574
9575 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9576 {
9579 }
9580
9581 else if (action_id ==
EActions.MAKE_SPECIAL)
9582 {
9583 auto debugParams = DebugSpawnParams.WithPlayer(player);
9584 OnDebugSpawnEx(debugParams);
9585 }
9586
9587 }
9588
9589
9590 return false;
9591 }
9592
9593
9594
9595
9599
9602
9603
9604
9606 {
9607 return false;
9608 }
9609
9610
9612 {
9613 return true;
9614 }
9615
9616
9618 {
9619 return true;
9620 }
9621
9622
9623
9625 {
9626 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9627 return g_Game.ConfigIsExisting(config_path);
9628 }
9629
9632 {
9633 return null;
9634 }
9635
9637 {
9638 return false;
9639 }
9640
9642 {
9643 return false;
9644 }
9645
9649
9650
9652 {
9653 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9654 return module_repairing.CanRepair(this, item_repair_kit);
9655 }
9656
9657
9658 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9659 {
9660 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9661 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9662 }
9663
9664
9666 {
9667
9668
9669
9670
9671
9672
9673
9674
9675 return 1;
9676 }
9677
9678
9679
9681 {
9683 }
9684
9685
9686
9688 {
9690 }
9691
9692
9701 {
9702 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9703
9704 if (player)
9705 {
9706 player.MessageStatus(text);
9707 }
9708 }
9709
9710
9719 {
9720 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9721
9722 if (player)
9723 {
9724 player.MessageAction(text);
9725 }
9726 }
9727
9728
9737 {
9738 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9739
9740 if (player)
9741 {
9742 player.MessageFriendly(text);
9743 }
9744 }
9745
9746
9755 {
9756 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9757
9758 if (player)
9759 {
9760 player.MessageImportant(text);
9761 }
9762 }
9763
9765 {
9766 return true;
9767 }
9768
9769
9770 override bool KindOf(
string tag)
9771 {
9772 bool found = false;
9773 string item_name = this.
GetType();
9775 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9776
9777 int array_size = item_tag_array.Count();
9778 for (int i = 0; i < array_size; i++)
9779 {
9780 if (item_tag_array.Get(i) == tag)
9781 {
9782 found = true;
9783 break;
9784 }
9785 }
9786 return found;
9787 }
9788
9789
9791 {
9792
9793 super.OnRPC(sender, rpc_type,ctx);
9794
9795
9796 switch (rpc_type)
9797 {
9798 #ifndef SERVER
9799 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9800 Param2<bool, string> p = new Param2<bool, string>(false, "");
9801
9803 return;
9804
9805 bool play = p.param1;
9806 string soundSet = p.param2;
9807
9808 if (play)
9809 {
9811 {
9813 {
9815 }
9816 }
9817 else
9818 {
9820 }
9821 }
9822 else
9823 {
9825 }
9826
9827 break;
9828 #endif
9829
9830 }
9831
9833 {
9835 }
9836 }
9837
9838
9839
9840
9842 {
9843 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9844 return plugin.GetID(
name);
9845 }
9846
9848 {
9849 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9850 return plugin.GetName(id);
9851 }
9852
9855 {
9856
9857
9858 int varFlags;
9859 if (!ctx.
Read(varFlags))
9860 return;
9861
9862 if (varFlags & ItemVariableFlags.FLOAT)
9863 {
9865 }
9866 }
9867
9869 {
9870
9871 super.SerializeNumericalVars(floats_out);
9872
9873
9874
9876 {
9878 }
9879
9881 {
9883 }
9884
9886 {
9888 }
9889
9891 {
9896 }
9897
9899 {
9901 }
9902 }
9903
9905 {
9906
9907 super.DeSerializeNumericalVars(floats);
9908
9909
9910 int index = 0;
9911 int mask = Math.Round(floats.Get(index));
9912
9913 index++;
9914
9916 {
9918 {
9920 }
9921 else
9922 {
9923 float quantity = floats.Get(index);
9925 }
9926 index++;
9927 }
9928
9930 {
9931 float wet = floats.Get(index);
9933 index++;
9934 }
9935
9937 {
9938 int liquidtype = Math.Round(floats.Get(index));
9940 index++;
9941 }
9942
9944 {
9946 index++;
9948 index++;
9950 index++;
9952 index++;
9953 }
9954
9956 {
9957 int cleanness = Math.Round(floats.Get(index));
9959 index++;
9960 }
9961 }
9962
9964 {
9965 super.WriteVarsToCTX(ctx);
9966
9967
9969 {
9971 }
9972
9974 {
9976 }
9977
9979 {
9981 }
9982
9984 {
9985 int r,g,b,a;
9991 }
9992
9994 {
9996 }
9997 }
9998
10000 {
10001 if (!super.ReadVarsFromCTX(ctx,version))
10002 return false;
10003
10004 int intValue;
10005 float value;
10006
10007 if (version < 140)
10008 {
10009 if (!ctx.
Read(intValue))
10010 return false;
10011
10012 m_VariablesMask = intValue;
10013 }
10014
10016 {
10017 if (!ctx.
Read(value))
10018 return false;
10019
10021 {
10023 }
10024 else
10025 {
10027 }
10028 }
10029
10030 if (version < 140)
10031 {
10033 {
10034 if (!ctx.
Read(value))
10035 return false;
10036 SetTemperatureDirect(value);
10037 }
10038 }
10039
10041 {
10042 if (!ctx.
Read(value))
10043 return false;
10045 }
10046
10048 {
10049 if (!ctx.
Read(intValue))
10050 return false;
10052 }
10053
10055 {
10056 int r,g,b,a;
10058 return false;
10060 return false;
10062 return false;
10064 return false;
10065
10067 }
10068
10070 {
10071 if (!ctx.
Read(intValue))
10072 return false;
10074 }
10075
10076 if (version >= 138 && version < 140)
10077 {
10079 {
10080 if (!ctx.
Read(intValue))
10081 return false;
10082 SetFrozen(intValue);
10083 }
10084 }
10085
10086 return true;
10087 }
10088
10089
10091 {
10094 {
10096 }
10097
10098 if (!super.OnStoreLoad(ctx, version))
10099 {
10101 return false;
10102 }
10103
10104 if (version >= 114)
10105 {
10106 bool hasQuickBarIndexSaved;
10107
10108 if (!ctx.
Read(hasQuickBarIndexSaved))
10109 {
10111 return false;
10112 }
10113
10114 if (hasQuickBarIndexSaved)
10115 {
10116 int itmQBIndex;
10117
10118
10119 if (!ctx.
Read(itmQBIndex))
10120 {
10122 return false;
10123 }
10124
10125 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10126 if (itmQBIndex != -1 && parentPlayer)
10127 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10128 }
10129 }
10130 else
10131 {
10132
10133 PlayerBase player;
10134 int itemQBIndex;
10135 if (version ==
int.
MAX)
10136 {
10137 if (!ctx.
Read(itemQBIndex))
10138 {
10140 return false;
10141 }
10142 }
10143 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10144 {
10145
10146 if (!ctx.
Read(itemQBIndex))
10147 {
10149 return false;
10150 }
10151 if (itemQBIndex != -1 && player)
10152 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10153 }
10154 }
10155
10156 if (version < 140)
10157 {
10158
10159 if (!LoadVariables(ctx, version))
10160 {
10162 return false;
10163 }
10164 }
10165
10166
10168 {
10170 return false;
10171 }
10172 if (version >= 132)
10173 {
10175 if (raib)
10176 {
10178 {
10180 return false;
10181 }
10182 }
10183 }
10184
10186 return true;
10187 }
10188
10189
10190
10192 {
10193 super.OnStoreSave(ctx);
10194
10195 PlayerBase player;
10196 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10197 {
10199
10200 int itemQBIndex = -1;
10201 itemQBIndex = player.FindQuickBarEntityIndex(this);
10202 ctx.
Write(itemQBIndex);
10203 }
10204 else
10205 {
10207 }
10208
10210
10212 if (raib)
10213 {
10215 }
10216 }
10217
10218
10220 {
10221 super.AfterStoreLoad();
10222
10224 {
10226 }
10227
10229 {
10232 }
10233 }
10234
10236 {
10237 super.EEOnAfterLoad();
10238
10240 {
10242 }
10243
10246 }
10247
10249 {
10250 return false;
10251 }
10252
10253
10254
10256 {
10258 {
10259 #ifdef PLATFORM_CONSOLE
10260
10262 {
10264 if (menu)
10265 {
10267 }
10268 }
10269 #endif
10270 }
10271
10273 {
10276 }
10277
10279 {
10280 SetWeightDirty();
10282 }
10284 {
10287 }
10288
10290 {
10293
10296 }
10298 {
10302 }
10303
10304 super.OnVariablesSynchronized();
10305 }
10306
10307
10308
10310 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10311 {
10312 if (!IsServerCheck(allow_client))
10313 return false;
10314
10316 return false;
10317
10320
10321 if (value <= (min + 0.001))
10322 value = min;
10323
10324 if (value == min)
10325 {
10326 if (destroy_config)
10327 {
10328 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10329 if (dstr)
10330 {
10332 this.Delete();
10333 return true;
10334 }
10335 }
10336 else if (destroy_forced)
10337 {
10339 this.Delete();
10340 return true;
10341 }
10342
10344 }
10345
10348
10350 {
10351 EntityAI parent = GetHierarchyRoot();
10352 InventoryLocation iLoc = new InventoryLocation();
10353 GetInventory().GetCurrentInventoryLocation(iLoc);
10355 {
10356 int iLocSlot = iLoc.
GetSlot();
10358 {
10360 }
10362 {
10364 }
10365 }
10366 }
10367
10369 {
10371
10372 if (delta)
10374 }
10375
10377
10378 return false;
10379 }
10380
10381
10383 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10384 {
10386 }
10387
10389 {
10392 }
10393
10395 {
10398 }
10399
10401 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10402 {
10403 float value_clamped = Math.Clamp(value, 0, 1);
10405 SetQuantity(result, destroy_config, destroy_forced);
10406 }
10407
10408
10411 {
10413 }
10414
10416 {
10418 }
10419
10420
10421
10422
10423
10424
10425
10426
10427
10428
10430 {
10431 int slot = -1;
10432 GameInventory inventory = GetInventory();
10433 if (inventory)
10434 {
10435 InventoryLocation il = new InventoryLocation;
10438 }
10439
10441 }
10442
10444 {
10445 float quantity_max = 0;
10446
10448 {
10449 if (attSlotID != -1)
10450 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10451
10452 if (quantity_max <= 0)
10454 }
10455
10456 if (quantity_max <= 0)
10458
10459 return quantity_max;
10460 }
10461
10463 {
10465 }
10466
10468 {
10470 }
10471
10472
10474 {
10476 }
10477
10479 {
10481 }
10482
10484 {
10486 }
10487
10488
10490 {
10491
10492 float weightEx = GetWeightEx();
10493 float special = GetInventoryAndCargoWeight();
10494 return weightEx - special;
10495 }
10496
10497
10499 {
10501 }
10502
10504 {
10506 {
10507 #ifdef DEVELOPER
10508 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10509 {
10510 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10512 }
10513 #endif
10514
10515 return GetQuantity() * GetConfigWeightModified();
10516 }
10517 else if (HasEnergyManager())
10518 {
10519 #ifdef DEVELOPER
10520 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10521 {
10522 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10523 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10524 }
10525 #endif
10526 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10527 }
10528 else
10529 {
10530 #ifdef DEVELOPER
10531 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10532 {
10533 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10534 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10535 }
10536 #endif
10537 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10538 }
10539 }
10540
10543 {
10544 int item_count = 0;
10546
10547 GameInventory inventory = GetInventory();
10548 CargoBase cargo = inventory.
GetCargo();
10549 if (cargo != NULL)
10550 {
10552 }
10553
10555 for (int i = 0; i < nAttachments; ++i)
10556 {
10558 if (item)
10559 item_count += item.GetNumberOfItems();
10560 }
10561 return item_count;
10562 }
10563
10566 {
10567 float weight = 0;
10568 float wetness = 1;
10569 if (include_wetness)
10572 {
10573 weight = wetness * m_ConfigWeight;
10574 }
10576 {
10577 weight = 1;
10578 }
10579 return weight;
10580 }
10581
10582
10583
10585 {
10586 GameInventory inventory = GetInventory();
10587 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10588 {
10589 array<EntityAI> items = new array<EntityAI>;
10591 for (int i = 0; i < items.Count(); ++i)
10592 {
10594 if (item)
10595 {
10596 g_Game.ObjectDelete(item);
10597 }
10598 }
10599 }
10600 }
10601
10602
10603
10604
10606 {
10607 float energy = 0;
10608 if (HasEnergyManager())
10609 {
10610 energy = GetCompEM().GetEnergy();
10611 }
10612 return energy;
10613 }
10614
10615
10617 {
10618 super.OnEnergyConsumed();
10619
10621 }
10622
10624 {
10625 super.OnEnergyAdded();
10626
10628 }
10629
10630
10632 {
10633 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10634 {
10636 {
10637 float energy_0to1 = GetCompEM().GetEnergy0To1();
10639 }
10640 }
10641 }
10642
10643
10645 {
10646 return ConfigGetFloat("heatIsolation");
10647 }
10648
10650 {
10652 }
10653
10655 {
10656 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10657 if (
g_Game.ConfigIsExisting(paramPath))
10658 return g_Game.ConfigGetFloat(paramPath);
10659
10660 return 0.0;
10661 }
10662
10664 {
10665 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10666 if (
g_Game.ConfigIsExisting(paramPath))
10667 return g_Game.ConfigGetFloat(paramPath);
10668
10669 return 0.0;
10670 }
10671
10672 override void SetWet(
float value,
bool allow_client =
false)
10673 {
10674 if (!IsServerCheck(allow_client))
10675 return;
10676
10679
10681
10682 m_VarWet = Math.Clamp(value, min, max);
10683
10685 {
10688 }
10689 }
10690
10691 override void AddWet(
float value)
10692 {
10694 }
10695
10697 {
10699 }
10700
10702 {
10704 }
10705
10707 {
10709 }
10710
10712 {
10714 }
10715
10717 {
10719 }
10720
10721 override void OnWetChanged(
float newVal,
float oldVal)
10722 {
10725 if (newLevel != oldLevel)
10726 {
10728 }
10729 }
10730
10732 {
10733 SetWeightDirty();
10734 }
10735
10737 {
10738 return GetWetLevelInternal(
m_VarWet);
10739 }
10740
10741
10742
10744 {
10746 }
10747
10749 {
10751 }
10752
10754 {
10756 }
10757
10759 {
10761 }
10762
10763
10764
10766 {
10767 if (ConfigIsExisting("itemModelLength"))
10768 {
10769 return ConfigGetFloat("itemModelLength");
10770 }
10771 return 0;
10772 }
10773
10775 {
10776 if (ConfigIsExisting("itemAttachOffset"))
10777 {
10778 return ConfigGetFloat("itemAttachOffset");
10779 }
10780 return 0;
10781 }
10782
10783 override void SetCleanness(
int value,
bool allow_client =
false)
10784 {
10785 if (!IsServerCheck(allow_client))
10786 return;
10787
10789
10791
10794 }
10795
10797 {
10799 }
10800
10802 {
10803 return true;
10804 }
10805
10806
10807
10808
10810 {
10812 }
10813
10815 {
10817 }
10818
10819
10820
10821
10822 override void SetColor(
int r,
int g,
int b,
int a)
10823 {
10829 }
10831 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10832 {
10837 }
10838
10840 {
10842 }
10843
10846 {
10847 int r,g,b,a;
10849 r = r/255;
10850 g = g/255;
10851 b = b/255;
10852 a = a/255;
10853 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10854 }
10855
10856
10857
10858 override void SetLiquidType(
int value,
bool allow_client =
false)
10859 {
10860 if (!IsServerCheck(allow_client))
10861 return;
10862
10867 }
10868
10870 {
10871 return ConfigGetInt("varLiquidTypeInit");
10872 }
10873
10875 {
10877 }
10878
10880 {
10882 SetFrozen(false);
10883 }
10884
10887 {
10888 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10889 }
10890
10891
10894 {
10895 PlayerBase nplayer;
10896 if (PlayerBase.CastTo(nplayer, player))
10897 {
10899 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10900 }
10901 }
10902
10903
10906 {
10907 PlayerBase nplayer;
10908 if (PlayerBase.CastTo(nplayer,player))
10909 {
10910 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10911 }
10912
10913 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10914
10915 if (HasEnergyManager())
10916 {
10917 GetCompEM().UpdatePlugState();
10918 }
10919 }
10920
10921
10923 {
10924 super.OnPlacementStarted(player);
10925
10927 }
10928
10929 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10930 {
10932 {
10933 m_AdminLog.OnPlacementComplete(player,
this);
10934 }
10935
10936 super.OnPlacementComplete(player, position, orientation);
10937 }
10938
10939
10940
10941
10942
10944 {
10946 {
10947 return true;
10948 }
10949 else
10950 {
10951 return false;
10952 }
10953 }
10954
10955
10957 {
10959 {
10961 }
10962 }
10963
10964
10966 {
10968 }
10969
10971 {
10973 }
10974
10975 override void InsertAgent(
int agent,
float count = 1)
10976 {
10977 if (count < 1)
10978 return;
10979
10981 }
10982
10985 {
10987 }
10988
10989
10991 {
10993 }
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11037 {
11039 return false;
11040 return true;
11041 }
11042
11044 {
11045
11047 }
11048
11049
11052 {
11053 super.CheckForRoofLimited(timeTresholdMS);
11054
11055 float time =
g_Game.GetTime();
11056 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11057 {
11058 m_PreviousRoofTestTime = time;
11059 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11060 }
11061 }
11062
11063
11065 {
11067 {
11068 return 0;
11069 }
11070
11071 if (GetInventory().GetAttachmentSlotsCount() != 0)
11072 {
11073 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11074 if (filter)
11075 return filter.GetProtectionLevel(type, false, system);
11076 else
11077 return 0;
11078 }
11079
11080 string subclassPath, entryName;
11081
11082 switch (type)
11083 {
11085 entryName = "biological";
11086 break;
11088 entryName = "chemical";
11089 break;
11090 default:
11091 entryName = "biological";
11092 break;
11093 }
11094
11095 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11096
11097 return g_Game.ConfigGetFloat(subclassPath + entryName);
11098 }
11099
11100
11101
11104 {
11105 if (!IsMagazine())
11107
11109 }
11110
11111
11112
11113
11114
11119 {
11120 return true;
11121 }
11122
11124 {
11126 }
11127
11128
11129
11130
11131
11133 {
11134 if (parent)
11135 {
11136 if (parent.IsInherited(DayZInfected))
11137 return true;
11138
11139 if (!parent.IsRuined())
11140 return true;
11141 }
11142
11143 return true;
11144 }
11145
11147 {
11148 if (!super.CanPutAsAttachment(parent))
11149 {
11150 return false;
11151 }
11152
11153 if (!IsRuined() && !parent.IsRuined())
11154 {
11155 return true;
11156 }
11157
11158 return false;
11159 }
11160
11162 {
11163
11164
11165
11166
11167 return super.CanReceiveItemIntoCargo(item);
11168 }
11169
11171 {
11172
11173
11174
11175
11176 GameInventory attachmentInv = attachment.GetInventory();
11178 {
11179 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11180 return false;
11181 }
11182
11183 InventoryLocation loc = new InventoryLocation();
11184 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11185 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11186 return false;
11187
11188 return super.CanReceiveAttachment(attachment, slotId);
11189 }
11190
11192 {
11193 if (!super.CanReleaseAttachment(attachment))
11194 return false;
11195
11196 return GetInventory().AreChildrenAccessible();
11197 }
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11220 {
11221 int id = muzzle_owner.GetMuzzleID();
11222 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11223
11224 if (WPOF_array)
11225 {
11226 for (int i = 0; i < WPOF_array.Count(); i++)
11227 {
11228 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11229
11230 if (WPOF)
11231 {
11232 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11233 }
11234 }
11235 }
11236 }
11237
11238
11240 {
11241 int id = muzzle_owner.GetMuzzleID();
11243
11244 if (WPOBE_array)
11245 {
11246 for (int i = 0; i < WPOBE_array.Count(); i++)
11247 {
11248 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11249
11250 if (WPOBE)
11251 {
11252 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11253 }
11254 }
11255 }
11256 }
11257
11258
11260 {
11261 int id = muzzle_owner.GetMuzzleID();
11262 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11263
11264 if (WPOOH_array)
11265 {
11266 for (int i = 0; i < WPOOH_array.Count(); i++)
11267 {
11268 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11269
11270 if (WPOOH)
11271 {
11272 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11273 }
11274 }
11275 }
11276 }
11277
11278
11280 {
11281 int id = muzzle_owner.GetMuzzleID();
11282 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11283
11284 if (WPOOH_array)
11285 {
11286 for (int i = 0; i < WPOOH_array.Count(); i++)
11287 {
11288 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11289
11290 if (WPOOH)
11291 {
11292 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11293 }
11294 }
11295 }
11296 }
11297
11298
11300 {
11301 int id = muzzle_owner.GetMuzzleID();
11302 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11303
11304 if (WPOOH_array)
11305 {
11306 for (int i = 0; i < WPOOH_array.Count(); i++)
11307 {
11308 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11309
11310 if (WPOOH)
11311 {
11312 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11313 }
11314 }
11315 }
11316 }
11317
11318
11319
11321 {
11323 {
11324 return true;
11325 }
11326
11327 return false;
11328 }
11329
11331 {
11333 {
11334 return true;
11335 }
11336
11337 return false;
11338 }
11339
11341 {
11343 {
11344 return true;
11345 }
11346
11347 return false;
11348 }
11349
11351 {
11352 return false;
11353 }
11354
11357 {
11358 return UATimeSpent.DEFAULT_DEPLOY;
11359 }
11360
11361
11362
11363
11365 {
11367 SetSynchDirty();
11368 }
11369
11371 {
11373 }
11374
11375
11377 {
11378 return false;
11379 }
11380
11383 {
11384 string att_type = "None";
11385
11386 if (ConfigIsExisting("soundAttType"))
11387 {
11388 att_type = ConfigGetString("soundAttType");
11389 }
11390
11392 }
11393
11395 {
11397 }
11398
11399
11400
11401
11402
11408
11410 {
11413
11415 }
11416
11417
11419 {
11421 return;
11422
11424
11427
11430
11431 SoundParameters params = new SoundParameters();
11435 }
11436
11437
11439 {
11441 {
11444
11445 SetSynchDirty();
11446
11449 }
11450 }
11451
11453 {
11455 }
11456
11457
11459 {
11461 return;
11462
11464 SetSynchDirty();
11465
11468 }
11469
11471 {
11474 }
11475
11477 {
11479 }
11480
11481 void OnApply(PlayerBase player);
11482
11484 {
11485 return 1.0;
11486 };
11487
11489 {
11491 }
11492
11494 {
11496 }
11497
11499
11501 {
11502 SetDynamicPhysicsLifeTime(0.01);
11504 }
11505
11507 {
11508 array<string> zone_names = new array<string>;
11509 GetDamageZones(zone_names);
11510 for (int i = 0; i < zone_names.Count(); i++)
11511 {
11512 SetHealthMax(zone_names.Get(i),"Health");
11513 }
11514 SetHealthMax("","Health");
11515 }
11516
11519 {
11520 float global_health = GetHealth01("","Health");
11521 array<string> zones = new array<string>;
11522 GetDamageZones(zones);
11523
11524 for (int i = 0; i < zones.Count(); i++)
11525 {
11526 SetHealth01(zones.Get(i),"Health",global_health);
11527 }
11528 }
11529
11532 {
11533 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11534 }
11535
11537 {
11538 if (!hasRootAsPlayer)
11539 {
11540 if (refParentIB)
11541 {
11542
11543 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11544 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11545
11546 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11547 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11548
11551 }
11552 else
11553 {
11554
11557 }
11558 }
11559 }
11560
11562 {
11564 {
11565 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11566 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11567 {
11568 float heatPermCoef = 1.0;
11570 while (ent)
11571 {
11572 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11573 ent = ent.GetHierarchyParent();
11574 }
11575
11576 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11577 }
11578 }
11579 }
11580
11582 {
11583
11584 EntityAI parent = GetHierarchyParent();
11585 if (!parent)
11586 {
11587 hasParent = false;
11588 hasRootAsPlayer = false;
11589 }
11590 else
11591 {
11592 hasParent = true;
11593 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11594 refParentIB =
ItemBase.Cast(parent);
11595 }
11596 }
11597
11598 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11599 {
11600
11601 }
11602
11604 {
11605
11606 return false;
11607 }
11608
11610 {
11611
11612
11613 return false;
11614 }
11615
11617 {
11618
11619 return false;
11620 }
11621
11624 {
11625 return !GetIsFrozen() &&
IsOpen();
11626 }
11627
11629 {
11630 bool hasParent = false, hasRootAsPlayer = false;
11632
11633 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11634 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11635
11636 if (wwtu || foodDecay)
11637 {
11641
11642 if (processWetness || processTemperature || processDecay)
11643 {
11645
11646 if (processWetness)
11647 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11648
11649 if (processTemperature)
11651
11652 if (processDecay)
11653 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11654 }
11655 }
11656 }
11657
11660 {
11662 }
11663
11665 {
11668
11669 return super.GetTemperatureFreezeThreshold();
11670 }
11671
11673 {
11676
11677 return super.GetTemperatureThawThreshold();
11678 }
11679
11681 {
11684
11685 return super.GetItemOverheatThreshold();
11686 }
11687
11689 {
11691 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11692
11693 return super.GetTemperatureFreezeTime();
11694 }
11695
11697 {
11699 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11700
11701 return super.GetTemperatureThawTime();
11702 }
11703
11708
11710 {
11711 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11712 }
11713
11715 {
11716 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11717 }
11718
11721 {
11723 }
11724
11726 {
11728 }
11729
11731 {
11733 }
11734
11737 {
11738 return null;
11739 }
11740
11743 {
11744 return false;
11745 }
11746
11748 {
11750 {
11753 if (!trg)
11754 {
11756 explosive = this;
11757 }
11758
11759 explosive.PairRemote(trg);
11761
11762 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11763 trg.SetPersistentPairID(persistentID);
11764 explosive.SetPersistentPairID(persistentID);
11765
11766 return true;
11767 }
11768 return false;
11769 }
11770
11773 {
11774 float ret = 1.0;
11777 ret *= GetHealth01();
11778
11779 return ret;
11780 }
11781
11782 #ifdef DEVELOPER
11783 override void SetDebugItem()
11784 {
11785 super.SetDebugItem();
11786 _itemBase = this;
11787 }
11788
11790 {
11791 string text = super.GetDebugText();
11792
11794 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11795
11796 return text;
11797 }
11798 #endif
11799
11801 {
11802 return true;
11803 }
11804
11806
11808
11810 {
11813 }
11814
11815
11823
11839
11840 [
Obsolete(
"Use ItemSoundHandler instead")]
11843 {
11844 if (!
g_Game.IsDedicatedServer())
11845 {
11846 if (ConfigIsExisting("attachSoundSet"))
11847 {
11848 string cfg_path = "";
11849 string soundset = "";
11850 string type_name =
GetType();
11851
11854 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11855 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11856
11857 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11858 {
11859 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11860 {
11861 if (cfg_slot_array[i] == slot_type)
11862 {
11863 soundset = cfg_soundset_array[i];
11864 break;
11865 }
11866 }
11867 }
11868
11869 if (soundset != "")
11870 {
11871 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11873 }
11874 }
11875 }
11876 }
11877
11879}
11880
11882{
11884 if (entity)
11885 {
11886 bool is_item = entity.IsInherited(
ItemBase);
11887 if (is_item && full_quantity)
11888 {
11891 }
11892 }
11893 else
11894 {
11896 return NULL;
11897 }
11898 return entity;
11899}
11900
11902{
11903 if (item)
11904 {
11905 if (health > 0)
11906 item.SetHealth("", "", health);
11907
11908 if (item.CanHaveTemperature())
11909 {
11911 if (item.CanFreeze())
11912 item.SetFrozen(false);
11913 }
11914
11915 if (item.HasEnergyManager())
11916 {
11917 if (quantity >= 0)
11918 {
11919 item.GetCompEM().SetEnergy0To1(quantity);
11920 }
11921 else
11922 {
11924 }
11925 }
11926 else if (item.IsMagazine())
11927 {
11928 Magazine mag = Magazine.Cast(item);
11929 if (quantity >= 0)
11930 {
11931 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11932 }
11933 else
11934 {
11936 }
11937
11938 }
11939 else
11940 {
11941 if (quantity >= 0)
11942 {
11943 item.SetQuantityNormalized(quantity, false);
11944 }
11945 else
11946 {
11948 }
11949
11950 }
11951 }
11952}
11953
11954#ifdef DEVELOPER
11956#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.