7566{
7568 {
7569 return true;
7570 }
7571};
7572
7574{
7575
7576};
7577
7578
7579
7581{
7585
7587
7590
7591
7592
7593
7594
7603
7609
7614
7619
7640 protected bool m_IsResultOfSplit
7641
7643
7648
7649
7650
7652
7656
7657
7658
7660
7663
7664
7665
7671
7672
7680
7683
7684
7686
7687
7689
7690
7695
7696
7701
7703
7704
7706
7707
7709 {
7714
7715 if (!
g_Game.IsDedicatedServer())
7716 {
7718 {
7720
7722 {
7724 }
7725 }
7726
7729 }
7730
7731 m_OldLocation = null;
7732
7734 {
7736 }
7737
7738 if (ConfigIsExisting("headSelectionsToHide"))
7739 {
7742 }
7743
7745 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7746 {
7748 }
7749
7751
7752 m_IsResultOfSplit = false;
7753
7755 }
7756
7758 {
7759 super.InitItemVariables();
7760
7766 m_Count = ConfigGetInt(
"count");
7767
7770
7775
7778
7783
7795
7799
7800
7803 if (ConfigIsExisting("canBeSplit"))
7804 {
7807 }
7808
7810 if (ConfigIsExisting("itemBehaviour"))
7812
7813
7816 RegisterNetSyncVariableInt("m_VarLiquidType");
7817 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7818
7819 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7820 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7821 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7822
7823 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7824 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7825 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7826 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7827
7828 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7829 RegisterNetSyncVariableBool("m_IsTakeable");
7830 RegisterNetSyncVariableBool("m_IsHologram");
7831
7834 {
7837 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7838 }
7839
7841
7843 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7845
7847 }
7848
7850 {
7852 }
7853
7855 {
7858 {
7863 }
7864 }
7865
7866 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7867 {
7869 {
7872 }
7873
7875 }
7876
7878 {
7884 }
7885
7887
7889 {
7891
7892 if (!action)
7893 {
7894 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7895 return;
7896 }
7897
7899 if (!ai)
7900 {
7902 return;
7903 }
7904
7906 if (!action_array)
7907 {
7908 action_array = new array<ActionBase_Basic>;
7910 }
7911 if (LogManager.IsActionLogEnable())
7912 {
7913 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7914 }
7915
7916 if (action_array.Find(action) != -1)
7917 {
7918 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7919 }
7920 else
7921 {
7922 action_array.Insert(action);
7923 }
7924 }
7925
7927 {
7928 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7929 ActionBase action = player.GetActionManager().GetAction(actionName);
7932
7933 if (action_array)
7934 {
7935 action_array.RemoveItem(action);
7936 }
7937 }
7938
7939
7940
7942 {
7943 ActionOverrideData overrideData = new ActionOverrideData();
7947
7949 if (!actionMap)
7950 {
7953 }
7954
7955 actionMap.Insert(this.
Type(), overrideData);
7956
7957 }
7958
7960
7962
7963
7965 {
7968
7971
7972 string config_to_search = "CfgVehicles";
7973 string muzzle_owner_config;
7974
7976 {
7977 if (IsInherited(Weapon))
7978 config_to_search = "CfgWeapons";
7979
7980 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7981
7982 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7983
7984 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7985
7986 if (config_OnFire_subclass_count > 0)
7987 {
7988 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7989
7990 for (int i = 0; i < config_OnFire_subclass_count; i++)
7991 {
7992 string particle_class = "";
7993 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7994 string config_OnFire_entry = config_OnFire_class + particle_class;
7995 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7996 WPOF_array.Insert(WPOF);
7997 }
7998
7999
8001 }
8002 }
8003
8005 {
8006 config_to_search = "CfgWeapons";
8007 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8008
8009 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8010
8011 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8012
8013 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8014 {
8015 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8016
8017 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8018 {
8019 string particle_class2 = "";
8020 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8021 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8022 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8023 WPOBE_array.Insert(WPOBE);
8024 }
8025
8026
8028 }
8029 }
8030 }
8031
8032
8034 {
8037
8039 {
8040 string config_to_search = "CfgVehicles";
8041
8042 if (IsInherited(Weapon))
8043 config_to_search = "CfgWeapons";
8044
8045 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8046 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8047
8048 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8049 {
8050
8052
8054 {
8056 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8058 return;
8059 }
8060
8063
8064
8065
8066 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8067 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8068
8069 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8070 {
8071 string particle_class = "";
8072 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8073 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8074 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8075
8076 if (entry_type == CT_CLASS)
8077 {
8078 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8079 WPOOH_array.Insert(WPOF);
8080 }
8081 }
8082
8083
8085 }
8086 }
8087 }
8088
8090 {
8092 }
8093
8095 {
8097 {
8099
8102
8105
8106 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8107 }
8108 }
8109
8111 {
8113 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8114
8116 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8117
8119 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8120
8122 {
8124 }
8125 }
8126
8128 {
8130 }
8131
8133 {
8136 else
8138
8140 {
8143 }
8144 else
8145 {
8148
8151 }
8152
8154 }
8155
8157 {
8159 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8160 }
8161
8163 {
8165 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8167 }
8168
8170 {
8172 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8173 }
8174
8176 {
8179
8180 OverheatingParticle OP = new OverheatingParticle();
8185
8187 }
8188
8190 {
8193
8194 return -1;
8195 }
8196
8198 {
8200 {
8203
8204 for (int i = count; i > 0; --i)
8205 {
8206 int id = i - 1;
8209
8212
8213 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8214 {
8215 if (p)
8216 {
8219 }
8220 }
8221 }
8222 }
8223 }
8224
8226 {
8228 {
8230 {
8231 int id = i - 1;
8233
8234 if (OP)
8235 {
8237
8238 if (p)
8239 {
8241 }
8242
8243 delete OP;
8244 }
8245 }
8246
8249 }
8250 }
8251
8254 {
8255 return 0.0;
8256 }
8257
8258
8260 {
8261 return 250;
8262 }
8263
8265 {
8266 return 0;
8267 }
8268
8271 {
8273 return true;
8274
8275 return false;
8276 }
8277
8280 {
8283
8285 {
8287 }
8288 else
8289 {
8290
8292 }
8293
8295 }
8296
8303 {
8304 return -1;
8305 }
8306
8307
8308
8309
8311 {
8313 {
8314 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8315 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8316
8317 if (r_index >= 0)
8318 {
8319 InventoryLocation r_il = new InventoryLocation;
8320 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8321
8322 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8325 {
8326 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8327 }
8329 {
8330 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8331 }
8332
8333 }
8334
8335 player.GetHumanInventory().ClearUserReservedLocation(this);
8336 }
8337
8340 }
8341
8342
8343
8344
8346 {
8347 return ItemBase.m_DebugActionsMask;
8348 }
8349
8351 {
8352 return ItemBase.m_DebugActionsMask & mask;
8353 }
8354
8356 {
8357 ItemBase.m_DebugActionsMask = mask;
8358 }
8359
8361 {
8362 ItemBase.m_DebugActionsMask |= mask;
8363 }
8364
8366 {
8367 ItemBase.m_DebugActionsMask &= ~mask;
8368 }
8369
8371 {
8373 {
8375 }
8376 else
8377 {
8379 }
8380 }
8381
8382
8384 {
8385 if (GetEconomyProfile())
8386 {
8387 float q_max = GetEconomyProfile().GetQuantityMax();
8388 if (q_max > 0)
8389 {
8390 float q_min = GetEconomyProfile().GetQuantityMin();
8391 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8392
8394 {
8395 ComponentEnergyManager comp = GetCompEM();
8397 {
8399 }
8400 }
8402 {
8404
8405 }
8406
8407 }
8408 }
8409 }
8410
8413 {
8414 EntityAI parent = GetHierarchyParent();
8415
8416 if (parent)
8417 {
8418 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8419 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8420 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8421 }
8422 }
8423
8426 {
8427 EntityAI parent = GetHierarchyParent();
8428
8429 if (parent)
8430 {
8431 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8432 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8433 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8434 }
8435 }
8436
8438 {
8439
8440
8441
8442
8444
8446 {
8447 if (ScriptInputUserData.CanStoreInputUserData())
8448 {
8449 ScriptInputUserData ctx = new ScriptInputUserData;
8455 ctx.
Write(use_stack_max);
8458
8460 {
8461 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8462 }
8463 }
8464 }
8465 else if (!
g_Game.IsMultiplayer())
8466 {
8468 }
8469 }
8470
8472 {
8474 }
8475
8477 {
8479 }
8480
8482 {
8484 }
8485
8487 {
8488
8489 return false;
8490 }
8491
8493 {
8494 return false;
8495 }
8496
8500 {
8501 return false;
8502 }
8503
8505 {
8506 return "";
8507 }
8508
8510
8512 {
8513 return false;
8514 }
8515
8517 {
8518 return true;
8519 }
8520
8521
8522
8524 {
8525 return true;
8526 }
8527
8529 {
8530 return true;
8531 }
8532
8534 {
8535 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8537 }
8538
8540 {
8542 }
8543
8545 {
8547 if (!is_being_placed)
8549 SetSynchDirty();
8550 }
8551
8552
8554
8556 {
8558 }
8559
8561 {
8563 }
8564
8566 {
8567 return 1;
8568 }
8569
8571 {
8572 return false;
8573 }
8574
8576 {
8578 SetSynchDirty();
8579 }
8580
8581
8582
8583
8584
8585
8586
8587
8588
8589
8590
8591
8592
8593
8594
8595
8596
8597
8598
8599
8600
8601
8602
8603
8604
8605
8606
8607
8608
8609
8610
8611
8612
8613
8614
8616 {
8617 super.OnMovedInsideCargo(container);
8618
8619 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8620 }
8621
8622 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8623 {
8624 super.EEItemLocationChanged(oldLoc, newLoc);
8625
8626 PlayerBase newPlayer = null;
8627 PlayerBase oldPlayer = null;
8628
8629 if (newLoc.GetParent())
8630 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8631
8632 if (oldLoc.GetParent())
8633 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8634
8636 {
8637 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8638
8639 if (rIndex >= 0)
8640 {
8641 InventoryLocation rIl = new InventoryLocation;
8642 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8643
8644 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8647 {
8648 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8649 }
8651 {
8653 }
8654
8655 }
8656 }
8657
8659 {
8660 if (newPlayer)
8661 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8662
8663 if (newPlayer == oldPlayer)
8664 {
8665 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8666 {
8668 {
8669 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8670 {
8671 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8672 }
8673 }
8674 else
8675 {
8676 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8677 }
8678 }
8679
8680 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8681 {
8682 int type = oldLoc.GetType();
8684 {
8685 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8686 }
8688 {
8689 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8690 }
8691 }
8692 if (!m_OldLocation)
8693 {
8694 m_OldLocation = new InventoryLocation;
8695 }
8696 m_OldLocation.Copy(oldLoc);
8697 }
8698 else
8699 {
8700 if (m_OldLocation)
8701 {
8702 m_OldLocation.Reset();
8703 }
8704 }
8705
8706 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8707 }
8708 else
8709 {
8710 if (newPlayer)
8711 {
8712 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8713 if (resIndex >= 0)
8714 {
8715 InventoryLocation il = new InventoryLocation;
8716 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8718 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8721 {
8722 il.
GetParent().GetOnReleaseLock().Invoke(it);
8723 }
8725 {
8727 }
8728
8729 }
8730 }
8732 {
8733
8735 }
8736
8737 if (m_OldLocation)
8738 {
8739 m_OldLocation.Reset();
8740 }
8741 }
8742
8744 {
8745 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8746 }
8747
8749 {
8750 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8751 }
8752 }
8753
8754 override void EOnContact(IEntity other, Contact extra)
8755 {
8757 {
8758 int liquidType = -1;
8760 if (impactSpeed > 0.0)
8761 {
8763 #ifndef SERVER
8765 #else
8767 SetSynchDirty();
8768 #endif
8770 }
8771 }
8772
8773 #ifdef SERVER
8774 if (GetCompEM() && GetCompEM().IsPlugged())
8775 {
8776 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8777 GetCompEM().UnplugThis();
8778 }
8779 #endif
8780 }
8781
8783
8785 {
8787 }
8788
8790 {
8791
8792 }
8793
8795 {
8796 super.OnItemLocationChanged(old_owner, new_owner);
8797
8798 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8799 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8800
8801 if (!relatedPlayer && playerNew)
8802 relatedPlayer = playerNew;
8803
8804 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8805 {
8807 if (actionMgr)
8808 {
8809 ActionBase currentAction = actionMgr.GetRunningAction();
8810 if (currentAction)
8812 }
8813 }
8814
8815 Man ownerPlayerOld = null;
8816 Man ownerPlayerNew = null;
8817
8818 if (old_owner)
8819 {
8820 if (old_owner.
IsMan())
8821 {
8822 ownerPlayerOld = Man.Cast(old_owner);
8823 }
8824 else
8825 {
8826 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8827 }
8828 }
8829 else
8830 {
8832 {
8834
8835 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8836 {
8837 GetCompEM().UnplugThis();
8838 }
8839 }
8840 }
8841
8842 if (new_owner)
8843 {
8844 if (new_owner.
IsMan())
8845 {
8846 ownerPlayerNew = Man.Cast(new_owner);
8847 }
8848 else
8849 {
8850 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8851 }
8852 }
8853
8854 if (ownerPlayerOld != ownerPlayerNew)
8855 {
8856 if (ownerPlayerOld)
8857 {
8858 array<EntityAI> subItemsExit = new array<EntityAI>;
8860 for (int i = 0; i < subItemsExit.Count(); i++)
8861 {
8864 }
8865 }
8866
8867 if (ownerPlayerNew)
8868 {
8869 array<EntityAI> subItemsEnter = new array<EntityAI>;
8871 for (int j = 0; j < subItemsEnter.Count(); j++)
8872 {
8875 }
8876 }
8877 }
8878 else if (ownerPlayerNew != null)
8879 {
8880 PlayerBase nplayer;
8881 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8882 {
8883 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8885 for (int k = 0; k < subItemsUpdate.Count(); k++)
8886 {
8888 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8889 }
8890 }
8891 }
8892
8893 if (old_owner)
8894 old_owner.OnChildItemRemoved(this);
8895 if (new_owner)
8896 new_owner.OnChildItemReceived(this);
8897 }
8898
8899
8901 {
8902 super.EEDelete(parent);
8903 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8904 if (player)
8905 {
8907
8908 if (player.IsAlive())
8909 {
8910 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8911 if (r_index >= 0)
8912 {
8913 InventoryLocation r_il = new InventoryLocation;
8914 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8915
8916 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8919 {
8920 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8921 }
8923 {
8924 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8925 }
8926
8927 }
8928
8929 player.RemoveQuickBarEntityShortcut(this);
8930 }
8931 }
8932 }
8933
8935 {
8936 super.EEKilled(killer);
8937
8940 {
8941 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8942 {
8943 if (IsMagazine())
8944 {
8945 if (Magazine.Cast(this).GetAmmoCount() > 0)
8946 {
8948 }
8949 }
8950 else
8951 {
8953 }
8954 }
8955 }
8956 }
8957
8959 {
8960 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8961
8962 super.OnWasAttached(parent, slot_id);
8963
8966
8969 }
8970
8972 {
8973 super.OnWasDetached(parent, slot_id);
8974
8977
8980 }
8981
8983 {
8984 int idx;
8987
8988 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8989 if (inventory_slots.Count() < 1)
8990 {
8991 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8992 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8993 }
8994 else
8995 {
8996 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8997 }
8998
8999 idx = inventory_slots.Find(slot);
9000 if (idx < 0)
9001 return "";
9002
9003 return attach_types.Get(idx);
9004 }
9005
9007 {
9008 int idx = -1;
9009 string slot;
9010
9013
9014 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9015 if (inventory_slots.Count() < 1)
9016 {
9017 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9018 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9019 }
9020 else
9021 {
9022 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9023 if (detach_types.Count() < 1)
9024 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9025 }
9026
9027 for (int i = 0; i < inventory_slots.Count(); i++)
9028 {
9029 slot = inventory_slots.Get(i);
9030 }
9031
9032 if (slot != "")
9033 {
9034 if (detach_types.Count() == 1)
9035 idx = 0;
9036 else
9037 idx = inventory_slots.Find(slot);
9038 }
9039 if (idx < 0)
9040 return "";
9041
9042 return detach_types.Get(idx);
9043 }
9044
9046 {
9047
9049
9050
9051 float min_time = 1;
9052 float max_time = 3;
9053 float delay = Math.RandomFloat(min_time, max_time);
9054
9055 explode_timer.Run(delay, this, "DoAmmoExplosion");
9056 }
9057
9059 {
9060 Magazine magazine = Magazine.Cast(this);
9061 int pop_sounds_count = 6;
9062 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9063
9064
9065 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9066 string sound_name = pop_sounds[ sound_idx ];
9067 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9068
9069
9070 magazine.ServerAddAmmoCount(-1);
9071
9072
9073 float min_temp_to_explode = 100;
9074
9075 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9076 {
9078 }
9079 }
9080
9081
9082 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9083 {
9084 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9085
9086 const int CHANCE_DAMAGE_CARGO = 4;
9087 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9088 const int CHANCE_DAMAGE_NOTHING = 2;
9089
9091 {
9092 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9093 int chances;
9094 int rnd;
9095
9096 if (GetInventory().GetCargo())
9097 {
9098 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9099 rnd = Math.RandomInt(0,chances);
9100
9101 if (rnd < CHANCE_DAMAGE_CARGO)
9102 {
9104 }
9105 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9106 {
9108 }
9109 }
9110 else
9111 {
9112 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9113 rnd = Math.RandomInt(0,chances);
9114
9115 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9116 {
9118 }
9119 }
9120 }
9121 }
9122
9124 {
9125 CargoBase cargo = GetInventory().GetCargo();
9126 if (cargo)
9127 {
9129 if (item_count > 0)
9130 {
9131 int random_pick = Math.RandomInt(0, item_count);
9133 if (!item.IsExplosive())
9134 {
9135 item.AddHealth("","",damage);
9136 return true;
9137 }
9138 }
9139 }
9140 return false;
9141 }
9142
9144 {
9145 GameInventory inventory = GetInventory();
9147 if (attachment_count > 0)
9148 {
9149 int random_pick = Math.RandomInt(0, attachment_count);
9151 if (!attachment.IsExplosive())
9152 {
9153 attachment.AddHealth("","",damage);
9154 return true;
9155 }
9156 }
9157 return false;
9158 }
9159
9161 {
9163 }
9164
9166 {
9168 return GetInventory().CanRemoveEntity();
9169
9170 return false;
9171 }
9172
9174 {
9175
9177 return false;
9178
9179
9181 return false;
9182
9183
9184
9186 if (delta == 0)
9187 return false;
9188
9189
9190 return true;
9191 }
9192
9194 {
9196 {
9197 if (ScriptInputUserData.CanStoreInputUserData())
9198 {
9199 ScriptInputUserData ctx = new ScriptInputUserData;
9204 ctx.
Write(destination_entity);
9208 }
9209 }
9210 else if (!
g_Game.IsMultiplayer())
9211 {
9213 }
9214 }
9215
9217 {
9218 float split_quantity_new;
9222 InventoryLocation loc = new InventoryLocation;
9223
9224 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9225 {
9227 split_quantity_new = stack_max;
9228 else
9230
9232 {
9233 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9234 if (new_item)
9235 {
9236 new_item.SetResultOfSplit(true);
9237 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9239 new_item.
SetQuantity(split_quantity_new,
false,
true);
9240 }
9241 }
9242 }
9243 else if (destination_entity && slot_id == -1)
9244 {
9245 if (quantity > stack_max)
9246 split_quantity_new = stack_max;
9247 else
9248 split_quantity_new = quantity;
9249
9251 {
9252 GameInventory destinationInventory = destination_entity.GetInventory();
9254 {
9257 }
9258
9259 if (new_item)
9260 {
9261 new_item.SetResultOfSplit(true);
9262 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9264 new_item.
SetQuantity(split_quantity_new,
false,
true);
9265 }
9266 }
9267 }
9268 else
9269 {
9270 if (stack_max != 0)
9271 {
9273 {
9275 }
9276
9277 if (split_quantity_new == 0)
9278 {
9279 if (!
g_Game.IsMultiplayer())
9280 player.PhysicalPredictiveDropItem(this);
9281 else
9282 player.ServerDropEntity(this);
9283 return;
9284 }
9285
9287 {
9289
9290 if (new_item)
9291 {
9292 new_item.SetResultOfSplit(true);
9293 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9296 new_item.PlaceOnSurface();
9297 }
9298 }
9299 }
9300 }
9301 }
9302
9304 {
9305 float split_quantity_new;
9309 InventoryLocation loc = new InventoryLocation;
9310
9311 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9312 {
9314 split_quantity_new = stack_max;
9315 else
9317
9319 {
9320 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9321 if (new_item)
9322 {
9323 new_item.SetResultOfSplit(true);
9324 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9326 new_item.
SetQuantity(split_quantity_new,
false,
true);
9327 }
9328 }
9329 }
9330 else if (destination_entity && slot_id == -1)
9331 {
9332 if (quantity > stack_max)
9333 split_quantity_new = stack_max;
9334 else
9335 split_quantity_new = quantity;
9336
9338 {
9339 GameInventory destinationInventory = destination_entity.GetInventory();
9341 {
9344 }
9345
9346 if (new_item)
9347 {
9348 new_item.SetResultOfSplit(true);
9349 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9351 new_item.
SetQuantity(split_quantity_new,
false,
true);
9352 }
9353 }
9354 }
9355 else
9356 {
9357 if (stack_max != 0)
9358 {
9360 {
9362 }
9363
9365 {
9367
9368 if (new_item)
9369 {
9370 new_item.SetResultOfSplit(true);
9371 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9374 new_item.PlaceOnSurface();
9375 }
9376 }
9377 }
9378 }
9379 }
9380
9382 {
9384 {
9385 if (ScriptInputUserData.CanStoreInputUserData())
9386 {
9387 ScriptInputUserData ctx = new ScriptInputUserData;
9392 dst.WriteToContext(ctx);
9394 }
9395 }
9396 else if (!
g_Game.IsMultiplayer())
9397 {
9399 }
9400 }
9401
9403 {
9405 {
9406 if (ScriptInputUserData.CanStoreInputUserData())
9407 {
9408 ScriptInputUserData ctx = new ScriptInputUserData;
9413 ctx.
Write(destination_entity);
9419 }
9420 }
9421 else if (!
g_Game.IsMultiplayer())
9422 {
9424 }
9425 }
9426
9428 {
9430 }
9431
9433 {
9435 float split_quantity_new;
9437 if (dst.IsValid())
9438 {
9439 int slot_id = dst.GetSlot();
9441
9442 if (quantity > stack_max)
9443 split_quantity_new = stack_max;
9444 else
9445 split_quantity_new = quantity;
9446
9448 {
9450
9451 if (new_item)
9452 {
9453 new_item.SetResultOfSplit(true);
9454 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9456 new_item.
SetQuantity(split_quantity_new,
false,
true);
9457 }
9458
9459 return new_item;
9460 }
9461 }
9462
9463 return null;
9464 }
9465
9467 {
9469 float split_quantity_new;
9471 if (destination_entity)
9472 {
9474 if (quantity > stackable)
9475 split_quantity_new = stackable;
9476 else
9477 split_quantity_new = quantity;
9478
9480 {
9481 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9482 if (new_item)
9483 {
9484 new_item.SetResultOfSplit(true);
9485 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9487 new_item.
SetQuantity(split_quantity_new,
false,
true);
9488 }
9489 }
9490 }
9491 }
9492
9494 {
9496 {
9497 if (ScriptInputUserData.CanStoreInputUserData())
9498 {
9499 ScriptInputUserData ctx = new ScriptInputUserData;
9504 ItemBase destination_entity =
this;
9505 ctx.
Write(destination_entity);
9509 }
9510 }
9511 else if (!
g_Game.IsMultiplayer())
9512 {
9514 }
9515 }
9516
9518 {
9520 float split_quantity_new;
9522 if (player)
9523 {
9525 if (quantity > stackable)
9526 split_quantity_new = stackable;
9527 else
9528 split_quantity_new = quantity;
9529
9531 {
9532 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9533 new_item =
ItemBase.Cast(in_hands);
9534 if (new_item)
9535 {
9536 new_item.SetResultOfSplit(true);
9537 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9539 new_item.SetQuantity(split_quantity_new, false, true);
9540 }
9541 }
9542 }
9543 }
9544
9546 {
9548 float split_quantity_new = Math.Floor(quantity * 0.5);
9549
9551 return;
9552
9554
9555 if (new_item)
9556 {
9557 if (new_item.GetQuantityMax() < split_quantity_new)
9558 {
9559 split_quantity_new = new_item.GetQuantityMax();
9560 }
9561
9562 new_item.SetResultOfSplit(true);
9563 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9564
9566 {
9569 }
9570 else
9571 {
9573 new_item.
SetQuantity(split_quantity_new,
false,
true);
9574 }
9575 }
9576 }
9577
9579 {
9581 float split_quantity_new = Math.Floor(quantity / 2);
9582
9584 return;
9585
9586 InventoryLocation invloc = new InventoryLocation;
9588
9590 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9591
9592 if (new_item)
9593 {
9594 if (new_item.GetQuantityMax() < split_quantity_new)
9595 {
9596 split_quantity_new = new_item.GetQuantityMax();
9597 }
9599 {
9602 }
9603 else if (split_quantity_new > 1)
9604 {
9606 new_item.
SetQuantity(split_quantity_new,
false,
true);
9607 }
9608 }
9609 }
9610
9613 {
9614 SetWeightDirty();
9616
9617 if (parent)
9618 parent.OnAttachmentQuantityChangedEx(this, delta);
9619
9621 {
9623 {
9625 }
9627 {
9628 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9630 }
9631 }
9632 }
9633
9636 {
9637
9638 }
9639
9642 {
9644 }
9645
9647 {
9648 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9649
9651 {
9652 if (newLevel == GameConstants.STATE_RUINED)
9653 {
9655 EntityAI parent = GetHierarchyParent();
9656 if (parent && parent.IsFireplace())
9657 {
9658 CargoBase cargo = GetInventory().GetCargo();
9659 if (cargo)
9660 {
9662 {
9664 }
9665 }
9666 }
9667 }
9668
9670 {
9671
9673 return;
9674 }
9675
9676 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9677 {
9679 }
9680 }
9681 }
9682
9683
9685 {
9686 super.OnRightClick();
9687
9689 {
9691 {
9692 if (ScriptInputUserData.CanStoreInputUserData())
9693 {
9694 EntityAI root = GetHierarchyRoot();
9695 Man playerOwner = GetHierarchyRootPlayer();
9696 InventoryLocation dst = new InventoryLocation;
9697
9698
9699 if (!playerOwner && root && root == this)
9700 {
9702 }
9703 else
9704 {
9705
9706 GetInventory().GetCurrentInventoryLocation(dst);
9708 {
9709 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9711 {
9713 }
9714 else
9715 {
9717
9718
9719 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9720 {
9722 }
9723 else
9724 {
9725 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9726 }
9727 }
9728 }
9729 }
9730
9731 ScriptInputUserData ctx = new ScriptInputUserData;
9739 }
9740 }
9741 else if (!
g_Game.IsMultiplayer())
9742 {
9744 }
9745 }
9746 }
9747
9749 {
9750 if (root)
9751 {
9752 vector m4[4];
9753 root.GetTransform(m4);
9754 dst.SetGround(this, m4);
9755 }
9756 else
9757 {
9758 GetInventory().GetCurrentInventoryLocation(dst);
9759 }
9760 }
9761
9762 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9763 {
9764
9765 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9766 return false;
9767
9768 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9769 return false;
9770
9771
9773 return false;
9774
9775
9776 Magazine mag = Magazine.Cast(this);
9777 if (mag)
9778 {
9779 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9780 return false;
9781
9782 if (stack_max_limit)
9783 {
9784 Magazine other_mag = Magazine.Cast(other_item);
9785 if (other_item)
9786 {
9787 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9788 return false;
9789 }
9790
9791 }
9792 }
9793 else
9794 {
9795
9797 return false;
9798
9800 return false;
9801 }
9802
9803 PlayerBase player = null;
9804 if (CastTo(player, GetHierarchyRootPlayer()))
9805 {
9806 if (player.GetInventory().HasAttachment(this))
9807 return false;
9808
9809 if (player.IsItemsToDelete())
9810 return false;
9811 }
9812
9813 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9814 return false;
9815
9816 int slotID;
9818 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9819 return false;
9820
9821 return true;
9822 }
9823
9825 {
9827 }
9828
9830 {
9831 return m_IsResultOfSplit;
9832 }
9833
9835 {
9836 m_IsResultOfSplit = value;
9837 }
9838
9840 {
9842 }
9843
9845 {
9846 float other_item_quantity = other_item.GetQuantity();
9847 float this_free_space;
9848
9850
9852
9853 if (other_item_quantity > this_free_space)
9854 {
9855 return this_free_space;
9856 }
9857 else
9858 {
9859 return other_item_quantity;
9860 }
9861 }
9862
9864 {
9866 }
9867
9869 {
9871 return;
9872
9873 if (!IsMagazine() && other_item)
9874 {
9876 if (quantity_used != 0)
9877 {
9878 float hp1 = GetHealth01("","");
9879 float hp2 = other_item.GetHealth01("","");
9880 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9881 hpResult = hpResult / (
GetQuantity() + quantity_used);
9882
9883 hpResult *= GetMaxHealth();
9884 Math.Round(hpResult);
9885 SetHealth("", "Health", hpResult);
9886
9888 other_item.AddQuantity(-quantity_used);
9889 }
9890 }
9892 }
9893
9895 {
9896 #ifdef SERVER
9897 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9898 GetHierarchyParent().IncreaseLifetimeUp();
9899 #endif
9900 };
9901
9903 {
9904 PlayerBase p = PlayerBase.Cast(player);
9905
9906 array<int> recipesIds = p.m_Recipes;
9907 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9908 if (moduleRecipesManager)
9909 {
9910 EntityAI itemInHands = player.GetEntityInHands();
9911 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9912 }
9913
9914 for (int i = 0;i < recipesIds.Count(); i++)
9915 {
9916 int key = recipesIds.Get(i);
9917 string recipeName = moduleRecipesManager.GetRecipeName(key);
9919 }
9920 }
9921
9922
9923 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9924 {
9925 super.GetDebugActions(outputList);
9926
9927
9933
9934
9939
9944
9945
9949
9950
9952 {
9956 }
9957
9960
9961
9965
9967
9968 InventoryLocation loc = new InventoryLocation();
9969 GetInventory().GetCurrentInventoryLocation(loc);
9971 {
9972 if (Gizmo_IsSupported())
9975 }
9976
9978 }
9979
9980
9981
9982
9984 {
9985 super.OnAction(action_id, player, ctx);
9986
9988 {
9989 switch (action_id)
9990 {
9994 return true;
9998 return true;
9999 }
10000 }
10001
10003 {
10004 switch (action_id)
10005 {
10007 Delete();
10008 return true;
10009 }
10010 }
10011
10012 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10013 {
10014 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10015 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10016 PlayerBase p = PlayerBase.Cast(player);
10017 if (
EActions.RECIPES_RANGE_START < 1000)
10018 {
10019 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10020 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10021 }
10022 }
10023 #ifndef SERVER
10024 else if (action_id ==
EActions.WATCH_PLAYER)
10025 {
10026 PluginDeveloper.SetDeveloperItemClientEx(player);
10027 }
10028 #endif
10030 {
10031 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10032 {
10033 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10034 OnDebugButtonPressServer(id + 1);
10035 }
10036
10037 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10038 {
10039 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10041 }
10042
10043 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10044 {
10045 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10047 }
10048
10049 else if (action_id ==
EActions.ADD_QUANTITY)
10050 {
10051 if (IsMagazine())
10052 {
10053 Magazine mag = Magazine.Cast(this);
10054 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10055 }
10056 else
10057 {
10059 }
10060
10061 if (m_EM)
10062 {
10063 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10064 }
10065
10066 }
10067
10068 else if (action_id ==
EActions.REMOVE_QUANTITY)
10069 {
10070 if (IsMagazine())
10071 {
10072 Magazine mag2 = Magazine.Cast(this);
10073 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10074 }
10075 else
10076 {
10078 }
10079 if (m_EM)
10080 {
10081 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10082 }
10083
10084 }
10085
10086 else if (action_id ==
EActions.SET_QUANTITY_0)
10087 {
10089
10090 if (m_EM)
10091 {
10092 m_EM.SetEnergy(0);
10093 }
10094 }
10095
10096 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10097 {
10099
10100 if (m_EM)
10101 {
10102 m_EM.SetEnergy(m_EM.GetEnergyMax());
10103 }
10104 }
10105
10106 else if (action_id ==
EActions.ADD_HEALTH)
10107 {
10108 AddHealth("","",GetMaxHealth("","Health")/5);
10109 }
10110 else if (action_id ==
EActions.REMOVE_HEALTH)
10111 {
10112 AddHealth("","",-GetMaxHealth("","Health")/5);
10113 }
10114 else if (action_id ==
EActions.DESTROY_HEALTH)
10115 {
10116 SetHealth01("","",0);
10117 }
10118 else if (action_id ==
EActions.WATCH_ITEM)
10119 {
10121 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10122 #ifdef DEVELOPER
10123 SetDebugDeveloper_item(this);
10124 #endif
10125 }
10126
10127 else if (action_id ==
EActions.ADD_TEMPERATURE)
10128 {
10129 AddTemperature(20);
10130
10131 }
10132
10133 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10134 {
10135 AddTemperature(-20);
10136
10137 }
10138
10139 else if (action_id ==
EActions.FLIP_FROZEN)
10140 {
10141 SetFrozen(!GetIsFrozen());
10142
10143 }
10144
10145 else if (action_id ==
EActions.ADD_WETNESS)
10146 {
10148
10149 }
10150
10151 else if (action_id ==
EActions.REMOVE_WETNESS)
10152 {
10154
10155 }
10156
10157 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10158 {
10161
10162
10163 }
10164
10165 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10166 {
10169 }
10170
10171 else if (action_id ==
EActions.MAKE_SPECIAL)
10172 {
10173 auto debugParams = DebugSpawnParams.WithPlayer(player);
10174 OnDebugSpawnEx(debugParams);
10175 }
10176
10177 }
10178
10179
10180 return false;
10181 }
10182
10183
10184
10185
10189
10192
10193
10194
10196 {
10197 return false;
10198 }
10199
10200
10202 {
10203 return true;
10204 }
10205
10206
10208 {
10209 return true;
10210 }
10211
10212
10213
10215 {
10216 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10217 return g_Game.ConfigIsExisting(config_path);
10218 }
10219
10222 {
10223 return null;
10224 }
10225
10227 {
10228 return false;
10229 }
10230
10232 {
10233 return false;
10234 }
10235
10239
10240
10242 {
10243 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10244 return module_repairing.CanRepair(this, item_repair_kit);
10245 }
10246
10247
10248 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10249 {
10250 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10251 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10252 }
10253
10254
10256 {
10257
10258
10259
10260
10261
10262
10263
10264
10265 return 1;
10266 }
10267
10268
10269
10271 {
10273 }
10274
10275
10276
10278 {
10280 }
10281
10282
10291 {
10292 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10293
10294 if (player)
10295 {
10296 player.MessageStatus(text);
10297 }
10298 }
10299
10300
10309 {
10310 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10311
10312 if (player)
10313 {
10314 player.MessageAction(text);
10315 }
10316 }
10317
10318
10327 {
10328 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10329
10330 if (player)
10331 {
10332 player.MessageFriendly(text);
10333 }
10334 }
10335
10336
10345 {
10346 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10347
10348 if (player)
10349 {
10350 player.MessageImportant(text);
10351 }
10352 }
10353
10355 {
10356 return true;
10357 }
10358
10359
10360 override bool KindOf(
string tag)
10361 {
10362 bool found = false;
10363 string item_name = this.
GetType();
10365 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10366
10367 int array_size = item_tag_array.Count();
10368 for (int i = 0; i < array_size; i++)
10369 {
10370 if (item_tag_array.Get(i) == tag)
10371 {
10372 found = true;
10373 break;
10374 }
10375 }
10376 return found;
10377 }
10378
10379
10381 {
10382
10383 super.OnRPC(sender, rpc_type,ctx);
10384
10385
10386 switch (rpc_type)
10387 {
10388 #ifndef SERVER
10389 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10390 Param2<bool, string> p = new Param2<bool, string>(false, "");
10391
10393 return;
10394
10395 bool play = p.param1;
10396 string soundSet = p.param2;
10397
10398 if (play)
10399 {
10401 {
10403 {
10405 }
10406 }
10407 else
10408 {
10410 }
10411 }
10412 else
10413 {
10415 }
10416
10417 break;
10418 #endif
10419
10420 }
10421
10423 {
10425 }
10426 }
10427
10428
10429
10430
10432 {
10433 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10434 return plugin.GetID(
name);
10435 }
10436
10438 {
10439 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10440 return plugin.GetName(id);
10441 }
10442
10445 {
10446
10447
10448 int varFlags;
10449 if (!ctx.
Read(varFlags))
10450 return;
10451
10452 if (varFlags & ItemVariableFlags.FLOAT)
10453 {
10455 }
10456 }
10457
10459 {
10460
10461 super.SerializeNumericalVars(floats_out);
10462
10463
10464
10466 {
10468 }
10469
10471 {
10473 }
10474
10476 {
10478 }
10479
10481 {
10486 }
10487
10489 {
10491 }
10492 }
10493
10495 {
10496
10497 super.DeSerializeNumericalVars(floats);
10498
10499
10500 int index = 0;
10501 int mask = Math.Round(floats.Get(index));
10502
10503 index++;
10504
10506 {
10508 {
10510 }
10511 else
10512 {
10513 float quantity = floats.Get(index);
10514 SetQuantity(quantity,
true,
false,
false,
false);
10515 }
10516 index++;
10517 }
10518
10520 {
10521 float wet = floats.Get(index);
10523 index++;
10524 }
10525
10527 {
10528 int liquidtype = Math.Round(floats.Get(index));
10530 index++;
10531 }
10532
10534 {
10536 index++;
10538 index++;
10540 index++;
10542 index++;
10543 }
10544
10546 {
10547 int cleanness = Math.Round(floats.Get(index));
10549 index++;
10550 }
10551 }
10552
10554 {
10555 super.WriteVarsToCTX(ctx);
10556
10557
10559 {
10561 }
10562
10564 {
10566 }
10567
10569 {
10571 }
10572
10574 {
10575 int r,g,b,a;
10581 }
10582
10584 {
10586 }
10587 }
10588
10590 {
10591 if (!super.ReadVarsFromCTX(ctx,version))
10592 return false;
10593
10594 int intValue;
10595 float value;
10596
10597 if (version < 140)
10598 {
10599 if (!ctx.
Read(intValue))
10600 return false;
10601
10602 m_VariablesMask = intValue;
10603 }
10604
10606 {
10607 if (!ctx.
Read(value))
10608 return false;
10609
10611 {
10613 }
10614 else
10615 {
10617 }
10618 }
10619
10620 if (version < 140)
10621 {
10623 {
10624 if (!ctx.
Read(value))
10625 return false;
10626 SetTemperatureDirect(value);
10627 }
10628 }
10629
10631 {
10632 if (!ctx.
Read(value))
10633 return false;
10635 }
10636
10638 {
10639 if (!ctx.
Read(intValue))
10640 return false;
10642 }
10643
10645 {
10646 int r,g,b,a;
10648 return false;
10650 return false;
10652 return false;
10654 return false;
10655
10657 }
10658
10660 {
10661 if (!ctx.
Read(intValue))
10662 return false;
10664 }
10665
10666 if (version >= 138 && version < 140)
10667 {
10669 {
10670 if (!ctx.
Read(intValue))
10671 return false;
10672 SetFrozen(intValue);
10673 }
10674 }
10675
10676 return true;
10677 }
10678
10679
10681 {
10684 {
10686 }
10687
10688 if (!super.OnStoreLoad(ctx, version))
10689 {
10691 return false;
10692 }
10693
10694 if (version >= 114)
10695 {
10696 bool hasQuickBarIndexSaved;
10697
10698 if (!ctx.
Read(hasQuickBarIndexSaved))
10699 {
10701 return false;
10702 }
10703
10704 if (hasQuickBarIndexSaved)
10705 {
10706 int itmQBIndex;
10707
10708
10709 if (!ctx.
Read(itmQBIndex))
10710 {
10712 return false;
10713 }
10714
10715 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10716 if (itmQBIndex != -1 && parentPlayer)
10717 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10718 }
10719 }
10720 else
10721 {
10722
10723 PlayerBase player;
10724 int itemQBIndex;
10725 if (version ==
int.
MAX)
10726 {
10727 if (!ctx.
Read(itemQBIndex))
10728 {
10730 return false;
10731 }
10732 }
10733 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10734 {
10735
10736 if (!ctx.
Read(itemQBIndex))
10737 {
10739 return false;
10740 }
10741 if (itemQBIndex != -1 && player)
10742 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10743 }
10744 }
10745
10746 if (version < 140)
10747 {
10748
10749 if (!LoadVariables(ctx, version))
10750 {
10752 return false;
10753 }
10754 }
10755
10756
10758 {
10760 return false;
10761 }
10762 if (version >= 132)
10763 {
10765 if (raib)
10766 {
10768 {
10770 return false;
10771 }
10772 }
10773 }
10774
10776 return true;
10777 }
10778
10779
10780
10782 {
10783 super.OnStoreSave(ctx);
10784
10785 PlayerBase player;
10786 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10787 {
10789
10790 int itemQBIndex = -1;
10791 itemQBIndex = player.FindQuickBarEntityIndex(this);
10792 ctx.
Write(itemQBIndex);
10793 }
10794 else
10795 {
10797 }
10798
10800
10802 if (raib)
10803 {
10805 }
10806 }
10807
10808
10810 {
10811 super.AfterStoreLoad();
10812
10814 {
10816 }
10817
10819 {
10822 }
10823 }
10824
10826 {
10827 super.EEOnAfterLoad();
10828
10830 {
10832 }
10833
10836 }
10837
10839 {
10840 return false;
10841 }
10842
10843
10844
10846 {
10848 {
10849 #ifdef PLATFORM_CONSOLE
10850
10852 {
10854 if (menu)
10855 {
10857 }
10858 }
10859 #endif
10860 }
10861
10863 {
10866 }
10867
10869 {
10870 SetWeightDirty();
10872 }
10874 {
10877 }
10878
10880 {
10883
10886 }
10888 {
10892 }
10893
10894 super.OnVariablesSynchronized();
10895 }
10896
10897
10898
10900 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10901 {
10902 if (!IsServerCheck(allow_client))
10903 return false;
10904
10906 return false;
10907
10910
10911 if (value <= (min + 0.001))
10912 value = min;
10913
10914 if (value == min)
10915 {
10916 if (destroy_config)
10917 {
10918 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10919 if (dstr)
10920 {
10922 this.Delete();
10923 return true;
10924 }
10925 }
10926 else if (destroy_forced)
10927 {
10929 this.Delete();
10930 return true;
10931 }
10932
10934 }
10935
10938
10940 {
10941 EntityAI parent = GetHierarchyRoot();
10942 InventoryLocation iLoc = new InventoryLocation();
10943 GetInventory().GetCurrentInventoryLocation(iLoc);
10945 {
10946 int iLocSlot = iLoc.
GetSlot();
10948 {
10950 }
10952 {
10954 }
10955 }
10956 }
10957
10959 {
10961
10962 if (delta)
10964 }
10965
10967
10968 return false;
10969 }
10970
10971
10973 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10974 {
10976 }
10977
10979 {
10982 }
10983
10985 {
10988 }
10989
10991 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10992 {
10993 float value_clamped = Math.Clamp(value, 0, 1);
10995 SetQuantity(result, destroy_config, destroy_forced);
10996 }
10997
10998
11001 {
11003 }
11004
11006 {
11008 }
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11020 {
11021 int slot = -1;
11022 GameInventory inventory = GetInventory();
11023 if (inventory)
11024 {
11025 InventoryLocation il = new InventoryLocation;
11028 }
11029
11031 }
11032
11034 {
11035 float quantity_max = 0;
11036
11038 {
11039 if (attSlotID != -1)
11040 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11041
11042 if (quantity_max <= 0)
11044 }
11045
11046 if (quantity_max <= 0)
11048
11049 return quantity_max;
11050 }
11051
11053 {
11055 }
11056
11058 {
11060 }
11061
11062
11064 {
11066 }
11067
11069 {
11071 }
11072
11074 {
11076 }
11077
11078
11080 {
11081
11082 float weightEx = GetWeightEx();
11083 float special = GetInventoryAndCargoWeight();
11084 return weightEx - special;
11085 }
11086
11087
11089 {
11091 }
11092
11094 {
11096 {
11097 #ifdef DEVELOPER
11098 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11099 {
11100 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11102 }
11103 #endif
11104
11105 return GetQuantity() * GetConfigWeightModified();
11106 }
11107 else if (HasEnergyManager())
11108 {
11109 #ifdef DEVELOPER
11110 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11111 {
11112 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11113 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11114 }
11115 #endif
11116 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11117 }
11118 else
11119 {
11120 #ifdef DEVELOPER
11121 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11122 {
11123 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11124 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11125 }
11126 #endif
11127 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11128 }
11129 }
11130
11133 {
11134 int item_count = 0;
11136
11137 GameInventory inventory = GetInventory();
11138 CargoBase cargo = inventory.
GetCargo();
11139 if (cargo != NULL)
11140 {
11142 }
11143
11145 for (int i = 0; i < nAttachments; ++i)
11146 {
11148 if (item)
11149 item_count += item.GetNumberOfItems();
11150 }
11151 return item_count;
11152 }
11153
11156 {
11157 float weight = 0;
11158 float wetness = 1;
11159 if (include_wetness)
11162 {
11163 weight = wetness * m_ConfigWeight;
11164 }
11166 {
11167 weight = 1;
11168 }
11169 return weight;
11170 }
11171
11172
11173
11175 {
11176 GameInventory inventory = GetInventory();
11177 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11178 {
11179 array<EntityAI> items = new array<EntityAI>;
11181 for (int i = 0; i < items.Count(); ++i)
11182 {
11184 if (item)
11185 {
11186 g_Game.ObjectDelete(item);
11187 }
11188 }
11189 }
11190 }
11191
11192
11193
11194
11196 {
11197 float energy = 0;
11198 if (HasEnergyManager())
11199 {
11200 energy = GetCompEM().GetEnergy();
11201 }
11202 return energy;
11203 }
11204
11205
11207 {
11208 super.OnEnergyConsumed();
11209
11211 }
11212
11214 {
11215 super.OnEnergyAdded();
11216
11218 }
11219
11220
11222 {
11223 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11224 {
11226 {
11227 float energy_0to1 = GetCompEM().GetEnergy0To1();
11229 }
11230 }
11231 }
11232
11233
11235 {
11236 return ConfigGetFloat("heatIsolation");
11237 }
11238
11240 {
11242 }
11243
11245 {
11246 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11247 if (
g_Game.ConfigIsExisting(paramPath))
11248 return g_Game.ConfigGetFloat(paramPath);
11249
11250 return 0.0;
11251 }
11252
11254 {
11255 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11256 if (
g_Game.ConfigIsExisting(paramPath))
11257 return g_Game.ConfigGetFloat(paramPath);
11258
11259 return 0.0;
11260 }
11261
11262 override void SetWet(
float value,
bool allow_client =
false)
11263 {
11264 if (!IsServerCheck(allow_client))
11265 return;
11266
11269
11271
11272 m_VarWet = Math.Clamp(value, min, max);
11273
11275 {
11278 }
11279 }
11280
11281 override void AddWet(
float value)
11282 {
11284 }
11285
11287 {
11289 }
11290
11292 {
11294 }
11295
11297 {
11299 }
11300
11302 {
11304 }
11305
11307 {
11309 }
11310
11311 override void OnWetChanged(
float newVal,
float oldVal)
11312 {
11315 if (newLevel != oldLevel)
11316 {
11318 }
11319 }
11320
11322 {
11323 SetWeightDirty();
11324 }
11325
11327 {
11328 return GetWetLevelInternal(
m_VarWet);
11329 }
11330
11331
11332
11334 {
11336 }
11337
11339 {
11341 }
11342
11344 {
11346 }
11347
11349 {
11351 }
11352
11353
11354
11356 {
11357 if (ConfigIsExisting("itemModelLength"))
11358 {
11359 return ConfigGetFloat("itemModelLength");
11360 }
11361 return 0;
11362 }
11363
11365 {
11366 if (ConfigIsExisting("itemAttachOffset"))
11367 {
11368 return ConfigGetFloat("itemAttachOffset");
11369 }
11370 return 0;
11371 }
11372
11373 override void SetCleanness(
int value,
bool allow_client =
false)
11374 {
11375 if (!IsServerCheck(allow_client))
11376 return;
11377
11379
11381
11384 }
11385
11387 {
11389 }
11390
11392 {
11393 return true;
11394 }
11395
11396
11397
11398
11400 {
11402 }
11403
11405 {
11407 }
11408
11409
11410
11411
11412 override void SetColor(
int r,
int g,
int b,
int a)
11413 {
11419 }
11421 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11422 {
11427 }
11428
11430 {
11432 }
11433
11436 {
11437 int r,g,b,a;
11439 r = r/255;
11440 g = g/255;
11441 b = b/255;
11442 a = a/255;
11443 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11444 }
11445
11446
11447
11448 override void SetLiquidType(
int value,
bool allow_client =
false)
11449 {
11450 if (!IsServerCheck(allow_client))
11451 return;
11452
11457 }
11458
11460 {
11461 return ConfigGetInt("varLiquidTypeInit");
11462 }
11463
11465 {
11467 }
11468
11470 {
11472 SetFrozen(false);
11473 }
11474
11477 {
11478 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11479 }
11480
11481
11484 {
11485 PlayerBase nplayer;
11486 if (PlayerBase.CastTo(nplayer, player))
11487 {
11489 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11490 }
11491 }
11492
11493
11496 {
11497 PlayerBase nplayer;
11498 if (PlayerBase.CastTo(nplayer,player))
11499 {
11500 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11501 }
11502
11503 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11504
11505 if (HasEnergyManager())
11506 {
11507 GetCompEM().UpdatePlugState();
11508 }
11509 }
11510
11511
11513 {
11514 super.OnPlacementStarted(player);
11515
11517 }
11518
11519 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11520 {
11522 {
11523 m_AdminLog.OnPlacementComplete(player,
this);
11524 }
11525
11526 super.OnPlacementComplete(player, position, orientation);
11527 }
11528
11529
11530
11531
11532
11534 {
11536 {
11537 return true;
11538 }
11539 else
11540 {
11541 return false;
11542 }
11543 }
11544
11545
11547 {
11549 {
11551 }
11552 }
11553
11554
11556 {
11558 }
11559
11561 {
11563 }
11564
11565 override void InsertAgent(
int agent,
float count = 1)
11566 {
11567 if (count < 1)
11568 return;
11569
11571 }
11572
11575 {
11577 }
11578
11579
11581 {
11583 }
11584
11585
11586
11587
11588
11589
11590
11591
11592
11593
11594
11595
11596
11597
11598
11599
11600
11601
11602
11603
11604
11605
11606
11607
11608
11609
11610
11611
11612
11613
11614
11615
11616
11617
11618
11619
11620
11621
11622
11623
11624
11625
11627 {
11629 return false;
11630 return true;
11631 }
11632
11634 {
11635
11637 }
11638
11639
11642 {
11643 super.CheckForRoofLimited(timeTresholdMS);
11644
11645 float time =
g_Game.GetTime();
11646 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11647 {
11648 m_PreviousRoofTestTime = time;
11649 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11650 }
11651 }
11652
11653
11655 {
11657 {
11658 return 0;
11659 }
11660
11661 if (GetInventory().GetAttachmentSlotsCount() != 0)
11662 {
11663 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11664 if (filter)
11665 return filter.GetProtectionLevel(type, false, system);
11666 else
11667 return 0;
11668 }
11669
11670 string subclassPath, entryName;
11671
11672 switch (type)
11673 {
11675 entryName = "biological";
11676 break;
11678 entryName = "chemical";
11679 break;
11680 default:
11681 entryName = "biological";
11682 break;
11683 }
11684
11685 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11686
11687 return g_Game.ConfigGetFloat(subclassPath + entryName);
11688 }
11689
11690
11691
11694 {
11695 if (!IsMagazine())
11697
11699 }
11700
11701
11702
11703
11704
11709 {
11710 return true;
11711 }
11712
11714 {
11716 }
11717
11718
11719
11720
11721
11723 {
11724 if (parent)
11725 {
11726 if (parent.IsInherited(DayZInfected))
11727 return true;
11728
11729 if (!parent.IsRuined())
11730 return true;
11731 }
11732
11733 return true;
11734 }
11735
11737 {
11738 if (!super.CanPutAsAttachment(parent))
11739 {
11740 return false;
11741 }
11742
11743 if (!IsRuined() && !parent.IsRuined())
11744 {
11745 return true;
11746 }
11747
11748 return false;
11749 }
11750
11752 {
11753
11754
11755
11756
11757 return super.CanReceiveItemIntoCargo(item);
11758 }
11759
11761 {
11762
11763
11764
11765
11766 GameInventory attachmentInv = attachment.GetInventory();
11768 {
11769 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11770 return false;
11771 }
11772
11773 InventoryLocation loc = new InventoryLocation();
11774 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11775 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11776 return false;
11777
11778 return super.CanReceiveAttachment(attachment, slotId);
11779 }
11780
11782 {
11783 if (!super.CanReleaseAttachment(attachment))
11784 return false;
11785
11786 return GetInventory().AreChildrenAccessible();
11787 }
11788
11789
11790
11791
11792
11793
11794
11795
11796
11797
11798
11799
11800
11801
11802
11803
11804
11805
11806
11807
11808
11810 {
11811 int id = muzzle_owner.GetMuzzleID();
11812 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11813
11814 if (WPOF_array)
11815 {
11816 for (int i = 0; i < WPOF_array.Count(); i++)
11817 {
11818 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11819
11820 if (WPOF)
11821 {
11822 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11823 }
11824 }
11825 }
11826 }
11827
11828
11830 {
11831 int id = muzzle_owner.GetMuzzleID();
11833
11834 if (WPOBE_array)
11835 {
11836 for (int i = 0; i < WPOBE_array.Count(); i++)
11837 {
11838 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11839
11840 if (WPOBE)
11841 {
11842 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11843 }
11844 }
11845 }
11846 }
11847
11848
11850 {
11851 int id = muzzle_owner.GetMuzzleID();
11852 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11853
11854 if (WPOOH_array)
11855 {
11856 for (int i = 0; i < WPOOH_array.Count(); i++)
11857 {
11858 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11859
11860 if (WPOOH)
11861 {
11862 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11863 }
11864 }
11865 }
11866 }
11867
11868
11870 {
11871 int id = muzzle_owner.GetMuzzleID();
11872 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11873
11874 if (WPOOH_array)
11875 {
11876 for (int i = 0; i < WPOOH_array.Count(); i++)
11877 {
11878 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11879
11880 if (WPOOH)
11881 {
11882 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11883 }
11884 }
11885 }
11886 }
11887
11888
11890 {
11891 int id = muzzle_owner.GetMuzzleID();
11892 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11893
11894 if (WPOOH_array)
11895 {
11896 for (int i = 0; i < WPOOH_array.Count(); i++)
11897 {
11898 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11899
11900 if (WPOOH)
11901 {
11902 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11903 }
11904 }
11905 }
11906 }
11907
11908
11909
11911 {
11913 {
11914 return true;
11915 }
11916
11917 return false;
11918 }
11919
11921 {
11923 {
11924 return true;
11925 }
11926
11927 return false;
11928 }
11929
11931 {
11933 {
11934 return true;
11935 }
11936
11937 return false;
11938 }
11939
11941 {
11942 return false;
11943 }
11944
11947 {
11948 return UATimeSpent.DEFAULT_DEPLOY;
11949 }
11950
11951
11952
11953
11955 {
11957 SetSynchDirty();
11958 }
11959
11961 {
11963 }
11964
11965
11967 {
11968 return false;
11969 }
11970
11973 {
11974 string att_type = "None";
11975
11976 if (ConfigIsExisting("soundAttType"))
11977 {
11978 att_type = ConfigGetString("soundAttType");
11979 }
11980
11982 }
11983
11985 {
11987 }
11988
11989
11990
11991
11992
11998
12000 {
12003
12005 }
12006
12007
12009 {
12011 return;
12012
12014
12017
12020
12021 SoundParameters params = new SoundParameters();
12025 }
12026
12027
12029 {
12031 {
12034
12035 SetSynchDirty();
12036
12039 }
12040 }
12041
12043 {
12045 }
12046
12047
12049 {
12051 return;
12052
12054 SetSynchDirty();
12055
12058 }
12059
12061 {
12064 }
12065
12067 {
12069 }
12070
12071 void OnApply(PlayerBase player);
12072
12074 {
12075 return 1.0;
12076 };
12077
12079 {
12081 }
12082
12084 {
12086 }
12087
12089
12091 {
12092 SetDynamicPhysicsLifeTime(0.01);
12094 }
12095
12097 {
12098 array<string> zone_names = new array<string>;
12099 GetDamageZones(zone_names);
12100 for (int i = 0; i < zone_names.Count(); i++)
12101 {
12102 SetHealthMax(zone_names.Get(i),"Health");
12103 }
12104 SetHealthMax("","Health");
12105 }
12106
12109 {
12110 float global_health = GetHealth01("","Health");
12111 array<string> zones = new array<string>;
12112 GetDamageZones(zones);
12113
12114 for (int i = 0; i < zones.Count(); i++)
12115 {
12116 SetHealth01(zones.Get(i),"Health",global_health);
12117 }
12118 }
12119
12122 {
12123 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12124 }
12125
12127 {
12128 if (!hasRootAsPlayer)
12129 {
12130 if (refParentIB)
12131 {
12132
12133 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12134 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12135
12136 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12137 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12138
12141 }
12142 else
12143 {
12144
12147 }
12148 }
12149 }
12150
12152 {
12154 {
12155 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12156 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12157 {
12158 float heatPermCoef = 1.0;
12160 while (ent)
12161 {
12162 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12163 ent = ent.GetHierarchyParent();
12164 }
12165
12166 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12167 }
12168 }
12169 }
12170
12172 {
12173
12174 EntityAI parent = GetHierarchyParent();
12175 if (!parent)
12176 {
12177 hasParent = false;
12178 hasRootAsPlayer = false;
12179 }
12180 else
12181 {
12182 hasParent = true;
12183 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12184 refParentIB =
ItemBase.Cast(parent);
12185 }
12186 }
12187
12188 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12189 {
12190
12191 }
12192
12194 {
12195
12196 return false;
12197 }
12198
12200 {
12201
12202
12203 return false;
12204 }
12205
12207 {
12208
12209 return false;
12210 }
12211
12214 {
12215 return !GetIsFrozen() &&
IsOpen();
12216 }
12217
12219 {
12220 bool hasParent = false, hasRootAsPlayer = false;
12222
12223 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12224 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12225
12226 if (wwtu || foodDecay)
12227 {
12231
12232 if (processWetness || processTemperature || processDecay)
12233 {
12235
12236 if (processWetness)
12237 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12238
12239 if (processTemperature)
12241
12242 if (processDecay)
12243 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12244 }
12245 }
12246 }
12247
12250 {
12252 }
12253
12255 {
12258
12259 return super.GetTemperatureFreezeThreshold();
12260 }
12261
12263 {
12266
12267 return super.GetTemperatureThawThreshold();
12268 }
12269
12271 {
12274
12275 return super.GetItemOverheatThreshold();
12276 }
12277
12279 {
12281 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12282
12283 return super.GetTemperatureFreezeTime();
12284 }
12285
12287 {
12289 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12290
12291 return super.GetTemperatureThawTime();
12292 }
12293
12298
12300 {
12301 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12302 }
12303
12305 {
12306 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12307 }
12308
12311 {
12313 }
12314
12316 {
12318 }
12319
12321 {
12323 }
12324
12327 {
12328 return null;
12329 }
12330
12333 {
12334 return false;
12335 }
12336
12338 {
12340 {
12343 if (!trg)
12344 {
12346 explosive = this;
12347 }
12348
12349 explosive.PairRemote(trg);
12351
12352 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12353 trg.SetPersistentPairID(persistentID);
12354 explosive.SetPersistentPairID(persistentID);
12355
12356 return true;
12357 }
12358 return false;
12359 }
12360
12363 {
12364 float ret = 1.0;
12367 ret *= GetHealth01();
12368
12369 return ret;
12370 }
12371
12372 #ifdef DEVELOPER
12373 override void SetDebugItem()
12374 {
12375 super.SetDebugItem();
12376 _itemBase = this;
12377 }
12378
12380 {
12381 string text = super.GetDebugText();
12382
12384 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12385
12386 return text;
12387 }
12388 #endif
12389
12391 {
12392 return true;
12393 }
12394
12396
12398
12400 {
12403 }
12404
12405
12413
12429
12430 [
Obsolete(
"Use ItemSoundHandler instead")]
12433 {
12434 if (!
g_Game.IsDedicatedServer())
12435 {
12436 if (ConfigIsExisting("attachSoundSet"))
12437 {
12438 string cfg_path = "";
12439 string soundset = "";
12440 string type_name =
GetType();
12441
12444 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12445 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12446
12447 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12448 {
12449 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12450 {
12451 if (cfg_slot_array[i] == slot_type)
12452 {
12453 soundset = cfg_soundset_array[i];
12454 break;
12455 }
12456 }
12457 }
12458
12459 if (soundset != "")
12460 {
12461 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12463 }
12464 }
12465 }
12466 }
12467
12469}
12470
12472{
12474 if (entity)
12475 {
12476 bool is_item = entity.IsInherited(
ItemBase);
12477 if (is_item && full_quantity)
12478 {
12481 }
12482 }
12483 else
12484 {
12486 return NULL;
12487 }
12488 return entity;
12489}
12490
12492{
12493 if (item)
12494 {
12495 if (health > 0)
12496 item.SetHealth("", "", health);
12497
12498 if (item.CanHaveTemperature())
12499 {
12501 if (item.CanFreeze())
12502 item.SetFrozen(false);
12503 }
12504
12505 if (item.HasEnergyManager())
12506 {
12507 if (quantity >= 0)
12508 {
12509 item.GetCompEM().SetEnergy0To1(quantity);
12510 }
12511 else
12512 {
12514 }
12515 }
12516 else if (item.IsMagazine())
12517 {
12518 Magazine mag = Magazine.Cast(item);
12519 if (quantity >= 0)
12520 {
12521 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12522 }
12523 else
12524 {
12526 }
12527
12528 }
12529 else
12530 {
12531 if (quantity >= 0)
12532 {
12533 item.SetQuantityNormalized(quantity, false);
12534 }
12535 else
12536 {
12538 }
12539
12540 }
12541 }
12542}
12543
12544#ifdef DEVELOPER
12546#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.