7179{
7181 {
7182 return true;
7183 }
7184};
7185
7187{
7188
7189};
7190
7191
7192
7194{
7198
7200
7203
7204
7205
7206
7207
7216
7222
7227
7232
7253 protected bool m_IsResultOfSplit
7254
7256
7261
7262
7263
7265
7269
7270
7271
7273
7276
7277
7278
7284
7285
7293
7296
7297
7299
7300
7302
7303
7308
7309
7314
7316
7317
7319
7320
7322 {
7327
7328 if (!
g_Game.IsDedicatedServer())
7329 {
7331 {
7333
7335 {
7337 }
7338 }
7339
7342 }
7343
7344 m_OldLocation = null;
7345
7347 {
7349 }
7350
7351 if (ConfigIsExisting("headSelectionsToHide"))
7352 {
7355 }
7356
7358 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7359 {
7361 }
7362
7364
7365 m_IsResultOfSplit = false;
7366
7368 }
7369
7371 {
7372 super.InitItemVariables();
7373
7379 m_Count = ConfigGetInt(
"count");
7380
7383
7388
7391
7396
7408
7412
7413
7416 if (ConfigIsExisting("canBeSplit"))
7417 {
7420 }
7421
7423 if (ConfigIsExisting("itemBehaviour"))
7425
7426
7429 RegisterNetSyncVariableInt("m_VarLiquidType");
7430 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7431
7432 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7433 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7434 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7435
7436 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7437 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7438 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7439 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7440
7441 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7442 RegisterNetSyncVariableBool("m_IsTakeable");
7443 RegisterNetSyncVariableBool("m_IsHologram");
7444
7447 {
7450 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7451 }
7452
7454
7456 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7458
7460 }
7461
7463 {
7465 }
7466
7468 {
7471 {
7476 }
7477 }
7478
7479 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7480 {
7482 {
7485 }
7486
7488 }
7489
7491 {
7497 }
7498
7500
7502 {
7504
7505 if (!action)
7506 {
7507 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7508 return;
7509 }
7510
7512 if (!ai)
7513 {
7515 return;
7516 }
7517
7519 if (!action_array)
7520 {
7521 action_array = new array<ActionBase_Basic>;
7523 }
7524 if (LogManager.IsActionLogEnable())
7525 {
7526 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7527 }
7528
7529 if (action_array.Find(action) != -1)
7530 {
7531 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7532 }
7533 else
7534 {
7535 action_array.Insert(action);
7536 }
7537 }
7538
7540 {
7541 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7542 ActionBase action = player.GetActionManager().GetAction(actionName);
7545
7546 if (action_array)
7547 {
7548 action_array.RemoveItem(action);
7549 }
7550 }
7551
7552
7553
7555 {
7556 ActionOverrideData overrideData = new ActionOverrideData();
7560
7562 if (!actionMap)
7563 {
7566 }
7567
7568 actionMap.Insert(this.
Type(), overrideData);
7569
7570 }
7571
7573
7575
7576
7578 {
7581
7584
7585 string config_to_search = "CfgVehicles";
7586 string muzzle_owner_config;
7587
7589 {
7590 if (IsInherited(Weapon))
7591 config_to_search = "CfgWeapons";
7592
7593 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7594
7595 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7596
7597 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7598
7599 if (config_OnFire_subclass_count > 0)
7600 {
7601 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7602
7603 for (int i = 0; i < config_OnFire_subclass_count; i++)
7604 {
7605 string particle_class = "";
7606 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7607 string config_OnFire_entry = config_OnFire_class + particle_class;
7608 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7609 WPOF_array.Insert(WPOF);
7610 }
7611
7612
7614 }
7615 }
7616
7618 {
7619 config_to_search = "CfgWeapons";
7620 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7621
7622 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7623
7624 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7625
7626 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7627 {
7628 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7629
7630 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7631 {
7632 string particle_class2 = "";
7633 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7634 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7635 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7636 WPOBE_array.Insert(WPOBE);
7637 }
7638
7639
7641 }
7642 }
7643 }
7644
7645
7647 {
7650
7652 {
7653 string config_to_search = "CfgVehicles";
7654
7655 if (IsInherited(Weapon))
7656 config_to_search = "CfgWeapons";
7657
7658 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7659 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7660
7661 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7662 {
7663
7665
7667 {
7669 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7671 return;
7672 }
7673
7676
7677
7678
7679 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7680 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7681
7682 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7683 {
7684 string particle_class = "";
7685 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7686 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7687 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7688
7689 if (entry_type == CT_CLASS)
7690 {
7691 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7692 WPOOH_array.Insert(WPOF);
7693 }
7694 }
7695
7696
7698 }
7699 }
7700 }
7701
7703 {
7705 }
7706
7708 {
7710 {
7712
7715
7718
7719 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7720 }
7721 }
7722
7724 {
7726 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7727
7729 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7730
7732 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7733
7735 {
7737 }
7738 }
7739
7741 {
7743 }
7744
7746 {
7749 else
7751
7753 {
7756 }
7757 else
7758 {
7761
7764 }
7765
7767 }
7768
7770 {
7772 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7773 }
7774
7776 {
7778 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7780 }
7781
7783 {
7785 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7786 }
7787
7789 {
7792
7793 OverheatingParticle OP = new OverheatingParticle();
7798
7800 }
7801
7803 {
7806
7807 return -1;
7808 }
7809
7811 {
7813 {
7816
7817 for (int i = count; i > 0; --i)
7818 {
7819 int id = i - 1;
7822
7825
7826 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7827 {
7828 if (p)
7829 {
7832 }
7833 }
7834 }
7835 }
7836 }
7837
7839 {
7841 {
7843 {
7844 int id = i - 1;
7846
7847 if (OP)
7848 {
7850
7851 if (p)
7852 {
7854 }
7855
7856 delete OP;
7857 }
7858 }
7859
7862 }
7863 }
7864
7867 {
7868 return 0.0;
7869 }
7870
7871
7873 {
7874 return 250;
7875 }
7876
7878 {
7879 return 0;
7880 }
7881
7884 {
7886 return true;
7887
7888 return false;
7889 }
7890
7893 {
7896
7898 {
7900 }
7901 else
7902 {
7903
7905 }
7906
7908 }
7909
7916 {
7917 return -1;
7918 }
7919
7920
7921
7922
7924 {
7926 {
7927 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7928 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7929
7930 if (r_index >= 0)
7931 {
7932 InventoryLocation r_il = new InventoryLocation;
7933 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7934
7935 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7938 {
7939 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7940 }
7942 {
7943 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7944 }
7945
7946 }
7947
7948 player.GetHumanInventory().ClearUserReservedLocation(this);
7949 }
7950
7953 }
7954
7955
7956
7957
7959 {
7960 return ItemBase.m_DebugActionsMask;
7961 }
7962
7964 {
7965 return ItemBase.m_DebugActionsMask & mask;
7966 }
7967
7969 {
7970 ItemBase.m_DebugActionsMask = mask;
7971 }
7972
7974 {
7975 ItemBase.m_DebugActionsMask |= mask;
7976 }
7977
7979 {
7980 ItemBase.m_DebugActionsMask &= ~mask;
7981 }
7982
7984 {
7986 {
7988 }
7989 else
7990 {
7992 }
7993 }
7994
7995
7997 {
7998 if (GetEconomyProfile())
7999 {
8000 float q_max = GetEconomyProfile().GetQuantityMax();
8001 if (q_max > 0)
8002 {
8003 float q_min = GetEconomyProfile().GetQuantityMin();
8004 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8005
8007 {
8008 ComponentEnergyManager comp = GetCompEM();
8010 {
8012 }
8013 }
8015 {
8017
8018 }
8019
8020 }
8021 }
8022 }
8023
8026 {
8027 EntityAI parent = GetHierarchyParent();
8028
8029 if (parent)
8030 {
8031 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8032 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8033 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8034 }
8035 }
8036
8039 {
8040 EntityAI parent = GetHierarchyParent();
8041
8042 if (parent)
8043 {
8044 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8045 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8046 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8047 }
8048 }
8049
8051 {
8052
8053
8054
8055
8057
8059 {
8060 if (ScriptInputUserData.CanStoreInputUserData())
8061 {
8062 ScriptInputUserData ctx = new ScriptInputUserData;
8068 ctx.
Write(use_stack_max);
8071
8073 {
8074 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8075 }
8076 }
8077 }
8078 else if (!
g_Game.IsMultiplayer())
8079 {
8081 }
8082 }
8083
8085 {
8087 }
8088
8090 {
8092 }
8093
8095 {
8097 }
8098
8100 {
8101
8102 return false;
8103 }
8104
8106 {
8107 return false;
8108 }
8109
8113 {
8114 return false;
8115 }
8116
8118 {
8119 return "";
8120 }
8121
8123
8125 {
8126 return false;
8127 }
8128
8130 {
8131 return true;
8132 }
8133
8134
8135
8137 {
8138 return true;
8139 }
8140
8142 {
8143 return true;
8144 }
8145
8147 {
8148 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8150 }
8151
8153 {
8155 }
8156
8158 {
8160 if (!is_being_placed)
8162 SetSynchDirty();
8163 }
8164
8165
8167
8169 {
8171 }
8172
8174 {
8176 }
8177
8179 {
8180 return 1;
8181 }
8182
8184 {
8185 return false;
8186 }
8187
8189 {
8191 SetSynchDirty();
8192 }
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8223
8224
8225
8226
8227
8229 {
8230 super.OnMovedInsideCargo(container);
8231
8232 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8233 }
8234
8235 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8236 {
8237 super.EEItemLocationChanged(oldLoc, newLoc);
8238
8239 PlayerBase newPlayer = null;
8240 PlayerBase oldPlayer = null;
8241
8242 if (newLoc.GetParent())
8243 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8244
8245 if (oldLoc.GetParent())
8246 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8247
8249 {
8250 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8251
8252 if (rIndex >= 0)
8253 {
8254 InventoryLocation rIl = new InventoryLocation;
8255 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8256
8257 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8260 {
8261 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8262 }
8264 {
8266 }
8267
8268 }
8269 }
8270
8272 {
8273 if (newPlayer)
8274 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8275
8276 if (newPlayer == oldPlayer)
8277 {
8278 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8279 {
8281 {
8282 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8283 {
8284 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8285 }
8286 }
8287 else
8288 {
8289 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8290 }
8291 }
8292
8293 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8294 {
8295 int type = oldLoc.GetType();
8297 {
8298 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8299 }
8301 {
8302 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8303 }
8304 }
8305 if (!m_OldLocation)
8306 {
8307 m_OldLocation = new InventoryLocation;
8308 }
8309 m_OldLocation.Copy(oldLoc);
8310 }
8311 else
8312 {
8313 if (m_OldLocation)
8314 {
8315 m_OldLocation.Reset();
8316 }
8317 }
8318
8319 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8320 }
8321 else
8322 {
8323 if (newPlayer)
8324 {
8325 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8326 if (resIndex >= 0)
8327 {
8328 InventoryLocation il = new InventoryLocation;
8329 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8331 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8334 {
8335 il.
GetParent().GetOnReleaseLock().Invoke(it);
8336 }
8338 {
8340 }
8341
8342 }
8343 }
8345 {
8346
8348 }
8349
8350 if (m_OldLocation)
8351 {
8352 m_OldLocation.Reset();
8353 }
8354 }
8355
8357 {
8358 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8359 }
8360
8362 {
8363 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8364 }
8365 }
8366
8367 override void EOnContact(IEntity other, Contact extra)
8368 {
8370 {
8371 int liquidType = -1;
8373 if (impactSpeed > 0.0)
8374 {
8376 #ifndef SERVER
8378 #else
8380 SetSynchDirty();
8381 #endif
8383 }
8384 }
8385
8386 #ifdef SERVER
8387 if (GetCompEM() && GetCompEM().IsPlugged())
8388 {
8389 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8390 GetCompEM().UnplugThis();
8391 }
8392 #endif
8393 }
8394
8396
8398 {
8400 }
8401
8403 {
8404
8405 }
8406
8408 {
8409 super.OnItemLocationChanged(old_owner, new_owner);
8410
8411 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8412 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8413
8414 if (!relatedPlayer && playerNew)
8415 relatedPlayer = playerNew;
8416
8417 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8418 {
8420 if (actionMgr)
8421 {
8422 ActionBase currentAction = actionMgr.GetRunningAction();
8423 if (currentAction)
8425 }
8426 }
8427
8428 Man ownerPlayerOld = null;
8429 Man ownerPlayerNew = null;
8430
8431 if (old_owner)
8432 {
8433 if (old_owner.
IsMan())
8434 {
8435 ownerPlayerOld = Man.Cast(old_owner);
8436 }
8437 else
8438 {
8439 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8440 }
8441 }
8442 else
8443 {
8445 {
8447
8448 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8449 {
8450 GetCompEM().UnplugThis();
8451 }
8452 }
8453 }
8454
8455 if (new_owner)
8456 {
8457 if (new_owner.
IsMan())
8458 {
8459 ownerPlayerNew = Man.Cast(new_owner);
8460 }
8461 else
8462 {
8463 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8464 }
8465 }
8466
8467 if (ownerPlayerOld != ownerPlayerNew)
8468 {
8469 if (ownerPlayerOld)
8470 {
8471 array<EntityAI> subItemsExit = new array<EntityAI>;
8473 for (int i = 0; i < subItemsExit.Count(); i++)
8474 {
8477 }
8478 }
8479
8480 if (ownerPlayerNew)
8481 {
8482 array<EntityAI> subItemsEnter = new array<EntityAI>;
8484 for (int j = 0; j < subItemsEnter.Count(); j++)
8485 {
8488 }
8489 }
8490 }
8491 else if (ownerPlayerNew != null)
8492 {
8493 PlayerBase nplayer;
8494 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8495 {
8496 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8498 for (int k = 0; k < subItemsUpdate.Count(); k++)
8499 {
8501 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8502 }
8503 }
8504 }
8505
8506 if (old_owner)
8507 old_owner.OnChildItemRemoved(this);
8508 if (new_owner)
8509 new_owner.OnChildItemReceived(this);
8510 }
8511
8512
8514 {
8515 super.EEDelete(parent);
8516 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8517 if (player)
8518 {
8520
8521 if (player.IsAlive())
8522 {
8523 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8524 if (r_index >= 0)
8525 {
8526 InventoryLocation r_il = new InventoryLocation;
8527 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8528
8529 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8532 {
8533 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8534 }
8536 {
8537 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8538 }
8539
8540 }
8541
8542 player.RemoveQuickBarEntityShortcut(this);
8543 }
8544 }
8545 }
8546
8548 {
8549 super.EEKilled(killer);
8550
8553 {
8554 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8555 {
8556 if (IsMagazine())
8557 {
8558 if (Magazine.Cast(this).GetAmmoCount() > 0)
8559 {
8561 }
8562 }
8563 else
8564 {
8566 }
8567 }
8568 }
8569 }
8570
8572 {
8573 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8574
8575 super.OnWasAttached(parent, slot_id);
8576
8579
8582 }
8583
8585 {
8586 super.OnWasDetached(parent, slot_id);
8587
8590
8593 }
8594
8596 {
8597 int idx;
8600
8601 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8602 if (inventory_slots.Count() < 1)
8603 {
8604 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8605 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8606 }
8607 else
8608 {
8609 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8610 }
8611
8612 idx = inventory_slots.Find(slot);
8613 if (idx < 0)
8614 return "";
8615
8616 return attach_types.Get(idx);
8617 }
8618
8620 {
8621 int idx = -1;
8622 string slot;
8623
8626
8627 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8628 if (inventory_slots.Count() < 1)
8629 {
8630 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8631 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8632 }
8633 else
8634 {
8635 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8636 if (detach_types.Count() < 1)
8637 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8638 }
8639
8640 for (int i = 0; i < inventory_slots.Count(); i++)
8641 {
8642 slot = inventory_slots.Get(i);
8643 }
8644
8645 if (slot != "")
8646 {
8647 if (detach_types.Count() == 1)
8648 idx = 0;
8649 else
8650 idx = inventory_slots.Find(slot);
8651 }
8652 if (idx < 0)
8653 return "";
8654
8655 return detach_types.Get(idx);
8656 }
8657
8659 {
8660
8662
8663
8664 float min_time = 1;
8665 float max_time = 3;
8666 float delay = Math.RandomFloat(min_time, max_time);
8667
8668 explode_timer.Run(delay, this, "DoAmmoExplosion");
8669 }
8670
8672 {
8673 Magazine magazine = Magazine.Cast(this);
8674 int pop_sounds_count = 6;
8675 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8676
8677
8678 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8679 string sound_name = pop_sounds[ sound_idx ];
8680 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8681
8682
8683 magazine.ServerAddAmmoCount(-1);
8684
8685
8686 float min_temp_to_explode = 100;
8687
8688 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8689 {
8691 }
8692 }
8693
8694
8695 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8696 {
8697 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8698
8699 const int CHANCE_DAMAGE_CARGO = 4;
8700 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8701 const int CHANCE_DAMAGE_NOTHING = 2;
8702
8704 {
8705 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8706 int chances;
8707 int rnd;
8708
8709 if (GetInventory().GetCargo())
8710 {
8711 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8712 rnd = Math.RandomInt(0,chances);
8713
8714 if (rnd < CHANCE_DAMAGE_CARGO)
8715 {
8717 }
8718 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8719 {
8721 }
8722 }
8723 else
8724 {
8725 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8726 rnd = Math.RandomInt(0,chances);
8727
8728 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8729 {
8731 }
8732 }
8733 }
8734 }
8735
8737 {
8738 CargoBase cargo = GetInventory().GetCargo();
8739 if (cargo)
8740 {
8742 if (item_count > 0)
8743 {
8744 int random_pick = Math.RandomInt(0, item_count);
8746 if (!item.IsExplosive())
8747 {
8748 item.AddHealth("","",damage);
8749 return true;
8750 }
8751 }
8752 }
8753 return false;
8754 }
8755
8757 {
8758 GameInventory inventory = GetInventory();
8760 if (attachment_count > 0)
8761 {
8762 int random_pick = Math.RandomInt(0, attachment_count);
8764 if (!attachment.IsExplosive())
8765 {
8766 attachment.AddHealth("","",damage);
8767 return true;
8768 }
8769 }
8770 return false;
8771 }
8772
8774 {
8776 }
8777
8779 {
8781 return GetInventory().CanRemoveEntity();
8782
8783 return false;
8784 }
8785
8787 {
8788
8790 return false;
8791
8792
8794 return false;
8795
8796
8797
8799 if (delta == 0)
8800 return false;
8801
8802
8803 return true;
8804 }
8805
8807 {
8809 {
8810 if (ScriptInputUserData.CanStoreInputUserData())
8811 {
8812 ScriptInputUserData ctx = new ScriptInputUserData;
8817 ctx.
Write(destination_entity);
8821 }
8822 }
8823 else if (!
g_Game.IsMultiplayer())
8824 {
8826 }
8827 }
8828
8830 {
8831 float split_quantity_new;
8835 InventoryLocation loc = new InventoryLocation;
8836
8837 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8838 {
8840 split_quantity_new = stack_max;
8841 else
8843
8845 {
8846 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8847 if (new_item)
8848 {
8849 new_item.SetResultOfSplit(true);
8850 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8852 new_item.
SetQuantity(split_quantity_new,
false,
true);
8853 }
8854 }
8855 }
8856 else if (destination_entity && slot_id == -1)
8857 {
8858 if (quantity > stack_max)
8859 split_quantity_new = stack_max;
8860 else
8861 split_quantity_new = quantity;
8862
8864 {
8865 GameInventory destinationInventory = destination_entity.GetInventory();
8867 {
8870 }
8871
8872 if (new_item)
8873 {
8874 new_item.SetResultOfSplit(true);
8875 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8877 new_item.
SetQuantity(split_quantity_new,
false,
true);
8878 }
8879 }
8880 }
8881 else
8882 {
8883 if (stack_max != 0)
8884 {
8886 {
8888 }
8889
8890 if (split_quantity_new == 0)
8891 {
8892 if (!
g_Game.IsMultiplayer())
8893 player.PhysicalPredictiveDropItem(this);
8894 else
8895 player.ServerDropEntity(this);
8896 return;
8897 }
8898
8900 {
8902
8903 if (new_item)
8904 {
8905 new_item.SetResultOfSplit(true);
8906 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8909 new_item.PlaceOnSurface();
8910 }
8911 }
8912 }
8913 }
8914 }
8915
8917 {
8918 float split_quantity_new;
8922 InventoryLocation loc = new InventoryLocation;
8923
8924 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8925 {
8927 split_quantity_new = stack_max;
8928 else
8930
8932 {
8933 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8934 if (new_item)
8935 {
8936 new_item.SetResultOfSplit(true);
8937 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8939 new_item.
SetQuantity(split_quantity_new,
false,
true);
8940 }
8941 }
8942 }
8943 else if (destination_entity && slot_id == -1)
8944 {
8945 if (quantity > stack_max)
8946 split_quantity_new = stack_max;
8947 else
8948 split_quantity_new = quantity;
8949
8951 {
8952 GameInventory destinationInventory = destination_entity.GetInventory();
8954 {
8957 }
8958
8959 if (new_item)
8960 {
8961 new_item.SetResultOfSplit(true);
8962 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8964 new_item.
SetQuantity(split_quantity_new,
false,
true);
8965 }
8966 }
8967 }
8968 else
8969 {
8970 if (stack_max != 0)
8971 {
8973 {
8975 }
8976
8978 {
8980
8981 if (new_item)
8982 {
8983 new_item.SetResultOfSplit(true);
8984 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8987 new_item.PlaceOnSurface();
8988 }
8989 }
8990 }
8991 }
8992 }
8993
8995 {
8997 {
8998 if (ScriptInputUserData.CanStoreInputUserData())
8999 {
9000 ScriptInputUserData ctx = new ScriptInputUserData;
9005 dst.WriteToContext(ctx);
9007 }
9008 }
9009 else if (!
g_Game.IsMultiplayer())
9010 {
9012 }
9013 }
9014
9016 {
9018 {
9019 if (ScriptInputUserData.CanStoreInputUserData())
9020 {
9021 ScriptInputUserData ctx = new ScriptInputUserData;
9026 ctx.
Write(destination_entity);
9032 }
9033 }
9034 else if (!
g_Game.IsMultiplayer())
9035 {
9037 }
9038 }
9039
9041 {
9043 }
9044
9046 {
9048 float split_quantity_new;
9050 if (dst.IsValid())
9051 {
9052 int slot_id = dst.GetSlot();
9054
9055 if (quantity > stack_max)
9056 split_quantity_new = stack_max;
9057 else
9058 split_quantity_new = quantity;
9059
9061 {
9063
9064 if (new_item)
9065 {
9066 new_item.SetResultOfSplit(true);
9067 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9069 new_item.
SetQuantity(split_quantity_new,
false,
true);
9070 }
9071
9072 return new_item;
9073 }
9074 }
9075
9076 return null;
9077 }
9078
9080 {
9082 float split_quantity_new;
9084 if (destination_entity)
9085 {
9087 if (quantity > stackable)
9088 split_quantity_new = stackable;
9089 else
9090 split_quantity_new = quantity;
9091
9093 {
9094 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9095 if (new_item)
9096 {
9097 new_item.SetResultOfSplit(true);
9098 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9100 new_item.
SetQuantity(split_quantity_new,
false,
true);
9101 }
9102 }
9103 }
9104 }
9105
9107 {
9109 {
9110 if (ScriptInputUserData.CanStoreInputUserData())
9111 {
9112 ScriptInputUserData ctx = new ScriptInputUserData;
9117 ItemBase destination_entity =
this;
9118 ctx.
Write(destination_entity);
9122 }
9123 }
9124 else if (!
g_Game.IsMultiplayer())
9125 {
9127 }
9128 }
9129
9131 {
9133 float split_quantity_new;
9135 if (player)
9136 {
9138 if (quantity > stackable)
9139 split_quantity_new = stackable;
9140 else
9141 split_quantity_new = quantity;
9142
9144 {
9145 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9146 new_item =
ItemBase.Cast(in_hands);
9147 if (new_item)
9148 {
9149 new_item.SetResultOfSplit(true);
9150 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9152 new_item.SetQuantity(split_quantity_new, false, true);
9153 }
9154 }
9155 }
9156 }
9157
9159 {
9161 float split_quantity_new = Math.Floor(quantity * 0.5);
9162
9164 return;
9165
9167
9168 if (new_item)
9169 {
9170 if (new_item.GetQuantityMax() < split_quantity_new)
9171 {
9172 split_quantity_new = new_item.GetQuantityMax();
9173 }
9174
9175 new_item.SetResultOfSplit(true);
9176 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9177
9179 {
9182 }
9183 else
9184 {
9186 new_item.
SetQuantity(split_quantity_new,
false,
true);
9187 }
9188 }
9189 }
9190
9192 {
9194 float split_quantity_new = Math.Floor(quantity / 2);
9195
9197 return;
9198
9199 InventoryLocation invloc = new InventoryLocation;
9201
9203 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9204
9205 if (new_item)
9206 {
9207 if (new_item.GetQuantityMax() < split_quantity_new)
9208 {
9209 split_quantity_new = new_item.GetQuantityMax();
9210 }
9212 {
9215 }
9216 else if (split_quantity_new > 1)
9217 {
9219 new_item.
SetQuantity(split_quantity_new,
false,
true);
9220 }
9221 }
9222 }
9223
9226 {
9227 SetWeightDirty();
9229
9230 if (parent)
9231 parent.OnAttachmentQuantityChangedEx(this, delta);
9232
9234 {
9236 {
9238 }
9240 {
9241 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9243 }
9244 }
9245 }
9246
9249 {
9250
9251 }
9252
9255 {
9257 }
9258
9260 {
9261 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9262
9264 {
9265 if (newLevel == GameConstants.STATE_RUINED)
9266 {
9268 EntityAI parent = GetHierarchyParent();
9269 if (parent && parent.IsFireplace())
9270 {
9271 CargoBase cargo = GetInventory().GetCargo();
9272 if (cargo)
9273 {
9275 {
9277 }
9278 }
9279 }
9280 }
9281
9283 {
9284
9286 return;
9287 }
9288
9289 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9290 {
9292 }
9293 }
9294 }
9295
9296
9298 {
9299 super.OnRightClick();
9300
9302 {
9304 {
9305 if (ScriptInputUserData.CanStoreInputUserData())
9306 {
9307 EntityAI root = GetHierarchyRoot();
9308 Man playerOwner = GetHierarchyRootPlayer();
9309 InventoryLocation dst = new InventoryLocation;
9310
9311
9312 if (!playerOwner && root && root == this)
9313 {
9315 }
9316 else
9317 {
9318
9319 GetInventory().GetCurrentInventoryLocation(dst);
9321 {
9322 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9324 {
9326 }
9327 else
9328 {
9330
9331
9332 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9333 {
9335 }
9336 else
9337 {
9338 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9339 }
9340 }
9341 }
9342 }
9343
9344 ScriptInputUserData ctx = new ScriptInputUserData;
9352 }
9353 }
9354 else if (!
g_Game.IsMultiplayer())
9355 {
9357 }
9358 }
9359 }
9360
9362 {
9363 if (root)
9364 {
9365 vector m4[4];
9366 root.GetTransform(m4);
9367 dst.SetGround(this, m4);
9368 }
9369 else
9370 {
9371 GetInventory().GetCurrentInventoryLocation(dst);
9372 }
9373 }
9374
9375 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9376 {
9377
9378 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9379 return false;
9380
9381 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9382 return false;
9383
9384
9386 return false;
9387
9388
9389 Magazine mag = Magazine.Cast(this);
9390 if (mag)
9391 {
9392 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9393 return false;
9394
9395 if (stack_max_limit)
9396 {
9397 Magazine other_mag = Magazine.Cast(other_item);
9398 if (other_item)
9399 {
9400 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9401 return false;
9402 }
9403
9404 }
9405 }
9406 else
9407 {
9408
9410 return false;
9411
9413 return false;
9414 }
9415
9416 PlayerBase player = null;
9417 if (CastTo(player, GetHierarchyRootPlayer()))
9418 {
9419 if (player.GetInventory().HasAttachment(this))
9420 return false;
9421
9422 if (player.IsItemsToDelete())
9423 return false;
9424 }
9425
9426 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9427 return false;
9428
9429 int slotID;
9431 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9432 return false;
9433
9434 return true;
9435 }
9436
9438 {
9440 }
9441
9443 {
9444 return m_IsResultOfSplit;
9445 }
9446
9448 {
9449 m_IsResultOfSplit = value;
9450 }
9451
9453 {
9455 }
9456
9458 {
9459 float other_item_quantity = other_item.GetQuantity();
9460 float this_free_space;
9461
9463
9465
9466 if (other_item_quantity > this_free_space)
9467 {
9468 return this_free_space;
9469 }
9470 else
9471 {
9472 return other_item_quantity;
9473 }
9474 }
9475
9477 {
9479 }
9480
9482 {
9484 return;
9485
9486 if (!IsMagazine() && other_item)
9487 {
9489 if (quantity_used != 0)
9490 {
9491 float hp1 = GetHealth01("","");
9492 float hp2 = other_item.GetHealth01("","");
9493 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9494 hpResult = hpResult / (
GetQuantity() + quantity_used);
9495
9496 hpResult *= GetMaxHealth();
9497 Math.Round(hpResult);
9498 SetHealth("", "Health", hpResult);
9499
9501 other_item.AddQuantity(-quantity_used);
9502 }
9503 }
9505 }
9506
9508 {
9509 #ifdef SERVER
9510 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9511 GetHierarchyParent().IncreaseLifetimeUp();
9512 #endif
9513 };
9514
9516 {
9517 PlayerBase p = PlayerBase.Cast(player);
9518
9519 array<int> recipesIds = p.m_Recipes;
9520 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9521 if (moduleRecipesManager)
9522 {
9523 EntityAI itemInHands = player.GetEntityInHands();
9524 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9525 }
9526
9527 for (int i = 0;i < recipesIds.Count(); i++)
9528 {
9529 int key = recipesIds.Get(i);
9530 string recipeName = moduleRecipesManager.GetRecipeName(key);
9532 }
9533 }
9534
9535
9536 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9537 {
9538 super.GetDebugActions(outputList);
9539
9540
9546
9547
9552
9557
9558
9562
9563
9565 {
9569 }
9570
9573
9574
9578
9580
9581 InventoryLocation loc = new InventoryLocation();
9582 GetInventory().GetCurrentInventoryLocation(loc);
9584 {
9585 if (Gizmo_IsSupported())
9588 }
9589
9591 }
9592
9593
9594
9595
9597 {
9598 super.OnAction(action_id, player, ctx);
9599
9601 {
9602 switch (action_id)
9603 {
9607 return true;
9611 return true;
9612 }
9613 }
9614
9616 {
9617 switch (action_id)
9618 {
9620 Delete();
9621 return true;
9622 }
9623 }
9624
9625 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9626 {
9627 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9628 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9629 PlayerBase p = PlayerBase.Cast(player);
9630 if (
EActions.RECIPES_RANGE_START < 1000)
9631 {
9632 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9633 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9634 }
9635 }
9636 #ifndef SERVER
9637 else if (action_id ==
EActions.WATCH_PLAYER)
9638 {
9639 PluginDeveloper.SetDeveloperItemClientEx(player);
9640 }
9641 #endif
9643 {
9644 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9645 {
9646 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9647 OnDebugButtonPressServer(id + 1);
9648 }
9649
9650 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9651 {
9652 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9654 }
9655
9656 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9657 {
9658 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9660 }
9661
9662 else if (action_id ==
EActions.ADD_QUANTITY)
9663 {
9664 if (IsMagazine())
9665 {
9666 Magazine mag = Magazine.Cast(this);
9667 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9668 }
9669 else
9670 {
9672 }
9673
9674 if (m_EM)
9675 {
9676 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9677 }
9678
9679 }
9680
9681 else if (action_id ==
EActions.REMOVE_QUANTITY)
9682 {
9683 if (IsMagazine())
9684 {
9685 Magazine mag2 = Magazine.Cast(this);
9686 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9687 }
9688 else
9689 {
9691 }
9692 if (m_EM)
9693 {
9694 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9695 }
9696
9697 }
9698
9699 else if (action_id ==
EActions.SET_QUANTITY_0)
9700 {
9702
9703 if (m_EM)
9704 {
9705 m_EM.SetEnergy(0);
9706 }
9707 }
9708
9709 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9710 {
9712
9713 if (m_EM)
9714 {
9715 m_EM.SetEnergy(m_EM.GetEnergyMax());
9716 }
9717 }
9718
9719 else if (action_id ==
EActions.ADD_HEALTH)
9720 {
9721 AddHealth("","",GetMaxHealth("","Health")/5);
9722 }
9723 else if (action_id ==
EActions.REMOVE_HEALTH)
9724 {
9725 AddHealth("","",-GetMaxHealth("","Health")/5);
9726 }
9727 else if (action_id ==
EActions.DESTROY_HEALTH)
9728 {
9729 SetHealth01("","",0);
9730 }
9731 else if (action_id ==
EActions.WATCH_ITEM)
9732 {
9734 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9735 #ifdef DEVELOPER
9736 SetDebugDeveloper_item(this);
9737 #endif
9738 }
9739
9740 else if (action_id ==
EActions.ADD_TEMPERATURE)
9741 {
9742 AddTemperature(20);
9743
9744 }
9745
9746 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9747 {
9748 AddTemperature(-20);
9749
9750 }
9751
9752 else if (action_id ==
EActions.FLIP_FROZEN)
9753 {
9754 SetFrozen(!GetIsFrozen());
9755
9756 }
9757
9758 else if (action_id ==
EActions.ADD_WETNESS)
9759 {
9761
9762 }
9763
9764 else if (action_id ==
EActions.REMOVE_WETNESS)
9765 {
9767
9768 }
9769
9770 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9771 {
9774
9775
9776 }
9777
9778 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9779 {
9782 }
9783
9784 else if (action_id ==
EActions.MAKE_SPECIAL)
9785 {
9786 auto debugParams = DebugSpawnParams.WithPlayer(player);
9787 OnDebugSpawnEx(debugParams);
9788 }
9789
9790 }
9791
9792
9793 return false;
9794 }
9795
9796
9797
9798
9802
9805
9806
9807
9809 {
9810 return false;
9811 }
9812
9813
9815 {
9816 return true;
9817 }
9818
9819
9821 {
9822 return true;
9823 }
9824
9825
9826
9828 {
9829 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9830 return g_Game.ConfigIsExisting(config_path);
9831 }
9832
9835 {
9836 return null;
9837 }
9838
9840 {
9841 return false;
9842 }
9843
9845 {
9846 return false;
9847 }
9848
9852
9853
9855 {
9856 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9857 return module_repairing.CanRepair(this, item_repair_kit);
9858 }
9859
9860
9861 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9862 {
9863 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9864 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9865 }
9866
9867
9869 {
9870
9871
9872
9873
9874
9875
9876
9877
9878 return 1;
9879 }
9880
9881
9882
9884 {
9886 }
9887
9888
9889
9891 {
9893 }
9894
9895
9904 {
9905 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9906
9907 if (player)
9908 {
9909 player.MessageStatus(text);
9910 }
9911 }
9912
9913
9922 {
9923 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9924
9925 if (player)
9926 {
9927 player.MessageAction(text);
9928 }
9929 }
9930
9931
9940 {
9941 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9942
9943 if (player)
9944 {
9945 player.MessageFriendly(text);
9946 }
9947 }
9948
9949
9958 {
9959 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9960
9961 if (player)
9962 {
9963 player.MessageImportant(text);
9964 }
9965 }
9966
9968 {
9969 return true;
9970 }
9971
9972
9973 override bool KindOf(
string tag)
9974 {
9975 bool found = false;
9976 string item_name = this.
GetType();
9978 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9979
9980 int array_size = item_tag_array.Count();
9981 for (int i = 0; i < array_size; i++)
9982 {
9983 if (item_tag_array.Get(i) == tag)
9984 {
9985 found = true;
9986 break;
9987 }
9988 }
9989 return found;
9990 }
9991
9992
9994 {
9995
9996 super.OnRPC(sender, rpc_type,ctx);
9997
9998
9999 switch (rpc_type)
10000 {
10001 #ifndef SERVER
10002 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10003 Param2<bool, string> p = new Param2<bool, string>(false, "");
10004
10006 return;
10007
10008 bool play = p.param1;
10009 string soundSet = p.param2;
10010
10011 if (play)
10012 {
10014 {
10016 {
10018 }
10019 }
10020 else
10021 {
10023 }
10024 }
10025 else
10026 {
10028 }
10029
10030 break;
10031 #endif
10032
10033 }
10034
10036 {
10038 }
10039 }
10040
10041
10042
10043
10045 {
10046 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10047 return plugin.GetID(
name);
10048 }
10049
10051 {
10052 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10053 return plugin.GetName(id);
10054 }
10055
10058 {
10059
10060
10061 int varFlags;
10062 if (!ctx.
Read(varFlags))
10063 return;
10064
10065 if (varFlags & ItemVariableFlags.FLOAT)
10066 {
10068 }
10069 }
10070
10072 {
10073
10074 super.SerializeNumericalVars(floats_out);
10075
10076
10077
10079 {
10081 }
10082
10084 {
10086 }
10087
10089 {
10091 }
10092
10094 {
10099 }
10100
10102 {
10104 }
10105 }
10106
10108 {
10109
10110 super.DeSerializeNumericalVars(floats);
10111
10112
10113 int index = 0;
10114 int mask = Math.Round(floats.Get(index));
10115
10116 index++;
10117
10119 {
10121 {
10123 }
10124 else
10125 {
10126 float quantity = floats.Get(index);
10127 SetQuantity(quantity,
true,
false,
false,
false);
10128 }
10129 index++;
10130 }
10131
10133 {
10134 float wet = floats.Get(index);
10136 index++;
10137 }
10138
10140 {
10141 int liquidtype = Math.Round(floats.Get(index));
10143 index++;
10144 }
10145
10147 {
10149 index++;
10151 index++;
10153 index++;
10155 index++;
10156 }
10157
10159 {
10160 int cleanness = Math.Round(floats.Get(index));
10162 index++;
10163 }
10164 }
10165
10167 {
10168 super.WriteVarsToCTX(ctx);
10169
10170
10172 {
10174 }
10175
10177 {
10179 }
10180
10182 {
10184 }
10185
10187 {
10188 int r,g,b,a;
10194 }
10195
10197 {
10199 }
10200 }
10201
10203 {
10204 if (!super.ReadVarsFromCTX(ctx,version))
10205 return false;
10206
10207 int intValue;
10208 float value;
10209
10210 if (version < 140)
10211 {
10212 if (!ctx.
Read(intValue))
10213 return false;
10214
10215 m_VariablesMask = intValue;
10216 }
10217
10219 {
10220 if (!ctx.
Read(value))
10221 return false;
10222
10224 {
10226 }
10227 else
10228 {
10230 }
10231 }
10232
10233 if (version < 140)
10234 {
10236 {
10237 if (!ctx.
Read(value))
10238 return false;
10239 SetTemperatureDirect(value);
10240 }
10241 }
10242
10244 {
10245 if (!ctx.
Read(value))
10246 return false;
10248 }
10249
10251 {
10252 if (!ctx.
Read(intValue))
10253 return false;
10255 }
10256
10258 {
10259 int r,g,b,a;
10261 return false;
10263 return false;
10265 return false;
10267 return false;
10268
10270 }
10271
10273 {
10274 if (!ctx.
Read(intValue))
10275 return false;
10277 }
10278
10279 if (version >= 138 && version < 140)
10280 {
10282 {
10283 if (!ctx.
Read(intValue))
10284 return false;
10285 SetFrozen(intValue);
10286 }
10287 }
10288
10289 return true;
10290 }
10291
10292
10294 {
10297 {
10299 }
10300
10301 if (!super.OnStoreLoad(ctx, version))
10302 {
10304 return false;
10305 }
10306
10307 if (version >= 114)
10308 {
10309 bool hasQuickBarIndexSaved;
10310
10311 if (!ctx.
Read(hasQuickBarIndexSaved))
10312 {
10314 return false;
10315 }
10316
10317 if (hasQuickBarIndexSaved)
10318 {
10319 int itmQBIndex;
10320
10321
10322 if (!ctx.
Read(itmQBIndex))
10323 {
10325 return false;
10326 }
10327
10328 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10329 if (itmQBIndex != -1 && parentPlayer)
10330 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10331 }
10332 }
10333 else
10334 {
10335
10336 PlayerBase player;
10337 int itemQBIndex;
10338 if (version ==
int.
MAX)
10339 {
10340 if (!ctx.
Read(itemQBIndex))
10341 {
10343 return false;
10344 }
10345 }
10346 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10347 {
10348
10349 if (!ctx.
Read(itemQBIndex))
10350 {
10352 return false;
10353 }
10354 if (itemQBIndex != -1 && player)
10355 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10356 }
10357 }
10358
10359 if (version < 140)
10360 {
10361
10362 if (!LoadVariables(ctx, version))
10363 {
10365 return false;
10366 }
10367 }
10368
10369
10371 {
10373 return false;
10374 }
10375 if (version >= 132)
10376 {
10378 if (raib)
10379 {
10381 {
10383 return false;
10384 }
10385 }
10386 }
10387
10389 return true;
10390 }
10391
10392
10393
10395 {
10396 super.OnStoreSave(ctx);
10397
10398 PlayerBase player;
10399 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10400 {
10402
10403 int itemQBIndex = -1;
10404 itemQBIndex = player.FindQuickBarEntityIndex(this);
10405 ctx.
Write(itemQBIndex);
10406 }
10407 else
10408 {
10410 }
10411
10413
10415 if (raib)
10416 {
10418 }
10419 }
10420
10421
10423 {
10424 super.AfterStoreLoad();
10425
10427 {
10429 }
10430
10432 {
10435 }
10436 }
10437
10439 {
10440 super.EEOnAfterLoad();
10441
10443 {
10445 }
10446
10449 }
10450
10452 {
10453 return false;
10454 }
10455
10456
10457
10459 {
10461 {
10462 #ifdef PLATFORM_CONSOLE
10463
10465 {
10467 if (menu)
10468 {
10470 }
10471 }
10472 #endif
10473 }
10474
10476 {
10479 }
10480
10482 {
10483 SetWeightDirty();
10485 }
10487 {
10490 }
10491
10493 {
10496
10499 }
10501 {
10505 }
10506
10507 super.OnVariablesSynchronized();
10508 }
10509
10510
10511
10513 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10514 {
10515 if (!IsServerCheck(allow_client))
10516 return false;
10517
10519 return false;
10520
10523
10524 if (value <= (min + 0.001))
10525 value = min;
10526
10527 if (value == min)
10528 {
10529 if (destroy_config)
10530 {
10531 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10532 if (dstr)
10533 {
10535 this.Delete();
10536 return true;
10537 }
10538 }
10539 else if (destroy_forced)
10540 {
10542 this.Delete();
10543 return true;
10544 }
10545
10547 }
10548
10551
10553 {
10554 EntityAI parent = GetHierarchyRoot();
10555 InventoryLocation iLoc = new InventoryLocation();
10556 GetInventory().GetCurrentInventoryLocation(iLoc);
10558 {
10559 int iLocSlot = iLoc.
GetSlot();
10561 {
10563 }
10565 {
10567 }
10568 }
10569 }
10570
10572 {
10574
10575 if (delta)
10577 }
10578
10580
10581 return false;
10582 }
10583
10584
10586 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10587 {
10589 }
10590
10592 {
10595 }
10596
10598 {
10601 }
10602
10604 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10605 {
10606 float value_clamped = Math.Clamp(value, 0, 1);
10608 SetQuantity(result, destroy_config, destroy_forced);
10609 }
10610
10611
10614 {
10616 }
10617
10619 {
10621 }
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10633 {
10634 int slot = -1;
10635 GameInventory inventory = GetInventory();
10636 if (inventory)
10637 {
10638 InventoryLocation il = new InventoryLocation;
10641 }
10642
10644 }
10645
10647 {
10648 float quantity_max = 0;
10649
10651 {
10652 if (attSlotID != -1)
10653 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10654
10655 if (quantity_max <= 0)
10657 }
10658
10659 if (quantity_max <= 0)
10661
10662 return quantity_max;
10663 }
10664
10666 {
10668 }
10669
10671 {
10673 }
10674
10675
10677 {
10679 }
10680
10682 {
10684 }
10685
10687 {
10689 }
10690
10691
10693 {
10694
10695 float weightEx = GetWeightEx();
10696 float special = GetInventoryAndCargoWeight();
10697 return weightEx - special;
10698 }
10699
10700
10702 {
10704 }
10705
10707 {
10709 {
10710 #ifdef DEVELOPER
10711 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10712 {
10713 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10715 }
10716 #endif
10717
10718 return GetQuantity() * GetConfigWeightModified();
10719 }
10720 else if (HasEnergyManager())
10721 {
10722 #ifdef DEVELOPER
10723 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10724 {
10725 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10726 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10727 }
10728 #endif
10729 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10730 }
10731 else
10732 {
10733 #ifdef DEVELOPER
10734 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10735 {
10736 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10737 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10738 }
10739 #endif
10740 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10741 }
10742 }
10743
10746 {
10747 int item_count = 0;
10749
10750 GameInventory inventory = GetInventory();
10751 CargoBase cargo = inventory.
GetCargo();
10752 if (cargo != NULL)
10753 {
10755 }
10756
10758 for (int i = 0; i < nAttachments; ++i)
10759 {
10761 if (item)
10762 item_count += item.GetNumberOfItems();
10763 }
10764 return item_count;
10765 }
10766
10769 {
10770 float weight = 0;
10771 float wetness = 1;
10772 if (include_wetness)
10775 {
10776 weight = wetness * m_ConfigWeight;
10777 }
10779 {
10780 weight = 1;
10781 }
10782 return weight;
10783 }
10784
10785
10786
10788 {
10789 GameInventory inventory = GetInventory();
10790 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10791 {
10792 array<EntityAI> items = new array<EntityAI>;
10794 for (int i = 0; i < items.Count(); ++i)
10795 {
10797 if (item)
10798 {
10799 g_Game.ObjectDelete(item);
10800 }
10801 }
10802 }
10803 }
10804
10805
10806
10807
10809 {
10810 float energy = 0;
10811 if (HasEnergyManager())
10812 {
10813 energy = GetCompEM().GetEnergy();
10814 }
10815 return energy;
10816 }
10817
10818
10820 {
10821 super.OnEnergyConsumed();
10822
10824 }
10825
10827 {
10828 super.OnEnergyAdded();
10829
10831 }
10832
10833
10835 {
10836 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10837 {
10839 {
10840 float energy_0to1 = GetCompEM().GetEnergy0To1();
10842 }
10843 }
10844 }
10845
10846
10848 {
10849 return ConfigGetFloat("heatIsolation");
10850 }
10851
10853 {
10855 }
10856
10858 {
10859 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10860 if (
g_Game.ConfigIsExisting(paramPath))
10861 return g_Game.ConfigGetFloat(paramPath);
10862
10863 return 0.0;
10864 }
10865
10867 {
10868 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10869 if (
g_Game.ConfigIsExisting(paramPath))
10870 return g_Game.ConfigGetFloat(paramPath);
10871
10872 return 0.0;
10873 }
10874
10875 override void SetWet(
float value,
bool allow_client =
false)
10876 {
10877 if (!IsServerCheck(allow_client))
10878 return;
10879
10882
10884
10885 m_VarWet = Math.Clamp(value, min, max);
10886
10888 {
10891 }
10892 }
10893
10894 override void AddWet(
float value)
10895 {
10897 }
10898
10900 {
10902 }
10903
10905 {
10907 }
10908
10910 {
10912 }
10913
10915 {
10917 }
10918
10920 {
10922 }
10923
10924 override void OnWetChanged(
float newVal,
float oldVal)
10925 {
10928 if (newLevel != oldLevel)
10929 {
10931 }
10932 }
10933
10935 {
10936 SetWeightDirty();
10937 }
10938
10940 {
10941 return GetWetLevelInternal(
m_VarWet);
10942 }
10943
10944
10945
10947 {
10949 }
10950
10952 {
10954 }
10955
10957 {
10959 }
10960
10962 {
10964 }
10965
10966
10967
10969 {
10970 if (ConfigIsExisting("itemModelLength"))
10971 {
10972 return ConfigGetFloat("itemModelLength");
10973 }
10974 return 0;
10975 }
10976
10978 {
10979 if (ConfigIsExisting("itemAttachOffset"))
10980 {
10981 return ConfigGetFloat("itemAttachOffset");
10982 }
10983 return 0;
10984 }
10985
10986 override void SetCleanness(
int value,
bool allow_client =
false)
10987 {
10988 if (!IsServerCheck(allow_client))
10989 return;
10990
10992
10994
10997 }
10998
11000 {
11002 }
11003
11005 {
11006 return true;
11007 }
11008
11009
11010
11011
11013 {
11015 }
11016
11018 {
11020 }
11021
11022
11023
11024
11025 override void SetColor(
int r,
int g,
int b,
int a)
11026 {
11032 }
11034 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11035 {
11040 }
11041
11043 {
11045 }
11046
11049 {
11050 int r,g,b,a;
11052 r = r/255;
11053 g = g/255;
11054 b = b/255;
11055 a = a/255;
11056 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11057 }
11058
11059
11060
11061 override void SetLiquidType(
int value,
bool allow_client =
false)
11062 {
11063 if (!IsServerCheck(allow_client))
11064 return;
11065
11070 }
11071
11073 {
11074 return ConfigGetInt("varLiquidTypeInit");
11075 }
11076
11078 {
11080 }
11081
11083 {
11085 SetFrozen(false);
11086 }
11087
11090 {
11091 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11092 }
11093
11094
11097 {
11098 PlayerBase nplayer;
11099 if (PlayerBase.CastTo(nplayer, player))
11100 {
11102 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11103 }
11104 }
11105
11106
11109 {
11110 PlayerBase nplayer;
11111 if (PlayerBase.CastTo(nplayer,player))
11112 {
11113 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11114 }
11115
11116 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11117
11118 if (HasEnergyManager())
11119 {
11120 GetCompEM().UpdatePlugState();
11121 }
11122 }
11123
11124
11126 {
11127 super.OnPlacementStarted(player);
11128
11130 }
11131
11132 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11133 {
11135 {
11136 m_AdminLog.OnPlacementComplete(player,
this);
11137 }
11138
11139 super.OnPlacementComplete(player, position, orientation);
11140 }
11141
11142
11143
11144
11145
11147 {
11149 {
11150 return true;
11151 }
11152 else
11153 {
11154 return false;
11155 }
11156 }
11157
11158
11160 {
11162 {
11164 }
11165 }
11166
11167
11169 {
11171 }
11172
11174 {
11176 }
11177
11178 override void InsertAgent(
int agent,
float count = 1)
11179 {
11180 if (count < 1)
11181 return;
11182
11184 }
11185
11188 {
11190 }
11191
11192
11194 {
11196 }
11197
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11229
11230
11231
11232
11233
11234
11235
11236
11237
11238
11240 {
11242 return false;
11243 return true;
11244 }
11245
11247 {
11248
11250 }
11251
11252
11255 {
11256 super.CheckForRoofLimited(timeTresholdMS);
11257
11258 float time =
g_Game.GetTime();
11259 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11260 {
11261 m_PreviousRoofTestTime = time;
11262 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11263 }
11264 }
11265
11266
11268 {
11270 {
11271 return 0;
11272 }
11273
11274 if (GetInventory().GetAttachmentSlotsCount() != 0)
11275 {
11276 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11277 if (filter)
11278 return filter.GetProtectionLevel(type, false, system);
11279 else
11280 return 0;
11281 }
11282
11283 string subclassPath, entryName;
11284
11285 switch (type)
11286 {
11288 entryName = "biological";
11289 break;
11291 entryName = "chemical";
11292 break;
11293 default:
11294 entryName = "biological";
11295 break;
11296 }
11297
11298 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11299
11300 return g_Game.ConfigGetFloat(subclassPath + entryName);
11301 }
11302
11303
11304
11307 {
11308 if (!IsMagazine())
11310
11312 }
11313
11314
11315
11316
11317
11322 {
11323 return true;
11324 }
11325
11327 {
11329 }
11330
11331
11332
11333
11334
11336 {
11337 if (parent)
11338 {
11339 if (parent.IsInherited(DayZInfected))
11340 return true;
11341
11342 if (!parent.IsRuined())
11343 return true;
11344 }
11345
11346 return true;
11347 }
11348
11350 {
11351 if (!super.CanPutAsAttachment(parent))
11352 {
11353 return false;
11354 }
11355
11356 if (!IsRuined() && !parent.IsRuined())
11357 {
11358 return true;
11359 }
11360
11361 return false;
11362 }
11363
11365 {
11366
11367
11368
11369
11370 return super.CanReceiveItemIntoCargo(item);
11371 }
11372
11374 {
11375
11376
11377
11378
11379 GameInventory attachmentInv = attachment.GetInventory();
11381 {
11382 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11383 return false;
11384 }
11385
11386 InventoryLocation loc = new InventoryLocation();
11387 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11388 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11389 return false;
11390
11391 return super.CanReceiveAttachment(attachment, slotId);
11392 }
11393
11395 {
11396 if (!super.CanReleaseAttachment(attachment))
11397 return false;
11398
11399 return GetInventory().AreChildrenAccessible();
11400 }
11401
11402
11403
11404
11405
11406
11407
11408
11409
11410
11411
11412
11413
11414
11415
11416
11417
11418
11419
11420
11421
11423 {
11424 int id = muzzle_owner.GetMuzzleID();
11425 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11426
11427 if (WPOF_array)
11428 {
11429 for (int i = 0; i < WPOF_array.Count(); i++)
11430 {
11431 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11432
11433 if (WPOF)
11434 {
11435 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11436 }
11437 }
11438 }
11439 }
11440
11441
11443 {
11444 int id = muzzle_owner.GetMuzzleID();
11446
11447 if (WPOBE_array)
11448 {
11449 for (int i = 0; i < WPOBE_array.Count(); i++)
11450 {
11451 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11452
11453 if (WPOBE)
11454 {
11455 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11456 }
11457 }
11458 }
11459 }
11460
11461
11463 {
11464 int id = muzzle_owner.GetMuzzleID();
11465 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11466
11467 if (WPOOH_array)
11468 {
11469 for (int i = 0; i < WPOOH_array.Count(); i++)
11470 {
11471 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11472
11473 if (WPOOH)
11474 {
11475 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11476 }
11477 }
11478 }
11479 }
11480
11481
11483 {
11484 int id = muzzle_owner.GetMuzzleID();
11485 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11486
11487 if (WPOOH_array)
11488 {
11489 for (int i = 0; i < WPOOH_array.Count(); i++)
11490 {
11491 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11492
11493 if (WPOOH)
11494 {
11495 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11496 }
11497 }
11498 }
11499 }
11500
11501
11503 {
11504 int id = muzzle_owner.GetMuzzleID();
11505 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11506
11507 if (WPOOH_array)
11508 {
11509 for (int i = 0; i < WPOOH_array.Count(); i++)
11510 {
11511 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11512
11513 if (WPOOH)
11514 {
11515 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11516 }
11517 }
11518 }
11519 }
11520
11521
11522
11524 {
11526 {
11527 return true;
11528 }
11529
11530 return false;
11531 }
11532
11534 {
11536 {
11537 return true;
11538 }
11539
11540 return false;
11541 }
11542
11544 {
11546 {
11547 return true;
11548 }
11549
11550 return false;
11551 }
11552
11554 {
11555 return false;
11556 }
11557
11560 {
11561 return UATimeSpent.DEFAULT_DEPLOY;
11562 }
11563
11564
11565
11566
11568 {
11570 SetSynchDirty();
11571 }
11572
11574 {
11576 }
11577
11578
11580 {
11581 return false;
11582 }
11583
11586 {
11587 string att_type = "None";
11588
11589 if (ConfigIsExisting("soundAttType"))
11590 {
11591 att_type = ConfigGetString("soundAttType");
11592 }
11593
11595 }
11596
11598 {
11600 }
11601
11602
11603
11604
11605
11611
11613 {
11616
11618 }
11619
11620
11622 {
11624 return;
11625
11627
11630
11633
11634 SoundParameters params = new SoundParameters();
11638 }
11639
11640
11642 {
11644 {
11647
11648 SetSynchDirty();
11649
11652 }
11653 }
11654
11656 {
11658 }
11659
11660
11662 {
11664 return;
11665
11667 SetSynchDirty();
11668
11671 }
11672
11674 {
11677 }
11678
11680 {
11682 }
11683
11684 void OnApply(PlayerBase player);
11685
11687 {
11688 return 1.0;
11689 };
11690
11692 {
11694 }
11695
11697 {
11699 }
11700
11702
11704 {
11705 SetDynamicPhysicsLifeTime(0.01);
11707 }
11708
11710 {
11711 array<string> zone_names = new array<string>;
11712 GetDamageZones(zone_names);
11713 for (int i = 0; i < zone_names.Count(); i++)
11714 {
11715 SetHealthMax(zone_names.Get(i),"Health");
11716 }
11717 SetHealthMax("","Health");
11718 }
11719
11722 {
11723 float global_health = GetHealth01("","Health");
11724 array<string> zones = new array<string>;
11725 GetDamageZones(zones);
11726
11727 for (int i = 0; i < zones.Count(); i++)
11728 {
11729 SetHealth01(zones.Get(i),"Health",global_health);
11730 }
11731 }
11732
11735 {
11736 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11737 }
11738
11740 {
11741 if (!hasRootAsPlayer)
11742 {
11743 if (refParentIB)
11744 {
11745
11746 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11747 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11748
11749 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11750 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11751
11754 }
11755 else
11756 {
11757
11760 }
11761 }
11762 }
11763
11765 {
11767 {
11768 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11769 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11770 {
11771 float heatPermCoef = 1.0;
11773 while (ent)
11774 {
11775 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11776 ent = ent.GetHierarchyParent();
11777 }
11778
11779 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11780 }
11781 }
11782 }
11783
11785 {
11786
11787 EntityAI parent = GetHierarchyParent();
11788 if (!parent)
11789 {
11790 hasParent = false;
11791 hasRootAsPlayer = false;
11792 }
11793 else
11794 {
11795 hasParent = true;
11796 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11797 refParentIB =
ItemBase.Cast(parent);
11798 }
11799 }
11800
11801 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11802 {
11803
11804 }
11805
11807 {
11808
11809 return false;
11810 }
11811
11813 {
11814
11815
11816 return false;
11817 }
11818
11820 {
11821
11822 return false;
11823 }
11824
11827 {
11828 return !GetIsFrozen() &&
IsOpen();
11829 }
11830
11832 {
11833 bool hasParent = false, hasRootAsPlayer = false;
11835
11836 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11837 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11838
11839 if (wwtu || foodDecay)
11840 {
11844
11845 if (processWetness || processTemperature || processDecay)
11846 {
11848
11849 if (processWetness)
11850 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11851
11852 if (processTemperature)
11854
11855 if (processDecay)
11856 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11857 }
11858 }
11859 }
11860
11863 {
11865 }
11866
11868 {
11871
11872 return super.GetTemperatureFreezeThreshold();
11873 }
11874
11876 {
11879
11880 return super.GetTemperatureThawThreshold();
11881 }
11882
11884 {
11887
11888 return super.GetItemOverheatThreshold();
11889 }
11890
11892 {
11894 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11895
11896 return super.GetTemperatureFreezeTime();
11897 }
11898
11900 {
11902 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11903
11904 return super.GetTemperatureThawTime();
11905 }
11906
11911
11913 {
11914 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11915 }
11916
11918 {
11919 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11920 }
11921
11924 {
11926 }
11927
11929 {
11931 }
11932
11934 {
11936 }
11937
11940 {
11941 return null;
11942 }
11943
11946 {
11947 return false;
11948 }
11949
11951 {
11953 {
11956 if (!trg)
11957 {
11959 explosive = this;
11960 }
11961
11962 explosive.PairRemote(trg);
11964
11965 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11966 trg.SetPersistentPairID(persistentID);
11967 explosive.SetPersistentPairID(persistentID);
11968
11969 return true;
11970 }
11971 return false;
11972 }
11973
11976 {
11977 float ret = 1.0;
11980 ret *= GetHealth01();
11981
11982 return ret;
11983 }
11984
11985 #ifdef DEVELOPER
11986 override void SetDebugItem()
11987 {
11988 super.SetDebugItem();
11989 _itemBase = this;
11990 }
11991
11993 {
11994 string text = super.GetDebugText();
11995
11997 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11998
11999 return text;
12000 }
12001 #endif
12002
12004 {
12005 return true;
12006 }
12007
12009
12011
12013 {
12016 }
12017
12018
12026
12042
12043 [
Obsolete(
"Use ItemSoundHandler instead")]
12046 {
12047 if (!
g_Game.IsDedicatedServer())
12048 {
12049 if (ConfigIsExisting("attachSoundSet"))
12050 {
12051 string cfg_path = "";
12052 string soundset = "";
12053 string type_name =
GetType();
12054
12057 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12058 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12059
12060 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12061 {
12062 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12063 {
12064 if (cfg_slot_array[i] == slot_type)
12065 {
12066 soundset = cfg_soundset_array[i];
12067 break;
12068 }
12069 }
12070 }
12071
12072 if (soundset != "")
12073 {
12074 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12076 }
12077 }
12078 }
12079 }
12080
12082}
12083
12085{
12087 if (entity)
12088 {
12089 bool is_item = entity.IsInherited(
ItemBase);
12090 if (is_item && full_quantity)
12091 {
12094 }
12095 }
12096 else
12097 {
12099 return NULL;
12100 }
12101 return entity;
12102}
12103
12105{
12106 if (item)
12107 {
12108 if (health > 0)
12109 item.SetHealth("", "", health);
12110
12111 if (item.CanHaveTemperature())
12112 {
12114 if (item.CanFreeze())
12115 item.SetFrozen(false);
12116 }
12117
12118 if (item.HasEnergyManager())
12119 {
12120 if (quantity >= 0)
12121 {
12122 item.GetCompEM().SetEnergy0To1(quantity);
12123 }
12124 else
12125 {
12127 }
12128 }
12129 else if (item.IsMagazine())
12130 {
12131 Magazine mag = Magazine.Cast(item);
12132 if (quantity >= 0)
12133 {
12134 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12135 }
12136 else
12137 {
12139 }
12140
12141 }
12142 else
12143 {
12144 if (quantity >= 0)
12145 {
12146 item.SetQuantityNormalized(quantity, false);
12147 }
12148 else
12149 {
12151 }
12152
12153 }
12154 }
12155}
12156
12157#ifdef DEVELOPER
12159#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.