7152{
7154 {
7155 return true;
7156 }
7157};
7158
7159
7160
7162{
7166
7168
7171
7172
7173
7174
7175
7184
7190
7195
7200
7221 protected bool m_IsResultOfSplit
7222
7224
7229
7230
7231
7233
7237
7238
7239
7241
7244
7245
7246
7252
7253
7261
7264
7265
7267
7268
7270
7271
7276
7277
7282
7283
7285
7286
7288 {
7293
7294 if (!
GetGame().IsDedicatedServer())
7295 {
7297 {
7299
7301 {
7303 }
7304 }
7305
7308 }
7309
7310 m_OldLocation = null;
7311
7313 {
7315 }
7316
7317 if (ConfigIsExisting("headSelectionsToHide"))
7318 {
7321 }
7322
7324 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7325 {
7327 }
7328
7330
7331 m_IsResultOfSplit = false;
7332
7334 }
7335
7337 {
7338 super.InitItemVariables();
7339
7345 m_Count = ConfigGetInt(
"count");
7346
7349
7354
7357
7362
7374
7378
7379
7382 if (ConfigIsExisting("canBeSplit"))
7383 {
7386 }
7387
7389 if (ConfigIsExisting("itemBehaviour"))
7391
7392
7395 RegisterNetSyncVariableInt("m_VarLiquidType");
7396 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7397
7398 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7399 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7400 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7401
7402 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7403 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7404 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7405 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7406
7407 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7408 RegisterNetSyncVariableBool("m_IsTakeable");
7409 RegisterNetSyncVariableBool("m_IsHologram");
7410
7413 {
7416 }
7417
7419
7421 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7423
7424 }
7425
7427 {
7429 }
7430
7432 {
7435 {
7440 }
7441 }
7442
7443 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7444 {
7446 {
7449 }
7450
7452 }
7453
7455 {
7461 }
7462
7464
7466 {
7468
7469 if (!action)
7470 {
7471 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7472 return;
7473 }
7474
7476 if (!ai)
7477 {
7479 return;
7480 }
7481
7483 if (!action_array)
7484 {
7485 action_array = new array<ActionBase_Basic>;
7487 }
7488 if (LogManager.IsActionLogEnable())
7489 {
7490 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7491 }
7492
7493 if (action_array.Find(action) != -1)
7494 {
7495 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7496 }
7497 else
7498 {
7499 action_array.Insert(action);
7500 }
7501 }
7502
7504 {
7506 ActionBase action = player.GetActionManager().GetAction(actionName);
7509
7510 if (action_array)
7511 {
7512 action_array.RemoveItem(action);
7513 }
7514 }
7515
7516
7517
7519 {
7520 ActionOverrideData overrideData = new ActionOverrideData();
7524
7526 if (!actionMap)
7527 {
7530 }
7531
7532 actionMap.Insert(this.
Type(), overrideData);
7533
7534 }
7535
7537
7539
7540
7542 {
7545
7548
7549 string config_to_search = "CfgVehicles";
7550 string muzzle_owner_config;
7551
7553 {
7554 if (IsInherited(Weapon))
7555 config_to_search = "CfgWeapons";
7556
7557 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7558
7559 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7560
7562
7563 if (config_OnFire_subclass_count > 0)
7564 {
7565 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7566
7567 for (int i = 0; i < config_OnFire_subclass_count; i++)
7568 {
7569 string particle_class = "";
7571 string config_OnFire_entry = config_OnFire_class + particle_class;
7572 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7573 WPOF_array.Insert(WPOF);
7574 }
7575
7576
7578 }
7579 }
7580
7582 {
7583 config_to_search = "CfgWeapons";
7584 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7585
7586 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7587
7589
7590 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7591 {
7592 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7593
7594 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7595 {
7596 string particle_class2 = "";
7598 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7599 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7600 WPOBE_array.Insert(WPOBE);
7601 }
7602
7603
7605 }
7606 }
7607 }
7608
7609
7611 {
7614
7616 {
7617 string config_to_search = "CfgVehicles";
7618
7619 if (IsInherited(Weapon))
7620 config_to_search = "CfgWeapons";
7621
7622 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7623 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7624
7625 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
7626 {
7627
7629
7631 {
7633 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7635 return;
7636 }
7637
7640
7641
7642
7644 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7645
7646 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7647 {
7648 string particle_class = "";
7650 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7652
7653 if (entry_type == CT_CLASS)
7654 {
7655 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7656 WPOOH_array.Insert(WPOF);
7657 }
7658 }
7659
7660
7662 }
7663 }
7664 }
7665
7667 {
7669 }
7670
7672 {
7674 {
7676
7679
7682
7683 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7684 }
7685 }
7686
7688 {
7690 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7691
7693 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7694
7696 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7697
7699 {
7701 }
7702 }
7703
7705 {
7707 }
7708
7710 {
7713 else
7715
7717 {
7720 }
7721 else
7722 {
7725
7728 }
7729
7731 }
7732
7734 {
7736 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7737 }
7738
7740 {
7742 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7744 }
7745
7747 {
7749 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7750 }
7751
7753 {
7756
7757 OverheatingParticle OP = new OverheatingParticle();
7762
7764 }
7765
7767 {
7770
7771 return -1;
7772 }
7773
7775 {
7777 {
7780
7781 for (int i = count; i > 0; --i)
7782 {
7783 int id = i - 1;
7786
7789
7790 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7791 {
7792 if (p)
7793 {
7796 }
7797 }
7798 }
7799 }
7800 }
7801
7803 {
7805 {
7807 {
7808 int id = i - 1;
7810
7811 if (OP)
7812 {
7814
7815 if (p)
7816 {
7818 }
7819
7820 delete OP;
7821 }
7822 }
7823
7826 }
7827 }
7828
7831 {
7832 return 0.0;
7833 }
7834
7835
7837 {
7838 return 250;
7839 }
7840
7842 {
7843 return 0;
7844 }
7845
7848 {
7850 return true;
7851
7852 return false;
7853 }
7854
7857 {
7860
7862 {
7864 }
7865 else
7866 {
7867
7869 }
7870
7872 }
7873
7880 {
7881 return -1;
7882 }
7883
7884
7885
7886
7888 {
7890 {
7892 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7893
7894 if (r_index >= 0)
7895 {
7896 InventoryLocation r_il = new InventoryLocation;
7897 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7898
7899 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7902 {
7903 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7904 }
7906 {
7907 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7908 }
7909
7910 }
7911
7912 player.GetHumanInventory().ClearUserReservedLocation(this);
7913 }
7914
7917 }
7918
7919
7920
7921
7923 {
7924 return ItemBase.m_DebugActionsMask;
7925 }
7926
7928 {
7929 return ItemBase.m_DebugActionsMask & mask;
7930 }
7931
7933 {
7934 ItemBase.m_DebugActionsMask = mask;
7935 }
7936
7938 {
7939 ItemBase.m_DebugActionsMask |= mask;
7940 }
7941
7943 {
7944 ItemBase.m_DebugActionsMask &= ~mask;
7945 }
7946
7948 {
7950 {
7952 }
7953 else
7954 {
7956 }
7957 }
7958
7959
7961 {
7962 if (GetEconomyProfile())
7963 {
7964 float q_max = GetEconomyProfile().GetQuantityMax();
7965 if (q_max > 0)
7966 {
7967 float q_min = GetEconomyProfile().GetQuantityMin();
7968 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7969
7971 {
7972 ComponentEnergyManager comp = GetCompEM();
7974 {
7976 }
7977 }
7979 {
7981
7982 }
7983
7984 }
7985 }
7986 }
7987
7990 {
7991 EntityAI parent = GetHierarchyParent();
7992
7993 if (parent)
7994 {
7995 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7996 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7997 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7998 }
7999 }
8000
8003 {
8004 EntityAI parent = GetHierarchyParent();
8005
8006 if (parent)
8007 {
8008 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8009 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8010 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8011 }
8012 }
8013
8015 {
8016
8017
8018
8019
8021
8023 {
8024 if (ScriptInputUserData.CanStoreInputUserData())
8025 {
8026 ScriptInputUserData ctx = new ScriptInputUserData;
8032 ctx.
Write(use_stack_max);
8035
8037 {
8038 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8039 }
8040 }
8041 }
8042 else if (!
GetGame().IsMultiplayer())
8043 {
8045 }
8046 }
8047
8049 {
8051 }
8052
8054 {
8056 }
8057
8059 {
8061 }
8062
8064 {
8065
8066 return false;
8067 }
8068
8070 {
8071 return false;
8072 }
8073
8077 {
8078 return false;
8079 }
8080
8082 {
8083 return "";
8084 }
8085
8087
8089 {
8090 return false;
8091 }
8092
8094 {
8095 return true;
8096 }
8097
8098
8099
8101 {
8102 return true;
8103 }
8104
8106 {
8107 return true;
8108 }
8109
8111 {
8112 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8114 }
8115
8117 {
8119 }
8120
8122 {
8124 if (!is_being_placed)
8126 SetSynchDirty();
8127 }
8128
8129
8131
8133 {
8135 }
8136
8138 {
8140 }
8141
8143 {
8144 return 1;
8145 }
8146
8148 {
8149 return false;
8150 }
8151
8153 {
8155 SetSynchDirty();
8156 }
8157
8158
8159
8160
8161
8162
8163
8164
8165
8166
8167
8168
8169
8170
8171
8172
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8193 {
8194 super.OnMovedInsideCargo(container);
8195
8196 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8197 }
8198
8199 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8200 {
8201 super.EEItemLocationChanged(oldLoc,newLoc);
8202
8203 PlayerBase new_player = null;
8204 PlayerBase old_player = null;
8205
8206 if (newLoc.GetParent())
8207 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8208
8209 if (oldLoc.GetParent())
8210 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8211
8213 {
8214 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
8215
8216 if (r_index >= 0)
8217 {
8218 InventoryLocation r_il = new InventoryLocation;
8219 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8220
8221 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8224 {
8225 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8226 }
8228 {
8229 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8230 }
8231
8232 }
8233 }
8234
8236 {
8237 if (new_player)
8238 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
8239
8240 if (new_player == old_player)
8241 {
8242
8243 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8244 {
8246 {
8247 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8248 {
8249 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8250 }
8251 }
8252 else
8253 {
8254 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8255 }
8256 }
8257
8258 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8259 {
8260 int type = oldLoc.GetType();
8262 {
8263 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8264 }
8266 {
8267 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8268 }
8269 }
8270 if (!m_OldLocation)
8271 {
8272 m_OldLocation = new InventoryLocation;
8273 }
8274 m_OldLocation.Copy(oldLoc);
8275 }
8276 else
8277 {
8278 if (m_OldLocation)
8279 {
8280 m_OldLocation.Reset();
8281 }
8282 }
8283
8285 }
8286 else
8287 {
8288 if (new_player)
8289 {
8290 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8291 if (res_index >= 0)
8292 {
8293 InventoryLocation il = new InventoryLocation;
8294 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
8296 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
8299 {
8300 il.
GetParent().GetOnReleaseLock().Invoke(it);
8301 }
8303 {
8305 }
8306
8307 }
8308 }
8310 {
8311
8313 }
8314
8315 if (m_OldLocation)
8316 {
8317 m_OldLocation.Reset();
8318 }
8319 }
8320 }
8321
8322 override void EOnContact(IEntity other, Contact extra)
8323 {
8325 {
8326 int liquidType = -1;
8328 if (impactSpeed > 0.0)
8329 {
8331 #ifndef SERVER
8333 #else
8335 SetSynchDirty();
8336 #endif
8338 }
8339 }
8340
8341 #ifdef SERVER
8342 if (GetCompEM() && GetCompEM().IsPlugged())
8343 {
8344 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8345 GetCompEM().UnplugThis();
8346 }
8347 #endif
8348 }
8349
8351
8353 {
8355 }
8356
8358 {
8359
8360 }
8361
8363 {
8364 super.OnItemLocationChanged(old_owner, new_owner);
8365
8366 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8367 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8368
8369 if (!relatedPlayer && playerNew)
8370 relatedPlayer = playerNew;
8371
8372 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8373 {
8375 if (actionMgr)
8376 {
8377 ActionBase currentAction = actionMgr.GetRunningAction();
8378 if (currentAction)
8380 }
8381 }
8382
8383 Man ownerPlayerOld = null;
8384 Man ownerPlayerNew = null;
8385
8386 if (old_owner)
8387 {
8388 if (old_owner.
IsMan())
8389 {
8390 ownerPlayerOld = Man.Cast(old_owner);
8391 }
8392 else
8393 {
8394 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8395 }
8396 }
8397 else
8398 {
8400 {
8402
8403 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8404 {
8405 GetCompEM().UnplugThis();
8406 }
8407 }
8408 }
8409
8410 if (new_owner)
8411 {
8412 if (new_owner.
IsMan())
8413 {
8414 ownerPlayerNew = Man.Cast(new_owner);
8415 }
8416 else
8417 {
8418 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8419 }
8420 }
8421
8422 if (ownerPlayerOld != ownerPlayerNew)
8423 {
8424 if (ownerPlayerOld)
8425 {
8426 array<EntityAI> subItemsExit = new array<EntityAI>;
8428 for (int i = 0; i < subItemsExit.Count(); i++)
8429 {
8432 }
8433 }
8434
8435 if (ownerPlayerNew)
8436 {
8437 array<EntityAI> subItemsEnter = new array<EntityAI>;
8439 for (int j = 0; j < subItemsEnter.Count(); j++)
8440 {
8443 }
8444 }
8445 }
8446 else if (ownerPlayerNew != null)
8447 {
8448 PlayerBase nplayer;
8449 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8450 {
8451 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8453 for (int k = 0; k < subItemsUpdate.Count(); k++)
8454 {
8456 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8457 }
8458 }
8459 }
8460
8461 if (old_owner)
8462 old_owner.OnChildItemRemoved(this);
8463 if (new_owner)
8464 new_owner.OnChildItemReceived(this);
8465 }
8466
8467
8469 {
8470 super.EEDelete(parent);
8471 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8472 if (player)
8473 {
8475
8476 if (player.IsAlive())
8477 {
8478 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8479 if (r_index >= 0)
8480 {
8481 InventoryLocation r_il = new InventoryLocation;
8482 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8483
8484 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8487 {
8488 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8489 }
8491 {
8492 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8493 }
8494
8495 }
8496
8497 player.RemoveQuickBarEntityShortcut(this);
8498 }
8499 }
8500 }
8501
8503 {
8504 super.EEKilled(killer);
8505
8508 {
8509 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8510 {
8511 if (IsMagazine())
8512 {
8513 if (Magazine.Cast(this).GetAmmoCount() > 0)
8514 {
8516 }
8517 }
8518 else
8519 {
8521 }
8522 }
8523 }
8524 }
8525
8527 {
8528 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8529
8530 super.OnWasAttached(parent, slot_id);
8531
8534
8536 }
8537
8539 {
8540 super.OnWasDetached(parent, slot_id);
8541
8544 }
8545
8547 {
8548 int idx;
8551
8552 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8553 if (inventory_slots.Count() < 1)
8554 {
8555 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8556 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8557 }
8558 else
8559 {
8560 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8561 }
8562
8563 idx = inventory_slots.Find(slot);
8564 if (idx < 0)
8565 return "";
8566
8567 return attach_types.Get(idx);
8568 }
8569
8571 {
8572 int idx = -1;
8573 string slot;
8574
8577
8578 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8579 if (inventory_slots.Count() < 1)
8580 {
8581 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8582 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8583 }
8584 else
8585 {
8586 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8587 if (detach_types.Count() < 1)
8588 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8589 }
8590
8591 for (int i = 0; i < inventory_slots.Count(); i++)
8592 {
8593 slot = inventory_slots.Get(i);
8594 }
8595
8596 if (slot != "")
8597 {
8598 if (detach_types.Count() == 1)
8599 idx = 0;
8600 else
8601 idx = inventory_slots.Find(slot);
8602 }
8603 if (idx < 0)
8604 return "";
8605
8606 return detach_types.Get(idx);
8607 }
8608
8610 {
8611
8613
8614
8615 float min_time = 1;
8616 float max_time = 3;
8617 float delay = Math.RandomFloat(min_time, max_time);
8618
8619 explode_timer.Run(delay, this, "DoAmmoExplosion");
8620 }
8621
8623 {
8624 Magazine magazine = Magazine.Cast(this);
8625 int pop_sounds_count = 6;
8626 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8627
8628
8629 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8630 string sound_name = pop_sounds[ sound_idx ];
8632
8633
8634 magazine.ServerAddAmmoCount(-1);
8635
8636
8637 float min_temp_to_explode = 100;
8638
8639 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8640 {
8642 }
8643 }
8644
8645
8646 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8647 {
8648 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8649
8650 const int CHANCE_DAMAGE_CARGO = 4;
8651 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8652 const int CHANCE_DAMAGE_NOTHING = 2;
8653
8655 {
8656 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8657 int chances;
8658 int rnd;
8659
8660 if (GetInventory().GetCargo())
8661 {
8662 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8663 rnd = Math.RandomInt(0,chances);
8664
8665 if (rnd < CHANCE_DAMAGE_CARGO)
8666 {
8668 }
8669 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8670 {
8672 }
8673 }
8674 else
8675 {
8676 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8677 rnd = Math.RandomInt(0,chances);
8678
8679 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8680 {
8682 }
8683 }
8684 }
8685 }
8686
8688 {
8689 if (GetInventory().GetCargo())
8690 {
8691 int item_count = GetInventory().GetCargo().GetItemCount();
8692 if (item_count > 0)
8693 {
8694 int random_pick = Math.RandomInt(0, item_count);
8696 if (!item.IsExplosive())
8697 {
8698 item.AddHealth("","",damage);
8699 return true;
8700 }
8701 }
8702 }
8703 return false;
8704 }
8705
8707 {
8708 int attachment_count = GetInventory().AttachmentCount();
8709 if (attachment_count > 0)
8710 {
8711 int random_pick = Math.RandomInt(0, attachment_count);
8712 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
8713 if (!attachment.IsExplosive())
8714 {
8715 attachment.AddHealth("","",damage);
8716 return true;
8717 }
8718 }
8719 return false;
8720 }
8721
8723 {
8725 }
8726
8728 {
8730 return GetInventory().CanRemoveEntity();
8731
8732 return false;
8733 }
8734
8736 {
8737
8739 return false;
8740
8741
8743 return false;
8744
8745
8746
8748 if (delta == 0)
8749 return false;
8750
8751
8752 return true;
8753 }
8754
8756 {
8758 {
8759 if (ScriptInputUserData.CanStoreInputUserData())
8760 {
8761 ScriptInputUserData ctx = new ScriptInputUserData;
8766 ctx.
Write(destination_entity);
8770 }
8771 }
8772 else if (!
GetGame().IsMultiplayer())
8773 {
8775 }
8776 }
8777
8779 {
8780 float split_quantity_new;
8784 InventoryLocation loc = new InventoryLocation;
8785
8786 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8787 {
8789 split_quantity_new = stack_max;
8790 else
8792
8794 {
8795 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8796 if (new_item)
8797 {
8798 new_item.SetResultOfSplit(true);
8799 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8801 new_item.
SetQuantity(split_quantity_new,
false,
true);
8802 }
8803 }
8804 }
8805 else if (destination_entity && slot_id == -1)
8806 {
8807 if (quantity > stack_max)
8808 split_quantity_new = stack_max;
8809 else
8810 split_quantity_new = quantity;
8811
8813 {
8815 {
8818 }
8819
8820 if (new_item)
8821 {
8822 new_item.SetResultOfSplit(true);
8823 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8825 new_item.
SetQuantity(split_quantity_new,
false,
true);
8826 }
8827 }
8828 }
8829 else
8830 {
8831 if (stack_max != 0)
8832 {
8834 {
8836 }
8837
8838 if (split_quantity_new == 0)
8839 {
8840 if (!
GetGame().IsMultiplayer())
8841 player.PhysicalPredictiveDropItem(this);
8842 else
8843 player.ServerDropEntity(this);
8844 return;
8845 }
8846
8848 {
8850
8851 if (new_item)
8852 {
8853 new_item.SetResultOfSplit(true);
8854 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8857 new_item.PlaceOnSurface();
8858 }
8859 }
8860 }
8861 }
8862 }
8863
8865 {
8866 float split_quantity_new;
8870 InventoryLocation loc = new InventoryLocation;
8871
8872 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8873 {
8875 split_quantity_new = stack_max;
8876 else
8878
8880 {
8881 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8882 if (new_item)
8883 {
8884 new_item.SetResultOfSplit(true);
8885 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8887 new_item.
SetQuantity(split_quantity_new,
false,
true);
8888 }
8889 }
8890 }
8891 else if (destination_entity && slot_id == -1)
8892 {
8893 if (quantity > stack_max)
8894 split_quantity_new = stack_max;
8895 else
8896 split_quantity_new = quantity;
8897
8899 {
8901 {
8904 }
8905
8906 if (new_item)
8907 {
8908 new_item.SetResultOfSplit(true);
8909 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8911 new_item.
SetQuantity(split_quantity_new,
false,
true);
8912 }
8913 }
8914 }
8915 else
8916 {
8917 if (stack_max != 0)
8918 {
8920 {
8922 }
8923
8925 {
8927
8928 if (new_item)
8929 {
8930 new_item.SetResultOfSplit(true);
8931 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8934 new_item.PlaceOnSurface();
8935 }
8936 }
8937 }
8938 }
8939 }
8940
8942 {
8944 {
8945 if (ScriptInputUserData.CanStoreInputUserData())
8946 {
8947 ScriptInputUserData ctx = new ScriptInputUserData;
8952 dst.WriteToContext(ctx);
8954 }
8955 }
8956 else if (!
GetGame().IsMultiplayer())
8957 {
8959 }
8960 }
8961
8963 {
8965 {
8966 if (ScriptInputUserData.CanStoreInputUserData())
8967 {
8968 ScriptInputUserData ctx = new ScriptInputUserData;
8973 ctx.
Write(destination_entity);
8979 }
8980 }
8981 else if (!
GetGame().IsMultiplayer())
8982 {
8984 }
8985 }
8986
8988 {
8990 }
8991
8993 {
8995 float split_quantity_new;
8997 if (dst.IsValid())
8998 {
8999 int slot_id = dst.GetSlot();
9001
9002 if (quantity > stack_max)
9003 split_quantity_new = stack_max;
9004 else
9005 split_quantity_new = quantity;
9006
9008 {
9010
9011 if (new_item)
9012 {
9013 new_item.SetResultOfSplit(true);
9014 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9016 new_item.
SetQuantity(split_quantity_new,
false,
true);
9017 }
9018
9019 return new_item;
9020 }
9021 }
9022
9023 return null;
9024 }
9025
9027 {
9029 float split_quantity_new;
9031 if (destination_entity)
9032 {
9034 if (quantity > stackable)
9035 split_quantity_new = stackable;
9036 else
9037 split_quantity_new = quantity;
9038
9040 {
9041 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9042 if (new_item)
9043 {
9044 new_item.SetResultOfSplit(true);
9045 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9047 new_item.
SetQuantity(split_quantity_new,
false,
true);
9048 }
9049 }
9050 }
9051 }
9052
9054 {
9056 {
9057 if (ScriptInputUserData.CanStoreInputUserData())
9058 {
9059 ScriptInputUserData ctx = new ScriptInputUserData;
9064 ItemBase destination_entity =
this;
9065 ctx.
Write(destination_entity);
9069 }
9070 }
9071 else if (!
GetGame().IsMultiplayer())
9072 {
9074 }
9075 }
9076
9078 {
9080 float split_quantity_new;
9082 if (player)
9083 {
9085 if (quantity > stackable)
9086 split_quantity_new = stackable;
9087 else
9088 split_quantity_new = quantity;
9089
9091 {
9092 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9093 new_item =
ItemBase.Cast(in_hands);
9094 if (new_item)
9095 {
9096 new_item.SetResultOfSplit(true);
9097 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9099 new_item.SetQuantity(split_quantity_new, false, true);
9100 }
9101 }
9102 }
9103 }
9104
9106 {
9108 float split_quantity_new = Math.Floor(quantity * 0.5);
9109
9111 return;
9112
9114
9115 if (new_item)
9116 {
9117 if (new_item.GetQuantityMax() < split_quantity_new)
9118 {
9119 split_quantity_new = new_item.GetQuantityMax();
9120 }
9121
9122 new_item.SetResultOfSplit(true);
9123 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9124
9126 {
9129 }
9130 else
9131 {
9133 new_item.
SetQuantity(split_quantity_new,
false,
true);
9134 }
9135 }
9136 }
9137
9139 {
9141 float split_quantity_new = Math.Floor(quantity / 2);
9142
9144 return;
9145
9146 InventoryLocation invloc = new InventoryLocation;
9148
9150 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9151
9152 if (new_item)
9153 {
9154 if (new_item.GetQuantityMax() < split_quantity_new)
9155 {
9156 split_quantity_new = new_item.GetQuantityMax();
9157 }
9159 {
9162 }
9163 else if (split_quantity_new > 1)
9164 {
9166 new_item.
SetQuantity(split_quantity_new,
false,
true);
9167 }
9168 }
9169 }
9170
9173 {
9174 SetWeightDirty();
9176
9177 if (parent)
9178 parent.OnAttachmentQuantityChangedEx(this, delta);
9179
9181 {
9183 {
9185 }
9187 {
9188 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9190 }
9191 }
9192
9193 }
9194
9197 {
9198
9199 }
9200
9203 {
9205 }
9206
9208 {
9209 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9210
9212 {
9213 if (newLevel == GameConstants.STATE_RUINED)
9214 {
9216 EntityAI parent = GetHierarchyParent();
9217 if (parent && parent.IsFireplace())
9218 {
9219 CargoBase cargo = GetInventory().GetCargo();
9220 if (cargo)
9221 {
9223 {
9225 }
9226 }
9227 }
9228 }
9229
9231 {
9232
9234 return;
9235 }
9236
9237 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9238 {
9240 }
9241 }
9242 }
9243
9244
9246 {
9247 super.OnRightClick();
9248
9250 {
9252 {
9253 if (ScriptInputUserData.CanStoreInputUserData())
9254 {
9255 EntityAI root = GetHierarchyRoot();
9256 Man playerOwner = GetHierarchyRootPlayer();
9257 InventoryLocation dst = new InventoryLocation;
9258
9259
9260 if (!playerOwner && root && root == this)
9261 {
9263 }
9264 else
9265 {
9266
9267 GetInventory().GetCurrentInventoryLocation(dst);
9269 {
9272 {
9274 }
9275 else
9276 {
9278
9279
9280 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9281 {
9283 }
9284 else
9285 {
9286 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9287 }
9288 }
9289 }
9290 }
9291
9292 ScriptInputUserData ctx = new ScriptInputUserData;
9300 }
9301 }
9302 else if (!
GetGame().IsMultiplayer())
9303 {
9305 }
9306 }
9307 }
9308
9310 {
9311 if (root)
9312 {
9313 vector m4[4];
9314 root.GetTransform(m4);
9315 dst.SetGround(this, m4);
9316 }
9317 else
9318 {
9319 GetInventory().GetCurrentInventoryLocation(dst);
9320 }
9321 }
9322
9323 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9324 {
9325
9326 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9327 return false;
9328
9329 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9330 return false;
9331
9332
9334 return false;
9335
9336
9337 Magazine mag = Magazine.Cast(this);
9338 if (mag)
9339 {
9340 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9341 return false;
9342
9343 if (stack_max_limit)
9344 {
9345 Magazine other_mag = Magazine.Cast(other_item);
9346 if (other_item)
9347 {
9348 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9349 return false;
9350 }
9351
9352 }
9353 }
9354 else
9355 {
9356
9358 return false;
9359
9361 return false;
9362 }
9363
9364 PlayerBase player = null;
9365 if (CastTo(player, GetHierarchyRootPlayer()))
9366 {
9367 if (player.GetInventory().HasAttachment(this))
9368 return false;
9369
9370 if (player.IsItemsToDelete())
9371 return false;
9372 }
9373
9374 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9375 return false;
9376
9377 int slotID;
9379 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9380 return false;
9381
9382 return true;
9383 }
9384
9386 {
9388 }
9389
9391 {
9392 return m_IsResultOfSplit;
9393 }
9394
9396 {
9397 m_IsResultOfSplit = value;
9398 }
9399
9401 {
9403 }
9404
9406 {
9407 float other_item_quantity = other_item.GetQuantity();
9408 float this_free_space;
9409
9411
9413
9414 if (other_item_quantity > this_free_space)
9415 {
9416 return this_free_space;
9417 }
9418 else
9419 {
9420 return other_item_quantity;
9421 }
9422 }
9423
9425 {
9427 }
9428
9430 {
9432 return;
9433
9434 if (!IsMagazine() && other_item)
9435 {
9437 if (quantity_used != 0)
9438 {
9439 float hp1 = GetHealth01("","");
9440 float hp2 = other_item.GetHealth01("","");
9441 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9442 hpResult = hpResult / (
GetQuantity() + quantity_used);
9443
9444 hpResult *= GetMaxHealth();
9445 Math.Round(hpResult);
9446 SetHealth("", "Health", hpResult);
9447
9449 other_item.AddQuantity(-quantity_used);
9450 }
9451 }
9453 }
9454
9456 {
9457 #ifdef SERVER
9458 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9459 GetHierarchyParent().IncreaseLifetimeUp();
9460 #endif
9461 };
9462
9464 {
9465 PlayerBase p = PlayerBase.Cast(player);
9466
9467 array<int> recipesIds = p.m_Recipes;
9468 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9469 if (moduleRecipesManager)
9470 {
9471 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
9472 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9473 }
9474
9475 for (int i = 0;i < recipesIds.Count(); i++)
9476 {
9477 int key = recipesIds.Get(i);
9478 string recipeName = moduleRecipesManager.GetRecipeName(key);
9480 }
9481 }
9482
9483
9484 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9485 {
9486 super.GetDebugActions(outputList);
9487
9488
9494
9495
9500
9505
9506
9510
9511
9513 {
9517 }
9518
9521
9522
9526
9528
9529 InventoryLocation loc = new InventoryLocation();
9530 GetInventory().GetCurrentInventoryLocation(loc);
9532 {
9533 if (Gizmo_IsSupported())
9536 }
9537
9539 }
9540
9541
9542
9543
9545 {
9546 super.OnAction(action_id, player, ctx);
9547
9549 {
9550 switch (action_id)
9551 {
9554 return true;
9557 return true;
9558 }
9559 }
9560
9562 {
9563 switch (action_id)
9564 {
9566 Delete();
9567 return true;
9568 }
9569 }
9570
9571 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9572 {
9573 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9574 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9575 PlayerBase p = PlayerBase.Cast(player);
9576 if (
EActions.RECIPES_RANGE_START < 1000)
9577 {
9578 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9579 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9580 }
9581 }
9582 #ifndef SERVER
9583 else if (action_id ==
EActions.WATCH_PLAYER)
9584 {
9585 PluginDeveloper.SetDeveloperItemClientEx(player);
9586 }
9587 #endif
9589 {
9590 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9591 {
9592 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9593 OnDebugButtonPressServer(id + 1);
9594 }
9595
9596 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9597 {
9598 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9600 }
9601
9602 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9603 {
9604 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9606 }
9607
9608 else if (action_id ==
EActions.ADD_QUANTITY)
9609 {
9610 if (IsMagazine())
9611 {
9612 Magazine mag = Magazine.Cast(this);
9613 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9614 }
9615 else
9616 {
9618 }
9619
9620 if (m_EM)
9621 {
9622 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9623 }
9624
9625 }
9626
9627 else if (action_id ==
EActions.REMOVE_QUANTITY)
9628 {
9629 if (IsMagazine())
9630 {
9631 Magazine mag2 = Magazine.Cast(this);
9632 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9633 }
9634 else
9635 {
9637 }
9638 if (m_EM)
9639 {
9640 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9641 }
9642
9643 }
9644
9645 else if (action_id ==
EActions.SET_QUANTITY_0)
9646 {
9648
9649 if (m_EM)
9650 {
9651 m_EM.SetEnergy(0);
9652 }
9653 }
9654
9655 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9656 {
9658
9659 if (m_EM)
9660 {
9661 m_EM.SetEnergy(m_EM.GetEnergyMax());
9662 }
9663 }
9664
9665 else if (action_id ==
EActions.ADD_HEALTH)
9666 {
9667 AddHealth("","",GetMaxHealth("","Health")/5);
9668 }
9669 else if (action_id ==
EActions.REMOVE_HEALTH)
9670 {
9671 AddHealth("","",-GetMaxHealth("","Health")/5);
9672 }
9673 else if (action_id ==
EActions.DESTROY_HEALTH)
9674 {
9675 SetHealth01("","",0);
9676 }
9677 else if (action_id ==
EActions.WATCH_ITEM)
9678 {
9680 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9681 #ifdef DEVELOPER
9682 SetDebugDeveloper_item(this);
9683 #endif
9684 }
9685
9686 else if (action_id ==
EActions.ADD_TEMPERATURE)
9687 {
9688 AddTemperature(20);
9689
9690 }
9691
9692 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9693 {
9694 AddTemperature(-20);
9695
9696 }
9697
9698 else if (action_id ==
EActions.FLIP_FROZEN)
9699 {
9700 SetFrozen(!GetIsFrozen());
9701
9702 }
9703
9704 else if (action_id ==
EActions.ADD_WETNESS)
9705 {
9707
9708 }
9709
9710 else if (action_id ==
EActions.REMOVE_WETNESS)
9711 {
9713
9714 }
9715
9716 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9717 {
9720
9721
9722 }
9723
9724 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9725 {
9728 }
9729
9730 else if (action_id ==
EActions.MAKE_SPECIAL)
9731 {
9732 auto debugParams = DebugSpawnParams.WithPlayer(player);
9733 OnDebugSpawnEx(debugParams);
9734 }
9735
9736 }
9737
9738
9739 return false;
9740 }
9741
9742
9743
9744
9748
9751
9752
9753
9755 {
9756 return false;
9757 }
9758
9759
9761 {
9762 return true;
9763 }
9764
9765
9767 {
9768 return true;
9769 }
9770
9771
9772
9774 {
9775 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9777 }
9778
9781 {
9782 return null;
9783 }
9784
9786 {
9787 return false;
9788 }
9789
9791 {
9792 return false;
9793 }
9794
9798
9799
9801 {
9802 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9803 return module_repairing.CanRepair(this, item_repair_kit);
9804 }
9805
9806
9807 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9808 {
9809 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9810 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9811 }
9812
9813
9815 {
9816
9817
9818
9819
9820
9821
9822
9823
9824 return 1;
9825 }
9826
9827
9828
9830 {
9832 }
9833
9834
9835
9837 {
9839 }
9840
9841
9850 {
9851 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9852
9853 if (player)
9854 {
9855 player.MessageStatus(text);
9856 }
9857 }
9858
9859
9868 {
9869 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9870
9871 if (player)
9872 {
9873 player.MessageAction(text);
9874 }
9875 }
9876
9877
9886 {
9887 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9888
9889 if (player)
9890 {
9891 player.MessageFriendly(text);
9892 }
9893 }
9894
9895
9904 {
9905 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9906
9907 if (player)
9908 {
9909 player.MessageImportant(text);
9910 }
9911 }
9912
9914 {
9915 return true;
9916 }
9917
9918
9919 override bool KindOf(
string tag)
9920 {
9921 bool found = false;
9922 string item_name = this.
GetType();
9925
9926 int array_size = item_tag_array.Count();
9927 for (int i = 0; i < array_size; i++)
9928 {
9929 if (item_tag_array.Get(i) == tag)
9930 {
9931 found = true;
9932 break;
9933 }
9934 }
9935 return found;
9936 }
9937
9938
9940 {
9941
9942 super.OnRPC(sender, rpc_type,ctx);
9943
9944
9945 switch (rpc_type)
9946 {
9947 #ifndef SERVER
9948 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9949 Param2<bool, string> p = new Param2<bool, string>(false, "");
9950
9952 return;
9953
9954 bool play = p.param1;
9955 string soundSet = p.param2;
9956
9957 if (play)
9958 {
9960 {
9962 {
9964 }
9965 }
9966 else
9967 {
9969 }
9970 }
9971 else
9972 {
9974 }
9975
9976 break;
9977 #endif
9978
9979 }
9980
9982 {
9984 }
9985 }
9986
9987
9988
9989
9991 {
9992 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9993 return plugin.GetID(
name);
9994 }
9995
9997 {
9998 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9999 return plugin.GetName(id);
10000 }
10001
10004 {
10005
10006
10007 int varFlags;
10008 if (!ctx.
Read(varFlags))
10009 return;
10010
10011 if (varFlags & ItemVariableFlags.FLOAT)
10012 {
10014 }
10015 }
10016
10018 {
10019
10020 super.SerializeNumericalVars(floats_out);
10021
10022
10023
10025 {
10027 }
10028
10030 {
10032 }
10033
10035 {
10037 }
10038
10040 {
10045 }
10046
10048 {
10050 }
10051 }
10052
10054 {
10055
10056 super.DeSerializeNumericalVars(floats);
10057
10058
10059 int index = 0;
10060 int mask = Math.Round(floats.Get(index));
10061
10062 index++;
10063
10065 {
10067 {
10069 }
10070 else
10071 {
10072 float quantity = floats.Get(index);
10073 SetQuantity(quantity,
true,
false,
false,
false);
10074 }
10075 index++;
10076 }
10077
10079 {
10080 float wet = floats.Get(index);
10082 index++;
10083 }
10084
10086 {
10087 int liquidtype = Math.Round(floats.Get(index));
10089 index++;
10090 }
10091
10093 {
10095 index++;
10097 index++;
10099 index++;
10101 index++;
10102 }
10103
10105 {
10106 int cleanness = Math.Round(floats.Get(index));
10108 index++;
10109 }
10110 }
10111
10113 {
10114 super.WriteVarsToCTX(ctx);
10115
10116
10118 {
10120 }
10121
10123 {
10125 }
10126
10128 {
10130 }
10131
10133 {
10134 int r,g,b,a;
10140 }
10141
10143 {
10145 }
10146 }
10147
10149 {
10150 if (!super.ReadVarsFromCTX(ctx,version))
10151 return false;
10152
10153 int intValue;
10154 float value;
10155
10156 if (version < 140)
10157 {
10158 if (!ctx.
Read(intValue))
10159 return false;
10160
10161 m_VariablesMask = intValue;
10162 }
10163
10165 {
10166 if (!ctx.
Read(value))
10167 return false;
10168
10170 {
10172 }
10173 else
10174 {
10176 }
10177 }
10178
10179 if (version < 140)
10180 {
10182 {
10183 if (!ctx.
Read(value))
10184 return false;
10185 SetTemperatureDirect(value);
10186 }
10187 }
10188
10190 {
10191 if (!ctx.
Read(value))
10192 return false;
10194 }
10195
10197 {
10198 if (!ctx.
Read(intValue))
10199 return false;
10201 }
10202
10204 {
10205 int r,g,b,a;
10207 return false;
10209 return false;
10211 return false;
10213 return false;
10214
10216 }
10217
10219 {
10220 if (!ctx.
Read(intValue))
10221 return false;
10223 }
10224
10225 if (version >= 138 && version < 140)
10226 {
10228 {
10229 if (!ctx.
Read(intValue))
10230 return false;
10231 SetFrozen(intValue);
10232 }
10233 }
10234
10235 return true;
10236 }
10237
10238
10240 {
10243 {
10245 }
10246
10247 if (!super.OnStoreLoad(ctx, version))
10248 {
10250 return false;
10251 }
10252
10253 if (version >= 114)
10254 {
10255 bool hasQuickBarIndexSaved;
10256
10257 if (!ctx.
Read(hasQuickBarIndexSaved))
10258 {
10260 return false;
10261 }
10262
10263 if (hasQuickBarIndexSaved)
10264 {
10265 int itmQBIndex;
10266
10267
10268 if (!ctx.
Read(itmQBIndex))
10269 {
10271 return false;
10272 }
10273
10274 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10275 if (itmQBIndex != -1 && parentPlayer)
10276 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10277 }
10278 }
10279 else
10280 {
10281
10282 PlayerBase player;
10283 int itemQBIndex;
10284 if (version ==
int.
MAX)
10285 {
10286 if (!ctx.
Read(itemQBIndex))
10287 {
10289 return false;
10290 }
10291 }
10292 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10293 {
10294
10295 if (!ctx.
Read(itemQBIndex))
10296 {
10298 return false;
10299 }
10300 if (itemQBIndex != -1 && player)
10301 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10302 }
10303 }
10304
10305 if (version < 140)
10306 {
10307
10308 if (!LoadVariables(ctx, version))
10309 {
10311 return false;
10312 }
10313 }
10314
10315
10317 {
10319 return false;
10320 }
10321 if (version >= 132)
10322 {
10324 if (raib)
10325 {
10327 {
10329 return false;
10330 }
10331 }
10332 }
10333
10335 return true;
10336 }
10337
10338
10339
10341 {
10342 super.OnStoreSave(ctx);
10343
10344 PlayerBase player;
10345 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10346 {
10348
10349 int itemQBIndex = -1;
10350 itemQBIndex = player.FindQuickBarEntityIndex(this);
10351 ctx.
Write(itemQBIndex);
10352 }
10353 else
10354 {
10356 }
10357
10359
10361 if (raib)
10362 {
10364 }
10365 }
10366
10367
10369 {
10370 super.AfterStoreLoad();
10371
10373 {
10375 }
10376
10378 {
10381 }
10382 }
10383
10385 {
10386 super.EEOnAfterLoad();
10387
10389 {
10391 }
10392
10395 }
10396
10398 {
10399 return false;
10400 }
10401
10402
10403
10405 {
10407 {
10408 #ifdef PLATFORM_CONSOLE
10409
10411 {
10413 if (menu)
10414 {
10416 }
10417 }
10418 #endif
10419 }
10420
10422 {
10425 }
10426
10428 {
10429 SetWeightDirty();
10431 }
10433 {
10436 }
10437
10439 {
10442 }
10444 {
10447 }
10448
10449 super.OnVariablesSynchronized();
10450 }
10451
10452
10453
10455 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10456 {
10457 if (!IsServerCheck(allow_client))
10458 return false;
10459
10461 return false;
10462
10465
10466 if (value <= (min + 0.001))
10467 value = min;
10468
10469 if (value == min)
10470 {
10471 if (destroy_config)
10472 {
10473 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10474 if (dstr)
10475 {
10477 this.Delete();
10478 return true;
10479 }
10480 }
10481 else if (destroy_forced)
10482 {
10484 this.Delete();
10485 return true;
10486 }
10487
10489 }
10490
10493
10495 {
10497
10498 if (delta)
10500 }
10501
10503
10504 return false;
10505 }
10506
10507
10509 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10510 {
10512 }
10513
10515 {
10518 }
10519
10521 {
10524 }
10525
10527 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10528 {
10529 float value_clamped = Math.Clamp(value, 0, 1);
10531 SetQuantity(result, destroy_config, destroy_forced);
10532 }
10533
10534
10537 {
10539 }
10540
10542 {
10544 }
10545
10546
10547
10548
10549
10550
10551
10552
10553
10554
10556 {
10557 int slot = -1;
10558 if (GetInventory())
10559 {
10560 InventoryLocation il = new InventoryLocation;
10561 GetInventory().GetCurrentInventoryLocation(il);
10563 }
10564
10566 }
10567
10569 {
10570 float quantity_max = 0;
10571
10573 {
10574 if (attSlotID != -1)
10575 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10576
10577 if (quantity_max <= 0)
10579 }
10580
10581 if (quantity_max <= 0)
10583
10584 return quantity_max;
10585 }
10586
10588 {
10590 }
10591
10593 {
10595 }
10596
10597
10599 {
10601 }
10602
10604 {
10606 }
10607
10609 {
10611 }
10612
10613
10615 {
10616
10617 float weightEx = GetWeightEx();
10618 float special = GetInventoryAndCargoWeight();
10619 return weightEx - special;
10620 }
10621
10622
10624 {
10626 }
10627
10629 {
10631 {
10632 #ifdef DEVELOPER
10633 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10634 {
10635 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10637 }
10638 #endif
10639
10640 return GetQuantity() * GetConfigWeightModified();
10641 }
10642 else if (HasEnergyManager())
10643 {
10644 #ifdef DEVELOPER
10645 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10646 {
10647 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10648 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10649 }
10650 #endif
10651 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10652 }
10653 else
10654 {
10655 #ifdef DEVELOPER
10656 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10657 {
10658 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10659 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10660 }
10661 #endif
10662 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10663 }
10664 }
10665
10668 {
10669 int item_count = 0;
10671
10672 if (GetInventory().GetCargo() != NULL)
10673 {
10674 item_count = GetInventory().GetCargo().GetItemCount();
10675 }
10676
10677 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
10678 {
10679 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
10680 if (item)
10681 item_count += item.GetNumberOfItems();
10682 }
10683 return item_count;
10684 }
10685
10688 {
10689 float weight = 0;
10690 float wetness = 1;
10691 if (include_wetness)
10694 {
10695 weight = wetness * m_ConfigWeight;
10696 }
10698 {
10699 weight = 1;
10700 }
10701 return weight;
10702 }
10703
10704
10705
10707 {
10708 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
10709 {
10710 GameInventory inv = GetInventory();
10711 array<EntityAI> items = new array<EntityAI>;
10713 for (int i = 0; i < items.Count(); i++)
10714 {
10716 if (item)
10717 {
10719 }
10720 }
10721 }
10722 }
10723
10724
10725
10726
10728 {
10729 float energy = 0;
10730 if (HasEnergyManager())
10731 {
10732 energy = GetCompEM().GetEnergy();
10733 }
10734 return energy;
10735 }
10736
10737
10739 {
10740 super.OnEnergyConsumed();
10741
10743 }
10744
10746 {
10747 super.OnEnergyAdded();
10748
10750 }
10751
10752
10754 {
10755 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10756 {
10758 {
10759 float energy_0to1 = GetCompEM().GetEnergy0To1();
10761 }
10762 }
10763 }
10764
10765
10767 {
10768 return ConfigGetFloat("heatIsolation");
10769 }
10770
10772 {
10774 }
10775
10777 {
10778 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10779 if (
GetGame().ConfigIsExisting(paramPath))
10781
10782 return 0.0;
10783 }
10784
10786 {
10787 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10788 if (
GetGame().ConfigIsExisting(paramPath))
10790
10791 return 0.0;
10792 }
10793
10794 override void SetWet(
float value,
bool allow_client =
false)
10795 {
10796 if (!IsServerCheck(allow_client))
10797 return;
10798
10801
10803
10804 m_VarWet = Math.Clamp(value, min, max);
10805
10807 {
10810 }
10811 }
10812
10813 override void AddWet(
float value)
10814 {
10816 }
10817
10819 {
10821 }
10822
10824 {
10826 }
10827
10829 {
10831 }
10832
10834 {
10836 }
10837
10839 {
10841 }
10842
10843 override void OnWetChanged(
float newVal,
float oldVal)
10844 {
10847 if (newLevel != oldLevel)
10848 {
10850 }
10851 }
10852
10854 {
10855 SetWeightDirty();
10856 }
10857
10859 {
10860 return GetWetLevelInternal(
m_VarWet);
10861 }
10862
10863
10864
10866 {
10868 }
10869
10871 {
10873 }
10874
10876 {
10878 }
10879
10881 {
10883 }
10884
10885
10886
10888 {
10889 if (ConfigIsExisting("itemModelLength"))
10890 {
10891 return ConfigGetFloat("itemModelLength");
10892 }
10893 return 0;
10894 }
10895
10897 {
10898 if (ConfigIsExisting("itemAttachOffset"))
10899 {
10900 return ConfigGetFloat("itemAttachOffset");
10901 }
10902 return 0;
10903 }
10904
10905 override void SetCleanness(
int value,
bool allow_client =
false)
10906 {
10907 if (!IsServerCheck(allow_client))
10908 return;
10909
10911
10913
10916 }
10917
10919 {
10921 }
10922
10924 {
10925 return true;
10926 }
10927
10928
10929
10930
10932 {
10934 }
10935
10937 {
10939 }
10940
10941
10942
10943
10944 override void SetColor(
int r,
int g,
int b,
int a)
10945 {
10951 }
10953 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10954 {
10959 }
10960
10962 {
10964 }
10965
10968 {
10969 int r,g,b,a;
10971 r = r/255;
10972 g = g/255;
10973 b = b/255;
10974 a = a/255;
10975 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10976 }
10977
10978
10979
10980 override void SetLiquidType(
int value,
bool allow_client =
false)
10981 {
10982 if (!IsServerCheck(allow_client))
10983 return;
10984
10989 }
10990
10992 {
10993 return ConfigGetInt("varLiquidTypeInit");
10994 }
10995
10997 {
10999 }
11000
11002 {
11004 SetFrozen(false);
11005 }
11006
11009 {
11010 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11011 }
11012
11013
11016 {
11017 PlayerBase nplayer;
11018 if (PlayerBase.CastTo(nplayer, player))
11019 {
11021
11022 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11023 }
11024 }
11025
11026
11029 {
11030 PlayerBase nplayer;
11031 if (PlayerBase.CastTo(nplayer,player))
11032 {
11033
11034 nplayer.SetEnableQuickBarEntityShortcut(this,false);
11035
11036 }
11037
11038
11039 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11040
11041
11042 if (HasEnergyManager())
11043 {
11044 GetCompEM().UpdatePlugState();
11045 }
11046 }
11047
11048
11050 {
11051 super.OnPlacementStarted(player);
11052
11054 }
11055
11056 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11057 {
11059 {
11060 m_AdminLog.OnPlacementComplete(player,
this);
11061 }
11062
11063 super.OnPlacementComplete(player, position, orientation);
11064 }
11065
11066
11067
11068
11069
11071 {
11073 {
11074 return true;
11075 }
11076 else
11077 {
11078 return false;
11079 }
11080 }
11081
11082
11084 {
11086 {
11088 }
11089 }
11090
11091
11093 {
11095 }
11096
11098 {
11100 }
11101
11102 override void InsertAgent(
int agent,
float count = 1)
11103 {
11104 if (count < 1)
11105 return;
11106
11108 }
11109
11112 {
11114 }
11115
11116
11118 {
11120 }
11121
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11132
11133
11134
11135
11136
11137
11138
11139
11140
11141
11142
11143
11144
11145
11146
11147
11148
11149
11150
11151
11152
11153
11154
11155
11156
11157
11158
11159
11160
11161
11162
11164 {
11166 return false;
11167 return true;
11168 }
11169
11171 {
11172
11174 }
11175
11176
11179 {
11180 super.CheckForRoofLimited(timeTresholdMS);
11181
11183 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11184 {
11185 m_PreviousRoofTestTime = time;
11186 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11187 }
11188 }
11189
11190
11192 {
11194 {
11195 return 0;
11196 }
11197
11198 if (GetInventory().GetAttachmentSlotsCount() != 0)
11199 {
11200 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11201 if (filter)
11202 return filter.GetProtectionLevel(type, false, system);
11203 else
11204 return 0;
11205 }
11206
11207 string subclassPath, entryName;
11208
11209 switch (type)
11210 {
11212 entryName = "biological";
11213 break;
11215 entryName = "chemical";
11216 break;
11217 default:
11218 entryName = "biological";
11219 break;
11220 }
11221
11222 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11223
11225 }
11226
11227
11228
11231 {
11232 if (!IsMagazine())
11234
11236 }
11237
11238
11239
11240
11241
11246 {
11247 return true;
11248 }
11249
11251 {
11253 }
11254
11255
11256
11257
11258
11260 {
11261 if (parent)
11262 {
11263 if (parent.IsInherited(DayZInfected))
11264 return true;
11265
11266 if (!parent.IsRuined())
11267 return true;
11268 }
11269
11270 return true;
11271 }
11272
11274 {
11275 if (!super.CanPutAsAttachment(parent))
11276 {
11277 return false;
11278 }
11279
11280 if (!IsRuined() && !parent.IsRuined())
11281 {
11282 return true;
11283 }
11284
11285 return false;
11286 }
11287
11289 {
11290
11291
11292
11293
11294 return super.CanReceiveItemIntoCargo(item);
11295 }
11296
11298 {
11299
11300
11301
11302
11303 GameInventory attachmentInv = attachment.GetInventory();
11305 {
11306 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11307 return false;
11308 }
11309
11310 InventoryLocation loc = new InventoryLocation();
11311 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11312 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11313 return false;
11314
11315 return super.CanReceiveAttachment(attachment, slotId);
11316 }
11317
11319 {
11320 if (!super.CanReleaseAttachment(attachment))
11321 return false;
11322
11323 return GetInventory().AreChildrenAccessible();
11324 }
11325
11326
11327
11328
11329
11330
11331
11332
11333
11334
11335
11336
11337
11338
11339
11340
11341
11342
11343
11344
11345
11347 {
11348 int id = muzzle_owner.GetMuzzleID();
11349 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11350
11351 if (WPOF_array)
11352 {
11353 for (int i = 0; i < WPOF_array.Count(); i++)
11354 {
11355 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11356
11357 if (WPOF)
11358 {
11359 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11360 }
11361 }
11362 }
11363 }
11364
11365
11367 {
11368 int id = muzzle_owner.GetMuzzleID();
11370
11371 if (WPOBE_array)
11372 {
11373 for (int i = 0; i < WPOBE_array.Count(); i++)
11374 {
11375 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11376
11377 if (WPOBE)
11378 {
11379 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11380 }
11381 }
11382 }
11383 }
11384
11385
11387 {
11388 int id = muzzle_owner.GetMuzzleID();
11389 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11390
11391 if (WPOOH_array)
11392 {
11393 for (int i = 0; i < WPOOH_array.Count(); i++)
11394 {
11395 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11396
11397 if (WPOOH)
11398 {
11399 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11400 }
11401 }
11402 }
11403 }
11404
11405
11407 {
11408 int id = muzzle_owner.GetMuzzleID();
11409 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11410
11411 if (WPOOH_array)
11412 {
11413 for (int i = 0; i < WPOOH_array.Count(); i++)
11414 {
11415 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11416
11417 if (WPOOH)
11418 {
11419 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11420 }
11421 }
11422 }
11423 }
11424
11425
11427 {
11428 int id = muzzle_owner.GetMuzzleID();
11429 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11430
11431 if (WPOOH_array)
11432 {
11433 for (int i = 0; i < WPOOH_array.Count(); i++)
11434 {
11435 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11436
11437 if (WPOOH)
11438 {
11439 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11440 }
11441 }
11442 }
11443 }
11444
11445
11446
11448 {
11450 {
11451 return true;
11452 }
11453
11454 return false;
11455 }
11456
11458 {
11460 {
11461 return true;
11462 }
11463
11464 return false;
11465 }
11466
11468 {
11470 {
11471 return true;
11472 }
11473
11474 return false;
11475 }
11476
11478 {
11479 return false;
11480 }
11481
11484 {
11485 return UATimeSpent.DEFAULT_DEPLOY;
11486 }
11487
11488
11489
11490
11492 {
11494 SetSynchDirty();
11495 }
11496
11498 {
11500 }
11501
11502
11504 {
11505 return false;
11506 }
11507
11510 {
11511 string att_type = "None";
11512
11513 if (ConfigIsExisting("soundAttType"))
11514 {
11515 att_type = ConfigGetString("soundAttType");
11516 }
11517
11519 }
11520
11522 {
11524 }
11525
11526
11527
11528
11529
11535
11537 {
11540
11542 }
11543
11544
11546 {
11548 return;
11549
11551
11554
11557
11558 SoundParameters params = new SoundParameters();
11562 }
11563
11564
11566 {
11568 return;
11569
11571 SetSynchDirty();
11572
11575 }
11576
11577
11579 {
11581 return;
11582
11584 SetSynchDirty();
11585
11588 }
11589
11591 {
11593 }
11594
11596 {
11598 }
11599
11602 {
11603 if (!
GetGame().IsDedicatedServer())
11604 {
11605 if (ConfigIsExisting("attachSoundSet"))
11606 {
11607 string cfg_path = "";
11608 string soundset = "";
11609 string type_name =
GetType();
11610
11613 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11614 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11615
11616 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11617 {
11618 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11619 {
11620 if (cfg_slot_array[i] == slot_type)
11621 {
11622 soundset = cfg_soundset_array[i];
11623 break;
11624 }
11625 }
11626 }
11627
11628 if (soundset != "")
11629 {
11630 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11632 }
11633 }
11634 }
11635 }
11636
11638 {
11639
11640 }
11641
11642 void OnApply(PlayerBase player);
11643
11645 {
11646 return 1.0;
11647 };
11648
11650 {
11652 }
11653
11655 {
11657 }
11658
11660
11662 {
11663 SetDynamicPhysicsLifeTime(0.01);
11665 }
11666
11668 {
11669 array<string> zone_names = new array<string>;
11670 GetDamageZones(zone_names);
11671 for (int i = 0; i < zone_names.Count(); i++)
11672 {
11673 SetHealthMax(zone_names.Get(i),"Health");
11674 }
11675 SetHealthMax("","Health");
11676 }
11677
11680 {
11681 float global_health = GetHealth01("","Health");
11682 array<string> zones = new array<string>;
11683 GetDamageZones(zones);
11684
11685 for (int i = 0; i < zones.Count(); i++)
11686 {
11687 SetHealth01(zones.Get(i),"Health",global_health);
11688 }
11689 }
11690
11693 {
11694 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11695 }
11696
11698 {
11699 if (!hasRootAsPlayer)
11700 {
11701 if (refParentIB)
11702 {
11703
11704 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11705 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11706
11707 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11708 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11709
11712 }
11713 else
11714 {
11715
11718 }
11719 }
11720 }
11721
11723 {
11725 {
11726 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11727 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11728 {
11729 float heatPermCoef = 1.0;
11731 while (ent)
11732 {
11733 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11734 ent = ent.GetHierarchyParent();
11735 }
11736
11737 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11738 }
11739 }
11740 }
11741
11743 {
11744
11745 EntityAI parent = GetHierarchyParent();
11746 if (!parent)
11747 {
11748 hasParent = false;
11749 hasRootAsPlayer = false;
11750 }
11751 else
11752 {
11753 hasParent = true;
11754 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11755 refParentIB =
ItemBase.Cast(parent);
11756 }
11757 }
11758
11759 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11760 {
11761
11762 }
11763
11765 {
11766
11767 return false;
11768 }
11769
11771 {
11772
11773
11774 return false;
11775 }
11776
11778 {
11779
11780 return false;
11781 }
11782
11785 {
11786 return !GetIsFrozen() &&
IsOpen();
11787 }
11788
11790 {
11791 bool hasParent = false, hasRootAsPlayer = false;
11793
11794 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11795 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11796
11797 if (wwtu || foodDecay)
11798 {
11802
11803 if (processWetness || processTemperature || processDecay)
11804 {
11806
11807 if (processWetness)
11808 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11809
11810 if (processTemperature)
11812
11813 if (processDecay)
11814 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11815 }
11816 }
11817 }
11818
11821 {
11823 }
11824
11826 {
11829
11830 return super.GetTemperatureFreezeThreshold();
11831 }
11832
11834 {
11837
11838 return super.GetTemperatureThawThreshold();
11839 }
11840
11842 {
11845
11846 return super.GetItemOverheatThreshold();
11847 }
11848
11850 {
11852 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11853
11854 return super.GetTemperatureFreezeTime();
11855 }
11856
11858 {
11860 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11861
11862 return super.GetTemperatureThawTime();
11863 }
11864
11869
11871 {
11872 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11873 }
11874
11876 {
11877 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11878 }
11879
11882 {
11884 }
11885
11887 {
11889 }
11890
11892 {
11894 }
11895
11898 {
11899 return null;
11900 }
11901
11904 {
11905 return false;
11906 }
11907
11909 {
11911 {
11914 if (!trg)
11915 {
11917 explosive = this;
11918 }
11919
11920 explosive.PairRemote(trg);
11922
11923 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11924 trg.SetPersistentPairID(persistentID);
11925 explosive.SetPersistentPairID(persistentID);
11926
11927 return true;
11928 }
11929 return false;
11930 }
11931
11934 {
11935 float ret = 1.0;
11938 ret *= GetHealth01();
11939
11940 return ret;
11941 }
11942
11943 #ifdef DEVELOPER
11944 override void SetDebugItem()
11945 {
11946 super.SetDebugItem();
11947 _itemBase = this;
11948 }
11949
11951 {
11952 string text = super.GetDebugText();
11953
11955 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11956
11957 return text;
11958 }
11959 #endif
11960
11962 {
11963 return true;
11964 }
11965
11967
11969
11971 {
11974 }
11975
11976
11984
12000}
12001
12003{
12005 if (entity)
12006 {
12007 bool is_item = entity.IsInherited(
ItemBase);
12008 if (is_item && full_quantity)
12009 {
12012 }
12013 }
12014 else
12015 {
12017 return NULL;
12018 }
12019 return entity;
12020}
12021
12023{
12024 if (item)
12025 {
12026 if (health > 0)
12027 item.SetHealth("", "", health);
12028
12029 if (item.CanHaveTemperature())
12030 {
12032 if (item.CanFreeze())
12033 item.SetFrozen(false);
12034 }
12035
12036 if (item.HasEnergyManager())
12037 {
12038 if (quantity >= 0)
12039 {
12040 item.GetCompEM().SetEnergy0To1(quantity);
12041 }
12042 else
12043 {
12045 }
12046 }
12047 else if (item.IsMagazine())
12048 {
12049 Magazine mag = Magazine.Cast(item);
12050 if (quantity >= 0)
12051 {
12052 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12053 }
12054 else
12055 {
12057 }
12058
12059 }
12060 else
12061 {
12062 if (quantity >= 0)
12063 {
12064 item.SetQuantityNormalized(quantity, false);
12065 }
12066 else
12067 {
12069 }
12070
12071 }
12072 }
12073}
12074
12075#ifdef DEVELOPER
12077#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.