Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first when overriding this event.
6947{
6949 {
6950 return true;
6951 }
6952};
6953
6955{
6956
6957};
6958
6959
6960
6962{
6966
6968
6971
6972
6973
6974
6975
6984
6990
6995
7000
7021 protected bool m_IsResultOfSplit
7022
7024
7029
7030
7031
7033
7037
7038
7039
7041
7044
7045
7046
7052
7053
7061
7064
7065
7067
7068
7070
7071
7076
7077
7082
7084
7085
7087
7088
7090 {
7095
7096 if (!
g_Game.IsDedicatedServer())
7097 {
7099 {
7101
7103 {
7105 }
7106 }
7107
7110 }
7111
7112 m_OldLocation = null;
7113
7115 {
7117 }
7118
7119 if (ConfigIsExisting("headSelectionsToHide"))
7120 {
7123 }
7124
7126 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7127 {
7129 }
7130
7132
7133 m_IsResultOfSplit = false;
7134
7136 }
7137
7139 {
7140 super.InitItemVariables();
7141
7147 m_Count = ConfigGetInt(
"count");
7148
7151
7156
7159
7164
7176
7180
7181
7184 if (ConfigIsExisting("canBeSplit"))
7185 {
7188 }
7189
7191 if (ConfigIsExisting("itemBehaviour"))
7193
7194
7197 RegisterNetSyncVariableInt("m_VarLiquidType");
7198 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7199
7200 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7201 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7202 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7203
7204 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7205 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7206 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7207 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7208
7209 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7210 RegisterNetSyncVariableBool("m_IsTakeable");
7211 RegisterNetSyncVariableBool("m_IsHologram");
7212
7215 {
7218 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7219 }
7220
7222
7224 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7226
7228 }
7229
7231 {
7233 }
7234
7236 {
7239 {
7244 }
7245 }
7246
7247 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7248 {
7250 {
7253 }
7254
7256 }
7257
7259 {
7265 }
7266
7268
7270 {
7272
7273 if (!action)
7274 {
7275 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7276 return;
7277 }
7278
7280 if (!ai)
7281 {
7283 return;
7284 }
7285
7287 if (!action_array)
7288 {
7289 action_array = new array<ActionBase_Basic>;
7291 }
7292 if (LogManager.IsActionLogEnable())
7293 {
7294 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7295 }
7296
7297 if (action_array.Find(action) != -1)
7298 {
7299 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7300 }
7301 else
7302 {
7303 action_array.Insert(action);
7304 }
7305 }
7306
7308 {
7309 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7310 ActionBase action = player.GetActionManager().GetAction(actionName);
7313
7314 if (action_array)
7315 {
7316 action_array.RemoveItem(action);
7317 }
7318 }
7319
7320
7321
7323 {
7324 ActionOverrideData overrideData = new ActionOverrideData();
7328
7330 if (!actionMap)
7331 {
7334 }
7335
7336 actionMap.Insert(this.
Type(), overrideData);
7337
7338 }
7339
7341
7343
7344
7346 {
7349
7352
7353 string config_to_search = "CfgVehicles";
7354 string muzzle_owner_config;
7355
7357 {
7358 if (IsInherited(Weapon))
7359 config_to_search = "CfgWeapons";
7360
7361 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7362
7363 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7364
7365 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7366
7367 if (config_OnFire_subclass_count > 0)
7368 {
7369 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7370
7371 for (int i = 0; i < config_OnFire_subclass_count; i++)
7372 {
7373 string particle_class = "";
7374 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7375 string config_OnFire_entry = config_OnFire_class + particle_class;
7376 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7377 WPOF_array.Insert(WPOF);
7378 }
7379
7380
7382 }
7383 }
7384
7386 {
7387 config_to_search = "CfgWeapons";
7388 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7389
7390 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7391
7392 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7393
7394 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7395 {
7396 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7397
7398 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7399 {
7400 string particle_class2 = "";
7401 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7402 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7403 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7404 WPOBE_array.Insert(WPOBE);
7405 }
7406
7407
7409 }
7410 }
7411 }
7412
7413
7415 {
7418
7420 {
7421 string config_to_search = "CfgVehicles";
7422
7423 if (IsInherited(Weapon))
7424 config_to_search = "CfgWeapons";
7425
7426 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7427 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7428
7429 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7430 {
7431
7433
7435 {
7437 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7439 return;
7440 }
7441
7444
7445
7446
7447 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7448 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7449
7450 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7451 {
7452 string particle_class = "";
7453 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7454 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7455 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7456
7457 if (entry_type == CT_CLASS)
7458 {
7459 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7460 WPOOH_array.Insert(WPOF);
7461 }
7462 }
7463
7464
7466 }
7467 }
7468 }
7469
7471 {
7473 }
7474
7476 {
7478 {
7480
7483
7486
7487 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7488 }
7489 }
7490
7492 {
7494 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7495
7497 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7498
7500 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7501
7503 {
7505 }
7506 }
7507
7509 {
7511 }
7512
7514 {
7517 else
7519
7521 {
7524 }
7525 else
7526 {
7529
7532 }
7533
7535 }
7536
7538 {
7540 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7541 }
7542
7544 {
7546 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7548 }
7549
7551 {
7553 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7554 }
7555
7557 {
7560
7561 OverheatingParticle OP = new OverheatingParticle();
7566
7568 }
7569
7571 {
7574
7575 return -1;
7576 }
7577
7579 {
7581 {
7584
7585 for (int i = count; i > 0; --i)
7586 {
7587 int id = i - 1;
7590
7593
7594 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7595 {
7596 if (p)
7597 {
7600 }
7601 }
7602 }
7603 }
7604 }
7605
7607 {
7609 {
7611 {
7612 int id = i - 1;
7614
7615 if (OP)
7616 {
7618
7619 if (p)
7620 {
7622 }
7623
7624 delete OP;
7625 }
7626 }
7627
7630 }
7631 }
7632
7635 {
7636 return 0.0;
7637 }
7638
7639
7641 {
7642 return 250;
7643 }
7644
7646 {
7647 return 0;
7648 }
7649
7652 {
7654 return true;
7655
7656 return false;
7657 }
7658
7661 {
7664
7666 {
7668 }
7669 else
7670 {
7671
7673 }
7674
7676 }
7677
7684 {
7685 return -1;
7686 }
7687
7688
7689
7690
7692 {
7694 {
7695 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7696 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7697
7698 if (r_index >= 0)
7699 {
7700 InventoryLocation r_il = new InventoryLocation;
7701 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7702
7703 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7706 {
7707 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7708 }
7710 {
7711 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7712 }
7713
7714 }
7715
7716 player.GetHumanInventory().ClearUserReservedLocation(this);
7717 }
7718
7721 }
7722
7723
7724
7725
7727 {
7728 return ItemBase.m_DebugActionsMask;
7729 }
7730
7732 {
7733 return ItemBase.m_DebugActionsMask & mask;
7734 }
7735
7737 {
7738 ItemBase.m_DebugActionsMask = mask;
7739 }
7740
7742 {
7743 ItemBase.m_DebugActionsMask |= mask;
7744 }
7745
7747 {
7748 ItemBase.m_DebugActionsMask &= ~mask;
7749 }
7750
7752 {
7754 {
7756 }
7757 else
7758 {
7760 }
7761 }
7762
7763
7765 {
7766 if (GetEconomyProfile())
7767 {
7768 float q_max = GetEconomyProfile().GetQuantityMax();
7769 if (q_max > 0)
7770 {
7771 float q_min = GetEconomyProfile().GetQuantityMin();
7772 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7773
7775 {
7776 ComponentEnergyManager comp = GetCompEM();
7778 {
7780 }
7781 }
7783 {
7785
7786 }
7787
7788 }
7789 }
7790 }
7791
7794 {
7795 EntityAI parent = GetHierarchyParent();
7796
7797 if (parent)
7798 {
7799 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7800 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7801 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7802 }
7803 }
7804
7807 {
7808 EntityAI parent = GetHierarchyParent();
7809
7810 if (parent)
7811 {
7812 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7813 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7814 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7815 }
7816 }
7817
7819 {
7820
7821
7822
7823
7825
7827 {
7828 if (ScriptInputUserData.CanStoreInputUserData())
7829 {
7830 ScriptInputUserData ctx = new ScriptInputUserData;
7836 ctx.
Write(use_stack_max);
7839
7841 {
7842 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7843 }
7844 }
7845 }
7846 else if (!
g_Game.IsMultiplayer())
7847 {
7849 }
7850 }
7851
7853 {
7855 }
7856
7858 {
7860 }
7861
7863 {
7865 }
7866
7868 {
7869
7870 return false;
7871 }
7872
7874 {
7875 return false;
7876 }
7877
7881 {
7882 return false;
7883 }
7884
7886 {
7887 return "";
7888 }
7889
7891
7893 {
7894 return false;
7895 }
7896
7898 {
7899 return true;
7900 }
7901
7902
7903
7905 {
7906 return true;
7907 }
7908
7910 {
7911 return true;
7912 }
7913
7915 {
7916 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7918 }
7919
7921 {
7923 }
7924
7926 {
7928 if (!is_being_placed)
7930 SetSynchDirty();
7931 }
7932
7933
7935
7937 {
7939 }
7940
7942 {
7944 }
7945
7947 {
7948 return 1;
7949 }
7950
7952 {
7953 return false;
7954 }
7955
7957 {
7959 SetSynchDirty();
7960 }
7961
7962
7963
7964
7965
7966
7967
7968
7969
7970
7971
7972
7973
7974
7975
7976
7977
7978
7979
7980
7981
7982
7983
7984
7985
7986
7987
7988
7989
7990
7991
7992
7993
7994
7995
7997 {
7998 super.OnMovedInsideCargo(container);
7999
8000 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8001 }
8002
8003 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8004 {
8005 super.EEItemLocationChanged(oldLoc, newLoc);
8006
8007 PlayerBase newPlayer = null;
8008 PlayerBase oldPlayer = null;
8009
8010 if (newLoc.GetParent())
8011 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8012
8013 if (oldLoc.GetParent())
8014 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8015
8017 {
8018 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8019
8020 if (rIndex >= 0)
8021 {
8022 InventoryLocation rIl = new InventoryLocation;
8023 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8024
8025 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8028 {
8029 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8030 }
8032 {
8034 }
8035
8036 }
8037 }
8038
8040 {
8041 if (newPlayer)
8042 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8043
8044 if (newPlayer == oldPlayer)
8045 {
8046 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8047 {
8049 {
8050 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8051 {
8052 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8053 }
8054 }
8055 else
8056 {
8057 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8058 }
8059 }
8060
8061 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8062 {
8063 int type = oldLoc.GetType();
8065 {
8066 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8067 }
8069 {
8070 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8071 }
8072 }
8073 if (!m_OldLocation)
8074 {
8075 m_OldLocation = new InventoryLocation;
8076 }
8077 m_OldLocation.Copy(oldLoc);
8078 }
8079 else
8080 {
8081 if (m_OldLocation)
8082 {
8083 m_OldLocation.Reset();
8084 }
8085 }
8086
8087 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8088 }
8089 else
8090 {
8091 if (newPlayer)
8092 {
8093 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8094 if (resIndex >= 0)
8095 {
8096 InventoryLocation il = new InventoryLocation;
8097 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8099 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8102 {
8103 il.
GetParent().GetOnReleaseLock().Invoke(it);
8104 }
8106 {
8108 }
8109
8110 }
8111 }
8113 {
8114
8116 }
8117
8118 if (m_OldLocation)
8119 {
8120 m_OldLocation.Reset();
8121 }
8122 }
8123
8125 {
8126 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8127 }
8128
8130 {
8131 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8132 }
8133 }
8134
8135 override void EOnContact(IEntity other, Contact extra)
8136 {
8138 {
8139 int liquidType = -1;
8141 if (impactSpeed > 0.0)
8142 {
8144 #ifndef SERVER
8146 #else
8148 SetSynchDirty();
8149 #endif
8151 }
8152 }
8153
8154 #ifdef SERVER
8155 if (GetCompEM() && GetCompEM().IsPlugged())
8156 {
8157 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8158 GetCompEM().UnplugThis();
8159 }
8160 #endif
8161 }
8162
8164
8166 {
8168 }
8169
8171 {
8172
8173 }
8174
8176 {
8177 super.OnItemLocationChanged(old_owner, new_owner);
8178
8179 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8180 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8181
8182 if (!relatedPlayer && playerNew)
8183 relatedPlayer = playerNew;
8184
8185 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8186 {
8188 if (actionMgr)
8189 {
8190 ActionBase currentAction = actionMgr.GetRunningAction();
8191 if (currentAction)
8193 }
8194 }
8195
8196 Man ownerPlayerOld = null;
8197 Man ownerPlayerNew = null;
8198
8199 if (old_owner)
8200 {
8201 if (old_owner.
IsMan())
8202 {
8203 ownerPlayerOld = Man.Cast(old_owner);
8204 }
8205 else
8206 {
8207 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8208 }
8209 }
8210 else
8211 {
8213 {
8215
8216 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8217 {
8218 GetCompEM().UnplugThis();
8219 }
8220 }
8221 }
8222
8223 if (new_owner)
8224 {
8225 if (new_owner.
IsMan())
8226 {
8227 ownerPlayerNew = Man.Cast(new_owner);
8228 }
8229 else
8230 {
8231 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8232 }
8233 }
8234
8235 if (ownerPlayerOld != ownerPlayerNew)
8236 {
8237 if (ownerPlayerOld)
8238 {
8239 array<EntityAI> subItemsExit = new array<EntityAI>;
8241 for (int i = 0; i < subItemsExit.Count(); i++)
8242 {
8245 }
8246 }
8247
8248 if (ownerPlayerNew)
8249 {
8250 array<EntityAI> subItemsEnter = new array<EntityAI>;
8252 for (int j = 0; j < subItemsEnter.Count(); j++)
8253 {
8256 }
8257 }
8258 }
8259 else if (ownerPlayerNew != null)
8260 {
8261 PlayerBase nplayer;
8262 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8263 {
8264 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8266 for (int k = 0; k < subItemsUpdate.Count(); k++)
8267 {
8269 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8270 }
8271 }
8272 }
8273
8274 if (old_owner)
8275 old_owner.OnChildItemRemoved(this);
8276 if (new_owner)
8277 new_owner.OnChildItemReceived(this);
8278 }
8279
8280
8282 {
8283 super.EEDelete(parent);
8284 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8285 if (player)
8286 {
8288
8289 if (player.IsAlive())
8290 {
8291 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8292 if (r_index >= 0)
8293 {
8294 InventoryLocation r_il = new InventoryLocation;
8295 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8296
8297 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8300 {
8301 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8302 }
8304 {
8305 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8306 }
8307
8308 }
8309
8310 player.RemoveQuickBarEntityShortcut(this);
8311 }
8312 }
8313 }
8314
8316 {
8317 super.EEKilled(killer);
8318
8321 {
8322 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8323 {
8324 if (IsMagazine())
8325 {
8326 if (Magazine.Cast(this).GetAmmoCount() > 0)
8327 {
8329 }
8330 }
8331 else
8332 {
8334 }
8335 }
8336 }
8337 }
8338
8340 {
8341 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8342
8343 super.OnWasAttached(parent, slot_id);
8344
8347
8350 }
8351
8353 {
8354 super.OnWasDetached(parent, slot_id);
8355
8358
8361 }
8362
8364 {
8365 int idx;
8368
8369 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8370 if (inventory_slots.Count() < 1)
8371 {
8372 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8373 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8374 }
8375 else
8376 {
8377 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8378 }
8379
8380 idx = inventory_slots.Find(slot);
8381 if (idx < 0)
8382 return "";
8383
8384 return attach_types.Get(idx);
8385 }
8386
8388 {
8389 int idx = -1;
8390 string slot;
8391
8394
8395 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8396 if (inventory_slots.Count() < 1)
8397 {
8398 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8399 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8400 }
8401 else
8402 {
8403 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8404 if (detach_types.Count() < 1)
8405 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8406 }
8407
8408 for (int i = 0; i < inventory_slots.Count(); i++)
8409 {
8410 slot = inventory_slots.Get(i);
8411 }
8412
8413 if (slot != "")
8414 {
8415 if (detach_types.Count() == 1)
8416 idx = 0;
8417 else
8418 idx = inventory_slots.Find(slot);
8419 }
8420 if (idx < 0)
8421 return "";
8422
8423 return detach_types.Get(idx);
8424 }
8425
8427 {
8428
8430
8431
8432 float min_time = 1;
8433 float max_time = 3;
8434 float delay = Math.RandomFloat(min_time, max_time);
8435
8436 explode_timer.Run(delay, this, "DoAmmoExplosion");
8437 }
8438
8440 {
8441 Magazine magazine = Magazine.Cast(this);
8442 int pop_sounds_count = 6;
8443 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8444
8445
8446 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8447 string sound_name = pop_sounds[ sound_idx ];
8448 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8449
8450
8451 magazine.ServerAddAmmoCount(-1);
8452
8453
8454 float min_temp_to_explode = 100;
8455
8456 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8457 {
8459 }
8460 }
8461
8462
8463 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8464 {
8465 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8466
8467 const int CHANCE_DAMAGE_CARGO = 4;
8468 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8469 const int CHANCE_DAMAGE_NOTHING = 2;
8470
8472 {
8473 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8474 int chances;
8475 int rnd;
8476
8477 if (GetInventory().GetCargo())
8478 {
8479 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8480 rnd = Math.RandomInt(0,chances);
8481
8482 if (rnd < CHANCE_DAMAGE_CARGO)
8483 {
8485 }
8486 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8487 {
8489 }
8490 }
8491 else
8492 {
8493 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8494 rnd = Math.RandomInt(0,chances);
8495
8496 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8497 {
8499 }
8500 }
8501 }
8502 }
8503
8505 {
8506 CargoBase cargo = GetInventory().GetCargo();
8507 if (cargo)
8508 {
8510 if (item_count > 0)
8511 {
8512 int random_pick = Math.RandomInt(0, item_count);
8514 if (!item.IsExplosive())
8515 {
8516 item.AddHealth("","",damage);
8517 return true;
8518 }
8519 }
8520 }
8521 return false;
8522 }
8523
8525 {
8526 GameInventory inventory = GetInventory();
8528 if (attachment_count > 0)
8529 {
8530 int random_pick = Math.RandomInt(0, attachment_count);
8532 if (!attachment.IsExplosive())
8533 {
8534 attachment.AddHealth("","",damage);
8535 return true;
8536 }
8537 }
8538 return false;
8539 }
8540
8542 {
8544 }
8545
8547 {
8549 return GetInventory().CanRemoveEntity();
8550
8551 return false;
8552 }
8553
8555 {
8556
8558 return false;
8559
8560
8562 return false;
8563
8564
8565
8567 if (delta == 0)
8568 return false;
8569
8570
8571 return true;
8572 }
8573
8575 {
8577 {
8578 if (ScriptInputUserData.CanStoreInputUserData())
8579 {
8580 ScriptInputUserData ctx = new ScriptInputUserData;
8585 ctx.
Write(destination_entity);
8589 }
8590 }
8591 else if (!
g_Game.IsMultiplayer())
8592 {
8594 }
8595 }
8596
8598 {
8599 float split_quantity_new;
8603 InventoryLocation loc = new InventoryLocation;
8604
8605 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8606 {
8608 split_quantity_new = stack_max;
8609 else
8611
8613 {
8614 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8615 if (new_item)
8616 {
8617 new_item.SetResultOfSplit(true);
8618 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8620 new_item.
SetQuantity(split_quantity_new,
false,
true);
8621 }
8622 }
8623 }
8624 else if (destination_entity && slot_id == -1)
8625 {
8626 if (quantity > stack_max)
8627 split_quantity_new = stack_max;
8628 else
8629 split_quantity_new = quantity;
8630
8632 {
8633 GameInventory destinationInventory = destination_entity.GetInventory();
8635 {
8638 }
8639
8640 if (new_item)
8641 {
8642 new_item.SetResultOfSplit(true);
8643 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8645 new_item.
SetQuantity(split_quantity_new,
false,
true);
8646 }
8647 }
8648 }
8649 else
8650 {
8651 if (stack_max != 0)
8652 {
8654 {
8656 }
8657
8658 if (split_quantity_new == 0)
8659 {
8660 if (!
g_Game.IsMultiplayer())
8661 player.PhysicalPredictiveDropItem(this);
8662 else
8663 player.ServerDropEntity(this);
8664 return;
8665 }
8666
8668 {
8670
8671 if (new_item)
8672 {
8673 new_item.SetResultOfSplit(true);
8674 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8677 new_item.PlaceOnSurface();
8678 }
8679 }
8680 }
8681 }
8682 }
8683
8685 {
8686 float split_quantity_new;
8690 InventoryLocation loc = new InventoryLocation;
8691
8692 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8693 {
8695 split_quantity_new = stack_max;
8696 else
8698
8700 {
8701 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8702 if (new_item)
8703 {
8704 new_item.SetResultOfSplit(true);
8705 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8707 new_item.
SetQuantity(split_quantity_new,
false,
true);
8708 }
8709 }
8710 }
8711 else if (destination_entity && slot_id == -1)
8712 {
8713 if (quantity > stack_max)
8714 split_quantity_new = stack_max;
8715 else
8716 split_quantity_new = quantity;
8717
8719 {
8720 GameInventory destinationInventory = destination_entity.GetInventory();
8722 {
8725 }
8726
8727 if (new_item)
8728 {
8729 new_item.SetResultOfSplit(true);
8730 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8732 new_item.
SetQuantity(split_quantity_new,
false,
true);
8733 }
8734 }
8735 }
8736 else
8737 {
8738 if (stack_max != 0)
8739 {
8741 {
8743 }
8744
8746 {
8748
8749 if (new_item)
8750 {
8751 new_item.SetResultOfSplit(true);
8752 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8755 new_item.PlaceOnSurface();
8756 }
8757 }
8758 }
8759 }
8760 }
8761
8763 {
8765 {
8766 if (ScriptInputUserData.CanStoreInputUserData())
8767 {
8768 ScriptInputUserData ctx = new ScriptInputUserData;
8773 dst.WriteToContext(ctx);
8775 }
8776 }
8777 else if (!
g_Game.IsMultiplayer())
8778 {
8780 }
8781 }
8782
8784 {
8786 {
8787 if (ScriptInputUserData.CanStoreInputUserData())
8788 {
8789 ScriptInputUserData ctx = new ScriptInputUserData;
8794 ctx.
Write(destination_entity);
8800 }
8801 }
8802 else if (!
g_Game.IsMultiplayer())
8803 {
8805 }
8806 }
8807
8809 {
8811 }
8812
8814 {
8816 float split_quantity_new;
8818 if (dst.IsValid())
8819 {
8820 int slot_id = dst.GetSlot();
8822
8823 if (quantity > stack_max)
8824 split_quantity_new = stack_max;
8825 else
8826 split_quantity_new = quantity;
8827
8829 {
8831
8832 if (new_item)
8833 {
8834 new_item.SetResultOfSplit(true);
8835 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8837 new_item.
SetQuantity(split_quantity_new,
false,
true);
8838 }
8839
8840 return new_item;
8841 }
8842 }
8843
8844 return null;
8845 }
8846
8848 {
8850 float split_quantity_new;
8852 if (destination_entity)
8853 {
8855 if (quantity > stackable)
8856 split_quantity_new = stackable;
8857 else
8858 split_quantity_new = quantity;
8859
8861 {
8862 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8863 if (new_item)
8864 {
8865 new_item.SetResultOfSplit(true);
8866 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8868 new_item.
SetQuantity(split_quantity_new,
false,
true);
8869 }
8870 }
8871 }
8872 }
8873
8875 {
8877 {
8878 if (ScriptInputUserData.CanStoreInputUserData())
8879 {
8880 ScriptInputUserData ctx = new ScriptInputUserData;
8885 ItemBase destination_entity =
this;
8886 ctx.
Write(destination_entity);
8890 }
8891 }
8892 else if (!
g_Game.IsMultiplayer())
8893 {
8895 }
8896 }
8897
8899 {
8901 float split_quantity_new;
8903 if (player)
8904 {
8906 if (quantity > stackable)
8907 split_quantity_new = stackable;
8908 else
8909 split_quantity_new = quantity;
8910
8912 {
8913 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8914 new_item =
ItemBase.Cast(in_hands);
8915 if (new_item)
8916 {
8917 new_item.SetResultOfSplit(true);
8918 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8920 new_item.SetQuantity(split_quantity_new, false, true);
8921 }
8922 }
8923 }
8924 }
8925
8927 {
8929 float split_quantity_new = Math.Floor(quantity * 0.5);
8930
8932 return;
8933
8935
8936 if (new_item)
8937 {
8938 if (new_item.GetQuantityMax() < split_quantity_new)
8939 {
8940 split_quantity_new = new_item.GetQuantityMax();
8941 }
8942
8943 new_item.SetResultOfSplit(true);
8944 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8945
8947 {
8950 }
8951 else
8952 {
8954 new_item.
SetQuantity(split_quantity_new,
false,
true);
8955 }
8956 }
8957 }
8958
8960 {
8962 float split_quantity_new = Math.Floor(quantity / 2);
8963
8965 return;
8966
8967 InventoryLocation invloc = new InventoryLocation;
8969
8971 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8972
8973 if (new_item)
8974 {
8975 if (new_item.GetQuantityMax() < split_quantity_new)
8976 {
8977 split_quantity_new = new_item.GetQuantityMax();
8978 }
8980 {
8983 }
8984 else if (split_quantity_new > 1)
8985 {
8987 new_item.
SetQuantity(split_quantity_new,
false,
true);
8988 }
8989 }
8990 }
8991
8994 {
8995 SetWeightDirty();
8997
8998 if (parent)
8999 parent.OnAttachmentQuantityChangedEx(this, delta);
9000
9002 {
9004 {
9006 }
9008 {
9009 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9011 }
9012 }
9013 }
9014
9017 {
9018
9019 }
9020
9023 {
9025 }
9026
9028 {
9029 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9030
9032 {
9033 if (newLevel == GameConstants.STATE_RUINED)
9034 {
9036 EntityAI parent = GetHierarchyParent();
9037 if (parent && parent.IsFireplace())
9038 {
9039 CargoBase cargo = GetInventory().GetCargo();
9040 if (cargo)
9041 {
9043 {
9045 }
9046 }
9047 }
9048 }
9049
9051 {
9052
9054 return;
9055 }
9056
9057 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9058 {
9060 }
9061 }
9062 }
9063
9064
9066 {
9067 super.OnRightClick();
9068
9070 {
9072 {
9073 if (ScriptInputUserData.CanStoreInputUserData())
9074 {
9075 EntityAI root = GetHierarchyRoot();
9076 Man playerOwner = GetHierarchyRootPlayer();
9077 InventoryLocation dst = new InventoryLocation;
9078
9079
9080 if (!playerOwner && root && root == this)
9081 {
9083 }
9084 else
9085 {
9086
9087 GetInventory().GetCurrentInventoryLocation(dst);
9089 {
9090 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9092 {
9094 }
9095 else
9096 {
9098
9099
9100 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9101 {
9103 }
9104 else
9105 {
9106 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9107 }
9108 }
9109 }
9110 }
9111
9112 ScriptInputUserData ctx = new ScriptInputUserData;
9120 }
9121 }
9122 else if (!
g_Game.IsMultiplayer())
9123 {
9125 }
9126 }
9127 }
9128
9130 {
9131 if (root)
9132 {
9133 vector m4[4];
9134 root.GetTransform(m4);
9135 dst.SetGround(this, m4);
9136 }
9137 else
9138 {
9139 GetInventory().GetCurrentInventoryLocation(dst);
9140 }
9141 }
9142
9143 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9144 {
9145
9146 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9147 return false;
9148
9149 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9150 return false;
9151
9152
9154 return false;
9155
9156
9157 Magazine mag = Magazine.Cast(this);
9158 if (mag)
9159 {
9160 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9161 return false;
9162
9163 if (stack_max_limit)
9164 {
9165 Magazine other_mag = Magazine.Cast(other_item);
9166 if (other_item)
9167 {
9168 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9169 return false;
9170 }
9171
9172 }
9173 }
9174 else
9175 {
9176
9178 return false;
9179
9181 return false;
9182 }
9183
9184 PlayerBase player = null;
9185 if (CastTo(player, GetHierarchyRootPlayer()))
9186 {
9187 if (player.GetInventory().HasAttachment(this))
9188 return false;
9189
9190 if (player.IsItemsToDelete())
9191 return false;
9192 }
9193
9194 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9195 return false;
9196
9197 int slotID;
9199 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9200 return false;
9201
9202 return true;
9203 }
9204
9206 {
9208 }
9209
9211 {
9212 return m_IsResultOfSplit;
9213 }
9214
9216 {
9217 m_IsResultOfSplit = value;
9218 }
9219
9221 {
9223 }
9224
9226 {
9227 float other_item_quantity = other_item.GetQuantity();
9228 float this_free_space;
9229
9231
9233
9234 if (other_item_quantity > this_free_space)
9235 {
9236 return this_free_space;
9237 }
9238 else
9239 {
9240 return other_item_quantity;
9241 }
9242 }
9243
9245 {
9247 }
9248
9250 {
9252 return;
9253
9254 if (!IsMagazine() && other_item)
9255 {
9257 if (quantity_used != 0)
9258 {
9259 float hp1 = GetHealth01("","");
9260 float hp2 = other_item.GetHealth01("","");
9261 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9262 hpResult = hpResult / (
GetQuantity() + quantity_used);
9263
9264 hpResult *= GetMaxHealth();
9265 Math.Round(hpResult);
9266 SetHealth("", "Health", hpResult);
9267
9269 other_item.AddQuantity(-quantity_used);
9270 }
9271 }
9273 }
9274
9276 {
9277 #ifdef SERVER
9278 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9279 GetHierarchyParent().IncreaseLifetimeUp();
9280 #endif
9281 };
9282
9284 {
9285 PlayerBase p = PlayerBase.Cast(player);
9286
9287 array<int> recipesIds = p.m_Recipes;
9288 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9289 if (moduleRecipesManager)
9290 {
9291 EntityAI itemInHands = player.GetEntityInHands();
9292 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9293 }
9294
9295 for (int i = 0;i < recipesIds.Count(); i++)
9296 {
9297 int key = recipesIds.Get(i);
9298 string recipeName = moduleRecipesManager.GetRecipeName(key);
9300 }
9301 }
9302
9303
9304 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9305 {
9306 super.GetDebugActions(outputList);
9307
9308
9314
9315
9320
9325
9326
9330
9331
9333 {
9337 }
9338
9341
9342
9346
9348
9349 InventoryLocation loc = new InventoryLocation();
9350 GetInventory().GetCurrentInventoryLocation(loc);
9352 {
9353 if (Gizmo_IsSupported())
9356 }
9357
9359 }
9360
9361
9362
9363
9365 {
9366 super.OnAction(action_id, player, ctx);
9367
9369 {
9370 switch (action_id)
9371 {
9375 return true;
9379 return true;
9380 }
9381 }
9382
9384 {
9385 switch (action_id)
9386 {
9388 Delete();
9389 return true;
9390 }
9391 }
9392
9393 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9394 {
9395 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9396 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9397 PlayerBase p = PlayerBase.Cast(player);
9398 if (
EActions.RECIPES_RANGE_START < 1000)
9399 {
9400 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9401 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9402 }
9403 }
9404 #ifndef SERVER
9405 else if (action_id ==
EActions.WATCH_PLAYER)
9406 {
9407 PluginDeveloper.SetDeveloperItemClientEx(player);
9408 }
9409 #endif
9411 {
9412 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9413 {
9414 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9415 OnDebugButtonPressServer(id + 1);
9416 }
9417
9418 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9419 {
9420 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9422 }
9423
9424 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9425 {
9426 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9428 }
9429
9430 else if (action_id ==
EActions.ADD_QUANTITY)
9431 {
9432 if (IsMagazine())
9433 {
9434 Magazine mag = Magazine.Cast(this);
9435 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9436 }
9437 else
9438 {
9440 }
9441
9442 if (m_EM)
9443 {
9444 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9445 }
9446
9447 }
9448
9449 else if (action_id ==
EActions.REMOVE_QUANTITY)
9450 {
9451 if (IsMagazine())
9452 {
9453 Magazine mag2 = Magazine.Cast(this);
9454 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9455 }
9456 else
9457 {
9459 }
9460 if (m_EM)
9461 {
9462 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9463 }
9464
9465 }
9466
9467 else if (action_id ==
EActions.SET_QUANTITY_0)
9468 {
9470
9471 if (m_EM)
9472 {
9473 m_EM.SetEnergy(0);
9474 }
9475 }
9476
9477 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9478 {
9480
9481 if (m_EM)
9482 {
9483 m_EM.SetEnergy(m_EM.GetEnergyMax());
9484 }
9485 }
9486
9487 else if (action_id ==
EActions.ADD_HEALTH)
9488 {
9489 AddHealth("","",GetMaxHealth("","Health")/5);
9490 }
9491 else if (action_id ==
EActions.REMOVE_HEALTH)
9492 {
9493 AddHealth("","",-GetMaxHealth("","Health")/5);
9494 }
9495 else if (action_id ==
EActions.DESTROY_HEALTH)
9496 {
9497 SetHealth01("","",0);
9498 }
9499 else if (action_id ==
EActions.WATCH_ITEM)
9500 {
9502 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9503 #ifdef DEVELOPER
9504 SetDebugDeveloper_item(this);
9505 #endif
9506 }
9507
9508 else if (action_id ==
EActions.ADD_TEMPERATURE)
9509 {
9510 AddTemperature(20);
9511
9512 }
9513
9514 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9515 {
9516 AddTemperature(-20);
9517
9518 }
9519
9520 else if (action_id ==
EActions.FLIP_FROZEN)
9521 {
9522 SetFrozen(!GetIsFrozen());
9523
9524 }
9525
9526 else if (action_id ==
EActions.ADD_WETNESS)
9527 {
9529
9530 }
9531
9532 else if (action_id ==
EActions.REMOVE_WETNESS)
9533 {
9535
9536 }
9537
9538 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9539 {
9542
9543
9544 }
9545
9546 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9547 {
9550 }
9551
9552 else if (action_id ==
EActions.MAKE_SPECIAL)
9553 {
9554 auto debugParams = DebugSpawnParams.WithPlayer(player);
9555 OnDebugSpawnEx(debugParams);
9556 }
9557
9558 }
9559
9560
9561 return false;
9562 }
9563
9564
9565
9566
9570
9573
9574
9575
9577 {
9578 return false;
9579 }
9580
9581
9583 {
9584 return true;
9585 }
9586
9587
9589 {
9590 return true;
9591 }
9592
9593
9594
9596 {
9597 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9598 return g_Game.ConfigIsExisting(config_path);
9599 }
9600
9603 {
9604 return null;
9605 }
9606
9608 {
9609 return false;
9610 }
9611
9613 {
9614 return false;
9615 }
9616
9620
9621
9623 {
9624 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9625 return module_repairing.CanRepair(this, item_repair_kit);
9626 }
9627
9628
9629 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9630 {
9631 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9632 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9633 }
9634
9635
9637 {
9638
9639
9640
9641
9642
9643
9644
9645
9646 return 1;
9647 }
9648
9649
9650
9652 {
9654 }
9655
9656
9657
9659 {
9661 }
9662
9663
9672 {
9673 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9674
9675 if (player)
9676 {
9677 player.MessageStatus(text);
9678 }
9679 }
9680
9681
9690 {
9691 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9692
9693 if (player)
9694 {
9695 player.MessageAction(text);
9696 }
9697 }
9698
9699
9708 {
9709 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9710
9711 if (player)
9712 {
9713 player.MessageFriendly(text);
9714 }
9715 }
9716
9717
9726 {
9727 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9728
9729 if (player)
9730 {
9731 player.MessageImportant(text);
9732 }
9733 }
9734
9736 {
9737 return true;
9738 }
9739
9740
9741 override bool KindOf(
string tag)
9742 {
9743 bool found = false;
9744 string item_name = this.
GetType();
9746 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9747
9748 int array_size = item_tag_array.Count();
9749 for (int i = 0; i < array_size; i++)
9750 {
9751 if (item_tag_array.Get(i) == tag)
9752 {
9753 found = true;
9754 break;
9755 }
9756 }
9757 return found;
9758 }
9759
9760
9762 {
9763
9764 super.OnRPC(sender, rpc_type,ctx);
9765
9766
9767 switch (rpc_type)
9768 {
9769 #ifndef SERVER
9770 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9771 Param2<bool, string> p = new Param2<bool, string>(false, "");
9772
9774 return;
9775
9776 bool play = p.param1;
9777 string soundSet = p.param2;
9778
9779 if (play)
9780 {
9782 {
9784 {
9786 }
9787 }
9788 else
9789 {
9791 }
9792 }
9793 else
9794 {
9796 }
9797
9798 break;
9799 #endif
9800
9801 }
9802
9804 {
9806 }
9807 }
9808
9809
9810
9811
9813 {
9814 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9815 return plugin.GetID(
name);
9816 }
9817
9819 {
9820 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9821 return plugin.GetName(id);
9822 }
9823
9826 {
9827
9828
9829 int varFlags;
9830 if (!ctx.
Read(varFlags))
9831 return;
9832
9833 if (varFlags & ItemVariableFlags.FLOAT)
9834 {
9836 }
9837 }
9838
9840 {
9841
9842 super.SerializeNumericalVars(floats_out);
9843
9844
9845
9847 {
9849 }
9850
9852 {
9854 }
9855
9857 {
9859 }
9860
9862 {
9867 }
9868
9870 {
9872 }
9873 }
9874
9876 {
9877
9878 super.DeSerializeNumericalVars(floats);
9879
9880
9881 int index = 0;
9882 int mask = Math.Round(floats.Get(index));
9883
9884 index++;
9885
9887 {
9889 {
9891 }
9892 else
9893 {
9894 float quantity = floats.Get(index);
9896 }
9897 index++;
9898 }
9899
9901 {
9902 float wet = floats.Get(index);
9904 index++;
9905 }
9906
9908 {
9909 int liquidtype = Math.Round(floats.Get(index));
9911 index++;
9912 }
9913
9915 {
9917 index++;
9919 index++;
9921 index++;
9923 index++;
9924 }
9925
9927 {
9928 int cleanness = Math.Round(floats.Get(index));
9930 index++;
9931 }
9932 }
9933
9935 {
9936 super.WriteVarsToCTX(ctx);
9937
9938
9940 {
9942 }
9943
9945 {
9947 }
9948
9950 {
9952 }
9953
9955 {
9956 int r,g,b,a;
9962 }
9963
9965 {
9967 }
9968 }
9969
9971 {
9972 if (!super.ReadVarsFromCTX(ctx,version))
9973 return false;
9974
9975 int intValue;
9976 float value;
9977
9978 if (version < 140)
9979 {
9980 if (!ctx.
Read(intValue))
9981 return false;
9982
9983 m_VariablesMask = intValue;
9984 }
9985
9987 {
9988 if (!ctx.
Read(value))
9989 return false;
9990
9992 {
9994 }
9995 else
9996 {
9998 }
9999 }
10000
10001 if (version < 140)
10002 {
10004 {
10005 if (!ctx.
Read(value))
10006 return false;
10007 SetTemperatureDirect(value);
10008 }
10009 }
10010
10012 {
10013 if (!ctx.
Read(value))
10014 return false;
10016 }
10017
10019 {
10020 if (!ctx.
Read(intValue))
10021 return false;
10023 }
10024
10026 {
10027 int r,g,b,a;
10029 return false;
10031 return false;
10033 return false;
10035 return false;
10036
10038 }
10039
10041 {
10042 if (!ctx.
Read(intValue))
10043 return false;
10045 }
10046
10047 if (version >= 138 && version < 140)
10048 {
10050 {
10051 if (!ctx.
Read(intValue))
10052 return false;
10053 SetFrozen(intValue);
10054 }
10055 }
10056
10057 return true;
10058 }
10059
10060
10062 {
10065 {
10067 }
10068
10069 if (!super.OnStoreLoad(ctx, version))
10070 {
10072 return false;
10073 }
10074
10075 if (version >= 114)
10076 {
10077 bool hasQuickBarIndexSaved;
10078
10079 if (!ctx.
Read(hasQuickBarIndexSaved))
10080 {
10082 return false;
10083 }
10084
10085 if (hasQuickBarIndexSaved)
10086 {
10087 int itmQBIndex;
10088
10089
10090 if (!ctx.
Read(itmQBIndex))
10091 {
10093 return false;
10094 }
10095
10096 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10097 if (itmQBIndex != -1 && parentPlayer)
10098 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10099 }
10100 }
10101 else
10102 {
10103
10104 PlayerBase player;
10105 int itemQBIndex;
10106 if (version ==
int.
MAX)
10107 {
10108 if (!ctx.
Read(itemQBIndex))
10109 {
10111 return false;
10112 }
10113 }
10114 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10115 {
10116
10117 if (!ctx.
Read(itemQBIndex))
10118 {
10120 return false;
10121 }
10122 if (itemQBIndex != -1 && player)
10123 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10124 }
10125 }
10126
10127 if (version < 140)
10128 {
10129
10130 if (!LoadVariables(ctx, version))
10131 {
10133 return false;
10134 }
10135 }
10136
10137
10139 {
10141 return false;
10142 }
10143 if (version >= 132)
10144 {
10146 if (raib)
10147 {
10149 {
10151 return false;
10152 }
10153 }
10154 }
10155
10157 return true;
10158 }
10159
10160
10161
10163 {
10164 super.OnStoreSave(ctx);
10165
10166 PlayerBase player;
10167 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10168 {
10170
10171 int itemQBIndex = -1;
10172 itemQBIndex = player.FindQuickBarEntityIndex(this);
10173 ctx.
Write(itemQBIndex);
10174 }
10175 else
10176 {
10178 }
10179
10181
10183 if (raib)
10184 {
10186 }
10187 }
10188
10189
10191 {
10192 super.AfterStoreLoad();
10193
10195 {
10197 }
10198
10200 {
10203 }
10204 }
10205
10207 {
10208 super.EEOnAfterLoad();
10209
10211 {
10213 }
10214
10217 }
10218
10220 {
10221 return false;
10222 }
10223
10224
10225
10227 {
10229 {
10230 #ifdef PLATFORM_CONSOLE
10231
10233 {
10235 if (menu)
10236 {
10238 }
10239 }
10240 #endif
10241 }
10242
10244 {
10247 }
10248
10250 {
10251 SetWeightDirty();
10253 }
10255 {
10258 }
10259
10261 {
10264
10267 }
10269 {
10273 }
10274
10275 super.OnVariablesSynchronized();
10276 }
10277
10278
10279
10281 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10282 {
10283 if (!IsServerCheck(allow_client))
10284 return false;
10285
10287 return false;
10288
10291
10292 if (value <= (min + 0.001))
10293 value = min;
10294
10295 if (value == min)
10296 {
10297 if (destroy_config)
10298 {
10299 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10300 if (dstr)
10301 {
10303 this.Delete();
10304 return true;
10305 }
10306 }
10307 else if (destroy_forced)
10308 {
10310 this.Delete();
10311 return true;
10312 }
10313
10315 }
10316
10319
10321 {
10322 EntityAI parent = GetHierarchyRoot();
10323 InventoryLocation iLoc = new InventoryLocation();
10324 GetInventory().GetCurrentInventoryLocation(iLoc);
10326 {
10327 int iLocSlot = iLoc.
GetSlot();
10329 {
10331 }
10333 {
10335 }
10336 }
10337 }
10338
10340 {
10342
10343 if (delta)
10345 }
10346
10348
10349 return false;
10350 }
10351
10352
10354 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10355 {
10357 }
10358
10360 {
10363 }
10364
10366 {
10369 }
10370
10372 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10373 {
10374 float value_clamped = Math.Clamp(value, 0, 1);
10376 SetQuantity(result, destroy_config, destroy_forced);
10377 }
10378
10379
10382 {
10384 }
10385
10387 {
10389 }
10390
10391
10392
10393
10394
10395
10396
10397
10398
10399
10401 {
10402 int slot = -1;
10403 GameInventory inventory = GetInventory();
10404 if (inventory)
10405 {
10406 InventoryLocation il = new InventoryLocation;
10409 }
10410
10412 }
10413
10415 {
10416 float quantity_max = 0;
10417
10419 {
10420 if (attSlotID != -1)
10421 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10422
10423 if (quantity_max <= 0)
10425 }
10426
10427 if (quantity_max <= 0)
10429
10430 return quantity_max;
10431 }
10432
10434 {
10436 }
10437
10439 {
10441 }
10442
10443
10445 {
10447 }
10448
10450 {
10452 }
10453
10455 {
10457 }
10458
10459
10461 {
10462
10463 float weightEx = GetWeightEx();
10464 float special = GetInventoryAndCargoWeight();
10465 return weightEx - special;
10466 }
10467
10468
10470 {
10472 }
10473
10475 {
10477 {
10478 #ifdef DEVELOPER
10479 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10480 {
10481 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10483 }
10484 #endif
10485
10486 return GetQuantity() * GetConfigWeightModified();
10487 }
10488 else if (HasEnergyManager())
10489 {
10490 #ifdef DEVELOPER
10491 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10492 {
10493 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10494 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10495 }
10496 #endif
10497 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10498 }
10499 else
10500 {
10501 #ifdef DEVELOPER
10502 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10503 {
10504 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10505 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10506 }
10507 #endif
10508 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10509 }
10510 }
10511
10514 {
10515 int item_count = 0;
10517
10518 GameInventory inventory = GetInventory();
10519 CargoBase cargo = inventory.
GetCargo();
10520 if (cargo != NULL)
10521 {
10523 }
10524
10526 for (int i = 0; i < nAttachments; ++i)
10527 {
10529 if (item)
10530 item_count += item.GetNumberOfItems();
10531 }
10532 return item_count;
10533 }
10534
10537 {
10538 float weight = 0;
10539 float wetness = 1;
10540 if (include_wetness)
10543 {
10544 weight = wetness * m_ConfigWeight;
10545 }
10547 {
10548 weight = 1;
10549 }
10550 return weight;
10551 }
10552
10553
10554
10556 {
10557 GameInventory inventory = GetInventory();
10558 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10559 {
10560 array<EntityAI> items = new array<EntityAI>;
10562 for (int i = 0; i < items.Count(); ++i)
10563 {
10565 if (item)
10566 {
10567 g_Game.ObjectDelete(item);
10568 }
10569 }
10570 }
10571 }
10572
10573
10574
10575
10577 {
10578 float energy = 0;
10579 if (HasEnergyManager())
10580 {
10581 energy = GetCompEM().GetEnergy();
10582 }
10583 return energy;
10584 }
10585
10586
10588 {
10589 super.OnEnergyConsumed();
10590
10592 }
10593
10595 {
10596 super.OnEnergyAdded();
10597
10599 }
10600
10601
10603 {
10604 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10605 {
10607 {
10608 float energy_0to1 = GetCompEM().GetEnergy0To1();
10610 }
10611 }
10612 }
10613
10614
10616 {
10617 return ConfigGetFloat("heatIsolation");
10618 }
10619
10621 {
10623 }
10624
10626 {
10627 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10628 if (
g_Game.ConfigIsExisting(paramPath))
10629 return g_Game.ConfigGetFloat(paramPath);
10630
10631 return 0.0;
10632 }
10633
10635 {
10636 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10637 if (
g_Game.ConfigIsExisting(paramPath))
10638 return g_Game.ConfigGetFloat(paramPath);
10639
10640 return 0.0;
10641 }
10642
10643 override void SetWet(
float value,
bool allow_client =
false)
10644 {
10645 if (!IsServerCheck(allow_client))
10646 return;
10647
10650
10652
10653 m_VarWet = Math.Clamp(value, min, max);
10654
10656 {
10659 }
10660 }
10661
10662 override void AddWet(
float value)
10663 {
10665 }
10666
10668 {
10670 }
10671
10673 {
10675 }
10676
10678 {
10680 }
10681
10683 {
10685 }
10686
10688 {
10690 }
10691
10692 override void OnWetChanged(
float newVal,
float oldVal)
10693 {
10696 if (newLevel != oldLevel)
10697 {
10699 }
10700 }
10701
10703 {
10704 SetWeightDirty();
10705 }
10706
10708 {
10709 return GetWetLevelInternal(
m_VarWet);
10710 }
10711
10712
10713
10715 {
10717 }
10718
10720 {
10722 }
10723
10725 {
10727 }
10728
10730 {
10732 }
10733
10734
10735
10737 {
10738 if (ConfigIsExisting("itemModelLength"))
10739 {
10740 return ConfigGetFloat("itemModelLength");
10741 }
10742 return 0;
10743 }
10744
10746 {
10747 if (ConfigIsExisting("itemAttachOffset"))
10748 {
10749 return ConfigGetFloat("itemAttachOffset");
10750 }
10751 return 0;
10752 }
10753
10754 override void SetCleanness(
int value,
bool allow_client =
false)
10755 {
10756 if (!IsServerCheck(allow_client))
10757 return;
10758
10760
10762
10765 }
10766
10768 {
10770 }
10771
10773 {
10774 return true;
10775 }
10776
10777
10778
10779
10781 {
10783 }
10784
10786 {
10788 }
10789
10790
10791
10792
10793 override void SetColor(
int r,
int g,
int b,
int a)
10794 {
10800 }
10802 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10803 {
10808 }
10809
10811 {
10813 }
10814
10817 {
10818 int r,g,b,a;
10820 r = r/255;
10821 g = g/255;
10822 b = b/255;
10823 a = a/255;
10824 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10825 }
10826
10827
10828
10829 override void SetLiquidType(
int value,
bool allow_client =
false)
10830 {
10831 if (!IsServerCheck(allow_client))
10832 return;
10833
10838 }
10839
10841 {
10842 return ConfigGetInt("varLiquidTypeInit");
10843 }
10844
10846 {
10848 }
10849
10851 {
10853 SetFrozen(false);
10854 }
10855
10858 {
10859 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10860 }
10861
10862
10865 {
10866 PlayerBase nplayer;
10867 if (PlayerBase.CastTo(nplayer, player))
10868 {
10870 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10871 }
10872 }
10873
10874
10877 {
10878 PlayerBase nplayer;
10879 if (PlayerBase.CastTo(nplayer,player))
10880 {
10881 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10882 }
10883
10884 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10885
10886 if (HasEnergyManager())
10887 {
10888 GetCompEM().UpdatePlugState();
10889 }
10890 }
10891
10892
10894 {
10895 super.OnPlacementStarted(player);
10896
10898 }
10899
10900 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10901 {
10903 {
10904 m_AdminLog.OnPlacementComplete(player,
this);
10905 }
10906
10907 super.OnPlacementComplete(player, position, orientation);
10908 }
10909
10910
10911
10912
10913
10915 {
10917 {
10918 return true;
10919 }
10920 else
10921 {
10922 return false;
10923 }
10924 }
10925
10926
10928 {
10930 {
10932 }
10933 }
10934
10935
10937 {
10939 }
10940
10942 {
10944 }
10945
10946 override void InsertAgent(
int agent,
float count = 1)
10947 {
10948 if (count < 1)
10949 return;
10950
10952 }
10953
10956 {
10958 }
10959
10960
10962 {
10964 }
10965
10966
10967
10968
10969
10970
10971
10972
10973
10974
10975
10976
10977
10978
10979
10980
10981
10982
10983
10984
10985
10986
10987
10988
10989
10990
10991
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11002
11003
11004
11005
11006
11008 {
11010 return false;
11011 return true;
11012 }
11013
11015 {
11016
11018 }
11019
11020
11023 {
11024 super.CheckForRoofLimited(timeTresholdMS);
11025
11026 float time =
g_Game.GetTime();
11027 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11028 {
11029 m_PreviousRoofTestTime = time;
11030 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11031 }
11032 }
11033
11034
11036 {
11038 {
11039 return 0;
11040 }
11041
11042 if (GetInventory().GetAttachmentSlotsCount() != 0)
11043 {
11044 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11045 if (filter)
11046 return filter.GetProtectionLevel(type, false, system);
11047 else
11048 return 0;
11049 }
11050
11051 string subclassPath, entryName;
11052
11053 switch (type)
11054 {
11056 entryName = "biological";
11057 break;
11059 entryName = "chemical";
11060 break;
11061 default:
11062 entryName = "biological";
11063 break;
11064 }
11065
11066 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11067
11068 return g_Game.ConfigGetFloat(subclassPath + entryName);
11069 }
11070
11071
11072
11075 {
11076 if (!IsMagazine())
11078
11080 }
11081
11082
11083
11084
11085
11090 {
11091 return true;
11092 }
11093
11095 {
11097 }
11098
11099
11100
11101
11102
11104 {
11105 if (parent)
11106 {
11107 if (parent.IsInherited(DayZInfected))
11108 return true;
11109
11110 if (!parent.IsRuined())
11111 return true;
11112 }
11113
11114 return true;
11115 }
11116
11118 {
11119 if (!super.CanPutAsAttachment(parent))
11120 {
11121 return false;
11122 }
11123
11124 if (!IsRuined() && !parent.IsRuined())
11125 {
11126 return true;
11127 }
11128
11129 return false;
11130 }
11131
11133 {
11134
11135
11136
11137
11138 return super.CanReceiveItemIntoCargo(item);
11139 }
11140
11142 {
11143
11144
11145
11146
11147 GameInventory attachmentInv = attachment.GetInventory();
11149 {
11150 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11151 return false;
11152 }
11153
11154 InventoryLocation loc = new InventoryLocation();
11155 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11156 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11157 return false;
11158
11159 return super.CanReceiveAttachment(attachment, slotId);
11160 }
11161
11163 {
11164 if (!super.CanReleaseAttachment(attachment))
11165 return false;
11166
11167 return GetInventory().AreChildrenAccessible();
11168 }
11169
11170
11171
11172
11173
11174
11175
11176
11177
11178
11179
11180
11181
11182
11183
11184
11185
11186
11187
11188
11189
11191 {
11192 int id = muzzle_owner.GetMuzzleID();
11193 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11194
11195 if (WPOF_array)
11196 {
11197 for (int i = 0; i < WPOF_array.Count(); i++)
11198 {
11199 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11200
11201 if (WPOF)
11202 {
11203 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11204 }
11205 }
11206 }
11207 }
11208
11209
11211 {
11212 int id = muzzle_owner.GetMuzzleID();
11214
11215 if (WPOBE_array)
11216 {
11217 for (int i = 0; i < WPOBE_array.Count(); i++)
11218 {
11219 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11220
11221 if (WPOBE)
11222 {
11223 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11224 }
11225 }
11226 }
11227 }
11228
11229
11231 {
11232 int id = muzzle_owner.GetMuzzleID();
11233 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11234
11235 if (WPOOH_array)
11236 {
11237 for (int i = 0; i < WPOOH_array.Count(); i++)
11238 {
11239 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11240
11241 if (WPOOH)
11242 {
11243 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11244 }
11245 }
11246 }
11247 }
11248
11249
11251 {
11252 int id = muzzle_owner.GetMuzzleID();
11253 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11254
11255 if (WPOOH_array)
11256 {
11257 for (int i = 0; i < WPOOH_array.Count(); i++)
11258 {
11259 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11260
11261 if (WPOOH)
11262 {
11263 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11264 }
11265 }
11266 }
11267 }
11268
11269
11271 {
11272 int id = muzzle_owner.GetMuzzleID();
11273 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11274
11275 if (WPOOH_array)
11276 {
11277 for (int i = 0; i < WPOOH_array.Count(); i++)
11278 {
11279 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11280
11281 if (WPOOH)
11282 {
11283 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11284 }
11285 }
11286 }
11287 }
11288
11289
11290
11292 {
11294 {
11295 return true;
11296 }
11297
11298 return false;
11299 }
11300
11302 {
11304 {
11305 return true;
11306 }
11307
11308 return false;
11309 }
11310
11312 {
11314 {
11315 return true;
11316 }
11317
11318 return false;
11319 }
11320
11322 {
11323 return false;
11324 }
11325
11328 {
11329 return UATimeSpent.DEFAULT_DEPLOY;
11330 }
11331
11332
11333
11334
11336 {
11338 SetSynchDirty();
11339 }
11340
11342 {
11344 }
11345
11346
11348 {
11349 return false;
11350 }
11351
11354 {
11355 string att_type = "None";
11356
11357 if (ConfigIsExisting("soundAttType"))
11358 {
11359 att_type = ConfigGetString("soundAttType");
11360 }
11361
11363 }
11364
11366 {
11368 }
11369
11370
11371
11372
11373
11379
11381 {
11384
11386 }
11387
11388
11390 {
11392 return;
11393
11395
11398
11401
11402 SoundParameters params = new SoundParameters();
11406 }
11407
11408
11410 {
11412 {
11415
11416 SetSynchDirty();
11417
11420 }
11421 }
11422
11424 {
11426 }
11427
11428
11430 {
11432 return;
11433
11435 SetSynchDirty();
11436
11439 }
11440
11442 {
11445 }
11446
11448 {
11450 }
11451
11452 void OnApply(PlayerBase player);
11453
11455 {
11456 return 1.0;
11457 };
11458
11460 {
11462 }
11463
11465 {
11467 }
11468
11470
11472 {
11473 SetDynamicPhysicsLifeTime(0.01);
11475 }
11476
11478 {
11479 array<string> zone_names = new array<string>;
11480 GetDamageZones(zone_names);
11481 for (int i = 0; i < zone_names.Count(); i++)
11482 {
11483 SetHealthMax(zone_names.Get(i),"Health");
11484 }
11485 SetHealthMax("","Health");
11486 }
11487
11490 {
11491 float global_health = GetHealth01("","Health");
11492 array<string> zones = new array<string>;
11493 GetDamageZones(zones);
11494
11495 for (int i = 0; i < zones.Count(); i++)
11496 {
11497 SetHealth01(zones.Get(i),"Health",global_health);
11498 }
11499 }
11500
11503 {
11504 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11505 }
11506
11508 {
11509 if (!hasRootAsPlayer)
11510 {
11511 if (refParentIB)
11512 {
11513
11514 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11515 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11516
11517 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11518 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11519
11522 }
11523 else
11524 {
11525
11528 }
11529 }
11530 }
11531
11533 {
11535 {
11536 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11537 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11538 {
11539 float heatPermCoef = 1.0;
11541 while (ent)
11542 {
11543 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11544 ent = ent.GetHierarchyParent();
11545 }
11546
11547 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11548 }
11549 }
11550 }
11551
11553 {
11554
11555 EntityAI parent = GetHierarchyParent();
11556 if (!parent)
11557 {
11558 hasParent = false;
11559 hasRootAsPlayer = false;
11560 }
11561 else
11562 {
11563 hasParent = true;
11564 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11565 refParentIB =
ItemBase.Cast(parent);
11566 }
11567 }
11568
11569 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11570 {
11571
11572 }
11573
11575 {
11576
11577 return false;
11578 }
11579
11581 {
11582
11583
11584 return false;
11585 }
11586
11588 {
11589
11590 return false;
11591 }
11592
11595 {
11596 return !GetIsFrozen() &&
IsOpen();
11597 }
11598
11600 {
11601 bool hasParent = false, hasRootAsPlayer = false;
11603
11604 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11605 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11606
11607 if (wwtu || foodDecay)
11608 {
11612
11613 if (processWetness || processTemperature || processDecay)
11614 {
11616
11617 if (processWetness)
11618 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11619
11620 if (processTemperature)
11622
11623 if (processDecay)
11624 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11625 }
11626 }
11627 }
11628
11631 {
11633 }
11634
11636 {
11639
11640 return super.GetTemperatureFreezeThreshold();
11641 }
11642
11644 {
11647
11648 return super.GetTemperatureThawThreshold();
11649 }
11650
11652 {
11655
11656 return super.GetItemOverheatThreshold();
11657 }
11658
11660 {
11662 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11663
11664 return super.GetTemperatureFreezeTime();
11665 }
11666
11668 {
11670 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11671
11672 return super.GetTemperatureThawTime();
11673 }
11674
11679
11681 {
11682 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11683 }
11684
11686 {
11687 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11688 }
11689
11692 {
11694 }
11695
11697 {
11699 }
11700
11702 {
11704 }
11705
11708 {
11709 return null;
11710 }
11711
11714 {
11715 return false;
11716 }
11717
11719 {
11721 {
11724 if (!trg)
11725 {
11727 explosive = this;
11728 }
11729
11730 explosive.PairRemote(trg);
11732
11733 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11734 trg.SetPersistentPairID(persistentID);
11735 explosive.SetPersistentPairID(persistentID);
11736
11737 return true;
11738 }
11739 return false;
11740 }
11741
11744 {
11745 float ret = 1.0;
11748 ret *= GetHealth01();
11749
11750 return ret;
11751 }
11752
11753 #ifdef DEVELOPER
11754 override void SetDebugItem()
11755 {
11756 super.SetDebugItem();
11757 _itemBase = this;
11758 }
11759
11761 {
11762 string text = super.GetDebugText();
11763
11765 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11766
11767 return text;
11768 }
11769 #endif
11770
11772 {
11773 return true;
11774 }
11775
11777
11779
11781 {
11784 }
11785
11786
11794
11810
11811 [
Obsolete(
"Use ItemSoundHandler instead")]
11814 {
11815 if (!
g_Game.IsDedicatedServer())
11816 {
11817 if (ConfigIsExisting("attachSoundSet"))
11818 {
11819 string cfg_path = "";
11820 string soundset = "";
11821 string type_name =
GetType();
11822
11825 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11826 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11827
11828 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11829 {
11830 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11831 {
11832 if (cfg_slot_array[i] == slot_type)
11833 {
11834 soundset = cfg_soundset_array[i];
11835 break;
11836 }
11837 }
11838 }
11839
11840 if (soundset != "")
11841 {
11842 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11844 }
11845 }
11846 }
11847 }
11848
11850}
11851
11853{
11855 if (entity)
11856 {
11857 bool is_item = entity.IsInherited(
ItemBase);
11858 if (is_item && full_quantity)
11859 {
11862 }
11863 }
11864 else
11865 {
11867 return NULL;
11868 }
11869 return entity;
11870}
11871
11873{
11874 if (item)
11875 {
11876 if (health > 0)
11877 item.SetHealth("", "", health);
11878
11879 if (item.CanHaveTemperature())
11880 {
11882 if (item.CanFreeze())
11883 item.SetFrozen(false);
11884 }
11885
11886 if (item.HasEnergyManager())
11887 {
11888 if (quantity >= 0)
11889 {
11890 item.GetCompEM().SetEnergy0To1(quantity);
11891 }
11892 else
11893 {
11895 }
11896 }
11897 else if (item.IsMagazine())
11898 {
11899 Magazine mag = Magazine.Cast(item);
11900 if (quantity >= 0)
11901 {
11902 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11903 }
11904 else
11905 {
11907 }
11908
11909 }
11910 else
11911 {
11912 if (quantity >= 0)
11913 {
11914 item.SetQuantityNormalized(quantity, false);
11915 }
11916 else
11917 {
11919 }
11920
11921 }
11922 }
11923}
11924
11925#ifdef DEVELOPER
11927#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.