7536{
7538 {
7539 return true;
7540 }
7541};
7542
7544{
7545
7546};
7547
7548
7549
7551{
7555
7557
7560
7561
7562
7563
7564
7573
7579
7584
7589
7610 protected bool m_IsResultOfSplit
7611
7613
7618
7619
7620
7622
7626
7627
7628
7630
7633
7634
7635
7641
7642
7650
7653
7654
7656
7657
7659
7660
7665
7666
7671
7673
7674
7676
7677
7679 {
7684
7685 if (!
g_Game.IsDedicatedServer())
7686 {
7688 {
7690
7692 {
7694 }
7695 }
7696
7699 }
7700
7701 m_OldLocation = null;
7702
7704 {
7706 }
7707
7708 if (ConfigIsExisting("headSelectionsToHide"))
7709 {
7712 }
7713
7715 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7716 {
7718 }
7719
7721
7722 m_IsResultOfSplit = false;
7723
7725 }
7726
7728 {
7729 super.InitItemVariables();
7730
7736 m_Count = ConfigGetInt(
"count");
7737
7740
7745
7748
7753
7765
7769
7770
7773 if (ConfigIsExisting("canBeSplit"))
7774 {
7777 }
7778
7780 if (ConfigIsExisting("itemBehaviour"))
7782
7783
7786 RegisterNetSyncVariableInt("m_VarLiquidType");
7787 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7788
7789 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7790 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7791 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7792
7793 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7794 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7795 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7796 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7797
7798 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7799 RegisterNetSyncVariableBool("m_IsTakeable");
7800 RegisterNetSyncVariableBool("m_IsHologram");
7801
7804 {
7807 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7808 }
7809
7811
7813 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7815
7817 }
7818
7820 {
7822 }
7823
7825 {
7828 {
7833 }
7834 }
7835
7836 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7837 {
7839 {
7842 }
7843
7845 }
7846
7848 {
7854 }
7855
7857
7859 {
7861
7862 if (!action)
7863 {
7864 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7865 return;
7866 }
7867
7869 if (!ai)
7870 {
7872 return;
7873 }
7874
7876 if (!action_array)
7877 {
7878 action_array = new array<ActionBase_Basic>;
7880 }
7881 if (LogManager.IsActionLogEnable())
7882 {
7883 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7884 }
7885
7886 if (action_array.Find(action) != -1)
7887 {
7888 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7889 }
7890 else
7891 {
7892 action_array.Insert(action);
7893 }
7894 }
7895
7897 {
7898 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7899 ActionBase action = player.GetActionManager().GetAction(actionName);
7902
7903 if (action_array)
7904 {
7905 action_array.RemoveItem(action);
7906 }
7907 }
7908
7909
7910
7912 {
7913 ActionOverrideData overrideData = new ActionOverrideData();
7917
7919 if (!actionMap)
7920 {
7923 }
7924
7925 actionMap.Insert(this.
Type(), overrideData);
7926
7927 }
7928
7930
7932
7933
7935 {
7938
7941
7942 string config_to_search = "CfgVehicles";
7943 string muzzle_owner_config;
7944
7946 {
7947 if (IsInherited(Weapon))
7948 config_to_search = "CfgWeapons";
7949
7950 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7951
7952 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7953
7954 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7955
7956 if (config_OnFire_subclass_count > 0)
7957 {
7958 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7959
7960 for (int i = 0; i < config_OnFire_subclass_count; i++)
7961 {
7962 string particle_class = "";
7963 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7964 string config_OnFire_entry = config_OnFire_class + particle_class;
7965 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7966 WPOF_array.Insert(WPOF);
7967 }
7968
7969
7971 }
7972 }
7973
7975 {
7976 config_to_search = "CfgWeapons";
7977 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7978
7979 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7980
7981 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7982
7983 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7984 {
7985 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7986
7987 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7988 {
7989 string particle_class2 = "";
7990 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7991 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7992 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7993 WPOBE_array.Insert(WPOBE);
7994 }
7995
7996
7998 }
7999 }
8000 }
8001
8002
8004 {
8007
8009 {
8010 string config_to_search = "CfgVehicles";
8011
8012 if (IsInherited(Weapon))
8013 config_to_search = "CfgWeapons";
8014
8015 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8016 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8017
8018 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8019 {
8020
8022
8024 {
8026 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8028 return;
8029 }
8030
8033
8034
8035
8036 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8037 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8038
8039 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8040 {
8041 string particle_class = "";
8042 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8043 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8044 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8045
8046 if (entry_type == CT_CLASS)
8047 {
8048 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8049 WPOOH_array.Insert(WPOF);
8050 }
8051 }
8052
8053
8055 }
8056 }
8057 }
8058
8060 {
8062 }
8063
8065 {
8067 {
8069
8072
8075
8076 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8077 }
8078 }
8079
8081 {
8083 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8084
8086 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8087
8089 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8090
8092 {
8094 }
8095 }
8096
8098 {
8100 }
8101
8103 {
8106 else
8108
8110 {
8113 }
8114 else
8115 {
8118
8121 }
8122
8124 }
8125
8127 {
8129 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8130 }
8131
8133 {
8135 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8137 }
8138
8140 {
8142 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8143 }
8144
8146 {
8149
8150 OverheatingParticle OP = new OverheatingParticle();
8155
8157 }
8158
8160 {
8163
8164 return -1;
8165 }
8166
8168 {
8170 {
8173
8174 for (int i = count; i > 0; --i)
8175 {
8176 int id = i - 1;
8179
8182
8183 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8184 {
8185 if (p)
8186 {
8189 }
8190 }
8191 }
8192 }
8193 }
8194
8196 {
8198 {
8200 {
8201 int id = i - 1;
8203
8204 if (OP)
8205 {
8207
8208 if (p)
8209 {
8211 }
8212
8213 delete OP;
8214 }
8215 }
8216
8219 }
8220 }
8221
8224 {
8225 return 0.0;
8226 }
8227
8228
8230 {
8231 return 250;
8232 }
8233
8235 {
8236 return 0;
8237 }
8238
8241 {
8243 return true;
8244
8245 return false;
8246 }
8247
8250 {
8253
8255 {
8257 }
8258 else
8259 {
8260
8262 }
8263
8265 }
8266
8273 {
8274 return -1;
8275 }
8276
8277
8278
8279
8281 {
8283 {
8284 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8285 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8286
8287 if (r_index >= 0)
8288 {
8289 InventoryLocation r_il = new InventoryLocation;
8290 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8291
8292 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8295 {
8296 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8297 }
8299 {
8300 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8301 }
8302
8303 }
8304
8305 player.GetHumanInventory().ClearUserReservedLocation(this);
8306 }
8307
8310 }
8311
8312
8313
8314
8316 {
8317 return ItemBase.m_DebugActionsMask;
8318 }
8319
8321 {
8322 return ItemBase.m_DebugActionsMask & mask;
8323 }
8324
8326 {
8327 ItemBase.m_DebugActionsMask = mask;
8328 }
8329
8331 {
8332 ItemBase.m_DebugActionsMask |= mask;
8333 }
8334
8336 {
8337 ItemBase.m_DebugActionsMask &= ~mask;
8338 }
8339
8341 {
8343 {
8345 }
8346 else
8347 {
8349 }
8350 }
8351
8352
8354 {
8355 if (GetEconomyProfile())
8356 {
8357 float q_max = GetEconomyProfile().GetQuantityMax();
8358 if (q_max > 0)
8359 {
8360 float q_min = GetEconomyProfile().GetQuantityMin();
8361 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8362
8364 {
8365 ComponentEnergyManager comp = GetCompEM();
8367 {
8369 }
8370 }
8372 {
8374
8375 }
8376
8377 }
8378 }
8379 }
8380
8383 {
8384 EntityAI parent = GetHierarchyParent();
8385
8386 if (parent)
8387 {
8388 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8389 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8390 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8391 }
8392 }
8393
8396 {
8397 EntityAI parent = GetHierarchyParent();
8398
8399 if (parent)
8400 {
8401 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8402 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8403 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8404 }
8405 }
8406
8408 {
8409
8410
8411
8412
8414
8416 {
8417 if (ScriptInputUserData.CanStoreInputUserData())
8418 {
8419 ScriptInputUserData ctx = new ScriptInputUserData;
8425 ctx.
Write(use_stack_max);
8428
8430 {
8431 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8432 }
8433 }
8434 }
8435 else if (!
g_Game.IsMultiplayer())
8436 {
8438 }
8439 }
8440
8442 {
8444 }
8445
8447 {
8449 }
8450
8452 {
8454 }
8455
8457 {
8458
8459 return false;
8460 }
8461
8463 {
8464 return false;
8465 }
8466
8470 {
8471 return false;
8472 }
8473
8475 {
8476 return "";
8477 }
8478
8480
8482 {
8483 return false;
8484 }
8485
8487 {
8488 return true;
8489 }
8490
8491
8492
8494 {
8495 return true;
8496 }
8497
8499 {
8500 return true;
8501 }
8502
8504 {
8505 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8507 }
8508
8510 {
8512 }
8513
8515 {
8517 if (!is_being_placed)
8519 SetSynchDirty();
8520 }
8521
8522
8524
8526 {
8528 }
8529
8531 {
8533 }
8534
8536 {
8537 return 1;
8538 }
8539
8541 {
8542 return false;
8543 }
8544
8546 {
8548 SetSynchDirty();
8549 }
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8573
8574
8575
8576
8577
8578
8579
8580
8581
8582
8583
8584
8586 {
8587 super.OnMovedInsideCargo(container);
8588
8589 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8590 }
8591
8592 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8593 {
8594 super.EEItemLocationChanged(oldLoc, newLoc);
8595
8596 PlayerBase newPlayer = null;
8597 PlayerBase oldPlayer = null;
8598
8599 if (newLoc.GetParent())
8600 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8601
8602 if (oldLoc.GetParent())
8603 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8604
8606 {
8607 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8608
8609 if (rIndex >= 0)
8610 {
8611 InventoryLocation rIl = new InventoryLocation;
8612 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8613
8614 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8617 {
8618 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8619 }
8621 {
8623 }
8624
8625 }
8626 }
8627
8629 {
8630 if (newPlayer)
8631 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8632
8633 if (newPlayer == oldPlayer)
8634 {
8635 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8636 {
8638 {
8639 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8640 {
8641 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8642 }
8643 }
8644 else
8645 {
8646 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8647 }
8648 }
8649
8650 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8651 {
8652 int type = oldLoc.GetType();
8654 {
8655 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8656 }
8658 {
8659 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8660 }
8661 }
8662 if (!m_OldLocation)
8663 {
8664 m_OldLocation = new InventoryLocation;
8665 }
8666 m_OldLocation.Copy(oldLoc);
8667 }
8668 else
8669 {
8670 if (m_OldLocation)
8671 {
8672 m_OldLocation.Reset();
8673 }
8674 }
8675
8676 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8677 }
8678 else
8679 {
8680 if (newPlayer)
8681 {
8682 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8683 if (resIndex >= 0)
8684 {
8685 InventoryLocation il = new InventoryLocation;
8686 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8688 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8691 {
8692 il.
GetParent().GetOnReleaseLock().Invoke(it);
8693 }
8695 {
8697 }
8698
8699 }
8700 }
8702 {
8703
8705 }
8706
8707 if (m_OldLocation)
8708 {
8709 m_OldLocation.Reset();
8710 }
8711 }
8712
8714 {
8715 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8716 }
8717
8719 {
8720 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8721 }
8722 }
8723
8724 override void EOnContact(IEntity other, Contact extra)
8725 {
8727 {
8728 int liquidType = -1;
8730 if (impactSpeed > 0.0)
8731 {
8733 #ifndef SERVER
8735 #else
8737 SetSynchDirty();
8738 #endif
8740 }
8741 }
8742
8743 #ifdef SERVER
8744 if (GetCompEM() && GetCompEM().IsPlugged())
8745 {
8746 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8747 GetCompEM().UnplugThis();
8748 }
8749 #endif
8750 }
8751
8753
8755 {
8757 }
8758
8760 {
8761
8762 }
8763
8765 {
8766 super.OnItemLocationChanged(old_owner, new_owner);
8767
8768 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8769 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8770
8771 if (!relatedPlayer && playerNew)
8772 relatedPlayer = playerNew;
8773
8774 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8775 {
8777 if (actionMgr)
8778 {
8779 ActionBase currentAction = actionMgr.GetRunningAction();
8780 if (currentAction)
8782 }
8783 }
8784
8785 Man ownerPlayerOld = null;
8786 Man ownerPlayerNew = null;
8787
8788 if (old_owner)
8789 {
8790 if (old_owner.
IsMan())
8791 {
8792 ownerPlayerOld = Man.Cast(old_owner);
8793 }
8794 else
8795 {
8796 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8797 }
8798 }
8799 else
8800 {
8802 {
8804
8805 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8806 {
8807 GetCompEM().UnplugThis();
8808 }
8809 }
8810 }
8811
8812 if (new_owner)
8813 {
8814 if (new_owner.
IsMan())
8815 {
8816 ownerPlayerNew = Man.Cast(new_owner);
8817 }
8818 else
8819 {
8820 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8821 }
8822 }
8823
8824 if (ownerPlayerOld != ownerPlayerNew)
8825 {
8826 if (ownerPlayerOld)
8827 {
8828 array<EntityAI> subItemsExit = new array<EntityAI>;
8830 for (int i = 0; i < subItemsExit.Count(); i++)
8831 {
8834 }
8835 }
8836
8837 if (ownerPlayerNew)
8838 {
8839 array<EntityAI> subItemsEnter = new array<EntityAI>;
8841 for (int j = 0; j < subItemsEnter.Count(); j++)
8842 {
8845 }
8846 }
8847 }
8848 else if (ownerPlayerNew != null)
8849 {
8850 PlayerBase nplayer;
8851 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8852 {
8853 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8855 for (int k = 0; k < subItemsUpdate.Count(); k++)
8856 {
8858 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8859 }
8860 }
8861 }
8862
8863 if (old_owner)
8864 old_owner.OnChildItemRemoved(this);
8865 if (new_owner)
8866 new_owner.OnChildItemReceived(this);
8867 }
8868
8869
8871 {
8872 super.EEDelete(parent);
8873 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8874 if (player)
8875 {
8877
8878 if (player.IsAlive())
8879 {
8880 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8881 if (r_index >= 0)
8882 {
8883 InventoryLocation r_il = new InventoryLocation;
8884 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8885
8886 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8889 {
8890 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8891 }
8893 {
8894 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8895 }
8896
8897 }
8898
8899 player.RemoveQuickBarEntityShortcut(this);
8900 }
8901 }
8902 }
8903
8905 {
8906 super.EEKilled(killer);
8907
8910 {
8911 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8912 {
8913 if (IsMagazine())
8914 {
8915 if (Magazine.Cast(this).GetAmmoCount() > 0)
8916 {
8918 }
8919 }
8920 else
8921 {
8923 }
8924 }
8925 }
8926 }
8927
8929 {
8930 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8931
8932 super.OnWasAttached(parent, slot_id);
8933
8936
8939 }
8940
8942 {
8943 super.OnWasDetached(parent, slot_id);
8944
8947
8950 }
8951
8953 {
8954 int idx;
8957
8958 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8959 if (inventory_slots.Count() < 1)
8960 {
8961 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8962 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8963 }
8964 else
8965 {
8966 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8967 }
8968
8969 idx = inventory_slots.Find(slot);
8970 if (idx < 0)
8971 return "";
8972
8973 return attach_types.Get(idx);
8974 }
8975
8977 {
8978 int idx = -1;
8979 string slot;
8980
8983
8984 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8985 if (inventory_slots.Count() < 1)
8986 {
8987 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8988 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8989 }
8990 else
8991 {
8992 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8993 if (detach_types.Count() < 1)
8994 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8995 }
8996
8997 for (int i = 0; i < inventory_slots.Count(); i++)
8998 {
8999 slot = inventory_slots.Get(i);
9000 }
9001
9002 if (slot != "")
9003 {
9004 if (detach_types.Count() == 1)
9005 idx = 0;
9006 else
9007 idx = inventory_slots.Find(slot);
9008 }
9009 if (idx < 0)
9010 return "";
9011
9012 return detach_types.Get(idx);
9013 }
9014
9016 {
9017
9019
9020
9021 float min_time = 1;
9022 float max_time = 3;
9023 float delay = Math.RandomFloat(min_time, max_time);
9024
9025 explode_timer.Run(delay, this, "DoAmmoExplosion");
9026 }
9027
9029 {
9030 Magazine magazine = Magazine.Cast(this);
9031 int pop_sounds_count = 6;
9032 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9033
9034
9035 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9036 string sound_name = pop_sounds[ sound_idx ];
9037 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9038
9039
9040 magazine.ServerAddAmmoCount(-1);
9041
9042
9043 float min_temp_to_explode = 100;
9044
9045 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9046 {
9048 }
9049 }
9050
9051
9052 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9053 {
9054 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9055
9056 const int CHANCE_DAMAGE_CARGO = 4;
9057 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9058 const int CHANCE_DAMAGE_NOTHING = 2;
9059
9061 {
9062 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9063 int chances;
9064 int rnd;
9065
9066 if (GetInventory().GetCargo())
9067 {
9068 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9069 rnd = Math.RandomInt(0,chances);
9070
9071 if (rnd < CHANCE_DAMAGE_CARGO)
9072 {
9074 }
9075 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9076 {
9078 }
9079 }
9080 else
9081 {
9082 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9083 rnd = Math.RandomInt(0,chances);
9084
9085 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9086 {
9088 }
9089 }
9090 }
9091 }
9092
9094 {
9095 CargoBase cargo = GetInventory().GetCargo();
9096 if (cargo)
9097 {
9099 if (item_count > 0)
9100 {
9101 int random_pick = Math.RandomInt(0, item_count);
9103 if (!item.IsExplosive())
9104 {
9105 item.AddHealth("","",damage);
9106 return true;
9107 }
9108 }
9109 }
9110 return false;
9111 }
9112
9114 {
9115 GameInventory inventory = GetInventory();
9117 if (attachment_count > 0)
9118 {
9119 int random_pick = Math.RandomInt(0, attachment_count);
9121 if (!attachment.IsExplosive())
9122 {
9123 attachment.AddHealth("","",damage);
9124 return true;
9125 }
9126 }
9127 return false;
9128 }
9129
9131 {
9133 }
9134
9136 {
9138 return GetInventory().CanRemoveEntity();
9139
9140 return false;
9141 }
9142
9144 {
9145
9147 return false;
9148
9149
9151 return false;
9152
9153
9154
9156 if (delta == 0)
9157 return false;
9158
9159
9160 return true;
9161 }
9162
9164 {
9166 {
9167 if (ScriptInputUserData.CanStoreInputUserData())
9168 {
9169 ScriptInputUserData ctx = new ScriptInputUserData;
9174 ctx.
Write(destination_entity);
9178 }
9179 }
9180 else if (!
g_Game.IsMultiplayer())
9181 {
9183 }
9184 }
9185
9187 {
9188 float split_quantity_new;
9192 InventoryLocation loc = new InventoryLocation;
9193
9194 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9195 {
9197 split_quantity_new = stack_max;
9198 else
9200
9202 {
9203 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9204 if (new_item)
9205 {
9206 new_item.SetResultOfSplit(true);
9207 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9209 new_item.
SetQuantity(split_quantity_new,
false,
true);
9210 }
9211 }
9212 }
9213 else if (destination_entity && slot_id == -1)
9214 {
9215 if (quantity > stack_max)
9216 split_quantity_new = stack_max;
9217 else
9218 split_quantity_new = quantity;
9219
9221 {
9222 GameInventory destinationInventory = destination_entity.GetInventory();
9224 {
9227 }
9228
9229 if (new_item)
9230 {
9231 new_item.SetResultOfSplit(true);
9232 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9234 new_item.
SetQuantity(split_quantity_new,
false,
true);
9235 }
9236 }
9237 }
9238 else
9239 {
9240 if (stack_max != 0)
9241 {
9243 {
9245 }
9246
9247 if (split_quantity_new == 0)
9248 {
9249 if (!
g_Game.IsMultiplayer())
9250 player.PhysicalPredictiveDropItem(this);
9251 else
9252 player.ServerDropEntity(this);
9253 return;
9254 }
9255
9257 {
9259
9260 if (new_item)
9261 {
9262 new_item.SetResultOfSplit(true);
9263 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9266 new_item.PlaceOnSurface();
9267 }
9268 }
9269 }
9270 }
9271 }
9272
9274 {
9275 float split_quantity_new;
9279 InventoryLocation loc = new InventoryLocation;
9280
9281 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9282 {
9284 split_quantity_new = stack_max;
9285 else
9287
9289 {
9290 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9291 if (new_item)
9292 {
9293 new_item.SetResultOfSplit(true);
9294 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9296 new_item.
SetQuantity(split_quantity_new,
false,
true);
9297 }
9298 }
9299 }
9300 else if (destination_entity && slot_id == -1)
9301 {
9302 if (quantity > stack_max)
9303 split_quantity_new = stack_max;
9304 else
9305 split_quantity_new = quantity;
9306
9308 {
9309 GameInventory destinationInventory = destination_entity.GetInventory();
9311 {
9314 }
9315
9316 if (new_item)
9317 {
9318 new_item.SetResultOfSplit(true);
9319 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9321 new_item.
SetQuantity(split_quantity_new,
false,
true);
9322 }
9323 }
9324 }
9325 else
9326 {
9327 if (stack_max != 0)
9328 {
9330 {
9332 }
9333
9335 {
9337
9338 if (new_item)
9339 {
9340 new_item.SetResultOfSplit(true);
9341 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9344 new_item.PlaceOnSurface();
9345 }
9346 }
9347 }
9348 }
9349 }
9350
9352 {
9354 {
9355 if (ScriptInputUserData.CanStoreInputUserData())
9356 {
9357 ScriptInputUserData ctx = new ScriptInputUserData;
9362 dst.WriteToContext(ctx);
9364 }
9365 }
9366 else if (!
g_Game.IsMultiplayer())
9367 {
9369 }
9370 }
9371
9373 {
9375 {
9376 if (ScriptInputUserData.CanStoreInputUserData())
9377 {
9378 ScriptInputUserData ctx = new ScriptInputUserData;
9383 ctx.
Write(destination_entity);
9389 }
9390 }
9391 else if (!
g_Game.IsMultiplayer())
9392 {
9394 }
9395 }
9396
9398 {
9400 }
9401
9403 {
9405 float split_quantity_new;
9407 if (dst.IsValid())
9408 {
9409 int slot_id = dst.GetSlot();
9411
9412 if (quantity > stack_max)
9413 split_quantity_new = stack_max;
9414 else
9415 split_quantity_new = quantity;
9416
9418 {
9420
9421 if (new_item)
9422 {
9423 new_item.SetResultOfSplit(true);
9424 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9426 new_item.
SetQuantity(split_quantity_new,
false,
true);
9427 }
9428
9429 return new_item;
9430 }
9431 }
9432
9433 return null;
9434 }
9435
9437 {
9439 float split_quantity_new;
9441 if (destination_entity)
9442 {
9444 if (quantity > stackable)
9445 split_quantity_new = stackable;
9446 else
9447 split_quantity_new = quantity;
9448
9450 {
9451 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9452 if (new_item)
9453 {
9454 new_item.SetResultOfSplit(true);
9455 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9457 new_item.
SetQuantity(split_quantity_new,
false,
true);
9458 }
9459 }
9460 }
9461 }
9462
9464 {
9466 {
9467 if (ScriptInputUserData.CanStoreInputUserData())
9468 {
9469 ScriptInputUserData ctx = new ScriptInputUserData;
9474 ItemBase destination_entity =
this;
9475 ctx.
Write(destination_entity);
9479 }
9480 }
9481 else if (!
g_Game.IsMultiplayer())
9482 {
9484 }
9485 }
9486
9488 {
9490 float split_quantity_new;
9492 if (player)
9493 {
9495 if (quantity > stackable)
9496 split_quantity_new = stackable;
9497 else
9498 split_quantity_new = quantity;
9499
9501 {
9502 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9503 new_item =
ItemBase.Cast(in_hands);
9504 if (new_item)
9505 {
9506 new_item.SetResultOfSplit(true);
9507 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9509 new_item.SetQuantity(split_quantity_new, false, true);
9510 }
9511 }
9512 }
9513 }
9514
9516 {
9518 float split_quantity_new = Math.Floor(quantity * 0.5);
9519
9521 return;
9522
9524
9525 if (new_item)
9526 {
9527 if (new_item.GetQuantityMax() < split_quantity_new)
9528 {
9529 split_quantity_new = new_item.GetQuantityMax();
9530 }
9531
9532 new_item.SetResultOfSplit(true);
9533 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9534
9536 {
9539 }
9540 else
9541 {
9543 new_item.
SetQuantity(split_quantity_new,
false,
true);
9544 }
9545 }
9546 }
9547
9549 {
9551 float split_quantity_new = Math.Floor(quantity / 2);
9552
9554 return;
9555
9556 InventoryLocation invloc = new InventoryLocation;
9558
9560 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9561
9562 if (new_item)
9563 {
9564 if (new_item.GetQuantityMax() < split_quantity_new)
9565 {
9566 split_quantity_new = new_item.GetQuantityMax();
9567 }
9569 {
9572 }
9573 else if (split_quantity_new > 1)
9574 {
9576 new_item.
SetQuantity(split_quantity_new,
false,
true);
9577 }
9578 }
9579 }
9580
9583 {
9584 SetWeightDirty();
9586
9587 if (parent)
9588 parent.OnAttachmentQuantityChangedEx(this, delta);
9589
9591 {
9593 {
9595 }
9597 {
9598 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9600 }
9601 }
9602 }
9603
9606 {
9607
9608 }
9609
9612 {
9614 }
9615
9617 {
9618 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9619
9621 {
9622 if (newLevel == GameConstants.STATE_RUINED)
9623 {
9625 EntityAI parent = GetHierarchyParent();
9626 if (parent && parent.IsFireplace())
9627 {
9628 CargoBase cargo = GetInventory().GetCargo();
9629 if (cargo)
9630 {
9632 {
9634 }
9635 }
9636 }
9637 }
9638
9640 {
9641
9643 return;
9644 }
9645
9646 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9647 {
9649 }
9650 }
9651 }
9652
9653
9655 {
9656 super.OnRightClick();
9657
9659 {
9661 {
9662 if (ScriptInputUserData.CanStoreInputUserData())
9663 {
9664 EntityAI root = GetHierarchyRoot();
9665 Man playerOwner = GetHierarchyRootPlayer();
9666 InventoryLocation dst = new InventoryLocation;
9667
9668
9669 if (!playerOwner && root && root == this)
9670 {
9672 }
9673 else
9674 {
9675
9676 GetInventory().GetCurrentInventoryLocation(dst);
9678 {
9679 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9681 {
9683 }
9684 else
9685 {
9687
9688
9689 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9690 {
9692 }
9693 else
9694 {
9695 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9696 }
9697 }
9698 }
9699 }
9700
9701 ScriptInputUserData ctx = new ScriptInputUserData;
9709 }
9710 }
9711 else if (!
g_Game.IsMultiplayer())
9712 {
9714 }
9715 }
9716 }
9717
9719 {
9720 if (root)
9721 {
9722 vector m4[4];
9723 root.GetTransform(m4);
9724 dst.SetGround(this, m4);
9725 }
9726 else
9727 {
9728 GetInventory().GetCurrentInventoryLocation(dst);
9729 }
9730 }
9731
9732 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9733 {
9734
9735 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9736 return false;
9737
9738 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9739 return false;
9740
9741
9743 return false;
9744
9745
9746 Magazine mag = Magazine.Cast(this);
9747 if (mag)
9748 {
9749 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9750 return false;
9751
9752 if (stack_max_limit)
9753 {
9754 Magazine other_mag = Magazine.Cast(other_item);
9755 if (other_item)
9756 {
9757 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9758 return false;
9759 }
9760
9761 }
9762 }
9763 else
9764 {
9765
9767 return false;
9768
9770 return false;
9771 }
9772
9773 PlayerBase player = null;
9774 if (CastTo(player, GetHierarchyRootPlayer()))
9775 {
9776 if (player.GetInventory().HasAttachment(this))
9777 return false;
9778
9779 if (player.IsItemsToDelete())
9780 return false;
9781 }
9782
9783 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9784 return false;
9785
9786 int slotID;
9788 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9789 return false;
9790
9791 return true;
9792 }
9793
9795 {
9797 }
9798
9800 {
9801 return m_IsResultOfSplit;
9802 }
9803
9805 {
9806 m_IsResultOfSplit = value;
9807 }
9808
9810 {
9812 }
9813
9815 {
9816 float other_item_quantity = other_item.GetQuantity();
9817 float this_free_space;
9818
9820
9822
9823 if (other_item_quantity > this_free_space)
9824 {
9825 return this_free_space;
9826 }
9827 else
9828 {
9829 return other_item_quantity;
9830 }
9831 }
9832
9834 {
9836 }
9837
9839 {
9841 return;
9842
9843 if (!IsMagazine() && other_item)
9844 {
9846 if (quantity_used != 0)
9847 {
9848 float hp1 = GetHealth01("","");
9849 float hp2 = other_item.GetHealth01("","");
9850 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9851 hpResult = hpResult / (
GetQuantity() + quantity_used);
9852
9853 hpResult *= GetMaxHealth();
9854 Math.Round(hpResult);
9855 SetHealth("", "Health", hpResult);
9856
9858 other_item.AddQuantity(-quantity_used);
9859 }
9860 }
9862 }
9863
9865 {
9866 #ifdef SERVER
9867 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9868 GetHierarchyParent().IncreaseLifetimeUp();
9869 #endif
9870 };
9871
9873 {
9874 PlayerBase p = PlayerBase.Cast(player);
9875
9876 array<int> recipesIds = p.m_Recipes;
9877 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9878 if (moduleRecipesManager)
9879 {
9880 EntityAI itemInHands = player.GetEntityInHands();
9881 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9882 }
9883
9884 for (int i = 0;i < recipesIds.Count(); i++)
9885 {
9886 int key = recipesIds.Get(i);
9887 string recipeName = moduleRecipesManager.GetRecipeName(key);
9889 }
9890 }
9891
9892
9893 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9894 {
9895 super.GetDebugActions(outputList);
9896
9897
9903
9904
9909
9914
9915
9919
9920
9922 {
9926 }
9927
9930
9931
9935
9937
9938 InventoryLocation loc = new InventoryLocation();
9939 GetInventory().GetCurrentInventoryLocation(loc);
9941 {
9942 if (Gizmo_IsSupported())
9945 }
9946
9948 }
9949
9950
9951
9952
9954 {
9955 super.OnAction(action_id, player, ctx);
9956
9958 {
9959 switch (action_id)
9960 {
9964 return true;
9968 return true;
9969 }
9970 }
9971
9973 {
9974 switch (action_id)
9975 {
9977 Delete();
9978 return true;
9979 }
9980 }
9981
9982 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9983 {
9984 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9985 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9986 PlayerBase p = PlayerBase.Cast(player);
9987 if (
EActions.RECIPES_RANGE_START < 1000)
9988 {
9989 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9990 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9991 }
9992 }
9993 #ifndef SERVER
9994 else if (action_id ==
EActions.WATCH_PLAYER)
9995 {
9996 PluginDeveloper.SetDeveloperItemClientEx(player);
9997 }
9998 #endif
10000 {
10001 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10002 {
10003 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10004 OnDebugButtonPressServer(id + 1);
10005 }
10006
10007 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10008 {
10009 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10011 }
10012
10013 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10014 {
10015 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10017 }
10018
10019 else if (action_id ==
EActions.ADD_QUANTITY)
10020 {
10021 if (IsMagazine())
10022 {
10023 Magazine mag = Magazine.Cast(this);
10024 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10025 }
10026 else
10027 {
10029 }
10030
10031 if (m_EM)
10032 {
10033 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10034 }
10035
10036 }
10037
10038 else if (action_id ==
EActions.REMOVE_QUANTITY)
10039 {
10040 if (IsMagazine())
10041 {
10042 Magazine mag2 = Magazine.Cast(this);
10043 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10044 }
10045 else
10046 {
10048 }
10049 if (m_EM)
10050 {
10051 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10052 }
10053
10054 }
10055
10056 else if (action_id ==
EActions.SET_QUANTITY_0)
10057 {
10059
10060 if (m_EM)
10061 {
10062 m_EM.SetEnergy(0);
10063 }
10064 }
10065
10066 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10067 {
10069
10070 if (m_EM)
10071 {
10072 m_EM.SetEnergy(m_EM.GetEnergyMax());
10073 }
10074 }
10075
10076 else if (action_id ==
EActions.ADD_HEALTH)
10077 {
10078 AddHealth("","",GetMaxHealth("","Health")/5);
10079 }
10080 else if (action_id ==
EActions.REMOVE_HEALTH)
10081 {
10082 AddHealth("","",-GetMaxHealth("","Health")/5);
10083 }
10084 else if (action_id ==
EActions.DESTROY_HEALTH)
10085 {
10086 SetHealth01("","",0);
10087 }
10088 else if (action_id ==
EActions.WATCH_ITEM)
10089 {
10091 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10092 #ifdef DEVELOPER
10093 SetDebugDeveloper_item(this);
10094 #endif
10095 }
10096
10097 else if (action_id ==
EActions.ADD_TEMPERATURE)
10098 {
10099 AddTemperature(20);
10100
10101 }
10102
10103 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10104 {
10105 AddTemperature(-20);
10106
10107 }
10108
10109 else if (action_id ==
EActions.FLIP_FROZEN)
10110 {
10111 SetFrozen(!GetIsFrozen());
10112
10113 }
10114
10115 else if (action_id ==
EActions.ADD_WETNESS)
10116 {
10118
10119 }
10120
10121 else if (action_id ==
EActions.REMOVE_WETNESS)
10122 {
10124
10125 }
10126
10127 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10128 {
10131
10132
10133 }
10134
10135 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10136 {
10139 }
10140
10141 else if (action_id ==
EActions.MAKE_SPECIAL)
10142 {
10143 auto debugParams = DebugSpawnParams.WithPlayer(player);
10144 OnDebugSpawnEx(debugParams);
10145 }
10146
10147 }
10148
10149
10150 return false;
10151 }
10152
10153
10154
10155
10159
10162
10163
10164
10166 {
10167 return false;
10168 }
10169
10170
10172 {
10173 return true;
10174 }
10175
10176
10178 {
10179 return true;
10180 }
10181
10182
10183
10185 {
10186 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10187 return g_Game.ConfigIsExisting(config_path);
10188 }
10189
10192 {
10193 return null;
10194 }
10195
10197 {
10198 return false;
10199 }
10200
10202 {
10203 return false;
10204 }
10205
10209
10210
10212 {
10213 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10214 return module_repairing.CanRepair(this, item_repair_kit);
10215 }
10216
10217
10218 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10219 {
10220 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10221 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10222 }
10223
10224
10226 {
10227
10228
10229
10230
10231
10232
10233
10234
10235 return 1;
10236 }
10237
10238
10239
10241 {
10243 }
10244
10245
10246
10248 {
10250 }
10251
10252
10261 {
10262 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10263
10264 if (player)
10265 {
10266 player.MessageStatus(text);
10267 }
10268 }
10269
10270
10279 {
10280 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10281
10282 if (player)
10283 {
10284 player.MessageAction(text);
10285 }
10286 }
10287
10288
10297 {
10298 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10299
10300 if (player)
10301 {
10302 player.MessageFriendly(text);
10303 }
10304 }
10305
10306
10315 {
10316 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10317
10318 if (player)
10319 {
10320 player.MessageImportant(text);
10321 }
10322 }
10323
10325 {
10326 return true;
10327 }
10328
10329
10330 override bool KindOf(
string tag)
10331 {
10332 bool found = false;
10333 string item_name = this.
GetType();
10335 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10336
10337 int array_size = item_tag_array.Count();
10338 for (int i = 0; i < array_size; i++)
10339 {
10340 if (item_tag_array.Get(i) == tag)
10341 {
10342 found = true;
10343 break;
10344 }
10345 }
10346 return found;
10347 }
10348
10349
10351 {
10352
10353 super.OnRPC(sender, rpc_type,ctx);
10354
10355
10356 switch (rpc_type)
10357 {
10358 #ifndef SERVER
10359 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10360 Param2<bool, string> p = new Param2<bool, string>(false, "");
10361
10363 return;
10364
10365 bool play = p.param1;
10366 string soundSet = p.param2;
10367
10368 if (play)
10369 {
10371 {
10373 {
10375 }
10376 }
10377 else
10378 {
10380 }
10381 }
10382 else
10383 {
10385 }
10386
10387 break;
10388 #endif
10389
10390 }
10391
10393 {
10395 }
10396 }
10397
10398
10399
10400
10402 {
10403 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10404 return plugin.GetID(
name);
10405 }
10406
10408 {
10409 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10410 return plugin.GetName(id);
10411 }
10412
10415 {
10416
10417
10418 int varFlags;
10419 if (!ctx.
Read(varFlags))
10420 return;
10421
10422 if (varFlags & ItemVariableFlags.FLOAT)
10423 {
10425 }
10426 }
10427
10429 {
10430
10431 super.SerializeNumericalVars(floats_out);
10432
10433
10434
10436 {
10438 }
10439
10441 {
10443 }
10444
10446 {
10448 }
10449
10451 {
10456 }
10457
10459 {
10461 }
10462 }
10463
10465 {
10466
10467 super.DeSerializeNumericalVars(floats);
10468
10469
10470 int index = 0;
10471 int mask = Math.Round(floats.Get(index));
10472
10473 index++;
10474
10476 {
10478 {
10480 }
10481 else
10482 {
10483 float quantity = floats.Get(index);
10484 SetQuantity(quantity,
true,
false,
false,
false);
10485 }
10486 index++;
10487 }
10488
10490 {
10491 float wet = floats.Get(index);
10493 index++;
10494 }
10495
10497 {
10498 int liquidtype = Math.Round(floats.Get(index));
10500 index++;
10501 }
10502
10504 {
10506 index++;
10508 index++;
10510 index++;
10512 index++;
10513 }
10514
10516 {
10517 int cleanness = Math.Round(floats.Get(index));
10519 index++;
10520 }
10521 }
10522
10524 {
10525 super.WriteVarsToCTX(ctx);
10526
10527
10529 {
10531 }
10532
10534 {
10536 }
10537
10539 {
10541 }
10542
10544 {
10545 int r,g,b,a;
10551 }
10552
10554 {
10556 }
10557 }
10558
10560 {
10561 if (!super.ReadVarsFromCTX(ctx,version))
10562 return false;
10563
10564 int intValue;
10565 float value;
10566
10567 if (version < 140)
10568 {
10569 if (!ctx.
Read(intValue))
10570 return false;
10571
10572 m_VariablesMask = intValue;
10573 }
10574
10576 {
10577 if (!ctx.
Read(value))
10578 return false;
10579
10581 {
10583 }
10584 else
10585 {
10587 }
10588 }
10589
10590 if (version < 140)
10591 {
10593 {
10594 if (!ctx.
Read(value))
10595 return false;
10596 SetTemperatureDirect(value);
10597 }
10598 }
10599
10601 {
10602 if (!ctx.
Read(value))
10603 return false;
10605 }
10606
10608 {
10609 if (!ctx.
Read(intValue))
10610 return false;
10612 }
10613
10615 {
10616 int r,g,b,a;
10618 return false;
10620 return false;
10622 return false;
10624 return false;
10625
10627 }
10628
10630 {
10631 if (!ctx.
Read(intValue))
10632 return false;
10634 }
10635
10636 if (version >= 138 && version < 140)
10637 {
10639 {
10640 if (!ctx.
Read(intValue))
10641 return false;
10642 SetFrozen(intValue);
10643 }
10644 }
10645
10646 return true;
10647 }
10648
10649
10651 {
10654 {
10656 }
10657
10658 if (!super.OnStoreLoad(ctx, version))
10659 {
10661 return false;
10662 }
10663
10664 if (version >= 114)
10665 {
10666 bool hasQuickBarIndexSaved;
10667
10668 if (!ctx.
Read(hasQuickBarIndexSaved))
10669 {
10671 return false;
10672 }
10673
10674 if (hasQuickBarIndexSaved)
10675 {
10676 int itmQBIndex;
10677
10678
10679 if (!ctx.
Read(itmQBIndex))
10680 {
10682 return false;
10683 }
10684
10685 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10686 if (itmQBIndex != -1 && parentPlayer)
10687 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10688 }
10689 }
10690 else
10691 {
10692
10693 PlayerBase player;
10694 int itemQBIndex;
10695 if (version ==
int.
MAX)
10696 {
10697 if (!ctx.
Read(itemQBIndex))
10698 {
10700 return false;
10701 }
10702 }
10703 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10704 {
10705
10706 if (!ctx.
Read(itemQBIndex))
10707 {
10709 return false;
10710 }
10711 if (itemQBIndex != -1 && player)
10712 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10713 }
10714 }
10715
10716 if (version < 140)
10717 {
10718
10719 if (!LoadVariables(ctx, version))
10720 {
10722 return false;
10723 }
10724 }
10725
10726
10728 {
10730 return false;
10731 }
10732 if (version >= 132)
10733 {
10735 if (raib)
10736 {
10738 {
10740 return false;
10741 }
10742 }
10743 }
10744
10746 return true;
10747 }
10748
10749
10750
10752 {
10753 super.OnStoreSave(ctx);
10754
10755 PlayerBase player;
10756 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10757 {
10759
10760 int itemQBIndex = -1;
10761 itemQBIndex = player.FindQuickBarEntityIndex(this);
10762 ctx.
Write(itemQBIndex);
10763 }
10764 else
10765 {
10767 }
10768
10770
10772 if (raib)
10773 {
10775 }
10776 }
10777
10778
10780 {
10781 super.AfterStoreLoad();
10782
10784 {
10786 }
10787
10789 {
10792 }
10793 }
10794
10796 {
10797 super.EEOnAfterLoad();
10798
10800 {
10802 }
10803
10806 }
10807
10809 {
10810 return false;
10811 }
10812
10813
10814
10816 {
10818 {
10819 #ifdef PLATFORM_CONSOLE
10820
10822 {
10824 if (menu)
10825 {
10827 }
10828 }
10829 #endif
10830 }
10831
10833 {
10836 }
10837
10839 {
10840 SetWeightDirty();
10842 }
10844 {
10847 }
10848
10850 {
10853
10856 }
10858 {
10862 }
10863
10864 super.OnVariablesSynchronized();
10865 }
10866
10867
10868
10870 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10871 {
10872 if (!IsServerCheck(allow_client))
10873 return false;
10874
10876 return false;
10877
10880
10881 if (value <= (min + 0.001))
10882 value = min;
10883
10884 if (value == min)
10885 {
10886 if (destroy_config)
10887 {
10888 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10889 if (dstr)
10890 {
10892 this.Delete();
10893 return true;
10894 }
10895 }
10896 else if (destroy_forced)
10897 {
10899 this.Delete();
10900 return true;
10901 }
10902
10904 }
10905
10908
10910 {
10911 EntityAI parent = GetHierarchyRoot();
10912 InventoryLocation iLoc = new InventoryLocation();
10913 GetInventory().GetCurrentInventoryLocation(iLoc);
10915 {
10916 int iLocSlot = iLoc.
GetSlot();
10918 {
10920 }
10922 {
10924 }
10925 }
10926 }
10927
10929 {
10931
10932 if (delta)
10934 }
10935
10937
10938 return false;
10939 }
10940
10941
10943 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10944 {
10946 }
10947
10949 {
10952 }
10953
10955 {
10958 }
10959
10961 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10962 {
10963 float value_clamped = Math.Clamp(value, 0, 1);
10965 SetQuantity(result, destroy_config, destroy_forced);
10966 }
10967
10968
10971 {
10973 }
10974
10976 {
10978 }
10979
10980
10981
10982
10983
10984
10985
10986
10987
10988
10990 {
10991 int slot = -1;
10992 GameInventory inventory = GetInventory();
10993 if (inventory)
10994 {
10995 InventoryLocation il = new InventoryLocation;
10998 }
10999
11001 }
11002
11004 {
11005 float quantity_max = 0;
11006
11008 {
11009 if (attSlotID != -1)
11010 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11011
11012 if (quantity_max <= 0)
11014 }
11015
11016 if (quantity_max <= 0)
11018
11019 return quantity_max;
11020 }
11021
11023 {
11025 }
11026
11028 {
11030 }
11031
11032
11034 {
11036 }
11037
11039 {
11041 }
11042
11044 {
11046 }
11047
11048
11050 {
11051
11052 float weightEx = GetWeightEx();
11053 float special = GetInventoryAndCargoWeight();
11054 return weightEx - special;
11055 }
11056
11057
11059 {
11061 }
11062
11064 {
11066 {
11067 #ifdef DEVELOPER
11068 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11069 {
11070 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11072 }
11073 #endif
11074
11075 return GetQuantity() * GetConfigWeightModified();
11076 }
11077 else if (HasEnergyManager())
11078 {
11079 #ifdef DEVELOPER
11080 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11081 {
11082 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11083 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11084 }
11085 #endif
11086 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11087 }
11088 else
11089 {
11090 #ifdef DEVELOPER
11091 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11092 {
11093 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11094 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11095 }
11096 #endif
11097 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11098 }
11099 }
11100
11103 {
11104 int item_count = 0;
11106
11107 GameInventory inventory = GetInventory();
11108 CargoBase cargo = inventory.
GetCargo();
11109 if (cargo != NULL)
11110 {
11112 }
11113
11115 for (int i = 0; i < nAttachments; ++i)
11116 {
11118 if (item)
11119 item_count += item.GetNumberOfItems();
11120 }
11121 return item_count;
11122 }
11123
11126 {
11127 float weight = 0;
11128 float wetness = 1;
11129 if (include_wetness)
11132 {
11133 weight = wetness * m_ConfigWeight;
11134 }
11136 {
11137 weight = 1;
11138 }
11139 return weight;
11140 }
11141
11142
11143
11145 {
11146 GameInventory inventory = GetInventory();
11147 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11148 {
11149 array<EntityAI> items = new array<EntityAI>;
11151 for (int i = 0; i < items.Count(); ++i)
11152 {
11154 if (item)
11155 {
11156 g_Game.ObjectDelete(item);
11157 }
11158 }
11159 }
11160 }
11161
11162
11163
11164
11166 {
11167 float energy = 0;
11168 if (HasEnergyManager())
11169 {
11170 energy = GetCompEM().GetEnergy();
11171 }
11172 return energy;
11173 }
11174
11175
11177 {
11178 super.OnEnergyConsumed();
11179
11181 }
11182
11184 {
11185 super.OnEnergyAdded();
11186
11188 }
11189
11190
11192 {
11193 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11194 {
11196 {
11197 float energy_0to1 = GetCompEM().GetEnergy0To1();
11199 }
11200 }
11201 }
11202
11203
11205 {
11206 return ConfigGetFloat("heatIsolation");
11207 }
11208
11210 {
11212 }
11213
11215 {
11216 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11217 if (
g_Game.ConfigIsExisting(paramPath))
11218 return g_Game.ConfigGetFloat(paramPath);
11219
11220 return 0.0;
11221 }
11222
11224 {
11225 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11226 if (
g_Game.ConfigIsExisting(paramPath))
11227 return g_Game.ConfigGetFloat(paramPath);
11228
11229 return 0.0;
11230 }
11231
11232 override void SetWet(
float value,
bool allow_client =
false)
11233 {
11234 if (!IsServerCheck(allow_client))
11235 return;
11236
11239
11241
11242 m_VarWet = Math.Clamp(value, min, max);
11243
11245 {
11248 }
11249 }
11250
11251 override void AddWet(
float value)
11252 {
11254 }
11255
11257 {
11259 }
11260
11262 {
11264 }
11265
11267 {
11269 }
11270
11272 {
11274 }
11275
11277 {
11279 }
11280
11281 override void OnWetChanged(
float newVal,
float oldVal)
11282 {
11285 if (newLevel != oldLevel)
11286 {
11288 }
11289 }
11290
11292 {
11293 SetWeightDirty();
11294 }
11295
11297 {
11298 return GetWetLevelInternal(
m_VarWet);
11299 }
11300
11301
11302
11304 {
11306 }
11307
11309 {
11311 }
11312
11314 {
11316 }
11317
11319 {
11321 }
11322
11323
11324
11326 {
11327 if (ConfigIsExisting("itemModelLength"))
11328 {
11329 return ConfigGetFloat("itemModelLength");
11330 }
11331 return 0;
11332 }
11333
11335 {
11336 if (ConfigIsExisting("itemAttachOffset"))
11337 {
11338 return ConfigGetFloat("itemAttachOffset");
11339 }
11340 return 0;
11341 }
11342
11343 override void SetCleanness(
int value,
bool allow_client =
false)
11344 {
11345 if (!IsServerCheck(allow_client))
11346 return;
11347
11349
11351
11354 }
11355
11357 {
11359 }
11360
11362 {
11363 return true;
11364 }
11365
11366
11367
11368
11370 {
11372 }
11373
11375 {
11377 }
11378
11379
11380
11381
11382 override void SetColor(
int r,
int g,
int b,
int a)
11383 {
11389 }
11391 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11392 {
11397 }
11398
11400 {
11402 }
11403
11406 {
11407 int r,g,b,a;
11409 r = r/255;
11410 g = g/255;
11411 b = b/255;
11412 a = a/255;
11413 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11414 }
11415
11416
11417
11418 override void SetLiquidType(
int value,
bool allow_client =
false)
11419 {
11420 if (!IsServerCheck(allow_client))
11421 return;
11422
11427 }
11428
11430 {
11431 return ConfigGetInt("varLiquidTypeInit");
11432 }
11433
11435 {
11437 }
11438
11440 {
11442 SetFrozen(false);
11443 }
11444
11447 {
11448 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11449 }
11450
11451
11454 {
11455 PlayerBase nplayer;
11456 if (PlayerBase.CastTo(nplayer, player))
11457 {
11459 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11460 }
11461 }
11462
11463
11466 {
11467 PlayerBase nplayer;
11468 if (PlayerBase.CastTo(nplayer,player))
11469 {
11470 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11471 }
11472
11473 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11474
11475 if (HasEnergyManager())
11476 {
11477 GetCompEM().UpdatePlugState();
11478 }
11479 }
11480
11481
11483 {
11484 super.OnPlacementStarted(player);
11485
11487 }
11488
11489 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11490 {
11492 {
11493 m_AdminLog.OnPlacementComplete(player,
this);
11494 }
11495
11496 super.OnPlacementComplete(player, position, orientation);
11497 }
11498
11499
11500
11501
11502
11504 {
11506 {
11507 return true;
11508 }
11509 else
11510 {
11511 return false;
11512 }
11513 }
11514
11515
11517 {
11519 {
11521 }
11522 }
11523
11524
11526 {
11528 }
11529
11531 {
11533 }
11534
11535 override void InsertAgent(
int agent,
float count = 1)
11536 {
11537 if (count < 1)
11538 return;
11539
11541 }
11542
11545 {
11547 }
11548
11549
11551 {
11553 }
11554
11555
11556
11557
11558
11559
11560
11561
11562
11563
11564
11565
11566
11567
11568
11569
11570
11571
11572
11573
11574
11575
11576
11577
11578
11579
11580
11581
11582
11583
11584
11585
11586
11587
11588
11589
11590
11591
11592
11593
11594
11595
11597 {
11599 return false;
11600 return true;
11601 }
11602
11604 {
11605
11607 }
11608
11609
11612 {
11613 super.CheckForRoofLimited(timeTresholdMS);
11614
11615 float time =
g_Game.GetTime();
11616 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11617 {
11618 m_PreviousRoofTestTime = time;
11619 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11620 }
11621 }
11622
11623
11625 {
11627 {
11628 return 0;
11629 }
11630
11631 if (GetInventory().GetAttachmentSlotsCount() != 0)
11632 {
11633 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11634 if (filter)
11635 return filter.GetProtectionLevel(type, false, system);
11636 else
11637 return 0;
11638 }
11639
11640 string subclassPath, entryName;
11641
11642 switch (type)
11643 {
11645 entryName = "biological";
11646 break;
11648 entryName = "chemical";
11649 break;
11650 default:
11651 entryName = "biological";
11652 break;
11653 }
11654
11655 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11656
11657 return g_Game.ConfigGetFloat(subclassPath + entryName);
11658 }
11659
11660
11661
11664 {
11665 if (!IsMagazine())
11667
11669 }
11670
11671
11672
11673
11674
11679 {
11680 return true;
11681 }
11682
11684 {
11686 }
11687
11688
11689
11690
11691
11693 {
11694 if (parent)
11695 {
11696 if (parent.IsInherited(DayZInfected))
11697 return true;
11698
11699 if (!parent.IsRuined())
11700 return true;
11701 }
11702
11703 return true;
11704 }
11705
11707 {
11708 if (!super.CanPutAsAttachment(parent))
11709 {
11710 return false;
11711 }
11712
11713 if (!IsRuined() && !parent.IsRuined())
11714 {
11715 return true;
11716 }
11717
11718 return false;
11719 }
11720
11722 {
11723
11724
11725
11726
11727 return super.CanReceiveItemIntoCargo(item);
11728 }
11729
11731 {
11732
11733
11734
11735
11736 GameInventory attachmentInv = attachment.GetInventory();
11738 {
11739 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11740 return false;
11741 }
11742
11743 InventoryLocation loc = new InventoryLocation();
11744 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11745 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11746 return false;
11747
11748 return super.CanReceiveAttachment(attachment, slotId);
11749 }
11750
11752 {
11753 if (!super.CanReleaseAttachment(attachment))
11754 return false;
11755
11756 return GetInventory().AreChildrenAccessible();
11757 }
11758
11759
11760
11761
11762
11763
11764
11765
11766
11767
11768
11769
11770
11771
11772
11773
11774
11775
11776
11777
11778
11780 {
11781 int id = muzzle_owner.GetMuzzleID();
11782 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11783
11784 if (WPOF_array)
11785 {
11786 for (int i = 0; i < WPOF_array.Count(); i++)
11787 {
11788 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11789
11790 if (WPOF)
11791 {
11792 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11793 }
11794 }
11795 }
11796 }
11797
11798
11800 {
11801 int id = muzzle_owner.GetMuzzleID();
11803
11804 if (WPOBE_array)
11805 {
11806 for (int i = 0; i < WPOBE_array.Count(); i++)
11807 {
11808 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11809
11810 if (WPOBE)
11811 {
11812 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11813 }
11814 }
11815 }
11816 }
11817
11818
11820 {
11821 int id = muzzle_owner.GetMuzzleID();
11822 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11823
11824 if (WPOOH_array)
11825 {
11826 for (int i = 0; i < WPOOH_array.Count(); i++)
11827 {
11828 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11829
11830 if (WPOOH)
11831 {
11832 WPOOH.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.OnUpdate(weapon, 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.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11873 }
11874 }
11875 }
11876 }
11877
11878
11879
11881 {
11883 {
11884 return true;
11885 }
11886
11887 return false;
11888 }
11889
11891 {
11893 {
11894 return true;
11895 }
11896
11897 return false;
11898 }
11899
11901 {
11903 {
11904 return true;
11905 }
11906
11907 return false;
11908 }
11909
11911 {
11912 return false;
11913 }
11914
11917 {
11918 return UATimeSpent.DEFAULT_DEPLOY;
11919 }
11920
11921
11922
11923
11925 {
11927 SetSynchDirty();
11928 }
11929
11931 {
11933 }
11934
11935
11937 {
11938 return false;
11939 }
11940
11943 {
11944 string att_type = "None";
11945
11946 if (ConfigIsExisting("soundAttType"))
11947 {
11948 att_type = ConfigGetString("soundAttType");
11949 }
11950
11952 }
11953
11955 {
11957 }
11958
11959
11960
11961
11962
11968
11970 {
11973
11975 }
11976
11977
11979 {
11981 return;
11982
11984
11987
11990
11991 SoundParameters params = new SoundParameters();
11995 }
11996
11997
11999 {
12001 {
12004
12005 SetSynchDirty();
12006
12009 }
12010 }
12011
12013 {
12015 }
12016
12017
12019 {
12021 return;
12022
12024 SetSynchDirty();
12025
12028 }
12029
12031 {
12034 }
12035
12037 {
12039 }
12040
12041 void OnApply(PlayerBase player);
12042
12044 {
12045 return 1.0;
12046 };
12047
12049 {
12051 }
12052
12054 {
12056 }
12057
12059
12061 {
12062 SetDynamicPhysicsLifeTime(0.01);
12064 }
12065
12067 {
12068 array<string> zone_names = new array<string>;
12069 GetDamageZones(zone_names);
12070 for (int i = 0; i < zone_names.Count(); i++)
12071 {
12072 SetHealthMax(zone_names.Get(i),"Health");
12073 }
12074 SetHealthMax("","Health");
12075 }
12076
12079 {
12080 float global_health = GetHealth01("","Health");
12081 array<string> zones = new array<string>;
12082 GetDamageZones(zones);
12083
12084 for (int i = 0; i < zones.Count(); i++)
12085 {
12086 SetHealth01(zones.Get(i),"Health",global_health);
12087 }
12088 }
12089
12092 {
12093 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12094 }
12095
12097 {
12098 if (!hasRootAsPlayer)
12099 {
12100 if (refParentIB)
12101 {
12102
12103 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12104 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12105
12106 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12107 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12108
12111 }
12112 else
12113 {
12114
12117 }
12118 }
12119 }
12120
12122 {
12124 {
12125 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12126 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12127 {
12128 float heatPermCoef = 1.0;
12130 while (ent)
12131 {
12132 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12133 ent = ent.GetHierarchyParent();
12134 }
12135
12136 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12137 }
12138 }
12139 }
12140
12142 {
12143
12144 EntityAI parent = GetHierarchyParent();
12145 if (!parent)
12146 {
12147 hasParent = false;
12148 hasRootAsPlayer = false;
12149 }
12150 else
12151 {
12152 hasParent = true;
12153 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12154 refParentIB =
ItemBase.Cast(parent);
12155 }
12156 }
12157
12158 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12159 {
12160
12161 }
12162
12164 {
12165
12166 return false;
12167 }
12168
12170 {
12171
12172
12173 return false;
12174 }
12175
12177 {
12178
12179 return false;
12180 }
12181
12184 {
12185 return !GetIsFrozen() &&
IsOpen();
12186 }
12187
12189 {
12190 bool hasParent = false, hasRootAsPlayer = false;
12192
12193 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12194 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12195
12196 if (wwtu || foodDecay)
12197 {
12201
12202 if (processWetness || processTemperature || processDecay)
12203 {
12205
12206 if (processWetness)
12207 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12208
12209 if (processTemperature)
12211
12212 if (processDecay)
12213 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12214 }
12215 }
12216 }
12217
12220 {
12222 }
12223
12225 {
12228
12229 return super.GetTemperatureFreezeThreshold();
12230 }
12231
12233 {
12236
12237 return super.GetTemperatureThawThreshold();
12238 }
12239
12241 {
12244
12245 return super.GetItemOverheatThreshold();
12246 }
12247
12249 {
12251 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12252
12253 return super.GetTemperatureFreezeTime();
12254 }
12255
12257 {
12259 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12260
12261 return super.GetTemperatureThawTime();
12262 }
12263
12268
12270 {
12271 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12272 }
12273
12275 {
12276 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12277 }
12278
12281 {
12283 }
12284
12286 {
12288 }
12289
12291 {
12293 }
12294
12297 {
12298 return null;
12299 }
12300
12303 {
12304 return false;
12305 }
12306
12308 {
12310 {
12313 if (!trg)
12314 {
12316 explosive = this;
12317 }
12318
12319 explosive.PairRemote(trg);
12321
12322 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12323 trg.SetPersistentPairID(persistentID);
12324 explosive.SetPersistentPairID(persistentID);
12325
12326 return true;
12327 }
12328 return false;
12329 }
12330
12333 {
12334 float ret = 1.0;
12337 ret *= GetHealth01();
12338
12339 return ret;
12340 }
12341
12342 #ifdef DEVELOPER
12343 override void SetDebugItem()
12344 {
12345 super.SetDebugItem();
12346 _itemBase = this;
12347 }
12348
12350 {
12351 string text = super.GetDebugText();
12352
12354 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12355
12356 return text;
12357 }
12358 #endif
12359
12361 {
12362 return true;
12363 }
12364
12366
12368
12370 {
12373 }
12374
12375
12383
12399
12400 [
Obsolete(
"Use ItemSoundHandler instead")]
12403 {
12404 if (!
g_Game.IsDedicatedServer())
12405 {
12406 if (ConfigIsExisting("attachSoundSet"))
12407 {
12408 string cfg_path = "";
12409 string soundset = "";
12410 string type_name =
GetType();
12411
12414 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12415 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12416
12417 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12418 {
12419 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12420 {
12421 if (cfg_slot_array[i] == slot_type)
12422 {
12423 soundset = cfg_soundset_array[i];
12424 break;
12425 }
12426 }
12427 }
12428
12429 if (soundset != "")
12430 {
12431 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12433 }
12434 }
12435 }
12436 }
12437
12439}
12440
12442{
12444 if (entity)
12445 {
12446 bool is_item = entity.IsInherited(
ItemBase);
12447 if (is_item && full_quantity)
12448 {
12451 }
12452 }
12453 else
12454 {
12456 return NULL;
12457 }
12458 return entity;
12459}
12460
12462{
12463 if (item)
12464 {
12465 if (health > 0)
12466 item.SetHealth("", "", health);
12467
12468 if (item.CanHaveTemperature())
12469 {
12471 if (item.CanFreeze())
12472 item.SetFrozen(false);
12473 }
12474
12475 if (item.HasEnergyManager())
12476 {
12477 if (quantity >= 0)
12478 {
12479 item.GetCompEM().SetEnergy0To1(quantity);
12480 }
12481 else
12482 {
12484 }
12485 }
12486 else if (item.IsMagazine())
12487 {
12488 Magazine mag = Magazine.Cast(item);
12489 if (quantity >= 0)
12490 {
12491 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12492 }
12493 else
12494 {
12496 }
12497
12498 }
12499 else
12500 {
12501 if (quantity >= 0)
12502 {
12503 item.SetQuantityNormalized(quantity, false);
12504 }
12505 else
12506 {
12508 }
12509
12510 }
12511 }
12512}
12513
12514#ifdef DEVELOPER
12516#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.