7159{
7161 {
7162 return true;
7163 }
7164};
7165
7167{
7168
7169};
7170
7171
7172
7174{
7178
7180
7183
7184
7185
7186
7187
7196
7202
7207
7212
7233 protected bool m_IsResultOfSplit
7234
7236
7241
7242
7243
7245
7249
7250
7251
7253
7256
7257
7258
7264
7265
7273
7276
7277
7279
7280
7282
7283
7288
7289
7294
7296
7297
7299
7300
7302 {
7307
7308 if (!
g_Game.IsDedicatedServer())
7309 {
7311 {
7313
7315 {
7317 }
7318 }
7319
7322 }
7323
7324 m_OldLocation = null;
7325
7327 {
7329 }
7330
7331 if (ConfigIsExisting("headSelectionsToHide"))
7332 {
7335 }
7336
7338 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7339 {
7341 }
7342
7344
7345 m_IsResultOfSplit = false;
7346
7348 }
7349
7351 {
7352 super.InitItemVariables();
7353
7359 m_Count = ConfigGetInt(
"count");
7360
7363
7368
7371
7376
7388
7392
7393
7396 if (ConfigIsExisting("canBeSplit"))
7397 {
7400 }
7401
7403 if (ConfigIsExisting("itemBehaviour"))
7405
7406
7409 RegisterNetSyncVariableInt("m_VarLiquidType");
7410 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7411
7412 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7413 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7414 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7415
7416 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7417 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7418 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7419 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7420
7421 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7422 RegisterNetSyncVariableBool("m_IsTakeable");
7423 RegisterNetSyncVariableBool("m_IsHologram");
7424
7427 {
7430 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7431 }
7432
7434
7436 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7438
7440 }
7441
7443 {
7445 }
7446
7448 {
7451 {
7456 }
7457 }
7458
7459 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7460 {
7462 {
7465 }
7466
7468 }
7469
7471 {
7477 }
7478
7480
7482 {
7484
7485 if (!action)
7486 {
7487 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7488 return;
7489 }
7490
7492 if (!ai)
7493 {
7495 return;
7496 }
7497
7499 if (!action_array)
7500 {
7501 action_array = new array<ActionBase_Basic>;
7503 }
7504 if (LogManager.IsActionLogEnable())
7505 {
7506 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7507 }
7508
7509 if (action_array.Find(action) != -1)
7510 {
7511 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7512 }
7513 else
7514 {
7515 action_array.Insert(action);
7516 }
7517 }
7518
7520 {
7521 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7522 ActionBase action = player.GetActionManager().GetAction(actionName);
7525
7526 if (action_array)
7527 {
7528 action_array.RemoveItem(action);
7529 }
7530 }
7531
7532
7533
7535 {
7536 ActionOverrideData overrideData = new ActionOverrideData();
7540
7542 if (!actionMap)
7543 {
7546 }
7547
7548 actionMap.Insert(this.
Type(), overrideData);
7549
7550 }
7551
7553
7555
7556
7558 {
7561
7564
7565 string config_to_search = "CfgVehicles";
7566 string muzzle_owner_config;
7567
7569 {
7570 if (IsInherited(Weapon))
7571 config_to_search = "CfgWeapons";
7572
7573 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7574
7575 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7576
7577 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7578
7579 if (config_OnFire_subclass_count > 0)
7580 {
7581 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7582
7583 for (int i = 0; i < config_OnFire_subclass_count; i++)
7584 {
7585 string particle_class = "";
7586 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7587 string config_OnFire_entry = config_OnFire_class + particle_class;
7588 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7589 WPOF_array.Insert(WPOF);
7590 }
7591
7592
7594 }
7595 }
7596
7598 {
7599 config_to_search = "CfgWeapons";
7600 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7601
7602 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7603
7604 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7605
7606 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7607 {
7608 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7609
7610 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7611 {
7612 string particle_class2 = "";
7613 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7614 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7615 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7616 WPOBE_array.Insert(WPOBE);
7617 }
7618
7619
7621 }
7622 }
7623 }
7624
7625
7627 {
7630
7632 {
7633 string config_to_search = "CfgVehicles";
7634
7635 if (IsInherited(Weapon))
7636 config_to_search = "CfgWeapons";
7637
7638 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7639 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7640
7641 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7642 {
7643
7645
7647 {
7649 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7651 return;
7652 }
7653
7656
7657
7658
7659 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7660 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7661
7662 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7663 {
7664 string particle_class = "";
7665 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7666 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7667 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7668
7669 if (entry_type == CT_CLASS)
7670 {
7671 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7672 WPOOH_array.Insert(WPOF);
7673 }
7674 }
7675
7676
7678 }
7679 }
7680 }
7681
7683 {
7685 }
7686
7688 {
7690 {
7692
7695
7698
7699 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7700 }
7701 }
7702
7704 {
7706 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7707
7709 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7710
7712 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7713
7715 {
7717 }
7718 }
7719
7721 {
7723 }
7724
7726 {
7729 else
7731
7733 {
7736 }
7737 else
7738 {
7741
7744 }
7745
7747 }
7748
7750 {
7752 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7753 }
7754
7756 {
7758 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7760 }
7761
7763 {
7765 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7766 }
7767
7769 {
7772
7773 OverheatingParticle OP = new OverheatingParticle();
7778
7780 }
7781
7783 {
7786
7787 return -1;
7788 }
7789
7791 {
7793 {
7796
7797 for (int i = count; i > 0; --i)
7798 {
7799 int id = i - 1;
7802
7805
7806 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7807 {
7808 if (p)
7809 {
7812 }
7813 }
7814 }
7815 }
7816 }
7817
7819 {
7821 {
7823 {
7824 int id = i - 1;
7826
7827 if (OP)
7828 {
7830
7831 if (p)
7832 {
7834 }
7835
7836 delete OP;
7837 }
7838 }
7839
7842 }
7843 }
7844
7847 {
7848 return 0.0;
7849 }
7850
7851
7853 {
7854 return 250;
7855 }
7856
7858 {
7859 return 0;
7860 }
7861
7864 {
7866 return true;
7867
7868 return false;
7869 }
7870
7873 {
7876
7878 {
7880 }
7881 else
7882 {
7883
7885 }
7886
7888 }
7889
7896 {
7897 return -1;
7898 }
7899
7900
7901
7902
7904 {
7906 {
7907 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7908 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7909
7910 if (r_index >= 0)
7911 {
7912 InventoryLocation r_il = new InventoryLocation;
7913 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7914
7915 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7918 {
7919 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7920 }
7922 {
7923 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7924 }
7925
7926 }
7927
7928 player.GetHumanInventory().ClearUserReservedLocation(this);
7929 }
7930
7933 }
7934
7935
7936
7937
7939 {
7940 return ItemBase.m_DebugActionsMask;
7941 }
7942
7944 {
7945 return ItemBase.m_DebugActionsMask & mask;
7946 }
7947
7949 {
7950 ItemBase.m_DebugActionsMask = mask;
7951 }
7952
7954 {
7955 ItemBase.m_DebugActionsMask |= mask;
7956 }
7957
7959 {
7960 ItemBase.m_DebugActionsMask &= ~mask;
7961 }
7962
7964 {
7966 {
7968 }
7969 else
7970 {
7972 }
7973 }
7974
7975
7977 {
7978 if (GetEconomyProfile())
7979 {
7980 float q_max = GetEconomyProfile().GetQuantityMax();
7981 if (q_max > 0)
7982 {
7983 float q_min = GetEconomyProfile().GetQuantityMin();
7984 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7985
7987 {
7988 ComponentEnergyManager comp = GetCompEM();
7990 {
7992 }
7993 }
7995 {
7997
7998 }
7999
8000 }
8001 }
8002 }
8003
8006 {
8007 EntityAI parent = GetHierarchyParent();
8008
8009 if (parent)
8010 {
8011 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8012 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8013 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8014 }
8015 }
8016
8019 {
8020 EntityAI parent = GetHierarchyParent();
8021
8022 if (parent)
8023 {
8024 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8025 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8026 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8027 }
8028 }
8029
8031 {
8032
8033
8034
8035
8037
8039 {
8040 if (ScriptInputUserData.CanStoreInputUserData())
8041 {
8042 ScriptInputUserData ctx = new ScriptInputUserData;
8048 ctx.
Write(use_stack_max);
8051
8053 {
8054 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8055 }
8056 }
8057 }
8058 else if (!
g_Game.IsMultiplayer())
8059 {
8061 }
8062 }
8063
8065 {
8067 }
8068
8070 {
8072 }
8073
8075 {
8077 }
8078
8080 {
8081
8082 return false;
8083 }
8084
8086 {
8087 return false;
8088 }
8089
8093 {
8094 return false;
8095 }
8096
8098 {
8099 return "";
8100 }
8101
8103
8105 {
8106 return false;
8107 }
8108
8110 {
8111 return true;
8112 }
8113
8114
8115
8117 {
8118 return true;
8119 }
8120
8122 {
8123 return true;
8124 }
8125
8127 {
8128 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8130 }
8131
8133 {
8135 }
8136
8138 {
8140 if (!is_being_placed)
8142 SetSynchDirty();
8143 }
8144
8145
8147
8149 {
8151 }
8152
8154 {
8156 }
8157
8159 {
8160 return 1;
8161 }
8162
8164 {
8165 return false;
8166 }
8167
8169 {
8171 SetSynchDirty();
8172 }
8173
8174
8175
8176
8177
8178
8179
8180
8181
8182
8183
8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8209 {
8210 super.OnMovedInsideCargo(container);
8211
8212 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8213 }
8214
8215 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8216 {
8217 super.EEItemLocationChanged(oldLoc, newLoc);
8218
8219 PlayerBase newPlayer = null;
8220 PlayerBase oldPlayer = null;
8221
8222 if (newLoc.GetParent())
8223 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8224
8225 if (oldLoc.GetParent())
8226 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8227
8229 {
8230 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8231
8232 if (rIndex >= 0)
8233 {
8234 InventoryLocation rIl = new InventoryLocation;
8235 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8236
8237 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8240 {
8241 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8242 }
8244 {
8246 }
8247
8248 }
8249 }
8250
8252 {
8253 if (newPlayer)
8254 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8255
8256 if (newPlayer == oldPlayer)
8257 {
8258 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8259 {
8261 {
8262 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8263 {
8264 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8265 }
8266 }
8267 else
8268 {
8269 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8270 }
8271 }
8272
8273 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8274 {
8275 int type = oldLoc.GetType();
8277 {
8278 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8279 }
8281 {
8282 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8283 }
8284 }
8285 if (!m_OldLocation)
8286 {
8287 m_OldLocation = new InventoryLocation;
8288 }
8289 m_OldLocation.Copy(oldLoc);
8290 }
8291 else
8292 {
8293 if (m_OldLocation)
8294 {
8295 m_OldLocation.Reset();
8296 }
8297 }
8298
8299 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8300 }
8301 else
8302 {
8303 if (newPlayer)
8304 {
8305 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8306 if (resIndex >= 0)
8307 {
8308 InventoryLocation il = new InventoryLocation;
8309 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8311 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8314 {
8315 il.
GetParent().GetOnReleaseLock().Invoke(it);
8316 }
8318 {
8320 }
8321
8322 }
8323 }
8325 {
8326
8328 }
8329
8330 if (m_OldLocation)
8331 {
8332 m_OldLocation.Reset();
8333 }
8334 }
8335
8337 {
8338 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8339 }
8340
8342 {
8343 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8344 }
8345 }
8346
8347 override void EOnContact(IEntity other, Contact extra)
8348 {
8350 {
8351 int liquidType = -1;
8353 if (impactSpeed > 0.0)
8354 {
8356 #ifndef SERVER
8358 #else
8360 SetSynchDirty();
8361 #endif
8363 }
8364 }
8365
8366 #ifdef SERVER
8367 if (GetCompEM() && GetCompEM().IsPlugged())
8368 {
8369 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8370 GetCompEM().UnplugThis();
8371 }
8372 #endif
8373 }
8374
8376
8378 {
8380 }
8381
8383 {
8384
8385 }
8386
8388 {
8389 super.OnItemLocationChanged(old_owner, new_owner);
8390
8391 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8392 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8393
8394 if (!relatedPlayer && playerNew)
8395 relatedPlayer = playerNew;
8396
8397 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8398 {
8400 if (actionMgr)
8401 {
8402 ActionBase currentAction = actionMgr.GetRunningAction();
8403 if (currentAction)
8405 }
8406 }
8407
8408 Man ownerPlayerOld = null;
8409 Man ownerPlayerNew = null;
8410
8411 if (old_owner)
8412 {
8413 if (old_owner.
IsMan())
8414 {
8415 ownerPlayerOld = Man.Cast(old_owner);
8416 }
8417 else
8418 {
8419 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8420 }
8421 }
8422 else
8423 {
8425 {
8427
8428 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8429 {
8430 GetCompEM().UnplugThis();
8431 }
8432 }
8433 }
8434
8435 if (new_owner)
8436 {
8437 if (new_owner.
IsMan())
8438 {
8439 ownerPlayerNew = Man.Cast(new_owner);
8440 }
8441 else
8442 {
8443 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8444 }
8445 }
8446
8447 if (ownerPlayerOld != ownerPlayerNew)
8448 {
8449 if (ownerPlayerOld)
8450 {
8451 array<EntityAI> subItemsExit = new array<EntityAI>;
8453 for (int i = 0; i < subItemsExit.Count(); i++)
8454 {
8457 }
8458 }
8459
8460 if (ownerPlayerNew)
8461 {
8462 array<EntityAI> subItemsEnter = new array<EntityAI>;
8464 for (int j = 0; j < subItemsEnter.Count(); j++)
8465 {
8468 }
8469 }
8470 }
8471 else if (ownerPlayerNew != null)
8472 {
8473 PlayerBase nplayer;
8474 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8475 {
8476 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8478 for (int k = 0; k < subItemsUpdate.Count(); k++)
8479 {
8481 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8482 }
8483 }
8484 }
8485
8486 if (old_owner)
8487 old_owner.OnChildItemRemoved(this);
8488 if (new_owner)
8489 new_owner.OnChildItemReceived(this);
8490 }
8491
8492
8494 {
8495 super.EEDelete(parent);
8496 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8497 if (player)
8498 {
8500
8501 if (player.IsAlive())
8502 {
8503 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8504 if (r_index >= 0)
8505 {
8506 InventoryLocation r_il = new InventoryLocation;
8507 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8508
8509 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8512 {
8513 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8514 }
8516 {
8517 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8518 }
8519
8520 }
8521
8522 player.RemoveQuickBarEntityShortcut(this);
8523 }
8524 }
8525 }
8526
8528 {
8529 super.EEKilled(killer);
8530
8533 {
8534 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8535 {
8536 if (IsMagazine())
8537 {
8538 if (Magazine.Cast(this).GetAmmoCount() > 0)
8539 {
8541 }
8542 }
8543 else
8544 {
8546 }
8547 }
8548 }
8549 }
8550
8552 {
8553 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8554
8555 super.OnWasAttached(parent, slot_id);
8556
8559
8562 }
8563
8565 {
8566 super.OnWasDetached(parent, slot_id);
8567
8570
8573 }
8574
8576 {
8577 int idx;
8580
8581 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8582 if (inventory_slots.Count() < 1)
8583 {
8584 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8585 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8586 }
8587 else
8588 {
8589 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8590 }
8591
8592 idx = inventory_slots.Find(slot);
8593 if (idx < 0)
8594 return "";
8595
8596 return attach_types.Get(idx);
8597 }
8598
8600 {
8601 int idx = -1;
8602 string slot;
8603
8606
8607 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8608 if (inventory_slots.Count() < 1)
8609 {
8610 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8611 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8612 }
8613 else
8614 {
8615 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8616 if (detach_types.Count() < 1)
8617 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8618 }
8619
8620 for (int i = 0; i < inventory_slots.Count(); i++)
8621 {
8622 slot = inventory_slots.Get(i);
8623 }
8624
8625 if (slot != "")
8626 {
8627 if (detach_types.Count() == 1)
8628 idx = 0;
8629 else
8630 idx = inventory_slots.Find(slot);
8631 }
8632 if (idx < 0)
8633 return "";
8634
8635 return detach_types.Get(idx);
8636 }
8637
8639 {
8640
8642
8643
8644 float min_time = 1;
8645 float max_time = 3;
8646 float delay = Math.RandomFloat(min_time, max_time);
8647
8648 explode_timer.Run(delay, this, "DoAmmoExplosion");
8649 }
8650
8652 {
8653 Magazine magazine = Magazine.Cast(this);
8654 int pop_sounds_count = 6;
8655 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8656
8657
8658 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8659 string sound_name = pop_sounds[ sound_idx ];
8660 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8661
8662
8663 magazine.ServerAddAmmoCount(-1);
8664
8665
8666 float min_temp_to_explode = 100;
8667
8668 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8669 {
8671 }
8672 }
8673
8674
8675 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8676 {
8677 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8678
8679 const int CHANCE_DAMAGE_CARGO = 4;
8680 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8681 const int CHANCE_DAMAGE_NOTHING = 2;
8682
8684 {
8685 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8686 int chances;
8687 int rnd;
8688
8689 if (GetInventory().GetCargo())
8690 {
8691 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8692 rnd = Math.RandomInt(0,chances);
8693
8694 if (rnd < CHANCE_DAMAGE_CARGO)
8695 {
8697 }
8698 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8699 {
8701 }
8702 }
8703 else
8704 {
8705 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8706 rnd = Math.RandomInt(0,chances);
8707
8708 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8709 {
8711 }
8712 }
8713 }
8714 }
8715
8717 {
8718 CargoBase cargo = GetInventory().GetCargo();
8719 if (cargo)
8720 {
8722 if (item_count > 0)
8723 {
8724 int random_pick = Math.RandomInt(0, item_count);
8726 if (!item.IsExplosive())
8727 {
8728 item.AddHealth("","",damage);
8729 return true;
8730 }
8731 }
8732 }
8733 return false;
8734 }
8735
8737 {
8738 GameInventory inventory = GetInventory();
8740 if (attachment_count > 0)
8741 {
8742 int random_pick = Math.RandomInt(0, attachment_count);
8744 if (!attachment.IsExplosive())
8745 {
8746 attachment.AddHealth("","",damage);
8747 return true;
8748 }
8749 }
8750 return false;
8751 }
8752
8754 {
8756 }
8757
8759 {
8761 return GetInventory().CanRemoveEntity();
8762
8763 return false;
8764 }
8765
8767 {
8768
8770 return false;
8771
8772
8774 return false;
8775
8776
8777
8779 if (delta == 0)
8780 return false;
8781
8782
8783 return true;
8784 }
8785
8787 {
8789 {
8790 if (ScriptInputUserData.CanStoreInputUserData())
8791 {
8792 ScriptInputUserData ctx = new ScriptInputUserData;
8797 ctx.
Write(destination_entity);
8801 }
8802 }
8803 else if (!
g_Game.IsMultiplayer())
8804 {
8806 }
8807 }
8808
8810 {
8811 float split_quantity_new;
8815 InventoryLocation loc = new InventoryLocation;
8816
8817 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8818 {
8820 split_quantity_new = stack_max;
8821 else
8823
8825 {
8826 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8827 if (new_item)
8828 {
8829 new_item.SetResultOfSplit(true);
8830 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8832 new_item.
SetQuantity(split_quantity_new,
false,
true);
8833 }
8834 }
8835 }
8836 else if (destination_entity && slot_id == -1)
8837 {
8838 if (quantity > stack_max)
8839 split_quantity_new = stack_max;
8840 else
8841 split_quantity_new = quantity;
8842
8844 {
8845 GameInventory destinationInventory = destination_entity.GetInventory();
8847 {
8850 }
8851
8852 if (new_item)
8853 {
8854 new_item.SetResultOfSplit(true);
8855 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8857 new_item.
SetQuantity(split_quantity_new,
false,
true);
8858 }
8859 }
8860 }
8861 else
8862 {
8863 if (stack_max != 0)
8864 {
8866 {
8868 }
8869
8870 if (split_quantity_new == 0)
8871 {
8872 if (!
g_Game.IsMultiplayer())
8873 player.PhysicalPredictiveDropItem(this);
8874 else
8875 player.ServerDropEntity(this);
8876 return;
8877 }
8878
8880 {
8882
8883 if (new_item)
8884 {
8885 new_item.SetResultOfSplit(true);
8886 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8889 new_item.PlaceOnSurface();
8890 }
8891 }
8892 }
8893 }
8894 }
8895
8897 {
8898 float split_quantity_new;
8902 InventoryLocation loc = new InventoryLocation;
8903
8904 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8905 {
8907 split_quantity_new = stack_max;
8908 else
8910
8912 {
8913 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8914 if (new_item)
8915 {
8916 new_item.SetResultOfSplit(true);
8917 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8919 new_item.
SetQuantity(split_quantity_new,
false,
true);
8920 }
8921 }
8922 }
8923 else if (destination_entity && slot_id == -1)
8924 {
8925 if (quantity > stack_max)
8926 split_quantity_new = stack_max;
8927 else
8928 split_quantity_new = quantity;
8929
8931 {
8932 GameInventory destinationInventory = destination_entity.GetInventory();
8934 {
8937 }
8938
8939 if (new_item)
8940 {
8941 new_item.SetResultOfSplit(true);
8942 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8944 new_item.
SetQuantity(split_quantity_new,
false,
true);
8945 }
8946 }
8947 }
8948 else
8949 {
8950 if (stack_max != 0)
8951 {
8953 {
8955 }
8956
8958 {
8960
8961 if (new_item)
8962 {
8963 new_item.SetResultOfSplit(true);
8964 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8967 new_item.PlaceOnSurface();
8968 }
8969 }
8970 }
8971 }
8972 }
8973
8975 {
8977 {
8978 if (ScriptInputUserData.CanStoreInputUserData())
8979 {
8980 ScriptInputUserData ctx = new ScriptInputUserData;
8985 dst.WriteToContext(ctx);
8987 }
8988 }
8989 else if (!
g_Game.IsMultiplayer())
8990 {
8992 }
8993 }
8994
8996 {
8998 {
8999 if (ScriptInputUserData.CanStoreInputUserData())
9000 {
9001 ScriptInputUserData ctx = new ScriptInputUserData;
9006 ctx.
Write(destination_entity);
9012 }
9013 }
9014 else if (!
g_Game.IsMultiplayer())
9015 {
9017 }
9018 }
9019
9021 {
9023 }
9024
9026 {
9028 float split_quantity_new;
9030 if (dst.IsValid())
9031 {
9032 int slot_id = dst.GetSlot();
9034
9035 if (quantity > stack_max)
9036 split_quantity_new = stack_max;
9037 else
9038 split_quantity_new = quantity;
9039
9041 {
9043
9044 if (new_item)
9045 {
9046 new_item.SetResultOfSplit(true);
9047 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9049 new_item.
SetQuantity(split_quantity_new,
false,
true);
9050 }
9051
9052 return new_item;
9053 }
9054 }
9055
9056 return null;
9057 }
9058
9060 {
9062 float split_quantity_new;
9064 if (destination_entity)
9065 {
9067 if (quantity > stackable)
9068 split_quantity_new = stackable;
9069 else
9070 split_quantity_new = quantity;
9071
9073 {
9074 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9075 if (new_item)
9076 {
9077 new_item.SetResultOfSplit(true);
9078 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9080 new_item.
SetQuantity(split_quantity_new,
false,
true);
9081 }
9082 }
9083 }
9084 }
9085
9087 {
9089 {
9090 if (ScriptInputUserData.CanStoreInputUserData())
9091 {
9092 ScriptInputUserData ctx = new ScriptInputUserData;
9097 ItemBase destination_entity =
this;
9098 ctx.
Write(destination_entity);
9102 }
9103 }
9104 else if (!
g_Game.IsMultiplayer())
9105 {
9107 }
9108 }
9109
9111 {
9113 float split_quantity_new;
9115 if (player)
9116 {
9118 if (quantity > stackable)
9119 split_quantity_new = stackable;
9120 else
9121 split_quantity_new = quantity;
9122
9124 {
9125 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9126 new_item =
ItemBase.Cast(in_hands);
9127 if (new_item)
9128 {
9129 new_item.SetResultOfSplit(true);
9130 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9132 new_item.SetQuantity(split_quantity_new, false, true);
9133 }
9134 }
9135 }
9136 }
9137
9139 {
9141 float split_quantity_new = Math.Floor(quantity * 0.5);
9142
9144 return;
9145
9147
9148 if (new_item)
9149 {
9150 if (new_item.GetQuantityMax() < split_quantity_new)
9151 {
9152 split_quantity_new = new_item.GetQuantityMax();
9153 }
9154
9155 new_item.SetResultOfSplit(true);
9156 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9157
9159 {
9162 }
9163 else
9164 {
9166 new_item.
SetQuantity(split_quantity_new,
false,
true);
9167 }
9168 }
9169 }
9170
9172 {
9174 float split_quantity_new = Math.Floor(quantity / 2);
9175
9177 return;
9178
9179 InventoryLocation invloc = new InventoryLocation;
9181
9183 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9184
9185 if (new_item)
9186 {
9187 if (new_item.GetQuantityMax() < split_quantity_new)
9188 {
9189 split_quantity_new = new_item.GetQuantityMax();
9190 }
9192 {
9195 }
9196 else if (split_quantity_new > 1)
9197 {
9199 new_item.
SetQuantity(split_quantity_new,
false,
true);
9200 }
9201 }
9202 }
9203
9206 {
9207 SetWeightDirty();
9209
9210 if (parent)
9211 parent.OnAttachmentQuantityChangedEx(this, delta);
9212
9214 {
9216 {
9218 }
9220 {
9221 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9223 }
9224 }
9225 }
9226
9229 {
9230
9231 }
9232
9235 {
9237 }
9238
9240 {
9241 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9242
9244 {
9245 if (newLevel == GameConstants.STATE_RUINED)
9246 {
9248 EntityAI parent = GetHierarchyParent();
9249 if (parent && parent.IsFireplace())
9250 {
9251 CargoBase cargo = GetInventory().GetCargo();
9252 if (cargo)
9253 {
9255 {
9257 }
9258 }
9259 }
9260 }
9261
9263 {
9264
9266 return;
9267 }
9268
9269 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9270 {
9272 }
9273 }
9274 }
9275
9276
9278 {
9279 super.OnRightClick();
9280
9282 {
9284 {
9285 if (ScriptInputUserData.CanStoreInputUserData())
9286 {
9287 EntityAI root = GetHierarchyRoot();
9288 Man playerOwner = GetHierarchyRootPlayer();
9289 InventoryLocation dst = new InventoryLocation;
9290
9291
9292 if (!playerOwner && root && root == this)
9293 {
9295 }
9296 else
9297 {
9298
9299 GetInventory().GetCurrentInventoryLocation(dst);
9301 {
9302 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9304 {
9306 }
9307 else
9308 {
9310
9311
9312 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9313 {
9315 }
9316 else
9317 {
9318 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9319 }
9320 }
9321 }
9322 }
9323
9324 ScriptInputUserData ctx = new ScriptInputUserData;
9332 }
9333 }
9334 else if (!
g_Game.IsMultiplayer())
9335 {
9337 }
9338 }
9339 }
9340
9342 {
9343 if (root)
9344 {
9345 vector m4[4];
9346 root.GetTransform(m4);
9347 dst.SetGround(this, m4);
9348 }
9349 else
9350 {
9351 GetInventory().GetCurrentInventoryLocation(dst);
9352 }
9353 }
9354
9355 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9356 {
9357
9358 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9359 return false;
9360
9361 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9362 return false;
9363
9364
9366 return false;
9367
9368
9369 Magazine mag = Magazine.Cast(this);
9370 if (mag)
9371 {
9372 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9373 return false;
9374
9375 if (stack_max_limit)
9376 {
9377 Magazine other_mag = Magazine.Cast(other_item);
9378 if (other_item)
9379 {
9380 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9381 return false;
9382 }
9383
9384 }
9385 }
9386 else
9387 {
9388
9390 return false;
9391
9393 return false;
9394 }
9395
9396 PlayerBase player = null;
9397 if (CastTo(player, GetHierarchyRootPlayer()))
9398 {
9399 if (player.GetInventory().HasAttachment(this))
9400 return false;
9401
9402 if (player.IsItemsToDelete())
9403 return false;
9404 }
9405
9406 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9407 return false;
9408
9409 int slotID;
9411 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9412 return false;
9413
9414 return true;
9415 }
9416
9418 {
9420 }
9421
9423 {
9424 return m_IsResultOfSplit;
9425 }
9426
9428 {
9429 m_IsResultOfSplit = value;
9430 }
9431
9433 {
9435 }
9436
9438 {
9439 float other_item_quantity = other_item.GetQuantity();
9440 float this_free_space;
9441
9443
9445
9446 if (other_item_quantity > this_free_space)
9447 {
9448 return this_free_space;
9449 }
9450 else
9451 {
9452 return other_item_quantity;
9453 }
9454 }
9455
9457 {
9459 }
9460
9462 {
9464 return;
9465
9466 if (!IsMagazine() && other_item)
9467 {
9469 if (quantity_used != 0)
9470 {
9471 float hp1 = GetHealth01("","");
9472 float hp2 = other_item.GetHealth01("","");
9473 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9474 hpResult = hpResult / (
GetQuantity() + quantity_used);
9475
9476 hpResult *= GetMaxHealth();
9477 Math.Round(hpResult);
9478 SetHealth("", "Health", hpResult);
9479
9481 other_item.AddQuantity(-quantity_used);
9482 }
9483 }
9485 }
9486
9488 {
9489 #ifdef SERVER
9490 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9491 GetHierarchyParent().IncreaseLifetimeUp();
9492 #endif
9493 };
9494
9496 {
9497 PlayerBase p = PlayerBase.Cast(player);
9498
9499 array<int> recipesIds = p.m_Recipes;
9500 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9501 if (moduleRecipesManager)
9502 {
9503 EntityAI itemInHands = player.GetEntityInHands();
9504 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9505 }
9506
9507 for (int i = 0;i < recipesIds.Count(); i++)
9508 {
9509 int key = recipesIds.Get(i);
9510 string recipeName = moduleRecipesManager.GetRecipeName(key);
9512 }
9513 }
9514
9515
9516 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9517 {
9518 super.GetDebugActions(outputList);
9519
9520
9526
9527
9532
9537
9538
9542
9543
9545 {
9549 }
9550
9553
9554
9558
9560
9561 InventoryLocation loc = new InventoryLocation();
9562 GetInventory().GetCurrentInventoryLocation(loc);
9564 {
9565 if (Gizmo_IsSupported())
9568 }
9569
9571 }
9572
9573
9574
9575
9577 {
9578 super.OnAction(action_id, player, ctx);
9579
9581 {
9582 switch (action_id)
9583 {
9587 return true;
9591 return true;
9592 }
9593 }
9594
9596 {
9597 switch (action_id)
9598 {
9600 Delete();
9601 return true;
9602 }
9603 }
9604
9605 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9606 {
9607 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9608 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9609 PlayerBase p = PlayerBase.Cast(player);
9610 if (
EActions.RECIPES_RANGE_START < 1000)
9611 {
9612 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9613 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9614 }
9615 }
9616 #ifndef SERVER
9617 else if (action_id ==
EActions.WATCH_PLAYER)
9618 {
9619 PluginDeveloper.SetDeveloperItemClientEx(player);
9620 }
9621 #endif
9623 {
9624 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9625 {
9626 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9627 OnDebugButtonPressServer(id + 1);
9628 }
9629
9630 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9631 {
9632 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9634 }
9635
9636 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9637 {
9638 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9640 }
9641
9642 else if (action_id ==
EActions.ADD_QUANTITY)
9643 {
9644 if (IsMagazine())
9645 {
9646 Magazine mag = Magazine.Cast(this);
9647 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9648 }
9649 else
9650 {
9652 }
9653
9654 if (m_EM)
9655 {
9656 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9657 }
9658
9659 }
9660
9661 else if (action_id ==
EActions.REMOVE_QUANTITY)
9662 {
9663 if (IsMagazine())
9664 {
9665 Magazine mag2 = Magazine.Cast(this);
9666 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9667 }
9668 else
9669 {
9671 }
9672 if (m_EM)
9673 {
9674 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9675 }
9676
9677 }
9678
9679 else if (action_id ==
EActions.SET_QUANTITY_0)
9680 {
9682
9683 if (m_EM)
9684 {
9685 m_EM.SetEnergy(0);
9686 }
9687 }
9688
9689 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9690 {
9692
9693 if (m_EM)
9694 {
9695 m_EM.SetEnergy(m_EM.GetEnergyMax());
9696 }
9697 }
9698
9699 else if (action_id ==
EActions.ADD_HEALTH)
9700 {
9701 AddHealth("","",GetMaxHealth("","Health")/5);
9702 }
9703 else if (action_id ==
EActions.REMOVE_HEALTH)
9704 {
9705 AddHealth("","",-GetMaxHealth("","Health")/5);
9706 }
9707 else if (action_id ==
EActions.DESTROY_HEALTH)
9708 {
9709 SetHealth01("","",0);
9710 }
9711 else if (action_id ==
EActions.WATCH_ITEM)
9712 {
9714 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9715 #ifdef DEVELOPER
9716 SetDebugDeveloper_item(this);
9717 #endif
9718 }
9719
9720 else if (action_id ==
EActions.ADD_TEMPERATURE)
9721 {
9722 AddTemperature(20);
9723
9724 }
9725
9726 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9727 {
9728 AddTemperature(-20);
9729
9730 }
9731
9732 else if (action_id ==
EActions.FLIP_FROZEN)
9733 {
9734 SetFrozen(!GetIsFrozen());
9735
9736 }
9737
9738 else if (action_id ==
EActions.ADD_WETNESS)
9739 {
9741
9742 }
9743
9744 else if (action_id ==
EActions.REMOVE_WETNESS)
9745 {
9747
9748 }
9749
9750 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9751 {
9754
9755
9756 }
9757
9758 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9759 {
9762 }
9763
9764 else if (action_id ==
EActions.MAKE_SPECIAL)
9765 {
9766 auto debugParams = DebugSpawnParams.WithPlayer(player);
9767 OnDebugSpawnEx(debugParams);
9768 }
9769
9770 }
9771
9772
9773 return false;
9774 }
9775
9776
9777
9778
9782
9785
9786
9787
9789 {
9790 return false;
9791 }
9792
9793
9795 {
9796 return true;
9797 }
9798
9799
9801 {
9802 return true;
9803 }
9804
9805
9806
9808 {
9809 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9810 return g_Game.ConfigIsExisting(config_path);
9811 }
9812
9815 {
9816 return null;
9817 }
9818
9820 {
9821 return false;
9822 }
9823
9825 {
9826 return false;
9827 }
9828
9832
9833
9835 {
9836 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9837 return module_repairing.CanRepair(this, item_repair_kit);
9838 }
9839
9840
9841 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9842 {
9843 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9844 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9845 }
9846
9847
9849 {
9850
9851
9852
9853
9854
9855
9856
9857
9858 return 1;
9859 }
9860
9861
9862
9864 {
9866 }
9867
9868
9869
9871 {
9873 }
9874
9875
9884 {
9885 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9886
9887 if (player)
9888 {
9889 player.MessageStatus(text);
9890 }
9891 }
9892
9893
9902 {
9903 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9904
9905 if (player)
9906 {
9907 player.MessageAction(text);
9908 }
9909 }
9910
9911
9920 {
9921 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9922
9923 if (player)
9924 {
9925 player.MessageFriendly(text);
9926 }
9927 }
9928
9929
9938 {
9939 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9940
9941 if (player)
9942 {
9943 player.MessageImportant(text);
9944 }
9945 }
9946
9948 {
9949 return true;
9950 }
9951
9952
9953 override bool KindOf(
string tag)
9954 {
9955 bool found = false;
9956 string item_name = this.
GetType();
9958 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9959
9960 int array_size = item_tag_array.Count();
9961 for (int i = 0; i < array_size; i++)
9962 {
9963 if (item_tag_array.Get(i) == tag)
9964 {
9965 found = true;
9966 break;
9967 }
9968 }
9969 return found;
9970 }
9971
9972
9974 {
9975
9976 super.OnRPC(sender, rpc_type,ctx);
9977
9978
9979 switch (rpc_type)
9980 {
9981 #ifndef SERVER
9982 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9983 Param2<bool, string> p = new Param2<bool, string>(false, "");
9984
9986 return;
9987
9988 bool play = p.param1;
9989 string soundSet = p.param2;
9990
9991 if (play)
9992 {
9994 {
9996 {
9998 }
9999 }
10000 else
10001 {
10003 }
10004 }
10005 else
10006 {
10008 }
10009
10010 break;
10011 #endif
10012
10013 }
10014
10016 {
10018 }
10019 }
10020
10021
10022
10023
10025 {
10026 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10027 return plugin.GetID(
name);
10028 }
10029
10031 {
10032 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10033 return plugin.GetName(id);
10034 }
10035
10038 {
10039
10040
10041 int varFlags;
10042 if (!ctx.
Read(varFlags))
10043 return;
10044
10045 if (varFlags & ItemVariableFlags.FLOAT)
10046 {
10048 }
10049 }
10050
10052 {
10053
10054 super.SerializeNumericalVars(floats_out);
10055
10056
10057
10059 {
10061 }
10062
10064 {
10066 }
10067
10069 {
10071 }
10072
10074 {
10079 }
10080
10082 {
10084 }
10085 }
10086
10088 {
10089
10090 super.DeSerializeNumericalVars(floats);
10091
10092
10093 int index = 0;
10094 int mask = Math.Round(floats.Get(index));
10095
10096 index++;
10097
10099 {
10101 {
10103 }
10104 else
10105 {
10106 float quantity = floats.Get(index);
10107 SetQuantity(quantity,
true,
false,
false,
false);
10108 }
10109 index++;
10110 }
10111
10113 {
10114 float wet = floats.Get(index);
10116 index++;
10117 }
10118
10120 {
10121 int liquidtype = Math.Round(floats.Get(index));
10123 index++;
10124 }
10125
10127 {
10129 index++;
10131 index++;
10133 index++;
10135 index++;
10136 }
10137
10139 {
10140 int cleanness = Math.Round(floats.Get(index));
10142 index++;
10143 }
10144 }
10145
10147 {
10148 super.WriteVarsToCTX(ctx);
10149
10150
10152 {
10154 }
10155
10157 {
10159 }
10160
10162 {
10164 }
10165
10167 {
10168 int r,g,b,a;
10174 }
10175
10177 {
10179 }
10180 }
10181
10183 {
10184 if (!super.ReadVarsFromCTX(ctx,version))
10185 return false;
10186
10187 int intValue;
10188 float value;
10189
10190 if (version < 140)
10191 {
10192 if (!ctx.
Read(intValue))
10193 return false;
10194
10195 m_VariablesMask = intValue;
10196 }
10197
10199 {
10200 if (!ctx.
Read(value))
10201 return false;
10202
10204 {
10206 }
10207 else
10208 {
10210 }
10211 }
10212
10213 if (version < 140)
10214 {
10216 {
10217 if (!ctx.
Read(value))
10218 return false;
10219 SetTemperatureDirect(value);
10220 }
10221 }
10222
10224 {
10225 if (!ctx.
Read(value))
10226 return false;
10228 }
10229
10231 {
10232 if (!ctx.
Read(intValue))
10233 return false;
10235 }
10236
10238 {
10239 int r,g,b,a;
10241 return false;
10243 return false;
10245 return false;
10247 return false;
10248
10250 }
10251
10253 {
10254 if (!ctx.
Read(intValue))
10255 return false;
10257 }
10258
10259 if (version >= 138 && version < 140)
10260 {
10262 {
10263 if (!ctx.
Read(intValue))
10264 return false;
10265 SetFrozen(intValue);
10266 }
10267 }
10268
10269 return true;
10270 }
10271
10272
10274 {
10277 {
10279 }
10280
10281 if (!super.OnStoreLoad(ctx, version))
10282 {
10284 return false;
10285 }
10286
10287 if (version >= 114)
10288 {
10289 bool hasQuickBarIndexSaved;
10290
10291 if (!ctx.
Read(hasQuickBarIndexSaved))
10292 {
10294 return false;
10295 }
10296
10297 if (hasQuickBarIndexSaved)
10298 {
10299 int itmQBIndex;
10300
10301
10302 if (!ctx.
Read(itmQBIndex))
10303 {
10305 return false;
10306 }
10307
10308 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10309 if (itmQBIndex != -1 && parentPlayer)
10310 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10311 }
10312 }
10313 else
10314 {
10315
10316 PlayerBase player;
10317 int itemQBIndex;
10318 if (version ==
int.
MAX)
10319 {
10320 if (!ctx.
Read(itemQBIndex))
10321 {
10323 return false;
10324 }
10325 }
10326 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10327 {
10328
10329 if (!ctx.
Read(itemQBIndex))
10330 {
10332 return false;
10333 }
10334 if (itemQBIndex != -1 && player)
10335 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10336 }
10337 }
10338
10339 if (version < 140)
10340 {
10341
10342 if (!LoadVariables(ctx, version))
10343 {
10345 return false;
10346 }
10347 }
10348
10349
10351 {
10353 return false;
10354 }
10355 if (version >= 132)
10356 {
10358 if (raib)
10359 {
10361 {
10363 return false;
10364 }
10365 }
10366 }
10367
10369 return true;
10370 }
10371
10372
10373
10375 {
10376 super.OnStoreSave(ctx);
10377
10378 PlayerBase player;
10379 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10380 {
10382
10383 int itemQBIndex = -1;
10384 itemQBIndex = player.FindQuickBarEntityIndex(this);
10385 ctx.
Write(itemQBIndex);
10386 }
10387 else
10388 {
10390 }
10391
10393
10395 if (raib)
10396 {
10398 }
10399 }
10400
10401
10403 {
10404 super.AfterStoreLoad();
10405
10407 {
10409 }
10410
10412 {
10415 }
10416 }
10417
10419 {
10420 super.EEOnAfterLoad();
10421
10423 {
10425 }
10426
10429 }
10430
10432 {
10433 return false;
10434 }
10435
10436
10437
10439 {
10441 {
10442 #ifdef PLATFORM_CONSOLE
10443
10445 {
10447 if (menu)
10448 {
10450 }
10451 }
10452 #endif
10453 }
10454
10456 {
10459 }
10460
10462 {
10463 SetWeightDirty();
10465 }
10467 {
10470 }
10471
10473 {
10476
10479 }
10481 {
10485 }
10486
10487 super.OnVariablesSynchronized();
10488 }
10489
10490
10491
10493 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10494 {
10495 if (!IsServerCheck(allow_client))
10496 return false;
10497
10499 return false;
10500
10503
10504 if (value <= (min + 0.001))
10505 value = min;
10506
10507 if (value == min)
10508 {
10509 if (destroy_config)
10510 {
10511 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10512 if (dstr)
10513 {
10515 this.Delete();
10516 return true;
10517 }
10518 }
10519 else if (destroy_forced)
10520 {
10522 this.Delete();
10523 return true;
10524 }
10525
10527 }
10528
10531
10533 {
10534 EntityAI parent = GetHierarchyRoot();
10535 InventoryLocation iLoc = new InventoryLocation();
10536 GetInventory().GetCurrentInventoryLocation(iLoc);
10538 {
10539 int iLocSlot = iLoc.
GetSlot();
10541 {
10543 }
10545 {
10547 }
10548 }
10549 }
10550
10552 {
10554
10555 if (delta)
10557 }
10558
10560
10561 return false;
10562 }
10563
10564
10566 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10567 {
10569 }
10570
10572 {
10575 }
10576
10578 {
10581 }
10582
10584 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10585 {
10586 float value_clamped = Math.Clamp(value, 0, 1);
10588 SetQuantity(result, destroy_config, destroy_forced);
10589 }
10590
10591
10594 {
10596 }
10597
10599 {
10601 }
10602
10603
10604
10605
10606
10607
10608
10609
10610
10611
10613 {
10614 int slot = -1;
10615 GameInventory inventory = GetInventory();
10616 if (inventory)
10617 {
10618 InventoryLocation il = new InventoryLocation;
10621 }
10622
10624 }
10625
10627 {
10628 float quantity_max = 0;
10629
10631 {
10632 if (attSlotID != -1)
10633 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10634
10635 if (quantity_max <= 0)
10637 }
10638
10639 if (quantity_max <= 0)
10641
10642 return quantity_max;
10643 }
10644
10646 {
10648 }
10649
10651 {
10653 }
10654
10655
10657 {
10659 }
10660
10662 {
10664 }
10665
10667 {
10669 }
10670
10671
10673 {
10674
10675 float weightEx = GetWeightEx();
10676 float special = GetInventoryAndCargoWeight();
10677 return weightEx - special;
10678 }
10679
10680
10682 {
10684 }
10685
10687 {
10689 {
10690 #ifdef DEVELOPER
10691 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10692 {
10693 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10695 }
10696 #endif
10697
10698 return GetQuantity() * GetConfigWeightModified();
10699 }
10700 else if (HasEnergyManager())
10701 {
10702 #ifdef DEVELOPER
10703 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10704 {
10705 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10706 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10707 }
10708 #endif
10709 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10710 }
10711 else
10712 {
10713 #ifdef DEVELOPER
10714 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10715 {
10716 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10717 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10718 }
10719 #endif
10720 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10721 }
10722 }
10723
10726 {
10727 int item_count = 0;
10729
10730 GameInventory inventory = GetInventory();
10731 CargoBase cargo = inventory.
GetCargo();
10732 if (cargo != NULL)
10733 {
10735 }
10736
10738 for (int i = 0; i < nAttachments; ++i)
10739 {
10741 if (item)
10742 item_count += item.GetNumberOfItems();
10743 }
10744 return item_count;
10745 }
10746
10749 {
10750 float weight = 0;
10751 float wetness = 1;
10752 if (include_wetness)
10755 {
10756 weight = wetness * m_ConfigWeight;
10757 }
10759 {
10760 weight = 1;
10761 }
10762 return weight;
10763 }
10764
10765
10766
10768 {
10769 GameInventory inventory = GetInventory();
10770 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10771 {
10772 array<EntityAI> items = new array<EntityAI>;
10774 for (int i = 0; i < items.Count(); ++i)
10775 {
10777 if (item)
10778 {
10779 g_Game.ObjectDelete(item);
10780 }
10781 }
10782 }
10783 }
10784
10785
10786
10787
10789 {
10790 float energy = 0;
10791 if (HasEnergyManager())
10792 {
10793 energy = GetCompEM().GetEnergy();
10794 }
10795 return energy;
10796 }
10797
10798
10800 {
10801 super.OnEnergyConsumed();
10802
10804 }
10805
10807 {
10808 super.OnEnergyAdded();
10809
10811 }
10812
10813
10815 {
10816 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10817 {
10819 {
10820 float energy_0to1 = GetCompEM().GetEnergy0To1();
10822 }
10823 }
10824 }
10825
10826
10828 {
10829 return ConfigGetFloat("heatIsolation");
10830 }
10831
10833 {
10835 }
10836
10838 {
10839 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10840 if (
g_Game.ConfigIsExisting(paramPath))
10841 return g_Game.ConfigGetFloat(paramPath);
10842
10843 return 0.0;
10844 }
10845
10847 {
10848 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10849 if (
g_Game.ConfigIsExisting(paramPath))
10850 return g_Game.ConfigGetFloat(paramPath);
10851
10852 return 0.0;
10853 }
10854
10855 override void SetWet(
float value,
bool allow_client =
false)
10856 {
10857 if (!IsServerCheck(allow_client))
10858 return;
10859
10862
10864
10865 m_VarWet = Math.Clamp(value, min, max);
10866
10868 {
10871 }
10872 }
10873
10874 override void AddWet(
float value)
10875 {
10877 }
10878
10880 {
10882 }
10883
10885 {
10887 }
10888
10890 {
10892 }
10893
10895 {
10897 }
10898
10900 {
10902 }
10903
10904 override void OnWetChanged(
float newVal,
float oldVal)
10905 {
10908 if (newLevel != oldLevel)
10909 {
10911 }
10912 }
10913
10915 {
10916 SetWeightDirty();
10917 }
10918
10920 {
10921 return GetWetLevelInternal(
m_VarWet);
10922 }
10923
10924
10925
10927 {
10929 }
10930
10932 {
10934 }
10935
10937 {
10939 }
10940
10942 {
10944 }
10945
10946
10947
10949 {
10950 if (ConfigIsExisting("itemModelLength"))
10951 {
10952 return ConfigGetFloat("itemModelLength");
10953 }
10954 return 0;
10955 }
10956
10958 {
10959 if (ConfigIsExisting("itemAttachOffset"))
10960 {
10961 return ConfigGetFloat("itemAttachOffset");
10962 }
10963 return 0;
10964 }
10965
10966 override void SetCleanness(
int value,
bool allow_client =
false)
10967 {
10968 if (!IsServerCheck(allow_client))
10969 return;
10970
10972
10974
10977 }
10978
10980 {
10982 }
10983
10985 {
10986 return true;
10987 }
10988
10989
10990
10991
10993 {
10995 }
10996
10998 {
11000 }
11001
11002
11003
11004
11005 override void SetColor(
int r,
int g,
int b,
int a)
11006 {
11012 }
11014 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11015 {
11020 }
11021
11023 {
11025 }
11026
11029 {
11030 int r,g,b,a;
11032 r = r/255;
11033 g = g/255;
11034 b = b/255;
11035 a = a/255;
11036 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11037 }
11038
11039
11040
11041 override void SetLiquidType(
int value,
bool allow_client =
false)
11042 {
11043 if (!IsServerCheck(allow_client))
11044 return;
11045
11050 }
11051
11053 {
11054 return ConfigGetInt("varLiquidTypeInit");
11055 }
11056
11058 {
11060 }
11061
11063 {
11065 SetFrozen(false);
11066 }
11067
11070 {
11071 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11072 }
11073
11074
11077 {
11078 PlayerBase nplayer;
11079 if (PlayerBase.CastTo(nplayer, player))
11080 {
11082 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11083 }
11084 }
11085
11086
11089 {
11090 PlayerBase nplayer;
11091 if (PlayerBase.CastTo(nplayer,player))
11092 {
11093 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11094 }
11095
11096 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11097
11098 if (HasEnergyManager())
11099 {
11100 GetCompEM().UpdatePlugState();
11101 }
11102 }
11103
11104
11106 {
11107 super.OnPlacementStarted(player);
11108
11110 }
11111
11112 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11113 {
11115 {
11116 m_AdminLog.OnPlacementComplete(player,
this);
11117 }
11118
11119 super.OnPlacementComplete(player, position, orientation);
11120 }
11121
11122
11123
11124
11125
11127 {
11129 {
11130 return true;
11131 }
11132 else
11133 {
11134 return false;
11135 }
11136 }
11137
11138
11140 {
11142 {
11144 }
11145 }
11146
11147
11149 {
11151 }
11152
11154 {
11156 }
11157
11158 override void InsertAgent(
int agent,
float count = 1)
11159 {
11160 if (count < 1)
11161 return;
11162
11164 }
11165
11168 {
11170 }
11171
11172
11174 {
11176 }
11177
11178
11179
11180
11181
11182
11183
11184
11185
11186
11187
11188
11189
11190
11191
11192
11193
11194
11195
11196
11197
11198
11199
11200
11201
11202
11203
11204
11205
11206
11207
11208
11209
11210
11211
11212
11213
11214
11215
11216
11217
11218
11220 {
11222 return false;
11223 return true;
11224 }
11225
11227 {
11228
11230 }
11231
11232
11235 {
11236 super.CheckForRoofLimited(timeTresholdMS);
11237
11238 float time =
g_Game.GetTime();
11239 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11240 {
11241 m_PreviousRoofTestTime = time;
11242 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11243 }
11244 }
11245
11246
11248 {
11250 {
11251 return 0;
11252 }
11253
11254 if (GetInventory().GetAttachmentSlotsCount() != 0)
11255 {
11256 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11257 if (filter)
11258 return filter.GetProtectionLevel(type, false, system);
11259 else
11260 return 0;
11261 }
11262
11263 string subclassPath, entryName;
11264
11265 switch (type)
11266 {
11268 entryName = "biological";
11269 break;
11271 entryName = "chemical";
11272 break;
11273 default:
11274 entryName = "biological";
11275 break;
11276 }
11277
11278 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11279
11280 return g_Game.ConfigGetFloat(subclassPath + entryName);
11281 }
11282
11283
11284
11287 {
11288 if (!IsMagazine())
11290
11292 }
11293
11294
11295
11296
11297
11302 {
11303 return true;
11304 }
11305
11307 {
11309 }
11310
11311
11312
11313
11314
11316 {
11317 if (parent)
11318 {
11319 if (parent.IsInherited(DayZInfected))
11320 return true;
11321
11322 if (!parent.IsRuined())
11323 return true;
11324 }
11325
11326 return true;
11327 }
11328
11330 {
11331 if (!super.CanPutAsAttachment(parent))
11332 {
11333 return false;
11334 }
11335
11336 if (!IsRuined() && !parent.IsRuined())
11337 {
11338 return true;
11339 }
11340
11341 return false;
11342 }
11343
11345 {
11346
11347
11348
11349
11350 return super.CanReceiveItemIntoCargo(item);
11351 }
11352
11354 {
11355
11356
11357
11358
11359 GameInventory attachmentInv = attachment.GetInventory();
11361 {
11362 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11363 return false;
11364 }
11365
11366 InventoryLocation loc = new InventoryLocation();
11367 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11368 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11369 return false;
11370
11371 return super.CanReceiveAttachment(attachment, slotId);
11372 }
11373
11375 {
11376 if (!super.CanReleaseAttachment(attachment))
11377 return false;
11378
11379 return GetInventory().AreChildrenAccessible();
11380 }
11381
11382
11383
11384
11385
11386
11387
11388
11389
11390
11391
11392
11393
11394
11395
11396
11397
11398
11399
11400
11401
11403 {
11404 int id = muzzle_owner.GetMuzzleID();
11405 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11406
11407 if (WPOF_array)
11408 {
11409 for (int i = 0; i < WPOF_array.Count(); i++)
11410 {
11411 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11412
11413 if (WPOF)
11414 {
11415 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11416 }
11417 }
11418 }
11419 }
11420
11421
11423 {
11424 int id = muzzle_owner.GetMuzzleID();
11426
11427 if (WPOBE_array)
11428 {
11429 for (int i = 0; i < WPOBE_array.Count(); i++)
11430 {
11431 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11432
11433 if (WPOBE)
11434 {
11435 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11436 }
11437 }
11438 }
11439 }
11440
11441
11443 {
11444 int id = muzzle_owner.GetMuzzleID();
11445 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11446
11447 if (WPOOH_array)
11448 {
11449 for (int i = 0; i < WPOOH_array.Count(); i++)
11450 {
11451 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11452
11453 if (WPOOH)
11454 {
11455 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11456 }
11457 }
11458 }
11459 }
11460
11461
11463 {
11464 int id = muzzle_owner.GetMuzzleID();
11465 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11466
11467 if (WPOOH_array)
11468 {
11469 for (int i = 0; i < WPOOH_array.Count(); i++)
11470 {
11471 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11472
11473 if (WPOOH)
11474 {
11475 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11476 }
11477 }
11478 }
11479 }
11480
11481
11483 {
11484 int id = muzzle_owner.GetMuzzleID();
11485 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11486
11487 if (WPOOH_array)
11488 {
11489 for (int i = 0; i < WPOOH_array.Count(); i++)
11490 {
11491 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11492
11493 if (WPOOH)
11494 {
11495 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11496 }
11497 }
11498 }
11499 }
11500
11501
11502
11504 {
11506 {
11507 return true;
11508 }
11509
11510 return false;
11511 }
11512
11514 {
11516 {
11517 return true;
11518 }
11519
11520 return false;
11521 }
11522
11524 {
11526 {
11527 return true;
11528 }
11529
11530 return false;
11531 }
11532
11534 {
11535 return false;
11536 }
11537
11540 {
11541 return UATimeSpent.DEFAULT_DEPLOY;
11542 }
11543
11544
11545
11546
11548 {
11550 SetSynchDirty();
11551 }
11552
11554 {
11556 }
11557
11558
11560 {
11561 return false;
11562 }
11563
11566 {
11567 string att_type = "None";
11568
11569 if (ConfigIsExisting("soundAttType"))
11570 {
11571 att_type = ConfigGetString("soundAttType");
11572 }
11573
11575 }
11576
11578 {
11580 }
11581
11582
11583
11584
11585
11591
11593 {
11596
11598 }
11599
11600
11602 {
11604 return;
11605
11607
11610
11613
11614 SoundParameters params = new SoundParameters();
11618 }
11619
11620
11622 {
11624 {
11627
11628 SetSynchDirty();
11629
11632 }
11633 }
11634
11636 {
11638 }
11639
11640
11642 {
11644 return;
11645
11647 SetSynchDirty();
11648
11651 }
11652
11654 {
11657 }
11658
11660 {
11662 }
11663
11664 void OnApply(PlayerBase player);
11665
11667 {
11668 return 1.0;
11669 };
11670
11672 {
11674 }
11675
11677 {
11679 }
11680
11682
11684 {
11685 SetDynamicPhysicsLifeTime(0.01);
11687 }
11688
11690 {
11691 array<string> zone_names = new array<string>;
11692 GetDamageZones(zone_names);
11693 for (int i = 0; i < zone_names.Count(); i++)
11694 {
11695 SetHealthMax(zone_names.Get(i),"Health");
11696 }
11697 SetHealthMax("","Health");
11698 }
11699
11702 {
11703 float global_health = GetHealth01("","Health");
11704 array<string> zones = new array<string>;
11705 GetDamageZones(zones);
11706
11707 for (int i = 0; i < zones.Count(); i++)
11708 {
11709 SetHealth01(zones.Get(i),"Health",global_health);
11710 }
11711 }
11712
11715 {
11716 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11717 }
11718
11720 {
11721 if (!hasRootAsPlayer)
11722 {
11723 if (refParentIB)
11724 {
11725
11726 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11727 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11728
11729 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11730 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11731
11734 }
11735 else
11736 {
11737
11740 }
11741 }
11742 }
11743
11745 {
11747 {
11748 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11749 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11750 {
11751 float heatPermCoef = 1.0;
11753 while (ent)
11754 {
11755 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11756 ent = ent.GetHierarchyParent();
11757 }
11758
11759 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11760 }
11761 }
11762 }
11763
11765 {
11766
11767 EntityAI parent = GetHierarchyParent();
11768 if (!parent)
11769 {
11770 hasParent = false;
11771 hasRootAsPlayer = false;
11772 }
11773 else
11774 {
11775 hasParent = true;
11776 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11777 refParentIB =
ItemBase.Cast(parent);
11778 }
11779 }
11780
11781 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11782 {
11783
11784 }
11785
11787 {
11788
11789 return false;
11790 }
11791
11793 {
11794
11795
11796 return false;
11797 }
11798
11800 {
11801
11802 return false;
11803 }
11804
11807 {
11808 return !GetIsFrozen() &&
IsOpen();
11809 }
11810
11812 {
11813 bool hasParent = false, hasRootAsPlayer = false;
11815
11816 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11817 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11818
11819 if (wwtu || foodDecay)
11820 {
11824
11825 if (processWetness || processTemperature || processDecay)
11826 {
11828
11829 if (processWetness)
11830 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11831
11832 if (processTemperature)
11834
11835 if (processDecay)
11836 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11837 }
11838 }
11839 }
11840
11843 {
11845 }
11846
11848 {
11851
11852 return super.GetTemperatureFreezeThreshold();
11853 }
11854
11856 {
11859
11860 return super.GetTemperatureThawThreshold();
11861 }
11862
11864 {
11867
11868 return super.GetItemOverheatThreshold();
11869 }
11870
11872 {
11874 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11875
11876 return super.GetTemperatureFreezeTime();
11877 }
11878
11880 {
11882 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11883
11884 return super.GetTemperatureThawTime();
11885 }
11886
11891
11893 {
11894 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11895 }
11896
11898 {
11899 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11900 }
11901
11904 {
11906 }
11907
11909 {
11911 }
11912
11914 {
11916 }
11917
11920 {
11921 return null;
11922 }
11923
11926 {
11927 return false;
11928 }
11929
11931 {
11933 {
11936 if (!trg)
11937 {
11939 explosive = this;
11940 }
11941
11942 explosive.PairRemote(trg);
11944
11945 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11946 trg.SetPersistentPairID(persistentID);
11947 explosive.SetPersistentPairID(persistentID);
11948
11949 return true;
11950 }
11951 return false;
11952 }
11953
11956 {
11957 float ret = 1.0;
11960 ret *= GetHealth01();
11961
11962 return ret;
11963 }
11964
11965 #ifdef DEVELOPER
11966 override void SetDebugItem()
11967 {
11968 super.SetDebugItem();
11969 _itemBase = this;
11970 }
11971
11973 {
11974 string text = super.GetDebugText();
11975
11977 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11978
11979 return text;
11980 }
11981 #endif
11982
11984 {
11985 return true;
11986 }
11987
11989
11991
11993 {
11996 }
11997
11998
12006
12022
12023 [
Obsolete(
"Use ItemSoundHandler instead")]
12026 {
12027 if (!
g_Game.IsDedicatedServer())
12028 {
12029 if (ConfigIsExisting("attachSoundSet"))
12030 {
12031 string cfg_path = "";
12032 string soundset = "";
12033 string type_name =
GetType();
12034
12037 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12038 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12039
12040 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12041 {
12042 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12043 {
12044 if (cfg_slot_array[i] == slot_type)
12045 {
12046 soundset = cfg_soundset_array[i];
12047 break;
12048 }
12049 }
12050 }
12051
12052 if (soundset != "")
12053 {
12054 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12056 }
12057 }
12058 }
12059 }
12060
12062}
12063
12065{
12067 if (entity)
12068 {
12069 bool is_item = entity.IsInherited(
ItemBase);
12070 if (is_item && full_quantity)
12071 {
12074 }
12075 }
12076 else
12077 {
12079 return NULL;
12080 }
12081 return entity;
12082}
12083
12085{
12086 if (item)
12087 {
12088 if (health > 0)
12089 item.SetHealth("", "", health);
12090
12091 if (item.CanHaveTemperature())
12092 {
12094 if (item.CanFreeze())
12095 item.SetFrozen(false);
12096 }
12097
12098 if (item.HasEnergyManager())
12099 {
12100 if (quantity >= 0)
12101 {
12102 item.GetCompEM().SetEnergy0To1(quantity);
12103 }
12104 else
12105 {
12107 }
12108 }
12109 else if (item.IsMagazine())
12110 {
12111 Magazine mag = Magazine.Cast(item);
12112 if (quantity >= 0)
12113 {
12114 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12115 }
12116 else
12117 {
12119 }
12120
12121 }
12122 else
12123 {
12124 if (quantity >= 0)
12125 {
12126 item.SetQuantityNormalized(quantity, false);
12127 }
12128 else
12129 {
12131 }
12132
12133 }
12134 }
12135}
12136
12137#ifdef DEVELOPER
12139#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
bool SetAttachSoundEvent()
bool SetDetachSoundEvent()
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 IsPrepareToDelete()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
proto GizmoApi GetGizmoApi()
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
void StartItemSoundServer(int id, int slotId)
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)
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()
override int GetLiquidType()
void ProcessDecay(float delta, bool hasRootAsPlayer)
override bool IsItemBase()
override bool IsTwoHandedBehaviour()
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override void OnEnergyAdded()
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
EffectSound m_DeployLoopSoundEx
override void DeSerializeNumericalVars(array< float > floats)
void StopItemDynamicPhysics()
override void SetStoreLoad(bool value)
float GetOverheatingValue()
bool ContainsAgent(int agent_id)
override void AddWet(float value)
override void EOnContact(IEntity other, Contact extra)
void SplitIntoStackMaxHands(PlayerBase player)
void SplitIntoStackMaxHandsClient(PlayerBase player)
ref Timer m_PhysDropTimer
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
override void SetStoreLoadedQuantity(float value)
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
void OnLiquidTypeChanged(int oldType, int newType)
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void PlayDeployFinishSound()
bool AllowFoodConsumption()
bool m_IsOverheatingEffectActive
int m_LiquidContainerMask
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override int GetCleanness()
bool PairWithDevice(notnull ItemBase otherDevice)
static void RemoveDebugActionsMask(int mask)
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void PerformDamageSystemReinit()
override void ClearInventory()
static int m_LastRegisteredWeaponID
ItemBase GetLightSourceItem()
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
override float GetItemOverheatThreshold()
void StopDeployLoopSoundEx()
override void SerializeNumericalVars(array< float > floats_out)
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)
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 EntityAI GetAttachmentFromIndex(int index)
proto native bool GetCurrentInventoryLocation(out notnull InventoryLocation loc)
returns information about current item location
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
static proto native EntityAI LocationCreateEntity(notnull InventoryLocation inv_loc, string type, int iSetupFlags, int iRotation)
creates new item directly at location
proto native int AttachmentCount()
Returns count of attachments attached to this item.
proto native bool FindFreeLocationFor(notnull EntityAI item, FindInventoryLocationType flags, out notnull InventoryLocation loc)
FindFreeLocationFor.
proto void SelectObject(Object object)
proto void SelectPhysics(Physics physics)
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 bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
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
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
void Obsolete(string msg="")
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
vector GetPosition()
Get the world position of the Effect.
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.