7126{
7128 {
7129 return true;
7130 }
7131};
7132
7133
7134
7136{
7140
7142
7145
7146
7147
7148
7149
7158
7164
7169
7174
7195 protected bool m_IsResultOfSplit
7196
7198
7203
7204
7205
7207
7211
7212
7213
7215
7218
7219
7220
7226
7227
7235
7238
7239
7241
7242
7244
7245
7250
7251
7256
7257
7259
7260
7262 {
7267
7268 if (!
GetGame().IsDedicatedServer())
7269 {
7271 {
7273
7275 {
7277 }
7278 }
7279
7282 }
7283
7284 m_OldLocation = null;
7285
7287 {
7289 }
7290
7291 if (ConfigIsExisting("headSelectionsToHide"))
7292 {
7295 }
7296
7298 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7299 {
7301 }
7302
7304
7305 m_IsResultOfSplit = false;
7306
7308 }
7309
7311 {
7312 super.InitItemVariables();
7313
7319 m_Count = ConfigGetInt(
"count");
7320
7323
7328
7331
7336
7348
7352
7353
7356 if (ConfigIsExisting("canBeSplit"))
7357 {
7360 }
7361
7363 if (ConfigIsExisting("itemBehaviour"))
7365
7366
7369 RegisterNetSyncVariableInt("m_VarLiquidType");
7370 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7371
7372 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7373 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7374 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7375
7376 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7377 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7378 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7379 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7380
7381 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7382 RegisterNetSyncVariableBool("m_IsTakeable");
7383 RegisterNetSyncVariableBool("m_IsHologram");
7384
7387 {
7390 }
7391
7393
7395 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7397
7398 }
7399
7401 {
7403 }
7404
7406 {
7409 {
7414 }
7415 }
7416
7417 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7418 {
7420 {
7423 }
7424
7426 }
7427
7429 {
7435 }
7436
7438
7440 {
7442
7443 if (!action)
7444 {
7445 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7446 return;
7447 }
7448
7450 if (!ai)
7451 {
7453 return;
7454 }
7455
7457 if (!action_array)
7458 {
7459 action_array = new array<ActionBase_Basic>;
7461 }
7462 if (LogManager.IsActionLogEnable())
7463 {
7464 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7465 }
7466
7467 if (action_array.Find(action) != -1)
7468 {
7469 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7470 }
7471 else
7472 {
7473 action_array.Insert(action);
7474 }
7475 }
7476
7478 {
7480 ActionBase action = player.GetActionManager().GetAction(actionName);
7483
7484 if (action_array)
7485 {
7486 action_array.RemoveItem(action);
7487 }
7488 }
7489
7490
7491
7493 {
7494 ActionOverrideData overrideData = new ActionOverrideData();
7498
7500 if (!actionMap)
7501 {
7504 }
7505
7506 actionMap.Insert(this.
Type(), overrideData);
7507
7508 }
7509
7511
7513
7514
7516 {
7519
7522
7523 string config_to_search = "CfgVehicles";
7524 string muzzle_owner_config;
7525
7527 {
7528 if (IsInherited(Weapon))
7529 config_to_search = "CfgWeapons";
7530
7531 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7532
7533 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7534
7536
7537 if (config_OnFire_subclass_count > 0)
7538 {
7539 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7540
7541 for (int i = 0; i < config_OnFire_subclass_count; i++)
7542 {
7543 string particle_class = "";
7545 string config_OnFire_entry = config_OnFire_class + particle_class;
7546 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7547 WPOF_array.Insert(WPOF);
7548 }
7549
7550
7552 }
7553 }
7554
7556 {
7557 config_to_search = "CfgWeapons";
7558 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7559
7560 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7561
7563
7564 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7565 {
7566 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7567
7568 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7569 {
7570 string particle_class2 = "";
7572 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7573 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7574 WPOBE_array.Insert(WPOBE);
7575 }
7576
7577
7579 }
7580 }
7581 }
7582
7583
7585 {
7588
7590 {
7591 string config_to_search = "CfgVehicles";
7592
7593 if (IsInherited(Weapon))
7594 config_to_search = "CfgWeapons";
7595
7596 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7597 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7598
7599 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
7600 {
7601
7603
7605 {
7607 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7609 return;
7610 }
7611
7614
7615
7616
7618 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7619
7620 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7621 {
7622 string particle_class = "";
7624 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7626
7627 if (entry_type == CT_CLASS)
7628 {
7629 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7630 WPOOH_array.Insert(WPOF);
7631 }
7632 }
7633
7634
7636 }
7637 }
7638 }
7639
7641 {
7643 }
7644
7646 {
7648 {
7650
7653
7656
7657 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7658 }
7659 }
7660
7662 {
7664 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7665
7667 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7668
7670 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7671
7673 {
7675 }
7676 }
7677
7679 {
7681 }
7682
7684 {
7687 else
7689
7691 {
7694 }
7695 else
7696 {
7699
7702 }
7703
7705 }
7706
7708 {
7710 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7711 }
7712
7714 {
7716 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7718 }
7719
7721 {
7723 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7724 }
7725
7727 {
7730
7731 OverheatingParticle OP = new OverheatingParticle();
7736
7738 }
7739
7741 {
7744
7745 return -1;
7746 }
7747
7749 {
7751 {
7754
7755 for (int i = count; i > 0; --i)
7756 {
7757 int id = i - 1;
7760
7763
7764 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7765 {
7766 if (p)
7767 {
7770 }
7771 }
7772 }
7773 }
7774 }
7775
7777 {
7779 {
7781 {
7782 int id = i - 1;
7784
7785 if (OP)
7786 {
7788
7789 if (p)
7790 {
7792 }
7793
7794 delete OP;
7795 }
7796 }
7797
7800 }
7801 }
7802
7805 {
7806 return 0.0;
7807 }
7808
7809
7811 {
7812 return 250;
7813 }
7814
7816 {
7817 return 0;
7818 }
7819
7822 {
7824 return true;
7825
7826 return false;
7827 }
7828
7831 {
7834
7836 {
7838 }
7839 else
7840 {
7841
7843 }
7844
7846 }
7847
7854 {
7855 return -1;
7856 }
7857
7858
7859
7860
7862 {
7864 {
7866 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7867
7868 if (r_index >= 0)
7869 {
7870 InventoryLocation r_il = new InventoryLocation;
7871 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7872
7873 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7876 {
7877 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7878 }
7880 {
7881 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7882 }
7883
7884 }
7885
7886 player.GetHumanInventory().ClearUserReservedLocation(this);
7887 }
7888
7891 }
7892
7893
7894
7895
7897 {
7898 return ItemBase.m_DebugActionsMask;
7899 }
7900
7902 {
7903 return ItemBase.m_DebugActionsMask & mask;
7904 }
7905
7907 {
7908 ItemBase.m_DebugActionsMask = mask;
7909 }
7910
7912 {
7913 ItemBase.m_DebugActionsMask |= mask;
7914 }
7915
7917 {
7918 ItemBase.m_DebugActionsMask &= ~mask;
7919 }
7920
7922 {
7924 {
7926 }
7927 else
7928 {
7930 }
7931 }
7932
7933
7935 {
7936 if (GetEconomyProfile())
7937 {
7938 float q_max = GetEconomyProfile().GetQuantityMax();
7939 if (q_max > 0)
7940 {
7941 float q_min = GetEconomyProfile().GetQuantityMin();
7942 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7943
7945 {
7946 ComponentEnergyManager comp = GetCompEM();
7948 {
7950 }
7951 }
7953 {
7955
7956 }
7957
7958 }
7959 }
7960 }
7961
7964 {
7965 EntityAI parent = GetHierarchyParent();
7966
7967 if (parent)
7968 {
7969 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7970 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7971 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7972 }
7973 }
7974
7977 {
7978 EntityAI parent = GetHierarchyParent();
7979
7980 if (parent)
7981 {
7982 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7983 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7984 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7985 }
7986 }
7987
7989 {
7990
7991
7992
7993
7995
7997 {
7998 if (ScriptInputUserData.CanStoreInputUserData())
7999 {
8000 ScriptInputUserData ctx = new ScriptInputUserData;
8006 ctx.
Write(use_stack_max);
8009
8011 {
8012 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8013 }
8014 }
8015 }
8016 else if (!
GetGame().IsMultiplayer())
8017 {
8019 }
8020 }
8021
8023 {
8025 }
8026
8028 {
8030 }
8031
8033 {
8035 }
8036
8038 {
8039
8040 return false;
8041 }
8042
8044 {
8045 return false;
8046 }
8047
8051 {
8052 return false;
8053 }
8054
8056 {
8057 return "";
8058 }
8059
8061
8063 {
8064 return false;
8065 }
8066
8068 {
8069 return true;
8070 }
8071
8072
8073
8075 {
8076 return true;
8077 }
8078
8080 {
8081 return true;
8082 }
8083
8085 {
8086 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8088 }
8089
8091 {
8093 }
8094
8096 {
8098 if (!is_being_placed)
8100 SetSynchDirty();
8101 }
8102
8103
8105
8107 {
8109 }
8110
8112 {
8114 }
8115
8117 {
8118 return 1;
8119 }
8120
8122 {
8123 return false;
8124 }
8125
8127 {
8129 SetSynchDirty();
8130 }
8131
8132
8133
8134
8135
8136
8137
8138
8139
8140
8141
8142
8143
8144
8145
8146
8147
8148
8149
8150
8151
8152
8153
8154
8155
8156
8157
8158
8159
8160
8161
8162
8163
8164
8165
8167 {
8168 super.OnMovedInsideCargo(container);
8169
8170 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8171 }
8172
8173 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8174 {
8175 super.EEItemLocationChanged(oldLoc,newLoc);
8176
8177 PlayerBase new_player = null;
8178 PlayerBase old_player = null;
8179
8180 if (newLoc.GetParent())
8181 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8182
8183 if (oldLoc.GetParent())
8184 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8185
8187 {
8188 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
8189
8190 if (r_index >= 0)
8191 {
8192 InventoryLocation r_il = new InventoryLocation;
8193 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8194
8195 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8198 {
8199 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8200 }
8202 {
8203 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8204 }
8205
8206 }
8207 }
8208
8210 {
8211 if (new_player)
8212 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
8213
8214 if (new_player == old_player)
8215 {
8216
8217 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8218 {
8220 {
8221 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8222 {
8223 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8224 }
8225 }
8226 else
8227 {
8228 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8229 }
8230 }
8231
8232 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8233 {
8234 int type = oldLoc.GetType();
8236 {
8237 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8238 }
8240 {
8241 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8242 }
8243 }
8244 if (!m_OldLocation)
8245 {
8246 m_OldLocation = new InventoryLocation;
8247 }
8248 m_OldLocation.Copy(oldLoc);
8249 }
8250 else
8251 {
8252 if (m_OldLocation)
8253 {
8254 m_OldLocation.Reset();
8255 }
8256 }
8257
8259 }
8260 else
8261 {
8262 if (new_player)
8263 {
8264 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8265 if (res_index >= 0)
8266 {
8267 InventoryLocation il = new InventoryLocation;
8268 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
8270 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
8273 {
8274 il.
GetParent().GetOnReleaseLock().Invoke(it);
8275 }
8277 {
8279 }
8280
8281 }
8282 }
8284 {
8285
8287 }
8288
8289 if (m_OldLocation)
8290 {
8291 m_OldLocation.Reset();
8292 }
8293 }
8294 }
8295
8296 override void EOnContact(IEntity other, Contact extra)
8297 {
8299 {
8300 int liquidType = -1;
8302 if (impactSpeed > 0.0)
8303 {
8305 #ifndef SERVER
8307 #else
8309 SetSynchDirty();
8310 #endif
8312 }
8313 }
8314
8315 #ifdef SERVER
8316 if (GetCompEM() && GetCompEM().IsPlugged())
8317 {
8318 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8319 GetCompEM().UnplugThis();
8320 }
8321 #endif
8322 }
8323
8325
8327 {
8329 }
8330
8332 {
8333
8334 }
8335
8337 {
8338 super.OnItemLocationChanged(old_owner, new_owner);
8339
8340 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8341 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8342
8343 if (!relatedPlayer && playerNew)
8344 relatedPlayer = playerNew;
8345
8346 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8347 {
8349 if (actionMgr)
8350 {
8351 ActionBase currentAction = actionMgr.GetRunningAction();
8352 if (currentAction)
8354 }
8355 }
8356
8357 Man ownerPlayerOld = null;
8358 Man ownerPlayerNew = null;
8359
8360 if (old_owner)
8361 {
8362 if (old_owner.
IsMan())
8363 {
8364 ownerPlayerOld = Man.Cast(old_owner);
8365 }
8366 else
8367 {
8368 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8369 }
8370 }
8371 else
8372 {
8374 {
8376
8377 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8378 {
8379 GetCompEM().UnplugThis();
8380 }
8381 }
8382 }
8383
8384 if (new_owner)
8385 {
8386 if (new_owner.
IsMan())
8387 {
8388 ownerPlayerNew = Man.Cast(new_owner);
8389 }
8390 else
8391 {
8392 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8393 }
8394 }
8395
8396 if (ownerPlayerOld != ownerPlayerNew)
8397 {
8398 if (ownerPlayerOld)
8399 {
8400 array<EntityAI> subItemsExit = new array<EntityAI>;
8402 for (int i = 0; i < subItemsExit.Count(); i++)
8403 {
8406 }
8407 }
8408
8409 if (ownerPlayerNew)
8410 {
8411 array<EntityAI> subItemsEnter = new array<EntityAI>;
8413 for (int j = 0; j < subItemsEnter.Count(); j++)
8414 {
8417 }
8418 }
8419 }
8420 else if (ownerPlayerNew != null)
8421 {
8422 PlayerBase nplayer;
8423 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8424 {
8425 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8427 for (int k = 0; k < subItemsUpdate.Count(); k++)
8428 {
8430 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8431 }
8432 }
8433 }
8434
8435 if (old_owner)
8436 old_owner.OnChildItemRemoved(this);
8437 if (new_owner)
8438 new_owner.OnChildItemReceived(this);
8439 }
8440
8441
8443 {
8444 super.EEDelete(parent);
8445 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8446 if (player)
8447 {
8449
8450 if (player.IsAlive())
8451 {
8452 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8453 if (r_index >= 0)
8454 {
8455 InventoryLocation r_il = new InventoryLocation;
8456 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8457
8458 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8461 {
8462 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8463 }
8465 {
8466 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8467 }
8468
8469 }
8470
8471 player.RemoveQuickBarEntityShortcut(this);
8472 }
8473 }
8474 }
8475
8477 {
8478 super.EEKilled(killer);
8479
8482 {
8483 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8484 {
8485 if (IsMagazine())
8486 {
8487 if (Magazine.Cast(this).GetAmmoCount() > 0)
8488 {
8490 }
8491 }
8492 else
8493 {
8495 }
8496 }
8497 }
8498 }
8499
8501 {
8502 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8503
8504 super.OnWasAttached(parent, slot_id);
8505
8508
8510 }
8511
8513 {
8514 super.OnWasDetached(parent, slot_id);
8515
8518 }
8519
8521 {
8522 int idx;
8525
8526 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8527 if (inventory_slots.Count() < 1)
8528 {
8529 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8530 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8531 }
8532 else
8533 {
8534 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8535 }
8536
8537 idx = inventory_slots.Find(slot);
8538 if (idx < 0)
8539 return "";
8540
8541 return attach_types.Get(idx);
8542 }
8543
8545 {
8546 int idx = -1;
8547 string slot;
8548
8551
8552 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8553 if (inventory_slots.Count() < 1)
8554 {
8555 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8556 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8557 }
8558 else
8559 {
8560 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8561 if (detach_types.Count() < 1)
8562 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8563 }
8564
8565 for (int i = 0; i < inventory_slots.Count(); i++)
8566 {
8567 slot = inventory_slots.Get(i);
8568 }
8569
8570 if (slot != "")
8571 {
8572 if (detach_types.Count() == 1)
8573 idx = 0;
8574 else
8575 idx = inventory_slots.Find(slot);
8576 }
8577 if (idx < 0)
8578 return "";
8579
8580 return detach_types.Get(idx);
8581 }
8582
8584 {
8585
8587
8588
8589 float min_time = 1;
8590 float max_time = 3;
8591 float delay = Math.RandomFloat(min_time, max_time);
8592
8593 explode_timer.Run(delay, this, "DoAmmoExplosion");
8594 }
8595
8597 {
8598 Magazine magazine = Magazine.Cast(this);
8599 int pop_sounds_count = 6;
8600 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8601
8602
8603 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8604 string sound_name = pop_sounds[ sound_idx ];
8606
8607
8608 magazine.ServerAddAmmoCount(-1);
8609
8610
8611 float min_temp_to_explode = 100;
8612
8613 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8614 {
8616 }
8617 }
8618
8619
8620 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8621 {
8622 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8623
8624 const int CHANCE_DAMAGE_CARGO = 4;
8625 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8626 const int CHANCE_DAMAGE_NOTHING = 2;
8627
8629 {
8630 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8631 int chances;
8632 int rnd;
8633
8634 if (GetInventory().GetCargo())
8635 {
8636 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8637 rnd = Math.RandomInt(0,chances);
8638
8639 if (rnd < CHANCE_DAMAGE_CARGO)
8640 {
8642 }
8643 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8644 {
8646 }
8647 }
8648 else
8649 {
8650 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8651 rnd = Math.RandomInt(0,chances);
8652
8653 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8654 {
8656 }
8657 }
8658 }
8659 }
8660
8662 {
8663 if (GetInventory().GetCargo())
8664 {
8665 int item_count = GetInventory().GetCargo().GetItemCount();
8666 if (item_count > 0)
8667 {
8668 int random_pick = Math.RandomInt(0, item_count);
8670 if (!item.IsExplosive())
8671 {
8672 item.AddHealth("","",damage);
8673 return true;
8674 }
8675 }
8676 }
8677 return false;
8678 }
8679
8681 {
8682 int attachment_count = GetInventory().AttachmentCount();
8683 if (attachment_count > 0)
8684 {
8685 int random_pick = Math.RandomInt(0, attachment_count);
8686 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
8687 if (!attachment.IsExplosive())
8688 {
8689 attachment.AddHealth("","",damage);
8690 return true;
8691 }
8692 }
8693 return false;
8694 }
8695
8697 {
8699 }
8700
8702 {
8704 return GetInventory().CanRemoveEntity();
8705
8706 return false;
8707 }
8708
8710 {
8711
8713 return false;
8714
8715
8717 return false;
8718
8719
8720
8722 if (delta == 0)
8723 return false;
8724
8725
8726 return true;
8727 }
8728
8730 {
8732 {
8733 if (ScriptInputUserData.CanStoreInputUserData())
8734 {
8735 ScriptInputUserData ctx = new ScriptInputUserData;
8740 ctx.
Write(destination_entity);
8744 }
8745 }
8746 else if (!
GetGame().IsMultiplayer())
8747 {
8749 }
8750 }
8751
8753 {
8754 float split_quantity_new;
8758 InventoryLocation loc = new InventoryLocation;
8759
8760 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8761 {
8763 split_quantity_new = stack_max;
8764 else
8766
8768 {
8769 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8770 if (new_item)
8771 {
8772 new_item.SetResultOfSplit(true);
8773 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8775 new_item.
SetQuantity(split_quantity_new,
false,
true);
8776 }
8777 }
8778 }
8779 else if (destination_entity && slot_id == -1)
8780 {
8781 if (quantity > stack_max)
8782 split_quantity_new = stack_max;
8783 else
8784 split_quantity_new = quantity;
8785
8787 {
8789 {
8792 }
8793
8794 if (new_item)
8795 {
8796 new_item.SetResultOfSplit(true);
8797 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8799 new_item.
SetQuantity(split_quantity_new,
false,
true);
8800 }
8801 }
8802 }
8803 else
8804 {
8805 if (stack_max != 0)
8806 {
8808 {
8810 }
8811
8812 if (split_quantity_new == 0)
8813 {
8814 if (!
GetGame().IsMultiplayer())
8815 player.PhysicalPredictiveDropItem(this);
8816 else
8817 player.ServerDropEntity(this);
8818 return;
8819 }
8820
8822 {
8824
8825 if (new_item)
8826 {
8827 new_item.SetResultOfSplit(true);
8828 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8831 new_item.PlaceOnSurface();
8832 }
8833 }
8834 }
8835 }
8836 }
8837
8839 {
8840 float split_quantity_new;
8844 InventoryLocation loc = new InventoryLocation;
8845
8846 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8847 {
8849 split_quantity_new = stack_max;
8850 else
8852
8854 {
8855 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8856 if (new_item)
8857 {
8858 new_item.SetResultOfSplit(true);
8859 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8861 new_item.
SetQuantity(split_quantity_new,
false,
true);
8862 }
8863 }
8864 }
8865 else if (destination_entity && slot_id == -1)
8866 {
8867 if (quantity > stack_max)
8868 split_quantity_new = stack_max;
8869 else
8870 split_quantity_new = quantity;
8871
8873 {
8875 {
8878 }
8879
8880 if (new_item)
8881 {
8882 new_item.SetResultOfSplit(true);
8883 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8885 new_item.
SetQuantity(split_quantity_new,
false,
true);
8886 }
8887 }
8888 }
8889 else
8890 {
8891 if (stack_max != 0)
8892 {
8894 {
8896 }
8897
8899 {
8901
8902 if (new_item)
8903 {
8904 new_item.SetResultOfSplit(true);
8905 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8908 new_item.PlaceOnSurface();
8909 }
8910 }
8911 }
8912 }
8913 }
8914
8916 {
8918 {
8919 if (ScriptInputUserData.CanStoreInputUserData())
8920 {
8921 ScriptInputUserData ctx = new ScriptInputUserData;
8926 dst.WriteToContext(ctx);
8928 }
8929 }
8930 else if (!
GetGame().IsMultiplayer())
8931 {
8933 }
8934 }
8935
8937 {
8939 {
8940 if (ScriptInputUserData.CanStoreInputUserData())
8941 {
8942 ScriptInputUserData ctx = new ScriptInputUserData;
8947 ctx.
Write(destination_entity);
8953 }
8954 }
8955 else if (!
GetGame().IsMultiplayer())
8956 {
8958 }
8959 }
8960
8962 {
8964 }
8965
8967 {
8969 float split_quantity_new;
8971 if (dst.IsValid())
8972 {
8973 int slot_id = dst.GetSlot();
8975
8976 if (quantity > stack_max)
8977 split_quantity_new = stack_max;
8978 else
8979 split_quantity_new = quantity;
8980
8982 {
8984
8985 if (new_item)
8986 {
8987 new_item.SetResultOfSplit(true);
8988 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8990 new_item.
SetQuantity(split_quantity_new,
false,
true);
8991 }
8992
8993 return new_item;
8994 }
8995 }
8996
8997 return null;
8998 }
8999
9001 {
9003 float split_quantity_new;
9005 if (destination_entity)
9006 {
9008 if (quantity > stackable)
9009 split_quantity_new = stackable;
9010 else
9011 split_quantity_new = quantity;
9012
9014 {
9015 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9016 if (new_item)
9017 {
9018 new_item.SetResultOfSplit(true);
9019 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9021 new_item.
SetQuantity(split_quantity_new,
false,
true);
9022 }
9023 }
9024 }
9025 }
9026
9028 {
9030 {
9031 if (ScriptInputUserData.CanStoreInputUserData())
9032 {
9033 ScriptInputUserData ctx = new ScriptInputUserData;
9038 ItemBase destination_entity =
this;
9039 ctx.
Write(destination_entity);
9043 }
9044 }
9045 else if (!
GetGame().IsMultiplayer())
9046 {
9048 }
9049 }
9050
9052 {
9054 float split_quantity_new;
9056 if (player)
9057 {
9059 if (quantity > stackable)
9060 split_quantity_new = stackable;
9061 else
9062 split_quantity_new = quantity;
9063
9065 {
9066 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9067 new_item =
ItemBase.Cast(in_hands);
9068 if (new_item)
9069 {
9070 new_item.SetResultOfSplit(true);
9071 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9073 new_item.SetQuantity(split_quantity_new, false, true);
9074 }
9075 }
9076 }
9077 }
9078
9080 {
9082 float split_quantity_new = Math.Floor(quantity * 0.5);
9083
9085 return;
9086
9088
9089 if (new_item)
9090 {
9091 if (new_item.GetQuantityMax() < split_quantity_new)
9092 {
9093 split_quantity_new = new_item.GetQuantityMax();
9094 }
9095
9096 new_item.SetResultOfSplit(true);
9097 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9098
9100 {
9103 }
9104 else
9105 {
9107 new_item.
SetQuantity(split_quantity_new,
false,
true);
9108 }
9109 }
9110 }
9111
9113 {
9115 float split_quantity_new = Math.Floor(quantity / 2);
9116
9118 return;
9119
9120 InventoryLocation invloc = new InventoryLocation;
9122
9124 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9125
9126 if (new_item)
9127 {
9128 if (new_item.GetQuantityMax() < split_quantity_new)
9129 {
9130 split_quantity_new = new_item.GetQuantityMax();
9131 }
9133 {
9136 }
9137 else if (split_quantity_new > 1)
9138 {
9140 new_item.
SetQuantity(split_quantity_new,
false,
true);
9141 }
9142 }
9143 }
9144
9147 {
9148 SetWeightDirty();
9150
9151 if (parent)
9152 parent.OnAttachmentQuantityChangedEx(this, delta);
9153
9155 {
9157 {
9159 }
9161 {
9162 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9164 }
9165 }
9166
9167 }
9168
9171 {
9172
9173 }
9174
9177 {
9179 }
9180
9182 {
9183 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9184
9186 {
9187 if (newLevel == GameConstants.STATE_RUINED)
9188 {
9190 EntityAI parent = GetHierarchyParent();
9191 if (parent && parent.IsFireplace())
9192 {
9193 CargoBase cargo = GetInventory().GetCargo();
9194 if (cargo)
9195 {
9197 {
9199 }
9200 }
9201 }
9202 }
9203
9205 {
9206
9208 return;
9209 }
9210
9211 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9212 {
9214 }
9215 }
9216 }
9217
9218
9220 {
9221 super.OnRightClick();
9222
9224 {
9226 {
9227 if (ScriptInputUserData.CanStoreInputUserData())
9228 {
9229 EntityAI root = GetHierarchyRoot();
9230 Man playerOwner = GetHierarchyRootPlayer();
9231 InventoryLocation dst = new InventoryLocation;
9232
9233
9234 if (!playerOwner && root && root == this)
9235 {
9237 }
9238 else
9239 {
9240
9241 GetInventory().GetCurrentInventoryLocation(dst);
9243 {
9246 {
9248 }
9249 else
9250 {
9252
9253
9254 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9255 {
9257 }
9258 else
9259 {
9260 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9261 }
9262 }
9263 }
9264 }
9265
9266 ScriptInputUserData ctx = new ScriptInputUserData;
9274 }
9275 }
9276 else if (!
GetGame().IsMultiplayer())
9277 {
9279 }
9280 }
9281 }
9282
9284 {
9285 if (root)
9286 {
9287 vector m4[4];
9288 root.GetTransform(m4);
9289 dst.SetGround(this, m4);
9290 }
9291 else
9292 {
9293 GetInventory().GetCurrentInventoryLocation(dst);
9294 }
9295 }
9296
9297 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9298 {
9299
9300 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9301 return false;
9302
9303 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9304 return false;
9305
9306
9308 return false;
9309
9310
9311 Magazine mag = Magazine.Cast(this);
9312 if (mag)
9313 {
9314 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9315 return false;
9316
9317 if (stack_max_limit)
9318 {
9319 Magazine other_mag = Magazine.Cast(other_item);
9320 if (other_item)
9321 {
9322 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9323 return false;
9324 }
9325
9326 }
9327 }
9328 else
9329 {
9330
9332 return false;
9333
9335 return false;
9336 }
9337
9338 PlayerBase player = null;
9339 if (CastTo(player, GetHierarchyRootPlayer()))
9340 {
9341 if (player.GetInventory().HasAttachment(this))
9342 return false;
9343
9344 if (player.IsItemsToDelete())
9345 return false;
9346 }
9347
9348 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9349 return false;
9350
9351 int slotID;
9353 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9354 return false;
9355
9356 return true;
9357 }
9358
9360 {
9362 }
9363
9365 {
9366 return m_IsResultOfSplit;
9367 }
9368
9370 {
9371 m_IsResultOfSplit = value;
9372 }
9373
9375 {
9377 }
9378
9380 {
9381 float other_item_quantity = other_item.GetQuantity();
9382 float this_free_space;
9383
9385
9387
9388 if (other_item_quantity > this_free_space)
9389 {
9390 return this_free_space;
9391 }
9392 else
9393 {
9394 return other_item_quantity;
9395 }
9396 }
9397
9399 {
9401 }
9402
9404 {
9406 return;
9407
9408 if (!IsMagazine() && other_item)
9409 {
9411 if (quantity_used != 0)
9412 {
9413 float hp1 = GetHealth01("","");
9414 float hp2 = other_item.GetHealth01("","");
9415 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9416 hpResult = hpResult / (
GetQuantity() + quantity_used);
9417
9418 hpResult *= GetMaxHealth();
9419 Math.Round(hpResult);
9420 SetHealth("", "Health", hpResult);
9421
9423 other_item.AddQuantity(-quantity_used);
9424 }
9425 }
9427 }
9428
9430 {
9431 #ifdef SERVER
9432 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9433 GetHierarchyParent().IncreaseLifetimeUp();
9434 #endif
9435 };
9436
9438 {
9439 PlayerBase p = PlayerBase.Cast(player);
9440
9441 array<int> recipesIds = p.m_Recipes;
9442 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9443 if (moduleRecipesManager)
9444 {
9445 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
9446 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9447 }
9448
9449 for (int i = 0;i < recipesIds.Count(); i++)
9450 {
9451 int key = recipesIds.Get(i);
9452 string recipeName = moduleRecipesManager.GetRecipeName(key);
9454 }
9455 }
9456
9457
9458 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9459 {
9460 super.GetDebugActions(outputList);
9461
9462
9468
9469
9474
9479
9480
9484
9485
9487 {
9491 }
9492
9495
9496
9500
9502
9503 InventoryLocation loc = new InventoryLocation();
9504 GetInventory().GetCurrentInventoryLocation(loc);
9506 {
9507 if (Gizmo_IsSupported())
9510 }
9511
9513 }
9514
9515
9516
9517
9519 {
9520 super.OnAction(action_id, player, ctx);
9521
9523 {
9524 switch (action_id)
9525 {
9528 return true;
9531 return true;
9532 }
9533 }
9534
9536 {
9537 switch (action_id)
9538 {
9540 Delete();
9541 return true;
9542 }
9543 }
9544
9545 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9546 {
9547 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9548 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9549 PlayerBase p = PlayerBase.Cast(player);
9550 if (
EActions.RECIPES_RANGE_START < 1000)
9551 {
9552 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9553 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9554 }
9555 }
9556 #ifndef SERVER
9557 else if (action_id ==
EActions.WATCH_PLAYER)
9558 {
9559 PluginDeveloper.SetDeveloperItemClientEx(player);
9560 }
9561 #endif
9563 {
9564 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9565 {
9566 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9567 OnDebugButtonPressServer(id + 1);
9568 }
9569
9570 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9571 {
9572 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9574 }
9575
9576 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9577 {
9578 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9580 }
9581
9582 else if (action_id ==
EActions.ADD_QUANTITY)
9583 {
9584 if (IsMagazine())
9585 {
9586 Magazine mag = Magazine.Cast(this);
9587 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9588 }
9589 else
9590 {
9592 }
9593
9594 if (m_EM)
9595 {
9596 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9597 }
9598
9599 }
9600
9601 else if (action_id ==
EActions.REMOVE_QUANTITY)
9602 {
9603 if (IsMagazine())
9604 {
9605 Magazine mag2 = Magazine.Cast(this);
9606 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9607 }
9608 else
9609 {
9611 }
9612 if (m_EM)
9613 {
9614 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9615 }
9616
9617 }
9618
9619 else if (action_id ==
EActions.SET_QUANTITY_0)
9620 {
9622
9623 if (m_EM)
9624 {
9625 m_EM.SetEnergy(0);
9626 }
9627 }
9628
9629 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9630 {
9632
9633 if (m_EM)
9634 {
9635 m_EM.SetEnergy(m_EM.GetEnergyMax());
9636 }
9637 }
9638
9639 else if (action_id ==
EActions.ADD_HEALTH)
9640 {
9641 AddHealth("","",GetMaxHealth("","Health")/5);
9642 }
9643 else if (action_id ==
EActions.REMOVE_HEALTH)
9644 {
9645 AddHealth("","",-GetMaxHealth("","Health")/5);
9646 }
9647 else if (action_id ==
EActions.DESTROY_HEALTH)
9648 {
9649 SetHealth01("","",0);
9650 }
9651 else if (action_id ==
EActions.WATCH_ITEM)
9652 {
9654 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9655 #ifdef DEVELOPER
9656 SetDebugDeveloper_item(this);
9657 #endif
9658 }
9659
9660 else if (action_id ==
EActions.ADD_TEMPERATURE)
9661 {
9662 AddTemperature(20);
9663
9664 }
9665
9666 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9667 {
9668 AddTemperature(-20);
9669
9670 }
9671
9672 else if (action_id ==
EActions.FLIP_FROZEN)
9673 {
9674 SetFrozen(!GetIsFrozen());
9675
9676 }
9677
9678 else if (action_id ==
EActions.ADD_WETNESS)
9679 {
9681
9682 }
9683
9684 else if (action_id ==
EActions.REMOVE_WETNESS)
9685 {
9687
9688 }
9689
9690 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9691 {
9694
9695
9696 }
9697
9698 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9699 {
9702 }
9703
9704 else if (action_id ==
EActions.MAKE_SPECIAL)
9705 {
9706 auto debugParams = DebugSpawnParams.WithPlayer(player);
9707 OnDebugSpawnEx(debugParams);
9708 }
9709
9710 }
9711
9712
9713 return false;
9714 }
9715
9716
9717
9718
9722
9725
9726
9727
9729 {
9730 return false;
9731 }
9732
9733
9735 {
9736 return true;
9737 }
9738
9739
9741 {
9742 return true;
9743 }
9744
9745
9746
9748 {
9749 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9751 }
9752
9755 {
9756 return null;
9757 }
9758
9760 {
9761 return false;
9762 }
9763
9765 {
9766 return false;
9767 }
9768
9772
9773
9775 {
9776 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9777 return module_repairing.CanRepair(this, item_repair_kit);
9778 }
9779
9780
9781 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9782 {
9783 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9784 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9785 }
9786
9787
9789 {
9790
9791
9792
9793
9794
9795
9796
9797
9798 return 1;
9799 }
9800
9801
9802
9804 {
9806 }
9807
9808
9809
9811 {
9813 }
9814
9815
9824 {
9825 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9826
9827 if (player)
9828 {
9829 player.MessageStatus(text);
9830 }
9831 }
9832
9833
9842 {
9843 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9844
9845 if (player)
9846 {
9847 player.MessageAction(text);
9848 }
9849 }
9850
9851
9860 {
9861 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9862
9863 if (player)
9864 {
9865 player.MessageFriendly(text);
9866 }
9867 }
9868
9869
9878 {
9879 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9880
9881 if (player)
9882 {
9883 player.MessageImportant(text);
9884 }
9885 }
9886
9888 {
9889 return true;
9890 }
9891
9892
9893 override bool KindOf(
string tag)
9894 {
9895 bool found = false;
9896 string item_name = this.
GetType();
9899
9900 int array_size = item_tag_array.Count();
9901 for (int i = 0; i < array_size; i++)
9902 {
9903 if (item_tag_array.Get(i) == tag)
9904 {
9905 found = true;
9906 break;
9907 }
9908 }
9909 return found;
9910 }
9911
9912
9914 {
9915
9916 super.OnRPC(sender, rpc_type,ctx);
9917
9918
9919 switch (rpc_type)
9920 {
9921 #ifndef SERVER
9922 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9923 Param2<bool, string> p = new Param2<bool, string>(false, "");
9924
9926 return;
9927
9928 bool play = p.param1;
9929 string soundSet = p.param2;
9930
9931 if (play)
9932 {
9934 {
9936 {
9938 }
9939 }
9940 else
9941 {
9943 }
9944 }
9945 else
9946 {
9948 }
9949
9950 break;
9951 #endif
9952
9953 }
9954
9956 {
9958 }
9959 }
9960
9961
9962
9963
9965 {
9966 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9967 return plugin.GetID(
name);
9968 }
9969
9971 {
9972 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9973 return plugin.GetName(id);
9974 }
9975
9978 {
9979
9980
9981 int varFlags;
9982 if (!ctx.
Read(varFlags))
9983 return;
9984
9985 if (varFlags & ItemVariableFlags.FLOAT)
9986 {
9988 }
9989 }
9990
9992 {
9993
9994 super.SerializeNumericalVars(floats_out);
9995
9996
9997
9999 {
10001 }
10002
10004 {
10006 }
10007
10009 {
10011 }
10012
10014 {
10019 }
10020
10022 {
10024 }
10025 }
10026
10028 {
10029
10030 super.DeSerializeNumericalVars(floats);
10031
10032
10033 int index = 0;
10034 int mask = Math.Round(floats.Get(index));
10035
10036 index++;
10037
10039 {
10041 {
10043 }
10044 else
10045 {
10046 float quantity = floats.Get(index);
10047 SetQuantity(quantity,
true,
false,
false,
false);
10048 }
10049 index++;
10050 }
10051
10053 {
10054 float wet = floats.Get(index);
10056 index++;
10057 }
10058
10060 {
10061 int liquidtype = Math.Round(floats.Get(index));
10063 index++;
10064 }
10065
10067 {
10069 index++;
10071 index++;
10073 index++;
10075 index++;
10076 }
10077
10079 {
10080 int cleanness = Math.Round(floats.Get(index));
10082 index++;
10083 }
10084 }
10085
10087 {
10088 super.WriteVarsToCTX(ctx);
10089
10090
10092 {
10094 }
10095
10097 {
10099 }
10100
10102 {
10104 }
10105
10107 {
10108 int r,g,b,a;
10114 }
10115
10117 {
10119 }
10120 }
10121
10123 {
10124 if (!super.ReadVarsFromCTX(ctx,version))
10125 return false;
10126
10127 int intValue;
10128 float value;
10129
10130 if (version < 140)
10131 {
10132 if (!ctx.
Read(intValue))
10133 return false;
10134
10135 m_VariablesMask = intValue;
10136 }
10137
10139 {
10140 if (!ctx.
Read(value))
10141 return false;
10142
10144 {
10146 }
10147 else
10148 {
10150 }
10151 }
10152
10153 if (version < 140)
10154 {
10156 {
10157 if (!ctx.
Read(value))
10158 return false;
10159 SetTemperatureDirect(value);
10160 }
10161 }
10162
10164 {
10165 if (!ctx.
Read(value))
10166 return false;
10168 }
10169
10171 {
10172 if (!ctx.
Read(intValue))
10173 return false;
10175 }
10176
10178 {
10179 int r,g,b,a;
10181 return false;
10183 return false;
10185 return false;
10187 return false;
10188
10190 }
10191
10193 {
10194 if (!ctx.
Read(intValue))
10195 return false;
10197 }
10198
10199 if (version >= 138 && version < 140)
10200 {
10202 {
10203 if (!ctx.
Read(intValue))
10204 return false;
10205 SetFrozen(intValue);
10206 }
10207 }
10208
10209 return true;
10210 }
10211
10212
10214 {
10217 {
10219 }
10220
10221 if (!super.OnStoreLoad(ctx, version))
10222 {
10224 return false;
10225 }
10226
10227 if (version >= 114)
10228 {
10229 bool hasQuickBarIndexSaved;
10230
10231 if (!ctx.
Read(hasQuickBarIndexSaved))
10232 {
10234 return false;
10235 }
10236
10237 if (hasQuickBarIndexSaved)
10238 {
10239 int itmQBIndex;
10240
10241
10242 if (!ctx.
Read(itmQBIndex))
10243 {
10245 return false;
10246 }
10247
10248 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10249 if (itmQBIndex != -1 && parentPlayer)
10250 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10251 }
10252 }
10253 else
10254 {
10255
10256 PlayerBase player;
10257 int itemQBIndex;
10258 if (version ==
int.
MAX)
10259 {
10260 if (!ctx.
Read(itemQBIndex))
10261 {
10263 return false;
10264 }
10265 }
10266 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10267 {
10268
10269 if (!ctx.
Read(itemQBIndex))
10270 {
10272 return false;
10273 }
10274 if (itemQBIndex != -1 && player)
10275 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10276 }
10277 }
10278
10279 if (version < 140)
10280 {
10281
10282 if (!LoadVariables(ctx, version))
10283 {
10285 return false;
10286 }
10287 }
10288
10289
10291 {
10293 return false;
10294 }
10295 if (version >= 132)
10296 {
10298 if (raib)
10299 {
10301 {
10303 return false;
10304 }
10305 }
10306 }
10307
10309 return true;
10310 }
10311
10312
10313
10315 {
10316 super.OnStoreSave(ctx);
10317
10318 PlayerBase player;
10319 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10320 {
10322
10323 int itemQBIndex = -1;
10324 itemQBIndex = player.FindQuickBarEntityIndex(this);
10325 ctx.
Write(itemQBIndex);
10326 }
10327 else
10328 {
10330 }
10331
10333
10335 if (raib)
10336 {
10338 }
10339 }
10340
10341
10343 {
10344 super.AfterStoreLoad();
10345
10347 {
10349 }
10350
10352 {
10355 }
10356 }
10357
10359 {
10360 super.EEOnAfterLoad();
10361
10363 {
10365 }
10366
10369 }
10370
10372 {
10373 return false;
10374 }
10375
10376
10377
10379 {
10381 {
10382 #ifdef PLATFORM_CONSOLE
10383
10385 {
10387 if (menu)
10388 {
10390 }
10391 }
10392 #endif
10393 }
10394
10396 {
10399 }
10400
10402 {
10403 SetWeightDirty();
10405 }
10407 {
10410 }
10411
10413 {
10416 }
10418 {
10421 }
10422
10423 super.OnVariablesSynchronized();
10424 }
10425
10426
10427
10429 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10430 {
10431 if (!IsServerCheck(allow_client))
10432 return false;
10433
10435 return false;
10436
10439
10440 if (value <= (min + 0.001))
10441 value = min;
10442
10443 if (value == min)
10444 {
10445 if (destroy_config)
10446 {
10447 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10448 if (dstr)
10449 {
10451 this.Delete();
10452 return true;
10453 }
10454 }
10455 else if (destroy_forced)
10456 {
10458 this.Delete();
10459 return true;
10460 }
10461
10463 }
10464
10467
10469 {
10471
10472 if (delta)
10474 }
10475
10477
10478 return false;
10479 }
10480
10481
10483 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10484 {
10486 }
10487
10489 {
10492 }
10493
10495 {
10498 }
10499
10501 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10502 {
10503 float value_clamped = Math.Clamp(value, 0, 1);
10505 SetQuantity(result, destroy_config, destroy_forced);
10506 }
10507
10508
10511 {
10513 }
10514
10516 {
10518 }
10519
10520
10521
10522
10523
10524
10525
10526
10527
10528
10530 {
10531 int slot = -1;
10532 if (GetInventory())
10533 {
10534 InventoryLocation il = new InventoryLocation;
10535 GetInventory().GetCurrentInventoryLocation(il);
10537 }
10538
10540 }
10541
10543 {
10544 float quantity_max = 0;
10545
10547 {
10548 if (attSlotID != -1)
10549 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10550
10551 if (quantity_max <= 0)
10553 }
10554
10555 if (quantity_max <= 0)
10557
10558 return quantity_max;
10559 }
10560
10562 {
10564 }
10565
10567 {
10569 }
10570
10571
10573 {
10575 }
10576
10578 {
10580 }
10581
10583 {
10585 }
10586
10587
10589 {
10590
10591 float weightEx = GetWeightEx();
10592 float special = GetInventoryAndCargoWeight();
10593 return weightEx - special;
10594 }
10595
10596
10598 {
10600 }
10601
10603 {
10605 {
10606 #ifdef DEVELOPER
10607 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10608 {
10609 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10611 }
10612 #endif
10613
10614 return GetQuantity() * GetConfigWeightModified();
10615 }
10616 else if (HasEnergyManager())
10617 {
10618 #ifdef DEVELOPER
10619 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10620 {
10621 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10622 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10623 }
10624 #endif
10625 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10626 }
10627 else
10628 {
10629 #ifdef DEVELOPER
10630 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10631 {
10632 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10633 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10634 }
10635 #endif
10636 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10637 }
10638 }
10639
10642 {
10643 int item_count = 0;
10645
10646 if (GetInventory().GetCargo() != NULL)
10647 {
10648 item_count = GetInventory().GetCargo().GetItemCount();
10649 }
10650
10651 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
10652 {
10653 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
10654 if (item)
10655 item_count += item.GetNumberOfItems();
10656 }
10657 return item_count;
10658 }
10659
10662 {
10663 float weight = 0;
10664 float wetness = 1;
10665 if (include_wetness)
10668 {
10669 weight = wetness * m_ConfigWeight;
10670 }
10672 {
10673 weight = 1;
10674 }
10675 return weight;
10676 }
10677
10678
10679
10681 {
10682 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
10683 {
10684 GameInventory inv = GetInventory();
10685 array<EntityAI> items = new array<EntityAI>;
10687 for (int i = 0; i < items.Count(); i++)
10688 {
10690 if (item)
10691 {
10693 }
10694 }
10695 }
10696 }
10697
10698
10699
10700
10702 {
10703 float energy = 0;
10704 if (HasEnergyManager())
10705 {
10706 energy = GetCompEM().GetEnergy();
10707 }
10708 return energy;
10709 }
10710
10711
10713 {
10714 super.OnEnergyConsumed();
10715
10717 }
10718
10720 {
10721 super.OnEnergyAdded();
10722
10724 }
10725
10726
10728 {
10729 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10730 {
10732 {
10733 float energy_0to1 = GetCompEM().GetEnergy0To1();
10735 }
10736 }
10737 }
10738
10739
10741 {
10742 return ConfigGetFloat("heatIsolation");
10743 }
10744
10746 {
10748 }
10749
10751 {
10752 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10753 if (
GetGame().ConfigIsExisting(paramPath))
10755
10756 return 0.0;
10757 }
10758
10760 {
10761 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10762 if (
GetGame().ConfigIsExisting(paramPath))
10764
10765 return 0.0;
10766 }
10767
10768 override void SetWet(
float value,
bool allow_client =
false)
10769 {
10770 if (!IsServerCheck(allow_client))
10771 return;
10772
10775
10777
10778 m_VarWet = Math.Clamp(value, min, max);
10779
10781 {
10784 }
10785 }
10786
10787 override void AddWet(
float value)
10788 {
10790 }
10791
10793 {
10795 }
10796
10798 {
10800 }
10801
10803 {
10805 }
10806
10808 {
10810 }
10811
10813 {
10815 }
10816
10817 override void OnWetChanged(
float newVal,
float oldVal)
10818 {
10821 if (newLevel != oldLevel)
10822 {
10824 }
10825 }
10826
10828 {
10829 SetWeightDirty();
10830 }
10831
10833 {
10834 return GetWetLevelInternal(
m_VarWet);
10835 }
10836
10837
10838
10840 {
10842 }
10843
10845 {
10847 }
10848
10850 {
10852 }
10853
10855 {
10857 }
10858
10859
10860
10862 {
10863 if (ConfigIsExisting("itemModelLength"))
10864 {
10865 return ConfigGetFloat("itemModelLength");
10866 }
10867 return 0;
10868 }
10869
10871 {
10872 if (ConfigIsExisting("itemAttachOffset"))
10873 {
10874 return ConfigGetFloat("itemAttachOffset");
10875 }
10876 return 0;
10877 }
10878
10879 override void SetCleanness(
int value,
bool allow_client =
false)
10880 {
10881 if (!IsServerCheck(allow_client))
10882 return;
10883
10885
10887
10890 }
10891
10893 {
10895 }
10896
10898 {
10899 return true;
10900 }
10901
10902
10903
10904
10906 {
10908 }
10909
10911 {
10913 }
10914
10915
10916
10917
10918 override void SetColor(
int r,
int g,
int b,
int a)
10919 {
10925 }
10927 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10928 {
10933 }
10934
10936 {
10938 }
10939
10942 {
10943 int r,g,b,a;
10945 r = r/255;
10946 g = g/255;
10947 b = b/255;
10948 a = a/255;
10949 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10950 }
10951
10952
10953
10954 override void SetLiquidType(
int value,
bool allow_client =
false)
10955 {
10956 if (!IsServerCheck(allow_client))
10957 return;
10958
10963 }
10964
10966 {
10967 return ConfigGetInt("varLiquidTypeInit");
10968 }
10969
10971 {
10973 }
10974
10976 {
10978 SetFrozen(false);
10979 }
10980
10983 {
10984 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10985 }
10986
10987
10990 {
10991 PlayerBase nplayer;
10992 if (PlayerBase.CastTo(nplayer, player))
10993 {
10995
10996 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10997 }
10998 }
10999
11000
11003 {
11004 PlayerBase nplayer;
11005 if (PlayerBase.CastTo(nplayer,player))
11006 {
11007
11008 nplayer.SetEnableQuickBarEntityShortcut(this,false);
11009
11010 }
11011
11012
11013 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11014
11015
11016 if (HasEnergyManager())
11017 {
11018 GetCompEM().UpdatePlugState();
11019 }
11020 }
11021
11022
11024 {
11025 super.OnPlacementStarted(player);
11026
11028 }
11029
11030 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11031 {
11033 {
11034 m_AdminLog.OnPlacementComplete(player,
this);
11035 }
11036
11037 super.OnPlacementComplete(player, position, orientation);
11038 }
11039
11040
11041
11042
11043
11045 {
11047 {
11048 return true;
11049 }
11050 else
11051 {
11052 return false;
11053 }
11054 }
11055
11056
11058 {
11060 {
11062 }
11063 }
11064
11065
11067 {
11069 }
11070
11072 {
11074 }
11075
11076 override void InsertAgent(
int agent,
float count = 1)
11077 {
11078 if (count < 1)
11079 return;
11080
11082 }
11083
11086 {
11088 }
11089
11090
11092 {
11094 }
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
11107
11108
11109
11110
11111
11112
11113
11114
11115
11116
11117
11118
11119
11120
11121
11122
11123
11124
11125
11126
11127
11128
11129
11130
11131
11132
11133
11134
11135
11136
11138 {
11140 return false;
11141 return true;
11142 }
11143
11145 {
11146
11148 }
11149
11150
11153 {
11154 super.CheckForRoofLimited(timeTresholdMS);
11155
11157 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11158 {
11159 m_PreviousRoofTestTime = time;
11160 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11161 }
11162 }
11163
11164
11166 {
11168 {
11169 return 0;
11170 }
11171
11172 if (GetInventory().GetAttachmentSlotsCount() != 0)
11173 {
11174 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11175 if (filter)
11176 return filter.GetProtectionLevel(type, false, system);
11177 else
11178 return 0;
11179 }
11180
11181 string subclassPath, entryName;
11182
11183 switch (type)
11184 {
11186 entryName = "biological";
11187 break;
11189 entryName = "chemical";
11190 break;
11191 default:
11192 entryName = "biological";
11193 break;
11194 }
11195
11196 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11197
11199 }
11200
11201
11202
11205 {
11206 if (!IsMagazine())
11208
11210 }
11211
11212
11213
11214
11215
11220 {
11221 return true;
11222 }
11223
11225 {
11227 }
11228
11229
11230
11231
11232
11234 {
11235 if (parent)
11236 {
11237 if (parent.IsInherited(DayZInfected))
11238 return true;
11239
11240 if (!parent.IsRuined())
11241 return true;
11242 }
11243
11244 return true;
11245 }
11246
11248 {
11249 if (!super.CanPutAsAttachment(parent))
11250 {
11251 return false;
11252 }
11253
11254 if (!IsRuined() && !parent.IsRuined())
11255 {
11256 return true;
11257 }
11258
11259 return false;
11260 }
11261
11263 {
11264
11265
11266
11267
11268 return super.CanReceiveItemIntoCargo(item);
11269 }
11270
11272 {
11273
11274
11275
11276
11277 GameInventory attachmentInv = attachment.GetInventory();
11279 {
11280 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11281 return false;
11282 }
11283
11284 InventoryLocation loc = new InventoryLocation();
11285 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11286 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11287 return false;
11288
11289 return super.CanReceiveAttachment(attachment, slotId);
11290 }
11291
11293 {
11294 if (!super.CanReleaseAttachment(attachment))
11295 return false;
11296
11297 return GetInventory().AreChildrenAccessible();
11298 }
11299
11300
11301
11302
11303
11304
11305
11306
11307
11308
11309
11310
11311
11312
11313
11314
11315
11316
11317
11318
11319
11321 {
11322 int id = muzzle_owner.GetMuzzleID();
11323 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11324
11325 if (WPOF_array)
11326 {
11327 for (int i = 0; i < WPOF_array.Count(); i++)
11328 {
11329 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11330
11331 if (WPOF)
11332 {
11333 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11334 }
11335 }
11336 }
11337 }
11338
11339
11341 {
11342 int id = muzzle_owner.GetMuzzleID();
11344
11345 if (WPOBE_array)
11346 {
11347 for (int i = 0; i < WPOBE_array.Count(); i++)
11348 {
11349 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11350
11351 if (WPOBE)
11352 {
11353 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11354 }
11355 }
11356 }
11357 }
11358
11359
11361 {
11362 int id = muzzle_owner.GetMuzzleID();
11363 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11364
11365 if (WPOOH_array)
11366 {
11367 for (int i = 0; i < WPOOH_array.Count(); i++)
11368 {
11369 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11370
11371 if (WPOOH)
11372 {
11373 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11374 }
11375 }
11376 }
11377 }
11378
11379
11381 {
11382 int id = muzzle_owner.GetMuzzleID();
11383 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11384
11385 if (WPOOH_array)
11386 {
11387 for (int i = 0; i < WPOOH_array.Count(); i++)
11388 {
11389 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11390
11391 if (WPOOH)
11392 {
11393 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11394 }
11395 }
11396 }
11397 }
11398
11399
11401 {
11402 int id = muzzle_owner.GetMuzzleID();
11403 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11404
11405 if (WPOOH_array)
11406 {
11407 for (int i = 0; i < WPOOH_array.Count(); i++)
11408 {
11409 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11410
11411 if (WPOOH)
11412 {
11413 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11414 }
11415 }
11416 }
11417 }
11418
11419
11420
11422 {
11424 {
11425 return true;
11426 }
11427
11428 return false;
11429 }
11430
11432 {
11434 {
11435 return true;
11436 }
11437
11438 return false;
11439 }
11440
11442 {
11444 {
11445 return true;
11446 }
11447
11448 return false;
11449 }
11450
11452 {
11453 return false;
11454 }
11455
11458 {
11459 return UATimeSpent.DEFAULT_DEPLOY;
11460 }
11461
11462
11463
11464
11466 {
11468 SetSynchDirty();
11469 }
11470
11472 {
11474 }
11475
11476
11478 {
11479 return false;
11480 }
11481
11484 {
11485 string att_type = "None";
11486
11487 if (ConfigIsExisting("soundAttType"))
11488 {
11489 att_type = ConfigGetString("soundAttType");
11490 }
11491
11493 }
11494
11496 {
11498 }
11499
11500
11501
11502
11503
11509
11511 {
11514
11516 }
11517
11518
11520 {
11522 return;
11523
11525
11528
11531
11532 SoundParameters params = new SoundParameters();
11536 }
11537
11538
11540 {
11542 return;
11543
11545 SetSynchDirty();
11546
11549 }
11550
11551
11553 {
11555 return;
11556
11558 SetSynchDirty();
11559
11562 }
11563
11565 {
11567 }
11568
11570 {
11572 }
11573
11576 {
11577 if (!
GetGame().IsDedicatedServer())
11578 {
11579 if (ConfigIsExisting("attachSoundSet"))
11580 {
11581 string cfg_path = "";
11582 string soundset = "";
11583 string type_name =
GetType();
11584
11587 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11588 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11589
11590 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11591 {
11592 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11593 {
11594 if (cfg_slot_array[i] == slot_type)
11595 {
11596 soundset = cfg_soundset_array[i];
11597 break;
11598 }
11599 }
11600 }
11601
11602 if (soundset != "")
11603 {
11604 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11606 }
11607 }
11608 }
11609 }
11610
11612 {
11613
11614 }
11615
11616 void OnApply(PlayerBase player);
11617
11619 {
11620 return 1.0;
11621 };
11622
11624 {
11626 }
11627
11629 {
11631 }
11632
11634
11636 {
11637 SetDynamicPhysicsLifeTime(0.01);
11639 }
11640
11642 {
11643 array<string> zone_names = new array<string>;
11644 GetDamageZones(zone_names);
11645 for (int i = 0; i < zone_names.Count(); i++)
11646 {
11647 SetHealthMax(zone_names.Get(i),"Health");
11648 }
11649 SetHealthMax("","Health");
11650 }
11651
11654 {
11655 float global_health = GetHealth01("","Health");
11656 array<string> zones = new array<string>;
11657 GetDamageZones(zones);
11658
11659 for (int i = 0; i < zones.Count(); i++)
11660 {
11661 SetHealth01(zones.Get(i),"Health",global_health);
11662 }
11663 }
11664
11667 {
11668 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11669 }
11670
11672 {
11673 if (!hasRootAsPlayer)
11674 {
11675 if (refParentIB)
11676 {
11677
11678 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11679 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11680
11681 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11682 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11683
11686 }
11687 else
11688 {
11689
11692 }
11693 }
11694 }
11695
11697 {
11699 {
11700 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11701 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11702 {
11703 float heatPermCoef = 1.0;
11705 while (ent)
11706 {
11707 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11708 ent = ent.GetHierarchyParent();
11709 }
11710
11711 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11712 }
11713 }
11714 }
11715
11717 {
11718
11719 EntityAI parent = GetHierarchyParent();
11720 if (!parent)
11721 {
11722 hasParent = false;
11723 hasRootAsPlayer = false;
11724 }
11725 else
11726 {
11727 hasParent = true;
11728 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11729 refParentIB =
ItemBase.Cast(parent);
11730 }
11731 }
11732
11733 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11734 {
11735
11736 }
11737
11739 {
11740
11741 return false;
11742 }
11743
11745 {
11746
11747
11748 return false;
11749 }
11750
11752 {
11753
11754 return false;
11755 }
11756
11759 {
11760 return !GetIsFrozen() &&
IsOpen();
11761 }
11762
11764 {
11765 bool hasParent = false, hasRootAsPlayer = false;
11767
11768 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11769 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11770
11771 if (wwtu || foodDecay)
11772 {
11776
11777 if (processWetness || processTemperature || processDecay)
11778 {
11780
11781 if (processWetness)
11782 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11783
11784 if (processTemperature)
11786
11787 if (processDecay)
11788 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11789 }
11790 }
11791 }
11792
11795 {
11797 }
11798
11800 {
11803
11804 return super.GetTemperatureFreezeThreshold();
11805 }
11806
11808 {
11811
11812 return super.GetTemperatureThawThreshold();
11813 }
11814
11816 {
11819
11820 return super.GetItemOverheatThreshold();
11821 }
11822
11824 {
11826 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11827
11828 return super.GetTemperatureFreezeTime();
11829 }
11830
11832 {
11834 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11835
11836 return super.GetTemperatureThawTime();
11837 }
11838
11843
11845 {
11846 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11847 }
11848
11850 {
11851 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11852 }
11853
11856 {
11858 }
11859
11861 {
11863 }
11864
11866 {
11868 }
11869
11872 {
11873 return null;
11874 }
11875
11878 {
11879 return false;
11880 }
11881
11883 {
11885 {
11888 if (!trg)
11889 {
11891 explosive = this;
11892 }
11893
11894 explosive.PairRemote(trg);
11896
11897 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11898 trg.SetPersistentPairID(persistentID);
11899 explosive.SetPersistentPairID(persistentID);
11900
11901 return true;
11902 }
11903 return false;
11904 }
11905
11908 {
11909 float ret = 1.0;
11912 ret *= GetHealth01();
11913
11914 return ret;
11915 }
11916
11917 #ifdef DEVELOPER
11918 override void SetDebugItem()
11919 {
11920 super.SetDebugItem();
11921 _itemBase = this;
11922 }
11923
11925 {
11926 string text = super.GetDebugText();
11927
11929 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11930
11931 return text;
11932 }
11933 #endif
11934
11936 {
11937 return true;
11938 }
11939
11941
11943
11945 {
11948 }
11949
11950
11958
11974}
11975
11977{
11979 if (entity)
11980 {
11981 bool is_item = entity.IsInherited(
ItemBase);
11982 if (is_item && full_quantity)
11983 {
11986 }
11987 }
11988 else
11989 {
11991 return NULL;
11992 }
11993 return entity;
11994}
11995
11997{
11998 if (item)
11999 {
12000 if (health > 0)
12001 item.SetHealth("", "", health);
12002
12003 if (item.CanHaveTemperature())
12004 {
12006 if (item.CanFreeze())
12007 item.SetFrozen(false);
12008 }
12009
12010 if (item.HasEnergyManager())
12011 {
12012 if (quantity >= 0)
12013 {
12014 item.GetCompEM().SetEnergy0To1(quantity);
12015 }
12016 else
12017 {
12019 }
12020 }
12021 else if (item.IsMagazine())
12022 {
12023 Magazine mag = Magazine.Cast(item);
12024 if (quantity >= 0)
12025 {
12026 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12027 }
12028 else
12029 {
12031 }
12032
12033 }
12034 else
12035 {
12036 if (quantity >= 0)
12037 {
12038 item.SetQuantityNormalized(quantity, false);
12039 }
12040 else
12041 {
12043 }
12044
12045 }
12046 }
12047}
12048
12049#ifdef DEVELOPER
12051#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.