6913{
6915 {
6916 return true;
6917 }
6918};
6919
6921{
6922
6923};
6924
6925
6926
6928{
6932
6934
6937
6938
6939
6940
6941
6950
6956
6961
6966
6987 protected bool m_IsResultOfSplit
6988
6990
6995
6996
6997
6999
7003
7004
7005
7007
7010
7011
7012
7018
7019
7027
7030
7031
7033
7034
7036
7037
7042
7043
7048
7050
7051
7053
7054
7056 {
7061
7062 if (!
g_Game.IsDedicatedServer())
7063 {
7065 {
7067
7069 {
7071 }
7072 }
7073
7076 }
7077
7078 m_OldLocation = null;
7079
7081 {
7083 }
7084
7085 if (ConfigIsExisting("headSelectionsToHide"))
7086 {
7089 }
7090
7092 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7093 {
7095 }
7096
7098
7099 m_IsResultOfSplit = false;
7100
7102 }
7103
7105 {
7106 super.InitItemVariables();
7107
7113 m_Count = ConfigGetInt(
"count");
7114
7117
7122
7125
7130
7142
7146
7147
7150 if (ConfigIsExisting("canBeSplit"))
7151 {
7154 }
7155
7157 if (ConfigIsExisting("itemBehaviour"))
7159
7160
7163 RegisterNetSyncVariableInt("m_VarLiquidType");
7164 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7165
7166 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7167 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7168 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7169
7170 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7171 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7172 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7173 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7174
7175 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7176 RegisterNetSyncVariableBool("m_IsTakeable");
7177 RegisterNetSyncVariableBool("m_IsHologram");
7178
7181 {
7184 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7185 }
7186
7188
7190 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7192
7194 }
7195
7197 {
7199 }
7200
7202 {
7205 {
7210 }
7211 }
7212
7213 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7214 {
7216 {
7219 }
7220
7222 }
7223
7225 {
7231 }
7232
7234
7236 {
7238
7239 if (!action)
7240 {
7241 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7242 return;
7243 }
7244
7246 if (!ai)
7247 {
7249 return;
7250 }
7251
7253 if (!action_array)
7254 {
7255 action_array = new array<ActionBase_Basic>;
7257 }
7258 if (LogManager.IsActionLogEnable())
7259 {
7260 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7261 }
7262
7263 if (action_array.Find(action) != -1)
7264 {
7265 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7266 }
7267 else
7268 {
7269 action_array.Insert(action);
7270 }
7271 }
7272
7274 {
7275 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7276 ActionBase action = player.GetActionManager().GetAction(actionName);
7279
7280 if (action_array)
7281 {
7282 action_array.RemoveItem(action);
7283 }
7284 }
7285
7286
7287
7289 {
7290 ActionOverrideData overrideData = new ActionOverrideData();
7294
7296 if (!actionMap)
7297 {
7300 }
7301
7302 actionMap.Insert(this.
Type(), overrideData);
7303
7304 }
7305
7307
7309
7310
7312 {
7315
7318
7319 string config_to_search = "CfgVehicles";
7320 string muzzle_owner_config;
7321
7323 {
7324 if (IsInherited(Weapon))
7325 config_to_search = "CfgWeapons";
7326
7327 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7328
7329 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7330
7331 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7332
7333 if (config_OnFire_subclass_count > 0)
7334 {
7335 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7336
7337 for (int i = 0; i < config_OnFire_subclass_count; i++)
7338 {
7339 string particle_class = "";
7340 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7341 string config_OnFire_entry = config_OnFire_class + particle_class;
7342 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7343 WPOF_array.Insert(WPOF);
7344 }
7345
7346
7348 }
7349 }
7350
7352 {
7353 config_to_search = "CfgWeapons";
7354 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7355
7356 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7357
7358 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7359
7360 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7361 {
7362 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7363
7364 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7365 {
7366 string particle_class2 = "";
7367 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7368 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7369 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7370 WPOBE_array.Insert(WPOBE);
7371 }
7372
7373
7375 }
7376 }
7377 }
7378
7379
7381 {
7384
7386 {
7387 string config_to_search = "CfgVehicles";
7388
7389 if (IsInherited(Weapon))
7390 config_to_search = "CfgWeapons";
7391
7392 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7393 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7394
7395 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7396 {
7397
7399
7401 {
7403 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7405 return;
7406 }
7407
7410
7411
7412
7413 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7414 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7415
7416 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7417 {
7418 string particle_class = "";
7419 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7420 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7421 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7422
7423 if (entry_type == CT_CLASS)
7424 {
7425 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7426 WPOOH_array.Insert(WPOF);
7427 }
7428 }
7429
7430
7432 }
7433 }
7434 }
7435
7437 {
7439 }
7440
7442 {
7444 {
7446
7449
7452
7453 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7454 }
7455 }
7456
7458 {
7460 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7461
7463 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7464
7466 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7467
7469 {
7471 }
7472 }
7473
7475 {
7477 }
7478
7480 {
7483 else
7485
7487 {
7490 }
7491 else
7492 {
7495
7498 }
7499
7501 }
7502
7504 {
7506 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7507 }
7508
7510 {
7512 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7514 }
7515
7517 {
7519 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7520 }
7521
7523 {
7526
7527 OverheatingParticle OP = new OverheatingParticle();
7532
7534 }
7535
7537 {
7540
7541 return -1;
7542 }
7543
7545 {
7547 {
7550
7551 for (int i = count; i > 0; --i)
7552 {
7553 int id = i - 1;
7556
7559
7560 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7561 {
7562 if (p)
7563 {
7566 }
7567 }
7568 }
7569 }
7570 }
7571
7573 {
7575 {
7577 {
7578 int id = i - 1;
7580
7581 if (OP)
7582 {
7584
7585 if (p)
7586 {
7588 }
7589
7590 delete OP;
7591 }
7592 }
7593
7596 }
7597 }
7598
7601 {
7602 return 0.0;
7603 }
7604
7605
7607 {
7608 return 250;
7609 }
7610
7612 {
7613 return 0;
7614 }
7615
7618 {
7620 return true;
7621
7622 return false;
7623 }
7624
7627 {
7630
7632 {
7634 }
7635 else
7636 {
7637
7639 }
7640
7642 }
7643
7650 {
7651 return -1;
7652 }
7653
7654
7655
7656
7658 {
7660 {
7661 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7662 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7663
7664 if (r_index >= 0)
7665 {
7666 InventoryLocation r_il = new InventoryLocation;
7667 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7668
7669 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7672 {
7673 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7674 }
7676 {
7677 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7678 }
7679
7680 }
7681
7682 player.GetHumanInventory().ClearUserReservedLocation(this);
7683 }
7684
7687 }
7688
7689
7690
7691
7693 {
7694 return ItemBase.m_DebugActionsMask;
7695 }
7696
7698 {
7699 return ItemBase.m_DebugActionsMask & mask;
7700 }
7701
7703 {
7704 ItemBase.m_DebugActionsMask = mask;
7705 }
7706
7708 {
7709 ItemBase.m_DebugActionsMask |= mask;
7710 }
7711
7713 {
7714 ItemBase.m_DebugActionsMask &= ~mask;
7715 }
7716
7718 {
7720 {
7722 }
7723 else
7724 {
7726 }
7727 }
7728
7729
7731 {
7732 if (GetEconomyProfile())
7733 {
7734 float q_max = GetEconomyProfile().GetQuantityMax();
7735 if (q_max > 0)
7736 {
7737 float q_min = GetEconomyProfile().GetQuantityMin();
7738 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7739
7741 {
7742 ComponentEnergyManager comp = GetCompEM();
7744 {
7746 }
7747 }
7749 {
7751
7752 }
7753
7754 }
7755 }
7756 }
7757
7760 {
7761 EntityAI parent = GetHierarchyParent();
7762
7763 if (parent)
7764 {
7765 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7766 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7767 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7768 }
7769 }
7770
7773 {
7774 EntityAI parent = GetHierarchyParent();
7775
7776 if (parent)
7777 {
7778 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7779 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7780 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7781 }
7782 }
7783
7785 {
7786
7787
7788
7789
7791
7793 {
7794 if (ScriptInputUserData.CanStoreInputUserData())
7795 {
7796 ScriptInputUserData ctx = new ScriptInputUserData;
7802 ctx.
Write(use_stack_max);
7805
7807 {
7808 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7809 }
7810 }
7811 }
7812 else if (!
g_Game.IsMultiplayer())
7813 {
7815 }
7816 }
7817
7819 {
7821 }
7822
7824 {
7826 }
7827
7829 {
7831 }
7832
7834 {
7835
7836 return false;
7837 }
7838
7840 {
7841 return false;
7842 }
7843
7847 {
7848 return false;
7849 }
7850
7852 {
7853 return "";
7854 }
7855
7857
7859 {
7860 return false;
7861 }
7862
7864 {
7865 return true;
7866 }
7867
7868
7869
7871 {
7872 return true;
7873 }
7874
7876 {
7877 return true;
7878 }
7879
7881 {
7882 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7884 }
7885
7887 {
7889 }
7890
7892 {
7894 if (!is_being_placed)
7896 SetSynchDirty();
7897 }
7898
7899
7901
7903 {
7905 }
7906
7908 {
7910 }
7911
7913 {
7914 return 1;
7915 }
7916
7918 {
7919 return false;
7920 }
7921
7923 {
7925 SetSynchDirty();
7926 }
7927
7928
7929
7930
7931
7932
7933
7934
7935
7936
7937
7938
7939
7940
7941
7942
7943
7944
7945
7946
7947
7948
7949
7950
7951
7952
7953
7954
7955
7956
7957
7958
7959
7960
7961
7963 {
7964 super.OnMovedInsideCargo(container);
7965
7966 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
7967 }
7968
7969 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
7970 {
7971 super.EEItemLocationChanged(oldLoc, newLoc);
7972
7973 PlayerBase newPlayer = null;
7974 PlayerBase oldPlayer = null;
7975
7976 if (newLoc.GetParent())
7977 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
7978
7979 if (oldLoc.GetParent())
7980 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
7981
7983 {
7984 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
7985
7986 if (rIndex >= 0)
7987 {
7988 InventoryLocation rIl = new InventoryLocation;
7989 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
7990
7991 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
7994 {
7995 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
7996 }
7998 {
8000 }
8001
8002 }
8003 }
8004
8006 {
8007 if (newPlayer)
8008 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8009
8010 if (newPlayer == oldPlayer)
8011 {
8012 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8013 {
8015 {
8016 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8017 {
8018 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8019 }
8020 }
8021 else
8022 {
8023 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8024 }
8025 }
8026
8027 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8028 {
8029 int type = oldLoc.GetType();
8031 {
8032 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8033 }
8035 {
8036 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8037 }
8038 }
8039 if (!m_OldLocation)
8040 {
8041 m_OldLocation = new InventoryLocation;
8042 }
8043 m_OldLocation.Copy(oldLoc);
8044 }
8045 else
8046 {
8047 if (m_OldLocation)
8048 {
8049 m_OldLocation.Reset();
8050 }
8051 }
8052
8053 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8054 }
8055 else
8056 {
8057 if (newPlayer)
8058 {
8059 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8060 if (resIndex >= 0)
8061 {
8062 InventoryLocation il = new InventoryLocation;
8063 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8065 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8068 {
8069 il.
GetParent().GetOnReleaseLock().Invoke(it);
8070 }
8072 {
8074 }
8075
8076 }
8077 }
8079 {
8080
8082 }
8083
8084 if (m_OldLocation)
8085 {
8086 m_OldLocation.Reset();
8087 }
8088 }
8089
8091 {
8092 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8093 }
8094
8096 {
8097 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8098 }
8099 }
8100
8101 override void EOnContact(IEntity other, Contact extra)
8102 {
8104 {
8105 int liquidType = -1;
8107 if (impactSpeed > 0.0)
8108 {
8110 #ifndef SERVER
8112 #else
8114 SetSynchDirty();
8115 #endif
8117 }
8118 }
8119
8120 #ifdef SERVER
8121 if (GetCompEM() && GetCompEM().IsPlugged())
8122 {
8123 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8124 GetCompEM().UnplugThis();
8125 }
8126 #endif
8127 }
8128
8130
8132 {
8134 }
8135
8137 {
8138
8139 }
8140
8142 {
8143 super.OnItemLocationChanged(old_owner, new_owner);
8144
8145 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8146 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8147
8148 if (!relatedPlayer && playerNew)
8149 relatedPlayer = playerNew;
8150
8151 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8152 {
8154 if (actionMgr)
8155 {
8156 ActionBase currentAction = actionMgr.GetRunningAction();
8157 if (currentAction)
8159 }
8160 }
8161
8162 Man ownerPlayerOld = null;
8163 Man ownerPlayerNew = null;
8164
8165 if (old_owner)
8166 {
8167 if (old_owner.
IsMan())
8168 {
8169 ownerPlayerOld = Man.Cast(old_owner);
8170 }
8171 else
8172 {
8173 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8174 }
8175 }
8176 else
8177 {
8179 {
8181
8182 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8183 {
8184 GetCompEM().UnplugThis();
8185 }
8186 }
8187 }
8188
8189 if (new_owner)
8190 {
8191 if (new_owner.
IsMan())
8192 {
8193 ownerPlayerNew = Man.Cast(new_owner);
8194 }
8195 else
8196 {
8197 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8198 }
8199 }
8200
8201 if (ownerPlayerOld != ownerPlayerNew)
8202 {
8203 if (ownerPlayerOld)
8204 {
8205 array<EntityAI> subItemsExit = new array<EntityAI>;
8207 for (int i = 0; i < subItemsExit.Count(); i++)
8208 {
8211 }
8212 }
8213
8214 if (ownerPlayerNew)
8215 {
8216 array<EntityAI> subItemsEnter = new array<EntityAI>;
8218 for (int j = 0; j < subItemsEnter.Count(); j++)
8219 {
8222 }
8223 }
8224 }
8225 else if (ownerPlayerNew != null)
8226 {
8227 PlayerBase nplayer;
8228 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8229 {
8230 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8232 for (int k = 0; k < subItemsUpdate.Count(); k++)
8233 {
8235 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8236 }
8237 }
8238 }
8239
8240 if (old_owner)
8241 old_owner.OnChildItemRemoved(this);
8242 if (new_owner)
8243 new_owner.OnChildItemReceived(this);
8244 }
8245
8246
8248 {
8249 super.EEDelete(parent);
8250 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8251 if (player)
8252 {
8254
8255 if (player.IsAlive())
8256 {
8257 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8258 if (r_index >= 0)
8259 {
8260 InventoryLocation r_il = new InventoryLocation;
8261 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8262
8263 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8266 {
8267 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8268 }
8270 {
8271 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8272 }
8273
8274 }
8275
8276 player.RemoveQuickBarEntityShortcut(this);
8277 }
8278 }
8279 }
8280
8282 {
8283 super.EEKilled(killer);
8284
8287 {
8288 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8289 {
8290 if (IsMagazine())
8291 {
8292 if (Magazine.Cast(this).GetAmmoCount() > 0)
8293 {
8295 }
8296 }
8297 else
8298 {
8300 }
8301 }
8302 }
8303 }
8304
8306 {
8307 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8308
8309 super.OnWasAttached(parent, slot_id);
8310
8313
8316 }
8317
8319 {
8320 super.OnWasDetached(parent, slot_id);
8321
8324
8327 }
8328
8330 {
8331 int idx;
8334
8335 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8336 if (inventory_slots.Count() < 1)
8337 {
8338 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8339 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8340 }
8341 else
8342 {
8343 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8344 }
8345
8346 idx = inventory_slots.Find(slot);
8347 if (idx < 0)
8348 return "";
8349
8350 return attach_types.Get(idx);
8351 }
8352
8354 {
8355 int idx = -1;
8356 string slot;
8357
8360
8361 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8362 if (inventory_slots.Count() < 1)
8363 {
8364 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8365 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8366 }
8367 else
8368 {
8369 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8370 if (detach_types.Count() < 1)
8371 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8372 }
8373
8374 for (int i = 0; i < inventory_slots.Count(); i++)
8375 {
8376 slot = inventory_slots.Get(i);
8377 }
8378
8379 if (slot != "")
8380 {
8381 if (detach_types.Count() == 1)
8382 idx = 0;
8383 else
8384 idx = inventory_slots.Find(slot);
8385 }
8386 if (idx < 0)
8387 return "";
8388
8389 return detach_types.Get(idx);
8390 }
8391
8393 {
8394
8396
8397
8398 float min_time = 1;
8399 float max_time = 3;
8400 float delay = Math.RandomFloat(min_time, max_time);
8401
8402 explode_timer.Run(delay, this, "DoAmmoExplosion");
8403 }
8404
8406 {
8407 Magazine magazine = Magazine.Cast(this);
8408 int pop_sounds_count = 6;
8409 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8410
8411
8412 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8413 string sound_name = pop_sounds[ sound_idx ];
8414 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8415
8416
8417 magazine.ServerAddAmmoCount(-1);
8418
8419
8420 float min_temp_to_explode = 100;
8421
8422 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8423 {
8425 }
8426 }
8427
8428
8429 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8430 {
8431 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8432
8433 const int CHANCE_DAMAGE_CARGO = 4;
8434 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8435 const int CHANCE_DAMAGE_NOTHING = 2;
8436
8438 {
8439 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8440 int chances;
8441 int rnd;
8442
8443 if (GetInventory().GetCargo())
8444 {
8445 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8446 rnd = Math.RandomInt(0,chances);
8447
8448 if (rnd < CHANCE_DAMAGE_CARGO)
8449 {
8451 }
8452 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8453 {
8455 }
8456 }
8457 else
8458 {
8459 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8460 rnd = Math.RandomInt(0,chances);
8461
8462 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8463 {
8465 }
8466 }
8467 }
8468 }
8469
8471 {
8472 CargoBase cargo = GetInventory().GetCargo();
8473 if (cargo)
8474 {
8476 if (item_count > 0)
8477 {
8478 int random_pick = Math.RandomInt(0, item_count);
8480 if (!item.IsExplosive())
8481 {
8482 item.AddHealth("","",damage);
8483 return true;
8484 }
8485 }
8486 }
8487 return false;
8488 }
8489
8491 {
8492 GameInventory inventory = GetInventory();
8494 if (attachment_count > 0)
8495 {
8496 int random_pick = Math.RandomInt(0, attachment_count);
8498 if (!attachment.IsExplosive())
8499 {
8500 attachment.AddHealth("","",damage);
8501 return true;
8502 }
8503 }
8504 return false;
8505 }
8506
8508 {
8510 }
8511
8513 {
8515 return GetInventory().CanRemoveEntity();
8516
8517 return false;
8518 }
8519
8521 {
8522
8524 return false;
8525
8526
8528 return false;
8529
8530
8531
8533 if (delta == 0)
8534 return false;
8535
8536
8537 return true;
8538 }
8539
8541 {
8543 {
8544 if (ScriptInputUserData.CanStoreInputUserData())
8545 {
8546 ScriptInputUserData ctx = new ScriptInputUserData;
8551 ctx.
Write(destination_entity);
8555 }
8556 }
8557 else if (!
g_Game.IsMultiplayer())
8558 {
8560 }
8561 }
8562
8564 {
8565 float split_quantity_new;
8569 InventoryLocation loc = new InventoryLocation;
8570
8571 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8572 {
8574 split_quantity_new = stack_max;
8575 else
8577
8579 {
8580 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8581 if (new_item)
8582 {
8583 new_item.SetResultOfSplit(true);
8584 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8586 new_item.
SetQuantity(split_quantity_new,
false,
true);
8587 }
8588 }
8589 }
8590 else if (destination_entity && slot_id == -1)
8591 {
8592 if (quantity > stack_max)
8593 split_quantity_new = stack_max;
8594 else
8595 split_quantity_new = quantity;
8596
8598 {
8599 GameInventory destinationInventory = destination_entity.GetInventory();
8601 {
8604 }
8605
8606 if (new_item)
8607 {
8608 new_item.SetResultOfSplit(true);
8609 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8611 new_item.
SetQuantity(split_quantity_new,
false,
true);
8612 }
8613 }
8614 }
8615 else
8616 {
8617 if (stack_max != 0)
8618 {
8620 {
8622 }
8623
8624 if (split_quantity_new == 0)
8625 {
8626 if (!
g_Game.IsMultiplayer())
8627 player.PhysicalPredictiveDropItem(this);
8628 else
8629 player.ServerDropEntity(this);
8630 return;
8631 }
8632
8634 {
8636
8637 if (new_item)
8638 {
8639 new_item.SetResultOfSplit(true);
8640 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8643 new_item.PlaceOnSurface();
8644 }
8645 }
8646 }
8647 }
8648 }
8649
8651 {
8652 float split_quantity_new;
8656 InventoryLocation loc = new InventoryLocation;
8657
8658 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8659 {
8661 split_quantity_new = stack_max;
8662 else
8664
8666 {
8667 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8668 if (new_item)
8669 {
8670 new_item.SetResultOfSplit(true);
8671 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8673 new_item.
SetQuantity(split_quantity_new,
false,
true);
8674 }
8675 }
8676 }
8677 else if (destination_entity && slot_id == -1)
8678 {
8679 if (quantity > stack_max)
8680 split_quantity_new = stack_max;
8681 else
8682 split_quantity_new = quantity;
8683
8685 {
8686 GameInventory destinationInventory = destination_entity.GetInventory();
8688 {
8691 }
8692
8693 if (new_item)
8694 {
8695 new_item.SetResultOfSplit(true);
8696 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8698 new_item.
SetQuantity(split_quantity_new,
false,
true);
8699 }
8700 }
8701 }
8702 else
8703 {
8704 if (stack_max != 0)
8705 {
8707 {
8709 }
8710
8712 {
8714
8715 if (new_item)
8716 {
8717 new_item.SetResultOfSplit(true);
8718 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8721 new_item.PlaceOnSurface();
8722 }
8723 }
8724 }
8725 }
8726 }
8727
8729 {
8731 {
8732 if (ScriptInputUserData.CanStoreInputUserData())
8733 {
8734 ScriptInputUserData ctx = new ScriptInputUserData;
8739 dst.WriteToContext(ctx);
8741 }
8742 }
8743 else if (!
g_Game.IsMultiplayer())
8744 {
8746 }
8747 }
8748
8750 {
8752 {
8753 if (ScriptInputUserData.CanStoreInputUserData())
8754 {
8755 ScriptInputUserData ctx = new ScriptInputUserData;
8760 ctx.
Write(destination_entity);
8766 }
8767 }
8768 else if (!
g_Game.IsMultiplayer())
8769 {
8771 }
8772 }
8773
8775 {
8777 }
8778
8780 {
8782 float split_quantity_new;
8784 if (dst.IsValid())
8785 {
8786 int slot_id = dst.GetSlot();
8788
8789 if (quantity > stack_max)
8790 split_quantity_new = stack_max;
8791 else
8792 split_quantity_new = quantity;
8793
8795 {
8797
8798 if (new_item)
8799 {
8800 new_item.SetResultOfSplit(true);
8801 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8803 new_item.
SetQuantity(split_quantity_new,
false,
true);
8804 }
8805
8806 return new_item;
8807 }
8808 }
8809
8810 return null;
8811 }
8812
8814 {
8816 float split_quantity_new;
8818 if (destination_entity)
8819 {
8821 if (quantity > stackable)
8822 split_quantity_new = stackable;
8823 else
8824 split_quantity_new = quantity;
8825
8827 {
8828 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8829 if (new_item)
8830 {
8831 new_item.SetResultOfSplit(true);
8832 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8834 new_item.
SetQuantity(split_quantity_new,
false,
true);
8835 }
8836 }
8837 }
8838 }
8839
8841 {
8843 {
8844 if (ScriptInputUserData.CanStoreInputUserData())
8845 {
8846 ScriptInputUserData ctx = new ScriptInputUserData;
8851 ItemBase destination_entity =
this;
8852 ctx.
Write(destination_entity);
8856 }
8857 }
8858 else if (!
g_Game.IsMultiplayer())
8859 {
8861 }
8862 }
8863
8865 {
8867 float split_quantity_new;
8869 if (player)
8870 {
8872 if (quantity > stackable)
8873 split_quantity_new = stackable;
8874 else
8875 split_quantity_new = quantity;
8876
8878 {
8879 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8880 new_item =
ItemBase.Cast(in_hands);
8881 if (new_item)
8882 {
8883 new_item.SetResultOfSplit(true);
8884 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8886 new_item.SetQuantity(split_quantity_new, false, true);
8887 }
8888 }
8889 }
8890 }
8891
8893 {
8895 float split_quantity_new = Math.Floor(quantity * 0.5);
8896
8898 return;
8899
8901
8902 if (new_item)
8903 {
8904 if (new_item.GetQuantityMax() < split_quantity_new)
8905 {
8906 split_quantity_new = new_item.GetQuantityMax();
8907 }
8908
8909 new_item.SetResultOfSplit(true);
8910 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8911
8913 {
8916 }
8917 else
8918 {
8920 new_item.
SetQuantity(split_quantity_new,
false,
true);
8921 }
8922 }
8923 }
8924
8926 {
8928 float split_quantity_new = Math.Floor(quantity / 2);
8929
8931 return;
8932
8933 InventoryLocation invloc = new InventoryLocation;
8935
8937 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
8938
8939 if (new_item)
8940 {
8941 if (new_item.GetQuantityMax() < split_quantity_new)
8942 {
8943 split_quantity_new = new_item.GetQuantityMax();
8944 }
8946 {
8949 }
8950 else if (split_quantity_new > 1)
8951 {
8953 new_item.
SetQuantity(split_quantity_new,
false,
true);
8954 }
8955 }
8956 }
8957
8960 {
8961 SetWeightDirty();
8963
8964 if (parent)
8965 parent.OnAttachmentQuantityChangedEx(this, delta);
8966
8968 {
8970 {
8972 }
8974 {
8975 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
8977 }
8978 }
8979 }
8980
8983 {
8984
8985 }
8986
8989 {
8991 }
8992
8994 {
8995 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
8996
8998 {
8999 if (newLevel == GameConstants.STATE_RUINED)
9000 {
9002 EntityAI parent = GetHierarchyParent();
9003 if (parent && parent.IsFireplace())
9004 {
9005 CargoBase cargo = GetInventory().GetCargo();
9006 if (cargo)
9007 {
9009 {
9011 }
9012 }
9013 }
9014 }
9015
9017 {
9018
9020 return;
9021 }
9022
9023 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9024 {
9026 }
9027 }
9028 }
9029
9030
9032 {
9033 super.OnRightClick();
9034
9036 {
9038 {
9039 if (ScriptInputUserData.CanStoreInputUserData())
9040 {
9041 EntityAI root = GetHierarchyRoot();
9042 Man playerOwner = GetHierarchyRootPlayer();
9043 InventoryLocation dst = new InventoryLocation;
9044
9045
9046 if (!playerOwner && root && root == this)
9047 {
9049 }
9050 else
9051 {
9052
9053 GetInventory().GetCurrentInventoryLocation(dst);
9055 {
9056 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9058 {
9060 }
9061 else
9062 {
9064
9065
9066 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9067 {
9069 }
9070 else
9071 {
9072 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9073 }
9074 }
9075 }
9076 }
9077
9078 ScriptInputUserData ctx = new ScriptInputUserData;
9086 }
9087 }
9088 else if (!
g_Game.IsMultiplayer())
9089 {
9091 }
9092 }
9093 }
9094
9096 {
9097 if (root)
9098 {
9099 vector m4[4];
9100 root.GetTransform(m4);
9101 dst.SetGround(this, m4);
9102 }
9103 else
9104 {
9105 GetInventory().GetCurrentInventoryLocation(dst);
9106 }
9107 }
9108
9109 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9110 {
9111
9112 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9113 return false;
9114
9115 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9116 return false;
9117
9118
9120 return false;
9121
9122
9123 Magazine mag = Magazine.Cast(this);
9124 if (mag)
9125 {
9126 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9127 return false;
9128
9129 if (stack_max_limit)
9130 {
9131 Magazine other_mag = Magazine.Cast(other_item);
9132 if (other_item)
9133 {
9134 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9135 return false;
9136 }
9137
9138 }
9139 }
9140 else
9141 {
9142
9144 return false;
9145
9147 return false;
9148 }
9149
9150 PlayerBase player = null;
9151 if (CastTo(player, GetHierarchyRootPlayer()))
9152 {
9153 if (player.GetInventory().HasAttachment(this))
9154 return false;
9155
9156 if (player.IsItemsToDelete())
9157 return false;
9158 }
9159
9160 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9161 return false;
9162
9163 int slotID;
9165 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9166 return false;
9167
9168 return true;
9169 }
9170
9172 {
9174 }
9175
9177 {
9178 return m_IsResultOfSplit;
9179 }
9180
9182 {
9183 m_IsResultOfSplit = value;
9184 }
9185
9187 {
9189 }
9190
9192 {
9193 float other_item_quantity = other_item.GetQuantity();
9194 float this_free_space;
9195
9197
9199
9200 if (other_item_quantity > this_free_space)
9201 {
9202 return this_free_space;
9203 }
9204 else
9205 {
9206 return other_item_quantity;
9207 }
9208 }
9209
9211 {
9213 }
9214
9216 {
9218 return;
9219
9220 if (!IsMagazine() && other_item)
9221 {
9223 if (quantity_used != 0)
9224 {
9225 float hp1 = GetHealth01("","");
9226 float hp2 = other_item.GetHealth01("","");
9227 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9228 hpResult = hpResult / (
GetQuantity() + quantity_used);
9229
9230 hpResult *= GetMaxHealth();
9231 Math.Round(hpResult);
9232 SetHealth("", "Health", hpResult);
9233
9235 other_item.AddQuantity(-quantity_used);
9236 }
9237 }
9239 }
9240
9242 {
9243 #ifdef SERVER
9244 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9245 GetHierarchyParent().IncreaseLifetimeUp();
9246 #endif
9247 };
9248
9250 {
9251 PlayerBase p = PlayerBase.Cast(player);
9252
9253 array<int> recipesIds = p.m_Recipes;
9254 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9255 if (moduleRecipesManager)
9256 {
9257 EntityAI itemInHands = player.GetEntityInHands();
9258 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9259 }
9260
9261 for (int i = 0;i < recipesIds.Count(); i++)
9262 {
9263 int key = recipesIds.Get(i);
9264 string recipeName = moduleRecipesManager.GetRecipeName(key);
9266 }
9267 }
9268
9269
9270 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9271 {
9272 super.GetDebugActions(outputList);
9273
9274
9280
9281
9286
9291
9292
9296
9297
9299 {
9303 }
9304
9307
9308
9312
9314
9315 InventoryLocation loc = new InventoryLocation();
9316 GetInventory().GetCurrentInventoryLocation(loc);
9318 {
9319 if (Gizmo_IsSupported())
9322 }
9323
9325 }
9326
9327
9328
9329
9331 {
9332 super.OnAction(action_id, player, ctx);
9333
9335 {
9336 switch (action_id)
9337 {
9341 return true;
9345 return true;
9346 }
9347 }
9348
9350 {
9351 switch (action_id)
9352 {
9354 Delete();
9355 return true;
9356 }
9357 }
9358
9359 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9360 {
9361 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9362 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9363 PlayerBase p = PlayerBase.Cast(player);
9364 if (
EActions.RECIPES_RANGE_START < 1000)
9365 {
9366 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9367 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9368 }
9369 }
9370 #ifndef SERVER
9371 else if (action_id ==
EActions.WATCH_PLAYER)
9372 {
9373 PluginDeveloper.SetDeveloperItemClientEx(player);
9374 }
9375 #endif
9377 {
9378 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9379 {
9380 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9381 OnDebugButtonPressServer(id + 1);
9382 }
9383
9384 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9385 {
9386 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9388 }
9389
9390 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9391 {
9392 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9394 }
9395
9396 else if (action_id ==
EActions.ADD_QUANTITY)
9397 {
9398 if (IsMagazine())
9399 {
9400 Magazine mag = Magazine.Cast(this);
9401 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9402 }
9403 else
9404 {
9406 }
9407
9408 if (m_EM)
9409 {
9410 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9411 }
9412
9413 }
9414
9415 else if (action_id ==
EActions.REMOVE_QUANTITY)
9416 {
9417 if (IsMagazine())
9418 {
9419 Magazine mag2 = Magazine.Cast(this);
9420 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9421 }
9422 else
9423 {
9425 }
9426 if (m_EM)
9427 {
9428 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9429 }
9430
9431 }
9432
9433 else if (action_id ==
EActions.SET_QUANTITY_0)
9434 {
9436
9437 if (m_EM)
9438 {
9439 m_EM.SetEnergy(0);
9440 }
9441 }
9442
9443 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9444 {
9446
9447 if (m_EM)
9448 {
9449 m_EM.SetEnergy(m_EM.GetEnergyMax());
9450 }
9451 }
9452
9453 else if (action_id ==
EActions.ADD_HEALTH)
9454 {
9455 AddHealth("","",GetMaxHealth("","Health")/5);
9456 }
9457 else if (action_id ==
EActions.REMOVE_HEALTH)
9458 {
9459 AddHealth("","",-GetMaxHealth("","Health")/5);
9460 }
9461 else if (action_id ==
EActions.DESTROY_HEALTH)
9462 {
9463 SetHealth01("","",0);
9464 }
9465 else if (action_id ==
EActions.WATCH_ITEM)
9466 {
9468 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9469 #ifdef DEVELOPER
9470 SetDebugDeveloper_item(this);
9471 #endif
9472 }
9473
9474 else if (action_id ==
EActions.ADD_TEMPERATURE)
9475 {
9476 AddTemperature(20);
9477
9478 }
9479
9480 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9481 {
9482 AddTemperature(-20);
9483
9484 }
9485
9486 else if (action_id ==
EActions.FLIP_FROZEN)
9487 {
9488 SetFrozen(!GetIsFrozen());
9489
9490 }
9491
9492 else if (action_id ==
EActions.ADD_WETNESS)
9493 {
9495
9496 }
9497
9498 else if (action_id ==
EActions.REMOVE_WETNESS)
9499 {
9501
9502 }
9503
9504 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9505 {
9508
9509
9510 }
9511
9512 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9513 {
9516 }
9517
9518 else if (action_id ==
EActions.MAKE_SPECIAL)
9519 {
9520 auto debugParams = DebugSpawnParams.WithPlayer(player);
9521 OnDebugSpawnEx(debugParams);
9522 }
9523
9524 }
9525
9526
9527 return false;
9528 }
9529
9530
9531
9532
9536
9539
9540
9541
9543 {
9544 return false;
9545 }
9546
9547
9549 {
9550 return true;
9551 }
9552
9553
9555 {
9556 return true;
9557 }
9558
9559
9560
9562 {
9563 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9564 return g_Game.ConfigIsExisting(config_path);
9565 }
9566
9569 {
9570 return null;
9571 }
9572
9574 {
9575 return false;
9576 }
9577
9579 {
9580 return false;
9581 }
9582
9586
9587
9589 {
9590 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9591 return module_repairing.CanRepair(this, item_repair_kit);
9592 }
9593
9594
9595 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9596 {
9597 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9598 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9599 }
9600
9601
9603 {
9604
9605
9606
9607
9608
9609
9610
9611
9612 return 1;
9613 }
9614
9615
9616
9618 {
9620 }
9621
9622
9623
9625 {
9627 }
9628
9629
9638 {
9639 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9640
9641 if (player)
9642 {
9643 player.MessageStatus(text);
9644 }
9645 }
9646
9647
9656 {
9657 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9658
9659 if (player)
9660 {
9661 player.MessageAction(text);
9662 }
9663 }
9664
9665
9674 {
9675 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9676
9677 if (player)
9678 {
9679 player.MessageFriendly(text);
9680 }
9681 }
9682
9683
9692 {
9693 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9694
9695 if (player)
9696 {
9697 player.MessageImportant(text);
9698 }
9699 }
9700
9702 {
9703 return true;
9704 }
9705
9706
9707 override bool KindOf(
string tag)
9708 {
9709 bool found = false;
9710 string item_name = this.
GetType();
9712 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9713
9714 int array_size = item_tag_array.Count();
9715 for (int i = 0; i < array_size; i++)
9716 {
9717 if (item_tag_array.Get(i) == tag)
9718 {
9719 found = true;
9720 break;
9721 }
9722 }
9723 return found;
9724 }
9725
9726
9728 {
9729
9730 super.OnRPC(sender, rpc_type,ctx);
9731
9732
9733 switch (rpc_type)
9734 {
9735 #ifndef SERVER
9736 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9737 Param2<bool, string> p = new Param2<bool, string>(false, "");
9738
9740 return;
9741
9742 bool play = p.param1;
9743 string soundSet = p.param2;
9744
9745 if (play)
9746 {
9748 {
9750 {
9752 }
9753 }
9754 else
9755 {
9757 }
9758 }
9759 else
9760 {
9762 }
9763
9764 break;
9765 #endif
9766
9767 }
9768
9770 {
9772 }
9773 }
9774
9775
9776
9777
9779 {
9780 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9781 return plugin.GetID(
name);
9782 }
9783
9785 {
9786 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9787 return plugin.GetName(id);
9788 }
9789
9792 {
9793
9794
9795 int varFlags;
9796 if (!ctx.
Read(varFlags))
9797 return;
9798
9799 if (varFlags & ItemVariableFlags.FLOAT)
9800 {
9802 }
9803 }
9804
9806 {
9807
9808 super.SerializeNumericalVars(floats_out);
9809
9810
9811
9813 {
9815 }
9816
9818 {
9820 }
9821
9823 {
9825 }
9826
9828 {
9833 }
9834
9836 {
9838 }
9839 }
9840
9842 {
9843
9844 super.DeSerializeNumericalVars(floats);
9845
9846
9847 int index = 0;
9848 int mask = Math.Round(floats.Get(index));
9849
9850 index++;
9851
9853 {
9855 {
9857 }
9858 else
9859 {
9860 float quantity = floats.Get(index);
9862 }
9863 index++;
9864 }
9865
9867 {
9868 float wet = floats.Get(index);
9870 index++;
9871 }
9872
9874 {
9875 int liquidtype = Math.Round(floats.Get(index));
9877 index++;
9878 }
9879
9881 {
9883 index++;
9885 index++;
9887 index++;
9889 index++;
9890 }
9891
9893 {
9894 int cleanness = Math.Round(floats.Get(index));
9896 index++;
9897 }
9898 }
9899
9901 {
9902 super.WriteVarsToCTX(ctx);
9903
9904
9906 {
9908 }
9909
9911 {
9913 }
9914
9916 {
9918 }
9919
9921 {
9922 int r,g,b,a;
9928 }
9929
9931 {
9933 }
9934 }
9935
9937 {
9938 if (!super.ReadVarsFromCTX(ctx,version))
9939 return false;
9940
9941 int intValue;
9942 float value;
9943
9944 if (version < 140)
9945 {
9946 if (!ctx.
Read(intValue))
9947 return false;
9948
9949 m_VariablesMask = intValue;
9950 }
9951
9953 {
9954 if (!ctx.
Read(value))
9955 return false;
9956
9958 {
9960 }
9961 else
9962 {
9964 }
9965 }
9966
9967 if (version < 140)
9968 {
9970 {
9971 if (!ctx.
Read(value))
9972 return false;
9973 SetTemperatureDirect(value);
9974 }
9975 }
9976
9978 {
9979 if (!ctx.
Read(value))
9980 return false;
9982 }
9983
9985 {
9986 if (!ctx.
Read(intValue))
9987 return false;
9989 }
9990
9992 {
9993 int r,g,b,a;
9995 return false;
9997 return false;
9999 return false;
10001 return false;
10002
10004 }
10005
10007 {
10008 if (!ctx.
Read(intValue))
10009 return false;
10011 }
10012
10013 if (version >= 138 && version < 140)
10014 {
10016 {
10017 if (!ctx.
Read(intValue))
10018 return false;
10019 SetFrozen(intValue);
10020 }
10021 }
10022
10023 return true;
10024 }
10025
10026
10028 {
10031 {
10033 }
10034
10035 if (!super.OnStoreLoad(ctx, version))
10036 {
10038 return false;
10039 }
10040
10041 if (version >= 114)
10042 {
10043 bool hasQuickBarIndexSaved;
10044
10045 if (!ctx.
Read(hasQuickBarIndexSaved))
10046 {
10048 return false;
10049 }
10050
10051 if (hasQuickBarIndexSaved)
10052 {
10053 int itmQBIndex;
10054
10055
10056 if (!ctx.
Read(itmQBIndex))
10057 {
10059 return false;
10060 }
10061
10062 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10063 if (itmQBIndex != -1 && parentPlayer)
10064 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10065 }
10066 }
10067 else
10068 {
10069
10070 PlayerBase player;
10071 int itemQBIndex;
10072 if (version ==
int.
MAX)
10073 {
10074 if (!ctx.
Read(itemQBIndex))
10075 {
10077 return false;
10078 }
10079 }
10080 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10081 {
10082
10083 if (!ctx.
Read(itemQBIndex))
10084 {
10086 return false;
10087 }
10088 if (itemQBIndex != -1 && player)
10089 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10090 }
10091 }
10092
10093 if (version < 140)
10094 {
10095
10096 if (!LoadVariables(ctx, version))
10097 {
10099 return false;
10100 }
10101 }
10102
10103
10105 {
10107 return false;
10108 }
10109 if (version >= 132)
10110 {
10112 if (raib)
10113 {
10115 {
10117 return false;
10118 }
10119 }
10120 }
10121
10123 return true;
10124 }
10125
10126
10127
10129 {
10130 super.OnStoreSave(ctx);
10131
10132 PlayerBase player;
10133 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10134 {
10136
10137 int itemQBIndex = -1;
10138 itemQBIndex = player.FindQuickBarEntityIndex(this);
10139 ctx.
Write(itemQBIndex);
10140 }
10141 else
10142 {
10144 }
10145
10147
10149 if (raib)
10150 {
10152 }
10153 }
10154
10155
10157 {
10158 super.AfterStoreLoad();
10159
10161 {
10163 }
10164
10166 {
10169 }
10170 }
10171
10173 {
10174 super.EEOnAfterLoad();
10175
10177 {
10179 }
10180
10183 }
10184
10186 {
10187 return false;
10188 }
10189
10190
10191
10193 {
10195 {
10196 #ifdef PLATFORM_CONSOLE
10197
10199 {
10201 if (menu)
10202 {
10204 }
10205 }
10206 #endif
10207 }
10208
10210 {
10213 }
10214
10216 {
10217 SetWeightDirty();
10219 }
10221 {
10224 }
10225
10227 {
10230
10233 }
10235 {
10239 }
10240
10241 super.OnVariablesSynchronized();
10242 }
10243
10244
10245
10247 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10248 {
10249 if (!IsServerCheck(allow_client))
10250 return false;
10251
10253 return false;
10254
10257
10258 if (value <= (min + 0.001))
10259 value = min;
10260
10261 if (value == min)
10262 {
10263 if (destroy_config)
10264 {
10265 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10266 if (dstr)
10267 {
10269 this.Delete();
10270 return true;
10271 }
10272 }
10273 else if (destroy_forced)
10274 {
10276 this.Delete();
10277 return true;
10278 }
10279
10281 }
10282
10285
10287 {
10288 EntityAI parent = GetHierarchyRoot();
10289 InventoryLocation iLoc = new InventoryLocation();
10290 GetInventory().GetCurrentInventoryLocation(iLoc);
10292 {
10293 int iLocSlot = iLoc.
GetSlot();
10295 {
10297 }
10299 {
10301 }
10302 }
10303 }
10304
10306 {
10308
10309 if (delta)
10311 }
10312
10314
10315 return false;
10316 }
10317
10318
10320 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10321 {
10323 }
10324
10326 {
10329 }
10330
10332 {
10335 }
10336
10338 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10339 {
10340 float value_clamped = Math.Clamp(value, 0, 1);
10342 SetQuantity(result, destroy_config, destroy_forced);
10343 }
10344
10345
10348 {
10350 }
10351
10353 {
10355 }
10356
10357
10358
10359
10360
10361
10362
10363
10364
10365
10367 {
10368 int slot = -1;
10369 GameInventory inventory = GetInventory();
10370 if (inventory)
10371 {
10372 InventoryLocation il = new InventoryLocation;
10375 }
10376
10378 }
10379
10381 {
10382 float quantity_max = 0;
10383
10385 {
10386 if (attSlotID != -1)
10387 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10388
10389 if (quantity_max <= 0)
10391 }
10392
10393 if (quantity_max <= 0)
10395
10396 return quantity_max;
10397 }
10398
10400 {
10402 }
10403
10405 {
10407 }
10408
10409
10411 {
10413 }
10414
10416 {
10418 }
10419
10421 {
10423 }
10424
10425
10427 {
10428
10429 float weightEx = GetWeightEx();
10430 float special = GetInventoryAndCargoWeight();
10431 return weightEx - special;
10432 }
10433
10434
10436 {
10438 }
10439
10441 {
10443 {
10444 #ifdef DEVELOPER
10445 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10446 {
10447 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10449 }
10450 #endif
10451
10452 return GetQuantity() * GetConfigWeightModified();
10453 }
10454 else if (HasEnergyManager())
10455 {
10456 #ifdef DEVELOPER
10457 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10458 {
10459 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10460 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10461 }
10462 #endif
10463 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10464 }
10465 else
10466 {
10467 #ifdef DEVELOPER
10468 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10469 {
10470 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10471 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10472 }
10473 #endif
10474 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10475 }
10476 }
10477
10480 {
10481 int item_count = 0;
10483
10484 GameInventory inventory = GetInventory();
10485 CargoBase cargo = inventory.
GetCargo();
10486 if (cargo != NULL)
10487 {
10489 }
10490
10492 for (int i = 0; i < nAttachments; ++i)
10493 {
10495 if (item)
10496 item_count += item.GetNumberOfItems();
10497 }
10498 return item_count;
10499 }
10500
10503 {
10504 float weight = 0;
10505 float wetness = 1;
10506 if (include_wetness)
10509 {
10510 weight = wetness * m_ConfigWeight;
10511 }
10513 {
10514 weight = 1;
10515 }
10516 return weight;
10517 }
10518
10519
10520
10522 {
10523 GameInventory inventory = GetInventory();
10524 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10525 {
10526 array<EntityAI> items = new array<EntityAI>;
10528 for (int i = 0; i < items.Count(); ++i)
10529 {
10531 if (item)
10532 {
10533 g_Game.ObjectDelete(item);
10534 }
10535 }
10536 }
10537 }
10538
10539
10540
10541
10543 {
10544 float energy = 0;
10545 if (HasEnergyManager())
10546 {
10547 energy = GetCompEM().GetEnergy();
10548 }
10549 return energy;
10550 }
10551
10552
10554 {
10555 super.OnEnergyConsumed();
10556
10558 }
10559
10561 {
10562 super.OnEnergyAdded();
10563
10565 }
10566
10567
10569 {
10570 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10571 {
10573 {
10574 float energy_0to1 = GetCompEM().GetEnergy0To1();
10576 }
10577 }
10578 }
10579
10580
10582 {
10583 return ConfigGetFloat("heatIsolation");
10584 }
10585
10587 {
10589 }
10590
10592 {
10593 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10594 if (
g_Game.ConfigIsExisting(paramPath))
10595 return g_Game.ConfigGetFloat(paramPath);
10596
10597 return 0.0;
10598 }
10599
10601 {
10602 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10603 if (
g_Game.ConfigIsExisting(paramPath))
10604 return g_Game.ConfigGetFloat(paramPath);
10605
10606 return 0.0;
10607 }
10608
10609 override void SetWet(
float value,
bool allow_client =
false)
10610 {
10611 if (!IsServerCheck(allow_client))
10612 return;
10613
10616
10618
10619 m_VarWet = Math.Clamp(value, min, max);
10620
10622 {
10625 }
10626 }
10627
10628 override void AddWet(
float value)
10629 {
10631 }
10632
10634 {
10636 }
10637
10639 {
10641 }
10642
10644 {
10646 }
10647
10649 {
10651 }
10652
10654 {
10656 }
10657
10658 override void OnWetChanged(
float newVal,
float oldVal)
10659 {
10662 if (newLevel != oldLevel)
10663 {
10665 }
10666 }
10667
10669 {
10670 SetWeightDirty();
10671 }
10672
10674 {
10675 return GetWetLevelInternal(
m_VarWet);
10676 }
10677
10678
10679
10681 {
10683 }
10684
10686 {
10688 }
10689
10691 {
10693 }
10694
10696 {
10698 }
10699
10700
10701
10703 {
10704 if (ConfigIsExisting("itemModelLength"))
10705 {
10706 return ConfigGetFloat("itemModelLength");
10707 }
10708 return 0;
10709 }
10710
10712 {
10713 if (ConfigIsExisting("itemAttachOffset"))
10714 {
10715 return ConfigGetFloat("itemAttachOffset");
10716 }
10717 return 0;
10718 }
10719
10720 override void SetCleanness(
int value,
bool allow_client =
false)
10721 {
10722 if (!IsServerCheck(allow_client))
10723 return;
10724
10726
10728
10731 }
10732
10734 {
10736 }
10737
10739 {
10740 return true;
10741 }
10742
10743
10744
10745
10747 {
10749 }
10750
10752 {
10754 }
10755
10756
10757
10758
10759 override void SetColor(
int r,
int g,
int b,
int a)
10760 {
10766 }
10768 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10769 {
10774 }
10775
10777 {
10779 }
10780
10783 {
10784 int r,g,b,a;
10786 r = r/255;
10787 g = g/255;
10788 b = b/255;
10789 a = a/255;
10790 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10791 }
10792
10793
10794
10795 override void SetLiquidType(
int value,
bool allow_client =
false)
10796 {
10797 if (!IsServerCheck(allow_client))
10798 return;
10799
10804 }
10805
10807 {
10808 return ConfigGetInt("varLiquidTypeInit");
10809 }
10810
10812 {
10814 }
10815
10817 {
10819 SetFrozen(false);
10820 }
10821
10824 {
10825 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10826 }
10827
10828
10831 {
10832 PlayerBase nplayer;
10833 if (PlayerBase.CastTo(nplayer, player))
10834 {
10836 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10837 }
10838 }
10839
10840
10843 {
10844 PlayerBase nplayer;
10845 if (PlayerBase.CastTo(nplayer,player))
10846 {
10847 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10848 }
10849
10850 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10851
10852 if (HasEnergyManager())
10853 {
10854 GetCompEM().UpdatePlugState();
10855 }
10856 }
10857
10858
10860 {
10861 super.OnPlacementStarted(player);
10862
10864 }
10865
10866 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10867 {
10869 {
10870 m_AdminLog.OnPlacementComplete(player,
this);
10871 }
10872
10873 super.OnPlacementComplete(player, position, orientation);
10874 }
10875
10876
10877
10878
10879
10881 {
10883 {
10884 return true;
10885 }
10886 else
10887 {
10888 return false;
10889 }
10890 }
10891
10892
10894 {
10896 {
10898 }
10899 }
10900
10901
10903 {
10905 }
10906
10908 {
10910 }
10911
10912 override void InsertAgent(
int agent,
float count = 1)
10913 {
10914 if (count < 1)
10915 return;
10916
10918 }
10919
10922 {
10924 }
10925
10926
10928 {
10930 }
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
10960
10961
10962
10963
10964
10965
10966
10967
10968
10969
10970
10971
10972
10974 {
10976 return false;
10977 return true;
10978 }
10979
10981 {
10982
10984 }
10985
10986
10989 {
10990 super.CheckForRoofLimited(timeTresholdMS);
10991
10992 float time =
g_Game.GetTime();
10993 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
10994 {
10995 m_PreviousRoofTestTime = time;
10996 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
10997 }
10998 }
10999
11000
11002 {
11004 {
11005 return 0;
11006 }
11007
11008 if (GetInventory().GetAttachmentSlotsCount() != 0)
11009 {
11010 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11011 if (filter)
11012 return filter.GetProtectionLevel(type, false, system);
11013 else
11014 return 0;
11015 }
11016
11017 string subclassPath, entryName;
11018
11019 switch (type)
11020 {
11022 entryName = "biological";
11023 break;
11025 entryName = "chemical";
11026 break;
11027 default:
11028 entryName = "biological";
11029 break;
11030 }
11031
11032 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11033
11034 return g_Game.ConfigGetFloat(subclassPath + entryName);
11035 }
11036
11037
11038
11041 {
11042 if (!IsMagazine())
11044
11046 }
11047
11048
11049
11050
11051
11056 {
11057 return true;
11058 }
11059
11061 {
11063 }
11064
11065
11066
11067
11068
11070 {
11071 if (parent)
11072 {
11073 if (parent.IsInherited(DayZInfected))
11074 return true;
11075
11076 if (!parent.IsRuined())
11077 return true;
11078 }
11079
11080 return true;
11081 }
11082
11084 {
11085 if (!super.CanPutAsAttachment(parent))
11086 {
11087 return false;
11088 }
11089
11090 if (!IsRuined() && !parent.IsRuined())
11091 {
11092 return true;
11093 }
11094
11095 return false;
11096 }
11097
11099 {
11100
11101
11102
11103
11104 return super.CanReceiveItemIntoCargo(item);
11105 }
11106
11108 {
11109
11110
11111
11112
11113 GameInventory attachmentInv = attachment.GetInventory();
11115 {
11116 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11117 return false;
11118 }
11119
11120 InventoryLocation loc = new InventoryLocation();
11121 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11122 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11123 return false;
11124
11125 return super.CanReceiveAttachment(attachment, slotId);
11126 }
11127
11129 {
11130 if (!super.CanReleaseAttachment(attachment))
11131 return false;
11132
11133 return GetInventory().AreChildrenAccessible();
11134 }
11135
11136
11137
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
11150
11151
11152
11153
11154
11155
11157 {
11158 int id = muzzle_owner.GetMuzzleID();
11159 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11160
11161 if (WPOF_array)
11162 {
11163 for (int i = 0; i < WPOF_array.Count(); i++)
11164 {
11165 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11166
11167 if (WPOF)
11168 {
11169 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11170 }
11171 }
11172 }
11173 }
11174
11175
11177 {
11178 int id = muzzle_owner.GetMuzzleID();
11180
11181 if (WPOBE_array)
11182 {
11183 for (int i = 0; i < WPOBE_array.Count(); i++)
11184 {
11185 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11186
11187 if (WPOBE)
11188 {
11189 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11190 }
11191 }
11192 }
11193 }
11194
11195
11197 {
11198 int id = muzzle_owner.GetMuzzleID();
11199 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11200
11201 if (WPOOH_array)
11202 {
11203 for (int i = 0; i < WPOOH_array.Count(); i++)
11204 {
11205 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11206
11207 if (WPOOH)
11208 {
11209 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11210 }
11211 }
11212 }
11213 }
11214
11215
11217 {
11218 int id = muzzle_owner.GetMuzzleID();
11219 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11220
11221 if (WPOOH_array)
11222 {
11223 for (int i = 0; i < WPOOH_array.Count(); i++)
11224 {
11225 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11226
11227 if (WPOOH)
11228 {
11229 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11230 }
11231 }
11232 }
11233 }
11234
11235
11237 {
11238 int id = muzzle_owner.GetMuzzleID();
11239 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11240
11241 if (WPOOH_array)
11242 {
11243 for (int i = 0; i < WPOOH_array.Count(); i++)
11244 {
11245 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11246
11247 if (WPOOH)
11248 {
11249 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11250 }
11251 }
11252 }
11253 }
11254
11255
11256
11258 {
11260 {
11261 return true;
11262 }
11263
11264 return false;
11265 }
11266
11268 {
11270 {
11271 return true;
11272 }
11273
11274 return false;
11275 }
11276
11278 {
11280 {
11281 return true;
11282 }
11283
11284 return false;
11285 }
11286
11288 {
11289 return false;
11290 }
11291
11294 {
11295 return UATimeSpent.DEFAULT_DEPLOY;
11296 }
11297
11298
11299
11300
11302 {
11304 SetSynchDirty();
11305 }
11306
11308 {
11310 }
11311
11312
11314 {
11315 return false;
11316 }
11317
11320 {
11321 string att_type = "None";
11322
11323 if (ConfigIsExisting("soundAttType"))
11324 {
11325 att_type = ConfigGetString("soundAttType");
11326 }
11327
11329 }
11330
11332 {
11334 }
11335
11336
11337
11338
11339
11345
11347 {
11350
11352 }
11353
11354
11356 {
11358 return;
11359
11361
11364
11367
11368 SoundParameters params = new SoundParameters();
11372 }
11373
11374
11376 {
11378 {
11381
11382 SetSynchDirty();
11383
11386 }
11387 }
11388
11390 {
11392 }
11393
11394
11396 {
11398 return;
11399
11401 SetSynchDirty();
11402
11405 }
11406
11408 {
11411 }
11412
11414 {
11416 }
11417
11418 void OnApply(PlayerBase player);
11419
11421 {
11422 return 1.0;
11423 };
11424
11426 {
11428 }
11429
11431 {
11433 }
11434
11436
11438 {
11439 SetDynamicPhysicsLifeTime(0.01);
11441 }
11442
11444 {
11445 array<string> zone_names = new array<string>;
11446 GetDamageZones(zone_names);
11447 for (int i = 0; i < zone_names.Count(); i++)
11448 {
11449 SetHealthMax(zone_names.Get(i),"Health");
11450 }
11451 SetHealthMax("","Health");
11452 }
11453
11456 {
11457 float global_health = GetHealth01("","Health");
11458 array<string> zones = new array<string>;
11459 GetDamageZones(zones);
11460
11461 for (int i = 0; i < zones.Count(); i++)
11462 {
11463 SetHealth01(zones.Get(i),"Health",global_health);
11464 }
11465 }
11466
11469 {
11470 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11471 }
11472
11474 {
11475 if (!hasRootAsPlayer)
11476 {
11477 if (refParentIB)
11478 {
11479
11480 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11481 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11482
11483 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11484 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11485
11488 }
11489 else
11490 {
11491
11494 }
11495 }
11496 }
11497
11499 {
11501 {
11502 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11503 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11504 {
11505 float heatPermCoef = 1.0;
11507 while (ent)
11508 {
11509 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11510 ent = ent.GetHierarchyParent();
11511 }
11512
11513 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11514 }
11515 }
11516 }
11517
11519 {
11520
11521 EntityAI parent = GetHierarchyParent();
11522 if (!parent)
11523 {
11524 hasParent = false;
11525 hasRootAsPlayer = false;
11526 }
11527 else
11528 {
11529 hasParent = true;
11530 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11531 refParentIB =
ItemBase.Cast(parent);
11532 }
11533 }
11534
11535 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11536 {
11537
11538 }
11539
11541 {
11542
11543 return false;
11544 }
11545
11547 {
11548
11549
11550 return false;
11551 }
11552
11554 {
11555
11556 return false;
11557 }
11558
11561 {
11562 return !GetIsFrozen() &&
IsOpen();
11563 }
11564
11566 {
11567 bool hasParent = false, hasRootAsPlayer = false;
11569
11570 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11571 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11572
11573 if (wwtu || foodDecay)
11574 {
11578
11579 if (processWetness || processTemperature || processDecay)
11580 {
11582
11583 if (processWetness)
11584 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11585
11586 if (processTemperature)
11588
11589 if (processDecay)
11590 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11591 }
11592 }
11593 }
11594
11597 {
11599 }
11600
11602 {
11605
11606 return super.GetTemperatureFreezeThreshold();
11607 }
11608
11610 {
11613
11614 return super.GetTemperatureThawThreshold();
11615 }
11616
11618 {
11621
11622 return super.GetItemOverheatThreshold();
11623 }
11624
11626 {
11628 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11629
11630 return super.GetTemperatureFreezeTime();
11631 }
11632
11634 {
11636 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11637
11638 return super.GetTemperatureThawTime();
11639 }
11640
11645
11647 {
11648 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11649 }
11650
11652 {
11653 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11654 }
11655
11658 {
11660 }
11661
11663 {
11665 }
11666
11668 {
11670 }
11671
11674 {
11675 return null;
11676 }
11677
11680 {
11681 return false;
11682 }
11683
11685 {
11687 {
11690 if (!trg)
11691 {
11693 explosive = this;
11694 }
11695
11696 explosive.PairRemote(trg);
11698
11699 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11700 trg.SetPersistentPairID(persistentID);
11701 explosive.SetPersistentPairID(persistentID);
11702
11703 return true;
11704 }
11705 return false;
11706 }
11707
11710 {
11711 float ret = 1.0;
11714 ret *= GetHealth01();
11715
11716 return ret;
11717 }
11718
11719 #ifdef DEVELOPER
11720 override void SetDebugItem()
11721 {
11722 super.SetDebugItem();
11723 _itemBase = this;
11724 }
11725
11727 {
11728 string text = super.GetDebugText();
11729
11731 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11732
11733 return text;
11734 }
11735 #endif
11736
11738 {
11739 return true;
11740 }
11741
11743
11745
11747 {
11750 }
11751
11752
11760
11776
11777 [
Obsolete(
"Use ItemSoundHandler instead")]
11780 {
11781 if (!
g_Game.IsDedicatedServer())
11782 {
11783 if (ConfigIsExisting("attachSoundSet"))
11784 {
11785 string cfg_path = "";
11786 string soundset = "";
11787 string type_name =
GetType();
11788
11791 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11792 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11793
11794 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11795 {
11796 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11797 {
11798 if (cfg_slot_array[i] == slot_type)
11799 {
11800 soundset = cfg_soundset_array[i];
11801 break;
11802 }
11803 }
11804 }
11805
11806 if (soundset != "")
11807 {
11808 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11810 }
11811 }
11812 }
11813 }
11814
11816}
11817
11819{
11821 if (entity)
11822 {
11823 bool is_item = entity.IsInherited(
ItemBase);
11824 if (is_item && full_quantity)
11825 {
11828 }
11829 }
11830 else
11831 {
11833 return NULL;
11834 }
11835 return entity;
11836}
11837
11839{
11840 if (item)
11841 {
11842 if (health > 0)
11843 item.SetHealth("", "", health);
11844
11845 if (item.CanHaveTemperature())
11846 {
11848 if (item.CanFreeze())
11849 item.SetFrozen(false);
11850 }
11851
11852 if (item.HasEnergyManager())
11853 {
11854 if (quantity >= 0)
11855 {
11856 item.GetCompEM().SetEnergy0To1(quantity);
11857 }
11858 else
11859 {
11861 }
11862 }
11863 else if (item.IsMagazine())
11864 {
11865 Magazine mag = Magazine.Cast(item);
11866 if (quantity >= 0)
11867 {
11868 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11869 }
11870 else
11871 {
11873 }
11874
11875 }
11876 else
11877 {
11878 if (quantity >= 0)
11879 {
11880 item.SetQuantityNormalized(quantity, false);
11881 }
11882 else
11883 {
11885 }
11886
11887 }
11888 }
11889}
11890
11891#ifdef DEVELOPER
11893#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
bool SetAttachSoundEvent()
bool SetDetachSoundEvent()
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
void ActionManagerBase(PlayerBase player)
map< typename, ref array< ActionBase_Basic > > TInputActionMap
void AddAction(typename actionName)
void RemoveAction(typename actionName)
TInputActionMap m_InputActionMap
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
const int ECE_PLACE_ON_SURFACE
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
Open
Implementations only.
override void EEOnCECreate()
DamageType
exposed from C++ (do not change)
PluginAdminLog m_AdminLog
override bool IsExplosive()
override bool IsPrepareToDelete()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
proto GizmoApi GetGizmoApi()
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
static bool HasDebugActionsMask(int mask)
bool HidesSelectionBySlot()
void SplitItem(PlayerBase player)
void CopyScriptPropertiesFrom(EntityAI oldItem)
override void InsertAgent(int agent, float count=1)
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
static void SetDebugActionsMask(int mask)
void SetIsDeploySound(bool is_deploy_sound)
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
override bool IsHeavyBehaviour()
override void SetWetMax()
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
void ClearStartItemSoundServer()
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
override void RemoveAllAgentsExcept(int agent_to_keep)
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
bool CanBeMovedOverride()
override void SetWet(float value, bool allow_client=false)
ref TIntArray m_SingleUseActions
void StartItemSoundServer(int id, int slotId)
override void ProcessVariables()
ref TStringArray m_HeadHidingSelections
float GetWeightSpecialized(bool forceRecalc=false)
bool LoadAgents(ParamsReadContext ctx, int version)
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
ref array< ref OverheatingParticle > m_OverheatingParticles
override float GetTemperatureFreezeThreshold()
bool m_IsSoundSynchRemote
void StopItemSoundServer(int id)
static void ToggleDebugActionsMask(int mask)
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetTemperatureFreezeTime()
ref array< int > m_CompatibleLocks
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
float m_TemperaturePerQuantityWeight
bool m_RecipesInitialized
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
override float GetTemperatureThawThreshold()
override void OnEnergyConsumed()
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
override EWetnessLevel GetWetLevel()
float GetSingleInventoryItemWeight()
ref TIntArray m_InteractActions
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
bool CanPlayDeployLoopSound()
override float GetWetMax()
bool CanBeUsedForSuicide()
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
bool m_CanBeMovedOverride
override string ChangeIntoOnAttach(string slot)
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
ScriptedLightBase GetLight()
string GetPlaceSoundset()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
override float GetQuantity()
int m_ShotsToStartOverheating
override void OnWetChanged(float newVal, float oldVal)
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void OnOverheatingDecay()
float GetDryingIncrement(string pIncrementName)
void SoundSynchRemoteReset()
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
override bool CanReleaseAttachment(EntityAI attachment)
override void OnMovedInsideCargo(EntityAI container)
void SetCEBasedQuantity()
bool m_CanPlayImpactSound
override string GetAttachmentSoundType()
float GetOverheatingCoef()
array< string > GetHeadHidingSelection()
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
override bool IsStoreLoad()
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
void SetResultOfSplit(bool value)
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
void UpdateAllOverheatingParticles()
float GetSoakingIncrement(string pIncrementName)
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetStoreLoadedQuantity()
const int ITEM_SOUNDS_MAX
float GetItemModelLength()
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
void CombineItems(ItemBase other_item, bool use_stack_max=true)
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
void TransferAgents(int agents)
transfer agents from another item
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
float GetHeatIsolationInit()
void SetCanBeMovedOverride(bool setting)
override bool HasQuantity()
bool IsCargoException4x3(EntityAI item)
ref TIntArray m_ContinuousActions
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
void LoadParticleConfigOnFire(int id)
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
override float GetWetInit()
int m_ImpactSoundSurfaceHash
int m_MaxOverheatingValue
void SetupSpawnedItem(ItemBase item, float health, float quantity)
bool ShouldSplitQuantity(float quantity)
static ref map< string, int > m_WeaponTypeToID
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
array< int > GetValidFinishers()
returns an array of possible finishers
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
ItemSoundHandler GetItemSoundHandler()
override int GetQuantityMin()
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
override int GetQuickBarBonus()
override void SetTakeable(bool pState)
float m_OverheatingDecayInterval
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
void RemoveAudioVisualsOnClient()
static void AddDebugActionsMask(int mask)
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
bool CanRepair(ItemBase item_repair_kit)
bool can_this_be_combined
EffectSound m_SoundDeploy
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
float GetDeployTime()
how long it takes to deploy this item in seconds
override bool IsSplitable()
bool DamageItemAttachments(float damage)
override void WriteVarsToCTX(ParamsWriteContext ctx)
void ConvertEnergyToQuantity()
override void RemoveAllAgents()
override void SetQuantityToMinimum()
bool m_WantPlayImpactSound
override float GetTemperatureThawTime()
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
float m_StoreLoadedQuantity
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
float GetFilterDamageRatio()
override void SetLiquidType(int value, bool allow_client=false)
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
void OnApply(PlayerBase player)
override void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
ref Timer m_CheckOverheating
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override bool IsOneHandedBehaviour()
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
override float GetSingleInventoryItemWeightEx()
void SaveAgents(ParamsWriteContext ctx)
override int GetTargetQuantityMax(int attSlotID=-1)
float GetDisinfectQuantity(int system=0, Param param1=null)
override bool IsHologram()
float GetItemAttachOffset()
static int GetDebugActionsMask()
override int GetLiquidType()
void ProcessDecay(float delta, bool hasRootAsPlayer)
override bool IsItemBase()
override bool IsTwoHandedBehaviour()
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override void OnEnergyAdded()
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
EffectSound m_DeployLoopSoundEx
override void DeSerializeNumericalVars(array< float > floats)
void StopItemDynamicPhysics()
override void SetStoreLoad(bool value)
float GetOverheatingValue()
bool ContainsAgent(int agent_id)
override void AddWet(float value)
override void EOnContact(IEntity other, Contact extra)
void SplitIntoStackMaxHands(PlayerBase player)
void SplitIntoStackMaxHandsClient(PlayerBase player)
ref Timer m_PhysDropTimer
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
override void SetStoreLoadedQuantity(float value)
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
void OnLiquidTypeChanged(int oldType, int newType)
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void PlayDeployFinishSound()
bool AllowFoodConsumption()
bool m_IsOverheatingEffectActive
int m_LiquidContainerMask
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override int GetCleanness()
bool PairWithDevice(notnull ItemBase otherDevice)
static void RemoveDebugActionsMask(int mask)
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void PerformDamageSystemReinit()
override void ClearInventory()
static int m_LastRegisteredWeaponID
ItemBase GetLightSourceItem()
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
override float GetItemOverheatThreshold()
void StopDeployLoopSoundEx()
override void SerializeNumericalVars(array< float > floats_out)
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
static int m_DebugActionsMask
void KillAllOverheatingParticles()
bool CanBeCookedOnStick()
override int GetQuantityMax()
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
void OnActivatedByTripWire()
override void RemoveAgent(int agent_id)
bool m_ItemBeingDroppedPhys
override bool CanPutAsAttachment(EntityAI parent)
void PlayDetachSound(string slot_type)
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override bool IsBeingPlaced()
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
bool m_FixDamageSystemInit
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
void LoadParticleConfigOnOverheating(int id)
bool IsSoundSynchRemote()
override void OnRightClick()
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
bool IsActionTargetVisible()
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
int NameToID(string name)
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
void ClearStopItemSoundServer()
override string ChangeIntoOnDetach()
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
EffectSound m_SoundDeployFinish
float GetQuantityNormalizedScripted()
override void SetCleanness(int value, bool allow_client=false)
override float GetWetMin()
ref ItemSoundHandler m_ItemSoundHandler
override bool KindOf(string tag)
void ItemSoundHandler(ItemBase parent)
EffectSound m_LockingSound
void PluginItemDiagnostic()
PluginBase GetPlugin(typename plugin_type)
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
void RemoteDetonatorTrigger()
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
override void Explode(int damageType, string ammoType="")
void OnItemLocationChanged(ItemBase item)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
proto native EntityAI GetAttachmentFromIndex(int index)
proto native bool GetCurrentInventoryLocation(out notnull InventoryLocation loc)
returns information about current item location
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
proto native int AttachmentCount()
Returns count of attachments attached to this item.
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
proto void SelectObject(Object object)
proto void SelectPhysics(Physics physics)
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
bool WriteToContext(ParamsWriteContext ctx)
proto native int GetType()
returns type of InventoryLocation
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native bool GetFlip()
returns flip status of cargo
proto native EntityAI GetItem()
returns item of current inventory location
override bool CanDisplayCargo()
override void OnInventoryEnter(Man player)
override string GetFoldSoundset()
override bool CanPutAsAttachment(EntityAI parent)
override bool CanReceiveItemIntoCargo(EntityAI item)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override void OnWasDetached(EntityAI parent, int slot_id)
override void EEOnAfterLoad()
override void EEDelete(EntityAI parent)
override bool CanBeRepairedByCrafting()
override void OnPlacementStarted(Man player)
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
override bool IsElectricAppliance()
override bool IsItemTent()
override void SetActions()
override string GetLoopFoldSoundset()
override bool CanMakeGardenplot()
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override WrittenNoteData GetWrittenNoteData()
override int GetDamageSystemVersionChange()
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
override void InitItemVariables()
override void SetActionAnimOverrides()
override void OnCreatePhysics()
override string GetDeploySoundset()
override float GetBandagingEffectivity()
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
override void OnStoreSave(ParamsWriteContext ctx)
override void AfterStoreLoad()
override int GetOnDigWormsAmount()
override bool IsSelfAdjustingTemperature()
override bool IsPlayerInside(PlayerBase player, string selection)
override void OnVariablesSynchronized()
override void RefreshPhysics()
override bool CanObstruct()
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override bool CanPutInCargo(EntityAI parent)
override string GetLoopDeploySoundset()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
override void OnInventoryExit(Man player)
override bool IsTakeable()
override bool IsIgnoredByConstruction()
override void InitItemSounds()
override void EEKilled(Object killer)
override void OnCombine(ItemBase other_item)
override bool CanExplodeInFire()
override bool IsFacingPlayer(PlayerBase player, string selection)
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
override bool IsBloodContainer()
override bool IsClothing()
override bool CanBeSplit()
override bool IsDeployable()
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
override bool CanBeDisinfected()
override float GetInfectionChance(int system=0, Param param=null)
override void OnEndPlacement()
float GetOverheatingLimitMax()
void SetOverheatingLimitMax(float max)
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
float GetOverheatingLimitMin()
void SetOverheatingLimitMin(float min)
void RegisterParticle(Particle p)
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
void SetControlledDevice(EntityAI pDevice)
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
void SetCalcDetails(string details)
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Serializer ParamsReadContext
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
Serializer ParamsWriteContext
const int COMP_TYPE_ENERGY_MANAGER
void Error(string err)
Messagebox with error message.
proto native void SetColor(int color)
array< string > TStringArray
void Obsolete(string msg="")
EntityEvent
Entity events for event-mask, or throwing event from code.
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
const int VARIABLE_LIQUIDTYPE
const int VARIABLE_CLEANNESS
const int VARIABLE_TEMPERATURE
const int VARIABLE_QUANTITY
static proto float AbsFloat(float f)
Returns absolute value.
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_DEBUG_ACTION
vector GetPosition()
Get the world position of the Effect.
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.