6689{
6691 {
6692 return true;
6693 }
6694};
6695
6696
6697
6699{
6703
6705
6708
6709
6710
6711
6712
6721
6727
6732
6737
6758 protected bool m_IsResultOfSplit
6759
6761
6766
6767
6768
6770
6774
6775
6776
6778
6781
6782
6783
6789
6790
6798
6801
6802
6804
6805
6807
6808
6813
6814
6819
6820
6822
6823
6825 {
6830
6831 if (!
GetGame().IsDedicatedServer())
6832 {
6834 {
6836
6838 {
6840 }
6841 }
6842
6845 }
6846
6847 m_OldLocation = null;
6848
6850 {
6852 }
6853
6854 if (ConfigIsExisting("headSelectionsToHide"))
6855 {
6858 }
6859
6861 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6862 {
6864 }
6865
6867
6868 m_IsResultOfSplit = false;
6869
6871 }
6872
6874 {
6875 super.InitItemVariables();
6876
6882 m_Count = ConfigGetInt(
"count");
6883
6886
6891
6894
6899
6911
6915
6916
6919 if (ConfigIsExisting("canBeSplit"))
6920 {
6923 }
6924
6926 if (ConfigIsExisting("itemBehaviour"))
6928
6929
6932 RegisterNetSyncVariableInt("m_VarLiquidType");
6933 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6934
6935 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6936 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6937 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6938
6939 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6940 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6941 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6942 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6943
6944 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6945 RegisterNetSyncVariableBool("m_IsTakeable");
6946 RegisterNetSyncVariableBool("m_IsHologram");
6947
6950 {
6953 }
6954
6956
6958 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6960
6961 }
6962
6964 {
6966 }
6967
6969 {
6972 {
6977 }
6978 }
6979
6980 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
6981 {
6983 {
6986 }
6987
6989 }
6990
6992 {
6998 }
6999
7001
7003 {
7005
7006 if (!action)
7007 {
7008 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7009 return;
7010 }
7011
7013 if (!ai)
7014 {
7016 return;
7017 }
7018
7020 if (!action_array)
7021 {
7022 action_array = new array<ActionBase_Basic>;
7024 }
7025 if (LogManager.IsActionLogEnable())
7026 {
7027 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7028 }
7029
7030 if (action_array.Find(action) != -1)
7031 {
7032 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7033 }
7034 else
7035 {
7036 action_array.Insert(action);
7037 }
7038 }
7039
7041 {
7043 ActionBase action = player.GetActionManager().GetAction(actionName);
7046
7047 if (action_array)
7048 {
7049 action_array.RemoveItem(action);
7050 }
7051 }
7052
7053
7054
7056 {
7057 ActionOverrideData overrideData = new ActionOverrideData();
7061
7063 if (!actionMap)
7064 {
7067 }
7068
7069 actionMap.Insert(this.
Type(), overrideData);
7070
7071 }
7072
7074
7076
7077
7079 {
7082
7085
7086 string config_to_search = "CfgVehicles";
7087 string muzzle_owner_config;
7088
7090 {
7091 if (IsInherited(Weapon))
7092 config_to_search = "CfgWeapons";
7093
7094 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7095
7096 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7097
7099
7100 if (config_OnFire_subclass_count > 0)
7101 {
7102 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7103
7104 for (int i = 0; i < config_OnFire_subclass_count; i++)
7105 {
7106 string particle_class = "";
7108 string config_OnFire_entry = config_OnFire_class + particle_class;
7109 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7110 WPOF_array.Insert(WPOF);
7111 }
7112
7113
7115 }
7116 }
7117
7119 {
7120 config_to_search = "CfgWeapons";
7121 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7122
7123 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7124
7126
7127 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7128 {
7129 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7130
7131 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7132 {
7133 string particle_class2 = "";
7135 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7136 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7137 WPOBE_array.Insert(WPOBE);
7138 }
7139
7140
7142 }
7143 }
7144 }
7145
7146
7148 {
7151
7153 {
7154 string config_to_search = "CfgVehicles";
7155
7156 if (IsInherited(Weapon))
7157 config_to_search = "CfgWeapons";
7158
7159 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7160 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7161
7162 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
7163 {
7164
7166
7168 {
7170 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7172 return;
7173 }
7174
7177
7178
7179
7181 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7182
7183 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7184 {
7185 string particle_class = "";
7187 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7189
7190 if (entry_type == CT_CLASS)
7191 {
7192 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7193 WPOOH_array.Insert(WPOF);
7194 }
7195 }
7196
7197
7199 }
7200 }
7201 }
7202
7204 {
7206 }
7207
7209 {
7211 {
7213
7216
7219
7220 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7221 }
7222 }
7223
7225 {
7227 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7228
7230 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7231
7233 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7234
7236 {
7238 }
7239 }
7240
7242 {
7244 }
7245
7247 {
7250 else
7252
7254 {
7257 }
7258 else
7259 {
7262
7265 }
7266
7268 }
7269
7271 {
7273 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7274 }
7275
7277 {
7279 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7281 }
7282
7284 {
7286 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7287 }
7288
7290 {
7293
7294 OverheatingParticle OP = new OverheatingParticle();
7299
7301 }
7302
7304 {
7307
7308 return -1;
7309 }
7310
7312 {
7314 {
7317
7318 for (int i = count; i > 0; --i)
7319 {
7320 int id = i - 1;
7323
7326
7327 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7328 {
7329 if (p)
7330 {
7333 }
7334 }
7335 }
7336 }
7337 }
7338
7340 {
7342 {
7344 {
7345 int id = i - 1;
7347
7348 if (OP)
7349 {
7351
7352 if (p)
7353 {
7355 }
7356
7357 delete OP;
7358 }
7359 }
7360
7363 }
7364 }
7365
7368 {
7369 return 0.0;
7370 }
7371
7372
7374 {
7375 return 250;
7376 }
7377
7379 {
7380 return 0;
7381 }
7382
7385 {
7387 return true;
7388
7389 return false;
7390 }
7391
7394 {
7397
7399 {
7401 }
7402 else
7403 {
7404
7406 }
7407
7409 }
7410
7417 {
7418 return -1;
7419 }
7420
7421
7422
7423
7425 {
7427 {
7429 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7430
7431 if (r_index >= 0)
7432 {
7433 InventoryLocation r_il = new InventoryLocation;
7434 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7435
7436 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7439 {
7440 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7441 }
7443 {
7444 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7445 }
7446
7447 }
7448
7449 player.GetHumanInventory().ClearUserReservedLocation(this);
7450 }
7451
7454 }
7455
7456
7457
7458
7460 {
7461 return ItemBase.m_DebugActionsMask;
7462 }
7463
7465 {
7466 return ItemBase.m_DebugActionsMask & mask;
7467 }
7468
7470 {
7471 ItemBase.m_DebugActionsMask = mask;
7472 }
7473
7475 {
7476 ItemBase.m_DebugActionsMask |= mask;
7477 }
7478
7480 {
7481 ItemBase.m_DebugActionsMask &= ~mask;
7482 }
7483
7485 {
7487 {
7489 }
7490 else
7491 {
7493 }
7494 }
7495
7496
7498 {
7499 if (GetEconomyProfile())
7500 {
7501 float q_max = GetEconomyProfile().GetQuantityMax();
7502 if (q_max > 0)
7503 {
7504 float q_min = GetEconomyProfile().GetQuantityMin();
7505 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7506
7508 {
7509 ComponentEnergyManager comp = GetCompEM();
7511 {
7513 }
7514 }
7516 {
7518
7519 }
7520
7521 }
7522 }
7523 }
7524
7527 {
7528 EntityAI parent = GetHierarchyParent();
7529
7530 if (parent)
7531 {
7532 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7533 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7534 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7535 }
7536 }
7537
7540 {
7541 EntityAI parent = GetHierarchyParent();
7542
7543 if (parent)
7544 {
7545 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7546 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7547 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7548 }
7549 }
7550
7552 {
7553
7554
7555
7556
7558
7560 {
7561 if (ScriptInputUserData.CanStoreInputUserData())
7562 {
7563 ScriptInputUserData ctx = new ScriptInputUserData;
7569 ctx.
Write(use_stack_max);
7572
7574 {
7575 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7576 }
7577 }
7578 }
7579 else if (!
GetGame().IsMultiplayer())
7580 {
7582 }
7583 }
7584
7586 {
7588 }
7589
7591 {
7593 }
7594
7596 {
7598 }
7599
7601 {
7602
7603 return false;
7604 }
7605
7607 {
7608 return false;
7609 }
7610
7614 {
7615 return false;
7616 }
7617
7619 {
7620 return "";
7621 }
7622
7624
7626 {
7627 return false;
7628 }
7629
7631 {
7632 return true;
7633 }
7634
7635
7636
7638 {
7639 return true;
7640 }
7641
7643 {
7644 return true;
7645 }
7646
7648 {
7649 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7651 }
7652
7654 {
7656 }
7657
7659 {
7661 if (!is_being_placed)
7663 SetSynchDirty();
7664 }
7665
7666
7668
7670 {
7672 }
7673
7675 {
7677 }
7678
7680 {
7681 return 1;
7682 }
7683
7685 {
7686 return false;
7687 }
7688
7690 {
7692 SetSynchDirty();
7693 }
7694
7695
7696
7697
7698
7699
7700
7701
7702
7703
7704
7705
7706
7707
7708
7709
7710
7711
7712
7713
7714
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7730 {
7731 super.OnMovedInsideCargo(container);
7732
7733 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7734 }
7735
7736 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7737 {
7738 super.EEItemLocationChanged(oldLoc,newLoc);
7739
7740 PlayerBase new_player = null;
7741 PlayerBase old_player = null;
7742
7743 if (newLoc.GetParent())
7744 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7745
7746 if (oldLoc.GetParent())
7747 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7748
7750 {
7751 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
7752
7753 if (r_index >= 0)
7754 {
7755 InventoryLocation r_il = new InventoryLocation;
7756 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7757
7758 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7761 {
7762 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7763 }
7765 {
7766 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7767 }
7768
7769 }
7770 }
7771
7773 {
7774 if (new_player)
7775 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
7776
7777 if (new_player == old_player)
7778 {
7779
7780 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7781 {
7783 {
7784 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7785 {
7786 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7787 }
7788 }
7789 else
7790 {
7791 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7792 }
7793 }
7794
7795 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7796 {
7797 int type = oldLoc.GetType();
7799 {
7800 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7801 }
7803 {
7804 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7805 }
7806 }
7807 if (!m_OldLocation)
7808 {
7809 m_OldLocation = new InventoryLocation;
7810 }
7811 m_OldLocation.Copy(oldLoc);
7812 }
7813 else
7814 {
7815 if (m_OldLocation)
7816 {
7817 m_OldLocation.Reset();
7818 }
7819 }
7820
7822 }
7823 else
7824 {
7825 if (new_player)
7826 {
7827 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7828 if (res_index >= 0)
7829 {
7830 InventoryLocation il = new InventoryLocation;
7831 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
7833 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
7836 {
7837 il.
GetParent().GetOnReleaseLock().Invoke(it);
7838 }
7840 {
7842 }
7843
7844 }
7845 }
7847 {
7848
7850 }
7851
7852 if (m_OldLocation)
7853 {
7854 m_OldLocation.Reset();
7855 }
7856 }
7857 }
7858
7859 override void EOnContact(IEntity other, Contact extra)
7860 {
7862 {
7863 int liquidType = -1;
7865 if (impactSpeed > 0.0)
7866 {
7868 #ifndef SERVER
7870 #else
7872 SetSynchDirty();
7873 #endif
7875 }
7876 }
7877
7878 #ifdef SERVER
7879 if (GetCompEM() && GetCompEM().IsPlugged())
7880 {
7881 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7882 GetCompEM().UnplugThis();
7883 }
7884 #endif
7885 }
7886
7888
7890 {
7892 }
7893
7895 {
7896
7897 }
7898
7900 {
7901 super.OnItemLocationChanged(old_owner, new_owner);
7902
7903 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7904 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7905
7906 if (!relatedPlayer && playerNew)
7907 relatedPlayer = playerNew;
7908
7909 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7910 {
7912 if (actionMgr)
7913 {
7914 ActionBase currentAction = actionMgr.GetRunningAction();
7915 if (currentAction)
7917 }
7918 }
7919
7920 Man ownerPlayerOld = null;
7921 Man ownerPlayerNew = null;
7922
7923 if (old_owner)
7924 {
7925 if (old_owner.
IsMan())
7926 {
7927 ownerPlayerOld = Man.Cast(old_owner);
7928 }
7929 else
7930 {
7931 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7932 }
7933 }
7934 else
7935 {
7937 {
7939
7940 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7941 {
7942 GetCompEM().UnplugThis();
7943 }
7944 }
7945 }
7946
7947 if (new_owner)
7948 {
7949 if (new_owner.
IsMan())
7950 {
7951 ownerPlayerNew = Man.Cast(new_owner);
7952 }
7953 else
7954 {
7955 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7956 }
7957 }
7958
7959 if (ownerPlayerOld != ownerPlayerNew)
7960 {
7961 if (ownerPlayerOld)
7962 {
7963 array<EntityAI> subItemsExit = new array<EntityAI>;
7965 for (int i = 0; i < subItemsExit.Count(); i++)
7966 {
7969 }
7970 }
7971
7972 if (ownerPlayerNew)
7973 {
7974 array<EntityAI> subItemsEnter = new array<EntityAI>;
7976 for (int j = 0; j < subItemsEnter.Count(); j++)
7977 {
7980 }
7981 }
7982 }
7983 else if (ownerPlayerNew != null)
7984 {
7985 PlayerBase nplayer;
7986 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
7987 {
7988 array<EntityAI> subItemsUpdate = new array<EntityAI>;
7990 for (int k = 0; k < subItemsUpdate.Count(); k++)
7991 {
7993 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
7994 }
7995 }
7996 }
7997
7998 if (old_owner)
7999 old_owner.OnChildItemRemoved(this);
8000 if (new_owner)
8001 new_owner.OnChildItemReceived(this);
8002 }
8003
8004
8006 {
8007 super.EEDelete(parent);
8008 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8009 if (player)
8010 {
8012
8013 if (player.IsAlive())
8014 {
8015 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8016 if (r_index >= 0)
8017 {
8018 InventoryLocation r_il = new InventoryLocation;
8019 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8020
8021 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8024 {
8025 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8026 }
8028 {
8029 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8030 }
8031
8032 }
8033
8034 player.RemoveQuickBarEntityShortcut(this);
8035 }
8036 }
8037 }
8038
8040 {
8041 super.EEKilled(killer);
8042
8045 {
8046 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8047 {
8048 if (IsMagazine())
8049 {
8050 if (Magazine.Cast(this).GetAmmoCount() > 0)
8051 {
8053 }
8054 }
8055 else
8056 {
8058 }
8059 }
8060 }
8061 }
8062
8064 {
8065 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8066
8067 super.OnWasAttached(parent, slot_id);
8068
8071
8073 }
8074
8076 {
8077 super.OnWasDetached(parent, slot_id);
8078
8081 }
8082
8084 {
8085 int idx;
8088
8089 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8090 if (inventory_slots.Count() < 1)
8091 {
8092 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8093 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8094 }
8095 else
8096 {
8097 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8098 }
8099
8100 idx = inventory_slots.Find(slot);
8101 if (idx < 0)
8102 return "";
8103
8104 return attach_types.Get(idx);
8105 }
8106
8108 {
8109 int idx = -1;
8110 string slot;
8111
8114
8115 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8116 if (inventory_slots.Count() < 1)
8117 {
8118 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8119 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8120 }
8121 else
8122 {
8123 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8124 if (detach_types.Count() < 1)
8125 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8126 }
8127
8128 for (int i = 0; i < inventory_slots.Count(); i++)
8129 {
8130 slot = inventory_slots.Get(i);
8131 }
8132
8133 if (slot != "")
8134 {
8135 if (detach_types.Count() == 1)
8136 idx = 0;
8137 else
8138 idx = inventory_slots.Find(slot);
8139 }
8140 if (idx < 0)
8141 return "";
8142
8143 return detach_types.Get(idx);
8144 }
8145
8147 {
8148
8150
8151
8152 float min_time = 1;
8153 float max_time = 3;
8154 float delay = Math.RandomFloat(min_time, max_time);
8155
8156 explode_timer.Run(delay, this, "DoAmmoExplosion");
8157 }
8158
8160 {
8161 Magazine magazine = Magazine.Cast(this);
8162 int pop_sounds_count = 6;
8163 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8164
8165
8166 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8167 string sound_name = pop_sounds[ sound_idx ];
8169
8170
8171 magazine.ServerAddAmmoCount(-1);
8172
8173
8174 float min_temp_to_explode = 100;
8175
8176 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8177 {
8179 }
8180 }
8181
8182
8183 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8184 {
8185 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8186
8187 const int CHANCE_DAMAGE_CARGO = 4;
8188 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8189 const int CHANCE_DAMAGE_NOTHING = 2;
8190
8192 {
8193 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8194 int chances;
8195 int rnd;
8196
8197 if (GetInventory().GetCargo())
8198 {
8199 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8200 rnd = Math.RandomInt(0,chances);
8201
8202 if (rnd < CHANCE_DAMAGE_CARGO)
8203 {
8205 }
8206 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8207 {
8209 }
8210 }
8211 else
8212 {
8213 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8214 rnd = Math.RandomInt(0,chances);
8215
8216 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8217 {
8219 }
8220 }
8221 }
8222 }
8223
8225 {
8226 if (GetInventory().GetCargo())
8227 {
8228 int item_count = GetInventory().GetCargo().GetItemCount();
8229 if (item_count > 0)
8230 {
8231 int random_pick = Math.RandomInt(0, item_count);
8233 if (!item.IsExplosive())
8234 {
8235 item.AddHealth("","",damage);
8236 return true;
8237 }
8238 }
8239 }
8240 return false;
8241 }
8242
8244 {
8245 int attachment_count = GetInventory().AttachmentCount();
8246 if (attachment_count > 0)
8247 {
8248 int random_pick = Math.RandomInt(0, attachment_count);
8249 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
8250 if (!attachment.IsExplosive())
8251 {
8252 attachment.AddHealth("","",damage);
8253 return true;
8254 }
8255 }
8256 return false;
8257 }
8258
8260 {
8262 }
8263
8265 {
8267 return GetInventory().CanRemoveEntity();
8268
8269 return false;
8270 }
8271
8273 {
8274
8276 return false;
8277
8278
8280 return false;
8281
8282
8283
8285 if (delta == 0)
8286 return false;
8287
8288
8289 return true;
8290 }
8291
8293 {
8295 {
8296 if (ScriptInputUserData.CanStoreInputUserData())
8297 {
8298 ScriptInputUserData ctx = new ScriptInputUserData;
8303 ctx.
Write(destination_entity);
8307 }
8308 }
8309 else if (!
GetGame().IsMultiplayer())
8310 {
8312 }
8313 }
8314
8316 {
8317 float split_quantity_new;
8321 InventoryLocation loc = new InventoryLocation;
8322
8323 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8324 {
8326 split_quantity_new = stack_max;
8327 else
8329
8331 {
8332 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8333 if (new_item)
8334 {
8335 new_item.SetResultOfSplit(true);
8336 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8338 new_item.
SetQuantity(split_quantity_new,
false,
true);
8339 }
8340 }
8341 }
8342 else if (destination_entity && slot_id == -1)
8343 {
8344 if (quantity > stack_max)
8345 split_quantity_new = stack_max;
8346 else
8347 split_quantity_new = quantity;
8348
8350 {
8352 {
8355 }
8356
8357 if (new_item)
8358 {
8359 new_item.SetResultOfSplit(true);
8360 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8362 new_item.
SetQuantity(split_quantity_new,
false,
true);
8363 }
8364 }
8365 }
8366 else
8367 {
8368 if (stack_max != 0)
8369 {
8371 {
8373 }
8374
8375 if (split_quantity_new == 0)
8376 {
8377 if (!
GetGame().IsMultiplayer())
8378 player.PhysicalPredictiveDropItem(this);
8379 else
8380 player.ServerDropEntity(this);
8381 return;
8382 }
8383
8385 {
8387
8388 if (new_item)
8389 {
8390 new_item.SetResultOfSplit(true);
8391 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8394 new_item.PlaceOnSurface();
8395 }
8396 }
8397 }
8398 }
8399 }
8400
8402 {
8403 float split_quantity_new;
8407 InventoryLocation loc = new InventoryLocation;
8408
8409 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8410 {
8412 split_quantity_new = stack_max;
8413 else
8415
8417 {
8418 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8419 if (new_item)
8420 {
8421 new_item.SetResultOfSplit(true);
8422 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8424 new_item.
SetQuantity(split_quantity_new,
false,
true);
8425 }
8426 }
8427 }
8428 else if (destination_entity && slot_id == -1)
8429 {
8430 if (quantity > stack_max)
8431 split_quantity_new = stack_max;
8432 else
8433 split_quantity_new = quantity;
8434
8436 {
8438 {
8441 }
8442
8443 if (new_item)
8444 {
8445 new_item.SetResultOfSplit(true);
8446 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8448 new_item.
SetQuantity(split_quantity_new,
false,
true);
8449 }
8450 }
8451 }
8452 else
8453 {
8454 if (stack_max != 0)
8455 {
8457 {
8459 }
8460
8462 {
8464
8465 if (new_item)
8466 {
8467 new_item.SetResultOfSplit(true);
8468 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8471 new_item.PlaceOnSurface();
8472 }
8473 }
8474 }
8475 }
8476 }
8477
8479 {
8481 {
8482 if (ScriptInputUserData.CanStoreInputUserData())
8483 {
8484 ScriptInputUserData ctx = new ScriptInputUserData;
8489 dst.WriteToContext(ctx);
8491 }
8492 }
8493 else if (!
GetGame().IsMultiplayer())
8494 {
8496 }
8497 }
8498
8500 {
8502 {
8503 if (ScriptInputUserData.CanStoreInputUserData())
8504 {
8505 ScriptInputUserData ctx = new ScriptInputUserData;
8510 ctx.
Write(destination_entity);
8516 }
8517 }
8518 else if (!
GetGame().IsMultiplayer())
8519 {
8521 }
8522 }
8523
8525 {
8527 }
8528
8530 {
8532 float split_quantity_new;
8534 if (dst.IsValid())
8535 {
8536 int slot_id = dst.GetSlot();
8538
8539 if (quantity > stack_max)
8540 split_quantity_new = stack_max;
8541 else
8542 split_quantity_new = quantity;
8543
8545 {
8547
8548 if (new_item)
8549 {
8550 new_item.SetResultOfSplit(true);
8551 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8553 new_item.
SetQuantity(split_quantity_new,
false,
true);
8554 }
8555
8556 return new_item;
8557 }
8558 }
8559
8560 return null;
8561 }
8562
8564 {
8566 float split_quantity_new;
8568 if (destination_entity)
8569 {
8571 if (quantity > stackable)
8572 split_quantity_new = stackable;
8573 else
8574 split_quantity_new = quantity;
8575
8577 {
8578 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8579 if (new_item)
8580 {
8581 new_item.SetResultOfSplit(true);
8582 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8584 new_item.
SetQuantity(split_quantity_new,
false,
true);
8585 }
8586 }
8587 }
8588 }
8589
8591 {
8593 {
8594 if (ScriptInputUserData.CanStoreInputUserData())
8595 {
8596 ScriptInputUserData ctx = new ScriptInputUserData;
8601 ItemBase destination_entity =
this;
8602 ctx.
Write(destination_entity);
8606 }
8607 }
8608 else if (!
GetGame().IsMultiplayer())
8609 {
8611 }
8612 }
8613
8615 {
8617 float split_quantity_new;
8619 if (player)
8620 {
8622 if (quantity > stackable)
8623 split_quantity_new = stackable;
8624 else
8625 split_quantity_new = quantity;
8626
8628 {
8629 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8630 new_item =
ItemBase.Cast(in_hands);
8631 if (new_item)
8632 {
8633 new_item.SetResultOfSplit(true);
8634 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8636 new_item.SetQuantity(split_quantity_new, false, true);
8637 }
8638 }
8639 }
8640 }
8641
8643 {
8645 float split_quantity_new = Math.Floor(quantity * 0.5);
8646
8648 return;
8649
8651
8652 if (new_item)
8653 {
8654 if (new_item.GetQuantityMax() < split_quantity_new)
8655 {
8656 split_quantity_new = new_item.GetQuantityMax();
8657 }
8658
8659 new_item.SetResultOfSplit(true);
8660 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8661
8663 {
8666 }
8667 else
8668 {
8670 new_item.
SetQuantity(split_quantity_new,
false,
true);
8671 }
8672 }
8673 }
8674
8676 {
8678 float split_quantity_new = Math.Floor(quantity / 2);
8679
8681 return;
8682
8683 InventoryLocation invloc = new InventoryLocation;
8685
8687 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8688
8689 if (new_item)
8690 {
8691 if (new_item.GetQuantityMax() < split_quantity_new)
8692 {
8693 split_quantity_new = new_item.GetQuantityMax();
8694 }
8696 {
8699 }
8700 else if (split_quantity_new > 1)
8701 {
8703 new_item.
SetQuantity(split_quantity_new,
false,
true);
8704 }
8705 }
8706 }
8707
8710 {
8711 SetWeightDirty();
8713
8714 if (parent)
8715 parent.OnAttachmentQuantityChangedEx(this, delta);
8716
8718 {
8720 {
8722 }
8724 {
8725 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8727 }
8728 }
8729
8730 }
8731
8734 {
8735
8736 }
8737
8740 {
8742 }
8743
8745 {
8746 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8747
8749 {
8750 if (newLevel == GameConstants.STATE_RUINED)
8751 {
8753 EntityAI parent = GetHierarchyParent();
8754 if (parent && parent.IsFireplace())
8755 {
8756 CargoBase cargo = GetInventory().GetCargo();
8757 if (cargo)
8758 {
8760 {
8762 }
8763 }
8764 }
8765 }
8766
8768 {
8769
8771 return;
8772 }
8773
8774 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8775 {
8777 }
8778 }
8779 }
8780
8781
8783 {
8784 super.OnRightClick();
8785
8787 {
8789 {
8790 if (ScriptInputUserData.CanStoreInputUserData())
8791 {
8792 EntityAI root = GetHierarchyRoot();
8793 Man playerOwner = GetHierarchyRootPlayer();
8794 InventoryLocation dst = new InventoryLocation;
8795
8796
8797 if (!playerOwner && root && root == this)
8798 {
8800 }
8801 else
8802 {
8803
8804 GetInventory().GetCurrentInventoryLocation(dst);
8806 {
8809 {
8811 }
8812 else
8813 {
8815
8816
8817 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8818 {
8820 }
8821 else
8822 {
8823 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8824 }
8825 }
8826 }
8827 }
8828
8829 ScriptInputUserData ctx = new ScriptInputUserData;
8837 }
8838 }
8839 else if (!
GetGame().IsMultiplayer())
8840 {
8842 }
8843 }
8844 }
8845
8847 {
8848 if (root)
8849 {
8850 vector m4[4];
8851 root.GetTransform(m4);
8852 dst.SetGround(this, m4);
8853 }
8854 else
8855 {
8856 GetInventory().GetCurrentInventoryLocation(dst);
8857 }
8858 }
8859
8860 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8861 {
8862
8863 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8864 return false;
8865
8866 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8867 return false;
8868
8869
8871 return false;
8872
8873
8874 Magazine mag = Magazine.Cast(this);
8875 if (mag)
8876 {
8877 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8878 return false;
8879
8880 if (stack_max_limit)
8881 {
8882 Magazine other_mag = Magazine.Cast(other_item);
8883 if (other_item)
8884 {
8885 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8886 return false;
8887 }
8888
8889 }
8890 }
8891 else
8892 {
8893
8895 return false;
8896
8898 return false;
8899 }
8900
8901 PlayerBase player = null;
8902 if (CastTo(player, GetHierarchyRootPlayer()))
8903 {
8904 if (player.GetInventory().HasAttachment(this))
8905 return false;
8906
8907 if (player.IsItemsToDelete())
8908 return false;
8909 }
8910
8911 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8912 return false;
8913
8914 int slotID;
8916 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8917 return false;
8918
8919 return true;
8920 }
8921
8923 {
8925 }
8926
8928 {
8929 return m_IsResultOfSplit;
8930 }
8931
8933 {
8934 m_IsResultOfSplit = value;
8935 }
8936
8938 {
8940 }
8941
8943 {
8944 float other_item_quantity = other_item.GetQuantity();
8945 float this_free_space;
8946
8948
8950
8951 if (other_item_quantity > this_free_space)
8952 {
8953 return this_free_space;
8954 }
8955 else
8956 {
8957 return other_item_quantity;
8958 }
8959 }
8960
8962 {
8964 }
8965
8967 {
8969 return;
8970
8971 if (!IsMagazine() && other_item)
8972 {
8974 if (quantity_used != 0)
8975 {
8976 float hp1 = GetHealth01("","");
8977 float hp2 = other_item.GetHealth01("","");
8978 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8979 hpResult = hpResult / (
GetQuantity() + quantity_used);
8980
8981 hpResult *= GetMaxHealth();
8982 Math.Round(hpResult);
8983 SetHealth("", "Health", hpResult);
8984
8986 other_item.AddQuantity(-quantity_used);
8987 }
8988 }
8990 }
8991
8993 {
8994 #ifdef SERVER
8995 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8996 GetHierarchyParent().IncreaseLifetimeUp();
8997 #endif
8998 };
8999
9001 {
9002 PlayerBase p = PlayerBase.Cast(player);
9003
9004 array<int> recipesIds = p.m_Recipes;
9005 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9006 if (moduleRecipesManager)
9007 {
9008 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
9009 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9010 }
9011
9012 for (int i = 0;i < recipesIds.Count(); i++)
9013 {
9014 int key = recipesIds.Get(i);
9015 string recipeName = moduleRecipesManager.GetRecipeName(key);
9017 }
9018 }
9019
9020
9021 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9022 {
9023 super.GetDebugActions(outputList);
9024
9025
9031
9032
9037
9042
9043
9047
9048
9050 {
9054 }
9055
9058
9059
9063
9065
9066 InventoryLocation loc = new InventoryLocation();
9067 GetInventory().GetCurrentInventoryLocation(loc);
9069 {
9070 if (Gizmo_IsSupported())
9073 }
9074
9076 }
9077
9078
9079
9080
9082 {
9083 super.OnAction(action_id, player, ctx);
9084
9086 {
9087 switch (action_id)
9088 {
9091 return true;
9094 return true;
9095 }
9096 }
9097
9099 {
9100 switch (action_id)
9101 {
9103 Delete();
9104 return true;
9105 }
9106 }
9107
9108 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9109 {
9110 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9111 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9112 PlayerBase p = PlayerBase.Cast(player);
9113 if (
EActions.RECIPES_RANGE_START < 1000)
9114 {
9115 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9116 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9117 }
9118 }
9119 #ifndef SERVER
9120 else if (action_id ==
EActions.WATCH_PLAYER)
9121 {
9122 PluginDeveloper.SetDeveloperItemClientEx(player);
9123 }
9124 #endif
9126 {
9127 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9128 {
9129 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9130 OnDebugButtonPressServer(id + 1);
9131 }
9132
9133 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9134 {
9135 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9137 }
9138
9139 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9140 {
9141 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9143 }
9144
9145 else if (action_id ==
EActions.ADD_QUANTITY)
9146 {
9147 if (IsMagazine())
9148 {
9149 Magazine mag = Magazine.Cast(this);
9150 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9151 }
9152 else
9153 {
9155 }
9156
9157 if (m_EM)
9158 {
9159 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9160 }
9161
9162 }
9163
9164 else if (action_id ==
EActions.REMOVE_QUANTITY)
9165 {
9166 if (IsMagazine())
9167 {
9168 Magazine mag2 = Magazine.Cast(this);
9169 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9170 }
9171 else
9172 {
9174 }
9175 if (m_EM)
9176 {
9177 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9178 }
9179
9180 }
9181
9182 else if (action_id ==
EActions.SET_QUANTITY_0)
9183 {
9185
9186 if (m_EM)
9187 {
9188 m_EM.SetEnergy(0);
9189 }
9190 }
9191
9192 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9193 {
9195
9196 if (m_EM)
9197 {
9198 m_EM.SetEnergy(m_EM.GetEnergyMax());
9199 }
9200 }
9201
9202 else if (action_id ==
EActions.ADD_HEALTH)
9203 {
9204 AddHealth("","",GetMaxHealth("","Health")/5);
9205 }
9206 else if (action_id ==
EActions.REMOVE_HEALTH)
9207 {
9208 AddHealth("","",-GetMaxHealth("","Health")/5);
9209 }
9210 else if (action_id ==
EActions.DESTROY_HEALTH)
9211 {
9212 SetHealth01("","",0);
9213 }
9214 else if (action_id ==
EActions.WATCH_ITEM)
9215 {
9217 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9218 #ifdef DEVELOPER
9219 SetDebugDeveloper_item(this);
9220 #endif
9221 }
9222
9223 else if (action_id ==
EActions.ADD_TEMPERATURE)
9224 {
9225 AddTemperature(20);
9226
9227 }
9228
9229 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9230 {
9231 AddTemperature(-20);
9232
9233 }
9234
9235 else if (action_id ==
EActions.FLIP_FROZEN)
9236 {
9237 SetFrozen(!GetIsFrozen());
9238
9239 }
9240
9241 else if (action_id ==
EActions.ADD_WETNESS)
9242 {
9244
9245 }
9246
9247 else if (action_id ==
EActions.REMOVE_WETNESS)
9248 {
9250
9251 }
9252
9253 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9254 {
9257
9258
9259 }
9260
9261 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9262 {
9265 }
9266
9267 else if (action_id ==
EActions.MAKE_SPECIAL)
9268 {
9269 auto debugParams = DebugSpawnParams.WithPlayer(player);
9270 OnDebugSpawnEx(debugParams);
9271 }
9272
9273 }
9274
9275
9276 return false;
9277 }
9278
9279
9280
9281
9285
9288
9289
9290
9292 {
9293 return false;
9294 }
9295
9296
9298 {
9299 return true;
9300 }
9301
9302
9304 {
9305 return true;
9306 }
9307
9308
9309
9311 {
9312 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9314 }
9315
9318 {
9319 return null;
9320 }
9321
9323 {
9324 return false;
9325 }
9326
9328 {
9329 return false;
9330 }
9331
9335
9336
9338 {
9339 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9340 return module_repairing.CanRepair(this, item_repair_kit);
9341 }
9342
9343
9344 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9345 {
9346 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9347 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9348 }
9349
9350
9352 {
9353
9354
9355
9356
9357
9358
9359
9360
9361 return 1;
9362 }
9363
9364
9365
9367 {
9369 }
9370
9371
9372
9374 {
9376 }
9377
9378
9387 {
9388 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9389
9390 if (player)
9391 {
9392 player.MessageStatus(text);
9393 }
9394 }
9395
9396
9405 {
9406 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9407
9408 if (player)
9409 {
9410 player.MessageAction(text);
9411 }
9412 }
9413
9414
9423 {
9424 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9425
9426 if (player)
9427 {
9428 player.MessageFriendly(text);
9429 }
9430 }
9431
9432
9441 {
9442 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9443
9444 if (player)
9445 {
9446 player.MessageImportant(text);
9447 }
9448 }
9449
9451 {
9452 return true;
9453 }
9454
9455
9456 override bool KindOf(
string tag)
9457 {
9458 bool found = false;
9459 string item_name = this.
GetType();
9462
9463 int array_size = item_tag_array.Count();
9464 for (int i = 0; i < array_size; i++)
9465 {
9466 if (item_tag_array.Get(i) == tag)
9467 {
9468 found = true;
9469 break;
9470 }
9471 }
9472 return found;
9473 }
9474
9475
9477 {
9478
9479 super.OnRPC(sender, rpc_type,ctx);
9480
9481
9482 switch (rpc_type)
9483 {
9484 #ifndef SERVER
9485 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9486 Param2<bool, string> p = new Param2<bool, string>(false, "");
9487
9489 return;
9490
9491 bool play = p.param1;
9492 string soundSet = p.param2;
9493
9494 if (play)
9495 {
9497 {
9499 {
9501 }
9502 }
9503 else
9504 {
9506 }
9507 }
9508 else
9509 {
9511 }
9512
9513 break;
9514 #endif
9515
9516 }
9517
9519 {
9521 }
9522 }
9523
9524
9525
9526
9528 {
9529 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9530 return plugin.GetID(
name);
9531 }
9532
9534 {
9535 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9536 return plugin.GetName(id);
9537 }
9538
9541 {
9542
9543
9544 int varFlags;
9545 if (!ctx.
Read(varFlags))
9546 return;
9547
9548 if (varFlags & ItemVariableFlags.FLOAT)
9549 {
9551 }
9552 }
9553
9555 {
9556
9557 super.SerializeNumericalVars(floats_out);
9558
9559
9560
9562 {
9564 }
9565
9567 {
9569 }
9570
9572 {
9574 }
9575
9577 {
9582 }
9583
9585 {
9587 }
9588 }
9589
9591 {
9592
9593 super.DeSerializeNumericalVars(floats);
9594
9595
9596 int index = 0;
9597 int mask = Math.Round(floats.Get(index));
9598
9599 index++;
9600
9602 {
9604 {
9606 }
9607 else
9608 {
9609 float quantity = floats.Get(index);
9611 }
9612 index++;
9613 }
9614
9616 {
9617 float wet = floats.Get(index);
9619 index++;
9620 }
9621
9623 {
9624 int liquidtype = Math.Round(floats.Get(index));
9626 index++;
9627 }
9628
9630 {
9632 index++;
9634 index++;
9636 index++;
9638 index++;
9639 }
9640
9642 {
9643 int cleanness = Math.Round(floats.Get(index));
9645 index++;
9646 }
9647 }
9648
9650 {
9651 super.WriteVarsToCTX(ctx);
9652
9653
9655 {
9657 }
9658
9660 {
9662 }
9663
9665 {
9667 }
9668
9670 {
9671 int r,g,b,a;
9677 }
9678
9680 {
9682 }
9683 }
9684
9686 {
9687 if (!super.ReadVarsFromCTX(ctx,version))
9688 return false;
9689
9690 int intValue;
9691 float value;
9692
9693 if (version < 140)
9694 {
9695 if (!ctx.
Read(intValue))
9696 return false;
9697
9698 m_VariablesMask = intValue;
9699 }
9700
9702 {
9703 if (!ctx.
Read(value))
9704 return false;
9705
9707 {
9709 }
9710 else
9711 {
9713 }
9714 }
9715
9716 if (version < 140)
9717 {
9719 {
9720 if (!ctx.
Read(value))
9721 return false;
9722 SetTemperatureDirect(value);
9723 }
9724 }
9725
9727 {
9728 if (!ctx.
Read(value))
9729 return false;
9731 }
9732
9734 {
9735 if (!ctx.
Read(intValue))
9736 return false;
9738 }
9739
9741 {
9742 int r,g,b,a;
9744 return false;
9746 return false;
9748 return false;
9750 return false;
9751
9753 }
9754
9756 {
9757 if (!ctx.
Read(intValue))
9758 return false;
9760 }
9761
9762 if (version >= 138 && version < 140)
9763 {
9765 {
9766 if (!ctx.
Read(intValue))
9767 return false;
9768 SetFrozen(intValue);
9769 }
9770 }
9771
9772 return true;
9773 }
9774
9775
9777 {
9780 {
9782 }
9783
9784 if (!super.OnStoreLoad(ctx, version))
9785 {
9787 return false;
9788 }
9789
9790 if (version >= 114)
9791 {
9792 bool hasQuickBarIndexSaved;
9793
9794 if (!ctx.
Read(hasQuickBarIndexSaved))
9795 {
9797 return false;
9798 }
9799
9800 if (hasQuickBarIndexSaved)
9801 {
9802 int itmQBIndex;
9803
9804
9805 if (!ctx.
Read(itmQBIndex))
9806 {
9808 return false;
9809 }
9810
9811 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9812 if (itmQBIndex != -1 && parentPlayer)
9813 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9814 }
9815 }
9816 else
9817 {
9818
9819 PlayerBase player;
9820 int itemQBIndex;
9821 if (version ==
int.
MAX)
9822 {
9823 if (!ctx.
Read(itemQBIndex))
9824 {
9826 return false;
9827 }
9828 }
9829 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9830 {
9831
9832 if (!ctx.
Read(itemQBIndex))
9833 {
9835 return false;
9836 }
9837 if (itemQBIndex != -1 && player)
9838 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9839 }
9840 }
9841
9842 if (version < 140)
9843 {
9844
9845 if (!LoadVariables(ctx, version))
9846 {
9848 return false;
9849 }
9850 }
9851
9852
9854 {
9856 return false;
9857 }
9858 if (version >= 132)
9859 {
9861 if (raib)
9862 {
9864 {
9866 return false;
9867 }
9868 }
9869 }
9870
9872 return true;
9873 }
9874
9875
9876
9878 {
9879 super.OnStoreSave(ctx);
9880
9881 PlayerBase player;
9882 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9883 {
9885
9886 int itemQBIndex = -1;
9887 itemQBIndex = player.FindQuickBarEntityIndex(this);
9888 ctx.
Write(itemQBIndex);
9889 }
9890 else
9891 {
9893 }
9894
9896
9898 if (raib)
9899 {
9901 }
9902 }
9903
9904
9906 {
9907 super.AfterStoreLoad();
9908
9910 {
9912 }
9913
9915 {
9918 }
9919 }
9920
9922 {
9923 super.EEOnAfterLoad();
9924
9926 {
9928 }
9929
9932 }
9933
9935 {
9936 return false;
9937 }
9938
9939
9940
9942 {
9944 {
9945 #ifdef PLATFORM_CONSOLE
9946
9948 {
9950 if (menu)
9951 {
9953 }
9954 }
9955 #endif
9956 }
9957
9959 {
9962 }
9963
9965 {
9966 SetWeightDirty();
9968 }
9970 {
9973 }
9974
9976 {
9979 }
9981 {
9984 }
9985
9986 super.OnVariablesSynchronized();
9987 }
9988
9989
9990
9992 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9993 {
9994 if (!IsServerCheck(allow_client))
9995 return false;
9996
9998 return false;
9999
10002
10003 if (value <= (min + 0.001))
10004 value = min;
10005
10006 if (value == min)
10007 {
10008 if (destroy_config)
10009 {
10010 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10011 if (dstr)
10012 {
10014 this.Delete();
10015 return true;
10016 }
10017 }
10018 else if (destroy_forced)
10019 {
10021 this.Delete();
10022 return true;
10023 }
10024
10026 }
10027
10030
10032 {
10034
10035 if (delta)
10037 }
10038
10040
10041 return false;
10042 }
10043
10044
10046 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10047 {
10049 }
10050
10052 {
10055 }
10056
10058 {
10061 }
10062
10064 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10065 {
10066 float value_clamped = Math.Clamp(value, 0, 1);
10068 SetQuantity(result, destroy_config, destroy_forced);
10069 }
10070
10071
10074 {
10076 }
10077
10079 {
10081 }
10082
10083
10084
10085
10086
10087
10088
10089
10090
10091
10093 {
10094 int slot = -1;
10095 if (GetInventory())
10096 {
10097 InventoryLocation il = new InventoryLocation;
10098 GetInventory().GetCurrentInventoryLocation(il);
10100 }
10101
10103 }
10104
10106 {
10107 float quantity_max = 0;
10108
10110 {
10111 if (attSlotID != -1)
10112 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10113
10114 if (quantity_max <= 0)
10116 }
10117
10118 if (quantity_max <= 0)
10120
10121 return quantity_max;
10122 }
10123
10125 {
10127 }
10128
10130 {
10132 }
10133
10134
10136 {
10138 }
10139
10141 {
10143 }
10144
10146 {
10148 }
10149
10150
10152 {
10153
10154 float weightEx = GetWeightEx();
10155 float special = GetInventoryAndCargoWeight();
10156 return weightEx - special;
10157 }
10158
10159
10161 {
10163 }
10164
10166 {
10168 {
10169 #ifdef DEVELOPER
10170 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10171 {
10172 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10174 }
10175 #endif
10176
10177 return GetQuantity() * GetConfigWeightModified();
10178 }
10179 else if (HasEnergyManager())
10180 {
10181 #ifdef DEVELOPER
10182 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10183 {
10184 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10185 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10186 }
10187 #endif
10188 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10189 }
10190 else
10191 {
10192 #ifdef DEVELOPER
10193 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10194 {
10195 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10196 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10197 }
10198 #endif
10199 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10200 }
10201 }
10202
10205 {
10206 int item_count = 0;
10208
10209 if (GetInventory().GetCargo() != NULL)
10210 {
10211 item_count = GetInventory().GetCargo().GetItemCount();
10212 }
10213
10214 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
10215 {
10216 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
10217 if (item)
10218 item_count += item.GetNumberOfItems();
10219 }
10220 return item_count;
10221 }
10222
10225 {
10226 float weight = 0;
10227 float wetness = 1;
10228 if (include_wetness)
10231 {
10232 weight = wetness * m_ConfigWeight;
10233 }
10235 {
10236 weight = 1;
10237 }
10238 return weight;
10239 }
10240
10241
10242
10244 {
10245 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
10246 {
10247 GameInventory inv = GetInventory();
10248 array<EntityAI> items = new array<EntityAI>;
10250 for (int i = 0; i < items.Count(); i++)
10251 {
10253 if (item)
10254 {
10256 }
10257 }
10258 }
10259 }
10260
10261
10262
10263
10265 {
10266 float energy = 0;
10267 if (HasEnergyManager())
10268 {
10269 energy = GetCompEM().GetEnergy();
10270 }
10271 return energy;
10272 }
10273
10274
10276 {
10277 super.OnEnergyConsumed();
10278
10280 }
10281
10283 {
10284 super.OnEnergyAdded();
10285
10287 }
10288
10289
10291 {
10292 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10293 {
10295 {
10296 float energy_0to1 = GetCompEM().GetEnergy0To1();
10298 }
10299 }
10300 }
10301
10302
10304 {
10305 return ConfigGetFloat("heatIsolation");
10306 }
10307
10309 {
10311 }
10312
10314 {
10315 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10316 if (
GetGame().ConfigIsExisting(paramPath))
10318
10319 return 0.0;
10320 }
10321
10323 {
10324 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10325 if (
GetGame().ConfigIsExisting(paramPath))
10327
10328 return 0.0;
10329 }
10330
10331 override void SetWet(
float value,
bool allow_client =
false)
10332 {
10333 if (!IsServerCheck(allow_client))
10334 return;
10335
10338
10340
10341 m_VarWet = Math.Clamp(value, min, max);
10342
10344 {
10347 }
10348 }
10349
10350 override void AddWet(
float value)
10351 {
10353 }
10354
10356 {
10358 }
10359
10361 {
10363 }
10364
10366 {
10368 }
10369
10371 {
10373 }
10374
10376 {
10378 }
10379
10380 override void OnWetChanged(
float newVal,
float oldVal)
10381 {
10384 if (newLevel != oldLevel)
10385 {
10387 }
10388 }
10389
10391 {
10392 SetWeightDirty();
10393 }
10394
10396 {
10397 return GetWetLevelInternal(
m_VarWet);
10398 }
10399
10400
10401
10403 {
10405 }
10406
10408 {
10410 }
10411
10413 {
10415 }
10416
10418 {
10420 }
10421
10422
10423
10425 {
10426 if (ConfigIsExisting("itemModelLength"))
10427 {
10428 return ConfigGetFloat("itemModelLength");
10429 }
10430 return 0;
10431 }
10432
10434 {
10435 if (ConfigIsExisting("itemAttachOffset"))
10436 {
10437 return ConfigGetFloat("itemAttachOffset");
10438 }
10439 return 0;
10440 }
10441
10442 override void SetCleanness(
int value,
bool allow_client =
false)
10443 {
10444 if (!IsServerCheck(allow_client))
10445 return;
10446
10448
10450
10453 }
10454
10456 {
10458 }
10459
10461 {
10462 return true;
10463 }
10464
10465
10466
10467
10469 {
10471 }
10472
10474 {
10476 }
10477
10478
10479
10480
10481 override void SetColor(
int r,
int g,
int b,
int a)
10482 {
10488 }
10490 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10491 {
10496 }
10497
10499 {
10501 }
10502
10505 {
10506 int r,g,b,a;
10508 r = r/255;
10509 g = g/255;
10510 b = b/255;
10511 a = a/255;
10512 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10513 }
10514
10515
10516
10517 override void SetLiquidType(
int value,
bool allow_client =
false)
10518 {
10519 if (!IsServerCheck(allow_client))
10520 return;
10521
10526 }
10527
10529 {
10530 return ConfigGetInt("varLiquidTypeInit");
10531 }
10532
10534 {
10536 }
10537
10539 {
10541 SetFrozen(false);
10542 }
10543
10546 {
10547 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10548 }
10549
10550
10553 {
10554 PlayerBase nplayer;
10555 if (PlayerBase.CastTo(nplayer, player))
10556 {
10558
10559 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10560 }
10561 }
10562
10563
10566 {
10567 PlayerBase nplayer;
10568 if (PlayerBase.CastTo(nplayer,player))
10569 {
10570
10571 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10572
10573 }
10574
10575
10576 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10577
10578
10579 if (HasEnergyManager())
10580 {
10581 GetCompEM().UpdatePlugState();
10582 }
10583 }
10584
10585
10587 {
10588 super.OnPlacementStarted(player);
10589
10591 }
10592
10593 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10594 {
10596 {
10597 m_AdminLog.OnPlacementComplete(player,
this);
10598 }
10599
10600 super.OnPlacementComplete(player, position, orientation);
10601 }
10602
10603
10604
10605
10606
10608 {
10610 {
10611 return true;
10612 }
10613 else
10614 {
10615 return false;
10616 }
10617 }
10618
10619
10621 {
10623 {
10625 }
10626 }
10627
10628
10630 {
10632 }
10633
10635 {
10637 }
10638
10639 override void InsertAgent(
int agent,
float count = 1)
10640 {
10641 if (count < 1)
10642 return;
10643
10645 }
10646
10649 {
10651 }
10652
10653
10655 {
10657 }
10658
10659
10660
10661
10662
10663
10664
10665
10666
10667
10668
10669
10670
10671
10672
10673
10674
10675
10676
10677
10678
10679
10680
10681
10682
10683
10684
10685
10686
10687
10688
10689
10690
10691
10692
10693
10694
10695
10696
10697
10698
10699
10701 {
10703 return false;
10704 return true;
10705 }
10706
10708 {
10709
10711 }
10712
10713
10716 {
10717 super.CheckForRoofLimited(timeTresholdMS);
10718
10720 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10721 {
10722 m_PreviousRoofTestTime = time;
10723 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10724 }
10725 }
10726
10727
10729 {
10731 {
10732 return 0;
10733 }
10734
10735 if (GetInventory().GetAttachmentSlotsCount() != 0)
10736 {
10737 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10738 if (filter)
10739 return filter.GetProtectionLevel(type, false, system);
10740 else
10741 return 0;
10742 }
10743
10744 string subclassPath, entryName;
10745
10746 switch (type)
10747 {
10749 entryName = "biological";
10750 break;
10752 entryName = "chemical";
10753 break;
10754 default:
10755 entryName = "biological";
10756 break;
10757 }
10758
10759 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10760
10762 }
10763
10764
10765
10768 {
10769 if (!IsMagazine())
10771
10773 }
10774
10775
10776
10777
10778
10783 {
10784 return true;
10785 }
10786
10788 {
10790 }
10791
10792
10793
10794
10795
10797 {
10798 if (parent)
10799 {
10800 if (parent.IsInherited(DayZInfected))
10801 return true;
10802
10803 if (!parent.IsRuined())
10804 return true;
10805 }
10806
10807 return true;
10808 }
10809
10811 {
10812 if (!super.CanPutAsAttachment(parent))
10813 {
10814 return false;
10815 }
10816
10817 if (!IsRuined() && !parent.IsRuined())
10818 {
10819 return true;
10820 }
10821
10822 return false;
10823 }
10824
10826 {
10827
10828
10829
10830
10831 return super.CanReceiveItemIntoCargo(item);
10832 }
10833
10835 {
10836
10837
10838
10839
10840 GameInventory attachmentInv = attachment.GetInventory();
10842 {
10843 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10844 return false;
10845 }
10846
10847 InventoryLocation loc = new InventoryLocation();
10848 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10849 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10850 return false;
10851
10852 return super.CanReceiveAttachment(attachment, slotId);
10853 }
10854
10856 {
10857 if (!super.CanReleaseAttachment(attachment))
10858 return false;
10859
10860 return GetInventory().AreChildrenAccessible();
10861 }
10862
10863
10864
10865
10866
10867
10868
10869
10870
10871
10872
10873
10874
10875
10876
10877
10878
10879
10880
10881
10882
10884 {
10885 int id = muzzle_owner.GetMuzzleID();
10886 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10887
10888 if (WPOF_array)
10889 {
10890 for (int i = 0; i < WPOF_array.Count(); i++)
10891 {
10892 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10893
10894 if (WPOF)
10895 {
10896 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10897 }
10898 }
10899 }
10900 }
10901
10902
10904 {
10905 int id = muzzle_owner.GetMuzzleID();
10907
10908 if (WPOBE_array)
10909 {
10910 for (int i = 0; i < WPOBE_array.Count(); i++)
10911 {
10912 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10913
10914 if (WPOBE)
10915 {
10916 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10917 }
10918 }
10919 }
10920 }
10921
10922
10924 {
10925 int id = muzzle_owner.GetMuzzleID();
10926 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10927
10928 if (WPOOH_array)
10929 {
10930 for (int i = 0; i < WPOOH_array.Count(); i++)
10931 {
10932 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10933
10934 if (WPOOH)
10935 {
10936 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10937 }
10938 }
10939 }
10940 }
10941
10942
10944 {
10945 int id = muzzle_owner.GetMuzzleID();
10946 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10947
10948 if (WPOOH_array)
10949 {
10950 for (int i = 0; i < WPOOH_array.Count(); i++)
10951 {
10952 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10953
10954 if (WPOOH)
10955 {
10956 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10957 }
10958 }
10959 }
10960 }
10961
10962
10964 {
10965 int id = muzzle_owner.GetMuzzleID();
10966 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10967
10968 if (WPOOH_array)
10969 {
10970 for (int i = 0; i < WPOOH_array.Count(); i++)
10971 {
10972 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10973
10974 if (WPOOH)
10975 {
10976 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10977 }
10978 }
10979 }
10980 }
10981
10982
10983
10985 {
10987 {
10988 return true;
10989 }
10990
10991 return false;
10992 }
10993
10995 {
10997 {
10998 return true;
10999 }
11000
11001 return false;
11002 }
11003
11005 {
11007 {
11008 return true;
11009 }
11010
11011 return false;
11012 }
11013
11015 {
11016 return false;
11017 }
11018
11021 {
11022 return UATimeSpent.DEFAULT_DEPLOY;
11023 }
11024
11025
11026
11027
11029 {
11031 SetSynchDirty();
11032 }
11033
11035 {
11037 }
11038
11039
11041 {
11042 return false;
11043 }
11044
11047 {
11048 string att_type = "None";
11049
11050 if (ConfigIsExisting("soundAttType"))
11051 {
11052 att_type = ConfigGetString("soundAttType");
11053 }
11054
11056 }
11057
11059 {
11061 }
11062
11063
11064
11065
11066
11072
11074 {
11077
11079 }
11080
11081
11083 {
11085 return;
11086
11088
11091
11094
11095 SoundParameters params = new SoundParameters();
11099 }
11100
11101
11103 {
11105 return;
11106
11108 SetSynchDirty();
11109
11112 }
11113
11114
11116 {
11118 return;
11119
11121 SetSynchDirty();
11122
11125 }
11126
11128 {
11130 }
11131
11133 {
11135 }
11136
11139 {
11140 if (!
GetGame().IsDedicatedServer())
11141 {
11142 if (ConfigIsExisting("attachSoundSet"))
11143 {
11144 string cfg_path = "";
11145 string soundset = "";
11146 string type_name =
GetType();
11147
11150 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11151 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11152
11153 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11154 {
11155 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11156 {
11157 if (cfg_slot_array[i] == slot_type)
11158 {
11159 soundset = cfg_soundset_array[i];
11160 break;
11161 }
11162 }
11163 }
11164
11165 if (soundset != "")
11166 {
11167 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11169 }
11170 }
11171 }
11172 }
11173
11175 {
11176
11177 }
11178
11179 void OnApply(PlayerBase player);
11180
11182 {
11183 return 1.0;
11184 };
11185
11187 {
11189 }
11190
11192 {
11194 }
11195
11197
11199 {
11200 SetDynamicPhysicsLifeTime(0.01);
11202 }
11203
11205 {
11206 array<string> zone_names = new array<string>;
11207 GetDamageZones(zone_names);
11208 for (int i = 0; i < zone_names.Count(); i++)
11209 {
11210 SetHealthMax(zone_names.Get(i),"Health");
11211 }
11212 SetHealthMax("","Health");
11213 }
11214
11217 {
11218 float global_health = GetHealth01("","Health");
11219 array<string> zones = new array<string>;
11220 GetDamageZones(zones);
11221
11222 for (int i = 0; i < zones.Count(); i++)
11223 {
11224 SetHealth01(zones.Get(i),"Health",global_health);
11225 }
11226 }
11227
11230 {
11231 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11232 }
11233
11235 {
11236 if (!hasRootAsPlayer)
11237 {
11238 if (refParentIB)
11239 {
11240
11241 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11242 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11243
11244 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11245 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11246
11249 }
11250 else
11251 {
11252
11255 }
11256 }
11257 }
11258
11260 {
11262 {
11263 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11264 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11265 {
11266 float heatPermCoef = 1.0;
11268 while (ent)
11269 {
11270 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11271 ent = ent.GetHierarchyParent();
11272 }
11273
11274 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11275 }
11276 }
11277 }
11278
11280 {
11281
11282 EntityAI parent = GetHierarchyParent();
11283 if (!parent)
11284 {
11285 hasParent = false;
11286 hasRootAsPlayer = false;
11287 }
11288 else
11289 {
11290 hasParent = true;
11291 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11292 refParentIB =
ItemBase.Cast(parent);
11293 }
11294 }
11295
11296 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11297 {
11298
11299 }
11300
11302 {
11303
11304 return false;
11305 }
11306
11308 {
11309
11310
11311 return false;
11312 }
11313
11315 {
11316
11317 return false;
11318 }
11319
11322 {
11323 return !GetIsFrozen() &&
IsOpen();
11324 }
11325
11327 {
11328 bool hasParent = false, hasRootAsPlayer = false;
11330
11331 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11332 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11333
11334 if (wwtu || foodDecay)
11335 {
11339
11340 if (processWetness || processTemperature || processDecay)
11341 {
11343
11344 if (processWetness)
11345 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11346
11347 if (processTemperature)
11349
11350 if (processDecay)
11351 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11352 }
11353 }
11354 }
11355
11358 {
11360 }
11361
11363 {
11366
11367 return super.GetTemperatureFreezeThreshold();
11368 }
11369
11371 {
11374
11375 return super.GetTemperatureThawThreshold();
11376 }
11377
11379 {
11382
11383 return super.GetItemOverheatThreshold();
11384 }
11385
11387 {
11389 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11390
11391 return super.GetTemperatureFreezeTime();
11392 }
11393
11395 {
11397 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11398
11399 return super.GetTemperatureThawTime();
11400 }
11401
11406
11408 {
11409 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11410 }
11411
11413 {
11414 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11415 }
11416
11419 {
11421 }
11422
11424 {
11426 }
11427
11429 {
11431 }
11432
11435 {
11436 return null;
11437 }
11438
11441 {
11442 return false;
11443 }
11444
11446 {
11448 {
11451 if (!trg)
11452 {
11454 explosive = this;
11455 }
11456
11457 explosive.PairRemote(trg);
11459
11460 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11461 trg.SetPersistentPairID(persistentID);
11462 explosive.SetPersistentPairID(persistentID);
11463
11464 return true;
11465 }
11466 return false;
11467 }
11468
11471 {
11472 float ret = 1.0;
11475 ret *= GetHealth01();
11476
11477 return ret;
11478 }
11479
11480 #ifdef DEVELOPER
11481 override void SetDebugItem()
11482 {
11483 super.SetDebugItem();
11484 _itemBase = this;
11485 }
11486
11488 {
11489 string text = super.GetDebugText();
11490
11492 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11493
11494 return text;
11495 }
11496 #endif
11497
11499 {
11500 return true;
11501 }
11502
11504
11506
11508 {
11511 }
11512
11513
11521
11537}
11538
11540{
11542 if (entity)
11543 {
11544 bool is_item = entity.IsInherited(
ItemBase);
11545 if (is_item && full_quantity)
11546 {
11549 }
11550 }
11551 else
11552 {
11554 return NULL;
11555 }
11556 return entity;
11557}
11558
11560{
11561 if (item)
11562 {
11563 if (health > 0)
11564 item.SetHealth("", "", health);
11565
11566 if (item.CanHaveTemperature())
11567 {
11569 if (item.CanFreeze())
11570 item.SetFrozen(false);
11571 }
11572
11573 if (item.HasEnergyManager())
11574 {
11575 if (quantity >= 0)
11576 {
11577 item.GetCompEM().SetEnergy0To1(quantity);
11578 }
11579 else
11580 {
11582 }
11583 }
11584 else if (item.IsMagazine())
11585 {
11586 Magazine mag = Magazine.Cast(item);
11587 if (quantity >= 0)
11588 {
11589 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11590 }
11591 else
11592 {
11594 }
11595
11596 }
11597 else
11598 {
11599 if (quantity >= 0)
11600 {
11601 item.SetQuantityNormalized(quantity, false);
11602 }
11603 else
11604 {
11606 }
11607
11608 }
11609 }
11610}
11611
11612#ifdef DEVELOPER
11614#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
void ActionManagerBase(PlayerBase player)
map< typename, ref array< ActionBase_Basic > > TInputActionMap
void AddAction(typename actionName)
void RemoveAction(typename actionName)
TInputActionMap m_InputActionMap
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
const int ECE_PLACE_ON_SURFACE
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
Open
Implementations only.
override void EEOnCECreate()
DamageType
exposed from C++ (do not change)
PluginAdminLog m_AdminLog
override bool IsExplosive()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
static bool HasDebugActionsMask(int mask)
bool HidesSelectionBySlot()
void SplitItem(PlayerBase player)
void CopyScriptPropertiesFrom(EntityAI oldItem)
override void InsertAgent(int agent, float count=1)
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
static void SetDebugActionsMask(int mask)
void SetIsDeploySound(bool is_deploy_sound)
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
override bool IsHeavyBehaviour()
override void SetWetMax()
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
void ClearStartItemSoundServer()
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
override void RemoveAllAgentsExcept(int agent_to_keep)
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
bool CanBeMovedOverride()
override void SetWet(float value, bool allow_client=false)
ref TIntArray m_SingleUseActions
override void ProcessVariables()
ref TStringArray m_HeadHidingSelections
float GetWeightSpecialized(bool forceRecalc=false)
bool LoadAgents(ParamsReadContext ctx, int version)
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
ref array< ref OverheatingParticle > m_OverheatingParticles
override float GetTemperatureFreezeThreshold()
bool m_IsSoundSynchRemote
void StopItemSoundServer(int id)
static void ToggleDebugActionsMask(int mask)
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetTemperatureFreezeTime()
ref array< int > m_CompatibleLocks
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
float m_TemperaturePerQuantityWeight
bool m_RecipesInitialized
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
override float GetTemperatureThawThreshold()
override void OnEnergyConsumed()
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
override EWetnessLevel GetWetLevel()
float GetSingleInventoryItemWeight()
ref TIntArray m_InteractActions
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
bool CanPlayDeployLoopSound()
override float GetWetMax()
bool CanBeUsedForSuicide()
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
void StartItemSoundServer(int id)
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
bool m_CanBeMovedOverride
override string ChangeIntoOnAttach(string slot)
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
ScriptedLightBase GetLight()
string GetPlaceSoundset()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
override float GetQuantity()
int m_ShotsToStartOverheating
override void OnWetChanged(float newVal, float oldVal)
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void OnOverheatingDecay()
float GetDryingIncrement(string pIncrementName)
void SoundSynchRemoteReset()
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
override bool CanReleaseAttachment(EntityAI attachment)
override void OnMovedInsideCargo(EntityAI container)
void SetCEBasedQuantity()
bool m_CanPlayImpactSound
override string GetAttachmentSoundType()
float GetOverheatingCoef()
array< string > GetHeadHidingSelection()
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
override bool IsStoreLoad()
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
void SetResultOfSplit(bool value)
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
void UpdateAllOverheatingParticles()
float GetSoakingIncrement(string pIncrementName)
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetStoreLoadedQuantity()
const int ITEM_SOUNDS_MAX
float GetItemModelLength()
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
void CombineItems(ItemBase other_item, bool use_stack_max=true)
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
void TransferAgents(int agents)
transfer agents from another item
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
float GetHeatIsolationInit()
void SetCanBeMovedOverride(bool setting)
override bool HasQuantity()
bool IsCargoException4x3(EntityAI item)
ref TIntArray m_ContinuousActions
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
void LoadParticleConfigOnFire(int id)
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
override float GetWetInit()
int m_ImpactSoundSurfaceHash
int m_MaxOverheatingValue
void SetupSpawnedItem(ItemBase item, float health, float quantity)
bool ShouldSplitQuantity(float quantity)
static ref map< string, int > m_WeaponTypeToID
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
array< int > GetValidFinishers()
returns an array of possible finishers
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
ItemSoundHandler GetItemSoundHandler()
override int GetQuantityMin()
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
override int GetQuickBarBonus()
override void SetTakeable(bool pState)
float m_OverheatingDecayInterval
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
void RemoveAudioVisualsOnClient()
static void AddDebugActionsMask(int mask)
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
bool CanRepair(ItemBase item_repair_kit)
bool can_this_be_combined
EffectSound m_SoundDeploy
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
float GetDeployTime()
how long it takes to deploy this item in seconds
override bool IsSplitable()
bool DamageItemAttachments(float damage)
override void WriteVarsToCTX(ParamsWriteContext ctx)
void ConvertEnergyToQuantity()
override void RemoveAllAgents()
override void SetQuantityToMinimum()
bool m_WantPlayImpactSound
override float GetTemperatureThawTime()
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
float m_StoreLoadedQuantity
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
float GetFilterDamageRatio()
override void SetLiquidType(int value, bool allow_client=false)
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
void OnApply(PlayerBase player)
override void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
ref Timer m_CheckOverheating
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override bool IsOneHandedBehaviour()
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
override float GetSingleInventoryItemWeightEx()
void SaveAgents(ParamsWriteContext ctx)
override int GetTargetQuantityMax(int attSlotID=-1)
float GetDisinfectQuantity(int system=0, Param param1=null)
override bool IsHologram()
float GetItemAttachOffset()
static int GetDebugActionsMask()
void ProcessDecay(float delta, bool hasRootAsPlayer)
override bool IsItemBase()
override bool IsTwoHandedBehaviour()
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override void OnEnergyAdded()
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
EffectSound m_DeployLoopSoundEx
override void DeSerializeNumericalVars(array< float > floats)
void StopItemDynamicPhysics()
override void SetStoreLoad(bool value)
float GetOverheatingValue()
bool ContainsAgent(int agent_id)
override void AddWet(float value)
override void EOnContact(IEntity other, Contact extra)
void SplitIntoStackMaxHands(PlayerBase player)
void SplitIntoStackMaxHandsClient(PlayerBase player)
ref Timer m_PhysDropTimer
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
override void SetStoreLoadedQuantity(float value)
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
void OnLiquidTypeChanged(int oldType, int newType)
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void PlayDeployFinishSound()
bool AllowFoodConsumption()
bool m_IsOverheatingEffectActive
int m_LiquidContainerMask
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override int GetCleanness()
bool PairWithDevice(notnull ItemBase otherDevice)
static void RemoveDebugActionsMask(int mask)
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void PerformDamageSystemReinit()
override void ClearInventory()
static int m_LastRegisteredWeaponID
ItemBase GetLightSourceItem()
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
override float GetItemOverheatThreshold()
void StopDeployLoopSoundEx()
override void SerializeNumericalVars(array< float > floats_out)
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
static int m_DebugActionsMask
void KillAllOverheatingParticles()
bool CanBeCookedOnStick()
override int GetQuantityMax()
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
void OnActivatedByTripWire()
override void RemoveAgent(int agent_id)
bool m_ItemBeingDroppedPhys
override bool CanPutAsAttachment(EntityAI parent)
void PlayDetachSound(string slot_type)
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override bool IsBeingPlaced()
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
bool m_FixDamageSystemInit
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
void LoadParticleConfigOnOverheating(int id)
bool IsSoundSynchRemote()
override void OnRightClick()
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
bool IsActionTargetVisible()
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
int NameToID(string name)
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
void ClearStopItemSoundServer()
override string ChangeIntoOnDetach()
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
EffectSound m_SoundDeployFinish
float GetQuantityNormalizedScripted()
override void SetCleanness(int value, bool allow_client=false)
override float GetWetMin()
ref ItemSoundHandler m_ItemSoundHandler
override bool KindOf(string tag)
void ItemSoundHandler(ItemBase parent)
EffectSound m_LockingSound
void PluginItemDiagnostic()
PluginBase GetPlugin(typename plugin_type)
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
void RemoteDetonatorTrigger()
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
override void Explode(int damageType, string ammoType="")
void OnItemLocationChanged(ItemBase item)
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
proto native void GizmoSelectObject(Object object)
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto native void GizmoSelectPhysics(Physics physics)
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
bool WriteToContext(ParamsWriteContext ctx)
proto native int GetType()
returns type of InventoryLocation
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native bool GetFlip()
returns flip status of cargo
proto native EntityAI GetItem()
returns item of current inventory location
override bool CanDisplayCargo()
override void OnInventoryEnter(Man player)
override string GetFoldSoundset()
override bool CanPutAsAttachment(EntityAI parent)
override bool CanReceiveItemIntoCargo(EntityAI item)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override void OnWasDetached(EntityAI parent, int slot_id)
override void EEOnAfterLoad()
override void EEDelete(EntityAI parent)
override bool CanBeRepairedByCrafting()
override void OnPlacementStarted(Man player)
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
override bool IsElectricAppliance()
override bool IsItemTent()
override void SetActions()
override string GetLoopFoldSoundset()
override bool CanMakeGardenplot()
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override WrittenNoteData GetWrittenNoteData()
override int GetDamageSystemVersionChange()
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
override void InitItemVariables()
override void SetActionAnimOverrides()
override void OnCreatePhysics()
override string GetDeploySoundset()
override float GetBandagingEffectivity()
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
override void OnStoreSave(ParamsWriteContext ctx)
override void AfterStoreLoad()
override int GetOnDigWormsAmount()
override bool IsSelfAdjustingTemperature()
override bool IsPlayerInside(PlayerBase player, string selection)
override void OnVariablesSynchronized()
override void RefreshPhysics()
override bool CanObstruct()
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override bool CanPutInCargo(EntityAI parent)
override string GetLoopDeploySoundset()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
override void OnInventoryExit(Man player)
override bool IsTakeable()
override bool IsIgnoredByConstruction()
override void InitItemSounds()
override void EEKilled(Object killer)
override void OnCombine(ItemBase other_item)
override bool CanExplodeInFire()
override bool IsFacingPlayer(PlayerBase player, string selection)
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
override bool IsBloodContainer()
override bool IsClothing()
override bool CanBeSplit()
override bool IsDeployable()
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
override bool CanBeDisinfected()
override float GetInfectionChance(int system=0, Param param=null)
override void OnEndPlacement()
float GetOverheatingLimitMax()
void SetOverheatingLimitMax(float max)
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
float GetOverheatingLimitMin()
void SetOverheatingLimitMin(float min)
void RegisterParticle(Particle p)
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
void SetControlledDevice(EntityAI pDevice)
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
proto void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
void SetCalcDetails(string details)
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Serializer ParamsReadContext
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
proto native CGame GetGame()
Serializer ParamsWriteContext
const int COMP_TYPE_ENERGY_MANAGER
void Error(string err)
Messagebox with error message.
proto native void SetColor(int color)
array< string > TStringArray
EntityEvent
Entity events for event-mask, or throwing event from code.
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
const int VARIABLE_LIQUIDTYPE
const int VARIABLE_CLEANNESS
const int VARIABLE_TEMPERATURE
const int VARIABLE_QUANTITY
static proto float AbsFloat(float f)
Returns absolute value.
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_DEBUG_ACTION
class JsonUndergroundAreaTriggerData GetPosition
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.