7092{
7094 {
7095 return true;
7096 }
7097};
7098
7099
7100
7102{
7106
7108
7111
7112
7113
7114
7115
7124
7130
7135
7140
7161 protected bool m_IsResultOfSplit
7162
7164
7169
7170
7171
7173
7177
7178
7179
7181
7184
7185
7186
7192
7193
7201
7204
7205
7207
7208
7210
7211
7216
7217
7222
7223
7225
7226
7228 {
7233
7234 if (!
GetGame().IsDedicatedServer())
7235 {
7237 {
7239
7241 {
7243 }
7244 }
7245
7248 }
7249
7250 m_OldLocation = null;
7251
7253 {
7255 }
7256
7257 if (ConfigIsExisting("headSelectionsToHide"))
7258 {
7261 }
7262
7264 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7265 {
7267 }
7268
7270
7271 m_IsResultOfSplit = false;
7272
7274 }
7275
7277 {
7278 super.InitItemVariables();
7279
7285 m_Count = ConfigGetInt(
"count");
7286
7289
7294
7297
7302
7314
7318
7319
7322 if (ConfigIsExisting("canBeSplit"))
7323 {
7326 }
7327
7329 if (ConfigIsExisting("itemBehaviour"))
7331
7332
7335 RegisterNetSyncVariableInt("m_VarLiquidType");
7336 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7337
7338 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7339 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7340 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7341
7342 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7343 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7344 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7345 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7346
7347 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7348 RegisterNetSyncVariableBool("m_IsTakeable");
7349 RegisterNetSyncVariableBool("m_IsHologram");
7350
7353 {
7356 }
7357
7359
7361 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7363
7364 }
7365
7367 {
7369 }
7370
7372 {
7375 {
7380 }
7381 }
7382
7383 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7384 {
7386 {
7389 }
7390
7392 }
7393
7395 {
7401 }
7402
7404
7406 {
7408
7409 if (!action)
7410 {
7411 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7412 return;
7413 }
7414
7416 if (!ai)
7417 {
7419 return;
7420 }
7421
7423 if (!action_array)
7424 {
7425 action_array = new array<ActionBase_Basic>;
7427 }
7428 if (LogManager.IsActionLogEnable())
7429 {
7430 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7431 }
7432
7433 if (action_array.Find(action) != -1)
7434 {
7435 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7436 }
7437 else
7438 {
7439 action_array.Insert(action);
7440 }
7441 }
7442
7444 {
7446 ActionBase action = player.GetActionManager().GetAction(actionName);
7449
7450 if (action_array)
7451 {
7452 action_array.RemoveItem(action);
7453 }
7454 }
7455
7456
7457
7459 {
7460 ActionOverrideData overrideData = new ActionOverrideData();
7464
7466 if (!actionMap)
7467 {
7470 }
7471
7472 actionMap.Insert(this.
Type(), overrideData);
7473
7474 }
7475
7477
7479
7480
7482 {
7485
7488
7489 string config_to_search = "CfgVehicles";
7490 string muzzle_owner_config;
7491
7493 {
7494 if (IsInherited(Weapon))
7495 config_to_search = "CfgWeapons";
7496
7497 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7498
7499 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7500
7502
7503 if (config_OnFire_subclass_count > 0)
7504 {
7505 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7506
7507 for (int i = 0; i < config_OnFire_subclass_count; i++)
7508 {
7509 string particle_class = "";
7511 string config_OnFire_entry = config_OnFire_class + particle_class;
7512 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7513 WPOF_array.Insert(WPOF);
7514 }
7515
7516
7518 }
7519 }
7520
7522 {
7523 config_to_search = "CfgWeapons";
7524 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7525
7526 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7527
7529
7530 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7531 {
7532 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7533
7534 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7535 {
7536 string particle_class2 = "";
7538 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7539 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7540 WPOBE_array.Insert(WPOBE);
7541 }
7542
7543
7545 }
7546 }
7547 }
7548
7549
7551 {
7554
7556 {
7557 string config_to_search = "CfgVehicles";
7558
7559 if (IsInherited(Weapon))
7560 config_to_search = "CfgWeapons";
7561
7562 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7563 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7564
7565 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
7566 {
7567
7569
7571 {
7573 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7575 return;
7576 }
7577
7580
7581
7582
7584 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7585
7586 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7587 {
7588 string particle_class = "";
7590 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7592
7593 if (entry_type == CT_CLASS)
7594 {
7595 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7596 WPOOH_array.Insert(WPOF);
7597 }
7598 }
7599
7600
7602 }
7603 }
7604 }
7605
7607 {
7609 }
7610
7612 {
7614 {
7616
7619
7622
7623 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7624 }
7625 }
7626
7628 {
7630 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7631
7633 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7634
7636 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7637
7639 {
7641 }
7642 }
7643
7645 {
7647 }
7648
7650 {
7653 else
7655
7657 {
7660 }
7661 else
7662 {
7665
7668 }
7669
7671 }
7672
7674 {
7676 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7677 }
7678
7680 {
7682 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7684 }
7685
7687 {
7689 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7690 }
7691
7693 {
7696
7697 OverheatingParticle OP = new OverheatingParticle();
7702
7704 }
7705
7707 {
7710
7711 return -1;
7712 }
7713
7715 {
7717 {
7720
7721 for (int i = count; i > 0; --i)
7722 {
7723 int id = i - 1;
7726
7729
7730 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7731 {
7732 if (p)
7733 {
7736 }
7737 }
7738 }
7739 }
7740 }
7741
7743 {
7745 {
7747 {
7748 int id = i - 1;
7750
7751 if (OP)
7752 {
7754
7755 if (p)
7756 {
7758 }
7759
7760 delete OP;
7761 }
7762 }
7763
7766 }
7767 }
7768
7771 {
7772 return 0.0;
7773 }
7774
7775
7777 {
7778 return 250;
7779 }
7780
7782 {
7783 return 0;
7784 }
7785
7788 {
7790 return true;
7791
7792 return false;
7793 }
7794
7797 {
7800
7802 {
7804 }
7805 else
7806 {
7807
7809 }
7810
7812 }
7813
7820 {
7821 return -1;
7822 }
7823
7824
7825
7826
7828 {
7830 {
7832 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7833
7834 if (r_index >= 0)
7835 {
7836 InventoryLocation r_il = new InventoryLocation;
7837 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7838
7839 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7842 {
7843 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7844 }
7846 {
7847 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7848 }
7849
7850 }
7851
7852 player.GetHumanInventory().ClearUserReservedLocation(this);
7853 }
7854
7857 }
7858
7859
7860
7861
7863 {
7864 return ItemBase.m_DebugActionsMask;
7865 }
7866
7868 {
7869 return ItemBase.m_DebugActionsMask & mask;
7870 }
7871
7873 {
7874 ItemBase.m_DebugActionsMask = mask;
7875 }
7876
7878 {
7879 ItemBase.m_DebugActionsMask |= mask;
7880 }
7881
7883 {
7884 ItemBase.m_DebugActionsMask &= ~mask;
7885 }
7886
7888 {
7890 {
7892 }
7893 else
7894 {
7896 }
7897 }
7898
7899
7901 {
7902 if (GetEconomyProfile())
7903 {
7904 float q_max = GetEconomyProfile().GetQuantityMax();
7905 if (q_max > 0)
7906 {
7907 float q_min = GetEconomyProfile().GetQuantityMin();
7908 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7909
7911 {
7912 ComponentEnergyManager comp = GetCompEM();
7914 {
7916 }
7917 }
7919 {
7921
7922 }
7923
7924 }
7925 }
7926 }
7927
7930 {
7931 EntityAI parent = GetHierarchyParent();
7932
7933 if (parent)
7934 {
7935 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7936 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7937 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7938 }
7939 }
7940
7943 {
7944 EntityAI parent = GetHierarchyParent();
7945
7946 if (parent)
7947 {
7948 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7949 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7950 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7951 }
7952 }
7953
7955 {
7956
7957
7958
7959
7961
7963 {
7964 if (ScriptInputUserData.CanStoreInputUserData())
7965 {
7966 ScriptInputUserData ctx = new ScriptInputUserData;
7972 ctx.
Write(use_stack_max);
7975
7977 {
7978 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7979 }
7980 }
7981 }
7982 else if (!
GetGame().IsMultiplayer())
7983 {
7985 }
7986 }
7987
7989 {
7991 }
7992
7994 {
7996 }
7997
7999 {
8001 }
8002
8004 {
8005
8006 return false;
8007 }
8008
8010 {
8011 return false;
8012 }
8013
8017 {
8018 return false;
8019 }
8020
8022 {
8023 return "";
8024 }
8025
8027
8029 {
8030 return false;
8031 }
8032
8034 {
8035 return true;
8036 }
8037
8038
8039
8041 {
8042 return true;
8043 }
8044
8046 {
8047 return true;
8048 }
8049
8051 {
8052 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8054 }
8055
8057 {
8059 }
8060
8062 {
8064 if (!is_being_placed)
8066 SetSynchDirty();
8067 }
8068
8069
8071
8073 {
8075 }
8076
8078 {
8080 }
8081
8083 {
8084 return 1;
8085 }
8086
8088 {
8089 return false;
8090 }
8091
8093 {
8095 SetSynchDirty();
8096 }
8097
8098
8099
8100
8101
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8133 {
8134 super.OnMovedInsideCargo(container);
8135
8136 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8137 }
8138
8139 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8140 {
8141 super.EEItemLocationChanged(oldLoc,newLoc);
8142
8143 PlayerBase new_player = null;
8144 PlayerBase old_player = null;
8145
8146 if (newLoc.GetParent())
8147 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8148
8149 if (oldLoc.GetParent())
8150 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8151
8153 {
8154 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
8155
8156 if (r_index >= 0)
8157 {
8158 InventoryLocation r_il = new InventoryLocation;
8159 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8160
8161 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8164 {
8165 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8166 }
8168 {
8169 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8170 }
8171
8172 }
8173 }
8174
8176 {
8177 if (new_player)
8178 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
8179
8180 if (new_player == old_player)
8181 {
8182
8183 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8184 {
8186 {
8187 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8188 {
8189 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8190 }
8191 }
8192 else
8193 {
8194 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8195 }
8196 }
8197
8198 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8199 {
8200 int type = oldLoc.GetType();
8202 {
8203 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8204 }
8206 {
8207 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8208 }
8209 }
8210 if (!m_OldLocation)
8211 {
8212 m_OldLocation = new InventoryLocation;
8213 }
8214 m_OldLocation.Copy(oldLoc);
8215 }
8216 else
8217 {
8218 if (m_OldLocation)
8219 {
8220 m_OldLocation.Reset();
8221 }
8222 }
8223
8225 }
8226 else
8227 {
8228 if (new_player)
8229 {
8230 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8231 if (res_index >= 0)
8232 {
8233 InventoryLocation il = new InventoryLocation;
8234 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
8236 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
8239 {
8240 il.
GetParent().GetOnReleaseLock().Invoke(it);
8241 }
8243 {
8245 }
8246
8247 }
8248 }
8250 {
8251
8253 }
8254
8255 if (m_OldLocation)
8256 {
8257 m_OldLocation.Reset();
8258 }
8259 }
8260 }
8261
8262 override void EOnContact(IEntity other, Contact extra)
8263 {
8265 {
8266 int liquidType = -1;
8268 if (impactSpeed > 0.0)
8269 {
8271 #ifndef SERVER
8273 #else
8275 SetSynchDirty();
8276 #endif
8278 }
8279 }
8280
8281 #ifdef SERVER
8282 if (GetCompEM() && GetCompEM().IsPlugged())
8283 {
8284 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8285 GetCompEM().UnplugThis();
8286 }
8287 #endif
8288 }
8289
8291
8293 {
8295 }
8296
8298 {
8299
8300 }
8301
8303 {
8304 super.OnItemLocationChanged(old_owner, new_owner);
8305
8306 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8307 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8308
8309 if (!relatedPlayer && playerNew)
8310 relatedPlayer = playerNew;
8311
8312 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8313 {
8315 if (actionMgr)
8316 {
8317 ActionBase currentAction = actionMgr.GetRunningAction();
8318 if (currentAction)
8320 }
8321 }
8322
8323 Man ownerPlayerOld = null;
8324 Man ownerPlayerNew = null;
8325
8326 if (old_owner)
8327 {
8328 if (old_owner.
IsMan())
8329 {
8330 ownerPlayerOld = Man.Cast(old_owner);
8331 }
8332 else
8333 {
8334 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8335 }
8336 }
8337 else
8338 {
8340 {
8342
8343 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8344 {
8345 GetCompEM().UnplugThis();
8346 }
8347 }
8348 }
8349
8350 if (new_owner)
8351 {
8352 if (new_owner.
IsMan())
8353 {
8354 ownerPlayerNew = Man.Cast(new_owner);
8355 }
8356 else
8357 {
8358 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8359 }
8360 }
8361
8362 if (ownerPlayerOld != ownerPlayerNew)
8363 {
8364 if (ownerPlayerOld)
8365 {
8366 array<EntityAI> subItemsExit = new array<EntityAI>;
8368 for (int i = 0; i < subItemsExit.Count(); i++)
8369 {
8372 }
8373 }
8374
8375 if (ownerPlayerNew)
8376 {
8377 array<EntityAI> subItemsEnter = new array<EntityAI>;
8379 for (int j = 0; j < subItemsEnter.Count(); j++)
8380 {
8383 }
8384 }
8385 }
8386 else if (ownerPlayerNew != null)
8387 {
8388 PlayerBase nplayer;
8389 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8390 {
8391 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8393 for (int k = 0; k < subItemsUpdate.Count(); k++)
8394 {
8396 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8397 }
8398 }
8399 }
8400
8401 if (old_owner)
8402 old_owner.OnChildItemRemoved(this);
8403 if (new_owner)
8404 new_owner.OnChildItemReceived(this);
8405 }
8406
8407
8409 {
8410 super.EEDelete(parent);
8411 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8412 if (player)
8413 {
8415
8416 if (player.IsAlive())
8417 {
8418 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8419 if (r_index >= 0)
8420 {
8421 InventoryLocation r_il = new InventoryLocation;
8422 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8423
8424 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8427 {
8428 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8429 }
8431 {
8432 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8433 }
8434
8435 }
8436
8437 player.RemoveQuickBarEntityShortcut(this);
8438 }
8439 }
8440 }
8441
8443 {
8444 super.EEKilled(killer);
8445
8448 {
8449 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8450 {
8451 if (IsMagazine())
8452 {
8453 if (Magazine.Cast(this).GetAmmoCount() > 0)
8454 {
8456 }
8457 }
8458 else
8459 {
8461 }
8462 }
8463 }
8464 }
8465
8467 {
8468 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8469
8470 super.OnWasAttached(parent, slot_id);
8471
8474
8476 }
8477
8479 {
8480 super.OnWasDetached(parent, slot_id);
8481
8484 }
8485
8487 {
8488 int idx;
8491
8492 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8493 if (inventory_slots.Count() < 1)
8494 {
8495 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8496 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8497 }
8498 else
8499 {
8500 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8501 }
8502
8503 idx = inventory_slots.Find(slot);
8504 if (idx < 0)
8505 return "";
8506
8507 return attach_types.Get(idx);
8508 }
8509
8511 {
8512 int idx = -1;
8513 string slot;
8514
8517
8518 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8519 if (inventory_slots.Count() < 1)
8520 {
8521 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8522 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8523 }
8524 else
8525 {
8526 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8527 if (detach_types.Count() < 1)
8528 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8529 }
8530
8531 for (int i = 0; i < inventory_slots.Count(); i++)
8532 {
8533 slot = inventory_slots.Get(i);
8534 }
8535
8536 if (slot != "")
8537 {
8538 if (detach_types.Count() == 1)
8539 idx = 0;
8540 else
8541 idx = inventory_slots.Find(slot);
8542 }
8543 if (idx < 0)
8544 return "";
8545
8546 return detach_types.Get(idx);
8547 }
8548
8550 {
8551
8553
8554
8555 float min_time = 1;
8556 float max_time = 3;
8557 float delay = Math.RandomFloat(min_time, max_time);
8558
8559 explode_timer.Run(delay, this, "DoAmmoExplosion");
8560 }
8561
8563 {
8564 Magazine magazine = Magazine.Cast(this);
8565 int pop_sounds_count = 6;
8566 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8567
8568
8569 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8570 string sound_name = pop_sounds[ sound_idx ];
8572
8573
8574 magazine.ServerAddAmmoCount(-1);
8575
8576
8577 float min_temp_to_explode = 100;
8578
8579 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8580 {
8582 }
8583 }
8584
8585
8586 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8587 {
8588 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8589
8590 const int CHANCE_DAMAGE_CARGO = 4;
8591 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8592 const int CHANCE_DAMAGE_NOTHING = 2;
8593
8595 {
8596 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8597 int chances;
8598 int rnd;
8599
8600 if (GetInventory().GetCargo())
8601 {
8602 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8603 rnd = Math.RandomInt(0,chances);
8604
8605 if (rnd < CHANCE_DAMAGE_CARGO)
8606 {
8608 }
8609 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8610 {
8612 }
8613 }
8614 else
8615 {
8616 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8617 rnd = Math.RandomInt(0,chances);
8618
8619 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8620 {
8622 }
8623 }
8624 }
8625 }
8626
8628 {
8629 if (GetInventory().GetCargo())
8630 {
8631 int item_count = GetInventory().GetCargo().GetItemCount();
8632 if (item_count > 0)
8633 {
8634 int random_pick = Math.RandomInt(0, item_count);
8636 if (!item.IsExplosive())
8637 {
8638 item.AddHealth("","",damage);
8639 return true;
8640 }
8641 }
8642 }
8643 return false;
8644 }
8645
8647 {
8648 int attachment_count = GetInventory().AttachmentCount();
8649 if (attachment_count > 0)
8650 {
8651 int random_pick = Math.RandomInt(0, attachment_count);
8652 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
8653 if (!attachment.IsExplosive())
8654 {
8655 attachment.AddHealth("","",damage);
8656 return true;
8657 }
8658 }
8659 return false;
8660 }
8661
8663 {
8665 }
8666
8668 {
8670 return GetInventory().CanRemoveEntity();
8671
8672 return false;
8673 }
8674
8676 {
8677
8679 return false;
8680
8681
8683 return false;
8684
8685
8686
8688 if (delta == 0)
8689 return false;
8690
8691
8692 return true;
8693 }
8694
8696 {
8698 {
8699 if (ScriptInputUserData.CanStoreInputUserData())
8700 {
8701 ScriptInputUserData ctx = new ScriptInputUserData;
8706 ctx.
Write(destination_entity);
8710 }
8711 }
8712 else if (!
GetGame().IsMultiplayer())
8713 {
8715 }
8716 }
8717
8719 {
8720 float split_quantity_new;
8724 InventoryLocation loc = new InventoryLocation;
8725
8726 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8727 {
8729 split_quantity_new = stack_max;
8730 else
8732
8734 {
8735 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8736 if (new_item)
8737 {
8738 new_item.SetResultOfSplit(true);
8739 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8741 new_item.
SetQuantity(split_quantity_new,
false,
true);
8742 }
8743 }
8744 }
8745 else if (destination_entity && slot_id == -1)
8746 {
8747 if (quantity > stack_max)
8748 split_quantity_new = stack_max;
8749 else
8750 split_quantity_new = quantity;
8751
8753 {
8755 {
8758 }
8759
8760 if (new_item)
8761 {
8762 new_item.SetResultOfSplit(true);
8763 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8765 new_item.
SetQuantity(split_quantity_new,
false,
true);
8766 }
8767 }
8768 }
8769 else
8770 {
8771 if (stack_max != 0)
8772 {
8774 {
8776 }
8777
8778 if (split_quantity_new == 0)
8779 {
8780 if (!
GetGame().IsMultiplayer())
8781 player.PhysicalPredictiveDropItem(this);
8782 else
8783 player.ServerDropEntity(this);
8784 return;
8785 }
8786
8788 {
8790
8791 if (new_item)
8792 {
8793 new_item.SetResultOfSplit(true);
8794 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8797 new_item.PlaceOnSurface();
8798 }
8799 }
8800 }
8801 }
8802 }
8803
8805 {
8806 float split_quantity_new;
8810 InventoryLocation loc = new InventoryLocation;
8811
8812 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8813 {
8815 split_quantity_new = stack_max;
8816 else
8818
8820 {
8821 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8822 if (new_item)
8823 {
8824 new_item.SetResultOfSplit(true);
8825 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8827 new_item.
SetQuantity(split_quantity_new,
false,
true);
8828 }
8829 }
8830 }
8831 else if (destination_entity && slot_id == -1)
8832 {
8833 if (quantity > stack_max)
8834 split_quantity_new = stack_max;
8835 else
8836 split_quantity_new = quantity;
8837
8839 {
8841 {
8844 }
8845
8846 if (new_item)
8847 {
8848 new_item.SetResultOfSplit(true);
8849 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8851 new_item.
SetQuantity(split_quantity_new,
false,
true);
8852 }
8853 }
8854 }
8855 else
8856 {
8857 if (stack_max != 0)
8858 {
8860 {
8862 }
8863
8865 {
8867
8868 if (new_item)
8869 {
8870 new_item.SetResultOfSplit(true);
8871 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8874 new_item.PlaceOnSurface();
8875 }
8876 }
8877 }
8878 }
8879 }
8880
8882 {
8884 {
8885 if (ScriptInputUserData.CanStoreInputUserData())
8886 {
8887 ScriptInputUserData ctx = new ScriptInputUserData;
8892 dst.WriteToContext(ctx);
8894 }
8895 }
8896 else if (!
GetGame().IsMultiplayer())
8897 {
8899 }
8900 }
8901
8903 {
8905 {
8906 if (ScriptInputUserData.CanStoreInputUserData())
8907 {
8908 ScriptInputUserData ctx = new ScriptInputUserData;
8913 ctx.
Write(destination_entity);
8919 }
8920 }
8921 else if (!
GetGame().IsMultiplayer())
8922 {
8924 }
8925 }
8926
8928 {
8930 }
8931
8933 {
8935 float split_quantity_new;
8937 if (dst.IsValid())
8938 {
8939 int slot_id = dst.GetSlot();
8941
8942 if (quantity > stack_max)
8943 split_quantity_new = stack_max;
8944 else
8945 split_quantity_new = quantity;
8946
8948 {
8950
8951 if (new_item)
8952 {
8953 new_item.SetResultOfSplit(true);
8954 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8956 new_item.
SetQuantity(split_quantity_new,
false,
true);
8957 }
8958
8959 return new_item;
8960 }
8961 }
8962
8963 return null;
8964 }
8965
8967 {
8969 float split_quantity_new;
8971 if (destination_entity)
8972 {
8974 if (quantity > stackable)
8975 split_quantity_new = stackable;
8976 else
8977 split_quantity_new = quantity;
8978
8980 {
8981 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8982 if (new_item)
8983 {
8984 new_item.SetResultOfSplit(true);
8985 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8987 new_item.
SetQuantity(split_quantity_new,
false,
true);
8988 }
8989 }
8990 }
8991 }
8992
8994 {
8996 {
8997 if (ScriptInputUserData.CanStoreInputUserData())
8998 {
8999 ScriptInputUserData ctx = new ScriptInputUserData;
9004 ItemBase destination_entity =
this;
9005 ctx.
Write(destination_entity);
9009 }
9010 }
9011 else if (!
GetGame().IsMultiplayer())
9012 {
9014 }
9015 }
9016
9018 {
9020 float split_quantity_new;
9022 if (player)
9023 {
9025 if (quantity > stackable)
9026 split_quantity_new = stackable;
9027 else
9028 split_quantity_new = quantity;
9029
9031 {
9032 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9033 new_item =
ItemBase.Cast(in_hands);
9034 if (new_item)
9035 {
9036 new_item.SetResultOfSplit(true);
9037 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9039 new_item.SetQuantity(split_quantity_new, false, true);
9040 }
9041 }
9042 }
9043 }
9044
9046 {
9048 float split_quantity_new = Math.Floor(quantity * 0.5);
9049
9051 return;
9052
9054
9055 if (new_item)
9056 {
9057 if (new_item.GetQuantityMax() < split_quantity_new)
9058 {
9059 split_quantity_new = new_item.GetQuantityMax();
9060 }
9061
9062 new_item.SetResultOfSplit(true);
9063 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9064
9066 {
9069 }
9070 else
9071 {
9073 new_item.
SetQuantity(split_quantity_new,
false,
true);
9074 }
9075 }
9076 }
9077
9079 {
9081 float split_quantity_new = Math.Floor(quantity / 2);
9082
9084 return;
9085
9086 InventoryLocation invloc = new InventoryLocation;
9088
9090 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9091
9092 if (new_item)
9093 {
9094 if (new_item.GetQuantityMax() < split_quantity_new)
9095 {
9096 split_quantity_new = new_item.GetQuantityMax();
9097 }
9099 {
9102 }
9103 else if (split_quantity_new > 1)
9104 {
9106 new_item.
SetQuantity(split_quantity_new,
false,
true);
9107 }
9108 }
9109 }
9110
9113 {
9114 SetWeightDirty();
9116
9117 if (parent)
9118 parent.OnAttachmentQuantityChangedEx(this, delta);
9119
9121 {
9123 {
9125 }
9127 {
9128 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9130 }
9131 }
9132
9133 }
9134
9137 {
9138
9139 }
9140
9143 {
9145 }
9146
9148 {
9149 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9150
9152 {
9153 if (newLevel == GameConstants.STATE_RUINED)
9154 {
9156 EntityAI parent = GetHierarchyParent();
9157 if (parent && parent.IsFireplace())
9158 {
9159 CargoBase cargo = GetInventory().GetCargo();
9160 if (cargo)
9161 {
9163 {
9165 }
9166 }
9167 }
9168 }
9169
9171 {
9172
9174 return;
9175 }
9176
9177 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9178 {
9180 }
9181 }
9182 }
9183
9184
9186 {
9187 super.OnRightClick();
9188
9190 {
9192 {
9193 if (ScriptInputUserData.CanStoreInputUserData())
9194 {
9195 EntityAI root = GetHierarchyRoot();
9196 Man playerOwner = GetHierarchyRootPlayer();
9197 InventoryLocation dst = new InventoryLocation;
9198
9199
9200 if (!playerOwner && root && root == this)
9201 {
9203 }
9204 else
9205 {
9206
9207 GetInventory().GetCurrentInventoryLocation(dst);
9209 {
9212 {
9214 }
9215 else
9216 {
9218
9219
9220 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9221 {
9223 }
9224 else
9225 {
9226 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9227 }
9228 }
9229 }
9230 }
9231
9232 ScriptInputUserData ctx = new ScriptInputUserData;
9240 }
9241 }
9242 else if (!
GetGame().IsMultiplayer())
9243 {
9245 }
9246 }
9247 }
9248
9250 {
9251 if (root)
9252 {
9253 vector m4[4];
9254 root.GetTransform(m4);
9255 dst.SetGround(this, m4);
9256 }
9257 else
9258 {
9259 GetInventory().GetCurrentInventoryLocation(dst);
9260 }
9261 }
9262
9263 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9264 {
9265
9266 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9267 return false;
9268
9269 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9270 return false;
9271
9272
9274 return false;
9275
9276
9277 Magazine mag = Magazine.Cast(this);
9278 if (mag)
9279 {
9280 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9281 return false;
9282
9283 if (stack_max_limit)
9284 {
9285 Magazine other_mag = Magazine.Cast(other_item);
9286 if (other_item)
9287 {
9288 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9289 return false;
9290 }
9291
9292 }
9293 }
9294 else
9295 {
9296
9298 return false;
9299
9301 return false;
9302 }
9303
9304 PlayerBase player = null;
9305 if (CastTo(player, GetHierarchyRootPlayer()))
9306 {
9307 if (player.GetInventory().HasAttachment(this))
9308 return false;
9309
9310 if (player.IsItemsToDelete())
9311 return false;
9312 }
9313
9314 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9315 return false;
9316
9317 int slotID;
9319 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9320 return false;
9321
9322 return true;
9323 }
9324
9326 {
9328 }
9329
9331 {
9332 return m_IsResultOfSplit;
9333 }
9334
9336 {
9337 m_IsResultOfSplit = value;
9338 }
9339
9341 {
9343 }
9344
9346 {
9347 float other_item_quantity = other_item.GetQuantity();
9348 float this_free_space;
9349
9351
9353
9354 if (other_item_quantity > this_free_space)
9355 {
9356 return this_free_space;
9357 }
9358 else
9359 {
9360 return other_item_quantity;
9361 }
9362 }
9363
9365 {
9367 }
9368
9370 {
9372 return;
9373
9374 if (!IsMagazine() && other_item)
9375 {
9377 if (quantity_used != 0)
9378 {
9379 float hp1 = GetHealth01("","");
9380 float hp2 = other_item.GetHealth01("","");
9381 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9382 hpResult = hpResult / (
GetQuantity() + quantity_used);
9383
9384 hpResult *= GetMaxHealth();
9385 Math.Round(hpResult);
9386 SetHealth("", "Health", hpResult);
9387
9389 other_item.AddQuantity(-quantity_used);
9390 }
9391 }
9393 }
9394
9396 {
9397 #ifdef SERVER
9398 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9399 GetHierarchyParent().IncreaseLifetimeUp();
9400 #endif
9401 };
9402
9404 {
9405 PlayerBase p = PlayerBase.Cast(player);
9406
9407 array<int> recipesIds = p.m_Recipes;
9408 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9409 if (moduleRecipesManager)
9410 {
9411 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
9412 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9413 }
9414
9415 for (int i = 0;i < recipesIds.Count(); i++)
9416 {
9417 int key = recipesIds.Get(i);
9418 string recipeName = moduleRecipesManager.GetRecipeName(key);
9420 }
9421 }
9422
9423
9424 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9425 {
9426 super.GetDebugActions(outputList);
9427
9428
9434
9435
9440
9445
9446
9450
9451
9453 {
9457 }
9458
9461
9462
9466
9468
9469 InventoryLocation loc = new InventoryLocation();
9470 GetInventory().GetCurrentInventoryLocation(loc);
9472 {
9473 if (Gizmo_IsSupported())
9476 }
9477
9479 }
9480
9481
9482
9483
9485 {
9486 super.OnAction(action_id, player, ctx);
9487
9489 {
9490 switch (action_id)
9491 {
9494 return true;
9497 return true;
9498 }
9499 }
9500
9502 {
9503 switch (action_id)
9504 {
9506 Delete();
9507 return true;
9508 }
9509 }
9510
9511 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9512 {
9513 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9514 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9515 PlayerBase p = PlayerBase.Cast(player);
9516 if (
EActions.RECIPES_RANGE_START < 1000)
9517 {
9518 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9519 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9520 }
9521 }
9522 #ifndef SERVER
9523 else if (action_id ==
EActions.WATCH_PLAYER)
9524 {
9525 PluginDeveloper.SetDeveloperItemClientEx(player);
9526 }
9527 #endif
9529 {
9530 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9531 {
9532 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9533 OnDebugButtonPressServer(id + 1);
9534 }
9535
9536 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9537 {
9538 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9540 }
9541
9542 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9543 {
9544 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9546 }
9547
9548 else if (action_id ==
EActions.ADD_QUANTITY)
9549 {
9550 if (IsMagazine())
9551 {
9552 Magazine mag = Magazine.Cast(this);
9553 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9554 }
9555 else
9556 {
9558 }
9559
9560 if (m_EM)
9561 {
9562 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9563 }
9564
9565 }
9566
9567 else if (action_id ==
EActions.REMOVE_QUANTITY)
9568 {
9569 if (IsMagazine())
9570 {
9571 Magazine mag2 = Magazine.Cast(this);
9572 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9573 }
9574 else
9575 {
9577 }
9578 if (m_EM)
9579 {
9580 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9581 }
9582
9583 }
9584
9585 else if (action_id ==
EActions.SET_QUANTITY_0)
9586 {
9588
9589 if (m_EM)
9590 {
9591 m_EM.SetEnergy(0);
9592 }
9593 }
9594
9595 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9596 {
9598
9599 if (m_EM)
9600 {
9601 m_EM.SetEnergy(m_EM.GetEnergyMax());
9602 }
9603 }
9604
9605 else if (action_id ==
EActions.ADD_HEALTH)
9606 {
9607 AddHealth("","",GetMaxHealth("","Health")/5);
9608 }
9609 else if (action_id ==
EActions.REMOVE_HEALTH)
9610 {
9611 AddHealth("","",-GetMaxHealth("","Health")/5);
9612 }
9613 else if (action_id ==
EActions.DESTROY_HEALTH)
9614 {
9615 SetHealth01("","",0);
9616 }
9617 else if (action_id ==
EActions.WATCH_ITEM)
9618 {
9620 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9621 #ifdef DEVELOPER
9622 SetDebugDeveloper_item(this);
9623 #endif
9624 }
9625
9626 else if (action_id ==
EActions.ADD_TEMPERATURE)
9627 {
9628 AddTemperature(20);
9629
9630 }
9631
9632 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9633 {
9634 AddTemperature(-20);
9635
9636 }
9637
9638 else if (action_id ==
EActions.FLIP_FROZEN)
9639 {
9640 SetFrozen(!GetIsFrozen());
9641
9642 }
9643
9644 else if (action_id ==
EActions.ADD_WETNESS)
9645 {
9647
9648 }
9649
9650 else if (action_id ==
EActions.REMOVE_WETNESS)
9651 {
9653
9654 }
9655
9656 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9657 {
9660
9661
9662 }
9663
9664 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9665 {
9668 }
9669
9670 else if (action_id ==
EActions.MAKE_SPECIAL)
9671 {
9672 auto debugParams = DebugSpawnParams.WithPlayer(player);
9673 OnDebugSpawnEx(debugParams);
9674 }
9675
9676 }
9677
9678
9679 return false;
9680 }
9681
9682
9683
9684
9688
9691
9692
9693
9695 {
9696 return false;
9697 }
9698
9699
9701 {
9702 return true;
9703 }
9704
9705
9707 {
9708 return true;
9709 }
9710
9711
9712
9714 {
9715 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9717 }
9718
9721 {
9722 return null;
9723 }
9724
9726 {
9727 return false;
9728 }
9729
9731 {
9732 return false;
9733 }
9734
9738
9739
9741 {
9742 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9743 return module_repairing.CanRepair(this, item_repair_kit);
9744 }
9745
9746
9747 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9748 {
9749 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9750 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9751 }
9752
9753
9755 {
9756
9757
9758
9759
9760
9761
9762
9763
9764 return 1;
9765 }
9766
9767
9768
9770 {
9772 }
9773
9774
9775
9777 {
9779 }
9780
9781
9790 {
9791 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9792
9793 if (player)
9794 {
9795 player.MessageStatus(text);
9796 }
9797 }
9798
9799
9808 {
9809 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9810
9811 if (player)
9812 {
9813 player.MessageAction(text);
9814 }
9815 }
9816
9817
9826 {
9827 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9828
9829 if (player)
9830 {
9831 player.MessageFriendly(text);
9832 }
9833 }
9834
9835
9844 {
9845 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9846
9847 if (player)
9848 {
9849 player.MessageImportant(text);
9850 }
9851 }
9852
9854 {
9855 return true;
9856 }
9857
9858
9859 override bool KindOf(
string tag)
9860 {
9861 bool found = false;
9862 string item_name = this.
GetType();
9865
9866 int array_size = item_tag_array.Count();
9867 for (int i = 0; i < array_size; i++)
9868 {
9869 if (item_tag_array.Get(i) == tag)
9870 {
9871 found = true;
9872 break;
9873 }
9874 }
9875 return found;
9876 }
9877
9878
9880 {
9881
9882 super.OnRPC(sender, rpc_type,ctx);
9883
9884
9885 switch (rpc_type)
9886 {
9887 #ifndef SERVER
9888 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9889 Param2<bool, string> p = new Param2<bool, string>(false, "");
9890
9892 return;
9893
9894 bool play = p.param1;
9895 string soundSet = p.param2;
9896
9897 if (play)
9898 {
9900 {
9902 {
9904 }
9905 }
9906 else
9907 {
9909 }
9910 }
9911 else
9912 {
9914 }
9915
9916 break;
9917 #endif
9918
9919 }
9920
9922 {
9924 }
9925 }
9926
9927
9928
9929
9931 {
9932 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9933 return plugin.GetID(
name);
9934 }
9935
9937 {
9938 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9939 return plugin.GetName(id);
9940 }
9941
9944 {
9945
9946
9947 int varFlags;
9948 if (!ctx.
Read(varFlags))
9949 return;
9950
9951 if (varFlags & ItemVariableFlags.FLOAT)
9952 {
9954 }
9955 }
9956
9958 {
9959
9960 super.SerializeNumericalVars(floats_out);
9961
9962
9963
9965 {
9967 }
9968
9970 {
9972 }
9973
9975 {
9977 }
9978
9980 {
9985 }
9986
9988 {
9990 }
9991 }
9992
9994 {
9995
9996 super.DeSerializeNumericalVars(floats);
9997
9998
9999 int index = 0;
10000 int mask = Math.Round(floats.Get(index));
10001
10002 index++;
10003
10005 {
10007 {
10009 }
10010 else
10011 {
10012 float quantity = floats.Get(index);
10013 SetQuantity(quantity,
true,
false,
false,
false);
10014 }
10015 index++;
10016 }
10017
10019 {
10020 float wet = floats.Get(index);
10022 index++;
10023 }
10024
10026 {
10027 int liquidtype = Math.Round(floats.Get(index));
10029 index++;
10030 }
10031
10033 {
10035 index++;
10037 index++;
10039 index++;
10041 index++;
10042 }
10043
10045 {
10046 int cleanness = Math.Round(floats.Get(index));
10048 index++;
10049 }
10050 }
10051
10053 {
10054 super.WriteVarsToCTX(ctx);
10055
10056
10058 {
10060 }
10061
10063 {
10065 }
10066
10068 {
10070 }
10071
10073 {
10074 int r,g,b,a;
10080 }
10081
10083 {
10085 }
10086 }
10087
10089 {
10090 if (!super.ReadVarsFromCTX(ctx,version))
10091 return false;
10092
10093 int intValue;
10094 float value;
10095
10096 if (version < 140)
10097 {
10098 if (!ctx.
Read(intValue))
10099 return false;
10100
10101 m_VariablesMask = intValue;
10102 }
10103
10105 {
10106 if (!ctx.
Read(value))
10107 return false;
10108
10110 {
10112 }
10113 else
10114 {
10116 }
10117 }
10118
10119 if (version < 140)
10120 {
10122 {
10123 if (!ctx.
Read(value))
10124 return false;
10125 SetTemperatureDirect(value);
10126 }
10127 }
10128
10130 {
10131 if (!ctx.
Read(value))
10132 return false;
10134 }
10135
10137 {
10138 if (!ctx.
Read(intValue))
10139 return false;
10141 }
10142
10144 {
10145 int r,g,b,a;
10147 return false;
10149 return false;
10151 return false;
10153 return false;
10154
10156 }
10157
10159 {
10160 if (!ctx.
Read(intValue))
10161 return false;
10163 }
10164
10165 if (version >= 138 && version < 140)
10166 {
10168 {
10169 if (!ctx.
Read(intValue))
10170 return false;
10171 SetFrozen(intValue);
10172 }
10173 }
10174
10175 return true;
10176 }
10177
10178
10180 {
10183 {
10185 }
10186
10187 if (!super.OnStoreLoad(ctx, version))
10188 {
10190 return false;
10191 }
10192
10193 if (version >= 114)
10194 {
10195 bool hasQuickBarIndexSaved;
10196
10197 if (!ctx.
Read(hasQuickBarIndexSaved))
10198 {
10200 return false;
10201 }
10202
10203 if (hasQuickBarIndexSaved)
10204 {
10205 int itmQBIndex;
10206
10207
10208 if (!ctx.
Read(itmQBIndex))
10209 {
10211 return false;
10212 }
10213
10214 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10215 if (itmQBIndex != -1 && parentPlayer)
10216 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10217 }
10218 }
10219 else
10220 {
10221
10222 PlayerBase player;
10223 int itemQBIndex;
10224 if (version ==
int.
MAX)
10225 {
10226 if (!ctx.
Read(itemQBIndex))
10227 {
10229 return false;
10230 }
10231 }
10232 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10233 {
10234
10235 if (!ctx.
Read(itemQBIndex))
10236 {
10238 return false;
10239 }
10240 if (itemQBIndex != -1 && player)
10241 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10242 }
10243 }
10244
10245 if (version < 140)
10246 {
10247
10248 if (!LoadVariables(ctx, version))
10249 {
10251 return false;
10252 }
10253 }
10254
10255
10257 {
10259 return false;
10260 }
10261 if (version >= 132)
10262 {
10264 if (raib)
10265 {
10267 {
10269 return false;
10270 }
10271 }
10272 }
10273
10275 return true;
10276 }
10277
10278
10279
10281 {
10282 super.OnStoreSave(ctx);
10283
10284 PlayerBase player;
10285 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10286 {
10288
10289 int itemQBIndex = -1;
10290 itemQBIndex = player.FindQuickBarEntityIndex(this);
10291 ctx.
Write(itemQBIndex);
10292 }
10293 else
10294 {
10296 }
10297
10299
10301 if (raib)
10302 {
10304 }
10305 }
10306
10307
10309 {
10310 super.AfterStoreLoad();
10311
10313 {
10315 }
10316
10318 {
10321 }
10322 }
10323
10325 {
10326 super.EEOnAfterLoad();
10327
10329 {
10331 }
10332
10335 }
10336
10338 {
10339 return false;
10340 }
10341
10342
10343
10345 {
10347 {
10348 #ifdef PLATFORM_CONSOLE
10349
10351 {
10353 if (menu)
10354 {
10356 }
10357 }
10358 #endif
10359 }
10360
10362 {
10365 }
10366
10368 {
10369 SetWeightDirty();
10371 }
10373 {
10376 }
10377
10379 {
10382 }
10384 {
10387 }
10388
10389 super.OnVariablesSynchronized();
10390 }
10391
10392
10393
10395 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10396 {
10397 if (!IsServerCheck(allow_client))
10398 return false;
10399
10401 return false;
10402
10405
10406 if (value <= (min + 0.001))
10407 value = min;
10408
10409 if (value == min)
10410 {
10411 if (destroy_config)
10412 {
10413 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10414 if (dstr)
10415 {
10417 this.Delete();
10418 return true;
10419 }
10420 }
10421 else if (destroy_forced)
10422 {
10424 this.Delete();
10425 return true;
10426 }
10427
10429 }
10430
10433
10435 {
10437
10438 if (delta)
10440 }
10441
10443
10444 return false;
10445 }
10446
10447
10449 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10450 {
10452 }
10453
10455 {
10458 }
10459
10461 {
10464 }
10465
10467 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10468 {
10469 float value_clamped = Math.Clamp(value, 0, 1);
10471 SetQuantity(result, destroy_config, destroy_forced);
10472 }
10473
10474
10477 {
10479 }
10480
10482 {
10484 }
10485
10486
10487
10488
10489
10490
10491
10492
10493
10494
10496 {
10497 int slot = -1;
10498 if (GetInventory())
10499 {
10500 InventoryLocation il = new InventoryLocation;
10501 GetInventory().GetCurrentInventoryLocation(il);
10503 }
10504
10506 }
10507
10509 {
10510 float quantity_max = 0;
10511
10513 {
10514 if (attSlotID != -1)
10515 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10516
10517 if (quantity_max <= 0)
10519 }
10520
10521 if (quantity_max <= 0)
10523
10524 return quantity_max;
10525 }
10526
10528 {
10530 }
10531
10533 {
10535 }
10536
10537
10539 {
10541 }
10542
10544 {
10546 }
10547
10549 {
10551 }
10552
10553
10555 {
10556
10557 float weightEx = GetWeightEx();
10558 float special = GetInventoryAndCargoWeight();
10559 return weightEx - special;
10560 }
10561
10562
10564 {
10566 }
10567
10569 {
10571 {
10572 #ifdef DEVELOPER
10573 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10574 {
10575 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10577 }
10578 #endif
10579
10580 return GetQuantity() * GetConfigWeightModified();
10581 }
10582 else if (HasEnergyManager())
10583 {
10584 #ifdef DEVELOPER
10585 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10586 {
10587 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10588 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10589 }
10590 #endif
10591 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10592 }
10593 else
10594 {
10595 #ifdef DEVELOPER
10596 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10597 {
10598 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10599 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10600 }
10601 #endif
10602 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10603 }
10604 }
10605
10608 {
10609 int item_count = 0;
10611
10612 if (GetInventory().GetCargo() != NULL)
10613 {
10614 item_count = GetInventory().GetCargo().GetItemCount();
10615 }
10616
10617 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
10618 {
10619 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
10620 if (item)
10621 item_count += item.GetNumberOfItems();
10622 }
10623 return item_count;
10624 }
10625
10628 {
10629 float weight = 0;
10630 float wetness = 1;
10631 if (include_wetness)
10634 {
10635 weight = wetness * m_ConfigWeight;
10636 }
10638 {
10639 weight = 1;
10640 }
10641 return weight;
10642 }
10643
10644
10645
10647 {
10648 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
10649 {
10650 GameInventory inv = GetInventory();
10651 array<EntityAI> items = new array<EntityAI>;
10653 for (int i = 0; i < items.Count(); i++)
10654 {
10656 if (item)
10657 {
10659 }
10660 }
10661 }
10662 }
10663
10664
10665
10666
10668 {
10669 float energy = 0;
10670 if (HasEnergyManager())
10671 {
10672 energy = GetCompEM().GetEnergy();
10673 }
10674 return energy;
10675 }
10676
10677
10679 {
10680 super.OnEnergyConsumed();
10681
10683 }
10684
10686 {
10687 super.OnEnergyAdded();
10688
10690 }
10691
10692
10694 {
10695 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10696 {
10698 {
10699 float energy_0to1 = GetCompEM().GetEnergy0To1();
10701 }
10702 }
10703 }
10704
10705
10707 {
10708 return ConfigGetFloat("heatIsolation");
10709 }
10710
10712 {
10714 }
10715
10717 {
10718 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10719 if (
GetGame().ConfigIsExisting(paramPath))
10721
10722 return 0.0;
10723 }
10724
10726 {
10727 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10728 if (
GetGame().ConfigIsExisting(paramPath))
10730
10731 return 0.0;
10732 }
10733
10734 override void SetWet(
float value,
bool allow_client =
false)
10735 {
10736 if (!IsServerCheck(allow_client))
10737 return;
10738
10741
10743
10744 m_VarWet = Math.Clamp(value, min, max);
10745
10747 {
10750 }
10751 }
10752
10753 override void AddWet(
float value)
10754 {
10756 }
10757
10759 {
10761 }
10762
10764 {
10766 }
10767
10769 {
10771 }
10772
10774 {
10776 }
10777
10779 {
10781 }
10782
10783 override void OnWetChanged(
float newVal,
float oldVal)
10784 {
10787 if (newLevel != oldLevel)
10788 {
10790 }
10791 }
10792
10794 {
10795 SetWeightDirty();
10796 }
10797
10799 {
10800 return GetWetLevelInternal(
m_VarWet);
10801 }
10802
10803
10804
10806 {
10808 }
10809
10811 {
10813 }
10814
10816 {
10818 }
10819
10821 {
10823 }
10824
10825
10826
10828 {
10829 if (ConfigIsExisting("itemModelLength"))
10830 {
10831 return ConfigGetFloat("itemModelLength");
10832 }
10833 return 0;
10834 }
10835
10837 {
10838 if (ConfigIsExisting("itemAttachOffset"))
10839 {
10840 return ConfigGetFloat("itemAttachOffset");
10841 }
10842 return 0;
10843 }
10844
10845 override void SetCleanness(
int value,
bool allow_client =
false)
10846 {
10847 if (!IsServerCheck(allow_client))
10848 return;
10849
10851
10853
10856 }
10857
10859 {
10861 }
10862
10864 {
10865 return true;
10866 }
10867
10868
10869
10870
10872 {
10874 }
10875
10877 {
10879 }
10880
10881
10882
10883
10884 override void SetColor(
int r,
int g,
int b,
int a)
10885 {
10891 }
10893 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10894 {
10899 }
10900
10902 {
10904 }
10905
10908 {
10909 int r,g,b,a;
10911 r = r/255;
10912 g = g/255;
10913 b = b/255;
10914 a = a/255;
10915 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10916 }
10917
10918
10919
10920 override void SetLiquidType(
int value,
bool allow_client =
false)
10921 {
10922 if (!IsServerCheck(allow_client))
10923 return;
10924
10929 }
10930
10932 {
10933 return ConfigGetInt("varLiquidTypeInit");
10934 }
10935
10937 {
10939 }
10940
10942 {
10944 SetFrozen(false);
10945 }
10946
10949 {
10950 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10951 }
10952
10953
10956 {
10957 PlayerBase nplayer;
10958 if (PlayerBase.CastTo(nplayer, player))
10959 {
10961
10962 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10963 }
10964 }
10965
10966
10969 {
10970 PlayerBase nplayer;
10971 if (PlayerBase.CastTo(nplayer,player))
10972 {
10973
10974 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10975
10976 }
10977
10978
10979 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10980
10981
10982 if (HasEnergyManager())
10983 {
10984 GetCompEM().UpdatePlugState();
10985 }
10986 }
10987
10988
10990 {
10991 super.OnPlacementStarted(player);
10992
10994 }
10995
10996 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
10997 {
10999 {
11000 m_AdminLog.OnPlacementComplete(player,
this);
11001 }
11002
11003 super.OnPlacementComplete(player, position, orientation);
11004 }
11005
11006
11007
11008
11009
11011 {
11013 {
11014 return true;
11015 }
11016 else
11017 {
11018 return false;
11019 }
11020 }
11021
11022
11024 {
11026 {
11028 }
11029 }
11030
11031
11033 {
11035 }
11036
11038 {
11040 }
11041
11042 override void InsertAgent(
int agent,
float count = 1)
11043 {
11044 if (count < 1)
11045 return;
11046
11048 }
11049
11052 {
11054 }
11055
11056
11058 {
11060 }
11061
11062
11063
11064
11065
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11104 {
11106 return false;
11107 return true;
11108 }
11109
11111 {
11112
11114 }
11115
11116
11119 {
11120 super.CheckForRoofLimited(timeTresholdMS);
11121
11123 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11124 {
11125 m_PreviousRoofTestTime = time;
11126 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11127 }
11128 }
11129
11130
11132 {
11134 {
11135 return 0;
11136 }
11137
11138 if (GetInventory().GetAttachmentSlotsCount() != 0)
11139 {
11140 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11141 if (filter)
11142 return filter.GetProtectionLevel(type, false, system);
11143 else
11144 return 0;
11145 }
11146
11147 string subclassPath, entryName;
11148
11149 switch (type)
11150 {
11152 entryName = "biological";
11153 break;
11155 entryName = "chemical";
11156 break;
11157 default:
11158 entryName = "biological";
11159 break;
11160 }
11161
11162 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11163
11165 }
11166
11167
11168
11171 {
11172 if (!IsMagazine())
11174
11176 }
11177
11178
11179
11180
11181
11186 {
11187 return true;
11188 }
11189
11191 {
11193 }
11194
11195
11196
11197
11198
11200 {
11201 if (parent)
11202 {
11203 if (parent.IsInherited(DayZInfected))
11204 return true;
11205
11206 if (!parent.IsRuined())
11207 return true;
11208 }
11209
11210 return true;
11211 }
11212
11214 {
11215 if (!super.CanPutAsAttachment(parent))
11216 {
11217 return false;
11218 }
11219
11220 if (!IsRuined() && !parent.IsRuined())
11221 {
11222 return true;
11223 }
11224
11225 return false;
11226 }
11227
11229 {
11230
11231
11232
11233
11234 return super.CanReceiveItemIntoCargo(item);
11235 }
11236
11238 {
11239
11240
11241
11242
11243 GameInventory attachmentInv = attachment.GetInventory();
11245 {
11246 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11247 return false;
11248 }
11249
11250 InventoryLocation loc = new InventoryLocation();
11251 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11252 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11253 return false;
11254
11255 return super.CanReceiveAttachment(attachment, slotId);
11256 }
11257
11259 {
11260 if (!super.CanReleaseAttachment(attachment))
11261 return false;
11262
11263 return GetInventory().AreChildrenAccessible();
11264 }
11265
11266
11267
11268
11269
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11287 {
11288 int id = muzzle_owner.GetMuzzleID();
11289 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11290
11291 if (WPOF_array)
11292 {
11293 for (int i = 0; i < WPOF_array.Count(); i++)
11294 {
11295 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11296
11297 if (WPOF)
11298 {
11299 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11300 }
11301 }
11302 }
11303 }
11304
11305
11307 {
11308 int id = muzzle_owner.GetMuzzleID();
11310
11311 if (WPOBE_array)
11312 {
11313 for (int i = 0; i < WPOBE_array.Count(); i++)
11314 {
11315 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11316
11317 if (WPOBE)
11318 {
11319 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11320 }
11321 }
11322 }
11323 }
11324
11325
11327 {
11328 int id = muzzle_owner.GetMuzzleID();
11329 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11330
11331 if (WPOOH_array)
11332 {
11333 for (int i = 0; i < WPOOH_array.Count(); i++)
11334 {
11335 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11336
11337 if (WPOOH)
11338 {
11339 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11340 }
11341 }
11342 }
11343 }
11344
11345
11347 {
11348 int id = muzzle_owner.GetMuzzleID();
11349 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11350
11351 if (WPOOH_array)
11352 {
11353 for (int i = 0; i < WPOOH_array.Count(); i++)
11354 {
11355 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11356
11357 if (WPOOH)
11358 {
11359 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11360 }
11361 }
11362 }
11363 }
11364
11365
11367 {
11368 int id = muzzle_owner.GetMuzzleID();
11369 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11370
11371 if (WPOOH_array)
11372 {
11373 for (int i = 0; i < WPOOH_array.Count(); i++)
11374 {
11375 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11376
11377 if (WPOOH)
11378 {
11379 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11380 }
11381 }
11382 }
11383 }
11384
11385
11386
11388 {
11390 {
11391 return true;
11392 }
11393
11394 return false;
11395 }
11396
11398 {
11400 {
11401 return true;
11402 }
11403
11404 return false;
11405 }
11406
11408 {
11410 {
11411 return true;
11412 }
11413
11414 return false;
11415 }
11416
11418 {
11419 return false;
11420 }
11421
11424 {
11425 return UATimeSpent.DEFAULT_DEPLOY;
11426 }
11427
11428
11429
11430
11432 {
11434 SetSynchDirty();
11435 }
11436
11438 {
11440 }
11441
11442
11444 {
11445 return false;
11446 }
11447
11450 {
11451 string att_type = "None";
11452
11453 if (ConfigIsExisting("soundAttType"))
11454 {
11455 att_type = ConfigGetString("soundAttType");
11456 }
11457
11459 }
11460
11462 {
11464 }
11465
11466
11467
11468
11469
11475
11477 {
11480
11482 }
11483
11484
11486 {
11488 return;
11489
11491
11494
11497
11498 SoundParameters params = new SoundParameters();
11502 }
11503
11504
11506 {
11508 return;
11509
11511 SetSynchDirty();
11512
11515 }
11516
11517
11519 {
11521 return;
11522
11524 SetSynchDirty();
11525
11528 }
11529
11531 {
11533 }
11534
11536 {
11538 }
11539
11542 {
11543 if (!
GetGame().IsDedicatedServer())
11544 {
11545 if (ConfigIsExisting("attachSoundSet"))
11546 {
11547 string cfg_path = "";
11548 string soundset = "";
11549 string type_name =
GetType();
11550
11553 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11554 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11555
11556 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11557 {
11558 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11559 {
11560 if (cfg_slot_array[i] == slot_type)
11561 {
11562 soundset = cfg_soundset_array[i];
11563 break;
11564 }
11565 }
11566 }
11567
11568 if (soundset != "")
11569 {
11570 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11572 }
11573 }
11574 }
11575 }
11576
11578 {
11579
11580 }
11581
11582 void OnApply(PlayerBase player);
11583
11585 {
11586 return 1.0;
11587 };
11588
11590 {
11592 }
11593
11595 {
11597 }
11598
11600
11602 {
11603 SetDynamicPhysicsLifeTime(0.01);
11605 }
11606
11608 {
11609 array<string> zone_names = new array<string>;
11610 GetDamageZones(zone_names);
11611 for (int i = 0; i < zone_names.Count(); i++)
11612 {
11613 SetHealthMax(zone_names.Get(i),"Health");
11614 }
11615 SetHealthMax("","Health");
11616 }
11617
11620 {
11621 float global_health = GetHealth01("","Health");
11622 array<string> zones = new array<string>;
11623 GetDamageZones(zones);
11624
11625 for (int i = 0; i < zones.Count(); i++)
11626 {
11627 SetHealth01(zones.Get(i),"Health",global_health);
11628 }
11629 }
11630
11633 {
11634 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11635 }
11636
11638 {
11639 if (!hasRootAsPlayer)
11640 {
11641 if (refParentIB)
11642 {
11643
11644 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11645 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11646
11647 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11648 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11649
11652 }
11653 else
11654 {
11655
11658 }
11659 }
11660 }
11661
11663 {
11665 {
11666 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11667 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11668 {
11669 float heatPermCoef = 1.0;
11671 while (ent)
11672 {
11673 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11674 ent = ent.GetHierarchyParent();
11675 }
11676
11677 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11678 }
11679 }
11680 }
11681
11683 {
11684
11685 EntityAI parent = GetHierarchyParent();
11686 if (!parent)
11687 {
11688 hasParent = false;
11689 hasRootAsPlayer = false;
11690 }
11691 else
11692 {
11693 hasParent = true;
11694 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11695 refParentIB =
ItemBase.Cast(parent);
11696 }
11697 }
11698
11699 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11700 {
11701
11702 }
11703
11705 {
11706
11707 return false;
11708 }
11709
11711 {
11712
11713
11714 return false;
11715 }
11716
11718 {
11719
11720 return false;
11721 }
11722
11725 {
11726 return !GetIsFrozen() &&
IsOpen();
11727 }
11728
11730 {
11731 bool hasParent = false, hasRootAsPlayer = false;
11733
11734 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11735 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11736
11737 if (wwtu || foodDecay)
11738 {
11742
11743 if (processWetness || processTemperature || processDecay)
11744 {
11746
11747 if (processWetness)
11748 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11749
11750 if (processTemperature)
11752
11753 if (processDecay)
11754 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11755 }
11756 }
11757 }
11758
11761 {
11763 }
11764
11766 {
11769
11770 return super.GetTemperatureFreezeThreshold();
11771 }
11772
11774 {
11777
11778 return super.GetTemperatureThawThreshold();
11779 }
11780
11782 {
11785
11786 return super.GetItemOverheatThreshold();
11787 }
11788
11790 {
11792 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11793
11794 return super.GetTemperatureFreezeTime();
11795 }
11796
11798 {
11800 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11801
11802 return super.GetTemperatureThawTime();
11803 }
11804
11809
11811 {
11812 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11813 }
11814
11816 {
11817 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11818 }
11819
11822 {
11824 }
11825
11827 {
11829 }
11830
11832 {
11834 }
11835
11838 {
11839 return null;
11840 }
11841
11844 {
11845 return false;
11846 }
11847
11849 {
11851 {
11854 if (!trg)
11855 {
11857 explosive = this;
11858 }
11859
11860 explosive.PairRemote(trg);
11862
11863 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11864 trg.SetPersistentPairID(persistentID);
11865 explosive.SetPersistentPairID(persistentID);
11866
11867 return true;
11868 }
11869 return false;
11870 }
11871
11874 {
11875 float ret = 1.0;
11878 ret *= GetHealth01();
11879
11880 return ret;
11881 }
11882
11883 #ifdef DEVELOPER
11884 override void SetDebugItem()
11885 {
11886 super.SetDebugItem();
11887 _itemBase = this;
11888 }
11889
11891 {
11892 string text = super.GetDebugText();
11893
11895 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11896
11897 return text;
11898 }
11899 #endif
11900
11902 {
11903 return true;
11904 }
11905
11907
11909
11911 {
11914 }
11915
11916
11924
11940}
11941
11943{
11945 if (entity)
11946 {
11947 bool is_item = entity.IsInherited(
ItemBase);
11948 if (is_item && full_quantity)
11949 {
11952 }
11953 }
11954 else
11955 {
11957 return NULL;
11958 }
11959 return entity;
11960}
11961
11963{
11964 if (item)
11965 {
11966 if (health > 0)
11967 item.SetHealth("", "", health);
11968
11969 if (item.CanHaveTemperature())
11970 {
11972 if (item.CanFreeze())
11973 item.SetFrozen(false);
11974 }
11975
11976 if (item.HasEnergyManager())
11977 {
11978 if (quantity >= 0)
11979 {
11980 item.GetCompEM().SetEnergy0To1(quantity);
11981 }
11982 else
11983 {
11985 }
11986 }
11987 else if (item.IsMagazine())
11988 {
11989 Magazine mag = Magazine.Cast(item);
11990 if (quantity >= 0)
11991 {
11992 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11993 }
11994 else
11995 {
11997 }
11998
11999 }
12000 else
12001 {
12002 if (quantity >= 0)
12003 {
12004 item.SetQuantityNormalized(quantity, false);
12005 }
12006 else
12007 {
12009 }
12010
12011 }
12012 }
12013}
12014
12015#ifdef DEVELOPER
12017#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.