Send message to owner player in grey color.
7625{
7627 {
7628 return true;
7629 }
7630};
7631
7633{
7634
7635};
7636
7637
7638
7640{
7644
7646
7649
7650
7651
7652
7653
7662
7668
7673
7678
7699 protected bool m_IsResultOfSplit
7700
7702
7707
7708
7709
7711
7715
7716
7717
7719
7722
7723
7724
7730
7731
7739
7742
7743
7745
7746
7748
7749
7754
7755
7760
7762
7763
7765
7766
7768 {
7773
7774 if (!
g_Game.IsDedicatedServer())
7775 {
7777 {
7779
7781 {
7783 }
7784 }
7785
7788 }
7789
7790 m_OldLocation = null;
7791
7793 {
7795 }
7796
7797 if (ConfigIsExisting("headSelectionsToHide"))
7798 {
7801 }
7802
7804 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7805 {
7807 }
7808
7810
7811 m_IsResultOfSplit = false;
7812
7814 }
7815
7817 {
7818 super.InitItemVariables();
7819
7825 m_Count = ConfigGetInt(
"count");
7826
7829
7834
7837
7842
7854
7858
7859
7862 if (ConfigIsExisting("canBeSplit"))
7863 {
7866 }
7867
7869 if (ConfigIsExisting("itemBehaviour"))
7871
7872
7875 RegisterNetSyncVariableInt("m_VarLiquidType");
7876 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7877
7878 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7879 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7880 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7881
7882 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7883 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7884 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7885 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7886
7887 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7888 RegisterNetSyncVariableBool("m_IsTakeable");
7889 RegisterNetSyncVariableBool("m_IsHologram");
7890
7893 {
7896 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7897 }
7898
7900
7902 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7904
7906 }
7907
7909 {
7911 }
7912
7914 {
7917 {
7922 }
7923 }
7924
7925 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7926 {
7928 {
7931 }
7932
7934 }
7935
7937 {
7943 }
7944
7946
7948 {
7950
7951 if (!action)
7952 {
7953 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7954 return;
7955 }
7956
7958 if (!ai)
7959 {
7961 return;
7962 }
7963
7965 if (!action_array)
7966 {
7967 action_array = new array<ActionBase_Basic>;
7969 }
7970 if (LogManager.IsActionLogEnable())
7971 {
7972 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7973 }
7974
7975 if (action_array.Find(action) != -1)
7976 {
7977 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7978 }
7979 else
7980 {
7981 action_array.Insert(action);
7982 }
7983 }
7984
7986 {
7987 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7988 ActionBase action = player.GetActionManager().GetAction(actionName);
7991
7992 if (action_array)
7993 {
7994 action_array.RemoveItem(action);
7995 }
7996 }
7997
7998
7999
8001 {
8002 ActionOverrideData overrideData = new ActionOverrideData();
8006
8008 if (!actionMap)
8009 {
8012 }
8013
8014 actionMap.Insert(this.
Type(), overrideData);
8015
8016 }
8017
8019
8021
8022
8024 {
8027
8030
8031 string config_to_search = "CfgVehicles";
8032 string muzzle_owner_config;
8033
8035 {
8036 if (IsInherited(Weapon))
8037 config_to_search = "CfgWeapons";
8038
8039 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8040
8041 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8042
8043 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8044
8045 if (config_OnFire_subclass_count > 0)
8046 {
8047 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8048
8049 for (int i = 0; i < config_OnFire_subclass_count; i++)
8050 {
8051 string particle_class = "";
8052 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8053 string config_OnFire_entry = config_OnFire_class + particle_class;
8054 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8055 WPOF_array.Insert(WPOF);
8056 }
8057
8058
8060 }
8061 }
8062
8064 {
8065 config_to_search = "CfgWeapons";
8066 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8067
8068 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8069
8070 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8071
8072 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8073 {
8074 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8075
8076 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8077 {
8078 string particle_class2 = "";
8079 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8080 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8081 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8082 WPOBE_array.Insert(WPOBE);
8083 }
8084
8085
8087 }
8088 }
8089 }
8090
8091
8093 {
8096
8098 {
8099 string config_to_search = "CfgVehicles";
8100
8101 if (IsInherited(Weapon))
8102 config_to_search = "CfgWeapons";
8103
8104 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8105 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8106
8107 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8108 {
8109
8111
8113 {
8115 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8117 return;
8118 }
8119
8122
8123
8124
8125 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8126 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8127
8128 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8129 {
8130 string particle_class = "";
8131 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8132 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8133 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8134
8135 if (entry_type == CT_CLASS)
8136 {
8137 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8138 WPOOH_array.Insert(WPOF);
8139 }
8140 }
8141
8142
8144 }
8145 }
8146 }
8147
8149 {
8151 }
8152
8154 {
8156 {
8158
8161
8164
8165 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8166 }
8167 }
8168
8170 {
8172 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8173
8175 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8176
8178 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8179
8181 {
8183 }
8184 }
8185
8187 {
8189 }
8190
8192 {
8195 else
8197
8199 {
8202 }
8203 else
8204 {
8207
8210 }
8211
8213 }
8214
8216 {
8218 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8219 }
8220
8222 {
8224 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8226 }
8227
8229 {
8231 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8232 }
8233
8235 {
8238
8239 OverheatingParticle OP = new OverheatingParticle();
8244
8246 }
8247
8249 {
8252
8253 return -1;
8254 }
8255
8257 {
8259 {
8262
8263 for (int i = count; i > 0; --i)
8264 {
8265 int id = i - 1;
8268
8271
8272 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8273 {
8274 if (p)
8275 {
8278 }
8279 }
8280 }
8281 }
8282 }
8283
8285 {
8287 {
8289 {
8290 int id = i - 1;
8292
8293 if (OP)
8294 {
8296
8297 if (p)
8298 {
8300 }
8301
8302 delete OP;
8303 }
8304 }
8305
8308 }
8309 }
8310
8313 {
8314 return 0.0;
8315 }
8316
8317
8319 {
8320 return 250;
8321 }
8322
8324 {
8325 return 0;
8326 }
8327
8330 {
8332 return true;
8333
8334 return false;
8335 }
8336
8339 {
8342
8344 {
8346 }
8347 else
8348 {
8349
8351 }
8352
8354 }
8355
8362 {
8363 return -1;
8364 }
8365
8366
8367
8368
8370 {
8372 {
8373 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8374 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8375
8376 if (r_index >= 0)
8377 {
8378 InventoryLocation r_il = new InventoryLocation;
8379 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8380
8381 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8384 {
8385 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8386 }
8388 {
8389 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8390 }
8391
8392 }
8393
8394 player.GetHumanInventory().ClearUserReservedLocation(this);
8395 }
8396
8399 }
8400
8401
8402
8403
8405 {
8406 return ItemBase.m_DebugActionsMask;
8407 }
8408
8410 {
8411 return ItemBase.m_DebugActionsMask & mask;
8412 }
8413
8415 {
8416 ItemBase.m_DebugActionsMask = mask;
8417 }
8418
8420 {
8421 ItemBase.m_DebugActionsMask |= mask;
8422 }
8423
8425 {
8426 ItemBase.m_DebugActionsMask &= ~mask;
8427 }
8428
8430 {
8432 {
8434 }
8435 else
8436 {
8438 }
8439 }
8440
8441
8443 {
8444 if (GetEconomyProfile())
8445 {
8446 float q_max = GetEconomyProfile().GetQuantityMax();
8447 if (q_max > 0)
8448 {
8449 float q_min = GetEconomyProfile().GetQuantityMin();
8450 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8451
8453 {
8454 ComponentEnergyManager comp = GetCompEM();
8456 {
8458 }
8459 }
8461 {
8463
8464 }
8465
8466 }
8467 }
8468 }
8469
8472 {
8473 EntityAI parent = GetHierarchyParent();
8474
8475 if (parent)
8476 {
8477 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8478 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8479 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8480 }
8481 }
8482
8485 {
8486 EntityAI parent = GetHierarchyParent();
8487
8488 if (parent)
8489 {
8490 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8491 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8492 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8493 }
8494 }
8495
8497 {
8498
8499
8500
8501
8503
8505 {
8506 if (ScriptInputUserData.CanStoreInputUserData())
8507 {
8508 ScriptInputUserData ctx = new ScriptInputUserData;
8514 ctx.
Write(use_stack_max);
8517
8519 {
8520 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8521 }
8522 }
8523 }
8524 else if (!
g_Game.IsMultiplayer())
8525 {
8527 }
8528 }
8529
8531 {
8533 }
8534
8536 {
8538 }
8539
8541 {
8543 }
8544
8546 {
8547
8548 return false;
8549 }
8550
8552 {
8553 return false;
8554 }
8555
8559 {
8560 return false;
8561 }
8562
8564 {
8565 return "";
8566 }
8567
8569
8571 {
8572 return false;
8573 }
8574
8576 {
8577 return true;
8578 }
8579
8580
8581
8583 {
8584 return true;
8585 }
8586
8588 {
8589 return true;
8590 }
8591
8593 {
8594 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8596 }
8597
8599 {
8601 }
8602
8604 {
8606 if (!is_being_placed)
8608 SetSynchDirty();
8609 }
8610
8611
8613
8615 {
8617 }
8618
8620 {
8622 }
8623
8625 {
8626 return 1;
8627 }
8628
8630 {
8631 return false;
8632 }
8633
8635 {
8637 SetSynchDirty();
8638 }
8639
8640
8641
8642
8643
8644
8645
8646
8647
8648
8649
8650
8651
8652
8653
8654
8655
8656
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8675 {
8676 super.OnMovedInsideCargo(container);
8677
8678 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8679 }
8680
8681 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8682 {
8683 super.EEItemLocationChanged(oldLoc, newLoc);
8684
8685 PlayerBase newPlayer = null;
8686 PlayerBase oldPlayer = null;
8687
8688 if (newLoc.GetParent())
8689 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8690
8691 if (oldLoc.GetParent())
8692 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8693
8695 {
8696 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8697
8698 if (rIndex >= 0)
8699 {
8700 InventoryLocation rIl = new InventoryLocation;
8701 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8702
8703 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8706 {
8707 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8708 }
8710 {
8712 }
8713
8714 }
8715 }
8716
8718 {
8719 if (newPlayer)
8720 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8721
8722 if (newPlayer == oldPlayer)
8723 {
8724 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8725 {
8727 {
8728 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8729 {
8730 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8731 }
8732 }
8733 else
8734 {
8735 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8736 }
8737 }
8738
8739 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8740 {
8741 int type = oldLoc.GetType();
8743 {
8744 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8745 }
8747 {
8748 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8749 }
8750 }
8751 if (!m_OldLocation)
8752 {
8753 m_OldLocation = new InventoryLocation;
8754 }
8755 m_OldLocation.Copy(oldLoc);
8756 }
8757 else
8758 {
8759 if (m_OldLocation)
8760 {
8761 m_OldLocation.Reset();
8762 }
8763 }
8764
8765 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8766 }
8767 else
8768 {
8769 if (newPlayer)
8770 {
8771 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8772 if (resIndex >= 0)
8773 {
8774 InventoryLocation il = new InventoryLocation;
8775 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8777 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8780 {
8781 il.
GetParent().GetOnReleaseLock().Invoke(it);
8782 }
8784 {
8786 }
8787
8788 }
8789 }
8791 {
8792
8794 }
8795
8796 if (m_OldLocation)
8797 {
8798 m_OldLocation.Reset();
8799 }
8800 }
8801
8803 {
8804 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8805 }
8806
8808 {
8809 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8810 }
8811 }
8812
8813 override void EOnContact(IEntity other, Contact extra)
8814 {
8816 {
8817 int liquidType = -1;
8819 if (impactSpeed > 0.0)
8820 {
8822 #ifndef SERVER
8824 #else
8826 SetSynchDirty();
8827 #endif
8829 }
8830 }
8831
8832 #ifdef SERVER
8833 if (GetCompEM() && GetCompEM().IsPlugged())
8834 {
8835 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8836 GetCompEM().UnplugThis();
8837 }
8838 #endif
8839 }
8840
8842
8844 {
8846 }
8847
8849 {
8850
8851 }
8852
8854 {
8855 super.OnItemLocationChanged(old_owner, new_owner);
8856
8857 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8858 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8859
8860 if (!relatedPlayer && playerNew)
8861 relatedPlayer = playerNew;
8862
8863 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8864 {
8866 if (actionMgr)
8867 {
8868 ActionBase currentAction = actionMgr.GetRunningAction();
8869 if (currentAction)
8871 }
8872 }
8873
8874 Man ownerPlayerOld = null;
8875 Man ownerPlayerNew = null;
8876
8877 if (old_owner)
8878 {
8879 if (old_owner.
IsMan())
8880 {
8881 ownerPlayerOld = Man.Cast(old_owner);
8882 }
8883 else
8884 {
8885 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8886 }
8887 }
8888 else
8889 {
8891 {
8893
8894 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8895 {
8896 GetCompEM().UnplugThis();
8897 }
8898 }
8899 }
8900
8901 if (new_owner)
8902 {
8903 if (new_owner.
IsMan())
8904 {
8905 ownerPlayerNew = Man.Cast(new_owner);
8906 }
8907 else
8908 {
8909 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8910 }
8911 }
8912
8913 if (ownerPlayerOld != ownerPlayerNew)
8914 {
8915 if (ownerPlayerOld)
8916 {
8917 array<EntityAI> subItemsExit = new array<EntityAI>;
8919 for (int i = 0; i < subItemsExit.Count(); i++)
8920 {
8923 }
8924 }
8925
8926 if (ownerPlayerNew)
8927 {
8928 array<EntityAI> subItemsEnter = new array<EntityAI>;
8930 for (int j = 0; j < subItemsEnter.Count(); j++)
8931 {
8934 }
8935 }
8936 }
8937 else if (ownerPlayerNew != null)
8938 {
8939 PlayerBase nplayer;
8940 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8941 {
8942 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8944 for (int k = 0; k < subItemsUpdate.Count(); k++)
8945 {
8947 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8948 }
8949 }
8950 }
8951
8952 if (old_owner)
8953 old_owner.OnChildItemRemoved(this);
8954 if (new_owner)
8955 new_owner.OnChildItemReceived(this);
8956 }
8957
8958
8960 {
8961 super.EEDelete(parent);
8962 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8963 if (player)
8964 {
8966
8967 if (player.IsAlive())
8968 {
8969 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8970 if (r_index >= 0)
8971 {
8972 InventoryLocation r_il = new InventoryLocation;
8973 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8974
8975 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8978 {
8979 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8980 }
8982 {
8983 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8984 }
8985
8986 }
8987
8988 player.RemoveQuickBarEntityShortcut(this);
8989 }
8990 }
8991 }
8992
8994 {
8995 super.EEKilled(killer);
8996
8999 {
9000 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9001 {
9002 if (IsMagazine())
9003 {
9004 if (Magazine.Cast(this).GetAmmoCount() > 0)
9005 {
9007 }
9008 }
9009 else
9010 {
9012 }
9013 }
9014 }
9015 }
9016
9018 {
9019 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9020
9021 super.OnWasAttached(parent, slot_id);
9022
9025
9028 }
9029
9031 {
9032 super.OnWasDetached(parent, slot_id);
9033
9036
9039 }
9040
9042 {
9043 int idx;
9046
9047 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9048 if (inventory_slots.Count() < 1)
9049 {
9050 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9051 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9052 }
9053 else
9054 {
9055 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9056 }
9057
9058 idx = inventory_slots.Find(slot);
9059 if (idx < 0)
9060 return "";
9061
9062 return attach_types.Get(idx);
9063 }
9064
9066 {
9067 int idx = -1;
9068 string slot;
9069
9072
9073 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9074 if (inventory_slots.Count() < 1)
9075 {
9076 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9077 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9078 }
9079 else
9080 {
9081 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9082 if (detach_types.Count() < 1)
9083 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9084 }
9085
9086 for (int i = 0; i < inventory_slots.Count(); i++)
9087 {
9088 slot = inventory_slots.Get(i);
9089 }
9090
9091 if (slot != "")
9092 {
9093 if (detach_types.Count() == 1)
9094 idx = 0;
9095 else
9096 idx = inventory_slots.Find(slot);
9097 }
9098 if (idx < 0)
9099 return "";
9100
9101 return detach_types.Get(idx);
9102 }
9103
9105 {
9106
9108
9109
9110 float min_time = 1;
9111 float max_time = 3;
9112 float delay = Math.RandomFloat(min_time, max_time);
9113
9114 explode_timer.Run(delay, this, "DoAmmoExplosion");
9115 }
9116
9118 {
9119 Magazine magazine = Magazine.Cast(this);
9120 int pop_sounds_count = 6;
9121 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9122
9123
9124 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9125 string sound_name = pop_sounds[ sound_idx ];
9126 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9127
9128
9129 magazine.ServerAddAmmoCount(-1);
9130
9131
9132 float min_temp_to_explode = 100;
9133
9134 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9135 {
9137 }
9138 }
9139
9140
9141 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9142 {
9143 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9144
9145 const int CHANCE_DAMAGE_CARGO = 4;
9146 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9147 const int CHANCE_DAMAGE_NOTHING = 2;
9148
9150 {
9151 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9152 int chances;
9153 int rnd;
9154
9155 if (GetInventory().GetCargo())
9156 {
9157 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9158 rnd = Math.RandomInt(0,chances);
9159
9160 if (rnd < CHANCE_DAMAGE_CARGO)
9161 {
9163 }
9164 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9165 {
9167 }
9168 }
9169 else
9170 {
9171 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9172 rnd = Math.RandomInt(0,chances);
9173
9174 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9175 {
9177 }
9178 }
9179 }
9180 }
9181
9183 {
9184 CargoBase cargo = GetInventory().GetCargo();
9185 if (cargo)
9186 {
9188 if (item_count > 0)
9189 {
9190 int random_pick = Math.RandomInt(0, item_count);
9192 if (!item.IsExplosive())
9193 {
9194 item.AddHealth("","",damage);
9195 return true;
9196 }
9197 }
9198 }
9199 return false;
9200 }
9201
9203 {
9204 GameInventory inventory = GetInventory();
9206 if (attachment_count > 0)
9207 {
9208 int random_pick = Math.RandomInt(0, attachment_count);
9210 if (!attachment.IsExplosive())
9211 {
9212 attachment.AddHealth("","",damage);
9213 return true;
9214 }
9215 }
9216 return false;
9217 }
9218
9220 {
9222 }
9223
9225 {
9227 return GetInventory().CanRemoveEntity();
9228
9229 return false;
9230 }
9231
9233 {
9234
9236 return false;
9237
9238
9240 return false;
9241
9242
9243
9245 if (delta == 0)
9246 return false;
9247
9248
9249 return true;
9250 }
9251
9253 {
9255 {
9256 if (ScriptInputUserData.CanStoreInputUserData())
9257 {
9258 ScriptInputUserData ctx = new ScriptInputUserData;
9263 ctx.
Write(destination_entity);
9267 }
9268 }
9269 else if (!
g_Game.IsMultiplayer())
9270 {
9272 }
9273 }
9274
9276 {
9277 float split_quantity_new;
9281 InventoryLocation loc = new InventoryLocation;
9282
9283 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9284 {
9286 split_quantity_new = stack_max;
9287 else
9289
9291 {
9292 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9293 if (new_item)
9294 {
9295 new_item.SetResultOfSplit(true);
9296 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9298 new_item.
SetQuantity(split_quantity_new,
false,
true);
9299 }
9300 }
9301 }
9302 else if (destination_entity && slot_id == -1)
9303 {
9304 if (quantity > stack_max)
9305 split_quantity_new = stack_max;
9306 else
9307 split_quantity_new = quantity;
9308
9310 {
9311 GameInventory destinationInventory = destination_entity.GetInventory();
9313 {
9316 }
9317
9318 if (new_item)
9319 {
9320 new_item.SetResultOfSplit(true);
9321 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9323 new_item.
SetQuantity(split_quantity_new,
false,
true);
9324 }
9325 }
9326 }
9327 else
9328 {
9329 if (stack_max != 0)
9330 {
9332 {
9334 }
9335
9336 if (split_quantity_new == 0)
9337 {
9338 if (!
g_Game.IsMultiplayer())
9339 player.PhysicalPredictiveDropItem(this);
9340 else
9341 player.ServerDropEntity(this);
9342 return;
9343 }
9344
9346 {
9348
9349 if (new_item)
9350 {
9351 new_item.SetResultOfSplit(true);
9352 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9355 new_item.PlaceOnSurface();
9356 }
9357 }
9358 }
9359 }
9360 }
9361
9363 {
9364 float split_quantity_new;
9368 InventoryLocation loc = new InventoryLocation;
9369
9370 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9371 {
9373 split_quantity_new = stack_max;
9374 else
9376
9378 {
9379 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9380 if (new_item)
9381 {
9382 new_item.SetResultOfSplit(true);
9383 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9385 new_item.
SetQuantity(split_quantity_new,
false,
true);
9386 }
9387 }
9388 }
9389 else if (destination_entity && slot_id == -1)
9390 {
9391 if (quantity > stack_max)
9392 split_quantity_new = stack_max;
9393 else
9394 split_quantity_new = quantity;
9395
9397 {
9398 GameInventory destinationInventory = destination_entity.GetInventory();
9400 {
9403 }
9404
9405 if (new_item)
9406 {
9407 new_item.SetResultOfSplit(true);
9408 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9410 new_item.
SetQuantity(split_quantity_new,
false,
true);
9411 }
9412 }
9413 }
9414 else
9415 {
9416 if (stack_max != 0)
9417 {
9419 {
9421 }
9422
9424 {
9426
9427 if (new_item)
9428 {
9429 new_item.SetResultOfSplit(true);
9430 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9433 new_item.PlaceOnSurface();
9434 }
9435 }
9436 }
9437 }
9438 }
9439
9441 {
9443 {
9444 if (ScriptInputUserData.CanStoreInputUserData())
9445 {
9446 ScriptInputUserData ctx = new ScriptInputUserData;
9451 dst.WriteToContext(ctx);
9453 }
9454 }
9455 else if (!
g_Game.IsMultiplayer())
9456 {
9458 }
9459 }
9460
9462 {
9464 {
9465 if (ScriptInputUserData.CanStoreInputUserData())
9466 {
9467 ScriptInputUserData ctx = new ScriptInputUserData;
9472 ctx.
Write(destination_entity);
9478 }
9479 }
9480 else if (!
g_Game.IsMultiplayer())
9481 {
9483 }
9484 }
9485
9487 {
9489 }
9490
9492 {
9494 float split_quantity_new;
9496 if (dst.IsValid())
9497 {
9498 int slot_id = dst.GetSlot();
9500
9501 if (quantity > stack_max)
9502 split_quantity_new = stack_max;
9503 else
9504 split_quantity_new = quantity;
9505
9507 {
9509
9510 if (new_item)
9511 {
9512 new_item.SetResultOfSplit(true);
9513 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9515 new_item.
SetQuantity(split_quantity_new,
false,
true);
9516 }
9517
9518 return new_item;
9519 }
9520 }
9521
9522 return null;
9523 }
9524
9526 {
9528 float split_quantity_new;
9530 if (destination_entity)
9531 {
9533 if (quantity > stackable)
9534 split_quantity_new = stackable;
9535 else
9536 split_quantity_new = quantity;
9537
9539 {
9540 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9541 if (new_item)
9542 {
9543 new_item.SetResultOfSplit(true);
9544 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9546 new_item.
SetQuantity(split_quantity_new,
false,
true);
9547 }
9548 }
9549 }
9550 }
9551
9553 {
9555 {
9556 if (ScriptInputUserData.CanStoreInputUserData())
9557 {
9558 ScriptInputUserData ctx = new ScriptInputUserData;
9563 ItemBase destination_entity =
this;
9564 ctx.
Write(destination_entity);
9568 }
9569 }
9570 else if (!
g_Game.IsMultiplayer())
9571 {
9573 }
9574 }
9575
9577 {
9579 float split_quantity_new;
9581 if (player)
9582 {
9584 if (quantity > stackable)
9585 split_quantity_new = stackable;
9586 else
9587 split_quantity_new = quantity;
9588
9590 {
9591 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9592 new_item =
ItemBase.Cast(in_hands);
9593 if (new_item)
9594 {
9595 new_item.SetResultOfSplit(true);
9596 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9598 new_item.SetQuantity(split_quantity_new, false, true);
9599 }
9600 }
9601 }
9602 }
9603
9605 {
9607 float split_quantity_new = Math.Floor(quantity * 0.5);
9608
9610 return;
9611
9613
9614 if (new_item)
9615 {
9616 if (new_item.GetQuantityMax() < split_quantity_new)
9617 {
9618 split_quantity_new = new_item.GetQuantityMax();
9619 }
9620
9621 new_item.SetResultOfSplit(true);
9622 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9623
9625 {
9628 }
9629 else
9630 {
9632 new_item.
SetQuantity(split_quantity_new,
false,
true);
9633 }
9634 }
9635 }
9636
9638 {
9640 float split_quantity_new = Math.Floor(quantity / 2);
9641
9643 return;
9644
9645 InventoryLocation invloc = new InventoryLocation;
9647
9649 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9650
9651 if (new_item)
9652 {
9653 if (new_item.GetQuantityMax() < split_quantity_new)
9654 {
9655 split_quantity_new = new_item.GetQuantityMax();
9656 }
9658 {
9661 }
9662 else if (split_quantity_new > 1)
9663 {
9665 new_item.
SetQuantity(split_quantity_new,
false,
true);
9666 }
9667 }
9668 }
9669
9672 {
9673 SetWeightDirty();
9675
9676 if (parent)
9677 parent.OnAttachmentQuantityChangedEx(this, delta);
9678
9680 {
9682 {
9684 }
9686 {
9687 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9689 }
9690 }
9691 }
9692
9695 {
9696
9697 }
9698
9701 {
9703 }
9704
9706 {
9707 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9708
9710 {
9711 if (newLevel == GameConstants.STATE_RUINED)
9712 {
9714 EntityAI parent = GetHierarchyParent();
9715 if (parent && parent.IsFireplace())
9716 {
9717 CargoBase cargo = GetInventory().GetCargo();
9718 if (cargo)
9719 {
9721 {
9723 }
9724 }
9725 }
9726 }
9727
9729 {
9730
9732 return;
9733 }
9734
9735 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9736 {
9738 }
9739 }
9740 }
9741
9742
9744 {
9745 super.OnRightClick();
9746
9748 {
9750 {
9751 if (ScriptInputUserData.CanStoreInputUserData())
9752 {
9753 EntityAI root = GetHierarchyRoot();
9754 Man playerOwner = GetHierarchyRootPlayer();
9755 InventoryLocation dst = new InventoryLocation;
9756
9757
9758 if (!playerOwner && root && root == this)
9759 {
9761 }
9762 else
9763 {
9764
9765 GetInventory().GetCurrentInventoryLocation(dst);
9767 {
9768 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9770 {
9772 }
9773 else
9774 {
9776
9777
9778 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9779 {
9781 }
9782 else
9783 {
9784 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9785 }
9786 }
9787 }
9788 }
9789
9790 ScriptInputUserData ctx = new ScriptInputUserData;
9798 }
9799 }
9800 else if (!
g_Game.IsMultiplayer())
9801 {
9803 }
9804 }
9805 }
9806
9808 {
9809 if (root)
9810 {
9811 vector m4[4];
9812 root.GetTransform(m4);
9813 dst.SetGround(this, m4);
9814 }
9815 else
9816 {
9817 GetInventory().GetCurrentInventoryLocation(dst);
9818 }
9819 }
9820
9821 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9822 {
9823
9824 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9825 return false;
9826
9827 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9828 return false;
9829
9830
9832 return false;
9833
9834
9835 Magazine mag = Magazine.Cast(this);
9836 if (mag)
9837 {
9838 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9839 return false;
9840
9841 if (stack_max_limit)
9842 {
9843 Magazine other_mag = Magazine.Cast(other_item);
9844 if (other_item)
9845 {
9846 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9847 return false;
9848 }
9849
9850 }
9851 }
9852 else
9853 {
9854
9856 return false;
9857
9859 return false;
9860 }
9861
9862 PlayerBase player = null;
9863 if (CastTo(player, GetHierarchyRootPlayer()))
9864 {
9865 if (player.GetInventory().HasAttachment(this))
9866 return false;
9867
9868 if (player.IsItemsToDelete())
9869 return false;
9870 }
9871
9872 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9873 return false;
9874
9875 int slotID;
9877 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9878 return false;
9879
9880 return true;
9881 }
9882
9884 {
9886 }
9887
9889 {
9890 return m_IsResultOfSplit;
9891 }
9892
9894 {
9895 m_IsResultOfSplit = value;
9896 }
9897
9899 {
9901 }
9902
9904 {
9905 float other_item_quantity = other_item.GetQuantity();
9906 float this_free_space;
9907
9909
9911
9912 if (other_item_quantity > this_free_space)
9913 {
9914 return this_free_space;
9915 }
9916 else
9917 {
9918 return other_item_quantity;
9919 }
9920 }
9921
9923 {
9925 }
9926
9928 {
9930 return;
9931
9932 if (!IsMagazine() && other_item)
9933 {
9935 if (quantity_used != 0)
9936 {
9937 float hp1 = GetHealth01("","");
9938 float hp2 = other_item.GetHealth01("","");
9939 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9940 hpResult = hpResult / (
GetQuantity() + quantity_used);
9941
9942 hpResult *= GetMaxHealth();
9943 Math.Round(hpResult);
9944 SetHealth("", "Health", hpResult);
9945
9947 other_item.AddQuantity(-quantity_used);
9948 }
9949 }
9951 }
9952
9954 {
9955 #ifdef SERVER
9956 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9957 GetHierarchyParent().IncreaseLifetimeUp();
9958 #endif
9959 };
9960
9962 {
9963 PlayerBase p = PlayerBase.Cast(player);
9964
9965 array<int> recipesIds = p.m_Recipes;
9966 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9967 if (moduleRecipesManager)
9968 {
9969 EntityAI itemInHands = player.GetEntityInHands();
9970 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9971 }
9972
9973 for (int i = 0;i < recipesIds.Count(); i++)
9974 {
9975 int key = recipesIds.Get(i);
9976 string recipeName = moduleRecipesManager.GetRecipeName(key);
9978 }
9979 }
9980
9981
9982 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9983 {
9984 super.GetDebugActions(outputList);
9985
9986
9992
9993
9998
10003
10004
10008
10009
10011 {
10015 }
10016
10019
10020
10024
10026
10027 InventoryLocation loc = new InventoryLocation();
10028 GetInventory().GetCurrentInventoryLocation(loc);
10030 {
10031 if (Gizmo_IsSupported())
10034 }
10035
10037 }
10038
10039
10040
10041
10043 {
10044 super.OnAction(action_id, player, ctx);
10045
10047 {
10048 switch (action_id)
10049 {
10053 return true;
10057 return true;
10058 }
10059 }
10060
10062 {
10063 switch (action_id)
10064 {
10066 Delete();
10067 return true;
10068 }
10069 }
10070
10071 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10072 {
10073 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10074 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10075 PlayerBase p = PlayerBase.Cast(player);
10076 if (
EActions.RECIPES_RANGE_START < 1000)
10077 {
10078 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10079 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10080 }
10081 }
10082 #ifndef SERVER
10083 else if (action_id ==
EActions.WATCH_PLAYER)
10084 {
10085 PluginDeveloper.SetDeveloperItemClientEx(player);
10086 }
10087 #endif
10089 {
10090 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10091 {
10092 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10093 OnDebugButtonPressServer(id + 1);
10094 }
10095
10096 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10097 {
10098 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10100 }
10101
10102 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10103 {
10104 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10106 }
10107
10108 else if (action_id ==
EActions.ADD_QUANTITY)
10109 {
10110 if (IsMagazine())
10111 {
10112 Magazine mag = Magazine.Cast(this);
10113 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10114 }
10115 else
10116 {
10118 }
10119
10120 if (m_EM)
10121 {
10122 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10123 }
10124
10125 }
10126
10127 else if (action_id ==
EActions.REMOVE_QUANTITY)
10128 {
10129 if (IsMagazine())
10130 {
10131 Magazine mag2 = Magazine.Cast(this);
10132 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10133 }
10134 else
10135 {
10137 }
10138 if (m_EM)
10139 {
10140 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10141 }
10142
10143 }
10144
10145 else if (action_id ==
EActions.SET_QUANTITY_0)
10146 {
10148
10149 if (m_EM)
10150 {
10151 m_EM.SetEnergy(0);
10152 }
10153 }
10154
10155 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10156 {
10158
10159 if (m_EM)
10160 {
10161 m_EM.SetEnergy(m_EM.GetEnergyMax());
10162 }
10163 }
10164
10165 else if (action_id ==
EActions.ADD_HEALTH)
10166 {
10167 AddHealth("","",GetMaxHealth("","Health")/5);
10168 }
10169 else if (action_id ==
EActions.REMOVE_HEALTH)
10170 {
10171 AddHealth("","",-GetMaxHealth("","Health")/5);
10172 }
10173 else if (action_id ==
EActions.DESTROY_HEALTH)
10174 {
10175 SetHealth01("","",0);
10176 }
10177 else if (action_id ==
EActions.WATCH_ITEM)
10178 {
10180 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10181 #ifdef DEVELOPER
10182 SetDebugDeveloper_item(this);
10183 #endif
10184 }
10185
10186 else if (action_id ==
EActions.ADD_TEMPERATURE)
10187 {
10188 AddTemperature(20);
10189
10190 }
10191
10192 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10193 {
10194 AddTemperature(-20);
10195
10196 }
10197
10198 else if (action_id ==
EActions.FLIP_FROZEN)
10199 {
10200 SetFrozen(!GetIsFrozen());
10201
10202 }
10203
10204 else if (action_id ==
EActions.ADD_WETNESS)
10205 {
10207
10208 }
10209
10210 else if (action_id ==
EActions.REMOVE_WETNESS)
10211 {
10213
10214 }
10215
10216 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10217 {
10220
10221
10222 }
10223
10224 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10225 {
10228 }
10229
10230 else if (action_id ==
EActions.MAKE_SPECIAL)
10231 {
10232 auto debugParams = DebugSpawnParams.WithPlayer(player);
10233 OnDebugSpawnEx(debugParams);
10234 }
10235
10236 }
10237
10238
10239 return false;
10240 }
10241
10242
10243
10244
10248
10251
10252
10253
10255 {
10256 return false;
10257 }
10258
10259
10261 {
10262 return true;
10263 }
10264
10265
10267 {
10268 return true;
10269 }
10270
10271
10272
10274 {
10275 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10276 return g_Game.ConfigIsExisting(config_path);
10277 }
10278
10281 {
10282 return null;
10283 }
10284
10286 {
10287 return false;
10288 }
10289
10291 {
10292 return false;
10293 }
10294
10298
10299
10301 {
10302 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10303 return module_repairing.CanRepair(this, item_repair_kit);
10304 }
10305
10306
10307 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10308 {
10309 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10310 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10311 }
10312
10313
10315 {
10316
10317
10318
10319
10320
10321
10322
10323
10324 return 1;
10325 }
10326
10327
10328
10330 {
10332 }
10333
10334
10335
10337 {
10339 }
10340
10341
10350 {
10351 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10352
10353 if (player)
10354 {
10355 player.MessageStatus(text);
10356 }
10357 }
10358
10359
10368 {
10369 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10370
10371 if (player)
10372 {
10373 player.MessageAction(text);
10374 }
10375 }
10376
10377
10386 {
10387 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10388
10389 if (player)
10390 {
10391 player.MessageFriendly(text);
10392 }
10393 }
10394
10395
10404 {
10405 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10406
10407 if (player)
10408 {
10409 player.MessageImportant(text);
10410 }
10411 }
10412
10414 {
10415 return true;
10416 }
10417
10418
10419 override bool KindOf(
string tag)
10420 {
10421 bool found = false;
10422 string item_name = this.
GetType();
10424 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10425
10426 int array_size = item_tag_array.Count();
10427 for (int i = 0; i < array_size; i++)
10428 {
10429 if (item_tag_array.Get(i) == tag)
10430 {
10431 found = true;
10432 break;
10433 }
10434 }
10435 return found;
10436 }
10437
10438
10440 {
10441
10442 super.OnRPC(sender, rpc_type,ctx);
10443
10444
10445 switch (rpc_type)
10446 {
10447 #ifndef SERVER
10448 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10449 Param2<bool, string> p = new Param2<bool, string>(false, "");
10450
10452 return;
10453
10454 bool play = p.param1;
10455 string soundSet = p.param2;
10456
10457 if (play)
10458 {
10460 {
10462 {
10464 }
10465 }
10466 else
10467 {
10469 }
10470 }
10471 else
10472 {
10474 }
10475
10476 break;
10477 #endif
10478
10479 }
10480
10482 {
10484 }
10485 }
10486
10487
10488
10489
10491 {
10492 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10493 return plugin.GetID(
name);
10494 }
10495
10497 {
10498 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10499 return plugin.GetName(id);
10500 }
10501
10504 {
10505
10506
10507 int varFlags;
10508 if (!ctx.
Read(varFlags))
10509 return;
10510
10511 if (varFlags & ItemVariableFlags.FLOAT)
10512 {
10514 }
10515 }
10516
10518 {
10519
10520 super.SerializeNumericalVars(floats_out);
10521
10522
10523
10525 {
10527 }
10528
10530 {
10532 }
10533
10535 {
10537 }
10538
10540 {
10545 }
10546
10548 {
10550 }
10551 }
10552
10554 {
10555
10556 super.DeSerializeNumericalVars(floats);
10557
10558
10559 int index = 0;
10560 int mask = Math.Round(floats.Get(index));
10561
10562 index++;
10563
10565 {
10567 {
10569 }
10570 else
10571 {
10572 float quantity = floats.Get(index);
10573 SetQuantity(quantity,
true,
false,
false,
false);
10574 }
10575 index++;
10576 }
10577
10579 {
10580 float wet = floats.Get(index);
10582 index++;
10583 }
10584
10586 {
10587 int liquidtype = Math.Round(floats.Get(index));
10589 index++;
10590 }
10591
10593 {
10595 index++;
10597 index++;
10599 index++;
10601 index++;
10602 }
10603
10605 {
10606 int cleanness = Math.Round(floats.Get(index));
10608 index++;
10609 }
10610 }
10611
10613 {
10614 super.WriteVarsToCTX(ctx);
10615
10616
10618 {
10620 }
10621
10623 {
10625 }
10626
10628 {
10630 }
10631
10633 {
10634 int r,g,b,a;
10640 }
10641
10643 {
10645 }
10646 }
10647
10649 {
10650 if (!super.ReadVarsFromCTX(ctx,version))
10651 return false;
10652
10653 int intValue;
10654 float value;
10655
10656 if (version < 140)
10657 {
10658 if (!ctx.
Read(intValue))
10659 return false;
10660
10661 m_VariablesMask = intValue;
10662 }
10663
10665 {
10666 if (!ctx.
Read(value))
10667 return false;
10668
10670 {
10672 }
10673 else
10674 {
10676 }
10677 }
10678
10679 if (version < 140)
10680 {
10682 {
10683 if (!ctx.
Read(value))
10684 return false;
10685 SetTemperatureDirect(value);
10686 }
10687 }
10688
10690 {
10691 if (!ctx.
Read(value))
10692 return false;
10694 }
10695
10697 {
10698 if (!ctx.
Read(intValue))
10699 return false;
10701 }
10702
10704 {
10705 int r,g,b,a;
10707 return false;
10709 return false;
10711 return false;
10713 return false;
10714
10716 }
10717
10719 {
10720 if (!ctx.
Read(intValue))
10721 return false;
10723 }
10724
10725 if (version >= 138 && version < 140)
10726 {
10728 {
10729 if (!ctx.
Read(intValue))
10730 return false;
10731 SetFrozen(intValue);
10732 }
10733 }
10734
10735 return true;
10736 }
10737
10738
10740 {
10743 {
10745 }
10746
10747 if (!super.OnStoreLoad(ctx, version))
10748 {
10750 return false;
10751 }
10752
10753 if (version >= 114)
10754 {
10755 bool hasQuickBarIndexSaved;
10756
10757 if (!ctx.
Read(hasQuickBarIndexSaved))
10758 {
10760 return false;
10761 }
10762
10763 if (hasQuickBarIndexSaved)
10764 {
10765 int itmQBIndex;
10766
10767
10768 if (!ctx.
Read(itmQBIndex))
10769 {
10771 return false;
10772 }
10773
10774 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10775 if (itmQBIndex != -1 && parentPlayer)
10776 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10777 }
10778 }
10779 else
10780 {
10781
10782 PlayerBase player;
10783 int itemQBIndex;
10784 if (version ==
int.
MAX)
10785 {
10786 if (!ctx.
Read(itemQBIndex))
10787 {
10789 return false;
10790 }
10791 }
10792 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10793 {
10794
10795 if (!ctx.
Read(itemQBIndex))
10796 {
10798 return false;
10799 }
10800 if (itemQBIndex != -1 && player)
10801 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10802 }
10803 }
10804
10805 if (version < 140)
10806 {
10807
10808 if (!LoadVariables(ctx, version))
10809 {
10811 return false;
10812 }
10813 }
10814
10815
10817 {
10819 return false;
10820 }
10821 if (version >= 132)
10822 {
10824 if (raib)
10825 {
10827 {
10829 return false;
10830 }
10831 }
10832 }
10833
10835 return true;
10836 }
10837
10838
10839
10841 {
10842 super.OnStoreSave(ctx);
10843
10844 PlayerBase player;
10845 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10846 {
10848
10849 int itemQBIndex = -1;
10850 itemQBIndex = player.FindQuickBarEntityIndex(this);
10851 ctx.
Write(itemQBIndex);
10852 }
10853 else
10854 {
10856 }
10857
10859
10861 if (raib)
10862 {
10864 }
10865 }
10866
10867
10869 {
10870 super.AfterStoreLoad();
10871
10873 {
10875 }
10876
10878 {
10881 }
10882 }
10883
10885 {
10886 super.EEOnAfterLoad();
10887
10889 {
10891 }
10892
10895 }
10896
10898 {
10899 return false;
10900 }
10901
10902
10903
10905 {
10907 {
10908 #ifdef PLATFORM_CONSOLE
10909
10911 {
10913 if (menu)
10914 {
10916 }
10917 }
10918 #endif
10919 }
10920
10922 {
10925 }
10926
10928 {
10929 SetWeightDirty();
10931 }
10933 {
10936 }
10937
10939 {
10942
10945 }
10947 {
10951 }
10952
10953 super.OnVariablesSynchronized();
10954 }
10955
10956
10957
10959 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10960 {
10961 if (!IsServerCheck(allow_client))
10962 return false;
10963
10965 return false;
10966
10969
10970 if (value <= (min + 0.001))
10971 value = min;
10972
10973 if (value == min)
10974 {
10975 if (destroy_config)
10976 {
10977 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10978 if (dstr)
10979 {
10981 this.Delete();
10982 return true;
10983 }
10984 }
10985 else if (destroy_forced)
10986 {
10988 this.Delete();
10989 return true;
10990 }
10991
10993 }
10994
10997
10999 {
11000 EntityAI parent = GetHierarchyRoot();
11001 InventoryLocation iLoc = new InventoryLocation();
11002 GetInventory().GetCurrentInventoryLocation(iLoc);
11004 {
11005 int iLocSlot = iLoc.
GetSlot();
11007 {
11009 }
11011 {
11013 }
11014 }
11015 }
11016
11018 {
11020
11021 if (delta)
11023 }
11024
11026
11027 return false;
11028 }
11029
11030
11032 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11033 {
11035 }
11036
11038 {
11041 }
11042
11044 {
11047 }
11048
11050 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11051 {
11052 float value_clamped = Math.Clamp(value, 0, 1);
11054 SetQuantity(result, destroy_config, destroy_forced);
11055 }
11056
11057
11060 {
11062 }
11063
11065 {
11067 }
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11079 {
11080 int slot = -1;
11081 GameInventory inventory = GetInventory();
11082 if (inventory)
11083 {
11084 InventoryLocation il = new InventoryLocation;
11087 }
11088
11090 }
11091
11093 {
11094 float quantity_max = 0;
11095
11097 {
11098 if (attSlotID != -1)
11099 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11100
11101 if (quantity_max <= 0)
11103 }
11104
11105 if (quantity_max <= 0)
11107
11108 return quantity_max;
11109 }
11110
11112 {
11114 }
11115
11117 {
11119 }
11120
11121
11123 {
11125 }
11126
11128 {
11130 }
11131
11133 {
11135 }
11136
11137
11139 {
11140
11141 float weightEx = GetWeightEx();
11142 float special = GetInventoryAndCargoWeight();
11143 return weightEx - special;
11144 }
11145
11146
11148 {
11150 }
11151
11153 {
11155 {
11156 #ifdef DEVELOPER
11157 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11158 {
11159 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11161 }
11162 #endif
11163
11164 return GetQuantity() * GetConfigWeightModified();
11165 }
11166 else if (HasEnergyManager())
11167 {
11168 #ifdef DEVELOPER
11169 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11170 {
11171 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11172 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11173 }
11174 #endif
11175 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11176 }
11177 else
11178 {
11179 #ifdef DEVELOPER
11180 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11181 {
11182 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11183 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11184 }
11185 #endif
11186 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11187 }
11188 }
11189
11192 {
11193 int item_count = 0;
11195
11196 GameInventory inventory = GetInventory();
11197 CargoBase cargo = inventory.
GetCargo();
11198 if (cargo != NULL)
11199 {
11201 }
11202
11204 for (int i = 0; i < nAttachments; ++i)
11205 {
11207 if (item)
11208 item_count += item.GetNumberOfItems();
11209 }
11210 return item_count;
11211 }
11212
11215 {
11216 float weight = 0;
11217 float wetness = 1;
11218 if (include_wetness)
11221 {
11222 weight = wetness * m_ConfigWeight;
11223 }
11225 {
11226 weight = 1;
11227 }
11228 return weight;
11229 }
11230
11231
11232
11234 {
11235 GameInventory inventory = GetInventory();
11236 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11237 {
11238 array<EntityAI> items = new array<EntityAI>;
11240 for (int i = 0; i < items.Count(); ++i)
11241 {
11243 if (item)
11244 {
11245 g_Game.ObjectDelete(item);
11246 }
11247 }
11248 }
11249 }
11250
11251
11252
11253
11255 {
11256 float energy = 0;
11257 if (HasEnergyManager())
11258 {
11259 energy = GetCompEM().GetEnergy();
11260 }
11261 return energy;
11262 }
11263
11264
11266 {
11267 super.OnEnergyConsumed();
11268
11270 }
11271
11273 {
11274 super.OnEnergyAdded();
11275
11277 }
11278
11279
11281 {
11282 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11283 {
11285 {
11286 float energy_0to1 = GetCompEM().GetEnergy0To1();
11288 }
11289 }
11290 }
11291
11292
11294 {
11295 return ConfigGetFloat("heatIsolation");
11296 }
11297
11299 {
11301 }
11302
11304 {
11305 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11306 if (
g_Game.ConfigIsExisting(paramPath))
11307 return g_Game.ConfigGetFloat(paramPath);
11308
11309 return 0.0;
11310 }
11311
11313 {
11314 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11315 if (
g_Game.ConfigIsExisting(paramPath))
11316 return g_Game.ConfigGetFloat(paramPath);
11317
11318 return 0.0;
11319 }
11320
11321 override void SetWet(
float value,
bool allow_client =
false)
11322 {
11323 if (!IsServerCheck(allow_client))
11324 return;
11325
11328
11330
11331 m_VarWet = Math.Clamp(value, min, max);
11332
11334 {
11337 }
11338 }
11339
11340 override void AddWet(
float value)
11341 {
11343 }
11344
11346 {
11348 }
11349
11351 {
11353 }
11354
11356 {
11358 }
11359
11361 {
11363 }
11364
11366 {
11368 }
11369
11370 override void OnWetChanged(
float newVal,
float oldVal)
11371 {
11374 if (newLevel != oldLevel)
11375 {
11377 }
11378 }
11379
11381 {
11382 SetWeightDirty();
11383 }
11384
11386 {
11387 return GetWetLevelInternal(
m_VarWet);
11388 }
11389
11390
11391
11393 {
11395 }
11396
11398 {
11400 }
11401
11403 {
11405 }
11406
11408 {
11410 }
11411
11412
11413
11415 {
11416 if (ConfigIsExisting("itemModelLength"))
11417 {
11418 return ConfigGetFloat("itemModelLength");
11419 }
11420 return 0;
11421 }
11422
11424 {
11425 if (ConfigIsExisting("itemAttachOffset"))
11426 {
11427 return ConfigGetFloat("itemAttachOffset");
11428 }
11429 return 0;
11430 }
11431
11432 override void SetCleanness(
int value,
bool allow_client =
false)
11433 {
11434 if (!IsServerCheck(allow_client))
11435 return;
11436
11438
11440
11443 }
11444
11446 {
11448 }
11449
11451 {
11452 return true;
11453 }
11454
11455
11456
11457
11459 {
11461 }
11462
11464 {
11466 }
11467
11468
11469
11470
11471 override void SetColor(
int r,
int g,
int b,
int a)
11472 {
11478 }
11480 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11481 {
11486 }
11487
11489 {
11491 }
11492
11495 {
11496 int r,g,b,a;
11498 r = r/255;
11499 g = g/255;
11500 b = b/255;
11501 a = a/255;
11502 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11503 }
11504
11505
11506
11507 override void SetLiquidType(
int value,
bool allow_client =
false)
11508 {
11509 if (!IsServerCheck(allow_client))
11510 return;
11511
11516 }
11517
11519 {
11520 return ConfigGetInt("varLiquidTypeInit");
11521 }
11522
11524 {
11526 }
11527
11529 {
11531 SetFrozen(false);
11532 }
11533
11536 {
11537 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11538 }
11539
11540
11543 {
11544 PlayerBase nplayer;
11545 if (PlayerBase.CastTo(nplayer, player))
11546 {
11548 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11549 }
11550 }
11551
11552
11555 {
11556 PlayerBase nplayer;
11557 if (PlayerBase.CastTo(nplayer,player))
11558 {
11559 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11560 }
11561
11562 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11563
11564 if (HasEnergyManager())
11565 {
11566 GetCompEM().UpdatePlugState();
11567 }
11568 }
11569
11570
11572 {
11573 super.OnPlacementStarted(player);
11574
11576 }
11577
11578 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11579 {
11581 {
11582 m_AdminLog.OnPlacementComplete(player,
this);
11583 }
11584
11585 super.OnPlacementComplete(player, position, orientation);
11586 }
11587
11588
11589
11590
11591
11593 {
11595 {
11596 return true;
11597 }
11598 else
11599 {
11600 return false;
11601 }
11602 }
11603
11604
11606 {
11608 {
11610 }
11611 }
11612
11613
11615 {
11617 }
11618
11620 {
11622 }
11623
11624 override void InsertAgent(
int agent,
float count = 1)
11625 {
11626 if (count < 1)
11627 return;
11628
11630 }
11631
11634 {
11636 }
11637
11638
11640 {
11642 }
11643
11644
11645
11646
11647
11648
11649
11650
11651
11652
11653
11654
11655
11656
11657
11658
11659
11660
11661
11662
11663
11664
11665
11666
11667
11668
11669
11670
11671
11672
11673
11674
11675
11676
11677
11678
11679
11680
11681
11682
11683
11684
11686 {
11688 return false;
11689 return true;
11690 }
11691
11693 {
11694
11696 }
11697
11698
11701 {
11702 super.CheckForRoofLimited(timeTresholdMS);
11703
11704 float time =
g_Game.GetTime();
11705 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11706 {
11707 m_PreviousRoofTestTime = time;
11708 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11709 }
11710 }
11711
11712
11714 {
11716 {
11717 return 0;
11718 }
11719
11720 if (GetInventory().GetAttachmentSlotsCount() != 0)
11721 {
11722 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11723 if (filter)
11724 return filter.GetProtectionLevel(type, false, system);
11725 else
11726 return 0;
11727 }
11728
11729 string subclassPath, entryName;
11730
11731 switch (type)
11732 {
11734 entryName = "biological";
11735 break;
11737 entryName = "chemical";
11738 break;
11739 default:
11740 entryName = "biological";
11741 break;
11742 }
11743
11744 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11745
11746 return g_Game.ConfigGetFloat(subclassPath + entryName);
11747 }
11748
11749
11750
11753 {
11754 if (!IsMagazine())
11756
11758 }
11759
11760
11761
11762
11763
11768 {
11769 return true;
11770 }
11771
11773 {
11775 }
11776
11777
11778
11779
11780
11782 {
11783 if (parent)
11784 {
11785 if (parent.IsInherited(DayZInfected))
11786 return true;
11787
11788 if (!parent.IsRuined())
11789 return true;
11790 }
11791
11792 return true;
11793 }
11794
11796 {
11797 if (!super.CanPutAsAttachment(parent))
11798 {
11799 return false;
11800 }
11801
11802 if (!IsRuined() && !parent.IsRuined())
11803 {
11804 return true;
11805 }
11806
11807 return false;
11808 }
11809
11811 {
11812
11813
11814
11815
11816 return super.CanReceiveItemIntoCargo(item);
11817 }
11818
11820 {
11821
11822
11823
11824
11825 GameInventory attachmentInv = attachment.GetInventory();
11827 {
11828 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11829 return false;
11830 }
11831
11832 InventoryLocation loc = new InventoryLocation();
11833 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11834 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11835 return false;
11836
11837 return super.CanReceiveAttachment(attachment, slotId);
11838 }
11839
11841 {
11842 if (!super.CanReleaseAttachment(attachment))
11843 return false;
11844
11845 return GetInventory().AreChildrenAccessible();
11846 }
11847
11848
11849
11850
11851
11852
11853
11854
11855
11856
11857
11858
11859
11860
11861
11862
11863
11864
11865
11866
11867
11869 {
11870 int id = muzzle_owner.GetMuzzleID();
11871 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11872
11873 if (WPOF_array)
11874 {
11875 for (int i = 0; i < WPOF_array.Count(); i++)
11876 {
11877 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11878
11879 if (WPOF)
11880 {
11881 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11882 }
11883 }
11884 }
11885 }
11886
11887
11889 {
11890 int id = muzzle_owner.GetMuzzleID();
11892
11893 if (WPOBE_array)
11894 {
11895 for (int i = 0; i < WPOBE_array.Count(); i++)
11896 {
11897 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11898
11899 if (WPOBE)
11900 {
11901 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11902 }
11903 }
11904 }
11905 }
11906
11907
11909 {
11910 int id = muzzle_owner.GetMuzzleID();
11911 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11912
11913 if (WPOOH_array)
11914 {
11915 for (int i = 0; i < WPOOH_array.Count(); i++)
11916 {
11917 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11918
11919 if (WPOOH)
11920 {
11921 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11922 }
11923 }
11924 }
11925 }
11926
11927
11929 {
11930 int id = muzzle_owner.GetMuzzleID();
11931 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11932
11933 if (WPOOH_array)
11934 {
11935 for (int i = 0; i < WPOOH_array.Count(); i++)
11936 {
11937 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11938
11939 if (WPOOH)
11940 {
11941 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11942 }
11943 }
11944 }
11945 }
11946
11947
11949 {
11950 int id = muzzle_owner.GetMuzzleID();
11951 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11952
11953 if (WPOOH_array)
11954 {
11955 for (int i = 0; i < WPOOH_array.Count(); i++)
11956 {
11957 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11958
11959 if (WPOOH)
11960 {
11961 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11962 }
11963 }
11964 }
11965 }
11966
11967
11968
11970 {
11972 {
11973 return true;
11974 }
11975
11976 return false;
11977 }
11978
11980 {
11982 {
11983 return true;
11984 }
11985
11986 return false;
11987 }
11988
11990 {
11992 {
11993 return true;
11994 }
11995
11996 return false;
11997 }
11998
12000 {
12001 return false;
12002 }
12003
12006 {
12007 return UATimeSpent.DEFAULT_DEPLOY;
12008 }
12009
12010
12011
12012
12014 {
12016 SetSynchDirty();
12017 }
12018
12020 {
12022 }
12023
12024
12026 {
12027 return false;
12028 }
12029
12032 {
12033 string att_type = "None";
12034
12035 if (ConfigIsExisting("soundAttType"))
12036 {
12037 att_type = ConfigGetString("soundAttType");
12038 }
12039
12041 }
12042
12044 {
12046 }
12047
12048
12049
12050
12051
12057
12059 {
12062
12064 }
12065
12066
12068 {
12070 return;
12071
12073
12076
12079
12080 SoundParameters params = new SoundParameters();
12084 }
12085
12086
12088 {
12090 {
12093
12094 SetSynchDirty();
12095
12098 }
12099 }
12100
12102 {
12104 }
12105
12106
12108 {
12110 return;
12111
12113 SetSynchDirty();
12114
12117 }
12118
12120 {
12123 }
12124
12126 {
12128 }
12129
12130 void OnApply(PlayerBase player);
12131
12133 {
12134 return 1.0;
12135 };
12136
12138 {
12140 }
12141
12143 {
12145 }
12146
12148
12150 {
12151 SetDynamicPhysicsLifeTime(0.01);
12153 }
12154
12156 {
12157 array<string> zone_names = new array<string>;
12158 GetDamageZones(zone_names);
12159 for (int i = 0; i < zone_names.Count(); i++)
12160 {
12161 SetHealthMax(zone_names.Get(i),"Health");
12162 }
12163 SetHealthMax("","Health");
12164 }
12165
12168 {
12169 float global_health = GetHealth01("","Health");
12170 array<string> zones = new array<string>;
12171 GetDamageZones(zones);
12172
12173 for (int i = 0; i < zones.Count(); i++)
12174 {
12175 SetHealth01(zones.Get(i),"Health",global_health);
12176 }
12177 }
12178
12181 {
12182 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12183 }
12184
12186 {
12187 if (!hasRootAsPlayer)
12188 {
12189 if (refParentIB)
12190 {
12191
12192 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12193 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12194
12195 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12196 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12197
12200 }
12201 else
12202 {
12203
12206 }
12207 }
12208 }
12209
12211 {
12213 {
12214 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12215 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12216 {
12217 float heatPermCoef = 1.0;
12219 while (ent)
12220 {
12221 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12222 ent = ent.GetHierarchyParent();
12223 }
12224
12225 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12226 }
12227 }
12228 }
12229
12231 {
12232
12233 EntityAI parent = GetHierarchyParent();
12234 if (!parent)
12235 {
12236 hasParent = false;
12237 hasRootAsPlayer = false;
12238 }
12239 else
12240 {
12241 hasParent = true;
12242 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12243 refParentIB =
ItemBase.Cast(parent);
12244 }
12245 }
12246
12247 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12248 {
12249
12250 }
12251
12253 {
12254
12255 return false;
12256 }
12257
12259 {
12260
12261
12262 return false;
12263 }
12264
12266 {
12267
12268 return false;
12269 }
12270
12273 {
12274 return !GetIsFrozen() &&
IsOpen();
12275 }
12276
12278 {
12279 bool hasParent = false, hasRootAsPlayer = false;
12281
12282 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12283 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12284
12285 if (wwtu || foodDecay)
12286 {
12290
12291 if (processWetness || processTemperature || processDecay)
12292 {
12294
12295 if (processWetness)
12296 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12297
12298 if (processTemperature)
12300
12301 if (processDecay)
12302 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12303 }
12304 }
12305 }
12306
12309 {
12311 }
12312
12314 {
12317
12318 return super.GetTemperatureFreezeThreshold();
12319 }
12320
12322 {
12325
12326 return super.GetTemperatureThawThreshold();
12327 }
12328
12330 {
12333
12334 return super.GetItemOverheatThreshold();
12335 }
12336
12338 {
12340 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12341
12342 return super.GetTemperatureFreezeTime();
12343 }
12344
12346 {
12348 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12349
12350 return super.GetTemperatureThawTime();
12351 }
12352
12357
12359 {
12360 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12361 }
12362
12364 {
12365 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12366 }
12367
12370 {
12372 }
12373
12375 {
12377 }
12378
12380 {
12382 }
12383
12386 {
12387 return null;
12388 }
12389
12392 {
12393 return false;
12394 }
12395
12397 {
12399 {
12402 if (!trg)
12403 {
12405 explosive = this;
12406 }
12407
12408 explosive.PairRemote(trg);
12410
12411 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12412 trg.SetPersistentPairID(persistentID);
12413 explosive.SetPersistentPairID(persistentID);
12414
12415 return true;
12416 }
12417 return false;
12418 }
12419
12422 {
12423 float ret = 1.0;
12426 ret *= GetHealth01();
12427
12428 return ret;
12429 }
12430
12431 #ifdef DEVELOPER
12432 override void SetDebugItem()
12433 {
12434 super.SetDebugItem();
12435 _itemBase = this;
12436 }
12437
12439 {
12440 string text = super.GetDebugText();
12441
12443 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12444
12445 return text;
12446 }
12447 #endif
12448
12450 {
12451 return true;
12452 }
12453
12455
12457
12459 {
12462 }
12463
12464
12472
12488
12489 [
Obsolete(
"Use ItemSoundHandler instead")]
12492 {
12493 if (!
g_Game.IsDedicatedServer())
12494 {
12495 if (ConfigIsExisting("attachSoundSet"))
12496 {
12497 string cfg_path = "";
12498 string soundset = "";
12499 string type_name =
GetType();
12500
12503 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12504 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12505
12506 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12507 {
12508 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12509 {
12510 if (cfg_slot_array[i] == slot_type)
12511 {
12512 soundset = cfg_soundset_array[i];
12513 break;
12514 }
12515 }
12516 }
12517
12518 if (soundset != "")
12519 {
12520 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12522 }
12523 }
12524 }
12525 }
12526
12528}
12529
12531{
12533 if (entity)
12534 {
12535 bool is_item = entity.IsInherited(
ItemBase);
12536 if (is_item && full_quantity)
12537 {
12540 }
12541 }
12542 else
12543 {
12545 return NULL;
12546 }
12547 return entity;
12548}
12549
12551{
12552 if (item)
12553 {
12554 if (health > 0)
12555 item.SetHealth("", "", health);
12556
12557 if (item.CanHaveTemperature())
12558 {
12560 if (item.CanFreeze())
12561 item.SetFrozen(false);
12562 }
12563
12564 if (item.HasEnergyManager())
12565 {
12566 if (quantity >= 0)
12567 {
12568 item.GetCompEM().SetEnergy0To1(quantity);
12569 }
12570 else
12571 {
12573 }
12574 }
12575 else if (item.IsMagazine())
12576 {
12577 Magazine mag = Magazine.Cast(item);
12578 if (quantity >= 0)
12579 {
12580 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12581 }
12582 else
12583 {
12585 }
12586
12587 }
12588 else
12589 {
12590 if (quantity >= 0)
12591 {
12592 item.SetQuantityNormalized(quantity, false);
12593 }
12594 else
12595 {
12597 }
12598
12599 }
12600 }
12601}
12602
12603#ifdef DEVELOPER
12605#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.