6710{
6712 {
6713 return true;
6714 }
6715};
6716
6717
6718
6720{
6724
6726
6729
6730
6731
6732
6733
6742
6748
6753
6758
6779 protected bool m_IsResultOfSplit
6780
6782
6787
6788
6789
6791
6795
6796
6797
6799
6802
6803
6804
6810
6811
6819
6822
6823
6825
6826
6828
6829
6834
6835
6840
6841
6843
6844
6846 {
6851
6852 if (!
GetGame().IsDedicatedServer())
6853 {
6855 {
6857
6859 {
6861 }
6862 }
6863
6866 }
6867
6868 m_OldLocation = null;
6869
6871 {
6873 }
6874
6875 if (ConfigIsExisting("headSelectionsToHide"))
6876 {
6879 }
6880
6882 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
6883 {
6885 }
6886
6888
6889 m_IsResultOfSplit = false;
6890
6892 }
6893
6895 {
6896 super.InitItemVariables();
6897
6903 m_Count = ConfigGetInt(
"count");
6904
6907
6912
6915
6920
6932
6936
6937
6940 if (ConfigIsExisting("canBeSplit"))
6941 {
6944 }
6945
6947 if (ConfigIsExisting("itemBehaviour"))
6949
6950
6953 RegisterNetSyncVariableInt("m_VarLiquidType");
6954 RegisterNetSyncVariableInt("m_Cleanness",0,1);
6955
6956 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
6957 RegisterNetSyncVariableFloat("m_ImpactSpeed");
6958 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
6959
6960 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
6961 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
6962 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
6963 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
6964
6965 RegisterNetSyncVariableBool("m_IsBeingPlaced");
6966 RegisterNetSyncVariableBool("m_IsTakeable");
6967 RegisterNetSyncVariableBool("m_IsHologram");
6968
6971 {
6974 }
6975
6977
6979 if (ConfigIsExisting("temperaturePerQuantityWeight"))
6981
6982 }
6983
6985 {
6987 }
6988
6990 {
6993 {
6998 }
6999 }
7000
7001 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7002 {
7004 {
7007 }
7008
7010 }
7011
7013 {
7019 }
7020
7022
7024 {
7026
7027 if (!action)
7028 {
7029 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7030 return;
7031 }
7032
7034 if (!ai)
7035 {
7037 return;
7038 }
7039
7041 if (!action_array)
7042 {
7043 action_array = new array<ActionBase_Basic>;
7045 }
7046 if (LogManager.IsActionLogEnable())
7047 {
7048 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7049 }
7050
7051 if (action_array.Find(action) != -1)
7052 {
7053 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7054 }
7055 else
7056 {
7057 action_array.Insert(action);
7058 }
7059 }
7060
7062 {
7064 ActionBase action = player.GetActionManager().GetAction(actionName);
7067
7068 if (action_array)
7069 {
7070 action_array.RemoveItem(action);
7071 }
7072 }
7073
7074
7075
7077 {
7078 ActionOverrideData overrideData = new ActionOverrideData();
7082
7084 if (!actionMap)
7085 {
7088 }
7089
7090 actionMap.Insert(this.
Type(), overrideData);
7091
7092 }
7093
7095
7097
7098
7100 {
7103
7106
7107 string config_to_search = "CfgVehicles";
7108 string muzzle_owner_config;
7109
7111 {
7112 if (IsInherited(Weapon))
7113 config_to_search = "CfgWeapons";
7114
7115 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7116
7117 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7118
7120
7121 if (config_OnFire_subclass_count > 0)
7122 {
7123 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7124
7125 for (int i = 0; i < config_OnFire_subclass_count; i++)
7126 {
7127 string particle_class = "";
7129 string config_OnFire_entry = config_OnFire_class + particle_class;
7130 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7131 WPOF_array.Insert(WPOF);
7132 }
7133
7134
7136 }
7137 }
7138
7140 {
7141 config_to_search = "CfgWeapons";
7142 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7143
7144 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7145
7147
7148 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7149 {
7150 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7151
7152 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7153 {
7154 string particle_class2 = "";
7156 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7157 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7158 WPOBE_array.Insert(WPOBE);
7159 }
7160
7161
7163 }
7164 }
7165 }
7166
7167
7169 {
7172
7174 {
7175 string config_to_search = "CfgVehicles";
7176
7177 if (IsInherited(Weapon))
7178 config_to_search = "CfgWeapons";
7179
7180 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7181 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7182
7183 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
7184 {
7185
7187
7189 {
7191 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7193 return;
7194 }
7195
7198
7199
7200
7202 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7203
7204 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7205 {
7206 string particle_class = "";
7208 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7210
7211 if (entry_type == CT_CLASS)
7212 {
7213 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7214 WPOOH_array.Insert(WPOF);
7215 }
7216 }
7217
7218
7220 }
7221 }
7222 }
7223
7225 {
7227 }
7228
7230 {
7232 {
7234
7237
7240
7241 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7242 }
7243 }
7244
7246 {
7248 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7249
7251 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7252
7254 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7255
7257 {
7259 }
7260 }
7261
7263 {
7265 }
7266
7268 {
7271 else
7273
7275 {
7278 }
7279 else
7280 {
7283
7286 }
7287
7289 }
7290
7292 {
7294 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7295 }
7296
7298 {
7300 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7302 }
7303
7305 {
7307 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7308 }
7309
7311 {
7314
7315 OverheatingParticle OP = new OverheatingParticle();
7320
7322 }
7323
7325 {
7328
7329 return -1;
7330 }
7331
7333 {
7335 {
7338
7339 for (int i = count; i > 0; --i)
7340 {
7341 int id = i - 1;
7344
7347
7348 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7349 {
7350 if (p)
7351 {
7354 }
7355 }
7356 }
7357 }
7358 }
7359
7361 {
7363 {
7365 {
7366 int id = i - 1;
7368
7369 if (OP)
7370 {
7372
7373 if (p)
7374 {
7376 }
7377
7378 delete OP;
7379 }
7380 }
7381
7384 }
7385 }
7386
7389 {
7390 return 0.0;
7391 }
7392
7393
7395 {
7396 return 250;
7397 }
7398
7400 {
7401 return 0;
7402 }
7403
7406 {
7408 return true;
7409
7410 return false;
7411 }
7412
7415 {
7418
7420 {
7422 }
7423 else
7424 {
7425
7427 }
7428
7430 }
7431
7438 {
7439 return -1;
7440 }
7441
7442
7443
7444
7446 {
7448 {
7450 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7451
7452 if (r_index >= 0)
7453 {
7454 InventoryLocation r_il = new InventoryLocation;
7455 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7456
7457 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7460 {
7461 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7462 }
7464 {
7465 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7466 }
7467
7468 }
7469
7470 player.GetHumanInventory().ClearUserReservedLocation(this);
7471 }
7472
7475 }
7476
7477
7478
7479
7481 {
7482 return ItemBase.m_DebugActionsMask;
7483 }
7484
7486 {
7487 return ItemBase.m_DebugActionsMask & mask;
7488 }
7489
7491 {
7492 ItemBase.m_DebugActionsMask = mask;
7493 }
7494
7496 {
7497 ItemBase.m_DebugActionsMask |= mask;
7498 }
7499
7501 {
7502 ItemBase.m_DebugActionsMask &= ~mask;
7503 }
7504
7506 {
7508 {
7510 }
7511 else
7512 {
7514 }
7515 }
7516
7517
7519 {
7520 if (GetEconomyProfile())
7521 {
7522 float q_max = GetEconomyProfile().GetQuantityMax();
7523 if (q_max > 0)
7524 {
7525 float q_min = GetEconomyProfile().GetQuantityMin();
7526 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7527
7529 {
7530 ComponentEnergyManager comp = GetCompEM();
7532 {
7534 }
7535 }
7537 {
7539
7540 }
7541
7542 }
7543 }
7544 }
7545
7548 {
7549 EntityAI parent = GetHierarchyParent();
7550
7551 if (parent)
7552 {
7553 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7554 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7555 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7556 }
7557 }
7558
7561 {
7562 EntityAI parent = GetHierarchyParent();
7563
7564 if (parent)
7565 {
7566 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7567 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7568 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7569 }
7570 }
7571
7573 {
7574
7575
7576
7577
7579
7581 {
7582 if (ScriptInputUserData.CanStoreInputUserData())
7583 {
7584 ScriptInputUserData ctx = new ScriptInputUserData;
7590 ctx.
Write(use_stack_max);
7593
7595 {
7596 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7597 }
7598 }
7599 }
7600 else if (!
GetGame().IsMultiplayer())
7601 {
7603 }
7604 }
7605
7607 {
7609 }
7610
7612 {
7614 }
7615
7617 {
7619 }
7620
7622 {
7623
7624 return false;
7625 }
7626
7628 {
7629 return false;
7630 }
7631
7635 {
7636 return false;
7637 }
7638
7640 {
7641 return "";
7642 }
7643
7645
7647 {
7648 return false;
7649 }
7650
7652 {
7653 return true;
7654 }
7655
7656
7657
7659 {
7660 return true;
7661 }
7662
7664 {
7665 return true;
7666 }
7667
7669 {
7670 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7672 }
7673
7675 {
7677 }
7678
7680 {
7682 if (!is_being_placed)
7684 SetSynchDirty();
7685 }
7686
7687
7689
7691 {
7693 }
7694
7696 {
7698 }
7699
7701 {
7702 return 1;
7703 }
7704
7706 {
7707 return false;
7708 }
7709
7711 {
7713 SetSynchDirty();
7714 }
7715
7716
7717
7718
7719
7720
7721
7722
7723
7724
7725
7726
7727
7728
7729
7730
7731
7732
7733
7734
7735
7736
7737
7738
7739
7740
7741
7742
7743
7744
7745
7746
7747
7748
7749
7751 {
7752 super.OnMovedInsideCargo(container);
7753
7754 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7755 }
7756
7757 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7758 {
7759 super.EEItemLocationChanged(oldLoc,newLoc);
7760
7761 PlayerBase new_player = null;
7762 PlayerBase old_player = null;
7763
7764 if (newLoc.GetParent())
7765 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7766
7767 if (oldLoc.GetParent())
7768 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7769
7771 {
7772 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
7773
7774 if (r_index >= 0)
7775 {
7776 InventoryLocation r_il = new InventoryLocation;
7777 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7778
7779 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7782 {
7783 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7784 }
7786 {
7787 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7788 }
7789
7790 }
7791 }
7792
7794 {
7795 if (new_player)
7796 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
7797
7798 if (new_player == old_player)
7799 {
7800
7801 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
7802 {
7804 {
7805 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
7806 {
7807 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7808 }
7809 }
7810 else
7811 {
7812 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
7813 }
7814 }
7815
7816 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
7817 {
7818 int type = oldLoc.GetType();
7820 {
7821 oldLoc.GetParent().GetOnSetLock().Invoke(this);
7822 }
7824 {
7825 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
7826 }
7827 }
7828 if (!m_OldLocation)
7829 {
7830 m_OldLocation = new InventoryLocation;
7831 }
7832 m_OldLocation.Copy(oldLoc);
7833 }
7834 else
7835 {
7836 if (m_OldLocation)
7837 {
7838 m_OldLocation.Reset();
7839 }
7840 }
7841
7843 }
7844 else
7845 {
7846 if (new_player)
7847 {
7848 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
7849 if (res_index >= 0)
7850 {
7851 InventoryLocation il = new InventoryLocation;
7852 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
7854 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
7857 {
7858 il.
GetParent().GetOnReleaseLock().Invoke(it);
7859 }
7861 {
7863 }
7864
7865 }
7866 }
7868 {
7869
7871 }
7872
7873 if (m_OldLocation)
7874 {
7875 m_OldLocation.Reset();
7876 }
7877 }
7878 }
7879
7880 override void EOnContact(IEntity other, Contact extra)
7881 {
7883 {
7884 int liquidType = -1;
7886 if (impactSpeed > 0.0)
7887 {
7889 #ifndef SERVER
7891 #else
7893 SetSynchDirty();
7894 #endif
7896 }
7897 }
7898
7899 #ifdef SERVER
7900 if (GetCompEM() && GetCompEM().IsPlugged())
7901 {
7902 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
7903 GetCompEM().UnplugThis();
7904 }
7905 #endif
7906 }
7907
7909
7911 {
7913 }
7914
7916 {
7917
7918 }
7919
7921 {
7922 super.OnItemLocationChanged(old_owner, new_owner);
7923
7924 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
7925 PlayerBase playerNew = PlayerBase.Cast(new_owner);
7926
7927 if (!relatedPlayer && playerNew)
7928 relatedPlayer = playerNew;
7929
7930 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
7931 {
7933 if (actionMgr)
7934 {
7935 ActionBase currentAction = actionMgr.GetRunningAction();
7936 if (currentAction)
7938 }
7939 }
7940
7941 Man ownerPlayerOld = null;
7942 Man ownerPlayerNew = null;
7943
7944 if (old_owner)
7945 {
7946 if (old_owner.
IsMan())
7947 {
7948 ownerPlayerOld = Man.Cast(old_owner);
7949 }
7950 else
7951 {
7952 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
7953 }
7954 }
7955 else
7956 {
7958 {
7960
7961 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
7962 {
7963 GetCompEM().UnplugThis();
7964 }
7965 }
7966 }
7967
7968 if (new_owner)
7969 {
7970 if (new_owner.
IsMan())
7971 {
7972 ownerPlayerNew = Man.Cast(new_owner);
7973 }
7974 else
7975 {
7976 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
7977 }
7978 }
7979
7980 if (ownerPlayerOld != ownerPlayerNew)
7981 {
7982 if (ownerPlayerOld)
7983 {
7984 array<EntityAI> subItemsExit = new array<EntityAI>;
7986 for (int i = 0; i < subItemsExit.Count(); i++)
7987 {
7990 }
7991 }
7992
7993 if (ownerPlayerNew)
7994 {
7995 array<EntityAI> subItemsEnter = new array<EntityAI>;
7997 for (int j = 0; j < subItemsEnter.Count(); j++)
7998 {
8001 }
8002 }
8003 }
8004 else if (ownerPlayerNew != null)
8005 {
8006 PlayerBase nplayer;
8007 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8008 {
8009 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8011 for (int k = 0; k < subItemsUpdate.Count(); k++)
8012 {
8014 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8015 }
8016 }
8017 }
8018
8019 if (old_owner)
8020 old_owner.OnChildItemRemoved(this);
8021 if (new_owner)
8022 new_owner.OnChildItemReceived(this);
8023 }
8024
8025
8027 {
8028 super.EEDelete(parent);
8029 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8030 if (player)
8031 {
8033
8034 if (player.IsAlive())
8035 {
8036 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8037 if (r_index >= 0)
8038 {
8039 InventoryLocation r_il = new InventoryLocation;
8040 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8041
8042 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8045 {
8046 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8047 }
8049 {
8050 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8051 }
8052
8053 }
8054
8055 player.RemoveQuickBarEntityShortcut(this);
8056 }
8057 }
8058 }
8059
8061 {
8062 super.EEKilled(killer);
8063
8066 {
8067 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8068 {
8069 if (IsMagazine())
8070 {
8071 if (Magazine.Cast(this).GetAmmoCount() > 0)
8072 {
8074 }
8075 }
8076 else
8077 {
8079 }
8080 }
8081 }
8082 }
8083
8085 {
8086 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8087
8088 super.OnWasAttached(parent, slot_id);
8089
8092
8094 }
8095
8097 {
8098 super.OnWasDetached(parent, slot_id);
8099
8102 }
8103
8105 {
8106 int idx;
8109
8110 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8111 if (inventory_slots.Count() < 1)
8112 {
8113 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8114 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8115 }
8116 else
8117 {
8118 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8119 }
8120
8121 idx = inventory_slots.Find(slot);
8122 if (idx < 0)
8123 return "";
8124
8125 return attach_types.Get(idx);
8126 }
8127
8129 {
8130 int idx = -1;
8131 string slot;
8132
8135
8136 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8137 if (inventory_slots.Count() < 1)
8138 {
8139 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8140 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8141 }
8142 else
8143 {
8144 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8145 if (detach_types.Count() < 1)
8146 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8147 }
8148
8149 for (int i = 0; i < inventory_slots.Count(); i++)
8150 {
8151 slot = inventory_slots.Get(i);
8152 }
8153
8154 if (slot != "")
8155 {
8156 if (detach_types.Count() == 1)
8157 idx = 0;
8158 else
8159 idx = inventory_slots.Find(slot);
8160 }
8161 if (idx < 0)
8162 return "";
8163
8164 return detach_types.Get(idx);
8165 }
8166
8168 {
8169
8171
8172
8173 float min_time = 1;
8174 float max_time = 3;
8175 float delay = Math.RandomFloat(min_time, max_time);
8176
8177 explode_timer.Run(delay, this, "DoAmmoExplosion");
8178 }
8179
8181 {
8182 Magazine magazine = Magazine.Cast(this);
8183 int pop_sounds_count = 6;
8184 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8185
8186
8187 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8188 string sound_name = pop_sounds[ sound_idx ];
8190
8191
8192 magazine.ServerAddAmmoCount(-1);
8193
8194
8195 float min_temp_to_explode = 100;
8196
8197 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode)
8198 {
8200 }
8201 }
8202
8203
8204 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8205 {
8206 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8207
8208 const int CHANCE_DAMAGE_CARGO = 4;
8209 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8210 const int CHANCE_DAMAGE_NOTHING = 2;
8211
8213 {
8214 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8215 int chances;
8216 int rnd;
8217
8218 if (GetInventory().GetCargo())
8219 {
8220 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8221 rnd = Math.RandomInt(0,chances);
8222
8223 if (rnd < CHANCE_DAMAGE_CARGO)
8224 {
8226 }
8227 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8228 {
8230 }
8231 }
8232 else
8233 {
8234 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8235 rnd = Math.RandomInt(0,chances);
8236
8237 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8238 {
8240 }
8241 }
8242 }
8243 }
8244
8246 {
8247 if (GetInventory().GetCargo())
8248 {
8249 int item_count = GetInventory().GetCargo().GetItemCount();
8250 if (item_count > 0)
8251 {
8252 int random_pick = Math.RandomInt(0, item_count);
8254 if (!item.IsExplosive())
8255 {
8256 item.AddHealth("","",damage);
8257 return true;
8258 }
8259 }
8260 }
8261 return false;
8262 }
8263
8265 {
8266 int attachment_count = GetInventory().AttachmentCount();
8267 if (attachment_count > 0)
8268 {
8269 int random_pick = Math.RandomInt(0, attachment_count);
8270 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
8271 if (!attachment.IsExplosive())
8272 {
8273 attachment.AddHealth("","",damage);
8274 return true;
8275 }
8276 }
8277 return false;
8278 }
8279
8281 {
8283 }
8284
8286 {
8288 return GetInventory().CanRemoveEntity();
8289
8290 return false;
8291 }
8292
8294 {
8296 return;
8297
8299 {
8300 if (ScriptInputUserData.CanStoreInputUserData())
8301 {
8302 ScriptInputUserData ctx = new ScriptInputUserData;
8307 ctx.
Write(destination_entity);
8311 }
8312 }
8313 else if (!
GetGame().IsMultiplayer())
8314 {
8316 }
8317 }
8318
8320 {
8322 return;
8323
8324 float split_quantity_new;
8328 InventoryLocation loc = new InventoryLocation;
8329
8330 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8331 {
8333 split_quantity_new = stack_max;
8334 else
8336
8337 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8338 if (new_item)
8339 {
8340 new_item.SetResultOfSplit(true);
8341 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8343 new_item.SetQuantity(split_quantity_new);
8344 }
8345 }
8346 else if (destination_entity && slot_id == -1)
8347 {
8348 if (quantity > stack_max)
8349 split_quantity_new = stack_max;
8350 else
8351 split_quantity_new = quantity;
8352
8354 {
8357 }
8358
8359 if (new_item)
8360 {
8361 new_item.SetResultOfSplit(true);
8362 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8364 new_item.SetQuantity(split_quantity_new);
8365 }
8366 }
8367 else
8368 {
8369 if (stack_max != 0)
8370 {
8372 {
8374 }
8375
8376 if (split_quantity_new == 0)
8377 {
8378 if (!
GetGame().IsMultiplayer())
8379 player.PhysicalPredictiveDropItem(this);
8380 else
8381 player.ServerDropEntity(this);
8382 return;
8383 }
8384
8386
8387 if (new_item)
8388 {
8389 new_item.SetResultOfSplit(true);
8390 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8392 new_item.SetQuantity(stack_max);
8393 new_item.PlaceOnSurface();
8394 }
8395 }
8396 }
8397 }
8398
8400 {
8402 return;
8403
8404 float split_quantity_new;
8408 InventoryLocation loc = new InventoryLocation;
8409
8410 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8411 {
8413 split_quantity_new = stack_max;
8414 else
8416
8417 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8418 if (new_item)
8419 {
8420 new_item.SetResultOfSplit(true);
8421 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8423 new_item.SetQuantity(split_quantity_new);
8424 }
8425 }
8426 else if (destination_entity && slot_id == -1)
8427 {
8428 if (quantity > stack_max)
8429 split_quantity_new = stack_max;
8430 else
8431 split_quantity_new = quantity;
8432
8434 {
8437 }
8438
8439 if (new_item)
8440 {
8441 new_item.SetResultOfSplit(true);
8442 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8444 new_item.SetQuantity(split_quantity_new);
8445 }
8446 }
8447 else
8448 {
8449 if (stack_max != 0)
8450 {
8452 {
8454 }
8455
8457
8458 if (new_item)
8459 {
8460 new_item.SetResultOfSplit(true);
8461 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8463 new_item.SetQuantity(stack_max);
8464 new_item.PlaceOnSurface();
8465 }
8466 }
8467 }
8468 }
8469
8471 {
8473 return;
8474
8476 {
8477 if (ScriptInputUserData.CanStoreInputUserData())
8478 {
8479 ScriptInputUserData ctx = new ScriptInputUserData;
8484 dst.WriteToContext(ctx);
8486 }
8487 }
8488 else if (!
GetGame().IsMultiplayer())
8489 {
8491 }
8492 }
8493
8495 {
8497 return;
8498
8500 {
8501 if (ScriptInputUserData.CanStoreInputUserData())
8502 {
8503 ScriptInputUserData ctx = new ScriptInputUserData;
8508 ctx.
Write(destination_entity);
8514 }
8515 }
8516 else if (!
GetGame().IsMultiplayer())
8517 {
8519 }
8520 }
8521
8523 {
8525 }
8526
8528 {
8530 return this;
8531
8533 float split_quantity_new;
8535 if (dst.IsValid())
8536 {
8537 int slot_id = dst.GetSlot();
8539
8540 if (quantity > stack_max)
8541 split_quantity_new = stack_max;
8542 else
8543 split_quantity_new = quantity;
8544
8546
8547 if (new_item)
8548 {
8549 new_item.SetResultOfSplit(true);
8550 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8553 }
8554
8555 return new_item;
8556 }
8557
8558 return null;
8559 }
8560
8562 {
8564 return;
8565
8567 float split_quantity_new;
8569 if (destination_entity)
8570 {
8572 if (quantity > stackable)
8573 split_quantity_new = stackable;
8574 else
8575 split_quantity_new = quantity;
8576
8577 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8578 if (new_item)
8579 {
8580 new_item.SetResultOfSplit(true);
8581 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8583 new_item.SetQuantity(split_quantity_new);
8584 }
8585 }
8586 }
8587
8589 {
8591 return;
8592
8594 {
8595 if (ScriptInputUserData.CanStoreInputUserData())
8596 {
8597 ScriptInputUserData ctx = new ScriptInputUserData;
8602 ItemBase destination_entity =
this;
8603 ctx.
Write(destination_entity);
8607 }
8608 }
8609 else if (!
GetGame().IsMultiplayer())
8610 {
8612 }
8613 }
8614
8616 {
8618 return;
8619
8621 float split_quantity_new;
8623 if (player)
8624 {
8626 if (quantity > stackable)
8627 split_quantity_new = stackable;
8628 else
8629 split_quantity_new = quantity;
8630
8631 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8632 new_item =
ItemBase.Cast(in_hands);
8633 if (new_item)
8634 {
8635 new_item.SetResultOfSplit(true);
8636 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8638 new_item.SetQuantity(split_quantity_new);
8639 }
8640 }
8641 }
8642
8644 {
8646 return;
8647
8649 float split_quantity_new = Math.Floor(quantity * 0.5);
8650
8652
8653 if (new_item)
8654 {
8655 if (new_item.GetQuantityMax() < split_quantity_new)
8656 {
8657 split_quantity_new = new_item.GetQuantityMax();
8658 }
8659
8660 new_item.SetResultOfSplit(true);
8661 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8662
8664 {
8667 }
8668 else
8669 {
8672 }
8673 }
8674 }
8675
8677 {
8679 return;
8680
8682 float split_quantity_new = Math.Floor(quantity / 2);
8683
8684 InventoryLocation invloc = new InventoryLocation;
8686
8688 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8689
8690 if (new_item)
8691 {
8692 if (new_item.GetQuantityMax() < split_quantity_new)
8693 {
8694 split_quantity_new = new_item.GetQuantityMax();
8695 }
8697 {
8700 }
8701 else
8702 {
8705 }
8706 }
8707 }
8708
8711 {
8712 SetWeightDirty();
8714
8715 if (parent)
8716 parent.OnAttachmentQuantityChangedEx(this, delta);
8717
8719 {
8721 {
8723 }
8725 {
8726 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8728 }
8729 }
8730
8731 }
8732
8735 {
8736
8737 }
8738
8741 {
8743 }
8744
8746 {
8747 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8748
8750 {
8751 if (newLevel == GameConstants.STATE_RUINED)
8752 {
8754 EntityAI parent = GetHierarchyParent();
8755 if (parent && parent.IsFireplace())
8756 {
8757 CargoBase cargo = GetInventory().GetCargo();
8758 if (cargo)
8759 {
8761 {
8763 }
8764 }
8765 }
8766 }
8767
8769 {
8770
8772 return;
8773 }
8774
8775 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
8776 {
8778 }
8779 }
8780 }
8781
8782
8784 {
8785 super.OnRightClick();
8786
8788 {
8790 {
8791 if (ScriptInputUserData.CanStoreInputUserData())
8792 {
8793 vector m4[4];
8795
8796 EntityAI root = GetHierarchyRoot();
8797
8798 InventoryLocation dst = new InventoryLocation;
8800 {
8801 if (root)
8802 {
8803 root.GetTransform(m4);
8805 }
8806 else
8807 GetInventory().GetCurrentInventoryLocation(dst);
8808 }
8809 else
8810 {
8812
8813
8814 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
8815 {
8816 if (root)
8817 {
8818 root.GetTransform(m4);
8820 }
8821 else
8822 GetInventory().GetCurrentInventoryLocation(dst);
8823 }
8824 else
8825 {
8826 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
8827 }
8828 }
8829
8830 ScriptInputUserData ctx = new ScriptInputUserData;
8838 }
8839 }
8840 else if (!
GetGame().IsMultiplayer())
8841 {
8843 }
8844 }
8845 }
8846
8847 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
8848 {
8849
8850 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
8851 return false;
8852
8853 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
8854 return false;
8855
8856
8858 return false;
8859
8860
8861 Magazine mag = Magazine.Cast(this);
8862 if (mag)
8863 {
8864 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
8865 return false;
8866
8867 if (stack_max_limit)
8868 {
8869 Magazine other_mag = Magazine.Cast(other_item);
8870 if (other_item)
8871 {
8872 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
8873 return false;
8874 }
8875
8876 }
8877 }
8878 else
8879 {
8880
8882 return false;
8883
8885 return false;
8886 }
8887
8888 PlayerBase player = null;
8889 if (CastTo(player, GetHierarchyRootPlayer()))
8890 {
8891 if (player.GetInventory().HasAttachment(this))
8892 return false;
8893
8894 if (player.IsItemsToDelete())
8895 return false;
8896 }
8897
8898 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
8899 return false;
8900
8901 int slotID;
8903 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
8904 return false;
8905
8906 return true;
8907 }
8908
8910 {
8912 }
8913
8915 {
8916 return m_IsResultOfSplit;
8917 }
8918
8920 {
8921 m_IsResultOfSplit = value;
8922 }
8923
8925 {
8927 }
8928
8930 {
8931 float other_item_quantity = other_item.GetQuantity();
8932 float this_free_space;
8933
8935
8937
8938 if (other_item_quantity > this_free_space)
8939 {
8940 return this_free_space;
8941 }
8942 else
8943 {
8944 return other_item_quantity;
8945 }
8946 }
8947
8949 {
8951 }
8952
8954 {
8956 return;
8957
8958 if (!IsMagazine() && other_item)
8959 {
8961 if (quantity_used != 0)
8962 {
8963 float hp1 = GetHealth01("","");
8964 float hp2 = other_item.GetHealth01("","");
8965 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
8966 hpResult = hpResult / (
GetQuantity() + quantity_used);
8967
8968 hpResult *= GetMaxHealth();
8969 Math.Round(hpResult);
8970 SetHealth("", "Health", hpResult);
8971
8973 other_item.AddQuantity(-quantity_used);
8974 }
8975 }
8977 }
8978
8980 {
8981 #ifdef SERVER
8982 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
8983 GetHierarchyParent().IncreaseLifetimeUp();
8984 #endif
8985 };
8986
8988 {
8989 PlayerBase p = PlayerBase.Cast(player);
8990
8991 array<int> recipesIds = p.m_Recipes;
8992 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
8993 if (moduleRecipesManager)
8994 {
8995 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
8996 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
8997 }
8998
8999 for (int i = 0;i < recipesIds.Count(); i++)
9000 {
9001 int key = recipesIds.Get(i);
9002 string recipeName = moduleRecipesManager.GetRecipeName(key);
9004 }
9005 }
9006
9007
9008 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9009 {
9010 super.GetDebugActions(outputList);
9011
9012
9017
9018
9022
9026
9027
9030
9031
9033 {
9036 }
9037
9039
9042
9046 }
9047
9048
9049
9050
9052 {
9053 super.OnAction(action_id, player, ctx);
9054 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9055 {
9056 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9057 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9058 PlayerBase p = PlayerBase.Cast(player);
9059 if (
EActions.RECIPES_RANGE_START < 1000)
9060 {
9061 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9062 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9063 }
9064 }
9065 #ifndef SERVER
9066 else if (action_id ==
EActions.WATCH_PLAYER)
9067 {
9068 PluginDeveloper.SetDeveloperItemClientEx(player);
9069 }
9070 #endif
9072 {
9073 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9074 {
9075 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9076 OnDebugButtonPressServer(id + 1);
9077 }
9078
9079 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9080 {
9081 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9083 }
9084
9085 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9086 {
9087 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9089 }
9090
9091 else if (action_id ==
EActions.ADD_QUANTITY)
9092 {
9093 if (IsMagazine())
9094 {
9095 Magazine mag = Magazine.Cast(this);
9096 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9097 }
9098 else
9099 {
9101 }
9102
9103 if (m_EM)
9104 {
9105 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9106 }
9107
9108 }
9109
9110 else if (action_id ==
EActions.REMOVE_QUANTITY)
9111 {
9112 if (IsMagazine())
9113 {
9114 Magazine mag2 = Magazine.Cast(this);
9115 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9116 }
9117 else
9118 {
9120 }
9121 if (m_EM)
9122 {
9123 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9124 }
9125
9126 }
9127
9128 else if (action_id ==
EActions.SET_QUANTITY_0)
9129 {
9131
9132 if (m_EM)
9133 {
9134 m_EM.SetEnergy(0);
9135 }
9136 }
9137
9138 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9139 {
9141
9142 if (m_EM)
9143 {
9144 m_EM.SetEnergy(m_EM.GetEnergyMax());
9145 }
9146 }
9147
9148 else if (action_id ==
EActions.ADD_HEALTH)
9149 {
9150 AddHealth("","",GetMaxHealth("","Health")/5);
9151 }
9152 else if (action_id ==
EActions.REMOVE_HEALTH)
9153 {
9154 AddHealth("","",-GetMaxHealth("","Health")/5);
9155 }
9156 else if (action_id ==
EActions.DESTROY_HEALTH)
9157 {
9158 SetHealth01("","",0);
9159 }
9160 else if (action_id ==
EActions.WATCH_ITEM)
9161 {
9163 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9164 #ifdef DEVELOPER
9165 SetDebugDeveloper_item(this);
9166 #endif
9167 }
9168
9169 else if (action_id ==
EActions.ADD_TEMPERATURE)
9170 {
9171 AddTemperature(20);
9172
9173 }
9174
9175 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9176 {
9177 AddTemperature(-20);
9178
9179 }
9180
9181 else if (action_id ==
EActions.FLIP_FROZEN)
9182 {
9183 SetFrozen(!GetIsFrozen());
9184
9185 }
9186
9187 else if (action_id ==
EActions.ADD_WETNESS)
9188 {
9190
9191 }
9192
9193 else if (action_id ==
EActions.REMOVE_WETNESS)
9194 {
9196
9197 }
9198
9199 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9200 {
9203
9204
9205 }
9206
9207 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9208 {
9211 }
9212
9213 else if (action_id ==
EActions.MAKE_SPECIAL)
9214 {
9215 auto debugParams = DebugSpawnParams.WithPlayer(player);
9216 OnDebugSpawnEx(debugParams);
9217 }
9218
9219 else if (action_id ==
EActions.DELETE)
9220 {
9221 Delete();
9222 }
9223
9224 }
9225
9226
9227 return false;
9228 }
9229
9230
9231
9232
9236
9239
9240
9241
9243 {
9244 return false;
9245 }
9246
9247
9249 {
9250 return true;
9251 }
9252
9253
9255 {
9256 return true;
9257 }
9258
9259
9260
9262 {
9263 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9265 }
9266
9269 {
9270 return null;
9271 }
9272
9274 {
9275 return false;
9276 }
9277
9279 {
9280 return false;
9281 }
9282
9286
9287
9289 {
9290 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9291 return module_repairing.CanRepair(this, item_repair_kit);
9292 }
9293
9294
9295 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9296 {
9297 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9298 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9299 }
9300
9301
9303 {
9304
9305
9306
9307
9308
9309
9310
9311
9312 return 1;
9313 }
9314
9315
9316
9318 {
9320 }
9321
9322
9323
9325 {
9327 }
9328
9329
9338 {
9339 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9340
9341 if (player)
9342 {
9343 player.MessageStatus(text);
9344 }
9345 }
9346
9347
9356 {
9357 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9358
9359 if (player)
9360 {
9361 player.MessageAction(text);
9362 }
9363 }
9364
9365
9374 {
9375 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9376
9377 if (player)
9378 {
9379 player.MessageFriendly(text);
9380 }
9381 }
9382
9383
9392 {
9393 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9394
9395 if (player)
9396 {
9397 player.MessageImportant(text);
9398 }
9399 }
9400
9402 {
9403 return true;
9404 }
9405
9406
9407 override bool KindOf(
string tag)
9408 {
9409 bool found = false;
9410 string item_name = this.
GetType();
9413
9414 int array_size = item_tag_array.Count();
9415 for (int i = 0; i < array_size; i++)
9416 {
9417 if (item_tag_array.Get(i) == tag)
9418 {
9419 found = true;
9420 break;
9421 }
9422 }
9423 return found;
9424 }
9425
9426
9428 {
9429
9430 super.OnRPC(sender, rpc_type,ctx);
9431
9432
9433 switch (rpc_type)
9434 {
9435 #ifndef SERVER
9436 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9437 Param2<bool, string> p = new Param2<bool, string>(false, "");
9438
9440 return;
9441
9442 bool play = p.param1;
9443 string soundSet = p.param2;
9444
9445 if (play)
9446 {
9448 {
9450 {
9452 }
9453 }
9454 else
9455 {
9457 }
9458 }
9459 else
9460 {
9462 }
9463
9464 break;
9465 #endif
9466
9467 }
9468
9470 {
9472 }
9473 }
9474
9475
9476
9477
9479 {
9480 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9481 return plugin.GetID(
name);
9482 }
9483
9485 {
9486 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9487 return plugin.GetName(id);
9488 }
9489
9492 {
9493
9494
9495 int varFlags;
9496 if (!ctx.
Read(varFlags))
9497 return;
9498
9499 if (varFlags & ItemVariableFlags.FLOAT)
9500 {
9502 }
9503 }
9504
9506 {
9507
9508 super.SerializeNumericalVars(floats_out);
9509
9510
9511
9513 {
9515 }
9516
9518 {
9520 }
9521
9523 {
9525 }
9526
9528 {
9533 }
9534
9536 {
9538 }
9539 }
9540
9542 {
9543
9544 super.DeSerializeNumericalVars(floats);
9545
9546
9547 int index = 0;
9548 int mask = Math.Round(floats.Get(index));
9549
9550 index++;
9551
9553 {
9555 {
9557 }
9558 else
9559 {
9560 float quantity = floats.Get(index);
9562 }
9563 index++;
9564 }
9565
9567 {
9568 float wet = floats.Get(index);
9570 index++;
9571 }
9572
9574 {
9575 int liquidtype = Math.Round(floats.Get(index));
9577 index++;
9578 }
9579
9581 {
9583 index++;
9585 index++;
9587 index++;
9589 index++;
9590 }
9591
9593 {
9594 int cleanness = Math.Round(floats.Get(index));
9596 index++;
9597 }
9598 }
9599
9601 {
9602 super.WriteVarsToCTX(ctx);
9603
9604
9606 {
9608 }
9609
9611 {
9613 }
9614
9616 {
9618 }
9619
9621 {
9622 int r,g,b,a;
9628 }
9629
9631 {
9633 }
9634 }
9635
9637 {
9638 if (!super.ReadVarsFromCTX(ctx,version))
9639 return false;
9640
9641 int intValue;
9642 float value;
9643
9644 if (version < 140)
9645 {
9646 if (!ctx.
Read(intValue))
9647 return false;
9648
9649 m_VariablesMask = intValue;
9650 }
9651
9653 {
9654 if (!ctx.
Read(value))
9655 return false;
9656
9658 {
9660 }
9661 else
9662 {
9664 }
9665 }
9666
9667 if (version < 140)
9668 {
9670 {
9671 if (!ctx.
Read(value))
9672 return false;
9673 SetTemperatureDirect(value);
9674 }
9675 }
9676
9678 {
9679 if (!ctx.
Read(value))
9680 return false;
9682 }
9683
9685 {
9686 if (!ctx.
Read(intValue))
9687 return false;
9689 }
9690
9692 {
9693 int r,g,b,a;
9695 return false;
9697 return false;
9699 return false;
9701 return false;
9702
9704 }
9705
9707 {
9708 if (!ctx.
Read(intValue))
9709 return false;
9711 }
9712
9713 if (version >= 138 && version < 140)
9714 {
9716 {
9717 if (!ctx.
Read(intValue))
9718 return false;
9719 SetFrozen(intValue);
9720 }
9721 }
9722
9723 return true;
9724 }
9725
9726
9728 {
9731 {
9733 }
9734
9735 if (!super.OnStoreLoad(ctx, version))
9736 {
9738 return false;
9739 }
9740
9741 if (version >= 114)
9742 {
9743 bool hasQuickBarIndexSaved;
9744
9745 if (!ctx.
Read(hasQuickBarIndexSaved))
9746 {
9748 return false;
9749 }
9750
9751 if (hasQuickBarIndexSaved)
9752 {
9753 int itmQBIndex;
9754
9755
9756 if (!ctx.
Read(itmQBIndex))
9757 {
9759 return false;
9760 }
9761
9762 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
9763 if (itmQBIndex != -1 && parentPlayer)
9764 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
9765 }
9766 }
9767 else
9768 {
9769
9770 PlayerBase player;
9771 int itemQBIndex;
9772 if (version ==
int.
MAX)
9773 {
9774 if (!ctx.
Read(itemQBIndex))
9775 {
9777 return false;
9778 }
9779 }
9780 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
9781 {
9782
9783 if (!ctx.
Read(itemQBIndex))
9784 {
9786 return false;
9787 }
9788 if (itemQBIndex != -1 && player)
9789 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
9790 }
9791 }
9792
9793 if (version < 140)
9794 {
9795
9796 if (!LoadVariables(ctx, version))
9797 {
9799 return false;
9800 }
9801 }
9802
9803
9805 {
9807 return false;
9808 }
9809 if (version >= 132)
9810 {
9812 if (raib)
9813 {
9815 {
9817 return false;
9818 }
9819 }
9820 }
9821
9823 return true;
9824 }
9825
9826
9827
9829 {
9830 super.OnStoreSave(ctx);
9831
9832 PlayerBase player;
9833 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
9834 {
9836
9837 int itemQBIndex = -1;
9838 itemQBIndex = player.FindQuickBarEntityIndex(this);
9839 ctx.
Write(itemQBIndex);
9840 }
9841 else
9842 {
9844 }
9845
9847
9849 if (raib)
9850 {
9852 }
9853 }
9854
9855
9857 {
9858 super.AfterStoreLoad();
9859
9861 {
9863 }
9864
9866 {
9869 }
9870 }
9871
9873 {
9874 super.EEOnAfterLoad();
9875
9877 {
9879 }
9880
9883 }
9884
9886 {
9887 return false;
9888 }
9889
9890
9891
9893 {
9895 {
9896 #ifdef PLATFORM_CONSOLE
9897
9899 {
9901 if (menu)
9902 {
9904 }
9905 }
9906 #endif
9907 }
9908
9910 {
9913 }
9914
9916 {
9917 SetWeightDirty();
9919 }
9921 {
9924 }
9925
9927 {
9930 }
9932 {
9935 }
9936
9937 super.OnVariablesSynchronized();
9938 }
9939
9940
9941
9943 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
9944 {
9945 if (!IsServerCheck(allow_client))
9946 return false;
9947
9949 return false;
9950
9953
9954 if (value <= (min + 0.001))
9955 value = min;
9956
9957 if (value == min)
9958 {
9959 if (destroy_config)
9960 {
9961 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
9962 if (dstr)
9963 {
9965 this.Delete();
9966 return true;
9967 }
9968 }
9969 else if (destroy_forced)
9970 {
9972 this.Delete();
9973 return true;
9974 }
9975
9977 }
9978
9981
9983 {
9985
9986 if (delta)
9988 }
9989
9991
9992 return false;
9993 }
9994
9995
9997 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
9998 {
10000 }
10001
10003 {
10006 }
10007
10009 {
10012 }
10013
10016 {
10017 float value_clamped = Math.Clamp(value, 0, 1);
10019 SetQuantity(result, destroy_config, destroy_forced);
10020 }
10021
10022
10025 {
10027 }
10028
10030 {
10032 }
10033
10034
10035
10036
10037
10038
10039
10040
10041
10042
10044 {
10045 int slot = -1;
10046 if (GetInventory())
10047 {
10048 InventoryLocation il = new InventoryLocation;
10049 GetInventory().GetCurrentInventoryLocation(il);
10051 }
10052
10054 }
10055
10057 {
10058 float quantity_max = 0;
10059
10061 {
10062 if (attSlotID != -1)
10063 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10064
10065 if (quantity_max <= 0)
10067 }
10068
10069 if (quantity_max <= 0)
10071
10072 return quantity_max;
10073 }
10074
10076 {
10078 }
10079
10081 {
10083 }
10084
10085
10087 {
10089 }
10090
10092 {
10094 }
10095
10097 {
10099 }
10100
10101
10103 {
10104
10105 float weightEx = GetWeightEx();
10106 float special = GetInventoryAndCargoWeight();
10107 return weightEx - special;
10108 }
10109
10110
10112 {
10114 }
10115
10117 {
10119 {
10120 #ifdef DEVELOPER
10121 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10122 {
10123 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10125 }
10126 #endif
10127
10128 return GetQuantity() * GetConfigWeightModified();
10129 }
10130 else if (HasEnergyManager())
10131 {
10132 #ifdef DEVELOPER
10133 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10134 {
10135 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10136 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10137 }
10138 #endif
10139 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
10140 }
10141 else
10142 {
10143 #ifdef DEVELOPER
10144 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10145 {
10146 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10147 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10148 }
10149 #endif
10150 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified());
10151 }
10152 }
10153
10156 {
10157 int item_count = 0;
10159
10160 if (GetInventory().GetCargo() != NULL)
10161 {
10162 item_count = GetInventory().GetCargo().GetItemCount();
10163 }
10164
10165 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
10166 {
10167 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
10168 if (item)
10169 item_count += item.GetNumberOfItems();
10170 }
10171 return item_count;
10172 }
10173
10176 {
10177 float weight = 0;
10178 float wetness = 1;
10179 if (include_wetness)
10182 {
10183 weight = wetness * m_ConfigWeight;
10184 }
10186 {
10187 weight = 1;
10188 }
10189 return weight;
10190 }
10191
10192
10193
10195 {
10196 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
10197 {
10198 GameInventory inv = GetInventory();
10199 array<EntityAI> items = new array<EntityAI>;
10201 for (int i = 0; i < items.Count(); i++)
10202 {
10204 if (item)
10205 {
10207 }
10208 }
10209 }
10210 }
10211
10212
10213
10214
10216 {
10217 float energy = 0;
10218 if (HasEnergyManager())
10219 {
10220 energy = GetCompEM().GetEnergy();
10221 }
10222 return energy;
10223 }
10224
10225
10227 {
10228 super.OnEnergyConsumed();
10229
10231 }
10232
10234 {
10235 super.OnEnergyAdded();
10236
10238 }
10239
10240
10242 {
10243 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10244 {
10246 {
10247 float energy_0to1 = GetCompEM().GetEnergy0To1();
10249 }
10250 }
10251 }
10252
10253
10255 {
10256 return ConfigGetFloat("heatIsolation");
10257 }
10258
10260 {
10262 }
10263
10265 {
10266 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10267 if (
GetGame().ConfigIsExisting(paramPath))
10269
10270 return 0.0;
10271 }
10272
10274 {
10275 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10276 if (
GetGame().ConfigIsExisting(paramPath))
10278
10279 return 0.0;
10280 }
10281
10282 override void SetWet(
float value,
bool allow_client =
false)
10283 {
10284 if (!IsServerCheck(allow_client))
10285 return;
10286
10289
10291
10292 m_VarWet = Math.Clamp(value, min, max);
10293
10295 {
10298 }
10299 }
10300
10301 override void AddWet(
float value)
10302 {
10304 }
10305
10307 {
10309 }
10310
10312 {
10314 }
10315
10317 {
10319 }
10320
10322 {
10324 }
10325
10327 {
10329 }
10330
10331 override void OnWetChanged(
float newVal,
float oldVal)
10332 {
10335 if (newLevel != oldLevel)
10336 {
10338 }
10339 }
10340
10342 {
10343 SetWeightDirty();
10344 }
10345
10347 {
10348 return GetWetLevelInternal(
m_VarWet);
10349 }
10350
10351
10352
10354 {
10356 }
10357
10359 {
10361 }
10362
10364 {
10366 }
10367
10369 {
10371 }
10372
10373
10374
10376 {
10377 if (ConfigIsExisting("itemModelLength"))
10378 {
10379 return ConfigGetFloat("itemModelLength");
10380 }
10381 return 0;
10382 }
10383
10385 {
10386 if (ConfigIsExisting("itemAttachOffset"))
10387 {
10388 return ConfigGetFloat("itemAttachOffset");
10389 }
10390 return 0;
10391 }
10392
10393 override void SetCleanness(
int value,
bool allow_client =
false)
10394 {
10395 if (!IsServerCheck(allow_client))
10396 return;
10397
10399
10401
10404 }
10405
10407 {
10409 }
10410
10412 {
10413 return true;
10414 }
10415
10416
10417
10418
10420 {
10422 }
10423
10425 {
10427 }
10428
10429
10430
10431
10432 override void SetColor(
int r,
int g,
int b,
int a)
10433 {
10439 }
10441 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10442 {
10447 }
10448
10450 {
10452 }
10453
10456 {
10457 int r,g,b,a;
10459 r = r/255;
10460 g = g/255;
10461 b = b/255;
10462 a = a/255;
10463 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10464 }
10465
10466
10467
10468 override void SetLiquidType(
int value,
bool allow_client =
false)
10469 {
10470 if (!IsServerCheck(allow_client))
10471 return;
10472
10477 }
10478
10480 {
10481 return ConfigGetInt("varLiquidTypeInit");
10482 }
10483
10485 {
10487 }
10488
10490 {
10492 SetFrozen(false);
10493 }
10494
10497 {
10498 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10499 }
10500
10501
10504 {
10505 PlayerBase nplayer;
10506 if (PlayerBase.CastTo(nplayer, player))
10507 {
10509
10510 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10511 }
10512 }
10513
10514
10517 {
10518 PlayerBase nplayer;
10519 if (PlayerBase.CastTo(nplayer,player))
10520 {
10521
10522 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10523
10524 }
10525
10526
10527 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10528
10529
10530 if (HasEnergyManager())
10531 {
10532 GetCompEM().UpdatePlugState();
10533 }
10534 }
10535
10536
10538 {
10539 super.OnPlacementStarted(player);
10540
10542 }
10543
10544 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10545 {
10547 {
10548 m_AdminLog.OnPlacementComplete(player,
this);
10549 }
10550
10551 super.OnPlacementComplete(player, position, orientation);
10552 }
10553
10554
10555
10556
10557
10559 {
10561 {
10562 return true;
10563 }
10564 else
10565 {
10566 return false;
10567 }
10568 }
10569
10570
10572 {
10574 {
10576 }
10577 }
10578
10579
10581 {
10583 }
10584
10586 {
10588 }
10589
10590 override void InsertAgent(
int agent,
float count = 1)
10591 {
10592 if (count < 1)
10593 return;
10594
10596 }
10597
10600 {
10602 }
10603
10604
10606 {
10608 }
10609
10610
10611
10612
10613
10614
10615
10616
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10627
10628
10629
10630
10631
10632
10633
10634
10635
10636
10637
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10648
10649
10650
10652 {
10654 return false;
10655 return true;
10656 }
10657
10659 {
10660
10662 }
10663
10664
10667 {
10668 super.CheckForRoofLimited(timeTresholdMS);
10669
10671 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10672 {
10673 m_PreviousRoofTestTime = time;
10674 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10675 }
10676 }
10677
10678
10680 {
10682 {
10683 return 0;
10684 }
10685
10686 if (GetInventory().GetAttachmentSlotsCount() != 0)
10687 {
10688 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
10689 if (filter)
10690 return filter.GetProtectionLevel(type, false, system);
10691 else
10692 return 0;
10693 }
10694
10695 string subclassPath, entryName;
10696
10697 switch (type)
10698 {
10700 entryName = "biological";
10701 break;
10703 entryName = "chemical";
10704 break;
10705 default:
10706 entryName = "biological";
10707 break;
10708 }
10709
10710 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
10711
10713 }
10714
10715
10716
10719 {
10720 if (!IsMagazine())
10722
10724 }
10725
10726
10727
10728
10729
10734 {
10735 return true;
10736 }
10737
10739 {
10741 }
10742
10743
10744
10745
10746
10748 {
10749 if (parent)
10750 {
10751 if (parent.IsInherited(DayZInfected))
10752 return true;
10753
10754 if (!parent.IsRuined())
10755 return true;
10756 }
10757
10758 return true;
10759 }
10760
10762 {
10763 if (!super.CanPutAsAttachment(parent))
10764 {
10765 return false;
10766 }
10767
10768 if (!IsRuined() && !parent.IsRuined())
10769 {
10770 return true;
10771 }
10772
10773 return false;
10774 }
10775
10777 {
10778
10779
10780
10781
10782 return super.CanReceiveItemIntoCargo(item);
10783 }
10784
10786 {
10787
10788
10789
10790
10791 GameInventory attachmentInv = attachment.GetInventory();
10793 {
10794 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
10795 return false;
10796 }
10797
10798 InventoryLocation loc = new InventoryLocation();
10799 attachment.GetInventory().GetCurrentInventoryLocation(loc);
10800 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
10801 return false;
10802
10803 return super.CanReceiveAttachment(attachment, slotId);
10804 }
10805
10807 {
10808 if (!super.CanReleaseAttachment(attachment))
10809 return false;
10810
10811 return GetInventory().AreChildrenAccessible();
10812 }
10813
10814
10815
10816
10817
10818
10819
10820
10821
10822
10823
10824
10825
10826
10827
10828
10829
10830
10831
10832
10833
10835 {
10836 int id = muzzle_owner.GetMuzzleID();
10837 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
10838
10839 if (WPOF_array)
10840 {
10841 for (int i = 0; i < WPOF_array.Count(); i++)
10842 {
10843 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
10844
10845 if (WPOF)
10846 {
10847 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
10848 }
10849 }
10850 }
10851 }
10852
10853
10855 {
10856 int id = muzzle_owner.GetMuzzleID();
10858
10859 if (WPOBE_array)
10860 {
10861 for (int i = 0; i < WPOBE_array.Count(); i++)
10862 {
10863 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
10864
10865 if (WPOBE)
10866 {
10867 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10868 }
10869 }
10870 }
10871 }
10872
10873
10875 {
10876 int id = muzzle_owner.GetMuzzleID();
10877 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10878
10879 if (WPOOH_array)
10880 {
10881 for (int i = 0; i < WPOOH_array.Count(); i++)
10882 {
10883 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10884
10885 if (WPOOH)
10886 {
10887 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
10888 }
10889 }
10890 }
10891 }
10892
10893
10895 {
10896 int id = muzzle_owner.GetMuzzleID();
10897 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10898
10899 if (WPOOH_array)
10900 {
10901 for (int i = 0; i < WPOOH_array.Count(); i++)
10902 {
10903 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10904
10905 if (WPOOH)
10906 {
10907 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10908 }
10909 }
10910 }
10911 }
10912
10913
10915 {
10916 int id = muzzle_owner.GetMuzzleID();
10917 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
10918
10919 if (WPOOH_array)
10920 {
10921 for (int i = 0; i < WPOOH_array.Count(); i++)
10922 {
10923 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
10924
10925 if (WPOOH)
10926 {
10927 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
10928 }
10929 }
10930 }
10931 }
10932
10933
10934
10936 {
10938 {
10939 return true;
10940 }
10941
10942 return false;
10943 }
10944
10946 {
10948 {
10949 return true;
10950 }
10951
10952 return false;
10953 }
10954
10956 {
10958 {
10959 return true;
10960 }
10961
10962 return false;
10963 }
10964
10966 {
10967 return false;
10968 }
10969
10972 {
10973 return UATimeSpent.DEFAULT_DEPLOY;
10974 }
10975
10976
10977
10978
10980 {
10982 SetSynchDirty();
10983 }
10984
10986 {
10988 }
10989
10990
10992 {
10993 return false;
10994 }
10995
10998 {
10999 string att_type = "None";
11000
11001 if (ConfigIsExisting("soundAttType"))
11002 {
11003 att_type = ConfigGetString("soundAttType");
11004 }
11005
11007 }
11008
11010 {
11012 }
11013
11014
11015
11016
11017
11021
11023 {
11026
11028 }
11029
11030
11032 {
11034 return;
11035
11037
11040
11043
11044 SoundParameters params = new SoundParameters();
11048 }
11049
11050
11052 {
11054 return;
11055
11057 SetSynchDirty();
11058
11061 }
11062
11063
11065 {
11067 return;
11068
11070 SetSynchDirty();
11071
11074 }
11075
11077 {
11079 }
11080
11082 {
11084 }
11085
11088 {
11089 if (!
GetGame().IsDedicatedServer())
11090 {
11091 if (ConfigIsExisting("attachSoundSet"))
11092 {
11093 string cfg_path = "";
11094 string soundset = "";
11095 string type_name =
GetType();
11096
11099 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11100 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11101
11102 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11103 {
11104 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11105 {
11106 if (cfg_slot_array[i] == slot_type)
11107 {
11108 soundset = cfg_soundset_array[i];
11109 break;
11110 }
11111 }
11112 }
11113
11114 if (soundset != "")
11115 {
11116 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11118 }
11119 }
11120 }
11121 }
11122
11124 {
11125
11126 }
11127
11128 void OnApply(PlayerBase player);
11129
11131 {
11132 return 1.0;
11133 };
11134
11136 {
11138 }
11139
11141 {
11143 }
11144
11146
11148 {
11149 SetDynamicPhysicsLifeTime(0.01);
11151 }
11152
11154 {
11155 array<string> zone_names = new array<string>;
11156 GetDamageZones(zone_names);
11157 for (int i = 0; i < zone_names.Count(); i++)
11158 {
11159 SetHealthMax(zone_names.Get(i),"Health");
11160 }
11161 SetHealthMax("","Health");
11162 }
11163
11166 {
11167 float global_health = GetHealth01("","Health");
11168 array<string> zones = new array<string>;
11169 GetDamageZones(zones);
11170
11171 for (int i = 0; i < zones.Count(); i++)
11172 {
11173 SetHealth01(zones.Get(i),"Health",global_health);
11174 }
11175 }
11176
11179 {
11180 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11181 }
11182
11184 {
11185 if (!hasRootAsPlayer)
11186 {
11187 if (refParentIB)
11188 {
11189
11190 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11191 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11192
11193 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11194 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11195
11198 }
11199 else
11200 {
11201
11204 }
11205 }
11206 }
11207
11209 {
11211 {
11212 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11213 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
11214 {
11215 float heatPermCoef = 1.0;
11217 while (ent)
11218 {
11219 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11220 ent = ent.GetHierarchyParent();
11221 }
11222
11223 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11224 }
11225 }
11226 }
11227
11229 {
11230
11231 EntityAI parent = GetHierarchyParent();
11232 if (!parent)
11233 {
11234 hasParent = false;
11235 hasRootAsPlayer = false;
11236 }
11237 else
11238 {
11239 hasParent = true;
11240 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11241 refParentIB =
ItemBase.Cast(parent);
11242 }
11243 }
11244
11245 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11246 {
11247
11248 }
11249
11251 {
11252
11253 return false;
11254 }
11255
11257 {
11258
11259
11260 return false;
11261 }
11262
11264 {
11265
11266 return false;
11267 }
11268
11271 {
11272 return !GetIsFrozen() &&
IsOpen();
11273 }
11274
11276 {
11277 bool hasParent = false, hasRootAsPlayer = false;
11279
11280 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11281 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11282
11283 if (wwtu || foodDecay)
11284 {
11288
11289 if (processWetness || processTemperature || processDecay)
11290 {
11292
11293 if (processWetness)
11294 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11295
11296 if (processTemperature)
11298
11299 if (processDecay)
11300 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11301 }
11302 }
11303 }
11304
11307 {
11309 }
11310
11312 {
11315
11316 return super.GetTemperatureFreezeThreshold();
11317 }
11318
11320 {
11323
11324 return super.GetTemperatureThawThreshold();
11325 }
11326
11328 {
11331
11332 return super.GetItemOverheatThreshold();
11333 }
11334
11336 {
11338 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11339
11340 return super.GetTemperatureFreezeTime();
11341 }
11342
11344 {
11346 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11347
11348 return super.GetTemperatureThawTime();
11349 }
11350
11355
11357 {
11358 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11359 }
11360
11362 {
11363 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11364 }
11365
11368 {
11370 }
11371
11373 {
11375 }
11376
11378 {
11380 }
11381
11384 {
11385 return null;
11386 }
11387
11390 {
11391 return false;
11392 }
11393
11395 {
11397 {
11400 if (!trg)
11401 {
11403 explosive = this;
11404 }
11405
11406 explosive.PairRemote(trg);
11408
11409 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11410 trg.SetPersistentPairID(persistentID);
11411 explosive.SetPersistentPairID(persistentID);
11412
11413 return true;
11414 }
11415 return false;
11416 }
11417
11420 {
11421 float ret = 1.0;
11424 ret *= GetHealth01();
11425
11426 return ret;
11427 }
11428
11429 #ifdef DEVELOPER
11430 override void SetDebugItem()
11431 {
11432 super.SetDebugItem();
11433 _itemBase = this;
11434 }
11435
11437 {
11438 string text = super.GetDebugText();
11439
11441 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11442
11443 return text;
11444 }
11445 #endif
11446
11448 {
11449 return true;
11450 }
11451
11453
11455
11457 {
11460 }
11461
11462
11470
11486}
11487
11489{
11491 if (entity)
11492 {
11493 bool is_item = entity.IsInherited(
ItemBase);
11494 if (is_item && full_quantity)
11495 {
11498 }
11499 }
11500 else
11501 {
11503 return NULL;
11504 }
11505 return entity;
11506}
11507
11509{
11510 if (item)
11511 {
11512 if (health > 0)
11513 item.SetHealth("", "", health);
11514
11515 if (item.CanHaveTemperature())
11516 {
11518 if (item.CanFreeze())
11519 item.SetFrozen(false);
11520 }
11521
11522 if (item.HasEnergyManager())
11523 {
11524 if (quantity >= 0)
11525 {
11526 item.GetCompEM().SetEnergy0To1(quantity);
11527 }
11528 else
11529 {
11531 }
11532 }
11533 else if (item.IsMagazine())
11534 {
11535 Magazine mag = Magazine.Cast(item);
11536 if (quantity >= 0)
11537 {
11538 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11539 }
11540 else
11541 {
11543 }
11544
11545 }
11546 else
11547 {
11548 if (quantity >= 0)
11549 {
11550 item.SetQuantityNormalized(quantity, false);
11551 }
11552 else
11553 {
11555 }
11556
11557 }
11558 }
11559}
11560
11561#ifdef DEVELOPER
11563#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
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 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...
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)
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)
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
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)
void Open()
Implementations only.
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 EEOnCECreate()
Called when entity is being created as new by CE/ Debug.
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 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 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
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
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 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 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.