7556{
7558 {
7559 return true;
7560 }
7561};
7562
7564{
7565
7566};
7567
7568
7569
7571{
7575
7577
7580
7581
7582
7583
7584
7593
7599
7604
7609
7630 protected bool m_IsResultOfSplit
7631
7633
7638
7639
7640
7642
7646
7647
7648
7650
7653
7654
7655
7661
7662
7670
7673
7674
7676
7677
7679
7680
7685
7686
7691
7693
7694
7696
7697
7699 {
7704
7705 if (!
g_Game.IsDedicatedServer())
7706 {
7708 {
7710
7712 {
7714 }
7715 }
7716
7719 }
7720
7721 m_OldLocation = null;
7722
7724 {
7726 }
7727
7728 if (ConfigIsExisting("headSelectionsToHide"))
7729 {
7732 }
7733
7735 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7736 {
7738 }
7739
7741
7742 m_IsResultOfSplit = false;
7743
7745 }
7746
7748 {
7749 super.InitItemVariables();
7750
7756 m_Count = ConfigGetInt(
"count");
7757
7760
7765
7768
7773
7785
7789
7790
7793 if (ConfigIsExisting("canBeSplit"))
7794 {
7797 }
7798
7800 if (ConfigIsExisting("itemBehaviour"))
7802
7803
7806 RegisterNetSyncVariableInt("m_VarLiquidType");
7807 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7808
7809 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7810 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7811 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7812
7813 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7814 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7815 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7816 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7817
7818 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7819 RegisterNetSyncVariableBool("m_IsTakeable");
7820 RegisterNetSyncVariableBool("m_IsHologram");
7821
7824 {
7827 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7828 }
7829
7831
7833 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7835
7837 }
7838
7840 {
7842 }
7843
7845 {
7848 {
7853 }
7854 }
7855
7856 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7857 {
7859 {
7862 }
7863
7865 }
7866
7868 {
7874 }
7875
7877
7879 {
7881
7882 if (!action)
7883 {
7884 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7885 return;
7886 }
7887
7889 if (!ai)
7890 {
7892 return;
7893 }
7894
7896 if (!action_array)
7897 {
7898 action_array = new array<ActionBase_Basic>;
7900 }
7901 if (LogManager.IsActionLogEnable())
7902 {
7903 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7904 }
7905
7906 if (action_array.Find(action) != -1)
7907 {
7908 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7909 }
7910 else
7911 {
7912 action_array.Insert(action);
7913 }
7914 }
7915
7917 {
7918 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7919 ActionBase action = player.GetActionManager().GetAction(actionName);
7922
7923 if (action_array)
7924 {
7925 action_array.RemoveItem(action);
7926 }
7927 }
7928
7929
7930
7932 {
7933 ActionOverrideData overrideData = new ActionOverrideData();
7937
7939 if (!actionMap)
7940 {
7943 }
7944
7945 actionMap.Insert(this.
Type(), overrideData);
7946
7947 }
7948
7950
7952
7953
7955 {
7958
7961
7962 string config_to_search = "CfgVehicles";
7963 string muzzle_owner_config;
7964
7966 {
7967 if (IsInherited(Weapon))
7968 config_to_search = "CfgWeapons";
7969
7970 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7971
7972 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7973
7974 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7975
7976 if (config_OnFire_subclass_count > 0)
7977 {
7978 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7979
7980 for (int i = 0; i < config_OnFire_subclass_count; i++)
7981 {
7982 string particle_class = "";
7983 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7984 string config_OnFire_entry = config_OnFire_class + particle_class;
7985 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7986 WPOF_array.Insert(WPOF);
7987 }
7988
7989
7991 }
7992 }
7993
7995 {
7996 config_to_search = "CfgWeapons";
7997 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7998
7999 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8000
8001 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8002
8003 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8004 {
8005 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8006
8007 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8008 {
8009 string particle_class2 = "";
8010 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8011 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8012 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8013 WPOBE_array.Insert(WPOBE);
8014 }
8015
8016
8018 }
8019 }
8020 }
8021
8022
8024 {
8027
8029 {
8030 string config_to_search = "CfgVehicles";
8031
8032 if (IsInherited(Weapon))
8033 config_to_search = "CfgWeapons";
8034
8035 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8036 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8037
8038 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8039 {
8040
8042
8044 {
8046 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8048 return;
8049 }
8050
8053
8054
8055
8056 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8057 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8058
8059 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8060 {
8061 string particle_class = "";
8062 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8063 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8064 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8065
8066 if (entry_type == CT_CLASS)
8067 {
8068 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8069 WPOOH_array.Insert(WPOF);
8070 }
8071 }
8072
8073
8075 }
8076 }
8077 }
8078
8080 {
8082 }
8083
8085 {
8087 {
8089
8092
8095
8096 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8097 }
8098 }
8099
8101 {
8103 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8104
8106 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8107
8109 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8110
8112 {
8114 }
8115 }
8116
8118 {
8120 }
8121
8123 {
8126 else
8128
8130 {
8133 }
8134 else
8135 {
8138
8141 }
8142
8144 }
8145
8147 {
8149 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8150 }
8151
8153 {
8155 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8157 }
8158
8160 {
8162 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8163 }
8164
8166 {
8169
8170 OverheatingParticle OP = new OverheatingParticle();
8175
8177 }
8178
8180 {
8183
8184 return -1;
8185 }
8186
8188 {
8190 {
8193
8194 for (int i = count; i > 0; --i)
8195 {
8196 int id = i - 1;
8199
8202
8203 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8204 {
8205 if (p)
8206 {
8209 }
8210 }
8211 }
8212 }
8213 }
8214
8216 {
8218 {
8220 {
8221 int id = i - 1;
8223
8224 if (OP)
8225 {
8227
8228 if (p)
8229 {
8231 }
8232
8233 delete OP;
8234 }
8235 }
8236
8239 }
8240 }
8241
8244 {
8245 return 0.0;
8246 }
8247
8248
8250 {
8251 return 250;
8252 }
8253
8255 {
8256 return 0;
8257 }
8258
8261 {
8263 return true;
8264
8265 return false;
8266 }
8267
8270 {
8273
8275 {
8277 }
8278 else
8279 {
8280
8282 }
8283
8285 }
8286
8293 {
8294 return -1;
8295 }
8296
8297
8298
8299
8301 {
8303 {
8304 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8305 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8306
8307 if (r_index >= 0)
8308 {
8309 InventoryLocation r_il = new InventoryLocation;
8310 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8311
8312 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8315 {
8316 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8317 }
8319 {
8320 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8321 }
8322
8323 }
8324
8325 player.GetHumanInventory().ClearUserReservedLocation(this);
8326 }
8327
8330 }
8331
8332
8333
8334
8336 {
8337 return ItemBase.m_DebugActionsMask;
8338 }
8339
8341 {
8342 return ItemBase.m_DebugActionsMask & mask;
8343 }
8344
8346 {
8347 ItemBase.m_DebugActionsMask = mask;
8348 }
8349
8351 {
8352 ItemBase.m_DebugActionsMask |= mask;
8353 }
8354
8356 {
8357 ItemBase.m_DebugActionsMask &= ~mask;
8358 }
8359
8361 {
8363 {
8365 }
8366 else
8367 {
8369 }
8370 }
8371
8372
8374 {
8375 if (GetEconomyProfile())
8376 {
8377 float q_max = GetEconomyProfile().GetQuantityMax();
8378 if (q_max > 0)
8379 {
8380 float q_min = GetEconomyProfile().GetQuantityMin();
8381 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8382
8384 {
8385 ComponentEnergyManager comp = GetCompEM();
8387 {
8389 }
8390 }
8392 {
8394
8395 }
8396
8397 }
8398 }
8399 }
8400
8403 {
8404 EntityAI parent = GetHierarchyParent();
8405
8406 if (parent)
8407 {
8408 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8409 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8410 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8411 }
8412 }
8413
8416 {
8417 EntityAI parent = GetHierarchyParent();
8418
8419 if (parent)
8420 {
8421 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8422 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8423 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8424 }
8425 }
8426
8428 {
8429
8430
8431
8432
8434
8436 {
8437 if (ScriptInputUserData.CanStoreInputUserData())
8438 {
8439 ScriptInputUserData ctx = new ScriptInputUserData;
8445 ctx.
Write(use_stack_max);
8448
8450 {
8451 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8452 }
8453 }
8454 }
8455 else if (!
g_Game.IsMultiplayer())
8456 {
8458 }
8459 }
8460
8462 {
8464 }
8465
8467 {
8469 }
8470
8472 {
8474 }
8475
8477 {
8478
8479 return false;
8480 }
8481
8483 {
8484 return false;
8485 }
8486
8490 {
8491 return false;
8492 }
8493
8495 {
8496 return "";
8497 }
8498
8500
8502 {
8503 return false;
8504 }
8505
8507 {
8508 return true;
8509 }
8510
8511
8512
8514 {
8515 return true;
8516 }
8517
8519 {
8520 return true;
8521 }
8522
8524 {
8525 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8527 }
8528
8530 {
8532 }
8533
8535 {
8537 if (!is_being_placed)
8539 SetSynchDirty();
8540 }
8541
8542
8544
8546 {
8548 }
8549
8551 {
8553 }
8554
8556 {
8557 return 1;
8558 }
8559
8561 {
8562 return false;
8563 }
8564
8566 {
8568 SetSynchDirty();
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
8598
8599
8600
8601
8602
8603
8604
8606 {
8607 super.OnMovedInsideCargo(container);
8608
8609 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8610 }
8611
8612 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8613 {
8614 super.EEItemLocationChanged(oldLoc, newLoc);
8615
8616 PlayerBase newPlayer = null;
8617 PlayerBase oldPlayer = null;
8618
8619 if (newLoc.GetParent())
8620 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8621
8622 if (oldLoc.GetParent())
8623 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8624
8626 {
8627 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8628
8629 if (rIndex >= 0)
8630 {
8631 InventoryLocation rIl = new InventoryLocation;
8632 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8633
8634 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8637 {
8638 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8639 }
8641 {
8643 }
8644
8645 }
8646 }
8647
8649 {
8650 if (newPlayer)
8651 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8652
8653 if (newPlayer == oldPlayer)
8654 {
8655 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8656 {
8658 {
8659 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8660 {
8661 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8662 }
8663 }
8664 else
8665 {
8666 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8667 }
8668 }
8669
8670 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8671 {
8672 int type = oldLoc.GetType();
8674 {
8675 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8676 }
8678 {
8679 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8680 }
8681 }
8682 if (!m_OldLocation)
8683 {
8684 m_OldLocation = new InventoryLocation;
8685 }
8686 m_OldLocation.Copy(oldLoc);
8687 }
8688 else
8689 {
8690 if (m_OldLocation)
8691 {
8692 m_OldLocation.Reset();
8693 }
8694 }
8695
8696 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8697 }
8698 else
8699 {
8700 if (newPlayer)
8701 {
8702 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8703 if (resIndex >= 0)
8704 {
8705 InventoryLocation il = new InventoryLocation;
8706 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8708 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8711 {
8712 il.
GetParent().GetOnReleaseLock().Invoke(it);
8713 }
8715 {
8717 }
8718
8719 }
8720 }
8722 {
8723
8725 }
8726
8727 if (m_OldLocation)
8728 {
8729 m_OldLocation.Reset();
8730 }
8731 }
8732
8734 {
8735 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8736 }
8737
8739 {
8740 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8741 }
8742 }
8743
8744 override void EOnContact(IEntity other, Contact extra)
8745 {
8747 {
8748 int liquidType = -1;
8750 if (impactSpeed > 0.0)
8751 {
8753 #ifndef SERVER
8755 #else
8757 SetSynchDirty();
8758 #endif
8760 }
8761 }
8762
8763 #ifdef SERVER
8764 if (GetCompEM() && GetCompEM().IsPlugged())
8765 {
8766 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8767 GetCompEM().UnplugThis();
8768 }
8769 #endif
8770 }
8771
8773
8775 {
8777 }
8778
8780 {
8781
8782 }
8783
8785 {
8786 super.OnItemLocationChanged(old_owner, new_owner);
8787
8788 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8789 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8790
8791 if (!relatedPlayer && playerNew)
8792 relatedPlayer = playerNew;
8793
8794 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8795 {
8797 if (actionMgr)
8798 {
8799 ActionBase currentAction = actionMgr.GetRunningAction();
8800 if (currentAction)
8802 }
8803 }
8804
8805 Man ownerPlayerOld = null;
8806 Man ownerPlayerNew = null;
8807
8808 if (old_owner)
8809 {
8810 if (old_owner.
IsMan())
8811 {
8812 ownerPlayerOld = Man.Cast(old_owner);
8813 }
8814 else
8815 {
8816 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8817 }
8818 }
8819 else
8820 {
8822 {
8824
8825 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8826 {
8827 GetCompEM().UnplugThis();
8828 }
8829 }
8830 }
8831
8832 if (new_owner)
8833 {
8834 if (new_owner.
IsMan())
8835 {
8836 ownerPlayerNew = Man.Cast(new_owner);
8837 }
8838 else
8839 {
8840 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8841 }
8842 }
8843
8844 if (ownerPlayerOld != ownerPlayerNew)
8845 {
8846 if (ownerPlayerOld)
8847 {
8848 array<EntityAI> subItemsExit = new array<EntityAI>;
8850 for (int i = 0; i < subItemsExit.Count(); i++)
8851 {
8854 }
8855 }
8856
8857 if (ownerPlayerNew)
8858 {
8859 array<EntityAI> subItemsEnter = new array<EntityAI>;
8861 for (int j = 0; j < subItemsEnter.Count(); j++)
8862 {
8865 }
8866 }
8867 }
8868 else if (ownerPlayerNew != null)
8869 {
8870 PlayerBase nplayer;
8871 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8872 {
8873 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8875 for (int k = 0; k < subItemsUpdate.Count(); k++)
8876 {
8878 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8879 }
8880 }
8881 }
8882
8883 if (old_owner)
8884 old_owner.OnChildItemRemoved(this);
8885 if (new_owner)
8886 new_owner.OnChildItemReceived(this);
8887 }
8888
8889
8891 {
8892 super.EEDelete(parent);
8893 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8894 if (player)
8895 {
8897
8898 if (player.IsAlive())
8899 {
8900 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8901 if (r_index >= 0)
8902 {
8903 InventoryLocation r_il = new InventoryLocation;
8904 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8905
8906 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8909 {
8910 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8911 }
8913 {
8914 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8915 }
8916
8917 }
8918
8919 player.RemoveQuickBarEntityShortcut(this);
8920 }
8921 }
8922 }
8923
8925 {
8926 super.EEKilled(killer);
8927
8930 {
8931 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8932 {
8933 if (IsMagazine())
8934 {
8935 if (Magazine.Cast(this).GetAmmoCount() > 0)
8936 {
8938 }
8939 }
8940 else
8941 {
8943 }
8944 }
8945 }
8946 }
8947
8949 {
8950 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8951
8952 super.OnWasAttached(parent, slot_id);
8953
8956
8959 }
8960
8962 {
8963 super.OnWasDetached(parent, slot_id);
8964
8967
8970 }
8971
8973 {
8974 int idx;
8977
8978 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8979 if (inventory_slots.Count() < 1)
8980 {
8981 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8982 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8983 }
8984 else
8985 {
8986 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8987 }
8988
8989 idx = inventory_slots.Find(slot);
8990 if (idx < 0)
8991 return "";
8992
8993 return attach_types.Get(idx);
8994 }
8995
8997 {
8998 int idx = -1;
8999 string slot;
9000
9003
9004 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9005 if (inventory_slots.Count() < 1)
9006 {
9007 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9008 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9009 }
9010 else
9011 {
9012 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9013 if (detach_types.Count() < 1)
9014 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9015 }
9016
9017 for (int i = 0; i < inventory_slots.Count(); i++)
9018 {
9019 slot = inventory_slots.Get(i);
9020 }
9021
9022 if (slot != "")
9023 {
9024 if (detach_types.Count() == 1)
9025 idx = 0;
9026 else
9027 idx = inventory_slots.Find(slot);
9028 }
9029 if (idx < 0)
9030 return "";
9031
9032 return detach_types.Get(idx);
9033 }
9034
9036 {
9037
9039
9040
9041 float min_time = 1;
9042 float max_time = 3;
9043 float delay = Math.RandomFloat(min_time, max_time);
9044
9045 explode_timer.Run(delay, this, "DoAmmoExplosion");
9046 }
9047
9049 {
9050 Magazine magazine = Magazine.Cast(this);
9051 int pop_sounds_count = 6;
9052 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9053
9054
9055 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9056 string sound_name = pop_sounds[ sound_idx ];
9057 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9058
9059
9060 magazine.ServerAddAmmoCount(-1);
9061
9062
9063 float min_temp_to_explode = 100;
9064
9065 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9066 {
9068 }
9069 }
9070
9071
9072 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9073 {
9074 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9075
9076 const int CHANCE_DAMAGE_CARGO = 4;
9077 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9078 const int CHANCE_DAMAGE_NOTHING = 2;
9079
9081 {
9082 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9083 int chances;
9084 int rnd;
9085
9086 if (GetInventory().GetCargo())
9087 {
9088 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9089 rnd = Math.RandomInt(0,chances);
9090
9091 if (rnd < CHANCE_DAMAGE_CARGO)
9092 {
9094 }
9095 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9096 {
9098 }
9099 }
9100 else
9101 {
9102 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9103 rnd = Math.RandomInt(0,chances);
9104
9105 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9106 {
9108 }
9109 }
9110 }
9111 }
9112
9114 {
9115 CargoBase cargo = GetInventory().GetCargo();
9116 if (cargo)
9117 {
9119 if (item_count > 0)
9120 {
9121 int random_pick = Math.RandomInt(0, item_count);
9123 if (!item.IsExplosive())
9124 {
9125 item.AddHealth("","",damage);
9126 return true;
9127 }
9128 }
9129 }
9130 return false;
9131 }
9132
9134 {
9135 GameInventory inventory = GetInventory();
9137 if (attachment_count > 0)
9138 {
9139 int random_pick = Math.RandomInt(0, attachment_count);
9141 if (!attachment.IsExplosive())
9142 {
9143 attachment.AddHealth("","",damage);
9144 return true;
9145 }
9146 }
9147 return false;
9148 }
9149
9151 {
9153 }
9154
9156 {
9158 return GetInventory().CanRemoveEntity();
9159
9160 return false;
9161 }
9162
9164 {
9165
9167 return false;
9168
9169
9171 return false;
9172
9173
9174
9176 if (delta == 0)
9177 return false;
9178
9179
9180 return true;
9181 }
9182
9184 {
9186 {
9187 if (ScriptInputUserData.CanStoreInputUserData())
9188 {
9189 ScriptInputUserData ctx = new ScriptInputUserData;
9194 ctx.
Write(destination_entity);
9198 }
9199 }
9200 else if (!
g_Game.IsMultiplayer())
9201 {
9203 }
9204 }
9205
9207 {
9208 float split_quantity_new;
9212 InventoryLocation loc = new InventoryLocation;
9213
9214 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9215 {
9217 split_quantity_new = stack_max;
9218 else
9220
9222 {
9223 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9224 if (new_item)
9225 {
9226 new_item.SetResultOfSplit(true);
9227 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9229 new_item.
SetQuantity(split_quantity_new,
false,
true);
9230 }
9231 }
9232 }
9233 else if (destination_entity && slot_id == -1)
9234 {
9235 if (quantity > stack_max)
9236 split_quantity_new = stack_max;
9237 else
9238 split_quantity_new = quantity;
9239
9241 {
9242 GameInventory destinationInventory = destination_entity.GetInventory();
9244 {
9247 }
9248
9249 if (new_item)
9250 {
9251 new_item.SetResultOfSplit(true);
9252 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9254 new_item.
SetQuantity(split_quantity_new,
false,
true);
9255 }
9256 }
9257 }
9258 else
9259 {
9260 if (stack_max != 0)
9261 {
9263 {
9265 }
9266
9267 if (split_quantity_new == 0)
9268 {
9269 if (!
g_Game.IsMultiplayer())
9270 player.PhysicalPredictiveDropItem(this);
9271 else
9272 player.ServerDropEntity(this);
9273 return;
9274 }
9275
9277 {
9279
9280 if (new_item)
9281 {
9282 new_item.SetResultOfSplit(true);
9283 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9286 new_item.PlaceOnSurface();
9287 }
9288 }
9289 }
9290 }
9291 }
9292
9294 {
9295 float split_quantity_new;
9299 InventoryLocation loc = new InventoryLocation;
9300
9301 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9302 {
9304 split_quantity_new = stack_max;
9305 else
9307
9309 {
9310 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9311 if (new_item)
9312 {
9313 new_item.SetResultOfSplit(true);
9314 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9316 new_item.
SetQuantity(split_quantity_new,
false,
true);
9317 }
9318 }
9319 }
9320 else if (destination_entity && slot_id == -1)
9321 {
9322 if (quantity > stack_max)
9323 split_quantity_new = stack_max;
9324 else
9325 split_quantity_new = quantity;
9326
9328 {
9329 GameInventory destinationInventory = destination_entity.GetInventory();
9331 {
9334 }
9335
9336 if (new_item)
9337 {
9338 new_item.SetResultOfSplit(true);
9339 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9341 new_item.
SetQuantity(split_quantity_new,
false,
true);
9342 }
9343 }
9344 }
9345 else
9346 {
9347 if (stack_max != 0)
9348 {
9350 {
9352 }
9353
9355 {
9357
9358 if (new_item)
9359 {
9360 new_item.SetResultOfSplit(true);
9361 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9364 new_item.PlaceOnSurface();
9365 }
9366 }
9367 }
9368 }
9369 }
9370
9372 {
9374 {
9375 if (ScriptInputUserData.CanStoreInputUserData())
9376 {
9377 ScriptInputUserData ctx = new ScriptInputUserData;
9382 dst.WriteToContext(ctx);
9384 }
9385 }
9386 else if (!
g_Game.IsMultiplayer())
9387 {
9389 }
9390 }
9391
9393 {
9395 {
9396 if (ScriptInputUserData.CanStoreInputUserData())
9397 {
9398 ScriptInputUserData ctx = new ScriptInputUserData;
9403 ctx.
Write(destination_entity);
9409 }
9410 }
9411 else if (!
g_Game.IsMultiplayer())
9412 {
9414 }
9415 }
9416
9418 {
9420 }
9421
9423 {
9425 float split_quantity_new;
9427 if (dst.IsValid())
9428 {
9429 int slot_id = dst.GetSlot();
9431
9432 if (quantity > stack_max)
9433 split_quantity_new = stack_max;
9434 else
9435 split_quantity_new = quantity;
9436
9438 {
9440
9441 if (new_item)
9442 {
9443 new_item.SetResultOfSplit(true);
9444 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9446 new_item.
SetQuantity(split_quantity_new,
false,
true);
9447 }
9448
9449 return new_item;
9450 }
9451 }
9452
9453 return null;
9454 }
9455
9457 {
9459 float split_quantity_new;
9461 if (destination_entity)
9462 {
9464 if (quantity > stackable)
9465 split_quantity_new = stackable;
9466 else
9467 split_quantity_new = quantity;
9468
9470 {
9471 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9472 if (new_item)
9473 {
9474 new_item.SetResultOfSplit(true);
9475 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9477 new_item.
SetQuantity(split_quantity_new,
false,
true);
9478 }
9479 }
9480 }
9481 }
9482
9484 {
9486 {
9487 if (ScriptInputUserData.CanStoreInputUserData())
9488 {
9489 ScriptInputUserData ctx = new ScriptInputUserData;
9494 ItemBase destination_entity =
this;
9495 ctx.
Write(destination_entity);
9499 }
9500 }
9501 else if (!
g_Game.IsMultiplayer())
9502 {
9504 }
9505 }
9506
9508 {
9510 float split_quantity_new;
9512 if (player)
9513 {
9515 if (quantity > stackable)
9516 split_quantity_new = stackable;
9517 else
9518 split_quantity_new = quantity;
9519
9521 {
9522 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9523 new_item =
ItemBase.Cast(in_hands);
9524 if (new_item)
9525 {
9526 new_item.SetResultOfSplit(true);
9527 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9529 new_item.SetQuantity(split_quantity_new, false, true);
9530 }
9531 }
9532 }
9533 }
9534
9536 {
9538 float split_quantity_new = Math.Floor(quantity * 0.5);
9539
9541 return;
9542
9544
9545 if (new_item)
9546 {
9547 if (new_item.GetQuantityMax() < split_quantity_new)
9548 {
9549 split_quantity_new = new_item.GetQuantityMax();
9550 }
9551
9552 new_item.SetResultOfSplit(true);
9553 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9554
9556 {
9559 }
9560 else
9561 {
9563 new_item.
SetQuantity(split_quantity_new,
false,
true);
9564 }
9565 }
9566 }
9567
9569 {
9571 float split_quantity_new = Math.Floor(quantity / 2);
9572
9574 return;
9575
9576 InventoryLocation invloc = new InventoryLocation;
9578
9580 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9581
9582 if (new_item)
9583 {
9584 if (new_item.GetQuantityMax() < split_quantity_new)
9585 {
9586 split_quantity_new = new_item.GetQuantityMax();
9587 }
9589 {
9592 }
9593 else if (split_quantity_new > 1)
9594 {
9596 new_item.
SetQuantity(split_quantity_new,
false,
true);
9597 }
9598 }
9599 }
9600
9603 {
9604 SetWeightDirty();
9606
9607 if (parent)
9608 parent.OnAttachmentQuantityChangedEx(this, delta);
9609
9611 {
9613 {
9615 }
9617 {
9618 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9620 }
9621 }
9622 }
9623
9626 {
9627
9628 }
9629
9632 {
9634 }
9635
9637 {
9638 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9639
9641 {
9642 if (newLevel == GameConstants.STATE_RUINED)
9643 {
9645 EntityAI parent = GetHierarchyParent();
9646 if (parent && parent.IsFireplace())
9647 {
9648 CargoBase cargo = GetInventory().GetCargo();
9649 if (cargo)
9650 {
9652 {
9654 }
9655 }
9656 }
9657 }
9658
9660 {
9661
9663 return;
9664 }
9665
9666 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9667 {
9669 }
9670 }
9671 }
9672
9673
9675 {
9676 super.OnRightClick();
9677
9679 {
9681 {
9682 if (ScriptInputUserData.CanStoreInputUserData())
9683 {
9684 EntityAI root = GetHierarchyRoot();
9685 Man playerOwner = GetHierarchyRootPlayer();
9686 InventoryLocation dst = new InventoryLocation;
9687
9688
9689 if (!playerOwner && root && root == this)
9690 {
9692 }
9693 else
9694 {
9695
9696 GetInventory().GetCurrentInventoryLocation(dst);
9698 {
9699 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9701 {
9703 }
9704 else
9705 {
9707
9708
9709 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9710 {
9712 }
9713 else
9714 {
9715 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9716 }
9717 }
9718 }
9719 }
9720
9721 ScriptInputUserData ctx = new ScriptInputUserData;
9729 }
9730 }
9731 else if (!
g_Game.IsMultiplayer())
9732 {
9734 }
9735 }
9736 }
9737
9739 {
9740 if (root)
9741 {
9742 vector m4[4];
9743 root.GetTransform(m4);
9744 dst.SetGround(this, m4);
9745 }
9746 else
9747 {
9748 GetInventory().GetCurrentInventoryLocation(dst);
9749 }
9750 }
9751
9752 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9753 {
9754
9755 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9756 return false;
9757
9758 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9759 return false;
9760
9761
9763 return false;
9764
9765
9766 Magazine mag = Magazine.Cast(this);
9767 if (mag)
9768 {
9769 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9770 return false;
9771
9772 if (stack_max_limit)
9773 {
9774 Magazine other_mag = Magazine.Cast(other_item);
9775 if (other_item)
9776 {
9777 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9778 return false;
9779 }
9780
9781 }
9782 }
9783 else
9784 {
9785
9787 return false;
9788
9790 return false;
9791 }
9792
9793 PlayerBase player = null;
9794 if (CastTo(player, GetHierarchyRootPlayer()))
9795 {
9796 if (player.GetInventory().HasAttachment(this))
9797 return false;
9798
9799 if (player.IsItemsToDelete())
9800 return false;
9801 }
9802
9803 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9804 return false;
9805
9806 int slotID;
9808 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9809 return false;
9810
9811 return true;
9812 }
9813
9815 {
9817 }
9818
9820 {
9821 return m_IsResultOfSplit;
9822 }
9823
9825 {
9826 m_IsResultOfSplit = value;
9827 }
9828
9830 {
9832 }
9833
9835 {
9836 float other_item_quantity = other_item.GetQuantity();
9837 float this_free_space;
9838
9840
9842
9843 if (other_item_quantity > this_free_space)
9844 {
9845 return this_free_space;
9846 }
9847 else
9848 {
9849 return other_item_quantity;
9850 }
9851 }
9852
9854 {
9856 }
9857
9859 {
9861 return;
9862
9863 if (!IsMagazine() && other_item)
9864 {
9866 if (quantity_used != 0)
9867 {
9868 float hp1 = GetHealth01("","");
9869 float hp2 = other_item.GetHealth01("","");
9870 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9871 hpResult = hpResult / (
GetQuantity() + quantity_used);
9872
9873 hpResult *= GetMaxHealth();
9874 Math.Round(hpResult);
9875 SetHealth("", "Health", hpResult);
9876
9878 other_item.AddQuantity(-quantity_used);
9879 }
9880 }
9882 }
9883
9885 {
9886 #ifdef SERVER
9887 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9888 GetHierarchyParent().IncreaseLifetimeUp();
9889 #endif
9890 };
9891
9893 {
9894 PlayerBase p = PlayerBase.Cast(player);
9895
9896 array<int> recipesIds = p.m_Recipes;
9897 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9898 if (moduleRecipesManager)
9899 {
9900 EntityAI itemInHands = player.GetEntityInHands();
9901 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9902 }
9903
9904 for (int i = 0;i < recipesIds.Count(); i++)
9905 {
9906 int key = recipesIds.Get(i);
9907 string recipeName = moduleRecipesManager.GetRecipeName(key);
9909 }
9910 }
9911
9912
9913 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9914 {
9915 super.GetDebugActions(outputList);
9916
9917
9923
9924
9929
9934
9935
9939
9940
9942 {
9946 }
9947
9950
9951
9955
9957
9958 InventoryLocation loc = new InventoryLocation();
9959 GetInventory().GetCurrentInventoryLocation(loc);
9961 {
9962 if (Gizmo_IsSupported())
9965 }
9966
9968 }
9969
9970
9971
9972
9974 {
9975 super.OnAction(action_id, player, ctx);
9976
9978 {
9979 switch (action_id)
9980 {
9984 return true;
9988 return true;
9989 }
9990 }
9991
9993 {
9994 switch (action_id)
9995 {
9997 Delete();
9998 return true;
9999 }
10000 }
10001
10002 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10003 {
10004 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10005 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10006 PlayerBase p = PlayerBase.Cast(player);
10007 if (
EActions.RECIPES_RANGE_START < 1000)
10008 {
10009 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10010 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10011 }
10012 }
10013 #ifndef SERVER
10014 else if (action_id ==
EActions.WATCH_PLAYER)
10015 {
10016 PluginDeveloper.SetDeveloperItemClientEx(player);
10017 }
10018 #endif
10020 {
10021 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10022 {
10023 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10024 OnDebugButtonPressServer(id + 1);
10025 }
10026
10027 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10028 {
10029 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10031 }
10032
10033 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10034 {
10035 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10037 }
10038
10039 else if (action_id ==
EActions.ADD_QUANTITY)
10040 {
10041 if (IsMagazine())
10042 {
10043 Magazine mag = Magazine.Cast(this);
10044 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10045 }
10046 else
10047 {
10049 }
10050
10051 if (m_EM)
10052 {
10053 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10054 }
10055
10056 }
10057
10058 else if (action_id ==
EActions.REMOVE_QUANTITY)
10059 {
10060 if (IsMagazine())
10061 {
10062 Magazine mag2 = Magazine.Cast(this);
10063 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10064 }
10065 else
10066 {
10068 }
10069 if (m_EM)
10070 {
10071 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10072 }
10073
10074 }
10075
10076 else if (action_id ==
EActions.SET_QUANTITY_0)
10077 {
10079
10080 if (m_EM)
10081 {
10082 m_EM.SetEnergy(0);
10083 }
10084 }
10085
10086 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10087 {
10089
10090 if (m_EM)
10091 {
10092 m_EM.SetEnergy(m_EM.GetEnergyMax());
10093 }
10094 }
10095
10096 else if (action_id ==
EActions.ADD_HEALTH)
10097 {
10098 AddHealth("","",GetMaxHealth("","Health")/5);
10099 }
10100 else if (action_id ==
EActions.REMOVE_HEALTH)
10101 {
10102 AddHealth("","",-GetMaxHealth("","Health")/5);
10103 }
10104 else if (action_id ==
EActions.DESTROY_HEALTH)
10105 {
10106 SetHealth01("","",0);
10107 }
10108 else if (action_id ==
EActions.WATCH_ITEM)
10109 {
10111 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10112 #ifdef DEVELOPER
10113 SetDebugDeveloper_item(this);
10114 #endif
10115 }
10116
10117 else if (action_id ==
EActions.ADD_TEMPERATURE)
10118 {
10119 AddTemperature(20);
10120
10121 }
10122
10123 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10124 {
10125 AddTemperature(-20);
10126
10127 }
10128
10129 else if (action_id ==
EActions.FLIP_FROZEN)
10130 {
10131 SetFrozen(!GetIsFrozen());
10132
10133 }
10134
10135 else if (action_id ==
EActions.ADD_WETNESS)
10136 {
10138
10139 }
10140
10141 else if (action_id ==
EActions.REMOVE_WETNESS)
10142 {
10144
10145 }
10146
10147 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10148 {
10151
10152
10153 }
10154
10155 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10156 {
10159 }
10160
10161 else if (action_id ==
EActions.MAKE_SPECIAL)
10162 {
10163 auto debugParams = DebugSpawnParams.WithPlayer(player);
10164 OnDebugSpawnEx(debugParams);
10165 }
10166
10167 }
10168
10169
10170 return false;
10171 }
10172
10173
10174
10175
10179
10182
10183
10184
10186 {
10187 return false;
10188 }
10189
10190
10192 {
10193 return true;
10194 }
10195
10196
10198 {
10199 return true;
10200 }
10201
10202
10203
10205 {
10206 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10207 return g_Game.ConfigIsExisting(config_path);
10208 }
10209
10212 {
10213 return null;
10214 }
10215
10217 {
10218 return false;
10219 }
10220
10222 {
10223 return false;
10224 }
10225
10229
10230
10232 {
10233 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10234 return module_repairing.CanRepair(this, item_repair_kit);
10235 }
10236
10237
10238 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10239 {
10240 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10241 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10242 }
10243
10244
10246 {
10247
10248
10249
10250
10251
10252
10253
10254
10255 return 1;
10256 }
10257
10258
10259
10261 {
10263 }
10264
10265
10266
10268 {
10270 }
10271
10272
10281 {
10282 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10283
10284 if (player)
10285 {
10286 player.MessageStatus(text);
10287 }
10288 }
10289
10290
10299 {
10300 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10301
10302 if (player)
10303 {
10304 player.MessageAction(text);
10305 }
10306 }
10307
10308
10317 {
10318 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10319
10320 if (player)
10321 {
10322 player.MessageFriendly(text);
10323 }
10324 }
10325
10326
10335 {
10336 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10337
10338 if (player)
10339 {
10340 player.MessageImportant(text);
10341 }
10342 }
10343
10345 {
10346 return true;
10347 }
10348
10349
10350 override bool KindOf(
string tag)
10351 {
10352 bool found = false;
10353 string item_name = this.
GetType();
10355 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10356
10357 int array_size = item_tag_array.Count();
10358 for (int i = 0; i < array_size; i++)
10359 {
10360 if (item_tag_array.Get(i) == tag)
10361 {
10362 found = true;
10363 break;
10364 }
10365 }
10366 return found;
10367 }
10368
10369
10371 {
10372
10373 super.OnRPC(sender, rpc_type,ctx);
10374
10375
10376 switch (rpc_type)
10377 {
10378 #ifndef SERVER
10379 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10380 Param2<bool, string> p = new Param2<bool, string>(false, "");
10381
10383 return;
10384
10385 bool play = p.param1;
10386 string soundSet = p.param2;
10387
10388 if (play)
10389 {
10391 {
10393 {
10395 }
10396 }
10397 else
10398 {
10400 }
10401 }
10402 else
10403 {
10405 }
10406
10407 break;
10408 #endif
10409
10410 }
10411
10413 {
10415 }
10416 }
10417
10418
10419
10420
10422 {
10423 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10424 return plugin.GetID(
name);
10425 }
10426
10428 {
10429 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10430 return plugin.GetName(id);
10431 }
10432
10435 {
10436
10437
10438 int varFlags;
10439 if (!ctx.
Read(varFlags))
10440 return;
10441
10442 if (varFlags & ItemVariableFlags.FLOAT)
10443 {
10445 }
10446 }
10447
10449 {
10450
10451 super.SerializeNumericalVars(floats_out);
10452
10453
10454
10456 {
10458 }
10459
10461 {
10463 }
10464
10466 {
10468 }
10469
10471 {
10476 }
10477
10479 {
10481 }
10482 }
10483
10485 {
10486
10487 super.DeSerializeNumericalVars(floats);
10488
10489
10490 int index = 0;
10491 int mask = Math.Round(floats.Get(index));
10492
10493 index++;
10494
10496 {
10498 {
10500 }
10501 else
10502 {
10503 float quantity = floats.Get(index);
10504 SetQuantity(quantity,
true,
false,
false,
false);
10505 }
10506 index++;
10507 }
10508
10510 {
10511 float wet = floats.Get(index);
10513 index++;
10514 }
10515
10517 {
10518 int liquidtype = Math.Round(floats.Get(index));
10520 index++;
10521 }
10522
10524 {
10526 index++;
10528 index++;
10530 index++;
10532 index++;
10533 }
10534
10536 {
10537 int cleanness = Math.Round(floats.Get(index));
10539 index++;
10540 }
10541 }
10542
10544 {
10545 super.WriteVarsToCTX(ctx);
10546
10547
10549 {
10551 }
10552
10554 {
10556 }
10557
10559 {
10561 }
10562
10564 {
10565 int r,g,b,a;
10571 }
10572
10574 {
10576 }
10577 }
10578
10580 {
10581 if (!super.ReadVarsFromCTX(ctx,version))
10582 return false;
10583
10584 int intValue;
10585 float value;
10586
10587 if (version < 140)
10588 {
10589 if (!ctx.
Read(intValue))
10590 return false;
10591
10592 m_VariablesMask = intValue;
10593 }
10594
10596 {
10597 if (!ctx.
Read(value))
10598 return false;
10599
10601 {
10603 }
10604 else
10605 {
10607 }
10608 }
10609
10610 if (version < 140)
10611 {
10613 {
10614 if (!ctx.
Read(value))
10615 return false;
10616 SetTemperatureDirect(value);
10617 }
10618 }
10619
10621 {
10622 if (!ctx.
Read(value))
10623 return false;
10625 }
10626
10628 {
10629 if (!ctx.
Read(intValue))
10630 return false;
10632 }
10633
10635 {
10636 int r,g,b,a;
10638 return false;
10640 return false;
10642 return false;
10644 return false;
10645
10647 }
10648
10650 {
10651 if (!ctx.
Read(intValue))
10652 return false;
10654 }
10655
10656 if (version >= 138 && version < 140)
10657 {
10659 {
10660 if (!ctx.
Read(intValue))
10661 return false;
10662 SetFrozen(intValue);
10663 }
10664 }
10665
10666 return true;
10667 }
10668
10669
10671 {
10674 {
10676 }
10677
10678 if (!super.OnStoreLoad(ctx, version))
10679 {
10681 return false;
10682 }
10683
10684 if (version >= 114)
10685 {
10686 bool hasQuickBarIndexSaved;
10687
10688 if (!ctx.
Read(hasQuickBarIndexSaved))
10689 {
10691 return false;
10692 }
10693
10694 if (hasQuickBarIndexSaved)
10695 {
10696 int itmQBIndex;
10697
10698
10699 if (!ctx.
Read(itmQBIndex))
10700 {
10702 return false;
10703 }
10704
10705 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10706 if (itmQBIndex != -1 && parentPlayer)
10707 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10708 }
10709 }
10710 else
10711 {
10712
10713 PlayerBase player;
10714 int itemQBIndex;
10715 if (version ==
int.
MAX)
10716 {
10717 if (!ctx.
Read(itemQBIndex))
10718 {
10720 return false;
10721 }
10722 }
10723 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10724 {
10725
10726 if (!ctx.
Read(itemQBIndex))
10727 {
10729 return false;
10730 }
10731 if (itemQBIndex != -1 && player)
10732 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10733 }
10734 }
10735
10736 if (version < 140)
10737 {
10738
10739 if (!LoadVariables(ctx, version))
10740 {
10742 return false;
10743 }
10744 }
10745
10746
10748 {
10750 return false;
10751 }
10752 if (version >= 132)
10753 {
10755 if (raib)
10756 {
10758 {
10760 return false;
10761 }
10762 }
10763 }
10764
10766 return true;
10767 }
10768
10769
10770
10772 {
10773 super.OnStoreSave(ctx);
10774
10775 PlayerBase player;
10776 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10777 {
10779
10780 int itemQBIndex = -1;
10781 itemQBIndex = player.FindQuickBarEntityIndex(this);
10782 ctx.
Write(itemQBIndex);
10783 }
10784 else
10785 {
10787 }
10788
10790
10792 if (raib)
10793 {
10795 }
10796 }
10797
10798
10800 {
10801 super.AfterStoreLoad();
10802
10804 {
10806 }
10807
10809 {
10812 }
10813 }
10814
10816 {
10817 super.EEOnAfterLoad();
10818
10820 {
10822 }
10823
10826 }
10827
10829 {
10830 return false;
10831 }
10832
10833
10834
10836 {
10838 {
10839 #ifdef PLATFORM_CONSOLE
10840
10842 {
10844 if (menu)
10845 {
10847 }
10848 }
10849 #endif
10850 }
10851
10853 {
10856 }
10857
10859 {
10860 SetWeightDirty();
10862 }
10864 {
10867 }
10868
10870 {
10873
10876 }
10878 {
10882 }
10883
10884 super.OnVariablesSynchronized();
10885 }
10886
10887
10888
10890 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10891 {
10892 if (!IsServerCheck(allow_client))
10893 return false;
10894
10896 return false;
10897
10900
10901 if (value <= (min + 0.001))
10902 value = min;
10903
10904 if (value == min)
10905 {
10906 if (destroy_config)
10907 {
10908 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10909 if (dstr)
10910 {
10912 this.Delete();
10913 return true;
10914 }
10915 }
10916 else if (destroy_forced)
10917 {
10919 this.Delete();
10920 return true;
10921 }
10922
10924 }
10925
10928
10930 {
10931 EntityAI parent = GetHierarchyRoot();
10932 InventoryLocation iLoc = new InventoryLocation();
10933 GetInventory().GetCurrentInventoryLocation(iLoc);
10935 {
10936 int iLocSlot = iLoc.
GetSlot();
10938 {
10940 }
10942 {
10944 }
10945 }
10946 }
10947
10949 {
10951
10952 if (delta)
10954 }
10955
10957
10958 return false;
10959 }
10960
10961
10963 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10964 {
10966 }
10967
10969 {
10972 }
10973
10975 {
10978 }
10979
10981 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10982 {
10983 float value_clamped = Math.Clamp(value, 0, 1);
10985 SetQuantity(result, destroy_config, destroy_forced);
10986 }
10987
10988
10991 {
10993 }
10994
10996 {
10998 }
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11010 {
11011 int slot = -1;
11012 GameInventory inventory = GetInventory();
11013 if (inventory)
11014 {
11015 InventoryLocation il = new InventoryLocation;
11018 }
11019
11021 }
11022
11024 {
11025 float quantity_max = 0;
11026
11028 {
11029 if (attSlotID != -1)
11030 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11031
11032 if (quantity_max <= 0)
11034 }
11035
11036 if (quantity_max <= 0)
11038
11039 return quantity_max;
11040 }
11041
11043 {
11045 }
11046
11048 {
11050 }
11051
11052
11054 {
11056 }
11057
11059 {
11061 }
11062
11064 {
11066 }
11067
11068
11070 {
11071
11072 float weightEx = GetWeightEx();
11073 float special = GetInventoryAndCargoWeight();
11074 return weightEx - special;
11075 }
11076
11077
11079 {
11081 }
11082
11084 {
11086 {
11087 #ifdef DEVELOPER
11088 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11089 {
11090 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11092 }
11093 #endif
11094
11095 return GetQuantity() * GetConfigWeightModified();
11096 }
11097 else if (HasEnergyManager())
11098 {
11099 #ifdef DEVELOPER
11100 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11101 {
11102 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11103 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11104 }
11105 #endif
11106 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11107 }
11108 else
11109 {
11110 #ifdef DEVELOPER
11111 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11112 {
11113 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11114 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11115 }
11116 #endif
11117 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11118 }
11119 }
11120
11123 {
11124 int item_count = 0;
11126
11127 GameInventory inventory = GetInventory();
11128 CargoBase cargo = inventory.
GetCargo();
11129 if (cargo != NULL)
11130 {
11132 }
11133
11135 for (int i = 0; i < nAttachments; ++i)
11136 {
11138 if (item)
11139 item_count += item.GetNumberOfItems();
11140 }
11141 return item_count;
11142 }
11143
11146 {
11147 float weight = 0;
11148 float wetness = 1;
11149 if (include_wetness)
11152 {
11153 weight = wetness * m_ConfigWeight;
11154 }
11156 {
11157 weight = 1;
11158 }
11159 return weight;
11160 }
11161
11162
11163
11165 {
11166 GameInventory inventory = GetInventory();
11167 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11168 {
11169 array<EntityAI> items = new array<EntityAI>;
11171 for (int i = 0; i < items.Count(); ++i)
11172 {
11174 if (item)
11175 {
11176 g_Game.ObjectDelete(item);
11177 }
11178 }
11179 }
11180 }
11181
11182
11183
11184
11186 {
11187 float energy = 0;
11188 if (HasEnergyManager())
11189 {
11190 energy = GetCompEM().GetEnergy();
11191 }
11192 return energy;
11193 }
11194
11195
11197 {
11198 super.OnEnergyConsumed();
11199
11201 }
11202
11204 {
11205 super.OnEnergyAdded();
11206
11208 }
11209
11210
11212 {
11213 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11214 {
11216 {
11217 float energy_0to1 = GetCompEM().GetEnergy0To1();
11219 }
11220 }
11221 }
11222
11223
11225 {
11226 return ConfigGetFloat("heatIsolation");
11227 }
11228
11230 {
11232 }
11233
11235 {
11236 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11237 if (
g_Game.ConfigIsExisting(paramPath))
11238 return g_Game.ConfigGetFloat(paramPath);
11239
11240 return 0.0;
11241 }
11242
11244 {
11245 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11246 if (
g_Game.ConfigIsExisting(paramPath))
11247 return g_Game.ConfigGetFloat(paramPath);
11248
11249 return 0.0;
11250 }
11251
11252 override void SetWet(
float value,
bool allow_client =
false)
11253 {
11254 if (!IsServerCheck(allow_client))
11255 return;
11256
11259
11261
11262 m_VarWet = Math.Clamp(value, min, max);
11263
11265 {
11268 }
11269 }
11270
11271 override void AddWet(
float value)
11272 {
11274 }
11275
11277 {
11279 }
11280
11282 {
11284 }
11285
11287 {
11289 }
11290
11292 {
11294 }
11295
11297 {
11299 }
11300
11301 override void OnWetChanged(
float newVal,
float oldVal)
11302 {
11305 if (newLevel != oldLevel)
11306 {
11308 }
11309 }
11310
11312 {
11313 SetWeightDirty();
11314 }
11315
11317 {
11318 return GetWetLevelInternal(
m_VarWet);
11319 }
11320
11321
11322
11324 {
11326 }
11327
11329 {
11331 }
11332
11334 {
11336 }
11337
11339 {
11341 }
11342
11343
11344
11346 {
11347 if (ConfigIsExisting("itemModelLength"))
11348 {
11349 return ConfigGetFloat("itemModelLength");
11350 }
11351 return 0;
11352 }
11353
11355 {
11356 if (ConfigIsExisting("itemAttachOffset"))
11357 {
11358 return ConfigGetFloat("itemAttachOffset");
11359 }
11360 return 0;
11361 }
11362
11363 override void SetCleanness(
int value,
bool allow_client =
false)
11364 {
11365 if (!IsServerCheck(allow_client))
11366 return;
11367
11369
11371
11374 }
11375
11377 {
11379 }
11380
11382 {
11383 return true;
11384 }
11385
11386
11387
11388
11390 {
11392 }
11393
11395 {
11397 }
11398
11399
11400
11401
11402 override void SetColor(
int r,
int g,
int b,
int a)
11403 {
11409 }
11411 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11412 {
11417 }
11418
11420 {
11422 }
11423
11426 {
11427 int r,g,b,a;
11429 r = r/255;
11430 g = g/255;
11431 b = b/255;
11432 a = a/255;
11433 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11434 }
11435
11436
11437
11438 override void SetLiquidType(
int value,
bool allow_client =
false)
11439 {
11440 if (!IsServerCheck(allow_client))
11441 return;
11442
11447 }
11448
11450 {
11451 return ConfigGetInt("varLiquidTypeInit");
11452 }
11453
11455 {
11457 }
11458
11460 {
11462 SetFrozen(false);
11463 }
11464
11467 {
11468 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11469 }
11470
11471
11474 {
11475 PlayerBase nplayer;
11476 if (PlayerBase.CastTo(nplayer, player))
11477 {
11479 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11480 }
11481 }
11482
11483
11486 {
11487 PlayerBase nplayer;
11488 if (PlayerBase.CastTo(nplayer,player))
11489 {
11490 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11491 }
11492
11493 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11494
11495 if (HasEnergyManager())
11496 {
11497 GetCompEM().UpdatePlugState();
11498 }
11499 }
11500
11501
11503 {
11504 super.OnPlacementStarted(player);
11505
11507 }
11508
11509 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11510 {
11512 {
11513 m_AdminLog.OnPlacementComplete(player,
this);
11514 }
11515
11516 super.OnPlacementComplete(player, position, orientation);
11517 }
11518
11519
11520
11521
11522
11524 {
11526 {
11527 return true;
11528 }
11529 else
11530 {
11531 return false;
11532 }
11533 }
11534
11535
11537 {
11539 {
11541 }
11542 }
11543
11544
11546 {
11548 }
11549
11551 {
11553 }
11554
11555 override void InsertAgent(
int agent,
float count = 1)
11556 {
11557 if (count < 1)
11558 return;
11559
11561 }
11562
11565 {
11567 }
11568
11569
11571 {
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
11609
11610
11611
11612
11613
11614
11615
11617 {
11619 return false;
11620 return true;
11621 }
11622
11624 {
11625
11627 }
11628
11629
11632 {
11633 super.CheckForRoofLimited(timeTresholdMS);
11634
11635 float time =
g_Game.GetTime();
11636 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11637 {
11638 m_PreviousRoofTestTime = time;
11639 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11640 }
11641 }
11642
11643
11645 {
11647 {
11648 return 0;
11649 }
11650
11651 if (GetInventory().GetAttachmentSlotsCount() != 0)
11652 {
11653 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11654 if (filter)
11655 return filter.GetProtectionLevel(type, false, system);
11656 else
11657 return 0;
11658 }
11659
11660 string subclassPath, entryName;
11661
11662 switch (type)
11663 {
11665 entryName = "biological";
11666 break;
11668 entryName = "chemical";
11669 break;
11670 default:
11671 entryName = "biological";
11672 break;
11673 }
11674
11675 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11676
11677 return g_Game.ConfigGetFloat(subclassPath + entryName);
11678 }
11679
11680
11681
11684 {
11685 if (!IsMagazine())
11687
11689 }
11690
11691
11692
11693
11694
11699 {
11700 return true;
11701 }
11702
11704 {
11706 }
11707
11708
11709
11710
11711
11713 {
11714 if (parent)
11715 {
11716 if (parent.IsInherited(DayZInfected))
11717 return true;
11718
11719 if (!parent.IsRuined())
11720 return true;
11721 }
11722
11723 return true;
11724 }
11725
11727 {
11728 if (!super.CanPutAsAttachment(parent))
11729 {
11730 return false;
11731 }
11732
11733 if (!IsRuined() && !parent.IsRuined())
11734 {
11735 return true;
11736 }
11737
11738 return false;
11739 }
11740
11742 {
11743
11744
11745
11746
11747 return super.CanReceiveItemIntoCargo(item);
11748 }
11749
11751 {
11752
11753
11754
11755
11756 GameInventory attachmentInv = attachment.GetInventory();
11758 {
11759 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11760 return false;
11761 }
11762
11763 InventoryLocation loc = new InventoryLocation();
11764 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11765 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11766 return false;
11767
11768 return super.CanReceiveAttachment(attachment, slotId);
11769 }
11770
11772 {
11773 if (!super.CanReleaseAttachment(attachment))
11774 return false;
11775
11776 return GetInventory().AreChildrenAccessible();
11777 }
11778
11779
11780
11781
11782
11783
11784
11785
11786
11787
11788
11789
11790
11791
11792
11793
11794
11795
11796
11797
11798
11800 {
11801 int id = muzzle_owner.GetMuzzleID();
11802 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11803
11804 if (WPOF_array)
11805 {
11806 for (int i = 0; i < WPOF_array.Count(); i++)
11807 {
11808 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11809
11810 if (WPOF)
11811 {
11812 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11813 }
11814 }
11815 }
11816 }
11817
11818
11820 {
11821 int id = muzzle_owner.GetMuzzleID();
11823
11824 if (WPOBE_array)
11825 {
11826 for (int i = 0; i < WPOBE_array.Count(); i++)
11827 {
11828 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11829
11830 if (WPOBE)
11831 {
11832 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11833 }
11834 }
11835 }
11836 }
11837
11838
11840 {
11841 int id = muzzle_owner.GetMuzzleID();
11842 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11843
11844 if (WPOOH_array)
11845 {
11846 for (int i = 0; i < WPOOH_array.Count(); i++)
11847 {
11848 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11849
11850 if (WPOOH)
11851 {
11852 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11853 }
11854 }
11855 }
11856 }
11857
11858
11860 {
11861 int id = muzzle_owner.GetMuzzleID();
11862 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11863
11864 if (WPOOH_array)
11865 {
11866 for (int i = 0; i < WPOOH_array.Count(); i++)
11867 {
11868 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11869
11870 if (WPOOH)
11871 {
11872 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11873 }
11874 }
11875 }
11876 }
11877
11878
11880 {
11881 int id = muzzle_owner.GetMuzzleID();
11882 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11883
11884 if (WPOOH_array)
11885 {
11886 for (int i = 0; i < WPOOH_array.Count(); i++)
11887 {
11888 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11889
11890 if (WPOOH)
11891 {
11892 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11893 }
11894 }
11895 }
11896 }
11897
11898
11899
11901 {
11903 {
11904 return true;
11905 }
11906
11907 return false;
11908 }
11909
11911 {
11913 {
11914 return true;
11915 }
11916
11917 return false;
11918 }
11919
11921 {
11923 {
11924 return true;
11925 }
11926
11927 return false;
11928 }
11929
11931 {
11932 return false;
11933 }
11934
11937 {
11938 return UATimeSpent.DEFAULT_DEPLOY;
11939 }
11940
11941
11942
11943
11945 {
11947 SetSynchDirty();
11948 }
11949
11951 {
11953 }
11954
11955
11957 {
11958 return false;
11959 }
11960
11963 {
11964 string att_type = "None";
11965
11966 if (ConfigIsExisting("soundAttType"))
11967 {
11968 att_type = ConfigGetString("soundAttType");
11969 }
11970
11972 }
11973
11975 {
11977 }
11978
11979
11980
11981
11982
11988
11990 {
11993
11995 }
11996
11997
11999 {
12001 return;
12002
12004
12007
12010
12011 SoundParameters params = new SoundParameters();
12015 }
12016
12017
12019 {
12021 {
12024
12025 SetSynchDirty();
12026
12029 }
12030 }
12031
12033 {
12035 }
12036
12037
12039 {
12041 return;
12042
12044 SetSynchDirty();
12045
12048 }
12049
12051 {
12054 }
12055
12057 {
12059 }
12060
12061 void OnApply(PlayerBase player);
12062
12064 {
12065 return 1.0;
12066 };
12067
12069 {
12071 }
12072
12074 {
12076 }
12077
12079
12081 {
12082 SetDynamicPhysicsLifeTime(0.01);
12084 }
12085
12087 {
12088 array<string> zone_names = new array<string>;
12089 GetDamageZones(zone_names);
12090 for (int i = 0; i < zone_names.Count(); i++)
12091 {
12092 SetHealthMax(zone_names.Get(i),"Health");
12093 }
12094 SetHealthMax("","Health");
12095 }
12096
12099 {
12100 float global_health = GetHealth01("","Health");
12101 array<string> zones = new array<string>;
12102 GetDamageZones(zones);
12103
12104 for (int i = 0; i < zones.Count(); i++)
12105 {
12106 SetHealth01(zones.Get(i),"Health",global_health);
12107 }
12108 }
12109
12112 {
12113 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12114 }
12115
12117 {
12118 if (!hasRootAsPlayer)
12119 {
12120 if (refParentIB)
12121 {
12122
12123 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12124 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12125
12126 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12127 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12128
12131 }
12132 else
12133 {
12134
12137 }
12138 }
12139 }
12140
12142 {
12144 {
12145 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12146 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12147 {
12148 float heatPermCoef = 1.0;
12150 while (ent)
12151 {
12152 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12153 ent = ent.GetHierarchyParent();
12154 }
12155
12156 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12157 }
12158 }
12159 }
12160
12162 {
12163
12164 EntityAI parent = GetHierarchyParent();
12165 if (!parent)
12166 {
12167 hasParent = false;
12168 hasRootAsPlayer = false;
12169 }
12170 else
12171 {
12172 hasParent = true;
12173 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12174 refParentIB =
ItemBase.Cast(parent);
12175 }
12176 }
12177
12178 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12179 {
12180
12181 }
12182
12184 {
12185
12186 return false;
12187 }
12188
12190 {
12191
12192
12193 return false;
12194 }
12195
12197 {
12198
12199 return false;
12200 }
12201
12204 {
12205 return !GetIsFrozen() &&
IsOpen();
12206 }
12207
12209 {
12210 bool hasParent = false, hasRootAsPlayer = false;
12212
12213 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12214 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12215
12216 if (wwtu || foodDecay)
12217 {
12221
12222 if (processWetness || processTemperature || processDecay)
12223 {
12225
12226 if (processWetness)
12227 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12228
12229 if (processTemperature)
12231
12232 if (processDecay)
12233 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12234 }
12235 }
12236 }
12237
12240 {
12242 }
12243
12245 {
12248
12249 return super.GetTemperatureFreezeThreshold();
12250 }
12251
12253 {
12256
12257 return super.GetTemperatureThawThreshold();
12258 }
12259
12261 {
12264
12265 return super.GetItemOverheatThreshold();
12266 }
12267
12269 {
12271 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12272
12273 return super.GetTemperatureFreezeTime();
12274 }
12275
12277 {
12279 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12280
12281 return super.GetTemperatureThawTime();
12282 }
12283
12288
12290 {
12291 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12292 }
12293
12295 {
12296 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12297 }
12298
12301 {
12303 }
12304
12306 {
12308 }
12309
12311 {
12313 }
12314
12317 {
12318 return null;
12319 }
12320
12323 {
12324 return false;
12325 }
12326
12328 {
12330 {
12333 if (!trg)
12334 {
12336 explosive = this;
12337 }
12338
12339 explosive.PairRemote(trg);
12341
12342 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12343 trg.SetPersistentPairID(persistentID);
12344 explosive.SetPersistentPairID(persistentID);
12345
12346 return true;
12347 }
12348 return false;
12349 }
12350
12353 {
12354 float ret = 1.0;
12357 ret *= GetHealth01();
12358
12359 return ret;
12360 }
12361
12362 #ifdef DEVELOPER
12363 override void SetDebugItem()
12364 {
12365 super.SetDebugItem();
12366 _itemBase = this;
12367 }
12368
12370 {
12371 string text = super.GetDebugText();
12372
12374 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12375
12376 return text;
12377 }
12378 #endif
12379
12381 {
12382 return true;
12383 }
12384
12386
12388
12390 {
12393 }
12394
12395
12403
12419
12420 [
Obsolete(
"Use ItemSoundHandler instead")]
12423 {
12424 if (!
g_Game.IsDedicatedServer())
12425 {
12426 if (ConfigIsExisting("attachSoundSet"))
12427 {
12428 string cfg_path = "";
12429 string soundset = "";
12430 string type_name =
GetType();
12431
12434 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12435 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12436
12437 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12438 {
12439 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12440 {
12441 if (cfg_slot_array[i] == slot_type)
12442 {
12443 soundset = cfg_soundset_array[i];
12444 break;
12445 }
12446 }
12447 }
12448
12449 if (soundset != "")
12450 {
12451 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12453 }
12454 }
12455 }
12456 }
12457
12459}
12460
12462{
12464 if (entity)
12465 {
12466 bool is_item = entity.IsInherited(
ItemBase);
12467 if (is_item && full_quantity)
12468 {
12471 }
12472 }
12473 else
12474 {
12476 return NULL;
12477 }
12478 return entity;
12479}
12480
12482{
12483 if (item)
12484 {
12485 if (health > 0)
12486 item.SetHealth("", "", health);
12487
12488 if (item.CanHaveTemperature())
12489 {
12491 if (item.CanFreeze())
12492 item.SetFrozen(false);
12493 }
12494
12495 if (item.HasEnergyManager())
12496 {
12497 if (quantity >= 0)
12498 {
12499 item.GetCompEM().SetEnergy0To1(quantity);
12500 }
12501 else
12502 {
12504 }
12505 }
12506 else if (item.IsMagazine())
12507 {
12508 Magazine mag = Magazine.Cast(item);
12509 if (quantity >= 0)
12510 {
12511 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12512 }
12513 else
12514 {
12516 }
12517
12518 }
12519 else
12520 {
12521 if (quantity >= 0)
12522 {
12523 item.SetQuantityNormalized(quantity, false);
12524 }
12525 else
12526 {
12528 }
12529
12530 }
12531 }
12532}
12533
12534#ifdef DEVELOPER
12536#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.