7097{
7099 {
7100 return true;
7101 }
7102};
7103
7105{
7106
7107};
7108
7109
7110
7112{
7116
7118
7121
7122
7123
7124
7125
7134
7140
7145
7150
7171 protected bool m_IsResultOfSplit
7172
7174
7179
7180
7181
7183
7187
7188
7189
7191
7194
7195
7196
7202
7203
7211
7214
7215
7217
7218
7220
7221
7226
7227
7232
7234
7235
7237
7238
7240 {
7245
7246 if (!
g_Game.IsDedicatedServer())
7247 {
7249 {
7251
7253 {
7255 }
7256 }
7257
7260 }
7261
7262 m_OldLocation = null;
7263
7265 {
7267 }
7268
7269 if (ConfigIsExisting("headSelectionsToHide"))
7270 {
7273 }
7274
7276 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7277 {
7279 }
7280
7282
7283 m_IsResultOfSplit = false;
7284
7286 }
7287
7289 {
7290 super.InitItemVariables();
7291
7297 m_Count = ConfigGetInt(
"count");
7298
7301
7306
7309
7314
7326
7330
7331
7334 if (ConfigIsExisting("canBeSplit"))
7335 {
7338 }
7339
7341 if (ConfigIsExisting("itemBehaviour"))
7343
7344
7347 RegisterNetSyncVariableInt("m_VarLiquidType");
7348 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7349
7350 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7351 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7352 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7353
7354 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7355 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7356 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7357 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7358
7359 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7360 RegisterNetSyncVariableBool("m_IsTakeable");
7361 RegisterNetSyncVariableBool("m_IsHologram");
7362
7365 {
7368 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7369 }
7370
7372
7374 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7376
7378 }
7379
7381 {
7383 }
7384
7386 {
7389 {
7394 }
7395 }
7396
7397 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7398 {
7400 {
7403 }
7404
7406 }
7407
7409 {
7415 }
7416
7418
7420 {
7422
7423 if (!action)
7424 {
7425 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7426 return;
7427 }
7428
7430 if (!ai)
7431 {
7433 return;
7434 }
7435
7437 if (!action_array)
7438 {
7439 action_array = new array<ActionBase_Basic>;
7441 }
7442 if (LogManager.IsActionLogEnable())
7443 {
7444 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7445 }
7446
7447 if (action_array.Find(action) != -1)
7448 {
7449 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7450 }
7451 else
7452 {
7453 action_array.Insert(action);
7454 }
7455 }
7456
7458 {
7459 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7460 ActionBase action = player.GetActionManager().GetAction(actionName);
7463
7464 if (action_array)
7465 {
7466 action_array.RemoveItem(action);
7467 }
7468 }
7469
7470
7471
7473 {
7474 ActionOverrideData overrideData = new ActionOverrideData();
7478
7480 if (!actionMap)
7481 {
7484 }
7485
7486 actionMap.Insert(this.
Type(), overrideData);
7487
7488 }
7489
7491
7493
7494
7496 {
7499
7502
7503 string config_to_search = "CfgVehicles";
7504 string muzzle_owner_config;
7505
7507 {
7508 if (IsInherited(Weapon))
7509 config_to_search = "CfgWeapons";
7510
7511 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7512
7513 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7514
7515 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7516
7517 if (config_OnFire_subclass_count > 0)
7518 {
7519 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7520
7521 for (int i = 0; i < config_OnFire_subclass_count; i++)
7522 {
7523 string particle_class = "";
7524 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7525 string config_OnFire_entry = config_OnFire_class + particle_class;
7526 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7527 WPOF_array.Insert(WPOF);
7528 }
7529
7530
7532 }
7533 }
7534
7536 {
7537 config_to_search = "CfgWeapons";
7538 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7539
7540 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7541
7542 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7543
7544 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7545 {
7546 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7547
7548 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7549 {
7550 string particle_class2 = "";
7551 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7552 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7553 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7554 WPOBE_array.Insert(WPOBE);
7555 }
7556
7557
7559 }
7560 }
7561 }
7562
7563
7565 {
7568
7570 {
7571 string config_to_search = "CfgVehicles";
7572
7573 if (IsInherited(Weapon))
7574 config_to_search = "CfgWeapons";
7575
7576 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7577 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7578
7579 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7580 {
7581
7583
7585 {
7587 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7589 return;
7590 }
7591
7594
7595
7596
7597 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7598 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7599
7600 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7601 {
7602 string particle_class = "";
7603 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7604 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7605 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7606
7607 if (entry_type == CT_CLASS)
7608 {
7609 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7610 WPOOH_array.Insert(WPOF);
7611 }
7612 }
7613
7614
7616 }
7617 }
7618 }
7619
7621 {
7623 }
7624
7626 {
7628 {
7630
7633
7636
7637 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7638 }
7639 }
7640
7642 {
7644 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7645
7647 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7648
7650 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7651
7653 {
7655 }
7656 }
7657
7659 {
7661 }
7662
7664 {
7667 else
7669
7671 {
7674 }
7675 else
7676 {
7679
7682 }
7683
7685 }
7686
7688 {
7690 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7691 }
7692
7694 {
7696 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7698 }
7699
7701 {
7703 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7704 }
7705
7707 {
7710
7711 OverheatingParticle OP = new OverheatingParticle();
7716
7718 }
7719
7721 {
7724
7725 return -1;
7726 }
7727
7729 {
7731 {
7734
7735 for (int i = count; i > 0; --i)
7736 {
7737 int id = i - 1;
7740
7743
7744 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7745 {
7746 if (p)
7747 {
7750 }
7751 }
7752 }
7753 }
7754 }
7755
7757 {
7759 {
7761 {
7762 int id = i - 1;
7764
7765 if (OP)
7766 {
7768
7769 if (p)
7770 {
7772 }
7773
7774 delete OP;
7775 }
7776 }
7777
7780 }
7781 }
7782
7785 {
7786 return 0.0;
7787 }
7788
7789
7791 {
7792 return 250;
7793 }
7794
7796 {
7797 return 0;
7798 }
7799
7802 {
7804 return true;
7805
7806 return false;
7807 }
7808
7811 {
7814
7816 {
7818 }
7819 else
7820 {
7821
7823 }
7824
7826 }
7827
7834 {
7835 return -1;
7836 }
7837
7838
7839
7840
7842 {
7844 {
7845 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7846 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7847
7848 if (r_index >= 0)
7849 {
7850 InventoryLocation r_il = new InventoryLocation;
7851 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7852
7853 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7856 {
7857 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7858 }
7860 {
7861 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7862 }
7863
7864 }
7865
7866 player.GetHumanInventory().ClearUserReservedLocation(this);
7867 }
7868
7871 }
7872
7873
7874
7875
7877 {
7878 return ItemBase.m_DebugActionsMask;
7879 }
7880
7882 {
7883 return ItemBase.m_DebugActionsMask & mask;
7884 }
7885
7887 {
7888 ItemBase.m_DebugActionsMask = mask;
7889 }
7890
7892 {
7893 ItemBase.m_DebugActionsMask |= mask;
7894 }
7895
7897 {
7898 ItemBase.m_DebugActionsMask &= ~mask;
7899 }
7900
7902 {
7904 {
7906 }
7907 else
7908 {
7910 }
7911 }
7912
7913
7915 {
7916 if (GetEconomyProfile())
7917 {
7918 float q_max = GetEconomyProfile().GetQuantityMax();
7919 if (q_max > 0)
7920 {
7921 float q_min = GetEconomyProfile().GetQuantityMin();
7922 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7923
7925 {
7926 ComponentEnergyManager comp = GetCompEM();
7928 {
7930 }
7931 }
7933 {
7935
7936 }
7937
7938 }
7939 }
7940 }
7941
7944 {
7945 EntityAI parent = GetHierarchyParent();
7946
7947 if (parent)
7948 {
7949 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7950 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7951 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7952 }
7953 }
7954
7957 {
7958 EntityAI parent = GetHierarchyParent();
7959
7960 if (parent)
7961 {
7962 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7963 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7964 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7965 }
7966 }
7967
7969 {
7970
7971
7972
7973
7975
7977 {
7978 if (ScriptInputUserData.CanStoreInputUserData())
7979 {
7980 ScriptInputUserData ctx = new ScriptInputUserData;
7986 ctx.
Write(use_stack_max);
7989
7991 {
7992 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7993 }
7994 }
7995 }
7996 else if (!
g_Game.IsMultiplayer())
7997 {
7999 }
8000 }
8001
8003 {
8005 }
8006
8008 {
8010 }
8011
8013 {
8015 }
8016
8018 {
8019
8020 return false;
8021 }
8022
8024 {
8025 return false;
8026 }
8027
8031 {
8032 return false;
8033 }
8034
8036 {
8037 return "";
8038 }
8039
8041
8043 {
8044 return false;
8045 }
8046
8048 {
8049 return true;
8050 }
8051
8052
8053
8055 {
8056 return true;
8057 }
8058
8060 {
8061 return true;
8062 }
8063
8065 {
8066 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8068 }
8069
8071 {
8073 }
8074
8076 {
8078 if (!is_being_placed)
8080 SetSynchDirty();
8081 }
8082
8083
8085
8087 {
8089 }
8090
8092 {
8094 }
8095
8097 {
8098 return 1;
8099 }
8100
8102 {
8103 return false;
8104 }
8105
8107 {
8109 SetSynchDirty();
8110 }
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8147 {
8148 super.OnMovedInsideCargo(container);
8149
8150 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8151 }
8152
8153 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8154 {
8155 super.EEItemLocationChanged(oldLoc, newLoc);
8156
8157 PlayerBase newPlayer = null;
8158 PlayerBase oldPlayer = null;
8159
8160 if (newLoc.GetParent())
8161 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8162
8163 if (oldLoc.GetParent())
8164 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8165
8167 {
8168 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8169
8170 if (rIndex >= 0)
8171 {
8172 InventoryLocation rIl = new InventoryLocation;
8173 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8174
8175 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8178 {
8179 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8180 }
8182 {
8184 }
8185
8186 }
8187 }
8188
8190 {
8191 if (newPlayer)
8192 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8193
8194 if (newPlayer == oldPlayer)
8195 {
8196 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8197 {
8199 {
8200 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8201 {
8202 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8203 }
8204 }
8205 else
8206 {
8207 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8208 }
8209 }
8210
8211 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8212 {
8213 int type = oldLoc.GetType();
8215 {
8216 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8217 }
8219 {
8220 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8221 }
8222 }
8223 if (!m_OldLocation)
8224 {
8225 m_OldLocation = new InventoryLocation;
8226 }
8227 m_OldLocation.Copy(oldLoc);
8228 }
8229 else
8230 {
8231 if (m_OldLocation)
8232 {
8233 m_OldLocation.Reset();
8234 }
8235 }
8236
8237 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8238 }
8239 else
8240 {
8241 if (newPlayer)
8242 {
8243 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8244 if (resIndex >= 0)
8245 {
8246 InventoryLocation il = new InventoryLocation;
8247 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8249 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8252 {
8253 il.
GetParent().GetOnReleaseLock().Invoke(it);
8254 }
8256 {
8258 }
8259
8260 }
8261 }
8263 {
8264
8266 }
8267
8268 if (m_OldLocation)
8269 {
8270 m_OldLocation.Reset();
8271 }
8272 }
8273
8275 {
8276 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8277 }
8278
8280 {
8281 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8282 }
8283 }
8284
8285 override void EOnContact(IEntity other, Contact extra)
8286 {
8288 {
8289 int liquidType = -1;
8291 if (impactSpeed > 0.0)
8292 {
8294 #ifndef SERVER
8296 #else
8298 SetSynchDirty();
8299 #endif
8301 }
8302 }
8303
8304 #ifdef SERVER
8305 if (GetCompEM() && GetCompEM().IsPlugged())
8306 {
8307 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8308 GetCompEM().UnplugThis();
8309 }
8310 #endif
8311 }
8312
8314
8316 {
8318 }
8319
8321 {
8322
8323 }
8324
8326 {
8327 super.OnItemLocationChanged(old_owner, new_owner);
8328
8329 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8330 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8331
8332 if (!relatedPlayer && playerNew)
8333 relatedPlayer = playerNew;
8334
8335 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8336 {
8338 if (actionMgr)
8339 {
8340 ActionBase currentAction = actionMgr.GetRunningAction();
8341 if (currentAction)
8343 }
8344 }
8345
8346 Man ownerPlayerOld = null;
8347 Man ownerPlayerNew = null;
8348
8349 if (old_owner)
8350 {
8351 if (old_owner.
IsMan())
8352 {
8353 ownerPlayerOld = Man.Cast(old_owner);
8354 }
8355 else
8356 {
8357 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8358 }
8359 }
8360 else
8361 {
8363 {
8365
8366 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8367 {
8368 GetCompEM().UnplugThis();
8369 }
8370 }
8371 }
8372
8373 if (new_owner)
8374 {
8375 if (new_owner.
IsMan())
8376 {
8377 ownerPlayerNew = Man.Cast(new_owner);
8378 }
8379 else
8380 {
8381 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8382 }
8383 }
8384
8385 if (ownerPlayerOld != ownerPlayerNew)
8386 {
8387 if (ownerPlayerOld)
8388 {
8389 array<EntityAI> subItemsExit = new array<EntityAI>;
8391 for (int i = 0; i < subItemsExit.Count(); i++)
8392 {
8395 }
8396 }
8397
8398 if (ownerPlayerNew)
8399 {
8400 array<EntityAI> subItemsEnter = new array<EntityAI>;
8402 for (int j = 0; j < subItemsEnter.Count(); j++)
8403 {
8406 }
8407 }
8408 }
8409 else if (ownerPlayerNew != null)
8410 {
8411 PlayerBase nplayer;
8412 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8413 {
8414 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8416 for (int k = 0; k < subItemsUpdate.Count(); k++)
8417 {
8419 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8420 }
8421 }
8422 }
8423
8424 if (old_owner)
8425 old_owner.OnChildItemRemoved(this);
8426 if (new_owner)
8427 new_owner.OnChildItemReceived(this);
8428 }
8429
8430
8432 {
8433 super.EEDelete(parent);
8434 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8435 if (player)
8436 {
8438
8439 if (player.IsAlive())
8440 {
8441 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8442 if (r_index >= 0)
8443 {
8444 InventoryLocation r_il = new InventoryLocation;
8445 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8446
8447 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8450 {
8451 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8452 }
8454 {
8455 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8456 }
8457
8458 }
8459
8460 player.RemoveQuickBarEntityShortcut(this);
8461 }
8462 }
8463 }
8464
8466 {
8467 super.EEKilled(killer);
8468
8471 {
8472 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8473 {
8474 if (IsMagazine())
8475 {
8476 if (Magazine.Cast(this).GetAmmoCount() > 0)
8477 {
8479 }
8480 }
8481 else
8482 {
8484 }
8485 }
8486 }
8487 }
8488
8490 {
8491 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8492
8493 super.OnWasAttached(parent, slot_id);
8494
8497
8500 }
8501
8503 {
8504 super.OnWasDetached(parent, slot_id);
8505
8508
8511 }
8512
8514 {
8515 int idx;
8518
8519 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8520 if (inventory_slots.Count() < 1)
8521 {
8522 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8523 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8524 }
8525 else
8526 {
8527 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8528 }
8529
8530 idx = inventory_slots.Find(slot);
8531 if (idx < 0)
8532 return "";
8533
8534 return attach_types.Get(idx);
8535 }
8536
8538 {
8539 int idx = -1;
8540 string slot;
8541
8544
8545 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8546 if (inventory_slots.Count() < 1)
8547 {
8548 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8549 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8550 }
8551 else
8552 {
8553 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8554 if (detach_types.Count() < 1)
8555 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8556 }
8557
8558 for (int i = 0; i < inventory_slots.Count(); i++)
8559 {
8560 slot = inventory_slots.Get(i);
8561 }
8562
8563 if (slot != "")
8564 {
8565 if (detach_types.Count() == 1)
8566 idx = 0;
8567 else
8568 idx = inventory_slots.Find(slot);
8569 }
8570 if (idx < 0)
8571 return "";
8572
8573 return detach_types.Get(idx);
8574 }
8575
8577 {
8578
8580
8581
8582 float min_time = 1;
8583 float max_time = 3;
8584 float delay = Math.RandomFloat(min_time, max_time);
8585
8586 explode_timer.Run(delay, this, "DoAmmoExplosion");
8587 }
8588
8590 {
8591 Magazine magazine = Magazine.Cast(this);
8592 int pop_sounds_count = 6;
8593 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8594
8595
8596 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8597 string sound_name = pop_sounds[ sound_idx ];
8598 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8599
8600
8601 magazine.ServerAddAmmoCount(-1);
8602
8603
8604 float min_temp_to_explode = 100;
8605
8606 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8607 {
8609 }
8610 }
8611
8612
8613 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8614 {
8615 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8616
8617 const int CHANCE_DAMAGE_CARGO = 4;
8618 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8619 const int CHANCE_DAMAGE_NOTHING = 2;
8620
8622 {
8623 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8624 int chances;
8625 int rnd;
8626
8627 if (GetInventory().GetCargo())
8628 {
8629 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8630 rnd = Math.RandomInt(0,chances);
8631
8632 if (rnd < CHANCE_DAMAGE_CARGO)
8633 {
8635 }
8636 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8637 {
8639 }
8640 }
8641 else
8642 {
8643 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8644 rnd = Math.RandomInt(0,chances);
8645
8646 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8647 {
8649 }
8650 }
8651 }
8652 }
8653
8655 {
8656 CargoBase cargo = GetInventory().GetCargo();
8657 if (cargo)
8658 {
8660 if (item_count > 0)
8661 {
8662 int random_pick = Math.RandomInt(0, item_count);
8664 if (!item.IsExplosive())
8665 {
8666 item.AddHealth("","",damage);
8667 return true;
8668 }
8669 }
8670 }
8671 return false;
8672 }
8673
8675 {
8676 GameInventory inventory = GetInventory();
8678 if (attachment_count > 0)
8679 {
8680 int random_pick = Math.RandomInt(0, attachment_count);
8682 if (!attachment.IsExplosive())
8683 {
8684 attachment.AddHealth("","",damage);
8685 return true;
8686 }
8687 }
8688 return false;
8689 }
8690
8692 {
8694 }
8695
8697 {
8699 return GetInventory().CanRemoveEntity();
8700
8701 return false;
8702 }
8703
8705 {
8706
8708 return false;
8709
8710
8712 return false;
8713
8714
8715
8717 if (delta == 0)
8718 return false;
8719
8720
8721 return true;
8722 }
8723
8725 {
8727 {
8728 if (ScriptInputUserData.CanStoreInputUserData())
8729 {
8730 ScriptInputUserData ctx = new ScriptInputUserData;
8735 ctx.
Write(destination_entity);
8739 }
8740 }
8741 else if (!
g_Game.IsMultiplayer())
8742 {
8744 }
8745 }
8746
8748 {
8749 float split_quantity_new;
8753 InventoryLocation loc = new InventoryLocation;
8754
8755 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8756 {
8758 split_quantity_new = stack_max;
8759 else
8761
8763 {
8764 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8765 if (new_item)
8766 {
8767 new_item.SetResultOfSplit(true);
8768 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8770 new_item.
SetQuantity(split_quantity_new,
false,
true);
8771 }
8772 }
8773 }
8774 else if (destination_entity && slot_id == -1)
8775 {
8776 if (quantity > stack_max)
8777 split_quantity_new = stack_max;
8778 else
8779 split_quantity_new = quantity;
8780
8782 {
8783 GameInventory destinationInventory = destination_entity.GetInventory();
8785 {
8788 }
8789
8790 if (new_item)
8791 {
8792 new_item.SetResultOfSplit(true);
8793 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8795 new_item.
SetQuantity(split_quantity_new,
false,
true);
8796 }
8797 }
8798 }
8799 else
8800 {
8801 if (stack_max != 0)
8802 {
8804 {
8806 }
8807
8808 if (split_quantity_new == 0)
8809 {
8810 if (!
g_Game.IsMultiplayer())
8811 player.PhysicalPredictiveDropItem(this);
8812 else
8813 player.ServerDropEntity(this);
8814 return;
8815 }
8816
8818 {
8820
8821 if (new_item)
8822 {
8823 new_item.SetResultOfSplit(true);
8824 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8827 new_item.PlaceOnSurface();
8828 }
8829 }
8830 }
8831 }
8832 }
8833
8835 {
8836 float split_quantity_new;
8840 InventoryLocation loc = new InventoryLocation;
8841
8842 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8843 {
8845 split_quantity_new = stack_max;
8846 else
8848
8850 {
8851 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8852 if (new_item)
8853 {
8854 new_item.SetResultOfSplit(true);
8855 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8857 new_item.
SetQuantity(split_quantity_new,
false,
true);
8858 }
8859 }
8860 }
8861 else if (destination_entity && slot_id == -1)
8862 {
8863 if (quantity > stack_max)
8864 split_quantity_new = stack_max;
8865 else
8866 split_quantity_new = quantity;
8867
8869 {
8870 GameInventory destinationInventory = destination_entity.GetInventory();
8872 {
8875 }
8876
8877 if (new_item)
8878 {
8879 new_item.SetResultOfSplit(true);
8880 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8882 new_item.
SetQuantity(split_quantity_new,
false,
true);
8883 }
8884 }
8885 }
8886 else
8887 {
8888 if (stack_max != 0)
8889 {
8891 {
8893 }
8894
8896 {
8898
8899 if (new_item)
8900 {
8901 new_item.SetResultOfSplit(true);
8902 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8905 new_item.PlaceOnSurface();
8906 }
8907 }
8908 }
8909 }
8910 }
8911
8913 {
8915 {
8916 if (ScriptInputUserData.CanStoreInputUserData())
8917 {
8918 ScriptInputUserData ctx = new ScriptInputUserData;
8923 dst.WriteToContext(ctx);
8925 }
8926 }
8927 else if (!
g_Game.IsMultiplayer())
8928 {
8930 }
8931 }
8932
8934 {
8936 {
8937 if (ScriptInputUserData.CanStoreInputUserData())
8938 {
8939 ScriptInputUserData ctx = new ScriptInputUserData;
8944 ctx.
Write(destination_entity);
8950 }
8951 }
8952 else if (!
g_Game.IsMultiplayer())
8953 {
8955 }
8956 }
8957
8959 {
8961 }
8962
8964 {
8966 float split_quantity_new;
8968 if (dst.IsValid())
8969 {
8970 int slot_id = dst.GetSlot();
8972
8973 if (quantity > stack_max)
8974 split_quantity_new = stack_max;
8975 else
8976 split_quantity_new = quantity;
8977
8979 {
8981
8982 if (new_item)
8983 {
8984 new_item.SetResultOfSplit(true);
8985 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8987 new_item.
SetQuantity(split_quantity_new,
false,
true);
8988 }
8989
8990 return new_item;
8991 }
8992 }
8993
8994 return null;
8995 }
8996
8998 {
9000 float split_quantity_new;
9002 if (destination_entity)
9003 {
9005 if (quantity > stackable)
9006 split_quantity_new = stackable;
9007 else
9008 split_quantity_new = quantity;
9009
9011 {
9012 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9013 if (new_item)
9014 {
9015 new_item.SetResultOfSplit(true);
9016 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9018 new_item.
SetQuantity(split_quantity_new,
false,
true);
9019 }
9020 }
9021 }
9022 }
9023
9025 {
9027 {
9028 if (ScriptInputUserData.CanStoreInputUserData())
9029 {
9030 ScriptInputUserData ctx = new ScriptInputUserData;
9035 ItemBase destination_entity =
this;
9036 ctx.
Write(destination_entity);
9040 }
9041 }
9042 else if (!
g_Game.IsMultiplayer())
9043 {
9045 }
9046 }
9047
9049 {
9051 float split_quantity_new;
9053 if (player)
9054 {
9056 if (quantity > stackable)
9057 split_quantity_new = stackable;
9058 else
9059 split_quantity_new = quantity;
9060
9062 {
9063 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9064 new_item =
ItemBase.Cast(in_hands);
9065 if (new_item)
9066 {
9067 new_item.SetResultOfSplit(true);
9068 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9070 new_item.SetQuantity(split_quantity_new, false, true);
9071 }
9072 }
9073 }
9074 }
9075
9077 {
9079 float split_quantity_new = Math.Floor(quantity * 0.5);
9080
9082 return;
9083
9085
9086 if (new_item)
9087 {
9088 if (new_item.GetQuantityMax() < split_quantity_new)
9089 {
9090 split_quantity_new = new_item.GetQuantityMax();
9091 }
9092
9093 new_item.SetResultOfSplit(true);
9094 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9095
9097 {
9100 }
9101 else
9102 {
9104 new_item.
SetQuantity(split_quantity_new,
false,
true);
9105 }
9106 }
9107 }
9108
9110 {
9112 float split_quantity_new = Math.Floor(quantity / 2);
9113
9115 return;
9116
9117 InventoryLocation invloc = new InventoryLocation;
9119
9121 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9122
9123 if (new_item)
9124 {
9125 if (new_item.GetQuantityMax() < split_quantity_new)
9126 {
9127 split_quantity_new = new_item.GetQuantityMax();
9128 }
9130 {
9133 }
9134 else if (split_quantity_new > 1)
9135 {
9137 new_item.
SetQuantity(split_quantity_new,
false,
true);
9138 }
9139 }
9140 }
9141
9144 {
9145 SetWeightDirty();
9147
9148 if (parent)
9149 parent.OnAttachmentQuantityChangedEx(this, delta);
9150
9152 {
9154 {
9156 }
9158 {
9159 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9161 }
9162 }
9163 }
9164
9167 {
9168
9169 }
9170
9173 {
9175 }
9176
9178 {
9179 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9180
9182 {
9183 if (newLevel == GameConstants.STATE_RUINED)
9184 {
9186 EntityAI parent = GetHierarchyParent();
9187 if (parent && parent.IsFireplace())
9188 {
9189 CargoBase cargo = GetInventory().GetCargo();
9190 if (cargo)
9191 {
9193 {
9195 }
9196 }
9197 }
9198 }
9199
9201 {
9202
9204 return;
9205 }
9206
9207 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9208 {
9210 }
9211 }
9212 }
9213
9214
9216 {
9217 super.OnRightClick();
9218
9220 {
9222 {
9223 if (ScriptInputUserData.CanStoreInputUserData())
9224 {
9225 EntityAI root = GetHierarchyRoot();
9226 Man playerOwner = GetHierarchyRootPlayer();
9227 InventoryLocation dst = new InventoryLocation;
9228
9229
9230 if (!playerOwner && root && root == this)
9231 {
9233 }
9234 else
9235 {
9236
9237 GetInventory().GetCurrentInventoryLocation(dst);
9239 {
9240 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9242 {
9244 }
9245 else
9246 {
9248
9249
9250 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9251 {
9253 }
9254 else
9255 {
9256 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9257 }
9258 }
9259 }
9260 }
9261
9262 ScriptInputUserData ctx = new ScriptInputUserData;
9270 }
9271 }
9272 else if (!
g_Game.IsMultiplayer())
9273 {
9275 }
9276 }
9277 }
9278
9280 {
9281 if (root)
9282 {
9283 vector m4[4];
9284 root.GetTransform(m4);
9285 dst.SetGround(this, m4);
9286 }
9287 else
9288 {
9289 GetInventory().GetCurrentInventoryLocation(dst);
9290 }
9291 }
9292
9293 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9294 {
9295
9296 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9297 return false;
9298
9299 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9300 return false;
9301
9302
9304 return false;
9305
9306
9307 Magazine mag = Magazine.Cast(this);
9308 if (mag)
9309 {
9310 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9311 return false;
9312
9313 if (stack_max_limit)
9314 {
9315 Magazine other_mag = Magazine.Cast(other_item);
9316 if (other_item)
9317 {
9318 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9319 return false;
9320 }
9321
9322 }
9323 }
9324 else
9325 {
9326
9328 return false;
9329
9331 return false;
9332 }
9333
9334 PlayerBase player = null;
9335 if (CastTo(player, GetHierarchyRootPlayer()))
9336 {
9337 if (player.GetInventory().HasAttachment(this))
9338 return false;
9339
9340 if (player.IsItemsToDelete())
9341 return false;
9342 }
9343
9344 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9345 return false;
9346
9347 int slotID;
9349 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9350 return false;
9351
9352 return true;
9353 }
9354
9356 {
9358 }
9359
9361 {
9362 return m_IsResultOfSplit;
9363 }
9364
9366 {
9367 m_IsResultOfSplit = value;
9368 }
9369
9371 {
9373 }
9374
9376 {
9377 float other_item_quantity = other_item.GetQuantity();
9378 float this_free_space;
9379
9381
9383
9384 if (other_item_quantity > this_free_space)
9385 {
9386 return this_free_space;
9387 }
9388 else
9389 {
9390 return other_item_quantity;
9391 }
9392 }
9393
9395 {
9397 }
9398
9400 {
9402 return;
9403
9404 if (!IsMagazine() && other_item)
9405 {
9407 if (quantity_used != 0)
9408 {
9409 float hp1 = GetHealth01("","");
9410 float hp2 = other_item.GetHealth01("","");
9411 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9412 hpResult = hpResult / (
GetQuantity() + quantity_used);
9413
9414 hpResult *= GetMaxHealth();
9415 Math.Round(hpResult);
9416 SetHealth("", "Health", hpResult);
9417
9419 other_item.AddQuantity(-quantity_used);
9420 }
9421 }
9423 }
9424
9426 {
9427 #ifdef SERVER
9428 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9429 GetHierarchyParent().IncreaseLifetimeUp();
9430 #endif
9431 };
9432
9434 {
9435 PlayerBase p = PlayerBase.Cast(player);
9436
9437 array<int> recipesIds = p.m_Recipes;
9438 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9439 if (moduleRecipesManager)
9440 {
9441 EntityAI itemInHands = player.GetEntityInHands();
9442 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9443 }
9444
9445 for (int i = 0;i < recipesIds.Count(); i++)
9446 {
9447 int key = recipesIds.Get(i);
9448 string recipeName = moduleRecipesManager.GetRecipeName(key);
9450 }
9451 }
9452
9453
9454 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9455 {
9456 super.GetDebugActions(outputList);
9457
9458
9464
9465
9470
9475
9476
9480
9481
9483 {
9487 }
9488
9491
9492
9496
9498
9499 InventoryLocation loc = new InventoryLocation();
9500 GetInventory().GetCurrentInventoryLocation(loc);
9502 {
9503 if (Gizmo_IsSupported())
9506 }
9507
9509 }
9510
9511
9512
9513
9515 {
9516 super.OnAction(action_id, player, ctx);
9517
9519 {
9520 switch (action_id)
9521 {
9525 return true;
9529 return true;
9530 }
9531 }
9532
9534 {
9535 switch (action_id)
9536 {
9538 Delete();
9539 return true;
9540 }
9541 }
9542
9543 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9544 {
9545 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9546 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9547 PlayerBase p = PlayerBase.Cast(player);
9548 if (
EActions.RECIPES_RANGE_START < 1000)
9549 {
9550 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9551 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9552 }
9553 }
9554 #ifndef SERVER
9555 else if (action_id ==
EActions.WATCH_PLAYER)
9556 {
9557 PluginDeveloper.SetDeveloperItemClientEx(player);
9558 }
9559 #endif
9561 {
9562 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9563 {
9564 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9565 OnDebugButtonPressServer(id + 1);
9566 }
9567
9568 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9569 {
9570 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9572 }
9573
9574 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9575 {
9576 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9578 }
9579
9580 else if (action_id ==
EActions.ADD_QUANTITY)
9581 {
9582 if (IsMagazine())
9583 {
9584 Magazine mag = Magazine.Cast(this);
9585 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9586 }
9587 else
9588 {
9590 }
9591
9592 if (m_EM)
9593 {
9594 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9595 }
9596
9597 }
9598
9599 else if (action_id ==
EActions.REMOVE_QUANTITY)
9600 {
9601 if (IsMagazine())
9602 {
9603 Magazine mag2 = Magazine.Cast(this);
9604 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9605 }
9606 else
9607 {
9609 }
9610 if (m_EM)
9611 {
9612 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9613 }
9614
9615 }
9616
9617 else if (action_id ==
EActions.SET_QUANTITY_0)
9618 {
9620
9621 if (m_EM)
9622 {
9623 m_EM.SetEnergy(0);
9624 }
9625 }
9626
9627 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9628 {
9630
9631 if (m_EM)
9632 {
9633 m_EM.SetEnergy(m_EM.GetEnergyMax());
9634 }
9635 }
9636
9637 else if (action_id ==
EActions.ADD_HEALTH)
9638 {
9639 AddHealth("","",GetMaxHealth("","Health")/5);
9640 }
9641 else if (action_id ==
EActions.REMOVE_HEALTH)
9642 {
9643 AddHealth("","",-GetMaxHealth("","Health")/5);
9644 }
9645 else if (action_id ==
EActions.DESTROY_HEALTH)
9646 {
9647 SetHealth01("","",0);
9648 }
9649 else if (action_id ==
EActions.WATCH_ITEM)
9650 {
9652 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9653 #ifdef DEVELOPER
9654 SetDebugDeveloper_item(this);
9655 #endif
9656 }
9657
9658 else if (action_id ==
EActions.ADD_TEMPERATURE)
9659 {
9660 AddTemperature(20);
9661
9662 }
9663
9664 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9665 {
9666 AddTemperature(-20);
9667
9668 }
9669
9670 else if (action_id ==
EActions.FLIP_FROZEN)
9671 {
9672 SetFrozen(!GetIsFrozen());
9673
9674 }
9675
9676 else if (action_id ==
EActions.ADD_WETNESS)
9677 {
9679
9680 }
9681
9682 else if (action_id ==
EActions.REMOVE_WETNESS)
9683 {
9685
9686 }
9687
9688 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9689 {
9692
9693
9694 }
9695
9696 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9697 {
9700 }
9701
9702 else if (action_id ==
EActions.MAKE_SPECIAL)
9703 {
9704 auto debugParams = DebugSpawnParams.WithPlayer(player);
9705 OnDebugSpawnEx(debugParams);
9706 }
9707
9708 }
9709
9710
9711 return false;
9712 }
9713
9714
9715
9716
9720
9723
9724
9725
9727 {
9728 return false;
9729 }
9730
9731
9733 {
9734 return true;
9735 }
9736
9737
9739 {
9740 return true;
9741 }
9742
9743
9744
9746 {
9747 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9748 return g_Game.ConfigIsExisting(config_path);
9749 }
9750
9753 {
9754 return null;
9755 }
9756
9758 {
9759 return false;
9760 }
9761
9763 {
9764 return false;
9765 }
9766
9770
9771
9773 {
9774 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9775 return module_repairing.CanRepair(this, item_repair_kit);
9776 }
9777
9778
9779 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9780 {
9781 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9782 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9783 }
9784
9785
9787 {
9788
9789
9790
9791
9792
9793
9794
9795
9796 return 1;
9797 }
9798
9799
9800
9802 {
9804 }
9805
9806
9807
9809 {
9811 }
9812
9813
9822 {
9823 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9824
9825 if (player)
9826 {
9827 player.MessageStatus(text);
9828 }
9829 }
9830
9831
9840 {
9841 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9842
9843 if (player)
9844 {
9845 player.MessageAction(text);
9846 }
9847 }
9848
9849
9858 {
9859 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9860
9861 if (player)
9862 {
9863 player.MessageFriendly(text);
9864 }
9865 }
9866
9867
9876 {
9877 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9878
9879 if (player)
9880 {
9881 player.MessageImportant(text);
9882 }
9883 }
9884
9886 {
9887 return true;
9888 }
9889
9890
9891 override bool KindOf(
string tag)
9892 {
9893 bool found = false;
9894 string item_name = this.
GetType();
9896 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9897
9898 int array_size = item_tag_array.Count();
9899 for (int i = 0; i < array_size; i++)
9900 {
9901 if (item_tag_array.Get(i) == tag)
9902 {
9903 found = true;
9904 break;
9905 }
9906 }
9907 return found;
9908 }
9909
9910
9912 {
9913
9914 super.OnRPC(sender, rpc_type,ctx);
9915
9916
9917 switch (rpc_type)
9918 {
9919 #ifndef SERVER
9920 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9921 Param2<bool, string> p = new Param2<bool, string>(false, "");
9922
9924 return;
9925
9926 bool play = p.param1;
9927 string soundSet = p.param2;
9928
9929 if (play)
9930 {
9932 {
9934 {
9936 }
9937 }
9938 else
9939 {
9941 }
9942 }
9943 else
9944 {
9946 }
9947
9948 break;
9949 #endif
9950
9951 }
9952
9954 {
9956 }
9957 }
9958
9959
9960
9961
9963 {
9964 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9965 return plugin.GetID(
name);
9966 }
9967
9969 {
9970 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9971 return plugin.GetName(id);
9972 }
9973
9976 {
9977
9978
9979 int varFlags;
9980 if (!ctx.
Read(varFlags))
9981 return;
9982
9983 if (varFlags & ItemVariableFlags.FLOAT)
9984 {
9986 }
9987 }
9988
9990 {
9991
9992 super.SerializeNumericalVars(floats_out);
9993
9994
9995
9997 {
9999 }
10000
10002 {
10004 }
10005
10007 {
10009 }
10010
10012 {
10017 }
10018
10020 {
10022 }
10023 }
10024
10026 {
10027
10028 super.DeSerializeNumericalVars(floats);
10029
10030
10031 int index = 0;
10032 int mask = Math.Round(floats.Get(index));
10033
10034 index++;
10035
10037 {
10039 {
10041 }
10042 else
10043 {
10044 float quantity = floats.Get(index);
10045 SetQuantity(quantity,
true,
false,
false,
false);
10046 }
10047 index++;
10048 }
10049
10051 {
10052 float wet = floats.Get(index);
10054 index++;
10055 }
10056
10058 {
10059 int liquidtype = Math.Round(floats.Get(index));
10061 index++;
10062 }
10063
10065 {
10067 index++;
10069 index++;
10071 index++;
10073 index++;
10074 }
10075
10077 {
10078 int cleanness = Math.Round(floats.Get(index));
10080 index++;
10081 }
10082 }
10083
10085 {
10086 super.WriteVarsToCTX(ctx);
10087
10088
10090 {
10092 }
10093
10095 {
10097 }
10098
10100 {
10102 }
10103
10105 {
10106 int r,g,b,a;
10112 }
10113
10115 {
10117 }
10118 }
10119
10121 {
10122 if (!super.ReadVarsFromCTX(ctx,version))
10123 return false;
10124
10125 int intValue;
10126 float value;
10127
10128 if (version < 140)
10129 {
10130 if (!ctx.
Read(intValue))
10131 return false;
10132
10133 m_VariablesMask = intValue;
10134 }
10135
10137 {
10138 if (!ctx.
Read(value))
10139 return false;
10140
10142 {
10144 }
10145 else
10146 {
10148 }
10149 }
10150
10151 if (version < 140)
10152 {
10154 {
10155 if (!ctx.
Read(value))
10156 return false;
10157 SetTemperatureDirect(value);
10158 }
10159 }
10160
10162 {
10163 if (!ctx.
Read(value))
10164 return false;
10166 }
10167
10169 {
10170 if (!ctx.
Read(intValue))
10171 return false;
10173 }
10174
10176 {
10177 int r,g,b,a;
10179 return false;
10181 return false;
10183 return false;
10185 return false;
10186
10188 }
10189
10191 {
10192 if (!ctx.
Read(intValue))
10193 return false;
10195 }
10196
10197 if (version >= 138 && version < 140)
10198 {
10200 {
10201 if (!ctx.
Read(intValue))
10202 return false;
10203 SetFrozen(intValue);
10204 }
10205 }
10206
10207 return true;
10208 }
10209
10210
10212 {
10215 {
10217 }
10218
10219 if (!super.OnStoreLoad(ctx, version))
10220 {
10222 return false;
10223 }
10224
10225 if (version >= 114)
10226 {
10227 bool hasQuickBarIndexSaved;
10228
10229 if (!ctx.
Read(hasQuickBarIndexSaved))
10230 {
10232 return false;
10233 }
10234
10235 if (hasQuickBarIndexSaved)
10236 {
10237 int itmQBIndex;
10238
10239
10240 if (!ctx.
Read(itmQBIndex))
10241 {
10243 return false;
10244 }
10245
10246 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10247 if (itmQBIndex != -1 && parentPlayer)
10248 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10249 }
10250 }
10251 else
10252 {
10253
10254 PlayerBase player;
10255 int itemQBIndex;
10256 if (version ==
int.
MAX)
10257 {
10258 if (!ctx.
Read(itemQBIndex))
10259 {
10261 return false;
10262 }
10263 }
10264 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10265 {
10266
10267 if (!ctx.
Read(itemQBIndex))
10268 {
10270 return false;
10271 }
10272 if (itemQBIndex != -1 && player)
10273 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10274 }
10275 }
10276
10277 if (version < 140)
10278 {
10279
10280 if (!LoadVariables(ctx, version))
10281 {
10283 return false;
10284 }
10285 }
10286
10287
10289 {
10291 return false;
10292 }
10293 if (version >= 132)
10294 {
10296 if (raib)
10297 {
10299 {
10301 return false;
10302 }
10303 }
10304 }
10305
10307 return true;
10308 }
10309
10310
10311
10313 {
10314 super.OnStoreSave(ctx);
10315
10316 PlayerBase player;
10317 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10318 {
10320
10321 int itemQBIndex = -1;
10322 itemQBIndex = player.FindQuickBarEntityIndex(this);
10323 ctx.
Write(itemQBIndex);
10324 }
10325 else
10326 {
10328 }
10329
10331
10333 if (raib)
10334 {
10336 }
10337 }
10338
10339
10341 {
10342 super.AfterStoreLoad();
10343
10345 {
10347 }
10348
10350 {
10353 }
10354 }
10355
10357 {
10358 super.EEOnAfterLoad();
10359
10361 {
10363 }
10364
10367 }
10368
10370 {
10371 return false;
10372 }
10373
10374
10375
10377 {
10379 {
10380 #ifdef PLATFORM_CONSOLE
10381
10383 {
10385 if (menu)
10386 {
10388 }
10389 }
10390 #endif
10391 }
10392
10394 {
10397 }
10398
10400 {
10401 SetWeightDirty();
10403 }
10405 {
10408 }
10409
10411 {
10414
10417 }
10419 {
10423 }
10424
10425 super.OnVariablesSynchronized();
10426 }
10427
10428
10429
10431 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10432 {
10433 if (!IsServerCheck(allow_client))
10434 return false;
10435
10437 return false;
10438
10441
10442 if (value <= (min + 0.001))
10443 value = min;
10444
10445 if (value == min)
10446 {
10447 if (destroy_config)
10448 {
10449 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10450 if (dstr)
10451 {
10453 this.Delete();
10454 return true;
10455 }
10456 }
10457 else if (destroy_forced)
10458 {
10460 this.Delete();
10461 return true;
10462 }
10463
10465 }
10466
10469
10471 {
10472 EntityAI parent = GetHierarchyRoot();
10473 InventoryLocation iLoc = new InventoryLocation();
10474 GetInventory().GetCurrentInventoryLocation(iLoc);
10476 {
10477 int iLocSlot = iLoc.
GetSlot();
10479 {
10481 }
10483 {
10485 }
10486 }
10487 }
10488
10490 {
10492
10493 if (delta)
10495 }
10496
10498
10499 return false;
10500 }
10501
10502
10504 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10505 {
10507 }
10508
10510 {
10513 }
10514
10516 {
10519 }
10520
10522 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10523 {
10524 float value_clamped = Math.Clamp(value, 0, 1);
10526 SetQuantity(result, destroy_config, destroy_forced);
10527 }
10528
10529
10532 {
10534 }
10535
10537 {
10539 }
10540
10541
10542
10543
10544
10545
10546
10547
10548
10549
10551 {
10552 int slot = -1;
10553 GameInventory inventory = GetInventory();
10554 if (inventory)
10555 {
10556 InventoryLocation il = new InventoryLocation;
10559 }
10560
10562 }
10563
10565 {
10566 float quantity_max = 0;
10567
10569 {
10570 if (attSlotID != -1)
10571 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10572
10573 if (quantity_max <= 0)
10575 }
10576
10577 if (quantity_max <= 0)
10579
10580 return quantity_max;
10581 }
10582
10584 {
10586 }
10587
10589 {
10591 }
10592
10593
10595 {
10597 }
10598
10600 {
10602 }
10603
10605 {
10607 }
10608
10609
10611 {
10612
10613 float weightEx = GetWeightEx();
10614 float special = GetInventoryAndCargoWeight();
10615 return weightEx - special;
10616 }
10617
10618
10620 {
10622 }
10623
10625 {
10627 {
10628 #ifdef DEVELOPER
10629 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10630 {
10631 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10633 }
10634 #endif
10635
10636 return GetQuantity() * GetConfigWeightModified();
10637 }
10638 else if (HasEnergyManager())
10639 {
10640 #ifdef DEVELOPER
10641 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10642 {
10643 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10644 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10645 }
10646 #endif
10647 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10648 }
10649 else
10650 {
10651 #ifdef DEVELOPER
10652 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10653 {
10654 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10655 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10656 }
10657 #endif
10658 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10659 }
10660 }
10661
10664 {
10665 int item_count = 0;
10667
10668 GameInventory inventory = GetInventory();
10669 CargoBase cargo = inventory.
GetCargo();
10670 if (cargo != NULL)
10671 {
10673 }
10674
10676 for (int i = 0; i < nAttachments; ++i)
10677 {
10679 if (item)
10680 item_count += item.GetNumberOfItems();
10681 }
10682 return item_count;
10683 }
10684
10687 {
10688 float weight = 0;
10689 float wetness = 1;
10690 if (include_wetness)
10693 {
10694 weight = wetness * m_ConfigWeight;
10695 }
10697 {
10698 weight = 1;
10699 }
10700 return weight;
10701 }
10702
10703
10704
10706 {
10707 GameInventory inventory = GetInventory();
10708 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10709 {
10710 array<EntityAI> items = new array<EntityAI>;
10712 for (int i = 0; i < items.Count(); ++i)
10713 {
10715 if (item)
10716 {
10717 g_Game.ObjectDelete(item);
10718 }
10719 }
10720 }
10721 }
10722
10723
10724
10725
10727 {
10728 float energy = 0;
10729 if (HasEnergyManager())
10730 {
10731 energy = GetCompEM().GetEnergy();
10732 }
10733 return energy;
10734 }
10735
10736
10738 {
10739 super.OnEnergyConsumed();
10740
10742 }
10743
10745 {
10746 super.OnEnergyAdded();
10747
10749 }
10750
10751
10753 {
10754 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10755 {
10757 {
10758 float energy_0to1 = GetCompEM().GetEnergy0To1();
10760 }
10761 }
10762 }
10763
10764
10766 {
10767 return ConfigGetFloat("heatIsolation");
10768 }
10769
10771 {
10773 }
10774
10776 {
10777 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10778 if (
g_Game.ConfigIsExisting(paramPath))
10779 return g_Game.ConfigGetFloat(paramPath);
10780
10781 return 0.0;
10782 }
10783
10785 {
10786 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10787 if (
g_Game.ConfigIsExisting(paramPath))
10788 return g_Game.ConfigGetFloat(paramPath);
10789
10790 return 0.0;
10791 }
10792
10793 override void SetWet(
float value,
bool allow_client =
false)
10794 {
10795 if (!IsServerCheck(allow_client))
10796 return;
10797
10800
10802
10803 m_VarWet = Math.Clamp(value, min, max);
10804
10806 {
10809 }
10810 }
10811
10812 override void AddWet(
float value)
10813 {
10815 }
10816
10818 {
10820 }
10821
10823 {
10825 }
10826
10828 {
10830 }
10831
10833 {
10835 }
10836
10838 {
10840 }
10841
10842 override void OnWetChanged(
float newVal,
float oldVal)
10843 {
10846 if (newLevel != oldLevel)
10847 {
10849 }
10850 }
10851
10853 {
10854 SetWeightDirty();
10855 }
10856
10858 {
10859 return GetWetLevelInternal(
m_VarWet);
10860 }
10861
10862
10863
10865 {
10867 }
10868
10870 {
10872 }
10873
10875 {
10877 }
10878
10880 {
10882 }
10883
10884
10885
10887 {
10888 if (ConfigIsExisting("itemModelLength"))
10889 {
10890 return ConfigGetFloat("itemModelLength");
10891 }
10892 return 0;
10893 }
10894
10896 {
10897 if (ConfigIsExisting("itemAttachOffset"))
10898 {
10899 return ConfigGetFloat("itemAttachOffset");
10900 }
10901 return 0;
10902 }
10903
10904 override void SetCleanness(
int value,
bool allow_client =
false)
10905 {
10906 if (!IsServerCheck(allow_client))
10907 return;
10908
10910
10912
10915 }
10916
10918 {
10920 }
10921
10923 {
10924 return true;
10925 }
10926
10927
10928
10929
10931 {
10933 }
10934
10936 {
10938 }
10939
10940
10941
10942
10943 override void SetColor(
int r,
int g,
int b,
int a)
10944 {
10950 }
10952 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10953 {
10958 }
10959
10961 {
10963 }
10964
10967 {
10968 int r,g,b,a;
10970 r = r/255;
10971 g = g/255;
10972 b = b/255;
10973 a = a/255;
10974 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10975 }
10976
10977
10978
10979 override void SetLiquidType(
int value,
bool allow_client =
false)
10980 {
10981 if (!IsServerCheck(allow_client))
10982 return;
10983
10988 }
10989
10991 {
10992 return ConfigGetInt("varLiquidTypeInit");
10993 }
10994
10996 {
10998 }
10999
11001 {
11003 SetFrozen(false);
11004 }
11005
11008 {
11009 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11010 }
11011
11012
11015 {
11016 PlayerBase nplayer;
11017 if (PlayerBase.CastTo(nplayer, player))
11018 {
11020 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11021 }
11022 }
11023
11024
11027 {
11028 PlayerBase nplayer;
11029 if (PlayerBase.CastTo(nplayer,player))
11030 {
11031 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11032 }
11033
11034 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11035
11036 if (HasEnergyManager())
11037 {
11038 GetCompEM().UpdatePlugState();
11039 }
11040 }
11041
11042
11044 {
11045 super.OnPlacementStarted(player);
11046
11048 }
11049
11050 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11051 {
11053 {
11054 m_AdminLog.OnPlacementComplete(player,
this);
11055 }
11056
11057 super.OnPlacementComplete(player, position, orientation);
11058 }
11059
11060
11061
11062
11063
11065 {
11067 {
11068 return true;
11069 }
11070 else
11071 {
11072 return false;
11073 }
11074 }
11075
11076
11078 {
11080 {
11082 }
11083 }
11084
11085
11087 {
11089 }
11090
11092 {
11094 }
11095
11096 override void InsertAgent(
int agent,
float count = 1)
11097 {
11098 if (count < 1)
11099 return;
11100
11102 }
11103
11106 {
11108 }
11109
11110
11112 {
11114 }
11115
11116
11117
11118
11119
11120
11121
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
11150
11151
11152
11153
11154
11155
11156
11158 {
11160 return false;
11161 return true;
11162 }
11163
11165 {
11166
11168 }
11169
11170
11173 {
11174 super.CheckForRoofLimited(timeTresholdMS);
11175
11176 float time =
g_Game.GetTime();
11177 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11178 {
11179 m_PreviousRoofTestTime = time;
11180 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11181 }
11182 }
11183
11184
11186 {
11188 {
11189 return 0;
11190 }
11191
11192 if (GetInventory().GetAttachmentSlotsCount() != 0)
11193 {
11194 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11195 if (filter)
11196 return filter.GetProtectionLevel(type, false, system);
11197 else
11198 return 0;
11199 }
11200
11201 string subclassPath, entryName;
11202
11203 switch (type)
11204 {
11206 entryName = "biological";
11207 break;
11209 entryName = "chemical";
11210 break;
11211 default:
11212 entryName = "biological";
11213 break;
11214 }
11215
11216 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11217
11218 return g_Game.ConfigGetFloat(subclassPath + entryName);
11219 }
11220
11221
11222
11225 {
11226 if (!IsMagazine())
11228
11230 }
11231
11232
11233
11234
11235
11240 {
11241 return true;
11242 }
11243
11245 {
11247 }
11248
11249
11250
11251
11252
11254 {
11255 if (parent)
11256 {
11257 if (parent.IsInherited(DayZInfected))
11258 return true;
11259
11260 if (!parent.IsRuined())
11261 return true;
11262 }
11263
11264 return true;
11265 }
11266
11268 {
11269 if (!super.CanPutAsAttachment(parent))
11270 {
11271 return false;
11272 }
11273
11274 if (!IsRuined() && !parent.IsRuined())
11275 {
11276 return true;
11277 }
11278
11279 return false;
11280 }
11281
11283 {
11284
11285
11286
11287
11288 return super.CanReceiveItemIntoCargo(item);
11289 }
11290
11292 {
11293
11294
11295
11296
11297 GameInventory attachmentInv = attachment.GetInventory();
11299 {
11300 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11301 return false;
11302 }
11303
11304 InventoryLocation loc = new InventoryLocation();
11305 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11306 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11307 return false;
11308
11309 return super.CanReceiveAttachment(attachment, slotId);
11310 }
11311
11313 {
11314 if (!super.CanReleaseAttachment(attachment))
11315 return false;
11316
11317 return GetInventory().AreChildrenAccessible();
11318 }
11319
11320
11321
11322
11323
11324
11325
11326
11327
11328
11329
11330
11331
11332
11333
11334
11335
11336
11337
11338
11339
11341 {
11342 int id = muzzle_owner.GetMuzzleID();
11343 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11344
11345 if (WPOF_array)
11346 {
11347 for (int i = 0; i < WPOF_array.Count(); i++)
11348 {
11349 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11350
11351 if (WPOF)
11352 {
11353 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11354 }
11355 }
11356 }
11357 }
11358
11359
11361 {
11362 int id = muzzle_owner.GetMuzzleID();
11364
11365 if (WPOBE_array)
11366 {
11367 for (int i = 0; i < WPOBE_array.Count(); i++)
11368 {
11369 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11370
11371 if (WPOBE)
11372 {
11373 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11374 }
11375 }
11376 }
11377 }
11378
11379
11381 {
11382 int id = muzzle_owner.GetMuzzleID();
11383 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11384
11385 if (WPOOH_array)
11386 {
11387 for (int i = 0; i < WPOOH_array.Count(); i++)
11388 {
11389 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11390
11391 if (WPOOH)
11392 {
11393 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11394 }
11395 }
11396 }
11397 }
11398
11399
11401 {
11402 int id = muzzle_owner.GetMuzzleID();
11403 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11404
11405 if (WPOOH_array)
11406 {
11407 for (int i = 0; i < WPOOH_array.Count(); i++)
11408 {
11409 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11410
11411 if (WPOOH)
11412 {
11413 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11414 }
11415 }
11416 }
11417 }
11418
11419
11421 {
11422 int id = muzzle_owner.GetMuzzleID();
11423 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11424
11425 if (WPOOH_array)
11426 {
11427 for (int i = 0; i < WPOOH_array.Count(); i++)
11428 {
11429 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11430
11431 if (WPOOH)
11432 {
11433 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11434 }
11435 }
11436 }
11437 }
11438
11439
11440
11442 {
11444 {
11445 return true;
11446 }
11447
11448 return false;
11449 }
11450
11452 {
11454 {
11455 return true;
11456 }
11457
11458 return false;
11459 }
11460
11462 {
11464 {
11465 return true;
11466 }
11467
11468 return false;
11469 }
11470
11472 {
11473 return false;
11474 }
11475
11478 {
11479 return UATimeSpent.DEFAULT_DEPLOY;
11480 }
11481
11482
11483
11484
11486 {
11488 SetSynchDirty();
11489 }
11490
11492 {
11494 }
11495
11496
11498 {
11499 return false;
11500 }
11501
11504 {
11505 string att_type = "None";
11506
11507 if (ConfigIsExisting("soundAttType"))
11508 {
11509 att_type = ConfigGetString("soundAttType");
11510 }
11511
11513 }
11514
11516 {
11518 }
11519
11520
11521
11522
11523
11529
11531 {
11534
11536 }
11537
11538
11540 {
11542 return;
11543
11545
11548
11551
11552 SoundParameters params = new SoundParameters();
11556 }
11557
11558
11560 {
11562 {
11565
11566 SetSynchDirty();
11567
11570 }
11571 }
11572
11574 {
11576 }
11577
11578
11580 {
11582 return;
11583
11585 SetSynchDirty();
11586
11589 }
11590
11592 {
11595 }
11596
11598 {
11600 }
11601
11602 void OnApply(PlayerBase player);
11603
11605 {
11606 return 1.0;
11607 };
11608
11610 {
11612 }
11613
11615 {
11617 }
11618
11620
11622 {
11623 SetDynamicPhysicsLifeTime(0.01);
11625 }
11626
11628 {
11629 array<string> zone_names = new array<string>;
11630 GetDamageZones(zone_names);
11631 for (int i = 0; i < zone_names.Count(); i++)
11632 {
11633 SetHealthMax(zone_names.Get(i),"Health");
11634 }
11635 SetHealthMax("","Health");
11636 }
11637
11640 {
11641 float global_health = GetHealth01("","Health");
11642 array<string> zones = new array<string>;
11643 GetDamageZones(zones);
11644
11645 for (int i = 0; i < zones.Count(); i++)
11646 {
11647 SetHealth01(zones.Get(i),"Health",global_health);
11648 }
11649 }
11650
11653 {
11654 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11655 }
11656
11658 {
11659 if (!hasRootAsPlayer)
11660 {
11661 if (refParentIB)
11662 {
11663
11664 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11665 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11666
11667 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11668 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11669
11672 }
11673 else
11674 {
11675
11678 }
11679 }
11680 }
11681
11683 {
11685 {
11686 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11687 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11688 {
11689 float heatPermCoef = 1.0;
11691 while (ent)
11692 {
11693 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11694 ent = ent.GetHierarchyParent();
11695 }
11696
11697 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11698 }
11699 }
11700 }
11701
11703 {
11704
11705 EntityAI parent = GetHierarchyParent();
11706 if (!parent)
11707 {
11708 hasParent = false;
11709 hasRootAsPlayer = false;
11710 }
11711 else
11712 {
11713 hasParent = true;
11714 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11715 refParentIB =
ItemBase.Cast(parent);
11716 }
11717 }
11718
11719 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11720 {
11721
11722 }
11723
11725 {
11726
11727 return false;
11728 }
11729
11731 {
11732
11733
11734 return false;
11735 }
11736
11738 {
11739
11740 return false;
11741 }
11742
11745 {
11746 return !GetIsFrozen() &&
IsOpen();
11747 }
11748
11750 {
11751 bool hasParent = false, hasRootAsPlayer = false;
11753
11754 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11755 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11756
11757 if (wwtu || foodDecay)
11758 {
11762
11763 if (processWetness || processTemperature || processDecay)
11764 {
11766
11767 if (processWetness)
11768 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11769
11770 if (processTemperature)
11772
11773 if (processDecay)
11774 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11775 }
11776 }
11777 }
11778
11781 {
11783 }
11784
11786 {
11789
11790 return super.GetTemperatureFreezeThreshold();
11791 }
11792
11794 {
11797
11798 return super.GetTemperatureThawThreshold();
11799 }
11800
11802 {
11805
11806 return super.GetItemOverheatThreshold();
11807 }
11808
11810 {
11812 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11813
11814 return super.GetTemperatureFreezeTime();
11815 }
11816
11818 {
11820 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11821
11822 return super.GetTemperatureThawTime();
11823 }
11824
11829
11831 {
11832 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11833 }
11834
11836 {
11837 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11838 }
11839
11842 {
11844 }
11845
11847 {
11849 }
11850
11852 {
11854 }
11855
11858 {
11859 return null;
11860 }
11861
11864 {
11865 return false;
11866 }
11867
11869 {
11871 {
11874 if (!trg)
11875 {
11877 explosive = this;
11878 }
11879
11880 explosive.PairRemote(trg);
11882
11883 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11884 trg.SetPersistentPairID(persistentID);
11885 explosive.SetPersistentPairID(persistentID);
11886
11887 return true;
11888 }
11889 return false;
11890 }
11891
11894 {
11895 float ret = 1.0;
11898 ret *= GetHealth01();
11899
11900 return ret;
11901 }
11902
11903 #ifdef DEVELOPER
11904 override void SetDebugItem()
11905 {
11906 super.SetDebugItem();
11907 _itemBase = this;
11908 }
11909
11911 {
11912 string text = super.GetDebugText();
11913
11915 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11916
11917 return text;
11918 }
11919 #endif
11920
11922 {
11923 return true;
11924 }
11925
11927
11929
11931 {
11934 }
11935
11936
11944
11960
11961 [
Obsolete(
"Use ItemSoundHandler instead")]
11964 {
11965 if (!
g_Game.IsDedicatedServer())
11966 {
11967 if (ConfigIsExisting("attachSoundSet"))
11968 {
11969 string cfg_path = "";
11970 string soundset = "";
11971 string type_name =
GetType();
11972
11975 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11976 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11977
11978 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11979 {
11980 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11981 {
11982 if (cfg_slot_array[i] == slot_type)
11983 {
11984 soundset = cfg_soundset_array[i];
11985 break;
11986 }
11987 }
11988 }
11989
11990 if (soundset != "")
11991 {
11992 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11994 }
11995 }
11996 }
11997 }
11998
12000}
12001
12003{
12005 if (entity)
12006 {
12007 bool is_item = entity.IsInherited(
ItemBase);
12008 if (is_item && full_quantity)
12009 {
12012 }
12013 }
12014 else
12015 {
12017 return NULL;
12018 }
12019 return entity;
12020}
12021
12023{
12024 if (item)
12025 {
12026 if (health > 0)
12027 item.SetHealth("", "", health);
12028
12029 if (item.CanHaveTemperature())
12030 {
12032 if (item.CanFreeze())
12033 item.SetFrozen(false);
12034 }
12035
12036 if (item.HasEnergyManager())
12037 {
12038 if (quantity >= 0)
12039 {
12040 item.GetCompEM().SetEnergy0To1(quantity);
12041 }
12042 else
12043 {
12045 }
12046 }
12047 else if (item.IsMagazine())
12048 {
12049 Magazine mag = Magazine.Cast(item);
12050 if (quantity >= 0)
12051 {
12052 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12053 }
12054 else
12055 {
12057 }
12058
12059 }
12060 else
12061 {
12062 if (quantity >= 0)
12063 {
12064 item.SetQuantityNormalized(quantity, false);
12065 }
12066 else
12067 {
12069 }
12070
12071 }
12072 }
12073}
12074
12075#ifdef DEVELOPER
12077#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.