7315{
7317 {
7318 return true;
7319 }
7320};
7321
7322
7323
7325{
7329
7331
7334
7335
7336
7337
7338
7347
7353
7358
7363
7384 protected bool m_IsResultOfSplit
7385
7387
7392
7393
7394
7396
7400
7401
7402
7404
7407
7408
7409
7415
7416
7424
7427
7428
7430
7431
7433
7434
7439
7440
7445
7446
7448
7449
7451 {
7456
7457 if (!
GetGame().IsDedicatedServer())
7458 {
7460 {
7462
7464 {
7466 }
7467 }
7468
7471 }
7472
7473 m_OldLocation = null;
7474
7476 {
7478 }
7479
7480 if (ConfigIsExisting("headSelectionsToHide"))
7481 {
7484 }
7485
7487 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7488 {
7490 }
7491
7493
7494 m_IsResultOfSplit = false;
7495
7497 }
7498
7500 {
7501 super.InitItemVariables();
7502
7508 m_Count = ConfigGetInt(
"count");
7509
7512
7517
7520
7525
7537
7541
7542
7545 if (ConfigIsExisting("canBeSplit"))
7546 {
7549 }
7550
7552 if (ConfigIsExisting("itemBehaviour"))
7554
7555
7558 RegisterNetSyncVariableInt("m_VarLiquidType");
7559 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7560
7561 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7562 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7563 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7564
7565 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7566 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7567 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7568 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7569
7570 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7571 RegisterNetSyncVariableBool("m_IsTakeable");
7572 RegisterNetSyncVariableBool("m_IsHologram");
7573
7576 {
7579 }
7580
7582
7584 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7586
7587 }
7588
7590 {
7592 }
7593
7595 {
7598 {
7603 }
7604 }
7605
7606 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7607 {
7609 {
7612 }
7613
7615 }
7616
7618 {
7624 }
7625
7627
7629 {
7631
7632 if (!action)
7633 {
7634 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7635 return;
7636 }
7637
7639 if (!ai)
7640 {
7642 return;
7643 }
7644
7646 if (!action_array)
7647 {
7648 action_array = new array<ActionBase_Basic>;
7650 }
7651 if (LogManager.IsActionLogEnable())
7652 {
7653 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7654 }
7655
7656 if (action_array.Find(action) != -1)
7657 {
7658 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7659 }
7660 else
7661 {
7662 action_array.Insert(action);
7663 }
7664 }
7665
7667 {
7669 ActionBase action = player.GetActionManager().GetAction(actionName);
7672
7673 if (action_array)
7674 {
7675 action_array.RemoveItem(action);
7676 }
7677 }
7678
7679
7680
7682 {
7683 ActionOverrideData overrideData = new ActionOverrideData();
7687
7689 if (!actionMap)
7690 {
7693 }
7694
7695 actionMap.Insert(this.
Type(), overrideData);
7696
7697 }
7698
7700
7702
7703
7705 {
7708
7711
7712 string config_to_search = "CfgVehicles";
7713 string muzzle_owner_config;
7714
7716 {
7717 if (IsInherited(Weapon))
7718 config_to_search = "CfgWeapons";
7719
7720 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7721
7722 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7723
7725
7726 if (config_OnFire_subclass_count > 0)
7727 {
7728 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7729
7730 for (int i = 0; i < config_OnFire_subclass_count; i++)
7731 {
7732 string particle_class = "";
7734 string config_OnFire_entry = config_OnFire_class + particle_class;
7735 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7736 WPOF_array.Insert(WPOF);
7737 }
7738
7739
7741 }
7742 }
7743
7745 {
7746 config_to_search = "CfgWeapons";
7747 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7748
7749 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7750
7752
7753 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7754 {
7755 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7756
7757 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7758 {
7759 string particle_class2 = "";
7761 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7762 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7763 WPOBE_array.Insert(WPOBE);
7764 }
7765
7766
7768 }
7769 }
7770 }
7771
7772
7774 {
7777
7779 {
7780 string config_to_search = "CfgVehicles";
7781
7782 if (IsInherited(Weapon))
7783 config_to_search = "CfgWeapons";
7784
7785 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7786 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7787
7788 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
7789 {
7790
7792
7794 {
7796 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7798 return;
7799 }
7800
7803
7804
7805
7807 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7808
7809 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7810 {
7811 string particle_class = "";
7813 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7815
7816 if (entry_type == CT_CLASS)
7817 {
7818 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7819 WPOOH_array.Insert(WPOF);
7820 }
7821 }
7822
7823
7825 }
7826 }
7827 }
7828
7830 {
7832 }
7833
7835 {
7837 {
7839
7842
7845
7846 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7847 }
7848 }
7849
7851 {
7853 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7854
7856 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7857
7859 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7860
7862 {
7864 }
7865 }
7866
7868 {
7870 }
7871
7873 {
7876 else
7878
7880 {
7883 }
7884 else
7885 {
7888
7891 }
7892
7894 }
7895
7897 {
7899 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7900 }
7901
7903 {
7905 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7907 }
7908
7910 {
7912 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7913 }
7914
7916 {
7919
7920 OverheatingParticle OP = new OverheatingParticle();
7925
7927 }
7928
7930 {
7933
7934 return -1;
7935 }
7936
7938 {
7940 {
7943
7944 for (int i = count; i > 0; --i)
7945 {
7946 int id = i - 1;
7949
7952
7953 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7954 {
7955 if (p)
7956 {
7959 }
7960 }
7961 }
7962 }
7963 }
7964
7966 {
7968 {
7970 {
7971 int id = i - 1;
7973
7974 if (OP)
7975 {
7977
7978 if (p)
7979 {
7981 }
7982
7983 delete OP;
7984 }
7985 }
7986
7989 }
7990 }
7991
7994 {
7995 return 0.0;
7996 }
7997
7998
8000 {
8001 return 250;
8002 }
8003
8005 {
8006 return 0;
8007 }
8008
8011 {
8013 return true;
8014
8015 return false;
8016 }
8017
8020 {
8023
8025 {
8027 }
8028 else
8029 {
8030
8032 }
8033
8035 }
8036
8043 {
8044 return -1;
8045 }
8046
8047
8048
8049
8051 {
8053 {
8055 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8056
8057 if (r_index >= 0)
8058 {
8059 InventoryLocation r_il = new InventoryLocation;
8060 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8061
8062 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8065 {
8066 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8067 }
8069 {
8070 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8071 }
8072
8073 }
8074
8075 player.GetHumanInventory().ClearUserReservedLocation(this);
8076 }
8077
8080 }
8081
8082
8083
8084
8086 {
8087 return ItemBase.m_DebugActionsMask;
8088 }
8089
8091 {
8092 return ItemBase.m_DebugActionsMask & mask;
8093 }
8094
8096 {
8097 ItemBase.m_DebugActionsMask = mask;
8098 }
8099
8101 {
8102 ItemBase.m_DebugActionsMask |= mask;
8103 }
8104
8106 {
8107 ItemBase.m_DebugActionsMask &= ~mask;
8108 }
8109
8111 {
8113 {
8115 }
8116 else
8117 {
8119 }
8120 }
8121
8122
8124 {
8125 if (GetEconomyProfile())
8126 {
8127 float q_max = GetEconomyProfile().GetQuantityMax();
8128 if (q_max > 0)
8129 {
8130 float q_min = GetEconomyProfile().GetQuantityMin();
8131 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8132
8134 {
8135 ComponentEnergyManager comp = GetCompEM();
8137 {
8139 }
8140 }
8142 {
8144
8145 }
8146
8147 }
8148 }
8149 }
8150
8153 {
8154 EntityAI parent = GetHierarchyParent();
8155
8156 if (parent)
8157 {
8158 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8159 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8160 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8161 }
8162 }
8163
8166 {
8167 EntityAI parent = GetHierarchyParent();
8168
8169 if (parent)
8170 {
8171 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8172 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8173 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8174 }
8175 }
8176
8178 {
8179
8180
8181
8182
8184
8186 {
8187 if (ScriptInputUserData.CanStoreInputUserData())
8188 {
8189 ScriptInputUserData ctx = new ScriptInputUserData;
8195 ctx.
Write(use_stack_max);
8198
8200 {
8201 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8202 }
8203 }
8204 }
8205 else if (!
GetGame().IsMultiplayer())
8206 {
8208 }
8209 }
8210
8212 {
8214 }
8215
8217 {
8219 }
8220
8222 {
8224 }
8225
8227 {
8228
8229 return false;
8230 }
8231
8233 {
8234 return false;
8235 }
8236
8240 {
8241 return false;
8242 }
8243
8245 {
8246 return "";
8247 }
8248
8250
8252 {
8253 return false;
8254 }
8255
8257 {
8258 return true;
8259 }
8260
8261
8262
8264 {
8265 return true;
8266 }
8267
8269 {
8270 return true;
8271 }
8272
8274 {
8275 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8277 }
8278
8280 {
8282 }
8283
8285 {
8287 if (!is_being_placed)
8289 SetSynchDirty();
8290 }
8291
8292
8294
8296 {
8298 }
8299
8301 {
8303 }
8304
8306 {
8307 return 1;
8308 }
8309
8311 {
8312 return false;
8313 }
8314
8316 {
8318 SetSynchDirty();
8319 }
8320
8321
8322
8323
8324
8325
8326
8327
8328
8329
8330
8331
8332
8333
8334
8335
8336
8337
8338
8339
8340
8341
8342
8343
8344
8345
8346
8347
8348
8349
8350
8351
8352
8353
8354
8356 {
8357 super.OnMovedInsideCargo(container);
8358
8359 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8360 }
8361
8362 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8363 {
8364 super.EEItemLocationChanged(oldLoc,newLoc);
8365
8366 PlayerBase new_player = null;
8367 PlayerBase old_player = null;
8368
8369 if (newLoc.GetParent())
8370 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8371
8372 if (oldLoc.GetParent())
8373 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8374
8376 {
8377 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
8378
8379 if (r_index >= 0)
8380 {
8381 InventoryLocation r_il = new InventoryLocation;
8382 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8383
8384 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8387 {
8388 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8389 }
8391 {
8392 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8393 }
8394
8395 }
8396 }
8397
8399 {
8400 if (new_player)
8401 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
8402
8403 if (new_player == old_player)
8404 {
8405
8406 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8407 {
8409 {
8410 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8411 {
8412 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8413 }
8414 }
8415 else
8416 {
8417 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8418 }
8419 }
8420
8421 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8422 {
8423 int type = oldLoc.GetType();
8425 {
8426 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8427 }
8429 {
8430 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8431 }
8432 }
8433 if (!m_OldLocation)
8434 {
8435 m_OldLocation = new InventoryLocation;
8436 }
8437 m_OldLocation.Copy(oldLoc);
8438 }
8439 else
8440 {
8441 if (m_OldLocation)
8442 {
8443 m_OldLocation.Reset();
8444 }
8445 }
8446
8448 }
8449 else
8450 {
8451 if (new_player)
8452 {
8453 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8454 if (res_index >= 0)
8455 {
8456 InventoryLocation il = new InventoryLocation;
8457 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
8459 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
8462 {
8463 il.
GetParent().GetOnReleaseLock().Invoke(it);
8464 }
8466 {
8468 }
8469
8470 }
8471 }
8473 {
8474
8476 }
8477
8478 if (m_OldLocation)
8479 {
8480 m_OldLocation.Reset();
8481 }
8482 }
8483 }
8484
8485 override void EOnContact(IEntity other, Contact extra)
8486 {
8488 {
8489 int liquidType = -1;
8491 if (impactSpeed > 0.0)
8492 {
8494 #ifndef SERVER
8496 #else
8498 SetSynchDirty();
8499 #endif
8501 }
8502 }
8503
8504 #ifdef SERVER
8505 if (GetCompEM() && GetCompEM().IsPlugged())
8506 {
8507 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8508 GetCompEM().UnplugThis();
8509 }
8510 #endif
8511 }
8512
8514
8516 {
8518 }
8519
8521 {
8522
8523 }
8524
8526 {
8527 super.OnItemLocationChanged(old_owner, new_owner);
8528
8529 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8530 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8531
8532 if (!relatedPlayer && playerNew)
8533 relatedPlayer = playerNew;
8534
8535 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8536 {
8538 if (actionMgr)
8539 {
8540 ActionBase currentAction = actionMgr.GetRunningAction();
8541 if (currentAction)
8543 }
8544 }
8545
8546 Man ownerPlayerOld = null;
8547 Man ownerPlayerNew = null;
8548
8549 if (old_owner)
8550 {
8551 if (old_owner.
IsMan())
8552 {
8553 ownerPlayerOld = Man.Cast(old_owner);
8554 }
8555 else
8556 {
8557 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8558 }
8559 }
8560 else
8561 {
8563 {
8565
8566 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8567 {
8568 GetCompEM().UnplugThis();
8569 }
8570 }
8571 }
8572
8573 if (new_owner)
8574 {
8575 if (new_owner.
IsMan())
8576 {
8577 ownerPlayerNew = Man.Cast(new_owner);
8578 }
8579 else
8580 {
8581 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8582 }
8583 }
8584
8585 if (ownerPlayerOld != ownerPlayerNew)
8586 {
8587 if (ownerPlayerOld)
8588 {
8589 array<EntityAI> subItemsExit = new array<EntityAI>;
8591 for (int i = 0; i < subItemsExit.Count(); i++)
8592 {
8595 }
8596 }
8597
8598 if (ownerPlayerNew)
8599 {
8600 array<EntityAI> subItemsEnter = new array<EntityAI>;
8602 for (int j = 0; j < subItemsEnter.Count(); j++)
8603 {
8606 }
8607 }
8608 }
8609 else if (ownerPlayerNew != null)
8610 {
8611 PlayerBase nplayer;
8612 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8613 {
8614 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8616 for (int k = 0; k < subItemsUpdate.Count(); k++)
8617 {
8619 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8620 }
8621 }
8622 }
8623
8624 if (old_owner)
8625 old_owner.OnChildItemRemoved(this);
8626 if (new_owner)
8627 new_owner.OnChildItemReceived(this);
8628 }
8629
8630
8632 {
8633 super.EEDelete(parent);
8634 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8635 if (player)
8636 {
8638
8639 if (player.IsAlive())
8640 {
8641 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8642 if (r_index >= 0)
8643 {
8644 InventoryLocation r_il = new InventoryLocation;
8645 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8646
8647 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8650 {
8651 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8652 }
8654 {
8655 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8656 }
8657
8658 }
8659
8660 player.RemoveQuickBarEntityShortcut(this);
8661 }
8662 }
8663 }
8664
8666 {
8667 super.EEKilled(killer);
8668
8671 {
8672 if (GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8673 {
8674 if (IsMagazine())
8675 {
8676 if (Magazine.Cast(this).GetAmmoCount() > 0)
8677 {
8679 }
8680 }
8681 else
8682 {
8684 }
8685 }
8686 }
8687 }
8688
8690 {
8691 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8692
8693 super.OnWasAttached(parent, slot_id);
8694
8697
8699 }
8700
8702 {
8703 super.OnWasDetached(parent, slot_id);
8704
8707 }
8708
8710 {
8711 int idx;
8714
8715 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8716 if (inventory_slots.Count() < 1)
8717 {
8718 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8719 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8720 }
8721 else
8722 {
8723 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8724 }
8725
8726 idx = inventory_slots.Find(slot);
8727 if (idx < 0)
8728 return "";
8729
8730 return attach_types.Get(idx);
8731 }
8732
8734 {
8735 int idx = -1;
8736 string slot;
8737
8740
8741 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8742 if (inventory_slots.Count() < 1)
8743 {
8744 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8745 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8746 }
8747 else
8748 {
8749 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8750 if (detach_types.Count() < 1)
8751 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8752 }
8753
8754 for (int i = 0; i < inventory_slots.Count(); i++)
8755 {
8756 slot = inventory_slots.Get(i);
8757 }
8758
8759 if (slot != "")
8760 {
8761 if (detach_types.Count() == 1)
8762 idx = 0;
8763 else
8764 idx = inventory_slots.Find(slot);
8765 }
8766 if (idx < 0)
8767 return "";
8768
8769 return detach_types.Get(idx);
8770 }
8771
8773 {
8774
8776
8777
8778 float min_time = 1;
8779 float max_time = 3;
8780 float delay = Math.RandomFloat(min_time, max_time);
8781
8782 explode_timer.Run(delay, this, "DoAmmoExplosion");
8783 }
8784
8786 {
8787 Magazine magazine = Magazine.Cast(this);
8788 int pop_sounds_count = 6;
8789 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8790
8791
8792 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8793 string sound_name = pop_sounds[ sound_idx ];
8795
8796
8797 magazine.ServerAddAmmoCount(-1);
8798
8799
8800 float min_temp_to_explode = 100;
8801
8802 if (magazine.GetAmmoCount() > 0 && GetTemperature() >= min_temp_to_explode)
8803 {
8805 }
8806 }
8807
8808
8809 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8810 {
8811 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8812
8813 const int CHANCE_DAMAGE_CARGO = 4;
8814 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8815 const int CHANCE_DAMAGE_NOTHING = 2;
8816
8818 {
8819 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8820 int chances;
8821 int rnd;
8822
8823 if (GetInventory().GetCargo())
8824 {
8825 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8826 rnd = Math.RandomInt(0,chances);
8827
8828 if (rnd < CHANCE_DAMAGE_CARGO)
8829 {
8831 }
8832 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8833 {
8835 }
8836 }
8837 else
8838 {
8839 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8840 rnd = Math.RandomInt(0,chances);
8841
8842 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8843 {
8845 }
8846 }
8847 }
8848 }
8849
8851 {
8852 if (GetInventory().GetCargo())
8853 {
8854 int item_count = GetInventory().GetCargo().GetItemCount();
8855 if (item_count > 0)
8856 {
8857 int random_pick = Math.RandomInt(0, item_count);
8859 if (!item.IsExplosive())
8860 {
8861 item.AddHealth("","",damage);
8862 return true;
8863 }
8864 }
8865 }
8866 return false;
8867 }
8868
8870 {
8871 int attachment_count = GetInventory().AttachmentCount();
8872 if (attachment_count > 0)
8873 {
8874 int random_pick = Math.RandomInt(0, attachment_count);
8875 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
8876 if (!attachment.IsExplosive())
8877 {
8878 attachment.AddHealth("","",damage);
8879 return true;
8880 }
8881 }
8882 return false;
8883 }
8884
8886 {
8888 }
8889
8891 {
8893 return GetInventory().CanRemoveEntity();
8894
8895 return false;
8896 }
8897
8899 {
8901 return;
8902
8904 {
8905 if (ScriptInputUserData.CanStoreInputUserData())
8906 {
8907 ScriptInputUserData ctx = new ScriptInputUserData;
8912 ctx.
Write(destination_entity);
8916 }
8917 }
8918 else if (!
GetGame().IsMultiplayer())
8919 {
8921 }
8922 }
8923
8925 {
8927 return;
8928
8929 float split_quantity_new;
8933 InventoryLocation loc = new InventoryLocation;
8934
8935 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8936 {
8938 split_quantity_new = stack_max;
8939 else
8941
8942 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8943 if (new_item)
8944 {
8945 new_item.SetResultOfSplit(true);
8946 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8948 new_item.SetQuantity(split_quantity_new);
8949 }
8950 }
8951 else if (destination_entity && slot_id == -1)
8952 {
8953 if (quantity > stack_max)
8954 split_quantity_new = stack_max;
8955 else
8956 split_quantity_new = quantity;
8957
8959 {
8962 }
8963
8964 if (new_item)
8965 {
8966 new_item.SetResultOfSplit(true);
8967 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8969 new_item.SetQuantity(split_quantity_new);
8970 }
8971 }
8972 else
8973 {
8974 if (stack_max != 0)
8975 {
8977 {
8979 }
8980
8981 if (split_quantity_new == 0)
8982 {
8983 if (!
GetGame().IsMultiplayer())
8984 player.PhysicalPredictiveDropItem(this);
8985 else
8986 player.ServerDropEntity(this);
8987 return;
8988 }
8989
8991
8992 if (new_item)
8993 {
8994 new_item.SetResultOfSplit(true);
8995 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8997 new_item.SetQuantity(stack_max);
8998 new_item.PlaceOnSurface();
8999 }
9000 }
9001 }
9002 }
9003
9005 {
9007 return;
9008
9009 float split_quantity_new;
9013 InventoryLocation loc = new InventoryLocation;
9014
9015 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
9016 {
9018 split_quantity_new = stack_max;
9019 else
9021
9022 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
9023 if (new_item)
9024 {
9025 new_item.SetResultOfSplit(true);
9026 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9028 new_item.SetQuantity(split_quantity_new);
9029 }
9030 }
9031 else if (destination_entity && slot_id == -1)
9032 {
9033 if (quantity > stack_max)
9034 split_quantity_new = stack_max;
9035 else
9036 split_quantity_new = quantity;
9037
9039 {
9042 }
9043
9044 if (new_item)
9045 {
9046 new_item.SetResultOfSplit(true);
9047 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9049 new_item.SetQuantity(split_quantity_new);
9050 }
9051 }
9052 else
9053 {
9054 if (stack_max != 0)
9055 {
9057 {
9059 }
9060
9062
9063 if (new_item)
9064 {
9065 new_item.SetResultOfSplit(true);
9066 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9068 new_item.SetQuantity(stack_max);
9069 new_item.PlaceOnSurface();
9070 }
9071 }
9072 }
9073 }
9074
9076 {
9078 return;
9079
9081 {
9082 if (ScriptInputUserData.CanStoreInputUserData())
9083 {
9084 ScriptInputUserData ctx = new ScriptInputUserData;
9089 dst.WriteToContext(ctx);
9091 }
9092 }
9093 else if (!
GetGame().IsMultiplayer())
9094 {
9096 }
9097 }
9098
9100 {
9102 return;
9103
9105 {
9106 if (ScriptInputUserData.CanStoreInputUserData())
9107 {
9108 ScriptInputUserData ctx = new ScriptInputUserData;
9113 ctx.
Write(destination_entity);
9119 }
9120 }
9121 else if (!
GetGame().IsMultiplayer())
9122 {
9124 }
9125 }
9126
9128 {
9130 }
9131
9133 {
9135 return this;
9136
9138 float split_quantity_new;
9140 if (dst.IsValid())
9141 {
9142 int slot_id = dst.GetSlot();
9144
9145 if (quantity > stack_max)
9146 split_quantity_new = stack_max;
9147 else
9148 split_quantity_new = quantity;
9149
9151
9152 if (new_item)
9153 {
9154 new_item.SetResultOfSplit(true);
9155 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9158 }
9159
9160 return new_item;
9161 }
9162
9163 return null;
9164 }
9165
9167 {
9169 return;
9170
9172 float split_quantity_new;
9174 if (destination_entity)
9175 {
9177 if (quantity > stackable)
9178 split_quantity_new = stackable;
9179 else
9180 split_quantity_new = quantity;
9181
9182 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9183 if (new_item)
9184 {
9185 new_item.SetResultOfSplit(true);
9186 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9188 new_item.SetQuantity(split_quantity_new);
9189 }
9190 }
9191 }
9192
9194 {
9196 return;
9197
9199 {
9200 if (ScriptInputUserData.CanStoreInputUserData())
9201 {
9202 ScriptInputUserData ctx = new ScriptInputUserData;
9207 ItemBase destination_entity =
this;
9208 ctx.
Write(destination_entity);
9212 }
9213 }
9214 else if (!
GetGame().IsMultiplayer())
9215 {
9217 }
9218 }
9219
9221 {
9223 return;
9224
9226 float split_quantity_new;
9228 if (player)
9229 {
9231 if (quantity > stackable)
9232 split_quantity_new = stackable;
9233 else
9234 split_quantity_new = quantity;
9235
9236 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9237 new_item =
ItemBase.Cast(in_hands);
9238 if (new_item)
9239 {
9240 new_item.SetResultOfSplit(true);
9241 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9243 new_item.SetQuantity(split_quantity_new);
9244 }
9245 }
9246 }
9247
9249 {
9251 return;
9252
9254 float split_quantity_new = Math.Floor(quantity * 0.5);
9255
9257
9258 if (new_item)
9259 {
9260 if (new_item.GetQuantityMax() < split_quantity_new)
9261 {
9262 split_quantity_new = new_item.GetQuantityMax();
9263 }
9264
9265 new_item.SetResultOfSplit(true);
9266 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9267
9269 {
9272 }
9273 else
9274 {
9277 }
9278 }
9279 }
9280
9282 {
9284 return;
9285
9287 float split_quantity_new = Math.Floor(quantity / 2);
9288
9289 InventoryLocation invloc = new InventoryLocation;
9291
9293 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9294
9295 if (new_item)
9296 {
9297 if (new_item.GetQuantityMax() < split_quantity_new)
9298 {
9299 split_quantity_new = new_item.GetQuantityMax();
9300 }
9302 {
9305 }
9306 else
9307 {
9310 }
9311 }
9312 }
9313
9316 {
9317 SetWeightDirty();
9319
9320 if (parent)
9321 parent.OnAttachmentQuantityChangedEx(this, delta);
9322
9324 {
9326 {
9328 }
9330 {
9331 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9333 }
9334 }
9335
9336 }
9337
9340 {
9341
9342 }
9343
9346 {
9348 }
9349
9351 {
9352 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9353
9355 {
9356 if (newLevel == GameConstants.STATE_RUINED)
9357 {
9359 EntityAI parent = GetHierarchyParent();
9360 if (parent && parent.IsFireplace())
9361 {
9362 CargoBase cargo = GetInventory().GetCargo();
9363 if (cargo)
9364 {
9366 {
9368 }
9369 }
9370 }
9371 }
9372
9374 {
9375
9377 return;
9378 }
9379
9380 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9381 {
9383 }
9384 }
9385 }
9386
9387
9389 {
9390 super.OnRightClick();
9391
9393 {
9395 {
9396 if (ScriptInputUserData.CanStoreInputUserData())
9397 {
9398 vector m4[4];
9400
9401 EntityAI root = GetHierarchyRoot();
9402
9403 InventoryLocation dst = new InventoryLocation;
9405 {
9406 if (root)
9407 {
9408 root.GetTransform(m4);
9410 }
9411 else
9412 GetInventory().GetCurrentInventoryLocation(dst);
9413 }
9414 else
9415 {
9417
9418
9419 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9420 {
9421 if (root)
9422 {
9423 root.GetTransform(m4);
9425 }
9426 else
9427 GetInventory().GetCurrentInventoryLocation(dst);
9428 }
9429 else
9430 {
9431 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9432 }
9433 }
9434
9435 ScriptInputUserData ctx = new ScriptInputUserData;
9443 }
9444 }
9445 else if (!
GetGame().IsMultiplayer())
9446 {
9448 }
9449 }
9450 }
9451
9452 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9453 {
9454
9455 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9456 return false;
9457
9458 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9459 return false;
9460
9461
9463 return false;
9464
9465
9466 Magazine mag = Magazine.Cast(this);
9467 if (mag)
9468 {
9469 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9470 return false;
9471
9472 if (stack_max_limit)
9473 {
9474 Magazine other_mag = Magazine.Cast(other_item);
9475 if (other_item)
9476 {
9477 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9478 return false;
9479 }
9480
9481 }
9482 }
9483 else
9484 {
9485
9487 return false;
9488
9490 return false;
9491 }
9492
9493 PlayerBase player = null;
9494 if (CastTo(player, GetHierarchyRootPlayer()))
9495 {
9496 if (player.GetInventory().HasAttachment(this))
9497 return false;
9498
9499 if (player.IsItemsToDelete())
9500 return false;
9501 }
9502
9503 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9504 return false;
9505
9506 int slotID;
9508 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9509 return false;
9510
9511 return true;
9512 }
9513
9515 {
9517 }
9518
9520 {
9521 return m_IsResultOfSplit;
9522 }
9523
9525 {
9526 m_IsResultOfSplit = value;
9527 }
9528
9530 {
9532 }
9533
9535 {
9536 float other_item_quantity = other_item.GetQuantity();
9537 float this_free_space;
9538
9540
9542
9543 if (other_item_quantity > this_free_space)
9544 {
9545 return this_free_space;
9546 }
9547 else
9548 {
9549 return other_item_quantity;
9550 }
9551 }
9552
9554 {
9556 }
9557
9559 {
9561 return;
9562
9563 if (!IsMagazine() && other_item)
9564 {
9566 if (quantity_used != 0)
9567 {
9568 float hp1 = GetHealth01("","");
9569 float hp2 = other_item.GetHealth01("","");
9570 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9571 hpResult = hpResult / (
GetQuantity() + quantity_used);
9572
9573 hpResult *= GetMaxHealth();
9574 Math.Round(hpResult);
9575 SetHealth("", "Health", hpResult);
9576
9578 other_item.AddQuantity(-quantity_used);
9579 }
9580 }
9582 }
9583
9585 {
9586 #ifdef SERVER
9587 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9588 GetHierarchyParent().IncreaseLifetimeUp();
9589 #endif
9590 };
9591
9593 {
9594 PlayerBase p = PlayerBase.Cast(player);
9595
9596 array<int> recipesIds = p.m_Recipes;
9597 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9598 if (moduleRecipesManager)
9599 {
9600 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
9601 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9602 }
9603
9604 for (int i = 0;i < recipesIds.Count(); i++)
9605 {
9606 int key = recipesIds.Get(i);
9607 string recipeName = moduleRecipesManager.GetRecipeName(key);
9609 }
9610 }
9611
9612
9613 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9614 {
9615 super.GetDebugActions(outputList);
9616
9617
9622
9623
9627
9631
9632
9635
9636
9638 {
9641 }
9642
9644
9647
9651 }
9652
9653
9654
9655
9657 {
9658 super.OnAction(action_id, player, ctx);
9659 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9660 {
9661 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9662 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9663 PlayerBase p = PlayerBase.Cast(player);
9664 if (
EActions.RECIPES_RANGE_START < 1000)
9665 {
9666 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9667 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9668 }
9669 }
9670 #ifndef SERVER
9671 else if (action_id ==
EActions.WATCH_PLAYER)
9672 {
9673 PluginDeveloper.SetDeveloperItemClientEx(player);
9674 }
9675 #endif
9677 {
9678 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9679 {
9680 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9681 OnDebugButtonPressServer(id + 1);
9682 }
9683
9684 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9685 {
9686 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9688 }
9689
9690 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9691 {
9692 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9694 }
9695
9696 else if (action_id ==
EActions.ADD_QUANTITY)
9697 {
9698 if (IsMagazine())
9699 {
9700 Magazine mag = Magazine.Cast(this);
9701 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9702 }
9703 else
9704 {
9706 }
9707
9708 if (m_EM)
9709 {
9710 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9711 }
9712
9713 }
9714
9715 else if (action_id ==
EActions.REMOVE_QUANTITY)
9716 {
9717 if (IsMagazine())
9718 {
9719 Magazine mag2 = Magazine.Cast(this);
9720 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9721 }
9722 else
9723 {
9725 }
9726 if (m_EM)
9727 {
9728 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9729 }
9730
9731 }
9732
9733 else if (action_id ==
EActions.SET_QUANTITY_0)
9734 {
9736
9737 if (m_EM)
9738 {
9739 m_EM.SetEnergy(0);
9740 }
9741 }
9742
9743 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9744 {
9746
9747 if (m_EM)
9748 {
9749 m_EM.SetEnergy(m_EM.GetEnergyMax());
9750 }
9751 }
9752
9753 else if (action_id ==
EActions.ADD_HEALTH)
9754 {
9755 AddHealth("","",GetMaxHealth("","Health")/5);
9756 }
9757 else if (action_id ==
EActions.REMOVE_HEALTH)
9758 {
9759 AddHealth("","",-GetMaxHealth("","Health")/5);
9760 }
9761 else if (action_id ==
EActions.DESTROY_HEALTH)
9762 {
9763 SetHealth01("","",0);
9764 }
9765 else if (action_id ==
EActions.WATCH_ITEM)
9766 {
9768 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9769 #ifdef DEVELOPER
9770 SetDebugDeveloper_item(this);
9771 #endif
9772 }
9773
9774 else if (action_id ==
EActions.ADD_TEMPERATURE)
9775 {
9776 AddTemperature(20);
9777
9778 }
9779
9780 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9781 {
9782 AddTemperature(-20);
9783
9784 }
9785
9786 else if (action_id ==
EActions.FLIP_FROZEN)
9787 {
9788 SetFrozen(!GetIsFrozen());
9789
9790 }
9791
9792 else if (action_id ==
EActions.ADD_WETNESS)
9793 {
9795
9796 }
9797
9798 else if (action_id ==
EActions.REMOVE_WETNESS)
9799 {
9801
9802 }
9803
9804 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9805 {
9808
9809
9810 }
9811
9812 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9813 {
9816 }
9817
9818 else if (action_id ==
EActions.MAKE_SPECIAL)
9819 {
9820 auto debugParams = DebugSpawnParams.WithPlayer(player);
9821 OnDebugSpawnEx(debugParams);
9822 }
9823
9824 else if (action_id ==
EActions.DELETE)
9825 {
9826 Delete();
9827 }
9828
9829 }
9830
9831
9832 return false;
9833 }
9834
9835
9836
9837
9841
9844
9845
9846
9848 {
9849 return false;
9850 }
9851
9852
9854 {
9855 return true;
9856 }
9857
9858
9860 {
9861 return true;
9862 }
9863
9864
9865
9867 {
9868 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9870 }
9871
9874 {
9875 return null;
9876 }
9877
9879 {
9880 return false;
9881 }
9882
9884 {
9885 return false;
9886 }
9887
9891
9892
9894 {
9895 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9896 return module_repairing.CanRepair(this, item_repair_kit);
9897 }
9898
9899
9900 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9901 {
9902 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9903 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9904 }
9905
9906
9908 {
9909
9910
9911
9912
9913
9914
9915
9916
9917 return 1;
9918 }
9919
9920
9921
9923 {
9925 }
9926
9927
9928
9930 {
9932 }
9933
9934
9943 {
9944 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9945
9946 if (player)
9947 {
9948 player.MessageStatus(text);
9949 }
9950 }
9951
9952
9961 {
9962 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9963
9964 if (player)
9965 {
9966 player.MessageAction(text);
9967 }
9968 }
9969
9970
9979 {
9980 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9981
9982 if (player)
9983 {
9984 player.MessageFriendly(text);
9985 }
9986 }
9987
9988
9997 {
9998 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9999
10000 if (player)
10001 {
10002 player.MessageImportant(text);
10003 }
10004 }
10005
10007 {
10008 return true;
10009 }
10010
10011
10012 override bool KindOf(
string tag)
10013 {
10014 bool found = false;
10015 string item_name = this.
GetType();
10018
10019 int array_size = item_tag_array.Count();
10020 for (int i = 0; i < array_size; i++)
10021 {
10022 if (item_tag_array.Get(i) == tag)
10023 {
10024 found = true;
10025 break;
10026 }
10027 }
10028 return found;
10029 }
10030
10031
10033 {
10034
10035 super.OnRPC(sender, rpc_type,ctx);
10036
10037
10038 switch (rpc_type)
10039 {
10040 #ifndef SERVER
10041 case ERPCs.RPC_SOUND_LOCK_ATTACH:
10042 Param2<bool, string> p = new Param2<bool, string>(false, "");
10043
10045 return;
10046
10047 bool play = p.param1;
10048 string soundSet = p.param2;
10049
10050 if (play)
10051 {
10053 {
10055 {
10057 }
10058 }
10059 else
10060 {
10062 }
10063 }
10064 else
10065 {
10067 }
10068
10069 break;
10070 #endif
10071
10072 }
10073
10075 {
10077 }
10078 }
10079
10080
10081
10082
10084 {
10085 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10086 return plugin.GetID(
name);
10087 }
10088
10090 {
10091 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10092 return plugin.GetName(id);
10093 }
10094
10097 {
10098
10099
10100 int varFlags;
10101 if (!ctx.
Read(varFlags))
10102 return;
10103
10104 if (varFlags & ItemVariableFlags.FLOAT)
10105 {
10107 }
10108 }
10109
10111 {
10112
10113 super.SerializeNumericalVars(floats_out);
10114
10115
10116
10118 {
10120 }
10121
10123 {
10125 }
10126
10128 {
10130 }
10131
10133 {
10138 }
10139
10141 {
10143 }
10144 }
10145
10147 {
10148
10149 super.DeSerializeNumericalVars(floats);
10150
10151
10152 int index = 0;
10153 int mask = Math.Round(floats.Get(index));
10154
10155 index++;
10156
10158 {
10160 {
10162 }
10163 else
10164 {
10165 float quantity = floats.Get(index);
10166 SetQuantity(quantity,
true,
false,
false,
false);
10167 }
10168 index++;
10169 }
10170
10172 {
10173 float wet = floats.Get(index);
10175 index++;
10176 }
10177
10179 {
10180 int liquidtype = Math.Round(floats.Get(index));
10182 index++;
10183 }
10184
10186 {
10188 index++;
10190 index++;
10192 index++;
10194 index++;
10195 }
10196
10198 {
10199 int cleanness = Math.Round(floats.Get(index));
10201 index++;
10202 }
10203 }
10204
10206 {
10207 super.WriteVarsToCTX(ctx);
10208
10209
10211 {
10213 }
10214
10216 {
10218 }
10219
10221 {
10223 }
10224
10226 {
10227 int r,g,b,a;
10233 }
10234
10236 {
10238 }
10239 }
10240
10242 {
10243 if (!super.ReadVarsFromCTX(ctx,version))
10244 return false;
10245
10246 int intValue;
10247 float value;
10248
10249 if (version < 140)
10250 {
10251 if (!ctx.
Read(intValue))
10252 return false;
10253
10254 m_VariablesMask = intValue;
10255 }
10256
10258 {
10259 if (!ctx.
Read(value))
10260 return false;
10261
10263 {
10265 }
10266 else
10267 {
10269 }
10270 }
10271
10272 if (version < 140)
10273 {
10275 {
10276 if (!ctx.
Read(value))
10277 return false;
10278 SetTemperatureDirect(value);
10279 }
10280 }
10281
10283 {
10284 if (!ctx.
Read(value))
10285 return false;
10287 }
10288
10290 {
10291 if (!ctx.
Read(intValue))
10292 return false;
10294 }
10295
10297 {
10298 int r,g,b,a;
10300 return false;
10302 return false;
10304 return false;
10306 return false;
10307
10309 }
10310
10312 {
10313 if (!ctx.
Read(intValue))
10314 return false;
10316 }
10317
10318 if (version >= 138 && version < 140)
10319 {
10321 {
10322 if (!ctx.
Read(intValue))
10323 return false;
10324 SetFrozen(intValue);
10325 }
10326 }
10327
10328 return true;
10329 }
10330
10331
10333 {
10336 {
10338 }
10339
10340 if (!super.OnStoreLoad(ctx, version))
10341 {
10343 return false;
10344 }
10345
10346 if (version >= 114)
10347 {
10348 bool hasQuickBarIndexSaved;
10349
10350 if (!ctx.
Read(hasQuickBarIndexSaved))
10351 {
10353 return false;
10354 }
10355
10356 if (hasQuickBarIndexSaved)
10357 {
10358 int itmQBIndex;
10359
10360
10361 if (!ctx.
Read(itmQBIndex))
10362 {
10364 return false;
10365 }
10366
10367 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10368 if (itmQBIndex != -1 && parentPlayer)
10369 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10370 }
10371 }
10372 else
10373 {
10374
10375 PlayerBase player;
10376 int itemQBIndex;
10377 if (version ==
int.
MAX)
10378 {
10379 if (!ctx.
Read(itemQBIndex))
10380 {
10382 return false;
10383 }
10384 }
10385 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10386 {
10387
10388 if (!ctx.
Read(itemQBIndex))
10389 {
10391 return false;
10392 }
10393 if (itemQBIndex != -1 && player)
10394 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10395 }
10396 }
10397
10398 if (version < 140)
10399 {
10400
10401 if (!LoadVariables(ctx, version))
10402 {
10404 return false;
10405 }
10406 }
10407
10408
10410 {
10412 return false;
10413 }
10414 if (version >= 132)
10415 {
10417 if (raib)
10418 {
10420 {
10422 return false;
10423 }
10424 }
10425 }
10426
10428 return true;
10429 }
10430
10431
10432
10434 {
10435 super.OnStoreSave(ctx);
10436
10437 PlayerBase player;
10438 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10439 {
10441
10442 int itemQBIndex = -1;
10443 itemQBIndex = player.FindQuickBarEntityIndex(this);
10444 ctx.
Write(itemQBIndex);
10445 }
10446 else
10447 {
10449 }
10450
10452
10454 if (raib)
10455 {
10457 }
10458 }
10459
10460
10462 {
10463 super.AfterStoreLoad();
10464
10466 {
10468 }
10469
10471 {
10474 }
10475 }
10476
10478 {
10479 super.EEOnAfterLoad();
10480
10482 {
10484 }
10485
10488 }
10489
10491 {
10492 return false;
10493 }
10494
10495
10496
10498 {
10500 {
10501 #ifdef PLATFORM_CONSOLE
10502
10504 {
10506 if (menu)
10507 {
10509 }
10510 }
10511 #endif
10512 }
10513
10515 {
10518 }
10519
10521 {
10522 SetWeightDirty();
10524 }
10526 {
10529 }
10530
10532 {
10535 }
10537 {
10540 }
10541
10542 super.OnVariablesSynchronized();
10543 }
10544
10545
10546
10548 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10549 {
10550 if (!IsServerCheck(allow_client))
10551 return false;
10552
10554 return false;
10555
10558
10559 if (value <= (min + 0.001))
10560 value = min;
10561
10562 if (value == min)
10563 {
10564 if (destroy_config)
10565 {
10566 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10567 if (dstr)
10568 {
10570 this.Delete();
10571 return true;
10572 }
10573 }
10574 else if (destroy_forced)
10575 {
10577 this.Delete();
10578 return true;
10579 }
10580
10582 }
10583
10586
10588 {
10590
10591 if (delta)
10593 }
10594
10596
10597 return false;
10598 }
10599
10600
10602 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10603 {
10605 }
10606
10608 {
10611 }
10612
10614 {
10617 }
10618
10621 {
10622 float value_clamped = Math.Clamp(value, 0, 1);
10624 SetQuantity(result, destroy_config, destroy_forced);
10625 }
10626
10627
10630 {
10632 }
10633
10635 {
10637 }
10638
10639
10640
10641
10642
10643
10644
10645
10646
10647
10649 {
10650 int slot = -1;
10651 if (GetInventory())
10652 {
10653 InventoryLocation il = new InventoryLocation;
10654 GetInventory().GetCurrentInventoryLocation(il);
10656 }
10657
10659 }
10660
10662 {
10663 float quantity_max = 0;
10664
10666 {
10667 if (attSlotID != -1)
10668 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10669
10670 if (quantity_max <= 0)
10672 }
10673
10674 if (quantity_max <= 0)
10676
10677 return quantity_max;
10678 }
10679
10681 {
10683 }
10684
10686 {
10688 }
10689
10690
10692 {
10694 }
10695
10697 {
10699 }
10700
10702 {
10704 }
10705
10706
10708 {
10709
10710 float weightEx = GetWeightEx();
10711 float special = GetInventoryAndCargoWeight();
10712 return weightEx - special;
10713 }
10714
10715
10717 {
10719 }
10720
10722 {
10724 {
10725 #ifdef DEVELOPER
10726 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10727 {
10728 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10730 }
10731 #endif
10732
10733 return GetQuantity() * GetConfigWeightModified();
10734 }
10735 else if (HasEnergyManager())
10736 {
10737 #ifdef DEVELOPER
10738 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10739 {
10740 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10741 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10742 }
10743 #endif
10744 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified());
10745 }
10746 else
10747 {
10748 #ifdef DEVELOPER
10749 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10750 {
10751 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10752 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10753 }
10754 #endif
10755 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified());
10756 }
10757 }
10758
10761 {
10762 int item_count = 0;
10764
10765 if (GetInventory().GetCargo() != NULL)
10766 {
10767 item_count = GetInventory().GetCargo().GetItemCount();
10768 }
10769
10770 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
10771 {
10772 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
10773 if (item)
10774 item_count += item.GetNumberOfItems();
10775 }
10776 return item_count;
10777 }
10778
10781 {
10782 float weight = 0;
10783 float wetness = 1;
10784 if (include_wetness)
10787 {
10788 weight = wetness * m_ConfigWeight;
10789 }
10791 {
10792 weight = 1;
10793 }
10794 return weight;
10795 }
10796
10797
10798
10800 {
10801 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
10802 {
10803 GameInventory inv = GetInventory();
10804 array<EntityAI> items = new array<EntityAI>;
10806 for (int i = 0; i < items.Count(); i++)
10807 {
10809 if (item)
10810 {
10812 }
10813 }
10814 }
10815 }
10816
10817
10818
10819
10821 {
10822 float energy = 0;
10823 if (HasEnergyManager())
10824 {
10825 energy = GetCompEM().GetEnergy();
10826 }
10827 return energy;
10828 }
10829
10830
10832 {
10833 super.OnEnergyConsumed();
10834
10836 }
10837
10839 {
10840 super.OnEnergyAdded();
10841
10843 }
10844
10845
10847 {
10848 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10849 {
10851 {
10852 float energy_0to1 = GetCompEM().GetEnergy0To1();
10854 }
10855 }
10856 }
10857
10858
10860 {
10861 return ConfigGetFloat("heatIsolation");
10862 }
10863
10865 {
10867 }
10868
10870 {
10871 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10872 if (
GetGame().ConfigIsExisting(paramPath))
10874
10875 return 0.0;
10876 }
10877
10879 {
10880 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10881 if (
GetGame().ConfigIsExisting(paramPath))
10883
10884 return 0.0;
10885 }
10886
10887 override void SetWet(
float value,
bool allow_client =
false)
10888 {
10889 if (!IsServerCheck(allow_client))
10890 return;
10891
10894
10896
10897 m_VarWet = Math.Clamp(value, min, max);
10898
10900 {
10903 }
10904 }
10905
10906 override void AddWet(
float value)
10907 {
10909 }
10910
10912 {
10914 }
10915
10917 {
10919 }
10920
10922 {
10924 }
10925
10927 {
10929 }
10930
10932 {
10934 }
10935
10936 override void OnWetChanged(
float newVal,
float oldVal)
10937 {
10940 if (newLevel != oldLevel)
10941 {
10943 }
10944 }
10945
10947 {
10948 SetWeightDirty();
10949 }
10950
10952 {
10953 return GetWetLevelInternal(
m_VarWet);
10954 }
10955
10956
10957
10959 {
10961 }
10962
10964 {
10966 }
10967
10969 {
10971 }
10972
10974 {
10976 }
10977
10978
10979
10981 {
10982 if (ConfigIsExisting("itemModelLength"))
10983 {
10984 return ConfigGetFloat("itemModelLength");
10985 }
10986 return 0;
10987 }
10988
10990 {
10991 if (ConfigIsExisting("itemAttachOffset"))
10992 {
10993 return ConfigGetFloat("itemAttachOffset");
10994 }
10995 return 0;
10996 }
10997
10998 override void SetCleanness(
int value,
bool allow_client =
false)
10999 {
11000 if (!IsServerCheck(allow_client))
11001 return;
11002
11004
11006
11009 }
11010
11012 {
11014 }
11015
11017 {
11018 return true;
11019 }
11020
11021
11022
11023
11025 {
11027 }
11028
11030 {
11032 }
11033
11034
11035
11036
11037 override void SetColor(
int r,
int g,
int b,
int a)
11038 {
11044 }
11046 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11047 {
11052 }
11053
11055 {
11057 }
11058
11061 {
11062 int r,g,b,a;
11064 r = r/255;
11065 g = g/255;
11066 b = b/255;
11067 a = a/255;
11068 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11069 }
11070
11071
11072
11073 override void SetLiquidType(
int value,
bool allow_client =
false)
11074 {
11075 if (!IsServerCheck(allow_client))
11076 return;
11077
11082 }
11083
11085 {
11086 return ConfigGetInt("varLiquidTypeInit");
11087 }
11088
11090 {
11092 }
11093
11095 {
11097 SetFrozen(false);
11098 }
11099
11102 {
11103 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11104 }
11105
11106
11109 {
11110 PlayerBase nplayer;
11111 if (PlayerBase.CastTo(nplayer, player))
11112 {
11114
11115 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11116 }
11117 }
11118
11119
11122 {
11123 PlayerBase nplayer;
11124 if (PlayerBase.CastTo(nplayer,player))
11125 {
11126
11127 nplayer.SetEnableQuickBarEntityShortcut(this,false);
11128
11129 }
11130
11131
11132 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11133
11134
11135 if (HasEnergyManager())
11136 {
11137 GetCompEM().UpdatePlugState();
11138 }
11139 }
11140
11141
11143 {
11144 super.OnPlacementStarted(player);
11145
11147 }
11148
11149 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11150 {
11152 {
11153 m_AdminLog.OnPlacementComplete(player,
this);
11154 }
11155
11156 super.OnPlacementComplete(player, position, orientation);
11157 }
11158
11159
11160
11161
11162
11164 {
11166 {
11167 return true;
11168 }
11169 else
11170 {
11171 return false;
11172 }
11173 }
11174
11175
11177 {
11179 {
11181 }
11182 }
11183
11184
11186 {
11188 }
11189
11191 {
11193 }
11194
11195 override void InsertAgent(
int agent,
float count = 1)
11196 {
11197 if (count < 1)
11198 return;
11199
11201 }
11202
11205 {
11207 }
11208
11209
11211 {
11213 }
11214
11215
11216
11217
11218
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11229
11230
11231
11232
11233
11234
11235
11236
11237
11238
11239
11240
11241
11242
11243
11244
11245
11246
11247
11248
11249
11250
11251
11252
11253
11254
11255
11257 {
11259 return false;
11260 return true;
11261 }
11262
11264 {
11265
11267 }
11268
11269
11272 {
11273 super.CheckForRoofLimited(timeTresholdMS);
11274
11276 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11277 {
11278 m_PreviousRoofTestTime = time;
11279 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11280 }
11281 }
11282
11283
11285 {
11287 {
11288 return 0;
11289 }
11290
11291 if (GetInventory().GetAttachmentSlotsCount() != 0)
11292 {
11293 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11294 if (filter)
11295 return filter.GetProtectionLevel(type, false, system);
11296 else
11297 return 0;
11298 }
11299
11300 string subclassPath, entryName;
11301
11302 switch (type)
11303 {
11305 entryName = "biological";
11306 break;
11308 entryName = "chemical";
11309 break;
11310 default:
11311 entryName = "biological";
11312 break;
11313 }
11314
11315 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11316
11318 }
11319
11320
11321
11324 {
11325 if (!IsMagazine())
11327
11329 }
11330
11331
11332
11333
11334
11339 {
11340 return true;
11341 }
11342
11344 {
11346 }
11347
11348
11349
11350
11351
11353 {
11354 if (parent)
11355 {
11356 if (parent.IsInherited(DayZInfected))
11357 return true;
11358
11359 if (!parent.IsRuined())
11360 return true;
11361 }
11362
11363 return true;
11364 }
11365
11367 {
11368 if (!super.CanPutAsAttachment(parent))
11369 {
11370 return false;
11371 }
11372
11373 if (!IsRuined() && !parent.IsRuined())
11374 {
11375 return true;
11376 }
11377
11378 return false;
11379 }
11380
11382 {
11383
11384
11385
11386
11387 return super.CanReceiveItemIntoCargo(item);
11388 }
11389
11391 {
11392
11393
11394
11395
11396 GameInventory attachmentInv = attachment.GetInventory();
11398 {
11399 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11400 return false;
11401 }
11402
11403 InventoryLocation loc = new InventoryLocation();
11404 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11405 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11406 return false;
11407
11408 return super.CanReceiveAttachment(attachment, slotId);
11409 }
11410
11412 {
11413 if (!super.CanReleaseAttachment(attachment))
11414 return false;
11415
11416 return GetInventory().AreChildrenAccessible();
11417 }
11418
11419
11420
11421
11422
11423
11424
11425
11426
11427
11428
11429
11430
11431
11432
11433
11434
11435
11436
11437
11438
11440 {
11441 int id = muzzle_owner.GetMuzzleID();
11442 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11443
11444 if (WPOF_array)
11445 {
11446 for (int i = 0; i < WPOF_array.Count(); i++)
11447 {
11448 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11449
11450 if (WPOF)
11451 {
11452 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11453 }
11454 }
11455 }
11456 }
11457
11458
11460 {
11461 int id = muzzle_owner.GetMuzzleID();
11463
11464 if (WPOBE_array)
11465 {
11466 for (int i = 0; i < WPOBE_array.Count(); i++)
11467 {
11468 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11469
11470 if (WPOBE)
11471 {
11472 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11473 }
11474 }
11475 }
11476 }
11477
11478
11480 {
11481 int id = muzzle_owner.GetMuzzleID();
11482 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11483
11484 if (WPOOH_array)
11485 {
11486 for (int i = 0; i < WPOOH_array.Count(); i++)
11487 {
11488 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11489
11490 if (WPOOH)
11491 {
11492 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11493 }
11494 }
11495 }
11496 }
11497
11498
11500 {
11501 int id = muzzle_owner.GetMuzzleID();
11502 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11503
11504 if (WPOOH_array)
11505 {
11506 for (int i = 0; i < WPOOH_array.Count(); i++)
11507 {
11508 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11509
11510 if (WPOOH)
11511 {
11512 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11513 }
11514 }
11515 }
11516 }
11517
11518
11520 {
11521 int id = muzzle_owner.GetMuzzleID();
11522 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11523
11524 if (WPOOH_array)
11525 {
11526 for (int i = 0; i < WPOOH_array.Count(); i++)
11527 {
11528 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11529
11530 if (WPOOH)
11531 {
11532 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11533 }
11534 }
11535 }
11536 }
11537
11538
11539
11541 {
11543 {
11544 return true;
11545 }
11546
11547 return false;
11548 }
11549
11551 {
11553 {
11554 return true;
11555 }
11556
11557 return false;
11558 }
11559
11561 {
11563 {
11564 return true;
11565 }
11566
11567 return false;
11568 }
11569
11571 {
11572 return false;
11573 }
11574
11577 {
11578 return UATimeSpent.DEFAULT_DEPLOY;
11579 }
11580
11581
11582
11583
11585 {
11587 SetSynchDirty();
11588 }
11589
11591 {
11593 }
11594
11595
11597 {
11598 return false;
11599 }
11600
11603 {
11604 string att_type = "None";
11605
11606 if (ConfigIsExisting("soundAttType"))
11607 {
11608 att_type = ConfigGetString("soundAttType");
11609 }
11610
11612 }
11613
11615 {
11617 }
11618
11619
11620
11621
11622
11626
11628 {
11631
11633 }
11634
11635
11637 {
11639 return;
11640
11642
11645
11648
11649 SoundParameters params = new SoundParameters();
11653 }
11654
11655
11657 {
11659 return;
11660
11662 SetSynchDirty();
11663
11666 }
11667
11668
11670 {
11672 return;
11673
11675 SetSynchDirty();
11676
11679 }
11680
11682 {
11684 }
11685
11687 {
11689 }
11690
11693 {
11694 if (!
GetGame().IsDedicatedServer())
11695 {
11696 if (ConfigIsExisting("attachSoundSet"))
11697 {
11698 string cfg_path = "";
11699 string soundset = "";
11700 string type_name =
GetType();
11701
11704 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11705 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11706
11707 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11708 {
11709 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11710 {
11711 if (cfg_slot_array[i] == slot_type)
11712 {
11713 soundset = cfg_soundset_array[i];
11714 break;
11715 }
11716 }
11717 }
11718
11719 if (soundset != "")
11720 {
11721 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11723 }
11724 }
11725 }
11726 }
11727
11729 {
11730
11731 }
11732
11733 void OnApply(PlayerBase player);
11734
11736 {
11737 return 1.0;
11738 };
11739
11741 {
11743 }
11744
11746 {
11748 }
11749
11751
11753 {
11754 SetDynamicPhysicsLifeTime(0.01);
11756 }
11757
11759 {
11760 array<string> zone_names = new array<string>;
11761 GetDamageZones(zone_names);
11762 for (int i = 0; i < zone_names.Count(); i++)
11763 {
11764 SetHealthMax(zone_names.Get(i),"Health");
11765 }
11766 SetHealthMax("","Health");
11767 }
11768
11771 {
11772 float global_health = GetHealth01("","Health");
11773 array<string> zones = new array<string>;
11774 GetDamageZones(zones);
11775
11776 for (int i = 0; i < zones.Count(); i++)
11777 {
11778 SetHealth01(zones.Get(i),"Health",global_health);
11779 }
11780 }
11781
11784 {
11785 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11786 }
11787
11789 {
11790 if (!hasRootAsPlayer)
11791 {
11792 if (refParentIB)
11793 {
11794
11795 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11796 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11797
11798 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11799 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11800
11803 }
11804 else
11805 {
11806
11809 }
11810 }
11811 }
11812
11814 {
11816 {
11817 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11818 if (GetTemperature() != target || !IsFreezeThawProgressFinished())
11819 {
11820 float heatPermCoef = 1.0;
11822 while (ent)
11823 {
11824 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11825 ent = ent.GetHierarchyParent();
11826 }
11827
11828 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11829 }
11830 }
11831 }
11832
11834 {
11835
11836 EntityAI parent = GetHierarchyParent();
11837 if (!parent)
11838 {
11839 hasParent = false;
11840 hasRootAsPlayer = false;
11841 }
11842 else
11843 {
11844 hasParent = true;
11845 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11846 refParentIB =
ItemBase.Cast(parent);
11847 }
11848 }
11849
11850 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11851 {
11852
11853 }
11854
11856 {
11857
11858 return false;
11859 }
11860
11862 {
11863
11864
11865 return false;
11866 }
11867
11869 {
11870
11871 return false;
11872 }
11873
11876 {
11877 return !GetIsFrozen() &&
IsOpen();
11878 }
11879
11881 {
11882 bool hasParent = false, hasRootAsPlayer = false;
11884
11885 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11886 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11887
11888 if (wwtu || foodDecay)
11889 {
11893
11894 if (processWetness || processTemperature || processDecay)
11895 {
11897
11898 if (processWetness)
11899 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11900
11901 if (processTemperature)
11903
11904 if (processDecay)
11905 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11906 }
11907 }
11908 }
11909
11912 {
11914 }
11915
11917 {
11920
11921 return super.GetTemperatureFreezeThreshold();
11922 }
11923
11925 {
11928
11929 return super.GetTemperatureThawThreshold();
11930 }
11931
11933 {
11936
11937 return super.GetItemOverheatThreshold();
11938 }
11939
11941 {
11943 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11944
11945 return super.GetTemperatureFreezeTime();
11946 }
11947
11949 {
11951 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11952
11953 return super.GetTemperatureThawTime();
11954 }
11955
11960
11962 {
11963 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11964 }
11965
11967 {
11968 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11969 }
11970
11973 {
11975 }
11976
11978 {
11980 }
11981
11983 {
11985 }
11986
11989 {
11990 return null;
11991 }
11992
11995 {
11996 return false;
11997 }
11998
12000 {
12002 {
12005 if (!trg)
12006 {
12008 explosive = this;
12009 }
12010
12011 explosive.PairRemote(trg);
12013
12014 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
12015 trg.SetPersistentPairID(persistentID);
12016 explosive.SetPersistentPairID(persistentID);
12017
12018 return true;
12019 }
12020 return false;
12021 }
12022
12025 {
12026 float ret = 1.0;
12029 ret *= GetHealth01();
12030
12031 return ret;
12032 }
12033
12034 #ifdef DEVELOPER
12035 override void SetDebugItem()
12036 {
12037 super.SetDebugItem();
12038 _itemBase = this;
12039 }
12040
12042 {
12043 string text = super.GetDebugText();
12044
12046 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
12047
12048 return text;
12049 }
12050 #endif
12051
12053 {
12054 return true;
12055 }
12056
12058
12060
12062 {
12065 }
12066
12067
12075
12091}
12092
12094{
12096 if (entity)
12097 {
12098 bool is_item = entity.IsInherited(
ItemBase);
12099 if (is_item && full_quantity)
12100 {
12103 }
12104 }
12105 else
12106 {
12108 return NULL;
12109 }
12110 return entity;
12111}
12112
12114{
12115 if (item)
12116 {
12117 if (health > 0)
12118 item.SetHealth("", "", health);
12119
12120 if (item.CanHaveTemperature())
12121 {
12123 if (item.CanFreeze())
12124 item.SetFrozen(false);
12125 }
12126
12127 if (item.HasEnergyManager())
12128 {
12129 if (quantity >= 0)
12130 {
12131 item.GetCompEM().SetEnergy0To1(quantity);
12132 }
12133 else
12134 {
12136 }
12137 }
12138 else if (item.IsMagazine())
12139 {
12140 Magazine mag = Magazine.Cast(item);
12141 if (quantity >= 0)
12142 {
12143 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12144 }
12145 else
12146 {
12148 }
12149
12150 }
12151 else
12152 {
12153 if (quantity >= 0)
12154 {
12155 item.SetQuantityNormalized(quantity, false);
12156 }
12157 else
12158 {
12160 }
12161
12162 }
12163 }
12164}
12165
12166#ifdef DEVELOPER
12168#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
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 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...
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)
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)
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
ref Timer m_CheckOverheating
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override bool IsOneHandedBehaviour()
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
override float GetSingleInventoryItemWeightEx()
void SaveAgents(ParamsWriteContext ctx)
override int GetTargetQuantityMax(int attSlotID=-1)
float GetDisinfectQuantity(int system=0, Param param1=null)
override bool IsHologram()
float GetItemAttachOffset()
static int GetDebugActionsMask()
override int GetLiquidType()
void ProcessDecay(float delta, bool hasRootAsPlayer)
override bool IsItemBase()
override bool IsTwoHandedBehaviour()
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override void OnEnergyAdded()
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
EffectSound m_DeployLoopSoundEx
override void DeSerializeNumericalVars(array< float > floats)
void StopItemDynamicPhysics()
override void SetStoreLoad(bool value)
float GetOverheatingValue()
bool ContainsAgent(int agent_id)
override void AddWet(float value)
override void EOnContact(IEntity other, Contact extra)
void SplitIntoStackMaxHands(PlayerBase player)
void SplitIntoStackMaxHandsClient(PlayerBase player)
ref Timer m_PhysDropTimer
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
override void SetStoreLoadedQuantity(float value)
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
void OnLiquidTypeChanged(int oldType, int newType)
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void PlayDeployFinishSound()
bool AllowFoodConsumption()
bool m_IsOverheatingEffectActive
int m_LiquidContainerMask
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override int GetCleanness()
bool PairWithDevice(notnull ItemBase otherDevice)
static void RemoveDebugActionsMask(int mask)
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void PerformDamageSystemReinit()
override void ClearInventory()
static int m_LastRegisteredWeaponID
ItemBase GetLightSourceItem()
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
override float GetItemOverheatThreshold()
void StopDeployLoopSoundEx()
override void SerializeNumericalVars(array< float > floats_out)
void Open()
Implementations only.
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 EEOnCECreate()
Called when entity is being created as new by CE/ Debug.
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 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 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
proto native void SetGround(EntityAI e, vector mat[4])
sets current inventory location type to Ground with transformation mat
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 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 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.