7087{
7089 {
7090 return true;
7091 }
7092};
7093
7094
7095
7097{
7101
7103
7106
7107
7108
7109
7110
7119
7125
7130
7135
7156 protected bool m_IsResultOfSplit
7157
7159
7164
7165
7166
7168
7172
7173
7174
7176
7179
7180
7181
7187
7188
7196
7199
7200
7202
7203
7205
7206
7211
7212
7217
7218
7220
7221
7223 {
7228
7229 if (!
GetGame().IsDedicatedServer())
7230 {
7232 {
7234
7236 {
7238 }
7239 }
7240
7243 }
7244
7245 m_OldLocation = null;
7246
7248 {
7250 }
7251
7252 if (ConfigIsExisting("headSelectionsToHide"))
7253 {
7256 }
7257
7259 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7260 {
7262 }
7263
7265
7266 m_IsResultOfSplit = false;
7267
7269 }
7270
7272 {
7273 super.InitItemVariables();
7274
7280 m_Count = ConfigGetInt(
"count");
7281
7284
7289
7292
7297
7309
7313
7314
7317 if (ConfigIsExisting("canBeSplit"))
7318 {
7321 }
7322
7324 if (ConfigIsExisting("itemBehaviour"))
7326
7327
7330 RegisterNetSyncVariableInt("m_VarLiquidType");
7331 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7332
7333 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7334 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7335 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7336
7337 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7338 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7339 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7340 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7341
7342 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7343 RegisterNetSyncVariableBool("m_IsTakeable");
7344 RegisterNetSyncVariableBool("m_IsHologram");
7345
7348 {
7351 }
7352
7354
7356 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7358
7359 }
7360
7362 {
7364 }
7365
7367 {
7370 {
7375 }
7376 }
7377
7378 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7379 {
7381 {
7384 }
7385
7387 }
7388
7390 {
7396 }
7397
7399
7401 {
7403
7404 if (!action)
7405 {
7406 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7407 return;
7408 }
7409
7411 if (!ai)
7412 {
7414 return;
7415 }
7416
7418 if (!action_array)
7419 {
7420 action_array = new array<ActionBase_Basic>;
7422 }
7423 if (LogManager.IsActionLogEnable())
7424 {
7425 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7426 }
7427
7428 if (action_array.Find(action) != -1)
7429 {
7430 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7431 }
7432 else
7433 {
7434 action_array.Insert(action);
7435 }
7436 }
7437
7439 {
7441 ActionBase action = player.GetActionManager().GetAction(actionName);
7444
7445 if (action_array)
7446 {
7447 action_array.RemoveItem(action);
7448 }
7449 }
7450
7451
7452
7454 {
7455 ActionOverrideData overrideData = new ActionOverrideData();
7459
7461 if (!actionMap)
7462 {
7465 }
7466
7467 actionMap.Insert(this.
Type(), overrideData);
7468
7469 }
7470
7472
7474
7475
7477 {
7480
7483
7484 string config_to_search = "CfgVehicles";
7485 string muzzle_owner_config;
7486
7488 {
7489 if (IsInherited(Weapon))
7490 config_to_search = "CfgWeapons";
7491
7492 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7493
7494 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7495
7497
7498 if (config_OnFire_subclass_count > 0)
7499 {
7500 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7501
7502 for (int i = 0; i < config_OnFire_subclass_count; i++)
7503 {
7504 string particle_class = "";
7506 string config_OnFire_entry = config_OnFire_class + particle_class;
7507 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7508 WPOF_array.Insert(WPOF);
7509 }
7510
7511
7513 }
7514 }
7515
7517 {
7518 config_to_search = "CfgWeapons";
7519 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7520
7521 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7522
7524
7525 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7526 {
7527 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7528
7529 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7530 {
7531 string particle_class2 = "";
7533 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7534 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7535 WPOBE_array.Insert(WPOBE);
7536 }
7537
7538
7540 }
7541 }
7542 }
7543
7544
7546 {
7549
7551 {
7552 string config_to_search = "CfgVehicles";
7553
7554 if (IsInherited(Weapon))
7555 config_to_search = "CfgWeapons";
7556
7557 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7558 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7559
7560 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
7561 {
7562
7564
7566 {
7568 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7570 return;
7571 }
7572
7575
7576
7577
7579 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7580
7581 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7582 {
7583 string particle_class = "";
7585 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7587
7588 if (entry_type == CT_CLASS)
7589 {
7590 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7591 WPOOH_array.Insert(WPOF);
7592 }
7593 }
7594
7595
7597 }
7598 }
7599 }
7600
7602 {
7604 }
7605
7607 {
7609 {
7611
7614
7617
7618 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7619 }
7620 }
7621
7623 {
7625 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7626
7628 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7629
7631 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7632
7634 {
7636 }
7637 }
7638
7640 {
7642 }
7643
7645 {
7648 else
7650
7652 {
7655 }
7656 else
7657 {
7660
7663 }
7664
7666 }
7667
7669 {
7671 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7672 }
7673
7675 {
7677 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7679 }
7680
7682 {
7684 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7685 }
7686
7688 {
7691
7692 OverheatingParticle OP = new OverheatingParticle();
7697
7699 }
7700
7702 {
7705
7706 return -1;
7707 }
7708
7710 {
7712 {
7715
7716 for (int i = count; i > 0; --i)
7717 {
7718 int id = i - 1;
7721
7724
7725 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7726 {
7727 if (p)
7728 {
7731 }
7732 }
7733 }
7734 }
7735 }
7736
7738 {
7740 {
7742 {
7743 int id = i - 1;
7745
7746 if (OP)
7747 {
7749
7750 if (p)
7751 {
7753 }
7754
7755 delete OP;
7756 }
7757 }
7758
7761 }
7762 }
7763
7766 {
7767 return 0.0;
7768 }
7769
7770
7772 {
7773 return 250;
7774 }
7775
7777 {
7778 return 0;
7779 }
7780
7783 {
7785 return true;
7786
7787 return false;
7788 }
7789
7792 {
7795
7797 {
7799 }
7800 else
7801 {
7802
7804 }
7805
7807 }
7808
7815 {
7816 return -1;
7817 }
7818
7819
7820
7821
7823 {
7825 {
7827 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7828
7829 if (r_index >= 0)
7830 {
7831 InventoryLocation r_il = new InventoryLocation;
7832 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7833
7834 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7837 {
7838 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7839 }
7841 {
7842 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7843 }
7844
7845 }
7846
7847 player.GetHumanInventory().ClearUserReservedLocation(this);
7848 }
7849
7852 }
7853
7854
7855
7856
7858 {
7859 return ItemBase.m_DebugActionsMask;
7860 }
7861
7863 {
7864 return ItemBase.m_DebugActionsMask & mask;
7865 }
7866
7868 {
7869 ItemBase.m_DebugActionsMask = mask;
7870 }
7871
7873 {
7874 ItemBase.m_DebugActionsMask |= mask;
7875 }
7876
7878 {
7879 ItemBase.m_DebugActionsMask &= ~mask;
7880 }
7881
7883 {
7885 {
7887 }
7888 else
7889 {
7891 }
7892 }
7893
7894
7896 {
7897 if (GetEconomyProfile())
7898 {
7899 float q_max = GetEconomyProfile().GetQuantityMax();
7900 if (q_max > 0)
7901 {
7902 float q_min = GetEconomyProfile().GetQuantityMin();
7903 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7904
7906 {
7907 ComponentEnergyManager comp = GetCompEM();
7909 {
7911 }
7912 }
7914 {
7916
7917 }
7918
7919 }
7920 }
7921 }
7922
7925 {
7926 EntityAI parent = GetHierarchyParent();
7927
7928 if (parent)
7929 {
7930 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7931 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7932 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7933 }
7934 }
7935
7938 {
7939 EntityAI parent = GetHierarchyParent();
7940
7941 if (parent)
7942 {
7943 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7944 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7945 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7946 }
7947 }
7948
7950 {
7951
7952
7953
7954
7956
7958 {
7959 if (ScriptInputUserData.CanStoreInputUserData())
7960 {
7961 ScriptInputUserData ctx = new ScriptInputUserData;
7967 ctx.
Write(use_stack_max);
7970
7972 {
7973 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7974 }
7975 }
7976 }
7977 else if (!
GetGame().IsMultiplayer())
7978 {
7980 }
7981 }
7982
7984 {
7986 }
7987
7989 {
7991 }
7992
7994 {
7996 }
7997
7999 {
8000
8001 return false;
8002 }
8003
8005 {
8006 return false;
8007 }
8008
8012 {
8013 return false;
8014 }
8015
8017 {
8018 return "";
8019 }
8020
8022
8024 {
8025 return false;
8026 }
8027
8029 {
8030 return true;
8031 }
8032
8033
8034
8036 {
8037 return true;
8038 }
8039
8041 {
8042 return true;
8043 }
8044
8046 {
8047 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8049 }
8050
8052 {
8054 }
8055
8057 {
8059 if (!is_being_placed)
8061 SetSynchDirty();
8062 }
8063
8064
8066
8068 {
8070 }
8071
8073 {
8075 }
8076
8078 {
8079 return 1;
8080 }
8081
8083 {
8084 return false;
8085 }
8086
8088 {
8090 SetSynchDirty();
8091 }
8092
8093
8094
8095
8096
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8128 {
8129 super.OnMovedInsideCargo(container);
8130
8131 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8132 }
8133
8134 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8135 {
8136 super.EEItemLocationChanged(oldLoc,newLoc);
8137
8138 PlayerBase new_player = null;
8139 PlayerBase old_player = null;
8140
8141 if (newLoc.GetParent())
8142 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8143
8144 if (oldLoc.GetParent())
8145 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8146
8148 {
8149 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
8150
8151 if (r_index >= 0)
8152 {
8153 InventoryLocation r_il = new InventoryLocation;
8154 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8155
8156 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8159 {
8160 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8161 }
8163 {
8164 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8165 }
8166
8167 }
8168 }
8169
8171 {
8172 if (new_player)
8173 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
8174
8175 if (new_player == old_player)
8176 {
8177
8178 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8179 {
8181 {
8182 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8183 {
8184 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8185 }
8186 }
8187 else
8188 {
8189 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8190 }
8191 }
8192
8193 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8194 {
8195 int type = oldLoc.GetType();
8197 {
8198 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8199 }
8201 {
8202 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8203 }
8204 }
8205 if (!m_OldLocation)
8206 {
8207 m_OldLocation = new InventoryLocation;
8208 }
8209 m_OldLocation.Copy(oldLoc);
8210 }
8211 else
8212 {
8213 if (m_OldLocation)
8214 {
8215 m_OldLocation.Reset();
8216 }
8217 }
8218
8220 }
8221 else
8222 {
8223 if (new_player)
8224 {
8225 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8226 if (res_index >= 0)
8227 {
8228 InventoryLocation il = new InventoryLocation;
8229 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
8231 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
8234 {
8235 il.
GetParent().GetOnReleaseLock().Invoke(it);
8236 }
8238 {
8240 }
8241
8242 }
8243 }
8245 {
8246
8248 }
8249
8250 if (m_OldLocation)
8251 {
8252 m_OldLocation.Reset();
8253 }
8254 }
8255 }
8256
8257 override void EOnContact(IEntity other, Contact extra)
8258 {
8260 {
8261 int liquidType = -1;
8263 if (impactSpeed > 0.0)
8264 {
8266 #ifndef SERVER
8268 #else
8270 SetSynchDirty();
8271 #endif
8273 }
8274 }
8275
8276 #ifdef SERVER
8277 if (GetCompEM() && GetCompEM().IsPlugged())
8278 {
8279 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8280 GetCompEM().UnplugThis();
8281 }
8282 #endif
8283 }
8284
8286
8288 {
8290 }
8291
8293 {
8294
8295 }
8296
8298 {
8299 super.OnItemLocationChanged(old_owner, new_owner);
8300
8301 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8302 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8303
8304 if (!relatedPlayer && playerNew)
8305 relatedPlayer = playerNew;
8306
8307 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8308 {
8310 if (actionMgr)
8311 {
8312 ActionBase currentAction = actionMgr.GetRunningAction();
8313 if (currentAction)
8315 }
8316 }
8317
8318 Man ownerPlayerOld = null;
8319 Man ownerPlayerNew = null;
8320
8321 if (old_owner)
8322 {
8323 if (old_owner.
IsMan())
8324 {
8325 ownerPlayerOld = Man.Cast(old_owner);
8326 }
8327 else
8328 {
8329 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8330 }
8331 }
8332 else
8333 {
8335 {
8337
8338 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8339 {
8340 GetCompEM().UnplugThis();
8341 }
8342 }
8343 }
8344
8345 if (new_owner)
8346 {
8347 if (new_owner.
IsMan())
8348 {
8349 ownerPlayerNew = Man.Cast(new_owner);
8350 }
8351 else
8352 {
8353 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8354 }
8355 }
8356
8357 if (ownerPlayerOld != ownerPlayerNew)
8358 {
8359 if (ownerPlayerOld)
8360 {
8361 array<EntityAI> subItemsExit = new array<EntityAI>;
8363 for (int i = 0; i < subItemsExit.Count(); i++)
8364 {
8367 }
8368 }
8369
8370 if (ownerPlayerNew)
8371 {
8372 array<EntityAI> subItemsEnter = new array<EntityAI>;
8374 for (int j = 0; j < subItemsEnter.Count(); j++)
8375 {
8378 }
8379 }
8380 }
8381 else if (ownerPlayerNew != null)
8382 {
8383 PlayerBase nplayer;
8384 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8385 {
8386 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8388 for (int k = 0; k < subItemsUpdate.Count(); k++)
8389 {
8391 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8392 }
8393 }
8394 }
8395
8396 if (old_owner)
8397 old_owner.OnChildItemRemoved(this);
8398 if (new_owner)
8399 new_owner.OnChildItemReceived(this);
8400 }
8401
8402
8404 {
8405 super.EEDelete(parent);
8406 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8407 if (player)
8408 {
8410
8411 if (player.IsAlive())
8412 {
8413 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8414 if (r_index >= 0)
8415 {
8416 InventoryLocation r_il = new InventoryLocation;
8417 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8418
8419 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8422 {
8423 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8424 }
8426 {
8427 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8428 }
8429
8430 }
8431
8432 player.RemoveQuickBarEntityShortcut(this);
8433 }
8434 }
8435 }
8436
8438 {
8439 super.EEKilled(killer);
8440
8443 {
8444 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8445 {
8446 if (IsMagazine())
8447 {
8448 if (Magazine.Cast(this).GetAmmoCount() > 0)
8449 {
8451 }
8452 }
8453 else
8454 {
8456 }
8457 }
8458 }
8459 }
8460
8462 {
8463 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8464
8465 super.OnWasAttached(parent, slot_id);
8466
8469
8471 }
8472
8474 {
8475 super.OnWasDetached(parent, slot_id);
8476
8479 }
8480
8482 {
8483 int idx;
8486
8487 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8488 if (inventory_slots.Count() < 1)
8489 {
8490 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8491 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8492 }
8493 else
8494 {
8495 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8496 }
8497
8498 idx = inventory_slots.Find(slot);
8499 if (idx < 0)
8500 return "";
8501
8502 return attach_types.Get(idx);
8503 }
8504
8506 {
8507 int idx = -1;
8508 string slot;
8509
8512
8513 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8514 if (inventory_slots.Count() < 1)
8515 {
8516 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8517 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8518 }
8519 else
8520 {
8521 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8522 if (detach_types.Count() < 1)
8523 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8524 }
8525
8526 for (int i = 0; i < inventory_slots.Count(); i++)
8527 {
8528 slot = inventory_slots.Get(i);
8529 }
8530
8531 if (slot != "")
8532 {
8533 if (detach_types.Count() == 1)
8534 idx = 0;
8535 else
8536 idx = inventory_slots.Find(slot);
8537 }
8538 if (idx < 0)
8539 return "";
8540
8541 return detach_types.Get(idx);
8542 }
8543
8545 {
8546
8548
8549
8550 float min_time = 1;
8551 float max_time = 3;
8552 float delay = Math.RandomFloat(min_time, max_time);
8553
8554 explode_timer.Run(delay, this, "DoAmmoExplosion");
8555 }
8556
8558 {
8559 Magazine magazine = Magazine.Cast(this);
8560 int pop_sounds_count = 6;
8561 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8562
8563
8564 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8565 string sound_name = pop_sounds[ sound_idx ];
8567
8568
8569 magazine.ServerAddAmmoCount(-1);
8570
8571
8572 float min_temp_to_explode = 100;
8573
8574 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8575 {
8577 }
8578 }
8579
8580
8581 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8582 {
8583 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8584
8585 const int CHANCE_DAMAGE_CARGO = 4;
8586 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8587 const int CHANCE_DAMAGE_NOTHING = 2;
8588
8590 {
8591 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8592 int chances;
8593 int rnd;
8594
8595 if (GetInventory().GetCargo())
8596 {
8597 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8598 rnd = Math.RandomInt(0,chances);
8599
8600 if (rnd < CHANCE_DAMAGE_CARGO)
8601 {
8603 }
8604 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8605 {
8607 }
8608 }
8609 else
8610 {
8611 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8612 rnd = Math.RandomInt(0,chances);
8613
8614 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8615 {
8617 }
8618 }
8619 }
8620 }
8621
8623 {
8624 if (GetInventory().GetCargo())
8625 {
8626 int item_count = GetInventory().GetCargo().GetItemCount();
8627 if (item_count > 0)
8628 {
8629 int random_pick = Math.RandomInt(0, item_count);
8631 if (!item.IsExplosive())
8632 {
8633 item.AddHealth("","",damage);
8634 return true;
8635 }
8636 }
8637 }
8638 return false;
8639 }
8640
8642 {
8643 int attachment_count = GetInventory().AttachmentCount();
8644 if (attachment_count > 0)
8645 {
8646 int random_pick = Math.RandomInt(0, attachment_count);
8647 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
8648 if (!attachment.IsExplosive())
8649 {
8650 attachment.AddHealth("","",damage);
8651 return true;
8652 }
8653 }
8654 return false;
8655 }
8656
8658 {
8660 }
8661
8663 {
8665 return GetInventory().CanRemoveEntity();
8666
8667 return false;
8668 }
8669
8671 {
8672
8674 return false;
8675
8676
8678 return false;
8679
8680
8681
8683 if (delta == 0)
8684 return false;
8685
8686
8687 return true;
8688 }
8689
8691 {
8693 {
8694 if (ScriptInputUserData.CanStoreInputUserData())
8695 {
8696 ScriptInputUserData ctx = new ScriptInputUserData;
8701 ctx.
Write(destination_entity);
8705 }
8706 }
8707 else if (!
GetGame().IsMultiplayer())
8708 {
8710 }
8711 }
8712
8714 {
8715 float split_quantity_new;
8719 InventoryLocation loc = new InventoryLocation;
8720
8721 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8722 {
8724 split_quantity_new = stack_max;
8725 else
8727
8729 {
8730 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8731 if (new_item)
8732 {
8733 new_item.SetResultOfSplit(true);
8734 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8736 new_item.
SetQuantity(split_quantity_new,
false,
true);
8737 }
8738 }
8739 }
8740 else if (destination_entity && slot_id == -1)
8741 {
8742 if (quantity > stack_max)
8743 split_quantity_new = stack_max;
8744 else
8745 split_quantity_new = quantity;
8746
8748 {
8750 {
8753 }
8754
8755 if (new_item)
8756 {
8757 new_item.SetResultOfSplit(true);
8758 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8760 new_item.
SetQuantity(split_quantity_new,
false,
true);
8761 }
8762 }
8763 }
8764 else
8765 {
8766 if (stack_max != 0)
8767 {
8769 {
8771 }
8772
8773 if (split_quantity_new == 0)
8774 {
8775 if (!
GetGame().IsMultiplayer())
8776 player.PhysicalPredictiveDropItem(this);
8777 else
8778 player.ServerDropEntity(this);
8779 return;
8780 }
8781
8783 {
8785
8786 if (new_item)
8787 {
8788 new_item.SetResultOfSplit(true);
8789 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8792 new_item.PlaceOnSurface();
8793 }
8794 }
8795 }
8796 }
8797 }
8798
8800 {
8801 float split_quantity_new;
8805 InventoryLocation loc = new InventoryLocation;
8806
8807 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8808 {
8810 split_quantity_new = stack_max;
8811 else
8813
8815 {
8816 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8817 if (new_item)
8818 {
8819 new_item.SetResultOfSplit(true);
8820 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8822 new_item.
SetQuantity(split_quantity_new,
false,
true);
8823 }
8824 }
8825 }
8826 else if (destination_entity && slot_id == -1)
8827 {
8828 if (quantity > stack_max)
8829 split_quantity_new = stack_max;
8830 else
8831 split_quantity_new = quantity;
8832
8834 {
8836 {
8839 }
8840
8841 if (new_item)
8842 {
8843 new_item.SetResultOfSplit(true);
8844 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8846 new_item.
SetQuantity(split_quantity_new,
false,
true);
8847 }
8848 }
8849 }
8850 else
8851 {
8852 if (stack_max != 0)
8853 {
8855 {
8857 }
8858
8860 {
8862
8863 if (new_item)
8864 {
8865 new_item.SetResultOfSplit(true);
8866 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8869 new_item.PlaceOnSurface();
8870 }
8871 }
8872 }
8873 }
8874 }
8875
8877 {
8879 {
8880 if (ScriptInputUserData.CanStoreInputUserData())
8881 {
8882 ScriptInputUserData ctx = new ScriptInputUserData;
8887 dst.WriteToContext(ctx);
8889 }
8890 }
8891 else if (!
GetGame().IsMultiplayer())
8892 {
8894 }
8895 }
8896
8898 {
8900 {
8901 if (ScriptInputUserData.CanStoreInputUserData())
8902 {
8903 ScriptInputUserData ctx = new ScriptInputUserData;
8908 ctx.
Write(destination_entity);
8914 }
8915 }
8916 else if (!
GetGame().IsMultiplayer())
8917 {
8919 }
8920 }
8921
8923 {
8925 }
8926
8928 {
8930 float split_quantity_new;
8932 if (dst.IsValid())
8933 {
8934 int slot_id = dst.GetSlot();
8936
8937 if (quantity > stack_max)
8938 split_quantity_new = stack_max;
8939 else
8940 split_quantity_new = quantity;
8941
8943 {
8945
8946 if (new_item)
8947 {
8948 new_item.SetResultOfSplit(true);
8949 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8951 new_item.
SetQuantity(split_quantity_new,
false,
true);
8952 }
8953
8954 return new_item;
8955 }
8956 }
8957
8958 return null;
8959 }
8960
8962 {
8964 float split_quantity_new;
8966 if (destination_entity)
8967 {
8969 if (quantity > stackable)
8970 split_quantity_new = stackable;
8971 else
8972 split_quantity_new = quantity;
8973
8975 {
8976 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8977 if (new_item)
8978 {
8979 new_item.SetResultOfSplit(true);
8980 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8982 new_item.
SetQuantity(split_quantity_new,
false,
true);
8983 }
8984 }
8985 }
8986 }
8987
8989 {
8991 {
8992 if (ScriptInputUserData.CanStoreInputUserData())
8993 {
8994 ScriptInputUserData ctx = new ScriptInputUserData;
8999 ItemBase destination_entity =
this;
9000 ctx.
Write(destination_entity);
9004 }
9005 }
9006 else if (!
GetGame().IsMultiplayer())
9007 {
9009 }
9010 }
9011
9013 {
9015 float split_quantity_new;
9017 if (player)
9018 {
9020 if (quantity > stackable)
9021 split_quantity_new = stackable;
9022 else
9023 split_quantity_new = quantity;
9024
9026 {
9027 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9028 new_item =
ItemBase.Cast(in_hands);
9029 if (new_item)
9030 {
9031 new_item.SetResultOfSplit(true);
9032 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9034 new_item.SetQuantity(split_quantity_new, false, true);
9035 }
9036 }
9037 }
9038 }
9039
9041 {
9043 float split_quantity_new = Math.Floor(quantity * 0.5);
9044
9046 return;
9047
9049
9050 if (new_item)
9051 {
9052 if (new_item.GetQuantityMax() < split_quantity_new)
9053 {
9054 split_quantity_new = new_item.GetQuantityMax();
9055 }
9056
9057 new_item.SetResultOfSplit(true);
9058 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9059
9061 {
9064 }
9065 else
9066 {
9068 new_item.
SetQuantity(split_quantity_new,
false,
true);
9069 }
9070 }
9071 }
9072
9074 {
9076 float split_quantity_new = Math.Floor(quantity / 2);
9077
9079 return;
9080
9081 InventoryLocation invloc = new InventoryLocation;
9083
9085 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9086
9087 if (new_item)
9088 {
9089 if (new_item.GetQuantityMax() < split_quantity_new)
9090 {
9091 split_quantity_new = new_item.GetQuantityMax();
9092 }
9094 {
9097 }
9098 else if (split_quantity_new > 1)
9099 {
9101 new_item.
SetQuantity(split_quantity_new,
false,
true);
9102 }
9103 }
9104 }
9105
9108 {
9109 SetWeightDirty();
9111
9112 if (parent)
9113 parent.OnAttachmentQuantityChangedEx(this, delta);
9114
9116 {
9118 {
9120 }
9122 {
9123 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9125 }
9126 }
9127
9128 }
9129
9132 {
9133
9134 }
9135
9138 {
9140 }
9141
9143 {
9144 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9145
9147 {
9148 if (newLevel == GameConstants.STATE_RUINED)
9149 {
9151 EntityAI parent = GetHierarchyParent();
9152 if (parent && parent.IsFireplace())
9153 {
9154 CargoBase cargo = GetInventory().GetCargo();
9155 if (cargo)
9156 {
9158 {
9160 }
9161 }
9162 }
9163 }
9164
9166 {
9167
9169 return;
9170 }
9171
9172 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9173 {
9175 }
9176 }
9177 }
9178
9179
9181 {
9182 super.OnRightClick();
9183
9185 {
9187 {
9188 if (ScriptInputUserData.CanStoreInputUserData())
9189 {
9190 EntityAI root = GetHierarchyRoot();
9191 Man playerOwner = GetHierarchyRootPlayer();
9192 InventoryLocation dst = new InventoryLocation;
9193
9194
9195 if (!playerOwner && root && root == this)
9196 {
9198 }
9199 else
9200 {
9201
9202 GetInventory().GetCurrentInventoryLocation(dst);
9204 {
9207 {
9209 }
9210 else
9211 {
9213
9214
9215 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9216 {
9218 }
9219 else
9220 {
9221 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9222 }
9223 }
9224 }
9225 }
9226
9227 ScriptInputUserData ctx = new ScriptInputUserData;
9235 }
9236 }
9237 else if (!
GetGame().IsMultiplayer())
9238 {
9240 }
9241 }
9242 }
9243
9245 {
9246 if (root)
9247 {
9248 vector m4[4];
9249 root.GetTransform(m4);
9250 dst.SetGround(this, m4);
9251 }
9252 else
9253 {
9254 GetInventory().GetCurrentInventoryLocation(dst);
9255 }
9256 }
9257
9258 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9259 {
9260
9261 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9262 return false;
9263
9264 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9265 return false;
9266
9267
9269 return false;
9270
9271
9272 Magazine mag = Magazine.Cast(this);
9273 if (mag)
9274 {
9275 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9276 return false;
9277
9278 if (stack_max_limit)
9279 {
9280 Magazine other_mag = Magazine.Cast(other_item);
9281 if (other_item)
9282 {
9283 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9284 return false;
9285 }
9286
9287 }
9288 }
9289 else
9290 {
9291
9293 return false;
9294
9296 return false;
9297 }
9298
9299 PlayerBase player = null;
9300 if (CastTo(player, GetHierarchyRootPlayer()))
9301 {
9302 if (player.GetInventory().HasAttachment(this))
9303 return false;
9304
9305 if (player.IsItemsToDelete())
9306 return false;
9307 }
9308
9309 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9310 return false;
9311
9312 int slotID;
9314 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9315 return false;
9316
9317 return true;
9318 }
9319
9321 {
9323 }
9324
9326 {
9327 return m_IsResultOfSplit;
9328 }
9329
9331 {
9332 m_IsResultOfSplit = value;
9333 }
9334
9336 {
9338 }
9339
9341 {
9342 float other_item_quantity = other_item.GetQuantity();
9343 float this_free_space;
9344
9346
9348
9349 if (other_item_quantity > this_free_space)
9350 {
9351 return this_free_space;
9352 }
9353 else
9354 {
9355 return other_item_quantity;
9356 }
9357 }
9358
9360 {
9362 }
9363
9365 {
9367 return;
9368
9369 if (!IsMagazine() && other_item)
9370 {
9372 if (quantity_used != 0)
9373 {
9374 float hp1 = GetHealth01("","");
9375 float hp2 = other_item.GetHealth01("","");
9376 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9377 hpResult = hpResult / (
GetQuantity() + quantity_used);
9378
9379 hpResult *= GetMaxHealth();
9380 Math.Round(hpResult);
9381 SetHealth("", "Health", hpResult);
9382
9384 other_item.AddQuantity(-quantity_used);
9385 }
9386 }
9388 }
9389
9391 {
9392 #ifdef SERVER
9393 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9394 GetHierarchyParent().IncreaseLifetimeUp();
9395 #endif
9396 };
9397
9399 {
9400 PlayerBase p = PlayerBase.Cast(player);
9401
9402 array<int> recipesIds = p.m_Recipes;
9403 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9404 if (moduleRecipesManager)
9405 {
9406 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
9407 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9408 }
9409
9410 for (int i = 0;i < recipesIds.Count(); i++)
9411 {
9412 int key = recipesIds.Get(i);
9413 string recipeName = moduleRecipesManager.GetRecipeName(key);
9415 }
9416 }
9417
9418
9419 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9420 {
9421 super.GetDebugActions(outputList);
9422
9423
9429
9430
9435
9440
9441
9445
9446
9448 {
9452 }
9453
9456
9457
9461
9463
9464 InventoryLocation loc = new InventoryLocation();
9465 GetInventory().GetCurrentInventoryLocation(loc);
9467 {
9468 if (Gizmo_IsSupported())
9471 }
9472
9474 }
9475
9476
9477
9478
9480 {
9481 super.OnAction(action_id, player, ctx);
9482
9484 {
9485 switch (action_id)
9486 {
9489 return true;
9492 return true;
9493 }
9494 }
9495
9497 {
9498 switch (action_id)
9499 {
9501 Delete();
9502 return true;
9503 }
9504 }
9505
9506 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9507 {
9508 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9509 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9510 PlayerBase p = PlayerBase.Cast(player);
9511 if (
EActions.RECIPES_RANGE_START < 1000)
9512 {
9513 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9514 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9515 }
9516 }
9517 #ifndef SERVER
9518 else if (action_id ==
EActions.WATCH_PLAYER)
9519 {
9520 PluginDeveloper.SetDeveloperItemClientEx(player);
9521 }
9522 #endif
9524 {
9525 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9526 {
9527 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9528 OnDebugButtonPressServer(id + 1);
9529 }
9530
9531 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9532 {
9533 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9535 }
9536
9537 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9538 {
9539 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9541 }
9542
9543 else if (action_id ==
EActions.ADD_QUANTITY)
9544 {
9545 if (IsMagazine())
9546 {
9547 Magazine mag = Magazine.Cast(this);
9548 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9549 }
9550 else
9551 {
9553 }
9554
9555 if (m_EM)
9556 {
9557 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9558 }
9559
9560 }
9561
9562 else if (action_id ==
EActions.REMOVE_QUANTITY)
9563 {
9564 if (IsMagazine())
9565 {
9566 Magazine mag2 = Magazine.Cast(this);
9567 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9568 }
9569 else
9570 {
9572 }
9573 if (m_EM)
9574 {
9575 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9576 }
9577
9578 }
9579
9580 else if (action_id ==
EActions.SET_QUANTITY_0)
9581 {
9583
9584 if (m_EM)
9585 {
9586 m_EM.SetEnergy(0);
9587 }
9588 }
9589
9590 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9591 {
9593
9594 if (m_EM)
9595 {
9596 m_EM.SetEnergy(m_EM.GetEnergyMax());
9597 }
9598 }
9599
9600 else if (action_id ==
EActions.ADD_HEALTH)
9601 {
9602 AddHealth("","",GetMaxHealth("","Health")/5);
9603 }
9604 else if (action_id ==
EActions.REMOVE_HEALTH)
9605 {
9606 AddHealth("","",-GetMaxHealth("","Health")/5);
9607 }
9608 else if (action_id ==
EActions.DESTROY_HEALTH)
9609 {
9610 SetHealth01("","",0);
9611 }
9612 else if (action_id ==
EActions.WATCH_ITEM)
9613 {
9615 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9616 #ifdef DEVELOPER
9617 SetDebugDeveloper_item(this);
9618 #endif
9619 }
9620
9621 else if (action_id ==
EActions.ADD_TEMPERATURE)
9622 {
9623 AddTemperature(20);
9624
9625 }
9626
9627 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9628 {
9629 AddTemperature(-20);
9630
9631 }
9632
9633 else if (action_id ==
EActions.FLIP_FROZEN)
9634 {
9635 SetFrozen(!GetIsFrozen());
9636
9637 }
9638
9639 else if (action_id ==
EActions.ADD_WETNESS)
9640 {
9642
9643 }
9644
9645 else if (action_id ==
EActions.REMOVE_WETNESS)
9646 {
9648
9649 }
9650
9651 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9652 {
9655
9656
9657 }
9658
9659 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9660 {
9663 }
9664
9665 else if (action_id ==
EActions.MAKE_SPECIAL)
9666 {
9667 auto debugParams = DebugSpawnParams.WithPlayer(player);
9668 OnDebugSpawnEx(debugParams);
9669 }
9670
9671 }
9672
9673
9674 return false;
9675 }
9676
9677
9678
9679
9683
9686
9687
9688
9690 {
9691 return false;
9692 }
9693
9694
9696 {
9697 return true;
9698 }
9699
9700
9702 {
9703 return true;
9704 }
9705
9706
9707
9709 {
9710 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9712 }
9713
9716 {
9717 return null;
9718 }
9719
9721 {
9722 return false;
9723 }
9724
9726 {
9727 return false;
9728 }
9729
9733
9734
9736 {
9737 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9738 return module_repairing.CanRepair(this, item_repair_kit);
9739 }
9740
9741
9742 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9743 {
9744 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9745 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9746 }
9747
9748
9750 {
9751
9752
9753
9754
9755
9756
9757
9758
9759 return 1;
9760 }
9761
9762
9763
9765 {
9767 }
9768
9769
9770
9772 {
9774 }
9775
9776
9785 {
9786 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9787
9788 if (player)
9789 {
9790 player.MessageStatus(text);
9791 }
9792 }
9793
9794
9803 {
9804 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9805
9806 if (player)
9807 {
9808 player.MessageAction(text);
9809 }
9810 }
9811
9812
9821 {
9822 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9823
9824 if (player)
9825 {
9826 player.MessageFriendly(text);
9827 }
9828 }
9829
9830
9839 {
9840 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9841
9842 if (player)
9843 {
9844 player.MessageImportant(text);
9845 }
9846 }
9847
9849 {
9850 return true;
9851 }
9852
9853
9854 override bool KindOf(
string tag)
9855 {
9856 bool found = false;
9857 string item_name = this.
GetType();
9860
9861 int array_size = item_tag_array.Count();
9862 for (int i = 0; i < array_size; i++)
9863 {
9864 if (item_tag_array.Get(i) == tag)
9865 {
9866 found = true;
9867 break;
9868 }
9869 }
9870 return found;
9871 }
9872
9873
9875 {
9876
9877 super.OnRPC(sender, rpc_type,ctx);
9878
9879
9880 switch (rpc_type)
9881 {
9882 #ifndef SERVER
9883 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9884 Param2<bool, string> p = new Param2<bool, string>(false, "");
9885
9887 return;
9888
9889 bool play = p.param1;
9890 string soundSet = p.param2;
9891
9892 if (play)
9893 {
9895 {
9897 {
9899 }
9900 }
9901 else
9902 {
9904 }
9905 }
9906 else
9907 {
9909 }
9910
9911 break;
9912 #endif
9913
9914 }
9915
9917 {
9919 }
9920 }
9921
9922
9923
9924
9926 {
9927 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9928 return plugin.GetID(
name);
9929 }
9930
9932 {
9933 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9934 return plugin.GetName(id);
9935 }
9936
9939 {
9940
9941
9942 int varFlags;
9943 if (!ctx.
Read(varFlags))
9944 return;
9945
9946 if (varFlags & ItemVariableFlags.FLOAT)
9947 {
9949 }
9950 }
9951
9953 {
9954
9955 super.SerializeNumericalVars(floats_out);
9956
9957
9958
9960 {
9962 }
9963
9965 {
9967 }
9968
9970 {
9972 }
9973
9975 {
9980 }
9981
9983 {
9985 }
9986 }
9987
9989 {
9990
9991 super.DeSerializeNumericalVars(floats);
9992
9993
9994 int index = 0;
9995 int mask = Math.Round(floats.Get(index));
9996
9997 index++;
9998
10000 {
10002 {
10004 }
10005 else
10006 {
10007 float quantity = floats.Get(index);
10008 SetQuantity(quantity,
true,
false,
false,
false);
10009 }
10010 index++;
10011 }
10012
10014 {
10015 float wet = floats.Get(index);
10017 index++;
10018 }
10019
10021 {
10022 int liquidtype = Math.Round(floats.Get(index));
10024 index++;
10025 }
10026
10028 {
10030 index++;
10032 index++;
10034 index++;
10036 index++;
10037 }
10038
10040 {
10041 int cleanness = Math.Round(floats.Get(index));
10043 index++;
10044 }
10045 }
10046
10048 {
10049 super.WriteVarsToCTX(ctx);
10050
10051
10053 {
10055 }
10056
10058 {
10060 }
10061
10063 {
10065 }
10066
10068 {
10069 int r,g,b,a;
10075 }
10076
10078 {
10080 }
10081 }
10082
10084 {
10085 if (!super.ReadVarsFromCTX(ctx,version))
10086 return false;
10087
10088 int intValue;
10089 float value;
10090
10091 if (version < 140)
10092 {
10093 if (!ctx.
Read(intValue))
10094 return false;
10095
10096 m_VariablesMask = intValue;
10097 }
10098
10100 {
10101 if (!ctx.
Read(value))
10102 return false;
10103
10105 {
10107 }
10108 else
10109 {
10111 }
10112 }
10113
10114 if (version < 140)
10115 {
10117 {
10118 if (!ctx.
Read(value))
10119 return false;
10120 SetTemperatureDirect(value);
10121 }
10122 }
10123
10125 {
10126 if (!ctx.
Read(value))
10127 return false;
10129 }
10130
10132 {
10133 if (!ctx.
Read(intValue))
10134 return false;
10136 }
10137
10139 {
10140 int r,g,b,a;
10142 return false;
10144 return false;
10146 return false;
10148 return false;
10149
10151 }
10152
10154 {
10155 if (!ctx.
Read(intValue))
10156 return false;
10158 }
10159
10160 if (version >= 138 && version < 140)
10161 {
10163 {
10164 if (!ctx.
Read(intValue))
10165 return false;
10166 SetFrozen(intValue);
10167 }
10168 }
10169
10170 return true;
10171 }
10172
10173
10175 {
10178 {
10180 }
10181
10182 if (!super.OnStoreLoad(ctx, version))
10183 {
10185 return false;
10186 }
10187
10188 if (version >= 114)
10189 {
10190 bool hasQuickBarIndexSaved;
10191
10192 if (!ctx.
Read(hasQuickBarIndexSaved))
10193 {
10195 return false;
10196 }
10197
10198 if (hasQuickBarIndexSaved)
10199 {
10200 int itmQBIndex;
10201
10202
10203 if (!ctx.
Read(itmQBIndex))
10204 {
10206 return false;
10207 }
10208
10209 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10210 if (itmQBIndex != -1 && parentPlayer)
10211 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10212 }
10213 }
10214 else
10215 {
10216
10217 PlayerBase player;
10218 int itemQBIndex;
10219 if (version ==
int.
MAX)
10220 {
10221 if (!ctx.
Read(itemQBIndex))
10222 {
10224 return false;
10225 }
10226 }
10227 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10228 {
10229
10230 if (!ctx.
Read(itemQBIndex))
10231 {
10233 return false;
10234 }
10235 if (itemQBIndex != -1 && player)
10236 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10237 }
10238 }
10239
10240 if (version < 140)
10241 {
10242
10243 if (!LoadVariables(ctx, version))
10244 {
10246 return false;
10247 }
10248 }
10249
10250
10252 {
10254 return false;
10255 }
10256 if (version >= 132)
10257 {
10259 if (raib)
10260 {
10262 {
10264 return false;
10265 }
10266 }
10267 }
10268
10270 return true;
10271 }
10272
10273
10274
10276 {
10277 super.OnStoreSave(ctx);
10278
10279 PlayerBase player;
10280 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10281 {
10283
10284 int itemQBIndex = -1;
10285 itemQBIndex = player.FindQuickBarEntityIndex(this);
10286 ctx.
Write(itemQBIndex);
10287 }
10288 else
10289 {
10291 }
10292
10294
10296 if (raib)
10297 {
10299 }
10300 }
10301
10302
10304 {
10305 super.AfterStoreLoad();
10306
10308 {
10310 }
10311
10313 {
10316 }
10317 }
10318
10320 {
10321 super.EEOnAfterLoad();
10322
10324 {
10326 }
10327
10330 }
10331
10333 {
10334 return false;
10335 }
10336
10337
10338
10340 {
10342 {
10343 #ifdef PLATFORM_CONSOLE
10344
10346 {
10348 if (menu)
10349 {
10351 }
10352 }
10353 #endif
10354 }
10355
10357 {
10360 }
10361
10363 {
10364 SetWeightDirty();
10366 }
10368 {
10371 }
10372
10374 {
10377 }
10379 {
10382 }
10383
10384 super.OnVariablesSynchronized();
10385 }
10386
10387
10388
10390 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10391 {
10392 if (!IsServerCheck(allow_client))
10393 return false;
10394
10396 return false;
10397
10400
10401 if (value <= (min + 0.001))
10402 value = min;
10403
10404 if (value == min)
10405 {
10406 if (destroy_config)
10407 {
10408 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10409 if (dstr)
10410 {
10412 this.Delete();
10413 return true;
10414 }
10415 }
10416 else if (destroy_forced)
10417 {
10419 this.Delete();
10420 return true;
10421 }
10422
10424 }
10425
10428
10430 {
10432
10433 if (delta)
10435 }
10436
10438
10439 return false;
10440 }
10441
10442
10444 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10445 {
10447 }
10448
10450 {
10453 }
10454
10456 {
10459 }
10460
10462 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10463 {
10464 float value_clamped = Math.Clamp(value, 0, 1);
10466 SetQuantity(result, destroy_config, destroy_forced);
10467 }
10468
10469
10472 {
10474 }
10475
10477 {
10479 }
10480
10481
10482
10483
10484
10485
10486
10487
10488
10489
10491 {
10492 int slot = -1;
10493 if (GetInventory())
10494 {
10495 InventoryLocation il = new InventoryLocation;
10496 GetInventory().GetCurrentInventoryLocation(il);
10498 }
10499
10501 }
10502
10504 {
10505 float quantity_max = 0;
10506
10508 {
10509 if (attSlotID != -1)
10510 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10511
10512 if (quantity_max <= 0)
10514 }
10515
10516 if (quantity_max <= 0)
10518
10519 return quantity_max;
10520 }
10521
10523 {
10525 }
10526
10528 {
10530 }
10531
10532
10534 {
10536 }
10537
10539 {
10541 }
10542
10544 {
10546 }
10547
10548
10550 {
10551
10552 float weightEx = GetWeightEx();
10553 float special = GetInventoryAndCargoWeight();
10554 return weightEx - special;
10555 }
10556
10557
10559 {
10561 }
10562
10564 {
10566 {
10567 #ifdef DEVELOPER
10568 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10569 {
10570 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10572 }
10573 #endif
10574
10575 return GetQuantity() * GetConfigWeightModified();
10576 }
10577 else if (HasEnergyManager())
10578 {
10579 #ifdef DEVELOPER
10580 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10581 {
10582 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10583 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10584 }
10585 #endif
10586 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10587 }
10588 else
10589 {
10590 #ifdef DEVELOPER
10591 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10592 {
10593 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10594 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10595 }
10596 #endif
10597 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10598 }
10599 }
10600
10603 {
10604 int item_count = 0;
10606
10607 if (GetInventory().GetCargo() != NULL)
10608 {
10609 item_count = GetInventory().GetCargo().GetItemCount();
10610 }
10611
10612 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
10613 {
10614 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
10615 if (item)
10616 item_count += item.GetNumberOfItems();
10617 }
10618 return item_count;
10619 }
10620
10623 {
10624 float weight = 0;
10625 float wetness = 1;
10626 if (include_wetness)
10629 {
10630 weight = wetness * m_ConfigWeight;
10631 }
10633 {
10634 weight = 1;
10635 }
10636 return weight;
10637 }
10638
10639
10640
10642 {
10643 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
10644 {
10645 GameInventory inv = GetInventory();
10646 array<EntityAI> items = new array<EntityAI>;
10648 for (int i = 0; i < items.Count(); i++)
10649 {
10651 if (item)
10652 {
10654 }
10655 }
10656 }
10657 }
10658
10659
10660
10661
10663 {
10664 float energy = 0;
10665 if (HasEnergyManager())
10666 {
10667 energy = GetCompEM().GetEnergy();
10668 }
10669 return energy;
10670 }
10671
10672
10674 {
10675 super.OnEnergyConsumed();
10676
10678 }
10679
10681 {
10682 super.OnEnergyAdded();
10683
10685 }
10686
10687
10689 {
10690 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10691 {
10693 {
10694 float energy_0to1 = GetCompEM().GetEnergy0To1();
10696 }
10697 }
10698 }
10699
10700
10702 {
10703 return ConfigGetFloat("heatIsolation");
10704 }
10705
10707 {
10709 }
10710
10712 {
10713 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10714 if (
GetGame().ConfigIsExisting(paramPath))
10716
10717 return 0.0;
10718 }
10719
10721 {
10722 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10723 if (
GetGame().ConfigIsExisting(paramPath))
10725
10726 return 0.0;
10727 }
10728
10729 override void SetWet(
float value,
bool allow_client =
false)
10730 {
10731 if (!IsServerCheck(allow_client))
10732 return;
10733
10736
10738
10739 m_VarWet = Math.Clamp(value, min, max);
10740
10742 {
10745 }
10746 }
10747
10748 override void AddWet(
float value)
10749 {
10751 }
10752
10754 {
10756 }
10757
10759 {
10761 }
10762
10764 {
10766 }
10767
10769 {
10771 }
10772
10774 {
10776 }
10777
10778 override void OnWetChanged(
float newVal,
float oldVal)
10779 {
10782 if (newLevel != oldLevel)
10783 {
10785 }
10786 }
10787
10789 {
10790 SetWeightDirty();
10791 }
10792
10794 {
10795 return GetWetLevelInternal(
m_VarWet);
10796 }
10797
10798
10799
10801 {
10803 }
10804
10806 {
10808 }
10809
10811 {
10813 }
10814
10816 {
10818 }
10819
10820
10821
10823 {
10824 if (ConfigIsExisting("itemModelLength"))
10825 {
10826 return ConfigGetFloat("itemModelLength");
10827 }
10828 return 0;
10829 }
10830
10832 {
10833 if (ConfigIsExisting("itemAttachOffset"))
10834 {
10835 return ConfigGetFloat("itemAttachOffset");
10836 }
10837 return 0;
10838 }
10839
10840 override void SetCleanness(
int value,
bool allow_client =
false)
10841 {
10842 if (!IsServerCheck(allow_client))
10843 return;
10844
10846
10848
10851 }
10852
10854 {
10856 }
10857
10859 {
10860 return true;
10861 }
10862
10863
10864
10865
10867 {
10869 }
10870
10872 {
10874 }
10875
10876
10877
10878
10879 override void SetColor(
int r,
int g,
int b,
int a)
10880 {
10886 }
10888 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10889 {
10894 }
10895
10897 {
10899 }
10900
10903 {
10904 int r,g,b,a;
10906 r = r/255;
10907 g = g/255;
10908 b = b/255;
10909 a = a/255;
10910 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10911 }
10912
10913
10914
10915 override void SetLiquidType(
int value,
bool allow_client =
false)
10916 {
10917 if (!IsServerCheck(allow_client))
10918 return;
10919
10924 }
10925
10927 {
10928 return ConfigGetInt("varLiquidTypeInit");
10929 }
10930
10932 {
10934 }
10935
10937 {
10939 SetFrozen(false);
10940 }
10941
10944 {
10945 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10946 }
10947
10948
10951 {
10952 PlayerBase nplayer;
10953 if (PlayerBase.CastTo(nplayer, player))
10954 {
10956
10957 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10958 }
10959 }
10960
10961
10964 {
10965 PlayerBase nplayer;
10966 if (PlayerBase.CastTo(nplayer,player))
10967 {
10968
10969 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10970
10971 }
10972
10973
10974 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10975
10976
10977 if (HasEnergyManager())
10978 {
10979 GetCompEM().UpdatePlugState();
10980 }
10981 }
10982
10983
10985 {
10986 super.OnPlacementStarted(player);
10987
10989 }
10990
10991 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10992 {
10994 {
10995 m_AdminLog.OnPlacementComplete(player,
this);
10996 }
10997
10998 super.OnPlacementComplete(player, position, orientation);
10999 }
11000
11001
11002
11003
11004
11006 {
11008 {
11009 return true;
11010 }
11011 else
11012 {
11013 return false;
11014 }
11015 }
11016
11017
11019 {
11021 {
11023 }
11024 }
11025
11026
11028 {
11030 }
11031
11033 {
11035 }
11036
11037 override void InsertAgent(
int agent,
float count = 1)
11038 {
11039 if (count < 1)
11040 return;
11041
11043 }
11044
11047 {
11049 }
11050
11051
11053 {
11055 }
11056
11057
11058
11059
11060
11061
11062
11063
11064
11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11099 {
11101 return false;
11102 return true;
11103 }
11104
11106 {
11107
11109 }
11110
11111
11114 {
11115 super.CheckForRoofLimited(timeTresholdMS);
11116
11118 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11119 {
11120 m_PreviousRoofTestTime = time;
11121 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11122 }
11123 }
11124
11125
11127 {
11129 {
11130 return 0;
11131 }
11132
11133 if (GetInventory().GetAttachmentSlotsCount() != 0)
11134 {
11135 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11136 if (filter)
11137 return filter.GetProtectionLevel(type, false, system);
11138 else
11139 return 0;
11140 }
11141
11142 string subclassPath, entryName;
11143
11144 switch (type)
11145 {
11147 entryName = "biological";
11148 break;
11150 entryName = "chemical";
11151 break;
11152 default:
11153 entryName = "biological";
11154 break;
11155 }
11156
11157 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11158
11160 }
11161
11162
11163
11166 {
11167 if (!IsMagazine())
11169
11171 }
11172
11173
11174
11175
11176
11181 {
11182 return true;
11183 }
11184
11186 {
11188 }
11189
11190
11191
11192
11193
11195 {
11196 if (parent)
11197 {
11198 if (parent.IsInherited(DayZInfected))
11199 return true;
11200
11201 if (!parent.IsRuined())
11202 return true;
11203 }
11204
11205 return true;
11206 }
11207
11209 {
11210 if (!super.CanPutAsAttachment(parent))
11211 {
11212 return false;
11213 }
11214
11215 if (!IsRuined() && !parent.IsRuined())
11216 {
11217 return true;
11218 }
11219
11220 return false;
11221 }
11222
11224 {
11225
11226
11227
11228
11229 return super.CanReceiveItemIntoCargo(item);
11230 }
11231
11233 {
11234
11235
11236
11237
11238 GameInventory attachmentInv = attachment.GetInventory();
11240 {
11241 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11242 return false;
11243 }
11244
11245 InventoryLocation loc = new InventoryLocation();
11246 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11247 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11248 return false;
11249
11250 return super.CanReceiveAttachment(attachment, slotId);
11251 }
11252
11254 {
11255 if (!super.CanReleaseAttachment(attachment))
11256 return false;
11257
11258 return GetInventory().AreChildrenAccessible();
11259 }
11260
11261
11262
11263
11264
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11282 {
11283 int id = muzzle_owner.GetMuzzleID();
11284 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11285
11286 if (WPOF_array)
11287 {
11288 for (int i = 0; i < WPOF_array.Count(); i++)
11289 {
11290 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11291
11292 if (WPOF)
11293 {
11294 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11295 }
11296 }
11297 }
11298 }
11299
11300
11302 {
11303 int id = muzzle_owner.GetMuzzleID();
11305
11306 if (WPOBE_array)
11307 {
11308 for (int i = 0; i < WPOBE_array.Count(); i++)
11309 {
11310 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11311
11312 if (WPOBE)
11313 {
11314 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11315 }
11316 }
11317 }
11318 }
11319
11320
11322 {
11323 int id = muzzle_owner.GetMuzzleID();
11324 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11325
11326 if (WPOOH_array)
11327 {
11328 for (int i = 0; i < WPOOH_array.Count(); i++)
11329 {
11330 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11331
11332 if (WPOOH)
11333 {
11334 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11335 }
11336 }
11337 }
11338 }
11339
11340
11342 {
11343 int id = muzzle_owner.GetMuzzleID();
11344 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11345
11346 if (WPOOH_array)
11347 {
11348 for (int i = 0; i < WPOOH_array.Count(); i++)
11349 {
11350 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11351
11352 if (WPOOH)
11353 {
11354 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11355 }
11356 }
11357 }
11358 }
11359
11360
11362 {
11363 int id = muzzle_owner.GetMuzzleID();
11364 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11365
11366 if (WPOOH_array)
11367 {
11368 for (int i = 0; i < WPOOH_array.Count(); i++)
11369 {
11370 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11371
11372 if (WPOOH)
11373 {
11374 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11375 }
11376 }
11377 }
11378 }
11379
11380
11381
11383 {
11385 {
11386 return true;
11387 }
11388
11389 return false;
11390 }
11391
11393 {
11395 {
11396 return true;
11397 }
11398
11399 return false;
11400 }
11401
11403 {
11405 {
11406 return true;
11407 }
11408
11409 return false;
11410 }
11411
11413 {
11414 return false;
11415 }
11416
11419 {
11420 return UATimeSpent.DEFAULT_DEPLOY;
11421 }
11422
11423
11424
11425
11427 {
11429 SetSynchDirty();
11430 }
11431
11433 {
11435 }
11436
11437
11439 {
11440 return false;
11441 }
11442
11445 {
11446 string att_type = "None";
11447
11448 if (ConfigIsExisting("soundAttType"))
11449 {
11450 att_type = ConfigGetString("soundAttType");
11451 }
11452
11454 }
11455
11457 {
11459 }
11460
11461
11462
11463
11464
11470
11472 {
11475
11477 }
11478
11479
11481 {
11483 return;
11484
11486
11489
11492
11493 SoundParameters params = new SoundParameters();
11497 }
11498
11499
11501 {
11503 return;
11504
11506 SetSynchDirty();
11507
11510 }
11511
11512
11514 {
11516 return;
11517
11519 SetSynchDirty();
11520
11523 }
11524
11526 {
11528 }
11529
11531 {
11533 }
11534
11537 {
11538 if (!
GetGame().IsDedicatedServer())
11539 {
11540 if (ConfigIsExisting("attachSoundSet"))
11541 {
11542 string cfg_path = "";
11543 string soundset = "";
11544 string type_name =
GetType();
11545
11548 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11549 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11550
11551 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11552 {
11553 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11554 {
11555 if (cfg_slot_array[i] == slot_type)
11556 {
11557 soundset = cfg_soundset_array[i];
11558 break;
11559 }
11560 }
11561 }
11562
11563 if (soundset != "")
11564 {
11565 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11567 }
11568 }
11569 }
11570 }
11571
11573 {
11574
11575 }
11576
11577 void OnApply(PlayerBase player);
11578
11580 {
11581 return 1.0;
11582 };
11583
11585 {
11587 }
11588
11590 {
11592 }
11593
11595
11597 {
11598 SetDynamicPhysicsLifeTime(0.01);
11600 }
11601
11603 {
11604 array<string> zone_names = new array<string>;
11605 GetDamageZones(zone_names);
11606 for (int i = 0; i < zone_names.Count(); i++)
11607 {
11608 SetHealthMax(zone_names.Get(i),"Health");
11609 }
11610 SetHealthMax("","Health");
11611 }
11612
11615 {
11616 float global_health = GetHealth01("","Health");
11617 array<string> zones = new array<string>;
11618 GetDamageZones(zones);
11619
11620 for (int i = 0; i < zones.Count(); i++)
11621 {
11622 SetHealth01(zones.Get(i),"Health",global_health);
11623 }
11624 }
11625
11628 {
11629 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11630 }
11631
11633 {
11634 if (!hasRootAsPlayer)
11635 {
11636 if (refParentIB)
11637 {
11638
11639 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11640 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11641
11642 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11643 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11644
11647 }
11648 else
11649 {
11650
11653 }
11654 }
11655 }
11656
11658 {
11660 {
11661 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11662 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11663 {
11664 float heatPermCoef = 1.0;
11666 while (ent)
11667 {
11668 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11669 ent = ent.GetHierarchyParent();
11670 }
11671
11672 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11673 }
11674 }
11675 }
11676
11678 {
11679
11680 EntityAI parent = GetHierarchyParent();
11681 if (!parent)
11682 {
11683 hasParent = false;
11684 hasRootAsPlayer = false;
11685 }
11686 else
11687 {
11688 hasParent = true;
11689 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11690 refParentIB =
ItemBase.Cast(parent);
11691 }
11692 }
11693
11694 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11695 {
11696
11697 }
11698
11700 {
11701
11702 return false;
11703 }
11704
11706 {
11707
11708
11709 return false;
11710 }
11711
11713 {
11714
11715 return false;
11716 }
11717
11720 {
11721 return !GetIsFrozen() &&
IsOpen();
11722 }
11723
11725 {
11726 bool hasParent = false, hasRootAsPlayer = false;
11728
11729 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11730 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11731
11732 if (wwtu || foodDecay)
11733 {
11737
11738 if (processWetness || processTemperature || processDecay)
11739 {
11741
11742 if (processWetness)
11743 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11744
11745 if (processTemperature)
11747
11748 if (processDecay)
11749 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11750 }
11751 }
11752 }
11753
11756 {
11758 }
11759
11761 {
11764
11765 return super.GetTemperatureFreezeThreshold();
11766 }
11767
11769 {
11772
11773 return super.GetTemperatureThawThreshold();
11774 }
11775
11777 {
11780
11781 return super.GetItemOverheatThreshold();
11782 }
11783
11785 {
11787 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11788
11789 return super.GetTemperatureFreezeTime();
11790 }
11791
11793 {
11795 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11796
11797 return super.GetTemperatureThawTime();
11798 }
11799
11804
11806 {
11807 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11808 }
11809
11811 {
11812 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11813 }
11814
11817 {
11819 }
11820
11822 {
11824 }
11825
11827 {
11829 }
11830
11833 {
11834 return null;
11835 }
11836
11839 {
11840 return false;
11841 }
11842
11844 {
11846 {
11849 if (!trg)
11850 {
11852 explosive = this;
11853 }
11854
11855 explosive.PairRemote(trg);
11857
11858 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11859 trg.SetPersistentPairID(persistentID);
11860 explosive.SetPersistentPairID(persistentID);
11861
11862 return true;
11863 }
11864 return false;
11865 }
11866
11869 {
11870 float ret = 1.0;
11873 ret *= GetHealth01();
11874
11875 return ret;
11876 }
11877
11878 #ifdef DEVELOPER
11879 override void SetDebugItem()
11880 {
11881 super.SetDebugItem();
11882 _itemBase = this;
11883 }
11884
11886 {
11887 string text = super.GetDebugText();
11888
11890 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11891
11892 return text;
11893 }
11894 #endif
11895
11897 {
11898 return true;
11899 }
11900
11902
11904
11906 {
11909 }
11910
11911
11919
11935}
11936
11938{
11940 if (entity)
11941 {
11942 bool is_item = entity.IsInherited(
ItemBase);
11943 if (is_item && full_quantity)
11944 {
11947 }
11948 }
11949 else
11950 {
11952 return NULL;
11953 }
11954 return entity;
11955}
11956
11958{
11959 if (item)
11960 {
11961 if (health > 0)
11962 item.SetHealth("", "", health);
11963
11964 if (item.CanHaveTemperature())
11965 {
11967 if (item.CanFreeze())
11968 item.SetFrozen(false);
11969 }
11970
11971 if (item.HasEnergyManager())
11972 {
11973 if (quantity >= 0)
11974 {
11975 item.GetCompEM().SetEnergy0To1(quantity);
11976 }
11977 else
11978 {
11980 }
11981 }
11982 else if (item.IsMagazine())
11983 {
11984 Magazine mag = Magazine.Cast(item);
11985 if (quantity >= 0)
11986 {
11987 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11988 }
11989 else
11990 {
11992 }
11993
11994 }
11995 else
11996 {
11997 if (quantity >= 0)
11998 {
11999 item.SetQuantityNormalized(quantity, false);
12000 }
12001 else
12002 {
12004 }
12005
12006 }
12007 }
12008}
12009
12010#ifdef DEVELOPER
12012#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
void ActionManagerBase(PlayerBase player)
map< typename, ref array< ActionBase_Basic > > TInputActionMap
void AddAction(typename actionName)
void RemoveAction(typename actionName)
TInputActionMap m_InputActionMap
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
const int ECE_PLACE_ON_SURFACE
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
Open
Implementations only.
override void EEOnCECreate()
DamageType
exposed from C++ (do not change)
PluginAdminLog m_AdminLog
override bool IsExplosive()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
static bool HasDebugActionsMask(int mask)
bool HidesSelectionBySlot()
void SplitItem(PlayerBase player)
void CopyScriptPropertiesFrom(EntityAI oldItem)
override void InsertAgent(int agent, float count=1)
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
static void SetDebugActionsMask(int mask)
void SetIsDeploySound(bool is_deploy_sound)
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
override bool IsHeavyBehaviour()
override void SetWetMax()
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
void ClearStartItemSoundServer()
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
override void RemoveAllAgentsExcept(int agent_to_keep)
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
bool CanBeMovedOverride()
override void SetWet(float value, bool allow_client=false)
ref TIntArray m_SingleUseActions
override void ProcessVariables()
ref TStringArray m_HeadHidingSelections
float GetWeightSpecialized(bool forceRecalc=false)
bool LoadAgents(ParamsReadContext ctx, int version)
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
ref array< ref OverheatingParticle > m_OverheatingParticles
override float GetTemperatureFreezeThreshold()
bool m_IsSoundSynchRemote
void StopItemSoundServer(int id)
static void ToggleDebugActionsMask(int mask)
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetTemperatureFreezeTime()
ref array< int > m_CompatibleLocks
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
float m_TemperaturePerQuantityWeight
bool m_RecipesInitialized
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
override float GetTemperatureThawThreshold()
override void OnEnergyConsumed()
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
override EWetnessLevel GetWetLevel()
float GetSingleInventoryItemWeight()
ref TIntArray m_InteractActions
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
bool CanPlayDeployLoopSound()
override float GetWetMax()
bool CanBeUsedForSuicide()
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
void StartItemSoundServer(int id)
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
bool m_CanBeMovedOverride
override string ChangeIntoOnAttach(string slot)
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
ScriptedLightBase GetLight()
string GetPlaceSoundset()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
override float GetQuantity()
int m_ShotsToStartOverheating
override void OnWetChanged(float newVal, float oldVal)
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void OnOverheatingDecay()
float GetDryingIncrement(string pIncrementName)
void SoundSynchRemoteReset()
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
override bool CanReleaseAttachment(EntityAI attachment)
override void OnMovedInsideCargo(EntityAI container)
void SetCEBasedQuantity()
bool m_CanPlayImpactSound
override string GetAttachmentSoundType()
float GetOverheatingCoef()
array< string > GetHeadHidingSelection()
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
override bool IsStoreLoad()
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
void SetResultOfSplit(bool value)
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
void UpdateAllOverheatingParticles()
float GetSoakingIncrement(string pIncrementName)
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetStoreLoadedQuantity()
const int ITEM_SOUNDS_MAX
float GetItemModelLength()
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
void CombineItems(ItemBase other_item, bool use_stack_max=true)
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
void TransferAgents(int agents)
transfer agents from another item
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
float GetHeatIsolationInit()
void SetCanBeMovedOverride(bool setting)
override bool HasQuantity()
bool IsCargoException4x3(EntityAI item)
ref TIntArray m_ContinuousActions
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
void LoadParticleConfigOnFire(int id)
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
override float GetWetInit()
int m_ImpactSoundSurfaceHash
int m_MaxOverheatingValue
void SetupSpawnedItem(ItemBase item, float health, float quantity)
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()
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)
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
proto native void GizmoSelectObject(Object object)
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto native void GizmoSelectPhysics(Physics physics)
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
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 void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
void SetCalcDetails(string details)
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Serializer ParamsReadContext
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
proto native CGame GetGame()
Serializer ParamsWriteContext
const int COMP_TYPE_ENERGY_MANAGER
void Error(string err)
Messagebox with error message.
proto native void SetColor(int color)
array< string > TStringArray
EntityEvent
Entity events for event-mask, or throwing event from code.
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
const int VARIABLE_LIQUIDTYPE
const int VARIABLE_CLEANNESS
const int VARIABLE_TEMPERATURE
const int VARIABLE_QUANTITY
static proto float AbsFloat(float f)
Returns absolute value.
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_DEBUG_ACTION
class JsonUndergroundAreaTriggerData GetPosition
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.