6981{
6983 {
6984 return true;
6985 }
6986};
6987
6989{
6990
6991};
6992
6993
6994
6996{
7000
7002
7005
7006
7007
7008
7009
7018
7024
7029
7034
7055 protected bool m_IsResultOfSplit
7056
7058
7063
7064
7065
7067
7071
7072
7073
7075
7078
7079
7080
7086
7087
7095
7098
7099
7101
7102
7104
7105
7110
7111
7116
7118
7119
7121
7122
7124 {
7129
7130 if (!
g_Game.IsDedicatedServer())
7131 {
7133 {
7135
7137 {
7139 }
7140 }
7141
7144 }
7145
7146 m_OldLocation = null;
7147
7149 {
7151 }
7152
7153 if (ConfigIsExisting("headSelectionsToHide"))
7154 {
7157 }
7158
7160 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7161 {
7163 }
7164
7166
7167 m_IsResultOfSplit = false;
7168
7170 }
7171
7173 {
7174 super.InitItemVariables();
7175
7181 m_Count = ConfigGetInt(
"count");
7182
7185
7190
7193
7198
7210
7214
7215
7218 if (ConfigIsExisting("canBeSplit"))
7219 {
7222 }
7223
7225 if (ConfigIsExisting("itemBehaviour"))
7227
7228
7231 RegisterNetSyncVariableInt("m_VarLiquidType");
7232 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7233
7234 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7235 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7236 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7237
7238 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7239 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7240 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7241 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7242
7243 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7244 RegisterNetSyncVariableBool("m_IsTakeable");
7245 RegisterNetSyncVariableBool("m_IsHologram");
7246
7249 {
7252 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7253 }
7254
7256
7258 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7260
7262 }
7263
7265 {
7267 }
7268
7270 {
7273 {
7278 }
7279 }
7280
7281 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7282 {
7284 {
7287 }
7288
7290 }
7291
7293 {
7299 }
7300
7302
7304 {
7306
7307 if (!action)
7308 {
7309 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7310 return;
7311 }
7312
7314 if (!ai)
7315 {
7317 return;
7318 }
7319
7321 if (!action_array)
7322 {
7323 action_array = new array<ActionBase_Basic>;
7325 }
7326 if (LogManager.IsActionLogEnable())
7327 {
7328 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7329 }
7330
7331 if (action_array.Find(action) != -1)
7332 {
7333 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7334 }
7335 else
7336 {
7337 action_array.Insert(action);
7338 }
7339 }
7340
7342 {
7343 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7344 ActionBase action = player.GetActionManager().GetAction(actionName);
7347
7348 if (action_array)
7349 {
7350 action_array.RemoveItem(action);
7351 }
7352 }
7353
7354
7355
7357 {
7358 ActionOverrideData overrideData = new ActionOverrideData();
7362
7364 if (!actionMap)
7365 {
7368 }
7369
7370 actionMap.Insert(this.
Type(), overrideData);
7371
7372 }
7373
7375
7377
7378
7380 {
7383
7386
7387 string config_to_search = "CfgVehicles";
7388 string muzzle_owner_config;
7389
7391 {
7392 if (IsInherited(Weapon))
7393 config_to_search = "CfgWeapons";
7394
7395 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7396
7397 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7398
7399 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7400
7401 if (config_OnFire_subclass_count > 0)
7402 {
7403 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7404
7405 for (int i = 0; i < config_OnFire_subclass_count; i++)
7406 {
7407 string particle_class = "";
7408 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7409 string config_OnFire_entry = config_OnFire_class + particle_class;
7410 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7411 WPOF_array.Insert(WPOF);
7412 }
7413
7414
7416 }
7417 }
7418
7420 {
7421 config_to_search = "CfgWeapons";
7422 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7423
7424 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7425
7426 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7427
7428 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7429 {
7430 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7431
7432 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7433 {
7434 string particle_class2 = "";
7435 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7436 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7437 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7438 WPOBE_array.Insert(WPOBE);
7439 }
7440
7441
7443 }
7444 }
7445 }
7446
7447
7449 {
7452
7454 {
7455 string config_to_search = "CfgVehicles";
7456
7457 if (IsInherited(Weapon))
7458 config_to_search = "CfgWeapons";
7459
7460 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7461 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7462
7463 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7464 {
7465
7467
7469 {
7471 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7473 return;
7474 }
7475
7478
7479
7480
7481 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7482 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7483
7484 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7485 {
7486 string particle_class = "";
7487 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7488 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7489 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7490
7491 if (entry_type == CT_CLASS)
7492 {
7493 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7494 WPOOH_array.Insert(WPOF);
7495 }
7496 }
7497
7498
7500 }
7501 }
7502 }
7503
7505 {
7507 }
7508
7510 {
7512 {
7514
7517
7520
7521 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7522 }
7523 }
7524
7526 {
7528 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7529
7531 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7532
7534 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7535
7537 {
7539 }
7540 }
7541
7543 {
7545 }
7546
7548 {
7551 else
7553
7555 {
7558 }
7559 else
7560 {
7563
7566 }
7567
7569 }
7570
7572 {
7574 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7575 }
7576
7578 {
7580 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7582 }
7583
7585 {
7587 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7588 }
7589
7591 {
7594
7595 OverheatingParticle OP = new OverheatingParticle();
7600
7602 }
7603
7605 {
7608
7609 return -1;
7610 }
7611
7613 {
7615 {
7618
7619 for (int i = count; i > 0; --i)
7620 {
7621 int id = i - 1;
7624
7627
7628 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7629 {
7630 if (p)
7631 {
7634 }
7635 }
7636 }
7637 }
7638 }
7639
7641 {
7643 {
7645 {
7646 int id = i - 1;
7648
7649 if (OP)
7650 {
7652
7653 if (p)
7654 {
7656 }
7657
7658 delete OP;
7659 }
7660 }
7661
7664 }
7665 }
7666
7669 {
7670 return 0.0;
7671 }
7672
7673
7675 {
7676 return 250;
7677 }
7678
7680 {
7681 return 0;
7682 }
7683
7686 {
7688 return true;
7689
7690 return false;
7691 }
7692
7695 {
7698
7700 {
7702 }
7703 else
7704 {
7705
7707 }
7708
7710 }
7711
7718 {
7719 return -1;
7720 }
7721
7722
7723
7724
7726 {
7728 {
7729 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7730 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7731
7732 if (r_index >= 0)
7733 {
7734 InventoryLocation r_il = new InventoryLocation;
7735 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7736
7737 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7740 {
7741 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7742 }
7744 {
7745 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7746 }
7747
7748 }
7749
7750 player.GetHumanInventory().ClearUserReservedLocation(this);
7751 }
7752
7755 }
7756
7757
7758
7759
7761 {
7762 return ItemBase.m_DebugActionsMask;
7763 }
7764
7766 {
7767 return ItemBase.m_DebugActionsMask & mask;
7768 }
7769
7771 {
7772 ItemBase.m_DebugActionsMask = mask;
7773 }
7774
7776 {
7777 ItemBase.m_DebugActionsMask |= mask;
7778 }
7779
7781 {
7782 ItemBase.m_DebugActionsMask &= ~mask;
7783 }
7784
7786 {
7788 {
7790 }
7791 else
7792 {
7794 }
7795 }
7796
7797
7799 {
7800 if (GetEconomyProfile())
7801 {
7802 float q_max = GetEconomyProfile().GetQuantityMax();
7803 if (q_max > 0)
7804 {
7805 float q_min = GetEconomyProfile().GetQuantityMin();
7806 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7807
7809 {
7810 ComponentEnergyManager comp = GetCompEM();
7812 {
7814 }
7815 }
7817 {
7819
7820 }
7821
7822 }
7823 }
7824 }
7825
7828 {
7829 EntityAI parent = GetHierarchyParent();
7830
7831 if (parent)
7832 {
7833 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7834 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7835 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7836 }
7837 }
7838
7841 {
7842 EntityAI parent = GetHierarchyParent();
7843
7844 if (parent)
7845 {
7846 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7847 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7848 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7849 }
7850 }
7851
7853 {
7854
7855
7856
7857
7859
7861 {
7862 if (ScriptInputUserData.CanStoreInputUserData())
7863 {
7864 ScriptInputUserData ctx = new ScriptInputUserData;
7870 ctx.
Write(use_stack_max);
7873
7875 {
7876 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7877 }
7878 }
7879 }
7880 else if (!
g_Game.IsMultiplayer())
7881 {
7883 }
7884 }
7885
7887 {
7889 }
7890
7892 {
7894 }
7895
7897 {
7899 }
7900
7902 {
7903
7904 return false;
7905 }
7906
7908 {
7909 return false;
7910 }
7911
7915 {
7916 return false;
7917 }
7918
7920 {
7921 return "";
7922 }
7923
7925
7927 {
7928 return false;
7929 }
7930
7932 {
7933 return true;
7934 }
7935
7936
7937
7939 {
7940 return true;
7941 }
7942
7944 {
7945 return true;
7946 }
7947
7949 {
7950 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7952 }
7953
7955 {
7957 }
7958
7960 {
7962 if (!is_being_placed)
7964 SetSynchDirty();
7965 }
7966
7967
7969
7971 {
7973 }
7974
7976 {
7978 }
7979
7981 {
7982 return 1;
7983 }
7984
7986 {
7987 return false;
7988 }
7989
7991 {
7993 SetSynchDirty();
7994 }
7995
7996
7997
7998
7999
8000
8001
8002
8003
8004
8005
8006
8007
8008
8009
8010
8011
8012
8013
8014
8015
8016
8017
8018
8019
8020
8021
8022
8023
8024
8025
8026
8027
8028
8029
8031 {
8032 super.OnMovedInsideCargo(container);
8033
8034 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8035 }
8036
8037 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8038 {
8039 super.EEItemLocationChanged(oldLoc, newLoc);
8040
8041 PlayerBase newPlayer = null;
8042 PlayerBase oldPlayer = null;
8043
8044 if (newLoc.GetParent())
8045 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8046
8047 if (oldLoc.GetParent())
8048 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8049
8051 {
8052 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8053
8054 if (rIndex >= 0)
8055 {
8056 InventoryLocation rIl = new InventoryLocation;
8057 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8058
8059 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8062 {
8063 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8064 }
8066 {
8068 }
8069
8070 }
8071 }
8072
8074 {
8075 if (newPlayer)
8076 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8077
8078 if (newPlayer == oldPlayer)
8079 {
8080 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8081 {
8083 {
8084 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8085 {
8086 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8087 }
8088 }
8089 else
8090 {
8091 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8092 }
8093 }
8094
8095 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8096 {
8097 int type = oldLoc.GetType();
8099 {
8100 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8101 }
8103 {
8104 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8105 }
8106 }
8107 if (!m_OldLocation)
8108 {
8109 m_OldLocation = new InventoryLocation;
8110 }
8111 m_OldLocation.Copy(oldLoc);
8112 }
8113 else
8114 {
8115 if (m_OldLocation)
8116 {
8117 m_OldLocation.Reset();
8118 }
8119 }
8120
8121 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8122 }
8123 else
8124 {
8125 if (newPlayer)
8126 {
8127 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8128 if (resIndex >= 0)
8129 {
8130 InventoryLocation il = new InventoryLocation;
8131 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8133 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8136 {
8137 il.
GetParent().GetOnReleaseLock().Invoke(it);
8138 }
8140 {
8142 }
8143
8144 }
8145 }
8147 {
8148
8150 }
8151
8152 if (m_OldLocation)
8153 {
8154 m_OldLocation.Reset();
8155 }
8156 }
8157
8159 {
8160 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8161 }
8162
8164 {
8165 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8166 }
8167 }
8168
8169 override void EOnContact(IEntity other, Contact extra)
8170 {
8172 {
8173 int liquidType = -1;
8175 if (impactSpeed > 0.0)
8176 {
8178 #ifndef SERVER
8180 #else
8182 SetSynchDirty();
8183 #endif
8185 }
8186 }
8187
8188 #ifdef SERVER
8189 if (GetCompEM() && GetCompEM().IsPlugged())
8190 {
8191 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8192 GetCompEM().UnplugThis();
8193 }
8194 #endif
8195 }
8196
8198
8200 {
8202 }
8203
8205 {
8206
8207 }
8208
8210 {
8211 super.OnItemLocationChanged(old_owner, new_owner);
8212
8213 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8214 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8215
8216 if (!relatedPlayer && playerNew)
8217 relatedPlayer = playerNew;
8218
8219 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8220 {
8222 if (actionMgr)
8223 {
8224 ActionBase currentAction = actionMgr.GetRunningAction();
8225 if (currentAction)
8227 }
8228 }
8229
8230 Man ownerPlayerOld = null;
8231 Man ownerPlayerNew = null;
8232
8233 if (old_owner)
8234 {
8235 if (old_owner.
IsMan())
8236 {
8237 ownerPlayerOld = Man.Cast(old_owner);
8238 }
8239 else
8240 {
8241 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8242 }
8243 }
8244 else
8245 {
8247 {
8249
8250 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8251 {
8252 GetCompEM().UnplugThis();
8253 }
8254 }
8255 }
8256
8257 if (new_owner)
8258 {
8259 if (new_owner.
IsMan())
8260 {
8261 ownerPlayerNew = Man.Cast(new_owner);
8262 }
8263 else
8264 {
8265 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8266 }
8267 }
8268
8269 if (ownerPlayerOld != ownerPlayerNew)
8270 {
8271 if (ownerPlayerOld)
8272 {
8273 array<EntityAI> subItemsExit = new array<EntityAI>;
8275 for (int i = 0; i < subItemsExit.Count(); i++)
8276 {
8279 }
8280 }
8281
8282 if (ownerPlayerNew)
8283 {
8284 array<EntityAI> subItemsEnter = new array<EntityAI>;
8286 for (int j = 0; j < subItemsEnter.Count(); j++)
8287 {
8290 }
8291 }
8292 }
8293 else if (ownerPlayerNew != null)
8294 {
8295 PlayerBase nplayer;
8296 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8297 {
8298 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8300 for (int k = 0; k < subItemsUpdate.Count(); k++)
8301 {
8303 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8304 }
8305 }
8306 }
8307
8308 if (old_owner)
8309 old_owner.OnChildItemRemoved(this);
8310 if (new_owner)
8311 new_owner.OnChildItemReceived(this);
8312 }
8313
8314
8316 {
8317 super.EEDelete(parent);
8318 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8319 if (player)
8320 {
8322
8323 if (player.IsAlive())
8324 {
8325 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8326 if (r_index >= 0)
8327 {
8328 InventoryLocation r_il = new InventoryLocation;
8329 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8330
8331 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8334 {
8335 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8336 }
8338 {
8339 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8340 }
8341
8342 }
8343
8344 player.RemoveQuickBarEntityShortcut(this);
8345 }
8346 }
8347 }
8348
8350 {
8351 super.EEKilled(killer);
8352
8355 {
8356 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8357 {
8358 if (IsMagazine())
8359 {
8360 if (Magazine.Cast(this).GetAmmoCount() > 0)
8361 {
8363 }
8364 }
8365 else
8366 {
8368 }
8369 }
8370 }
8371 }
8372
8374 {
8375 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8376
8377 super.OnWasAttached(parent, slot_id);
8378
8381
8384 }
8385
8387 {
8388 super.OnWasDetached(parent, slot_id);
8389
8392
8395 }
8396
8398 {
8399 int idx;
8402
8403 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8404 if (inventory_slots.Count() < 1)
8405 {
8406 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8407 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8408 }
8409 else
8410 {
8411 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8412 }
8413
8414 idx = inventory_slots.Find(slot);
8415 if (idx < 0)
8416 return "";
8417
8418 return attach_types.Get(idx);
8419 }
8420
8422 {
8423 int idx = -1;
8424 string slot;
8425
8428
8429 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8430 if (inventory_slots.Count() < 1)
8431 {
8432 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8433 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8434 }
8435 else
8436 {
8437 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8438 if (detach_types.Count() < 1)
8439 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8440 }
8441
8442 for (int i = 0; i < inventory_slots.Count(); i++)
8443 {
8444 slot = inventory_slots.Get(i);
8445 }
8446
8447 if (slot != "")
8448 {
8449 if (detach_types.Count() == 1)
8450 idx = 0;
8451 else
8452 idx = inventory_slots.Find(slot);
8453 }
8454 if (idx < 0)
8455 return "";
8456
8457 return detach_types.Get(idx);
8458 }
8459
8461 {
8462
8464
8465
8466 float min_time = 1;
8467 float max_time = 3;
8468 float delay = Math.RandomFloat(min_time, max_time);
8469
8470 explode_timer.Run(delay, this, "DoAmmoExplosion");
8471 }
8472
8474 {
8475 Magazine magazine = Magazine.Cast(this);
8476 int pop_sounds_count = 6;
8477 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8478
8479
8480 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8481 string sound_name = pop_sounds[ sound_idx ];
8482 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8483
8484
8485 magazine.ServerAddAmmoCount(-1);
8486
8487
8488 float min_temp_to_explode = 100;
8489
8490 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8491 {
8493 }
8494 }
8495
8496
8497 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8498 {
8499 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8500
8501 const int CHANCE_DAMAGE_CARGO = 4;
8502 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8503 const int CHANCE_DAMAGE_NOTHING = 2;
8504
8506 {
8507 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8508 int chances;
8509 int rnd;
8510
8511 if (GetInventory().GetCargo())
8512 {
8513 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8514 rnd = Math.RandomInt(0,chances);
8515
8516 if (rnd < CHANCE_DAMAGE_CARGO)
8517 {
8519 }
8520 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8521 {
8523 }
8524 }
8525 else
8526 {
8527 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8528 rnd = Math.RandomInt(0,chances);
8529
8530 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8531 {
8533 }
8534 }
8535 }
8536 }
8537
8539 {
8540 CargoBase cargo = GetInventory().GetCargo();
8541 if (cargo)
8542 {
8544 if (item_count > 0)
8545 {
8546 int random_pick = Math.RandomInt(0, item_count);
8548 if (!item.IsExplosive())
8549 {
8550 item.AddHealth("","",damage);
8551 return true;
8552 }
8553 }
8554 }
8555 return false;
8556 }
8557
8559 {
8560 GameInventory inventory = GetInventory();
8562 if (attachment_count > 0)
8563 {
8564 int random_pick = Math.RandomInt(0, attachment_count);
8566 if (!attachment.IsExplosive())
8567 {
8568 attachment.AddHealth("","",damage);
8569 return true;
8570 }
8571 }
8572 return false;
8573 }
8574
8576 {
8578 }
8579
8581 {
8583 return GetInventory().CanRemoveEntity();
8584
8585 return false;
8586 }
8587
8589 {
8590
8592 return false;
8593
8594
8596 return false;
8597
8598
8599
8601 if (delta == 0)
8602 return false;
8603
8604
8605 return true;
8606 }
8607
8609 {
8611 {
8612 if (ScriptInputUserData.CanStoreInputUserData())
8613 {
8614 ScriptInputUserData ctx = new ScriptInputUserData;
8619 ctx.
Write(destination_entity);
8623 }
8624 }
8625 else if (!
g_Game.IsMultiplayer())
8626 {
8628 }
8629 }
8630
8632 {
8633 float split_quantity_new;
8637 InventoryLocation loc = new InventoryLocation;
8638
8639 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8640 {
8642 split_quantity_new = stack_max;
8643 else
8645
8647 {
8648 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8649 if (new_item)
8650 {
8651 new_item.SetResultOfSplit(true);
8652 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8654 new_item.
SetQuantity(split_quantity_new,
false,
true);
8655 }
8656 }
8657 }
8658 else if (destination_entity && slot_id == -1)
8659 {
8660 if (quantity > stack_max)
8661 split_quantity_new = stack_max;
8662 else
8663 split_quantity_new = quantity;
8664
8666 {
8667 GameInventory destinationInventory = destination_entity.GetInventory();
8669 {
8672 }
8673
8674 if (new_item)
8675 {
8676 new_item.SetResultOfSplit(true);
8677 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8679 new_item.
SetQuantity(split_quantity_new,
false,
true);
8680 }
8681 }
8682 }
8683 else
8684 {
8685 if (stack_max != 0)
8686 {
8688 {
8690 }
8691
8692 if (split_quantity_new == 0)
8693 {
8694 if (!
g_Game.IsMultiplayer())
8695 player.PhysicalPredictiveDropItem(this);
8696 else
8697 player.ServerDropEntity(this);
8698 return;
8699 }
8700
8702 {
8704
8705 if (new_item)
8706 {
8707 new_item.SetResultOfSplit(true);
8708 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8711 new_item.PlaceOnSurface();
8712 }
8713 }
8714 }
8715 }
8716 }
8717
8719 {
8720 float split_quantity_new;
8724 InventoryLocation loc = new InventoryLocation;
8725
8726 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8727 {
8729 split_quantity_new = stack_max;
8730 else
8732
8734 {
8735 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8736 if (new_item)
8737 {
8738 new_item.SetResultOfSplit(true);
8739 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8741 new_item.
SetQuantity(split_quantity_new,
false,
true);
8742 }
8743 }
8744 }
8745 else if (destination_entity && slot_id == -1)
8746 {
8747 if (quantity > stack_max)
8748 split_quantity_new = stack_max;
8749 else
8750 split_quantity_new = quantity;
8751
8753 {
8754 GameInventory destinationInventory = destination_entity.GetInventory();
8756 {
8759 }
8760
8761 if (new_item)
8762 {
8763 new_item.SetResultOfSplit(true);
8764 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8766 new_item.
SetQuantity(split_quantity_new,
false,
true);
8767 }
8768 }
8769 }
8770 else
8771 {
8772 if (stack_max != 0)
8773 {
8775 {
8777 }
8778
8780 {
8782
8783 if (new_item)
8784 {
8785 new_item.SetResultOfSplit(true);
8786 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8789 new_item.PlaceOnSurface();
8790 }
8791 }
8792 }
8793 }
8794 }
8795
8797 {
8799 {
8800 if (ScriptInputUserData.CanStoreInputUserData())
8801 {
8802 ScriptInputUserData ctx = new ScriptInputUserData;
8807 dst.WriteToContext(ctx);
8809 }
8810 }
8811 else if (!
g_Game.IsMultiplayer())
8812 {
8814 }
8815 }
8816
8818 {
8820 {
8821 if (ScriptInputUserData.CanStoreInputUserData())
8822 {
8823 ScriptInputUserData ctx = new ScriptInputUserData;
8828 ctx.
Write(destination_entity);
8834 }
8835 }
8836 else if (!
g_Game.IsMultiplayer())
8837 {
8839 }
8840 }
8841
8843 {
8845 }
8846
8848 {
8850 float split_quantity_new;
8852 if (dst.IsValid())
8853 {
8854 int slot_id = dst.GetSlot();
8856
8857 if (quantity > stack_max)
8858 split_quantity_new = stack_max;
8859 else
8860 split_quantity_new = quantity;
8861
8863 {
8865
8866 if (new_item)
8867 {
8868 new_item.SetResultOfSplit(true);
8869 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8871 new_item.
SetQuantity(split_quantity_new,
false,
true);
8872 }
8873
8874 return new_item;
8875 }
8876 }
8877
8878 return null;
8879 }
8880
8882 {
8884 float split_quantity_new;
8886 if (destination_entity)
8887 {
8889 if (quantity > stackable)
8890 split_quantity_new = stackable;
8891 else
8892 split_quantity_new = quantity;
8893
8895 {
8896 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8897 if (new_item)
8898 {
8899 new_item.SetResultOfSplit(true);
8900 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8902 new_item.
SetQuantity(split_quantity_new,
false,
true);
8903 }
8904 }
8905 }
8906 }
8907
8909 {
8911 {
8912 if (ScriptInputUserData.CanStoreInputUserData())
8913 {
8914 ScriptInputUserData ctx = new ScriptInputUserData;
8919 ItemBase destination_entity =
this;
8920 ctx.
Write(destination_entity);
8924 }
8925 }
8926 else if (!
g_Game.IsMultiplayer())
8927 {
8929 }
8930 }
8931
8933 {
8935 float split_quantity_new;
8937 if (player)
8938 {
8940 if (quantity > stackable)
8941 split_quantity_new = stackable;
8942 else
8943 split_quantity_new = quantity;
8944
8946 {
8947 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
8948 new_item =
ItemBase.Cast(in_hands);
8949 if (new_item)
8950 {
8951 new_item.SetResultOfSplit(true);
8952 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8954 new_item.SetQuantity(split_quantity_new, false, true);
8955 }
8956 }
8957 }
8958 }
8959
8961 {
8963 float split_quantity_new = Math.Floor(quantity * 0.5);
8964
8966 return;
8967
8969
8970 if (new_item)
8971 {
8972 if (new_item.GetQuantityMax() < split_quantity_new)
8973 {
8974 split_quantity_new = new_item.GetQuantityMax();
8975 }
8976
8977 new_item.SetResultOfSplit(true);
8978 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8979
8981 {
8984 }
8985 else
8986 {
8988 new_item.
SetQuantity(split_quantity_new,
false,
true);
8989 }
8990 }
8991 }
8992
8994 {
8996 float split_quantity_new = Math.Floor(quantity / 2);
8997
8999 return;
9000
9001 InventoryLocation invloc = new InventoryLocation;
9003
9005 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9006
9007 if (new_item)
9008 {
9009 if (new_item.GetQuantityMax() < split_quantity_new)
9010 {
9011 split_quantity_new = new_item.GetQuantityMax();
9012 }
9014 {
9017 }
9018 else if (split_quantity_new > 1)
9019 {
9021 new_item.
SetQuantity(split_quantity_new,
false,
true);
9022 }
9023 }
9024 }
9025
9028 {
9029 SetWeightDirty();
9031
9032 if (parent)
9033 parent.OnAttachmentQuantityChangedEx(this, delta);
9034
9036 {
9038 {
9040 }
9042 {
9043 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9045 }
9046 }
9047 }
9048
9051 {
9052
9053 }
9054
9057 {
9059 }
9060
9062 {
9063 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9064
9066 {
9067 if (newLevel == GameConstants.STATE_RUINED)
9068 {
9070 EntityAI parent = GetHierarchyParent();
9071 if (parent && parent.IsFireplace())
9072 {
9073 CargoBase cargo = GetInventory().GetCargo();
9074 if (cargo)
9075 {
9077 {
9079 }
9080 }
9081 }
9082 }
9083
9085 {
9086
9088 return;
9089 }
9090
9091 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9092 {
9094 }
9095 }
9096 }
9097
9098
9100 {
9101 super.OnRightClick();
9102
9104 {
9106 {
9107 if (ScriptInputUserData.CanStoreInputUserData())
9108 {
9109 EntityAI root = GetHierarchyRoot();
9110 Man playerOwner = GetHierarchyRootPlayer();
9111 InventoryLocation dst = new InventoryLocation;
9112
9113
9114 if (!playerOwner && root && root == this)
9115 {
9117 }
9118 else
9119 {
9120
9121 GetInventory().GetCurrentInventoryLocation(dst);
9123 {
9124 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9126 {
9128 }
9129 else
9130 {
9132
9133
9134 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9135 {
9137 }
9138 else
9139 {
9140 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9141 }
9142 }
9143 }
9144 }
9145
9146 ScriptInputUserData ctx = new ScriptInputUserData;
9154 }
9155 }
9156 else if (!
g_Game.IsMultiplayer())
9157 {
9159 }
9160 }
9161 }
9162
9164 {
9165 if (root)
9166 {
9167 vector m4[4];
9168 root.GetTransform(m4);
9169 dst.SetGround(this, m4);
9170 }
9171 else
9172 {
9173 GetInventory().GetCurrentInventoryLocation(dst);
9174 }
9175 }
9176
9177 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9178 {
9179
9180 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9181 return false;
9182
9183 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9184 return false;
9185
9186
9188 return false;
9189
9190
9191 Magazine mag = Magazine.Cast(this);
9192 if (mag)
9193 {
9194 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9195 return false;
9196
9197 if (stack_max_limit)
9198 {
9199 Magazine other_mag = Magazine.Cast(other_item);
9200 if (other_item)
9201 {
9202 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9203 return false;
9204 }
9205
9206 }
9207 }
9208 else
9209 {
9210
9212 return false;
9213
9215 return false;
9216 }
9217
9218 PlayerBase player = null;
9219 if (CastTo(player, GetHierarchyRootPlayer()))
9220 {
9221 if (player.GetInventory().HasAttachment(this))
9222 return false;
9223
9224 if (player.IsItemsToDelete())
9225 return false;
9226 }
9227
9228 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9229 return false;
9230
9231 int slotID;
9233 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9234 return false;
9235
9236 return true;
9237 }
9238
9240 {
9242 }
9243
9245 {
9246 return m_IsResultOfSplit;
9247 }
9248
9250 {
9251 m_IsResultOfSplit = value;
9252 }
9253
9255 {
9257 }
9258
9260 {
9261 float other_item_quantity = other_item.GetQuantity();
9262 float this_free_space;
9263
9265
9267
9268 if (other_item_quantity > this_free_space)
9269 {
9270 return this_free_space;
9271 }
9272 else
9273 {
9274 return other_item_quantity;
9275 }
9276 }
9277
9279 {
9281 }
9282
9284 {
9286 return;
9287
9288 if (!IsMagazine() && other_item)
9289 {
9291 if (quantity_used != 0)
9292 {
9293 float hp1 = GetHealth01("","");
9294 float hp2 = other_item.GetHealth01("","");
9295 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9296 hpResult = hpResult / (
GetQuantity() + quantity_used);
9297
9298 hpResult *= GetMaxHealth();
9299 Math.Round(hpResult);
9300 SetHealth("", "Health", hpResult);
9301
9303 other_item.AddQuantity(-quantity_used);
9304 }
9305 }
9307 }
9308
9310 {
9311 #ifdef SERVER
9312 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9313 GetHierarchyParent().IncreaseLifetimeUp();
9314 #endif
9315 };
9316
9318 {
9319 PlayerBase p = PlayerBase.Cast(player);
9320
9321 array<int> recipesIds = p.m_Recipes;
9322 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9323 if (moduleRecipesManager)
9324 {
9325 EntityAI itemInHands = player.GetEntityInHands();
9326 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9327 }
9328
9329 for (int i = 0;i < recipesIds.Count(); i++)
9330 {
9331 int key = recipesIds.Get(i);
9332 string recipeName = moduleRecipesManager.GetRecipeName(key);
9334 }
9335 }
9336
9337
9338 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9339 {
9340 super.GetDebugActions(outputList);
9341
9342
9348
9349
9354
9359
9360
9364
9365
9367 {
9371 }
9372
9375
9376
9380
9382
9383 InventoryLocation loc = new InventoryLocation();
9384 GetInventory().GetCurrentInventoryLocation(loc);
9386 {
9387 if (Gizmo_IsSupported())
9390 }
9391
9393 }
9394
9395
9396
9397
9399 {
9400 super.OnAction(action_id, player, ctx);
9401
9403 {
9404 switch (action_id)
9405 {
9409 return true;
9413 return true;
9414 }
9415 }
9416
9418 {
9419 switch (action_id)
9420 {
9422 Delete();
9423 return true;
9424 }
9425 }
9426
9427 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9428 {
9429 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9430 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9431 PlayerBase p = PlayerBase.Cast(player);
9432 if (
EActions.RECIPES_RANGE_START < 1000)
9433 {
9434 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9435 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9436 }
9437 }
9438 #ifndef SERVER
9439 else if (action_id ==
EActions.WATCH_PLAYER)
9440 {
9441 PluginDeveloper.SetDeveloperItemClientEx(player);
9442 }
9443 #endif
9445 {
9446 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9447 {
9448 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9449 OnDebugButtonPressServer(id + 1);
9450 }
9451
9452 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9453 {
9454 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9456 }
9457
9458 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9459 {
9460 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9462 }
9463
9464 else if (action_id ==
EActions.ADD_QUANTITY)
9465 {
9466 if (IsMagazine())
9467 {
9468 Magazine mag = Magazine.Cast(this);
9469 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9470 }
9471 else
9472 {
9474 }
9475
9476 if (m_EM)
9477 {
9478 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9479 }
9480
9481 }
9482
9483 else if (action_id ==
EActions.REMOVE_QUANTITY)
9484 {
9485 if (IsMagazine())
9486 {
9487 Magazine mag2 = Magazine.Cast(this);
9488 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9489 }
9490 else
9491 {
9493 }
9494 if (m_EM)
9495 {
9496 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9497 }
9498
9499 }
9500
9501 else if (action_id ==
EActions.SET_QUANTITY_0)
9502 {
9504
9505 if (m_EM)
9506 {
9507 m_EM.SetEnergy(0);
9508 }
9509 }
9510
9511 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9512 {
9514
9515 if (m_EM)
9516 {
9517 m_EM.SetEnergy(m_EM.GetEnergyMax());
9518 }
9519 }
9520
9521 else if (action_id ==
EActions.ADD_HEALTH)
9522 {
9523 AddHealth("","",GetMaxHealth("","Health")/5);
9524 }
9525 else if (action_id ==
EActions.REMOVE_HEALTH)
9526 {
9527 AddHealth("","",-GetMaxHealth("","Health")/5);
9528 }
9529 else if (action_id ==
EActions.DESTROY_HEALTH)
9530 {
9531 SetHealth01("","",0);
9532 }
9533 else if (action_id ==
EActions.WATCH_ITEM)
9534 {
9536 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9537 #ifdef DEVELOPER
9538 SetDebugDeveloper_item(this);
9539 #endif
9540 }
9541
9542 else if (action_id ==
EActions.ADD_TEMPERATURE)
9543 {
9544 AddTemperature(20);
9545
9546 }
9547
9548 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9549 {
9550 AddTemperature(-20);
9551
9552 }
9553
9554 else if (action_id ==
EActions.FLIP_FROZEN)
9555 {
9556 SetFrozen(!GetIsFrozen());
9557
9558 }
9559
9560 else if (action_id ==
EActions.ADD_WETNESS)
9561 {
9563
9564 }
9565
9566 else if (action_id ==
EActions.REMOVE_WETNESS)
9567 {
9569
9570 }
9571
9572 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9573 {
9576
9577
9578 }
9579
9580 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9581 {
9584 }
9585
9586 else if (action_id ==
EActions.MAKE_SPECIAL)
9587 {
9588 auto debugParams = DebugSpawnParams.WithPlayer(player);
9589 OnDebugSpawnEx(debugParams);
9590 }
9591
9592 }
9593
9594
9595 return false;
9596 }
9597
9598
9599
9600
9604
9607
9608
9609
9611 {
9612 return false;
9613 }
9614
9615
9617 {
9618 return true;
9619 }
9620
9621
9623 {
9624 return true;
9625 }
9626
9627
9628
9630 {
9631 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9632 return g_Game.ConfigIsExisting(config_path);
9633 }
9634
9637 {
9638 return null;
9639 }
9640
9642 {
9643 return false;
9644 }
9645
9647 {
9648 return false;
9649 }
9650
9654
9655
9657 {
9658 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9659 return module_repairing.CanRepair(this, item_repair_kit);
9660 }
9661
9662
9663 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9664 {
9665 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9666 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9667 }
9668
9669
9671 {
9672
9673
9674
9675
9676
9677
9678
9679
9680 return 1;
9681 }
9682
9683
9684
9686 {
9688 }
9689
9690
9691
9693 {
9695 }
9696
9697
9706 {
9707 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9708
9709 if (player)
9710 {
9711 player.MessageStatus(text);
9712 }
9713 }
9714
9715
9724 {
9725 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9726
9727 if (player)
9728 {
9729 player.MessageAction(text);
9730 }
9731 }
9732
9733
9742 {
9743 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9744
9745 if (player)
9746 {
9747 player.MessageFriendly(text);
9748 }
9749 }
9750
9751
9760 {
9761 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9762
9763 if (player)
9764 {
9765 player.MessageImportant(text);
9766 }
9767 }
9768
9770 {
9771 return true;
9772 }
9773
9774
9775 override bool KindOf(
string tag)
9776 {
9777 bool found = false;
9778 string item_name = this.
GetType();
9780 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9781
9782 int array_size = item_tag_array.Count();
9783 for (int i = 0; i < array_size; i++)
9784 {
9785 if (item_tag_array.Get(i) == tag)
9786 {
9787 found = true;
9788 break;
9789 }
9790 }
9791 return found;
9792 }
9793
9794
9796 {
9797
9798 super.OnRPC(sender, rpc_type,ctx);
9799
9800
9801 switch (rpc_type)
9802 {
9803 #ifndef SERVER
9804 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9805 Param2<bool, string> p = new Param2<bool, string>(false, "");
9806
9808 return;
9809
9810 bool play = p.param1;
9811 string soundSet = p.param2;
9812
9813 if (play)
9814 {
9816 {
9818 {
9820 }
9821 }
9822 else
9823 {
9825 }
9826 }
9827 else
9828 {
9830 }
9831
9832 break;
9833 #endif
9834
9835 }
9836
9838 {
9840 }
9841 }
9842
9843
9844
9845
9847 {
9848 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9849 return plugin.GetID(
name);
9850 }
9851
9853 {
9854 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9855 return plugin.GetName(id);
9856 }
9857
9860 {
9861
9862
9863 int varFlags;
9864 if (!ctx.
Read(varFlags))
9865 return;
9866
9867 if (varFlags & ItemVariableFlags.FLOAT)
9868 {
9870 }
9871 }
9872
9874 {
9875
9876 super.SerializeNumericalVars(floats_out);
9877
9878
9879
9881 {
9883 }
9884
9886 {
9888 }
9889
9891 {
9893 }
9894
9896 {
9901 }
9902
9904 {
9906 }
9907 }
9908
9910 {
9911
9912 super.DeSerializeNumericalVars(floats);
9913
9914
9915 int index = 0;
9916 int mask = Math.Round(floats.Get(index));
9917
9918 index++;
9919
9921 {
9923 {
9925 }
9926 else
9927 {
9928 float quantity = floats.Get(index);
9930 }
9931 index++;
9932 }
9933
9935 {
9936 float wet = floats.Get(index);
9938 index++;
9939 }
9940
9942 {
9943 int liquidtype = Math.Round(floats.Get(index));
9945 index++;
9946 }
9947
9949 {
9951 index++;
9953 index++;
9955 index++;
9957 index++;
9958 }
9959
9961 {
9962 int cleanness = Math.Round(floats.Get(index));
9964 index++;
9965 }
9966 }
9967
9969 {
9970 super.WriteVarsToCTX(ctx);
9971
9972
9974 {
9976 }
9977
9979 {
9981 }
9982
9984 {
9986 }
9987
9989 {
9990 int r,g,b,a;
9996 }
9997
9999 {
10001 }
10002 }
10003
10005 {
10006 if (!super.ReadVarsFromCTX(ctx,version))
10007 return false;
10008
10009 int intValue;
10010 float value;
10011
10012 if (version < 140)
10013 {
10014 if (!ctx.
Read(intValue))
10015 return false;
10016
10017 m_VariablesMask = intValue;
10018 }
10019
10021 {
10022 if (!ctx.
Read(value))
10023 return false;
10024
10026 {
10028 }
10029 else
10030 {
10032 }
10033 }
10034
10035 if (version < 140)
10036 {
10038 {
10039 if (!ctx.
Read(value))
10040 return false;
10041 SetTemperatureDirect(value);
10042 }
10043 }
10044
10046 {
10047 if (!ctx.
Read(value))
10048 return false;
10050 }
10051
10053 {
10054 if (!ctx.
Read(intValue))
10055 return false;
10057 }
10058
10060 {
10061 int r,g,b,a;
10063 return false;
10065 return false;
10067 return false;
10069 return false;
10070
10072 }
10073
10075 {
10076 if (!ctx.
Read(intValue))
10077 return false;
10079 }
10080
10081 if (version >= 138 && version < 140)
10082 {
10084 {
10085 if (!ctx.
Read(intValue))
10086 return false;
10087 SetFrozen(intValue);
10088 }
10089 }
10090
10091 return true;
10092 }
10093
10094
10096 {
10099 {
10101 }
10102
10103 if (!super.OnStoreLoad(ctx, version))
10104 {
10106 return false;
10107 }
10108
10109 if (version >= 114)
10110 {
10111 bool hasQuickBarIndexSaved;
10112
10113 if (!ctx.
Read(hasQuickBarIndexSaved))
10114 {
10116 return false;
10117 }
10118
10119 if (hasQuickBarIndexSaved)
10120 {
10121 int itmQBIndex;
10122
10123
10124 if (!ctx.
Read(itmQBIndex))
10125 {
10127 return false;
10128 }
10129
10130 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10131 if (itmQBIndex != -1 && parentPlayer)
10132 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10133 }
10134 }
10135 else
10136 {
10137
10138 PlayerBase player;
10139 int itemQBIndex;
10140 if (version ==
int.
MAX)
10141 {
10142 if (!ctx.
Read(itemQBIndex))
10143 {
10145 return false;
10146 }
10147 }
10148 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10149 {
10150
10151 if (!ctx.
Read(itemQBIndex))
10152 {
10154 return false;
10155 }
10156 if (itemQBIndex != -1 && player)
10157 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10158 }
10159 }
10160
10161 if (version < 140)
10162 {
10163
10164 if (!LoadVariables(ctx, version))
10165 {
10167 return false;
10168 }
10169 }
10170
10171
10173 {
10175 return false;
10176 }
10177 if (version >= 132)
10178 {
10180 if (raib)
10181 {
10183 {
10185 return false;
10186 }
10187 }
10188 }
10189
10191 return true;
10192 }
10193
10194
10195
10197 {
10198 super.OnStoreSave(ctx);
10199
10200 PlayerBase player;
10201 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10202 {
10204
10205 int itemQBIndex = -1;
10206 itemQBIndex = player.FindQuickBarEntityIndex(this);
10207 ctx.
Write(itemQBIndex);
10208 }
10209 else
10210 {
10212 }
10213
10215
10217 if (raib)
10218 {
10220 }
10221 }
10222
10223
10225 {
10226 super.AfterStoreLoad();
10227
10229 {
10231 }
10232
10234 {
10237 }
10238 }
10239
10241 {
10242 super.EEOnAfterLoad();
10243
10245 {
10247 }
10248
10251 }
10252
10254 {
10255 return false;
10256 }
10257
10258
10259
10261 {
10263 {
10264 #ifdef PLATFORM_CONSOLE
10265
10267 {
10269 if (menu)
10270 {
10272 }
10273 }
10274 #endif
10275 }
10276
10278 {
10281 }
10282
10284 {
10285 SetWeightDirty();
10287 }
10289 {
10292 }
10293
10295 {
10298
10301 }
10303 {
10307 }
10308
10309 super.OnVariablesSynchronized();
10310 }
10311
10312
10313
10315 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10316 {
10317 if (!IsServerCheck(allow_client))
10318 return false;
10319
10321 return false;
10322
10325
10326 if (value <= (min + 0.001))
10327 value = min;
10328
10329 if (value == min)
10330 {
10331 if (destroy_config)
10332 {
10333 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10334 if (dstr)
10335 {
10337 this.Delete();
10338 return true;
10339 }
10340 }
10341 else if (destroy_forced)
10342 {
10344 this.Delete();
10345 return true;
10346 }
10347
10349 }
10350
10353
10355 {
10356 EntityAI parent = GetHierarchyRoot();
10357 InventoryLocation iLoc = new InventoryLocation();
10358 GetInventory().GetCurrentInventoryLocation(iLoc);
10360 {
10361 int iLocSlot = iLoc.
GetSlot();
10363 {
10365 }
10367 {
10369 }
10370 }
10371 }
10372
10374 {
10376
10377 if (delta)
10379 }
10380
10382
10383 return false;
10384 }
10385
10386
10388 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10389 {
10391 }
10392
10394 {
10397 }
10398
10400 {
10403 }
10404
10406 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10407 {
10408 float value_clamped = Math.Clamp(value, 0, 1);
10410 SetQuantity(result, destroy_config, destroy_forced);
10411 }
10412
10413
10416 {
10418 }
10419
10421 {
10423 }
10424
10425
10426
10427
10428
10429
10430
10431
10432
10433
10435 {
10436 int slot = -1;
10437 GameInventory inventory = GetInventory();
10438 if (inventory)
10439 {
10440 InventoryLocation il = new InventoryLocation;
10443 }
10444
10446 }
10447
10449 {
10450 float quantity_max = 0;
10451
10453 {
10454 if (attSlotID != -1)
10455 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10456
10457 if (quantity_max <= 0)
10459 }
10460
10461 if (quantity_max <= 0)
10463
10464 return quantity_max;
10465 }
10466
10468 {
10470 }
10471
10473 {
10475 }
10476
10477
10479 {
10481 }
10482
10484 {
10486 }
10487
10489 {
10491 }
10492
10493
10495 {
10496
10497 float weightEx = GetWeightEx();
10498 float special = GetInventoryAndCargoWeight();
10499 return weightEx - special;
10500 }
10501
10502
10504 {
10506 }
10507
10509 {
10511 {
10512 #ifdef DEVELOPER
10513 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10514 {
10515 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10517 }
10518 #endif
10519
10520 return GetQuantity() * GetConfigWeightModified();
10521 }
10522 else if (HasEnergyManager())
10523 {
10524 #ifdef DEVELOPER
10525 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10526 {
10527 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10528 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10529 }
10530 #endif
10531 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10532 }
10533 else
10534 {
10535 #ifdef DEVELOPER
10536 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10537 {
10538 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10539 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10540 }
10541 #endif
10542 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10543 }
10544 }
10545
10548 {
10549 int item_count = 0;
10551
10552 GameInventory inventory = GetInventory();
10553 CargoBase cargo = inventory.
GetCargo();
10554 if (cargo != NULL)
10555 {
10557 }
10558
10560 for (int i = 0; i < nAttachments; ++i)
10561 {
10563 if (item)
10564 item_count += item.GetNumberOfItems();
10565 }
10566 return item_count;
10567 }
10568
10571 {
10572 float weight = 0;
10573 float wetness = 1;
10574 if (include_wetness)
10577 {
10578 weight = wetness * m_ConfigWeight;
10579 }
10581 {
10582 weight = 1;
10583 }
10584 return weight;
10585 }
10586
10587
10588
10590 {
10591 GameInventory inventory = GetInventory();
10592 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10593 {
10594 array<EntityAI> items = new array<EntityAI>;
10596 for (int i = 0; i < items.Count(); ++i)
10597 {
10599 if (item)
10600 {
10601 g_Game.ObjectDelete(item);
10602 }
10603 }
10604 }
10605 }
10606
10607
10608
10609
10611 {
10612 float energy = 0;
10613 if (HasEnergyManager())
10614 {
10615 energy = GetCompEM().GetEnergy();
10616 }
10617 return energy;
10618 }
10619
10620
10622 {
10623 super.OnEnergyConsumed();
10624
10626 }
10627
10629 {
10630 super.OnEnergyAdded();
10631
10633 }
10634
10635
10637 {
10638 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10639 {
10641 {
10642 float energy_0to1 = GetCompEM().GetEnergy0To1();
10644 }
10645 }
10646 }
10647
10648
10650 {
10651 return ConfigGetFloat("heatIsolation");
10652 }
10653
10655 {
10657 }
10658
10660 {
10661 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10662 if (
g_Game.ConfigIsExisting(paramPath))
10663 return g_Game.ConfigGetFloat(paramPath);
10664
10665 return 0.0;
10666 }
10667
10669 {
10670 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10671 if (
g_Game.ConfigIsExisting(paramPath))
10672 return g_Game.ConfigGetFloat(paramPath);
10673
10674 return 0.0;
10675 }
10676
10677 override void SetWet(
float value,
bool allow_client =
false)
10678 {
10679 if (!IsServerCheck(allow_client))
10680 return;
10681
10684
10686
10687 m_VarWet = Math.Clamp(value, min, max);
10688
10690 {
10693 }
10694 }
10695
10696 override void AddWet(
float value)
10697 {
10699 }
10700
10702 {
10704 }
10705
10707 {
10709 }
10710
10712 {
10714 }
10715
10717 {
10719 }
10720
10722 {
10724 }
10725
10726 override void OnWetChanged(
float newVal,
float oldVal)
10727 {
10730 if (newLevel != oldLevel)
10731 {
10733 }
10734 }
10735
10737 {
10738 SetWeightDirty();
10739 }
10740
10742 {
10743 return GetWetLevelInternal(
m_VarWet);
10744 }
10745
10746
10747
10749 {
10751 }
10752
10754 {
10756 }
10757
10759 {
10761 }
10762
10764 {
10766 }
10767
10768
10769
10771 {
10772 if (ConfigIsExisting("itemModelLength"))
10773 {
10774 return ConfigGetFloat("itemModelLength");
10775 }
10776 return 0;
10777 }
10778
10780 {
10781 if (ConfigIsExisting("itemAttachOffset"))
10782 {
10783 return ConfigGetFloat("itemAttachOffset");
10784 }
10785 return 0;
10786 }
10787
10788 override void SetCleanness(
int value,
bool allow_client =
false)
10789 {
10790 if (!IsServerCheck(allow_client))
10791 return;
10792
10794
10796
10799 }
10800
10802 {
10804 }
10805
10807 {
10808 return true;
10809 }
10810
10811
10812
10813
10815 {
10817 }
10818
10820 {
10822 }
10823
10824
10825
10826
10827 override void SetColor(
int r,
int g,
int b,
int a)
10828 {
10834 }
10836 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10837 {
10842 }
10843
10845 {
10847 }
10848
10851 {
10852 int r,g,b,a;
10854 r = r/255;
10855 g = g/255;
10856 b = b/255;
10857 a = a/255;
10858 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10859 }
10860
10861
10862
10863 override void SetLiquidType(
int value,
bool allow_client =
false)
10864 {
10865 if (!IsServerCheck(allow_client))
10866 return;
10867
10872 }
10873
10875 {
10876 return ConfigGetInt("varLiquidTypeInit");
10877 }
10878
10880 {
10882 }
10883
10885 {
10887 SetFrozen(false);
10888 }
10889
10892 {
10893 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10894 }
10895
10896
10899 {
10900 PlayerBase nplayer;
10901 if (PlayerBase.CastTo(nplayer, player))
10902 {
10904 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10905 }
10906 }
10907
10908
10911 {
10912 PlayerBase nplayer;
10913 if (PlayerBase.CastTo(nplayer,player))
10914 {
10915 nplayer.SetEnableQuickBarEntityShortcut(this, false);
10916 }
10917
10918 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10919
10920 if (HasEnergyManager())
10921 {
10922 GetCompEM().UpdatePlugState();
10923 }
10924 }
10925
10926
10928 {
10929 super.OnPlacementStarted(player);
10930
10932 }
10933
10934 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10935 {
10937 {
10938 m_AdminLog.OnPlacementComplete(player,
this);
10939 }
10940
10941 super.OnPlacementComplete(player, position, orientation);
10942 }
10943
10944
10945
10946
10947
10949 {
10951 {
10952 return true;
10953 }
10954 else
10955 {
10956 return false;
10957 }
10958 }
10959
10960
10962 {
10964 {
10966 }
10967 }
10968
10969
10971 {
10973 }
10974
10976 {
10978 }
10979
10980 override void InsertAgent(
int agent,
float count = 1)
10981 {
10982 if (count < 1)
10983 return;
10984
10986 }
10987
10990 {
10992 }
10993
10994
10996 {
10998 }
10999
11000
11001
11002
11003
11004
11005
11006
11007
11008
11009
11010
11011
11012
11013
11014
11015
11016
11017
11018
11019
11020
11021
11022
11023
11024
11025
11026
11027
11028
11029
11030
11031
11032
11033
11034
11035
11036
11037
11038
11039
11040
11042 {
11044 return false;
11045 return true;
11046 }
11047
11049 {
11050
11052 }
11053
11054
11057 {
11058 super.CheckForRoofLimited(timeTresholdMS);
11059
11060 float time =
g_Game.GetTime();
11061 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11062 {
11063 m_PreviousRoofTestTime = time;
11064 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11065 }
11066 }
11067
11068
11070 {
11072 {
11073 return 0;
11074 }
11075
11076 if (GetInventory().GetAttachmentSlotsCount() != 0)
11077 {
11078 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11079 if (filter)
11080 return filter.GetProtectionLevel(type, false, system);
11081 else
11082 return 0;
11083 }
11084
11085 string subclassPath, entryName;
11086
11087 switch (type)
11088 {
11090 entryName = "biological";
11091 break;
11093 entryName = "chemical";
11094 break;
11095 default:
11096 entryName = "biological";
11097 break;
11098 }
11099
11100 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11101
11102 return g_Game.ConfigGetFloat(subclassPath + entryName);
11103 }
11104
11105
11106
11109 {
11110 if (!IsMagazine())
11112
11114 }
11115
11116
11117
11118
11119
11124 {
11125 return true;
11126 }
11127
11129 {
11131 }
11132
11133
11134
11135
11136
11138 {
11139 if (parent)
11140 {
11141 if (parent.IsInherited(DayZInfected))
11142 return true;
11143
11144 if (!parent.IsRuined())
11145 return true;
11146 }
11147
11148 return true;
11149 }
11150
11152 {
11153 if (!super.CanPutAsAttachment(parent))
11154 {
11155 return false;
11156 }
11157
11158 if (!IsRuined() && !parent.IsRuined())
11159 {
11160 return true;
11161 }
11162
11163 return false;
11164 }
11165
11167 {
11168
11169
11170
11171
11172 return super.CanReceiveItemIntoCargo(item);
11173 }
11174
11176 {
11177
11178
11179
11180
11181 GameInventory attachmentInv = attachment.GetInventory();
11183 {
11184 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11185 return false;
11186 }
11187
11188 InventoryLocation loc = new InventoryLocation();
11189 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11190 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11191 return false;
11192
11193 return super.CanReceiveAttachment(attachment, slotId);
11194 }
11195
11197 {
11198 if (!super.CanReleaseAttachment(attachment))
11199 return false;
11200
11201 return GetInventory().AreChildrenAccessible();
11202 }
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11225 {
11226 int id = muzzle_owner.GetMuzzleID();
11227 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11228
11229 if (WPOF_array)
11230 {
11231 for (int i = 0; i < WPOF_array.Count(); i++)
11232 {
11233 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11234
11235 if (WPOF)
11236 {
11237 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11238 }
11239 }
11240 }
11241 }
11242
11243
11245 {
11246 int id = muzzle_owner.GetMuzzleID();
11248
11249 if (WPOBE_array)
11250 {
11251 for (int i = 0; i < WPOBE_array.Count(); i++)
11252 {
11253 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11254
11255 if (WPOBE)
11256 {
11257 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11258 }
11259 }
11260 }
11261 }
11262
11263
11265 {
11266 int id = muzzle_owner.GetMuzzleID();
11267 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11268
11269 if (WPOOH_array)
11270 {
11271 for (int i = 0; i < WPOOH_array.Count(); i++)
11272 {
11273 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11274
11275 if (WPOOH)
11276 {
11277 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11278 }
11279 }
11280 }
11281 }
11282
11283
11285 {
11286 int id = muzzle_owner.GetMuzzleID();
11287 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11288
11289 if (WPOOH_array)
11290 {
11291 for (int i = 0; i < WPOOH_array.Count(); i++)
11292 {
11293 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11294
11295 if (WPOOH)
11296 {
11297 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11298 }
11299 }
11300 }
11301 }
11302
11303
11305 {
11306 int id = muzzle_owner.GetMuzzleID();
11307 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11308
11309 if (WPOOH_array)
11310 {
11311 for (int i = 0; i < WPOOH_array.Count(); i++)
11312 {
11313 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11314
11315 if (WPOOH)
11316 {
11317 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11318 }
11319 }
11320 }
11321 }
11322
11323
11324
11326 {
11328 {
11329 return true;
11330 }
11331
11332 return false;
11333 }
11334
11336 {
11338 {
11339 return true;
11340 }
11341
11342 return false;
11343 }
11344
11346 {
11348 {
11349 return true;
11350 }
11351
11352 return false;
11353 }
11354
11356 {
11357 return false;
11358 }
11359
11362 {
11363 return UATimeSpent.DEFAULT_DEPLOY;
11364 }
11365
11366
11367
11368
11370 {
11372 SetSynchDirty();
11373 }
11374
11376 {
11378 }
11379
11380
11382 {
11383 return false;
11384 }
11385
11388 {
11389 string att_type = "None";
11390
11391 if (ConfigIsExisting("soundAttType"))
11392 {
11393 att_type = ConfigGetString("soundAttType");
11394 }
11395
11397 }
11398
11400 {
11402 }
11403
11404
11405
11406
11407
11413
11415 {
11418
11420 }
11421
11422
11424 {
11426 return;
11427
11429
11432
11435
11436 SoundParameters params = new SoundParameters();
11440 }
11441
11442
11444 {
11446 {
11449
11450 SetSynchDirty();
11451
11454 }
11455 }
11456
11458 {
11460 }
11461
11462
11464 {
11466 return;
11467
11469 SetSynchDirty();
11470
11473 }
11474
11476 {
11479 }
11480
11482 {
11484 }
11485
11486 void OnApply(PlayerBase player);
11487
11489 {
11490 return 1.0;
11491 };
11492
11494 {
11496 }
11497
11499 {
11501 }
11502
11504
11506 {
11507 SetDynamicPhysicsLifeTime(0.01);
11509 }
11510
11512 {
11513 array<string> zone_names = new array<string>;
11514 GetDamageZones(zone_names);
11515 for (int i = 0; i < zone_names.Count(); i++)
11516 {
11517 SetHealthMax(zone_names.Get(i),"Health");
11518 }
11519 SetHealthMax("","Health");
11520 }
11521
11524 {
11525 float global_health = GetHealth01("","Health");
11526 array<string> zones = new array<string>;
11527 GetDamageZones(zones);
11528
11529 for (int i = 0; i < zones.Count(); i++)
11530 {
11531 SetHealth01(zones.Get(i),"Health",global_health);
11532 }
11533 }
11534
11537 {
11538 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11539 }
11540
11542 {
11543 if (!hasRootAsPlayer)
11544 {
11545 if (refParentIB)
11546 {
11547
11548 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11549 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11550
11551 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11552 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11553
11556 }
11557 else
11558 {
11559
11562 }
11563 }
11564 }
11565
11567 {
11569 {
11570 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11571 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11572 {
11573 float heatPermCoef = 1.0;
11575 while (ent)
11576 {
11577 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11578 ent = ent.GetHierarchyParent();
11579 }
11580
11581 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11582 }
11583 }
11584 }
11585
11587 {
11588
11589 EntityAI parent = GetHierarchyParent();
11590 if (!parent)
11591 {
11592 hasParent = false;
11593 hasRootAsPlayer = false;
11594 }
11595 else
11596 {
11597 hasParent = true;
11598 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11599 refParentIB =
ItemBase.Cast(parent);
11600 }
11601 }
11602
11603 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11604 {
11605
11606 }
11607
11609 {
11610
11611 return false;
11612 }
11613
11615 {
11616
11617
11618 return false;
11619 }
11620
11622 {
11623
11624 return false;
11625 }
11626
11629 {
11630 return !GetIsFrozen() &&
IsOpen();
11631 }
11632
11634 {
11635 bool hasParent = false, hasRootAsPlayer = false;
11637
11638 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11639 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11640
11641 if (wwtu || foodDecay)
11642 {
11646
11647 if (processWetness || processTemperature || processDecay)
11648 {
11650
11651 if (processWetness)
11652 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11653
11654 if (processTemperature)
11656
11657 if (processDecay)
11658 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11659 }
11660 }
11661 }
11662
11665 {
11667 }
11668
11670 {
11673
11674 return super.GetTemperatureFreezeThreshold();
11675 }
11676
11678 {
11681
11682 return super.GetTemperatureThawThreshold();
11683 }
11684
11686 {
11689
11690 return super.GetItemOverheatThreshold();
11691 }
11692
11694 {
11696 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11697
11698 return super.GetTemperatureFreezeTime();
11699 }
11700
11702 {
11704 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11705
11706 return super.GetTemperatureThawTime();
11707 }
11708
11713
11715 {
11716 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11717 }
11718
11720 {
11721 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11722 }
11723
11726 {
11728 }
11729
11731 {
11733 }
11734
11736 {
11738 }
11739
11742 {
11743 return null;
11744 }
11745
11748 {
11749 return false;
11750 }
11751
11753 {
11755 {
11758 if (!trg)
11759 {
11761 explosive = this;
11762 }
11763
11764 explosive.PairRemote(trg);
11766
11767 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11768 trg.SetPersistentPairID(persistentID);
11769 explosive.SetPersistentPairID(persistentID);
11770
11771 return true;
11772 }
11773 return false;
11774 }
11775
11778 {
11779 float ret = 1.0;
11782 ret *= GetHealth01();
11783
11784 return ret;
11785 }
11786
11787 #ifdef DEVELOPER
11788 override void SetDebugItem()
11789 {
11790 super.SetDebugItem();
11791 _itemBase = this;
11792 }
11793
11795 {
11796 string text = super.GetDebugText();
11797
11799 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11800
11801 return text;
11802 }
11803 #endif
11804
11806 {
11807 return true;
11808 }
11809
11811
11813
11815 {
11818 }
11819
11820
11828
11844
11845 [
Obsolete(
"Use ItemSoundHandler instead")]
11848 {
11849 if (!
g_Game.IsDedicatedServer())
11850 {
11851 if (ConfigIsExisting("attachSoundSet"))
11852 {
11853 string cfg_path = "";
11854 string soundset = "";
11855 string type_name =
GetType();
11856
11859 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11860 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11861
11862 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11863 {
11864 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11865 {
11866 if (cfg_slot_array[i] == slot_type)
11867 {
11868 soundset = cfg_soundset_array[i];
11869 break;
11870 }
11871 }
11872 }
11873
11874 if (soundset != "")
11875 {
11876 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11878 }
11879 }
11880 }
11881 }
11882
11884}
11885
11887{
11889 if (entity)
11890 {
11891 bool is_item = entity.IsInherited(
ItemBase);
11892 if (is_item && full_quantity)
11893 {
11896 }
11897 }
11898 else
11899 {
11901 return NULL;
11902 }
11903 return entity;
11904}
11905
11907{
11908 if (item)
11909 {
11910 if (health > 0)
11911 item.SetHealth("", "", health);
11912
11913 if (item.CanHaveTemperature())
11914 {
11916 if (item.CanFreeze())
11917 item.SetFrozen(false);
11918 }
11919
11920 if (item.HasEnergyManager())
11921 {
11922 if (quantity >= 0)
11923 {
11924 item.GetCompEM().SetEnergy0To1(quantity);
11925 }
11926 else
11927 {
11929 }
11930 }
11931 else if (item.IsMagazine())
11932 {
11933 Magazine mag = Magazine.Cast(item);
11934 if (quantity >= 0)
11935 {
11936 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11937 }
11938 else
11939 {
11941 }
11942
11943 }
11944 else
11945 {
11946 if (quantity >= 0)
11947 {
11948 item.SetQuantityNormalized(quantity, false);
11949 }
11950 else
11951 {
11953 }
11954
11955 }
11956 }
11957}
11958
11959#ifdef DEVELOPER
11961#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.