7549{
7551 {
7552 return true;
7553 }
7554};
7555
7557{
7558
7559};
7560
7561
7562
7564{
7568
7570
7573
7574
7575
7576
7577
7586
7592
7597
7602
7623 protected bool m_IsResultOfSplit
7624
7626
7631
7632
7633
7635
7639
7640
7641
7643
7646
7647
7648
7654
7655
7663
7666
7667
7669
7670
7672
7673
7678
7679
7684
7686
7687
7689
7690
7692 {
7697
7698 if (!
g_Game.IsDedicatedServer())
7699 {
7701 {
7703
7705 {
7707 }
7708 }
7709
7712 }
7713
7714 m_OldLocation = null;
7715
7717 {
7719 }
7720
7721 if (ConfigIsExisting("headSelectionsToHide"))
7722 {
7725 }
7726
7728 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7729 {
7731 }
7732
7734
7735 m_IsResultOfSplit = false;
7736
7738 }
7739
7741 {
7742 super.InitItemVariables();
7743
7749 m_Count = ConfigGetInt(
"count");
7750
7753
7758
7761
7766
7778
7782
7783
7786 if (ConfigIsExisting("canBeSplit"))
7787 {
7790 }
7791
7793 if (ConfigIsExisting("itemBehaviour"))
7795
7796
7799 RegisterNetSyncVariableInt("m_VarLiquidType");
7800 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7801
7802 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7803 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7804 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7805
7806 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7807 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7808 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7809 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7810
7811 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7812 RegisterNetSyncVariableBool("m_IsTakeable");
7813 RegisterNetSyncVariableBool("m_IsHologram");
7814
7817 {
7820 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7821 }
7822
7824
7826 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7828
7830 }
7831
7833 {
7835 }
7836
7838 {
7841 {
7846 }
7847 }
7848
7849 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7850 {
7852 {
7855 }
7856
7858 }
7859
7861 {
7867 }
7868
7870
7872 {
7874
7875 if (!action)
7876 {
7877 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7878 return;
7879 }
7880
7882 if (!ai)
7883 {
7885 return;
7886 }
7887
7889 if (!action_array)
7890 {
7891 action_array = new array<ActionBase_Basic>;
7893 }
7894 if (LogManager.IsActionLogEnable())
7895 {
7896 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7897 }
7898
7899 if (action_array.Find(action) != -1)
7900 {
7901 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7902 }
7903 else
7904 {
7905 action_array.Insert(action);
7906 }
7907 }
7908
7910 {
7911 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7912 ActionBase action = player.GetActionManager().GetAction(actionName);
7915
7916 if (action_array)
7917 {
7918 action_array.RemoveItem(action);
7919 }
7920 }
7921
7922
7923
7925 {
7926 ActionOverrideData overrideData = new ActionOverrideData();
7930
7932 if (!actionMap)
7933 {
7936 }
7937
7938 actionMap.Insert(this.
Type(), overrideData);
7939
7940 }
7941
7943
7945
7946
7948 {
7951
7954
7955 string config_to_search = "CfgVehicles";
7956 string muzzle_owner_config;
7957
7959 {
7960 if (IsInherited(Weapon))
7961 config_to_search = "CfgWeapons";
7962
7963 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7964
7965 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7966
7967 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7968
7969 if (config_OnFire_subclass_count > 0)
7970 {
7971 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7972
7973 for (int i = 0; i < config_OnFire_subclass_count; i++)
7974 {
7975 string particle_class = "";
7976 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7977 string config_OnFire_entry = config_OnFire_class + particle_class;
7978 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7979 WPOF_array.Insert(WPOF);
7980 }
7981
7982
7984 }
7985 }
7986
7988 {
7989 config_to_search = "CfgWeapons";
7990 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7991
7992 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7993
7994 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7995
7996 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7997 {
7998 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7999
8000 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8001 {
8002 string particle_class2 = "";
8003 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8004 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8005 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8006 WPOBE_array.Insert(WPOBE);
8007 }
8008
8009
8011 }
8012 }
8013 }
8014
8015
8017 {
8020
8022 {
8023 string config_to_search = "CfgVehicles";
8024
8025 if (IsInherited(Weapon))
8026 config_to_search = "CfgWeapons";
8027
8028 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8029 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8030
8031 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8032 {
8033
8035
8037 {
8039 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8041 return;
8042 }
8043
8046
8047
8048
8049 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8050 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8051
8052 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8053 {
8054 string particle_class = "";
8055 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8056 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8057 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8058
8059 if (entry_type == CT_CLASS)
8060 {
8061 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8062 WPOOH_array.Insert(WPOF);
8063 }
8064 }
8065
8066
8068 }
8069 }
8070 }
8071
8073 {
8075 }
8076
8078 {
8080 {
8082
8085
8088
8089 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8090 }
8091 }
8092
8094 {
8096 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8097
8099 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8100
8102 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8103
8105 {
8107 }
8108 }
8109
8111 {
8113 }
8114
8116 {
8119 else
8121
8123 {
8126 }
8127 else
8128 {
8131
8134 }
8135
8137 }
8138
8140 {
8142 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8143 }
8144
8146 {
8148 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8150 }
8151
8153 {
8155 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8156 }
8157
8159 {
8162
8163 OverheatingParticle OP = new OverheatingParticle();
8168
8170 }
8171
8173 {
8176
8177 return -1;
8178 }
8179
8181 {
8183 {
8186
8187 for (int i = count; i > 0; --i)
8188 {
8189 int id = i - 1;
8192
8195
8196 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8197 {
8198 if (p)
8199 {
8202 }
8203 }
8204 }
8205 }
8206 }
8207
8209 {
8211 {
8213 {
8214 int id = i - 1;
8216
8217 if (OP)
8218 {
8220
8221 if (p)
8222 {
8224 }
8225
8226 delete OP;
8227 }
8228 }
8229
8232 }
8233 }
8234
8237 {
8238 return 0.0;
8239 }
8240
8241
8243 {
8244 return 250;
8245 }
8246
8248 {
8249 return 0;
8250 }
8251
8254 {
8256 return true;
8257
8258 return false;
8259 }
8260
8263 {
8266
8268 {
8270 }
8271 else
8272 {
8273
8275 }
8276
8278 }
8279
8286 {
8287 return -1;
8288 }
8289
8290
8291
8292
8294 {
8296 {
8297 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8298 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8299
8300 if (r_index >= 0)
8301 {
8302 InventoryLocation r_il = new InventoryLocation;
8303 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8304
8305 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8308 {
8309 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8310 }
8312 {
8313 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8314 }
8315
8316 }
8317
8318 player.GetHumanInventory().ClearUserReservedLocation(this);
8319 }
8320
8323 }
8324
8325
8326
8327
8329 {
8330 return ItemBase.m_DebugActionsMask;
8331 }
8332
8334 {
8335 return ItemBase.m_DebugActionsMask & mask;
8336 }
8337
8339 {
8340 ItemBase.m_DebugActionsMask = mask;
8341 }
8342
8344 {
8345 ItemBase.m_DebugActionsMask |= mask;
8346 }
8347
8349 {
8350 ItemBase.m_DebugActionsMask &= ~mask;
8351 }
8352
8354 {
8356 {
8358 }
8359 else
8360 {
8362 }
8363 }
8364
8365
8367 {
8368 if (GetEconomyProfile())
8369 {
8370 float q_max = GetEconomyProfile().GetQuantityMax();
8371 if (q_max > 0)
8372 {
8373 float q_min = GetEconomyProfile().GetQuantityMin();
8374 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8375
8377 {
8378 ComponentEnergyManager comp = GetCompEM();
8380 {
8382 }
8383 }
8385 {
8387
8388 }
8389
8390 }
8391 }
8392 }
8393
8396 {
8397 EntityAI parent = GetHierarchyParent();
8398
8399 if (parent)
8400 {
8401 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8402 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8403 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8404 }
8405 }
8406
8409 {
8410 EntityAI parent = GetHierarchyParent();
8411
8412 if (parent)
8413 {
8414 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8415 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8416 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8417 }
8418 }
8419
8421 {
8422
8423
8424
8425
8427
8429 {
8430 if (ScriptInputUserData.CanStoreInputUserData())
8431 {
8432 ScriptInputUserData ctx = new ScriptInputUserData;
8438 ctx.
Write(use_stack_max);
8441
8443 {
8444 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8445 }
8446 }
8447 }
8448 else if (!
g_Game.IsMultiplayer())
8449 {
8451 }
8452 }
8453
8455 {
8457 }
8458
8460 {
8462 }
8463
8465 {
8467 }
8468
8470 {
8471
8472 return false;
8473 }
8474
8476 {
8477 return false;
8478 }
8479
8483 {
8484 return false;
8485 }
8486
8488 {
8489 return "";
8490 }
8491
8493
8495 {
8496 return false;
8497 }
8498
8500 {
8501 return true;
8502 }
8503
8504
8505
8507 {
8508 return true;
8509 }
8510
8512 {
8513 return true;
8514 }
8515
8517 {
8518 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8520 }
8521
8523 {
8525 }
8526
8528 {
8530 if (!is_being_placed)
8532 SetSynchDirty();
8533 }
8534
8535
8537
8539 {
8541 }
8542
8544 {
8546 }
8547
8549 {
8550 return 1;
8551 }
8552
8554 {
8555 return false;
8556 }
8557
8559 {
8561 SetSynchDirty();
8562 }
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8599 {
8600 super.OnMovedInsideCargo(container);
8601
8602 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8603 }
8604
8605 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8606 {
8607 super.EEItemLocationChanged(oldLoc, newLoc);
8608
8609 PlayerBase newPlayer = null;
8610 PlayerBase oldPlayer = null;
8611
8612 if (newLoc.GetParent())
8613 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8614
8615 if (oldLoc.GetParent())
8616 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8617
8619 {
8620 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8621
8622 if (rIndex >= 0)
8623 {
8624 InventoryLocation rIl = new InventoryLocation;
8625 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8626
8627 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8630 {
8631 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8632 }
8634 {
8636 }
8637
8638 }
8639 }
8640
8642 {
8643 if (newPlayer)
8644 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8645
8646 if (newPlayer == oldPlayer)
8647 {
8648 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8649 {
8651 {
8652 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8653 {
8654 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8655 }
8656 }
8657 else
8658 {
8659 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8660 }
8661 }
8662
8663 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8664 {
8665 int type = oldLoc.GetType();
8667 {
8668 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8669 }
8671 {
8672 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8673 }
8674 }
8675 if (!m_OldLocation)
8676 {
8677 m_OldLocation = new InventoryLocation;
8678 }
8679 m_OldLocation.Copy(oldLoc);
8680 }
8681 else
8682 {
8683 if (m_OldLocation)
8684 {
8685 m_OldLocation.Reset();
8686 }
8687 }
8688
8689 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8690 }
8691 else
8692 {
8693 if (newPlayer)
8694 {
8695 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8696 if (resIndex >= 0)
8697 {
8698 InventoryLocation il = new InventoryLocation;
8699 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8701 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8704 {
8705 il.
GetParent().GetOnReleaseLock().Invoke(it);
8706 }
8708 {
8710 }
8711
8712 }
8713 }
8715 {
8716
8718 }
8719
8720 if (m_OldLocation)
8721 {
8722 m_OldLocation.Reset();
8723 }
8724 }
8725
8727 {
8728 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8729 }
8730
8732 {
8733 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8734 }
8735 }
8736
8737 override void EOnContact(IEntity other, Contact extra)
8738 {
8740 {
8741 int liquidType = -1;
8743 if (impactSpeed > 0.0)
8744 {
8746 #ifndef SERVER
8748 #else
8750 SetSynchDirty();
8751 #endif
8753 }
8754 }
8755
8756 #ifdef SERVER
8757 if (GetCompEM() && GetCompEM().IsPlugged())
8758 {
8759 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8760 GetCompEM().UnplugThis();
8761 }
8762 #endif
8763 }
8764
8766
8768 {
8770 }
8771
8773 {
8774
8775 }
8776
8778 {
8779 super.OnItemLocationChanged(old_owner, new_owner);
8780
8781 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8782 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8783
8784 if (!relatedPlayer && playerNew)
8785 relatedPlayer = playerNew;
8786
8787 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8788 {
8790 if (actionMgr)
8791 {
8792 ActionBase currentAction = actionMgr.GetRunningAction();
8793 if (currentAction)
8795 }
8796 }
8797
8798 Man ownerPlayerOld = null;
8799 Man ownerPlayerNew = null;
8800
8801 if (old_owner)
8802 {
8803 if (old_owner.
IsMan())
8804 {
8805 ownerPlayerOld = Man.Cast(old_owner);
8806 }
8807 else
8808 {
8809 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8810 }
8811 }
8812 else
8813 {
8815 {
8817
8818 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8819 {
8820 GetCompEM().UnplugThis();
8821 }
8822 }
8823 }
8824
8825 if (new_owner)
8826 {
8827 if (new_owner.
IsMan())
8828 {
8829 ownerPlayerNew = Man.Cast(new_owner);
8830 }
8831 else
8832 {
8833 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8834 }
8835 }
8836
8837 if (ownerPlayerOld != ownerPlayerNew)
8838 {
8839 if (ownerPlayerOld)
8840 {
8841 array<EntityAI> subItemsExit = new array<EntityAI>;
8843 for (int i = 0; i < subItemsExit.Count(); i++)
8844 {
8847 }
8848 }
8849
8850 if (ownerPlayerNew)
8851 {
8852 array<EntityAI> subItemsEnter = new array<EntityAI>;
8854 for (int j = 0; j < subItemsEnter.Count(); j++)
8855 {
8858 }
8859 }
8860 }
8861 else if (ownerPlayerNew != null)
8862 {
8863 PlayerBase nplayer;
8864 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8865 {
8866 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8868 for (int k = 0; k < subItemsUpdate.Count(); k++)
8869 {
8871 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8872 }
8873 }
8874 }
8875
8876 if (old_owner)
8877 old_owner.OnChildItemRemoved(this);
8878 if (new_owner)
8879 new_owner.OnChildItemReceived(this);
8880 }
8881
8882
8884 {
8885 super.EEDelete(parent);
8886 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8887 if (player)
8888 {
8890
8891 if (player.IsAlive())
8892 {
8893 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8894 if (r_index >= 0)
8895 {
8896 InventoryLocation r_il = new InventoryLocation;
8897 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8898
8899 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8902 {
8903 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8904 }
8906 {
8907 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8908 }
8909
8910 }
8911
8912 player.RemoveQuickBarEntityShortcut(this);
8913 }
8914 }
8915 }
8916
8918 {
8919 super.EEKilled(killer);
8920
8923 {
8924 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8925 {
8926 if (IsMagazine())
8927 {
8928 if (Magazine.Cast(this).GetAmmoCount() > 0)
8929 {
8931 }
8932 }
8933 else
8934 {
8936 }
8937 }
8938 }
8939 }
8940
8942 {
8943 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8944
8945 super.OnWasAttached(parent, slot_id);
8946
8949
8952 }
8953
8955 {
8956 super.OnWasDetached(parent, slot_id);
8957
8960
8963 }
8964
8966 {
8967 int idx;
8970
8971 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8972 if (inventory_slots.Count() < 1)
8973 {
8974 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8975 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8976 }
8977 else
8978 {
8979 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8980 }
8981
8982 idx = inventory_slots.Find(slot);
8983 if (idx < 0)
8984 return "";
8985
8986 return attach_types.Get(idx);
8987 }
8988
8990 {
8991 int idx = -1;
8992 string slot;
8993
8996
8997 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8998 if (inventory_slots.Count() < 1)
8999 {
9000 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9001 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9002 }
9003 else
9004 {
9005 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9006 if (detach_types.Count() < 1)
9007 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9008 }
9009
9010 for (int i = 0; i < inventory_slots.Count(); i++)
9011 {
9012 slot = inventory_slots.Get(i);
9013 }
9014
9015 if (slot != "")
9016 {
9017 if (detach_types.Count() == 1)
9018 idx = 0;
9019 else
9020 idx = inventory_slots.Find(slot);
9021 }
9022 if (idx < 0)
9023 return "";
9024
9025 return detach_types.Get(idx);
9026 }
9027
9029 {
9030
9032
9033
9034 float min_time = 1;
9035 float max_time = 3;
9036 float delay = Math.RandomFloat(min_time, max_time);
9037
9038 explode_timer.Run(delay, this, "DoAmmoExplosion");
9039 }
9040
9042 {
9043 Magazine magazine = Magazine.Cast(this);
9044 int pop_sounds_count = 6;
9045 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9046
9047
9048 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9049 string sound_name = pop_sounds[ sound_idx ];
9050 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9051
9052
9053 magazine.ServerAddAmmoCount(-1);
9054
9055
9056 float min_temp_to_explode = 100;
9057
9058 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9059 {
9061 }
9062 }
9063
9064
9065 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9066 {
9067 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9068
9069 const int CHANCE_DAMAGE_CARGO = 4;
9070 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9071 const int CHANCE_DAMAGE_NOTHING = 2;
9072
9074 {
9075 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9076 int chances;
9077 int rnd;
9078
9079 if (GetInventory().GetCargo())
9080 {
9081 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9082 rnd = Math.RandomInt(0,chances);
9083
9084 if (rnd < CHANCE_DAMAGE_CARGO)
9085 {
9087 }
9088 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9089 {
9091 }
9092 }
9093 else
9094 {
9095 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9096 rnd = Math.RandomInt(0,chances);
9097
9098 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9099 {
9101 }
9102 }
9103 }
9104 }
9105
9107 {
9108 CargoBase cargo = GetInventory().GetCargo();
9109 if (cargo)
9110 {
9112 if (item_count > 0)
9113 {
9114 int random_pick = Math.RandomInt(0, item_count);
9116 if (!item.IsExplosive())
9117 {
9118 item.AddHealth("","",damage);
9119 return true;
9120 }
9121 }
9122 }
9123 return false;
9124 }
9125
9127 {
9128 GameInventory inventory = GetInventory();
9130 if (attachment_count > 0)
9131 {
9132 int random_pick = Math.RandomInt(0, attachment_count);
9134 if (!attachment.IsExplosive())
9135 {
9136 attachment.AddHealth("","",damage);
9137 return true;
9138 }
9139 }
9140 return false;
9141 }
9142
9144 {
9146 }
9147
9149 {
9151 return GetInventory().CanRemoveEntity();
9152
9153 return false;
9154 }
9155
9157 {
9158
9160 return false;
9161
9162
9164 return false;
9165
9166
9167
9169 if (delta == 0)
9170 return false;
9171
9172
9173 return true;
9174 }
9175
9177 {
9179 {
9180 if (ScriptInputUserData.CanStoreInputUserData())
9181 {
9182 ScriptInputUserData ctx = new ScriptInputUserData;
9187 ctx.
Write(destination_entity);
9191 }
9192 }
9193 else if (!
g_Game.IsMultiplayer())
9194 {
9196 }
9197 }
9198
9200 {
9201 float split_quantity_new;
9205 InventoryLocation loc = new InventoryLocation;
9206
9207 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9208 {
9210 split_quantity_new = stack_max;
9211 else
9213
9215 {
9216 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9217 if (new_item)
9218 {
9219 new_item.SetResultOfSplit(true);
9220 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9222 new_item.
SetQuantity(split_quantity_new,
false,
true);
9223 }
9224 }
9225 }
9226 else if (destination_entity && slot_id == -1)
9227 {
9228 if (quantity > stack_max)
9229 split_quantity_new = stack_max;
9230 else
9231 split_quantity_new = quantity;
9232
9234 {
9235 GameInventory destinationInventory = destination_entity.GetInventory();
9237 {
9240 }
9241
9242 if (new_item)
9243 {
9244 new_item.SetResultOfSplit(true);
9245 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9247 new_item.
SetQuantity(split_quantity_new,
false,
true);
9248 }
9249 }
9250 }
9251 else
9252 {
9253 if (stack_max != 0)
9254 {
9256 {
9258 }
9259
9260 if (split_quantity_new == 0)
9261 {
9262 if (!
g_Game.IsMultiplayer())
9263 player.PhysicalPredictiveDropItem(this);
9264 else
9265 player.ServerDropEntity(this);
9266 return;
9267 }
9268
9270 {
9272
9273 if (new_item)
9274 {
9275 new_item.SetResultOfSplit(true);
9276 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9279 new_item.PlaceOnSurface();
9280 }
9281 }
9282 }
9283 }
9284 }
9285
9287 {
9288 float split_quantity_new;
9292 InventoryLocation loc = new InventoryLocation;
9293
9294 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9295 {
9297 split_quantity_new = stack_max;
9298 else
9300
9302 {
9303 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9304 if (new_item)
9305 {
9306 new_item.SetResultOfSplit(true);
9307 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9309 new_item.
SetQuantity(split_quantity_new,
false,
true);
9310 }
9311 }
9312 }
9313 else if (destination_entity && slot_id == -1)
9314 {
9315 if (quantity > stack_max)
9316 split_quantity_new = stack_max;
9317 else
9318 split_quantity_new = quantity;
9319
9321 {
9322 GameInventory destinationInventory = destination_entity.GetInventory();
9324 {
9327 }
9328
9329 if (new_item)
9330 {
9331 new_item.SetResultOfSplit(true);
9332 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9334 new_item.
SetQuantity(split_quantity_new,
false,
true);
9335 }
9336 }
9337 }
9338 else
9339 {
9340 if (stack_max != 0)
9341 {
9343 {
9345 }
9346
9348 {
9350
9351 if (new_item)
9352 {
9353 new_item.SetResultOfSplit(true);
9354 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9357 new_item.PlaceOnSurface();
9358 }
9359 }
9360 }
9361 }
9362 }
9363
9365 {
9367 {
9368 if (ScriptInputUserData.CanStoreInputUserData())
9369 {
9370 ScriptInputUserData ctx = new ScriptInputUserData;
9375 dst.WriteToContext(ctx);
9377 }
9378 }
9379 else if (!
g_Game.IsMultiplayer())
9380 {
9382 }
9383 }
9384
9386 {
9388 {
9389 if (ScriptInputUserData.CanStoreInputUserData())
9390 {
9391 ScriptInputUserData ctx = new ScriptInputUserData;
9396 ctx.
Write(destination_entity);
9402 }
9403 }
9404 else if (!
g_Game.IsMultiplayer())
9405 {
9407 }
9408 }
9409
9411 {
9413 }
9414
9416 {
9418 float split_quantity_new;
9420 if (dst.IsValid())
9421 {
9422 int slot_id = dst.GetSlot();
9424
9425 if (quantity > stack_max)
9426 split_quantity_new = stack_max;
9427 else
9428 split_quantity_new = quantity;
9429
9431 {
9433
9434 if (new_item)
9435 {
9436 new_item.SetResultOfSplit(true);
9437 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9439 new_item.
SetQuantity(split_quantity_new,
false,
true);
9440 }
9441
9442 return new_item;
9443 }
9444 }
9445
9446 return null;
9447 }
9448
9450 {
9452 float split_quantity_new;
9454 if (destination_entity)
9455 {
9457 if (quantity > stackable)
9458 split_quantity_new = stackable;
9459 else
9460 split_quantity_new = quantity;
9461
9463 {
9464 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9465 if (new_item)
9466 {
9467 new_item.SetResultOfSplit(true);
9468 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9470 new_item.
SetQuantity(split_quantity_new,
false,
true);
9471 }
9472 }
9473 }
9474 }
9475
9477 {
9479 {
9480 if (ScriptInputUserData.CanStoreInputUserData())
9481 {
9482 ScriptInputUserData ctx = new ScriptInputUserData;
9487 ItemBase destination_entity =
this;
9488 ctx.
Write(destination_entity);
9492 }
9493 }
9494 else if (!
g_Game.IsMultiplayer())
9495 {
9497 }
9498 }
9499
9501 {
9503 float split_quantity_new;
9505 if (player)
9506 {
9508 if (quantity > stackable)
9509 split_quantity_new = stackable;
9510 else
9511 split_quantity_new = quantity;
9512
9514 {
9515 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9516 new_item =
ItemBase.Cast(in_hands);
9517 if (new_item)
9518 {
9519 new_item.SetResultOfSplit(true);
9520 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9522 new_item.SetQuantity(split_quantity_new, false, true);
9523 }
9524 }
9525 }
9526 }
9527
9529 {
9531 float split_quantity_new = Math.Floor(quantity * 0.5);
9532
9534 return;
9535
9537
9538 if (new_item)
9539 {
9540 if (new_item.GetQuantityMax() < split_quantity_new)
9541 {
9542 split_quantity_new = new_item.GetQuantityMax();
9543 }
9544
9545 new_item.SetResultOfSplit(true);
9546 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9547
9549 {
9552 }
9553 else
9554 {
9556 new_item.
SetQuantity(split_quantity_new,
false,
true);
9557 }
9558 }
9559 }
9560
9562 {
9564 float split_quantity_new = Math.Floor(quantity / 2);
9565
9567 return;
9568
9569 InventoryLocation invloc = new InventoryLocation;
9571
9573 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9574
9575 if (new_item)
9576 {
9577 if (new_item.GetQuantityMax() < split_quantity_new)
9578 {
9579 split_quantity_new = new_item.GetQuantityMax();
9580 }
9582 {
9585 }
9586 else if (split_quantity_new > 1)
9587 {
9589 new_item.
SetQuantity(split_quantity_new,
false,
true);
9590 }
9591 }
9592 }
9593
9596 {
9597 SetWeightDirty();
9599
9600 if (parent)
9601 parent.OnAttachmentQuantityChangedEx(this, delta);
9602
9604 {
9606 {
9608 }
9610 {
9611 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9613 }
9614 }
9615 }
9616
9619 {
9620
9621 }
9622
9625 {
9627 }
9628
9630 {
9631 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9632
9634 {
9635 if (newLevel == GameConstants.STATE_RUINED)
9636 {
9638 EntityAI parent = GetHierarchyParent();
9639 if (parent && parent.IsFireplace())
9640 {
9641 CargoBase cargo = GetInventory().GetCargo();
9642 if (cargo)
9643 {
9645 {
9647 }
9648 }
9649 }
9650 }
9651
9653 {
9654
9656 return;
9657 }
9658
9659 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9660 {
9662 }
9663 }
9664 }
9665
9666
9668 {
9669 super.OnRightClick();
9670
9672 {
9674 {
9675 if (ScriptInputUserData.CanStoreInputUserData())
9676 {
9677 EntityAI root = GetHierarchyRoot();
9678 Man playerOwner = GetHierarchyRootPlayer();
9679 InventoryLocation dst = new InventoryLocation;
9680
9681
9682 if (!playerOwner && root && root == this)
9683 {
9685 }
9686 else
9687 {
9688
9689 GetInventory().GetCurrentInventoryLocation(dst);
9691 {
9692 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9694 {
9696 }
9697 else
9698 {
9700
9701
9702 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9703 {
9705 }
9706 else
9707 {
9708 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9709 }
9710 }
9711 }
9712 }
9713
9714 ScriptInputUserData ctx = new ScriptInputUserData;
9722 }
9723 }
9724 else if (!
g_Game.IsMultiplayer())
9725 {
9727 }
9728 }
9729 }
9730
9732 {
9733 if (root)
9734 {
9735 vector m4[4];
9736 root.GetTransform(m4);
9737 dst.SetGround(this, m4);
9738 }
9739 else
9740 {
9741 GetInventory().GetCurrentInventoryLocation(dst);
9742 }
9743 }
9744
9745 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9746 {
9747
9748 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9749 return false;
9750
9751 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9752 return false;
9753
9754
9756 return false;
9757
9758
9759 Magazine mag = Magazine.Cast(this);
9760 if (mag)
9761 {
9762 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9763 return false;
9764
9765 if (stack_max_limit)
9766 {
9767 Magazine other_mag = Magazine.Cast(other_item);
9768 if (other_item)
9769 {
9770 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9771 return false;
9772 }
9773
9774 }
9775 }
9776 else
9777 {
9778
9780 return false;
9781
9783 return false;
9784 }
9785
9786 PlayerBase player = null;
9787 if (CastTo(player, GetHierarchyRootPlayer()))
9788 {
9789 if (player.GetInventory().HasAttachment(this))
9790 return false;
9791
9792 if (player.IsItemsToDelete())
9793 return false;
9794 }
9795
9796 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9797 return false;
9798
9799 int slotID;
9801 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9802 return false;
9803
9804 return true;
9805 }
9806
9808 {
9810 }
9811
9813 {
9814 return m_IsResultOfSplit;
9815 }
9816
9818 {
9819 m_IsResultOfSplit = value;
9820 }
9821
9823 {
9825 }
9826
9828 {
9829 float other_item_quantity = other_item.GetQuantity();
9830 float this_free_space;
9831
9833
9835
9836 if (other_item_quantity > this_free_space)
9837 {
9838 return this_free_space;
9839 }
9840 else
9841 {
9842 return other_item_quantity;
9843 }
9844 }
9845
9847 {
9849 }
9850
9852 {
9854 return;
9855
9856 if (!IsMagazine() && other_item)
9857 {
9859 if (quantity_used != 0)
9860 {
9861 float hp1 = GetHealth01("","");
9862 float hp2 = other_item.GetHealth01("","");
9863 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9864 hpResult = hpResult / (
GetQuantity() + quantity_used);
9865
9866 hpResult *= GetMaxHealth();
9867 Math.Round(hpResult);
9868 SetHealth("", "Health", hpResult);
9869
9871 other_item.AddQuantity(-quantity_used);
9872 }
9873 }
9875 }
9876
9878 {
9879 #ifdef SERVER
9880 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9881 GetHierarchyParent().IncreaseLifetimeUp();
9882 #endif
9883 };
9884
9886 {
9887 PlayerBase p = PlayerBase.Cast(player);
9888
9889 array<int> recipesIds = p.m_Recipes;
9890 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9891 if (moduleRecipesManager)
9892 {
9893 EntityAI itemInHands = player.GetEntityInHands();
9894 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9895 }
9896
9897 for (int i = 0;i < recipesIds.Count(); i++)
9898 {
9899 int key = recipesIds.Get(i);
9900 string recipeName = moduleRecipesManager.GetRecipeName(key);
9902 }
9903 }
9904
9905
9906 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9907 {
9908 super.GetDebugActions(outputList);
9909
9910
9916
9917
9922
9927
9928
9932
9933
9935 {
9939 }
9940
9943
9944
9948
9950
9951 InventoryLocation loc = new InventoryLocation();
9952 GetInventory().GetCurrentInventoryLocation(loc);
9954 {
9955 if (Gizmo_IsSupported())
9958 }
9959
9961 }
9962
9963
9964
9965
9967 {
9968 super.OnAction(action_id, player, ctx);
9969
9971 {
9972 switch (action_id)
9973 {
9977 return true;
9981 return true;
9982 }
9983 }
9984
9986 {
9987 switch (action_id)
9988 {
9990 Delete();
9991 return true;
9992 }
9993 }
9994
9995 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9996 {
9997 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9998 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9999 PlayerBase p = PlayerBase.Cast(player);
10000 if (
EActions.RECIPES_RANGE_START < 1000)
10001 {
10002 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10003 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10004 }
10005 }
10006 #ifndef SERVER
10007 else if (action_id ==
EActions.WATCH_PLAYER)
10008 {
10009 PluginDeveloper.SetDeveloperItemClientEx(player);
10010 }
10011 #endif
10013 {
10014 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10015 {
10016 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10017 OnDebugButtonPressServer(id + 1);
10018 }
10019
10020 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10021 {
10022 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10024 }
10025
10026 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10027 {
10028 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10030 }
10031
10032 else if (action_id ==
EActions.ADD_QUANTITY)
10033 {
10034 if (IsMagazine())
10035 {
10036 Magazine mag = Magazine.Cast(this);
10037 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10038 }
10039 else
10040 {
10042 }
10043
10044 if (m_EM)
10045 {
10046 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10047 }
10048
10049 }
10050
10051 else if (action_id ==
EActions.REMOVE_QUANTITY)
10052 {
10053 if (IsMagazine())
10054 {
10055 Magazine mag2 = Magazine.Cast(this);
10056 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10057 }
10058 else
10059 {
10061 }
10062 if (m_EM)
10063 {
10064 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10065 }
10066
10067 }
10068
10069 else if (action_id ==
EActions.SET_QUANTITY_0)
10070 {
10072
10073 if (m_EM)
10074 {
10075 m_EM.SetEnergy(0);
10076 }
10077 }
10078
10079 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10080 {
10082
10083 if (m_EM)
10084 {
10085 m_EM.SetEnergy(m_EM.GetEnergyMax());
10086 }
10087 }
10088
10089 else if (action_id ==
EActions.ADD_HEALTH)
10090 {
10091 AddHealth("","",GetMaxHealth("","Health")/5);
10092 }
10093 else if (action_id ==
EActions.REMOVE_HEALTH)
10094 {
10095 AddHealth("","",-GetMaxHealth("","Health")/5);
10096 }
10097 else if (action_id ==
EActions.DESTROY_HEALTH)
10098 {
10099 SetHealth01("","",0);
10100 }
10101 else if (action_id ==
EActions.WATCH_ITEM)
10102 {
10104 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10105 #ifdef DEVELOPER
10106 SetDebugDeveloper_item(this);
10107 #endif
10108 }
10109
10110 else if (action_id ==
EActions.ADD_TEMPERATURE)
10111 {
10112 AddTemperature(20);
10113
10114 }
10115
10116 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10117 {
10118 AddTemperature(-20);
10119
10120 }
10121
10122 else if (action_id ==
EActions.FLIP_FROZEN)
10123 {
10124 SetFrozen(!GetIsFrozen());
10125
10126 }
10127
10128 else if (action_id ==
EActions.ADD_WETNESS)
10129 {
10131
10132 }
10133
10134 else if (action_id ==
EActions.REMOVE_WETNESS)
10135 {
10137
10138 }
10139
10140 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10141 {
10144
10145
10146 }
10147
10148 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10149 {
10152 }
10153
10154 else if (action_id ==
EActions.MAKE_SPECIAL)
10155 {
10156 auto debugParams = DebugSpawnParams.WithPlayer(player);
10157 OnDebugSpawnEx(debugParams);
10158 }
10159
10160 }
10161
10162
10163 return false;
10164 }
10165
10166
10167
10168
10172
10175
10176
10177
10179 {
10180 return false;
10181 }
10182
10183
10185 {
10186 return true;
10187 }
10188
10189
10191 {
10192 return true;
10193 }
10194
10195
10196
10198 {
10199 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10200 return g_Game.ConfigIsExisting(config_path);
10201 }
10202
10205 {
10206 return null;
10207 }
10208
10210 {
10211 return false;
10212 }
10213
10215 {
10216 return false;
10217 }
10218
10222
10223
10225 {
10226 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10227 return module_repairing.CanRepair(this, item_repair_kit);
10228 }
10229
10230
10231 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10232 {
10233 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10234 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10235 }
10236
10237
10239 {
10240
10241
10242
10243
10244
10245
10246
10247
10248 return 1;
10249 }
10250
10251
10252
10254 {
10256 }
10257
10258
10259
10261 {
10263 }
10264
10265
10274 {
10275 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10276
10277 if (player)
10278 {
10279 player.MessageStatus(text);
10280 }
10281 }
10282
10283
10292 {
10293 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10294
10295 if (player)
10296 {
10297 player.MessageAction(text);
10298 }
10299 }
10300
10301
10310 {
10311 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10312
10313 if (player)
10314 {
10315 player.MessageFriendly(text);
10316 }
10317 }
10318
10319
10328 {
10329 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10330
10331 if (player)
10332 {
10333 player.MessageImportant(text);
10334 }
10335 }
10336
10338 {
10339 return true;
10340 }
10341
10342
10343 override bool KindOf(
string tag)
10344 {
10345 bool found = false;
10346 string item_name = this.
GetType();
10348 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10349
10350 int array_size = item_tag_array.Count();
10351 for (int i = 0; i < array_size; i++)
10352 {
10353 if (item_tag_array.Get(i) == tag)
10354 {
10355 found = true;
10356 break;
10357 }
10358 }
10359 return found;
10360 }
10361
10362
10364 {
10365
10366 super.OnRPC(sender, rpc_type,ctx);
10367
10368
10369 switch (rpc_type)
10370 {
10371 #ifndef SERVER
10372 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10373 Param2<bool, string> p = new Param2<bool, string>(false, "");
10374
10376 return;
10377
10378 bool play = p.param1;
10379 string soundSet = p.param2;
10380
10381 if (play)
10382 {
10384 {
10386 {
10388 }
10389 }
10390 else
10391 {
10393 }
10394 }
10395 else
10396 {
10398 }
10399
10400 break;
10401 #endif
10402
10403 }
10404
10406 {
10408 }
10409 }
10410
10411
10412
10413
10415 {
10416 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10417 return plugin.GetID(
name);
10418 }
10419
10421 {
10422 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10423 return plugin.GetName(id);
10424 }
10425
10428 {
10429
10430
10431 int varFlags;
10432 if (!ctx.
Read(varFlags))
10433 return;
10434
10435 if (varFlags & ItemVariableFlags.FLOAT)
10436 {
10438 }
10439 }
10440
10442 {
10443
10444 super.SerializeNumericalVars(floats_out);
10445
10446
10447
10449 {
10451 }
10452
10454 {
10456 }
10457
10459 {
10461 }
10462
10464 {
10469 }
10470
10472 {
10474 }
10475 }
10476
10478 {
10479
10480 super.DeSerializeNumericalVars(floats);
10481
10482
10483 int index = 0;
10484 int mask = Math.Round(floats.Get(index));
10485
10486 index++;
10487
10489 {
10491 {
10493 }
10494 else
10495 {
10496 float quantity = floats.Get(index);
10497 SetQuantity(quantity,
true,
false,
false,
false);
10498 }
10499 index++;
10500 }
10501
10503 {
10504 float wet = floats.Get(index);
10506 index++;
10507 }
10508
10510 {
10511 int liquidtype = Math.Round(floats.Get(index));
10513 index++;
10514 }
10515
10517 {
10519 index++;
10521 index++;
10523 index++;
10525 index++;
10526 }
10527
10529 {
10530 int cleanness = Math.Round(floats.Get(index));
10532 index++;
10533 }
10534 }
10535
10537 {
10538 super.WriteVarsToCTX(ctx);
10539
10540
10542 {
10544 }
10545
10547 {
10549 }
10550
10552 {
10554 }
10555
10557 {
10558 int r,g,b,a;
10564 }
10565
10567 {
10569 }
10570 }
10571
10573 {
10574 if (!super.ReadVarsFromCTX(ctx,version))
10575 return false;
10576
10577 int intValue;
10578 float value;
10579
10580 if (version < 140)
10581 {
10582 if (!ctx.
Read(intValue))
10583 return false;
10584
10585 m_VariablesMask = intValue;
10586 }
10587
10589 {
10590 if (!ctx.
Read(value))
10591 return false;
10592
10594 {
10596 }
10597 else
10598 {
10600 }
10601 }
10602
10603 if (version < 140)
10604 {
10606 {
10607 if (!ctx.
Read(value))
10608 return false;
10609 SetTemperatureDirect(value);
10610 }
10611 }
10612
10614 {
10615 if (!ctx.
Read(value))
10616 return false;
10618 }
10619
10621 {
10622 if (!ctx.
Read(intValue))
10623 return false;
10625 }
10626
10628 {
10629 int r,g,b,a;
10631 return false;
10633 return false;
10635 return false;
10637 return false;
10638
10640 }
10641
10643 {
10644 if (!ctx.
Read(intValue))
10645 return false;
10647 }
10648
10649 if (version >= 138 && version < 140)
10650 {
10652 {
10653 if (!ctx.
Read(intValue))
10654 return false;
10655 SetFrozen(intValue);
10656 }
10657 }
10658
10659 return true;
10660 }
10661
10662
10664 {
10667 {
10669 }
10670
10671 if (!super.OnStoreLoad(ctx, version))
10672 {
10674 return false;
10675 }
10676
10677 if (version >= 114)
10678 {
10679 bool hasQuickBarIndexSaved;
10680
10681 if (!ctx.
Read(hasQuickBarIndexSaved))
10682 {
10684 return false;
10685 }
10686
10687 if (hasQuickBarIndexSaved)
10688 {
10689 int itmQBIndex;
10690
10691
10692 if (!ctx.
Read(itmQBIndex))
10693 {
10695 return false;
10696 }
10697
10698 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10699 if (itmQBIndex != -1 && parentPlayer)
10700 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10701 }
10702 }
10703 else
10704 {
10705
10706 PlayerBase player;
10707 int itemQBIndex;
10708 if (version ==
int.
MAX)
10709 {
10710 if (!ctx.
Read(itemQBIndex))
10711 {
10713 return false;
10714 }
10715 }
10716 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10717 {
10718
10719 if (!ctx.
Read(itemQBIndex))
10720 {
10722 return false;
10723 }
10724 if (itemQBIndex != -1 && player)
10725 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10726 }
10727 }
10728
10729 if (version < 140)
10730 {
10731
10732 if (!LoadVariables(ctx, version))
10733 {
10735 return false;
10736 }
10737 }
10738
10739
10741 {
10743 return false;
10744 }
10745 if (version >= 132)
10746 {
10748 if (raib)
10749 {
10751 {
10753 return false;
10754 }
10755 }
10756 }
10757
10759 return true;
10760 }
10761
10762
10763
10765 {
10766 super.OnStoreSave(ctx);
10767
10768 PlayerBase player;
10769 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10770 {
10772
10773 int itemQBIndex = -1;
10774 itemQBIndex = player.FindQuickBarEntityIndex(this);
10775 ctx.
Write(itemQBIndex);
10776 }
10777 else
10778 {
10780 }
10781
10783
10785 if (raib)
10786 {
10788 }
10789 }
10790
10791
10793 {
10794 super.AfterStoreLoad();
10795
10797 {
10799 }
10800
10802 {
10805 }
10806 }
10807
10809 {
10810 super.EEOnAfterLoad();
10811
10813 {
10815 }
10816
10819 }
10820
10822 {
10823 return false;
10824 }
10825
10826
10827
10829 {
10831 {
10832 #ifdef PLATFORM_CONSOLE
10833
10835 {
10837 if (menu)
10838 {
10840 }
10841 }
10842 #endif
10843 }
10844
10846 {
10849 }
10850
10852 {
10853 SetWeightDirty();
10855 }
10857 {
10860 }
10861
10863 {
10866
10869 }
10871 {
10875 }
10876
10877 super.OnVariablesSynchronized();
10878 }
10879
10880
10881
10883 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10884 {
10885 if (!IsServerCheck(allow_client))
10886 return false;
10887
10889 return false;
10890
10893
10894 if (value <= (min + 0.001))
10895 value = min;
10896
10897 if (value == min)
10898 {
10899 if (destroy_config)
10900 {
10901 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10902 if (dstr)
10903 {
10905 this.Delete();
10906 return true;
10907 }
10908 }
10909 else if (destroy_forced)
10910 {
10912 this.Delete();
10913 return true;
10914 }
10915
10917 }
10918
10921
10923 {
10924 EntityAI parent = GetHierarchyRoot();
10925 InventoryLocation iLoc = new InventoryLocation();
10926 GetInventory().GetCurrentInventoryLocation(iLoc);
10928 {
10929 int iLocSlot = iLoc.
GetSlot();
10931 {
10933 }
10935 {
10937 }
10938 }
10939 }
10940
10942 {
10944
10945 if (delta)
10947 }
10948
10950
10951 return false;
10952 }
10953
10954
10956 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10957 {
10959 }
10960
10962 {
10965 }
10966
10968 {
10971 }
10972
10974 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10975 {
10976 float value_clamped = Math.Clamp(value, 0, 1);
10978 SetQuantity(result, destroy_config, destroy_forced);
10979 }
10980
10981
10984 {
10986 }
10987
10989 {
10991 }
10992
10993
10994
10995
10996
10997
10998
10999
11000
11001
11003 {
11004 int slot = -1;
11005 GameInventory inventory = GetInventory();
11006 if (inventory)
11007 {
11008 InventoryLocation il = new InventoryLocation;
11011 }
11012
11014 }
11015
11017 {
11018 float quantity_max = 0;
11019
11021 {
11022 if (attSlotID != -1)
11023 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11024
11025 if (quantity_max <= 0)
11027 }
11028
11029 if (quantity_max <= 0)
11031
11032 return quantity_max;
11033 }
11034
11036 {
11038 }
11039
11041 {
11043 }
11044
11045
11047 {
11049 }
11050
11052 {
11054 }
11055
11057 {
11059 }
11060
11061
11063 {
11064
11065 float weightEx = GetWeightEx();
11066 float special = GetInventoryAndCargoWeight();
11067 return weightEx - special;
11068 }
11069
11070
11072 {
11074 }
11075
11077 {
11079 {
11080 #ifdef DEVELOPER
11081 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11082 {
11083 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11085 }
11086 #endif
11087
11088 return GetQuantity() * GetConfigWeightModified();
11089 }
11090 else if (HasEnergyManager())
11091 {
11092 #ifdef DEVELOPER
11093 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11094 {
11095 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11096 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11097 }
11098 #endif
11099 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11100 }
11101 else
11102 {
11103 #ifdef DEVELOPER
11104 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11105 {
11106 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11107 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11108 }
11109 #endif
11110 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11111 }
11112 }
11113
11116 {
11117 int item_count = 0;
11119
11120 GameInventory inventory = GetInventory();
11121 CargoBase cargo = inventory.
GetCargo();
11122 if (cargo != NULL)
11123 {
11125 }
11126
11128 for (int i = 0; i < nAttachments; ++i)
11129 {
11131 if (item)
11132 item_count += item.GetNumberOfItems();
11133 }
11134 return item_count;
11135 }
11136
11139 {
11140 float weight = 0;
11141 float wetness = 1;
11142 if (include_wetness)
11145 {
11146 weight = wetness * m_ConfigWeight;
11147 }
11149 {
11150 weight = 1;
11151 }
11152 return weight;
11153 }
11154
11155
11156
11158 {
11159 GameInventory inventory = GetInventory();
11160 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11161 {
11162 array<EntityAI> items = new array<EntityAI>;
11164 for (int i = 0; i < items.Count(); ++i)
11165 {
11167 if (item)
11168 {
11169 g_Game.ObjectDelete(item);
11170 }
11171 }
11172 }
11173 }
11174
11175
11176
11177
11179 {
11180 float energy = 0;
11181 if (HasEnergyManager())
11182 {
11183 energy = GetCompEM().GetEnergy();
11184 }
11185 return energy;
11186 }
11187
11188
11190 {
11191 super.OnEnergyConsumed();
11192
11194 }
11195
11197 {
11198 super.OnEnergyAdded();
11199
11201 }
11202
11203
11205 {
11206 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11207 {
11209 {
11210 float energy_0to1 = GetCompEM().GetEnergy0To1();
11212 }
11213 }
11214 }
11215
11216
11218 {
11219 return ConfigGetFloat("heatIsolation");
11220 }
11221
11223 {
11225 }
11226
11228 {
11229 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11230 if (
g_Game.ConfigIsExisting(paramPath))
11231 return g_Game.ConfigGetFloat(paramPath);
11232
11233 return 0.0;
11234 }
11235
11237 {
11238 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11239 if (
g_Game.ConfigIsExisting(paramPath))
11240 return g_Game.ConfigGetFloat(paramPath);
11241
11242 return 0.0;
11243 }
11244
11245 override void SetWet(
float value,
bool allow_client =
false)
11246 {
11247 if (!IsServerCheck(allow_client))
11248 return;
11249
11252
11254
11255 m_VarWet = Math.Clamp(value, min, max);
11256
11258 {
11261 }
11262 }
11263
11264 override void AddWet(
float value)
11265 {
11267 }
11268
11270 {
11272 }
11273
11275 {
11277 }
11278
11280 {
11282 }
11283
11285 {
11287 }
11288
11290 {
11292 }
11293
11294 override void OnWetChanged(
float newVal,
float oldVal)
11295 {
11298 if (newLevel != oldLevel)
11299 {
11301 }
11302 }
11303
11305 {
11306 SetWeightDirty();
11307 }
11308
11310 {
11311 return GetWetLevelInternal(
m_VarWet);
11312 }
11313
11314
11315
11317 {
11319 }
11320
11322 {
11324 }
11325
11327 {
11329 }
11330
11332 {
11334 }
11335
11336
11337
11339 {
11340 if (ConfigIsExisting("itemModelLength"))
11341 {
11342 return ConfigGetFloat("itemModelLength");
11343 }
11344 return 0;
11345 }
11346
11348 {
11349 if (ConfigIsExisting("itemAttachOffset"))
11350 {
11351 return ConfigGetFloat("itemAttachOffset");
11352 }
11353 return 0;
11354 }
11355
11356 override void SetCleanness(
int value,
bool allow_client =
false)
11357 {
11358 if (!IsServerCheck(allow_client))
11359 return;
11360
11362
11364
11367 }
11368
11370 {
11372 }
11373
11375 {
11376 return true;
11377 }
11378
11379
11380
11381
11383 {
11385 }
11386
11388 {
11390 }
11391
11392
11393
11394
11395 override void SetColor(
int r,
int g,
int b,
int a)
11396 {
11402 }
11404 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11405 {
11410 }
11411
11413 {
11415 }
11416
11419 {
11420 int r,g,b,a;
11422 r = r/255;
11423 g = g/255;
11424 b = b/255;
11425 a = a/255;
11426 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11427 }
11428
11429
11430
11431 override void SetLiquidType(
int value,
bool allow_client =
false)
11432 {
11433 if (!IsServerCheck(allow_client))
11434 return;
11435
11440 }
11441
11443 {
11444 return ConfigGetInt("varLiquidTypeInit");
11445 }
11446
11448 {
11450 }
11451
11453 {
11455 SetFrozen(false);
11456 }
11457
11460 {
11461 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11462 }
11463
11464
11467 {
11468 PlayerBase nplayer;
11469 if (PlayerBase.CastTo(nplayer, player))
11470 {
11472 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11473 }
11474 }
11475
11476
11479 {
11480 PlayerBase nplayer;
11481 if (PlayerBase.CastTo(nplayer,player))
11482 {
11483 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11484 }
11485
11486 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11487
11488 if (HasEnergyManager())
11489 {
11490 GetCompEM().UpdatePlugState();
11491 }
11492 }
11493
11494
11496 {
11497 super.OnPlacementStarted(player);
11498
11500 }
11501
11502 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11503 {
11505 {
11506 m_AdminLog.OnPlacementComplete(player,
this);
11507 }
11508
11509 super.OnPlacementComplete(player, position, orientation);
11510 }
11511
11512
11513
11514
11515
11517 {
11519 {
11520 return true;
11521 }
11522 else
11523 {
11524 return false;
11525 }
11526 }
11527
11528
11530 {
11532 {
11534 }
11535 }
11536
11537
11539 {
11541 }
11542
11544 {
11546 }
11547
11548 override void InsertAgent(
int agent,
float count = 1)
11549 {
11550 if (count < 1)
11551 return;
11552
11554 }
11555
11558 {
11560 }
11561
11562
11564 {
11566 }
11567
11568
11569
11570
11571
11572
11573
11574
11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585
11586
11587
11588
11589
11590
11591
11592
11593
11594
11595
11596
11597
11598
11599
11600
11601
11602
11603
11604
11605
11606
11607
11608
11610 {
11612 return false;
11613 return true;
11614 }
11615
11617 {
11618
11620 }
11621
11622
11625 {
11626 super.CheckForRoofLimited(timeTresholdMS);
11627
11628 float time =
g_Game.GetTime();
11629 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11630 {
11631 m_PreviousRoofTestTime = time;
11632 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11633 }
11634 }
11635
11636
11638 {
11640 {
11641 return 0;
11642 }
11643
11644 if (GetInventory().GetAttachmentSlotsCount() != 0)
11645 {
11646 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11647 if (filter)
11648 return filter.GetProtectionLevel(type, false, system);
11649 else
11650 return 0;
11651 }
11652
11653 string subclassPath, entryName;
11654
11655 switch (type)
11656 {
11658 entryName = "biological";
11659 break;
11661 entryName = "chemical";
11662 break;
11663 default:
11664 entryName = "biological";
11665 break;
11666 }
11667
11668 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11669
11670 return g_Game.ConfigGetFloat(subclassPath + entryName);
11671 }
11672
11673
11674
11677 {
11678 if (!IsMagazine())
11680
11682 }
11683
11684
11685
11686
11687
11692 {
11693 return true;
11694 }
11695
11697 {
11699 }
11700
11701
11702
11703
11704
11706 {
11707 if (parent)
11708 {
11709 if (parent.IsInherited(DayZInfected))
11710 return true;
11711
11712 if (!parent.IsRuined())
11713 return true;
11714 }
11715
11716 return true;
11717 }
11718
11720 {
11721 if (!super.CanPutAsAttachment(parent))
11722 {
11723 return false;
11724 }
11725
11726 if (!IsRuined() && !parent.IsRuined())
11727 {
11728 return true;
11729 }
11730
11731 return false;
11732 }
11733
11735 {
11736
11737
11738
11739
11740 return super.CanReceiveItemIntoCargo(item);
11741 }
11742
11744 {
11745
11746
11747
11748
11749 GameInventory attachmentInv = attachment.GetInventory();
11751 {
11752 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11753 return false;
11754 }
11755
11756 InventoryLocation loc = new InventoryLocation();
11757 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11758 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11759 return false;
11760
11761 return super.CanReceiveAttachment(attachment, slotId);
11762 }
11763
11765 {
11766 if (!super.CanReleaseAttachment(attachment))
11767 return false;
11768
11769 return GetInventory().AreChildrenAccessible();
11770 }
11771
11772
11773
11774
11775
11776
11777
11778
11779
11780
11781
11782
11783
11784
11785
11786
11787
11788
11789
11790
11791
11793 {
11794 int id = muzzle_owner.GetMuzzleID();
11795 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11796
11797 if (WPOF_array)
11798 {
11799 for (int i = 0; i < WPOF_array.Count(); i++)
11800 {
11801 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11802
11803 if (WPOF)
11804 {
11805 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11806 }
11807 }
11808 }
11809 }
11810
11811
11813 {
11814 int id = muzzle_owner.GetMuzzleID();
11816
11817 if (WPOBE_array)
11818 {
11819 for (int i = 0; i < WPOBE_array.Count(); i++)
11820 {
11821 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11822
11823 if (WPOBE)
11824 {
11825 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11826 }
11827 }
11828 }
11829 }
11830
11831
11833 {
11834 int id = muzzle_owner.GetMuzzleID();
11835 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11836
11837 if (WPOOH_array)
11838 {
11839 for (int i = 0; i < WPOOH_array.Count(); i++)
11840 {
11841 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11842
11843 if (WPOOH)
11844 {
11845 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11846 }
11847 }
11848 }
11849 }
11850
11851
11853 {
11854 int id = muzzle_owner.GetMuzzleID();
11855 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11856
11857 if (WPOOH_array)
11858 {
11859 for (int i = 0; i < WPOOH_array.Count(); i++)
11860 {
11861 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11862
11863 if (WPOOH)
11864 {
11865 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11866 }
11867 }
11868 }
11869 }
11870
11871
11873 {
11874 int id = muzzle_owner.GetMuzzleID();
11875 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11876
11877 if (WPOOH_array)
11878 {
11879 for (int i = 0; i < WPOOH_array.Count(); i++)
11880 {
11881 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11882
11883 if (WPOOH)
11884 {
11885 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11886 }
11887 }
11888 }
11889 }
11890
11891
11892
11894 {
11896 {
11897 return true;
11898 }
11899
11900 return false;
11901 }
11902
11904 {
11906 {
11907 return true;
11908 }
11909
11910 return false;
11911 }
11912
11914 {
11916 {
11917 return true;
11918 }
11919
11920 return false;
11921 }
11922
11924 {
11925 return false;
11926 }
11927
11930 {
11931 return UATimeSpent.DEFAULT_DEPLOY;
11932 }
11933
11934
11935
11936
11938 {
11940 SetSynchDirty();
11941 }
11942
11944 {
11946 }
11947
11948
11950 {
11951 return false;
11952 }
11953
11956 {
11957 string att_type = "None";
11958
11959 if (ConfigIsExisting("soundAttType"))
11960 {
11961 att_type = ConfigGetString("soundAttType");
11962 }
11963
11965 }
11966
11968 {
11970 }
11971
11972
11973
11974
11975
11981
11983 {
11986
11988 }
11989
11990
11992 {
11994 return;
11995
11997
12000
12003
12004 SoundParameters params = new SoundParameters();
12008 }
12009
12010
12012 {
12014 {
12017
12018 SetSynchDirty();
12019
12022 }
12023 }
12024
12026 {
12028 }
12029
12030
12032 {
12034 return;
12035
12037 SetSynchDirty();
12038
12041 }
12042
12044 {
12047 }
12048
12050 {
12052 }
12053
12054 void OnApply(PlayerBase player);
12055
12057 {
12058 return 1.0;
12059 };
12060
12062 {
12064 }
12065
12067 {
12069 }
12070
12072
12074 {
12075 SetDynamicPhysicsLifeTime(0.01);
12077 }
12078
12080 {
12081 array<string> zone_names = new array<string>;
12082 GetDamageZones(zone_names);
12083 for (int i = 0; i < zone_names.Count(); i++)
12084 {
12085 SetHealthMax(zone_names.Get(i),"Health");
12086 }
12087 SetHealthMax("","Health");
12088 }
12089
12092 {
12093 float global_health = GetHealth01("","Health");
12094 array<string> zones = new array<string>;
12095 GetDamageZones(zones);
12096
12097 for (int i = 0; i < zones.Count(); i++)
12098 {
12099 SetHealth01(zones.Get(i),"Health",global_health);
12100 }
12101 }
12102
12105 {
12106 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12107 }
12108
12110 {
12111 if (!hasRootAsPlayer)
12112 {
12113 if (refParentIB)
12114 {
12115
12116 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12117 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12118
12119 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12120 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12121
12124 }
12125 else
12126 {
12127
12130 }
12131 }
12132 }
12133
12135 {
12137 {
12138 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12139 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12140 {
12141 float heatPermCoef = 1.0;
12143 while (ent)
12144 {
12145 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12146 ent = ent.GetHierarchyParent();
12147 }
12148
12149 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12150 }
12151 }
12152 }
12153
12155 {
12156
12157 EntityAI parent = GetHierarchyParent();
12158 if (!parent)
12159 {
12160 hasParent = false;
12161 hasRootAsPlayer = false;
12162 }
12163 else
12164 {
12165 hasParent = true;
12166 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12167 refParentIB =
ItemBase.Cast(parent);
12168 }
12169 }
12170
12171 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12172 {
12173
12174 }
12175
12177 {
12178
12179 return false;
12180 }
12181
12183 {
12184
12185
12186 return false;
12187 }
12188
12190 {
12191
12192 return false;
12193 }
12194
12197 {
12198 return !GetIsFrozen() &&
IsOpen();
12199 }
12200
12202 {
12203 bool hasParent = false, hasRootAsPlayer = false;
12205
12206 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12207 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12208
12209 if (wwtu || foodDecay)
12210 {
12214
12215 if (processWetness || processTemperature || processDecay)
12216 {
12218
12219 if (processWetness)
12220 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12221
12222 if (processTemperature)
12224
12225 if (processDecay)
12226 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12227 }
12228 }
12229 }
12230
12233 {
12235 }
12236
12238 {
12241
12242 return super.GetTemperatureFreezeThreshold();
12243 }
12244
12246 {
12249
12250 return super.GetTemperatureThawThreshold();
12251 }
12252
12254 {
12257
12258 return super.GetItemOverheatThreshold();
12259 }
12260
12262 {
12264 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12265
12266 return super.GetTemperatureFreezeTime();
12267 }
12268
12270 {
12272 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12273
12274 return super.GetTemperatureThawTime();
12275 }
12276
12281
12283 {
12284 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12285 }
12286
12288 {
12289 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12290 }
12291
12294 {
12296 }
12297
12299 {
12301 }
12302
12304 {
12306 }
12307
12310 {
12311 return null;
12312 }
12313
12316 {
12317 return false;
12318 }
12319
12321 {
12323 {
12326 if (!trg)
12327 {
12329 explosive = this;
12330 }
12331
12332 explosive.PairRemote(trg);
12334
12335 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12336 trg.SetPersistentPairID(persistentID);
12337 explosive.SetPersistentPairID(persistentID);
12338
12339 return true;
12340 }
12341 return false;
12342 }
12343
12346 {
12347 float ret = 1.0;
12350 ret *= GetHealth01();
12351
12352 return ret;
12353 }
12354
12355 #ifdef DEVELOPER
12356 override void SetDebugItem()
12357 {
12358 super.SetDebugItem();
12359 _itemBase = this;
12360 }
12361
12363 {
12364 string text = super.GetDebugText();
12365
12367 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12368
12369 return text;
12370 }
12371 #endif
12372
12374 {
12375 return true;
12376 }
12377
12379
12381
12383 {
12386 }
12387
12388
12396
12412
12413 [
Obsolete(
"Use ItemSoundHandler instead")]
12416 {
12417 if (!
g_Game.IsDedicatedServer())
12418 {
12419 if (ConfigIsExisting("attachSoundSet"))
12420 {
12421 string cfg_path = "";
12422 string soundset = "";
12423 string type_name =
GetType();
12424
12427 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12428 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12429
12430 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12431 {
12432 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12433 {
12434 if (cfg_slot_array[i] == slot_type)
12435 {
12436 soundset = cfg_soundset_array[i];
12437 break;
12438 }
12439 }
12440 }
12441
12442 if (soundset != "")
12443 {
12444 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12446 }
12447 }
12448 }
12449 }
12450
12452}
12453
12455{
12457 if (entity)
12458 {
12459 bool is_item = entity.IsInherited(
ItemBase);
12460 if (is_item && full_quantity)
12461 {
12464 }
12465 }
12466 else
12467 {
12469 return NULL;
12470 }
12471 return entity;
12472}
12473
12475{
12476 if (item)
12477 {
12478 if (health > 0)
12479 item.SetHealth("", "", health);
12480
12481 if (item.CanHaveTemperature())
12482 {
12484 if (item.CanFreeze())
12485 item.SetFrozen(false);
12486 }
12487
12488 if (item.HasEnergyManager())
12489 {
12490 if (quantity >= 0)
12491 {
12492 item.GetCompEM().SetEnergy0To1(quantity);
12493 }
12494 else
12495 {
12497 }
12498 }
12499 else if (item.IsMagazine())
12500 {
12501 Magazine mag = Magazine.Cast(item);
12502 if (quantity >= 0)
12503 {
12504 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12505 }
12506 else
12507 {
12509 }
12510
12511 }
12512 else
12513 {
12514 if (quantity >= 0)
12515 {
12516 item.SetQuantityNormalized(quantity, false);
12517 }
12518 else
12519 {
12521 }
12522
12523 }
12524 }
12525}
12526
12527#ifdef DEVELOPER
12529#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.