Send message to owner player in yellow color.
7643{
7645 {
7646 return true;
7647 }
7648};
7649
7651{
7652
7653};
7654
7655
7656
7658{
7662
7664
7667
7668
7669
7670
7671
7680
7686
7691
7696
7717 protected bool m_IsResultOfSplit
7718
7720
7725
7726
7727
7729
7733
7734
7735
7737
7740
7741
7742
7748
7749
7757
7760
7761
7763
7764
7766
7767
7772
7773
7778
7780
7781
7783
7784
7786 {
7791
7792 if (!
g_Game.IsDedicatedServer())
7793 {
7795 {
7797
7799 {
7801 }
7802 }
7803
7806 }
7807
7808 m_OldLocation = null;
7809
7811 {
7813 }
7814
7815 if (ConfigIsExisting("headSelectionsToHide"))
7816 {
7819 }
7820
7822 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7823 {
7825 }
7826
7828
7829 m_IsResultOfSplit = false;
7830
7832 }
7833
7835 {
7836 super.InitItemVariables();
7837
7843 m_Count = ConfigGetInt(
"count");
7844
7847
7852
7855
7860
7872
7876
7877
7880 if (ConfigIsExisting("canBeSplit"))
7881 {
7884 }
7885
7887 if (ConfigIsExisting("itemBehaviour"))
7889
7890
7893 RegisterNetSyncVariableInt("m_VarLiquidType");
7894 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7895
7896 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7897 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7898 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7899
7900 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7901 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7902 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7903 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7904
7905 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7906 RegisterNetSyncVariableBool("m_IsTakeable");
7907 RegisterNetSyncVariableBool("m_IsHologram");
7908
7911 {
7914 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7915 }
7916
7918
7920 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7922
7924 }
7925
7927 {
7929 }
7930
7932 {
7935 {
7940 }
7941 }
7942
7943 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7944 {
7946 {
7949 }
7950
7952 }
7953
7955 {
7961 }
7962
7964
7966 {
7968
7969 if (!action)
7970 {
7971 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7972 return;
7973 }
7974
7976 if (!ai)
7977 {
7979 return;
7980 }
7981
7983 if (!action_array)
7984 {
7985 action_array = new array<ActionBase_Basic>;
7987 }
7988 if (LogManager.IsActionLogEnable())
7989 {
7990 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7991 }
7992
7993 if (action_array.Find(action) != -1)
7994 {
7995 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7996 }
7997 else
7998 {
7999 action_array.Insert(action);
8000 }
8001 }
8002
8004 {
8005 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8006 ActionBase action = player.GetActionManager().GetAction(actionName);
8009
8010 if (action_array)
8011 {
8012 action_array.RemoveItem(action);
8013 }
8014 }
8015
8016
8017
8019 {
8020 ActionOverrideData overrideData = new ActionOverrideData();
8024
8026 if (!actionMap)
8027 {
8030 }
8031
8032 actionMap.Insert(this.
Type(), overrideData);
8033
8034 }
8035
8037
8039
8040
8042 {
8045
8048
8049 string config_to_search = "CfgVehicles";
8050 string muzzle_owner_config;
8051
8053 {
8054 if (IsInherited(Weapon))
8055 config_to_search = "CfgWeapons";
8056
8057 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8058
8059 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
8060
8061 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
8062
8063 if (config_OnFire_subclass_count > 0)
8064 {
8065 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
8066
8067 for (int i = 0; i < config_OnFire_subclass_count; i++)
8068 {
8069 string particle_class = "";
8070 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
8071 string config_OnFire_entry = config_OnFire_class + particle_class;
8072 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
8073 WPOF_array.Insert(WPOF);
8074 }
8075
8076
8078 }
8079 }
8080
8082 {
8083 config_to_search = "CfgWeapons";
8084 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8085
8086 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
8087
8088 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
8089
8090 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
8091 {
8092 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
8093
8094 for (i = 0; i < config_OnBulletCasingEject_count; i++)
8095 {
8096 string particle_class2 = "";
8097 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
8098 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
8099 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
8100 WPOBE_array.Insert(WPOBE);
8101 }
8102
8103
8105 }
8106 }
8107 }
8108
8109
8111 {
8114
8116 {
8117 string config_to_search = "CfgVehicles";
8118
8119 if (IsInherited(Weapon))
8120 config_to_search = "CfgWeapons";
8121
8122 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
8123 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
8124
8125 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
8126 {
8127
8129
8131 {
8133 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
8135 return;
8136 }
8137
8140
8141
8142
8143 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
8144 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
8145
8146 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
8147 {
8148 string particle_class = "";
8149 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
8150 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
8151 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
8152
8153 if (entry_type == CT_CLASS)
8154 {
8155 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
8156 WPOOH_array.Insert(WPOF);
8157 }
8158 }
8159
8160
8162 }
8163 }
8164 }
8165
8167 {
8169 }
8170
8172 {
8174 {
8176
8179
8182
8183 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8184 }
8185 }
8186
8188 {
8190 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8191
8193 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8194
8196 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8197
8199 {
8201 }
8202 }
8203
8205 {
8207 }
8208
8210 {
8213 else
8215
8217 {
8220 }
8221 else
8222 {
8225
8228 }
8229
8231 }
8232
8234 {
8236 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8237 }
8238
8240 {
8242 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
8244 }
8245
8247 {
8249 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
8250 }
8251
8253 {
8256
8257 OverheatingParticle OP = new OverheatingParticle();
8262
8264 }
8265
8267 {
8270
8271 return -1;
8272 }
8273
8275 {
8277 {
8280
8281 for (int i = count; i > 0; --i)
8282 {
8283 int id = i - 1;
8286
8289
8290 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
8291 {
8292 if (p)
8293 {
8296 }
8297 }
8298 }
8299 }
8300 }
8301
8303 {
8305 {
8307 {
8308 int id = i - 1;
8310
8311 if (OP)
8312 {
8314
8315 if (p)
8316 {
8318 }
8319
8320 delete OP;
8321 }
8322 }
8323
8326 }
8327 }
8328
8331 {
8332 return 0.0;
8333 }
8334
8335
8337 {
8338 return 250;
8339 }
8340
8342 {
8343 return 0;
8344 }
8345
8348 {
8350 return true;
8351
8352 return false;
8353 }
8354
8357 {
8360
8362 {
8364 }
8365 else
8366 {
8367
8369 }
8370
8372 }
8373
8380 {
8381 return -1;
8382 }
8383
8384
8385
8386
8388 {
8390 {
8391 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8392 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8393
8394 if (r_index >= 0)
8395 {
8396 InventoryLocation r_il = new InventoryLocation;
8397 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8398
8399 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8402 {
8403 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8404 }
8406 {
8407 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8408 }
8409
8410 }
8411
8412 player.GetHumanInventory().ClearUserReservedLocation(this);
8413 }
8414
8417 }
8418
8419
8420
8421
8423 {
8424 return ItemBase.m_DebugActionsMask;
8425 }
8426
8428 {
8429 return ItemBase.m_DebugActionsMask & mask;
8430 }
8431
8433 {
8434 ItemBase.m_DebugActionsMask = mask;
8435 }
8436
8438 {
8439 ItemBase.m_DebugActionsMask |= mask;
8440 }
8441
8443 {
8444 ItemBase.m_DebugActionsMask &= ~mask;
8445 }
8446
8448 {
8450 {
8452 }
8453 else
8454 {
8456 }
8457 }
8458
8459
8461 {
8462 if (GetEconomyProfile())
8463 {
8464 float q_max = GetEconomyProfile().GetQuantityMax();
8465 if (q_max > 0)
8466 {
8467 float q_min = GetEconomyProfile().GetQuantityMin();
8468 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8469
8471 {
8472 ComponentEnergyManager comp = GetCompEM();
8474 {
8476 }
8477 }
8479 {
8481
8482 }
8483
8484 }
8485 }
8486 }
8487
8490 {
8491 EntityAI parent = GetHierarchyParent();
8492
8493 if (parent)
8494 {
8495 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8496 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8497 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8498 }
8499 }
8500
8503 {
8504 EntityAI parent = GetHierarchyParent();
8505
8506 if (parent)
8507 {
8508 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8509 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8510 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8511 }
8512 }
8513
8515 {
8516
8517
8518
8519
8521
8523 {
8524 if (ScriptInputUserData.CanStoreInputUserData())
8525 {
8526 ScriptInputUserData ctx = new ScriptInputUserData;
8532 ctx.
Write(use_stack_max);
8535
8537 {
8538 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8539 }
8540 }
8541 }
8542 else if (!
g_Game.IsMultiplayer())
8543 {
8545 }
8546 }
8547
8549 {
8551 }
8552
8554 {
8556 }
8557
8559 {
8561 }
8562
8564 {
8565
8566 return false;
8567 }
8568
8570 {
8571 return false;
8572 }
8573
8577 {
8578 return false;
8579 }
8580
8582 {
8583 return "";
8584 }
8585
8587
8589 {
8590 return false;
8591 }
8592
8594 {
8595 return true;
8596 }
8597
8598
8599
8601 {
8602 return true;
8603 }
8604
8606 {
8607 return true;
8608 }
8609
8611 {
8612 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8614 }
8615
8617 {
8619 }
8620
8622 {
8624 if (!is_being_placed)
8626 SetSynchDirty();
8627 }
8628
8629
8631
8633 {
8635 }
8636
8638 {
8640 }
8641
8643 {
8644 return 1;
8645 }
8646
8648 {
8649 return false;
8650 }
8651
8653 {
8655 SetSynchDirty();
8656 }
8657
8658
8659
8660
8661
8662
8663
8664
8665
8666
8667
8668
8669
8670
8671
8672
8673
8674
8675
8676
8677
8678
8679
8680
8681
8682
8683
8684
8685
8686
8687
8688
8689
8690
8691
8693 {
8694 super.OnMovedInsideCargo(container);
8695
8696 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8697 }
8698
8699 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8700 {
8701 super.EEItemLocationChanged(oldLoc, newLoc);
8702
8703 PlayerBase newPlayer = null;
8704 PlayerBase oldPlayer = null;
8705
8706 if (newLoc.GetParent())
8707 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8708
8709 if (oldLoc.GetParent())
8710 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8711
8713 {
8714 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8715
8716 if (rIndex >= 0)
8717 {
8718 InventoryLocation rIl = new InventoryLocation;
8719 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8720
8721 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8724 {
8725 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8726 }
8728 {
8730 }
8731
8732 }
8733 }
8734
8736 {
8737 if (newPlayer)
8738 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8739
8740 if (newPlayer == oldPlayer)
8741 {
8742 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8743 {
8745 {
8746 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8747 {
8748 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8749 }
8750 }
8751 else
8752 {
8753 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8754 }
8755 }
8756
8757 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8758 {
8759 int type = oldLoc.GetType();
8761 {
8762 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8763 }
8765 {
8766 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8767 }
8768 }
8769 if (!m_OldLocation)
8770 {
8771 m_OldLocation = new InventoryLocation;
8772 }
8773 m_OldLocation.Copy(oldLoc);
8774 }
8775 else
8776 {
8777 if (m_OldLocation)
8778 {
8779 m_OldLocation.Reset();
8780 }
8781 }
8782
8783 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8784 }
8785 else
8786 {
8787 if (newPlayer)
8788 {
8789 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8790 if (resIndex >= 0)
8791 {
8792 InventoryLocation il = new InventoryLocation;
8793 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8795 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8798 {
8799 il.
GetParent().GetOnReleaseLock().Invoke(it);
8800 }
8802 {
8804 }
8805
8806 }
8807 }
8809 {
8810
8812 }
8813
8814 if (m_OldLocation)
8815 {
8816 m_OldLocation.Reset();
8817 }
8818 }
8819
8821 {
8822 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8823 }
8824
8826 {
8827 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8828 }
8829 }
8830
8831 override void EOnContact(IEntity other, Contact extra)
8832 {
8834 {
8835 int liquidType = -1;
8837 if (impactSpeed > 0.0)
8838 {
8840 #ifndef SERVER
8842 #else
8844 SetSynchDirty();
8845 #endif
8847 }
8848 }
8849
8850 #ifdef SERVER
8851 if (GetCompEM() && GetCompEM().IsPlugged())
8852 {
8853 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8854 GetCompEM().UnplugThis();
8855 }
8856 #endif
8857 }
8858
8860
8862 {
8864 }
8865
8867 {
8868
8869 }
8870
8872 {
8873 super.OnItemLocationChanged(old_owner, new_owner);
8874
8875 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8876 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8877
8878 if (!relatedPlayer && playerNew)
8879 relatedPlayer = playerNew;
8880
8881 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8882 {
8884 if (actionMgr)
8885 {
8886 ActionBase currentAction = actionMgr.GetRunningAction();
8887 if (currentAction)
8889 }
8890 }
8891
8892 Man ownerPlayerOld = null;
8893 Man ownerPlayerNew = null;
8894
8895 if (old_owner)
8896 {
8897 if (old_owner.
IsMan())
8898 {
8899 ownerPlayerOld = Man.Cast(old_owner);
8900 }
8901 else
8902 {
8903 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8904 }
8905 }
8906 else
8907 {
8909 {
8911
8912 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8913 {
8914 GetCompEM().UnplugThis();
8915 }
8916 }
8917 }
8918
8919 if (new_owner)
8920 {
8921 if (new_owner.
IsMan())
8922 {
8923 ownerPlayerNew = Man.Cast(new_owner);
8924 }
8925 else
8926 {
8927 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8928 }
8929 }
8930
8931 if (ownerPlayerOld != ownerPlayerNew)
8932 {
8933 if (ownerPlayerOld)
8934 {
8935 array<EntityAI> subItemsExit = new array<EntityAI>;
8937 for (int i = 0; i < subItemsExit.Count(); i++)
8938 {
8941 }
8942 }
8943
8944 if (ownerPlayerNew)
8945 {
8946 array<EntityAI> subItemsEnter = new array<EntityAI>;
8948 for (int j = 0; j < subItemsEnter.Count(); j++)
8949 {
8952 }
8953 }
8954 }
8955 else if (ownerPlayerNew != null)
8956 {
8957 PlayerBase nplayer;
8958 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8959 {
8960 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8962 for (int k = 0; k < subItemsUpdate.Count(); k++)
8963 {
8965 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8966 }
8967 }
8968 }
8969
8970 if (old_owner)
8971 old_owner.OnChildItemRemoved(this);
8972 if (new_owner)
8973 new_owner.OnChildItemReceived(this);
8974 }
8975
8976
8978 {
8979 super.EEDelete(parent);
8980 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8981 if (player)
8982 {
8984
8985 if (player.IsAlive())
8986 {
8987 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8988 if (r_index >= 0)
8989 {
8990 InventoryLocation r_il = new InventoryLocation;
8991 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8992
8993 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8996 {
8997 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8998 }
9000 {
9001 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
9002 }
9003
9004 }
9005
9006 player.RemoveQuickBarEntityShortcut(this);
9007 }
9008 }
9009 }
9010
9012 {
9013 super.EEKilled(killer);
9014
9017 {
9018 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
9019 {
9020 if (IsMagazine())
9021 {
9022 if (Magazine.Cast(this).GetAmmoCount() > 0)
9023 {
9025 }
9026 }
9027 else
9028 {
9030 }
9031 }
9032 }
9033 }
9034
9036 {
9037 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
9038
9039 super.OnWasAttached(parent, slot_id);
9040
9043
9046 }
9047
9049 {
9050 super.OnWasDetached(parent, slot_id);
9051
9054
9057 }
9058
9060 {
9061 int idx;
9064
9065 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9066 if (inventory_slots.Count() < 1)
9067 {
9068 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
9069 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
9070 }
9071 else
9072 {
9073 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
9074 }
9075
9076 idx = inventory_slots.Find(slot);
9077 if (idx < 0)
9078 return "";
9079
9080 return attach_types.Get(idx);
9081 }
9082
9084 {
9085 int idx = -1;
9086 string slot;
9087
9090
9091 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
9092 if (inventory_slots.Count() < 1)
9093 {
9094 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
9095 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9096 }
9097 else
9098 {
9099 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
9100 if (detach_types.Count() < 1)
9101 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
9102 }
9103
9104 for (int i = 0; i < inventory_slots.Count(); i++)
9105 {
9106 slot = inventory_slots.Get(i);
9107 }
9108
9109 if (slot != "")
9110 {
9111 if (detach_types.Count() == 1)
9112 idx = 0;
9113 else
9114 idx = inventory_slots.Find(slot);
9115 }
9116 if (idx < 0)
9117 return "";
9118
9119 return detach_types.Get(idx);
9120 }
9121
9123 {
9124
9126
9127
9128 float min_time = 1;
9129 float max_time = 3;
9130 float delay = Math.RandomFloat(min_time, max_time);
9131
9132 explode_timer.Run(delay, this, "DoAmmoExplosion");
9133 }
9134
9136 {
9137 Magazine magazine = Magazine.Cast(this);
9138 int pop_sounds_count = 6;
9139 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
9140
9141
9142 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
9143 string sound_name = pop_sounds[ sound_idx ];
9144 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
9145
9146
9147 magazine.ServerAddAmmoCount(-1);
9148
9149
9150 float min_temp_to_explode = 100;
9151
9152 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
9153 {
9155 }
9156 }
9157
9158
9159 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
9160 {
9161 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
9162
9163 const int CHANCE_DAMAGE_CARGO = 4;
9164 const int CHANCE_DAMAGE_ATTACHMENT = 1;
9165 const int CHANCE_DAMAGE_NOTHING = 2;
9166
9168 {
9169 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
9170 int chances;
9171 int rnd;
9172
9173 if (GetInventory().GetCargo())
9174 {
9175 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9176 rnd = Math.RandomInt(0,chances);
9177
9178 if (rnd < CHANCE_DAMAGE_CARGO)
9179 {
9181 }
9182 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
9183 {
9185 }
9186 }
9187 else
9188 {
9189 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
9190 rnd = Math.RandomInt(0,chances);
9191
9192 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
9193 {
9195 }
9196 }
9197 }
9198 }
9199
9201 {
9202 CargoBase cargo = GetInventory().GetCargo();
9203 if (cargo)
9204 {
9206 if (item_count > 0)
9207 {
9208 int random_pick = Math.RandomInt(0, item_count);
9210 if (!item.IsExplosive())
9211 {
9212 item.AddHealth("","",damage);
9213 return true;
9214 }
9215 }
9216 }
9217 return false;
9218 }
9219
9221 {
9222 GameInventory inventory = GetInventory();
9224 if (attachment_count > 0)
9225 {
9226 int random_pick = Math.RandomInt(0, attachment_count);
9228 if (!attachment.IsExplosive())
9229 {
9230 attachment.AddHealth("","",damage);
9231 return true;
9232 }
9233 }
9234 return false;
9235 }
9236
9238 {
9240 }
9241
9243 {
9245 return GetInventory().CanRemoveEntity();
9246
9247 return false;
9248 }
9249
9251 {
9252
9254 return false;
9255
9256
9258 return false;
9259
9260
9261
9263 if (delta == 0)
9264 return false;
9265
9266
9267 return true;
9268 }
9269
9271 {
9273 {
9274 if (ScriptInputUserData.CanStoreInputUserData())
9275 {
9276 ScriptInputUserData ctx = new ScriptInputUserData;
9281 ctx.
Write(destination_entity);
9285 }
9286 }
9287 else if (!
g_Game.IsMultiplayer())
9288 {
9290 }
9291 }
9292
9294 {
9295 float split_quantity_new;
9299 InventoryLocation loc = new InventoryLocation;
9300
9301 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9302 {
9304 split_quantity_new = stack_max;
9305 else
9307
9309 {
9310 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9311 if (new_item)
9312 {
9313 new_item.SetResultOfSplit(true);
9314 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9316 new_item.
SetQuantity(split_quantity_new,
false,
true);
9317 }
9318 }
9319 }
9320 else if (destination_entity && slot_id == -1)
9321 {
9322 if (quantity > stack_max)
9323 split_quantity_new = stack_max;
9324 else
9325 split_quantity_new = quantity;
9326
9328 {
9329 GameInventory destinationInventory = destination_entity.GetInventory();
9331 {
9334 }
9335
9336 if (new_item)
9337 {
9338 new_item.SetResultOfSplit(true);
9339 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9341 new_item.
SetQuantity(split_quantity_new,
false,
true);
9342 }
9343 }
9344 }
9345 else
9346 {
9347 if (stack_max != 0)
9348 {
9350 {
9352 }
9353
9354 if (split_quantity_new == 0)
9355 {
9356 if (!
g_Game.IsMultiplayer())
9357 player.PhysicalPredictiveDropItem(this);
9358 else
9359 player.ServerDropEntity(this);
9360 return;
9361 }
9362
9364 {
9366
9367 if (new_item)
9368 {
9369 new_item.SetResultOfSplit(true);
9370 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9373 new_item.PlaceOnSurface();
9374 }
9375 }
9376 }
9377 }
9378 }
9379
9381 {
9382 float split_quantity_new;
9386 InventoryLocation loc = new InventoryLocation;
9387
9388 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9389 {
9391 split_quantity_new = stack_max;
9392 else
9394
9396 {
9397 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9398 if (new_item)
9399 {
9400 new_item.SetResultOfSplit(true);
9401 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9403 new_item.
SetQuantity(split_quantity_new,
false,
true);
9404 }
9405 }
9406 }
9407 else if (destination_entity && slot_id == -1)
9408 {
9409 if (quantity > stack_max)
9410 split_quantity_new = stack_max;
9411 else
9412 split_quantity_new = quantity;
9413
9415 {
9416 GameInventory destinationInventory = destination_entity.GetInventory();
9418 {
9421 }
9422
9423 if (new_item)
9424 {
9425 new_item.SetResultOfSplit(true);
9426 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9428 new_item.
SetQuantity(split_quantity_new,
false,
true);
9429 }
9430 }
9431 }
9432 else
9433 {
9434 if (stack_max != 0)
9435 {
9437 {
9439 }
9440
9442 {
9444
9445 if (new_item)
9446 {
9447 new_item.SetResultOfSplit(true);
9448 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9451 new_item.PlaceOnSurface();
9452 }
9453 }
9454 }
9455 }
9456 }
9457
9459 {
9461 {
9462 if (ScriptInputUserData.CanStoreInputUserData())
9463 {
9464 ScriptInputUserData ctx = new ScriptInputUserData;
9469 dst.WriteToContext(ctx);
9471 }
9472 }
9473 else if (!
g_Game.IsMultiplayer())
9474 {
9476 }
9477 }
9478
9480 {
9482 {
9483 if (ScriptInputUserData.CanStoreInputUserData())
9484 {
9485 ScriptInputUserData ctx = new ScriptInputUserData;
9490 ctx.
Write(destination_entity);
9496 }
9497 }
9498 else if (!
g_Game.IsMultiplayer())
9499 {
9501 }
9502 }
9503
9505 {
9507 }
9508
9510 {
9512 float split_quantity_new;
9514 if (dst.IsValid())
9515 {
9516 int slot_id = dst.GetSlot();
9518
9519 if (quantity > stack_max)
9520 split_quantity_new = stack_max;
9521 else
9522 split_quantity_new = quantity;
9523
9525 {
9527
9528 if (new_item)
9529 {
9530 new_item.SetResultOfSplit(true);
9531 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9533 new_item.
SetQuantity(split_quantity_new,
false,
true);
9534 }
9535
9536 return new_item;
9537 }
9538 }
9539
9540 return null;
9541 }
9542
9544 {
9546 float split_quantity_new;
9548 if (destination_entity)
9549 {
9551 if (quantity > stackable)
9552 split_quantity_new = stackable;
9553 else
9554 split_quantity_new = quantity;
9555
9557 {
9558 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9559 if (new_item)
9560 {
9561 new_item.SetResultOfSplit(true);
9562 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9564 new_item.
SetQuantity(split_quantity_new,
false,
true);
9565 }
9566 }
9567 }
9568 }
9569
9571 {
9573 {
9574 if (ScriptInputUserData.CanStoreInputUserData())
9575 {
9576 ScriptInputUserData ctx = new ScriptInputUserData;
9581 ItemBase destination_entity =
this;
9582 ctx.
Write(destination_entity);
9586 }
9587 }
9588 else if (!
g_Game.IsMultiplayer())
9589 {
9591 }
9592 }
9593
9595 {
9597 float split_quantity_new;
9599 if (player)
9600 {
9602 if (quantity > stackable)
9603 split_quantity_new = stackable;
9604 else
9605 split_quantity_new = quantity;
9606
9608 {
9609 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9610 new_item =
ItemBase.Cast(in_hands);
9611 if (new_item)
9612 {
9613 new_item.SetResultOfSplit(true);
9614 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9616 new_item.SetQuantity(split_quantity_new, false, true);
9617 }
9618 }
9619 }
9620 }
9621
9623 {
9625 float split_quantity_new = Math.Floor(quantity * 0.5);
9626
9628 return;
9629
9631
9632 if (new_item)
9633 {
9634 if (new_item.GetQuantityMax() < split_quantity_new)
9635 {
9636 split_quantity_new = new_item.GetQuantityMax();
9637 }
9638
9639 new_item.SetResultOfSplit(true);
9640 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9641
9643 {
9646 }
9647 else
9648 {
9650 new_item.
SetQuantity(split_quantity_new,
false,
true);
9651 }
9652 }
9653 }
9654
9656 {
9658 float split_quantity_new = Math.Floor(quantity / 2);
9659
9661 return;
9662
9663 InventoryLocation invloc = new InventoryLocation;
9665
9667 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9668
9669 if (new_item)
9670 {
9671 if (new_item.GetQuantityMax() < split_quantity_new)
9672 {
9673 split_quantity_new = new_item.GetQuantityMax();
9674 }
9676 {
9679 }
9680 else if (split_quantity_new > 1)
9681 {
9683 new_item.
SetQuantity(split_quantity_new,
false,
true);
9684 }
9685 }
9686 }
9687
9690 {
9691 SetWeightDirty();
9693
9694 if (parent)
9695 parent.OnAttachmentQuantityChangedEx(this, delta);
9696
9698 {
9700 {
9702 }
9704 {
9705 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9707 }
9708 }
9709 }
9710
9713 {
9714
9715 }
9716
9719 {
9721 }
9722
9724 {
9725 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9726
9728 {
9729 if (newLevel == GameConstants.STATE_RUINED)
9730 {
9732 EntityAI parent = GetHierarchyParent();
9733 if (parent && parent.IsFireplace())
9734 {
9735 CargoBase cargo = GetInventory().GetCargo();
9736 if (cargo)
9737 {
9739 {
9741 }
9742 }
9743 }
9744 }
9745
9747 {
9748
9750 return;
9751 }
9752
9753 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9754 {
9756 }
9757 }
9758 }
9759
9760
9762 {
9763 super.OnRightClick();
9764
9766 {
9768 {
9769 if (ScriptInputUserData.CanStoreInputUserData())
9770 {
9771 EntityAI root = GetHierarchyRoot();
9772 Man playerOwner = GetHierarchyRootPlayer();
9773 InventoryLocation dst = new InventoryLocation;
9774
9775
9776 if (!playerOwner && root && root == this)
9777 {
9779 }
9780 else
9781 {
9782
9783 GetInventory().GetCurrentInventoryLocation(dst);
9785 {
9786 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9788 {
9790 }
9791 else
9792 {
9794
9795
9796 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9797 {
9799 }
9800 else
9801 {
9802 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9803 }
9804 }
9805 }
9806 }
9807
9808 ScriptInputUserData ctx = new ScriptInputUserData;
9816 }
9817 }
9818 else if (!
g_Game.IsMultiplayer())
9819 {
9821 }
9822 }
9823 }
9824
9826 {
9827 if (root)
9828 {
9829 vector m4[4];
9830 root.GetTransform(m4);
9831 dst.SetGround(this, m4);
9832 }
9833 else
9834 {
9835 GetInventory().GetCurrentInventoryLocation(dst);
9836 }
9837 }
9838
9839 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9840 {
9841
9842 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9843 return false;
9844
9845 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9846 return false;
9847
9848
9850 return false;
9851
9852
9853 Magazine mag = Magazine.Cast(this);
9854 if (mag)
9855 {
9856 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9857 return false;
9858
9859 if (stack_max_limit)
9860 {
9861 Magazine other_mag = Magazine.Cast(other_item);
9862 if (other_item)
9863 {
9864 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9865 return false;
9866 }
9867
9868 }
9869 }
9870 else
9871 {
9872
9874 return false;
9875
9877 return false;
9878 }
9879
9880 PlayerBase player = null;
9881 if (CastTo(player, GetHierarchyRootPlayer()))
9882 {
9883 if (player.GetInventory().HasAttachment(this))
9884 return false;
9885
9886 if (player.IsItemsToDelete())
9887 return false;
9888 }
9889
9890 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9891 return false;
9892
9893 int slotID;
9895 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9896 return false;
9897
9898 return true;
9899 }
9900
9902 {
9904 }
9905
9907 {
9908 return m_IsResultOfSplit;
9909 }
9910
9912 {
9913 m_IsResultOfSplit = value;
9914 }
9915
9917 {
9919 }
9920
9922 {
9923 float other_item_quantity = other_item.GetQuantity();
9924 float this_free_space;
9925
9927
9929
9930 if (other_item_quantity > this_free_space)
9931 {
9932 return this_free_space;
9933 }
9934 else
9935 {
9936 return other_item_quantity;
9937 }
9938 }
9939
9941 {
9943 }
9944
9946 {
9948 return;
9949
9950 if (!IsMagazine() && other_item)
9951 {
9953 if (quantity_used != 0)
9954 {
9955 float hp1 = GetHealth01("","");
9956 float hp2 = other_item.GetHealth01("","");
9957 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9958 hpResult = hpResult / (
GetQuantity() + quantity_used);
9959
9960 hpResult *= GetMaxHealth();
9961 Math.Round(hpResult);
9962 SetHealth("", "Health", hpResult);
9963
9965 other_item.AddQuantity(-quantity_used);
9966 }
9967 }
9969 }
9970
9972 {
9973 #ifdef SERVER
9974 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9975 GetHierarchyParent().IncreaseLifetimeUp();
9976 #endif
9977 };
9978
9980 {
9981 PlayerBase p = PlayerBase.Cast(player);
9982
9983 array<int> recipesIds = p.m_Recipes;
9984 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9985 if (moduleRecipesManager)
9986 {
9987 EntityAI itemInHands = player.GetEntityInHands();
9988 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9989 }
9990
9991 for (int i = 0;i < recipesIds.Count(); i++)
9992 {
9993 int key = recipesIds.Get(i);
9994 string recipeName = moduleRecipesManager.GetRecipeName(key);
9996 }
9997 }
9998
9999
10000 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
10001 {
10002 super.GetDebugActions(outputList);
10003
10004
10010
10011
10016
10021
10022
10026
10027
10029 {
10033 }
10034
10037
10038
10042
10044
10045 InventoryLocation loc = new InventoryLocation();
10046 GetInventory().GetCurrentInventoryLocation(loc);
10048 {
10049 if (Gizmo_IsSupported())
10052 }
10053
10055 }
10056
10057
10058
10059
10061 {
10062 super.OnAction(action_id, player, ctx);
10063
10065 {
10066 switch (action_id)
10067 {
10071 return true;
10075 return true;
10076 }
10077 }
10078
10080 {
10081 switch (action_id)
10082 {
10084 Delete();
10085 return true;
10086 }
10087 }
10088
10089 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
10090 {
10091 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
10092 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
10093 PlayerBase p = PlayerBase.Cast(player);
10094 if (
EActions.RECIPES_RANGE_START < 1000)
10095 {
10096 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
10097 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
10098 }
10099 }
10100 #ifndef SERVER
10101 else if (action_id ==
EActions.WATCH_PLAYER)
10102 {
10103 PluginDeveloper.SetDeveloperItemClientEx(player);
10104 }
10105 #endif
10107 {
10108 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
10109 {
10110 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
10111 OnDebugButtonPressServer(id + 1);
10112 }
10113
10114 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
10115 {
10116 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
10118 }
10119
10120 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
10121 {
10122 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
10124 }
10125
10126 else if (action_id ==
EActions.ADD_QUANTITY)
10127 {
10128 if (IsMagazine())
10129 {
10130 Magazine mag = Magazine.Cast(this);
10131 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
10132 }
10133 else
10134 {
10136 }
10137
10138 if (m_EM)
10139 {
10140 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
10141 }
10142
10143 }
10144
10145 else if (action_id ==
EActions.REMOVE_QUANTITY)
10146 {
10147 if (IsMagazine())
10148 {
10149 Magazine mag2 = Magazine.Cast(this);
10150 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
10151 }
10152 else
10153 {
10155 }
10156 if (m_EM)
10157 {
10158 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
10159 }
10160
10161 }
10162
10163 else if (action_id ==
EActions.SET_QUANTITY_0)
10164 {
10166
10167 if (m_EM)
10168 {
10169 m_EM.SetEnergy(0);
10170 }
10171 }
10172
10173 else if (action_id ==
EActions.SET_MAX_QUANTITY)
10174 {
10176
10177 if (m_EM)
10178 {
10179 m_EM.SetEnergy(m_EM.GetEnergyMax());
10180 }
10181 }
10182
10183 else if (action_id ==
EActions.ADD_HEALTH)
10184 {
10185 AddHealth("","",GetMaxHealth("","Health")/5);
10186 }
10187 else if (action_id ==
EActions.REMOVE_HEALTH)
10188 {
10189 AddHealth("","",-GetMaxHealth("","Health")/5);
10190 }
10191 else if (action_id ==
EActions.DESTROY_HEALTH)
10192 {
10193 SetHealth01("","",0);
10194 }
10195 else if (action_id ==
EActions.WATCH_ITEM)
10196 {
10198 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
10199 #ifdef DEVELOPER
10200 SetDebugDeveloper_item(this);
10201 #endif
10202 }
10203
10204 else if (action_id ==
EActions.ADD_TEMPERATURE)
10205 {
10206 AddTemperature(20);
10207
10208 }
10209
10210 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
10211 {
10212 AddTemperature(-20);
10213
10214 }
10215
10216 else if (action_id ==
EActions.FLIP_FROZEN)
10217 {
10218 SetFrozen(!GetIsFrozen());
10219
10220 }
10221
10222 else if (action_id ==
EActions.ADD_WETNESS)
10223 {
10225
10226 }
10227
10228 else if (action_id ==
EActions.REMOVE_WETNESS)
10229 {
10231
10232 }
10233
10234 else if (action_id ==
EActions.LIQUIDTYPE_UP)
10235 {
10238
10239
10240 }
10241
10242 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
10243 {
10246 }
10247
10248 else if (action_id ==
EActions.MAKE_SPECIAL)
10249 {
10250 auto debugParams = DebugSpawnParams.WithPlayer(player);
10251 OnDebugSpawnEx(debugParams);
10252 }
10253
10254 }
10255
10256
10257 return false;
10258 }
10259
10260
10261
10262
10266
10269
10270
10271
10273 {
10274 return false;
10275 }
10276
10277
10279 {
10280 return true;
10281 }
10282
10283
10285 {
10286 return true;
10287 }
10288
10289
10290
10292 {
10293 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
10294 return g_Game.ConfigIsExisting(config_path);
10295 }
10296
10299 {
10300 return null;
10301 }
10302
10304 {
10305 return false;
10306 }
10307
10309 {
10310 return false;
10311 }
10312
10316
10317
10319 {
10320 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10321 return module_repairing.CanRepair(this, item_repair_kit);
10322 }
10323
10324
10325 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
10326 {
10327 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
10328 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
10329 }
10330
10331
10333 {
10334
10335
10336
10337
10338
10339
10340
10341
10342 return 1;
10343 }
10344
10345
10346
10348 {
10350 }
10351
10352
10353
10355 {
10357 }
10358
10359
10368 {
10369 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10370
10371 if (player)
10372 {
10373 player.MessageStatus(text);
10374 }
10375 }
10376
10377
10386 {
10387 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10388
10389 if (player)
10390 {
10391 player.MessageAction(text);
10392 }
10393 }
10394
10395
10404 {
10405 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10406
10407 if (player)
10408 {
10409 player.MessageFriendly(text);
10410 }
10411 }
10412
10413
10422 {
10423 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
10424
10425 if (player)
10426 {
10427 player.MessageImportant(text);
10428 }
10429 }
10430
10432 {
10433 return true;
10434 }
10435
10436
10437 override bool KindOf(
string tag)
10438 {
10439 bool found = false;
10440 string item_name = this.
GetType();
10442 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
10443
10444 int array_size = item_tag_array.Count();
10445 for (int i = 0; i < array_size; i++)
10446 {
10447 if (item_tag_array.Get(i) == tag)
10448 {
10449 found = true;
10450 break;
10451 }
10452 }
10453 return found;
10454 }
10455
10456
10458 {
10459
10460 super.OnRPC(sender, rpc_type,ctx);
10461
10462
10463 switch (rpc_type)
10464 {
10465 #ifndef SERVER
10466 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10467 Param2<bool, string> p = new Param2<bool, string>(false, "");
10468
10470 return;
10471
10472 bool play = p.param1;
10473 string soundSet = p.param2;
10474
10475 if (play)
10476 {
10478 {
10480 {
10482 }
10483 }
10484 else
10485 {
10487 }
10488 }
10489 else
10490 {
10492 }
10493
10494 break;
10495 #endif
10496
10497 }
10498
10500 {
10502 }
10503 }
10504
10505
10506
10507
10509 {
10510 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10511 return plugin.GetID(
name);
10512 }
10513
10515 {
10516 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10517 return plugin.GetName(id);
10518 }
10519
10522 {
10523
10524
10525 int varFlags;
10526 if (!ctx.
Read(varFlags))
10527 return;
10528
10529 if (varFlags & ItemVariableFlags.FLOAT)
10530 {
10532 }
10533 }
10534
10536 {
10537
10538 super.SerializeNumericalVars(floats_out);
10539
10540
10541
10543 {
10545 }
10546
10548 {
10550 }
10551
10553 {
10555 }
10556
10558 {
10563 }
10564
10566 {
10568 }
10569 }
10570
10572 {
10573
10574 super.DeSerializeNumericalVars(floats);
10575
10576
10577 int index = 0;
10578 int mask = Math.Round(floats.Get(index));
10579
10580 index++;
10581
10583 {
10585 {
10587 }
10588 else
10589 {
10590 float quantity = floats.Get(index);
10591 SetQuantity(quantity,
true,
false,
false,
false);
10592 }
10593 index++;
10594 }
10595
10597 {
10598 float wet = floats.Get(index);
10600 index++;
10601 }
10602
10604 {
10605 int liquidtype = Math.Round(floats.Get(index));
10607 index++;
10608 }
10609
10611 {
10613 index++;
10615 index++;
10617 index++;
10619 index++;
10620 }
10621
10623 {
10624 int cleanness = Math.Round(floats.Get(index));
10626 index++;
10627 }
10628 }
10629
10631 {
10632 super.WriteVarsToCTX(ctx);
10633
10634
10636 {
10638 }
10639
10641 {
10643 }
10644
10646 {
10648 }
10649
10651 {
10652 int r,g,b,a;
10658 }
10659
10661 {
10663 }
10664 }
10665
10667 {
10668 if (!super.ReadVarsFromCTX(ctx,version))
10669 return false;
10670
10671 int intValue;
10672 float value;
10673
10674 if (version < 140)
10675 {
10676 if (!ctx.
Read(intValue))
10677 return false;
10678
10679 m_VariablesMask = intValue;
10680 }
10681
10683 {
10684 if (!ctx.
Read(value))
10685 return false;
10686
10688 {
10690 }
10691 else
10692 {
10694 }
10695 }
10696
10697 if (version < 140)
10698 {
10700 {
10701 if (!ctx.
Read(value))
10702 return false;
10703 SetTemperatureDirect(value);
10704 }
10705 }
10706
10708 {
10709 if (!ctx.
Read(value))
10710 return false;
10712 }
10713
10715 {
10716 if (!ctx.
Read(intValue))
10717 return false;
10719 }
10720
10722 {
10723 int r,g,b,a;
10725 return false;
10727 return false;
10729 return false;
10731 return false;
10732
10734 }
10735
10737 {
10738 if (!ctx.
Read(intValue))
10739 return false;
10741 }
10742
10743 if (version >= 138 && version < 140)
10744 {
10746 {
10747 if (!ctx.
Read(intValue))
10748 return false;
10749 SetFrozen(intValue);
10750 }
10751 }
10752
10753 return true;
10754 }
10755
10756
10758 {
10761 {
10763 }
10764
10765 if (!super.OnStoreLoad(ctx, version))
10766 {
10768 return false;
10769 }
10770
10771 if (version >= 114)
10772 {
10773 bool hasQuickBarIndexSaved;
10774
10775 if (!ctx.
Read(hasQuickBarIndexSaved))
10776 {
10778 return false;
10779 }
10780
10781 if (hasQuickBarIndexSaved)
10782 {
10783 int itmQBIndex;
10784
10785
10786 if (!ctx.
Read(itmQBIndex))
10787 {
10789 return false;
10790 }
10791
10792 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10793 if (itmQBIndex != -1 && parentPlayer)
10794 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10795 }
10796 }
10797 else
10798 {
10799
10800 PlayerBase player;
10801 int itemQBIndex;
10802 if (version ==
int.
MAX)
10803 {
10804 if (!ctx.
Read(itemQBIndex))
10805 {
10807 return false;
10808 }
10809 }
10810 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10811 {
10812
10813 if (!ctx.
Read(itemQBIndex))
10814 {
10816 return false;
10817 }
10818 if (itemQBIndex != -1 && player)
10819 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10820 }
10821 }
10822
10823 if (version < 140)
10824 {
10825
10826 if (!LoadVariables(ctx, version))
10827 {
10829 return false;
10830 }
10831 }
10832
10833
10835 {
10837 return false;
10838 }
10839 if (version >= 132)
10840 {
10842 if (raib)
10843 {
10845 {
10847 return false;
10848 }
10849 }
10850 }
10851
10853 return true;
10854 }
10855
10856
10857
10859 {
10860 super.OnStoreSave(ctx);
10861
10862 PlayerBase player;
10863 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10864 {
10866
10867 int itemQBIndex = -1;
10868 itemQBIndex = player.FindQuickBarEntityIndex(this);
10869 ctx.
Write(itemQBIndex);
10870 }
10871 else
10872 {
10874 }
10875
10877
10879 if (raib)
10880 {
10882 }
10883 }
10884
10885
10887 {
10888 super.AfterStoreLoad();
10889
10891 {
10893 }
10894
10896 {
10899 }
10900 }
10901
10903 {
10904 super.EEOnAfterLoad();
10905
10907 {
10909 }
10910
10913 }
10914
10916 {
10917 return false;
10918 }
10919
10920
10921
10923 {
10925 {
10926 #ifdef PLATFORM_CONSOLE
10927
10929 {
10931 if (menu)
10932 {
10934 }
10935 }
10936 #endif
10937 }
10938
10940 {
10943 }
10944
10946 {
10947 SetWeightDirty();
10949 }
10951 {
10954 }
10955
10957 {
10960
10963 }
10965 {
10969 }
10970
10971 super.OnVariablesSynchronized();
10972 }
10973
10974
10975
10977 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10978 {
10979 if (!IsServerCheck(allow_client))
10980 return false;
10981
10983 return false;
10984
10987
10988 if (value <= (min + 0.001))
10989 value = min;
10990
10991 if (value == min)
10992 {
10993 if (destroy_config)
10994 {
10995 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10996 if (dstr)
10997 {
10999 this.Delete();
11000 return true;
11001 }
11002 }
11003 else if (destroy_forced)
11004 {
11006 this.Delete();
11007 return true;
11008 }
11009
11011 }
11012
11015
11017 {
11018 EntityAI parent = GetHierarchyRoot();
11019 InventoryLocation iLoc = new InventoryLocation();
11020 GetInventory().GetCurrentInventoryLocation(iLoc);
11022 {
11023 int iLocSlot = iLoc.
GetSlot();
11025 {
11027 }
11029 {
11031 }
11032 }
11033 }
11034
11036 {
11038
11039 if (delta)
11041 }
11042
11044
11045 return false;
11046 }
11047
11048
11050 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11051 {
11053 }
11054
11056 {
11059 }
11060
11062 {
11065 }
11066
11068 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
11069 {
11070 float value_clamped = Math.Clamp(value, 0, 1);
11072 SetQuantity(result, destroy_config, destroy_forced);
11073 }
11074
11075
11078 {
11080 }
11081
11083 {
11085 }
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11097 {
11098 int slot = -1;
11099 GameInventory inventory = GetInventory();
11100 if (inventory)
11101 {
11102 InventoryLocation il = new InventoryLocation;
11105 }
11106
11108 }
11109
11111 {
11112 float quantity_max = 0;
11113
11115 {
11116 if (attSlotID != -1)
11117 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
11118
11119 if (quantity_max <= 0)
11121 }
11122
11123 if (quantity_max <= 0)
11125
11126 return quantity_max;
11127 }
11128
11130 {
11132 }
11133
11135 {
11137 }
11138
11139
11141 {
11143 }
11144
11146 {
11148 }
11149
11151 {
11153 }
11154
11155
11157 {
11158
11159 float weightEx = GetWeightEx();
11160 float special = GetInventoryAndCargoWeight();
11161 return weightEx - special;
11162 }
11163
11164
11166 {
11168 }
11169
11171 {
11173 {
11174 #ifdef DEVELOPER
11175 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11176 {
11177 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
11179 }
11180 #endif
11181
11182 return GetQuantity() * GetConfigWeightModified();
11183 }
11184 else if (HasEnergyManager())
11185 {
11186 #ifdef DEVELOPER
11187 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11188 {
11189 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
11190 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
11191 }
11192 #endif
11193 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
11194 }
11195 else
11196 {
11197 #ifdef DEVELOPER
11198 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
11199 {
11200 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
11201 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
11202 }
11203 #endif
11204 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
11205 }
11206 }
11207
11210 {
11211 int item_count = 0;
11213
11214 GameInventory inventory = GetInventory();
11215 CargoBase cargo = inventory.
GetCargo();
11216 if (cargo != NULL)
11217 {
11219 }
11220
11222 for (int i = 0; i < nAttachments; ++i)
11223 {
11225 if (item)
11226 item_count += item.GetNumberOfItems();
11227 }
11228 return item_count;
11229 }
11230
11233 {
11234 float weight = 0;
11235 float wetness = 1;
11236 if (include_wetness)
11239 {
11240 weight = wetness * m_ConfigWeight;
11241 }
11243 {
11244 weight = 1;
11245 }
11246 return weight;
11247 }
11248
11249
11250
11252 {
11253 GameInventory inventory = GetInventory();
11254 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
11255 {
11256 array<EntityAI> items = new array<EntityAI>;
11258 for (int i = 0; i < items.Count(); ++i)
11259 {
11261 if (item)
11262 {
11263 g_Game.ObjectDelete(item);
11264 }
11265 }
11266 }
11267 }
11268
11269
11270
11271
11273 {
11274 float energy = 0;
11275 if (HasEnergyManager())
11276 {
11277 energy = GetCompEM().GetEnergy();
11278 }
11279 return energy;
11280 }
11281
11282
11284 {
11285 super.OnEnergyConsumed();
11286
11288 }
11289
11291 {
11292 super.OnEnergyAdded();
11293
11295 }
11296
11297
11299 {
11300 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
11301 {
11303 {
11304 float energy_0to1 = GetCompEM().GetEnergy0To1();
11306 }
11307 }
11308 }
11309
11310
11312 {
11313 return ConfigGetFloat("heatIsolation");
11314 }
11315
11317 {
11319 }
11320
11322 {
11323 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
11324 if (
g_Game.ConfigIsExisting(paramPath))
11325 return g_Game.ConfigGetFloat(paramPath);
11326
11327 return 0.0;
11328 }
11329
11331 {
11332 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
11333 if (
g_Game.ConfigIsExisting(paramPath))
11334 return g_Game.ConfigGetFloat(paramPath);
11335
11336 return 0.0;
11337 }
11338
11339 override void SetWet(
float value,
bool allow_client =
false)
11340 {
11341 if (!IsServerCheck(allow_client))
11342 return;
11343
11346
11348
11349 m_VarWet = Math.Clamp(value, min, max);
11350
11352 {
11355 }
11356 }
11357
11358 override void AddWet(
float value)
11359 {
11361 }
11362
11364 {
11366 }
11367
11369 {
11371 }
11372
11374 {
11376 }
11377
11379 {
11381 }
11382
11384 {
11386 }
11387
11388 override void OnWetChanged(
float newVal,
float oldVal)
11389 {
11392 if (newLevel != oldLevel)
11393 {
11395 }
11396 }
11397
11399 {
11400 SetWeightDirty();
11401 }
11402
11404 {
11405 return GetWetLevelInternal(
m_VarWet);
11406 }
11407
11408
11409
11411 {
11413 }
11414
11416 {
11418 }
11419
11421 {
11423 }
11424
11426 {
11428 }
11429
11430
11431
11433 {
11434 if (ConfigIsExisting("itemModelLength"))
11435 {
11436 return ConfigGetFloat("itemModelLength");
11437 }
11438 return 0;
11439 }
11440
11442 {
11443 if (ConfigIsExisting("itemAttachOffset"))
11444 {
11445 return ConfigGetFloat("itemAttachOffset");
11446 }
11447 return 0;
11448 }
11449
11450 override void SetCleanness(
int value,
bool allow_client =
false)
11451 {
11452 if (!IsServerCheck(allow_client))
11453 return;
11454
11456
11458
11461 }
11462
11464 {
11466 }
11467
11469 {
11470 return true;
11471 }
11472
11473
11474
11475
11477 {
11479 }
11480
11482 {
11484 }
11485
11486
11487
11488
11489 override void SetColor(
int r,
int g,
int b,
int a)
11490 {
11496 }
11498 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11499 {
11504 }
11505
11507 {
11509 }
11510
11513 {
11514 int r,g,b,a;
11516 r = r/255;
11517 g = g/255;
11518 b = b/255;
11519 a = a/255;
11520 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11521 }
11522
11523
11524
11525 override void SetLiquidType(
int value,
bool allow_client =
false)
11526 {
11527 if (!IsServerCheck(allow_client))
11528 return;
11529
11534 }
11535
11537 {
11538 return ConfigGetInt("varLiquidTypeInit");
11539 }
11540
11542 {
11544 }
11545
11547 {
11549 SetFrozen(false);
11550 }
11551
11554 {
11555 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11556 }
11557
11558
11561 {
11562 PlayerBase nplayer;
11563 if (PlayerBase.CastTo(nplayer, player))
11564 {
11566 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11567 }
11568 }
11569
11570
11573 {
11574 PlayerBase nplayer;
11575 if (PlayerBase.CastTo(nplayer,player))
11576 {
11577 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11578 }
11579
11580 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11581
11582 if (HasEnergyManager())
11583 {
11584 GetCompEM().UpdatePlugState();
11585 }
11586 }
11587
11588
11590 {
11591 super.OnPlacementStarted(player);
11592
11594 }
11595
11596 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11597 {
11599 {
11600 m_AdminLog.OnPlacementComplete(player,
this);
11601 }
11602
11603 super.OnPlacementComplete(player, position, orientation);
11604 }
11605
11606
11607
11608
11609
11611 {
11613 {
11614 return true;
11615 }
11616 else
11617 {
11618 return false;
11619 }
11620 }
11621
11622
11624 {
11626 {
11628 }
11629 }
11630
11631
11633 {
11635 }
11636
11638 {
11640 }
11641
11642 override void InsertAgent(
int agent,
float count = 1)
11643 {
11644 if (count < 1)
11645 return;
11646
11648 }
11649
11652 {
11654 }
11655
11656
11658 {
11660 }
11661
11662
11663
11664
11665
11666
11667
11668
11669
11670
11671
11672
11673
11674
11675
11676
11677
11678
11679
11680
11681
11682
11683
11684
11685
11686
11687
11688
11689
11690
11691
11692
11693
11694
11695
11696
11697
11698
11699
11700
11701
11702
11704 {
11706 return false;
11707 return true;
11708 }
11709
11711 {
11712
11714 }
11715
11716
11719 {
11720 super.CheckForRoofLimited(timeTresholdMS);
11721
11722 float time =
g_Game.GetTime();
11723 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11724 {
11725 m_PreviousRoofTestTime = time;
11726 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11727 }
11728 }
11729
11730
11732 {
11734 {
11735 return 0;
11736 }
11737
11738 if (GetInventory().GetAttachmentSlotsCount() != 0)
11739 {
11740 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11741 if (filter)
11742 return filter.GetProtectionLevel(type, false, system);
11743 else
11744 return 0;
11745 }
11746
11747 string subclassPath, entryName;
11748
11749 switch (type)
11750 {
11752 entryName = "biological";
11753 break;
11755 entryName = "chemical";
11756 break;
11757 default:
11758 entryName = "biological";
11759 break;
11760 }
11761
11762 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11763
11764 return g_Game.ConfigGetFloat(subclassPath + entryName);
11765 }
11766
11767
11768
11771 {
11772 if (!IsMagazine())
11774
11776 }
11777
11778
11779
11780
11781
11786 {
11787 return true;
11788 }
11789
11791 {
11793 }
11794
11795
11796
11797
11798
11800 {
11801 if (parent)
11802 {
11803 if (parent.IsInherited(DayZInfected))
11804 return true;
11805
11806 if (!parent.IsRuined())
11807 return true;
11808 }
11809
11810 return true;
11811 }
11812
11814 {
11815 if (!super.CanPutAsAttachment(parent))
11816 {
11817 return false;
11818 }
11819
11820 if (!IsRuined() && !parent.IsRuined())
11821 {
11822 return true;
11823 }
11824
11825 return false;
11826 }
11827
11829 {
11830
11831
11832
11833
11834 return super.CanReceiveItemIntoCargo(item);
11835 }
11836
11838 {
11839
11840
11841
11842
11843 GameInventory attachmentInv = attachment.GetInventory();
11845 {
11846 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11847 return false;
11848 }
11849
11850 InventoryLocation loc = new InventoryLocation();
11851 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11852 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11853 return false;
11854
11855 return super.CanReceiveAttachment(attachment, slotId);
11856 }
11857
11859 {
11860 if (!super.CanReleaseAttachment(attachment))
11861 return false;
11862
11863 return GetInventory().AreChildrenAccessible();
11864 }
11865
11866
11867
11868
11869
11870
11871
11872
11873
11874
11875
11876
11877
11878
11879
11880
11881
11882
11883
11884
11885
11887 {
11888 int id = muzzle_owner.GetMuzzleID();
11889 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11890
11891 if (WPOF_array)
11892 {
11893 for (int i = 0; i < WPOF_array.Count(); i++)
11894 {
11895 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11896
11897 if (WPOF)
11898 {
11899 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11900 }
11901 }
11902 }
11903 }
11904
11905
11907 {
11908 int id = muzzle_owner.GetMuzzleID();
11910
11911 if (WPOBE_array)
11912 {
11913 for (int i = 0; i < WPOBE_array.Count(); i++)
11914 {
11915 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11916
11917 if (WPOBE)
11918 {
11919 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11920 }
11921 }
11922 }
11923 }
11924
11925
11927 {
11928 int id = muzzle_owner.GetMuzzleID();
11929 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11930
11931 if (WPOOH_array)
11932 {
11933 for (int i = 0; i < WPOOH_array.Count(); i++)
11934 {
11935 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11936
11937 if (WPOOH)
11938 {
11939 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11940 }
11941 }
11942 }
11943 }
11944
11945
11947 {
11948 int id = muzzle_owner.GetMuzzleID();
11949 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11950
11951 if (WPOOH_array)
11952 {
11953 for (int i = 0; i < WPOOH_array.Count(); i++)
11954 {
11955 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11956
11957 if (WPOOH)
11958 {
11959 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11960 }
11961 }
11962 }
11963 }
11964
11965
11967 {
11968 int id = muzzle_owner.GetMuzzleID();
11969 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11970
11971 if (WPOOH_array)
11972 {
11973 for (int i = 0; i < WPOOH_array.Count(); i++)
11974 {
11975 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11976
11977 if (WPOOH)
11978 {
11979 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11980 }
11981 }
11982 }
11983 }
11984
11985
11986
11988 {
11990 {
11991 return true;
11992 }
11993
11994 return false;
11995 }
11996
11998 {
12000 {
12001 return true;
12002 }
12003
12004 return false;
12005 }
12006
12008 {
12010 {
12011 return true;
12012 }
12013
12014 return false;
12015 }
12016
12018 {
12019 return false;
12020 }
12021
12024 {
12025 return UATimeSpent.DEFAULT_DEPLOY;
12026 }
12027
12028
12029
12030
12032 {
12034 SetSynchDirty();
12035 }
12036
12038 {
12040 }
12041
12042
12044 {
12045 return false;
12046 }
12047
12050 {
12051 string att_type = "None";
12052
12053 if (ConfigIsExisting("soundAttType"))
12054 {
12055 att_type = ConfigGetString("soundAttType");
12056 }
12057
12059 }
12060
12062 {
12064 }
12065
12066
12067
12068
12069
12075
12077 {
12080
12082 }
12083
12084
12086 {
12088 return;
12089
12091
12094
12097
12098 SoundParameters params = new SoundParameters();
12102 }
12103
12104
12106 {
12108 {
12111
12112 SetSynchDirty();
12113
12116 }
12117 }
12118
12120 {
12122 }
12123
12124
12126 {
12128 return;
12129
12131 SetSynchDirty();
12132
12135 }
12136
12138 {
12141 }
12142
12144 {
12146 }
12147
12148 void OnApply(PlayerBase player);
12149
12151 {
12152 return 1.0;
12153 };
12154
12156 {
12158 }
12159
12161 {
12163 }
12164
12166
12168 {
12169 SetDynamicPhysicsLifeTime(0.01);
12171 }
12172
12174 {
12175 array<string> zone_names = new array<string>;
12176 GetDamageZones(zone_names);
12177 for (int i = 0; i < zone_names.Count(); i++)
12178 {
12179 SetHealthMax(zone_names.Get(i),"Health");
12180 }
12181 SetHealthMax("","Health");
12182 }
12183
12186 {
12187 float global_health = GetHealth01("","Health");
12188 array<string> zones = new array<string>;
12189 GetDamageZones(zones);
12190
12191 for (int i = 0; i < zones.Count(); i++)
12192 {
12193 SetHealth01(zones.Get(i),"Health",global_health);
12194 }
12195 }
12196
12199 {
12200 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
12201 }
12202
12204 {
12205 if (!hasRootAsPlayer)
12206 {
12207 if (refParentIB)
12208 {
12209
12210 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
12211 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
12212
12213 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
12214 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
12215
12218 }
12219 else
12220 {
12221
12224 }
12225 }
12226 }
12227
12229 {
12231 {
12232 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
12233 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
12234 {
12235 float heatPermCoef = 1.0;
12237 while (ent)
12238 {
12239 heatPermCoef *= ent.GetHeatPermeabilityCoef();
12240 ent = ent.GetHierarchyParent();
12241 }
12242
12243 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
12244 }
12245 }
12246 }
12247
12249 {
12250
12251 EntityAI parent = GetHierarchyParent();
12252 if (!parent)
12253 {
12254 hasParent = false;
12255 hasRootAsPlayer = false;
12256 }
12257 else
12258 {
12259 hasParent = true;
12260 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
12261 refParentIB =
ItemBase.Cast(parent);
12262 }
12263 }
12264
12265 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
12266 {
12267
12268 }
12269
12271 {
12272
12273 return false;
12274 }
12275
12277 {
12278
12279
12280 return false;
12281 }
12282
12284 {
12285
12286 return false;
12287 }
12288
12291 {
12292 return !GetIsFrozen() &&
IsOpen();
12293 }
12294
12296 {
12297 bool hasParent = false, hasRootAsPlayer = false;
12299
12300 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
12301 bool foodDecay =
g_Game.IsFoodDecayEnabled();
12302
12303 if (wwtu || foodDecay)
12304 {
12308
12309 if (processWetness || processTemperature || processDecay)
12310 {
12312
12313 if (processWetness)
12314 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
12315
12316 if (processTemperature)
12318
12319 if (processDecay)
12320 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
12321 }
12322 }
12323 }
12324
12327 {
12329 }
12330
12332 {
12335
12336 return super.GetTemperatureFreezeThreshold();
12337 }
12338
12340 {
12343
12344 return super.GetTemperatureThawThreshold();
12345 }
12346
12348 {
12351
12352 return super.GetItemOverheatThreshold();
12353 }
12354
12356 {
12358 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
12359
12360 return super.GetTemperatureFreezeTime();
12361 }
12362
12364 {
12366 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
12367
12368 return super.GetTemperatureThawTime();
12369 }
12370
12375
12377 {
12378 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
12379 }
12380
12382 {
12383 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
12384 }
12385
12388 {
12390 }
12391
12393 {
12395 }
12396
12398 {
12400 }
12401
12404 {
12405 return null;
12406 }
12407
12410 {
12411 return false;
12412 }
12413
12415 {
12417 {
12420 if (!trg)
12421 {
12423 explosive = this;
12424 }
12425
12426 explosive.PairRemote(trg);
12428
12429 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12430 trg.SetPersistentPairID(persistentID);
12431 explosive.SetPersistentPairID(persistentID);
12432
12433 return true;
12434 }
12435 return false;
12436 }
12437
12440 {
12441 float ret = 1.0;
12444 ret *= GetHealth01();
12445
12446 return ret;
12447 }
12448
12449 #ifdef DEVELOPER
12450 override void SetDebugItem()
12451 {
12452 super.SetDebugItem();
12453 _itemBase = this;
12454 }
12455
12457 {
12458 string text = super.GetDebugText();
12459
12461 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12462
12463 return text;
12464 }
12465 #endif
12466
12468 {
12469 return true;
12470 }
12471
12473
12475
12477 {
12480 }
12481
12482
12490
12506
12507 [
Obsolete(
"Use ItemSoundHandler instead")]
12510 {
12511 if (!
g_Game.IsDedicatedServer())
12512 {
12513 if (ConfigIsExisting("attachSoundSet"))
12514 {
12515 string cfg_path = "";
12516 string soundset = "";
12517 string type_name =
GetType();
12518
12521 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12522 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12523
12524 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12525 {
12526 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12527 {
12528 if (cfg_slot_array[i] == slot_type)
12529 {
12530 soundset = cfg_soundset_array[i];
12531 break;
12532 }
12533 }
12534 }
12535
12536 if (soundset != "")
12537 {
12538 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12540 }
12541 }
12542 }
12543 }
12544
12546}
12547
12549{
12551 if (entity)
12552 {
12553 bool is_item = entity.IsInherited(
ItemBase);
12554 if (is_item && full_quantity)
12555 {
12558 }
12559 }
12560 else
12561 {
12563 return NULL;
12564 }
12565 return entity;
12566}
12567
12569{
12570 if (item)
12571 {
12572 if (health > 0)
12573 item.SetHealth("", "", health);
12574
12575 if (item.CanHaveTemperature())
12576 {
12578 if (item.CanFreeze())
12579 item.SetFrozen(false);
12580 }
12581
12582 if (item.HasEnergyManager())
12583 {
12584 if (quantity >= 0)
12585 {
12586 item.GetCompEM().SetEnergy0To1(quantity);
12587 }
12588 else
12589 {
12591 }
12592 }
12593 else if (item.IsMagazine())
12594 {
12595 Magazine mag = Magazine.Cast(item);
12596 if (quantity >= 0)
12597 {
12598 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12599 }
12600 else
12601 {
12603 }
12604
12605 }
12606 else
12607 {
12608 if (quantity >= 0)
12609 {
12610 item.SetQuantityNormalized(quantity, false);
12611 }
12612 else
12613 {
12615 }
12616
12617 }
12618 }
12619}
12620
12621#ifdef DEVELOPER
12623#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.