7181{
7183 {
7184 return true;
7185 }
7186};
7187
7188
7189
7191{
7195
7197
7200
7201
7202
7203
7204
7213
7219
7224
7229
7250 protected bool m_IsResultOfSplit
7251
7253
7258
7259
7260
7262
7266
7267
7268
7270
7273
7274
7275
7281
7282
7290
7293
7294
7296
7297
7299
7300
7305
7306
7311
7312
7314
7315
7317 {
7322
7323 if (!
GetGame().IsDedicatedServer())
7324 {
7326 {
7328
7330 {
7332 }
7333 }
7334
7337 }
7338
7339 m_OldLocation = null;
7340
7342 {
7344 }
7345
7346 if (ConfigIsExisting("headSelectionsToHide"))
7347 {
7350 }
7351
7353 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7354 {
7356 }
7357
7359
7360 m_IsResultOfSplit = false;
7361
7363 }
7364
7366 {
7367 super.InitItemVariables();
7368
7374 m_Count = ConfigGetInt(
"count");
7375
7378
7383
7386
7391
7403
7407
7408
7411 if (ConfigIsExisting("canBeSplit"))
7412 {
7415 }
7416
7418 if (ConfigIsExisting("itemBehaviour"))
7420
7421
7424 RegisterNetSyncVariableInt("m_VarLiquidType");
7425 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7426
7427 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7428 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7429 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7430
7431 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7432 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7433 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7434 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7435
7436 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7437 RegisterNetSyncVariableBool("m_IsTakeable");
7438 RegisterNetSyncVariableBool("m_IsHologram");
7439
7442 {
7445 }
7446
7448
7450 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7452
7453 }
7454
7456 {
7458 }
7459
7461 {
7464 {
7469 }
7470 }
7471
7472 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7473 {
7475 {
7478 }
7479
7481 }
7482
7484 {
7490 }
7491
7493
7495 {
7497
7498 if (!action)
7499 {
7500 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7501 return;
7502 }
7503
7505 if (!ai)
7506 {
7508 return;
7509 }
7510
7512 if (!action_array)
7513 {
7514 action_array = new array<ActionBase_Basic>;
7516 }
7517 if (LogManager.IsActionLogEnable())
7518 {
7519 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7520 }
7521
7522 if (action_array.Find(action) != -1)
7523 {
7524 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7525 }
7526 else
7527 {
7528 action_array.Insert(action);
7529 }
7530 }
7531
7533 {
7535 ActionBase action = player.GetActionManager().GetAction(actionName);
7538
7539 if (action_array)
7540 {
7541 action_array.RemoveItem(action);
7542 }
7543 }
7544
7545
7546
7548 {
7549 ActionOverrideData overrideData = new ActionOverrideData();
7553
7555 if (!actionMap)
7556 {
7559 }
7560
7561 actionMap.Insert(this.
Type(), overrideData);
7562
7563 }
7564
7566
7568
7569
7571 {
7574
7577
7578 string config_to_search = "CfgVehicles";
7579 string muzzle_owner_config;
7580
7582 {
7583 if (IsInherited(Weapon))
7584 config_to_search = "CfgWeapons";
7585
7586 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7587
7588 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7589
7591
7592 if (config_OnFire_subclass_count > 0)
7593 {
7594 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7595
7596 for (int i = 0; i < config_OnFire_subclass_count; i++)
7597 {
7598 string particle_class = "";
7600 string config_OnFire_entry = config_OnFire_class + particle_class;
7601 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7602 WPOF_array.Insert(WPOF);
7603 }
7604
7605
7607 }
7608 }
7609
7611 {
7612 config_to_search = "CfgWeapons";
7613 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7614
7615 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7616
7618
7619 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7620 {
7621 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7622
7623 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7624 {
7625 string particle_class2 = "";
7627 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7628 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7629 WPOBE_array.Insert(WPOBE);
7630 }
7631
7632
7634 }
7635 }
7636 }
7637
7638
7640 {
7643
7645 {
7646 string config_to_search = "CfgVehicles";
7647
7648 if (IsInherited(Weapon))
7649 config_to_search = "CfgWeapons";
7650
7651 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7652 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7653
7654 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
7655 {
7656
7658
7660 {
7662 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7664 return;
7665 }
7666
7669
7670
7671
7673 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7674
7675 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7676 {
7677 string particle_class = "";
7679 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7681
7682 if (entry_type == CT_CLASS)
7683 {
7684 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7685 WPOOH_array.Insert(WPOF);
7686 }
7687 }
7688
7689
7691 }
7692 }
7693 }
7694
7696 {
7698 }
7699
7701 {
7703 {
7705
7708
7711
7712 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7713 }
7714 }
7715
7717 {
7719 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7720
7722 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7723
7725 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7726
7728 {
7730 }
7731 }
7732
7734 {
7736 }
7737
7739 {
7742 else
7744
7746 {
7749 }
7750 else
7751 {
7754
7757 }
7758
7760 }
7761
7763 {
7765 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7766 }
7767
7769 {
7771 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7773 }
7774
7776 {
7778 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7779 }
7780
7782 {
7785
7786 OverheatingParticle OP = new OverheatingParticle();
7791
7793 }
7794
7796 {
7799
7800 return -1;
7801 }
7802
7804 {
7806 {
7809
7810 for (int i = count; i > 0; --i)
7811 {
7812 int id = i - 1;
7815
7818
7819 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7820 {
7821 if (p)
7822 {
7825 }
7826 }
7827 }
7828 }
7829 }
7830
7832 {
7834 {
7836 {
7837 int id = i - 1;
7839
7840 if (OP)
7841 {
7843
7844 if (p)
7845 {
7847 }
7848
7849 delete OP;
7850 }
7851 }
7852
7855 }
7856 }
7857
7860 {
7861 return 0.0;
7862 }
7863
7864
7866 {
7867 return 250;
7868 }
7869
7871 {
7872 return 0;
7873 }
7874
7877 {
7879 return true;
7880
7881 return false;
7882 }
7883
7886 {
7889
7891 {
7893 }
7894 else
7895 {
7896
7898 }
7899
7901 }
7902
7909 {
7910 return -1;
7911 }
7912
7913
7914
7915
7917 {
7919 {
7921 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7922
7923 if (r_index >= 0)
7924 {
7925 InventoryLocation r_il = new InventoryLocation;
7926 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7927
7928 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7931 {
7932 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7933 }
7935 {
7936 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7937 }
7938
7939 }
7940
7941 player.GetHumanInventory().ClearUserReservedLocation(this);
7942 }
7943
7946 }
7947
7948
7949
7950
7952 {
7953 return ItemBase.m_DebugActionsMask;
7954 }
7955
7957 {
7958 return ItemBase.m_DebugActionsMask & mask;
7959 }
7960
7962 {
7963 ItemBase.m_DebugActionsMask = mask;
7964 }
7965
7967 {
7968 ItemBase.m_DebugActionsMask |= mask;
7969 }
7970
7972 {
7973 ItemBase.m_DebugActionsMask &= ~mask;
7974 }
7975
7977 {
7979 {
7981 }
7982 else
7983 {
7985 }
7986 }
7987
7988
7990 {
7991 if (GetEconomyProfile())
7992 {
7993 float q_max = GetEconomyProfile().GetQuantityMax();
7994 if (q_max > 0)
7995 {
7996 float q_min = GetEconomyProfile().GetQuantityMin();
7997 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7998
8000 {
8001 ComponentEnergyManager comp = GetCompEM();
8003 {
8005 }
8006 }
8008 {
8010
8011 }
8012
8013 }
8014 }
8015 }
8016
8019 {
8020 EntityAI parent = GetHierarchyParent();
8021
8022 if (parent)
8023 {
8024 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8025 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8026 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8027 }
8028 }
8029
8032 {
8033 EntityAI parent = GetHierarchyParent();
8034
8035 if (parent)
8036 {
8037 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8038 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8039 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8040 }
8041 }
8042
8044 {
8045
8046
8047
8048
8050
8052 {
8053 if (ScriptInputUserData.CanStoreInputUserData())
8054 {
8055 ScriptInputUserData ctx = new ScriptInputUserData;
8061 ctx.
Write(use_stack_max);
8064
8066 {
8067 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8068 }
8069 }
8070 }
8071 else if (!
GetGame().IsMultiplayer())
8072 {
8074 }
8075 }
8076
8078 {
8080 }
8081
8083 {
8085 }
8086
8088 {
8090 }
8091
8093 {
8094
8095 return false;
8096 }
8097
8099 {
8100 return false;
8101 }
8102
8106 {
8107 return false;
8108 }
8109
8111 {
8112 return "";
8113 }
8114
8116
8118 {
8119 return false;
8120 }
8121
8123 {
8124 return true;
8125 }
8126
8127
8128
8130 {
8131 return true;
8132 }
8133
8135 {
8136 return true;
8137 }
8138
8140 {
8141 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8143 }
8144
8146 {
8148 }
8149
8151 {
8153 if (!is_being_placed)
8155 SetSynchDirty();
8156 }
8157
8158
8160
8162 {
8164 }
8165
8167 {
8169 }
8170
8172 {
8173 return 1;
8174 }
8175
8177 {
8178 return false;
8179 }
8180
8182 {
8184 SetSynchDirty();
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
8213
8214
8215
8216
8217
8218
8219
8220
8222 {
8223 super.OnMovedInsideCargo(container);
8224
8225 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8226 }
8227
8228 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8229 {
8230 super.EEItemLocationChanged(oldLoc,newLoc);
8231
8232 PlayerBase new_player = null;
8233 PlayerBase old_player = null;
8234
8235 if (newLoc.GetParent())
8236 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8237
8238 if (oldLoc.GetParent())
8239 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8240
8242 {
8243 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
8244
8245 if (r_index >= 0)
8246 {
8247 InventoryLocation r_il = new InventoryLocation;
8248 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8249
8250 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8253 {
8254 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8255 }
8257 {
8258 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8259 }
8260
8261 }
8262 }
8263
8265 {
8266 if (new_player)
8267 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
8268
8269 if (new_player == old_player)
8270 {
8271
8272 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8273 {
8275 {
8276 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8277 {
8278 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8279 }
8280 }
8281 else
8282 {
8283 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8284 }
8285 }
8286
8287 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8288 {
8289 int type = oldLoc.GetType();
8291 {
8292 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8293 }
8295 {
8296 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8297 }
8298 }
8299 if (!m_OldLocation)
8300 {
8301 m_OldLocation = new InventoryLocation;
8302 }
8303 m_OldLocation.Copy(oldLoc);
8304 }
8305 else
8306 {
8307 if (m_OldLocation)
8308 {
8309 m_OldLocation.Reset();
8310 }
8311 }
8312
8314 }
8315 else
8316 {
8317 if (new_player)
8318 {
8319 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8320 if (res_index >= 0)
8321 {
8322 InventoryLocation il = new InventoryLocation;
8323 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
8325 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
8328 {
8329 il.
GetParent().GetOnReleaseLock().Invoke(it);
8330 }
8332 {
8334 }
8335
8336 }
8337 }
8339 {
8340
8342 }
8343
8344 if (m_OldLocation)
8345 {
8346 m_OldLocation.Reset();
8347 }
8348 }
8349 }
8350
8351 override void EOnContact(IEntity other, Contact extra)
8352 {
8354 {
8355 int liquidType = -1;
8357 if (impactSpeed > 0.0)
8358 {
8360 #ifndef SERVER
8362 #else
8364 SetSynchDirty();
8365 #endif
8367 }
8368 }
8369
8370 #ifdef SERVER
8371 if (GetCompEM() && GetCompEM().IsPlugged())
8372 {
8373 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8374 GetCompEM().UnplugThis();
8375 }
8376 #endif
8377 }
8378
8380
8382 {
8384 }
8385
8387 {
8388
8389 }
8390
8392 {
8393 super.OnItemLocationChanged(old_owner, new_owner);
8394
8395 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8396 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8397
8398 if (!relatedPlayer && playerNew)
8399 relatedPlayer = playerNew;
8400
8401 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8402 {
8404 if (actionMgr)
8405 {
8406 ActionBase currentAction = actionMgr.GetRunningAction();
8407 if (currentAction)
8409 }
8410 }
8411
8412 Man ownerPlayerOld = null;
8413 Man ownerPlayerNew = null;
8414
8415 if (old_owner)
8416 {
8417 if (old_owner.
IsMan())
8418 {
8419 ownerPlayerOld = Man.Cast(old_owner);
8420 }
8421 else
8422 {
8423 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8424 }
8425 }
8426 else
8427 {
8429 {
8431
8432 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8433 {
8434 GetCompEM().UnplugThis();
8435 }
8436 }
8437 }
8438
8439 if (new_owner)
8440 {
8441 if (new_owner.
IsMan())
8442 {
8443 ownerPlayerNew = Man.Cast(new_owner);
8444 }
8445 else
8446 {
8447 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8448 }
8449 }
8450
8451 if (ownerPlayerOld != ownerPlayerNew)
8452 {
8453 if (ownerPlayerOld)
8454 {
8455 array<EntityAI> subItemsExit = new array<EntityAI>;
8457 for (int i = 0; i < subItemsExit.Count(); i++)
8458 {
8461 }
8462 }
8463
8464 if (ownerPlayerNew)
8465 {
8466 array<EntityAI> subItemsEnter = new array<EntityAI>;
8468 for (int j = 0; j < subItemsEnter.Count(); j++)
8469 {
8472 }
8473 }
8474 }
8475 else if (ownerPlayerNew != null)
8476 {
8477 PlayerBase nplayer;
8478 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8479 {
8480 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8482 for (int k = 0; k < subItemsUpdate.Count(); k++)
8483 {
8485 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8486 }
8487 }
8488 }
8489
8490 if (old_owner)
8491 old_owner.OnChildItemRemoved(this);
8492 if (new_owner)
8493 new_owner.OnChildItemReceived(this);
8494 }
8495
8496
8498 {
8499 super.EEDelete(parent);
8500 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8501 if (player)
8502 {
8504
8505 if (player.IsAlive())
8506 {
8507 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8508 if (r_index >= 0)
8509 {
8510 InventoryLocation r_il = new InventoryLocation;
8511 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8512
8513 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8516 {
8517 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8518 }
8520 {
8521 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8522 }
8523
8524 }
8525
8526 player.RemoveQuickBarEntityShortcut(this);
8527 }
8528 }
8529 }
8530
8532 {
8533 super.EEKilled(killer);
8534
8537 {
8538 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8539 {
8540 if (IsMagazine())
8541 {
8542 if (Magazine.Cast(this).GetAmmoCount() > 0)
8543 {
8545 }
8546 }
8547 else
8548 {
8550 }
8551 }
8552 }
8553 }
8554
8556 {
8557 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8558
8559 super.OnWasAttached(parent, slot_id);
8560
8563
8565 }
8566
8568 {
8569 super.OnWasDetached(parent, slot_id);
8570
8573 }
8574
8576 {
8577 int idx;
8580
8581 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8582 if (inventory_slots.Count() < 1)
8583 {
8584 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8585 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8586 }
8587 else
8588 {
8589 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8590 }
8591
8592 idx = inventory_slots.Find(slot);
8593 if (idx < 0)
8594 return "";
8595
8596 return attach_types.Get(idx);
8597 }
8598
8600 {
8601 int idx = -1;
8602 string slot;
8603
8606
8607 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8608 if (inventory_slots.Count() < 1)
8609 {
8610 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8611 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8612 }
8613 else
8614 {
8615 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8616 if (detach_types.Count() < 1)
8617 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8618 }
8619
8620 for (int i = 0; i < inventory_slots.Count(); i++)
8621 {
8622 slot = inventory_slots.Get(i);
8623 }
8624
8625 if (slot != "")
8626 {
8627 if (detach_types.Count() == 1)
8628 idx = 0;
8629 else
8630 idx = inventory_slots.Find(slot);
8631 }
8632 if (idx < 0)
8633 return "";
8634
8635 return detach_types.Get(idx);
8636 }
8637
8639 {
8640
8642
8643
8644 float min_time = 1;
8645 float max_time = 3;
8646 float delay = Math.RandomFloat(min_time, max_time);
8647
8648 explode_timer.Run(delay, this, "DoAmmoExplosion");
8649 }
8650
8652 {
8653 Magazine magazine = Magazine.Cast(this);
8654 int pop_sounds_count = 6;
8655 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8656
8657
8658 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8659 string sound_name = pop_sounds[ sound_idx ];
8661
8662
8663 magazine.ServerAddAmmoCount(-1);
8664
8665
8666 float min_temp_to_explode = 100;
8667
8668 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8669 {
8671 }
8672 }
8673
8674
8675 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8676 {
8677 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8678
8679 const int CHANCE_DAMAGE_CARGO = 4;
8680 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8681 const int CHANCE_DAMAGE_NOTHING = 2;
8682
8684 {
8685 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8686 int chances;
8687 int rnd;
8688
8689 if (GetInventory().GetCargo())
8690 {
8691 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8692 rnd = Math.RandomInt(0,chances);
8693
8694 if (rnd < CHANCE_DAMAGE_CARGO)
8695 {
8697 }
8698 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8699 {
8701 }
8702 }
8703 else
8704 {
8705 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8706 rnd = Math.RandomInt(0,chances);
8707
8708 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8709 {
8711 }
8712 }
8713 }
8714 }
8715
8717 {
8718 if (GetInventory().GetCargo())
8719 {
8720 int item_count = GetInventory().GetCargo().GetItemCount();
8721 if (item_count > 0)
8722 {
8723 int random_pick = Math.RandomInt(0, item_count);
8725 if (!item.IsExplosive())
8726 {
8727 item.AddHealth("","",damage);
8728 return true;
8729 }
8730 }
8731 }
8732 return false;
8733 }
8734
8736 {
8737 int attachment_count = GetInventory().AttachmentCount();
8738 if (attachment_count > 0)
8739 {
8740 int random_pick = Math.RandomInt(0, attachment_count);
8741 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
8742 if (!attachment.IsExplosive())
8743 {
8744 attachment.AddHealth("","",damage);
8745 return true;
8746 }
8747 }
8748 return false;
8749 }
8750
8752 {
8754 }
8755
8757 {
8759 return GetInventory().CanRemoveEntity();
8760
8761 return false;
8762 }
8763
8765 {
8766
8768 return false;
8769
8770
8772 return false;
8773
8774
8775
8777 if (delta == 0)
8778 return false;
8779
8780
8781 return true;
8782 }
8783
8785 {
8787 {
8788 if (ScriptInputUserData.CanStoreInputUserData())
8789 {
8790 ScriptInputUserData ctx = new ScriptInputUserData;
8795 ctx.
Write(destination_entity);
8799 }
8800 }
8801 else if (!
GetGame().IsMultiplayer())
8802 {
8804 }
8805 }
8806
8808 {
8809 float split_quantity_new;
8813 InventoryLocation loc = new InventoryLocation;
8814
8815 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8816 {
8818 split_quantity_new = stack_max;
8819 else
8821
8823 {
8824 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8825 if (new_item)
8826 {
8827 new_item.SetResultOfSplit(true);
8828 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8830 new_item.
SetQuantity(split_quantity_new,
false,
true);
8831 }
8832 }
8833 }
8834 else if (destination_entity && slot_id == -1)
8835 {
8836 if (quantity > stack_max)
8837 split_quantity_new = stack_max;
8838 else
8839 split_quantity_new = quantity;
8840
8842 {
8844 {
8847 }
8848
8849 if (new_item)
8850 {
8851 new_item.SetResultOfSplit(true);
8852 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8854 new_item.
SetQuantity(split_quantity_new,
false,
true);
8855 }
8856 }
8857 }
8858 else
8859 {
8860 if (stack_max != 0)
8861 {
8863 {
8865 }
8866
8867 if (split_quantity_new == 0)
8868 {
8869 if (!
GetGame().IsMultiplayer())
8870 player.PhysicalPredictiveDropItem(this);
8871 else
8872 player.ServerDropEntity(this);
8873 return;
8874 }
8875
8877 {
8879
8880 if (new_item)
8881 {
8882 new_item.SetResultOfSplit(true);
8883 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8886 new_item.PlaceOnSurface();
8887 }
8888 }
8889 }
8890 }
8891 }
8892
8894 {
8895 float split_quantity_new;
8899 InventoryLocation loc = new InventoryLocation;
8900
8901 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8902 {
8904 split_quantity_new = stack_max;
8905 else
8907
8909 {
8910 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8911 if (new_item)
8912 {
8913 new_item.SetResultOfSplit(true);
8914 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8916 new_item.
SetQuantity(split_quantity_new,
false,
true);
8917 }
8918 }
8919 }
8920 else if (destination_entity && slot_id == -1)
8921 {
8922 if (quantity > stack_max)
8923 split_quantity_new = stack_max;
8924 else
8925 split_quantity_new = quantity;
8926
8928 {
8930 {
8933 }
8934
8935 if (new_item)
8936 {
8937 new_item.SetResultOfSplit(true);
8938 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8940 new_item.
SetQuantity(split_quantity_new,
false,
true);
8941 }
8942 }
8943 }
8944 else
8945 {
8946 if (stack_max != 0)
8947 {
8949 {
8951 }
8952
8954 {
8956
8957 if (new_item)
8958 {
8959 new_item.SetResultOfSplit(true);
8960 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8963 new_item.PlaceOnSurface();
8964 }
8965 }
8966 }
8967 }
8968 }
8969
8971 {
8973 {
8974 if (ScriptInputUserData.CanStoreInputUserData())
8975 {
8976 ScriptInputUserData ctx = new ScriptInputUserData;
8981 dst.WriteToContext(ctx);
8983 }
8984 }
8985 else if (!
GetGame().IsMultiplayer())
8986 {
8988 }
8989 }
8990
8992 {
8994 {
8995 if (ScriptInputUserData.CanStoreInputUserData())
8996 {
8997 ScriptInputUserData ctx = new ScriptInputUserData;
9002 ctx.
Write(destination_entity);
9008 }
9009 }
9010 else if (!
GetGame().IsMultiplayer())
9011 {
9013 }
9014 }
9015
9017 {
9019 }
9020
9022 {
9024 float split_quantity_new;
9026 if (dst.IsValid())
9027 {
9028 int slot_id = dst.GetSlot();
9030
9031 if (quantity > stack_max)
9032 split_quantity_new = stack_max;
9033 else
9034 split_quantity_new = quantity;
9035
9037 {
9039
9040 if (new_item)
9041 {
9042 new_item.SetResultOfSplit(true);
9043 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9045 new_item.
SetQuantity(split_quantity_new,
false,
true);
9046 }
9047
9048 return new_item;
9049 }
9050 }
9051
9052 return null;
9053 }
9054
9056 {
9058 float split_quantity_new;
9060 if (destination_entity)
9061 {
9063 if (quantity > stackable)
9064 split_quantity_new = stackable;
9065 else
9066 split_quantity_new = quantity;
9067
9069 {
9070 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9071 if (new_item)
9072 {
9073 new_item.SetResultOfSplit(true);
9074 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9076 new_item.
SetQuantity(split_quantity_new,
false,
true);
9077 }
9078 }
9079 }
9080 }
9081
9083 {
9085 {
9086 if (ScriptInputUserData.CanStoreInputUserData())
9087 {
9088 ScriptInputUserData ctx = new ScriptInputUserData;
9093 ItemBase destination_entity =
this;
9094 ctx.
Write(destination_entity);
9098 }
9099 }
9100 else if (!
GetGame().IsMultiplayer())
9101 {
9103 }
9104 }
9105
9107 {
9109 float split_quantity_new;
9111 if (player)
9112 {
9114 if (quantity > stackable)
9115 split_quantity_new = stackable;
9116 else
9117 split_quantity_new = quantity;
9118
9120 {
9121 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9122 new_item =
ItemBase.Cast(in_hands);
9123 if (new_item)
9124 {
9125 new_item.SetResultOfSplit(true);
9126 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9128 new_item.SetQuantity(split_quantity_new, false, true);
9129 }
9130 }
9131 }
9132 }
9133
9135 {
9137 float split_quantity_new = Math.Floor(quantity * 0.5);
9138
9140 return;
9141
9143
9144 if (new_item)
9145 {
9146 if (new_item.GetQuantityMax() < split_quantity_new)
9147 {
9148 split_quantity_new = new_item.GetQuantityMax();
9149 }
9150
9151 new_item.SetResultOfSplit(true);
9152 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9153
9155 {
9158 }
9159 else
9160 {
9162 new_item.
SetQuantity(split_quantity_new,
false,
true);
9163 }
9164 }
9165 }
9166
9168 {
9170 float split_quantity_new = Math.Floor(quantity / 2);
9171
9173 return;
9174
9175 InventoryLocation invloc = new InventoryLocation;
9177
9179 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9180
9181 if (new_item)
9182 {
9183 if (new_item.GetQuantityMax() < split_quantity_new)
9184 {
9185 split_quantity_new = new_item.GetQuantityMax();
9186 }
9188 {
9191 }
9192 else if (split_quantity_new > 1)
9193 {
9195 new_item.
SetQuantity(split_quantity_new,
false,
true);
9196 }
9197 }
9198 }
9199
9202 {
9203 SetWeightDirty();
9205
9206 if (parent)
9207 parent.OnAttachmentQuantityChangedEx(this, delta);
9208
9210 {
9212 {
9214 }
9216 {
9217 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9219 }
9220 }
9221
9222 }
9223
9226 {
9227
9228 }
9229
9232 {
9234 }
9235
9237 {
9238 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9239
9241 {
9242 if (newLevel == GameConstants.STATE_RUINED)
9243 {
9245 EntityAI parent = GetHierarchyParent();
9246 if (parent && parent.IsFireplace())
9247 {
9248 CargoBase cargo = GetInventory().GetCargo();
9249 if (cargo)
9250 {
9252 {
9254 }
9255 }
9256 }
9257 }
9258
9260 {
9261
9263 return;
9264 }
9265
9266 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9267 {
9269 }
9270 }
9271 }
9272
9273
9275 {
9276 super.OnRightClick();
9277
9279 {
9281 {
9282 if (ScriptInputUserData.CanStoreInputUserData())
9283 {
9284 EntityAI root = GetHierarchyRoot();
9285 Man playerOwner = GetHierarchyRootPlayer();
9286 InventoryLocation dst = new InventoryLocation;
9287
9288
9289 if (!playerOwner && root && root == this)
9290 {
9292 }
9293 else
9294 {
9295
9296 GetInventory().GetCurrentInventoryLocation(dst);
9298 {
9301 {
9303 }
9304 else
9305 {
9307
9308
9309 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9310 {
9312 }
9313 else
9314 {
9315 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9316 }
9317 }
9318 }
9319 }
9320
9321 ScriptInputUserData ctx = new ScriptInputUserData;
9329 }
9330 }
9331 else if (!
GetGame().IsMultiplayer())
9332 {
9334 }
9335 }
9336 }
9337
9339 {
9340 if (root)
9341 {
9342 vector m4[4];
9343 root.GetTransform(m4);
9344 dst.SetGround(this, m4);
9345 }
9346 else
9347 {
9348 GetInventory().GetCurrentInventoryLocation(dst);
9349 }
9350 }
9351
9352 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9353 {
9354
9355 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9356 return false;
9357
9358 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9359 return false;
9360
9361
9363 return false;
9364
9365
9366 Magazine mag = Magazine.Cast(this);
9367 if (mag)
9368 {
9369 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9370 return false;
9371
9372 if (stack_max_limit)
9373 {
9374 Magazine other_mag = Magazine.Cast(other_item);
9375 if (other_item)
9376 {
9377 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9378 return false;
9379 }
9380
9381 }
9382 }
9383 else
9384 {
9385
9387 return false;
9388
9390 return false;
9391 }
9392
9393 PlayerBase player = null;
9394 if (CastTo(player, GetHierarchyRootPlayer()))
9395 {
9396 if (player.GetInventory().HasAttachment(this))
9397 return false;
9398
9399 if (player.IsItemsToDelete())
9400 return false;
9401 }
9402
9403 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9404 return false;
9405
9406 int slotID;
9408 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9409 return false;
9410
9411 return true;
9412 }
9413
9415 {
9417 }
9418
9420 {
9421 return m_IsResultOfSplit;
9422 }
9423
9425 {
9426 m_IsResultOfSplit = value;
9427 }
9428
9430 {
9432 }
9433
9435 {
9436 float other_item_quantity = other_item.GetQuantity();
9437 float this_free_space;
9438
9440
9442
9443 if (other_item_quantity > this_free_space)
9444 {
9445 return this_free_space;
9446 }
9447 else
9448 {
9449 return other_item_quantity;
9450 }
9451 }
9452
9454 {
9456 }
9457
9459 {
9461 return;
9462
9463 if (!IsMagazine() && other_item)
9464 {
9466 if (quantity_used != 0)
9467 {
9468 float hp1 = GetHealth01("","");
9469 float hp2 = other_item.GetHealth01("","");
9470 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9471 hpResult = hpResult / (
GetQuantity() + quantity_used);
9472
9473 hpResult *= GetMaxHealth();
9474 Math.Round(hpResult);
9475 SetHealth("", "Health", hpResult);
9476
9478 other_item.AddQuantity(-quantity_used);
9479 }
9480 }
9482 }
9483
9485 {
9486 #ifdef SERVER
9487 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9488 GetHierarchyParent().IncreaseLifetimeUp();
9489 #endif
9490 };
9491
9493 {
9494 PlayerBase p = PlayerBase.Cast(player);
9495
9496 array<int> recipesIds = p.m_Recipes;
9497 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9498 if (moduleRecipesManager)
9499 {
9500 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
9501 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9502 }
9503
9504 for (int i = 0;i < recipesIds.Count(); i++)
9505 {
9506 int key = recipesIds.Get(i);
9507 string recipeName = moduleRecipesManager.GetRecipeName(key);
9509 }
9510 }
9511
9512
9513 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9514 {
9515 super.GetDebugActions(outputList);
9516
9517
9523
9524
9529
9534
9535
9539
9540
9542 {
9546 }
9547
9550
9551
9555
9557
9558 InventoryLocation loc = new InventoryLocation();
9559 GetInventory().GetCurrentInventoryLocation(loc);
9561 {
9562 if (Gizmo_IsSupported())
9565 }
9566
9568 }
9569
9570
9571
9572
9574 {
9575 super.OnAction(action_id, player, ctx);
9576
9578 {
9579 switch (action_id)
9580 {
9583 return true;
9586 return true;
9587 }
9588 }
9589
9591 {
9592 switch (action_id)
9593 {
9595 Delete();
9596 return true;
9597 }
9598 }
9599
9600 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9601 {
9602 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9603 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9604 PlayerBase p = PlayerBase.Cast(player);
9605 if (
EActions.RECIPES_RANGE_START < 1000)
9606 {
9607 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9608 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9609 }
9610 }
9611 #ifndef SERVER
9612 else if (action_id ==
EActions.WATCH_PLAYER)
9613 {
9614 PluginDeveloper.SetDeveloperItemClientEx(player);
9615 }
9616 #endif
9618 {
9619 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9620 {
9621 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9622 OnDebugButtonPressServer(id + 1);
9623 }
9624
9625 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9626 {
9627 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9629 }
9630
9631 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9632 {
9633 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9635 }
9636
9637 else if (action_id ==
EActions.ADD_QUANTITY)
9638 {
9639 if (IsMagazine())
9640 {
9641 Magazine mag = Magazine.Cast(this);
9642 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9643 }
9644 else
9645 {
9647 }
9648
9649 if (m_EM)
9650 {
9651 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9652 }
9653
9654 }
9655
9656 else if (action_id ==
EActions.REMOVE_QUANTITY)
9657 {
9658 if (IsMagazine())
9659 {
9660 Magazine mag2 = Magazine.Cast(this);
9661 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9662 }
9663 else
9664 {
9666 }
9667 if (m_EM)
9668 {
9669 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9670 }
9671
9672 }
9673
9674 else if (action_id ==
EActions.SET_QUANTITY_0)
9675 {
9677
9678 if (m_EM)
9679 {
9680 m_EM.SetEnergy(0);
9681 }
9682 }
9683
9684 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9685 {
9687
9688 if (m_EM)
9689 {
9690 m_EM.SetEnergy(m_EM.GetEnergyMax());
9691 }
9692 }
9693
9694 else if (action_id ==
EActions.ADD_HEALTH)
9695 {
9696 AddHealth("","",GetMaxHealth("","Health")/5);
9697 }
9698 else if (action_id ==
EActions.REMOVE_HEALTH)
9699 {
9700 AddHealth("","",-GetMaxHealth("","Health")/5);
9701 }
9702 else if (action_id ==
EActions.DESTROY_HEALTH)
9703 {
9704 SetHealth01("","",0);
9705 }
9706 else if (action_id ==
EActions.WATCH_ITEM)
9707 {
9709 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9710 #ifdef DEVELOPER
9711 SetDebugDeveloper_item(this);
9712 #endif
9713 }
9714
9715 else if (action_id ==
EActions.ADD_TEMPERATURE)
9716 {
9717 AddTemperature(20);
9718
9719 }
9720
9721 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9722 {
9723 AddTemperature(-20);
9724
9725 }
9726
9727 else if (action_id ==
EActions.FLIP_FROZEN)
9728 {
9729 SetFrozen(!GetIsFrozen());
9730
9731 }
9732
9733 else if (action_id ==
EActions.ADD_WETNESS)
9734 {
9736
9737 }
9738
9739 else if (action_id ==
EActions.REMOVE_WETNESS)
9740 {
9742
9743 }
9744
9745 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9746 {
9749
9750
9751 }
9752
9753 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9754 {
9757 }
9758
9759 else if (action_id ==
EActions.MAKE_SPECIAL)
9760 {
9761 auto debugParams = DebugSpawnParams.WithPlayer(player);
9762 OnDebugSpawnEx(debugParams);
9763 }
9764
9765 }
9766
9767
9768 return false;
9769 }
9770
9771
9772
9773
9777
9780
9781
9782
9784 {
9785 return false;
9786 }
9787
9788
9790 {
9791 return true;
9792 }
9793
9794
9796 {
9797 return true;
9798 }
9799
9800
9801
9803 {
9804 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9806 }
9807
9810 {
9811 return null;
9812 }
9813
9815 {
9816 return false;
9817 }
9818
9820 {
9821 return false;
9822 }
9823
9827
9828
9830 {
9831 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9832 return module_repairing.CanRepair(this, item_repair_kit);
9833 }
9834
9835
9836 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9837 {
9838 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9839 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9840 }
9841
9842
9844 {
9845
9846
9847
9848
9849
9850
9851
9852
9853 return 1;
9854 }
9855
9856
9857
9859 {
9861 }
9862
9863
9864
9866 {
9868 }
9869
9870
9879 {
9880 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9881
9882 if (player)
9883 {
9884 player.MessageStatus(text);
9885 }
9886 }
9887
9888
9897 {
9898 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9899
9900 if (player)
9901 {
9902 player.MessageAction(text);
9903 }
9904 }
9905
9906
9915 {
9916 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9917
9918 if (player)
9919 {
9920 player.MessageFriendly(text);
9921 }
9922 }
9923
9924
9933 {
9934 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9935
9936 if (player)
9937 {
9938 player.MessageImportant(text);
9939 }
9940 }
9941
9943 {
9944 return true;
9945 }
9946
9947
9948 override bool KindOf(
string tag)
9949 {
9950 bool found = false;
9951 string item_name = this.
GetType();
9954
9955 int array_size = item_tag_array.Count();
9956 for (int i = 0; i < array_size; i++)
9957 {
9958 if (item_tag_array.Get(i) == tag)
9959 {
9960 found = true;
9961 break;
9962 }
9963 }
9964 return found;
9965 }
9966
9967
9969 {
9970
9971 super.OnRPC(sender, rpc_type,ctx);
9972
9973
9974 switch (rpc_type)
9975 {
9976 #ifndef SERVER
9977 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9978 Param2<bool, string> p = new Param2<bool, string>(false, "");
9979
9981 return;
9982
9983 bool play = p.param1;
9984 string soundSet = p.param2;
9985
9986 if (play)
9987 {
9989 {
9991 {
9993 }
9994 }
9995 else
9996 {
9998 }
9999 }
10000 else
10001 {
10003 }
10004
10005 break;
10006 #endif
10007
10008 }
10009
10011 {
10013 }
10014 }
10015
10016
10017
10018
10020 {
10021 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10022 return plugin.GetID(
name);
10023 }
10024
10026 {
10027 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10028 return plugin.GetName(id);
10029 }
10030
10033 {
10034
10035
10036 int varFlags;
10037 if (!ctx.
Read(varFlags))
10038 return;
10039
10040 if (varFlags & ItemVariableFlags.FLOAT)
10041 {
10043 }
10044 }
10045
10047 {
10048
10049 super.SerializeNumericalVars(floats_out);
10050
10051
10052
10054 {
10056 }
10057
10059 {
10061 }
10062
10064 {
10066 }
10067
10069 {
10074 }
10075
10077 {
10079 }
10080 }
10081
10083 {
10084
10085 super.DeSerializeNumericalVars(floats);
10086
10087
10088 int index = 0;
10089 int mask = Math.Round(floats.Get(index));
10090
10091 index++;
10092
10094 {
10096 {
10098 }
10099 else
10100 {
10101 float quantity = floats.Get(index);
10102 SetQuantity(quantity,
true,
false,
false,
false);
10103 }
10104 index++;
10105 }
10106
10108 {
10109 float wet = floats.Get(index);
10111 index++;
10112 }
10113
10115 {
10116 int liquidtype = Math.Round(floats.Get(index));
10118 index++;
10119 }
10120
10122 {
10124 index++;
10126 index++;
10128 index++;
10130 index++;
10131 }
10132
10134 {
10135 int cleanness = Math.Round(floats.Get(index));
10137 index++;
10138 }
10139 }
10140
10142 {
10143 super.WriteVarsToCTX(ctx);
10144
10145
10147 {
10149 }
10150
10152 {
10154 }
10155
10157 {
10159 }
10160
10162 {
10163 int r,g,b,a;
10169 }
10170
10172 {
10174 }
10175 }
10176
10178 {
10179 if (!super.ReadVarsFromCTX(ctx,version))
10180 return false;
10181
10182 int intValue;
10183 float value;
10184
10185 if (version < 140)
10186 {
10187 if (!ctx.
Read(intValue))
10188 return false;
10189
10190 m_VariablesMask = intValue;
10191 }
10192
10194 {
10195 if (!ctx.
Read(value))
10196 return false;
10197
10199 {
10201 }
10202 else
10203 {
10205 }
10206 }
10207
10208 if (version < 140)
10209 {
10211 {
10212 if (!ctx.
Read(value))
10213 return false;
10214 SetTemperatureDirect(value);
10215 }
10216 }
10217
10219 {
10220 if (!ctx.
Read(value))
10221 return false;
10223 }
10224
10226 {
10227 if (!ctx.
Read(intValue))
10228 return false;
10230 }
10231
10233 {
10234 int r,g,b,a;
10236 return false;
10238 return false;
10240 return false;
10242 return false;
10243
10245 }
10246
10248 {
10249 if (!ctx.
Read(intValue))
10250 return false;
10252 }
10253
10254 if (version >= 138 && version < 140)
10255 {
10257 {
10258 if (!ctx.
Read(intValue))
10259 return false;
10260 SetFrozen(intValue);
10261 }
10262 }
10263
10264 return true;
10265 }
10266
10267
10269 {
10272 {
10274 }
10275
10276 if (!super.OnStoreLoad(ctx, version))
10277 {
10279 return false;
10280 }
10281
10282 if (version >= 114)
10283 {
10284 bool hasQuickBarIndexSaved;
10285
10286 if (!ctx.
Read(hasQuickBarIndexSaved))
10287 {
10289 return false;
10290 }
10291
10292 if (hasQuickBarIndexSaved)
10293 {
10294 int itmQBIndex;
10295
10296
10297 if (!ctx.
Read(itmQBIndex))
10298 {
10300 return false;
10301 }
10302
10303 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10304 if (itmQBIndex != -1 && parentPlayer)
10305 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10306 }
10307 }
10308 else
10309 {
10310
10311 PlayerBase player;
10312 int itemQBIndex;
10313 if (version ==
int.
MAX)
10314 {
10315 if (!ctx.
Read(itemQBIndex))
10316 {
10318 return false;
10319 }
10320 }
10321 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10322 {
10323
10324 if (!ctx.
Read(itemQBIndex))
10325 {
10327 return false;
10328 }
10329 if (itemQBIndex != -1 && player)
10330 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10331 }
10332 }
10333
10334 if (version < 140)
10335 {
10336
10337 if (!LoadVariables(ctx, version))
10338 {
10340 return false;
10341 }
10342 }
10343
10344
10346 {
10348 return false;
10349 }
10350 if (version >= 132)
10351 {
10353 if (raib)
10354 {
10356 {
10358 return false;
10359 }
10360 }
10361 }
10362
10364 return true;
10365 }
10366
10367
10368
10370 {
10371 super.OnStoreSave(ctx);
10372
10373 PlayerBase player;
10374 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10375 {
10377
10378 int itemQBIndex = -1;
10379 itemQBIndex = player.FindQuickBarEntityIndex(this);
10380 ctx.
Write(itemQBIndex);
10381 }
10382 else
10383 {
10385 }
10386
10388
10390 if (raib)
10391 {
10393 }
10394 }
10395
10396
10398 {
10399 super.AfterStoreLoad();
10400
10402 {
10404 }
10405
10407 {
10410 }
10411 }
10412
10414 {
10415 super.EEOnAfterLoad();
10416
10418 {
10420 }
10421
10424 }
10425
10427 {
10428 return false;
10429 }
10430
10431
10432
10434 {
10436 {
10437 #ifdef PLATFORM_CONSOLE
10438
10440 {
10442 if (menu)
10443 {
10445 }
10446 }
10447 #endif
10448 }
10449
10451 {
10454 }
10455
10457 {
10458 SetWeightDirty();
10460 }
10462 {
10465 }
10466
10468 {
10471 }
10473 {
10476 }
10477
10478 super.OnVariablesSynchronized();
10479 }
10480
10481
10482
10484 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10485 {
10486 if (!IsServerCheck(allow_client))
10487 return false;
10488
10490 return false;
10491
10494
10495 if (value <= (min + 0.001))
10496 value = min;
10497
10498 if (value == min)
10499 {
10500 if (destroy_config)
10501 {
10502 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10503 if (dstr)
10504 {
10506 this.Delete();
10507 return true;
10508 }
10509 }
10510 else if (destroy_forced)
10511 {
10513 this.Delete();
10514 return true;
10515 }
10516
10518 }
10519
10522
10524 {
10526
10527 if (delta)
10529 }
10530
10532
10533 return false;
10534 }
10535
10536
10538 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10539 {
10541 }
10542
10544 {
10547 }
10548
10550 {
10553 }
10554
10556 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10557 {
10558 float value_clamped = Math.Clamp(value, 0, 1);
10560 SetQuantity(result, destroy_config, destroy_forced);
10561 }
10562
10563
10566 {
10568 }
10569
10571 {
10573 }
10574
10575
10576
10577
10578
10579
10580
10581
10582
10583
10585 {
10586 int slot = -1;
10587 if (GetInventory())
10588 {
10589 InventoryLocation il = new InventoryLocation;
10590 GetInventory().GetCurrentInventoryLocation(il);
10592 }
10593
10595 }
10596
10598 {
10599 float quantity_max = 0;
10600
10602 {
10603 if (attSlotID != -1)
10604 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10605
10606 if (quantity_max <= 0)
10608 }
10609
10610 if (quantity_max <= 0)
10612
10613 return quantity_max;
10614 }
10615
10617 {
10619 }
10620
10622 {
10624 }
10625
10626
10628 {
10630 }
10631
10633 {
10635 }
10636
10638 {
10640 }
10641
10642
10644 {
10645
10646 float weightEx = GetWeightEx();
10647 float special = GetInventoryAndCargoWeight();
10648 return weightEx - special;
10649 }
10650
10651
10653 {
10655 }
10656
10658 {
10660 {
10661 #ifdef DEVELOPER
10662 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10663 {
10664 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10666 }
10667 #endif
10668
10669 return GetQuantity() * GetConfigWeightModified();
10670 }
10671 else if (HasEnergyManager())
10672 {
10673 #ifdef DEVELOPER
10674 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10675 {
10676 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10677 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10678 }
10679 #endif
10680 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10681 }
10682 else
10683 {
10684 #ifdef DEVELOPER
10685 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10686 {
10687 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10688 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10689 }
10690 #endif
10691 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10692 }
10693 }
10694
10697 {
10698 int item_count = 0;
10700
10701 if (GetInventory().GetCargo() != NULL)
10702 {
10703 item_count = GetInventory().GetCargo().GetItemCount();
10704 }
10705
10706 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
10707 {
10708 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
10709 if (item)
10710 item_count += item.GetNumberOfItems();
10711 }
10712 return item_count;
10713 }
10714
10717 {
10718 float weight = 0;
10719 float wetness = 1;
10720 if (include_wetness)
10723 {
10724 weight = wetness * m_ConfigWeight;
10725 }
10727 {
10728 weight = 1;
10729 }
10730 return weight;
10731 }
10732
10733
10734
10736 {
10737 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
10738 {
10739 GameInventory inv = GetInventory();
10740 array<EntityAI> items = new array<EntityAI>;
10742 for (int i = 0; i < items.Count(); i++)
10743 {
10745 if (item)
10746 {
10748 }
10749 }
10750 }
10751 }
10752
10753
10754
10755
10757 {
10758 float energy = 0;
10759 if (HasEnergyManager())
10760 {
10761 energy = GetCompEM().GetEnergy();
10762 }
10763 return energy;
10764 }
10765
10766
10768 {
10769 super.OnEnergyConsumed();
10770
10772 }
10773
10775 {
10776 super.OnEnergyAdded();
10777
10779 }
10780
10781
10783 {
10784 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10785 {
10787 {
10788 float energy_0to1 = GetCompEM().GetEnergy0To1();
10790 }
10791 }
10792 }
10793
10794
10796 {
10797 return ConfigGetFloat("heatIsolation");
10798 }
10799
10801 {
10803 }
10804
10806 {
10807 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10808 if (
GetGame().ConfigIsExisting(paramPath))
10810
10811 return 0.0;
10812 }
10813
10815 {
10816 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10817 if (
GetGame().ConfigIsExisting(paramPath))
10819
10820 return 0.0;
10821 }
10822
10823 override void SetWet(
float value,
bool allow_client =
false)
10824 {
10825 if (!IsServerCheck(allow_client))
10826 return;
10827
10830
10832
10833 m_VarWet = Math.Clamp(value, min, max);
10834
10836 {
10839 }
10840 }
10841
10842 override void AddWet(
float value)
10843 {
10845 }
10846
10848 {
10850 }
10851
10853 {
10855 }
10856
10858 {
10860 }
10861
10863 {
10865 }
10866
10868 {
10870 }
10871
10872 override void OnWetChanged(
float newVal,
float oldVal)
10873 {
10876 if (newLevel != oldLevel)
10877 {
10879 }
10880 }
10881
10883 {
10884 SetWeightDirty();
10885 }
10886
10888 {
10889 return GetWetLevelInternal(
m_VarWet);
10890 }
10891
10892
10893
10895 {
10897 }
10898
10900 {
10902 }
10903
10905 {
10907 }
10908
10910 {
10912 }
10913
10914
10915
10917 {
10918 if (ConfigIsExisting("itemModelLength"))
10919 {
10920 return ConfigGetFloat("itemModelLength");
10921 }
10922 return 0;
10923 }
10924
10926 {
10927 if (ConfigIsExisting("itemAttachOffset"))
10928 {
10929 return ConfigGetFloat("itemAttachOffset");
10930 }
10931 return 0;
10932 }
10933
10934 override void SetCleanness(
int value,
bool allow_client =
false)
10935 {
10936 if (!IsServerCheck(allow_client))
10937 return;
10938
10940
10942
10945 }
10946
10948 {
10950 }
10951
10953 {
10954 return true;
10955 }
10956
10957
10958
10959
10961 {
10963 }
10964
10966 {
10968 }
10969
10970
10971
10972
10973 override void SetColor(
int r,
int g,
int b,
int a)
10974 {
10980 }
10982 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10983 {
10988 }
10989
10991 {
10993 }
10994
10997 {
10998 int r,g,b,a;
11000 r = r/255;
11001 g = g/255;
11002 b = b/255;
11003 a = a/255;
11004 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11005 }
11006
11007
11008
11009 override void SetLiquidType(
int value,
bool allow_client =
false)
11010 {
11011 if (!IsServerCheck(allow_client))
11012 return;
11013
11018 }
11019
11021 {
11022 return ConfigGetInt("varLiquidTypeInit");
11023 }
11024
11026 {
11028 }
11029
11031 {
11033 SetFrozen(false);
11034 }
11035
11038 {
11039 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11040 }
11041
11042
11045 {
11046 PlayerBase nplayer;
11047 if (PlayerBase.CastTo(nplayer, player))
11048 {
11050
11051 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11052 }
11053 }
11054
11055
11058 {
11059 PlayerBase nplayer;
11060 if (PlayerBase.CastTo(nplayer,player))
11061 {
11062
11063 nplayer.SetEnableQuickBarEntityShortcut(this,false);
11064
11065 }
11066
11067
11068 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11069
11070
11071 if (HasEnergyManager())
11072 {
11073 GetCompEM().UpdatePlugState();
11074 }
11075 }
11076
11077
11079 {
11080 super.OnPlacementStarted(player);
11081
11083 }
11084
11085 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11086 {
11088 {
11089 m_AdminLog.OnPlacementComplete(player,
this);
11090 }
11091
11092 super.OnPlacementComplete(player, position, orientation);
11093 }
11094
11095
11096
11097
11098
11100 {
11102 {
11103 return true;
11104 }
11105 else
11106 {
11107 return false;
11108 }
11109 }
11110
11111
11113 {
11115 {
11117 }
11118 }
11119
11120
11122 {
11124 }
11125
11127 {
11129 }
11130
11131 override void InsertAgent(
int agent,
float count = 1)
11132 {
11133 if (count < 1)
11134 return;
11135
11137 }
11138
11141 {
11143 }
11144
11145
11147 {
11149 }
11150
11151
11152
11153
11154
11155
11156
11157
11158
11159
11160
11161
11162
11163
11164
11165
11166
11167
11168
11169
11170
11171
11172
11173
11174
11175
11176
11177
11178
11179
11180
11181
11182
11183
11184
11185
11186
11187
11188
11189
11190
11191
11193 {
11195 return false;
11196 return true;
11197 }
11198
11200 {
11201
11203 }
11204
11205
11208 {
11209 super.CheckForRoofLimited(timeTresholdMS);
11210
11212 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11213 {
11214 m_PreviousRoofTestTime = time;
11215 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11216 }
11217 }
11218
11219
11221 {
11223 {
11224 return 0;
11225 }
11226
11227 if (GetInventory().GetAttachmentSlotsCount() != 0)
11228 {
11229 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11230 if (filter)
11231 return filter.GetProtectionLevel(type, false, system);
11232 else
11233 return 0;
11234 }
11235
11236 string subclassPath, entryName;
11237
11238 switch (type)
11239 {
11241 entryName = "biological";
11242 break;
11244 entryName = "chemical";
11245 break;
11246 default:
11247 entryName = "biological";
11248 break;
11249 }
11250
11251 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11252
11254 }
11255
11256
11257
11260 {
11261 if (!IsMagazine())
11263
11265 }
11266
11267
11268
11269
11270
11275 {
11276 return true;
11277 }
11278
11280 {
11282 }
11283
11284
11285
11286
11287
11289 {
11290 if (parent)
11291 {
11292 if (parent.IsInherited(DayZInfected))
11293 return true;
11294
11295 if (!parent.IsRuined())
11296 return true;
11297 }
11298
11299 return true;
11300 }
11301
11303 {
11304 if (!super.CanPutAsAttachment(parent))
11305 {
11306 return false;
11307 }
11308
11309 if (!IsRuined() && !parent.IsRuined())
11310 {
11311 return true;
11312 }
11313
11314 return false;
11315 }
11316
11318 {
11319
11320
11321
11322
11323 return super.CanReceiveItemIntoCargo(item);
11324 }
11325
11327 {
11328
11329
11330
11331
11332 GameInventory attachmentInv = attachment.GetInventory();
11334 {
11335 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11336 return false;
11337 }
11338
11339 InventoryLocation loc = new InventoryLocation();
11340 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11341 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11342 return false;
11343
11344 return super.CanReceiveAttachment(attachment, slotId);
11345 }
11346
11348 {
11349 if (!super.CanReleaseAttachment(attachment))
11350 return false;
11351
11352 return GetInventory().AreChildrenAccessible();
11353 }
11354
11355
11356
11357
11358
11359
11360
11361
11362
11363
11364
11365
11366
11367
11368
11369
11370
11371
11372
11373
11374
11376 {
11377 int id = muzzle_owner.GetMuzzleID();
11378 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11379
11380 if (WPOF_array)
11381 {
11382 for (int i = 0; i < WPOF_array.Count(); i++)
11383 {
11384 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11385
11386 if (WPOF)
11387 {
11388 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11389 }
11390 }
11391 }
11392 }
11393
11394
11396 {
11397 int id = muzzle_owner.GetMuzzleID();
11399
11400 if (WPOBE_array)
11401 {
11402 for (int i = 0; i < WPOBE_array.Count(); i++)
11403 {
11404 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11405
11406 if (WPOBE)
11407 {
11408 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11409 }
11410 }
11411 }
11412 }
11413
11414
11416 {
11417 int id = muzzle_owner.GetMuzzleID();
11418 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11419
11420 if (WPOOH_array)
11421 {
11422 for (int i = 0; i < WPOOH_array.Count(); i++)
11423 {
11424 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11425
11426 if (WPOOH)
11427 {
11428 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11429 }
11430 }
11431 }
11432 }
11433
11434
11436 {
11437 int id = muzzle_owner.GetMuzzleID();
11438 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11439
11440 if (WPOOH_array)
11441 {
11442 for (int i = 0; i < WPOOH_array.Count(); i++)
11443 {
11444 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11445
11446 if (WPOOH)
11447 {
11448 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11449 }
11450 }
11451 }
11452 }
11453
11454
11456 {
11457 int id = muzzle_owner.GetMuzzleID();
11458 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11459
11460 if (WPOOH_array)
11461 {
11462 for (int i = 0; i < WPOOH_array.Count(); i++)
11463 {
11464 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11465
11466 if (WPOOH)
11467 {
11468 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11469 }
11470 }
11471 }
11472 }
11473
11474
11475
11477 {
11479 {
11480 return true;
11481 }
11482
11483 return false;
11484 }
11485
11487 {
11489 {
11490 return true;
11491 }
11492
11493 return false;
11494 }
11495
11497 {
11499 {
11500 return true;
11501 }
11502
11503 return false;
11504 }
11505
11507 {
11508 return false;
11509 }
11510
11513 {
11514 return UATimeSpent.DEFAULT_DEPLOY;
11515 }
11516
11517
11518
11519
11521 {
11523 SetSynchDirty();
11524 }
11525
11527 {
11529 }
11530
11531
11533 {
11534 return false;
11535 }
11536
11539 {
11540 string att_type = "None";
11541
11542 if (ConfigIsExisting("soundAttType"))
11543 {
11544 att_type = ConfigGetString("soundAttType");
11545 }
11546
11548 }
11549
11551 {
11553 }
11554
11555
11556
11557
11558
11564
11566 {
11569
11571 }
11572
11573
11575 {
11577 return;
11578
11580
11583
11586
11587 SoundParameters params = new SoundParameters();
11591 }
11592
11593
11595 {
11597 return;
11598
11600 SetSynchDirty();
11601
11604 }
11605
11606
11608 {
11610 return;
11611
11613 SetSynchDirty();
11614
11617 }
11618
11620 {
11622 }
11623
11625 {
11627 }
11628
11631 {
11632 if (!
GetGame().IsDedicatedServer())
11633 {
11634 if (ConfigIsExisting("attachSoundSet"))
11635 {
11636 string cfg_path = "";
11637 string soundset = "";
11638 string type_name =
GetType();
11639
11642 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11643 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11644
11645 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11646 {
11647 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11648 {
11649 if (cfg_slot_array[i] == slot_type)
11650 {
11651 soundset = cfg_soundset_array[i];
11652 break;
11653 }
11654 }
11655 }
11656
11657 if (soundset != "")
11658 {
11659 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11661 }
11662 }
11663 }
11664 }
11665
11667 {
11668
11669 }
11670
11671 void OnApply(PlayerBase player);
11672
11674 {
11675 return 1.0;
11676 };
11677
11679 {
11681 }
11682
11684 {
11686 }
11687
11689
11691 {
11692 SetDynamicPhysicsLifeTime(0.01);
11694 }
11695
11697 {
11698 array<string> zone_names = new array<string>;
11699 GetDamageZones(zone_names);
11700 for (int i = 0; i < zone_names.Count(); i++)
11701 {
11702 SetHealthMax(zone_names.Get(i),"Health");
11703 }
11704 SetHealthMax("","Health");
11705 }
11706
11709 {
11710 float global_health = GetHealth01("","Health");
11711 array<string> zones = new array<string>;
11712 GetDamageZones(zones);
11713
11714 for (int i = 0; i < zones.Count(); i++)
11715 {
11716 SetHealth01(zones.Get(i),"Health",global_health);
11717 }
11718 }
11719
11722 {
11723 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11724 }
11725
11727 {
11728 if (!hasRootAsPlayer)
11729 {
11730 if (refParentIB)
11731 {
11732
11733 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11734 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11735
11736 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11737 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11738
11741 }
11742 else
11743 {
11744
11747 }
11748 }
11749 }
11750
11752 {
11754 {
11755 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11756 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11757 {
11758 float heatPermCoef = 1.0;
11760 while (ent)
11761 {
11762 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11763 ent = ent.GetHierarchyParent();
11764 }
11765
11766 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11767 }
11768 }
11769 }
11770
11772 {
11773
11774 EntityAI parent = GetHierarchyParent();
11775 if (!parent)
11776 {
11777 hasParent = false;
11778 hasRootAsPlayer = false;
11779 }
11780 else
11781 {
11782 hasParent = true;
11783 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11784 refParentIB =
ItemBase.Cast(parent);
11785 }
11786 }
11787
11788 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11789 {
11790
11791 }
11792
11794 {
11795
11796 return false;
11797 }
11798
11800 {
11801
11802
11803 return false;
11804 }
11805
11807 {
11808
11809 return false;
11810 }
11811
11814 {
11815 return !GetIsFrozen() &&
IsOpen();
11816 }
11817
11819 {
11820 bool hasParent = false, hasRootAsPlayer = false;
11822
11823 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11824 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11825
11826 if (wwtu || foodDecay)
11827 {
11831
11832 if (processWetness || processTemperature || processDecay)
11833 {
11835
11836 if (processWetness)
11837 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11838
11839 if (processTemperature)
11841
11842 if (processDecay)
11843 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11844 }
11845 }
11846 }
11847
11850 {
11852 }
11853
11855 {
11858
11859 return super.GetTemperatureFreezeThreshold();
11860 }
11861
11863 {
11866
11867 return super.GetTemperatureThawThreshold();
11868 }
11869
11871 {
11874
11875 return super.GetItemOverheatThreshold();
11876 }
11877
11879 {
11881 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11882
11883 return super.GetTemperatureFreezeTime();
11884 }
11885
11887 {
11889 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11890
11891 return super.GetTemperatureThawTime();
11892 }
11893
11898
11900 {
11901 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11902 }
11903
11905 {
11906 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11907 }
11908
11911 {
11913 }
11914
11916 {
11918 }
11919
11921 {
11923 }
11924
11927 {
11928 return null;
11929 }
11930
11933 {
11934 return false;
11935 }
11936
11938 {
11940 {
11943 if (!trg)
11944 {
11946 explosive = this;
11947 }
11948
11949 explosive.PairRemote(trg);
11951
11952 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11953 trg.SetPersistentPairID(persistentID);
11954 explosive.SetPersistentPairID(persistentID);
11955
11956 return true;
11957 }
11958 return false;
11959 }
11960
11963 {
11964 float ret = 1.0;
11967 ret *= GetHealth01();
11968
11969 return ret;
11970 }
11971
11972 #ifdef DEVELOPER
11973 override void SetDebugItem()
11974 {
11975 super.SetDebugItem();
11976 _itemBase = this;
11977 }
11978
11980 {
11981 string text = super.GetDebugText();
11982
11984 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11985
11986 return text;
11987 }
11988 #endif
11989
11991 {
11992 return true;
11993 }
11994
11996
11998
12000 {
12003 }
12004
12005
12013
12029}
12030
12032{
12034 if (entity)
12035 {
12036 bool is_item = entity.IsInherited(
ItemBase);
12037 if (is_item && full_quantity)
12038 {
12041 }
12042 }
12043 else
12044 {
12046 return NULL;
12047 }
12048 return entity;
12049}
12050
12052{
12053 if (item)
12054 {
12055 if (health > 0)
12056 item.SetHealth("", "", health);
12057
12058 if (item.CanHaveTemperature())
12059 {
12061 if (item.CanFreeze())
12062 item.SetFrozen(false);
12063 }
12064
12065 if (item.HasEnergyManager())
12066 {
12067 if (quantity >= 0)
12068 {
12069 item.GetCompEM().SetEnergy0To1(quantity);
12070 }
12071 else
12072 {
12074 }
12075 }
12076 else if (item.IsMagazine())
12077 {
12078 Magazine mag = Magazine.Cast(item);
12079 if (quantity >= 0)
12080 {
12081 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12082 }
12083 else
12084 {
12086 }
12087
12088 }
12089 else
12090 {
12091 if (quantity >= 0)
12092 {
12093 item.SetQuantityNormalized(quantity, false);
12094 }
12095 else
12096 {
12098 }
12099
12100 }
12101 }
12102}
12103
12104#ifdef DEVELOPER
12106#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.