7174{
7176 {
7177 return true;
7178 }
7179};
7180
7182{
7183
7184};
7185
7186
7187
7189{
7193
7195
7198
7199
7200
7201
7202
7211
7217
7222
7227
7248 protected bool m_IsResultOfSplit
7249
7251
7256
7257
7258
7260
7264
7265
7266
7268
7271
7272
7273
7279
7280
7288
7291
7292
7294
7295
7297
7298
7303
7304
7309
7311
7312
7314
7315
7317 {
7322
7323 if (!
g_Game.IsDedicatedServer())
7324 {
7326 {
7328
7330 {
7332 }
7333 }
7334
7337 }
7338
7339 m_OldLocation = null;
7340
7342 {
7344 }
7345
7346 if (ConfigIsExisting("headSelectionsToHide"))
7347 {
7350 }
7351
7353 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7354 {
7356 }
7357
7359
7360 m_IsResultOfSplit = false;
7361
7363 }
7364
7366 {
7367 super.InitItemVariables();
7368
7374 m_Count = ConfigGetInt(
"count");
7375
7378
7383
7386
7391
7403
7407
7408
7411 if (ConfigIsExisting("canBeSplit"))
7412 {
7415 }
7416
7418 if (ConfigIsExisting("itemBehaviour"))
7420
7421
7424 RegisterNetSyncVariableInt("m_VarLiquidType");
7425 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7426
7427 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7428 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7429 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7430
7431 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7432 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7433 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7434 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7435
7436 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7437 RegisterNetSyncVariableBool("m_IsTakeable");
7438 RegisterNetSyncVariableBool("m_IsHologram");
7439
7442 {
7445 RegisterNetSyncVariableInt(
"m_SoundSyncSlotID",
int.
MIN,
int.
MAX);
7446 }
7447
7449
7451 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7453
7455 }
7456
7458 {
7460 }
7461
7463 {
7466 {
7471 }
7472 }
7473
7474 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7475 {
7477 {
7480 }
7481
7483 }
7484
7486 {
7492 }
7493
7495
7497 {
7499
7500 if (!action)
7501 {
7502 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7503 return;
7504 }
7505
7507 if (!ai)
7508 {
7510 return;
7511 }
7512
7514 if (!action_array)
7515 {
7516 action_array = new array<ActionBase_Basic>;
7518 }
7519 if (LogManager.IsActionLogEnable())
7520 {
7521 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7522 }
7523
7524 if (action_array.Find(action) != -1)
7525 {
7526 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7527 }
7528 else
7529 {
7530 action_array.Insert(action);
7531 }
7532 }
7533
7535 {
7536 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7537 ActionBase action = player.GetActionManager().GetAction(actionName);
7540
7541 if (action_array)
7542 {
7543 action_array.RemoveItem(action);
7544 }
7545 }
7546
7547
7548
7550 {
7551 ActionOverrideData overrideData = new ActionOverrideData();
7555
7557 if (!actionMap)
7558 {
7561 }
7562
7563 actionMap.Insert(this.
Type(), overrideData);
7564
7565 }
7566
7568
7570
7571
7573 {
7576
7579
7580 string config_to_search = "CfgVehicles";
7581 string muzzle_owner_config;
7582
7584 {
7585 if (IsInherited(Weapon))
7586 config_to_search = "CfgWeapons";
7587
7588 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7589
7590 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7591
7592 int config_OnFire_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnFire_class);
7593
7594 if (config_OnFire_subclass_count > 0)
7595 {
7596 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7597
7598 for (int i = 0; i < config_OnFire_subclass_count; i++)
7599 {
7600 string particle_class = "";
7601 g_Game.ConfigGetChildName(config_OnFire_class, i, particle_class);
7602 string config_OnFire_entry = config_OnFire_class + particle_class;
7603 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7604 WPOF_array.Insert(WPOF);
7605 }
7606
7607
7609 }
7610 }
7611
7613 {
7614 config_to_search = "CfgWeapons";
7615 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7616
7617 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7618
7619 int config_OnBulletCasingEject_count =
g_Game.ConfigGetChildrenCount(config_OnBulletCasingEject_class);
7620
7621 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7622 {
7623 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7624
7625 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7626 {
7627 string particle_class2 = "";
7628 g_Game.ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
7629 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7630 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7631 WPOBE_array.Insert(WPOBE);
7632 }
7633
7634
7636 }
7637 }
7638 }
7639
7640
7642 {
7645
7647 {
7648 string config_to_search = "CfgVehicles";
7649
7650 if (IsInherited(Weapon))
7651 config_to_search = "CfgWeapons";
7652
7653 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7654 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7655
7656 if (
g_Game.ConfigIsExisting(config_OnOverheating_class))
7657 {
7658
7660
7662 {
7664 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7666 return;
7667 }
7668
7671
7672
7673
7674 int config_OnOverheating_subclass_count =
g_Game.ConfigGetChildrenCount(config_OnOverheating_class);
7675 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7676
7677 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7678 {
7679 string particle_class = "";
7680 g_Game.ConfigGetChildName(config_OnOverheating_class, i, particle_class);
7681 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7682 int entry_type =
g_Game.ConfigGetType(config_OnOverheating_entry);
7683
7684 if (entry_type == CT_CLASS)
7685 {
7686 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7687 WPOOH_array.Insert(WPOF);
7688 }
7689 }
7690
7691
7693 }
7694 }
7695 }
7696
7698 {
7700 }
7701
7703 {
7705 {
7707
7710
7713
7714 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7715 }
7716 }
7717
7719 {
7721 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7722
7724 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7725
7727 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7728
7730 {
7732 }
7733 }
7734
7736 {
7738 }
7739
7741 {
7744 else
7746
7748 {
7751 }
7752 else
7753 {
7756
7759 }
7760
7762 }
7763
7765 {
7767 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7768 }
7769
7771 {
7773 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7775 }
7776
7778 {
7780 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7781 }
7782
7784 {
7787
7788 OverheatingParticle OP = new OverheatingParticle();
7793
7795 }
7796
7798 {
7801
7802 return -1;
7803 }
7804
7806 {
7808 {
7811
7812 for (int i = count; i > 0; --i)
7813 {
7814 int id = i - 1;
7817
7820
7821 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7822 {
7823 if (p)
7824 {
7827 }
7828 }
7829 }
7830 }
7831 }
7832
7834 {
7836 {
7838 {
7839 int id = i - 1;
7841
7842 if (OP)
7843 {
7845
7846 if (p)
7847 {
7849 }
7850
7851 delete OP;
7852 }
7853 }
7854
7857 }
7858 }
7859
7862 {
7863 return 0.0;
7864 }
7865
7866
7868 {
7869 return 250;
7870 }
7871
7873 {
7874 return 0;
7875 }
7876
7879 {
7881 return true;
7882
7883 return false;
7884 }
7885
7888 {
7891
7893 {
7895 }
7896 else
7897 {
7898
7900 }
7901
7903 }
7904
7911 {
7912 return -1;
7913 }
7914
7915
7916
7917
7919 {
7921 {
7922 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
7923 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7924
7925 if (r_index >= 0)
7926 {
7927 InventoryLocation r_il = new InventoryLocation;
7928 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7929
7930 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7933 {
7934 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7935 }
7937 {
7938 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7939 }
7940
7941 }
7942
7943 player.GetHumanInventory().ClearUserReservedLocation(this);
7944 }
7945
7948 }
7949
7950
7951
7952
7954 {
7955 return ItemBase.m_DebugActionsMask;
7956 }
7957
7959 {
7960 return ItemBase.m_DebugActionsMask & mask;
7961 }
7962
7964 {
7965 ItemBase.m_DebugActionsMask = mask;
7966 }
7967
7969 {
7970 ItemBase.m_DebugActionsMask |= mask;
7971 }
7972
7974 {
7975 ItemBase.m_DebugActionsMask &= ~mask;
7976 }
7977
7979 {
7981 {
7983 }
7984 else
7985 {
7987 }
7988 }
7989
7990
7992 {
7993 if (GetEconomyProfile())
7994 {
7995 float q_max = GetEconomyProfile().GetQuantityMax();
7996 if (q_max > 0)
7997 {
7998 float q_min = GetEconomyProfile().GetQuantityMin();
7999 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
8000
8002 {
8003 ComponentEnergyManager comp = GetCompEM();
8005 {
8007 }
8008 }
8010 {
8012
8013 }
8014
8015 }
8016 }
8017 }
8018
8021 {
8022 EntityAI parent = GetHierarchyParent();
8023
8024 if (parent)
8025 {
8026 InventoryLocation inventory_location_to_lock = new InventoryLocation;
8027 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
8028 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
8029 }
8030 }
8031
8034 {
8035 EntityAI parent = GetHierarchyParent();
8036
8037 if (parent)
8038 {
8039 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
8040 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
8041 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
8042 }
8043 }
8044
8046 {
8047
8048
8049
8050
8052
8054 {
8055 if (ScriptInputUserData.CanStoreInputUserData())
8056 {
8057 ScriptInputUserData ctx = new ScriptInputUserData;
8063 ctx.
Write(use_stack_max);
8066
8068 {
8069 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
8070 }
8071 }
8072 }
8073 else if (!
g_Game.IsMultiplayer())
8074 {
8076 }
8077 }
8078
8080 {
8082 }
8083
8085 {
8087 }
8088
8090 {
8092 }
8093
8095 {
8096
8097 return false;
8098 }
8099
8101 {
8102 return false;
8103 }
8104
8108 {
8109 return false;
8110 }
8111
8113 {
8114 return "";
8115 }
8116
8118
8120 {
8121 return false;
8122 }
8123
8125 {
8126 return true;
8127 }
8128
8129
8130
8132 {
8133 return true;
8134 }
8135
8137 {
8138 return true;
8139 }
8140
8142 {
8143 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8145 }
8146
8148 {
8150 }
8151
8153 {
8155 if (!is_being_placed)
8157 SetSynchDirty();
8158 }
8159
8160
8162
8164 {
8166 }
8167
8169 {
8171 }
8172
8174 {
8175 return 1;
8176 }
8177
8179 {
8180 return false;
8181 }
8182
8184 {
8186 SetSynchDirty();
8187 }
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8215
8216
8217
8218
8219
8220
8221
8222
8224 {
8225 super.OnMovedInsideCargo(container);
8226
8227 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8228 }
8229
8230 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8231 {
8232 super.EEItemLocationChanged(oldLoc, newLoc);
8233
8234 PlayerBase newPlayer = null;
8235 PlayerBase oldPlayer = null;
8236
8237 if (newLoc.GetParent())
8238 newPlayer = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8239
8240 if (oldLoc.GetParent())
8241 oldPlayer = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8242
8244 {
8245 int rIndex = oldPlayer.GetHumanInventory().FindUserReservedLocationIndex(this);
8246
8247 if (rIndex >= 0)
8248 {
8249 InventoryLocation rIl = new InventoryLocation;
8250 oldPlayer.GetHumanInventory().GetUserReservedLocation(rIndex, rIl);
8251
8252 oldPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(rIndex);
8255 {
8256 rIl.
GetParent().GetOnReleaseLock().Invoke(
this);
8257 }
8259 {
8261 }
8262
8263 }
8264 }
8265
8267 {
8268 if (newPlayer)
8269 newPlayer.ForceStandUpForHeavyItems(newLoc.GetItem());
8270
8271 if (newPlayer == oldPlayer)
8272 {
8273 if (oldLoc.GetParent() && newPlayer.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8274 {
8276 {
8277 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8278 {
8279 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8280 }
8281 }
8282 else
8283 {
8284 newPlayer.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8285 }
8286 }
8287
8288 if (newPlayer.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8289 {
8290 int type = oldLoc.GetType();
8292 {
8293 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8294 }
8296 {
8297 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8298 }
8299 }
8300 if (!m_OldLocation)
8301 {
8302 m_OldLocation = new InventoryLocation;
8303 }
8304 m_OldLocation.Copy(oldLoc);
8305 }
8306 else
8307 {
8308 if (m_OldLocation)
8309 {
8310 m_OldLocation.Reset();
8311 }
8312 }
8313
8314 g_Game.GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
8315 }
8316 else
8317 {
8318 if (newPlayer)
8319 {
8320 int resIndex = newPlayer.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8321 if (resIndex >= 0)
8322 {
8323 InventoryLocation il = new InventoryLocation;
8324 newPlayer.GetHumanInventory().GetUserReservedLocation(resIndex, il);
8326 newPlayer.GetHumanInventory().ClearUserReservedLocationAtIndex(resIndex);
8329 {
8330 il.
GetParent().GetOnReleaseLock().Invoke(it);
8331 }
8333 {
8335 }
8336
8337 }
8338 }
8340 {
8341
8343 }
8344
8345 if (m_OldLocation)
8346 {
8347 m_OldLocation.Reset();
8348 }
8349 }
8350
8352 {
8353 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Remove(oldLoc.GetItem());
8354 }
8355
8357 {
8358 PluginInventoryRepair.Cast(
GetPlugin(PluginInventoryRepair)).Add(oldLoc.GetItem());
8359 }
8360 }
8361
8362 override void EOnContact(IEntity other, Contact extra)
8363 {
8365 {
8366 int liquidType = -1;
8368 if (impactSpeed > 0.0)
8369 {
8371 #ifndef SERVER
8373 #else
8375 SetSynchDirty();
8376 #endif
8378 }
8379 }
8380
8381 #ifdef SERVER
8382 if (GetCompEM() && GetCompEM().IsPlugged())
8383 {
8384 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8385 GetCompEM().UnplugThis();
8386 }
8387 #endif
8388 }
8389
8391
8393 {
8395 }
8396
8398 {
8399
8400 }
8401
8403 {
8404 super.OnItemLocationChanged(old_owner, new_owner);
8405
8406 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8407 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8408
8409 if (!relatedPlayer && playerNew)
8410 relatedPlayer = playerNew;
8411
8412 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8413 {
8415 if (actionMgr)
8416 {
8417 ActionBase currentAction = actionMgr.GetRunningAction();
8418 if (currentAction)
8420 }
8421 }
8422
8423 Man ownerPlayerOld = null;
8424 Man ownerPlayerNew = null;
8425
8426 if (old_owner)
8427 {
8428 if (old_owner.
IsMan())
8429 {
8430 ownerPlayerOld = Man.Cast(old_owner);
8431 }
8432 else
8433 {
8434 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8435 }
8436 }
8437 else
8438 {
8440 {
8442
8443 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8444 {
8445 GetCompEM().UnplugThis();
8446 }
8447 }
8448 }
8449
8450 if (new_owner)
8451 {
8452 if (new_owner.
IsMan())
8453 {
8454 ownerPlayerNew = Man.Cast(new_owner);
8455 }
8456 else
8457 {
8458 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8459 }
8460 }
8461
8462 if (ownerPlayerOld != ownerPlayerNew)
8463 {
8464 if (ownerPlayerOld)
8465 {
8466 array<EntityAI> subItemsExit = new array<EntityAI>;
8468 for (int i = 0; i < subItemsExit.Count(); i++)
8469 {
8472 }
8473 }
8474
8475 if (ownerPlayerNew)
8476 {
8477 array<EntityAI> subItemsEnter = new array<EntityAI>;
8479 for (int j = 0; j < subItemsEnter.Count(); j++)
8480 {
8483 }
8484 }
8485 }
8486 else if (ownerPlayerNew != null)
8487 {
8488 PlayerBase nplayer;
8489 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8490 {
8491 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8493 for (int k = 0; k < subItemsUpdate.Count(); k++)
8494 {
8496 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8497 }
8498 }
8499 }
8500
8501 if (old_owner)
8502 old_owner.OnChildItemRemoved(this);
8503 if (new_owner)
8504 new_owner.OnChildItemReceived(this);
8505 }
8506
8507
8509 {
8510 super.EEDelete(parent);
8511 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8512 if (player)
8513 {
8515
8516 if (player.IsAlive())
8517 {
8518 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8519 if (r_index >= 0)
8520 {
8521 InventoryLocation r_il = new InventoryLocation;
8522 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8523
8524 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8527 {
8528 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8529 }
8531 {
8532 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8533 }
8534
8535 }
8536
8537 player.RemoveQuickBarEntityShortcut(this);
8538 }
8539 }
8540 }
8541
8543 {
8544 super.EEKilled(killer);
8545
8548 {
8549 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8550 {
8551 if (IsMagazine())
8552 {
8553 if (Magazine.Cast(this).GetAmmoCount() > 0)
8554 {
8556 }
8557 }
8558 else
8559 {
8561 }
8562 }
8563 }
8564 }
8565
8567 {
8568 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8569
8570 super.OnWasAttached(parent, slot_id);
8571
8574
8577 }
8578
8580 {
8581 super.OnWasDetached(parent, slot_id);
8582
8585
8588 }
8589
8591 {
8592 int idx;
8595
8596 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8597 if (inventory_slots.Count() < 1)
8598 {
8599 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8600 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8601 }
8602 else
8603 {
8604 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8605 }
8606
8607 idx = inventory_slots.Find(slot);
8608 if (idx < 0)
8609 return "";
8610
8611 return attach_types.Get(idx);
8612 }
8613
8615 {
8616 int idx = -1;
8617 string slot;
8618
8621
8622 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8623 if (inventory_slots.Count() < 1)
8624 {
8625 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8626 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8627 }
8628 else
8629 {
8630 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8631 if (detach_types.Count() < 1)
8632 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8633 }
8634
8635 for (int i = 0; i < inventory_slots.Count(); i++)
8636 {
8637 slot = inventory_slots.Get(i);
8638 }
8639
8640 if (slot != "")
8641 {
8642 if (detach_types.Count() == 1)
8643 idx = 0;
8644 else
8645 idx = inventory_slots.Find(slot);
8646 }
8647 if (idx < 0)
8648 return "";
8649
8650 return detach_types.Get(idx);
8651 }
8652
8654 {
8655
8657
8658
8659 float min_time = 1;
8660 float max_time = 3;
8661 float delay = Math.RandomFloat(min_time, max_time);
8662
8663 explode_timer.Run(delay, this, "DoAmmoExplosion");
8664 }
8665
8667 {
8668 Magazine magazine = Magazine.Cast(this);
8669 int pop_sounds_count = 6;
8670 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8671
8672
8673 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8674 string sound_name = pop_sounds[ sound_idx ];
8675 g_Game.CreateSoundOnObject(
this, sound_name, 20,
false);
8676
8677
8678 magazine.ServerAddAmmoCount(-1);
8679
8680
8681 float min_temp_to_explode = 100;
8682
8683 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8684 {
8686 }
8687 }
8688
8689
8690 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8691 {
8692 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8693
8694 const int CHANCE_DAMAGE_CARGO = 4;
8695 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8696 const int CHANCE_DAMAGE_NOTHING = 2;
8697
8699 {
8700 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8701 int chances;
8702 int rnd;
8703
8704 if (GetInventory().GetCargo())
8705 {
8706 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8707 rnd = Math.RandomInt(0,chances);
8708
8709 if (rnd < CHANCE_DAMAGE_CARGO)
8710 {
8712 }
8713 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8714 {
8716 }
8717 }
8718 else
8719 {
8720 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8721 rnd = Math.RandomInt(0,chances);
8722
8723 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8724 {
8726 }
8727 }
8728 }
8729 }
8730
8732 {
8733 CargoBase cargo = GetInventory().GetCargo();
8734 if (cargo)
8735 {
8737 if (item_count > 0)
8738 {
8739 int random_pick = Math.RandomInt(0, item_count);
8741 if (!item.IsExplosive())
8742 {
8743 item.AddHealth("","",damage);
8744 return true;
8745 }
8746 }
8747 }
8748 return false;
8749 }
8750
8752 {
8753 GameInventory inventory = GetInventory();
8755 if (attachment_count > 0)
8756 {
8757 int random_pick = Math.RandomInt(0, attachment_count);
8759 if (!attachment.IsExplosive())
8760 {
8761 attachment.AddHealth("","",damage);
8762 return true;
8763 }
8764 }
8765 return false;
8766 }
8767
8769 {
8771 }
8772
8774 {
8776 return GetInventory().CanRemoveEntity();
8777
8778 return false;
8779 }
8780
8782 {
8783
8785 return false;
8786
8787
8789 return false;
8790
8791
8792
8794 if (delta == 0)
8795 return false;
8796
8797
8798 return true;
8799 }
8800
8802 {
8804 {
8805 if (ScriptInputUserData.CanStoreInputUserData())
8806 {
8807 ScriptInputUserData ctx = new ScriptInputUserData;
8812 ctx.
Write(destination_entity);
8816 }
8817 }
8818 else if (!
g_Game.IsMultiplayer())
8819 {
8821 }
8822 }
8823
8825 {
8826 float split_quantity_new;
8830 InventoryLocation loc = new InventoryLocation;
8831
8832 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8833 {
8835 split_quantity_new = stack_max;
8836 else
8838
8840 {
8841 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8842 if (new_item)
8843 {
8844 new_item.SetResultOfSplit(true);
8845 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8847 new_item.
SetQuantity(split_quantity_new,
false,
true);
8848 }
8849 }
8850 }
8851 else if (destination_entity && slot_id == -1)
8852 {
8853 if (quantity > stack_max)
8854 split_quantity_new = stack_max;
8855 else
8856 split_quantity_new = quantity;
8857
8859 {
8860 GameInventory destinationInventory = destination_entity.GetInventory();
8862 {
8865 }
8866
8867 if (new_item)
8868 {
8869 new_item.SetResultOfSplit(true);
8870 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8872 new_item.
SetQuantity(split_quantity_new,
false,
true);
8873 }
8874 }
8875 }
8876 else
8877 {
8878 if (stack_max != 0)
8879 {
8881 {
8883 }
8884
8885 if (split_quantity_new == 0)
8886 {
8887 if (!
g_Game.IsMultiplayer())
8888 player.PhysicalPredictiveDropItem(this);
8889 else
8890 player.ServerDropEntity(this);
8891 return;
8892 }
8893
8895 {
8897
8898 if (new_item)
8899 {
8900 new_item.SetResultOfSplit(true);
8901 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8904 new_item.PlaceOnSurface();
8905 }
8906 }
8907 }
8908 }
8909 }
8910
8912 {
8913 float split_quantity_new;
8917 InventoryLocation loc = new InventoryLocation;
8918
8919 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8920 {
8922 split_quantity_new = stack_max;
8923 else
8925
8927 {
8928 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8929 if (new_item)
8930 {
8931 new_item.SetResultOfSplit(true);
8932 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8934 new_item.
SetQuantity(split_quantity_new,
false,
true);
8935 }
8936 }
8937 }
8938 else if (destination_entity && slot_id == -1)
8939 {
8940 if (quantity > stack_max)
8941 split_quantity_new = stack_max;
8942 else
8943 split_quantity_new = quantity;
8944
8946 {
8947 GameInventory destinationInventory = destination_entity.GetInventory();
8949 {
8952 }
8953
8954 if (new_item)
8955 {
8956 new_item.SetResultOfSplit(true);
8957 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8959 new_item.
SetQuantity(split_quantity_new,
false,
true);
8960 }
8961 }
8962 }
8963 else
8964 {
8965 if (stack_max != 0)
8966 {
8968 {
8970 }
8971
8973 {
8975
8976 if (new_item)
8977 {
8978 new_item.SetResultOfSplit(true);
8979 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8982 new_item.PlaceOnSurface();
8983 }
8984 }
8985 }
8986 }
8987 }
8988
8990 {
8992 {
8993 if (ScriptInputUserData.CanStoreInputUserData())
8994 {
8995 ScriptInputUserData ctx = new ScriptInputUserData;
9000 dst.WriteToContext(ctx);
9002 }
9003 }
9004 else if (!
g_Game.IsMultiplayer())
9005 {
9007 }
9008 }
9009
9011 {
9013 {
9014 if (ScriptInputUserData.CanStoreInputUserData())
9015 {
9016 ScriptInputUserData ctx = new ScriptInputUserData;
9021 ctx.
Write(destination_entity);
9027 }
9028 }
9029 else if (!
g_Game.IsMultiplayer())
9030 {
9032 }
9033 }
9034
9036 {
9038 }
9039
9041 {
9043 float split_quantity_new;
9045 if (dst.IsValid())
9046 {
9047 int slot_id = dst.GetSlot();
9049
9050 if (quantity > stack_max)
9051 split_quantity_new = stack_max;
9052 else
9053 split_quantity_new = quantity;
9054
9056 {
9058
9059 if (new_item)
9060 {
9061 new_item.SetResultOfSplit(true);
9062 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9064 new_item.
SetQuantity(split_quantity_new,
false,
true);
9065 }
9066
9067 return new_item;
9068 }
9069 }
9070
9071 return null;
9072 }
9073
9075 {
9077 float split_quantity_new;
9079 if (destination_entity)
9080 {
9082 if (quantity > stackable)
9083 split_quantity_new = stackable;
9084 else
9085 split_quantity_new = quantity;
9086
9088 {
9089 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
9090 if (new_item)
9091 {
9092 new_item.SetResultOfSplit(true);
9093 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9095 new_item.
SetQuantity(split_quantity_new,
false,
true);
9096 }
9097 }
9098 }
9099 }
9100
9102 {
9104 {
9105 if (ScriptInputUserData.CanStoreInputUserData())
9106 {
9107 ScriptInputUserData ctx = new ScriptInputUserData;
9112 ItemBase destination_entity =
this;
9113 ctx.
Write(destination_entity);
9117 }
9118 }
9119 else if (!
g_Game.IsMultiplayer())
9120 {
9122 }
9123 }
9124
9126 {
9128 float split_quantity_new;
9130 if (player)
9131 {
9133 if (quantity > stackable)
9134 split_quantity_new = stackable;
9135 else
9136 split_quantity_new = quantity;
9137
9139 {
9140 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9141 new_item =
ItemBase.Cast(in_hands);
9142 if (new_item)
9143 {
9144 new_item.SetResultOfSplit(true);
9145 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9147 new_item.SetQuantity(split_quantity_new, false, true);
9148 }
9149 }
9150 }
9151 }
9152
9154 {
9156 float split_quantity_new = Math.Floor(quantity * 0.5);
9157
9159 return;
9160
9162
9163 if (new_item)
9164 {
9165 if (new_item.GetQuantityMax() < split_quantity_new)
9166 {
9167 split_quantity_new = new_item.GetQuantityMax();
9168 }
9169
9170 new_item.SetResultOfSplit(true);
9171 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9172
9174 {
9177 }
9178 else
9179 {
9181 new_item.
SetQuantity(split_quantity_new,
false,
true);
9182 }
9183 }
9184 }
9185
9187 {
9189 float split_quantity_new = Math.Floor(quantity / 2);
9190
9192 return;
9193
9194 InventoryLocation invloc = new InventoryLocation;
9196
9198 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9199
9200 if (new_item)
9201 {
9202 if (new_item.GetQuantityMax() < split_quantity_new)
9203 {
9204 split_quantity_new = new_item.GetQuantityMax();
9205 }
9207 {
9210 }
9211 else if (split_quantity_new > 1)
9212 {
9214 new_item.
SetQuantity(split_quantity_new,
false,
true);
9215 }
9216 }
9217 }
9218
9221 {
9222 SetWeightDirty();
9224
9225 if (parent)
9226 parent.OnAttachmentQuantityChangedEx(this, delta);
9227
9229 {
9231 {
9233 }
9235 {
9236 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9238 }
9239 }
9240 }
9241
9244 {
9245
9246 }
9247
9250 {
9252 }
9253
9255 {
9256 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9257
9259 {
9260 if (newLevel == GameConstants.STATE_RUINED)
9261 {
9263 EntityAI parent = GetHierarchyParent();
9264 if (parent && parent.IsFireplace())
9265 {
9266 CargoBase cargo = GetInventory().GetCargo();
9267 if (cargo)
9268 {
9270 {
9272 }
9273 }
9274 }
9275 }
9276
9278 {
9279
9281 return;
9282 }
9283
9284 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9285 {
9287 }
9288 }
9289 }
9290
9291
9293 {
9294 super.OnRightClick();
9295
9297 {
9299 {
9300 if (ScriptInputUserData.CanStoreInputUserData())
9301 {
9302 EntityAI root = GetHierarchyRoot();
9303 Man playerOwner = GetHierarchyRootPlayer();
9304 InventoryLocation dst = new InventoryLocation;
9305
9306
9307 if (!playerOwner && root && root == this)
9308 {
9310 }
9311 else
9312 {
9313
9314 GetInventory().GetCurrentInventoryLocation(dst);
9316 {
9317 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
9319 {
9321 }
9322 else
9323 {
9325
9326
9327 if (
g_Game.GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9328 {
9330 }
9331 else
9332 {
9333 g_Game.GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9334 }
9335 }
9336 }
9337 }
9338
9339 ScriptInputUserData ctx = new ScriptInputUserData;
9347 }
9348 }
9349 else if (!
g_Game.IsMultiplayer())
9350 {
9352 }
9353 }
9354 }
9355
9357 {
9358 if (root)
9359 {
9360 vector m4[4];
9361 root.GetTransform(m4);
9362 dst.SetGround(this, m4);
9363 }
9364 else
9365 {
9366 GetInventory().GetCurrentInventoryLocation(dst);
9367 }
9368 }
9369
9370 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9371 {
9372
9373 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9374 return false;
9375
9376 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9377 return false;
9378
9379
9381 return false;
9382
9383
9384 Magazine mag = Magazine.Cast(this);
9385 if (mag)
9386 {
9387 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9388 return false;
9389
9390 if (stack_max_limit)
9391 {
9392 Magazine other_mag = Magazine.Cast(other_item);
9393 if (other_item)
9394 {
9395 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9396 return false;
9397 }
9398
9399 }
9400 }
9401 else
9402 {
9403
9405 return false;
9406
9408 return false;
9409 }
9410
9411 PlayerBase player = null;
9412 if (CastTo(player, GetHierarchyRootPlayer()))
9413 {
9414 if (player.GetInventory().HasAttachment(this))
9415 return false;
9416
9417 if (player.IsItemsToDelete())
9418 return false;
9419 }
9420
9421 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9422 return false;
9423
9424 int slotID;
9426 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9427 return false;
9428
9429 return true;
9430 }
9431
9433 {
9435 }
9436
9438 {
9439 return m_IsResultOfSplit;
9440 }
9441
9443 {
9444 m_IsResultOfSplit = value;
9445 }
9446
9448 {
9450 }
9451
9453 {
9454 float other_item_quantity = other_item.GetQuantity();
9455 float this_free_space;
9456
9458
9460
9461 if (other_item_quantity > this_free_space)
9462 {
9463 return this_free_space;
9464 }
9465 else
9466 {
9467 return other_item_quantity;
9468 }
9469 }
9470
9472 {
9474 }
9475
9477 {
9479 return;
9480
9481 if (!IsMagazine() && other_item)
9482 {
9484 if (quantity_used != 0)
9485 {
9486 float hp1 = GetHealth01("","");
9487 float hp2 = other_item.GetHealth01("","");
9488 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9489 hpResult = hpResult / (
GetQuantity() + quantity_used);
9490
9491 hpResult *= GetMaxHealth();
9492 Math.Round(hpResult);
9493 SetHealth("", "Health", hpResult);
9494
9496 other_item.AddQuantity(-quantity_used);
9497 }
9498 }
9500 }
9501
9503 {
9504 #ifdef SERVER
9505 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9506 GetHierarchyParent().IncreaseLifetimeUp();
9507 #endif
9508 };
9509
9511 {
9512 PlayerBase p = PlayerBase.Cast(player);
9513
9514 array<int> recipesIds = p.m_Recipes;
9515 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9516 if (moduleRecipesManager)
9517 {
9518 EntityAI itemInHands = player.GetEntityInHands();
9519 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9520 }
9521
9522 for (int i = 0;i < recipesIds.Count(); i++)
9523 {
9524 int key = recipesIds.Get(i);
9525 string recipeName = moduleRecipesManager.GetRecipeName(key);
9527 }
9528 }
9529
9530
9531 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9532 {
9533 super.GetDebugActions(outputList);
9534
9535
9541
9542
9547
9552
9553
9557
9558
9560 {
9564 }
9565
9568
9569
9573
9575
9576 InventoryLocation loc = new InventoryLocation();
9577 GetInventory().GetCurrentInventoryLocation(loc);
9579 {
9580 if (Gizmo_IsSupported())
9583 }
9584
9586 }
9587
9588
9589
9590
9592 {
9593 super.OnAction(action_id, player, ctx);
9594
9596 {
9597 switch (action_id)
9598 {
9602 return true;
9606 return true;
9607 }
9608 }
9609
9611 {
9612 switch (action_id)
9613 {
9615 Delete();
9616 return true;
9617 }
9618 }
9619
9620 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9621 {
9622 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9623 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9624 PlayerBase p = PlayerBase.Cast(player);
9625 if (
EActions.RECIPES_RANGE_START < 1000)
9626 {
9627 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9628 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9629 }
9630 }
9631 #ifndef SERVER
9632 else if (action_id ==
EActions.WATCH_PLAYER)
9633 {
9634 PluginDeveloper.SetDeveloperItemClientEx(player);
9635 }
9636 #endif
9638 {
9639 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9640 {
9641 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9642 OnDebugButtonPressServer(id + 1);
9643 }
9644
9645 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9646 {
9647 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9649 }
9650
9651 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9652 {
9653 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9655 }
9656
9657 else if (action_id ==
EActions.ADD_QUANTITY)
9658 {
9659 if (IsMagazine())
9660 {
9661 Magazine mag = Magazine.Cast(this);
9662 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9663 }
9664 else
9665 {
9667 }
9668
9669 if (m_EM)
9670 {
9671 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9672 }
9673
9674 }
9675
9676 else if (action_id ==
EActions.REMOVE_QUANTITY)
9677 {
9678 if (IsMagazine())
9679 {
9680 Magazine mag2 = Magazine.Cast(this);
9681 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9682 }
9683 else
9684 {
9686 }
9687 if (m_EM)
9688 {
9689 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9690 }
9691
9692 }
9693
9694 else if (action_id ==
EActions.SET_QUANTITY_0)
9695 {
9697
9698 if (m_EM)
9699 {
9700 m_EM.SetEnergy(0);
9701 }
9702 }
9703
9704 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9705 {
9707
9708 if (m_EM)
9709 {
9710 m_EM.SetEnergy(m_EM.GetEnergyMax());
9711 }
9712 }
9713
9714 else if (action_id ==
EActions.ADD_HEALTH)
9715 {
9716 AddHealth("","",GetMaxHealth("","Health")/5);
9717 }
9718 else if (action_id ==
EActions.REMOVE_HEALTH)
9719 {
9720 AddHealth("","",-GetMaxHealth("","Health")/5);
9721 }
9722 else if (action_id ==
EActions.DESTROY_HEALTH)
9723 {
9724 SetHealth01("","",0);
9725 }
9726 else if (action_id ==
EActions.WATCH_ITEM)
9727 {
9729 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9730 #ifdef DEVELOPER
9731 SetDebugDeveloper_item(this);
9732 #endif
9733 }
9734
9735 else if (action_id ==
EActions.ADD_TEMPERATURE)
9736 {
9737 AddTemperature(20);
9738
9739 }
9740
9741 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9742 {
9743 AddTemperature(-20);
9744
9745 }
9746
9747 else if (action_id ==
EActions.FLIP_FROZEN)
9748 {
9749 SetFrozen(!GetIsFrozen());
9750
9751 }
9752
9753 else if (action_id ==
EActions.ADD_WETNESS)
9754 {
9756
9757 }
9758
9759 else if (action_id ==
EActions.REMOVE_WETNESS)
9760 {
9762
9763 }
9764
9765 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9766 {
9769
9770
9771 }
9772
9773 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9774 {
9777 }
9778
9779 else if (action_id ==
EActions.MAKE_SPECIAL)
9780 {
9781 auto debugParams = DebugSpawnParams.WithPlayer(player);
9782 OnDebugSpawnEx(debugParams);
9783 }
9784
9785 }
9786
9787
9788 return false;
9789 }
9790
9791
9792
9793
9797
9800
9801
9802
9804 {
9805 return false;
9806 }
9807
9808
9810 {
9811 return true;
9812 }
9813
9814
9816 {
9817 return true;
9818 }
9819
9820
9821
9823 {
9824 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9825 return g_Game.ConfigIsExisting(config_path);
9826 }
9827
9830 {
9831 return null;
9832 }
9833
9835 {
9836 return false;
9837 }
9838
9840 {
9841 return false;
9842 }
9843
9847
9848
9850 {
9851 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9852 return module_repairing.CanRepair(this, item_repair_kit);
9853 }
9854
9855
9856 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9857 {
9858 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9859 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9860 }
9861
9862
9864 {
9865
9866
9867
9868
9869
9870
9871
9872
9873 return 1;
9874 }
9875
9876
9877
9879 {
9881 }
9882
9883
9884
9886 {
9888 }
9889
9890
9899 {
9900 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9901
9902 if (player)
9903 {
9904 player.MessageStatus(text);
9905 }
9906 }
9907
9908
9917 {
9918 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9919
9920 if (player)
9921 {
9922 player.MessageAction(text);
9923 }
9924 }
9925
9926
9935 {
9936 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9937
9938 if (player)
9939 {
9940 player.MessageFriendly(text);
9941 }
9942 }
9943
9944
9953 {
9954 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9955
9956 if (player)
9957 {
9958 player.MessageImportant(text);
9959 }
9960 }
9961
9963 {
9964 return true;
9965 }
9966
9967
9968 override bool KindOf(
string tag)
9969 {
9970 bool found = false;
9971 string item_name = this.
GetType();
9973 g_Game.ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
9974
9975 int array_size = item_tag_array.Count();
9976 for (int i = 0; i < array_size; i++)
9977 {
9978 if (item_tag_array.Get(i) == tag)
9979 {
9980 found = true;
9981 break;
9982 }
9983 }
9984 return found;
9985 }
9986
9987
9989 {
9990
9991 super.OnRPC(sender, rpc_type,ctx);
9992
9993
9994 switch (rpc_type)
9995 {
9996 #ifndef SERVER
9997 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9998 Param2<bool, string> p = new Param2<bool, string>(false, "");
9999
10001 return;
10002
10003 bool play = p.param1;
10004 string soundSet = p.param2;
10005
10006 if (play)
10007 {
10009 {
10011 {
10013 }
10014 }
10015 else
10016 {
10018 }
10019 }
10020 else
10021 {
10023 }
10024
10025 break;
10026 #endif
10027
10028 }
10029
10031 {
10033 }
10034 }
10035
10036
10037
10038
10040 {
10041 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10042 return plugin.GetID(
name);
10043 }
10044
10046 {
10047 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
10048 return plugin.GetName(id);
10049 }
10050
10053 {
10054
10055
10056 int varFlags;
10057 if (!ctx.
Read(varFlags))
10058 return;
10059
10060 if (varFlags & ItemVariableFlags.FLOAT)
10061 {
10063 }
10064 }
10065
10067 {
10068
10069 super.SerializeNumericalVars(floats_out);
10070
10071
10072
10074 {
10076 }
10077
10079 {
10081 }
10082
10084 {
10086 }
10087
10089 {
10094 }
10095
10097 {
10099 }
10100 }
10101
10103 {
10104
10105 super.DeSerializeNumericalVars(floats);
10106
10107
10108 int index = 0;
10109 int mask = Math.Round(floats.Get(index));
10110
10111 index++;
10112
10114 {
10116 {
10118 }
10119 else
10120 {
10121 float quantity = floats.Get(index);
10122 SetQuantity(quantity,
true,
false,
false,
false);
10123 }
10124 index++;
10125 }
10126
10128 {
10129 float wet = floats.Get(index);
10131 index++;
10132 }
10133
10135 {
10136 int liquidtype = Math.Round(floats.Get(index));
10138 index++;
10139 }
10140
10142 {
10144 index++;
10146 index++;
10148 index++;
10150 index++;
10151 }
10152
10154 {
10155 int cleanness = Math.Round(floats.Get(index));
10157 index++;
10158 }
10159 }
10160
10162 {
10163 super.WriteVarsToCTX(ctx);
10164
10165
10167 {
10169 }
10170
10172 {
10174 }
10175
10177 {
10179 }
10180
10182 {
10183 int r,g,b,a;
10189 }
10190
10192 {
10194 }
10195 }
10196
10198 {
10199 if (!super.ReadVarsFromCTX(ctx,version))
10200 return false;
10201
10202 int intValue;
10203 float value;
10204
10205 if (version < 140)
10206 {
10207 if (!ctx.
Read(intValue))
10208 return false;
10209
10210 m_VariablesMask = intValue;
10211 }
10212
10214 {
10215 if (!ctx.
Read(value))
10216 return false;
10217
10219 {
10221 }
10222 else
10223 {
10225 }
10226 }
10227
10228 if (version < 140)
10229 {
10231 {
10232 if (!ctx.
Read(value))
10233 return false;
10234 SetTemperatureDirect(value);
10235 }
10236 }
10237
10239 {
10240 if (!ctx.
Read(value))
10241 return false;
10243 }
10244
10246 {
10247 if (!ctx.
Read(intValue))
10248 return false;
10250 }
10251
10253 {
10254 int r,g,b,a;
10256 return false;
10258 return false;
10260 return false;
10262 return false;
10263
10265 }
10266
10268 {
10269 if (!ctx.
Read(intValue))
10270 return false;
10272 }
10273
10274 if (version >= 138 && version < 140)
10275 {
10277 {
10278 if (!ctx.
Read(intValue))
10279 return false;
10280 SetFrozen(intValue);
10281 }
10282 }
10283
10284 return true;
10285 }
10286
10287
10289 {
10292 {
10294 }
10295
10296 if (!super.OnStoreLoad(ctx, version))
10297 {
10299 return false;
10300 }
10301
10302 if (version >= 114)
10303 {
10304 bool hasQuickBarIndexSaved;
10305
10306 if (!ctx.
Read(hasQuickBarIndexSaved))
10307 {
10309 return false;
10310 }
10311
10312 if (hasQuickBarIndexSaved)
10313 {
10314 int itmQBIndex;
10315
10316
10317 if (!ctx.
Read(itmQBIndex))
10318 {
10320 return false;
10321 }
10322
10323 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10324 if (itmQBIndex != -1 && parentPlayer)
10325 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10326 }
10327 }
10328 else
10329 {
10330
10331 PlayerBase player;
10332 int itemQBIndex;
10333 if (version ==
int.
MAX)
10334 {
10335 if (!ctx.
Read(itemQBIndex))
10336 {
10338 return false;
10339 }
10340 }
10341 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10342 {
10343
10344 if (!ctx.
Read(itemQBIndex))
10345 {
10347 return false;
10348 }
10349 if (itemQBIndex != -1 && player)
10350 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10351 }
10352 }
10353
10354 if (version < 140)
10355 {
10356
10357 if (!LoadVariables(ctx, version))
10358 {
10360 return false;
10361 }
10362 }
10363
10364
10366 {
10368 return false;
10369 }
10370 if (version >= 132)
10371 {
10373 if (raib)
10374 {
10376 {
10378 return false;
10379 }
10380 }
10381 }
10382
10384 return true;
10385 }
10386
10387
10388
10390 {
10391 super.OnStoreSave(ctx);
10392
10393 PlayerBase player;
10394 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10395 {
10397
10398 int itemQBIndex = -1;
10399 itemQBIndex = player.FindQuickBarEntityIndex(this);
10400 ctx.
Write(itemQBIndex);
10401 }
10402 else
10403 {
10405 }
10406
10408
10410 if (raib)
10411 {
10413 }
10414 }
10415
10416
10418 {
10419 super.AfterStoreLoad();
10420
10422 {
10424 }
10425
10427 {
10430 }
10431 }
10432
10434 {
10435 super.EEOnAfterLoad();
10436
10438 {
10440 }
10441
10444 }
10445
10447 {
10448 return false;
10449 }
10450
10451
10452
10454 {
10456 {
10457 #ifdef PLATFORM_CONSOLE
10458
10460 {
10462 if (menu)
10463 {
10465 }
10466 }
10467 #endif
10468 }
10469
10471 {
10474 }
10475
10477 {
10478 SetWeightDirty();
10480 }
10482 {
10485 }
10486
10488 {
10491
10494 }
10496 {
10500 }
10501
10502 super.OnVariablesSynchronized();
10503 }
10504
10505
10506
10508 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10509 {
10510 if (!IsServerCheck(allow_client))
10511 return false;
10512
10514 return false;
10515
10518
10519 if (value <= (min + 0.001))
10520 value = min;
10521
10522 if (value == min)
10523 {
10524 if (destroy_config)
10525 {
10526 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10527 if (dstr)
10528 {
10530 this.Delete();
10531 return true;
10532 }
10533 }
10534 else if (destroy_forced)
10535 {
10537 this.Delete();
10538 return true;
10539 }
10540
10542 }
10543
10546
10548 {
10549 EntityAI parent = GetHierarchyRoot();
10550 InventoryLocation iLoc = new InventoryLocation();
10551 GetInventory().GetCurrentInventoryLocation(iLoc);
10553 {
10554 int iLocSlot = iLoc.
GetSlot();
10556 {
10558 }
10560 {
10562 }
10563 }
10564 }
10565
10567 {
10569
10570 if (delta)
10572 }
10573
10575
10576 return false;
10577 }
10578
10579
10581 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10582 {
10584 }
10585
10587 {
10590 }
10591
10593 {
10596 }
10597
10599 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10600 {
10601 float value_clamped = Math.Clamp(value, 0, 1);
10603 SetQuantity(result, destroy_config, destroy_forced);
10604 }
10605
10606
10609 {
10611 }
10612
10614 {
10616 }
10617
10618
10619
10620
10621
10622
10623
10624
10625
10626
10628 {
10629 int slot = -1;
10630 GameInventory inventory = GetInventory();
10631 if (inventory)
10632 {
10633 InventoryLocation il = new InventoryLocation;
10636 }
10637
10639 }
10640
10642 {
10643 float quantity_max = 0;
10644
10646 {
10647 if (attSlotID != -1)
10648 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10649
10650 if (quantity_max <= 0)
10652 }
10653
10654 if (quantity_max <= 0)
10656
10657 return quantity_max;
10658 }
10659
10661 {
10663 }
10664
10666 {
10668 }
10669
10670
10672 {
10674 }
10675
10677 {
10679 }
10680
10682 {
10684 }
10685
10686
10688 {
10689
10690 float weightEx = GetWeightEx();
10691 float special = GetInventoryAndCargoWeight();
10692 return weightEx - special;
10693 }
10694
10695
10697 {
10699 }
10700
10702 {
10704 {
10705 #ifdef DEVELOPER
10706 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10707 {
10708 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10710 }
10711 #endif
10712
10713 return GetQuantity() * GetConfigWeightModified();
10714 }
10715 else if (HasEnergyManager())
10716 {
10717 #ifdef DEVELOPER
10718 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10719 {
10720 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10721 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10722 }
10723 #endif
10724 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10725 }
10726 else
10727 {
10728 #ifdef DEVELOPER
10729 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10730 {
10731 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10732 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10733 }
10734 #endif
10735 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10736 }
10737 }
10738
10741 {
10742 int item_count = 0;
10744
10745 GameInventory inventory = GetInventory();
10746 CargoBase cargo = inventory.
GetCargo();
10747 if (cargo != NULL)
10748 {
10750 }
10751
10753 for (int i = 0; i < nAttachments; ++i)
10754 {
10756 if (item)
10757 item_count += item.GetNumberOfItems();
10758 }
10759 return item_count;
10760 }
10761
10764 {
10765 float weight = 0;
10766 float wetness = 1;
10767 if (include_wetness)
10770 {
10771 weight = wetness * m_ConfigWeight;
10772 }
10774 {
10775 weight = 1;
10776 }
10777 return weight;
10778 }
10779
10780
10781
10783 {
10784 GameInventory inventory = GetInventory();
10785 if ((
g_Game.IsServer() || !
g_Game.IsMultiplayer()) && inventory)
10786 {
10787 array<EntityAI> items = new array<EntityAI>;
10789 for (int i = 0; i < items.Count(); ++i)
10790 {
10792 if (item)
10793 {
10794 g_Game.ObjectDelete(item);
10795 }
10796 }
10797 }
10798 }
10799
10800
10801
10802
10804 {
10805 float energy = 0;
10806 if (HasEnergyManager())
10807 {
10808 energy = GetCompEM().GetEnergy();
10809 }
10810 return energy;
10811 }
10812
10813
10815 {
10816 super.OnEnergyConsumed();
10817
10819 }
10820
10822 {
10823 super.OnEnergyAdded();
10824
10826 }
10827
10828
10830 {
10831 if (
g_Game.IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10832 {
10834 {
10835 float energy_0to1 = GetCompEM().GetEnergy0To1();
10837 }
10838 }
10839 }
10840
10841
10843 {
10844 return ConfigGetFloat("heatIsolation");
10845 }
10846
10848 {
10850 }
10851
10853 {
10854 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10855 if (
g_Game.ConfigIsExisting(paramPath))
10856 return g_Game.ConfigGetFloat(paramPath);
10857
10858 return 0.0;
10859 }
10860
10862 {
10863 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10864 if (
g_Game.ConfigIsExisting(paramPath))
10865 return g_Game.ConfigGetFloat(paramPath);
10866
10867 return 0.0;
10868 }
10869
10870 override void SetWet(
float value,
bool allow_client =
false)
10871 {
10872 if (!IsServerCheck(allow_client))
10873 return;
10874
10877
10879
10880 m_VarWet = Math.Clamp(value, min, max);
10881
10883 {
10886 }
10887 }
10888
10889 override void AddWet(
float value)
10890 {
10892 }
10893
10895 {
10897 }
10898
10900 {
10902 }
10903
10905 {
10907 }
10908
10910 {
10912 }
10913
10915 {
10917 }
10918
10919 override void OnWetChanged(
float newVal,
float oldVal)
10920 {
10923 if (newLevel != oldLevel)
10924 {
10926 }
10927 }
10928
10930 {
10931 SetWeightDirty();
10932 }
10933
10935 {
10936 return GetWetLevelInternal(
m_VarWet);
10937 }
10938
10939
10940
10942 {
10944 }
10945
10947 {
10949 }
10950
10952 {
10954 }
10955
10957 {
10959 }
10960
10961
10962
10964 {
10965 if (ConfigIsExisting("itemModelLength"))
10966 {
10967 return ConfigGetFloat("itemModelLength");
10968 }
10969 return 0;
10970 }
10971
10973 {
10974 if (ConfigIsExisting("itemAttachOffset"))
10975 {
10976 return ConfigGetFloat("itemAttachOffset");
10977 }
10978 return 0;
10979 }
10980
10981 override void SetCleanness(
int value,
bool allow_client =
false)
10982 {
10983 if (!IsServerCheck(allow_client))
10984 return;
10985
10987
10989
10992 }
10993
10995 {
10997 }
10998
11000 {
11001 return true;
11002 }
11003
11004
11005
11006
11008 {
11010 }
11011
11013 {
11015 }
11016
11017
11018
11019
11020 override void SetColor(
int r,
int g,
int b,
int a)
11021 {
11027 }
11029 override void GetColor(out
int r,out
int g,out
int b,out
int a)
11030 {
11035 }
11036
11038 {
11040 }
11041
11044 {
11045 int r,g,b,a;
11047 r = r/255;
11048 g = g/255;
11049 b = b/255;
11050 a = a/255;
11051 return MiscGameplayFunctions.GetColorString(r, g, b, a);
11052 }
11053
11054
11055
11056 override void SetLiquidType(
int value,
bool allow_client =
false)
11057 {
11058 if (!IsServerCheck(allow_client))
11059 return;
11060
11065 }
11066
11068 {
11069 return ConfigGetInt("varLiquidTypeInit");
11070 }
11071
11073 {
11075 }
11076
11078 {
11080 SetFrozen(false);
11081 }
11082
11085 {
11086 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11087 }
11088
11089
11092 {
11093 PlayerBase nplayer;
11094 if (PlayerBase.CastTo(nplayer, player))
11095 {
11097 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
11098 }
11099 }
11100
11101
11104 {
11105 PlayerBase nplayer;
11106 if (PlayerBase.CastTo(nplayer,player))
11107 {
11108 nplayer.SetEnableQuickBarEntityShortcut(this, false);
11109 }
11110
11111 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
11112
11113 if (HasEnergyManager())
11114 {
11115 GetCompEM().UpdatePlugState();
11116 }
11117 }
11118
11119
11121 {
11122 super.OnPlacementStarted(player);
11123
11125 }
11126
11127 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11128 {
11130 {
11131 m_AdminLog.OnPlacementComplete(player,
this);
11132 }
11133
11134 super.OnPlacementComplete(player, position, orientation);
11135 }
11136
11137
11138
11139
11140
11142 {
11144 {
11145 return true;
11146 }
11147 else
11148 {
11149 return false;
11150 }
11151 }
11152
11153
11155 {
11157 {
11159 }
11160 }
11161
11162
11164 {
11166 }
11167
11169 {
11171 }
11172
11173 override void InsertAgent(
int agent,
float count = 1)
11174 {
11175 if (count < 1)
11176 return;
11177
11179 }
11180
11183 {
11185 }
11186
11187
11189 {
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
11219
11220
11221
11222
11223
11224
11225
11226
11227
11228
11229
11230
11231
11232
11233
11235 {
11237 return false;
11238 return true;
11239 }
11240
11242 {
11243
11245 }
11246
11247
11250 {
11251 super.CheckForRoofLimited(timeTresholdMS);
11252
11253 float time =
g_Game.GetTime();
11254 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11255 {
11256 m_PreviousRoofTestTime = time;
11257 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11258 }
11259 }
11260
11261
11263 {
11265 {
11266 return 0;
11267 }
11268
11269 if (GetInventory().GetAttachmentSlotsCount() != 0)
11270 {
11271 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11272 if (filter)
11273 return filter.GetProtectionLevel(type, false, system);
11274 else
11275 return 0;
11276 }
11277
11278 string subclassPath, entryName;
11279
11280 switch (type)
11281 {
11283 entryName = "biological";
11284 break;
11286 entryName = "chemical";
11287 break;
11288 default:
11289 entryName = "biological";
11290 break;
11291 }
11292
11293 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11294
11295 return g_Game.ConfigGetFloat(subclassPath + entryName);
11296 }
11297
11298
11299
11302 {
11303 if (!IsMagazine())
11305
11307 }
11308
11309
11310
11311
11312
11317 {
11318 return true;
11319 }
11320
11322 {
11324 }
11325
11326
11327
11328
11329
11331 {
11332 if (parent)
11333 {
11334 if (parent.IsInherited(DayZInfected))
11335 return true;
11336
11337 if (!parent.IsRuined())
11338 return true;
11339 }
11340
11341 return true;
11342 }
11343
11345 {
11346 if (!super.CanPutAsAttachment(parent))
11347 {
11348 return false;
11349 }
11350
11351 if (!IsRuined() && !parent.IsRuined())
11352 {
11353 return true;
11354 }
11355
11356 return false;
11357 }
11358
11360 {
11361
11362
11363
11364
11365 return super.CanReceiveItemIntoCargo(item);
11366 }
11367
11369 {
11370
11371
11372
11373
11374 GameInventory attachmentInv = attachment.GetInventory();
11376 {
11377 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11378 return false;
11379 }
11380
11381 InventoryLocation loc = new InventoryLocation();
11382 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11383 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11384 return false;
11385
11386 return super.CanReceiveAttachment(attachment, slotId);
11387 }
11388
11390 {
11391 if (!super.CanReleaseAttachment(attachment))
11392 return false;
11393
11394 return GetInventory().AreChildrenAccessible();
11395 }
11396
11397
11398
11399
11400
11401
11402
11403
11404
11405
11406
11407
11408
11409
11410
11411
11412
11413
11414
11415
11416
11418 {
11419 int id = muzzle_owner.GetMuzzleID();
11420 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11421
11422 if (WPOF_array)
11423 {
11424 for (int i = 0; i < WPOF_array.Count(); i++)
11425 {
11426 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11427
11428 if (WPOF)
11429 {
11430 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11431 }
11432 }
11433 }
11434 }
11435
11436
11438 {
11439 int id = muzzle_owner.GetMuzzleID();
11441
11442 if (WPOBE_array)
11443 {
11444 for (int i = 0; i < WPOBE_array.Count(); i++)
11445 {
11446 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11447
11448 if (WPOBE)
11449 {
11450 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11451 }
11452 }
11453 }
11454 }
11455
11456
11458 {
11459 int id = muzzle_owner.GetMuzzleID();
11460 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11461
11462 if (WPOOH_array)
11463 {
11464 for (int i = 0; i < WPOOH_array.Count(); i++)
11465 {
11466 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11467
11468 if (WPOOH)
11469 {
11470 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11471 }
11472 }
11473 }
11474 }
11475
11476
11478 {
11479 int id = muzzle_owner.GetMuzzleID();
11480 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11481
11482 if (WPOOH_array)
11483 {
11484 for (int i = 0; i < WPOOH_array.Count(); i++)
11485 {
11486 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11487
11488 if (WPOOH)
11489 {
11490 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11491 }
11492 }
11493 }
11494 }
11495
11496
11498 {
11499 int id = muzzle_owner.GetMuzzleID();
11500 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11501
11502 if (WPOOH_array)
11503 {
11504 for (int i = 0; i < WPOOH_array.Count(); i++)
11505 {
11506 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11507
11508 if (WPOOH)
11509 {
11510 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11511 }
11512 }
11513 }
11514 }
11515
11516
11517
11519 {
11521 {
11522 return true;
11523 }
11524
11525 return false;
11526 }
11527
11529 {
11531 {
11532 return true;
11533 }
11534
11535 return false;
11536 }
11537
11539 {
11541 {
11542 return true;
11543 }
11544
11545 return false;
11546 }
11547
11549 {
11550 return false;
11551 }
11552
11555 {
11556 return UATimeSpent.DEFAULT_DEPLOY;
11557 }
11558
11559
11560
11561
11563 {
11565 SetSynchDirty();
11566 }
11567
11569 {
11571 }
11572
11573
11575 {
11576 return false;
11577 }
11578
11581 {
11582 string att_type = "None";
11583
11584 if (ConfigIsExisting("soundAttType"))
11585 {
11586 att_type = ConfigGetString("soundAttType");
11587 }
11588
11590 }
11591
11593 {
11595 }
11596
11597
11598
11599
11600
11606
11608 {
11611
11613 }
11614
11615
11617 {
11619 return;
11620
11622
11625
11628
11629 SoundParameters params = new SoundParameters();
11633 }
11634
11635
11637 {
11639 {
11642
11643 SetSynchDirty();
11644
11647 }
11648 }
11649
11651 {
11653 }
11654
11655
11657 {
11659 return;
11660
11662 SetSynchDirty();
11663
11666 }
11667
11669 {
11672 }
11673
11675 {
11677 }
11678
11679 void OnApply(PlayerBase player);
11680
11682 {
11683 return 1.0;
11684 };
11685
11687 {
11689 }
11690
11692 {
11694 }
11695
11697
11699 {
11700 SetDynamicPhysicsLifeTime(0.01);
11702 }
11703
11705 {
11706 array<string> zone_names = new array<string>;
11707 GetDamageZones(zone_names);
11708 for (int i = 0; i < zone_names.Count(); i++)
11709 {
11710 SetHealthMax(zone_names.Get(i),"Health");
11711 }
11712 SetHealthMax("","Health");
11713 }
11714
11717 {
11718 float global_health = GetHealth01("","Health");
11719 array<string> zones = new array<string>;
11720 GetDamageZones(zones);
11721
11722 for (int i = 0; i < zones.Count(); i++)
11723 {
11724 SetHealth01(zones.Get(i),"Health",global_health);
11725 }
11726 }
11727
11730 {
11731 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11732 }
11733
11735 {
11736 if (!hasRootAsPlayer)
11737 {
11738 if (refParentIB)
11739 {
11740
11741 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11742 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11743
11744 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11745 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11746
11749 }
11750 else
11751 {
11752
11755 }
11756 }
11757 }
11758
11760 {
11762 {
11763 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11764 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11765 {
11766 float heatPermCoef = 1.0;
11768 while (ent)
11769 {
11770 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11771 ent = ent.GetHierarchyParent();
11772 }
11773
11774 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11775 }
11776 }
11777 }
11778
11780 {
11781
11782 EntityAI parent = GetHierarchyParent();
11783 if (!parent)
11784 {
11785 hasParent = false;
11786 hasRootAsPlayer = false;
11787 }
11788 else
11789 {
11790 hasParent = true;
11791 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11792 refParentIB =
ItemBase.Cast(parent);
11793 }
11794 }
11795
11796 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11797 {
11798
11799 }
11800
11802 {
11803
11804 return false;
11805 }
11806
11808 {
11809
11810
11811 return false;
11812 }
11813
11815 {
11816
11817 return false;
11818 }
11819
11822 {
11823 return !GetIsFrozen() &&
IsOpen();
11824 }
11825
11827 {
11828 bool hasParent = false, hasRootAsPlayer = false;
11830
11831 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11832 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11833
11834 if (wwtu || foodDecay)
11835 {
11839
11840 if (processWetness || processTemperature || processDecay)
11841 {
11843
11844 if (processWetness)
11845 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11846
11847 if (processTemperature)
11849
11850 if (processDecay)
11851 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11852 }
11853 }
11854 }
11855
11858 {
11860 }
11861
11863 {
11866
11867 return super.GetTemperatureFreezeThreshold();
11868 }
11869
11871 {
11874
11875 return super.GetTemperatureThawThreshold();
11876 }
11877
11879 {
11882
11883 return super.GetItemOverheatThreshold();
11884 }
11885
11887 {
11889 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11890
11891 return super.GetTemperatureFreezeTime();
11892 }
11893
11895 {
11897 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11898
11899 return super.GetTemperatureThawTime();
11900 }
11901
11906
11908 {
11909 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11910 }
11911
11913 {
11914 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11915 }
11916
11919 {
11921 }
11922
11924 {
11926 }
11927
11929 {
11931 }
11932
11935 {
11936 return null;
11937 }
11938
11941 {
11942 return false;
11943 }
11944
11946 {
11948 {
11951 if (!trg)
11952 {
11954 explosive = this;
11955 }
11956
11957 explosive.PairRemote(trg);
11959
11960 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11961 trg.SetPersistentPairID(persistentID);
11962 explosive.SetPersistentPairID(persistentID);
11963
11964 return true;
11965 }
11966 return false;
11967 }
11968
11971 {
11972 float ret = 1.0;
11975 ret *= GetHealth01();
11976
11977 return ret;
11978 }
11979
11980 #ifdef DEVELOPER
11981 override void SetDebugItem()
11982 {
11983 super.SetDebugItem();
11984 _itemBase = this;
11985 }
11986
11988 {
11989 string text = super.GetDebugText();
11990
11992 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11993
11994 return text;
11995 }
11996 #endif
11997
11999 {
12000 return true;
12001 }
12002
12004
12006
12008 {
12011 }
12012
12013
12021
12037
12038 [
Obsolete(
"Use ItemSoundHandler instead")]
12041 {
12042 if (!
g_Game.IsDedicatedServer())
12043 {
12044 if (ConfigIsExisting("attachSoundSet"))
12045 {
12046 string cfg_path = "";
12047 string soundset = "";
12048 string type_name =
GetType();
12049
12052 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
12053 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
12054
12055 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
12056 {
12057 for (int i = 0; i < cfg_soundset_array.Count(); i++)
12058 {
12059 if (cfg_slot_array[i] == slot_type)
12060 {
12061 soundset = cfg_soundset_array[i];
12062 break;
12063 }
12064 }
12065 }
12066
12067 if (soundset != "")
12068 {
12069 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
12071 }
12072 }
12073 }
12074 }
12075
12077}
12078
12080{
12082 if (entity)
12083 {
12084 bool is_item = entity.IsInherited(
ItemBase);
12085 if (is_item && full_quantity)
12086 {
12089 }
12090 }
12091 else
12092 {
12094 return NULL;
12095 }
12096 return entity;
12097}
12098
12100{
12101 if (item)
12102 {
12103 if (health > 0)
12104 item.SetHealth("", "", health);
12105
12106 if (item.CanHaveTemperature())
12107 {
12109 if (item.CanFreeze())
12110 item.SetFrozen(false);
12111 }
12112
12113 if (item.HasEnergyManager())
12114 {
12115 if (quantity >= 0)
12116 {
12117 item.GetCompEM().SetEnergy0To1(quantity);
12118 }
12119 else
12120 {
12122 }
12123 }
12124 else if (item.IsMagazine())
12125 {
12126 Magazine mag = Magazine.Cast(item);
12127 if (quantity >= 0)
12128 {
12129 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
12130 }
12131 else
12132 {
12134 }
12135
12136 }
12137 else
12138 {
12139 if (quantity >= 0)
12140 {
12141 item.SetQuantityNormalized(quantity, false);
12142 }
12143 else
12144 {
12146 }
12147
12148 }
12149 }
12150}
12151
12152#ifdef DEVELOPER
12154#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.