7561{
7563 {
7564 return true;
7565 }
7566};
7567
7569{
7570
7571};
7572
7573
7574
7576{
7580
7582
7585
7586
7587
7588
7589
7598
7604
7609
7614
7635 protected bool m_IsResultOfSplit
7636
7638
7643
7644
7645
7647
7651
7652
7653
7655
7658
7659
7660
7666
7667
7675
7678
7679
7681
7682
7684
7685
7690
7691
7696
7698
7699
7701
7702
7704 {
7709
7710 if (!
g_Game.IsDedicatedServer())
7711 {
7713 {
7715
7717 {
7719 }
7720 }
7721
7724 }
7725
7726 m_OldLocation = null;
7727
7729 {
7731 }
7732
7733 if (ConfigIsExisting("headSelectionsToHide"))
7734 {
7737 }
7738
7740 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7741 {
7743 }
7744
7746
7747 m_IsResultOfSplit = false;
7748
7750 }
7751
7753 {
7754 super.InitItemVariables();
7755
7761 m_Count = ConfigGetInt(
"count");
7762
7765
7770
7773
7778
7790
7794
7795
7798 if (ConfigIsExisting("canBeSplit"))
7799 {
7802 }
7803
7805 if (ConfigIsExisting("itemBehaviour"))
7807
7808
7811 RegisterNetSyncVariableInt("m_VarLiquidType");
7812 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7813
7814 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7815 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7816 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7817
7818 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7819 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7820 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7821 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7822
7823 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7824 RegisterNetSyncVariableBool("m_IsTakeable");
7825 RegisterNetSyncVariableBool("m_IsHologram");
7826
7829 {
7832 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7833 }
7834
7836
7838 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7840
7842 }
7843
7845 {
7847 }
7848
7850 {
7853 {
7858 }
7859 }
7860
7861 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7862 {
7864 {
7867 }
7868
7870 }
7871
7873 {
7879 }
7880
7882
7884 {
7886
7887 if (!action)
7888 {
7889 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7890 return;
7891 }
7892
7894 if (!ai)
7895 {
7897 return;
7898 }
7899
7901 if (!action_array)
7902 {
7903 action_array = new array<ActionBase_Basic>;
7905 }
7906 if (LogManager.IsActionLogEnable())
7907 {
7908 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7909 }
7910
7911 if (action_array.Find(action) != -1)
7912 {
7913 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7914 }
7915 else
7916 {
7917 action_array.Insert(action);
7918 }
7919 }
7920
7922 {
7923 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7924 ActionBase action = player.GetActionManager().GetAction(actionName);
7927
7928 if (action_array)
7929 {
7930 action_array.RemoveItem(action);
7931 }
7932 }
7933
7934
7935
7937 {
7938 ActionOverrideData overrideData = new ActionOverrideData();
7942
7944 if (!actionMap)
7945 {
7948 }
7949
7950 actionMap.Insert(this.
Type(), overrideData);
7951
7952 }
7953
7955
7957
7958
7960 {
7963
7966
7967 string config_to_search = "CfgVehicles";
7968 string muzzle_owner_config;
7969
7971 {
7972 if (IsInherited(Weapon))
7973 config_to_search = "CfgWeapons";
7974
7975 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7976
7977 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7978
7979 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7980
7981 if (config_OnFire_subclass_count > 0)
7982 {
7983 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7984
7985 for (int i = 0; i < config_OnFire_subclass_count; i++)
7986 {
7987 string particle_class = "";
7988 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7989 string config_OnFire_entry = config_OnFire_class + particle_class;
7990 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7991 WPOF_array.Insert(WPOF);
7992 }
7993
7994
7996 }
7997 }
7998
8000 {
8001 config_to_search = "CfgWeapons";
8002 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8003
8004 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8005
8006 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8007
8008 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8009 {
8010 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8011
8012 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8013 {
8014 string particle_class2 = "";
8015 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8016 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8017 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8018 WPOBE_array.Insert(WPOBE);
8019 }
8020
8021
8023 }
8024 }
8025 }
8026
8027
8029 {
8032
8034 {
8035 string config_to_search = "CfgVehicles";
8036
8037 if (IsInherited(Weapon))
8038 config_to_search = "CfgWeapons";
8039
8040 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8041 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8042
8043 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8044 {
8045
8047
8049 {
8051 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8053 return;
8054 }
8055
8058
8059
8060
8061 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8062 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8063
8064 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8065 {
8066 string particle_class = "";
8067 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8068 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8069 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8070
8071 if (entry_type == CT_CLASS)
8072 {
8073 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8074 WPOOH_array.Insert(WPOF);
8075 }
8076 }
8077
8078
8080 }
8081 }
8082 }
8083
8085 {
8087 }
8088
8090 {
8092 {
8094
8097
8100
8101 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8102 }
8103 }
8104
8106 {
8108 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8109
8111 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8112
8114 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8115
8117 {
8119 }
8120 }
8121
8123 {
8125 }
8126
8128 {
8131 else
8133
8135 {
8138 }
8139 else
8140 {
8143
8146 }
8147
8149 }
8150
8152 {
8154 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8155 }
8156
8158 {
8160 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8162 }
8163
8165 {
8167 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8168 }
8169
8171 {
8174
8175 OverheatingParticle OP = new OverheatingParticle();
8180
8182 }
8183
8185 {
8188
8189 return -1;
8190 }
8191
8193 {
8195 {
8198
8199 for (int i = count; i > 0; --i)
8200 {
8201 int id = i - 1;
8204
8207
8208 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8209 {
8210 if (p)
8211 {
8214 }
8215 }
8216 }
8217 }
8218 }
8219
8221 {
8223 {
8225 {
8226 int id = i - 1;
8228
8229 if (OP)
8230 {
8232
8233 if (p)
8234 {
8236 }
8237
8238 delete OP;
8239 }
8240 }
8241
8244 }
8245 }
8246
8249 {
8250 return 0.0;
8251 }
8252
8253
8255 {
8256 return 250;
8257 }
8258
8260 {
8261 return 0;
8262 }
8263
8266 {
8268 return true;
8269
8270 return false;
8271 }
8272
8275 {
8278
8280 {
8282 }
8283 else
8284 {
8285
8287 }
8288
8290 }
8291
8298 {
8299 return -1;
8300 }
8301
8302
8303
8304
8306 {
8308 {
8309 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8310 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8311
8312 if (r_index >= 0)
8313 {
8314 InventoryLocation r_il = new InventoryLocation;
8315 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8316
8317 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8320 {
8321 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8322 }
8324 {
8325 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8326 }
8327
8328 }
8329
8330 player.GetHumanInventory().ClearUserReservedLocation(this);
8331 }
8332
8335 }
8336
8337
8338
8339
8341 {
8342 return ItemBase.m_DebugActionsMask;
8343 }
8344
8346 {
8347 return ItemBase.m_DebugActionsMask & mask;
8348 }
8349
8351 {
8352 ItemBase.m_DebugActionsMask = mask;
8353 }
8354
8356 {
8357 ItemBase.m_DebugActionsMask |= mask;
8358 }
8359
8361 {
8362 ItemBase.m_DebugActionsMask &= ~mask;
8363 }
8364
8366 {
8368 {
8370 }
8371 else
8372 {
8374 }
8375 }
8376
8377
8379 {
8380 if (GetEconomyProfile())
8381 {
8382 float q_max = GetEconomyProfile().GetQuantityMax();
8383 if (q_max > 0)
8384 {
8385 float q_min = GetEconomyProfile().GetQuantityMin();
8386 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8387
8389 {
8390 ComponentEnergyManager comp = GetCompEM();
8392 {
8394 }
8395 }
8397 {
8399
8400 }
8401
8402 }
8403 }
8404 }
8405
8408 {
8409 EntityAI parent = GetHierarchyParent();
8410
8411 if (parent)
8412 {
8413 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8414 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8415 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8416 }
8417 }
8418
8421 {
8422 EntityAI parent = GetHierarchyParent();
8423
8424 if (parent)
8425 {
8426 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8427 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8428 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8429 }
8430 }
8431
8433 {
8434
8435
8436
8437
8439
8441 {
8442 if (ScriptInputUserData.CanStoreInputUserData())
8443 {
8444 ScriptInputUserData ctx = new ScriptInputUserData;
8450 ctx.
Write(use_stack_max);
8453
8455 {
8456 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8457 }
8458 }
8459 }
8460 else if (!
g_Game.IsMultiplayer())
8461 {
8463 }
8464 }
8465
8467 {
8469 }
8470
8472 {
8474 }
8475
8477 {
8479 }
8480
8482 {
8483
8484 return false;
8485 }
8486
8488 {
8489 return false;
8490 }
8491
8495 {
8496 return false;
8497 }
8498
8500 {
8501 return "";
8502 }
8503
8505
8507 {
8508 return false;
8509 }
8510
8512 {
8513 return true;
8514 }
8515
8516
8517
8519 {
8520 return true;
8521 }
8522
8524 {
8525 return true;
8526 }
8527
8529 {
8530 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8532 }
8533
8535 {
8537 }
8538
8540 {
8542 if (!is_being_placed)
8544 SetSynchDirty();
8545 }
8546
8547
8549
8551 {
8553 }
8554
8556 {
8558 }
8559
8561 {
8562 return 1;
8563 }
8564
8566 {
8567 return false;
8568 }
8569
8571 {
8573 SetSynchDirty();
8574 }
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8611 {
8612 super.OnMovedInsideCargo(container);
8613
8614 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8615 }
8616
8617 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8618 {
8619 super.EEItemLocationChanged(oldLoc, newLoc);
8620
8621 PlayerBase newPlayer = null;
8622 PlayerBase oldPlayer = null;
8623
8624 if (newLoc.GetParent())
8625 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8626
8627 if (oldLoc.GetParent())
8628 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8629
8631 {
8632 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8633
8634 if (rIndex >= 0)
8635 {
8636 InventoryLocation rIl = new InventoryLocation;
8637 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8638
8639 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8642 {
8643 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8644 }
8646 {
8648 }
8649
8650 }
8651 }
8652
8654 {
8655 if (newPlayer)
8656 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8657
8658 if (newPlayer == oldPlayer)
8659 {
8660 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8661 {
8663 {
8664 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8665 {
8666 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8667 }
8668 }
8669 else
8670 {
8671 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8672 }
8673 }
8674
8675 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8676 {
8677 int type = oldLoc.GetType();
8679 {
8680 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8681 }
8683 {
8684 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8685 }
8686 }
8687 if (!m_OldLocation)
8688 {
8689 m_OldLocation = new InventoryLocation;
8690 }
8691 m_OldLocation.Copy(oldLoc);
8692 }
8693 else
8694 {
8695 if (m_OldLocation)
8696 {
8697 m_OldLocation.Reset();
8698 }
8699 }
8700
8701 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8702 }
8703 else
8704 {
8705 if (newPlayer)
8706 {
8707 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8708 if (resIndex >= 0)
8709 {
8710 InventoryLocation il = new InventoryLocation;
8711 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8713 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8716 {
8717 il.
GetParent().GetOnReleaseLock().Invoke(it);
8718 }
8720 {
8722 }
8723
8724 }
8725 }
8727 {
8728
8730 }
8731
8732 if (m_OldLocation)
8733 {
8734 m_OldLocation.Reset();
8735 }
8736 }
8737
8739 {
8740 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8741 }
8742
8744 {
8745 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8746 }
8747 }
8748
8749 override void EOnContact(IEntity other, Contact extra)
8750 {
8752 {
8753 int liquidType = -1;
8755 if (impactSpeed > 0.0)
8756 {
8758 #ifndef SERVER
8760 #else
8762 SetSynchDirty();
8763 #endif
8765 }
8766 }
8767
8768 #ifdef SERVER
8769 if (GetCompEM() && GetCompEM().IsPlugged())
8770 {
8771 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8772 GetCompEM().UnplugThis();
8773 }
8774 #endif
8775 }
8776
8778
8780 {
8782 }
8783
8785 {
8786
8787 }
8788
8790 {
8791 super.OnItemLocationChanged(old_owner, new_owner);
8792
8793 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8794 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8795
8796 if (!relatedPlayer && playerNew)
8797 relatedPlayer = playerNew;
8798
8799 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8800 {
8802 if (actionMgr)
8803 {
8804 ActionBase currentAction = actionMgr.GetRunningAction();
8805 if (currentAction)
8807 }
8808 }
8809
8810 Man ownerPlayerOld = null;
8811 Man ownerPlayerNew = null;
8812
8813 if (old_owner)
8814 {
8815 if (old_owner.
IsMan())
8816 {
8817 ownerPlayerOld = Man.Cast(old_owner);
8818 }
8819 else
8820 {
8821 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8822 }
8823 }
8824 else
8825 {
8827 {
8829
8830 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8831 {
8832 GetCompEM().UnplugThis();
8833 }
8834 }
8835 }
8836
8837 if (new_owner)
8838 {
8839 if (new_owner.
IsMan())
8840 {
8841 ownerPlayerNew = Man.Cast(new_owner);
8842 }
8843 else
8844 {
8845 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8846 }
8847 }
8848
8849 if (ownerPlayerOld != ownerPlayerNew)
8850 {
8851 if (ownerPlayerOld)
8852 {
8853 array<EntityAI> subItemsExit = new array<EntityAI>;
8855 for (int i = 0; i < subItemsExit.Count(); i++)
8856 {
8859 }
8860 }
8861
8862 if (ownerPlayerNew)
8863 {
8864 array<EntityAI> subItemsEnter = new array<EntityAI>;
8866 for (int j = 0; j < subItemsEnter.Count(); j++)
8867 {
8870 }
8871 }
8872 }
8873 else if (ownerPlayerNew != null)
8874 {
8875 PlayerBase nplayer;
8876 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8877 {
8878 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8880 for (int k = 0; k < subItemsUpdate.Count(); k++)
8881 {
8883 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8884 }
8885 }
8886 }
8887
8888 if (old_owner)
8889 old_owner.OnChildItemRemoved(this);
8890 if (new_owner)
8891 new_owner.OnChildItemReceived(this);
8892 }
8893
8894
8896 {
8897 super.EEDelete(parent);
8898 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8899 if (player)
8900 {
8902
8903 if (player.IsAlive())
8904 {
8905 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8906 if (r_index >= 0)
8907 {
8908 InventoryLocation r_il = new InventoryLocation;
8909 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8910
8911 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8914 {
8915 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8916 }
8918 {
8919 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8920 }
8921
8922 }
8923
8924 player.RemoveQuickBarEntityShortcut(this);
8925 }
8926 }
8927 }
8928
8930 {
8931 super.EEKilled(killer);
8932
8935 {
8936 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8937 {
8938 if (IsMagazine())
8939 {
8940 if (Magazine.Cast(this).GetAmmoCount() > 0)
8941 {
8943 }
8944 }
8945 else
8946 {
8948 }
8949 }
8950 }
8951 }
8952
8954 {
8955 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8956
8957 super.OnWasAttached(parent, slot_id);
8958
8961
8964 }
8965
8967 {
8968 super.OnWasDetached(parent, slot_id);
8969
8972
8975 }
8976
8978 {
8979 int idx;
8982
8983 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8984 if (inventory_slots.Count() < 1)
8985 {
8986 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8987 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8988 }
8989 else
8990 {
8991 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8992 }
8993
8994 idx = inventory_slots.Find(slot);
8995 if (idx < 0)
8996 return "";
8997
8998 return attach_types.Get(idx);
8999 }
9000
9002 {
9003 int idx = -1;
9004 string slot;
9005
9008
9009 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9010 if (inventory_slots.Count() < 1)
9011 {
9012 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9013 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9014 }
9015 else
9016 {
9017 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9018 if (detach_types.Count() < 1)
9019 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9020 }
9021
9022 for (int i = 0; i < inventory_slots.Count(); i++)
9023 {
9024 slot = inventory_slots.Get(i);
9025 }
9026
9027 if (slot != "")
9028 {
9029 if (detach_types.Count() == 1)
9030 idx = 0;
9031 else
9032 idx = inventory_slots.Find(slot);
9033 }
9034 if (idx < 0)
9035 return "";
9036
9037 return detach_types.Get(idx);
9038 }
9039
9041 {
9042
9044
9045
9046 float min_time = 1;
9047 float max_time = 3;
9048 float delay = Math.RandomFloat(min_time, max_time);
9049
9050 explode_timer.Run(delay, this, "DoAmmoExplosion");
9051 }
9052
9054 {
9055 Magazine magazine = Magazine.Cast(this);
9056 int pop_sounds_count = 6;
9057 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9058
9059
9060 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9061 string sound_name = pop_sounds[ sound_idx ];
9062 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9063
9064
9065 magazine.ServerAddAmmoCount(-1);
9066
9067
9068 float min_temp_to_explode = 100;
9069
9070 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9071 {
9073 }
9074 }
9075
9076
9077 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9078 {
9079 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9080
9081 const int CHANCE_DAMAGE_CARGO = 4;
9082 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9083 const int CHANCE_DAMAGE_NOTHING = 2;
9084
9086 {
9087 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9088 int chances;
9089 int rnd;
9090
9091 if (GetInventory().GetCargo())
9092 {
9093 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9094 rnd = Math.RandomInt(0,chances);
9095
9096 if (rnd < CHANCE_DAMAGE_CARGO)
9097 {
9099 }
9100 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9101 {
9103 }
9104 }
9105 else
9106 {
9107 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9108 rnd = Math.RandomInt(0,chances);
9109
9110 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9111 {
9113 }
9114 }
9115 }
9116 }
9117
9119 {
9120 CargoBase cargo = GetInventory().GetCargo();
9121 if (cargo)
9122 {
9124 if (item_count > 0)
9125 {
9126 int random_pick = Math.RandomInt(0, item_count);
9128 if (!item.IsExplosive())
9129 {
9130 item.AddHealth("","",damage);
9131 return true;
9132 }
9133 }
9134 }
9135 return false;
9136 }
9137
9139 {
9140 GameInventory inventory = GetInventory();
9142 if (attachment_count > 0)
9143 {
9144 int random_pick = Math.RandomInt(0, attachment_count);
9146 if (!attachment.IsExplosive())
9147 {
9148 attachment.AddHealth("","",damage);
9149 return true;
9150 }
9151 }
9152 return false;
9153 }
9154
9156 {
9158 }
9159
9161 {
9163 return GetInventory().CanRemoveEntity();
9164
9165 return false;
9166 }
9167
9169 {
9170
9172 return false;
9173
9174
9176 return false;
9177
9178
9179
9181 if (delta == 0)
9182 return false;
9183
9184
9185 return true;
9186 }
9187
9189 {
9191 {
9192 if (ScriptInputUserData.CanStoreInputUserData())
9193 {
9194 ScriptInputUserData ctx = new ScriptInputUserData;
9199 ctx.
Write(destination_entity);
9203 }
9204 }
9205 else if (!
g_Game.IsMultiplayer())
9206 {
9208 }
9209 }
9210
9212 {
9213 float split_quantity_new;
9217 InventoryLocation loc = new InventoryLocation;
9218
9219 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9220 {
9222 split_quantity_new = stack_max;
9223 else
9225
9227 {
9228 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9229 if (new_item)
9230 {
9231 new_item.SetResultOfSplit(true);
9232 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9234 new_item.
SetQuantity(split_quantity_new,
false,
true);
9235 }
9236 }
9237 }
9238 else if (destination_entity && slot_id == -1)
9239 {
9240 if (quantity > stack_max)
9241 split_quantity_new = stack_max;
9242 else
9243 split_quantity_new = quantity;
9244
9246 {
9247 GameInventory destinationInventory = destination_entity.GetInventory();
9249 {
9252 }
9253
9254 if (new_item)
9255 {
9256 new_item.SetResultOfSplit(true);
9257 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9259 new_item.
SetQuantity(split_quantity_new,
false,
true);
9260 }
9261 }
9262 }
9263 else
9264 {
9265 if (stack_max != 0)
9266 {
9268 {
9270 }
9271
9272 if (split_quantity_new == 0)
9273 {
9274 if (!
g_Game.IsMultiplayer())
9275 player.PhysicalPredictiveDropItem(this);
9276 else
9277 player.ServerDropEntity(this);
9278 return;
9279 }
9280
9282 {
9284
9285 if (new_item)
9286 {
9287 new_item.SetResultOfSplit(true);
9288 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9291 new_item.PlaceOnSurface();
9292 }
9293 }
9294 }
9295 }
9296 }
9297
9299 {
9300 float split_quantity_new;
9304 InventoryLocation loc = new InventoryLocation;
9305
9306 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9307 {
9309 split_quantity_new = stack_max;
9310 else
9312
9314 {
9315 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9316 if (new_item)
9317 {
9318 new_item.SetResultOfSplit(true);
9319 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9321 new_item.
SetQuantity(split_quantity_new,
false,
true);
9322 }
9323 }
9324 }
9325 else if (destination_entity && slot_id == -1)
9326 {
9327 if (quantity > stack_max)
9328 split_quantity_new = stack_max;
9329 else
9330 split_quantity_new = quantity;
9331
9333 {
9334 GameInventory destinationInventory = destination_entity.GetInventory();
9336 {
9339 }
9340
9341 if (new_item)
9342 {
9343 new_item.SetResultOfSplit(true);
9344 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9346 new_item.
SetQuantity(split_quantity_new,
false,
true);
9347 }
9348 }
9349 }
9350 else
9351 {
9352 if (stack_max != 0)
9353 {
9355 {
9357 }
9358
9360 {
9362
9363 if (new_item)
9364 {
9365 new_item.SetResultOfSplit(true);
9366 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9369 new_item.PlaceOnSurface();
9370 }
9371 }
9372 }
9373 }
9374 }
9375
9377 {
9379 {
9380 if (ScriptInputUserData.CanStoreInputUserData())
9381 {
9382 ScriptInputUserData ctx = new ScriptInputUserData;
9387 dst.WriteToContext(ctx);
9389 }
9390 }
9391 else if (!
g_Game.IsMultiplayer())
9392 {
9394 }
9395 }
9396
9398 {
9400 {
9401 if (ScriptInputUserData.CanStoreInputUserData())
9402 {
9403 ScriptInputUserData ctx = new ScriptInputUserData;
9408 ctx.
Write(destination_entity);
9414 }
9415 }
9416 else if (!
g_Game.IsMultiplayer())
9417 {
9419 }
9420 }
9421
9423 {
9425 }
9426
9428 {
9430 float split_quantity_new;
9432 if (dst.IsValid())
9433 {
9434 int slot_id = dst.GetSlot();
9436
9437 if (quantity > stack_max)
9438 split_quantity_new = stack_max;
9439 else
9440 split_quantity_new = quantity;
9441
9443 {
9445
9446 if (new_item)
9447 {
9448 new_item.SetResultOfSplit(true);
9449 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9451 new_item.
SetQuantity(split_quantity_new,
false,
true);
9452 }
9453
9454 return new_item;
9455 }
9456 }
9457
9458 return null;
9459 }
9460
9462 {
9464 float split_quantity_new;
9466 if (destination_entity)
9467 {
9469 if (quantity > stackable)
9470 split_quantity_new = stackable;
9471 else
9472 split_quantity_new = quantity;
9473
9475 {
9476 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9477 if (new_item)
9478 {
9479 new_item.SetResultOfSplit(true);
9480 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9482 new_item.
SetQuantity(split_quantity_new,
false,
true);
9483 }
9484 }
9485 }
9486 }
9487
9489 {
9491 {
9492 if (ScriptInputUserData.CanStoreInputUserData())
9493 {
9494 ScriptInputUserData ctx = new ScriptInputUserData;
9499 ItemBase destination_entity =
this;
9500 ctx.
Write(destination_entity);
9504 }
9505 }
9506 else if (!
g_Game.IsMultiplayer())
9507 {
9509 }
9510 }
9511
9513 {
9515 float split_quantity_new;
9517 if (player)
9518 {
9520 if (quantity > stackable)
9521 split_quantity_new = stackable;
9522 else
9523 split_quantity_new = quantity;
9524
9526 {
9527 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9528 new_item =
ItemBase.Cast(in_hands);
9529 if (new_item)
9530 {
9531 new_item.SetResultOfSplit(true);
9532 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9534 new_item.SetQuantity(split_quantity_new, false, true);
9535 }
9536 }
9537 }
9538 }
9539
9541 {
9543 float split_quantity_new = Math.Floor(quantity * 0.5);
9544
9546 return;
9547
9549
9550 if (new_item)
9551 {
9552 if (new_item.GetQuantityMax() < split_quantity_new)
9553 {
9554 split_quantity_new = new_item.GetQuantityMax();
9555 }
9556
9557 new_item.SetResultOfSplit(true);
9558 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9559
9561 {
9564 }
9565 else
9566 {
9568 new_item.
SetQuantity(split_quantity_new,
false,
true);
9569 }
9570 }
9571 }
9572
9574 {
9576 float split_quantity_new = Math.Floor(quantity / 2);
9577
9579 return;
9580
9581 InventoryLocation invloc = new InventoryLocation;
9583
9585 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9586
9587 if (new_item)
9588 {
9589 if (new_item.GetQuantityMax() < split_quantity_new)
9590 {
9591 split_quantity_new = new_item.GetQuantityMax();
9592 }
9594 {
9597 }
9598 else if (split_quantity_new > 1)
9599 {
9601 new_item.
SetQuantity(split_quantity_new,
false,
true);
9602 }
9603 }
9604 }
9605
9608 {
9609 SetWeightDirty();
9611
9612 if (parent)
9613 parent.OnAttachmentQuantityChangedEx(this, delta);
9614
9616 {
9618 {
9620 }
9622 {
9623 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9625 }
9626 }
9627 }
9628
9631 {
9632
9633 }
9634
9637 {
9639 }
9640
9642 {
9643 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9644
9646 {
9647 if (newLevel == GameConstants.STATE_RUINED)
9648 {
9650 EntityAI parent = GetHierarchyParent();
9651 if (parent && parent.IsFireplace())
9652 {
9653 CargoBase cargo = GetInventory().GetCargo();
9654 if (cargo)
9655 {
9657 {
9659 }
9660 }
9661 }
9662 }
9663
9665 {
9666
9668 return;
9669 }
9670
9671 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9672 {
9674 }
9675 }
9676 }
9677
9678
9680 {
9681 super.OnRightClick();
9682
9684 {
9686 {
9687 if (ScriptInputUserData.CanStoreInputUserData())
9688 {
9689 EntityAI root = GetHierarchyRoot();
9690 Man playerOwner = GetHierarchyRootPlayer();
9691 InventoryLocation dst = new InventoryLocation;
9692
9693
9694 if (!playerOwner && root && root == this)
9695 {
9697 }
9698 else
9699 {
9700
9701 GetInventory().GetCurrentInventoryLocation(dst);
9703 {
9704 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9706 {
9708 }
9709 else
9710 {
9712
9713
9714 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9715 {
9717 }
9718 else
9719 {
9720 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9721 }
9722 }
9723 }
9724 }
9725
9726 ScriptInputUserData ctx = new ScriptInputUserData;
9734 }
9735 }
9736 else if (!
g_Game.IsMultiplayer())
9737 {
9739 }
9740 }
9741 }
9742
9744 {
9745 if (root)
9746 {
9747 vector m4[4];
9748 root.GetTransform(m4);
9749 dst.SetGround(this, m4);
9750 }
9751 else
9752 {
9753 GetInventory().GetCurrentInventoryLocation(dst);
9754 }
9755 }
9756
9757 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9758 {
9759
9760 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9761 return false;
9762
9763 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9764 return false;
9765
9766
9768 return false;
9769
9770
9771 Magazine mag = Magazine.Cast(this);
9772 if (mag)
9773 {
9774 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9775 return false;
9776
9777 if (stack_max_limit)
9778 {
9779 Magazine other_mag = Magazine.Cast(other_item);
9780 if (other_item)
9781 {
9782 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9783 return false;
9784 }
9785
9786 }
9787 }
9788 else
9789 {
9790
9792 return false;
9793
9795 return false;
9796 }
9797
9798 PlayerBase player = null;
9799 if (CastTo(player, GetHierarchyRootPlayer()))
9800 {
9801 if (player.GetInventory().HasAttachment(this))
9802 return false;
9803
9804 if (player.IsItemsToDelete())
9805 return false;
9806 }
9807
9808 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9809 return false;
9810
9811 int slotID;
9813 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9814 return false;
9815
9816 return true;
9817 }
9818
9820 {
9822 }
9823
9825 {
9826 return m_IsResultOfSplit;
9827 }
9828
9830 {
9831 m_IsResultOfSplit = value;
9832 }
9833
9835 {
9837 }
9838
9840 {
9841 float other_item_quantity = other_item.GetQuantity();
9842 float this_free_space;
9843
9845
9847
9848 if (other_item_quantity > this_free_space)
9849 {
9850 return this_free_space;
9851 }
9852 else
9853 {
9854 return other_item_quantity;
9855 }
9856 }
9857
9859 {
9861 }
9862
9864 {
9866 return;
9867
9868 if (!IsMagazine() && other_item)
9869 {
9871 if (quantity_used != 0)
9872 {
9873 float hp1 = GetHealth01("","");
9874 float hp2 = other_item.GetHealth01("","");
9875 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9876 hpResult = hpResult / (
GetQuantity() + quantity_used);
9877
9878 hpResult *= GetMaxHealth();
9879 Math.Round(hpResult);
9880 SetHealth("", "Health", hpResult);
9881
9883 other_item.AddQuantity(-quantity_used);
9884 }
9885 }
9887 }
9888
9890 {
9891 #ifdef SERVER
9892 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9893 GetHierarchyParent().IncreaseLifetimeUp();
9894 #endif
9895 };
9896
9898 {
9899 PlayerBase p = PlayerBase.Cast(player);
9900
9901 array<int> recipesIds = p.m_Recipes;
9902 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9903 if (moduleRecipesManager)
9904 {
9905 EntityAI itemInHands = player.GetEntityInHands();
9906 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9907 }
9908
9909 for (int i = 0;i < recipesIds.Count(); i++)
9910 {
9911 int key = recipesIds.Get(i);
9912 string recipeName = moduleRecipesManager.GetRecipeName(key);
9914 }
9915 }
9916
9917
9918 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9919 {
9920 super.GetDebugActions(outputList);
9921
9922
9928
9929
9934
9939
9940
9944
9945
9947 {
9951 }
9952
9955
9956
9960
9962
9963 InventoryLocation loc = new InventoryLocation();
9964 GetInventory().GetCurrentInventoryLocation(loc);
9966 {
9967 if (Gizmo_IsSupported())
9970 }
9971
9973 }
9974
9975
9976
9977
9979 {
9980 super.OnAction(action_id, player, ctx);
9981
9983 {
9984 switch (action_id)
9985 {
9989 return true;
9993 return true;
9994 }
9995 }
9996
9998 {
9999 switch (action_id)
10000 {
10002 Delete();
10003 return true;
10004 }
10005 }
10006
10007 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10008 {
10009 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10010 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10011 PlayerBase p = PlayerBase.Cast(player);
10012 if (
EActions.RECIPES_RANGE_START < 1000)
10013 {
10014 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10015 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10016 }
10017 }
10018 #ifndef SERVER
10019 else if (action_id ==
EActions.WATCH_PLAYER)
10020 {
10021 PluginDeveloper.SetDeveloperItemClientEx(player);
10022 }
10023 #endif
10025 {
10026 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10027 {
10028 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10029 OnDebugButtonPressServer(id + 1);
10030 }
10031
10032 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10033 {
10034 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10036 }
10037
10038 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10039 {
10040 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10042 }
10043
10044 else if (action_id ==
EActions.ADD_QUANTITY)
10045 {
10046 if (IsMagazine())
10047 {
10048 Magazine mag = Magazine.Cast(this);
10049 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10050 }
10051 else
10052 {
10054 }
10055
10056 if (m_EM)
10057 {
10058 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10059 }
10060
10061 }
10062
10063 else if (action_id ==
EActions.REMOVE_QUANTITY)
10064 {
10065 if (IsMagazine())
10066 {
10067 Magazine mag2 = Magazine.Cast(this);
10068 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10069 }
10070 else
10071 {
10073 }
10074 if (m_EM)
10075 {
10076 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10077 }
10078
10079 }
10080
10081 else if (action_id ==
EActions.SET_QUANTITY_0)
10082 {
10084
10085 if (m_EM)
10086 {
10087 m_EM.SetEnergy(0);
10088 }
10089 }
10090
10091 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10092 {
10094
10095 if (m_EM)
10096 {
10097 m_EM.SetEnergy(m_EM.GetEnergyMax());
10098 }
10099 }
10100
10101 else if (action_id ==
EActions.ADD_HEALTH)
10102 {
10103 AddHealth("","",GetMaxHealth("","Health")/5);
10104 }
10105 else if (action_id ==
EActions.REMOVE_HEALTH)
10106 {
10107 AddHealth("","",-GetMaxHealth("","Health")/5);
10108 }
10109 else if (action_id ==
EActions.DESTROY_HEALTH)
10110 {
10111 SetHealth01("","",0);
10112 }
10113 else if (action_id ==
EActions.WATCH_ITEM)
10114 {
10116 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10117 #ifdef DEVELOPER
10118 SetDebugDeveloper_item(this);
10119 #endif
10120 }
10121
10122 else if (action_id ==
EActions.ADD_TEMPERATURE)
10123 {
10124 AddTemperature(20);
10125
10126 }
10127
10128 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10129 {
10130 AddTemperature(-20);
10131
10132 }
10133
10134 else if (action_id ==
EActions.FLIP_FROZEN)
10135 {
10136 SetFrozen(!GetIsFrozen());
10137
10138 }
10139
10140 else if (action_id ==
EActions.ADD_WETNESS)
10141 {
10143
10144 }
10145
10146 else if (action_id ==
EActions.REMOVE_WETNESS)
10147 {
10149
10150 }
10151
10152 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10153 {
10156
10157
10158 }
10159
10160 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10161 {
10164 }
10165
10166 else if (action_id ==
EActions.MAKE_SPECIAL)
10167 {
10168 auto debugParams = DebugSpawnParams.WithPlayer(player);
10169 OnDebugSpawnEx(debugParams);
10170 }
10171
10172 }
10173
10174
10175 return false;
10176 }
10177
10178
10179
10180
10184
10187
10188
10189
10191 {
10192 return false;
10193 }
10194
10195
10197 {
10198 return true;
10199 }
10200
10201
10203 {
10204 return true;
10205 }
10206
10207
10208
10210 {
10211 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10212 return g_Game.ConfigIsExisting(config_path);
10213 }
10214
10217 {
10218 return null;
10219 }
10220
10222 {
10223 return false;
10224 }
10225
10227 {
10228 return false;
10229 }
10230
10234
10235
10237 {
10238 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10239 return module_repairing.CanRepair(this, item_repair_kit);
10240 }
10241
10242
10243 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10244 {
10245 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10246 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10247 }
10248
10249
10251 {
10252
10253
10254
10255
10256
10257
10258
10259
10260 return 1;
10261 }
10262
10263
10264
10266 {
10268 }
10269
10270
10271
10273 {
10275 }
10276
10277
10286 {
10287 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10288
10289 if (player)
10290 {
10291 player.MessageStatus(text);
10292 }
10293 }
10294
10295
10304 {
10305 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10306
10307 if (player)
10308 {
10309 player.MessageAction(text);
10310 }
10311 }
10312
10313
10322 {
10323 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10324
10325 if (player)
10326 {
10327 player.MessageFriendly(text);
10328 }
10329 }
10330
10331
10340 {
10341 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10342
10343 if (player)
10344 {
10345 player.MessageImportant(text);
10346 }
10347 }
10348
10350 {
10351 return true;
10352 }
10353
10354
10355 override bool KindOf(
string tag)
10356 {
10357 bool found = false;
10358 string item_name = this.
GetType();
10360 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10361
10362 int array_size = item_tag_array.Count();
10363 for (int i = 0; i < array_size; i++)
10364 {
10365 if (item_tag_array.Get(i) == tag)
10366 {
10367 found = true;
10368 break;
10369 }
10370 }
10371 return found;
10372 }
10373
10374
10376 {
10377
10378 super.OnRPC(sender, rpc_type,ctx);
10379
10380
10381 switch (rpc_type)
10382 {
10383 #ifndef SERVER
10384 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10385 Param2<bool, string> p = new Param2<bool, string>(false, "");
10386
10388 return;
10389
10390 bool play = p.param1;
10391 string soundSet = p.param2;
10392
10393 if (play)
10394 {
10396 {
10398 {
10400 }
10401 }
10402 else
10403 {
10405 }
10406 }
10407 else
10408 {
10410 }
10411
10412 break;
10413 #endif
10414
10415 }
10416
10418 {
10420 }
10421 }
10422
10423
10424
10425
10427 {
10428 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10429 return plugin.GetID(
name);
10430 }
10431
10433 {
10434 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10435 return plugin.GetName(id);
10436 }
10437
10440 {
10441
10442
10443 int varFlags;
10444 if (!ctx.
Read(varFlags))
10445 return;
10446
10447 if (varFlags & ItemVariableFlags.FLOAT)
10448 {
10450 }
10451 }
10452
10454 {
10455
10456 super.SerializeNumericalVars(floats_out);
10457
10458
10459
10461 {
10463 }
10464
10466 {
10468 }
10469
10471 {
10473 }
10474
10476 {
10481 }
10482
10484 {
10486 }
10487 }
10488
10490 {
10491
10492 super.DeSerializeNumericalVars(floats);
10493
10494
10495 int index = 0;
10496 int mask = Math.Round(floats.Get(index));
10497
10498 index++;
10499
10501 {
10503 {
10505 }
10506 else
10507 {
10508 float quantity = floats.Get(index);
10509 SetQuantity(quantity,
true,
false,
false,
false);
10510 }
10511 index++;
10512 }
10513
10515 {
10516 float wet = floats.Get(index);
10518 index++;
10519 }
10520
10522 {
10523 int liquidtype = Math.Round(floats.Get(index));
10525 index++;
10526 }
10527
10529 {
10531 index++;
10533 index++;
10535 index++;
10537 index++;
10538 }
10539
10541 {
10542 int cleanness = Math.Round(floats.Get(index));
10544 index++;
10545 }
10546 }
10547
10549 {
10550 super.WriteVarsToCTX(ctx);
10551
10552
10554 {
10556 }
10557
10559 {
10561 }
10562
10564 {
10566 }
10567
10569 {
10570 int r,g,b,a;
10576 }
10577
10579 {
10581 }
10582 }
10583
10585 {
10586 if (!super.ReadVarsFromCTX(ctx,version))
10587 return false;
10588
10589 int intValue;
10590 float value;
10591
10592 if (version < 140)
10593 {
10594 if (!ctx.
Read(intValue))
10595 return false;
10596
10597 m_VariablesMask = intValue;
10598 }
10599
10601 {
10602 if (!ctx.
Read(value))
10603 return false;
10604
10606 {
10608 }
10609 else
10610 {
10612 }
10613 }
10614
10615 if (version < 140)
10616 {
10618 {
10619 if (!ctx.
Read(value))
10620 return false;
10621 SetTemperatureDirect(value);
10622 }
10623 }
10624
10626 {
10627 if (!ctx.
Read(value))
10628 return false;
10630 }
10631
10633 {
10634 if (!ctx.
Read(intValue))
10635 return false;
10637 }
10638
10640 {
10641 int r,g,b,a;
10643 return false;
10645 return false;
10647 return false;
10649 return false;
10650
10652 }
10653
10655 {
10656 if (!ctx.
Read(intValue))
10657 return false;
10659 }
10660
10661 if (version >= 138 && version < 140)
10662 {
10664 {
10665 if (!ctx.
Read(intValue))
10666 return false;
10667 SetFrozen(intValue);
10668 }
10669 }
10670
10671 return true;
10672 }
10673
10674
10676 {
10679 {
10681 }
10682
10683 if (!super.OnStoreLoad(ctx, version))
10684 {
10686 return false;
10687 }
10688
10689 if (version >= 114)
10690 {
10691 bool hasQuickBarIndexSaved;
10692
10693 if (!ctx.
Read(hasQuickBarIndexSaved))
10694 {
10696 return false;
10697 }
10698
10699 if (hasQuickBarIndexSaved)
10700 {
10701 int itmQBIndex;
10702
10703
10704 if (!ctx.
Read(itmQBIndex))
10705 {
10707 return false;
10708 }
10709
10710 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10711 if (itmQBIndex != -1 && parentPlayer)
10712 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10713 }
10714 }
10715 else
10716 {
10717
10718 PlayerBase player;
10719 int itemQBIndex;
10720 if (version ==
int.
MAX)
10721 {
10722 if (!ctx.
Read(itemQBIndex))
10723 {
10725 return false;
10726 }
10727 }
10728 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10729 {
10730
10731 if (!ctx.
Read(itemQBIndex))
10732 {
10734 return false;
10735 }
10736 if (itemQBIndex != -1 && player)
10737 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10738 }
10739 }
10740
10741 if (version < 140)
10742 {
10743
10744 if (!LoadVariables(ctx, version))
10745 {
10747 return false;
10748 }
10749 }
10750
10751
10753 {
10755 return false;
10756 }
10757 if (version >= 132)
10758 {
10760 if (raib)
10761 {
10763 {
10765 return false;
10766 }
10767 }
10768 }
10769
10771 return true;
10772 }
10773
10774
10775
10777 {
10778 super.OnStoreSave(ctx);
10779
10780 PlayerBase player;
10781 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10782 {
10784
10785 int itemQBIndex = -1;
10786 itemQBIndex = player.FindQuickBarEntityIndex(this);
10787 ctx.
Write(itemQBIndex);
10788 }
10789 else
10790 {
10792 }
10793
10795
10797 if (raib)
10798 {
10800 }
10801 }
10802
10803
10805 {
10806 super.AfterStoreLoad();
10807
10809 {
10811 }
10812
10814 {
10817 }
10818 }
10819
10821 {
10822 super.EEOnAfterLoad();
10823
10825 {
10827 }
10828
10831 }
10832
10834 {
10835 return false;
10836 }
10837
10838
10839
10841 {
10843 {
10844 #ifdef PLATFORM_CONSOLE
10845
10847 {
10849 if (menu)
10850 {
10852 }
10853 }
10854 #endif
10855 }
10856
10858 {
10861 }
10862
10864 {
10865 SetWeightDirty();
10867 }
10869 {
10872 }
10873
10875 {
10878
10881 }
10883 {
10887 }
10888
10889 super.OnVariablesSynchronized();
10890 }
10891
10892
10893
10895 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10896 {
10897 if (!IsServerCheck(allow_client))
10898 return false;
10899
10901 return false;
10902
10905
10906 if (value <= (min + 0.001))
10907 value = min;
10908
10909 if (value == min)
10910 {
10911 if (destroy_config)
10912 {
10913 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10914 if (dstr)
10915 {
10917 this.Delete();
10918 return true;
10919 }
10920 }
10921 else if (destroy_forced)
10922 {
10924 this.Delete();
10925 return true;
10926 }
10927
10929 }
10930
10933
10935 {
10936 EntityAI parent = GetHierarchyRoot();
10937 InventoryLocation iLoc = new InventoryLocation();
10938 GetInventory().GetCurrentInventoryLocation(iLoc);
10940 {
10941 int iLocSlot = iLoc.
GetSlot();
10943 {
10945 }
10947 {
10949 }
10950 }
10951 }
10952
10954 {
10956
10957 if (delta)
10959 }
10960
10962
10963 return false;
10964 }
10965
10966
10968 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10969 {
10971 }
10972
10974 {
10977 }
10978
10980 {
10983 }
10984
10986 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10987 {
10988 float value_clamped = Math.Clamp(value, 0, 1);
10990 SetQuantity(result, destroy_config, destroy_forced);
10991 }
10992
10993
10996 {
10998 }
10999
11001 {
11003 }
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11015 {
11016 int slot = -1;
11017 GameInventory inventory = GetInventory();
11018 if (inventory)
11019 {
11020 InventoryLocation il = new InventoryLocation;
11023 }
11024
11026 }
11027
11029 {
11030 float quantity_max = 0;
11031
11033 {
11034 if (attSlotID != -1)
11035 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11036
11037 if (quantity_max <= 0)
11039 }
11040
11041 if (quantity_max <= 0)
11043
11044 return quantity_max;
11045 }
11046
11048 {
11050 }
11051
11053 {
11055 }
11056
11057
11059 {
11061 }
11062
11064 {
11066 }
11067
11069 {
11071 }
11072
11073
11075 {
11076
11077 float weightEx = GetWeightEx();
11078 float special = GetInventoryAndCargoWeight();
11079 return weightEx - special;
11080 }
11081
11082
11084 {
11086 }
11087
11089 {
11091 {
11092 #ifdef DEVELOPER
11093 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11094 {
11095 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11097 }
11098 #endif
11099
11100 return GetQuantity() * GetConfigWeightModified();
11101 }
11102 else if (HasEnergyManager())
11103 {
11104 #ifdef DEVELOPER
11105 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11106 {
11107 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11108 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11109 }
11110 #endif
11111 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11112 }
11113 else
11114 {
11115 #ifdef DEVELOPER
11116 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11117 {
11118 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11119 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11120 }
11121 #endif
11122 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11123 }
11124 }
11125
11128 {
11129 int item_count = 0;
11131
11132 GameInventory inventory = GetInventory();
11133 CargoBase cargo = inventory.
GetCargo();
11134 if (cargo != NULL)
11135 {
11137 }
11138
11140 for (int i = 0; i < nAttachments; ++i)
11141 {
11143 if (item)
11144 item_count += item.GetNumberOfItems();
11145 }
11146 return item_count;
11147 }
11148
11151 {
11152 float weight = 0;
11153 float wetness = 1;
11154 if (include_wetness)
11157 {
11158 weight = wetness * m_ConfigWeight;
11159 }
11161 {
11162 weight = 1;
11163 }
11164 return weight;
11165 }
11166
11167
11168
11170 {
11171 GameInventory inventory = GetInventory();
11172 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11173 {
11174 array<EntityAI> items = new array<EntityAI>;
11176 for (int i = 0; i < items.Count(); ++i)
11177 {
11179 if (item)
11180 {
11181 g_Game.ObjectDelete(item);
11182 }
11183 }
11184 }
11185 }
11186
11187
11188
11189
11191 {
11192 float energy = 0;
11193 if (HasEnergyManager())
11194 {
11195 energy = GetCompEM().GetEnergy();
11196 }
11197 return energy;
11198 }
11199
11200
11202 {
11203 super.OnEnergyConsumed();
11204
11206 }
11207
11209 {
11210 super.OnEnergyAdded();
11211
11213 }
11214
11215
11217 {
11218 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11219 {
11221 {
11222 float energy_0to1 = GetCompEM().GetEnergy0To1();
11224 }
11225 }
11226 }
11227
11228
11230 {
11231 return ConfigGetFloat("heatIsolation");
11232 }
11233
11235 {
11237 }
11238
11240 {
11241 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11242 if (
g_Game.ConfigIsExisting(paramPath))
11243 return g_Game.ConfigGetFloat(paramPath);
11244
11245 return 0.0;
11246 }
11247
11249 {
11250 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11251 if (
g_Game.ConfigIsExisting(paramPath))
11252 return g_Game.ConfigGetFloat(paramPath);
11253
11254 return 0.0;
11255 }
11256
11257 override void SetWet(
float value,
bool allow_client =
false)
11258 {
11259 if (!IsServerCheck(allow_client))
11260 return;
11261
11264
11266
11267 m_VarWet = Math.Clamp(value, min, max);
11268
11270 {
11273 }
11274 }
11275
11276 override void AddWet(
float value)
11277 {
11279 }
11280
11282 {
11284 }
11285
11287 {
11289 }
11290
11292 {
11294 }
11295
11297 {
11299 }
11300
11302 {
11304 }
11305
11306 override void OnWetChanged(
float newVal,
float oldVal)
11307 {
11310 if (newLevel != oldLevel)
11311 {
11313 }
11314 }
11315
11317 {
11318 SetWeightDirty();
11319 }
11320
11322 {
11323 return GetWetLevelInternal(
m_VarWet);
11324 }
11325
11326
11327
11329 {
11331 }
11332
11334 {
11336 }
11337
11339 {
11341 }
11342
11344 {
11346 }
11347
11348
11349
11351 {
11352 if (ConfigIsExisting("itemModelLength"))
11353 {
11354 return ConfigGetFloat("itemModelLength");
11355 }
11356 return 0;
11357 }
11358
11360 {
11361 if (ConfigIsExisting("itemAttachOffset"))
11362 {
11363 return ConfigGetFloat("itemAttachOffset");
11364 }
11365 return 0;
11366 }
11367
11368 override void SetCleanness(
int value,
bool allow_client =
false)
11369 {
11370 if (!IsServerCheck(allow_client))
11371 return;
11372
11374
11376
11379 }
11380
11382 {
11384 }
11385
11387 {
11388 return true;
11389 }
11390
11391
11392
11393
11395 {
11397 }
11398
11400 {
11402 }
11403
11404
11405
11406
11407 override void SetColor(
int r,
int g,
int b,
int a)
11408 {
11414 }
11416 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11417 {
11422 }
11423
11425 {
11427 }
11428
11431 {
11432 int r,g,b,a;
11434 r = r/255;
11435 g = g/255;
11436 b = b/255;
11437 a = a/255;
11438 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11439 }
11440
11441
11442
11443 override void SetLiquidType(
int value,
bool allow_client =
false)
11444 {
11445 if (!IsServerCheck(allow_client))
11446 return;
11447
11452 }
11453
11455 {
11456 return ConfigGetInt("varLiquidTypeInit");
11457 }
11458
11460 {
11462 }
11463
11465 {
11467 SetFrozen(false);
11468 }
11469
11472 {
11473 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11474 }
11475
11476
11479 {
11480 PlayerBase nplayer;
11481 if (PlayerBase.CastTo(nplayer, player))
11482 {
11484 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11485 }
11486 }
11487
11488
11491 {
11492 PlayerBase nplayer;
11493 if (PlayerBase.CastTo(nplayer,player))
11494 {
11495 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11496 }
11497
11498 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11499
11500 if (HasEnergyManager())
11501 {
11502 GetCompEM().UpdatePlugState();
11503 }
11504 }
11505
11506
11508 {
11509 super.OnPlacementStarted(player);
11510
11512 }
11513
11514 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11515 {
11517 {
11518 m_AdminLog.OnPlacementComplete(player,
this);
11519 }
11520
11521 super.OnPlacementComplete(player, position, orientation);
11522 }
11523
11524
11525
11526
11527
11529 {
11531 {
11532 return true;
11533 }
11534 else
11535 {
11536 return false;
11537 }
11538 }
11539
11540
11542 {
11544 {
11546 }
11547 }
11548
11549
11551 {
11553 }
11554
11556 {
11558 }
11559
11560 override void InsertAgent(
int agent,
float count = 1)
11561 {
11562 if (count < 1)
11563 return;
11564
11566 }
11567
11570 {
11572 }
11573
11574
11576 {
11578 }
11579
11580
11581
11582
11583
11584
11585
11586
11587
11588
11589
11590
11591
11592
11593
11594
11595
11596
11597
11598
11599
11600
11601
11602
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619
11620
11622 {
11624 return false;
11625 return true;
11626 }
11627
11629 {
11630
11632 }
11633
11634
11637 {
11638 super.CheckForRoofLimited(timeTresholdMS);
11639
11640 float time =
g_Game.GetTime();
11641 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11642 {
11643 m_PreviousRoofTestTime = time;
11644 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11645 }
11646 }
11647
11648
11650 {
11652 {
11653 return 0;
11654 }
11655
11656 if (GetInventory().GetAttachmentSlotsCount() != 0)
11657 {
11658 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11659 if (filter)
11660 return filter.GetProtectionLevel(type, false, system);
11661 else
11662 return 0;
11663 }
11664
11665 string subclassPath, entryName;
11666
11667 switch (type)
11668 {
11670 entryName = "biological";
11671 break;
11673 entryName = "chemical";
11674 break;
11675 default:
11676 entryName = "biological";
11677 break;
11678 }
11679
11680 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11681
11682 return g_Game.ConfigGetFloat(subclassPath + entryName);
11683 }
11684
11685
11686
11689 {
11690 if (!IsMagazine())
11692
11694 }
11695
11696
11697
11698
11699
11704 {
11705 return true;
11706 }
11707
11709 {
11711 }
11712
11713
11714
11715
11716
11718 {
11719 if (parent)
11720 {
11721 if (parent.IsInherited(DayZInfected))
11722 return true;
11723
11724 if (!parent.IsRuined())
11725 return true;
11726 }
11727
11728 return true;
11729 }
11730
11732 {
11733 if (!super.CanPutAsAttachment(parent))
11734 {
11735 return false;
11736 }
11737
11738 if (!IsRuined() && !parent.IsRuined())
11739 {
11740 return true;
11741 }
11742
11743 return false;
11744 }
11745
11747 {
11748
11749
11750
11751
11752 return super.CanReceiveItemIntoCargo(item);
11753 }
11754
11756 {
11757
11758
11759
11760
11761 GameInventory attachmentInv = attachment.GetInventory();
11763 {
11764 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11765 return false;
11766 }
11767
11768 InventoryLocation loc = new InventoryLocation();
11769 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11770 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11771 return false;
11772
11773 return super.CanReceiveAttachment(attachment, slotId);
11774 }
11775
11777 {
11778 if (!super.CanReleaseAttachment(attachment))
11779 return false;
11780
11781 return GetInventory().AreChildrenAccessible();
11782 }
11783
11784
11785
11786
11787
11788
11789
11790
11791
11792
11793
11794
11795
11796
11797
11798
11799
11800
11801
11802
11803
11805 {
11806 int id = muzzle_owner.GetMuzzleID();
11807 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11808
11809 if (WPOF_array)
11810 {
11811 for (int i = 0; i < WPOF_array.Count(); i++)
11812 {
11813 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11814
11815 if (WPOF)
11816 {
11817 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11818 }
11819 }
11820 }
11821 }
11822
11823
11825 {
11826 int id = muzzle_owner.GetMuzzleID();
11828
11829 if (WPOBE_array)
11830 {
11831 for (int i = 0; i < WPOBE_array.Count(); i++)
11832 {
11833 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11834
11835 if (WPOBE)
11836 {
11837 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11838 }
11839 }
11840 }
11841 }
11842
11843
11845 {
11846 int id = muzzle_owner.GetMuzzleID();
11847 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11848
11849 if (WPOOH_array)
11850 {
11851 for (int i = 0; i < WPOOH_array.Count(); i++)
11852 {
11853 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11854
11855 if (WPOOH)
11856 {
11857 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11858 }
11859 }
11860 }
11861 }
11862
11863
11865 {
11866 int id = muzzle_owner.GetMuzzleID();
11867 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11868
11869 if (WPOOH_array)
11870 {
11871 for (int i = 0; i < WPOOH_array.Count(); i++)
11872 {
11873 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11874
11875 if (WPOOH)
11876 {
11877 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11878 }
11879 }
11880 }
11881 }
11882
11883
11885 {
11886 int id = muzzle_owner.GetMuzzleID();
11887 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11888
11889 if (WPOOH_array)
11890 {
11891 for (int i = 0; i < WPOOH_array.Count(); i++)
11892 {
11893 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11894
11895 if (WPOOH)
11896 {
11897 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11898 }
11899 }
11900 }
11901 }
11902
11903
11904
11906 {
11908 {
11909 return true;
11910 }
11911
11912 return false;
11913 }
11914
11916 {
11918 {
11919 return true;
11920 }
11921
11922 return false;
11923 }
11924
11926 {
11928 {
11929 return true;
11930 }
11931
11932 return false;
11933 }
11934
11936 {
11937 return false;
11938 }
11939
11942 {
11943 return UATimeSpent.DEFAULT_DEPLOY;
11944 }
11945
11946
11947
11948
11950 {
11952 SetSynchDirty();
11953 }
11954
11956 {
11958 }
11959
11960
11962 {
11963 return false;
11964 }
11965
11968 {
11969 string att_type = "None";
11970
11971 if (ConfigIsExisting("soundAttType"))
11972 {
11973 att_type = ConfigGetString("soundAttType");
11974 }
11975
11977 }
11978
11980 {
11982 }
11983
11984
11985
11986
11987
11993
11995 {
11998
12000 }
12001
12002
12004 {
12006 return;
12007
12009
12012
12015
12016 SoundParameters params = new SoundParameters();
12020 }
12021
12022
12024 {
12026 {
12029
12030 SetSynchDirty();
12031
12034 }
12035 }
12036
12038 {
12040 }
12041
12042
12044 {
12046 return;
12047
12049 SetSynchDirty();
12050
12053 }
12054
12056 {
12059 }
12060
12062 {
12064 }
12065
12066 void OnApply(PlayerBase player);
12067
12069 {
12070 return 1.0;
12071 };
12072
12074 {
12076 }
12077
12079 {
12081 }
12082
12084
12086 {
12087 SetDynamicPhysicsLifeTime(0.01);
12089 }
12090
12092 {
12093 array<string> zone_names = new array<string>;
12094 GetDamageZones(zone_names);
12095 for (int i = 0; i < zone_names.Count(); i++)
12096 {
12097 SetHealthMax(zone_names.Get(i),"Health");
12098 }
12099 SetHealthMax("","Health");
12100 }
12101
12104 {
12105 float global_health = GetHealth01("","Health");
12106 array<string> zones = new array<string>;
12107 GetDamageZones(zones);
12108
12109 for (int i = 0; i < zones.Count(); i++)
12110 {
12111 SetHealth01(zones.Get(i),"Health",global_health);
12112 }
12113 }
12114
12117 {
12118 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12119 }
12120
12122 {
12123 if (!hasRootAsPlayer)
12124 {
12125 if (refParentIB)
12126 {
12127
12128 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12129 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12130
12131 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12132 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12133
12136 }
12137 else
12138 {
12139
12142 }
12143 }
12144 }
12145
12147 {
12149 {
12150 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12151 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12152 {
12153 float heatPermCoef = 1.0;
12155 while (ent)
12156 {
12157 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12158 ent = ent.GetHierarchyParent();
12159 }
12160
12161 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12162 }
12163 }
12164 }
12165
12167 {
12168
12169 EntityAI parent = GetHierarchyParent();
12170 if (!parent)
12171 {
12172 hasParent = false;
12173 hasRootAsPlayer = false;
12174 }
12175 else
12176 {
12177 hasParent = true;
12178 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12179 refParentIB =
ItemBase.Cast(parent);
12180 }
12181 }
12182
12183 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12184 {
12185
12186 }
12187
12189 {
12190
12191 return false;
12192 }
12193
12195 {
12196
12197
12198 return false;
12199 }
12200
12202 {
12203
12204 return false;
12205 }
12206
12209 {
12210 return !GetIsFrozen() &&
IsOpen();
12211 }
12212
12214 {
12215 bool hasParent = false, hasRootAsPlayer = false;
12217
12218 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12219 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12220
12221 if (wwtu || foodDecay)
12222 {
12226
12227 if (processWetness || processTemperature || processDecay)
12228 {
12230
12231 if (processWetness)
12232 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12233
12234 if (processTemperature)
12236
12237 if (processDecay)
12238 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12239 }
12240 }
12241 }
12242
12245 {
12247 }
12248
12250 {
12253
12254 return super.GetTemperatureFreezeThreshold();
12255 }
12256
12258 {
12261
12262 return super.GetTemperatureThawThreshold();
12263 }
12264
12266 {
12269
12270 return super.GetItemOverheatThreshold();
12271 }
12272
12274 {
12276 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12277
12278 return super.GetTemperatureFreezeTime();
12279 }
12280
12282 {
12284 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12285
12286 return super.GetTemperatureThawTime();
12287 }
12288
12293
12295 {
12296 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12297 }
12298
12300 {
12301 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12302 }
12303
12306 {
12308 }
12309
12311 {
12313 }
12314
12316 {
12318 }
12319
12322 {
12323 return null;
12324 }
12325
12328 {
12329 return false;
12330 }
12331
12333 {
12335 {
12338 if (!trg)
12339 {
12341 explosive = this;
12342 }
12343
12344 explosive.PairRemote(trg);
12346
12347 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12348 trg.SetPersistentPairID(persistentID);
12349 explosive.SetPersistentPairID(persistentID);
12350
12351 return true;
12352 }
12353 return false;
12354 }
12355
12358 {
12359 float ret = 1.0;
12362 ret *= GetHealth01();
12363
12364 return ret;
12365 }
12366
12367 #ifdef DEVELOPER
12368 override void SetDebugItem()
12369 {
12370 super.SetDebugItem();
12371 _itemBase = this;
12372 }
12373
12375 {
12376 string text = super.GetDebugText();
12377
12379 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12380
12381 return text;
12382 }
12383 #endif
12384
12386 {
12387 return true;
12388 }
12389
12391
12393
12395 {
12398 }
12399
12400
12408
12424
12425 [
Obsolete(
"Use ItemSoundHandler instead")]
12428 {
12429 if (!
g_Game.IsDedicatedServer())
12430 {
12431 if (ConfigIsExisting("attachSoundSet"))
12432 {
12433 string cfg_path = "";
12434 string soundset = "";
12435 string type_name =
GetType();
12436
12439 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12440 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12441
12442 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12443 {
12444 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12445 {
12446 if (cfg_slot_array[i] == slot_type)
12447 {
12448 soundset = cfg_soundset_array[i];
12449 break;
12450 }
12451 }
12452 }
12453
12454 if (soundset != "")
12455 {
12456 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12458 }
12459 }
12460 }
12461 }
12462
12464}
12465
12467{
12469 if (entity)
12470 {
12471 bool is_item = entity.IsInherited(
ItemBase);
12472 if (is_item && full_quantity)
12473 {
12476 }
12477 }
12478 else
12479 {
12481 return NULL;
12482 }
12483 return entity;
12484}
12485
12487{
12488 if (item)
12489 {
12490 if (health > 0)
12491 item.SetHealth("", "", health);
12492
12493 if (item.CanHaveTemperature())
12494 {
12496 if (item.CanFreeze())
12497 item.SetFrozen(false);
12498 }
12499
12500 if (item.HasEnergyManager())
12501 {
12502 if (quantity >= 0)
12503 {
12504 item.GetCompEM().SetEnergy0To1(quantity);
12505 }
12506 else
12507 {
12509 }
12510 }
12511 else if (item.IsMagazine())
12512 {
12513 Magazine mag = Magazine.Cast(item);
12514 if (quantity >= 0)
12515 {
12516 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12517 }
12518 else
12519 {
12521 }
12522
12523 }
12524 else
12525 {
12526 if (quantity >= 0)
12527 {
12528 item.SetQuantityNormalized(quantity, false);
12529 }
12530 else
12531 {
12533 }
12534
12535 }
12536 }
12537}
12538
12539#ifdef DEVELOPER
12541#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.