7097{
7099 {
7100 return true;
7101 }
7102};
7103
7104
7105
7107{
7111
7113
7116
7117
7118
7119
7120
7129
7135
7140
7145
7166 protected bool m_IsResultOfSplit
7167
7169
7174
7175
7176
7178
7182
7183
7184
7186
7189
7190
7191
7197
7198
7206
7209
7210
7212
7213
7215
7216
7221
7222
7227
7228
7230
7231
7233 {
7238
7239 if (!
GetGame().IsDedicatedServer())
7240 {
7242 {
7244
7246 {
7248 }
7249 }
7250
7253 }
7254
7255 m_OldLocation = null;
7256
7258 {
7260 }
7261
7262 if (ConfigIsExisting("headSelectionsToHide"))
7263 {
7266 }
7267
7269 if (ConfigIsExisting("hideSelectionsByinventorySlot"))
7270 {
7272 }
7273
7275
7276 m_IsResultOfSplit = false;
7277
7279 }
7280
7282 {
7283 super.InitItemVariables();
7284
7290 m_Count = ConfigGetInt(
"count");
7291
7294
7299
7302
7307
7319
7323
7324
7327 if (ConfigIsExisting("canBeSplit"))
7328 {
7331 }
7332
7334 if (ConfigIsExisting("itemBehaviour"))
7336
7337
7340 RegisterNetSyncVariableInt("m_VarLiquidType");
7341 RegisterNetSyncVariableInt("m_Cleanness",0,1);
7342
7343 RegisterNetSyncVariableBoolSignal("m_WantPlayImpactSound");
7344 RegisterNetSyncVariableFloat("m_ImpactSpeed");
7345 RegisterNetSyncVariableInt("m_ImpactSoundSurfaceHash");
7346
7347 RegisterNetSyncVariableInt("m_ColorComponentR", 0, 255);
7348 RegisterNetSyncVariableInt("m_ColorComponentG", 0, 255);
7349 RegisterNetSyncVariableInt("m_ColorComponentB", 0, 255);
7350 RegisterNetSyncVariableInt("m_ColorComponentA", 0, 255);
7351
7352 RegisterNetSyncVariableBool("m_IsBeingPlaced");
7353 RegisterNetSyncVariableBool("m_IsTakeable");
7354 RegisterNetSyncVariableBool("m_IsHologram");
7355
7358 {
7361 }
7362
7364
7366 if (ConfigIsExisting("temperaturePerQuantityWeight"))
7368
7369 }
7370
7372 {
7374 }
7375
7377 {
7380 {
7385 }
7386 }
7387
7388 override void GetActions(
typename action_input_type, out array<ActionBase_Basic> actions)
7389 {
7391 {
7394 }
7395
7397 }
7398
7400 {
7406 }
7407
7409
7411 {
7413
7414 if (!action)
7415 {
7416 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
7417 return;
7418 }
7419
7421 if (!ai)
7422 {
7424 return;
7425 }
7426
7428 if (!action_array)
7429 {
7430 action_array = new array<ActionBase_Basic>;
7432 }
7433 if (LogManager.IsActionLogEnable())
7434 {
7435 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
7436 }
7437
7438 if (action_array.Find(action) != -1)
7439 {
7440 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
7441 }
7442 else
7443 {
7444 action_array.Insert(action);
7445 }
7446 }
7447
7449 {
7451 ActionBase action = player.GetActionManager().GetAction(actionName);
7454
7455 if (action_array)
7456 {
7457 action_array.RemoveItem(action);
7458 }
7459 }
7460
7461
7462
7464 {
7465 ActionOverrideData overrideData = new ActionOverrideData();
7469
7471 if (!actionMap)
7472 {
7475 }
7476
7477 actionMap.Insert(this.
Type(), overrideData);
7478
7479 }
7480
7482
7484
7485
7487 {
7490
7493
7494 string config_to_search = "CfgVehicles";
7495 string muzzle_owner_config;
7496
7498 {
7499 if (IsInherited(Weapon))
7500 config_to_search = "CfgWeapons";
7501
7502 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7503
7504 string config_OnFire_class = muzzle_owner_config + "Particles " + "OnFire ";
7505
7507
7508 if (config_OnFire_subclass_count > 0)
7509 {
7510 array<ref WeaponParticlesOnFire> WPOF_array = new array<ref WeaponParticlesOnFire>;
7511
7512 for (int i = 0; i < config_OnFire_subclass_count; i++)
7513 {
7514 string particle_class = "";
7516 string config_OnFire_entry = config_OnFire_class + particle_class;
7517 WeaponParticlesOnFire WPOF = new WeaponParticlesOnFire(this, config_OnFire_entry);
7518 WPOF_array.Insert(WPOF);
7519 }
7520
7521
7523 }
7524 }
7525
7527 {
7528 config_to_search = "CfgWeapons";
7529 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7530
7531 string config_OnBulletCasingEject_class = muzzle_owner_config + "Particles " + "OnBulletCasingEject ";
7532
7534
7535 if (config_OnBulletCasingEject_count > 0 && IsInherited(Weapon))
7536 {
7537 array<ref WeaponParticlesOnBulletCasingEject> WPOBE_array = new array<ref WeaponParticlesOnBulletCasingEject>;
7538
7539 for (i = 0; i < config_OnBulletCasingEject_count; i++)
7540 {
7541 string particle_class2 = "";
7543 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
7544 WeaponParticlesOnBulletCasingEject WPOBE = new WeaponParticlesOnBulletCasingEject(this, config_OnBulletCasingEject_entry);
7545 WPOBE_array.Insert(WPOBE);
7546 }
7547
7548
7550 }
7551 }
7552 }
7553
7554
7556 {
7559
7561 {
7562 string config_to_search = "CfgVehicles";
7563
7564 if (IsInherited(Weapon))
7565 config_to_search = "CfgWeapons";
7566
7567 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
7568 string config_OnOverheating_class = muzzle_owner_config + "Particles " + "OnOverheating ";
7569
7570 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
7571 {
7572
7574
7576 {
7578 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
7580 return;
7581 }
7582
7585
7586
7587
7589 array<ref WeaponParticlesOnOverheating> WPOOH_array = new array<ref WeaponParticlesOnOverheating>;
7590
7591 for (int i = 0; i < config_OnOverheating_subclass_count; i++)
7592 {
7593 string particle_class = "";
7595 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
7597
7598 if (entry_type == CT_CLASS)
7599 {
7600 WeaponParticlesOnOverheating WPOF = new WeaponParticlesOnOverheating(this, config_OnOverheating_entry);
7601 WPOOH_array.Insert(WPOF);
7602 }
7603 }
7604
7605
7607 }
7608 }
7609 }
7610
7612 {
7614 }
7615
7617 {
7619 {
7621
7624
7627
7628 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7629 }
7630 }
7631
7633 {
7635 UpdateOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7636
7638 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7639
7641 StopOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7642
7644 {
7646 }
7647 }
7648
7650 {
7652 }
7653
7655 {
7658 else
7660
7662 {
7665 }
7666 else
7667 {
7670
7673 }
7674
7676 }
7677
7679 {
7681 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7682 }
7683
7685 {
7687 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
7689 }
7690
7692 {
7694 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
7695 }
7696
7698 {
7701
7702 OverheatingParticle OP = new OverheatingParticle();
7707
7709 }
7710
7712 {
7715
7716 return -1;
7717 }
7718
7720 {
7722 {
7725
7726 for (int i = count; i > 0; --i)
7727 {
7728 int id = i - 1;
7731
7734
7735 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
7736 {
7737 if (p)
7738 {
7741 }
7742 }
7743 }
7744 }
7745 }
7746
7748 {
7750 {
7752 {
7753 int id = i - 1;
7755
7756 if (OP)
7757 {
7759
7760 if (p)
7761 {
7763 }
7764
7765 delete OP;
7766 }
7767 }
7768
7771 }
7772 }
7773
7776 {
7777 return 0.0;
7778 }
7779
7780
7782 {
7783 return 250;
7784 }
7785
7787 {
7788 return 0;
7789 }
7790
7793 {
7795 return true;
7796
7797 return false;
7798 }
7799
7802 {
7805
7807 {
7809 }
7810 else
7811 {
7812
7814 }
7815
7817 }
7818
7825 {
7826 return -1;
7827 }
7828
7829
7830
7831
7833 {
7835 {
7837 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
7838
7839 if (r_index >= 0)
7840 {
7841 InventoryLocation r_il = new InventoryLocation;
7842 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
7843
7844 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
7847 {
7848 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
7849 }
7851 {
7852 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
7853 }
7854
7855 }
7856
7857 player.GetHumanInventory().ClearUserReservedLocation(this);
7858 }
7859
7862 }
7863
7864
7865
7866
7868 {
7869 return ItemBase.m_DebugActionsMask;
7870 }
7871
7873 {
7874 return ItemBase.m_DebugActionsMask & mask;
7875 }
7876
7878 {
7879 ItemBase.m_DebugActionsMask = mask;
7880 }
7881
7883 {
7884 ItemBase.m_DebugActionsMask |= mask;
7885 }
7886
7888 {
7889 ItemBase.m_DebugActionsMask &= ~mask;
7890 }
7891
7893 {
7895 {
7897 }
7898 else
7899 {
7901 }
7902 }
7903
7904
7906 {
7907 if (GetEconomyProfile())
7908 {
7909 float q_max = GetEconomyProfile().GetQuantityMax();
7910 if (q_max > 0)
7911 {
7912 float q_min = GetEconomyProfile().GetQuantityMin();
7913 float quantity_randomized = Math.RandomFloatInclusive(q_min, q_max);
7914
7916 {
7917 ComponentEnergyManager comp = GetCompEM();
7919 {
7921 }
7922 }
7924 {
7926
7927 }
7928
7929 }
7930 }
7931 }
7932
7935 {
7936 EntityAI parent = GetHierarchyParent();
7937
7938 if (parent)
7939 {
7940 InventoryLocation inventory_location_to_lock = new InventoryLocation;
7941 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
7942 parent.GetInventory().SetSlotLock(inventory_location_to_lock.
GetSlot(),
true);
7943 }
7944 }
7945
7948 {
7949 EntityAI parent = GetHierarchyParent();
7950
7951 if (parent)
7952 {
7953 InventoryLocation inventory_location_to_unlock = new InventoryLocation;
7954 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
7955 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.
GetSlot(),
false);
7956 }
7957 }
7958
7960 {
7961
7962
7963
7964
7966
7968 {
7969 if (ScriptInputUserData.CanStoreInputUserData())
7970 {
7971 ScriptInputUserData ctx = new ScriptInputUserData;
7977 ctx.
Write(use_stack_max);
7980
7982 {
7983 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(item2,null,GameInventory.c_InventoryReservationTimeoutShortMS);
7984 }
7985 }
7986 }
7987 else if (!
GetGame().IsMultiplayer())
7988 {
7990 }
7991 }
7992
7994 {
7996 }
7997
7999 {
8001 }
8002
8004 {
8006 }
8007
8009 {
8010
8011 return false;
8012 }
8013
8015 {
8016 return false;
8017 }
8018
8022 {
8023 return false;
8024 }
8025
8027 {
8028 return "";
8029 }
8030
8032
8034 {
8035 return false;
8036 }
8037
8039 {
8040 return true;
8041 }
8042
8043
8044
8046 {
8047 return true;
8048 }
8049
8051 {
8052 return true;
8053 }
8054
8056 {
8057 PlayerBase player = PlayerBase.Cast(
g_Game.GetPlayer());
8059 }
8060
8062 {
8064 }
8065
8067 {
8069 if (!is_being_placed)
8071 SetSynchDirty();
8072 }
8073
8074
8076
8078 {
8080 }
8081
8083 {
8085 }
8086
8088 {
8089 return 1;
8090 }
8091
8093 {
8094 return false;
8095 }
8096
8098 {
8100 SetSynchDirty();
8101 }
8102
8103
8104
8105
8106
8107
8108
8109
8110
8111
8112
8113
8114
8115
8116
8117
8118
8119
8120
8121
8122
8123
8124
8125
8126
8127
8128
8129
8130
8131
8132
8133
8134
8135
8136
8138 {
8139 super.OnMovedInsideCargo(container);
8140
8141 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8142 }
8143
8144 override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
8145 {
8146 super.EEItemLocationChanged(oldLoc,newLoc);
8147
8148 PlayerBase new_player = null;
8149 PlayerBase old_player = null;
8150
8151 if (newLoc.GetParent())
8152 new_player = PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
8153
8154 if (oldLoc.GetParent())
8155 old_player = PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
8156
8158 {
8159 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(this);
8160
8161 if (r_index >= 0)
8162 {
8163 InventoryLocation r_il = new InventoryLocation;
8164 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8165
8166 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8169 {
8170 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8171 }
8173 {
8174 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8175 }
8176
8177 }
8178 }
8179
8181 {
8182 if (new_player)
8183 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
8184
8185 if (new_player == old_player)
8186 {
8187
8188 if (oldLoc.GetParent() && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
8189 {
8191 {
8192 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc, false, false, false, true, false, false))
8193 {
8194 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8195 }
8196 }
8197 else
8198 {
8199 new_player.GetHumanInventory().SetUserReservedLocation(this,oldLoc);
8200 }
8201 }
8202
8203 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(this) >= 0)
8204 {
8205 int type = oldLoc.GetType();
8207 {
8208 oldLoc.GetParent().GetOnSetLock().Invoke(this);
8209 }
8211 {
8212 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(this, oldLoc.GetSlot());
8213 }
8214 }
8215 if (!m_OldLocation)
8216 {
8217 m_OldLocation = new InventoryLocation;
8218 }
8219 m_OldLocation.Copy(oldLoc);
8220 }
8221 else
8222 {
8223 if (m_OldLocation)
8224 {
8225 m_OldLocation.Reset();
8226 }
8227 }
8228
8230 }
8231 else
8232 {
8233 if (new_player)
8234 {
8235 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(this, newLoc);
8236 if (res_index >= 0)
8237 {
8238 InventoryLocation il = new InventoryLocation;
8239 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
8241 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
8244 {
8245 il.
GetParent().GetOnReleaseLock().Invoke(it);
8246 }
8248 {
8250 }
8251
8252 }
8253 }
8255 {
8256
8258 }
8259
8260 if (m_OldLocation)
8261 {
8262 m_OldLocation.Reset();
8263 }
8264 }
8265 }
8266
8267 override void EOnContact(IEntity other, Contact extra)
8268 {
8270 {
8271 int liquidType = -1;
8273 if (impactSpeed > 0.0)
8274 {
8276 #ifndef SERVER
8278 #else
8280 SetSynchDirty();
8281 #endif
8283 }
8284 }
8285
8286 #ifdef SERVER
8287 if (GetCompEM() && GetCompEM().IsPlugged())
8288 {
8289 if (GetCompEM().GetCordLength() < vector.Distance(
GetPosition(), GetCompEM().GetEnergySource().
GetPosition()))
8290 GetCompEM().UnplugThis();
8291 }
8292 #endif
8293 }
8294
8296
8298 {
8300 }
8301
8303 {
8304
8305 }
8306
8308 {
8309 super.OnItemLocationChanged(old_owner, new_owner);
8310
8311 PlayerBase relatedPlayer = PlayerBase.Cast(old_owner);
8312 PlayerBase playerNew = PlayerBase.Cast(new_owner);
8313
8314 if (!relatedPlayer && playerNew)
8315 relatedPlayer = playerNew;
8316
8317 if (relatedPlayer && relatedPlayer.GetPerformedActionID() != -1)
8318 {
8320 if (actionMgr)
8321 {
8322 ActionBase currentAction = actionMgr.GetRunningAction();
8323 if (currentAction)
8325 }
8326 }
8327
8328 Man ownerPlayerOld = null;
8329 Man ownerPlayerNew = null;
8330
8331 if (old_owner)
8332 {
8333 if (old_owner.
IsMan())
8334 {
8335 ownerPlayerOld = Man.Cast(old_owner);
8336 }
8337 else
8338 {
8339 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
8340 }
8341 }
8342 else
8343 {
8345 {
8347
8348 if (!action || !playerNew || playerNew.GetPerformedActionID() != action.
GetID())
8349 {
8350 GetCompEM().UnplugThis();
8351 }
8352 }
8353 }
8354
8355 if (new_owner)
8356 {
8357 if (new_owner.
IsMan())
8358 {
8359 ownerPlayerNew = Man.Cast(new_owner);
8360 }
8361 else
8362 {
8363 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
8364 }
8365 }
8366
8367 if (ownerPlayerOld != ownerPlayerNew)
8368 {
8369 if (ownerPlayerOld)
8370 {
8371 array<EntityAI> subItemsExit = new array<EntityAI>;
8373 for (int i = 0; i < subItemsExit.Count(); i++)
8374 {
8377 }
8378 }
8379
8380 if (ownerPlayerNew)
8381 {
8382 array<EntityAI> subItemsEnter = new array<EntityAI>;
8384 for (int j = 0; j < subItemsEnter.Count(); j++)
8385 {
8388 }
8389 }
8390 }
8391 else if (ownerPlayerNew != null)
8392 {
8393 PlayerBase nplayer;
8394 if (PlayerBase.CastTo(nplayer, ownerPlayerNew))
8395 {
8396 array<EntityAI> subItemsUpdate = new array<EntityAI>;
8398 for (int k = 0; k < subItemsUpdate.Count(); k++)
8399 {
8401 itemUpdate.UpdateQuickbarShortcutVisibility(nplayer);
8402 }
8403 }
8404 }
8405
8406 if (old_owner)
8407 old_owner.OnChildItemRemoved(this);
8408 if (new_owner)
8409 new_owner.OnChildItemReceived(this);
8410 }
8411
8412
8414 {
8415 super.EEDelete(parent);
8416 PlayerBase player = PlayerBase.Cast(GetHierarchyRootPlayer());
8417 if (player)
8418 {
8420
8421 if (player.IsAlive())
8422 {
8423 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(this);
8424 if (r_index >= 0)
8425 {
8426 InventoryLocation r_il = new InventoryLocation;
8427 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
8428
8429 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
8432 {
8433 r_il.
GetParent().GetOnReleaseLock().Invoke(
this);
8434 }
8436 {
8437 r_il.
GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.
GetSlot());
8438 }
8439
8440 }
8441
8442 player.RemoveQuickBarEntityShortcut(this);
8443 }
8444 }
8445 }
8446
8448 {
8449 super.EEKilled(killer);
8450
8453 {
8454 if (
GetTemperature() >= GameConstants.ITEM_TEMPERATURE_TO_EXPLODE_MIN)
8455 {
8456 if (IsMagazine())
8457 {
8458 if (Magazine.Cast(this).GetAmmoCount() > 0)
8459 {
8461 }
8462 }
8463 else
8464 {
8466 }
8467 }
8468 }
8469 }
8470
8472 {
8473 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(this, {Bolt_Base});
8474
8475 super.OnWasAttached(parent, slot_id);
8476
8479
8481 }
8482
8484 {
8485 super.OnWasDetached(parent, slot_id);
8486
8489 }
8490
8492 {
8493 int idx;
8496
8497 ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8498 if (inventory_slots.Count() < 1)
8499 {
8500 inventory_slots.Insert(ConfigGetString("ChangeInventorySlot"));
8501 attach_types.Insert(ConfigGetString("ChangeIntoOnAttach"));
8502 }
8503 else
8504 {
8505 ConfigGetTextArray("ChangeIntoOnAttach",attach_types);
8506 }
8507
8508 idx = inventory_slots.Find(slot);
8509 if (idx < 0)
8510 return "";
8511
8512 return attach_types.Get(idx);
8513 }
8514
8516 {
8517 int idx = -1;
8518 string slot;
8519
8522
8523 this.ConfigGetTextArray("ChangeInventorySlot",inventory_slots);
8524 if (inventory_slots.Count() < 1)
8525 {
8526 inventory_slots.Insert(this.ConfigGetString("ChangeInventorySlot"));
8527 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8528 }
8529 else
8530 {
8531 this.ConfigGetTextArray("ChangeIntoOnDetach",detach_types);
8532 if (detach_types.Count() < 1)
8533 detach_types.Insert(this.ConfigGetString("ChangeIntoOnDetach"));
8534 }
8535
8536 for (int i = 0; i < inventory_slots.Count(); i++)
8537 {
8538 slot = inventory_slots.Get(i);
8539 }
8540
8541 if (slot != "")
8542 {
8543 if (detach_types.Count() == 1)
8544 idx = 0;
8545 else
8546 idx = inventory_slots.Find(slot);
8547 }
8548 if (idx < 0)
8549 return "";
8550
8551 return detach_types.Get(idx);
8552 }
8553
8555 {
8556
8558
8559
8560 float min_time = 1;
8561 float max_time = 3;
8562 float delay = Math.RandomFloat(min_time, max_time);
8563
8564 explode_timer.Run(delay, this, "DoAmmoExplosion");
8565 }
8566
8568 {
8569 Magazine magazine = Magazine.Cast(this);
8570 int pop_sounds_count = 6;
8571 string pop_sounds[ 6 ] = { "ammopops_1","ammopops_2","ammopops_3","ammopops_4","ammopops_5","ammopops_6" };
8572
8573
8574 int sound_idx = Math.RandomInt(0, pop_sounds_count - 1);
8575 string sound_name = pop_sounds[ sound_idx ];
8577
8578
8579 magazine.ServerAddAmmoCount(-1);
8580
8581
8582 float min_temp_to_explode = 100;
8583
8584 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
8585 {
8587 }
8588 }
8589
8590
8591 override void EEHitBy(TotalDamageResult damageResult,
int damageType,
EntityAI source,
int component,
string dmgZone,
string ammo, vector modelPos,
float speedCoef)
8592 {
8593 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
8594
8595 const int CHANCE_DAMAGE_CARGO = 4;
8596 const int CHANCE_DAMAGE_ATTACHMENT = 1;
8597 const int CHANCE_DAMAGE_NOTHING = 2;
8598
8600 {
8601 float dmg = damageResult.
GetDamage(
"",
"Health") * -0.5;
8602 int chances;
8603 int rnd;
8604
8605 if (GetInventory().GetCargo())
8606 {
8607 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8608 rnd = Math.RandomInt(0,chances);
8609
8610 if (rnd < CHANCE_DAMAGE_CARGO)
8611 {
8613 }
8614 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
8615 {
8617 }
8618 }
8619 else
8620 {
8621 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
8622 rnd = Math.RandomInt(0,chances);
8623
8624 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
8625 {
8627 }
8628 }
8629 }
8630 }
8631
8633 {
8634 if (GetInventory().GetCargo())
8635 {
8636 int item_count = GetInventory().GetCargo().GetItemCount();
8637 if (item_count > 0)
8638 {
8639 int random_pick = Math.RandomInt(0, item_count);
8641 if (!item.IsExplosive())
8642 {
8643 item.AddHealth("","",damage);
8644 return true;
8645 }
8646 }
8647 }
8648 return false;
8649 }
8650
8652 {
8653 int attachment_count = GetInventory().AttachmentCount();
8654 if (attachment_count > 0)
8655 {
8656 int random_pick = Math.RandomInt(0, attachment_count);
8657 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
8658 if (!attachment.IsExplosive())
8659 {
8660 attachment.AddHealth("","",damage);
8661 return true;
8662 }
8663 }
8664 return false;
8665 }
8666
8668 {
8670 }
8671
8673 {
8675 return GetInventory().CanRemoveEntity();
8676
8677 return false;
8678 }
8679
8681 {
8682
8684 return false;
8685
8686
8688 return false;
8689
8690
8691
8693 if (delta == 0)
8694 return false;
8695
8696
8697 return true;
8698 }
8699
8701 {
8703 {
8704 if (ScriptInputUserData.CanStoreInputUserData())
8705 {
8706 ScriptInputUserData ctx = new ScriptInputUserData;
8711 ctx.
Write(destination_entity);
8715 }
8716 }
8717 else if (!
GetGame().IsMultiplayer())
8718 {
8720 }
8721 }
8722
8724 {
8725 float split_quantity_new;
8729 InventoryLocation loc = new InventoryLocation;
8730
8731 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8732 {
8734 split_quantity_new = stack_max;
8735 else
8737
8739 {
8740 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8741 if (new_item)
8742 {
8743 new_item.SetResultOfSplit(true);
8744 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8746 new_item.
SetQuantity(split_quantity_new,
false,
true);
8747 }
8748 }
8749 }
8750 else if (destination_entity && slot_id == -1)
8751 {
8752 if (quantity > stack_max)
8753 split_quantity_new = stack_max;
8754 else
8755 split_quantity_new = quantity;
8756
8758 {
8760 {
8763 }
8764
8765 if (new_item)
8766 {
8767 new_item.SetResultOfSplit(true);
8768 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8770 new_item.
SetQuantity(split_quantity_new,
false,
true);
8771 }
8772 }
8773 }
8774 else
8775 {
8776 if (stack_max != 0)
8777 {
8779 {
8781 }
8782
8783 if (split_quantity_new == 0)
8784 {
8785 if (!
GetGame().IsMultiplayer())
8786 player.PhysicalPredictiveDropItem(this);
8787 else
8788 player.ServerDropEntity(this);
8789 return;
8790 }
8791
8793 {
8795
8796 if (new_item)
8797 {
8798 new_item.SetResultOfSplit(true);
8799 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8802 new_item.PlaceOnSurface();
8803 }
8804 }
8805 }
8806 }
8807 }
8808
8810 {
8811 float split_quantity_new;
8815 InventoryLocation loc = new InventoryLocation;
8816
8817 if (destination_entity && slot_id != -1 && InventorySlots.IsSlotIdValid(slot_id))
8818 {
8820 split_quantity_new = stack_max;
8821 else
8823
8825 {
8826 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
8827 if (new_item)
8828 {
8829 new_item.SetResultOfSplit(true);
8830 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8832 new_item.
SetQuantity(split_quantity_new,
false,
true);
8833 }
8834 }
8835 }
8836 else if (destination_entity && slot_id == -1)
8837 {
8838 if (quantity > stack_max)
8839 split_quantity_new = stack_max;
8840 else
8841 split_quantity_new = quantity;
8842
8844 {
8846 {
8849 }
8850
8851 if (new_item)
8852 {
8853 new_item.SetResultOfSplit(true);
8854 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8856 new_item.
SetQuantity(split_quantity_new,
false,
true);
8857 }
8858 }
8859 }
8860 else
8861 {
8862 if (stack_max != 0)
8863 {
8865 {
8867 }
8868
8870 {
8872
8873 if (new_item)
8874 {
8875 new_item.SetResultOfSplit(true);
8876 MiscGameplayFunctions.TransferItemProperties(this, new_item);
8879 new_item.PlaceOnSurface();
8880 }
8881 }
8882 }
8883 }
8884 }
8885
8887 {
8889 {
8890 if (ScriptInputUserData.CanStoreInputUserData())
8891 {
8892 ScriptInputUserData ctx = new ScriptInputUserData;
8897 dst.WriteToContext(ctx);
8899 }
8900 }
8901 else if (!
GetGame().IsMultiplayer())
8902 {
8904 }
8905 }
8906
8908 {
8910 {
8911 if (ScriptInputUserData.CanStoreInputUserData())
8912 {
8913 ScriptInputUserData ctx = new ScriptInputUserData;
8918 ctx.
Write(destination_entity);
8924 }
8925 }
8926 else if (!
GetGame().IsMultiplayer())
8927 {
8929 }
8930 }
8931
8933 {
8935 }
8936
8938 {
8940 float split_quantity_new;
8942 if (dst.IsValid())
8943 {
8944 int slot_id = dst.GetSlot();
8946
8947 if (quantity > stack_max)
8948 split_quantity_new = stack_max;
8949 else
8950 split_quantity_new = quantity;
8951
8953 {
8955
8956 if (new_item)
8957 {
8958 new_item.SetResultOfSplit(true);
8959 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8961 new_item.
SetQuantity(split_quantity_new,
false,
true);
8962 }
8963
8964 return new_item;
8965 }
8966 }
8967
8968 return null;
8969 }
8970
8972 {
8974 float split_quantity_new;
8976 if (destination_entity)
8977 {
8979 if (quantity > stackable)
8980 split_quantity_new = stackable;
8981 else
8982 split_quantity_new = quantity;
8983
8985 {
8986 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
8987 if (new_item)
8988 {
8989 new_item.SetResultOfSplit(true);
8990 MiscGameplayFunctions.TransferItemProperties(this,new_item);
8992 new_item.
SetQuantity(split_quantity_new,
false,
true);
8993 }
8994 }
8995 }
8996 }
8997
8999 {
9001 {
9002 if (ScriptInputUserData.CanStoreInputUserData())
9003 {
9004 ScriptInputUserData ctx = new ScriptInputUserData;
9009 ItemBase destination_entity =
this;
9010 ctx.
Write(destination_entity);
9014 }
9015 }
9016 else if (!
GetGame().IsMultiplayer())
9017 {
9019 }
9020 }
9021
9023 {
9025 float split_quantity_new;
9027 if (player)
9028 {
9030 if (quantity > stackable)
9031 split_quantity_new = stackable;
9032 else
9033 split_quantity_new = quantity;
9034
9036 {
9037 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
9038 new_item =
ItemBase.Cast(in_hands);
9039 if (new_item)
9040 {
9041 new_item.SetResultOfSplit(true);
9042 MiscGameplayFunctions.TransferItemProperties(this,new_item);
9044 new_item.SetQuantity(split_quantity_new, false, true);
9045 }
9046 }
9047 }
9048 }
9049
9051 {
9053 float split_quantity_new = Math.Floor(quantity * 0.5);
9054
9056 return;
9057
9059
9060 if (new_item)
9061 {
9062 if (new_item.GetQuantityMax() < split_quantity_new)
9063 {
9064 split_quantity_new = new_item.GetQuantityMax();
9065 }
9066
9067 new_item.SetResultOfSplit(true);
9068 MiscGameplayFunctions.TransferItemProperties(this, new_item);
9069
9071 {
9074 }
9075 else
9076 {
9078 new_item.
SetQuantity(split_quantity_new,
false,
true);
9079 }
9080 }
9081 }
9082
9084 {
9086 float split_quantity_new = Math.Floor(quantity / 2);
9087
9089 return;
9090
9091 InventoryLocation invloc = new InventoryLocation;
9093
9095 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(this, true);
9096
9097 if (new_item)
9098 {
9099 if (new_item.GetQuantityMax() < split_quantity_new)
9100 {
9101 split_quantity_new = new_item.GetQuantityMax();
9102 }
9104 {
9107 }
9108 else if (split_quantity_new > 1)
9109 {
9111 new_item.
SetQuantity(split_quantity_new,
false,
true);
9112 }
9113 }
9114 }
9115
9118 {
9119 SetWeightDirty();
9121
9122 if (parent)
9123 parent.OnAttachmentQuantityChangedEx(this, delta);
9124
9126 {
9128 {
9130 }
9132 {
9133 ErrorEx(
"Undefined liquid type quantity changed, please define liquid type first! Using init value.",
ErrorExSeverity.INFO);
9135 }
9136 }
9137
9138 }
9139
9142 {
9143
9144 }
9145
9148 {
9150 }
9151
9153 {
9154 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
9155
9157 {
9158 if (newLevel == GameConstants.STATE_RUINED)
9159 {
9161 EntityAI parent = GetHierarchyParent();
9162 if (parent && parent.IsFireplace())
9163 {
9164 CargoBase cargo = GetInventory().GetCargo();
9165 if (cargo)
9166 {
9168 {
9170 }
9171 }
9172 }
9173 }
9174
9176 {
9177
9179 return;
9180 }
9181
9182 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
9183 {
9185 }
9186 }
9187 }
9188
9189
9191 {
9192 super.OnRightClick();
9193
9195 {
9197 {
9198 if (ScriptInputUserData.CanStoreInputUserData())
9199 {
9200 EntityAI root = GetHierarchyRoot();
9201 Man playerOwner = GetHierarchyRootPlayer();
9202 InventoryLocation dst = new InventoryLocation;
9203
9204
9205 if (!playerOwner && root && root == this)
9206 {
9208 }
9209 else
9210 {
9211
9212 GetInventory().GetCurrentInventoryLocation(dst);
9214 {
9217 {
9219 }
9220 else
9221 {
9223
9224
9225 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
this, dst))
9226 {
9228 }
9229 else
9230 {
9231 GetGame().
GetPlayer().GetInventory().AddInventoryReservationEx(null, dst, GameInventory.c_InventoryReservationTimeoutShortMS);
9232 }
9233 }
9234 }
9235 }
9236
9237 ScriptInputUserData ctx = new ScriptInputUserData;
9245 }
9246 }
9247 else if (!
GetGame().IsMultiplayer())
9248 {
9250 }
9251 }
9252 }
9253
9255 {
9256 if (root)
9257 {
9258 vector m4[4];
9259 root.GetTransform(m4);
9260 dst.SetGround(this, m4);
9261 }
9262 else
9263 {
9264 GetInventory().GetCurrentInventoryLocation(dst);
9265 }
9266 }
9267
9268 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
9269 {
9270
9271 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
9272 return false;
9273
9274 if (GetHealthLevel() == GameConstants.STATE_RUINED || other_item.GetHealthLevel() == GameConstants.STATE_RUINED)
9275 return false;
9276
9277
9279 return false;
9280
9281
9282 Magazine mag = Magazine.Cast(this);
9283 if (mag)
9284 {
9285 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
9286 return false;
9287
9288 if (stack_max_limit)
9289 {
9290 Magazine other_mag = Magazine.Cast(other_item);
9291 if (other_item)
9292 {
9293 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
9294 return false;
9295 }
9296
9297 }
9298 }
9299 else
9300 {
9301
9303 return false;
9304
9306 return false;
9307 }
9308
9309 PlayerBase player = null;
9310 if (CastTo(player, GetHierarchyRootPlayer()))
9311 {
9312 if (player.GetInventory().HasAttachment(this))
9313 return false;
9314
9315 if (player.IsItemsToDelete())
9316 return false;
9317 }
9318
9319 if (reservation_check && (GetInventory().HasInventoryReservation(this, null) || other_item.GetInventory().HasInventoryReservation(other_item, null)))
9320 return false;
9321
9322 int slotID;
9324 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
9325 return false;
9326
9327 return true;
9328 }
9329
9331 {
9333 }
9334
9336 {
9337 return m_IsResultOfSplit;
9338 }
9339
9341 {
9342 m_IsResultOfSplit = value;
9343 }
9344
9346 {
9348 }
9349
9351 {
9352 float other_item_quantity = other_item.GetQuantity();
9353 float this_free_space;
9354
9356
9358
9359 if (other_item_quantity > this_free_space)
9360 {
9361 return this_free_space;
9362 }
9363 else
9364 {
9365 return other_item_quantity;
9366 }
9367 }
9368
9370 {
9372 }
9373
9375 {
9377 return;
9378
9379 if (!IsMagazine() && other_item)
9380 {
9382 if (quantity_used != 0)
9383 {
9384 float hp1 = GetHealth01("","");
9385 float hp2 = other_item.GetHealth01("","");
9386 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
9387 hpResult = hpResult / (
GetQuantity() + quantity_used);
9388
9389 hpResult *= GetMaxHealth();
9390 Math.Round(hpResult);
9391 SetHealth("", "Health", hpResult);
9392
9394 other_item.AddQuantity(-quantity_used);
9395 }
9396 }
9398 }
9399
9401 {
9402 #ifdef SERVER
9403 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
9404 GetHierarchyParent().IncreaseLifetimeUp();
9405 #endif
9406 };
9407
9409 {
9410 PlayerBase p = PlayerBase.Cast(player);
9411
9412 array<int> recipesIds = p.m_Recipes;
9413 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9414 if (moduleRecipesManager)
9415 {
9416 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
9417 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
9418 }
9419
9420 for (int i = 0;i < recipesIds.Count(); i++)
9421 {
9422 int key = recipesIds.Get(i);
9423 string recipeName = moduleRecipesManager.GetRecipeName(key);
9425 }
9426 }
9427
9428
9429 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
9430 {
9431 super.GetDebugActions(outputList);
9432
9433
9439
9440
9445
9450
9451
9455
9456
9458 {
9462 }
9463
9466
9467
9471
9473
9474 InventoryLocation loc = new InventoryLocation();
9475 GetInventory().GetCurrentInventoryLocation(loc);
9477 {
9478 if (Gizmo_IsSupported())
9481 }
9482
9484 }
9485
9486
9487
9488
9490 {
9491 super.OnAction(action_id, player, ctx);
9492
9494 {
9495 switch (action_id)
9496 {
9499 return true;
9502 return true;
9503 }
9504 }
9505
9507 {
9508 switch (action_id)
9509 {
9511 Delete();
9512 return true;
9513 }
9514 }
9515
9516 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
9517 {
9518 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
9519 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
9520 PlayerBase p = PlayerBase.Cast(player);
9521 if (
EActions.RECIPES_RANGE_START < 1000)
9522 {
9523 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
9524 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
9525 }
9526 }
9527 #ifndef SERVER
9528 else if (action_id ==
EActions.WATCH_PLAYER)
9529 {
9530 PluginDeveloper.SetDeveloperItemClientEx(player);
9531 }
9532 #endif
9534 {
9535 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
9536 {
9537 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
9538 OnDebugButtonPressServer(id + 1);
9539 }
9540
9541 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
9542 {
9543 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
9545 }
9546
9547 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
9548 {
9549 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
9551 }
9552
9553 else if (action_id ==
EActions.ADD_QUANTITY)
9554 {
9555 if (IsMagazine())
9556 {
9557 Magazine mag = Magazine.Cast(this);
9558 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
9559 }
9560 else
9561 {
9563 }
9564
9565 if (m_EM)
9566 {
9567 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
9568 }
9569
9570 }
9571
9572 else if (action_id ==
EActions.REMOVE_QUANTITY)
9573 {
9574 if (IsMagazine())
9575 {
9576 Magazine mag2 = Magazine.Cast(this);
9577 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
9578 }
9579 else
9580 {
9582 }
9583 if (m_EM)
9584 {
9585 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
9586 }
9587
9588 }
9589
9590 else if (action_id ==
EActions.SET_QUANTITY_0)
9591 {
9593
9594 if (m_EM)
9595 {
9596 m_EM.SetEnergy(0);
9597 }
9598 }
9599
9600 else if (action_id ==
EActions.SET_MAX_QUANTITY)
9601 {
9603
9604 if (m_EM)
9605 {
9606 m_EM.SetEnergy(m_EM.GetEnergyMax());
9607 }
9608 }
9609
9610 else if (action_id ==
EActions.ADD_HEALTH)
9611 {
9612 AddHealth("","",GetMaxHealth("","Health")/5);
9613 }
9614 else if (action_id ==
EActions.REMOVE_HEALTH)
9615 {
9616 AddHealth("","",-GetMaxHealth("","Health")/5);
9617 }
9618 else if (action_id ==
EActions.DESTROY_HEALTH)
9619 {
9620 SetHealth01("","",0);
9621 }
9622 else if (action_id ==
EActions.WATCH_ITEM)
9623 {
9625 mid.RegisterDebugItem(
ItemBase.Cast(
this), PlayerBase.Cast(player));
9626 #ifdef DEVELOPER
9627 SetDebugDeveloper_item(this);
9628 #endif
9629 }
9630
9631 else if (action_id ==
EActions.ADD_TEMPERATURE)
9632 {
9633 AddTemperature(20);
9634
9635 }
9636
9637 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
9638 {
9639 AddTemperature(-20);
9640
9641 }
9642
9643 else if (action_id ==
EActions.FLIP_FROZEN)
9644 {
9645 SetFrozen(!GetIsFrozen());
9646
9647 }
9648
9649 else if (action_id ==
EActions.ADD_WETNESS)
9650 {
9652
9653 }
9654
9655 else if (action_id ==
EActions.REMOVE_WETNESS)
9656 {
9658
9659 }
9660
9661 else if (action_id ==
EActions.LIQUIDTYPE_UP)
9662 {
9665
9666
9667 }
9668
9669 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
9670 {
9673 }
9674
9675 else if (action_id ==
EActions.MAKE_SPECIAL)
9676 {
9677 auto debugParams = DebugSpawnParams.WithPlayer(player);
9678 OnDebugSpawnEx(debugParams);
9679 }
9680
9681 }
9682
9683
9684 return false;
9685 }
9686
9687
9688
9689
9693
9696
9697
9698
9700 {
9701 return false;
9702 }
9703
9704
9706 {
9707 return true;
9708 }
9709
9710
9712 {
9713 return true;
9714 }
9715
9716
9717
9719 {
9720 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
9722 }
9723
9726 {
9727 return null;
9728 }
9729
9731 {
9732 return false;
9733 }
9734
9736 {
9737 return false;
9738 }
9739
9743
9744
9746 {
9747 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9748 return module_repairing.CanRepair(this, item_repair_kit);
9749 }
9750
9751
9752 bool Repair(PlayerBase player,
ItemBase item_repair_kit,
float specialty_weight)
9753 {
9754 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
9755 return module_repairing.Repair(player, this, item_repair_kit, specialty_weight);
9756 }
9757
9758
9760 {
9761
9762
9763
9764
9765
9766
9767
9768
9769 return 1;
9770 }
9771
9772
9773
9775 {
9777 }
9778
9779
9780
9782 {
9784 }
9785
9786
9795 {
9796 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9797
9798 if (player)
9799 {
9800 player.MessageStatus(text);
9801 }
9802 }
9803
9804
9813 {
9814 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9815
9816 if (player)
9817 {
9818 player.MessageAction(text);
9819 }
9820 }
9821
9822
9831 {
9832 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9833
9834 if (player)
9835 {
9836 player.MessageFriendly(text);
9837 }
9838 }
9839
9840
9849 {
9850 PlayerBase player = PlayerBase.Cast(this.GetHierarchyRootPlayer());
9851
9852 if (player)
9853 {
9854 player.MessageImportant(text);
9855 }
9856 }
9857
9859 {
9860 return true;
9861 }
9862
9863
9864 override bool KindOf(
string tag)
9865 {
9866 bool found = false;
9867 string item_name = this.
GetType();
9870
9871 int array_size = item_tag_array.Count();
9872 for (int i = 0; i < array_size; i++)
9873 {
9874 if (item_tag_array.Get(i) == tag)
9875 {
9876 found = true;
9877 break;
9878 }
9879 }
9880 return found;
9881 }
9882
9883
9885 {
9886
9887 super.OnRPC(sender, rpc_type,ctx);
9888
9889
9890 switch (rpc_type)
9891 {
9892 #ifndef SERVER
9893 case ERPCs.RPC_SOUND_LOCK_ATTACH:
9894 Param2<bool, string> p = new Param2<bool, string>(false, "");
9895
9897 return;
9898
9899 bool play = p.param1;
9900 string soundSet = p.param2;
9901
9902 if (play)
9903 {
9905 {
9907 {
9909 }
9910 }
9911 else
9912 {
9914 }
9915 }
9916 else
9917 {
9919 }
9920
9921 break;
9922 #endif
9923
9924 }
9925
9927 {
9929 }
9930 }
9931
9932
9933
9934
9936 {
9937 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9938 return plugin.GetID(
name);
9939 }
9940
9942 {
9943 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
9944 return plugin.GetName(id);
9945 }
9946
9949 {
9950
9951
9952 int varFlags;
9953 if (!ctx.
Read(varFlags))
9954 return;
9955
9956 if (varFlags & ItemVariableFlags.FLOAT)
9957 {
9959 }
9960 }
9961
9963 {
9964
9965 super.SerializeNumericalVars(floats_out);
9966
9967
9968
9970 {
9972 }
9973
9975 {
9977 }
9978
9980 {
9982 }
9983
9985 {
9990 }
9991
9993 {
9995 }
9996 }
9997
9999 {
10000
10001 super.DeSerializeNumericalVars(floats);
10002
10003
10004 int index = 0;
10005 int mask = Math.Round(floats.Get(index));
10006
10007 index++;
10008
10010 {
10012 {
10014 }
10015 else
10016 {
10017 float quantity = floats.Get(index);
10018 SetQuantity(quantity,
true,
false,
false,
false);
10019 }
10020 index++;
10021 }
10022
10024 {
10025 float wet = floats.Get(index);
10027 index++;
10028 }
10029
10031 {
10032 int liquidtype = Math.Round(floats.Get(index));
10034 index++;
10035 }
10036
10038 {
10040 index++;
10042 index++;
10044 index++;
10046 index++;
10047 }
10048
10050 {
10051 int cleanness = Math.Round(floats.Get(index));
10053 index++;
10054 }
10055 }
10056
10058 {
10059 super.WriteVarsToCTX(ctx);
10060
10061
10063 {
10065 }
10066
10068 {
10070 }
10071
10073 {
10075 }
10076
10078 {
10079 int r,g,b,a;
10085 }
10086
10088 {
10090 }
10091 }
10092
10094 {
10095 if (!super.ReadVarsFromCTX(ctx,version))
10096 return false;
10097
10098 int intValue;
10099 float value;
10100
10101 if (version < 140)
10102 {
10103 if (!ctx.
Read(intValue))
10104 return false;
10105
10106 m_VariablesMask = intValue;
10107 }
10108
10110 {
10111 if (!ctx.
Read(value))
10112 return false;
10113
10115 {
10117 }
10118 else
10119 {
10121 }
10122 }
10123
10124 if (version < 140)
10125 {
10127 {
10128 if (!ctx.
Read(value))
10129 return false;
10130 SetTemperatureDirect(value);
10131 }
10132 }
10133
10135 {
10136 if (!ctx.
Read(value))
10137 return false;
10139 }
10140
10142 {
10143 if (!ctx.
Read(intValue))
10144 return false;
10146 }
10147
10149 {
10150 int r,g,b,a;
10152 return false;
10154 return false;
10156 return false;
10158 return false;
10159
10161 }
10162
10164 {
10165 if (!ctx.
Read(intValue))
10166 return false;
10168 }
10169
10170 if (version >= 138 && version < 140)
10171 {
10173 {
10174 if (!ctx.
Read(intValue))
10175 return false;
10176 SetFrozen(intValue);
10177 }
10178 }
10179
10180 return true;
10181 }
10182
10183
10185 {
10188 {
10190 }
10191
10192 if (!super.OnStoreLoad(ctx, version))
10193 {
10195 return false;
10196 }
10197
10198 if (version >= 114)
10199 {
10200 bool hasQuickBarIndexSaved;
10201
10202 if (!ctx.
Read(hasQuickBarIndexSaved))
10203 {
10205 return false;
10206 }
10207
10208 if (hasQuickBarIndexSaved)
10209 {
10210 int itmQBIndex;
10211
10212
10213 if (!ctx.
Read(itmQBIndex))
10214 {
10216 return false;
10217 }
10218
10219 PlayerBase parentPlayer = PlayerBase.Cast(GetHierarchyRootPlayer());
10220 if (itmQBIndex != -1 && parentPlayer)
10221 parentPlayer.SetLoadedQuickBarItemBind(this, itmQBIndex);
10222 }
10223 }
10224 else
10225 {
10226
10227 PlayerBase player;
10228 int itemQBIndex;
10229 if (version ==
int.
MAX)
10230 {
10231 if (!ctx.
Read(itemQBIndex))
10232 {
10234 return false;
10235 }
10236 }
10237 else if (Class.CastTo(player, GetHierarchyRootPlayer()))
10238 {
10239
10240 if (!ctx.
Read(itemQBIndex))
10241 {
10243 return false;
10244 }
10245 if (itemQBIndex != -1 && player)
10246 player.SetLoadedQuickBarItemBind(this,itemQBIndex);
10247 }
10248 }
10249
10250 if (version < 140)
10251 {
10252
10253 if (!LoadVariables(ctx, version))
10254 {
10256 return false;
10257 }
10258 }
10259
10260
10262 {
10264 return false;
10265 }
10266 if (version >= 132)
10267 {
10269 if (raib)
10270 {
10272 {
10274 return false;
10275 }
10276 }
10277 }
10278
10280 return true;
10281 }
10282
10283
10284
10286 {
10287 super.OnStoreSave(ctx);
10288
10289 PlayerBase player;
10290 if (PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
10291 {
10293
10294 int itemQBIndex = -1;
10295 itemQBIndex = player.FindQuickBarEntityIndex(this);
10296 ctx.
Write(itemQBIndex);
10297 }
10298 else
10299 {
10301 }
10302
10304
10306 if (raib)
10307 {
10309 }
10310 }
10311
10312
10314 {
10315 super.AfterStoreLoad();
10316
10318 {
10320 }
10321
10323 {
10326 }
10327 }
10328
10330 {
10331 super.EEOnAfterLoad();
10332
10334 {
10336 }
10337
10340 }
10341
10343 {
10344 return false;
10345 }
10346
10347
10348
10350 {
10352 {
10353 #ifdef PLATFORM_CONSOLE
10354
10356 {
10358 if (menu)
10359 {
10361 }
10362 }
10363 #endif
10364 }
10365
10367 {
10370 }
10371
10373 {
10374 SetWeightDirty();
10376 }
10378 {
10381 }
10382
10384 {
10387 }
10389 {
10392 }
10393
10394 super.OnVariablesSynchronized();
10395 }
10396
10397
10398
10400 override bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
10401 {
10402 if (!IsServerCheck(allow_client))
10403 return false;
10404
10406 return false;
10407
10410
10411 if (value <= (min + 0.001))
10412 value = min;
10413
10414 if (value == min)
10415 {
10416 if (destroy_config)
10417 {
10418 bool dstr = ConfigGetBool("varQuantityDestroyOnMin");
10419 if (dstr)
10420 {
10422 this.Delete();
10423 return true;
10424 }
10425 }
10426 else if (destroy_forced)
10427 {
10429 this.Delete();
10430 return true;
10431 }
10432
10434 }
10435
10438
10440 {
10442
10443 if (delta)
10445 }
10446
10448
10449 return false;
10450 }
10451
10452
10454 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10455 {
10457 }
10458
10460 {
10463 }
10464
10466 {
10469 }
10470
10472 override void SetQuantityNormalized(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
10473 {
10474 float value_clamped = Math.Clamp(value, 0, 1);
10476 SetQuantity(result, destroy_config, destroy_forced);
10477 }
10478
10479
10482 {
10484 }
10485
10487 {
10489 }
10490
10491
10492
10493
10494
10495
10496
10497
10498
10499
10501 {
10502 int slot = -1;
10503 if (GetInventory())
10504 {
10505 InventoryLocation il = new InventoryLocation;
10506 GetInventory().GetCurrentInventoryLocation(il);
10508 }
10509
10511 }
10512
10514 {
10515 float quantity_max = 0;
10516
10518 {
10519 if (attSlotID != -1)
10520 quantity_max = InventorySlots.GetStackMaxForSlotId(attSlotID);
10521
10522 if (quantity_max <= 0)
10524 }
10525
10526 if (quantity_max <= 0)
10528
10529 return quantity_max;
10530 }
10531
10533 {
10535 }
10536
10538 {
10540 }
10541
10542
10544 {
10546 }
10547
10549 {
10551 }
10552
10554 {
10556 }
10557
10558
10560 {
10561
10562 float weightEx = GetWeightEx();
10563 float special = GetInventoryAndCargoWeight();
10564 return weightEx - special;
10565 }
10566
10567
10569 {
10571 }
10572
10574 {
10576 {
10577 #ifdef DEVELOPER
10578 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10579 {
10580 WeightDebugData data1 = WeightDebug.GetWeightDebug(this);
10582 }
10583 #endif
10584
10585 return GetQuantity() * GetConfigWeightModified();
10586 }
10587 else if (HasEnergyManager())
10588 {
10589 #ifdef DEVELOPER
10590 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10591 {
10592 WeightDebugData data2 = WeightDebug.GetWeightDebug(this);
10593 data2.
SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
10594 }
10595 #endif
10596 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat("weightPerQuantityUnit")) + GetConfigWeightModified();
10597 }
10598 else
10599 {
10600 #ifdef DEVELOPER
10601 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
10602 {
10603 WeightDebugData data3 = WeightDebug.GetWeightDebug(this);
10604 data3.
SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
10605 }
10606 #endif
10607 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified();
10608 }
10609 }
10610
10613 {
10614 int item_count = 0;
10616
10617 if (GetInventory().GetCargo() != NULL)
10618 {
10619 item_count = GetInventory().GetCargo().GetItemCount();
10620 }
10621
10622 for (int i = 0; i < GetInventory().AttachmentCount(); i++)
10623 {
10624 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
10625 if (item)
10626 item_count += item.GetNumberOfItems();
10627 }
10628 return item_count;
10629 }
10630
10633 {
10634 float weight = 0;
10635 float wetness = 1;
10636 if (include_wetness)
10639 {
10640 weight = wetness * m_ConfigWeight;
10641 }
10643 {
10644 weight = 1;
10645 }
10646 return weight;
10647 }
10648
10649
10650
10652 {
10653 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
10654 {
10655 GameInventory inv = GetInventory();
10656 array<EntityAI> items = new array<EntityAI>;
10658 for (int i = 0; i < items.Count(); i++)
10659 {
10661 if (item)
10662 {
10664 }
10665 }
10666 }
10667 }
10668
10669
10670
10671
10673 {
10674 float energy = 0;
10675 if (HasEnergyManager())
10676 {
10677 energy = GetCompEM().GetEnergy();
10678 }
10679 return energy;
10680 }
10681
10682
10684 {
10685 super.OnEnergyConsumed();
10686
10688 }
10689
10691 {
10692 super.OnEnergyAdded();
10693
10695 }
10696
10697
10699 {
10700 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
10701 {
10703 {
10704 float energy_0to1 = GetCompEM().GetEnergy0To1();
10706 }
10707 }
10708 }
10709
10710
10712 {
10713 return ConfigGetFloat("heatIsolation");
10714 }
10715
10717 {
10719 }
10720
10722 {
10723 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
10724 if (
GetGame().ConfigIsExisting(paramPath))
10726
10727 return 0.0;
10728 }
10729
10731 {
10732 string paramPath =
string.
Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
10733 if (
GetGame().ConfigIsExisting(paramPath))
10735
10736 return 0.0;
10737 }
10738
10739 override void SetWet(
float value,
bool allow_client =
false)
10740 {
10741 if (!IsServerCheck(allow_client))
10742 return;
10743
10746
10748
10749 m_VarWet = Math.Clamp(value, min, max);
10750
10752 {
10755 }
10756 }
10757
10758 override void AddWet(
float value)
10759 {
10761 }
10762
10764 {
10766 }
10767
10769 {
10771 }
10772
10774 {
10776 }
10777
10779 {
10781 }
10782
10784 {
10786 }
10787
10788 override void OnWetChanged(
float newVal,
float oldVal)
10789 {
10792 if (newLevel != oldLevel)
10793 {
10795 }
10796 }
10797
10799 {
10800 SetWeightDirty();
10801 }
10802
10804 {
10805 return GetWetLevelInternal(
m_VarWet);
10806 }
10807
10808
10809
10811 {
10813 }
10814
10816 {
10818 }
10819
10821 {
10823 }
10824
10826 {
10828 }
10829
10830
10831
10833 {
10834 if (ConfigIsExisting("itemModelLength"))
10835 {
10836 return ConfigGetFloat("itemModelLength");
10837 }
10838 return 0;
10839 }
10840
10842 {
10843 if (ConfigIsExisting("itemAttachOffset"))
10844 {
10845 return ConfigGetFloat("itemAttachOffset");
10846 }
10847 return 0;
10848 }
10849
10850 override void SetCleanness(
int value,
bool allow_client =
false)
10851 {
10852 if (!IsServerCheck(allow_client))
10853 return;
10854
10856
10858
10861 }
10862
10864 {
10866 }
10867
10869 {
10870 return true;
10871 }
10872
10873
10874
10875
10877 {
10879 }
10880
10882 {
10884 }
10885
10886
10887
10888
10889 override void SetColor(
int r,
int g,
int b,
int a)
10890 {
10896 }
10898 override void GetColor(out
int r,out
int g,out
int b,out
int a)
10899 {
10904 }
10905
10907 {
10909 }
10910
10913 {
10914 int r,g,b,a;
10916 r = r/255;
10917 g = g/255;
10918 b = b/255;
10919 a = a/255;
10920 return MiscGameplayFunctions.GetColorString(r, g, b, a);
10921 }
10922
10923
10924
10925 override void SetLiquidType(
int value,
bool allow_client =
false)
10926 {
10927 if (!IsServerCheck(allow_client))
10928 return;
10929
10934 }
10935
10937 {
10938 return ConfigGetInt("varLiquidTypeInit");
10939 }
10940
10942 {
10944 }
10945
10947 {
10949 SetFrozen(false);
10950 }
10951
10954 {
10955 player.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10956 }
10957
10958
10961 {
10962 PlayerBase nplayer;
10963 if (PlayerBase.CastTo(nplayer, player))
10964 {
10966
10967 nplayer.SetEnableQuickBarEntityShortcut(this,!GetHierarchyParent() || GetHierarchyParent().GetInventory().AreChildrenAccessible());
10968 }
10969 }
10970
10971
10974 {
10975 PlayerBase nplayer;
10976 if (PlayerBase.CastTo(nplayer,player))
10977 {
10978
10979 nplayer.SetEnableQuickBarEntityShortcut(this,false);
10980
10981 }
10982
10983
10984 player.GetHumanInventory().ClearUserReservedLocationForContainer(this);
10985
10986
10987 if (HasEnergyManager())
10988 {
10989 GetCompEM().UpdatePlugState();
10990 }
10991 }
10992
10993
10995 {
10996 super.OnPlacementStarted(player);
10997
10999 }
11000
11001 override void OnPlacementComplete(Man player, vector position =
"0 0 0", vector orientation =
"0 0 0")
11002 {
11004 {
11005 m_AdminLog.OnPlacementComplete(player,
this);
11006 }
11007
11008 super.OnPlacementComplete(player, position, orientation);
11009 }
11010
11011
11012
11013
11014
11016 {
11018 {
11019 return true;
11020 }
11021 else
11022 {
11023 return false;
11024 }
11025 }
11026
11027
11029 {
11031 {
11033 }
11034 }
11035
11036
11038 {
11040 }
11041
11043 {
11045 }
11046
11047 override void InsertAgent(
int agent,
float count = 1)
11048 {
11049 if (count < 1)
11050 return;
11051
11053 }
11054
11057 {
11059 }
11060
11061
11063 {
11065 }
11066
11067
11068
11069
11070
11071
11072
11073
11074
11075
11076
11077
11078
11079
11080
11081
11082
11083
11084
11085
11086
11087
11088
11089
11090
11091
11092
11093
11094
11095
11096
11097
11098
11099
11100
11101
11102
11103
11104
11105
11106
11107
11109 {
11111 return false;
11112 return true;
11113 }
11114
11116 {
11117
11119 }
11120
11121
11124 {
11125 super.CheckForRoofLimited(timeTresholdMS);
11126
11128 if ((time - m_PreviousRoofTestTime) >= timeTresholdMS)
11129 {
11130 m_PreviousRoofTestTime = time;
11131 SetRoofAbove(MiscGameplayFunctions.IsUnderRoof(this));
11132 }
11133 }
11134
11135
11137 {
11139 {
11140 return 0;
11141 }
11142
11143 if (GetInventory().GetAttachmentSlotsCount() != 0)
11144 {
11145 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
11146 if (filter)
11147 return filter.GetProtectionLevel(type, false, system);
11148 else
11149 return 0;
11150 }
11151
11152 string subclassPath, entryName;
11153
11154 switch (type)
11155 {
11157 entryName = "biological";
11158 break;
11160 entryName = "chemical";
11161 break;
11162 default:
11163 entryName = "biological";
11164 break;
11165 }
11166
11167 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
11168
11170 }
11171
11172
11173
11176 {
11177 if (!IsMagazine())
11179
11181 }
11182
11183
11184
11185
11186
11191 {
11192 return true;
11193 }
11194
11196 {
11198 }
11199
11200
11201
11202
11203
11205 {
11206 if (parent)
11207 {
11208 if (parent.IsInherited(DayZInfected))
11209 return true;
11210
11211 if (!parent.IsRuined())
11212 return true;
11213 }
11214
11215 return true;
11216 }
11217
11219 {
11220 if (!super.CanPutAsAttachment(parent))
11221 {
11222 return false;
11223 }
11224
11225 if (!IsRuined() && !parent.IsRuined())
11226 {
11227 return true;
11228 }
11229
11230 return false;
11231 }
11232
11234 {
11235
11236
11237
11238
11239 return super.CanReceiveItemIntoCargo(item);
11240 }
11241
11243 {
11244
11245
11246
11247
11248 GameInventory attachmentInv = attachment.GetInventory();
11250 {
11251 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(PlayerBase))
11252 return false;
11253 }
11254
11255 InventoryLocation loc = new InventoryLocation();
11256 attachment.GetInventory().GetCurrentInventoryLocation(loc);
11257 if (loc && loc.
IsValid() && !GetInventory().AreChildrenAccessible())
11258 return false;
11259
11260 return super.CanReceiveAttachment(attachment, slotId);
11261 }
11262
11264 {
11265 if (!super.CanReleaseAttachment(attachment))
11266 return false;
11267
11268 return GetInventory().AreChildrenAccessible();
11269 }
11270
11271
11272
11273
11274
11275
11276
11277
11278
11279
11280
11281
11282
11283
11284
11285
11286
11287
11288
11289
11290
11292 {
11293 int id = muzzle_owner.GetMuzzleID();
11294 array<ref WeaponParticlesOnFire> WPOF_array =
m_OnFireEffect.Get(
id);
11295
11296 if (WPOF_array)
11297 {
11298 for (int i = 0; i < WPOF_array.Count(); i++)
11299 {
11300 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
11301
11302 if (WPOF)
11303 {
11304 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
11305 }
11306 }
11307 }
11308 }
11309
11310
11312 {
11313 int id = muzzle_owner.GetMuzzleID();
11315
11316 if (WPOBE_array)
11317 {
11318 for (int i = 0; i < WPOBE_array.Count(); i++)
11319 {
11320 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
11321
11322 if (WPOBE)
11323 {
11324 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11325 }
11326 }
11327 }
11328 }
11329
11330
11332 {
11333 int id = muzzle_owner.GetMuzzleID();
11334 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11335
11336 if (WPOOH_array)
11337 {
11338 for (int i = 0; i < WPOOH_array.Count(); i++)
11339 {
11340 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11341
11342 if (WPOOH)
11343 {
11344 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
11345 }
11346 }
11347 }
11348 }
11349
11350
11352 {
11353 int id = muzzle_owner.GetMuzzleID();
11354 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11355
11356 if (WPOOH_array)
11357 {
11358 for (int i = 0; i < WPOOH_array.Count(); i++)
11359 {
11360 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11361
11362 if (WPOOH)
11363 {
11364 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11365 }
11366 }
11367 }
11368 }
11369
11370
11372 {
11373 int id = muzzle_owner.GetMuzzleID();
11374 array<ref WeaponParticlesOnOverheating> WPOOH_array = weapon.m_OnOverheatingEffect.Get(id);
11375
11376 if (WPOOH_array)
11377 {
11378 for (int i = 0; i < WPOOH_array.Count(); i++)
11379 {
11380 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
11381
11382 if (WPOOH)
11383 {
11384 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
11385 }
11386 }
11387 }
11388 }
11389
11390
11391
11393 {
11395 {
11396 return true;
11397 }
11398
11399 return false;
11400 }
11401
11403 {
11405 {
11406 return true;
11407 }
11408
11409 return false;
11410 }
11411
11413 {
11415 {
11416 return true;
11417 }
11418
11419 return false;
11420 }
11421
11423 {
11424 return false;
11425 }
11426
11429 {
11430 return UATimeSpent.DEFAULT_DEPLOY;
11431 }
11432
11433
11434
11435
11437 {
11439 SetSynchDirty();
11440 }
11441
11443 {
11445 }
11446
11447
11449 {
11450 return false;
11451 }
11452
11455 {
11456 string att_type = "None";
11457
11458 if (ConfigIsExisting("soundAttType"))
11459 {
11460 att_type = ConfigGetString("soundAttType");
11461 }
11462
11464 }
11465
11467 {
11469 }
11470
11471
11472
11473
11474
11480
11482 {
11485
11487 }
11488
11489
11491 {
11493 return;
11494
11496
11499
11502
11503 SoundParameters params = new SoundParameters();
11507 }
11508
11509
11511 {
11513 return;
11514
11516 SetSynchDirty();
11517
11520 }
11521
11522
11524 {
11526 return;
11527
11529 SetSynchDirty();
11530
11533 }
11534
11536 {
11538 }
11539
11541 {
11543 }
11544
11547 {
11548 if (!
GetGame().IsDedicatedServer())
11549 {
11550 if (ConfigIsExisting("attachSoundSet"))
11551 {
11552 string cfg_path = "";
11553 string soundset = "";
11554 string type_name =
GetType();
11555
11558 ConfigGetTextArray("attachSoundSet",cfg_soundset_array);
11559 ConfigGetTextArray("attachSoundSlot",cfg_slot_array);
11560
11561 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
11562 {
11563 for (int i = 0; i < cfg_soundset_array.Count(); i++)
11564 {
11565 if (cfg_slot_array[i] == slot_type)
11566 {
11567 soundset = cfg_soundset_array[i];
11568 break;
11569 }
11570 }
11571 }
11572
11573 if (soundset != "")
11574 {
11575 EffectSound sound = SEffectManager.PlaySound(soundset,
GetPosition());
11577 }
11578 }
11579 }
11580 }
11581
11583 {
11584
11585 }
11586
11587 void OnApply(PlayerBase player);
11588
11590 {
11591 return 1.0;
11592 };
11593
11595 {
11597 }
11598
11600 {
11602 }
11603
11605
11607 {
11608 SetDynamicPhysicsLifeTime(0.01);
11610 }
11611
11613 {
11614 array<string> zone_names = new array<string>;
11615 GetDamageZones(zone_names);
11616 for (int i = 0; i < zone_names.Count(); i++)
11617 {
11618 SetHealthMax(zone_names.Get(i),"Health");
11619 }
11620 SetHealthMax("","Health");
11621 }
11622
11625 {
11626 float global_health = GetHealth01("","Health");
11627 array<string> zones = new array<string>;
11628 GetDamageZones(zones);
11629
11630 for (int i = 0; i < zones.Count(); i++)
11631 {
11632 SetHealth01(zones.Get(i),"Health",global_health);
11633 }
11634 }
11635
11638 {
11639 return IsExclusionFlagPresent(PlayerBase.GetFaceCoverageShaveValues());
11640 }
11641
11643 {
11644 if (!hasRootAsPlayer)
11645 {
11646 if (refParentIB)
11647 {
11648
11649 if ((refParentIB.GetWet() >= GameConstants.STATE_SOAKING_WET) && (
m_VarWet <
m_VarWetMax))
11650 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_INSIDE);
11651
11652 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
11653 AddWet(delta * GameConstants.WETNESS_RATE_WETTING_LIQUID);
11654
11657 }
11658 else
11659 {
11660
11663 }
11664 }
11665 }
11666
11668 {
11670 {
11671 float target =
g_Game.GetMission().GetWorldData().GetBaseEnvTemperatureAtObject(
this);
11672 if (
GetTemperature() != target || !IsFreezeThawProgressFinished())
11673 {
11674 float heatPermCoef = 1.0;
11676 while (ent)
11677 {
11678 heatPermCoef *= ent.GetHeatPermeabilityCoef();
11679 ent = ent.GetHierarchyParent();
11680 }
11681
11682 SetTemperatureEx(
new TemperatureDataInterpolated(target,
ETemperatureAccessTypes.ACCESS_WORLD,delta,GameConstants.TEMP_COEF_WORLD,heatPermCoef));
11683 }
11684 }
11685 }
11686
11688 {
11689
11690 EntityAI parent = GetHierarchyParent();
11691 if (!parent)
11692 {
11693 hasParent = false;
11694 hasRootAsPlayer = false;
11695 }
11696 else
11697 {
11698 hasParent = true;
11699 hasRootAsPlayer = (GetHierarchyRootPlayer() != null);
11700 refParentIB =
ItemBase.Cast(parent);
11701 }
11702 }
11703
11704 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
11705 {
11706
11707 }
11708
11710 {
11711
11712 return false;
11713 }
11714
11716 {
11717
11718
11719 return false;
11720 }
11721
11723 {
11724
11725 return false;
11726 }
11727
11730 {
11731 return !GetIsFrozen() &&
IsOpen();
11732 }
11733
11735 {
11736 bool hasParent = false, hasRootAsPlayer = false;
11738
11739 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
11740 bool foodDecay =
g_Game.IsFoodDecayEnabled();
11741
11742 if (wwtu || foodDecay)
11743 {
11747
11748 if (processWetness || processTemperature || processDecay)
11749 {
11751
11752 if (processWetness)
11753 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
11754
11755 if (processTemperature)
11757
11758 if (processDecay)
11759 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
11760 }
11761 }
11762 }
11763
11766 {
11768 }
11769
11771 {
11774
11775 return super.GetTemperatureFreezeThreshold();
11776 }
11777
11779 {
11782
11783 return super.GetTemperatureThawThreshold();
11784 }
11785
11787 {
11790
11791 return super.GetItemOverheatThreshold();
11792 }
11793
11795 {
11797 return Math.Lerp(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureFreezeTime()),
GetQuantityNormalized());
11798
11799 return super.GetTemperatureFreezeTime();
11800 }
11801
11803 {
11805 return Math.Lerp(GameConstants.TEMPERATURE_TIME_THAW_MIN,Math.Max(GameConstants.TEMPERATURE_TIME_FREEZE_MIN,super.GetTemperatureThawTime()),
GetQuantityNormalized());
11806
11807 return super.GetTemperatureThawTime();
11808 }
11809
11814
11816 {
11817 return (item.IsKindOf("Cauldron") || item.IsKindOf("Pot") || item.IsKindOf("FryingPan") || item.IsKindOf("SmallProtectorCase") || (item.IsKindOf("PortableGasStove") && item.FindAttachmentBySlotName("CookingEquipment")));
11818 }
11819
11821 {
11822 MiscGameplayFunctions.TransferItemProperties(oldItem, this);
11823 }
11824
11827 {
11829 }
11830
11832 {
11834 }
11835
11837 {
11839 }
11840
11843 {
11844 return null;
11845 }
11846
11849 {
11850 return false;
11851 }
11852
11854 {
11856 {
11859 if (!trg)
11860 {
11862 explosive = this;
11863 }
11864
11865 explosive.PairRemote(trg);
11867
11868 int persistentID = RemotelyActivatedItemBehaviour.GeneratePersistentID();
11869 trg.SetPersistentPairID(persistentID);
11870 explosive.SetPersistentPairID(persistentID);
11871
11872 return true;
11873 }
11874 return false;
11875 }
11876
11879 {
11880 float ret = 1.0;
11883 ret *= GetHealth01();
11884
11885 return ret;
11886 }
11887
11888 #ifdef DEVELOPER
11889 override void SetDebugItem()
11890 {
11891 super.SetDebugItem();
11892 _itemBase = this;
11893 }
11894
11896 {
11897 string text = super.GetDebugText();
11898
11900 text +=
string.
Format(
"Heat isolation(modified): %1\n", MiscGameplayFunctions.GetCurrentItemHeatIsolation(
this));
11901
11902 return text;
11903 }
11904 #endif
11905
11907 {
11908 return true;
11909 }
11910
11912
11914
11916 {
11919 }
11920
11921
11929
11945}
11946
11948{
11950 if (entity)
11951 {
11952 bool is_item = entity.IsInherited(
ItemBase);
11953 if (is_item && full_quantity)
11954 {
11957 }
11958 }
11959 else
11960 {
11962 return NULL;
11963 }
11964 return entity;
11965}
11966
11968{
11969 if (item)
11970 {
11971 if (health > 0)
11972 item.SetHealth("", "", health);
11973
11974 if (item.CanHaveTemperature())
11975 {
11977 if (item.CanFreeze())
11978 item.SetFrozen(false);
11979 }
11980
11981 if (item.HasEnergyManager())
11982 {
11983 if (quantity >= 0)
11984 {
11985 item.GetCompEM().SetEnergy0To1(quantity);
11986 }
11987 else
11988 {
11990 }
11991 }
11992 else if (item.IsMagazine())
11993 {
11994 Magazine mag = Magazine.Cast(item);
11995 if (quantity >= 0)
11996 {
11997 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
11998 }
11999 else
12000 {
12002 }
12003
12004 }
12005 else
12006 {
12007 if (quantity >= 0)
12008 {
12009 item.SetQuantityNormalized(quantity, false);
12010 }
12011 else
12012 {
12014 }
12015
12016 }
12017 }
12018}
12019
12020#ifdef DEVELOPER
12022#endif
Param4< int, int, string, int > TSelectableActionInfoWithColor
Param3 TSelectableActionInfo
InventoryMode
NOTE: PREDICTIVE is not to be used at all in multiplayer.
eBleedingSourceType GetType()
ItemSuppressor SuppressorBase
void ActionManagerBase(PlayerBase player)
map< typename, ref array< ActionBase_Basic > > TInputActionMap
void AddAction(typename actionName)
void RemoveAction(typename actionName)
TInputActionMap m_InputActionMap
override void GetActions(typename action_input_type, out array< ActionBase_Basic > actions)
const int ECE_PLACE_ON_SURFACE
proto native void SpawnEntity(string sClassName, vector vPos, float fRange, int iCount)
Spawn an entity through CE.
const int ECE_IN_INVENTORY
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
PlayerSpawnPreset slotName
Open
Implementations only.
override void EEOnCECreate()
DamageType
exposed from C++ (do not change)
PluginAdminLog m_AdminLog
override bool IsExplosive()
override bool CanHaveTemperature()
class GP5GasMask extends MaskBase ItemBase
FindInventoryLocationType
flags for searching locations in inventory
InventoryLocationType
types of Inventory Location
class BoxCollidingParams component
ComponentInfo for BoxCollidingResult.
bool DamageItemInCargo(float damage)
static bool HasDebugActionsMask(int mask)
bool HidesSelectionBySlot()
void SplitItem(PlayerBase player)
void CopyScriptPropertiesFrom(EntityAI oldItem)
override void InsertAgent(int agent, float count=1)
override float GetQuantityNormalized()
Gets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
static void SetDebugActionsMask(int mask)
void SetIsDeploySound(bool is_deploy_sound)
void SplitItemToInventoryLocation(notnull InventoryLocation dst)
override bool IsHeavyBehaviour()
override void SetWetMax()
bool IsCoverFaceForShave(string slot_name)
DEPRECATED in use, but returns correct values nontheless. Check performed elsewhere.
void ClearStartItemSoundServer()
void ProcessItemTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
map< typename, ref ActionOverrideData > TActionAnimOverrideMap
override void RemoveAllAgentsExcept(int agent_to_keep)
static ref map< int, ref array< ref WeaponParticlesOnBulletCasingEject > > m_OnBulletCasingEjectEffect
bool CanBeMovedOverride()
override void SetWet(float value, bool allow_client=false)
ref TIntArray m_SingleUseActions
override void ProcessVariables()
ref TStringArray m_HeadHidingSelections
float GetWeightSpecialized(bool forceRecalc=false)
bool LoadAgents(ParamsReadContext ctx, int version)
void UpdateQuickbarShortcutVisibility(PlayerBase player)
To be called on moving item within character's inventory; 'player' should never be null.
void OverrideActionAnimation(typename action, int commandUID, int stanceMask=-1, int commandUIDProne=-1)
ref array< ref OverheatingParticle > m_OverheatingParticles
override float GetTemperatureFreezeThreshold()
bool m_IsSoundSynchRemote
void StopItemSoundServer(int id)
static void ToggleDebugActionsMask(int mask)
void IncreaseOverheating(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetTemperatureFreezeTime()
ref array< int > m_CompatibleLocks
override void CombineItemsClient(EntityAI entity2, bool use_stack_max=true)
float m_TemperaturePerQuantityWeight
bool m_RecipesInitialized
void SplitIntoStackMax(EntityAI destination_entity, int slot_id, PlayerBase player)
override float GetTemperatureThawThreshold()
override void OnEnergyConsumed()
void RefreshAudioVisualsOnClient(CookingMethodType cooking_method, bool is_done, bool is_empty, bool is_burned)
cooking-related effect methods
int GetNumberOfItems()
Returns the number of items in cargo, otherwise returns 0(non-cargo objects). Recursive.
override EWetnessLevel GetWetLevel()
float GetSingleInventoryItemWeight()
ref TIntArray m_InteractActions
void MessageToOwnerStatus(string text)
Send message to owner player in grey color.
bool CanPlayDeployLoopSound()
override float GetWetMax()
bool CanBeUsedForSuicide()
override void CombineItemsEx(EntityAI entity2, bool use_stack_max=true)
void OnItemInHandsPlayerSwimStart(PlayerBase player)
void SetIsHologram(bool is_hologram)
void OnSyncVariables(ParamsReadContext ctx)
DEPRECATED (most likely)
void StartItemSoundServer(int id)
static ref map< int, ref array< ref WeaponParticlesOnFire > > m_OnFireEffect
void SplitIntoStackMaxCargoClient(EntityAI destination_entity, int idx, int row, int col)
bool m_CanBeMovedOverride
override string ChangeIntoOnAttach(string slot)
void UpdateOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
ScriptedLightBase GetLight()
string GetPlaceSoundset()
bool AddQuantity(float value, bool destroy_config=true, bool destroy_forced=false)
add item quantity[related to varQuantity... config entry], destroy_config = true > if the quantity re...
override float GetQuantity()
int m_ShotsToStartOverheating
override void OnWetChanged(float newVal, float oldVal)
void StopOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
static void PlayFireParticles(ItemBase weapon, int muzzle_index, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void OnOverheatingDecay()
float GetDryingIncrement(string pIncrementName)
void SoundSynchRemoteReset()
bool HasMuzzle()
Returns true if this item has a muzzle (weapons, suppressors)
override bool CanReleaseAttachment(EntityAI attachment)
override void OnMovedInsideCargo(EntityAI container)
void SetCEBasedQuantity()
bool m_CanPlayImpactSound
override string GetAttachmentSoundType()
float GetOverheatingCoef()
array< string > GetHeadHidingSelection()
void PlayAttachSound(string slot_type)
Plays sound on item attach. Be advised, the config structure may slightly change in 1....
override bool IsStoreLoad()
int ComputeQuantityUsed(ItemBase other_item, bool use_stack_max=true)
void SetResultOfSplit(bool value)
void SplitIntoStackMaxCargo(EntityAI destination_entity, int idx, int row, int col)
void OnAttachmentQuantityChanged(ItemBase item)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
void UpdateAllOverheatingParticles()
float GetSoakingIncrement(string pIncrementName)
static void StopOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override float GetStoreLoadedQuantity()
const int ITEM_SOUNDS_MAX
float GetItemModelLength()
override bool ReadVarsFromCTX(ParamsReadContext ctx, int version=-1)
override void CheckForRoofLimited(float timeTresholdMS=3000)
Roof check for entity, limited by time (anti-spam solution)
void CombineItems(ItemBase other_item, bool use_stack_max=true)
void TransferModifiers(PlayerBase reciever)
appears to be deprecated, legacy code
float GetTemperaturePerQuantityWeight()
Used in heat comfort calculations only!
void TransferAgents(int agents)
transfer agents from another item
bool CanBeConsumed(ConsumeConditionData data=null)
Items cannot be consumed if frozen by default. Override for exceptions.
float GetHeatIsolationInit()
void SetCanBeMovedOverride(bool setting)
override bool HasQuantity()
bool IsCargoException4x3(EntityAI item)
ref TIntArray m_ContinuousActions
int GetMuzzleID()
Returns global muzzle ID. If not found, then it gets automatically registered.
void LoadParticleConfigOnFire(int id)
void PreLoadSoundAttachmentType()
Attachment Sound Type getting from config file.
override float GetWetInit()
int m_ImpactSoundSurfaceHash
int m_MaxOverheatingValue
void SetupSpawnedItem(ItemBase item, float health, float quantity)
bool ShouldSplitQuantity(float quantity)
static ref map< string, int > m_WeaponTypeToID
string GetColorString()
Returns item's PROCEDURAL color as formated string, i.e. "#(argb,8,8,3)color(0.15,...
array< int > GetValidFinishers()
returns an array of possible finishers
void OnAttachmentQuantityChangedEx(ItemBase item, float delta)
Called on server side when some attachment's quantity is changed. Call super.OnAttachmentQuantityChan...
class ItemBase extends InventoryItem SpawnItemOnLocation(string object_name, notnull InventoryLocation loc, bool full_quantity)
ItemSoundHandler GetItemSoundHandler()
override int GetQuantityMin()
void SplitIntoStackMaxToInventoryLocationClient(notnull InventoryLocation dst)
override int GetQuickBarBonus()
override void SetTakeable(bool pState)
float m_OverheatingDecayInterval
void SetIsPlaceSound(bool is_place_sound)
override void SplitIntoStackMaxClient(EntityAI destination_entity, int slot_id)
void HierarchyCheck(out bool hasParent, out bool hasRootAsPlayer, out ItemBase refParentIB)
void RemoveAudioVisualsOnClient()
static void AddDebugActionsMask(int mask)
void PlayDeployLoopSoundEx()
void RemoveLightSourceItem()
bool CanRepair(ItemBase item_repair_kit)
bool can_this_be_combined
EffectSound m_SoundDeploy
float GetBaitEffectivity()
generic effectivity as a bait for animal catching
float GetDeployTime()
how long it takes to deploy this item in seconds
override bool IsSplitable()
bool DamageItemAttachments(float damage)
override void WriteVarsToCTX(ParamsWriteContext ctx)
void ConvertEnergyToQuantity()
override void RemoveAllAgents()
override void SetQuantityToMinimum()
bool m_WantPlayImpactSound
override float GetTemperatureThawTime()
ref map< int, ref array< ref WeaponParticlesOnOverheating > > m_OnOverheatingEffect
float m_StoreLoadedQuantity
void MessageToOwnerAction(string text)
Send message to owner player in yellow color.
float GetFilterDamageRatio()
override void SetLiquidType(int value, bool allow_client=false)
void OnQuantityChanged(float delta)
Called on server side when this item's quantity is changed. Call super.OnQuantityChanged(); first whe...
void OnApply(PlayerBase player)
override void SetQuantityNormalized(float value, bool destroy_config=true, bool destroy_forced=false)
Sets quantity in normalized 0..1 form between the item's Min a Max values as defined by item's config...
bool m_HideSelectionsBySlot
bool IsOverheatingEffectActive()
void SetIsBeingPlaced(bool is_being_placed)
int GetLiquidContainerMask()
void SetInventoryLocationToVicinityOrCurrent(EntityAI root, inout InventoryLocation dst)
ref Timer m_CheckOverheating
void RegisterOverheatingParticle(Particle p, float min_heat_coef, float max_heat_coef, int particle_id, Object parent, vector local_pos, vector local_ori)
bool GetActionWidgetOverride(out typename name)
If we need a different (handheld)item action widget displayed, the logic goes in here.
float GetUnitWeight(bool include_wetness=true)
Obsolete, use GetWeightEx instead.
void SetZoneDamageCEInit()
Sets zone damages to match randomized global health set by CE (CE spawn only)
static void PlayOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override bool IsOneHandedBehaviour()
void AddLightSourceItem(ItemBase lightsource)
Adds a light source child.
FoodStage GetFoodStage()
overridden on Edible_Base; so we don't have to parse configs all the time
override float GetSingleInventoryItemWeightEx()
void SaveAgents(ParamsWriteContext ctx)
override int GetTargetQuantityMax(int attSlotID=-1)
float GetDisinfectQuantity(int system=0, Param param1=null)
override bool IsHologram()
float GetItemAttachOffset()
static int GetDebugActionsMask()
void ProcessDecay(float delta, bool hasRootAsPlayer)
override bool IsItemBase()
override bool IsTwoHandedBehaviour()
bool IsCombineAll(ItemBase other_item, bool use_stack_max=false)
float GetProtectionLevel(int type, bool consider_filter=false, int system=0)
static void PlayBulletCasingEjectParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
override void OnEnergyAdded()
void AffectLiquidContainerOnFill(int liquid_type, float amount)
from enviro source
void AffectLiquidContainerOnTransfer(int liquidType, float amount, float sourceLiquidTemperature)
from other liquid container source
string GetExplosiveTriggerSlotName()
EffectSound m_DeployLoopSoundEx
override void DeSerializeNumericalVars(array< float > floats)
void StopItemDynamicPhysics()
override void SetStoreLoad(bool value)
float GetOverheatingValue()
bool ContainsAgent(int agent_id)
override void AddWet(float value)
override void EOnContact(IEntity other, Contact extra)
void SplitIntoStackMaxHands(PlayerBase player)
void SplitIntoStackMaxHandsClient(PlayerBase player)
ref Timer m_PhysDropTimer
void MessageToOwnerFriendly(string text)
Send message to owner player in green color.
override void SetStoreLoadedQuantity(float value)
bool m_IsResultOfSplit string m_SoundAttType
distinguish if item has been created as new or it came from splitting (server only flag)
void CheckOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void UnlockFromParent()
Unlocks this item from its attachment slot of its parent.
bool Repair(PlayerBase player, ItemBase item_repair_kit, float specialty_weight)
void OnLiquidTypeChanged(int oldType, int newType)
void StartOverheating(ItemBase weapon=null, string ammoType="", ItemBase muzzle_owner=null, ItemBase suppressor=null, string config_to_search="")
void PlayDeployFinishSound()
bool AllowFoodConsumption()
bool m_IsOverheatingEffectActive
int m_LiquidContainerMask
void ProcessItemWetness(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override int GetCleanness()
bool PairWithDevice(notnull ItemBase otherDevice)
static void RemoveDebugActionsMask(int mask)
static void UpdateOverheatingParticles(ItemBase weapon, string ammoType, ItemBase muzzle_owner, ItemBase suppressor, string config_to_search)
void PerformDamageSystemReinit()
override void ClearInventory()
static int m_LastRegisteredWeaponID
ItemBase GetLightSourceItem()
void MessageToOwnerImportant(string text)
Send message to owner player in red color.
override float GetItemOverheatThreshold()
void StopDeployLoopSoundEx()
override void SerializeNumericalVars(array< float > floats_out)
ItemBase SplitIntoStackMaxToInventoryLocationEx(notnull InventoryLocation dst)
static int m_DebugActionsMask
void KillAllOverheatingParticles()
bool CanBeCookedOnStick()
override int GetQuantityMax()
void GetRecipesActions(Man player, out TSelectableActionInfoArray outputList)
void OnActivatedByTripWire()
override void RemoveAgent(int agent_id)
bool m_ItemBeingDroppedPhys
override bool CanPutAsAttachment(EntityAI parent)
void PlayDetachSound(string slot_type)
static ref map< typename, ref TInputActionMap > m_ItemTypeActionsMap
void ProcessItemWetnessAndTemperature(float delta, bool hasParent, bool hasRootAsPlayer, ItemBase refParentIB)
override bool IsBeingPlaced()
float ComputeQuantityUsedEx(ItemBase other_item, bool use_stack_max=true)
bool m_FixDamageSystemInit
string GetDeployFinishSoundset()
ItemBase m_LightSourceItem
void LockToParent()
Locks this item in it's current attachment slot of its parent. This makes the "locked" icon visible i...
override void SplitIntoStackMaxEx(EntityAI destination_entity, int slot_id)
void LoadParticleConfigOnOverheating(int id)
bool IsSoundSynchRemote()
override void OnRightClick()
static ref map< typename, ref TActionAnimOverrideMap > m_ItemActionOverrides
bool IsActionTargetVisible()
override void OnItemAttachmentSlotChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override void EEHitBy(TotalDamageResult damageResult, int damageType, EntityAI source, int component, string dmgZone, string ammo, vector modelPos, float speedCoef)
int NameToID(string name)
override void OnWetLevelChanged(EWetnessLevel newLevel, EWetnessLevel oldLevel)
void ClearStopItemSoundServer()
override string ChangeIntoOnDetach()
void SplitIntoStackMaxToInventoryLocation(notnull InventoryLocation dst)
EffectSound m_SoundDeployFinish
float GetQuantityNormalizedScripted()
override void SetCleanness(int value, bool allow_client=false)
override float GetWetMin()
ref ItemSoundHandler m_ItemSoundHandler
override bool KindOf(string tag)
void ItemSoundHandler(ItemBase parent)
EffectSound m_LockingSound
void PluginItemDiagnostic()
PluginBase GetPlugin(typename plugin_type)
override RemotelyActivatedItemBehaviour GetRemotelyActivatedItemBehaviour()
void RemoteDetonatorTrigger()
override void OnActivatedByItem(notnull ItemBase item)
Called when this item is activated by other.
override void Explode(int damageType, string ammoType="")
void OnItemLocationChanged(ItemBase item)
void OnItemAttachedAtPlayer(EntityAI item, string slot_name)
proto native UIManager GetUIManager()
proto bool ConfigGetChildName(string path, int index, out string name)
Get name of subclass in config class on path.
proto native float ConfigGetFloat(string path)
Get float value from config on path.
override ScriptCallQueue GetCallQueue(int call_category)
proto native void GizmoSelectObject(Object object)
proto native bool ConfigIsExisting(string path)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto native void GizmoSelectPhysics(Physics physics)
proto int GetTime()
returns mission time in milliseconds
proto native int ConfigGetType(string path)
Returns type of config value.
AnalyticsManagerClient GetAnalyticsClient()
proto native int ConfigGetChildrenCount(string path)
Get count of subclasses in config class on path.
proto native SoundOnVehicle CreateSoundOnObject(Object source, string sound_name, float distance, bool looped, bool create_local=false)
proto native void ObjectDelete(Object obj)
proto native int GetItemCount()
proto native EntityAI GetItem(int index)
void SetEnergy0To1(float energy01)
Energy manager: Sets stored energy for this device between 0 and MAX based on relative input value be...
float GetEnergyMaxPristine()
Energy manager: Returns the maximum amount of energy this device can store. It's damage is NOT taken ...
override void SetAutodestroy(bool auto_destroy)
Sets whether Effect automatically cleans up when it stops.
bool IsSoundPlaying()
Get whether EffectSound is currently playing.
proto native bool EnumerateInventory(InventoryTraversalType tt, out array< EntityAI > items)
enumerate inventory using traversal type and filling items array
proto native CargoBase GetCargo()
cargo
proto native bool IsValid()
verify current set inventory location
proto native EntityAI GetParent()
returns parent of current inventory location
proto native int GetSlot()
returns slot id if current type is Attachment
proto native int GetCol()
returns column of cargo if current type is Cargo / ProxyCargo
proto native int GetRow()
returns row of cargo if current type is Cargo / ProxyCargo
bool WriteToContext(ParamsWriteContext ctx)
proto native int GetType()
returns type of InventoryLocation
proto native int GetIdx()
returns index of cargo if current type is Cargo / ProxyCargo
proto native void SetCargo(notnull EntityAI parent, EntityAI e, int idx, int row, int col, bool flip)
sets current inventory location type to Cargo with coordinates (idx, row, col)
proto native bool GetFlip()
returns flip status of cargo
proto native EntityAI GetItem()
returns item of current inventory location
override bool CanDisplayCargo()
override void OnInventoryEnter(Man player)
override string GetFoldSoundset()
override bool CanPutAsAttachment(EntityAI parent)
override bool CanReceiveItemIntoCargo(EntityAI item)
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override void OnWasDetached(EntityAI parent, int slot_id)
override void EEOnAfterLoad()
override void EEDelete(EntityAI parent)
override bool CanBeRepairedByCrafting()
override void OnPlacementStarted(Man player)
override void OnItemLocationChanged(EntityAI old_owner, EntityAI new_owner)
override bool IsElectricAppliance()
override bool IsItemTent()
override void SetActions()
override string GetLoopFoldSoundset()
override bool CanMakeGardenplot()
override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
override void EEItemLocationChanged(notnull InventoryLocation oldLoc, notnull InventoryLocation newLoc)
override WrittenNoteData GetWrittenNoteData()
override int GetDamageSystemVersionChange()
override bool SetQuantity(float value, bool destroy_config=true, bool destroy_forced=false, bool allow_client=false, bool clamp_to_stack_max=true)
override void InitItemVariables()
override void SetActionAnimOverrides()
override void OnCreatePhysics()
override string GetDeploySoundset()
override float GetBandagingEffectivity()
override bool OnAction(int action_id, Man player, ParamsReadContext ctx)
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
override void OnStoreSave(ParamsWriteContext ctx)
override void AfterStoreLoad()
override int GetOnDigWormsAmount()
override bool IsSelfAdjustingTemperature()
override bool IsPlayerInside(PlayerBase player, string selection)
override void OnVariablesSynchronized()
override void RefreshPhysics()
override bool CanObstruct()
override void OnWasAttached(EntityAI parent, int slot_id)
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
override bool CanPutInCargo(EntityAI parent)
override string GetLoopDeploySoundset()
override void OnPlacementComplete(Man player, vector position="0 0 0", vector orientation="0 0 0")
override void OnInventoryExit(Man player)
override bool IsTakeable()
override bool IsIgnoredByConstruction()
override void InitItemSounds()
override void EEKilled(Object killer)
override void OnCombine(ItemBase other_item)
override bool CanExplodeInFire()
override bool IsFacingPlayer(PlayerBase player, string selection)
override bool CanBeCombined(EntityAI other_item, bool reservation_check=true, bool stack_max_limit=false)
override bool IsBloodContainer()
override bool IsClothing()
override bool CanBeSplit()
override bool IsDeployable()
override void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
override bool CanBeDisinfected()
override float GetInfectionChance(int system=0, Param param=null)
override void OnEndPlacement()
float GetOverheatingLimitMax()
void SetOverheatingLimitMax(float max)
void SetParticleParams(int particle_id, Object parent, vector local_pos, vector local_ori)
float GetOverheatingLimitMin()
void SetOverheatingLimitMin(float min)
void RegisterParticle(Particle p)
void Stop()
Legacy function for backwards compatibility with 1.14 and below.
void SetControlledDevice(EntityAI pDevice)
bool OnStoreLoad(ParamsReadContext ctx, int version)
void OnStoreSave(ParamsWriteContext ctx)
proto void Remove(func fn)
remove specific call from queue
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native float GetDamage(string zoneName, string healthType)
UIScriptedMenu FindMenu(int id)
Returns menu with specific ID if it is open (see MenuID)
void SetCalcDetails(string details)
void OnRPC(PlayerIdentity sender, int rpc_type, ParamsReadContext ctx)
Serializer ParamsReadContext
InventoryTraversalType
tree traversal type, for more see http://en.wikipedia.org/wiki/Tree_traversal
proto native CGame GetGame()
Serializer ParamsWriteContext
const int COMP_TYPE_ENERGY_MANAGER
void Error(string err)
Messagebox with error message.
proto native void SetColor(int color)
array< string > TStringArray
EntityEvent
Entity events for event-mask, or throwing event from code.
static const float ITEM_TEMPERATURE_NEUTRAL_ZONE_MIDDLE
const int VARIABLE_LIQUIDTYPE
const int VARIABLE_CLEANNESS
const int VARIABLE_TEMPERATURE
const int VARIABLE_QUANTITY
static proto float AbsFloat(float f)
Returns absolute value.
proto native bool dBodyIsDynamic(notnull IEntity ent)
const int SAT_DEBUG_ACTION
class JsonUndergroundAreaTriggerData GetPosition
static proto string Format(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
Gets n-th character from string.