7583{
7585 {
7586 return true;
7587 }
7588};
7589
7591{
7592
7593};
7594
7595
7596
7598{
7602
7604
7607
7608
7609
7610
7611
7620
7626
7631
7636
7657 protected bool m_IsResultOfSplit
7658
7660
7665
7666
7667
7669
7673
7674
7675
7677
7680
7681
7682
7688
7689
7697
7700
7701
7703
7704
7706
7707
7712
7713
7718
7720
7721
7723
7724
7726 {
7731
7732 if (!
g_Game.IsDedicatedServer())
7733 {
7735 {
7737
7739 {
7741 }
7742 }
7743
7746 }
7747
7748 m_OldLocation = null;
7749
7751 {
7753 }
7754
7755 if (ConfigIsExisting("headSelectionsToHide"))
7756 {
7759 }
7760
7762 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7763 {
7765 }
7766
7768
7769 m_IsResultOfSplit = false;
7770
7772 }
7773
7775 {
7776 super.InitItemVariables();
7777
7783 m_Count = ConfigGetInt(
"count");
7784
7787
7792
7795
7800
7812
7816
7817
7820 if (ConfigIsExisting("canBeSplit"))
7821 {
7824 }
7825
7827 if (ConfigIsExisting("itemBehaviour"))
7829
7830
7833 RegisterNetSyncVariableInt("m_VarLiquidType");
7834 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7835
7836 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7837 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7838 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7839
7840 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7841 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7842 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7843 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7844
7845 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7846 RegisterNetSyncVariableBool("m_IsTakeable");
7847 RegisterNetSyncVariableBool("m_IsHologram");
7848
7851 {
7854 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7855 }
7856
7858
7860 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7862
7864 }
7865
7867 {
7869 }
7870
7872 {
7875 {
7880 }
7881 }
7882
7883 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7884 {
7886 {
7889 }
7890
7892 }
7893
7895 {
7901 }
7902
7904
7906 {
7908
7909 if (!action)
7910 {
7911 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7912 return;
7913 }
7914
7916 if (!ai)
7917 {
7919 return;
7920 }
7921
7923 if (!action_array)
7924 {
7925 action_array = new array<ActionBase_Basic>;
7927 }
7928 if (LogManager.IsActionLogEnable())
7929 {
7930 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7931 }
7932
7933 if (action_array.Find(action) != -1)
7934 {
7935 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7936 }
7937 else
7938 {
7939 action_array.Insert(action);
7940 }
7941 }
7942
7944 {
7945 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7946 ActionBase action = player.GetActionManager().GetAction(actionName);
7949
7950 if (action_array)
7951 {
7952 action_array.RemoveItem(action);
7953 }
7954 }
7955
7956
7957
7959 {
7960 ActionOverrideData overrideData = new ActionOverrideData();
7964
7966 if (!actionMap)
7967 {
7970 }
7971
7972 actionMap.Insert(this.
Type(), overrideData);
7973
7974 }
7975
7977
7979
7980
7982 {
7985
7988
7989 string config_to_search = "CfgVehicles";
7990 string muzzle_owner_config;
7991
7993 {
7994 if (IsInherited(Weapon))
7995 config_to_search = "CfgWeapons";
7996
7997 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7998
7999 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8000
8001 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8002
8003 if (config_OnFire_subclass_count > 0)
8004 {
8005 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8006
8007 for (int i = 0; i < config_OnFire_subclass_count; i++)
8008 {
8009 string particle_class = "";
8010 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8011 string config_OnFire_entry = config_OnFire_class + particle_class;
8012 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8013 WPOF_array.Insert(WPOF);
8014 }
8015
8016
8018 }
8019 }
8020
8022 {
8023 config_to_search = "CfgWeapons";
8024 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8025
8026 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8027
8028 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8029
8030 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8031 {
8032 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8033
8034 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8035 {
8036 string particle_class2 = "";
8037 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8038 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8039 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8040 WPOBE_array.Insert(WPOBE);
8041 }
8042
8043
8045 }
8046 }
8047 }
8048
8049
8051 {
8054
8056 {
8057 string config_to_search = "CfgVehicles";
8058
8059 if (IsInherited(Weapon))
8060 config_to_search = "CfgWeapons";
8061
8062 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8063 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8064
8065 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8066 {
8067
8069
8071 {
8073 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8075 return;
8076 }
8077
8080
8081
8082
8083 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8084 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8085
8086 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8087 {
8088 string particle_class = "";
8089 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8090 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8091 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8092
8093 if (entry_type == CT_CLASS)
8094 {
8095 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8096 WPOOH_array.Insert(WPOF);
8097 }
8098 }
8099
8100
8102 }
8103 }
8104 }
8105
8107 {
8109 }
8110
8112 {
8114 {
8116
8119
8122
8123 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8124 }
8125 }
8126
8128 {
8130 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8131
8133 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8134
8136 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8137
8139 {
8141 }
8142 }
8143
8145 {
8147 }
8148
8150 {
8153 else
8155
8157 {
8160 }
8161 else
8162 {
8165
8168 }
8169
8171 }
8172
8174 {
8176 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8177 }
8178
8180 {
8182 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8184 }
8185
8187 {
8189 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8190 }
8191
8193 {
8196
8197 OverheatingParticle OP = new OverheatingParticle();
8202
8204 }
8205
8207 {
8210
8211 return -1;
8212 }
8213
8215 {
8217 {
8220
8221 for (int i = count; i > 0; --i)
8222 {
8223 int id = i - 1;
8226
8229
8230 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8231 {
8232 if (p)
8233 {
8236 }
8237 }
8238 }
8239 }
8240 }
8241
8243 {
8245 {
8247 {
8248 int id = i - 1;
8250
8251 if (OP)
8252 {
8254
8255 if (p)
8256 {
8258 }
8259
8260 delete OP;
8261 }
8262 }
8263
8266 }
8267 }
8268
8271 {
8272 return 0.0;
8273 }
8274
8275
8277 {
8278 return 250;
8279 }
8280
8282 {
8283 return 0;
8284 }
8285
8288 {
8290 return true;
8291
8292 return false;
8293 }
8294
8297 {
8300
8302 {
8304 }
8305 else
8306 {
8307
8309 }
8310
8312 }
8313
8320 {
8321 return -1;
8322 }
8323
8324
8325
8326
8328 {
8330 {
8331 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8332 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8333
8334 if (r_index >= 0)
8335 {
8336 InventoryLocation r_il = new InventoryLocation;
8337 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8338
8339 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8342 {
8343 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8344 }
8346 {
8347 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8348 }
8349
8350 }
8351
8352 player.GetHumanInventory().ClearUserReservedLocation(this);
8353 }
8354
8357 }
8358
8359
8360
8361
8363 {
8364 return ItemBase.m_DebugActionsMask;
8365 }
8366
8368 {
8369 return ItemBase.m_DebugActionsMask & mask;
8370 }
8371
8373 {
8374 ItemBase.m_DebugActionsMask = mask;
8375 }
8376
8378 {
8379 ItemBase.m_DebugActionsMask |= mask;
8380 }
8381
8383 {
8384 ItemBase.m_DebugActionsMask &= ~mask;
8385 }
8386
8388 {
8390 {
8392 }
8393 else
8394 {
8396 }
8397 }
8398
8399
8401 {
8402 if (GetEconomyProfile())
8403 {
8404 float q_max = GetEconomyProfile().GetQuantityMax();
8405 if (q_max > 0)
8406 {
8407 float q_min = GetEconomyProfile().GetQuantityMin();
8408 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8409
8411 {
8412 ComponentEnergyManager comp = GetCompEM();
8414 {
8416 }
8417 }
8419 {
8421
8422 }
8423
8424 }
8425 }
8426 }
8427
8430 {
8431 EntityAI parent = GetHierarchyParent();
8432
8433 if (parent)
8434 {
8435 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8436 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8437 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8438 }
8439 }
8440
8443 {
8444 EntityAI parent = GetHierarchyParent();
8445
8446 if (parent)
8447 {
8448 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8449 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8450 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8451 }
8452 }
8453
8455 {
8456
8457
8458
8459
8461
8463 {
8464 if (ScriptInputUserData.CanStoreInputUserData())
8465 {
8466 ScriptInputUserData ctx = new ScriptInputUserData;
8472 ctx.
Write(use_stack_max);
8475
8477 {
8478 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8479 }
8480 }
8481 }
8482 else if (!
g_Game.IsMultiplayer())
8483 {
8485 }
8486 }
8487
8489 {
8491 }
8492
8494 {
8496 }
8497
8499 {
8501 }
8502
8504 {
8505
8506 return false;
8507 }
8508
8510 {
8511 return false;
8512 }
8513
8517 {
8518 return false;
8519 }
8520
8522 {
8523 return "";
8524 }
8525
8527
8529 {
8530 return false;
8531 }
8532
8534 {
8535 return true;
8536 }
8537
8538
8539
8541 {
8542 return true;
8543 }
8544
8546 {
8547 return true;
8548 }
8549
8551 {
8552 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8554 }
8555
8557 {
8559 }
8560
8562 {
8564 if (!is_being_placed)
8566 SetSynchDirty();
8567 }
8568
8569
8571
8573 {
8575 }
8576
8578 {
8580 }
8581
8583 {
8584 return 1;
8585 }
8586
8588 {
8589 return false;
8590 }
8591
8593 {
8595 SetSynchDirty();
8596 }
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8615
8616
8617
8618
8619
8620
8621
8622
8623
8624
8625
8626
8627
8628
8629
8630
8631
8633 {
8634 super.OnMovedInsideCargo(container);
8635
8636 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8637 }
8638
8639 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8640 {
8641 super.EEItemLocationChanged(oldLoc, newLoc);
8642
8643 PlayerBase newPlayer = null;
8644 PlayerBase oldPlayer = null;
8645
8646 if (newLoc.GetParent())
8647 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8648
8649 if (oldLoc.GetParent())
8650 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8651
8653 {
8654 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8655
8656 if (rIndex >= 0)
8657 {
8658 InventoryLocation rIl = new InventoryLocation;
8659 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8660
8661 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8664 {
8665 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8666 }
8668 {
8670 }
8671
8672 }
8673 }
8674
8676 {
8677 if (newPlayer)
8678 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8679
8680 if (newPlayer == oldPlayer)
8681 {
8682 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8683 {
8685 {
8686 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8687 {
8688 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8689 }
8690 }
8691 else
8692 {
8693 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8694 }
8695 }
8696
8697 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8698 {
8699 int type = oldLoc.GetType();
8701 {
8702 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8703 }
8705 {
8706 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8707 }
8708 }
8709 if (!m_OldLocation)
8710 {
8711 m_OldLocation = new InventoryLocation;
8712 }
8713 m_OldLocation.Copy(oldLoc);
8714 }
8715 else
8716 {
8717 if (m_OldLocation)
8718 {
8719 m_OldLocation.Reset();
8720 }
8721 }
8722
8723 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8724 }
8725 else
8726 {
8727 if (newPlayer)
8728 {
8729 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8730 if (resIndex >= 0)
8731 {
8732 InventoryLocation il = new InventoryLocation;
8733 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8735 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8738 {
8739 il.
GetParent().GetOnReleaseLock().Invoke(it);
8740 }
8742 {
8744 }
8745
8746 }
8747 }
8749 {
8750
8752 }
8753
8754 if (m_OldLocation)
8755 {
8756 m_OldLocation.Reset();
8757 }
8758 }
8759
8761 {
8762 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8763 }
8764
8766 {
8767 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8768 }
8769 }
8770
8771 override void EOnContact(IEntity other, Contact extra)
8772 {
8774 {
8775 int liquidType = -1;
8777 if (impactSpeed > 0.0)
8778 {
8780 #ifndef SERVER
8782 #else
8784 SetSynchDirty();
8785 #endif
8787 }
8788 }
8789
8790 #ifdef SERVER
8791 if (GetCompEM() && GetCompEM().IsPlugged())
8792 {
8793 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8794 GetCompEM().UnplugThis();
8795 }
8796 #endif
8797 }
8798
8800
8802 {
8804 }
8805
8807 {
8808
8809 }
8810
8812 {
8813 super.OnItemLocationChanged(old_owner, new_owner);
8814
8815 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8816 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8817
8818 if (!relatedPlayer && playerNew)
8819 relatedPlayer = playerNew;
8820
8821 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8822 {
8824 if (actionMgr)
8825 {
8826 ActionBase currentAction = actionMgr.GetRunningAction();
8827 if (currentAction)
8829 }
8830 }
8831
8832 Man ownerPlayerOld = null;
8833 Man ownerPlayerNew = null;
8834
8835 if (old_owner)
8836 {
8837 if (old_owner.
IsMan())
8838 {
8839 ownerPlayerOld = Man.Cast(old_owner);
8840 }
8841 else
8842 {
8843 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8844 }
8845 }
8846 else
8847 {
8849 {
8851
8852 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8853 {
8854 GetCompEM().UnplugThis();
8855 }
8856 }
8857 }
8858
8859 if (new_owner)
8860 {
8861 if (new_owner.
IsMan())
8862 {
8863 ownerPlayerNew = Man.Cast(new_owner);
8864 }
8865 else
8866 {
8867 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8868 }
8869 }
8870
8871 if (ownerPlayerOld != ownerPlayerNew)
8872 {
8873 if (ownerPlayerOld)
8874 {
8875 array<EntityAI> subItemsExit = new array<EntityAI>;
8877 for (int i = 0; i < subItemsExit.Count(); i++)
8878 {
8881 }
8882 }
8883
8884 if (ownerPlayerNew)
8885 {
8886 array<EntityAI> subItemsEnter = new array<EntityAI>;
8888 for (int j = 0; j < subItemsEnter.Count(); j++)
8889 {
8892 }
8893 }
8894 }
8895 else if (ownerPlayerNew != null)
8896 {
8897 PlayerBase nplayer;
8898 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8899 {
8900 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8902 for (int k = 0; k < subItemsUpdate.Count(); k++)
8903 {
8905 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8906 }
8907 }
8908 }
8909
8910 if (old_owner)
8911 old_owner.OnChildItemRemoved(this);
8912 if (new_owner)
8913 new_owner.OnChildItemReceived(this);
8914 }
8915
8916
8918 {
8919 super.EEDelete(parent);
8920 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8921 if (player)
8922 {
8924
8925 if (player.IsAlive())
8926 {
8927 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8928 if (r_index >= 0)
8929 {
8930 InventoryLocation r_il = new InventoryLocation;
8931 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8932
8933 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8936 {
8937 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8938 }
8940 {
8941 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8942 }
8943
8944 }
8945
8946 player.RemoveQuickBarEntityShortcut(this);
8947 }
8948 }
8949 }
8950
8952 {
8953 super.EEKilled(killer);
8954
8957 {
8958 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8959 {
8960 if (IsMagazine())
8961 {
8962 if (Magazine.Cast(this).GetAmmoCount() > 0)
8963 {
8965 }
8966 }
8967 else
8968 {
8970 }
8971 }
8972 }
8973 }
8974
8976 {
8977 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8978
8979 super.OnWasAttached(parent, slot_id);
8980
8983
8986 }
8987
8989 {
8990 super.OnWasDetached(parent, slot_id);
8991
8994
8997 }
8998
9000 {
9001 int idx;
9004
9005 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9006 if (inventory_slots.Count() < 1)
9007 {
9008 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9009 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9010 }
9011 else
9012 {
9013 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9014 }
9015
9016 idx = inventory_slots.Find(slot);
9017 if (idx < 0)
9018 return "";
9019
9020 return attach_types.Get(idx);
9021 }
9022
9024 {
9025 int idx = -1;
9026 string slot;
9027
9030
9031 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9032 if (inventory_slots.Count() < 1)
9033 {
9034 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9035 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9036 }
9037 else
9038 {
9039 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9040 if (detach_types.Count() < 1)
9041 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9042 }
9043
9044 for (int i = 0; i < inventory_slots.Count(); i++)
9045 {
9046 slot = inventory_slots.Get(i);
9047 }
9048
9049 if (slot != "")
9050 {
9051 if (detach_types.Count() == 1)
9052 idx = 0;
9053 else
9054 idx = inventory_slots.Find(slot);
9055 }
9056 if (idx < 0)
9057 return "";
9058
9059 return detach_types.Get(idx);
9060 }
9061
9063 {
9064
9066
9067
9068 float min_time = 1;
9069 float max_time = 3;
9070 float delay = Math.RandomFloat(min_time, max_time);
9071
9072 explode_timer.Run(delay, this, "DoAmmoExplosion");
9073 }
9074
9076 {
9077 Magazine magazine = Magazine.Cast(this);
9078 int pop_sounds_count = 6;
9079 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9080
9081
9082 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9083 string sound_name = pop_sounds[ sound_idx ];
9084 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9085
9086
9087 magazine.ServerAddAmmoCount(-1);
9088
9089
9090 float min_temp_to_explode = 100;
9091
9092 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9093 {
9095 }
9096 }
9097
9098
9099 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9100 {
9101 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9102
9103 const int CHANCE_DAMAGE_CARGO = 4;
9104 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9105 const int CHANCE_DAMAGE_NOTHING = 2;
9106
9108 {
9109 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9110 int chances;
9111 int rnd;
9112
9113 if (GetInventory().GetCargo())
9114 {
9115 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9116 rnd = Math.RandomInt(0,chances);
9117
9118 if (rnd < CHANCE_DAMAGE_CARGO)
9119 {
9121 }
9122 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9123 {
9125 }
9126 }
9127 else
9128 {
9129 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9130 rnd = Math.RandomInt(0,chances);
9131
9132 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9133 {
9135 }
9136 }
9137 }
9138 }
9139
9141 {
9142 CargoBase cargo = GetInventory().GetCargo();
9143 if (cargo)
9144 {
9146 if (item_count > 0)
9147 {
9148 int random_pick = Math.RandomInt(0, item_count);
9150 if (!item.IsExplosive())
9151 {
9152 item.AddHealth("","",damage);
9153 return true;
9154 }
9155 }
9156 }
9157 return false;
9158 }
9159
9161 {
9162 GameInventory inventory = GetInventory();
9164 if (attachment_count > 0)
9165 {
9166 int random_pick = Math.RandomInt(0, attachment_count);
9168 if (!attachment.IsExplosive())
9169 {
9170 attachment.AddHealth("","",damage);
9171 return true;
9172 }
9173 }
9174 return false;
9175 }
9176
9178 {
9180 }
9181
9183 {
9185 return GetInventory().CanRemoveEntity();
9186
9187 return false;
9188 }
9189
9191 {
9192
9194 return false;
9195
9196
9198 return false;
9199
9200
9201
9203 if (delta == 0)
9204 return false;
9205
9206
9207 return true;
9208 }
9209
9211 {
9213 {
9214 if (ScriptInputUserData.CanStoreInputUserData())
9215 {
9216 ScriptInputUserData ctx = new ScriptInputUserData;
9221 ctx.
Write(destination_entity);
9225 }
9226 }
9227 else if (!
g_Game.IsMultiplayer())
9228 {
9230 }
9231 }
9232
9234 {
9235 float split_quantity_new;
9239 InventoryLocation loc = new InventoryLocation;
9240
9241 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9242 {
9244 split_quantity_new = stack_max;
9245 else
9247
9249 {
9250 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9251 if (new_item)
9252 {
9253 new_item.SetResultOfSplit(true);
9254 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9256 new_item.
SetQuantity(split_quantity_new,
false,
true);
9257 }
9258 }
9259 }
9260 else if (destination_entity && slot_id == -1)
9261 {
9262 if (quantity > stack_max)
9263 split_quantity_new = stack_max;
9264 else
9265 split_quantity_new = quantity;
9266
9268 {
9269 GameInventory destinationInventory = destination_entity.GetInventory();
9271 {
9274 }
9275
9276 if (new_item)
9277 {
9278 new_item.SetResultOfSplit(true);
9279 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9281 new_item.
SetQuantity(split_quantity_new,
false,
true);
9282 }
9283 }
9284 }
9285 else
9286 {
9287 if (stack_max != 0)
9288 {
9290 {
9292 }
9293
9294 if (split_quantity_new == 0)
9295 {
9296 if (!
g_Game.IsMultiplayer())
9297 player.PhysicalPredictiveDropItem(this);
9298 else
9299 player.ServerDropEntity(this);
9300 return;
9301 }
9302
9304 {
9306
9307 if (new_item)
9308 {
9309 new_item.SetResultOfSplit(true);
9310 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9313 new_item.PlaceOnSurface();
9314 }
9315 }
9316 }
9317 }
9318 }
9319
9321 {
9322 float split_quantity_new;
9326 InventoryLocation loc = new InventoryLocation;
9327
9328 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9329 {
9331 split_quantity_new = stack_max;
9332 else
9334
9336 {
9337 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9338 if (new_item)
9339 {
9340 new_item.SetResultOfSplit(true);
9341 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9343 new_item.
SetQuantity(split_quantity_new,
false,
true);
9344 }
9345 }
9346 }
9347 else if (destination_entity && slot_id == -1)
9348 {
9349 if (quantity > stack_max)
9350 split_quantity_new = stack_max;
9351 else
9352 split_quantity_new = quantity;
9353
9355 {
9356 GameInventory destinationInventory = destination_entity.GetInventory();
9358 {
9361 }
9362
9363 if (new_item)
9364 {
9365 new_item.SetResultOfSplit(true);
9366 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9368 new_item.
SetQuantity(split_quantity_new,
false,
true);
9369 }
9370 }
9371 }
9372 else
9373 {
9374 if (stack_max != 0)
9375 {
9377 {
9379 }
9380
9382 {
9384
9385 if (new_item)
9386 {
9387 new_item.SetResultOfSplit(true);
9388 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9391 new_item.PlaceOnSurface();
9392 }
9393 }
9394 }
9395 }
9396 }
9397
9399 {
9401 {
9402 if (ScriptInputUserData.CanStoreInputUserData())
9403 {
9404 ScriptInputUserData ctx = new ScriptInputUserData;
9409 dst.WriteToContext(ctx);
9411 }
9412 }
9413 else if (!
g_Game.IsMultiplayer())
9414 {
9416 }
9417 }
9418
9420 {
9422 {
9423 if (ScriptInputUserData.CanStoreInputUserData())
9424 {
9425 ScriptInputUserData ctx = new ScriptInputUserData;
9430 ctx.
Write(destination_entity);
9436 }
9437 }
9438 else if (!
g_Game.IsMultiplayer())
9439 {
9441 }
9442 }
9443
9445 {
9447 }
9448
9450 {
9452 float split_quantity_new;
9454 if (dst.IsValid())
9455 {
9456 int slot_id = dst.GetSlot();
9458
9459 if (quantity > stack_max)
9460 split_quantity_new = stack_max;
9461 else
9462 split_quantity_new = quantity;
9463
9465 {
9467
9468 if (new_item)
9469 {
9470 new_item.SetResultOfSplit(true);
9471 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9473 new_item.
SetQuantity(split_quantity_new,
false,
true);
9474 }
9475
9476 return new_item;
9477 }
9478 }
9479
9480 return null;
9481 }
9482
9484 {
9486 float split_quantity_new;
9488 if (destination_entity)
9489 {
9491 if (quantity > stackable)
9492 split_quantity_new = stackable;
9493 else
9494 split_quantity_new = quantity;
9495
9497 {
9498 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9499 if (new_item)
9500 {
9501 new_item.SetResultOfSplit(true);
9502 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9504 new_item.
SetQuantity(split_quantity_new,
false,
true);
9505 }
9506 }
9507 }
9508 }
9509
9511 {
9513 {
9514 if (ScriptInputUserData.CanStoreInputUserData())
9515 {
9516 ScriptInputUserData ctx = new ScriptInputUserData;
9521 ItemBase destination_entity =
this;
9522 ctx.
Write(destination_entity);
9526 }
9527 }
9528 else if (!
g_Game.IsMultiplayer())
9529 {
9531 }
9532 }
9533
9535 {
9537 float split_quantity_new;
9539 if (player)
9540 {
9542 if (quantity > stackable)
9543 split_quantity_new = stackable;
9544 else
9545 split_quantity_new = quantity;
9546
9548 {
9549 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9550 new_item =
ItemBase.Cast(in_hands);
9551 if (new_item)
9552 {
9553 new_item.SetResultOfSplit(true);
9554 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9556 new_item.SetQuantity(split_quantity_new, false, true);
9557 }
9558 }
9559 }
9560 }
9561
9563 {
9565 float split_quantity_new = Math.Floor(quantity * 0.5);
9566
9568 return;
9569
9571
9572 if (new_item)
9573 {
9574 if (new_item.GetQuantityMax() < split_quantity_new)
9575 {
9576 split_quantity_new = new_item.GetQuantityMax();
9577 }
9578
9579 new_item.SetResultOfSplit(true);
9580 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9581
9583 {
9586 }
9587 else
9588 {
9590 new_item.
SetQuantity(split_quantity_new,
false,
true);
9591 }
9592 }
9593 }
9594
9596 {
9598 float split_quantity_new = Math.Floor(quantity / 2);
9599
9601 return;
9602
9603 InventoryLocation invloc = new InventoryLocation;
9605
9607 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9608
9609 if (new_item)
9610 {
9611 if (new_item.GetQuantityMax() < split_quantity_new)
9612 {
9613 split_quantity_new = new_item.GetQuantityMax();
9614 }
9616 {
9619 }
9620 else if (split_quantity_new > 1)
9621 {
9623 new_item.
SetQuantity(split_quantity_new,
false,
true);
9624 }
9625 }
9626 }
9627
9630 {
9631 SetWeightDirty();
9633
9634 if (parent)
9635 parent.OnAttachmentQuantityChangedEx(this, delta);
9636
9638 {
9640 {
9642 }
9644 {
9645 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9647 }
9648 }
9649 }
9650
9653 {
9654
9655 }
9656
9659 {
9661 }
9662
9664 {
9665 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9666
9668 {
9669 if (newLevel == GameConstants.STATE_RUINED)
9670 {
9672 EntityAI parent = GetHierarchyParent();
9673 if (parent && parent.IsFireplace())
9674 {
9675 CargoBase cargo = GetInventory().GetCargo();
9676 if (cargo)
9677 {
9679 {
9681 }
9682 }
9683 }
9684 }
9685
9687 {
9688
9690 return;
9691 }
9692
9693 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9694 {
9696 }
9697 }
9698 }
9699
9700
9702 {
9703 super.OnRightClick();
9704
9706 {
9708 {
9709 if (ScriptInputUserData.CanStoreInputUserData())
9710 {
9711 EntityAI root = GetHierarchyRoot();
9712 Man playerOwner = GetHierarchyRootPlayer();
9713 InventoryLocation dst = new InventoryLocation;
9714
9715
9716 if (!playerOwner && root && root == this)
9717 {
9719 }
9720 else
9721 {
9722
9723 GetInventory().GetCurrentInventoryLocation(dst);
9725 {
9726 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9728 {
9730 }
9731 else
9732 {
9734
9735
9736 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9737 {
9739 }
9740 else
9741 {
9742 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9743 }
9744 }
9745 }
9746 }
9747
9748 ScriptInputUserData ctx = new ScriptInputUserData;
9756 }
9757 }
9758 else if (!
g_Game.IsMultiplayer())
9759 {
9761 }
9762 }
9763 }
9764
9766 {
9767 if (root)
9768 {
9769 vector m4[4];
9770 root.GetTransform(m4);
9771 dst.SetGround(this, m4);
9772 }
9773 else
9774 {
9775 GetInventory().GetCurrentInventoryLocation(dst);
9776 }
9777 }
9778
9779 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9780 {
9781
9782 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9783 return false;
9784
9785 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9786 return false;
9787
9788
9790 return false;
9791
9792
9793 Magazine mag = Magazine.Cast(this);
9794 if (mag)
9795 {
9796 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9797 return false;
9798
9799 if (stack_max_limit)
9800 {
9801 Magazine other_mag = Magazine.Cast(other_item);
9802 if (other_item)
9803 {
9804 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9805 return false;
9806 }
9807
9808 }
9809 }
9810 else
9811 {
9812
9814 return false;
9815
9817 return false;
9818 }
9819
9820 PlayerBase player = null;
9821 if (CastTo(player, GetHierarchyRootPlayer()))
9822 {
9823 if (player.GetInventory().HasAttachment(this))
9824 return false;
9825
9826 if (player.IsItemsToDelete())
9827 return false;
9828 }
9829
9830 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9831 return false;
9832
9833 int slotID;
9835 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9836 return false;
9837
9838 return true;
9839 }
9840
9842 {
9844 }
9845
9847 {
9848 return m_IsResultOfSplit;
9849 }
9850
9852 {
9853 m_IsResultOfSplit = value;
9854 }
9855
9857 {
9859 }
9860
9862 {
9863 float other_item_quantity = other_item.GetQuantity();
9864 float this_free_space;
9865
9867
9869
9870 if (other_item_quantity > this_free_space)
9871 {
9872 return this_free_space;
9873 }
9874 else
9875 {
9876 return other_item_quantity;
9877 }
9878 }
9879
9881 {
9883 }
9884
9886 {
9888 return;
9889
9890 if (!IsMagazine() && other_item)
9891 {
9893 if (quantity_used != 0)
9894 {
9895 float hp1 = GetHealth01("","");
9896 float hp2 = other_item.GetHealth01("","");
9897 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9898 hpResult = hpResult / (
GetQuantity() + quantity_used);
9899
9900 hpResult *= GetMaxHealth();
9901 Math.Round(hpResult);
9902 SetHealth("", "Health", hpResult);
9903
9905 other_item.AddQuantity(-quantity_used);
9906 }
9907 }
9909 }
9910
9912 {
9913 #ifdef SERVER
9914 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9915 GetHierarchyParent().IncreaseLifetimeUp();
9916 #endif
9917 };
9918
9920 {
9921 PlayerBase p = PlayerBase.Cast(player);
9922
9923 array<int> recipesIds = p.m_Recipes;
9924 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9925 if (moduleRecipesManager)
9926 {
9927 EntityAI itemInHands = player.GetEntityInHands();
9928 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9929 }
9930
9931 for (int i = 0;i < recipesIds.Count(); i++)
9932 {
9933 int key = recipesIds.Get(i);
9934 string recipeName = moduleRecipesManager.GetRecipeName(key);
9936 }
9937 }
9938
9939
9940 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9941 {
9942 super.GetDebugActions(outputList);
9943
9944
9950
9951
9956
9961
9962
9966
9967
9969 {
9973 }
9974
9977
9978
9982
9984
9985 InventoryLocation loc = new InventoryLocation();
9986 GetInventory().GetCurrentInventoryLocation(loc);
9988 {
9989 if (Gizmo_IsSupported())
9992 }
9993
9995 }
9996
9997
9998
9999
10001 {
10002 super.OnAction(action_id, player, ctx);
10003
10005 {
10006 switch (action_id)
10007 {
10011 return true;
10015 return true;
10016 }
10017 }
10018
10020 {
10021 switch (action_id)
10022 {
10024 Delete();
10025 return true;
10026 }
10027 }
10028
10029 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10030 {
10031 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10032 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10033 PlayerBase p = PlayerBase.Cast(player);
10034 if (
EActions.RECIPES_RANGE_START < 1000)
10035 {
10036 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10037 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10038 }
10039 }
10040 #ifndef SERVER
10041 else if (action_id ==
EActions.WATCH_PLAYER)
10042 {
10043 PluginDeveloper.SetDeveloperItemClientEx(player);
10044 }
10045 #endif
10047 {
10048 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10049 {
10050 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10051 OnDebugButtonPressServer(id + 1);
10052 }
10053
10054 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10055 {
10056 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10058 }
10059
10060 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10061 {
10062 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10064 }
10065
10066 else if (action_id ==
EActions.ADD_QUANTITY)
10067 {
10068 if (IsMagazine())
10069 {
10070 Magazine mag = Magazine.Cast(this);
10071 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10072 }
10073 else
10074 {
10076 }
10077
10078 if (m_EM)
10079 {
10080 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10081 }
10082
10083 }
10084
10085 else if (action_id ==
EActions.REMOVE_QUANTITY)
10086 {
10087 if (IsMagazine())
10088 {
10089 Magazine mag2 = Magazine.Cast(this);
10090 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10091 }
10092 else
10093 {
10095 }
10096 if (m_EM)
10097 {
10098 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10099 }
10100
10101 }
10102
10103 else if (action_id ==
EActions.SET_QUANTITY_0)
10104 {
10106
10107 if (m_EM)
10108 {
10109 m_EM.SetEnergy(0);
10110 }
10111 }
10112
10113 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10114 {
10116
10117 if (m_EM)
10118 {
10119 m_EM.SetEnergy(m_EM.GetEnergyMax());
10120 }
10121 }
10122
10123 else if (action_id ==
EActions.ADD_HEALTH)
10124 {
10125 AddHealth("","",GetMaxHealth("","Health")/5);
10126 }
10127 else if (action_id ==
EActions.REMOVE_HEALTH)
10128 {
10129 AddHealth("","",-GetMaxHealth("","Health")/5);
10130 }
10131 else if (action_id ==
EActions.DESTROY_HEALTH)
10132 {
10133 SetHealth01("","",0);
10134 }
10135 else if (action_id ==
EActions.WATCH_ITEM)
10136 {
10138 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10139 #ifdef DEVELOPER
10140 SetDebugDeveloper_item(this);
10141 #endif
10142 }
10143
10144 else if (action_id ==
EActions.ADD_TEMPERATURE)
10145 {
10146 AddTemperature(20);
10147
10148 }
10149
10150 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10151 {
10152 AddTemperature(-20);
10153
10154 }
10155
10156 else if (action_id ==
EActions.FLIP_FROZEN)
10157 {
10158 SetFrozen(!GetIsFrozen());
10159
10160 }
10161
10162 else if (action_id ==
EActions.ADD_WETNESS)
10163 {
10165
10166 }
10167
10168 else if (action_id ==
EActions.REMOVE_WETNESS)
10169 {
10171
10172 }
10173
10174 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10175 {
10178
10179
10180 }
10181
10182 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10183 {
10186 }
10187
10188 else if (action_id ==
EActions.MAKE_SPECIAL)
10189 {
10190 auto debugParams = DebugSpawnParams.WithPlayer(player);
10191 OnDebugSpawnEx(debugParams);
10192 }
10193
10194 }
10195
10196
10197 return false;
10198 }
10199
10200
10201
10202
10206
10209
10210
10211
10213 {
10214 return false;
10215 }
10216
10217
10219 {
10220 return true;
10221 }
10222
10223
10225 {
10226 return true;
10227 }
10228
10229
10230
10232 {
10233 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10234 return g_Game.ConfigIsExisting(config_path);
10235 }
10236
10239 {
10240 return null;
10241 }
10242
10244 {
10245 return false;
10246 }
10247
10249 {
10250 return false;
10251 }
10252
10256
10257
10259 {
10260 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10261 return module_repairing.CanRepair(this, item_repair_kit);
10262 }
10263
10264
10265 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10266 {
10267 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10268 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10269 }
10270
10271
10273 {
10274
10275
10276
10277
10278
10279
10280
10281
10282 return 1;
10283 }
10284
10285
10286
10288 {
10290 }
10291
10292
10293
10295 {
10297 }
10298
10299
10308 {
10309 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10310
10311 if (player)
10312 {
10313 player.MessageStatus(text);
10314 }
10315 }
10316
10317
10326 {
10327 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10328
10329 if (player)
10330 {
10331 player.MessageAction(text);
10332 }
10333 }
10334
10335
10344 {
10345 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10346
10347 if (player)
10348 {
10349 player.MessageFriendly(text);
10350 }
10351 }
10352
10353
10362 {
10363 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10364
10365 if (player)
10366 {
10367 player.MessageImportant(text);
10368 }
10369 }
10370
10372 {
10373 return true;
10374 }
10375
10376
10377 override bool KindOf(
string tag)
10378 {
10379 bool found = false;
10380 string item_name = this.
GetType();
10382 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10383
10384 int array_size = item_tag_array.Count();
10385 for (int i = 0; i < array_size; i++)
10386 {
10387 if (item_tag_array.Get(i) == tag)
10388 {
10389 found = true;
10390 break;
10391 }
10392 }
10393 return found;
10394 }
10395
10396
10398 {
10399
10400 super.OnRPC(sender, rpc_type,ctx);
10401
10402
10403 switch (rpc_type)
10404 {
10405 #ifndef SERVER
10406 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10407 Param2<bool, string> p = new Param2<bool, string>(false, "");
10408
10410 return;
10411
10412 bool play = p.param1;
10413 string soundSet = p.param2;
10414
10415 if (play)
10416 {
10418 {
10420 {
10422 }
10423 }
10424 else
10425 {
10427 }
10428 }
10429 else
10430 {
10432 }
10433
10434 break;
10435 #endif
10436
10437 }
10438
10440 {
10442 }
10443 }
10444
10445
10446
10447
10449 {
10450 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10451 return plugin.GetID(
name);
10452 }
10453
10455 {
10456 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10457 return plugin.GetName(id);
10458 }
10459
10462 {
10463
10464
10465 int varFlags;
10466 if (!ctx.
Read(varFlags))
10467 return;
10468
10469 if (varFlags & ItemVariableFlags.FLOAT)
10470 {
10472 }
10473 }
10474
10476 {
10477
10478 super.SerializeNumericalVars(floats_out);
10479
10480
10481
10483 {
10485 }
10486
10488 {
10490 }
10491
10493 {
10495 }
10496
10498 {
10503 }
10504
10506 {
10508 }
10509 }
10510
10512 {
10513
10514 super.DeSerializeNumericalVars(floats);
10515
10516
10517 int index = 0;
10518 int mask = Math.Round(floats.Get(index));
10519
10520 index++;
10521
10523 {
10525 {
10527 }
10528 else
10529 {
10530 float quantity = floats.Get(index);
10531 SetQuantity(quantity,
true,
false,
false,
false);
10532 }
10533 index++;
10534 }
10535
10537 {
10538 float wet = floats.Get(index);
10540 index++;
10541 }
10542
10544 {
10545 int liquidtype = Math.Round(floats.Get(index));
10547 index++;
10548 }
10549
10551 {
10553 index++;
10555 index++;
10557 index++;
10559 index++;
10560 }
10561
10563 {
10564 int cleanness = Math.Round(floats.Get(index));
10566 index++;
10567 }
10568 }
10569
10571 {
10572 super.WriteVarsToCTX(ctx);
10573
10574
10576 {
10578 }
10579
10581 {
10583 }
10584
10586 {
10588 }
10589
10591 {
10592 int r,g,b,a;
10598 }
10599
10601 {
10603 }
10604 }
10605
10607 {
10608 if (!super.ReadVarsFromCTX(ctx,version))
10609 return false;
10610
10611 int intValue;
10612 float value;
10613
10614 if (version < 140)
10615 {
10616 if (!ctx.
Read(intValue))
10617 return false;
10618
10619 m_VariablesMask = intValue;
10620 }
10621
10623 {
10624 if (!ctx.
Read(value))
10625 return false;
10626
10628 {
10630 }
10631 else
10632 {
10634 }
10635 }
10636
10637 if (version < 140)
10638 {
10640 {
10641 if (!ctx.
Read(value))
10642 return false;
10643 SetTemperatureDirect(value);
10644 }
10645 }
10646
10648 {
10649 if (!ctx.
Read(value))
10650 return false;
10652 }
10653
10655 {
10656 if (!ctx.
Read(intValue))
10657 return false;
10659 }
10660
10662 {
10663 int r,g,b,a;
10665 return false;
10667 return false;
10669 return false;
10671 return false;
10672
10674 }
10675
10677 {
10678 if (!ctx.
Read(intValue))
10679 return false;
10681 }
10682
10683 if (version >= 138 && version < 140)
10684 {
10686 {
10687 if (!ctx.
Read(intValue))
10688 return false;
10689 SetFrozen(intValue);
10690 }
10691 }
10692
10693 return true;
10694 }
10695
10696
10698 {
10701 {
10703 }
10704
10705 if (!super.OnStoreLoad(ctx, version))
10706 {
10708 return false;
10709 }
10710
10711 if (version >= 114)
10712 {
10713 bool hasQuickBarIndexSaved;
10714
10715 if (!ctx.
Read(hasQuickBarIndexSaved))
10716 {
10718 return false;
10719 }
10720
10721 if (hasQuickBarIndexSaved)
10722 {
10723 int itmQBIndex;
10724
10725
10726 if (!ctx.
Read(itmQBIndex))
10727 {
10729 return false;
10730 }
10731
10732 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10733 if (itmQBIndex != -1 && parentPlayer)
10734 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10735 }
10736 }
10737 else
10738 {
10739
10740 PlayerBase player;
10741 int itemQBIndex;
10742 if (version ==
int.
MAX)
10743 {
10744 if (!ctx.
Read(itemQBIndex))
10745 {
10747 return false;
10748 }
10749 }
10750 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10751 {
10752
10753 if (!ctx.
Read(itemQBIndex))
10754 {
10756 return false;
10757 }
10758 if (itemQBIndex != -1 && player)
10759 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10760 }
10761 }
10762
10763 if (version < 140)
10764 {
10765
10766 if (!LoadVariables(ctx, version))
10767 {
10769 return false;
10770 }
10771 }
10772
10773
10775 {
10777 return false;
10778 }
10779 if (version >= 132)
10780 {
10782 if (raib)
10783 {
10785 {
10787 return false;
10788 }
10789 }
10790 }
10791
10793 return true;
10794 }
10795
10796
10797
10799 {
10800 super.OnStoreSave(ctx);
10801
10802 PlayerBase player;
10803 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10804 {
10806
10807 int itemQBIndex = -1;
10808 itemQBIndex = player.FindQuickBarEntityIndex(this);
10809 ctx.
Write(itemQBIndex);
10810 }
10811 else
10812 {
10814 }
10815
10817
10819 if (raib)
10820 {
10822 }
10823 }
10824
10825
10827 {
10828 super.AfterStoreLoad();
10829
10831 {
10833 }
10834
10836 {
10839 }
10840 }
10841
10843 {
10844 super.EEOnAfterLoad();
10845
10847 {
10849 }
10850
10853 }
10854
10856 {
10857 return false;
10858 }
10859
10860
10861
10863 {
10865 {
10866 #ifdef PLATFORM_CONSOLE
10867
10869 {
10871 if (menu)
10872 {
10874 }
10875 }
10876 #endif
10877 }
10878
10880 {
10883 }
10884
10886 {
10887 SetWeightDirty();
10889 }
10891 {
10894 }
10895
10897 {
10900
10903 }
10905 {
10909 }
10910
10911 super.OnVariablesSynchronized();
10912 }
10913
10914
10915
10917 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10918 {
10919 if (!IsServerCheck(allow_client))
10920 return false;
10921
10923 return false;
10924
10927
10928 if (value <= (min + 0.001))
10929 value = min;
10930
10931 if (value == min)
10932 {
10933 if (destroy_config)
10934 {
10935 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10936 if (dstr)
10937 {
10939 this.Delete();
10940 return true;
10941 }
10942 }
10943 else if (destroy_forced)
10944 {
10946 this.Delete();
10947 return true;
10948 }
10949
10951 }
10952
10955
10957 {
10958 EntityAI parent = GetHierarchyRoot();
10959 InventoryLocation iLoc = new InventoryLocation();
10960 GetInventory().GetCurrentInventoryLocation(iLoc);
10962 {
10963 int iLocSlot = iLoc.
GetSlot();
10965 {
10967 }
10969 {
10971 }
10972 }
10973 }
10974
10976 {
10978
10979 if (delta)
10981 }
10982
10984
10985 return false;
10986 }
10987
10988
10990 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10991 {
10993 }
10994
10996 {
10999 }
11000
11002 {
11005 }
11006
11008 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11009 {
11010 float value_clamped = Math.Clamp(value, 0, 1);
11012 SetQuantity(result, destroy_config, destroy_forced);
11013 }
11014
11015
11018 {
11020 }
11021
11023 {
11025 }
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11037 {
11038 int slot = -1;
11039 GameInventory inventory = GetInventory();
11040 if (inventory)
11041 {
11042 InventoryLocation il = new InventoryLocation;
11045 }
11046
11048 }
11049
11051 {
11052 float quantity_max = 0;
11053
11055 {
11056 if (attSlotID != -1)
11057 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11058
11059 if (quantity_max <= 0)
11061 }
11062
11063 if (quantity_max <= 0)
11065
11066 return quantity_max;
11067 }
11068
11070 {
11072 }
11073
11075 {
11077 }
11078
11079
11081 {
11083 }
11084
11086 {
11088 }
11089
11091 {
11093 }
11094
11095
11097 {
11098
11099 float weightEx = GetWeightEx();
11100 float special = GetInventoryAndCargoWeight();
11101 return weightEx - special;
11102 }
11103
11104
11106 {
11108 }
11109
11111 {
11113 {
11114 #ifdef DEVELOPER
11115 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11116 {
11117 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11119 }
11120 #endif
11121
11122 return GetQuantity() * GetConfigWeightModified();
11123 }
11124 else if (HasEnergyManager())
11125 {
11126 #ifdef DEVELOPER
11127 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11128 {
11129 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11130 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11131 }
11132 #endif
11133 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11134 }
11135 else
11136 {
11137 #ifdef DEVELOPER
11138 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11139 {
11140 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11141 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11142 }
11143 #endif
11144 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11145 }
11146 }
11147
11150 {
11151 int item_count = 0;
11153
11154 GameInventory inventory = GetInventory();
11155 CargoBase cargo = inventory.
GetCargo();
11156 if (cargo != NULL)
11157 {
11159 }
11160
11162 for (int i = 0; i < nAttachments; ++i)
11163 {
11165 if (item)
11166 item_count += item.GetNumberOfItems();
11167 }
11168 return item_count;
11169 }
11170
11173 {
11174 float weight = 0;
11175 float wetness = 1;
11176 if (include_wetness)
11179 {
11180 weight = wetness * m_ConfigWeight;
11181 }
11183 {
11184 weight = 1;
11185 }
11186 return weight;
11187 }
11188
11189
11190
11192 {
11193 GameInventory inventory = GetInventory();
11194 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11195 {
11196 array<EntityAI> items = new array<EntityAI>;
11198 for (int i = 0; i < items.Count(); ++i)
11199 {
11201 if (item)
11202 {
11203 g_Game.ObjectDelete(item);
11204 }
11205 }
11206 }
11207 }
11208
11209
11210
11211
11213 {
11214 float energy = 0;
11215 if (HasEnergyManager())
11216 {
11217 energy = GetCompEM().GetEnergy();
11218 }
11219 return energy;
11220 }
11221
11222
11224 {
11225 super.OnEnergyConsumed();
11226
11228 }
11229
11231 {
11232 super.OnEnergyAdded();
11233
11235 }
11236
11237
11239 {
11240 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11241 {
11243 {
11244 float energy_0to1 = GetCompEM().GetEnergy0To1();
11246 }
11247 }
11248 }
11249
11250
11252 {
11253 return ConfigGetFloat("heatIsolation");
11254 }
11255
11257 {
11259 }
11260
11262 {
11263 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11264 if (
g_Game.ConfigIsExisting(paramPath))
11265 return g_Game.ConfigGetFloat(paramPath);
11266
11267 return 0.0;
11268 }
11269
11271 {
11272 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11273 if (
g_Game.ConfigIsExisting(paramPath))
11274 return g_Game.ConfigGetFloat(paramPath);
11275
11276 return 0.0;
11277 }
11278
11279 override void SetWet(
float value,
bool allow_client =
false)
11280 {
11281 if (!IsServerCheck(allow_client))
11282 return;
11283
11286
11288
11289 m_VarWet = Math.Clamp(value, min, max);
11290
11292 {
11295 }
11296 }
11297
11298 override void AddWet(
float value)
11299 {
11301 }
11302
11304 {
11306 }
11307
11309 {
11311 }
11312
11314 {
11316 }
11317
11319 {
11321 }
11322
11324 {
11326 }
11327
11328 override void OnWetChanged(
float newVal,
float oldVal)
11329 {
11332 if (newLevel != oldLevel)
11333 {
11335 }
11336 }
11337
11339 {
11340 SetWeightDirty();
11341 }
11342
11344 {
11345 return GetWetLevelInternal(
m_VarWet);
11346 }
11347
11348
11349
11351 {
11353 }
11354
11356 {
11358 }
11359
11361 {
11363 }
11364
11366 {
11368 }
11369
11370
11371
11373 {
11374 if (ConfigIsExisting("itemModelLength"))
11375 {
11376 return ConfigGetFloat("itemModelLength");
11377 }
11378 return 0;
11379 }
11380
11382 {
11383 if (ConfigIsExisting("itemAttachOffset"))
11384 {
11385 return ConfigGetFloat("itemAttachOffset");
11386 }
11387 return 0;
11388 }
11389
11390 override void SetCleanness(
int value,
bool allow_client =
false)
11391 {
11392 if (!IsServerCheck(allow_client))
11393 return;
11394
11396
11398
11401 }
11402
11404 {
11406 }
11407
11409 {
11410 return true;
11411 }
11412
11413
11414
11415
11417 {
11419 }
11420
11422 {
11424 }
11425
11426
11427
11428
11429 override void SetColor(
int r,
int g,
int b,
int a)
11430 {
11436 }
11438 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11439 {
11444 }
11445
11447 {
11449 }
11450
11453 {
11454 int r,g,b,a;
11456 r = r/255;
11457 g = g/255;
11458 b = b/255;
11459 a = a/255;
11460 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11461 }
11462
11463
11464
11465 override void SetLiquidType(
int value,
bool allow_client =
false)
11466 {
11467 if (!IsServerCheck(allow_client))
11468 return;
11469
11474 }
11475
11477 {
11478 return ConfigGetInt("varLiquidTypeInit");
11479 }
11480
11482 {
11484 }
11485
11487 {
11489 SetFrozen(false);
11490 }
11491
11494 {
11495 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11496 }
11497
11498
11501 {
11502 PlayerBase nplayer;
11503 if (PlayerBase.CastTo(nplayer, player))
11504 {
11506 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11507 }
11508 }
11509
11510
11513 {
11514 PlayerBase nplayer;
11515 if (PlayerBase.CastTo(nplayer,player))
11516 {
11517 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11518 }
11519
11520 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11521
11522 if (HasEnergyManager())
11523 {
11524 GetCompEM().UpdatePlugState();
11525 }
11526 }
11527
11528
11530 {
11531 super.OnPlacementStarted(player);
11532
11534 }
11535
11536 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11537 {
11539 {
11540 m_AdminLog.OnPlacementComplete(player,
this);
11541 }
11542
11543 super.OnPlacementComplete(player, position, orientation);
11544 }
11545
11546
11547
11548
11549
11551 {
11553 {
11554 return true;
11555 }
11556 else
11557 {
11558 return false;
11559 }
11560 }
11561
11562
11564 {
11566 {
11568 }
11569 }
11570
11571
11573 {
11575 }
11576
11578 {
11580 }
11581
11582 override void InsertAgent(
int agent,
float count = 1)
11583 {
11584 if (count < 1)
11585 return;
11586
11588 }
11589
11592 {
11594 }
11595
11596
11598 {
11600 }
11601
11602
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619
11620
11621
11622
11623
11624
11625
11626
11627
11628
11629
11630
11631
11632
11633
11634
11635
11636
11637
11638
11639
11640
11641
11642
11644 {
11646 return false;
11647 return true;
11648 }
11649
11651 {
11652
11654 }
11655
11656
11659 {
11660 super.CheckForRoofLimited(timeTresholdMS);
11661
11662 float time =
g_Game.GetTime();
11663 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11664 {
11665 m_PreviousRoofTestTime = time;
11666 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11667 }
11668 }
11669
11670
11672 {
11674 {
11675 return 0;
11676 }
11677
11678 if (GetInventory().GetAttachmentSlotsCount() != 0)
11679 {
11680 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11681 if (filter)
11682 return filter.GetProtectionLevel(type, false, system);
11683 else
11684 return 0;
11685 }
11686
11687 string subclassPath, entryName;
11688
11689 switch (type)
11690 {
11692 entryName = "biological";
11693 break;
11695 entryName = "chemical";
11696 break;
11697 default:
11698 entryName = "biological";
11699 break;
11700 }
11701
11702 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11703
11704 return g_Game.ConfigGetFloat(subclassPath + entryName);
11705 }
11706
11707
11708
11711 {
11712 if (!IsMagazine())
11714
11716 }
11717
11718
11719
11720
11721
11726 {
11727 return true;
11728 }
11729
11731 {
11733 }
11734
11735
11736
11737
11738
11740 {
11741 if (parent)
11742 {
11743 if (parent.IsInherited(DayZInfected))
11744 return true;
11745
11746 if (!parent.IsRuined())
11747 return true;
11748 }
11749
11750 return true;
11751 }
11752
11754 {
11755 if (!super.CanPutAsAttachment(parent))
11756 {
11757 return false;
11758 }
11759
11760 if (!IsRuined() && !parent.IsRuined())
11761 {
11762 return true;
11763 }
11764
11765 return false;
11766 }
11767
11769 {
11770
11771
11772
11773
11774 return super.CanReceiveItemIntoCargo(item);
11775 }
11776
11778 {
11779
11780
11781
11782
11783 GameInventory attachmentInv = attachment.GetInventory();
11785 {
11786 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11787 return false;
11788 }
11789
11790 InventoryLocation loc = new InventoryLocation();
11791 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11792 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11793 return false;
11794
11795 return super.CanReceiveAttachment(attachment, slotId);
11796 }
11797
11799 {
11800 if (!super.CanReleaseAttachment(attachment))
11801 return false;
11802
11803 return GetInventory().AreChildrenAccessible();
11804 }
11805
11806
11807
11808
11809
11810
11811
11812
11813
11814
11815
11816
11817
11818
11819
11820
11821
11822
11823
11824
11825
11827 {
11828 int id = muzzle_owner.GetMuzzleID();
11829 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11830
11831 if (WPOF_array)
11832 {
11833 for (int i = 0; i < WPOF_array.Count(); i++)
11834 {
11835 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11836
11837 if (WPOF)
11838 {
11839 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11840 }
11841 }
11842 }
11843 }
11844
11845
11847 {
11848 int id = muzzle_owner.GetMuzzleID();
11850
11851 if (WPOBE_array)
11852 {
11853 for (int i = 0; i < WPOBE_array.Count(); i++)
11854 {
11855 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11856
11857 if (WPOBE)
11858 {
11859 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11860 }
11861 }
11862 }
11863 }
11864
11865
11867 {
11868 int id = muzzle_owner.GetMuzzleID();
11869 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11870
11871 if (WPOOH_array)
11872 {
11873 for (int i = 0; i < WPOOH_array.Count(); i++)
11874 {
11875 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11876
11877 if (WPOOH)
11878 {
11879 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11880 }
11881 }
11882 }
11883 }
11884
11885
11887 {
11888 int id = muzzle_owner.GetMuzzleID();
11889 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11890
11891 if (WPOOH_array)
11892 {
11893 for (int i = 0; i < WPOOH_array.Count(); i++)
11894 {
11895 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11896
11897 if (WPOOH)
11898 {
11899 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11900 }
11901 }
11902 }
11903 }
11904
11905
11907 {
11908 int id = muzzle_owner.GetMuzzleID();
11909 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11910
11911 if (WPOOH_array)
11912 {
11913 for (int i = 0; i < WPOOH_array.Count(); i++)
11914 {
11915 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11916
11917 if (WPOOH)
11918 {
11919 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11920 }
11921 }
11922 }
11923 }
11924
11925
11926
11928 {
11930 {
11931 return true;
11932 }
11933
11934 return false;
11935 }
11936
11938 {
11940 {
11941 return true;
11942 }
11943
11944 return false;
11945 }
11946
11948 {
11950 {
11951 return true;
11952 }
11953
11954 return false;
11955 }
11956
11958 {
11959 return false;
11960 }
11961
11964 {
11965 return UATimeSpent.DEFAULT_DEPLOY;
11966 }
11967
11968
11969
11970
11972 {
11974 SetSynchDirty();
11975 }
11976
11978 {
11980 }
11981
11982
11984 {
11985 return false;
11986 }
11987
11990 {
11991 string att_type = "None";
11992
11993 if (ConfigIsExisting("soundAttType"))
11994 {
11995 att_type = ConfigGetString("soundAttType");
11996 }
11997
11999 }
12000
12002 {
12004 }
12005
12006
12007
12008
12009
12015
12017 {
12020
12022 }
12023
12024
12026 {
12028 return;
12029
12031
12034
12037
12038 SoundParameters params = new SoundParameters();
12042 }
12043
12044
12046 {
12048 {
12051
12052 SetSynchDirty();
12053
12056 }
12057 }
12058
12060 {
12062 }
12063
12064
12066 {
12068 return;
12069
12071 SetSynchDirty();
12072
12075 }
12076
12078 {
12081 }
12082
12084 {
12086 }
12087
12088 void OnApply(PlayerBase player);
12089
12091 {
12092 return 1.0;
12093 };
12094
12096 {
12098 }
12099
12101 {
12103 }
12104
12106
12108 {
12109 SetDynamicPhysicsLifeTime(0.01);
12111 }
12112
12114 {
12115 array<string> zone_names = new array<string>;
12116 GetDamageZones(zone_names);
12117 for (int i = 0; i < zone_names.Count(); i++)
12118 {
12119 SetHealthMax(zone_names.Get(i),"Health");
12120 }
12121 SetHealthMax("","Health");
12122 }
12123
12126 {
12127 float global_health = GetHealth01("","Health");
12128 array<string> zones = new array<string>;
12129 GetDamageZones(zones);
12130
12131 for (int i = 0; i < zones.Count(); i++)
12132 {
12133 SetHealth01(zones.Get(i),"Health",global_health);
12134 }
12135 }
12136
12139 {
12140 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12141 }
12142
12144 {
12145 if (!hasRootAsPlayer)
12146 {
12147 if (refParentIB)
12148 {
12149
12150 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12151 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12152
12153 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12154 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12155
12158 }
12159 else
12160 {
12161
12164 }
12165 }
12166 }
12167
12169 {
12171 {
12172 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12173 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12174 {
12175 float heatPermCoef = 1.0;
12177 while (ent)
12178 {
12179 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12180 ent = ent.GetHierarchyParent();
12181 }
12182
12183 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12184 }
12185 }
12186 }
12187
12189 {
12190
12191 EntityAI parent = GetHierarchyParent();
12192 if (!parent)
12193 {
12194 hasParent = false;
12195 hasRootAsPlayer = false;
12196 }
12197 else
12198 {
12199 hasParent = true;
12200 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12201 refParentIB =
ItemBase.Cast(parent);
12202 }
12203 }
12204
12205 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12206 {
12207
12208 }
12209
12211 {
12212
12213 return false;
12214 }
12215
12217 {
12218
12219
12220 return false;
12221 }
12222
12224 {
12225
12226 return false;
12227 }
12228
12231 {
12232 return !GetIsFrozen() &&
IsOpen();
12233 }
12234
12236 {
12237 bool hasParent = false, hasRootAsPlayer = false;
12239
12240 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12241 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12242
12243 if (wwtu || foodDecay)
12244 {
12248
12249 if (processWetness || processTemperature || processDecay)
12250 {
12252
12253 if (processWetness)
12254 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12255
12256 if (processTemperature)
12258
12259 if (processDecay)
12260 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12261 }
12262 }
12263 }
12264
12267 {
12269 }
12270
12272 {
12275
12276 return super.GetTemperatureFreezeThreshold();
12277 }
12278
12280 {
12283
12284 return super.GetTemperatureThawThreshold();
12285 }
12286
12288 {
12291
12292 return super.GetItemOverheatThreshold();
12293 }
12294
12296 {
12298 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12299
12300 return super.GetTemperatureFreezeTime();
12301 }
12302
12304 {
12306 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12307
12308 return super.GetTemperatureThawTime();
12309 }
12310
12315
12317 {
12318 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12319 }
12320
12322 {
12323 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12324 }
12325
12328 {
12330 }
12331
12333 {
12335 }
12336
12338 {
12340 }
12341
12344 {
12345 return null;
12346 }
12347
12350 {
12351 return false;
12352 }
12353
12355 {
12357 {
12360 if (!trg)
12361 {
12363 explosive = this;
12364 }
12365
12366 explosive.PairRemote(trg);
12368
12369 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12370 trg.SetPersistentPairID(persistentID);
12371 explosive.SetPersistentPairID(persistentID);
12372
12373 return true;
12374 }
12375 return false;
12376 }
12377
12380 {
12381 float ret = 1.0;
12384 ret *= GetHealth01();
12385
12386 return ret;
12387 }
12388
12389 #ifdef DEVELOPER
12390 override void SetDebugItem()
12391 {
12392 super.SetDebugItem();
12393 _itemBase = this;
12394 }
12395
12397 {
12398 string text = super.GetDebugText();
12399
12401 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12402
12403 return text;
12404 }
12405 #endif
12406
12408 {
12409 return true;
12410 }
12411
12413
12415
12417 {
12420 }
12421
12422
12430
12446
12447 [
Obsolete(
"Use ItemSoundHandler instead")]
12450 {
12451 if (!
g_Game.IsDedicatedServer())
12452 {
12453 if (ConfigIsExisting("attachSoundSet"))
12454 {
12455 string cfg_path = "";
12456 string soundset = "";
12457 string type_name =
GetType();
12458
12461 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12462 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12463
12464 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12465 {
12466 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12467 {
12468 if (cfg_slot_array[i] == slot_type)
12469 {
12470 soundset = cfg_soundset_array[i];
12471 break;
12472 }
12473 }
12474 }
12475
12476 if (soundset != "")
12477 {
12478 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12480 }
12481 }
12482 }
12483 }
12484
12486}
12487
12489{
12491 if (entity)
12492 {
12493 bool is_item = entity.IsInherited(
ItemBase);
12494 if (is_item && full_quantity)
12495 {
12498 }
12499 }
12500 else
12501 {
12503 return NULL;
12504 }
12505 return entity;
12506}
12507
12509{
12510 if (item)
12511 {
12512 if (health > 0)
12513 item.SetHealth("", "", health);
12514
12515 if (item.CanHaveTemperature())
12516 {
12518 if (item.CanFreeze())
12519 item.SetFrozen(false);
12520 }
12521
12522 if (item.HasEnergyManager())
12523 {
12524 if (quantity >= 0)
12525 {
12526 item.GetCompEM().SetEnergy0To1(quantity);
12527 }
12528 else
12529 {
12531 }
12532 }
12533 else if (item.IsMagazine())
12534 {
12535 Magazine mag = Magazine.Cast(item);
12536 if (quantity >= 0)
12537 {
12538 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12539 }
12540 else
12541 {
12543 }
12544
12545 }
12546 else
12547 {
12548 if (quantity >= 0)
12549 {
12550 item.SetQuantityNormalized(quantity, false);
12551 }
12552 else
12553 {
12555 }
12556
12557 }
12558 }
12559}
12560
12561#ifdef DEVELOPER
12563#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.