7164{
7166 {
7167 return true;
7168 }
7169};
7170
7172{
7173
7174};
7175
7176
7177
7179{
7183
7185
7188
7189
7190
7191
7192
7201
7207
7212
7217
7238 protected bool m_IsResultOfSplit
7239
7241
7246
7247
7248
7250
7254
7255
7256
7258
7261
7262
7263
7269
7270
7278
7281
7282
7284
7285
7287
7288
7293
7294
7299
7301
7302
7304
7305
7307 {
7312
7313 if (!
g_Game.IsDedicatedServer())
7314 {
7316 {
7318
7320 {
7322 }
7323 }
7324
7327 }
7328
7329 m_OldLocation = null;
7330
7332 {
7334 }
7335
7336 if (ConfigIsExisting("headSelectionsToHide"))
7337 {
7340 }
7341
7343 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7344 {
7346 }
7347
7349
7350 m_IsResultOfSplit = false;
7351
7353 }
7354
7356 {
7357 super.InitItemVariables();
7358
7364 m_Count = ConfigGetInt(
"count");
7365
7368
7373
7376
7381
7393
7397
7398
7401 if (ConfigIsExisting("canBeSplit"))
7402 {
7405 }
7406
7408 if (ConfigIsExisting("itemBehaviour"))
7410
7411
7414 RegisterNetSyncVariableInt("m_VarLiquidType");
7415 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7416
7417 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7418 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7419 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7420
7421 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7422 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7423 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7424 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7425
7426 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7427 RegisterNetSyncVariableBool("m_IsTakeable");
7428 RegisterNetSyncVariableBool("m_IsHologram");
7429
7432 {
7435 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7436 }
7437
7439
7441 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7443
7445 }
7446
7448 {
7450 }
7451
7453 {
7456 {
7461 }
7462 }
7463
7464 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7465 {
7467 {
7470 }
7471
7473 }
7474
7476 {
7482 }
7483
7485
7487 {
7489
7490 if (!action)
7491 {
7492 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7493 return;
7494 }
7495
7497 if (!ai)
7498 {
7500 return;
7501 }
7502
7504 if (!action_array)
7505 {
7506 action_array = new array<ActionBase_Basic>;
7508 }
7509 if (LogManager.IsActionLogEnable())
7510 {
7511 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7512 }
7513
7514 if (action_array.Find(action) != -1)
7515 {
7516 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7517 }
7518 else
7519 {
7520 action_array.Insert(action);
7521 }
7522 }
7523
7525 {
7526 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7527 ActionBase action = player.GetActionManager().GetAction(actionName);
7530
7531 if (action_array)
7532 {
7533 action_array.RemoveItem(action);
7534 }
7535 }
7536
7537
7538
7540 {
7541 ActionOverrideData overrideData = new ActionOverrideData();
7545
7547 if (!actionMap)
7548 {
7551 }
7552
7553 actionMap.Insert(this.
Type(), overrideData);
7554
7555 }
7556
7558
7560
7561
7563 {
7566
7569
7570 string config_to_search = "CfgVehicles";
7571 string muzzle_owner_config;
7572
7574 {
7575 if (IsInherited(Weapon))
7576 config_to_search = "CfgWeapons";
7577
7578 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7579
7580 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7581
7582 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7583
7584 if (config_OnFire_subclass_count > 0)
7585 {
7586 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7587
7588 for (int i = 0; i < config_OnFire_subclass_count; i++)
7589 {
7590 string particle_class = "";
7591 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7592 string config_OnFire_entry = config_OnFire_class + particle_class;
7593 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7594 WPOF_array.Insert(WPOF);
7595 }
7596
7597
7599 }
7600 }
7601
7603 {
7604 config_to_search = "CfgWeapons";
7605 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7606
7607 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7608
7609 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7610
7611 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7612 {
7613 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7614
7615 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7616 {
7617 string particle_class2 = "";
7618 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7619 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7620 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7621 WPOBE_array.Insert(WPOBE);
7622 }
7623
7624
7626 }
7627 }
7628 }
7629
7630
7632 {
7635
7637 {
7638 string config_to_search = "CfgVehicles";
7639
7640 if (IsInherited(Weapon))
7641 config_to_search = "CfgWeapons";
7642
7643 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7644 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7645
7646 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7647 {
7648
7650
7652 {
7654 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7656 return;
7657 }
7658
7661
7662
7663
7664 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7665 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7666
7667 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7668 {
7669 string particle_class = "";
7670 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7671 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7672 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7673
7674 if (entry_type == CT_CLASS)
7675 {
7676 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7677 WPOOH_array.Insert(WPOF);
7678 }
7679 }
7680
7681
7683 }
7684 }
7685 }
7686
7688 {
7690 }
7691
7693 {
7695 {
7697
7700
7703
7704 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7705 }
7706 }
7707
7709 {
7711 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7712
7714 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7715
7717 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7718
7720 {
7722 }
7723 }
7724
7726 {
7728 }
7729
7731 {
7734 else
7736
7738 {
7741 }
7742 else
7743 {
7746
7749 }
7750
7752 }
7753
7755 {
7757 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7758 }
7759
7761 {
7763 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7765 }
7766
7768 {
7770 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7771 }
7772
7774 {
7777
7778 OverheatingParticle OP = new OverheatingParticle();
7783
7785 }
7786
7788 {
7791
7792 return -1;
7793 }
7794
7796 {
7798 {
7801
7802 for (int i = count; i > 0; --i)
7803 {
7804 int id = i - 1;
7807
7810
7811 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7812 {
7813 if (p)
7814 {
7817 }
7818 }
7819 }
7820 }
7821 }
7822
7824 {
7826 {
7828 {
7829 int id = i - 1;
7831
7832 if (OP)
7833 {
7835
7836 if (p)
7837 {
7839 }
7840
7841 delete OP;
7842 }
7843 }
7844
7847 }
7848 }
7849
7852 {
7853 return 0.0;
7854 }
7855
7856
7858 {
7859 return 250;
7860 }
7861
7863 {
7864 return 0;
7865 }
7866
7869 {
7871 return true;
7872
7873 return false;
7874 }
7875
7878 {
7881
7883 {
7885 }
7886 else
7887 {
7888
7890 }
7891
7893 }
7894
7901 {
7902 return -1;
7903 }
7904
7905
7906
7907
7909 {
7911 {
7912 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7913 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7914
7915 if (r_index >= 0)
7916 {
7917 InventoryLocation r_il = new InventoryLocation;
7918 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7919
7920 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7923 {
7924 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7925 }
7927 {
7928 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7929 }
7930
7931 }
7932
7933 player.GetHumanInventory().ClearUserReservedLocation(this);
7934 }
7935
7938 }
7939
7940
7941
7942
7944 {
7945 return ItemBase.m_DebugActionsMask;
7946 }
7947
7949 {
7950 return ItemBase.m_DebugActionsMask & mask;
7951 }
7952
7954 {
7955 ItemBase.m_DebugActionsMask = mask;
7956 }
7957
7959 {
7960 ItemBase.m_DebugActionsMask |= mask;
7961 }
7962
7964 {
7965 ItemBase.m_DebugActionsMask &= ~mask;
7966 }
7967
7969 {
7971 {
7973 }
7974 else
7975 {
7977 }
7978 }
7979
7980
7982 {
7983 if (GetEconomyProfile())
7984 {
7985 float q_max = GetEconomyProfile().GetQuantityMax();
7986 if (q_max > 0)
7987 {
7988 float q_min = GetEconomyProfile().GetQuantityMin();
7989 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7990
7992 {
7993 ComponentEnergyManager comp = GetCompEM();
7995 {
7997 }
7998 }
8000 {
8002
8003 }
8004
8005 }
8006 }
8007 }
8008
8011 {
8012 EntityAI parent = GetHierarchyParent();
8013
8014 if (parent)
8015 {
8016 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8017 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8018 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8019 }
8020 }
8021
8024 {
8025 EntityAI parent = GetHierarchyParent();
8026
8027 if (parent)
8028 {
8029 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8030 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8031 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8032 }
8033 }
8034
8036 {
8037
8038
8039
8040
8042
8044 {
8045 if (ScriptInputUserData.CanStoreInputUserData())
8046 {
8047 ScriptInputUserData ctx = new ScriptInputUserData;
8053 ctx.
Write(use_stack_max);
8056
8058 {
8059 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8060 }
8061 }
8062 }
8063 else if (!
g_Game.IsMultiplayer())
8064 {
8066 }
8067 }
8068
8070 {
8072 }
8073
8075 {
8077 }
8078
8080 {
8082 }
8083
8085 {
8086
8087 return false;
8088 }
8089
8091 {
8092 return false;
8093 }
8094
8098 {
8099 return false;
8100 }
8101
8103 {
8104 return "";
8105 }
8106
8108
8110 {
8111 return false;
8112 }
8113
8115 {
8116 return true;
8117 }
8118
8119
8120
8122 {
8123 return true;
8124 }
8125
8127 {
8128 return true;
8129 }
8130
8132 {
8133 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8135 }
8136
8138 {
8140 }
8141
8143 {
8145 if (!is_being_placed)
8147 SetSynchDirty();
8148 }
8149
8150
8152
8154 {
8156 }
8157
8159 {
8161 }
8162
8164 {
8165 return 1;
8166 }
8167
8169 {
8170 return false;
8171 }
8172
8174 {
8176 SetSynchDirty();
8177 }
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8214 {
8215 super.OnMovedInsideCargo(container);
8216
8217 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8218 }
8219
8220 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8221 {
8222 super.EEItemLocationChanged(oldLoc, newLoc);
8223
8224 PlayerBase newPlayer = null;
8225 PlayerBase oldPlayer = null;
8226
8227 if (newLoc.GetParent())
8228 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8229
8230 if (oldLoc.GetParent())
8231 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8232
8234 {
8235 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8236
8237 if (rIndex >= 0)
8238 {
8239 InventoryLocation rIl = new InventoryLocation;
8240 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8241
8242 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8245 {
8246 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8247 }
8249 {
8251 }
8252
8253 }
8254 }
8255
8257 {
8258 if (newPlayer)
8259 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8260
8261 if (newPlayer == oldPlayer)
8262 {
8263 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8264 {
8266 {
8267 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8268 {
8269 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8270 }
8271 }
8272 else
8273 {
8274 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8275 }
8276 }
8277
8278 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8279 {
8280 int type = oldLoc.GetType();
8282 {
8283 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8284 }
8286 {
8287 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8288 }
8289 }
8290 if (!m_OldLocation)
8291 {
8292 m_OldLocation = new InventoryLocation;
8293 }
8294 m_OldLocation.Copy(oldLoc);
8295 }
8296 else
8297 {
8298 if (m_OldLocation)
8299 {
8300 m_OldLocation.Reset();
8301 }
8302 }
8303
8304 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8305 }
8306 else
8307 {
8308 if (newPlayer)
8309 {
8310 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8311 if (resIndex >= 0)
8312 {
8313 InventoryLocation il = new InventoryLocation;
8314 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8316 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8319 {
8320 il.
GetParent().GetOnReleaseLock().Invoke(it);
8321 }
8323 {
8325 }
8326
8327 }
8328 }
8330 {
8331
8333 }
8334
8335 if (m_OldLocation)
8336 {
8337 m_OldLocation.Reset();
8338 }
8339 }
8340
8342 {
8343 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8344 }
8345
8347 {
8348 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8349 }
8350 }
8351
8352 override void EOnContact(IEntity other, Contact extra)
8353 {
8355 {
8356 int liquidType = -1;
8358 if (impactSpeed > 0.0)
8359 {
8361 #ifndef SERVER
8363 #else
8365 SetSynchDirty();
8366 #endif
8368 }
8369 }
8370
8371 #ifdef SERVER
8372 if (GetCompEM() && GetCompEM().IsPlugged())
8373 {
8374 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8375 GetCompEM().UnplugThis();
8376 }
8377 #endif
8378 }
8379
8381
8383 {
8385 }
8386
8388 {
8389
8390 }
8391
8393 {
8394 super.OnItemLocationChanged(old_owner, new_owner);
8395
8396 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8397 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8398
8399 if (!relatedPlayer && playerNew)
8400 relatedPlayer = playerNew;
8401
8402 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8403 {
8405 if (actionMgr)
8406 {
8407 ActionBase currentAction = actionMgr.GetRunningAction();
8408 if (currentAction)
8410 }
8411 }
8412
8413 Man ownerPlayerOld = null;
8414 Man ownerPlayerNew = null;
8415
8416 if (old_owner)
8417 {
8418 if (old_owner.
IsMan())
8419 {
8420 ownerPlayerOld = Man.Cast(old_owner);
8421 }
8422 else
8423 {
8424 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8425 }
8426 }
8427 else
8428 {
8430 {
8432
8433 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8434 {
8435 GetCompEM().UnplugThis();
8436 }
8437 }
8438 }
8439
8440 if (new_owner)
8441 {
8442 if (new_owner.
IsMan())
8443 {
8444 ownerPlayerNew = Man.Cast(new_owner);
8445 }
8446 else
8447 {
8448 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8449 }
8450 }
8451
8452 if (ownerPlayerOld != ownerPlayerNew)
8453 {
8454 if (ownerPlayerOld)
8455 {
8456 array<EntityAI> subItemsExit = new array<EntityAI>;
8458 for (int i = 0; i < subItemsExit.Count(); i++)
8459 {
8462 }
8463 }
8464
8465 if (ownerPlayerNew)
8466 {
8467 array<EntityAI> subItemsEnter = new array<EntityAI>;
8469 for (int j = 0; j < subItemsEnter.Count(); j++)
8470 {
8473 }
8474 }
8475 }
8476 else if (ownerPlayerNew != null)
8477 {
8478 PlayerBase nplayer;
8479 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8480 {
8481 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8483 for (int k = 0; k < subItemsUpdate.Count(); k++)
8484 {
8486 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8487 }
8488 }
8489 }
8490
8491 if (old_owner)
8492 old_owner.OnChildItemRemoved(this);
8493 if (new_owner)
8494 new_owner.OnChildItemReceived(this);
8495 }
8496
8497
8499 {
8500 super.EEDelete(parent);
8501 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8502 if (player)
8503 {
8505
8506 if (player.IsAlive())
8507 {
8508 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8509 if (r_index >= 0)
8510 {
8511 InventoryLocation r_il = new InventoryLocation;
8512 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8513
8514 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8517 {
8518 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8519 }
8521 {
8522 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8523 }
8524
8525 }
8526
8527 player.RemoveQuickBarEntityShortcut(this);
8528 }
8529 }
8530 }
8531
8533 {
8534 super.EEKilled(killer);
8535
8538 {
8539 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8540 {
8541 if (IsMagazine())
8542 {
8543 if (Magazine.Cast(this).GetAmmoCount() > 0)
8544 {
8546 }
8547 }
8548 else
8549 {
8551 }
8552 }
8553 }
8554 }
8555
8557 {
8558 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8559
8560 super.OnWasAttached(parent, slot_id);
8561
8564
8567 }
8568
8570 {
8571 super.OnWasDetached(parent, slot_id);
8572
8575
8578 }
8579
8581 {
8582 int idx;
8585
8586 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8587 if (inventory_slots.Count() < 1)
8588 {
8589 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8590 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8591 }
8592 else
8593 {
8594 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8595 }
8596
8597 idx = inventory_slots.Find(slot);
8598 if (idx < 0)
8599 return "";
8600
8601 return attach_types.Get(idx);
8602 }
8603
8605 {
8606 int idx = -1;
8607 string slot;
8608
8611
8612 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8613 if (inventory_slots.Count() < 1)
8614 {
8615 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8616 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8617 }
8618 else
8619 {
8620 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8621 if (detach_types.Count() < 1)
8622 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8623 }
8624
8625 for (int i = 0; i < inventory_slots.Count(); i++)
8626 {
8627 slot = inventory_slots.Get(i);
8628 }
8629
8630 if (slot != "")
8631 {
8632 if (detach_types.Count() == 1)
8633 idx = 0;
8634 else
8635 idx = inventory_slots.Find(slot);
8636 }
8637 if (idx < 0)
8638 return "";
8639
8640 return detach_types.Get(idx);
8641 }
8642
8644 {
8645
8647
8648
8649 float min_time = 1;
8650 float max_time = 3;
8651 float delay = Math.RandomFloat(min_time, max_time);
8652
8653 explode_timer.Run(delay, this, "DoAmmoExplosion");
8654 }
8655
8657 {
8658 Magazine magazine = Magazine.Cast(this);
8659 int pop_sounds_count = 6;
8660 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8661
8662
8663 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8664 string sound_name = pop_sounds[ sound_idx ];
8665 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8666
8667
8668 magazine.ServerAddAmmoCount(-1);
8669
8670
8671 float min_temp_to_explode = 100;
8672
8673 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8674 {
8676 }
8677 }
8678
8679
8680 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8681 {
8682 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8683
8684 const int CHANCE_DAMAGE_CARGO = 4;
8685 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8686 const int CHANCE_DAMAGE_NOTHING = 2;
8687
8689 {
8690 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8691 int chances;
8692 int rnd;
8693
8694 if (GetInventory().GetCargo())
8695 {
8696 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8697 rnd = Math.RandomInt(0,chances);
8698
8699 if (rnd < CHANCE_DAMAGE_CARGO)
8700 {
8702 }
8703 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8704 {
8706 }
8707 }
8708 else
8709 {
8710 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8711 rnd = Math.RandomInt(0,chances);
8712
8713 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8714 {
8716 }
8717 }
8718 }
8719 }
8720
8722 {
8723 CargoBase cargo = GetInventory().GetCargo();
8724 if (cargo)
8725 {
8727 if (item_count > 0)
8728 {
8729 int random_pick = Math.RandomInt(0, item_count);
8731 if (!item.IsExplosive())
8732 {
8733 item.AddHealth("","",damage);
8734 return true;
8735 }
8736 }
8737 }
8738 return false;
8739 }
8740
8742 {
8743 GameInventory inventory = GetInventory();
8745 if (attachment_count > 0)
8746 {
8747 int random_pick = Math.RandomInt(0, attachment_count);
8749 if (!attachment.IsExplosive())
8750 {
8751 attachment.AddHealth("","",damage);
8752 return true;
8753 }
8754 }
8755 return false;
8756 }
8757
8759 {
8761 }
8762
8764 {
8766 return GetInventory().CanRemoveEntity();
8767
8768 return false;
8769 }
8770
8772 {
8773
8775 return false;
8776
8777
8779 return false;
8780
8781
8782
8784 if (delta == 0)
8785 return false;
8786
8787
8788 return true;
8789 }
8790
8792 {
8794 {
8795 if (ScriptInputUserData.CanStoreInputUserData())
8796 {
8797 ScriptInputUserData ctx = new ScriptInputUserData;
8802 ctx.
Write(destination_entity);
8806 }
8807 }
8808 else if (!
g_Game.IsMultiplayer())
8809 {
8811 }
8812 }
8813
8815 {
8816 float split_quantity_new;
8820 InventoryLocation loc = new InventoryLocation;
8821
8822 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8823 {
8825 split_quantity_new = stack_max;
8826 else
8828
8830 {
8831 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8832 if (new_item)
8833 {
8834 new_item.SetResultOfSplit(true);
8835 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8837 new_item.
SetQuantity(split_quantity_new,
false,
true);
8838 }
8839 }
8840 }
8841 else if (destination_entity && slot_id == -1)
8842 {
8843 if (quantity > stack_max)
8844 split_quantity_new = stack_max;
8845 else
8846 split_quantity_new = quantity;
8847
8849 {
8850 GameInventory destinationInventory = destination_entity.GetInventory();
8852 {
8855 }
8856
8857 if (new_item)
8858 {
8859 new_item.SetResultOfSplit(true);
8860 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8862 new_item.
SetQuantity(split_quantity_new,
false,
true);
8863 }
8864 }
8865 }
8866 else
8867 {
8868 if (stack_max != 0)
8869 {
8871 {
8873 }
8874
8875 if (split_quantity_new == 0)
8876 {
8877 if (!
g_Game.IsMultiplayer())
8878 player.PhysicalPredictiveDropItem(this);
8879 else
8880 player.ServerDropEntity(this);
8881 return;
8882 }
8883
8885 {
8887
8888 if (new_item)
8889 {
8890 new_item.SetResultOfSplit(true);
8891 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8894 new_item.PlaceOnSurface();
8895 }
8896 }
8897 }
8898 }
8899 }
8900
8902 {
8903 float split_quantity_new;
8907 InventoryLocation loc = new InventoryLocation;
8908
8909 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8910 {
8912 split_quantity_new = stack_max;
8913 else
8915
8917 {
8918 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8919 if (new_item)
8920 {
8921 new_item.SetResultOfSplit(true);
8922 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8924 new_item.
SetQuantity(split_quantity_new,
false,
true);
8925 }
8926 }
8927 }
8928 else if (destination_entity && slot_id == -1)
8929 {
8930 if (quantity > stack_max)
8931 split_quantity_new = stack_max;
8932 else
8933 split_quantity_new = quantity;
8934
8936 {
8937 GameInventory destinationInventory = destination_entity.GetInventory();
8939 {
8942 }
8943
8944 if (new_item)
8945 {
8946 new_item.SetResultOfSplit(true);
8947 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8949 new_item.
SetQuantity(split_quantity_new,
false,
true);
8950 }
8951 }
8952 }
8953 else
8954 {
8955 if (stack_max != 0)
8956 {
8958 {
8960 }
8961
8963 {
8965
8966 if (new_item)
8967 {
8968 new_item.SetResultOfSplit(true);
8969 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8972 new_item.PlaceOnSurface();
8973 }
8974 }
8975 }
8976 }
8977 }
8978
8980 {
8982 {
8983 if (ScriptInputUserData.CanStoreInputUserData())
8984 {
8985 ScriptInputUserData ctx = new ScriptInputUserData;
8990 dst.WriteToContext(ctx);
8992 }
8993 }
8994 else if (!
g_Game.IsMultiplayer())
8995 {
8997 }
8998 }
8999
9001 {
9003 {
9004 if (ScriptInputUserData.CanStoreInputUserData())
9005 {
9006 ScriptInputUserData ctx = new ScriptInputUserData;
9011 ctx.
Write(destination_entity);
9017 }
9018 }
9019 else if (!
g_Game.IsMultiplayer())
9020 {
9022 }
9023 }
9024
9026 {
9028 }
9029
9031 {
9033 float split_quantity_new;
9035 if (dst.IsValid())
9036 {
9037 int slot_id = dst.GetSlot();
9039
9040 if (quantity > stack_max)
9041 split_quantity_new = stack_max;
9042 else
9043 split_quantity_new = quantity;
9044
9046 {
9048
9049 if (new_item)
9050 {
9051 new_item.SetResultOfSplit(true);
9052 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9054 new_item.
SetQuantity(split_quantity_new,
false,
true);
9055 }
9056
9057 return new_item;
9058 }
9059 }
9060
9061 return null;
9062 }
9063
9065 {
9067 float split_quantity_new;
9069 if (destination_entity)
9070 {
9072 if (quantity > stackable)
9073 split_quantity_new = stackable;
9074 else
9075 split_quantity_new = quantity;
9076
9078 {
9079 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9080 if (new_item)
9081 {
9082 new_item.SetResultOfSplit(true);
9083 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9085 new_item.
SetQuantity(split_quantity_new,
false,
true);
9086 }
9087 }
9088 }
9089 }
9090
9092 {
9094 {
9095 if (ScriptInputUserData.CanStoreInputUserData())
9096 {
9097 ScriptInputUserData ctx = new ScriptInputUserData;
9102 ItemBase destination_entity =
this;
9103 ctx.
Write(destination_entity);
9107 }
9108 }
9109 else if (!
g_Game.IsMultiplayer())
9110 {
9112 }
9113 }
9114
9116 {
9118 float split_quantity_new;
9120 if (player)
9121 {
9123 if (quantity > stackable)
9124 split_quantity_new = stackable;
9125 else
9126 split_quantity_new = quantity;
9127
9129 {
9130 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9131 new_item =
ItemBase.Cast(in_hands);
9132 if (new_item)
9133 {
9134 new_item.SetResultOfSplit(true);
9135 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9137 new_item.SetQuantity(split_quantity_new, false, true);
9138 }
9139 }
9140 }
9141 }
9142
9144 {
9146 float split_quantity_new = Math.Floor(quantity * 0.5);
9147
9149 return;
9150
9152
9153 if (new_item)
9154 {
9155 if (new_item.GetQuantityMax() < split_quantity_new)
9156 {
9157 split_quantity_new = new_item.GetQuantityMax();
9158 }
9159
9160 new_item.SetResultOfSplit(true);
9161 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9162
9164 {
9167 }
9168 else
9169 {
9171 new_item.
SetQuantity(split_quantity_new,
false,
true);
9172 }
9173 }
9174 }
9175
9177 {
9179 float split_quantity_new = Math.Floor(quantity / 2);
9180
9182 return;
9183
9184 InventoryLocation invloc = new InventoryLocation;
9186
9188 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9189
9190 if (new_item)
9191 {
9192 if (new_item.GetQuantityMax() < split_quantity_new)
9193 {
9194 split_quantity_new = new_item.GetQuantityMax();
9195 }
9197 {
9200 }
9201 else if (split_quantity_new > 1)
9202 {
9204 new_item.
SetQuantity(split_quantity_new,
false,
true);
9205 }
9206 }
9207 }
9208
9211 {
9212 SetWeightDirty();
9214
9215 if (parent)
9216 parent.OnAttachmentQuantityChangedEx(this, delta);
9217
9219 {
9221 {
9223 }
9225 {
9226 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9228 }
9229 }
9230 }
9231
9234 {
9235
9236 }
9237
9240 {
9242 }
9243
9245 {
9246 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9247
9249 {
9250 if (newLevel == GameConstants.STATE_RUINED)
9251 {
9253 EntityAI parent = GetHierarchyParent();
9254 if (parent && parent.IsFireplace())
9255 {
9256 CargoBase cargo = GetInventory().GetCargo();
9257 if (cargo)
9258 {
9260 {
9262 }
9263 }
9264 }
9265 }
9266
9268 {
9269
9271 return;
9272 }
9273
9274 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9275 {
9277 }
9278 }
9279 }
9280
9281
9283 {
9284 super.OnRightClick();
9285
9287 {
9289 {
9290 if (ScriptInputUserData.CanStoreInputUserData())
9291 {
9292 EntityAI root = GetHierarchyRoot();
9293 Man playerOwner = GetHierarchyRootPlayer();
9294 InventoryLocation dst = new InventoryLocation;
9295
9296
9297 if (!playerOwner && root && root == this)
9298 {
9300 }
9301 else
9302 {
9303
9304 GetInventory().GetCurrentInventoryLocation(dst);
9306 {
9307 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9309 {
9311 }
9312 else
9313 {
9315
9316
9317 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9318 {
9320 }
9321 else
9322 {
9323 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9324 }
9325 }
9326 }
9327 }
9328
9329 ScriptInputUserData ctx = new ScriptInputUserData;
9337 }
9338 }
9339 else if (!
g_Game.IsMultiplayer())
9340 {
9342 }
9343 }
9344 }
9345
9347 {
9348 if (root)
9349 {
9350 vector m4[4];
9351 root.GetTransform(m4);
9352 dst.SetGround(this, m4);
9353 }
9354 else
9355 {
9356 GetInventory().GetCurrentInventoryLocation(dst);
9357 }
9358 }
9359
9360 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9361 {
9362
9363 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9364 return false;
9365
9366 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9367 return false;
9368
9369
9371 return false;
9372
9373
9374 Magazine mag = Magazine.Cast(this);
9375 if (mag)
9376 {
9377 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9378 return false;
9379
9380 if (stack_max_limit)
9381 {
9382 Magazine other_mag = Magazine.Cast(other_item);
9383 if (other_item)
9384 {
9385 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9386 return false;
9387 }
9388
9389 }
9390 }
9391 else
9392 {
9393
9395 return false;
9396
9398 return false;
9399 }
9400
9401 PlayerBase player = null;
9402 if (CastTo(player, GetHierarchyRootPlayer()))
9403 {
9404 if (player.GetInventory().HasAttachment(this))
9405 return false;
9406
9407 if (player.IsItemsToDelete())
9408 return false;
9409 }
9410
9411 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9412 return false;
9413
9414 int slotID;
9416 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9417 return false;
9418
9419 return true;
9420 }
9421
9423 {
9425 }
9426
9428 {
9429 return m_IsResultOfSplit;
9430 }
9431
9433 {
9434 m_IsResultOfSplit = value;
9435 }
9436
9438 {
9440 }
9441
9443 {
9444 float other_item_quantity = other_item.GetQuantity();
9445 float this_free_space;
9446
9448
9450
9451 if (other_item_quantity > this_free_space)
9452 {
9453 return this_free_space;
9454 }
9455 else
9456 {
9457 return other_item_quantity;
9458 }
9459 }
9460
9462 {
9464 }
9465
9467 {
9469 return;
9470
9471 if (!IsMagazine() && other_item)
9472 {
9474 if (quantity_used != 0)
9475 {
9476 float hp1 = GetHealth01("","");
9477 float hp2 = other_item.GetHealth01("","");
9478 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9479 hpResult = hpResult / (
GetQuantity() + quantity_used);
9480
9481 hpResult *= GetMaxHealth();
9482 Math.Round(hpResult);
9483 SetHealth("", "Health", hpResult);
9484
9486 other_item.AddQuantity(-quantity_used);
9487 }
9488 }
9490 }
9491
9493 {
9494 #ifdef SERVER
9495 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9496 GetHierarchyParent().IncreaseLifetimeUp();
9497 #endif
9498 };
9499
9501 {
9502 PlayerBase p = PlayerBase.Cast(player);
9503
9504 array<int> recipesIds = p.m_Recipes;
9505 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9506 if (moduleRecipesManager)
9507 {
9508 EntityAI itemInHands = player.GetEntityInHands();
9509 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9510 }
9511
9512 for (int i = 0;i < recipesIds.Count(); i++)
9513 {
9514 int key = recipesIds.Get(i);
9515 string recipeName = moduleRecipesManager.GetRecipeName(key);
9517 }
9518 }
9519
9520
9521 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9522 {
9523 super.GetDebugActions(outputList);
9524
9525
9531
9532
9537
9542
9543
9547
9548
9550 {
9554 }
9555
9558
9559
9563
9565
9566 InventoryLocation loc = new InventoryLocation();
9567 GetInventory().GetCurrentInventoryLocation(loc);
9569 {
9570 if (Gizmo_IsSupported())
9573 }
9574
9576 }
9577
9578
9579
9580
9582 {
9583 super.OnAction(action_id, player, ctx);
9584
9586 {
9587 switch (action_id)
9588 {
9592 return true;
9596 return true;
9597 }
9598 }
9599
9601 {
9602 switch (action_id)
9603 {
9605 Delete();
9606 return true;
9607 }
9608 }
9609
9610 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9611 {
9612 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9613 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9614 PlayerBase p = PlayerBase.Cast(player);
9615 if (
EActions.RECIPES_RANGE_START < 1000)
9616 {
9617 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9618 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9619 }
9620 }
9621 #ifndef SERVER
9622 else if (action_id ==
EActions.WATCH_PLAYER)
9623 {
9624 PluginDeveloper.SetDeveloperItemClientEx(player);
9625 }
9626 #endif
9628 {
9629 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9630 {
9631 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9632 OnDebugButtonPressServer(id + 1);
9633 }
9634
9635 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9636 {
9637 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9639 }
9640
9641 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9642 {
9643 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9645 }
9646
9647 else if (action_id ==
EActions.ADD_QUANTITY)
9648 {
9649 if (IsMagazine())
9650 {
9651 Magazine mag = Magazine.Cast(this);
9652 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9653 }
9654 else
9655 {
9657 }
9658
9659 if (m_EM)
9660 {
9661 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9662 }
9663
9664 }
9665
9666 else if (action_id ==
EActions.REMOVE_QUANTITY)
9667 {
9668 if (IsMagazine())
9669 {
9670 Magazine mag2 = Magazine.Cast(this);
9671 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9672 }
9673 else
9674 {
9676 }
9677 if (m_EM)
9678 {
9679 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9680 }
9681
9682 }
9683
9684 else if (action_id ==
EActions.SET_QUANTITY_0)
9685 {
9687
9688 if (m_EM)
9689 {
9690 m_EM.SetEnergy(0);
9691 }
9692 }
9693
9694 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9695 {
9697
9698 if (m_EM)
9699 {
9700 m_EM.SetEnergy(m_EM.GetEnergyMax());
9701 }
9702 }
9703
9704 else if (action_id ==
EActions.ADD_HEALTH)
9705 {
9706 AddHealth("","",GetMaxHealth("","Health")/5);
9707 }
9708 else if (action_id ==
EActions.REMOVE_HEALTH)
9709 {
9710 AddHealth("","",-GetMaxHealth("","Health")/5);
9711 }
9712 else if (action_id ==
EActions.DESTROY_HEALTH)
9713 {
9714 SetHealth01("","",0);
9715 }
9716 else if (action_id ==
EActions.WATCH_ITEM)
9717 {
9719 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9720 #ifdef DEVELOPER
9721 SetDebugDeveloper_item(this);
9722 #endif
9723 }
9724
9725 else if (action_id ==
EActions.ADD_TEMPERATURE)
9726 {
9727 AddTemperature(20);
9728
9729 }
9730
9731 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9732 {
9733 AddTemperature(-20);
9734
9735 }
9736
9737 else if (action_id ==
EActions.FLIP_FROZEN)
9738 {
9739 SetFrozen(!GetIsFrozen());
9740
9741 }
9742
9743 else if (action_id ==
EActions.ADD_WETNESS)
9744 {
9746
9747 }
9748
9749 else if (action_id ==
EActions.REMOVE_WETNESS)
9750 {
9752
9753 }
9754
9755 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9756 {
9759
9760
9761 }
9762
9763 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9764 {
9767 }
9768
9769 else if (action_id ==
EActions.MAKE_SPECIAL)
9770 {
9771 auto debugParams = DebugSpawnParams.WithPlayer(player);
9772 OnDebugSpawnEx(debugParams);
9773 }
9774
9775 }
9776
9777
9778 return false;
9779 }
9780
9781
9782
9783
9787
9790
9791
9792
9794 {
9795 return false;
9796 }
9797
9798
9800 {
9801 return true;
9802 }
9803
9804
9806 {
9807 return true;
9808 }
9809
9810
9811
9813 {
9814 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9815 return g_Game.ConfigIsExisting(config_path);
9816 }
9817
9820 {
9821 return null;
9822 }
9823
9825 {
9826 return false;
9827 }
9828
9830 {
9831 return false;
9832 }
9833
9837
9838
9840 {
9841 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9842 return module_repairing.CanRepair(this, item_repair_kit);
9843 }
9844
9845
9846 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9847 {
9848 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9849 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9850 }
9851
9852
9854 {
9855
9856
9857
9858
9859
9860
9861
9862
9863 return 1;
9864 }
9865
9866
9867
9869 {
9871 }
9872
9873
9874
9876 {
9878 }
9879
9880
9889 {
9890 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9891
9892 if (player)
9893 {
9894 player.MessageStatus(text);
9895 }
9896 }
9897
9898
9907 {
9908 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9909
9910 if (player)
9911 {
9912 player.MessageAction(text);
9913 }
9914 }
9915
9916
9925 {
9926 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9927
9928 if (player)
9929 {
9930 player.MessageFriendly(text);
9931 }
9932 }
9933
9934
9943 {
9944 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9945
9946 if (player)
9947 {
9948 player.MessageImportant(text);
9949 }
9950 }
9951
9953 {
9954 return true;
9955 }
9956
9957
9958 override bool KindOf(
string tag)
9959 {
9960 bool found = false;
9961 string item_name = this.
GetType();
9963 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9964
9965 int array_size = item_tag_array.Count();
9966 for (int i = 0; i < array_size; i++)
9967 {
9968 if (item_tag_array.Get(i) == tag)
9969 {
9970 found = true;
9971 break;
9972 }
9973 }
9974 return found;
9975 }
9976
9977
9979 {
9980
9981 super.OnRPC(sender, rpc_type,ctx);
9982
9983
9984 switch (rpc_type)
9985 {
9986 #ifndef SERVER
9987 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9988 Param2<bool, string> p = new Param2<bool, string>(false, "");
9989
9991 return;
9992
9993 bool play = p.param1;
9994 string soundSet = p.param2;
9995
9996 if (play)
9997 {
9999 {
10001 {
10003 }
10004 }
10005 else
10006 {
10008 }
10009 }
10010 else
10011 {
10013 }
10014
10015 break;
10016 #endif
10017
10018 }
10019
10021 {
10023 }
10024 }
10025
10026
10027
10028
10030 {
10031 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10032 return plugin.GetID(
name);
10033 }
10034
10036 {
10037 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10038 return plugin.GetName(id);
10039 }
10040
10043 {
10044
10045
10046 int varFlags;
10047 if (!ctx.
Read(varFlags))
10048 return;
10049
10050 if (varFlags & ItemVariableFlags.FLOAT)
10051 {
10053 }
10054 }
10055
10057 {
10058
10059 super.SerializeNumericalVars(floats_out);
10060
10061
10062
10064 {
10066 }
10067
10069 {
10071 }
10072
10074 {
10076 }
10077
10079 {
10084 }
10085
10087 {
10089 }
10090 }
10091
10093 {
10094
10095 super.DeSerializeNumericalVars(floats);
10096
10097
10098 int index = 0;
10099 int mask = Math.Round(floats.Get(index));
10100
10101 index++;
10102
10104 {
10106 {
10108 }
10109 else
10110 {
10111 float quantity = floats.Get(index);
10112 SetQuantity(quantity,
true,
false,
false,
false);
10113 }
10114 index++;
10115 }
10116
10118 {
10119 float wet = floats.Get(index);
10121 index++;
10122 }
10123
10125 {
10126 int liquidtype = Math.Round(floats.Get(index));
10128 index++;
10129 }
10130
10132 {
10134 index++;
10136 index++;
10138 index++;
10140 index++;
10141 }
10142
10144 {
10145 int cleanness = Math.Round(floats.Get(index));
10147 index++;
10148 }
10149 }
10150
10152 {
10153 super.WriteVarsToCTX(ctx);
10154
10155
10157 {
10159 }
10160
10162 {
10164 }
10165
10167 {
10169 }
10170
10172 {
10173 int r,g,b,a;
10179 }
10180
10182 {
10184 }
10185 }
10186
10188 {
10189 if (!super.ReadVarsFromCTX(ctx,version))
10190 return false;
10191
10192 int intValue;
10193 float value;
10194
10195 if (version < 140)
10196 {
10197 if (!ctx.
Read(intValue))
10198 return false;
10199
10200 m_VariablesMask = intValue;
10201 }
10202
10204 {
10205 if (!ctx.
Read(value))
10206 return false;
10207
10209 {
10211 }
10212 else
10213 {
10215 }
10216 }
10217
10218 if (version < 140)
10219 {
10221 {
10222 if (!ctx.
Read(value))
10223 return false;
10224 SetTemperatureDirect(value);
10225 }
10226 }
10227
10229 {
10230 if (!ctx.
Read(value))
10231 return false;
10233 }
10234
10236 {
10237 if (!ctx.
Read(intValue))
10238 return false;
10240 }
10241
10243 {
10244 int r,g,b,a;
10246 return false;
10248 return false;
10250 return false;
10252 return false;
10253
10255 }
10256
10258 {
10259 if (!ctx.
Read(intValue))
10260 return false;
10262 }
10263
10264 if (version >= 138 && version < 140)
10265 {
10267 {
10268 if (!ctx.
Read(intValue))
10269 return false;
10270 SetFrozen(intValue);
10271 }
10272 }
10273
10274 return true;
10275 }
10276
10277
10279 {
10282 {
10284 }
10285
10286 if (!super.OnStoreLoad(ctx, version))
10287 {
10289 return false;
10290 }
10291
10292 if (version >= 114)
10293 {
10294 bool hasQuickBarIndexSaved;
10295
10296 if (!ctx.
Read(hasQuickBarIndexSaved))
10297 {
10299 return false;
10300 }
10301
10302 if (hasQuickBarIndexSaved)
10303 {
10304 int itmQBIndex;
10305
10306
10307 if (!ctx.
Read(itmQBIndex))
10308 {
10310 return false;
10311 }
10312
10313 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10314 if (itmQBIndex != -1 && parentPlayer)
10315 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10316 }
10317 }
10318 else
10319 {
10320
10321 PlayerBase player;
10322 int itemQBIndex;
10323 if (version ==
int.
MAX)
10324 {
10325 if (!ctx.
Read(itemQBIndex))
10326 {
10328 return false;
10329 }
10330 }
10331 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10332 {
10333
10334 if (!ctx.
Read(itemQBIndex))
10335 {
10337 return false;
10338 }
10339 if (itemQBIndex != -1 && player)
10340 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10341 }
10342 }
10343
10344 if (version < 140)
10345 {
10346
10347 if (!LoadVariables(ctx, version))
10348 {
10350 return false;
10351 }
10352 }
10353
10354
10356 {
10358 return false;
10359 }
10360 if (version >= 132)
10361 {
10363 if (raib)
10364 {
10366 {
10368 return false;
10369 }
10370 }
10371 }
10372
10374 return true;
10375 }
10376
10377
10378
10380 {
10381 super.OnStoreSave(ctx);
10382
10383 PlayerBase player;
10384 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10385 {
10387
10388 int itemQBIndex = -1;
10389 itemQBIndex = player.FindQuickBarEntityIndex(this);
10390 ctx.
Write(itemQBIndex);
10391 }
10392 else
10393 {
10395 }
10396
10398
10400 if (raib)
10401 {
10403 }
10404 }
10405
10406
10408 {
10409 super.AfterStoreLoad();
10410
10412 {
10414 }
10415
10417 {
10420 }
10421 }
10422
10424 {
10425 super.EEOnAfterLoad();
10426
10428 {
10430 }
10431
10434 }
10435
10437 {
10438 return false;
10439 }
10440
10441
10442
10444 {
10446 {
10447 #ifdef PLATFORM_CONSOLE
10448
10450 {
10452 if (menu)
10453 {
10455 }
10456 }
10457 #endif
10458 }
10459
10461 {
10464 }
10465
10467 {
10468 SetWeightDirty();
10470 }
10472 {
10475 }
10476
10478 {
10481
10484 }
10486 {
10490 }
10491
10492 super.OnVariablesSynchronized();
10493 }
10494
10495
10496
10498 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10499 {
10500 if (!IsServerCheck(allow_client))
10501 return false;
10502
10504 return false;
10505
10508
10509 if (value <= (min + 0.001))
10510 value = min;
10511
10512 if (value == min)
10513 {
10514 if (destroy_config)
10515 {
10516 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10517 if (dstr)
10518 {
10520 this.Delete();
10521 return true;
10522 }
10523 }
10524 else if (destroy_forced)
10525 {
10527 this.Delete();
10528 return true;
10529 }
10530
10532 }
10533
10536
10538 {
10539 EntityAI parent = GetHierarchyRoot();
10540 InventoryLocation iLoc = new InventoryLocation();
10541 GetInventory().GetCurrentInventoryLocation(iLoc);
10543 {
10544 int iLocSlot = iLoc.
GetSlot();
10546 {
10548 }
10550 {
10552 }
10553 }
10554 }
10555
10557 {
10559
10560 if (delta)
10562 }
10563
10565
10566 return false;
10567 }
10568
10569
10571 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10572 {
10574 }
10575
10577 {
10580 }
10581
10583 {
10586 }
10587
10589 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10590 {
10591 float value_clamped = Math.Clamp(value, 0, 1);
10593 SetQuantity(result, destroy_config, destroy_forced);
10594 }
10595
10596
10599 {
10601 }
10602
10604 {
10606 }
10607
10608
10609
10610
10611
10612
10613
10614
10615
10616
10618 {
10619 int slot = -1;
10620 GameInventory inventory = GetInventory();
10621 if (inventory)
10622 {
10623 InventoryLocation il = new InventoryLocation;
10626 }
10627
10629 }
10630
10632 {
10633 float quantity_max = 0;
10634
10636 {
10637 if (attSlotID != -1)
10638 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10639
10640 if (quantity_max <= 0)
10642 }
10643
10644 if (quantity_max <= 0)
10646
10647 return quantity_max;
10648 }
10649
10651 {
10653 }
10654
10656 {
10658 }
10659
10660
10662 {
10664 }
10665
10667 {
10669 }
10670
10672 {
10674 }
10675
10676
10678 {
10679
10680 float weightEx = GetWeightEx();
10681 float special = GetInventoryAndCargoWeight();
10682 return weightEx - special;
10683 }
10684
10685
10687 {
10689 }
10690
10692 {
10694 {
10695 #ifdef DEVELOPER
10696 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10697 {
10698 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10700 }
10701 #endif
10702
10703 return GetQuantity() * GetConfigWeightModified();
10704 }
10705 else if (HasEnergyManager())
10706 {
10707 #ifdef DEVELOPER
10708 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10709 {
10710 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10711 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10712 }
10713 #endif
10714 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10715 }
10716 else
10717 {
10718 #ifdef DEVELOPER
10719 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10720 {
10721 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10722 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10723 }
10724 #endif
10725 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10726 }
10727 }
10728
10731 {
10732 int item_count = 0;
10734
10735 GameInventory inventory = GetInventory();
10736 CargoBase cargo = inventory.
GetCargo();
10737 if (cargo != NULL)
10738 {
10740 }
10741
10743 for (int i = 0; i < nAttachments; ++i)
10744 {
10746 if (item)
10747 item_count += item.GetNumberOfItems();
10748 }
10749 return item_count;
10750 }
10751
10754 {
10755 float weight = 0;
10756 float wetness = 1;
10757 if (include_wetness)
10760 {
10761 weight = wetness * m_ConfigWeight;
10762 }
10764 {
10765 weight = 1;
10766 }
10767 return weight;
10768 }
10769
10770
10771
10773 {
10774 GameInventory inventory = GetInventory();
10775 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10776 {
10777 array<EntityAI> items = new array<EntityAI>;
10779 for (int i = 0; i < items.Count(); ++i)
10780 {
10782 if (item)
10783 {
10784 g_Game.ObjectDelete(item);
10785 }
10786 }
10787 }
10788 }
10789
10790
10791
10792
10794 {
10795 float energy = 0;
10796 if (HasEnergyManager())
10797 {
10798 energy = GetCompEM().GetEnergy();
10799 }
10800 return energy;
10801 }
10802
10803
10805 {
10806 super.OnEnergyConsumed();
10807
10809 }
10810
10812 {
10813 super.OnEnergyAdded();
10814
10816 }
10817
10818
10820 {
10821 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10822 {
10824 {
10825 float energy_0to1 = GetCompEM().GetEnergy0To1();
10827 }
10828 }
10829 }
10830
10831
10833 {
10834 return ConfigGetFloat("heatIsolation");
10835 }
10836
10838 {
10840 }
10841
10843 {
10844 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10845 if (
g_Game.ConfigIsExisting(paramPath))
10846 return g_Game.ConfigGetFloat(paramPath);
10847
10848 return 0.0;
10849 }
10850
10852 {
10853 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10854 if (
g_Game.ConfigIsExisting(paramPath))
10855 return g_Game.ConfigGetFloat(paramPath);
10856
10857 return 0.0;
10858 }
10859
10860 override void SetWet(
float value,
bool allow_client =
false)
10861 {
10862 if (!IsServerCheck(allow_client))
10863 return;
10864
10867
10869
10870 m_VarWet = Math.Clamp(value, min, max);
10871
10873 {
10876 }
10877 }
10878
10879 override void AddWet(
float value)
10880 {
10882 }
10883
10885 {
10887 }
10888
10890 {
10892 }
10893
10895 {
10897 }
10898
10900 {
10902 }
10903
10905 {
10907 }
10908
10909 override void OnWetChanged(
float newVal,
float oldVal)
10910 {
10913 if (newLevel != oldLevel)
10914 {
10916 }
10917 }
10918
10920 {
10921 SetWeightDirty();
10922 }
10923
10925 {
10926 return GetWetLevelInternal(
m_VarWet);
10927 }
10928
10929
10930
10932 {
10934 }
10935
10937 {
10939 }
10940
10942 {
10944 }
10945
10947 {
10949 }
10950
10951
10952
10954 {
10955 if (ConfigIsExisting("itemModelLength"))
10956 {
10957 return ConfigGetFloat("itemModelLength");
10958 }
10959 return 0;
10960 }
10961
10963 {
10964 if (ConfigIsExisting("itemAttachOffset"))
10965 {
10966 return ConfigGetFloat("itemAttachOffset");
10967 }
10968 return 0;
10969 }
10970
10971 override void SetCleanness(
int value,
bool allow_client =
false)
10972 {
10973 if (!IsServerCheck(allow_client))
10974 return;
10975
10977
10979
10982 }
10983
10985 {
10987 }
10988
10990 {
10991 return true;
10992 }
10993
10994
10995
10996
10998 {
11000 }
11001
11003 {
11005 }
11006
11007
11008
11009
11010 override void SetColor(
int r,
int g,
int b,
int a)
11011 {
11017 }
11019 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11020 {
11025 }
11026
11028 {
11030 }
11031
11034 {
11035 int r,g,b,a;
11037 r = r/255;
11038 g = g/255;
11039 b = b/255;
11040 a = a/255;
11041 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11042 }
11043
11044
11045
11046 override void SetLiquidType(
int value,
bool allow_client =
false)
11047 {
11048 if (!IsServerCheck(allow_client))
11049 return;
11050
11055 }
11056
11058 {
11059 return ConfigGetInt("varLiquidTypeInit");
11060 }
11061
11063 {
11065 }
11066
11068 {
11070 SetFrozen(false);
11071 }
11072
11075 {
11076 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11077 }
11078
11079
11082 {
11083 PlayerBase nplayer;
11084 if (PlayerBase.CastTo(nplayer, player))
11085 {
11087 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11088 }
11089 }
11090
11091
11094 {
11095 PlayerBase nplayer;
11096 if (PlayerBase.CastTo(nplayer,player))
11097 {
11098 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11099 }
11100
11101 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11102
11103 if (HasEnergyManager())
11104 {
11105 GetCompEM().UpdatePlugState();
11106 }
11107 }
11108
11109
11111 {
11112 super.OnPlacementStarted(player);
11113
11115 }
11116
11117 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11118 {
11120 {
11121 m_AdminLog.OnPlacementComplete(player,
this);
11122 }
11123
11124 super.OnPlacementComplete(player, position, orientation);
11125 }
11126
11127
11128
11129
11130
11132 {
11134 {
11135 return true;
11136 }
11137 else
11138 {
11139 return false;
11140 }
11141 }
11142
11143
11145 {
11147 {
11149 }
11150 }
11151
11152
11154 {
11156 }
11157
11159 {
11161 }
11162
11163 override void InsertAgent(
int agent,
float count = 1)
11164 {
11165 if (count < 1)
11166 return;
11167
11169 }
11170
11173 {
11175 }
11176
11177
11179 {
11181 }
11182
11183
11184
11185
11186
11187
11188
11189
11190
11191
11192
11193
11194
11195
11196
11197
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11225 {
11227 return false;
11228 return true;
11229 }
11230
11232 {
11233
11235 }
11236
11237
11240 {
11241 super.CheckForRoofLimited(timeTresholdMS);
11242
11243 float time =
g_Game.GetTime();
11244 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11245 {
11246 m_PreviousRoofTestTime = time;
11247 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11248 }
11249 }
11250
11251
11253 {
11255 {
11256 return 0;
11257 }
11258
11259 if (GetInventory().GetAttachmentSlotsCount() != 0)
11260 {
11261 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11262 if (filter)
11263 return filter.GetProtectionLevel(type, false, system);
11264 else
11265 return 0;
11266 }
11267
11268 string subclassPath, entryName;
11269
11270 switch (type)
11271 {
11273 entryName = "biological";
11274 break;
11276 entryName = "chemical";
11277 break;
11278 default:
11279 entryName = "biological";
11280 break;
11281 }
11282
11283 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11284
11285 return g_Game.ConfigGetFloat(subclassPath + entryName);
11286 }
11287
11288
11289
11292 {
11293 if (!IsMagazine())
11295
11297 }
11298
11299
11300
11301
11302
11307 {
11308 return true;
11309 }
11310
11312 {
11314 }
11315
11316
11317
11318
11319
11321 {
11322 if (parent)
11323 {
11324 if (parent.IsInherited(DayZInfected))
11325 return true;
11326
11327 if (!parent.IsRuined())
11328 return true;
11329 }
11330
11331 return true;
11332 }
11333
11335 {
11336 if (!super.CanPutAsAttachment(parent))
11337 {
11338 return false;
11339 }
11340
11341 if (!IsRuined() && !parent.IsRuined())
11342 {
11343 return true;
11344 }
11345
11346 return false;
11347 }
11348
11350 {
11351
11352
11353
11354
11355 return super.CanReceiveItemIntoCargo(item);
11356 }
11357
11359 {
11360
11361
11362
11363
11364 GameInventory attachmentInv = attachment.GetInventory();
11366 {
11367 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11368 return false;
11369 }
11370
11371 InventoryLocation loc = new InventoryLocation();
11372 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11373 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11374 return false;
11375
11376 return super.CanReceiveAttachment(attachment, slotId);
11377 }
11378
11380 {
11381 if (!super.CanReleaseAttachment(attachment))
11382 return false;
11383
11384 return GetInventory().AreChildrenAccessible();
11385 }
11386
11387
11388
11389
11390
11391
11392
11393
11394
11395
11396
11397
11398
11399
11400
11401
11402
11403
11404
11405
11406
11408 {
11409 int id = muzzle_owner.GetMuzzleID();
11410 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11411
11412 if (WPOF_array)
11413 {
11414 for (int i = 0; i < WPOF_array.Count(); i++)
11415 {
11416 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11417
11418 if (WPOF)
11419 {
11420 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11421 }
11422 }
11423 }
11424 }
11425
11426
11428 {
11429 int id = muzzle_owner.GetMuzzleID();
11431
11432 if (WPOBE_array)
11433 {
11434 for (int i = 0; i < WPOBE_array.Count(); i++)
11435 {
11436 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11437
11438 if (WPOBE)
11439 {
11440 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11441 }
11442 }
11443 }
11444 }
11445
11446
11448 {
11449 int id = muzzle_owner.GetMuzzleID();
11450 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11451
11452 if (WPOOH_array)
11453 {
11454 for (int i = 0; i < WPOOH_array.Count(); i++)
11455 {
11456 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11457
11458 if (WPOOH)
11459 {
11460 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11461 }
11462 }
11463 }
11464 }
11465
11466
11468 {
11469 int id = muzzle_owner.GetMuzzleID();
11470 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11471
11472 if (WPOOH_array)
11473 {
11474 for (int i = 0; i < WPOOH_array.Count(); i++)
11475 {
11476 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11477
11478 if (WPOOH)
11479 {
11480 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11481 }
11482 }
11483 }
11484 }
11485
11486
11488 {
11489 int id = muzzle_owner.GetMuzzleID();
11490 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11491
11492 if (WPOOH_array)
11493 {
11494 for (int i = 0; i < WPOOH_array.Count(); i++)
11495 {
11496 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11497
11498 if (WPOOH)
11499 {
11500 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11501 }
11502 }
11503 }
11504 }
11505
11506
11507
11509 {
11511 {
11512 return true;
11513 }
11514
11515 return false;
11516 }
11517
11519 {
11521 {
11522 return true;
11523 }
11524
11525 return false;
11526 }
11527
11529 {
11531 {
11532 return true;
11533 }
11534
11535 return false;
11536 }
11537
11539 {
11540 return false;
11541 }
11542
11545 {
11546 return UATimeSpent.DEFAULT_DEPLOY;
11547 }
11548
11549
11550
11551
11553 {
11555 SetSynchDirty();
11556 }
11557
11559 {
11561 }
11562
11563
11565 {
11566 return false;
11567 }
11568
11571 {
11572 string att_type = "None";
11573
11574 if (ConfigIsExisting("soundAttType"))
11575 {
11576 att_type = ConfigGetString("soundAttType");
11577 }
11578
11580 }
11581
11583 {
11585 }
11586
11587
11588
11589
11590
11596
11598 {
11601
11603 }
11604
11605
11607 {
11609 return;
11610
11612
11615
11618
11619 SoundParameters params = new SoundParameters();
11623 }
11624
11625
11627 {
11629 {
11632
11633 SetSynchDirty();
11634
11637 }
11638 }
11639
11641 {
11643 }
11644
11645
11647 {
11649 return;
11650
11652 SetSynchDirty();
11653
11656 }
11657
11659 {
11662 }
11663
11665 {
11667 }
11668
11669 void OnApply(PlayerBase player);
11670
11672 {
11673 return 1.0;
11674 };
11675
11677 {
11679 }
11680
11682 {
11684 }
11685
11687
11689 {
11690 SetDynamicPhysicsLifeTime(0.01);
11692 }
11693
11695 {
11696 array<string> zone_names = new array<string>;
11697 GetDamageZones(zone_names);
11698 for (int i = 0; i < zone_names.Count(); i++)
11699 {
11700 SetHealthMax(zone_names.Get(i),"Health");
11701 }
11702 SetHealthMax("","Health");
11703 }
11704
11707 {
11708 float global_health = GetHealth01("","Health");
11709 array<string> zones = new array<string>;
11710 GetDamageZones(zones);
11711
11712 for (int i = 0; i < zones.Count(); i++)
11713 {
11714 SetHealth01(zones.Get(i),"Health",global_health);
11715 }
11716 }
11717
11720 {
11721 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11722 }
11723
11725 {
11726 if (!hasRootAsPlayer)
11727 {
11728 if (refParentIB)
11729 {
11730
11731 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11732 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11733
11734 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11735 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11736
11739 }
11740 else
11741 {
11742
11745 }
11746 }
11747 }
11748
11750 {
11752 {
11753 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11754 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11755 {
11756 float heatPermCoef = 1.0;
11758 while (ent)
11759 {
11760 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11761 ent = ent.GetHierarchyParent();
11762 }
11763
11764 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11765 }
11766 }
11767 }
11768
11770 {
11771
11772 EntityAI parent = GetHierarchyParent();
11773 if (!parent)
11774 {
11775 hasParent = false;
11776 hasRootAsPlayer = false;
11777 }
11778 else
11779 {
11780 hasParent = true;
11781 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11782 refParentIB =
ItemBase.Cast(parent);
11783 }
11784 }
11785
11786 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11787 {
11788
11789 }
11790
11792 {
11793
11794 return false;
11795 }
11796
11798 {
11799
11800
11801 return false;
11802 }
11803
11805 {
11806
11807 return false;
11808 }
11809
11812 {
11813 return !GetIsFrozen() &&
IsOpen();
11814 }
11815
11817 {
11818 bool hasParent = false, hasRootAsPlayer = false;
11820
11821 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11822 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11823
11824 if (wwtu || foodDecay)
11825 {
11829
11830 if (processWetness || processTemperature || processDecay)
11831 {
11833
11834 if (processWetness)
11835 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11836
11837 if (processTemperature)
11839
11840 if (processDecay)
11841 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11842 }
11843 }
11844 }
11845
11848 {
11850 }
11851
11853 {
11856
11857 return super.GetTemperatureFreezeThreshold();
11858 }
11859
11861 {
11864
11865 return super.GetTemperatureThawThreshold();
11866 }
11867
11869 {
11872
11873 return super.GetItemOverheatThreshold();
11874 }
11875
11877 {
11879 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11880
11881 return super.GetTemperatureFreezeTime();
11882 }
11883
11885 {
11887 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11888
11889 return super.GetTemperatureThawTime();
11890 }
11891
11896
11898 {
11899 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11900 }
11901
11903 {
11904 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11905 }
11906
11909 {
11911 }
11912
11914 {
11916 }
11917
11919 {
11921 }
11922
11925 {
11926 return null;
11927 }
11928
11931 {
11932 return false;
11933 }
11934
11936 {
11938 {
11941 if (!trg)
11942 {
11944 explosive = this;
11945 }
11946
11947 explosive.PairRemote(trg);
11949
11950 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11951 trg.SetPersistentPairID(persistentID);
11952 explosive.SetPersistentPairID(persistentID);
11953
11954 return true;
11955 }
11956 return false;
11957 }
11958
11961 {
11962 float ret = 1.0;
11965 ret *= GetHealth01();
11966
11967 return ret;
11968 }
11969
11970 #ifdef DEVELOPER
11971 override void SetDebugItem()
11972 {
11973 super.SetDebugItem();
11974 _itemBase = this;
11975 }
11976
11978 {
11979 string text = super.GetDebugText();
11980
11982 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11983
11984 return text;
11985 }
11986 #endif
11987
11989 {
11990 return true;
11991 }
11992
11994
11996
11998 {
12001 }
12002
12003
12011
12027
12028 [
Obsolete(
"Use ItemSoundHandler instead")]
12031 {
12032 if (!
g_Game.IsDedicatedServer())
12033 {
12034 if (ConfigIsExisting("attachSoundSet"))
12035 {
12036 string cfg_path = "";
12037 string soundset = "";
12038 string type_name =
GetType();
12039
12042 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12043 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12044
12045 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12046 {
12047 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12048 {
12049 if (cfg_slot_array[i] == slot_type)
12050 {
12051 soundset = cfg_soundset_array[i];
12052 break;
12053 }
12054 }
12055 }
12056
12057 if (soundset != "")
12058 {
12059 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12061 }
12062 }
12063 }
12064 }
12065
12067}
12068
12070{
12072 if (entity)
12073 {
12074 bool is_item = entity.IsInherited(
ItemBase);
12075 if (is_item && full_quantity)
12076 {
12079 }
12080 }
12081 else
12082 {
12084 return NULL;
12085 }
12086 return entity;
12087}
12088
12090{
12091 if (item)
12092 {
12093 if (health > 0)
12094 item.SetHealth("", "", health);
12095
12096 if (item.CanHaveTemperature())
12097 {
12099 if (item.CanFreeze())
12100 item.SetFrozen(false);
12101 }
12102
12103 if (item.HasEnergyManager())
12104 {
12105 if (quantity >= 0)
12106 {
12107 item.GetCompEM().SetEnergy0To1(quantity);
12108 }
12109 else
12110 {
12112 }
12113 }
12114 else if (item.IsMagazine())
12115 {
12116 Magazine mag = Magazine.Cast(item);
12117 if (quantity >= 0)
12118 {
12119 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12120 }
12121 else
12122 {
12124 }
12125
12126 }
12127 else
12128 {
12129 if (quantity >= 0)
12130 {
12131 item.SetQuantityNormalized(quantity, false);
12132 }
12133 else
12134 {
12136 }
12137
12138 }
12139 }
12140}
12141
12142#ifdef DEVELOPER
12144#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.