7533{
7535 {
7536 return true;
7537 }
7538};
7539
7540
7541
7543{
7547
7549
7552
7553
7554
7555
7556
7565
7571
7576
7581
7602 protected bool m_IsResultOfSplit
7603
7605
7610
7611
7612
7614
7618
7619
7620
7622
7625
7626
7627
7633
7634
7642
7645
7646
7648
7649
7651
7652
7657
7658
7663
7664
7666
7667
7669 {
7674
7675 if (!
GetGame().IsDedicatedServer())
7676 {
7678 {
7680
7682 {
7684 }
7685 }
7686
7689 }
7690
7691 m_OldLocation = null;
7692
7694 {
7696 }
7697
7698 if (ConfigIsExisting("headSelectionsToHide"))
7699 {
7702 }
7703
7705 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7706 {
7708 }
7709
7711
7712 m_IsResultOfSplit = false;
7713
7715 }
7716
7718 {
7719 super.InitItemVariables();
7720
7726 m_Count = ConfigGetInt(
"count");
7727
7730
7735
7738
7743
7755
7759
7760
7763 if (ConfigIsExisting("canBeSplit"))
7764 {
7767 }
7768
7770 if (ConfigIsExisting("itemBehaviour"))
7772
7773
7776 RegisterNetSyncVariableInt("m_VarLiquidType");
7777 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7778
7779 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7780 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7781 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7782
7783 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7784 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7785 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7786 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7787
7788 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7789 RegisterNetSyncVariableBool("m_IsTakeable");
7790 RegisterNetSyncVariableBool("m_IsHologram");
7791
7794 {
7797 }
7798
7800
7802 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7804
7805 }
7806
7808 {
7810 }
7811
7813 {
7816 {
7821 }
7822 }
7823
7824 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7825 {
7827 {
7830 }
7831
7833 }
7834
7836 {
7842 }
7843
7845
7847 {
7849
7850 if (!action)
7851 {
7852 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7853 return;
7854 }
7855
7857 if (!ai)
7858 {
7860 return;
7861 }
7862
7864 if (!action_array)
7865 {
7866 action_array = new array<ActionBase_Basic>;
7868 }
7869 if (LogManager.IsActionLogEnable())
7870 {
7871 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7872 }
7873
7874 if (action_array.Find(action) != -1)
7875 {
7876 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7877 }
7878 else
7879 {
7880 action_array.Insert(action);
7881 }
7882 }
7883
7885 {
7887 ActionBase action = player.GetActionManager().GetAction(actionName);
7890
7891 if (action_array)
7892 {
7893 action_array.RemoveItem(action);
7894 }
7895 }
7896
7897
7898
7900 {
7901 ActionOverrideData overrideData = new ActionOverrideData();
7905
7907 if (!actionMap)
7908 {
7911 }
7912
7913 actionMap.Insert(this.
Type(), overrideData);
7914
7915 }
7916
7918
7920
7921
7923 {
7926
7929
7930 string config_to_search = "CfgVehicles";
7931 string muzzle_owner_config;
7932
7934 {
7935 if (IsInherited(Weapon))
7936 config_to_search = "CfgWeapons";
7937
7938 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7939
7940 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7941
7943
7944 if (config_OnFire_subclass_count > 0)
7945 {
7946 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7947
7948 for (int i = 0; i < config_OnFire_subclass_count; i++)
7949 {
7950 string particle_class = "";
7952 string config_OnFire_entry = config_OnFire_class + particle_class;
7953 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7954 WPOF_array.Insert(WPOF);
7955 }
7956
7957
7959 }
7960 }
7961
7963 {
7964 config_to_search = "CfgWeapons";
7965 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7966
7967 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7968
7970
7971 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7972 {
7973 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7974
7975 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7976 {
7977 string particle_class2 = "";
7979 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7980 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7981 WPOBE_array.Insert(WPOBE);
7982 }
7983
7984
7986 }
7987 }
7988 }
7989
7990
7992 {
7995
7997 {
7998 string config_to_search = "CfgVehicles";
7999
8000 if (IsInherited(Weapon))
8001 config_to_search = "CfgWeapons";
8002
8003 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8004 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8005
8006 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
8007 {
8008
8010
8012 {
8014 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8016 return;
8017 }
8018
8021
8022
8023
8025 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8026
8027 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8028 {
8029 string particle_class = "";
8031 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8033
8034 if (entry_type == CT_CLASS)
8035 {
8036 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8037 WPOOH_array.Insert(WPOF);
8038 }
8039 }
8040
8041
8043 }
8044 }
8045 }
8046
8048 {
8050 }
8051
8053 {
8055 {
8057
8060
8063
8064 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8065 }
8066 }
8067
8069 {
8071 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8072
8074 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8075
8077 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8078
8080 {
8082 }
8083 }
8084
8086 {
8088 }
8089
8091 {
8094 else
8096
8098 {
8101 }
8102 else
8103 {
8106
8109 }
8110
8112 }
8113
8115 {
8117 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8118 }
8119
8121 {
8123 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8125 }
8126
8128 {
8130 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8131 }
8132
8134 {
8137
8138 OverheatingParticle OP = new OverheatingParticle();
8143
8145 }
8146
8148 {
8151
8152 return -1;
8153 }
8154
8156 {
8158 {
8161
8162 for (int i = count; i > 0; --i)
8163 {
8164 int id = i - 1;
8167
8170
8171 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8172 {
8173 if (p)
8174 {
8177 }
8178 }
8179 }
8180 }
8181 }
8182
8184 {
8186 {
8188 {
8189 int id = i - 1;
8191
8192 if (OP)
8193 {
8195
8196 if (p)
8197 {
8199 }
8200
8201 delete OP;
8202 }
8203 }
8204
8207 }
8208 }
8209
8212 {
8213 return 0.0;
8214 }
8215
8216
8218 {
8219 return 250;
8220 }
8221
8223 {
8224 return 0;
8225 }
8226
8229 {
8231 return true;
8232
8233 return false;
8234 }
8235
8238 {
8241
8243 {
8245 }
8246 else
8247 {
8248
8250 }
8251
8253 }
8254
8261 {
8262 return -1;
8263 }
8264
8265
8266
8267
8269 {
8271 {
8273 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8274
8275 if (r_index >= 0)
8276 {
8277 InventoryLocation r_il = new InventoryLocation;
8278 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8279
8280 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8283 {
8284 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8285 }
8287 {
8288 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8289 }
8290
8291 }
8292
8293 player.GetHumanInventory().ClearUserReservedLocation(this);
8294 }
8295
8298 }
8299
8300
8301
8302
8304 {
8305 return ItemBase.m_DebugActionsMask;
8306 }
8307
8309 {
8310 return ItemBase.m_DebugActionsMask & mask;
8311 }
8312
8314 {
8315 ItemBase.m_DebugActionsMask = mask;
8316 }
8317
8319 {
8320 ItemBase.m_DebugActionsMask |= mask;
8321 }
8322
8324 {
8325 ItemBase.m_DebugActionsMask &= ~mask;
8326 }
8327
8329 {
8331 {
8333 }
8334 else
8335 {
8337 }
8338 }
8339
8340
8342 {
8343 if (GetEconomyProfile())
8344 {
8345 float q_max = GetEconomyProfile().GetQuantityMax();
8346 if (q_max > 0)
8347 {
8348 float q_min = GetEconomyProfile().GetQuantityMin();
8349 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8350
8352 {
8353 ComponentEnergyManager comp = GetCompEM();
8355 {
8357 }
8358 }
8360 {
8362
8363 }
8364
8365 }
8366 }
8367 }
8368
8371 {
8372 EntityAI parent = GetHierarchyParent();
8373
8374 if (parent)
8375 {
8376 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8377 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8378 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8379 }
8380 }
8381
8384 {
8385 EntityAI parent = GetHierarchyParent();
8386
8387 if (parent)
8388 {
8389 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8390 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8391 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8392 }
8393 }
8394
8396 {
8397
8398
8399
8400
8402
8404 {
8405 if (ScriptInputUserData.CanStoreInputUserData())
8406 {
8407 ScriptInputUserData ctx = new ScriptInputUserData;
8413 ctx.
Write(use_stack_max);
8416
8418 {
8419 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8420 }
8421 }
8422 }
8423 else if (!
GetGame().IsMultiplayer())
8424 {
8426 }
8427 }
8428
8430 {
8432 }
8433
8435 {
8437 }
8438
8440 {
8442 }
8443
8445 {
8446
8447 return false;
8448 }
8449
8451 {
8452 return false;
8453 }
8454
8458 {
8459 return false;
8460 }
8461
8463 {
8464 return "";
8465 }
8466
8468
8470 {
8471 return false;
8472 }
8473
8475 {
8476 return true;
8477 }
8478
8479
8480
8482 {
8483 return true;
8484 }
8485
8487 {
8488 return true;
8489 }
8490
8492 {
8493 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8495 }
8496
8498 {
8500 }
8501
8503 {
8505 if (!is_being_placed)
8507 SetSynchDirty();
8508 }
8509
8510
8512
8514 {
8516 }
8517
8519 {
8521 }
8522
8524 {
8525 return 1;
8526 }
8527
8529 {
8530 return false;
8531 }
8532
8534 {
8536 SetSynchDirty();
8537 }
8538
8539
8540
8541
8542
8543
8544
8545
8546
8547
8548
8549
8550
8551
8552
8553
8554
8555
8556
8557
8558
8559
8560
8561
8562
8563
8564
8565
8566
8567
8568
8569
8570
8571
8572
8574 {
8575 super.OnMovedInsideCargo(container);
8576
8577 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8578 }
8579
8580 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8581 {
8582 super.EEItemLocationChanged(oldLoc,newLoc);
8583
8584 PlayerBase new_player = null;
8585 PlayerBase old_player = null;
8586
8587 if (newLoc.GetParent())
8588 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8589
8590 if (oldLoc.GetParent())
8591 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8592
8594 {
8595 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
8596
8597 if (r_index >= 0)
8598 {
8599 InventoryLocation r_il = new InventoryLocation;
8600 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8601
8602 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8605 {
8606 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8607 }
8609 {
8610 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8611 }
8612
8613 }
8614 }
8615
8617 {
8618 if (new_player)
8619 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
8620
8621 if (new_player == old_player)
8622 {
8623
8624 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8625 {
8627 {
8628 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8629 {
8630 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8631 }
8632 }
8633 else
8634 {
8635 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8636 }
8637 }
8638
8639 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8640 {
8641 int type = oldLoc.GetType();
8643 {
8644 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8645 }
8647 {
8648 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8649 }
8650 }
8651 if (!m_OldLocation)
8652 {
8653 m_OldLocation = new InventoryLocation;
8654 }
8655 m_OldLocation.Copy(oldLoc);
8656 }
8657 else
8658 {
8659 if (m_OldLocation)
8660 {
8661 m_OldLocation.Reset();
8662 }
8663 }
8664
8666 }
8667 else
8668 {
8669 if (new_player)
8670 {
8671 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8672 if (res_index >= 0)
8673 {
8674 InventoryLocation il = new InventoryLocation;
8675 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
8677 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
8680 {
8681 il.
GetParent().GetOnReleaseLock().Invoke(it);
8682 }
8684 {
8686 }
8687
8688 }
8689 }
8691 {
8692
8694 }
8695
8696 if (m_OldLocation)
8697 {
8698 m_OldLocation.Reset();
8699 }
8700 }
8701 }
8702
8703 override void EOnContact(IEntity other, Contact extra)
8704 {
8706 {
8707 int liquidType = -1;
8709 if (impactSpeed > 0.0)
8710 {
8712 #ifndef SERVER
8714 #else
8716 SetSynchDirty();
8717 #endif
8719 }
8720 }
8721
8722 #ifdef SERVER
8723 if (GetCompEM() && GetCompEM().IsPlugged())
8724 {
8725 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8726 GetCompEM().UnplugThis();
8727 }
8728 #endif
8729 }
8730
8732
8734 {
8736 }
8737
8739 {
8740
8741 }
8742
8744 {
8745 super.OnItemLocationChanged(old_owner, new_owner);
8746
8747 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8748 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8749
8750 if (!relatedPlayer && playerNew)
8751 relatedPlayer = playerNew;
8752
8753 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8754 {
8756 if (actionMgr)
8757 {
8758 ActionBase currentAction = actionMgr.GetRunningAction();
8759 if (currentAction)
8761 }
8762 }
8763
8764 Man ownerPlayerOld = null;
8765 Man ownerPlayerNew = null;
8766
8767 if (old_owner)
8768 {
8769 if (old_owner.
IsMan())
8770 {
8771 ownerPlayerOld = Man.Cast(old_owner);
8772 }
8773 else
8774 {
8775 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8776 }
8777 }
8778 else
8779 {
8781 {
8783
8784 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8785 {
8786 GetCompEM().UnplugThis();
8787 }
8788 }
8789 }
8790
8791 if (new_owner)
8792 {
8793 if (new_owner.
IsMan())
8794 {
8795 ownerPlayerNew = Man.Cast(new_owner);
8796 }
8797 else
8798 {
8799 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8800 }
8801 }
8802
8803 if (ownerPlayerOld != ownerPlayerNew)
8804 {
8805 if (ownerPlayerOld)
8806 {
8807 array<EntityAI> subItemsExit = new array<EntityAI>;
8809 for (int i = 0; i < subItemsExit.Count(); i++)
8810 {
8813 }
8814 }
8815
8816 if (ownerPlayerNew)
8817 {
8818 array<EntityAI> subItemsEnter = new array<EntityAI>;
8820 for (int j = 0; j < subItemsEnter.Count(); j++)
8821 {
8824 }
8825 }
8826 }
8827 else if (ownerPlayerNew != null)
8828 {
8829 PlayerBase nplayer;
8830 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8831 {
8832 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8834 for (int k = 0; k < subItemsUpdate.Count(); k++)
8835 {
8837 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8838 }
8839 }
8840 }
8841
8842 if (old_owner)
8843 old_owner.OnChildItemRemoved(this);
8844 if (new_owner)
8845 new_owner.OnChildItemReceived(this);
8846 }
8847
8848
8850 {
8851 super.EEDelete(parent);
8852 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8853 if (player)
8854 {
8856
8857 if (player.IsAlive())
8858 {
8859 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8860 if (r_index >= 0)
8861 {
8862 InventoryLocation r_il = new InventoryLocation;
8863 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8864
8865 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8868 {
8869 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8870 }
8872 {
8873 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8874 }
8875
8876 }
8877
8878 player.RemoveQuickBarEntityShortcut(this);
8879 }
8880 }
8881 }
8882
8884 {
8885 super.EEKilled(killer);
8886
8889 {
8890 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8891 {
8892 if (IsMagazine())
8893 {
8894 if (Magazine.Cast(this).GetAmmoCount() > 0)
8895 {
8897 }
8898 }
8899 else
8900 {
8902 }
8903 }
8904 }
8905 }
8906
8908 {
8909 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8910
8911 super.OnWasAttached(parent, slot_id);
8912
8915
8917 }
8918
8920 {
8921 super.OnWasDetached(parent, slot_id);
8922
8925 }
8926
8928 {
8929 int idx;
8932
8933 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8934 if (inventory_slots.Count() < 1)
8935 {
8936 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8937 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8938 }
8939 else
8940 {
8941 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8942 }
8943
8944 idx = inventory_slots.Find(slot);
8945 if (idx < 0)
8946 return "";
8947
8948 return attach_types.Get(idx);
8949 }
8950
8952 {
8953 int idx = -1;
8954 string slot;
8955
8958
8959 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8960 if (inventory_slots.Count() < 1)
8961 {
8962 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8963 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8964 }
8965 else
8966 {
8967 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8968 if (detach_types.Count() < 1)
8969 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8970 }
8971
8972 for (int i = 0; i < inventory_slots.Count(); i++)
8973 {
8974 slot = inventory_slots.Get(i);
8975 }
8976
8977 if (slot != "")
8978 {
8979 if (detach_types.Count() == 1)
8980 idx = 0;
8981 else
8982 idx = inventory_slots.Find(slot);
8983 }
8984 if (idx < 0)
8985 return "";
8986
8987 return detach_types.Get(idx);
8988 }
8989
8991 {
8992
8994
8995
8996 float min_time = 1;
8997 float max_time = 3;
8998 float delay = Math.RandomFloat(min_time, max_time);
8999
9000 explode_timer.Run(delay, this, "DoAmmoExplosion");
9001 }
9002
9004 {
9005 Magazine magazine = Magazine.Cast(this);
9006 int pop_sounds_count = 6;
9007 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9008
9009
9010 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9011 string sound_name = pop_sounds[ sound_idx ];
9013
9014
9015 magazine.ServerAddAmmoCount(-1);
9016
9017
9018 float min_temp_to_explode = 100;
9019
9020 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9021 {
9023 }
9024 }
9025
9026
9027 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9028 {
9029 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9030
9031 const int CHANCE_DAMAGE_CARGO = 4;
9032 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9033 const int CHANCE_DAMAGE_NOTHING = 2;
9034
9036 {
9037 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9038 int chances;
9039 int rnd;
9040
9041 if (GetInventory().GetCargo())
9042 {
9043 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9044 rnd = Math.RandomInt(0,chances);
9045
9046 if (rnd < CHANCE_DAMAGE_CARGO)
9047 {
9049 }
9050 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9051 {
9053 }
9054 }
9055 else
9056 {
9057 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9058 rnd = Math.RandomInt(0,chances);
9059
9060 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9061 {
9063 }
9064 }
9065 }
9066 }
9067
9069 {
9070 if (GetInventory().GetCargo())
9071 {
9072 int item_count = GetInventory().GetCargo().GetItemCount();
9073 if (item_count > 0)
9074 {
9075 int random_pick = Math.RandomInt(0, item_count);
9077 if (!item.IsExplosive())
9078 {
9079 item.AddHealth("","",damage);
9080 return true;
9081 }
9082 }
9083 }
9084 return false;
9085 }
9086
9088 {
9089 int attachment_count = GetInventory().AttachmentCount();
9090 if (attachment_count > 0)
9091 {
9092 int random_pick = Math.RandomInt(0, attachment_count);
9093 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
9094 if (!attachment.IsExplosive())
9095 {
9096 attachment.AddHealth("","",damage);
9097 return true;
9098 }
9099 }
9100 return false;
9101 }
9102
9104 {
9106 }
9107
9109 {
9111 return GetInventory().CanRemoveEntity();
9112
9113 return false;
9114 }
9115
9117 {
9118
9120 return false;
9121
9122
9124 return false;
9125
9126
9127
9129 if (delta == 0)
9130 return false;
9131
9132
9133 return true;
9134 }
9135
9137 {
9139 {
9140 if (ScriptInputUserData.CanStoreInputUserData())
9141 {
9142 ScriptInputUserData ctx = new ScriptInputUserData;
9147 ctx.
Write(destination_entity);
9151 }
9152 }
9153 else if (!
GetGame().IsMultiplayer())
9154 {
9156 }
9157 }
9158
9160 {
9161 float split_quantity_new;
9165 InventoryLocation loc = new InventoryLocation;
9166
9167 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9168 {
9170 split_quantity_new = stack_max;
9171 else
9173
9175 {
9176 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9177 if (new_item)
9178 {
9179 new_item.SetResultOfSplit(true);
9180 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9182 new_item.
SetQuantity(split_quantity_new,
false,
true);
9183 }
9184 }
9185 }
9186 else if (destination_entity && slot_id == -1)
9187 {
9188 if (quantity > stack_max)
9189 split_quantity_new = stack_max;
9190 else
9191 split_quantity_new = quantity;
9192
9194 {
9196 {
9199 }
9200
9201 if (new_item)
9202 {
9203 new_item.SetResultOfSplit(true);
9204 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9206 new_item.
SetQuantity(split_quantity_new,
false,
true);
9207 }
9208 }
9209 }
9210 else
9211 {
9212 if (stack_max != 0)
9213 {
9215 {
9217 }
9218
9219 if (split_quantity_new == 0)
9220 {
9221 if (!
GetGame().IsMultiplayer())
9222 player.PhysicalPredictiveDropItem(this);
9223 else
9224 player.ServerDropEntity(this);
9225 return;
9226 }
9227
9229 {
9231
9232 if (new_item)
9233 {
9234 new_item.SetResultOfSplit(true);
9235 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9238 new_item.PlaceOnSurface();
9239 }
9240 }
9241 }
9242 }
9243 }
9244
9246 {
9247 float split_quantity_new;
9251 InventoryLocation loc = new InventoryLocation;
9252
9253 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9254 {
9256 split_quantity_new = stack_max;
9257 else
9259
9261 {
9262 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9263 if (new_item)
9264 {
9265 new_item.SetResultOfSplit(true);
9266 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9268 new_item.
SetQuantity(split_quantity_new,
false,
true);
9269 }
9270 }
9271 }
9272 else if (destination_entity && slot_id == -1)
9273 {
9274 if (quantity > stack_max)
9275 split_quantity_new = stack_max;
9276 else
9277 split_quantity_new = quantity;
9278
9280 {
9282 {
9285 }
9286
9287 if (new_item)
9288 {
9289 new_item.SetResultOfSplit(true);
9290 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9292 new_item.
SetQuantity(split_quantity_new,
false,
true);
9293 }
9294 }
9295 }
9296 else
9297 {
9298 if (stack_max != 0)
9299 {
9301 {
9303 }
9304
9306 {
9308
9309 if (new_item)
9310 {
9311 new_item.SetResultOfSplit(true);
9312 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9315 new_item.PlaceOnSurface();
9316 }
9317 }
9318 }
9319 }
9320 }
9321
9323 {
9325 {
9326 if (ScriptInputUserData.CanStoreInputUserData())
9327 {
9328 ScriptInputUserData ctx = new ScriptInputUserData;
9333 dst.WriteToContext(ctx);
9335 }
9336 }
9337 else if (!
GetGame().IsMultiplayer())
9338 {
9340 }
9341 }
9342
9344 {
9346 {
9347 if (ScriptInputUserData.CanStoreInputUserData())
9348 {
9349 ScriptInputUserData ctx = new ScriptInputUserData;
9354 ctx.
Write(destination_entity);
9360 }
9361 }
9362 else if (!
GetGame().IsMultiplayer())
9363 {
9365 }
9366 }
9367
9369 {
9371 }
9372
9374 {
9376 float split_quantity_new;
9378 if (dst.IsValid())
9379 {
9380 int slot_id = dst.GetSlot();
9382
9383 if (quantity > stack_max)
9384 split_quantity_new = stack_max;
9385 else
9386 split_quantity_new = quantity;
9387
9389 {
9391
9392 if (new_item)
9393 {
9394 new_item.SetResultOfSplit(true);
9395 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9397 new_item.
SetQuantity(split_quantity_new,
false,
true);
9398 }
9399
9400 return new_item;
9401 }
9402 }
9403
9404 return null;
9405 }
9406
9408 {
9410 float split_quantity_new;
9412 if (destination_entity)
9413 {
9415 if (quantity > stackable)
9416 split_quantity_new = stackable;
9417 else
9418 split_quantity_new = quantity;
9419
9421 {
9422 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9423 if (new_item)
9424 {
9425 new_item.SetResultOfSplit(true);
9426 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9428 new_item.
SetQuantity(split_quantity_new,
false,
true);
9429 }
9430 }
9431 }
9432 }
9433
9435 {
9437 {
9438 if (ScriptInputUserData.CanStoreInputUserData())
9439 {
9440 ScriptInputUserData ctx = new ScriptInputUserData;
9445 ItemBase destination_entity =
this;
9446 ctx.
Write(destination_entity);
9450 }
9451 }
9452 else if (!
GetGame().IsMultiplayer())
9453 {
9455 }
9456 }
9457
9459 {
9461 float split_quantity_new;
9463 if (player)
9464 {
9466 if (quantity > stackable)
9467 split_quantity_new = stackable;
9468 else
9469 split_quantity_new = quantity;
9470
9472 {
9473 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9474 new_item =
ItemBase.Cast(in_hands);
9475 if (new_item)
9476 {
9477 new_item.SetResultOfSplit(true);
9478 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9480 new_item.SetQuantity(split_quantity_new, false, true);
9481 }
9482 }
9483 }
9484 }
9485
9487 {
9489 float split_quantity_new = Math.Floor(quantity * 0.5);
9490
9492 return;
9493
9495
9496 if (new_item)
9497 {
9498 if (new_item.GetQuantityMax() < split_quantity_new)
9499 {
9500 split_quantity_new = new_item.GetQuantityMax();
9501 }
9502
9503 new_item.SetResultOfSplit(true);
9504 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9505
9507 {
9510 }
9511 else
9512 {
9514 new_item.
SetQuantity(split_quantity_new,
false,
true);
9515 }
9516 }
9517 }
9518
9520 {
9522 float split_quantity_new = Math.Floor(quantity / 2);
9523
9525 return;
9526
9527 InventoryLocation invloc = new InventoryLocation;
9529
9531 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9532
9533 if (new_item)
9534 {
9535 if (new_item.GetQuantityMax() < split_quantity_new)
9536 {
9537 split_quantity_new = new_item.GetQuantityMax();
9538 }
9540 {
9543 }
9544 else if (split_quantity_new > 1)
9545 {
9547 new_item.
SetQuantity(split_quantity_new,
false,
true);
9548 }
9549 }
9550 }
9551
9554 {
9555 SetWeightDirty();
9557
9558 if (parent)
9559 parent.OnAttachmentQuantityChangedEx(this, delta);
9560
9562 {
9564 {
9566 }
9568 {
9569 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9571 }
9572 }
9573
9574 }
9575
9578 {
9579
9580 }
9581
9584 {
9586 }
9587
9589 {
9590 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9591
9593 {
9594 if (newLevel == GameConstants.STATE_RUINED)
9595 {
9597 EntityAI parent = GetHierarchyParent();
9598 if (parent && parent.IsFireplace())
9599 {
9600 CargoBase cargo = GetInventory().GetCargo();
9601 if (cargo)
9602 {
9604 {
9606 }
9607 }
9608 }
9609 }
9610
9612 {
9613
9615 return;
9616 }
9617
9618 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9619 {
9621 }
9622 }
9623 }
9624
9625
9627 {
9628 super.OnRightClick();
9629
9631 {
9633 {
9634 if (ScriptInputUserData.CanStoreInputUserData())
9635 {
9636 EntityAI root = GetHierarchyRoot();
9637 Man playerOwner = GetHierarchyRootPlayer();
9638 InventoryLocation dst = new InventoryLocation;
9639
9640
9641 if (!playerOwner && root && root == this)
9642 {
9644 }
9645 else
9646 {
9647
9648 GetInventory().GetCurrentInventoryLocation(dst);
9650 {
9653 {
9655 }
9656 else
9657 {
9659
9660
9661 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9662 {
9664 }
9665 else
9666 {
9667 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9668 }
9669 }
9670 }
9671 }
9672
9673 ScriptInputUserData ctx = new ScriptInputUserData;
9681 }
9682 }
9683 else if (!
GetGame().IsMultiplayer())
9684 {
9686 }
9687 }
9688 }
9689
9691 {
9692 if (root)
9693 {
9694 vector m4[4];
9695 root.GetTransform(m4);
9696 dst.SetGround(this, m4);
9697 }
9698 else
9699 {
9700 GetInventory().GetCurrentInventoryLocation(dst);
9701 }
9702 }
9703
9704 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9705 {
9706
9707 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9708 return false;
9709
9710 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9711 return false;
9712
9713
9715 return false;
9716
9717
9718 Magazine mag = Magazine.Cast(this);
9719 if (mag)
9720 {
9721 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9722 return false;
9723
9724 if (stack_max_limit)
9725 {
9726 Magazine other_mag = Magazine.Cast(other_item);
9727 if (other_item)
9728 {
9729 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9730 return false;
9731 }
9732
9733 }
9734 }
9735 else
9736 {
9737
9739 return false;
9740
9742 return false;
9743 }
9744
9745 PlayerBase player = null;
9746 if (CastTo(player, GetHierarchyRootPlayer()))
9747 {
9748 if (player.GetInventory().HasAttachment(this))
9749 return false;
9750
9751 if (player.IsItemsToDelete())
9752 return false;
9753 }
9754
9755 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9756 return false;
9757
9758 int slotID;
9760 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9761 return false;
9762
9763 return true;
9764 }
9765
9767 {
9769 }
9770
9772 {
9773 return m_IsResultOfSplit;
9774 }
9775
9777 {
9778 m_IsResultOfSplit = value;
9779 }
9780
9782 {
9784 }
9785
9787 {
9788 float other_item_quantity = other_item.GetQuantity();
9789 float this_free_space;
9790
9792
9794
9795 if (other_item_quantity > this_free_space)
9796 {
9797 return this_free_space;
9798 }
9799 else
9800 {
9801 return other_item_quantity;
9802 }
9803 }
9804
9806 {
9808 }
9809
9811 {
9813 return;
9814
9815 if (!IsMagazine() && other_item)
9816 {
9818 if (quantity_used != 0)
9819 {
9820 float hp1 = GetHealth01("","");
9821 float hp2 = other_item.GetHealth01("","");
9822 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9823 hpResult = hpResult / (
GetQuantity() + quantity_used);
9824
9825 hpResult *= GetMaxHealth();
9826 Math.Round(hpResult);
9827 SetHealth("", "Health", hpResult);
9828
9830 other_item.AddQuantity(-quantity_used);
9831 }
9832 }
9834 }
9835
9837 {
9838 #ifdef SERVER
9839 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9840 GetHierarchyParent().IncreaseLifetimeUp();
9841 #endif
9842 };
9843
9845 {
9846 PlayerBase p = PlayerBase.Cast(player);
9847
9848 array<int> recipesIds = p.m_Recipes;
9849 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9850 if (moduleRecipesManager)
9851 {
9852 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
9853 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9854 }
9855
9856 for (int i = 0;i < recipesIds.Count(); i++)
9857 {
9858 int key = recipesIds.Get(i);
9859 string recipeName = moduleRecipesManager.GetRecipeName(key);
9861 }
9862 }
9863
9864
9865 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9866 {
9867 super.GetDebugActions(outputList);
9868
9869
9875
9876
9881
9886
9887
9891
9892
9894 {
9898 }
9899
9902
9903
9907
9909
9910 InventoryLocation loc = new InventoryLocation();
9911 GetInventory().GetCurrentInventoryLocation(loc);
9913 {
9914 if (Gizmo_IsSupported())
9917 }
9918
9920 }
9921
9922
9923
9924
9926 {
9927 super.OnAction(action_id, player, ctx);
9928
9930 {
9931 switch (action_id)
9932 {
9935 return true;
9938 return true;
9939 }
9940 }
9941
9943 {
9944 switch (action_id)
9945 {
9947 Delete();
9948 return true;
9949 }
9950 }
9951
9952 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9953 {
9954 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9955 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9956 PlayerBase p = PlayerBase.Cast(player);
9957 if (
EActions.RECIPES_RANGE_START < 1000)
9958 {
9959 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9960 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9961 }
9962 }
9963 #ifndef SERVER
9964 else if (action_id ==
EActions.WATCH_PLAYER)
9965 {
9966 PluginDeveloper.SetDeveloperItemClientEx(player);
9967 }
9968 #endif
9970 {
9971 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9972 {
9973 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9974 OnDebugButtonPressServer(id + 1);
9975 }
9976
9977 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9978 {
9979 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9981 }
9982
9983 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9984 {
9985 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9987 }
9988
9989 else if (action_id ==
EActions.ADD_QUANTITY)
9990 {
9991 if (IsMagazine())
9992 {
9993 Magazine mag = Magazine.Cast(this);
9994 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9995 }
9996 else
9997 {
9999 }
10000
10001 if (m_EM)
10002 {
10003 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10004 }
10005
10006 }
10007
10008 else if (action_id ==
EActions.REMOVE_QUANTITY)
10009 {
10010 if (IsMagazine())
10011 {
10012 Magazine mag2 = Magazine.Cast(this);
10013 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10014 }
10015 else
10016 {
10018 }
10019 if (m_EM)
10020 {
10021 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10022 }
10023
10024 }
10025
10026 else if (action_id ==
EActions.SET_QUANTITY_0)
10027 {
10029
10030 if (m_EM)
10031 {
10032 m_EM.SetEnergy(0);
10033 }
10034 }
10035
10036 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10037 {
10039
10040 if (m_EM)
10041 {
10042 m_EM.SetEnergy(m_EM.GetEnergyMax());
10043 }
10044 }
10045
10046 else if (action_id ==
EActions.ADD_HEALTH)
10047 {
10048 AddHealth("","",GetMaxHealth("","Health")/5);
10049 }
10050 else if (action_id ==
EActions.REMOVE_HEALTH)
10051 {
10052 AddHealth("","",-GetMaxHealth("","Health")/5);
10053 }
10054 else if (action_id ==
EActions.DESTROY_HEALTH)
10055 {
10056 SetHealth01("","",0);
10057 }
10058 else if (action_id ==
EActions.WATCH_ITEM)
10059 {
10061 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10062 #ifdef DEVELOPER
10063 SetDebugDeveloper_item(this);
10064 #endif
10065 }
10066
10067 else if (action_id ==
EActions.ADD_TEMPERATURE)
10068 {
10069 AddTemperature(20);
10070
10071 }
10072
10073 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10074 {
10075 AddTemperature(-20);
10076
10077 }
10078
10079 else if (action_id ==
EActions.FLIP_FROZEN)
10080 {
10081 SetFrozen(!GetIsFrozen());
10082
10083 }
10084
10085 else if (action_id ==
EActions.ADD_WETNESS)
10086 {
10088
10089 }
10090
10091 else if (action_id ==
EActions.REMOVE_WETNESS)
10092 {
10094
10095 }
10096
10097 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10098 {
10101
10102
10103 }
10104
10105 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10106 {
10109 }
10110
10111 else if (action_id ==
EActions.MAKE_SPECIAL)
10112 {
10113 auto debugParams = DebugSpawnParams.WithPlayer(player);
10114 OnDebugSpawnEx(debugParams);
10115 }
10116
10117 }
10118
10119
10120 return false;
10121 }
10122
10123
10124
10125
10129
10132
10133
10134
10136 {
10137 return false;
10138 }
10139
10140
10142 {
10143 return true;
10144 }
10145
10146
10148 {
10149 return true;
10150 }
10151
10152
10153
10155 {
10156 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10158 }
10159
10162 {
10163 return null;
10164 }
10165
10167 {
10168 return false;
10169 }
10170
10172 {
10173 return false;
10174 }
10175
10179
10180
10182 {
10183 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10184 return module_repairing.CanRepair(this, item_repair_kit);
10185 }
10186
10187
10188 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10189 {
10190 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10191 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10192 }
10193
10194
10196 {
10197
10198
10199
10200
10201
10202
10203
10204
10205 return 1;
10206 }
10207
10208
10209
10211 {
10213 }
10214
10215
10216
10218 {
10220 }
10221
10222
10231 {
10232 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10233
10234 if (player)
10235 {
10236 player.MessageStatus(text);
10237 }
10238 }
10239
10240
10249 {
10250 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10251
10252 if (player)
10253 {
10254 player.MessageAction(text);
10255 }
10256 }
10257
10258
10267 {
10268 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10269
10270 if (player)
10271 {
10272 player.MessageFriendly(text);
10273 }
10274 }
10275
10276
10285 {
10286 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10287
10288 if (player)
10289 {
10290 player.MessageImportant(text);
10291 }
10292 }
10293
10295 {
10296 return true;
10297 }
10298
10299
10300 override bool KindOf(
string tag)
10301 {
10302 bool found = false;
10303 string item_name = this.
GetType();
10306
10307 int array_size = item_tag_array.Count();
10308 for (int i = 0; i < array_size; i++)
10309 {
10310 if (item_tag_array.Get(i) == tag)
10311 {
10312 found = true;
10313 break;
10314 }
10315 }
10316 return found;
10317 }
10318
10319
10321 {
10322
10323 super.OnRPC(sender, rpc_type,ctx);
10324
10325
10326 switch (rpc_type)
10327 {
10328 #ifndef SERVER
10329 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10330 Param2<bool, string> p = new Param2<bool, string>(false, "");
10331
10333 return;
10334
10335 bool play = p.param1;
10336 string soundSet = p.param2;
10337
10338 if (play)
10339 {
10341 {
10343 {
10345 }
10346 }
10347 else
10348 {
10350 }
10351 }
10352 else
10353 {
10355 }
10356
10357 break;
10358 #endif
10359
10360 }
10361
10363 {
10365 }
10366 }
10367
10368
10369
10370
10372 {
10373 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10374 return plugin.GetID(
name);
10375 }
10376
10378 {
10379 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10380 return plugin.GetName(id);
10381 }
10382
10385 {
10386
10387
10388 int varFlags;
10389 if (!ctx.
Read(varFlags))
10390 return;
10391
10392 if (varFlags & ItemVariableFlags.FLOAT)
10393 {
10395 }
10396 }
10397
10399 {
10400
10401 super.SerializeNumericalVars(floats_out);
10402
10403
10404
10406 {
10408 }
10409
10411 {
10413 }
10414
10416 {
10418 }
10419
10421 {
10426 }
10427
10429 {
10431 }
10432 }
10433
10435 {
10436
10437 super.DeSerializeNumericalVars(floats);
10438
10439
10440 int index = 0;
10441 int mask = Math.Round(floats.Get(index));
10442
10443 index++;
10444
10446 {
10448 {
10450 }
10451 else
10452 {
10453 float quantity = floats.Get(index);
10454 SetQuantity(quantity,
true,
false,
false,
false);
10455 }
10456 index++;
10457 }
10458
10460 {
10461 float wet = floats.Get(index);
10463 index++;
10464 }
10465
10467 {
10468 int liquidtype = Math.Round(floats.Get(index));
10470 index++;
10471 }
10472
10474 {
10476 index++;
10478 index++;
10480 index++;
10482 index++;
10483 }
10484
10486 {
10487 int cleanness = Math.Round(floats.Get(index));
10489 index++;
10490 }
10491 }
10492
10494 {
10495 super.WriteVarsToCTX(ctx);
10496
10497
10499 {
10501 }
10502
10504 {
10506 }
10507
10509 {
10511 }
10512
10514 {
10515 int r,g,b,a;
10521 }
10522
10524 {
10526 }
10527 }
10528
10530 {
10531 if (!super.ReadVarsFromCTX(ctx,version))
10532 return false;
10533
10534 int intValue;
10535 float value;
10536
10537 if (version < 140)
10538 {
10539 if (!ctx.
Read(intValue))
10540 return false;
10541
10542 m_VariablesMask = intValue;
10543 }
10544
10546 {
10547 if (!ctx.
Read(value))
10548 return false;
10549
10551 {
10553 }
10554 else
10555 {
10557 }
10558 }
10559
10560 if (version < 140)
10561 {
10563 {
10564 if (!ctx.
Read(value))
10565 return false;
10566 SetTemperatureDirect(value);
10567 }
10568 }
10569
10571 {
10572 if (!ctx.
Read(value))
10573 return false;
10575 }
10576
10578 {
10579 if (!ctx.
Read(intValue))
10580 return false;
10582 }
10583
10585 {
10586 int r,g,b,a;
10588 return false;
10590 return false;
10592 return false;
10594 return false;
10595
10597 }
10598
10600 {
10601 if (!ctx.
Read(intValue))
10602 return false;
10604 }
10605
10606 if (version >= 138 && version < 140)
10607 {
10609 {
10610 if (!ctx.
Read(intValue))
10611 return false;
10612 SetFrozen(intValue);
10613 }
10614 }
10615
10616 return true;
10617 }
10618
10619
10621 {
10624 {
10626 }
10627
10628 if (!super.OnStoreLoad(ctx, version))
10629 {
10631 return false;
10632 }
10633
10634 if (version >= 114)
10635 {
10636 bool hasQuickBarIndexSaved;
10637
10638 if (!ctx.
Read(hasQuickBarIndexSaved))
10639 {
10641 return false;
10642 }
10643
10644 if (hasQuickBarIndexSaved)
10645 {
10646 int itmQBIndex;
10647
10648
10649 if (!ctx.
Read(itmQBIndex))
10650 {
10652 return false;
10653 }
10654
10655 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10656 if (itmQBIndex != -1 && parentPlayer)
10657 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10658 }
10659 }
10660 else
10661 {
10662
10663 PlayerBase player;
10664 int itemQBIndex;
10665 if (version ==
int.
MAX)
10666 {
10667 if (!ctx.
Read(itemQBIndex))
10668 {
10670 return false;
10671 }
10672 }
10673 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10674 {
10675
10676 if (!ctx.
Read(itemQBIndex))
10677 {
10679 return false;
10680 }
10681 if (itemQBIndex != -1 && player)
10682 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10683 }
10684 }
10685
10686 if (version < 140)
10687 {
10688
10689 if (!LoadVariables(ctx, version))
10690 {
10692 return false;
10693 }
10694 }
10695
10696
10698 {
10700 return false;
10701 }
10702 if (version >= 132)
10703 {
10705 if (raib)
10706 {
10708 {
10710 return false;
10711 }
10712 }
10713 }
10714
10716 return true;
10717 }
10718
10719
10720
10722 {
10723 super.OnStoreSave(ctx);
10724
10725 PlayerBase player;
10726 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10727 {
10729
10730 int itemQBIndex = -1;
10731 itemQBIndex = player.FindQuickBarEntityIndex(this);
10732 ctx.
Write(itemQBIndex);
10733 }
10734 else
10735 {
10737 }
10738
10740
10742 if (raib)
10743 {
10745 }
10746 }
10747
10748
10750 {
10751 super.AfterStoreLoad();
10752
10754 {
10756 }
10757
10759 {
10762 }
10763 }
10764
10766 {
10767 super.EEOnAfterLoad();
10768
10770 {
10772 }
10773
10776 }
10777
10779 {
10780 return false;
10781 }
10782
10783
10784
10786 {
10788 {
10789 #ifdef PLATFORM_CONSOLE
10790
10792 {
10794 if (menu)
10795 {
10797 }
10798 }
10799 #endif
10800 }
10801
10803 {
10806 }
10807
10809 {
10810 SetWeightDirty();
10812 }
10814 {
10817 }
10818
10820 {
10823 }
10825 {
10828 }
10829
10830 super.OnVariablesSynchronized();
10831 }
10832
10833
10834
10836 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10837 {
10838 if (!IsServerCheck(allow_client))
10839 return false;
10840
10842 return false;
10843
10846
10847 if (value <= (min + 0.001))
10848 value = min;
10849
10850 if (value == min)
10851 {
10852 if (destroy_config)
10853 {
10854 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10855 if (dstr)
10856 {
10858 this.Delete();
10859 return true;
10860 }
10861 }
10862 else if (destroy_forced)
10863 {
10865 this.Delete();
10866 return true;
10867 }
10868
10870 }
10871
10874
10876 {
10878
10879 if (delta)
10881 }
10882
10884
10885 return false;
10886 }
10887
10888
10890 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10891 {
10893 }
10894
10896 {
10899 }
10900
10902 {
10905 }
10906
10908 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10909 {
10910 float value_clamped = Math.Clamp(value, 0, 1);
10912 SetQuantity(result, destroy_config, destroy_forced);
10913 }
10914
10915
10918 {
10920 }
10921
10923 {
10925 }
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10937 {
10938 int slot = -1;
10939 if (GetInventory())
10940 {
10941 InventoryLocation il = new InventoryLocation;
10942 GetInventory().GetCurrentInventoryLocation(il);
10944 }
10945
10947 }
10948
10950 {
10951 float quantity_max = 0;
10952
10954 {
10955 if (attSlotID != -1)
10956 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10957
10958 if (quantity_max <= 0)
10960 }
10961
10962 if (quantity_max <= 0)
10964
10965 return quantity_max;
10966 }
10967
10969 {
10971 }
10972
10974 {
10976 }
10977
10978
10980 {
10982 }
10983
10985 {
10987 }
10988
10990 {
10992 }
10993
10994
10996 {
10997
10998 float weightEx = GetWeightEx();
10999 float special = GetInventoryAndCargoWeight();
11000 return weightEx - special;
11001 }
11002
11003
11005 {
11007 }
11008
11010 {
11012 {
11013 #ifdef DEVELOPER
11014 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11015 {
11016 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11018 }
11019 #endif
11020
11021 return GetQuantity() * GetConfigWeightModified();
11022 }
11023 else if (HasEnergyManager())
11024 {
11025 #ifdef DEVELOPER
11026 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11027 {
11028 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11029 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11030 }
11031 #endif
11032 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11033 }
11034 else
11035 {
11036 #ifdef DEVELOPER
11037 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11038 {
11039 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11040 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11041 }
11042 #endif
11043 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11044 }
11045 }
11046
11049 {
11050 int item_count = 0;
11052
11053 if (GetInventory().GetCargo() != NULL)
11054 {
11055 item_count = GetInventory().GetCargo().GetItemCount();
11056 }
11057
11058 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
11059 {
11060 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
11061 if (item)
11062 item_count += item.GetNumberOfItems();
11063 }
11064 return item_count;
11065 }
11066
11069 {
11070 float weight = 0;
11071 float wetness = 1;
11072 if (include_wetness)
11075 {
11076 weight = wetness * m_ConfigWeight;
11077 }
11079 {
11080 weight = 1;
11081 }
11082 return weight;
11083 }
11084
11085
11086
11088 {
11089 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
11090 {
11091 GameInventory inv = GetInventory();
11092 array<EntityAI> items = new array<EntityAI>;
11094 for (int i = 0; i < items.Count(); i++)
11095 {
11097 if (item)
11098 {
11100 }
11101 }
11102 }
11103 }
11104
11105
11106
11107
11109 {
11110 float energy = 0;
11111 if (HasEnergyManager())
11112 {
11113 energy = GetCompEM().GetEnergy();
11114 }
11115 return energy;
11116 }
11117
11118
11120 {
11121 super.OnEnergyConsumed();
11122
11124 }
11125
11127 {
11128 super.OnEnergyAdded();
11129
11131 }
11132
11133
11135 {
11136 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11137 {
11139 {
11140 float energy_0to1 = GetCompEM().GetEnergy0To1();
11142 }
11143 }
11144 }
11145
11146
11148 {
11149 return ConfigGetFloat("heatIsolation");
11150 }
11151
11153 {
11155 }
11156
11158 {
11159 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11160 if (
GetGame().ConfigIsExisting(paramPath))
11162
11163 return 0.0;
11164 }
11165
11167 {
11168 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11169 if (
GetGame().ConfigIsExisting(paramPath))
11171
11172 return 0.0;
11173 }
11174
11175 override void SetWet(
float value,
bool allow_client =
false)
11176 {
11177 if (!IsServerCheck(allow_client))
11178 return;
11179
11182
11184
11185 m_VarWet = Math.Clamp(value, min, max);
11186
11188 {
11191 }
11192 }
11193
11194 override void AddWet(
float value)
11195 {
11197 }
11198
11200 {
11202 }
11203
11205 {
11207 }
11208
11210 {
11212 }
11213
11215 {
11217 }
11218
11220 {
11222 }
11223
11224 override void OnWetChanged(
float newVal,
float oldVal)
11225 {
11228 if (newLevel != oldLevel)
11229 {
11231 }
11232 }
11233
11235 {
11236 SetWeightDirty();
11237 }
11238
11240 {
11241 return GetWetLevelInternal(
m_VarWet);
11242 }
11243
11244
11245
11247 {
11249 }
11250
11252 {
11254 }
11255
11257 {
11259 }
11260
11262 {
11264 }
11265
11266
11267
11269 {
11270 if (ConfigIsExisting("itemModelLength"))
11271 {
11272 return ConfigGetFloat("itemModelLength");
11273 }
11274 return 0;
11275 }
11276
11278 {
11279 if (ConfigIsExisting("itemAttachOffset"))
11280 {
11281 return ConfigGetFloat("itemAttachOffset");
11282 }
11283 return 0;
11284 }
11285
11286 override void SetCleanness(
int value,
bool allow_client =
false)
11287 {
11288 if (!IsServerCheck(allow_client))
11289 return;
11290
11292
11294
11297 }
11298
11300 {
11302 }
11303
11305 {
11306 return true;
11307 }
11308
11309
11310
11311
11313 {
11315 }
11316
11318 {
11320 }
11321
11322
11323
11324
11325 override void SetColor(
int r,
int g,
int b,
int a)
11326 {
11332 }
11334 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11335 {
11340 }
11341
11343 {
11345 }
11346
11349 {
11350 int r,g,b,a;
11352 r = r/255;
11353 g = g/255;
11354 b = b/255;
11355 a = a/255;
11356 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11357 }
11358
11359
11360
11361 override void SetLiquidType(
int value,
bool allow_client =
false)
11362 {
11363 if (!IsServerCheck(allow_client))
11364 return;
11365
11370 }
11371
11373 {
11374 return ConfigGetInt("varLiquidTypeInit");
11375 }
11376
11378 {
11380 }
11381
11383 {
11385 SetFrozen(false);
11386 }
11387
11390 {
11391 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11392 }
11393
11394
11397 {
11398 PlayerBase nplayer;
11399 if (PlayerBase.CastTo(nplayer, player))
11400 {
11402
11403 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11404 }
11405 }
11406
11407
11410 {
11411 PlayerBase nplayer;
11412 if (PlayerBase.CastTo(nplayer,player))
11413 {
11414
11415 nplayer.SetEnableQuickBarEntityShortcut(this,false);
11416
11417 }
11418
11419
11420 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11421
11422
11423 if (HasEnergyManager())
11424 {
11425 GetCompEM().UpdatePlugState();
11426 }
11427 }
11428
11429
11431 {
11432 super.OnPlacementStarted(player);
11433
11435 }
11436
11437 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11438 {
11440 {
11441 m_AdminLog.OnPlacementComplete(player,
this);
11442 }
11443
11444 super.OnPlacementComplete(player, position, orientation);
11445 }
11446
11447
11448
11449
11450
11452 {
11454 {
11455 return true;
11456 }
11457 else
11458 {
11459 return false;
11460 }
11461 }
11462
11463
11465 {
11467 {
11469 }
11470 }
11471
11472
11474 {
11476 }
11477
11479 {
11481 }
11482
11483 override void InsertAgent(
int agent,
float count = 1)
11484 {
11485 if (count < 1)
11486 return;
11487
11489 }
11490
11493 {
11495 }
11496
11497
11499 {
11501 }
11502
11503
11504
11505
11506
11507
11508
11509
11510
11511
11512
11513
11514
11515
11516
11517
11518
11519
11520
11521
11522
11523
11524
11525
11526
11527
11528
11529
11530
11531
11532
11533
11534
11535
11536
11537
11538
11539
11540
11541
11542
11543
11545 {
11547 return false;
11548 return true;
11549 }
11550
11552 {
11553
11555 }
11556
11557
11560 {
11561 super.CheckForRoofLimited(timeTresholdMS);
11562
11564 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11565 {
11566 m_PreviousRoofTestTime = time;
11567 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11568 }
11569 }
11570
11571
11573 {
11575 {
11576 return 0;
11577 }
11578
11579 if (GetInventory().GetAttachmentSlotsCount() != 0)
11580 {
11581 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11582 if (filter)
11583 return filter.GetProtectionLevel(type, false, system);
11584 else
11585 return 0;
11586 }
11587
11588 string subclassPath, entryName;
11589
11590 switch (type)
11591 {
11593 entryName = "biological";
11594 break;
11596 entryName = "chemical";
11597 break;
11598 default:
11599 entryName = "biological";
11600 break;
11601 }
11602
11603 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11604
11606 }
11607
11608
11609
11612 {
11613 if (!IsMagazine())
11615
11617 }
11618
11619
11620
11621
11622
11627 {
11628 return true;
11629 }
11630
11632 {
11634 }
11635
11636
11637
11638
11639
11641 {
11642 if (parent)
11643 {
11644 if (parent.IsInherited(DayZInfected))
11645 return true;
11646
11647 if (!parent.IsRuined())
11648 return true;
11649 }
11650
11651 return true;
11652 }
11653
11655 {
11656 if (!super.CanPutAsAttachment(parent))
11657 {
11658 return false;
11659 }
11660
11661 if (!IsRuined() && !parent.IsRuined())
11662 {
11663 return true;
11664 }
11665
11666 return false;
11667 }
11668
11670 {
11671
11672
11673
11674
11675 return super.CanReceiveItemIntoCargo(item);
11676 }
11677
11679 {
11680
11681
11682
11683
11684 GameInventory attachmentInv = attachment.GetInventory();
11686 {
11687 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11688 return false;
11689 }
11690
11691 InventoryLocation loc = new InventoryLocation();
11692 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11693 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11694 return false;
11695
11696 return super.CanReceiveAttachment(attachment, slotId);
11697 }
11698
11700 {
11701 if (!super.CanReleaseAttachment(attachment))
11702 return false;
11703
11704 return GetInventory().AreChildrenAccessible();
11705 }
11706
11707
11708
11709
11710
11711
11712
11713
11714
11715
11716
11717
11718
11719
11720
11721
11722
11723
11724
11725
11726
11728 {
11729 int id = muzzle_owner.GetMuzzleID();
11730 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11731
11732 if (WPOF_array)
11733 {
11734 for (int i = 0; i < WPOF_array.Count(); i++)
11735 {
11736 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11737
11738 if (WPOF)
11739 {
11740 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11741 }
11742 }
11743 }
11744 }
11745
11746
11748 {
11749 int id = muzzle_owner.GetMuzzleID();
11751
11752 if (WPOBE_array)
11753 {
11754 for (int i = 0; i < WPOBE_array.Count(); i++)
11755 {
11756 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11757
11758 if (WPOBE)
11759 {
11760 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11761 }
11762 }
11763 }
11764 }
11765
11766
11768 {
11769 int id = muzzle_owner.GetMuzzleID();
11770 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11771
11772 if (WPOOH_array)
11773 {
11774 for (int i = 0; i < WPOOH_array.Count(); i++)
11775 {
11776 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11777
11778 if (WPOOH)
11779 {
11780 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11781 }
11782 }
11783 }
11784 }
11785
11786
11788 {
11789 int id = muzzle_owner.GetMuzzleID();
11790 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11791
11792 if (WPOOH_array)
11793 {
11794 for (int i = 0; i < WPOOH_array.Count(); i++)
11795 {
11796 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11797
11798 if (WPOOH)
11799 {
11800 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11801 }
11802 }
11803 }
11804 }
11805
11806
11808 {
11809 int id = muzzle_owner.GetMuzzleID();
11810 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11811
11812 if (WPOOH_array)
11813 {
11814 for (int i = 0; i < WPOOH_array.Count(); i++)
11815 {
11816 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11817
11818 if (WPOOH)
11819 {
11820 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11821 }
11822 }
11823 }
11824 }
11825
11826
11827
11829 {
11831 {
11832 return true;
11833 }
11834
11835 return false;
11836 }
11837
11839 {
11841 {
11842 return true;
11843 }
11844
11845 return false;
11846 }
11847
11849 {
11851 {
11852 return true;
11853 }
11854
11855 return false;
11856 }
11857
11859 {
11860 return false;
11861 }
11862
11865 {
11866 return UATimeSpent.DEFAULT_DEPLOY;
11867 }
11868
11869
11870
11871
11873 {
11875 SetSynchDirty();
11876 }
11877
11879 {
11881 }
11882
11883
11885 {
11886 return false;
11887 }
11888
11891 {
11892 string att_type = "None";
11893
11894 if (ConfigIsExisting("soundAttType"))
11895 {
11896 att_type = ConfigGetString("soundAttType");
11897 }
11898
11900 }
11901
11903 {
11905 }
11906
11907
11908
11909
11910
11916
11918 {
11921
11923 }
11924
11925
11927 {
11929 return;
11930
11932
11935
11938
11939 SoundParameters params = new SoundParameters();
11943 }
11944
11945
11947 {
11949 return;
11950
11952 SetSynchDirty();
11953
11956 }
11957
11958
11960 {
11962 return;
11963
11965 SetSynchDirty();
11966
11969 }
11970
11972 {
11974 }
11975
11977 {
11979 }
11980
11983 {
11984 if (!
GetGame().IsDedicatedServer())
11985 {
11986 if (ConfigIsExisting("attachSoundSet"))
11987 {
11988 string cfg_path = "";
11989 string soundset = "";
11990 string type_name =
GetType();
11991
11994 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11995 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11996
11997 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11998 {
11999 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12000 {
12001 if (cfg_slot_array[i] == slot_type)
12002 {
12003 soundset = cfg_soundset_array[i];
12004 break;
12005 }
12006 }
12007 }
12008
12009 if (soundset != "")
12010 {
12011 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12013 }
12014 }
12015 }
12016 }
12017
12019 {
12020
12021 }
12022
12023 void OnApply(PlayerBase player);
12024
12026 {
12027 return 1.0;
12028 };
12029
12031 {
12033 }
12034
12036 {
12038 }
12039
12041
12043 {
12044 SetDynamicPhysicsLifeTime(0.01);
12046 }
12047
12049 {
12050 array<string> zone_names = new array<string>;
12051 GetDamageZones(zone_names);
12052 for (int i = 0; i < zone_names.Count(); i++)
12053 {
12054 SetHealthMax(zone_names.Get(i),"Health");
12055 }
12056 SetHealthMax("","Health");
12057 }
12058
12061 {
12062 float global_health = GetHealth01("","Health");
12063 array<string> zones = new array<string>;
12064 GetDamageZones(zones);
12065
12066 for (int i = 0; i < zones.Count(); i++)
12067 {
12068 SetHealth01(zones.Get(i),"Health",global_health);
12069 }
12070 }
12071
12074 {
12075 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12076 }
12077
12079 {
12080 if (!hasRootAsPlayer)
12081 {
12082 if (refParentIB)
12083 {
12084
12085 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12086 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12087
12088 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12089 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12090
12093 }
12094 else
12095 {
12096
12099 }
12100 }
12101 }
12102
12104 {
12106 {
12107 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12108 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12109 {
12110 float heatPermCoef = 1.0;
12112 while (ent)
12113 {
12114 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12115 ent = ent.GetHierarchyParent();
12116 }
12117
12118 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12119 }
12120 }
12121 }
12122
12124 {
12125
12126 EntityAI parent = GetHierarchyParent();
12127 if (!parent)
12128 {
12129 hasParent = false;
12130 hasRootAsPlayer = false;
12131 }
12132 else
12133 {
12134 hasParent = true;
12135 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12136 refParentIB =
ItemBase.Cast(parent);
12137 }
12138 }
12139
12140 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12141 {
12142
12143 }
12144
12146 {
12147
12148 return false;
12149 }
12150
12152 {
12153
12154
12155 return false;
12156 }
12157
12159 {
12160
12161 return false;
12162 }
12163
12166 {
12167 return !GetIsFrozen() &&
IsOpen();
12168 }
12169
12171 {
12172 bool hasParent = false, hasRootAsPlayer = false;
12174
12175 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12176 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12177
12178 if (wwtu || foodDecay)
12179 {
12183
12184 if (processWetness || processTemperature || processDecay)
12185 {
12187
12188 if (processWetness)
12189 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12190
12191 if (processTemperature)
12193
12194 if (processDecay)
12195 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12196 }
12197 }
12198 }
12199
12202 {
12204 }
12205
12207 {
12210
12211 return super.GetTemperatureFreezeThreshold();
12212 }
12213
12215 {
12218
12219 return super.GetTemperatureThawThreshold();
12220 }
12221
12223 {
12226
12227 return super.GetItemOverheatThreshold();
12228 }
12229
12231 {
12233 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12234
12235 return super.GetTemperatureFreezeTime();
12236 }
12237
12239 {
12241 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12242
12243 return super.GetTemperatureThawTime();
12244 }
12245
12250
12252 {
12253 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12254 }
12255
12257 {
12258 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12259 }
12260
12263 {
12265 }
12266
12268 {
12270 }
12271
12273 {
12275 }
12276
12279 {
12280 return null;
12281 }
12282
12285 {
12286 return false;
12287 }
12288
12290 {
12292 {
12295 if (!trg)
12296 {
12298 explosive = this;
12299 }
12300
12301 explosive.PairRemote(trg);
12303
12304 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12305 trg.SetPersistentPairID(persistentID);
12306 explosive.SetPersistentPairID(persistentID);
12307
12308 return true;
12309 }
12310 return false;
12311 }
12312
12315 {
12316 float ret = 1.0;
12319 ret *= GetHealth01();
12320
12321 return ret;
12322 }
12323
12324 #ifdef DEVELOPER
12325 override void SetDebugItem()
12326 {
12327 super.SetDebugItem();
12328 _itemBase = this;
12329 }
12330
12332 {
12333 string text = super.GetDebugText();
12334
12336 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12337
12338 return text;
12339 }
12340 #endif
12341
12343 {
12344 return true;
12345 }
12346
12348
12350
12352 {
12355 }
12356
12357
12365
12381}
12382
12384{
12386 if (entity)
12387 {
12388 bool is_item = entity.IsInherited(
ItemBase);
12389 if (is_item && full_quantity)
12390 {
12393 }
12394 }
12395 else
12396 {
12398 return NULL;
12399 }
12400 return entity;
12401}
12402
12404{
12405 if (item)
12406 {
12407 if (health > 0)
12408 item.SetHealth("", "", health);
12409
12410 if (item.CanHaveTemperature())
12411 {
12413 if (item.CanFreeze())
12414 item.SetFrozen(false);
12415 }
12416
12417 if (item.HasEnergyManager())
12418 {
12419 if (quantity >= 0)
12420 {
12421 item.GetCompEM().SetEnergy0To1(quantity);
12422 }
12423 else
12424 {
12426 }
12427 }
12428 else if (item.IsMagazine())
12429 {
12430 Magazine mag = Magazine.Cast(item);
12431 if (quantity >= 0)
12432 {
12433 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12434 }
12435 else
12436 {
12438 }
12439
12440 }
12441 else
12442 {
12443 if (quantity >= 0)
12444 {
12445 item.SetQuantityNormalized(quantity, false);
12446 }
12447 else
12448 {
12450 }
12451
12452 }
12453 }
12454}
12455
12456#ifdef DEVELOPER
12458#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
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 CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
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
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)
void StartItemSoundServer(int id)
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()
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)
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
proto native void GizmoSelectObject(Object object)
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto native void GizmoSelectPhysics(Physics physics)
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
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 bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
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 void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, 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)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
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
proto native CGame GetGame()
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
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
class JsonUndergroundAreaTriggerData GetPosition
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.