7083{
7085 {
7086 return true;
7087 }
7088};
7089
7091{
7092
7093};
7094
7095
7096
7098{
7102
7104
7107
7108
7109
7110
7111
7120
7126
7131
7136
7157 protected bool m_IsResultOfSplit
7158
7160
7165
7166
7167
7169
7173
7174
7175
7177
7180
7181
7182
7188
7189
7197
7200
7201
7203
7204
7206
7207
7212
7213
7218
7220
7221
7223
7224
7226 {
7231
7232 if (!
g_Game.IsDedicatedServer())
7233 {
7235 {
7237
7239 {
7241 }
7242 }
7243
7246 }
7247
7248 m_OldLocation = null;
7249
7251 {
7253 }
7254
7255 if (ConfigIsExisting("headSelectionsToHide"))
7256 {
7259 }
7260
7262 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7263 {
7265 }
7266
7268
7269 m_IsResultOfSplit = false;
7270
7272 }
7273
7275 {
7276 super.InitItemVariables();
7277
7283 m_Count = ConfigGetInt(
"count");
7284
7287
7292
7295
7300
7312
7316
7317
7320 if (ConfigIsExisting("canBeSplit"))
7321 {
7324 }
7325
7327 if (ConfigIsExisting("itemBehaviour"))
7329
7330
7333 RegisterNetSyncVariableInt("m_VarLiquidType");
7334 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7335
7336 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7337 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7338 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7339
7340 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7341 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7342 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7343 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7344
7345 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7346 RegisterNetSyncVariableBool("m_IsTakeable");
7347 RegisterNetSyncVariableBool("m_IsHologram");
7348
7351 {
7354 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7355 }
7356
7358
7360 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7362
7364 }
7365
7367 {
7369 }
7370
7372 {
7375 {
7380 }
7381 }
7382
7383 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7384 {
7386 {
7389 }
7390
7392 }
7393
7395 {
7401 }
7402
7404
7406 {
7408
7409 if (!action)
7410 {
7411 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7412 return;
7413 }
7414
7416 if (!ai)
7417 {
7419 return;
7420 }
7421
7423 if (!action_array)
7424 {
7425 action_array = new array<ActionBase_Basic>;
7427 }
7428 if (LogManager.IsActionLogEnable())
7429 {
7430 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7431 }
7432
7433 if (action_array.Find(action) != -1)
7434 {
7435 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7436 }
7437 else
7438 {
7439 action_array.Insert(action);
7440 }
7441 }
7442
7444 {
7445 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7446 ActionBase action = player.GetActionManager().GetAction(actionName);
7449
7450 if (action_array)
7451 {
7452 action_array.RemoveItem(action);
7453 }
7454 }
7455
7456
7457
7459 {
7460 ActionOverrideData overrideData = new ActionOverrideData();
7464
7466 if (!actionMap)
7467 {
7470 }
7471
7472 actionMap.Insert(this.
Type(), overrideData);
7473
7474 }
7475
7477
7479
7480
7482 {
7485
7488
7489 string config_to_search = "CfgVehicles";
7490 string muzzle_owner_config;
7491
7493 {
7494 if (IsInherited(Weapon))
7495 config_to_search = "CfgWeapons";
7496
7497 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7498
7499 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7500
7501 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7502
7503 if (config_OnFire_subclass_count > 0)
7504 {
7505 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7506
7507 for (int i = 0; i < config_OnFire_subclass_count; i++)
7508 {
7509 string particle_class = "";
7510 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7511 string config_OnFire_entry = config_OnFire_class + particle_class;
7512 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7513 WPOF_array.Insert(WPOF);
7514 }
7515
7516
7518 }
7519 }
7520
7522 {
7523 config_to_search = "CfgWeapons";
7524 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7525
7526 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7527
7528 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7529
7530 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7531 {
7532 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7533
7534 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7535 {
7536 string particle_class2 = "";
7537 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7538 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7539 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7540 WPOBE_array.Insert(WPOBE);
7541 }
7542
7543
7545 }
7546 }
7547 }
7548
7549
7551 {
7554
7556 {
7557 string config_to_search = "CfgVehicles";
7558
7559 if (IsInherited(Weapon))
7560 config_to_search = "CfgWeapons";
7561
7562 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7563 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7564
7565 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7566 {
7567
7569
7571 {
7573 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7575 return;
7576 }
7577
7580
7581
7582
7583 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7584 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7585
7586 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7587 {
7588 string particle_class = "";
7589 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7590 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7591 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7592
7593 if (entry_type == CT_CLASS)
7594 {
7595 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7596 WPOOH_array.Insert(WPOF);
7597 }
7598 }
7599
7600
7602 }
7603 }
7604 }
7605
7607 {
7609 }
7610
7612 {
7614 {
7616
7619
7622
7623 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7624 }
7625 }
7626
7628 {
7630 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7631
7633 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7634
7636 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7637
7639 {
7641 }
7642 }
7643
7645 {
7647 }
7648
7650 {
7653 else
7655
7657 {
7660 }
7661 else
7662 {
7665
7668 }
7669
7671 }
7672
7674 {
7676 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7677 }
7678
7680 {
7682 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7684 }
7685
7687 {
7689 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7690 }
7691
7693 {
7696
7697 OverheatingParticle OP = new OverheatingParticle();
7702
7704 }
7705
7707 {
7710
7711 return -1;
7712 }
7713
7715 {
7717 {
7720
7721 for (int i = count; i > 0; --i)
7722 {
7723 int id = i - 1;
7726
7729
7730 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7731 {
7732 if (p)
7733 {
7736 }
7737 }
7738 }
7739 }
7740 }
7741
7743 {
7745 {
7747 {
7748 int id = i - 1;
7750
7751 if (OP)
7752 {
7754
7755 if (p)
7756 {
7758 }
7759
7760 delete OP;
7761 }
7762 }
7763
7766 }
7767 }
7768
7771 {
7772 return 0.0;
7773 }
7774
7775
7777 {
7778 return 250;
7779 }
7780
7782 {
7783 return 0;
7784 }
7785
7788 {
7790 return true;
7791
7792 return false;
7793 }
7794
7797 {
7800
7802 {
7804 }
7805 else
7806 {
7807
7809 }
7810
7812 }
7813
7820 {
7821 return -1;
7822 }
7823
7824
7825
7826
7828 {
7830 {
7831 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7832 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7833
7834 if (r_index >= 0)
7835 {
7836 InventoryLocation r_il = new InventoryLocation;
7837 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7838
7839 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7842 {
7843 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7844 }
7846 {
7847 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7848 }
7849
7850 }
7851
7852 player.GetHumanInventory().ClearUserReservedLocation(this);
7853 }
7854
7857 }
7858
7859
7860
7861
7863 {
7864 return ItemBase.m_DebugActionsMask;
7865 }
7866
7868 {
7869 return ItemBase.m_DebugActionsMask & mask;
7870 }
7871
7873 {
7874 ItemBase.m_DebugActionsMask = mask;
7875 }
7876
7878 {
7879 ItemBase.m_DebugActionsMask |= mask;
7880 }
7881
7883 {
7884 ItemBase.m_DebugActionsMask &= ~mask;
7885 }
7886
7888 {
7890 {
7892 }
7893 else
7894 {
7896 }
7897 }
7898
7899
7901 {
7902 if (GetEconomyProfile())
7903 {
7904 float q_max = GetEconomyProfile().GetQuantityMax();
7905 if (q_max > 0)
7906 {
7907 float q_min = GetEconomyProfile().GetQuantityMin();
7908 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7909
7911 {
7912 ComponentEnergyManager comp = GetCompEM();
7914 {
7916 }
7917 }
7919 {
7921
7922 }
7923
7924 }
7925 }
7926 }
7927
7930 {
7931 EntityAI parent = GetHierarchyParent();
7932
7933 if (parent)
7934 {
7935 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7936 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7937 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7938 }
7939 }
7940
7943 {
7944 EntityAI parent = GetHierarchyParent();
7945
7946 if (parent)
7947 {
7948 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7949 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7950 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7951 }
7952 }
7953
7955 {
7956
7957
7958
7959
7961
7963 {
7964 if (ScriptInputUserData.CanStoreInputUserData())
7965 {
7966 ScriptInputUserData ctx = new ScriptInputUserData;
7972 ctx.
Write(use_stack_max);
7975
7977 {
7978 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7979 }
7980 }
7981 }
7982 else if (!
g_Game.IsMultiplayer())
7983 {
7985 }
7986 }
7987
7989 {
7991 }
7992
7994 {
7996 }
7997
7999 {
8001 }
8002
8004 {
8005
8006 return false;
8007 }
8008
8010 {
8011 return false;
8012 }
8013
8017 {
8018 return false;
8019 }
8020
8022 {
8023 return "";
8024 }
8025
8027
8029 {
8030 return false;
8031 }
8032
8034 {
8035 return true;
8036 }
8037
8038
8039
8041 {
8042 return true;
8043 }
8044
8046 {
8047 return true;
8048 }
8049
8051 {
8052 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8054 }
8055
8057 {
8059 }
8060
8062 {
8064 if (!is_being_placed)
8066 SetSynchDirty();
8067 }
8068
8069
8071
8073 {
8075 }
8076
8078 {
8080 }
8081
8083 {
8084 return 1;
8085 }
8086
8088 {
8089 return false;
8090 }
8091
8093 {
8095 SetSynchDirty();
8096 }
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8133 {
8134 super.OnMovedInsideCargo(container);
8135
8136 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8137 }
8138
8139 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8140 {
8141 super.EEItemLocationChanged(oldLoc, newLoc);
8142
8143 PlayerBase newPlayer = null;
8144 PlayerBase oldPlayer = null;
8145
8146 if (newLoc.GetParent())
8147 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8148
8149 if (oldLoc.GetParent())
8150 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8151
8153 {
8154 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8155
8156 if (rIndex >= 0)
8157 {
8158 InventoryLocation rIl = new InventoryLocation;
8159 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8160
8161 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8164 {
8165 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8166 }
8168 {
8170 }
8171
8172 }
8173 }
8174
8176 {
8177 if (newPlayer)
8178 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8179
8180 if (newPlayer == oldPlayer)
8181 {
8182 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8183 {
8185 {
8186 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8187 {
8188 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8189 }
8190 }
8191 else
8192 {
8193 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8194 }
8195 }
8196
8197 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8198 {
8199 int type = oldLoc.GetType();
8201 {
8202 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8203 }
8205 {
8206 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8207 }
8208 }
8209 if (!m_OldLocation)
8210 {
8211 m_OldLocation = new InventoryLocation;
8212 }
8213 m_OldLocation.Copy(oldLoc);
8214 }
8215 else
8216 {
8217 if (m_OldLocation)
8218 {
8219 m_OldLocation.Reset();
8220 }
8221 }
8222
8223 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8224 }
8225 else
8226 {
8227 if (newPlayer)
8228 {
8229 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8230 if (resIndex >= 0)
8231 {
8232 InventoryLocation il = new InventoryLocation;
8233 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8235 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8238 {
8239 il.
GetParent().GetOnReleaseLock().Invoke(it);
8240 }
8242 {
8244 }
8245
8246 }
8247 }
8249 {
8250
8252 }
8253
8254 if (m_OldLocation)
8255 {
8256 m_OldLocation.Reset();
8257 }
8258 }
8259
8261 {
8262 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8263 }
8264
8266 {
8267 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8268 }
8269 }
8270
8271 override void EOnContact(IEntity other, Contact extra)
8272 {
8274 {
8275 int liquidType = -1;
8277 if (impactSpeed > 0.0)
8278 {
8280 #ifndef SERVER
8282 #else
8284 SetSynchDirty();
8285 #endif
8287 }
8288 }
8289
8290 #ifdef SERVER
8291 if (GetCompEM() && GetCompEM().IsPlugged())
8292 {
8293 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8294 GetCompEM().UnplugThis();
8295 }
8296 #endif
8297 }
8298
8300
8302 {
8304 }
8305
8307 {
8308
8309 }
8310
8312 {
8313 super.OnItemLocationChanged(old_owner, new_owner);
8314
8315 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8316 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8317
8318 if (!relatedPlayer && playerNew)
8319 relatedPlayer = playerNew;
8320
8321 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8322 {
8324 if (actionMgr)
8325 {
8326 ActionBase currentAction = actionMgr.GetRunningAction();
8327 if (currentAction)
8329 }
8330 }
8331
8332 Man ownerPlayerOld = null;
8333 Man ownerPlayerNew = null;
8334
8335 if (old_owner)
8336 {
8337 if (old_owner.
IsMan())
8338 {
8339 ownerPlayerOld = Man.Cast(old_owner);
8340 }
8341 else
8342 {
8343 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8344 }
8345 }
8346 else
8347 {
8349 {
8351
8352 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8353 {
8354 GetCompEM().UnplugThis();
8355 }
8356 }
8357 }
8358
8359 if (new_owner)
8360 {
8361 if (new_owner.
IsMan())
8362 {
8363 ownerPlayerNew = Man.Cast(new_owner);
8364 }
8365 else
8366 {
8367 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8368 }
8369 }
8370
8371 if (ownerPlayerOld != ownerPlayerNew)
8372 {
8373 if (ownerPlayerOld)
8374 {
8375 array<EntityAI> subItemsExit = new array<EntityAI>;
8377 for (int i = 0; i < subItemsExit.Count(); i++)
8378 {
8381 }
8382 }
8383
8384 if (ownerPlayerNew)
8385 {
8386 array<EntityAI> subItemsEnter = new array<EntityAI>;
8388 for (int j = 0; j < subItemsEnter.Count(); j++)
8389 {
8392 }
8393 }
8394 }
8395 else if (ownerPlayerNew != null)
8396 {
8397 PlayerBase nplayer;
8398 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8399 {
8400 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8402 for (int k = 0; k < subItemsUpdate.Count(); k++)
8403 {
8405 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8406 }
8407 }
8408 }
8409
8410 if (old_owner)
8411 old_owner.OnChildItemRemoved(this);
8412 if (new_owner)
8413 new_owner.OnChildItemReceived(this);
8414 }
8415
8416
8418 {
8419 super.EEDelete(parent);
8420 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8421 if (player)
8422 {
8424
8425 if (player.IsAlive())
8426 {
8427 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8428 if (r_index >= 0)
8429 {
8430 InventoryLocation r_il = new InventoryLocation;
8431 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8432
8433 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8436 {
8437 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8438 }
8440 {
8441 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8442 }
8443
8444 }
8445
8446 player.RemoveQuickBarEntityShortcut(this);
8447 }
8448 }
8449 }
8450
8452 {
8453 super.EEKilled(killer);
8454
8457 {
8458 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8459 {
8460 if (IsMagazine())
8461 {
8462 if (Magazine.Cast(this).GetAmmoCount() > 0)
8463 {
8465 }
8466 }
8467 else
8468 {
8470 }
8471 }
8472 }
8473 }
8474
8476 {
8477 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8478
8479 super.OnWasAttached(parent, slot_id);
8480
8483
8486 }
8487
8489 {
8490 super.OnWasDetached(parent, slot_id);
8491
8494
8497 }
8498
8500 {
8501 int idx;
8504
8505 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8506 if (inventory_slots.Count() < 1)
8507 {
8508 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8509 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8510 }
8511 else
8512 {
8513 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8514 }
8515
8516 idx = inventory_slots.Find(slot);
8517 if (idx < 0)
8518 return "";
8519
8520 return attach_types.Get(idx);
8521 }
8522
8524 {
8525 int idx = -1;
8526 string slot;
8527
8530
8531 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8532 if (inventory_slots.Count() < 1)
8533 {
8534 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8535 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8536 }
8537 else
8538 {
8539 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8540 if (detach_types.Count() < 1)
8541 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8542 }
8543
8544 for (int i = 0; i < inventory_slots.Count(); i++)
8545 {
8546 slot = inventory_slots.Get(i);
8547 }
8548
8549 if (slot != "")
8550 {
8551 if (detach_types.Count() == 1)
8552 idx = 0;
8553 else
8554 idx = inventory_slots.Find(slot);
8555 }
8556 if (idx < 0)
8557 return "";
8558
8559 return detach_types.Get(idx);
8560 }
8561
8563 {
8564
8566
8567
8568 float min_time = 1;
8569 float max_time = 3;
8570 float delay = Math.RandomFloat(min_time, max_time);
8571
8572 explode_timer.Run(delay, this, "DoAmmoExplosion");
8573 }
8574
8576 {
8577 Magazine magazine = Magazine.Cast(this);
8578 int pop_sounds_count = 6;
8579 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8580
8581
8582 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8583 string sound_name = pop_sounds[ sound_idx ];
8584 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8585
8586
8587 magazine.ServerAddAmmoCount(-1);
8588
8589
8590 float min_temp_to_explode = 100;
8591
8592 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8593 {
8595 }
8596 }
8597
8598
8599 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8600 {
8601 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8602
8603 const int CHANCE_DAMAGE_CARGO = 4;
8604 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8605 const int CHANCE_DAMAGE_NOTHING = 2;
8606
8608 {
8609 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8610 int chances;
8611 int rnd;
8612
8613 if (GetInventory().GetCargo())
8614 {
8615 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8616 rnd = Math.RandomInt(0,chances);
8617
8618 if (rnd < CHANCE_DAMAGE_CARGO)
8619 {
8621 }
8622 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8623 {
8625 }
8626 }
8627 else
8628 {
8629 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8630 rnd = Math.RandomInt(0,chances);
8631
8632 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8633 {
8635 }
8636 }
8637 }
8638 }
8639
8641 {
8642 CargoBase cargo = GetInventory().GetCargo();
8643 if (cargo)
8644 {
8646 if (item_count > 0)
8647 {
8648 int random_pick = Math.RandomInt(0, item_count);
8650 if (!item.IsExplosive())
8651 {
8652 item.AddHealth("","",damage);
8653 return true;
8654 }
8655 }
8656 }
8657 return false;
8658 }
8659
8661 {
8662 GameInventory inventory = GetInventory();
8664 if (attachment_count > 0)
8665 {
8666 int random_pick = Math.RandomInt(0, attachment_count);
8668 if (!attachment.IsExplosive())
8669 {
8670 attachment.AddHealth("","",damage);
8671 return true;
8672 }
8673 }
8674 return false;
8675 }
8676
8678 {
8680 }
8681
8683 {
8685 return GetInventory().CanRemoveEntity();
8686
8687 return false;
8688 }
8689
8691 {
8692
8694 return false;
8695
8696
8698 return false;
8699
8700
8701
8703 if (delta == 0)
8704 return false;
8705
8706
8707 return true;
8708 }
8709
8711 {
8713 {
8714 if (ScriptInputUserData.CanStoreInputUserData())
8715 {
8716 ScriptInputUserData ctx = new ScriptInputUserData;
8721 ctx.
Write(destination_entity);
8725 }
8726 }
8727 else if (!
g_Game.IsMultiplayer())
8728 {
8730 }
8731 }
8732
8734 {
8735 float split_quantity_new;
8739 InventoryLocation loc = new InventoryLocation;
8740
8741 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8742 {
8744 split_quantity_new = stack_max;
8745 else
8747
8749 {
8750 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8751 if (new_item)
8752 {
8753 new_item.SetResultOfSplit(true);
8754 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8756 new_item.
SetQuantity(split_quantity_new,
false,
true);
8757 }
8758 }
8759 }
8760 else if (destination_entity && slot_id == -1)
8761 {
8762 if (quantity > stack_max)
8763 split_quantity_new = stack_max;
8764 else
8765 split_quantity_new = quantity;
8766
8768 {
8769 GameInventory destinationInventory = destination_entity.GetInventory();
8771 {
8774 }
8775
8776 if (new_item)
8777 {
8778 new_item.SetResultOfSplit(true);
8779 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8781 new_item.
SetQuantity(split_quantity_new,
false,
true);
8782 }
8783 }
8784 }
8785 else
8786 {
8787 if (stack_max != 0)
8788 {
8790 {
8792 }
8793
8794 if (split_quantity_new == 0)
8795 {
8796 if (!
g_Game.IsMultiplayer())
8797 player.PhysicalPredictiveDropItem(this);
8798 else
8799 player.ServerDropEntity(this);
8800 return;
8801 }
8802
8804 {
8806
8807 if (new_item)
8808 {
8809 new_item.SetResultOfSplit(true);
8810 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8813 new_item.PlaceOnSurface();
8814 }
8815 }
8816 }
8817 }
8818 }
8819
8821 {
8822 float split_quantity_new;
8826 InventoryLocation loc = new InventoryLocation;
8827
8828 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8829 {
8831 split_quantity_new = stack_max;
8832 else
8834
8836 {
8837 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8838 if (new_item)
8839 {
8840 new_item.SetResultOfSplit(true);
8841 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8843 new_item.
SetQuantity(split_quantity_new,
false,
true);
8844 }
8845 }
8846 }
8847 else if (destination_entity && slot_id == -1)
8848 {
8849 if (quantity > stack_max)
8850 split_quantity_new = stack_max;
8851 else
8852 split_quantity_new = quantity;
8853
8855 {
8856 GameInventory destinationInventory = destination_entity.GetInventory();
8858 {
8861 }
8862
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 else
8873 {
8874 if (stack_max != 0)
8875 {
8877 {
8879 }
8880
8882 {
8884
8885 if (new_item)
8886 {
8887 new_item.SetResultOfSplit(true);
8888 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8891 new_item.PlaceOnSurface();
8892 }
8893 }
8894 }
8895 }
8896 }
8897
8899 {
8901 {
8902 if (ScriptInputUserData.CanStoreInputUserData())
8903 {
8904 ScriptInputUserData ctx = new ScriptInputUserData;
8909 dst.WriteToContext(ctx);
8911 }
8912 }
8913 else if (!
g_Game.IsMultiplayer())
8914 {
8916 }
8917 }
8918
8920 {
8922 {
8923 if (ScriptInputUserData.CanStoreInputUserData())
8924 {
8925 ScriptInputUserData ctx = new ScriptInputUserData;
8930 ctx.
Write(destination_entity);
8936 }
8937 }
8938 else if (!
g_Game.IsMultiplayer())
8939 {
8941 }
8942 }
8943
8945 {
8947 }
8948
8950 {
8952 float split_quantity_new;
8954 if (dst.IsValid())
8955 {
8956 int slot_id = dst.GetSlot();
8958
8959 if (quantity > stack_max)
8960 split_quantity_new = stack_max;
8961 else
8962 split_quantity_new = quantity;
8963
8965 {
8967
8968 if (new_item)
8969 {
8970 new_item.SetResultOfSplit(true);
8971 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8973 new_item.
SetQuantity(split_quantity_new,
false,
true);
8974 }
8975
8976 return new_item;
8977 }
8978 }
8979
8980 return null;
8981 }
8982
8984 {
8986 float split_quantity_new;
8988 if (destination_entity)
8989 {
8991 if (quantity > stackable)
8992 split_quantity_new = stackable;
8993 else
8994 split_quantity_new = quantity;
8995
8997 {
8998 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8999 if (new_item)
9000 {
9001 new_item.SetResultOfSplit(true);
9002 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9004 new_item.
SetQuantity(split_quantity_new,
false,
true);
9005 }
9006 }
9007 }
9008 }
9009
9011 {
9013 {
9014 if (ScriptInputUserData.CanStoreInputUserData())
9015 {
9016 ScriptInputUserData ctx = new ScriptInputUserData;
9021 ItemBase destination_entity =
this;
9022 ctx.
Write(destination_entity);
9026 }
9027 }
9028 else if (!
g_Game.IsMultiplayer())
9029 {
9031 }
9032 }
9033
9035 {
9037 float split_quantity_new;
9039 if (player)
9040 {
9042 if (quantity > stackable)
9043 split_quantity_new = stackable;
9044 else
9045 split_quantity_new = quantity;
9046
9048 {
9049 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9050 new_item =
ItemBase.Cast(in_hands);
9051 if (new_item)
9052 {
9053 new_item.SetResultOfSplit(true);
9054 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9056 new_item.SetQuantity(split_quantity_new, false, true);
9057 }
9058 }
9059 }
9060 }
9061
9063 {
9065 float split_quantity_new = Math.Floor(quantity * 0.5);
9066
9068 return;
9069
9071
9072 if (new_item)
9073 {
9074 if (new_item.GetQuantityMax() < split_quantity_new)
9075 {
9076 split_quantity_new = new_item.GetQuantityMax();
9077 }
9078
9079 new_item.SetResultOfSplit(true);
9080 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9081
9083 {
9086 }
9087 else
9088 {
9090 new_item.
SetQuantity(split_quantity_new,
false,
true);
9091 }
9092 }
9093 }
9094
9096 {
9098 float split_quantity_new = Math.Floor(quantity / 2);
9099
9101 return;
9102
9103 InventoryLocation invloc = new InventoryLocation;
9105
9107 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9108
9109 if (new_item)
9110 {
9111 if (new_item.GetQuantityMax() < split_quantity_new)
9112 {
9113 split_quantity_new = new_item.GetQuantityMax();
9114 }
9116 {
9119 }
9120 else if (split_quantity_new > 1)
9121 {
9123 new_item.
SetQuantity(split_quantity_new,
false,
true);
9124 }
9125 }
9126 }
9127
9130 {
9131 SetWeightDirty();
9133
9134 if (parent)
9135 parent.OnAttachmentQuantityChangedEx(this, delta);
9136
9138 {
9140 {
9142 }
9144 {
9145 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9147 }
9148 }
9149 }
9150
9153 {
9154
9155 }
9156
9159 {
9161 }
9162
9164 {
9165 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9166
9168 {
9169 if (newLevel == GameConstants.STATE_RUINED)
9170 {
9172 EntityAI parent = GetHierarchyParent();
9173 if (parent && parent.IsFireplace())
9174 {
9175 CargoBase cargo = GetInventory().GetCargo();
9176 if (cargo)
9177 {
9179 {
9181 }
9182 }
9183 }
9184 }
9185
9187 {
9188
9190 return;
9191 }
9192
9193 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9194 {
9196 }
9197 }
9198 }
9199
9200
9202 {
9203 super.OnRightClick();
9204
9206 {
9208 {
9209 if (ScriptInputUserData.CanStoreInputUserData())
9210 {
9211 EntityAI root = GetHierarchyRoot();
9212 Man playerOwner = GetHierarchyRootPlayer();
9213 InventoryLocation dst = new InventoryLocation;
9214
9215
9216 if (!playerOwner && root && root == this)
9217 {
9219 }
9220 else
9221 {
9222
9223 GetInventory().GetCurrentInventoryLocation(dst);
9225 {
9226 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9228 {
9230 }
9231 else
9232 {
9234
9235
9236 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9237 {
9239 }
9240 else
9241 {
9242 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9243 }
9244 }
9245 }
9246 }
9247
9248 ScriptInputUserData ctx = new ScriptInputUserData;
9256 }
9257 }
9258 else if (!
g_Game.IsMultiplayer())
9259 {
9261 }
9262 }
9263 }
9264
9266 {
9267 if (root)
9268 {
9269 vector m4[4];
9270 root.GetTransform(m4);
9271 dst.SetGround(this, m4);
9272 }
9273 else
9274 {
9275 GetInventory().GetCurrentInventoryLocation(dst);
9276 }
9277 }
9278
9279 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9280 {
9281
9282 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9283 return false;
9284
9285 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9286 return false;
9287
9288
9290 return false;
9291
9292
9293 Magazine mag = Magazine.Cast(this);
9294 if (mag)
9295 {
9296 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9297 return false;
9298
9299 if (stack_max_limit)
9300 {
9301 Magazine other_mag = Magazine.Cast(other_item);
9302 if (other_item)
9303 {
9304 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9305 return false;
9306 }
9307
9308 }
9309 }
9310 else
9311 {
9312
9314 return false;
9315
9317 return false;
9318 }
9319
9320 PlayerBase player = null;
9321 if (CastTo(player, GetHierarchyRootPlayer()))
9322 {
9323 if (player.GetInventory().HasAttachment(this))
9324 return false;
9325
9326 if (player.IsItemsToDelete())
9327 return false;
9328 }
9329
9330 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9331 return false;
9332
9333 int slotID;
9335 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9336 return false;
9337
9338 return true;
9339 }
9340
9342 {
9344 }
9345
9347 {
9348 return m_IsResultOfSplit;
9349 }
9350
9352 {
9353 m_IsResultOfSplit = value;
9354 }
9355
9357 {
9359 }
9360
9362 {
9363 float other_item_quantity = other_item.GetQuantity();
9364 float this_free_space;
9365
9367
9369
9370 if (other_item_quantity > this_free_space)
9371 {
9372 return this_free_space;
9373 }
9374 else
9375 {
9376 return other_item_quantity;
9377 }
9378 }
9379
9381 {
9383 }
9384
9386 {
9388 return;
9389
9390 if (!IsMagazine() && other_item)
9391 {
9393 if (quantity_used != 0)
9394 {
9395 float hp1 = GetHealth01("","");
9396 float hp2 = other_item.GetHealth01("","");
9397 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9398 hpResult = hpResult / (
GetQuantity() + quantity_used);
9399
9400 hpResult *= GetMaxHealth();
9401 Math.Round(hpResult);
9402 SetHealth("", "Health", hpResult);
9403
9405 other_item.AddQuantity(-quantity_used);
9406 }
9407 }
9409 }
9410
9412 {
9413 #ifdef SERVER
9414 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9415 GetHierarchyParent().IncreaseLifetimeUp();
9416 #endif
9417 };
9418
9420 {
9421 PlayerBase p = PlayerBase.Cast(player);
9422
9423 array<int> recipesIds = p.m_Recipes;
9424 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9425 if (moduleRecipesManager)
9426 {
9427 EntityAI itemInHands = player.GetEntityInHands();
9428 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9429 }
9430
9431 for (int i = 0;i < recipesIds.Count(); i++)
9432 {
9433 int key = recipesIds.Get(i);
9434 string recipeName = moduleRecipesManager.GetRecipeName(key);
9436 }
9437 }
9438
9439
9440 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9441 {
9442 super.GetDebugActions(outputList);
9443
9444
9450
9451
9456
9461
9462
9466
9467
9469 {
9473 }
9474
9477
9478
9482
9484
9485 InventoryLocation loc = new InventoryLocation();
9486 GetInventory().GetCurrentInventoryLocation(loc);
9488 {
9489 if (Gizmo_IsSupported())
9492 }
9493
9495 }
9496
9497
9498
9499
9501 {
9502 super.OnAction(action_id, player, ctx);
9503
9505 {
9506 switch (action_id)
9507 {
9511 return true;
9515 return true;
9516 }
9517 }
9518
9520 {
9521 switch (action_id)
9522 {
9524 Delete();
9525 return true;
9526 }
9527 }
9528
9529 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9530 {
9531 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9532 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9533 PlayerBase p = PlayerBase.Cast(player);
9534 if (
EActions.RECIPES_RANGE_START < 1000)
9535 {
9536 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9537 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9538 }
9539 }
9540 #ifndef SERVER
9541 else if (action_id ==
EActions.WATCH_PLAYER)
9542 {
9543 PluginDeveloper.SetDeveloperItemClientEx(player);
9544 }
9545 #endif
9547 {
9548 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9549 {
9550 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9551 OnDebugButtonPressServer(id + 1);
9552 }
9553
9554 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9555 {
9556 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9558 }
9559
9560 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9561 {
9562 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9564 }
9565
9566 else if (action_id ==
EActions.ADD_QUANTITY)
9567 {
9568 if (IsMagazine())
9569 {
9570 Magazine mag = Magazine.Cast(this);
9571 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9572 }
9573 else
9574 {
9576 }
9577
9578 if (m_EM)
9579 {
9580 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9581 }
9582
9583 }
9584
9585 else if (action_id ==
EActions.REMOVE_QUANTITY)
9586 {
9587 if (IsMagazine())
9588 {
9589 Magazine mag2 = Magazine.Cast(this);
9590 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9591 }
9592 else
9593 {
9595 }
9596 if (m_EM)
9597 {
9598 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9599 }
9600
9601 }
9602
9603 else if (action_id ==
EActions.SET_QUANTITY_0)
9604 {
9606
9607 if (m_EM)
9608 {
9609 m_EM.SetEnergy(0);
9610 }
9611 }
9612
9613 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9614 {
9616
9617 if (m_EM)
9618 {
9619 m_EM.SetEnergy(m_EM.GetEnergyMax());
9620 }
9621 }
9622
9623 else if (action_id ==
EActions.ADD_HEALTH)
9624 {
9625 AddHealth("","",GetMaxHealth("","Health")/5);
9626 }
9627 else if (action_id ==
EActions.REMOVE_HEALTH)
9628 {
9629 AddHealth("","",-GetMaxHealth("","Health")/5);
9630 }
9631 else if (action_id ==
EActions.DESTROY_HEALTH)
9632 {
9633 SetHealth01("","",0);
9634 }
9635 else if (action_id ==
EActions.WATCH_ITEM)
9636 {
9638 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9639 #ifdef DEVELOPER
9640 SetDebugDeveloper_item(this);
9641 #endif
9642 }
9643
9644 else if (action_id ==
EActions.ADD_TEMPERATURE)
9645 {
9646 AddTemperature(20);
9647
9648 }
9649
9650 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9651 {
9652 AddTemperature(-20);
9653
9654 }
9655
9656 else if (action_id ==
EActions.FLIP_FROZEN)
9657 {
9658 SetFrozen(!GetIsFrozen());
9659
9660 }
9661
9662 else if (action_id ==
EActions.ADD_WETNESS)
9663 {
9665
9666 }
9667
9668 else if (action_id ==
EActions.REMOVE_WETNESS)
9669 {
9671
9672 }
9673
9674 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9675 {
9678
9679
9680 }
9681
9682 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9683 {
9686 }
9687
9688 else if (action_id ==
EActions.MAKE_SPECIAL)
9689 {
9690 auto debugParams = DebugSpawnParams.WithPlayer(player);
9691 OnDebugSpawnEx(debugParams);
9692 }
9693
9694 }
9695
9696
9697 return false;
9698 }
9699
9700
9701
9702
9706
9709
9710
9711
9713 {
9714 return false;
9715 }
9716
9717
9719 {
9720 return true;
9721 }
9722
9723
9725 {
9726 return true;
9727 }
9728
9729
9730
9732 {
9733 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9734 return g_Game.ConfigIsExisting(config_path);
9735 }
9736
9739 {
9740 return null;
9741 }
9742
9744 {
9745 return false;
9746 }
9747
9749 {
9750 return false;
9751 }
9752
9756
9757
9759 {
9760 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9761 return module_repairing.CanRepair(this, item_repair_kit);
9762 }
9763
9764
9765 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9766 {
9767 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9768 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9769 }
9770
9771
9773 {
9774
9775
9776
9777
9778
9779
9780
9781
9782 return 1;
9783 }
9784
9785
9786
9788 {
9790 }
9791
9792
9793
9795 {
9797 }
9798
9799
9808 {
9809 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9810
9811 if (player)
9812 {
9813 player.MessageStatus(text);
9814 }
9815 }
9816
9817
9826 {
9827 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9828
9829 if (player)
9830 {
9831 player.MessageAction(text);
9832 }
9833 }
9834
9835
9844 {
9845 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9846
9847 if (player)
9848 {
9849 player.MessageFriendly(text);
9850 }
9851 }
9852
9853
9862 {
9863 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9864
9865 if (player)
9866 {
9867 player.MessageImportant(text);
9868 }
9869 }
9870
9872 {
9873 return true;
9874 }
9875
9876
9877 override bool KindOf(
string tag)
9878 {
9879 bool found = false;
9880 string item_name = this.
GetType();
9882 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9883
9884 int array_size = item_tag_array.Count();
9885 for (int i = 0; i < array_size; i++)
9886 {
9887 if (item_tag_array.Get(i) == tag)
9888 {
9889 found = true;
9890 break;
9891 }
9892 }
9893 return found;
9894 }
9895
9896
9898 {
9899
9900 super.OnRPC(sender, rpc_type,ctx);
9901
9902
9903 switch (rpc_type)
9904 {
9905 #ifndef SERVER
9906 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9907 Param2<bool, string> p = new Param2<bool, string>(false, "");
9908
9910 return;
9911
9912 bool play = p.param1;
9913 string soundSet = p.param2;
9914
9915 if (play)
9916 {
9918 {
9920 {
9922 }
9923 }
9924 else
9925 {
9927 }
9928 }
9929 else
9930 {
9932 }
9933
9934 break;
9935 #endif
9936
9937 }
9938
9940 {
9942 }
9943 }
9944
9945
9946
9947
9949 {
9950 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9951 return plugin.GetID(
name);
9952 }
9953
9955 {
9956 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9957 return plugin.GetName(id);
9958 }
9959
9962 {
9963
9964
9965 int varFlags;
9966 if (!ctx.
Read(varFlags))
9967 return;
9968
9969 if (varFlags & ItemVariableFlags.FLOAT)
9970 {
9972 }
9973 }
9974
9976 {
9977
9978 super.SerializeNumericalVars(floats_out);
9979
9980
9981
9983 {
9985 }
9986
9988 {
9990 }
9991
9993 {
9995 }
9996
9998 {
10003 }
10004
10006 {
10008 }
10009 }
10010
10012 {
10013
10014 super.DeSerializeNumericalVars(floats);
10015
10016
10017 int index = 0;
10018 int mask = Math.Round(floats.Get(index));
10019
10020 index++;
10021
10023 {
10025 {
10027 }
10028 else
10029 {
10030 float quantity = floats.Get(index);
10031 SetQuantity(quantity,
true,
false,
false,
false);
10032 }
10033 index++;
10034 }
10035
10037 {
10038 float wet = floats.Get(index);
10040 index++;
10041 }
10042
10044 {
10045 int liquidtype = Math.Round(floats.Get(index));
10047 index++;
10048 }
10049
10051 {
10053 index++;
10055 index++;
10057 index++;
10059 index++;
10060 }
10061
10063 {
10064 int cleanness = Math.Round(floats.Get(index));
10066 index++;
10067 }
10068 }
10069
10071 {
10072 super.WriteVarsToCTX(ctx);
10073
10074
10076 {
10078 }
10079
10081 {
10083 }
10084
10086 {
10088 }
10089
10091 {
10092 int r,g,b,a;
10098 }
10099
10101 {
10103 }
10104 }
10105
10107 {
10108 if (!super.ReadVarsFromCTX(ctx,version))
10109 return false;
10110
10111 int intValue;
10112 float value;
10113
10114 if (version < 140)
10115 {
10116 if (!ctx.
Read(intValue))
10117 return false;
10118
10119 m_VariablesMask = intValue;
10120 }
10121
10123 {
10124 if (!ctx.
Read(value))
10125 return false;
10126
10128 {
10130 }
10131 else
10132 {
10134 }
10135 }
10136
10137 if (version < 140)
10138 {
10140 {
10141 if (!ctx.
Read(value))
10142 return false;
10143 SetTemperatureDirect(value);
10144 }
10145 }
10146
10148 {
10149 if (!ctx.
Read(value))
10150 return false;
10152 }
10153
10155 {
10156 if (!ctx.
Read(intValue))
10157 return false;
10159 }
10160
10162 {
10163 int r,g,b,a;
10165 return false;
10167 return false;
10169 return false;
10171 return false;
10172
10174 }
10175
10177 {
10178 if (!ctx.
Read(intValue))
10179 return false;
10181 }
10182
10183 if (version >= 138 && version < 140)
10184 {
10186 {
10187 if (!ctx.
Read(intValue))
10188 return false;
10189 SetFrozen(intValue);
10190 }
10191 }
10192
10193 return true;
10194 }
10195
10196
10198 {
10201 {
10203 }
10204
10205 if (!super.OnStoreLoad(ctx, version))
10206 {
10208 return false;
10209 }
10210
10211 if (version >= 114)
10212 {
10213 bool hasQuickBarIndexSaved;
10214
10215 if (!ctx.
Read(hasQuickBarIndexSaved))
10216 {
10218 return false;
10219 }
10220
10221 if (hasQuickBarIndexSaved)
10222 {
10223 int itmQBIndex;
10224
10225
10226 if (!ctx.
Read(itmQBIndex))
10227 {
10229 return false;
10230 }
10231
10232 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10233 if (itmQBIndex != -1 && parentPlayer)
10234 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10235 }
10236 }
10237 else
10238 {
10239
10240 PlayerBase player;
10241 int itemQBIndex;
10242 if (version ==
int.
MAX)
10243 {
10244 if (!ctx.
Read(itemQBIndex))
10245 {
10247 return false;
10248 }
10249 }
10250 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10251 {
10252
10253 if (!ctx.
Read(itemQBIndex))
10254 {
10256 return false;
10257 }
10258 if (itemQBIndex != -1 && player)
10259 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10260 }
10261 }
10262
10263 if (version < 140)
10264 {
10265
10266 if (!LoadVariables(ctx, version))
10267 {
10269 return false;
10270 }
10271 }
10272
10273
10275 {
10277 return false;
10278 }
10279 if (version >= 132)
10280 {
10282 if (raib)
10283 {
10285 {
10287 return false;
10288 }
10289 }
10290 }
10291
10293 return true;
10294 }
10295
10296
10297
10299 {
10300 super.OnStoreSave(ctx);
10301
10302 PlayerBase player;
10303 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10304 {
10306
10307 int itemQBIndex = -1;
10308 itemQBIndex = player.FindQuickBarEntityIndex(this);
10309 ctx.
Write(itemQBIndex);
10310 }
10311 else
10312 {
10314 }
10315
10317
10319 if (raib)
10320 {
10322 }
10323 }
10324
10325
10327 {
10328 super.AfterStoreLoad();
10329
10331 {
10333 }
10334
10336 {
10339 }
10340 }
10341
10343 {
10344 super.EEOnAfterLoad();
10345
10347 {
10349 }
10350
10353 }
10354
10356 {
10357 return false;
10358 }
10359
10360
10361
10363 {
10365 {
10366 #ifdef PLATFORM_CONSOLE
10367
10369 {
10371 if (menu)
10372 {
10374 }
10375 }
10376 #endif
10377 }
10378
10380 {
10383 }
10384
10386 {
10387 SetWeightDirty();
10389 }
10391 {
10394 }
10395
10397 {
10400
10403 }
10405 {
10409 }
10410
10411 super.OnVariablesSynchronized();
10412 }
10413
10414
10415
10417 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10418 {
10419 if (!IsServerCheck(allow_client))
10420 return false;
10421
10423 return false;
10424
10427
10428 if (value <= (min + 0.001))
10429 value = min;
10430
10431 if (value == min)
10432 {
10433 if (destroy_config)
10434 {
10435 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10436 if (dstr)
10437 {
10439 this.Delete();
10440 return true;
10441 }
10442 }
10443 else if (destroy_forced)
10444 {
10446 this.Delete();
10447 return true;
10448 }
10449
10451 }
10452
10455
10457 {
10458 EntityAI parent = GetHierarchyRoot();
10459 InventoryLocation iLoc = new InventoryLocation();
10460 GetInventory().GetCurrentInventoryLocation(iLoc);
10462 {
10463 int iLocSlot = iLoc.
GetSlot();
10465 {
10467 }
10469 {
10471 }
10472 }
10473 }
10474
10476 {
10478
10479 if (delta)
10481 }
10482
10484
10485 return false;
10486 }
10487
10488
10490 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10491 {
10493 }
10494
10496 {
10499 }
10500
10502 {
10505 }
10506
10508 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10509 {
10510 float value_clamped = Math.Clamp(value, 0, 1);
10512 SetQuantity(result, destroy_config, destroy_forced);
10513 }
10514
10515
10518 {
10520 }
10521
10523 {
10525 }
10526
10527
10528
10529
10530
10531
10532
10533
10534
10535
10537 {
10538 int slot = -1;
10539 GameInventory inventory = GetInventory();
10540 if (inventory)
10541 {
10542 InventoryLocation il = new InventoryLocation;
10545 }
10546
10548 }
10549
10551 {
10552 float quantity_max = 0;
10553
10555 {
10556 if (attSlotID != -1)
10557 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10558
10559 if (quantity_max <= 0)
10561 }
10562
10563 if (quantity_max <= 0)
10565
10566 return quantity_max;
10567 }
10568
10570 {
10572 }
10573
10575 {
10577 }
10578
10579
10581 {
10583 }
10584
10586 {
10588 }
10589
10591 {
10593 }
10594
10595
10597 {
10598
10599 float weightEx = GetWeightEx();
10600 float special = GetInventoryAndCargoWeight();
10601 return weightEx - special;
10602 }
10603
10604
10606 {
10608 }
10609
10611 {
10613 {
10614 #ifdef DEVELOPER
10615 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10616 {
10617 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10619 }
10620 #endif
10621
10622 return GetQuantity() * GetConfigWeightModified();
10623 }
10624 else if (HasEnergyManager())
10625 {
10626 #ifdef DEVELOPER
10627 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10628 {
10629 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10630 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10631 }
10632 #endif
10633 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10634 }
10635 else
10636 {
10637 #ifdef DEVELOPER
10638 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10639 {
10640 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10641 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10642 }
10643 #endif
10644 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10645 }
10646 }
10647
10650 {
10651 int item_count = 0;
10653
10654 GameInventory inventory = GetInventory();
10655 CargoBase cargo = inventory.
GetCargo();
10656 if (cargo != NULL)
10657 {
10659 }
10660
10662 for (int i = 0; i < nAttachments; ++i)
10663 {
10665 if (item)
10666 item_count += item.GetNumberOfItems();
10667 }
10668 return item_count;
10669 }
10670
10673 {
10674 float weight = 0;
10675 float wetness = 1;
10676 if (include_wetness)
10679 {
10680 weight = wetness * m_ConfigWeight;
10681 }
10683 {
10684 weight = 1;
10685 }
10686 return weight;
10687 }
10688
10689
10690
10692 {
10693 GameInventory inventory = GetInventory();
10694 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10695 {
10696 array<EntityAI> items = new array<EntityAI>;
10698 for (int i = 0; i < items.Count(); ++i)
10699 {
10701 if (item)
10702 {
10703 g_Game.ObjectDelete(item);
10704 }
10705 }
10706 }
10707 }
10708
10709
10710
10711
10713 {
10714 float energy = 0;
10715 if (HasEnergyManager())
10716 {
10717 energy = GetCompEM().GetEnergy();
10718 }
10719 return energy;
10720 }
10721
10722
10724 {
10725 super.OnEnergyConsumed();
10726
10728 }
10729
10731 {
10732 super.OnEnergyAdded();
10733
10735 }
10736
10737
10739 {
10740 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10741 {
10743 {
10744 float energy_0to1 = GetCompEM().GetEnergy0To1();
10746 }
10747 }
10748 }
10749
10750
10752 {
10753 return ConfigGetFloat("heatIsolation");
10754 }
10755
10757 {
10759 }
10760
10762 {
10763 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10764 if (
g_Game.ConfigIsExisting(paramPath))
10765 return g_Game.ConfigGetFloat(paramPath);
10766
10767 return 0.0;
10768 }
10769
10771 {
10772 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10773 if (
g_Game.ConfigIsExisting(paramPath))
10774 return g_Game.ConfigGetFloat(paramPath);
10775
10776 return 0.0;
10777 }
10778
10779 override void SetWet(
float value,
bool allow_client =
false)
10780 {
10781 if (!IsServerCheck(allow_client))
10782 return;
10783
10786
10788
10789 m_VarWet = Math.Clamp(value, min, max);
10790
10792 {
10795 }
10796 }
10797
10798 override void AddWet(
float value)
10799 {
10801 }
10802
10804 {
10806 }
10807
10809 {
10811 }
10812
10814 {
10816 }
10817
10819 {
10821 }
10822
10824 {
10826 }
10827
10828 override void OnWetChanged(
float newVal,
float oldVal)
10829 {
10832 if (newLevel != oldLevel)
10833 {
10835 }
10836 }
10837
10839 {
10840 SetWeightDirty();
10841 }
10842
10844 {
10845 return GetWetLevelInternal(
m_VarWet);
10846 }
10847
10848
10849
10851 {
10853 }
10854
10856 {
10858 }
10859
10861 {
10863 }
10864
10866 {
10868 }
10869
10870
10871
10873 {
10874 if (ConfigIsExisting("itemModelLength"))
10875 {
10876 return ConfigGetFloat("itemModelLength");
10877 }
10878 return 0;
10879 }
10880
10882 {
10883 if (ConfigIsExisting("itemAttachOffset"))
10884 {
10885 return ConfigGetFloat("itemAttachOffset");
10886 }
10887 return 0;
10888 }
10889
10890 override void SetCleanness(
int value,
bool allow_client =
false)
10891 {
10892 if (!IsServerCheck(allow_client))
10893 return;
10894
10896
10898
10901 }
10902
10904 {
10906 }
10907
10909 {
10910 return true;
10911 }
10912
10913
10914
10915
10917 {
10919 }
10920
10922 {
10924 }
10925
10926
10927
10928
10929 override void SetColor(
int r,
int g,
int b,
int a)
10930 {
10936 }
10938 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10939 {
10944 }
10945
10947 {
10949 }
10950
10953 {
10954 int r,g,b,a;
10956 r = r/255;
10957 g = g/255;
10958 b = b/255;
10959 a = a/255;
10960 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10961 }
10962
10963
10964
10965 override void SetLiquidType(
int value,
bool allow_client =
false)
10966 {
10967 if (!IsServerCheck(allow_client))
10968 return;
10969
10974 }
10975
10977 {
10978 return ConfigGetInt("varLiquidTypeInit");
10979 }
10980
10982 {
10984 }
10985
10987 {
10989 SetFrozen(false);
10990 }
10991
10994 {
10995 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10996 }
10997
10998
11001 {
11002 PlayerBase nplayer;
11003 if (PlayerBase.CastTo(nplayer, player))
11004 {
11006 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11007 }
11008 }
11009
11010
11013 {
11014 PlayerBase nplayer;
11015 if (PlayerBase.CastTo(nplayer,player))
11016 {
11017 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11018 }
11019
11020 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11021
11022 if (HasEnergyManager())
11023 {
11024 GetCompEM().UpdatePlugState();
11025 }
11026 }
11027
11028
11030 {
11031 super.OnPlacementStarted(player);
11032
11034 }
11035
11036 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11037 {
11039 {
11040 m_AdminLog.OnPlacementComplete(player,
this);
11041 }
11042
11043 super.OnPlacementComplete(player, position, orientation);
11044 }
11045
11046
11047
11048
11049
11051 {
11053 {
11054 return true;
11055 }
11056 else
11057 {
11058 return false;
11059 }
11060 }
11061
11062
11064 {
11066 {
11068 }
11069 }
11070
11071
11073 {
11075 }
11076
11078 {
11080 }
11081
11082 override void InsertAgent(
int agent,
float count = 1)
11083 {
11084 if (count < 1)
11085 return;
11086
11088 }
11089
11092 {
11094 }
11095
11096
11098 {
11100 }
11101
11102
11103
11104
11105
11106
11107
11108
11109
11110
11111
11112
11113
11114
11115
11116
11117
11118
11119
11120
11121
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11142
11144 {
11146 return false;
11147 return true;
11148 }
11149
11151 {
11152
11154 }
11155
11156
11159 {
11160 super.CheckForRoofLimited(timeTresholdMS);
11161
11162 float time =
g_Game.GetTime();
11163 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11164 {
11165 m_PreviousRoofTestTime = time;
11166 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11167 }
11168 }
11169
11170
11172 {
11174 {
11175 return 0;
11176 }
11177
11178 if (GetInventory().GetAttachmentSlotsCount() != 0)
11179 {
11180 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11181 if (filter)
11182 return filter.GetProtectionLevel(type, false, system);
11183 else
11184 return 0;
11185 }
11186
11187 string subclassPath, entryName;
11188
11189 switch (type)
11190 {
11192 entryName = "biological";
11193 break;
11195 entryName = "chemical";
11196 break;
11197 default:
11198 entryName = "biological";
11199 break;
11200 }
11201
11202 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11203
11204 return g_Game.ConfigGetFloat(subclassPath + entryName);
11205 }
11206
11207
11208
11211 {
11212 if (!IsMagazine())
11214
11216 }
11217
11218
11219
11220
11221
11226 {
11227 return true;
11228 }
11229
11231 {
11233 }
11234
11235
11236
11237
11238
11240 {
11241 if (parent)
11242 {
11243 if (parent.IsInherited(DayZInfected))
11244 return true;
11245
11246 if (!parent.IsRuined())
11247 return true;
11248 }
11249
11250 return true;
11251 }
11252
11254 {
11255 if (!super.CanPutAsAttachment(parent))
11256 {
11257 return false;
11258 }
11259
11260 if (!IsRuined() && !parent.IsRuined())
11261 {
11262 return true;
11263 }
11264
11265 return false;
11266 }
11267
11269 {
11270
11271
11272
11273
11274 return super.CanReceiveItemIntoCargo(item);
11275 }
11276
11278 {
11279
11280
11281
11282
11283 GameInventory attachmentInv = attachment.GetInventory();
11285 {
11286 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11287 return false;
11288 }
11289
11290 InventoryLocation loc = new InventoryLocation();
11291 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11292 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11293 return false;
11294
11295 return super.CanReceiveAttachment(attachment, slotId);
11296 }
11297
11299 {
11300 if (!super.CanReleaseAttachment(attachment))
11301 return false;
11302
11303 return GetInventory().AreChildrenAccessible();
11304 }
11305
11306
11307
11308
11309
11310
11311
11312
11313
11314
11315
11316
11317
11318
11319
11320
11321
11322
11323
11324
11325
11327 {
11328 int id = muzzle_owner.GetMuzzleID();
11329 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11330
11331 if (WPOF_array)
11332 {
11333 for (int i = 0; i < WPOF_array.Count(); i++)
11334 {
11335 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11336
11337 if (WPOF)
11338 {
11339 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11340 }
11341 }
11342 }
11343 }
11344
11345
11347 {
11348 int id = muzzle_owner.GetMuzzleID();
11350
11351 if (WPOBE_array)
11352 {
11353 for (int i = 0; i < WPOBE_array.Count(); i++)
11354 {
11355 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11356
11357 if (WPOBE)
11358 {
11359 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11360 }
11361 }
11362 }
11363 }
11364
11365
11367 {
11368 int id = muzzle_owner.GetMuzzleID();
11369 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11370
11371 if (WPOOH_array)
11372 {
11373 for (int i = 0; i < WPOOH_array.Count(); i++)
11374 {
11375 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11376
11377 if (WPOOH)
11378 {
11379 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11380 }
11381 }
11382 }
11383 }
11384
11385
11387 {
11388 int id = muzzle_owner.GetMuzzleID();
11389 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11390
11391 if (WPOOH_array)
11392 {
11393 for (int i = 0; i < WPOOH_array.Count(); i++)
11394 {
11395 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11396
11397 if (WPOOH)
11398 {
11399 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11400 }
11401 }
11402 }
11403 }
11404
11405
11407 {
11408 int id = muzzle_owner.GetMuzzleID();
11409 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11410
11411 if (WPOOH_array)
11412 {
11413 for (int i = 0; i < WPOOH_array.Count(); i++)
11414 {
11415 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11416
11417 if (WPOOH)
11418 {
11419 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11420 }
11421 }
11422 }
11423 }
11424
11425
11426
11428 {
11430 {
11431 return true;
11432 }
11433
11434 return false;
11435 }
11436
11438 {
11440 {
11441 return true;
11442 }
11443
11444 return false;
11445 }
11446
11448 {
11450 {
11451 return true;
11452 }
11453
11454 return false;
11455 }
11456
11458 {
11459 return false;
11460 }
11461
11464 {
11465 return UATimeSpent.DEFAULT_DEPLOY;
11466 }
11467
11468
11469
11470
11472 {
11474 SetSynchDirty();
11475 }
11476
11478 {
11480 }
11481
11482
11484 {
11485 return false;
11486 }
11487
11490 {
11491 string att_type = "None";
11492
11493 if (ConfigIsExisting("soundAttType"))
11494 {
11495 att_type = ConfigGetString("soundAttType");
11496 }
11497
11499 }
11500
11502 {
11504 }
11505
11506
11507
11508
11509
11515
11517 {
11520
11522 }
11523
11524
11526 {
11528 return;
11529
11531
11534
11537
11538 SoundParameters params = new SoundParameters();
11542 }
11543
11544
11546 {
11548 {
11551
11552 SetSynchDirty();
11553
11556 }
11557 }
11558
11560 {
11562 }
11563
11564
11566 {
11568 return;
11569
11571 SetSynchDirty();
11572
11575 }
11576
11578 {
11581 }
11582
11584 {
11586 }
11587
11588 void OnApply(PlayerBase player);
11589
11591 {
11592 return 1.0;
11593 };
11594
11596 {
11598 }
11599
11601 {
11603 }
11604
11606
11608 {
11609 SetDynamicPhysicsLifeTime(0.01);
11611 }
11612
11614 {
11615 array<string> zone_names = new array<string>;
11616 GetDamageZones(zone_names);
11617 for (int i = 0; i < zone_names.Count(); i++)
11618 {
11619 SetHealthMax(zone_names.Get(i),"Health");
11620 }
11621 SetHealthMax("","Health");
11622 }
11623
11626 {
11627 float global_health = GetHealth01("","Health");
11628 array<string> zones = new array<string>;
11629 GetDamageZones(zones);
11630
11631 for (int i = 0; i < zones.Count(); i++)
11632 {
11633 SetHealth01(zones.Get(i),"Health",global_health);
11634 }
11635 }
11636
11639 {
11640 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11641 }
11642
11644 {
11645 if (!hasRootAsPlayer)
11646 {
11647 if (refParentIB)
11648 {
11649
11650 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11651 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11652
11653 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11654 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11655
11658 }
11659 else
11660 {
11661
11664 }
11665 }
11666 }
11667
11669 {
11671 {
11672 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11673 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11674 {
11675 float heatPermCoef = 1.0;
11677 while (ent)
11678 {
11679 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11680 ent = ent.GetHierarchyParent();
11681 }
11682
11683 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11684 }
11685 }
11686 }
11687
11689 {
11690
11691 EntityAI parent = GetHierarchyParent();
11692 if (!parent)
11693 {
11694 hasParent = false;
11695 hasRootAsPlayer = false;
11696 }
11697 else
11698 {
11699 hasParent = true;
11700 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11701 refParentIB =
ItemBase.Cast(parent);
11702 }
11703 }
11704
11705 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11706 {
11707
11708 }
11709
11711 {
11712
11713 return false;
11714 }
11715
11717 {
11718
11719
11720 return false;
11721 }
11722
11724 {
11725
11726 return false;
11727 }
11728
11731 {
11732 return !GetIsFrozen() &&
IsOpen();
11733 }
11734
11736 {
11737 bool hasParent = false, hasRootAsPlayer = false;
11739
11740 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11741 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11742
11743 if (wwtu || foodDecay)
11744 {
11748
11749 if (processWetness || processTemperature || processDecay)
11750 {
11752
11753 if (processWetness)
11754 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11755
11756 if (processTemperature)
11758
11759 if (processDecay)
11760 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11761 }
11762 }
11763 }
11764
11767 {
11769 }
11770
11772 {
11775
11776 return super.GetTemperatureFreezeThreshold();
11777 }
11778
11780 {
11783
11784 return super.GetTemperatureThawThreshold();
11785 }
11786
11788 {
11791
11792 return super.GetItemOverheatThreshold();
11793 }
11794
11796 {
11798 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11799
11800 return super.GetTemperatureFreezeTime();
11801 }
11802
11804 {
11806 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11807
11808 return super.GetTemperatureThawTime();
11809 }
11810
11815
11817 {
11818 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11819 }
11820
11822 {
11823 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11824 }
11825
11828 {
11830 }
11831
11833 {
11835 }
11836
11838 {
11840 }
11841
11844 {
11845 return null;
11846 }
11847
11850 {
11851 return false;
11852 }
11853
11855 {
11857 {
11860 if (!trg)
11861 {
11863 explosive = this;
11864 }
11865
11866 explosive.PairRemote(trg);
11868
11869 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11870 trg.SetPersistentPairID(persistentID);
11871 explosive.SetPersistentPairID(persistentID);
11872
11873 return true;
11874 }
11875 return false;
11876 }
11877
11880 {
11881 float ret = 1.0;
11884 ret *= GetHealth01();
11885
11886 return ret;
11887 }
11888
11889 #ifdef DEVELOPER
11890 override void SetDebugItem()
11891 {
11892 super.SetDebugItem();
11893 _itemBase = this;
11894 }
11895
11897 {
11898 string text = super.GetDebugText();
11899
11901 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11902
11903 return text;
11904 }
11905 #endif
11906
11908 {
11909 return true;
11910 }
11911
11913
11915
11917 {
11920 }
11921
11922
11930
11946
11947 [
Obsolete(
"Use ItemSoundHandler instead")]
11950 {
11951 if (!
g_Game.IsDedicatedServer())
11952 {
11953 if (ConfigIsExisting("attachSoundSet"))
11954 {
11955 string cfg_path = "";
11956 string soundset = "";
11957 string type_name =
GetType();
11958
11961 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11962 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11963
11964 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11965 {
11966 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11967 {
11968 if (cfg_slot_array[i] == slot_type)
11969 {
11970 soundset = cfg_soundset_array[i];
11971 break;
11972 }
11973 }
11974 }
11975
11976 if (soundset != "")
11977 {
11978 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11980 }
11981 }
11982 }
11983 }
11984
11986}
11987
11989{
11991 if (entity)
11992 {
11993 bool is_item = entity.IsInherited(
ItemBase);
11994 if (is_item && full_quantity)
11995 {
11998 }
11999 }
12000 else
12001 {
12003 return NULL;
12004 }
12005 return entity;
12006}
12007
12009{
12010 if (item)
12011 {
12012 if (health > 0)
12013 item.SetHealth("", "", health);
12014
12015 if (item.CanHaveTemperature())
12016 {
12018 if (item.CanFreeze())
12019 item.SetFrozen(false);
12020 }
12021
12022 if (item.HasEnergyManager())
12023 {
12024 if (quantity >= 0)
12025 {
12026 item.GetCompEM().SetEnergy0To1(quantity);
12027 }
12028 else
12029 {
12031 }
12032 }
12033 else if (item.IsMagazine())
12034 {
12035 Magazine mag = Magazine.Cast(item);
12036 if (quantity >= 0)
12037 {
12038 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12039 }
12040 else
12041 {
12043 }
12044
12045 }
12046 else
12047 {
12048 if (quantity >= 0)
12049 {
12050 item.SetQuantityNormalized(quantity, false);
12051 }
12052 else
12053 {
12055 }
12056
12057 }
12058 }
12059}
12060
12061#ifdef DEVELOPER
12063#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.