19 static int m_DebugActionsMask;
81 protected bool m_IsResultOfSplit
113 static int m_LastRegisteredWeaponID = 0;
153 if (!
GetGame().IsDedicatedServer())
169 m_OldLocation =
null;
176 if (ConfigIsExisting(
"headSelectionsToHide"))
183 if (ConfigIsExisting(
"hideSelectionsByinventorySlot"))
192 m_IsResultOfSplit =
false;
195 void InitItemVariables()
202 m_Count = ConfigGetInt(
"count");
243 if (ConfigIsExisting(
"canBeSplit"))
249 if (ConfigIsExisting(
"itemBehaviour"))
256 RegisterNetSyncVariableInt(
"m_VarLiquidType");
257 RegisterNetSyncVariableInt(
"m_Cleanness",0,1);
259 RegisterNetSyncVariableBoolSignal(
"m_WantPlayImpactSound");
260 RegisterNetSyncVariableFloat(
"m_ImpactSpeed");
261 RegisterNetSyncVariableInt(
"m_ImpactSoundSurfaceHash");
263 RegisterNetSyncVariableInt(
"m_ColorComponentR", 0, 255);
264 RegisterNetSyncVariableInt(
"m_ColorComponentG", 0, 255);
265 RegisterNetSyncVariableInt(
"m_ColorComponentB", 0, 255);
266 RegisterNetSyncVariableInt(
"m_ColorComponentA", 0, 255);
268 RegisterNetSyncVariableBool(
"m_IsBeingPlaced");
269 RegisterNetSyncVariableBool(
"m_IsTakeable");
270 RegisterNetSyncVariableBool(
"m_IsHologram");
274 RegisterNetSyncVariableBool(
"m_IsSoundSynchRemote");
275 RegisterNetSyncVariableBool(
"m_IsDeploySound");
295 if (!m_InputActionMap)
300 m_ItemTypeActionsMap.Insert(this.
Type(), m_InputActionMap);
330 Debug.LogError(
"Action " + actionName +
" dosn't exist!");
334 typename ai = action.GetInputType();
349 Debug.ActionLog(action.ToString() +
" -> " + ai,
this.ToString() ,
"n/a",
"Add action");
352 if (action_array.Find(action) != -1)
354 Debug.Log(
"Action " + action.Type() +
" already added to " +
this +
", skipping!");
358 action_array.Insert(action);
365 ActionBase action = player.GetActionManager().GetAction(actionName);
366 typename ai = action.GetInputType();
371 action_array.RemoveItem(action);
385 if (!m_OnBulletCasingEjectEffect)
388 string config_to_search =
"CfgVehicles";
389 string muzzle_owner_config;
391 if (!m_OnFireEffect.Contains(
id))
394 config_to_search =
"CfgWeapons";
396 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
398 string config_OnFire_class = muzzle_owner_config +
"Particles " +
"OnFire ";
400 int config_OnFire_subclass_count =
GetGame().ConfigGetChildrenCount(config_OnFire_class);
402 if (config_OnFire_subclass_count > 0)
406 for (
int i = 0; i < config_OnFire_subclass_count; i++)
408 string particle_class =
"";
409 GetGame().ConfigGetChildName(config_OnFire_class, i, particle_class);
410 string config_OnFire_entry = config_OnFire_class + particle_class;
411 WeaponParticlesOnFire WPOF =
new WeaponParticlesOnFire(
this, config_OnFire_entry);
412 WPOF_array.Insert(WPOF);
416 m_OnFireEffect.Insert(
id, WPOF_array);
420 if (!m_OnBulletCasingEjectEffect.Contains(
id))
422 config_to_search =
"CfgWeapons";
423 muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
425 string config_OnBulletCasingEject_class = muzzle_owner_config +
"Particles " +
"OnBulletCasingEject ";
427 int config_OnBulletCasingEject_count =
GetGame().ConfigGetChildrenCount(config_OnBulletCasingEject_class);
429 if (config_OnBulletCasingEject_count > 0 && IsInherited(
Weapon))
433 for (i = 0; i < config_OnBulletCasingEject_count; i++)
435 string particle_class2 =
"";
436 GetGame().ConfigGetChildName(config_OnBulletCasingEject_class, i, particle_class2);
437 string config_OnBulletCasingEject_entry = config_OnBulletCasingEject_class + particle_class2;
438 WeaponParticlesOnBulletCasingEject WPOBE =
new WeaponParticlesOnBulletCasingEject(
this, config_OnBulletCasingEject_entry);
439 WPOBE_array.Insert(WPOBE);
443 m_OnBulletCasingEjectEffect.Insert(
id, WPOBE_array);
456 string config_to_search =
"CfgVehicles";
459 config_to_search =
"CfgWeapons";
461 string muzzle_owner_config = config_to_search +
" " +
GetType() +
" ";
462 string config_OnOverheating_class = muzzle_owner_config +
"Particles " +
"OnOverheating ";
464 if (
GetGame().ConfigIsExisting(config_OnOverheating_class))
472 string error =
"Error reading config " +
GetType() +
">Particles>OnOverheating - Parameter shotsToStartOverheating is configured wrong or is missing! Its value must be 1 or higher!";
482 int config_OnOverheating_subclass_count =
GetGame().ConfigGetChildrenCount(config_OnOverheating_class);
485 for (
int i = 0; i < config_OnOverheating_subclass_count; i++)
487 string particle_class =
"";
488 GetGame().ConfigGetChildName(config_OnOverheating_class, i, particle_class);
489 string config_OnOverheating_entry = config_OnOverheating_class + particle_class;
490 int entry_type =
GetGame().ConfigGetType(config_OnOverheating_entry);
492 if (entry_type == CT_CLASS)
494 WeaponParticlesOnOverheating WPOF =
new WeaponParticlesOnOverheating(
this, config_OnOverheating_entry);
495 WPOOH_array.Insert(WPOF);
522 CheckOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
532 StartOverheating(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
575 ItemBase.PlayOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
581 ItemBase.UpdateOverheatingParticles(
this, ammoType,
this, suppressor,
"CfgWeapons");
588 ItemBase.StopOverheatingParticles(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
597 OP.RegisterParticle(p);
598 OP.SetOverheatingLimitMin(min_heat_coef);
599 OP.SetOverheatingLimitMax(max_heat_coef);
620 for (
int i = count; i > 0; --i)
626 float overheat_min = OP.GetOverheatingLimitMin();
627 float overheat_max = OP.GetOverheatingLimitMax();
629 if (overheat_coef < overheat_min && overheat_coef >= overheat_max)
634 OP.RegisterParticle(
null);
669 float GetInfectionChance(
int system = 0,
Param param =
null)
697 if (!m_WeaponTypeToID)
700 if (m_WeaponTypeToID.Contains(
GetType()))
702 return m_WeaponTypeToID.Get(
GetType());
707 m_WeaponTypeToID.Insert(
GetType(), ++m_LastRegisteredWeaponID);
710 return m_LastRegisteredWeaponID;
718 int GetDamageSystemVersionChange()
736 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(
this);
741 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
743 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
744 int r_type = r_il.GetType();
747 r_il.GetParent().GetOnReleaseLock().Invoke(
this);
751 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.GetSlot());
756 player.GetHumanInventory().ClearUserReservedLocation(
this);
765 static int GetDebugActionsMask()
770 static bool HasDebugActionsMask(
int mask)
772 return ItemBase.m_DebugActionsMask & mask;
775 static void SetDebugActionsMask(
int mask)
780 static void AddDebugActionsMask(
int mask)
782 ItemBase.m_DebugActionsMask |= mask;
785 static void RemoveDebugActionsMask(
int mask)
787 ItemBase.m_DebugActionsMask &= ~mask;
790 static void ToggleDebugActionsMask(
int mask)
792 if (HasDebugActionsMask(mask))
794 RemoveDebugActionsMask(mask);
798 AddDebugActionsMask(mask);
805 if (GetEconomyProfile())
807 float q_max = GetEconomyProfile().GetQuantityMax();
810 float q_min = GetEconomyProfile().GetQuantityMin();
811 float quantity_randomized =
Math.RandomFloatInclusive(q_min, q_max);
816 if (comp && (comp.GetEnergyMaxPristine() || comp.GetEnergyAtSpawn()))
819 comp.SetEnergy0To1(quantity_randomized);
839 EntityAI parent = GetHierarchyParent();
844 GetInventory().GetCurrentInventoryLocation(inventory_location_to_lock);
845 parent.GetInventory().SetSlotLock(inventory_location_to_lock.GetSlot(),
true);
852 EntityAI parent = GetHierarchyParent();
857 GetInventory().GetCurrentInventoryLocation(inventory_location_to_unlock);
858 parent.GetInventory().SetSlotLock(inventory_location_to_unlock.GetSlot(),
false);
880 ctx.Write(use_stack_max);
886 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(item2,
null,
GameInventory.c_InventoryReservationTimeoutShortMS);
890 else if (!
GetGame().IsMultiplayer())
904 return (ConfigGetFloat(
"liquidContainerType") != 0);
907 bool IsBloodContainer()
936 bool CanBeRepairedByCrafting()
943 bool IsFacingPlayer(
PlayerBase player,
string selection)
948 bool IsPlayerInside(
PlayerBase player,
string selection)
953 override bool CanObstruct()
956 return !player || !IsPlayerInside(player,
"");
967 if (!is_being_placed)
973 void OnEndPlacement() {}
985 bool CanMakeGardenplot()
1032 super.OnMovedInsideCargo(container);
1034 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(
this, {
Bolt_Base});
1039 super.EEItemLocationChanged(oldLoc,newLoc);
1044 if (newLoc.GetParent())
1045 new_player =
PlayerBase.Cast(newLoc.GetParent().GetHierarchyRootPlayer());
1047 if (oldLoc.GetParent())
1048 old_player =
PlayerBase.Cast(oldLoc.GetParent().GetHierarchyRootPlayer());
1052 int r_index = old_player.GetHumanInventory().FindUserReservedLocationIndex(
this);
1057 old_player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
1059 old_player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
1060 int r_type = r_il.GetType();
1063 r_il.GetParent().GetOnReleaseLock().Invoke(
this);
1067 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.GetSlot());
1076 new_player.ForceStandUpForHeavyItems(newLoc.GetItem());
1078 if (new_player == old_player)
1081 if (oldLoc.GetParent() && !(oldLoc.GetParent() != new_player && oldLoc.GetType() ==
InventoryLocationType.ATTACHMENT) && new_player.GetHumanInventory().LocationGetEntity(oldLoc) == NULL)
1085 if (oldLoc.GetParent().GetInventory().TestAddEntityInCargoExLoc(oldLoc,
false,
false,
false,
true,
false,
false))
1087 new_player.GetHumanInventory().SetUserReservedLocation(
this,oldLoc);
1092 new_player.GetHumanInventory().SetUserReservedLocation(
this,oldLoc);
1096 if (new_player.GetHumanInventory().FindUserReservedLocationIndex(
this) >= 0)
1098 int type = oldLoc.GetType();
1101 oldLoc.GetParent().GetOnSetLock().Invoke(
this);
1105 oldLoc.GetParent().GetOnAttachmentSetLock().Invoke(
this, oldLoc.GetSlot());
1112 m_OldLocation.Copy(oldLoc);
1118 m_OldLocation.Reset();
1122 GetGame().GetAnalyticsClient().OnItemAttachedAtPlayer(
this,
"Hands");
1128 int res_index = new_player.GetHumanInventory().FindCollidingUserReservedLocationIndex(
this, newLoc);
1132 new_player.GetHumanInventory().GetUserReservedLocation(res_index,il);
1134 new_player.GetHumanInventory().ClearUserReservedLocationAtIndex(res_index);
1135 int rel_type = il.GetType();
1138 il.GetParent().GetOnReleaseLock().Invoke(it);
1142 il.GetParent().GetOnAttachmentReleaseLock().Invoke(it, il.GetSlot());
1156 m_OldLocation.Reset();
1165 int liquidType = -1;
1167 if (impactSpeed > 0.0)
1181 if (GetCompEM() && GetCompEM().IsPlugged())
1184 GetCompEM().UnplugThis();
1189 void RefreshPhysics();
1201 override void OnItemLocationChanged(
EntityAI old_owner,
EntityAI new_owner)
1203 super.OnItemLocationChanged(old_owner, new_owner);
1205 Man ownerPlayerOld =
null;
1206 Man ownerPlayerNew =
null;
1210 if (old_owner.IsMan())
1212 ownerPlayerOld = Man.Cast(old_owner);
1216 ownerPlayerOld = Man.Cast(old_owner.GetHierarchyRootPlayer());
1222 if (new_owner.IsMan())
1224 ownerPlayerNew = Man.Cast(new_owner);
1228 ownerPlayerNew = Man.Cast(new_owner.GetHierarchyRootPlayer());
1232 if (ownerPlayerOld != ownerPlayerNew)
1238 for (
int i = 0; i < subItemsExit.Count(); i++)
1241 itemExit.OnInventoryExit(ownerPlayerOld);
1249 for (
int j = 0; j < subItemsEnter.Count(); j++)
1252 itemEnter.OnInventoryEnter(ownerPlayerNew);
1259 override void EEDelete(
EntityAI parent)
1261 super.EEDelete(parent);
1265 OnInventoryExit(player);
1267 if (player.IsAlive())
1269 int r_index = player.GetHumanInventory().FindUserReservedLocationIndex(
this);
1273 player.GetHumanInventory().GetUserReservedLocation(r_index,r_il);
1275 player.GetHumanInventory().ClearUserReservedLocationAtIndex(r_index);
1276 int r_type = r_il.GetType();
1279 r_il.GetParent().GetOnReleaseLock().Invoke(
this);
1283 r_il.GetParent().GetOnAttachmentReleaseLock().Invoke(
this, r_il.GetSlot());
1288 player.RemoveQuickBarEntityShortcut(
this);
1293 override void EEKilled(
Object killer)
1295 super.EEKilled(killer);
1298 if (killer && killer.IsFireplace() && CanExplodeInFire())
1304 if (Magazine.Cast(
this).GetAmmoCount() > 0)
1317 override void OnWasAttached(
EntityAI parent,
int slot_id)
1319 MiscGameplayFunctions.RemoveAllAttachedChildrenByTypename(
this, {
Bolt_Base});
1321 super.OnWasAttached(parent, slot_id);
1329 override void OnWasDetached(
EntityAI parent,
int slot_id)
1331 super.OnWasDetached(parent, slot_id);
1343 ConfigGetTextArray(
"ChangeInventorySlot",inventory_slots);
1344 if (inventory_slots.Count() < 1)
1346 inventory_slots.Insert(ConfigGetString(
"ChangeInventorySlot"));
1347 attach_types.Insert(ConfigGetString(
"ChangeIntoOnAttach"));
1351 ConfigGetTextArray(
"ChangeIntoOnAttach",attach_types);
1354 idx = inventory_slots.Find(slot);
1358 return attach_types.Get(idx);
1369 this.ConfigGetTextArray(
"ChangeInventorySlot",inventory_slots);
1370 if (inventory_slots.Count() < 1)
1372 inventory_slots.Insert(this.ConfigGetString(
"ChangeInventorySlot"));
1373 detach_types.Insert(this.ConfigGetString(
"ChangeIntoOnDetach"));
1377 this.ConfigGetTextArray(
"ChangeIntoOnDetach",detach_types);
1378 if (detach_types.Count() < 1)
1379 detach_types.Insert(this.ConfigGetString(
"ChangeIntoOnDetach"));
1382 for (
int i = 0; i < inventory_slots.Count(); i++)
1384 slot = inventory_slots.Get(i);
1389 if (detach_types.Count() == 1)
1392 idx = inventory_slots.Find(slot);
1397 return detach_types.Get(idx);
1408 float delay =
Math.RandomFloat(min_time, max_time);
1410 explode_timer.Run(delay,
this,
"DoAmmoExplosion");
1415 Magazine magazine = Magazine.Cast(
this);
1416 int pop_sounds_count = 6;
1417 string pop_sounds[ 6 ] = {
"ammopops_1",
"ammopops_2",
"ammopops_3",
"ammopops_4",
"ammopops_5",
"ammopops_6" };
1420 int sound_idx =
Math.RandomInt(0, pop_sounds_count - 1);
1421 string sound_name = pop_sounds[ sound_idx ];
1422 GetGame().CreateSoundOnObject(
this, sound_name, 20,
false);
1425 magazine.ServerAddAmmoCount(-1);
1428 float min_temp_to_explode = 100;
1430 if (magazine.GetAmmoCount() > 0 &&
GetTemperature() >= min_temp_to_explode)
1439 super.EEHitBy(damageResult, damageType, source,
component, dmgZone, ammo, modelPos, speedCoef);
1441 const int CHANCE_DAMAGE_CARGO = 4;
1442 const int CHANCE_DAMAGE_ATTACHMENT = 1;
1443 const int CHANCE_DAMAGE_NOTHING = 2;
1445 if (IsClothing() || IsContainer() || IsItemTent())
1447 float dmg = damageResult.GetDamage(
"",
"Health") * -0.5;
1451 if (GetInventory().GetCargo())
1453 chances = CHANCE_DAMAGE_CARGO + CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
1454 rnd =
Math.RandomInt(0,chances);
1456 if (rnd < CHANCE_DAMAGE_CARGO)
1460 else if (rnd < (chances - CHANCE_DAMAGE_NOTHING))
1467 chances = CHANCE_DAMAGE_ATTACHMENT + CHANCE_DAMAGE_NOTHING;
1468 rnd =
Math.RandomInt(0,chances);
1470 if (rnd < CHANCE_DAMAGE_ATTACHMENT)
1480 if (GetInventory().GetCargo())
1482 int item_count = GetInventory().GetCargo().GetItemCount();
1485 int random_pick =
Math.RandomInt(0, item_count);
1487 if (!item.IsExplosive())
1489 item.AddHealth(
"",
"",damage);
1499 int attachment_count = GetInventory().AttachmentCount();
1500 if (attachment_count > 0)
1502 int random_pick =
Math.RandomInt(0, attachment_count);
1503 ItemBase attachment =
ItemBase.Cast(GetInventory().GetAttachmentFromIndex(random_pick));
1504 if (!attachment.IsExplosive())
1506 attachment.AddHealth(
"",
"",damage);
1533 ctx.Write(destination_entity);
1539 else if (!
GetGame().IsMultiplayer())
1547 float split_quantity_new;
1553 if (destination_entity && slot_id != -1 &&
InventorySlots.IsSlotIdValid(slot_id))
1556 split_quantity_new = stack_max;
1560 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateAttachmentEx(
this.GetType(), slot_id));
1563 new_item.SetResultOfSplit(
true);
1564 MiscGameplayFunctions.TransferItemProperties(
this, new_item);
1566 new_item.SetQuantity(split_quantity_new);
1569 else if (destination_entity && slot_id == -1)
1571 if (quantity > stack_max)
1572 split_quantity_new = stack_max;
1574 split_quantity_new = quantity;
1584 new_item.SetResultOfSplit(
true);
1585 MiscGameplayFunctions.TransferItemProperties(
this, new_item);
1587 new_item.SetQuantity(split_quantity_new);
1599 if (split_quantity_new == 0)
1601 if (!
GetGame().IsMultiplayer())
1602 player.PhysicalPredictiveDropItem(
this);
1604 player.ServerDropEntity(
this);
1612 new_item.SetResultOfSplit(
true);
1613 MiscGameplayFunctions.TransferItemProperties(
this, new_item);
1615 new_item.SetQuantity(stack_max);
1616 new_item.PlaceOnSurface();
1633 dst.WriteToContext(ctx);
1637 else if (!
GetGame().IsMultiplayer())
1654 ctx.Write(destination_entity);
1662 else if (!
GetGame().IsMultiplayer())
1676 float split_quantity_new;
1680 int slot_id = dst.GetSlot();
1683 if (quantity > stack_max)
1684 split_quantity_new = stack_max;
1686 split_quantity_new = quantity;
1692 new_item.SetResultOfSplit(
true);
1693 MiscGameplayFunctions.TransferItemProperties(
this,new_item);
1695 new_item.SetQuantity(split_quantity_new);
1707 float split_quantity_new;
1709 if (destination_entity)
1712 if (quantity > stackable)
1713 split_quantity_new = stackable;
1715 split_quantity_new = quantity;
1717 new_item =
ItemBase.Cast(destination_entity.GetInventory().CreateEntityInCargoEx(
this.GetType(), idx, row, col,
false));
1720 new_item.SetResultOfSplit(
true);
1721 MiscGameplayFunctions.TransferItemProperties(
this,new_item);
1723 new_item.SetQuantity(split_quantity_new);
1740 ctx.Write(destination_entity);
1746 else if (!
GetGame().IsMultiplayer())
1755 float split_quantity_new;
1760 if (quantity > stackable)
1761 split_quantity_new = stackable;
1763 split_quantity_new = quantity;
1765 EntityAI in_hands = player.GetHumanInventory().CreateInHands(this.
GetType());
1766 new_item =
ItemBase.Cast(in_hands);
1769 new_item.SetResultOfSplit(
true);
1770 MiscGameplayFunctions.TransferItemProperties(
this,new_item);
1772 new_item.SetQuantity(split_quantity_new);
1783 float split_quantity_new =
Math.Floor(quantity * 0.5);
1789 if (new_item.GetQuantityMax() < split_quantity_new)
1791 split_quantity_new = new_item.GetQuantityMax();
1794 new_item.SetResultOfSplit(
true);
1795 MiscGameplayFunctions.TransferItemProperties(
this, new_item);
1800 new_item.SetQuantity(1);
1805 new_item.SetQuantity(split_quantity_new);
1818 float split_quantity_new =
Math.Floor(quantity / 2);
1824 new_item = player.CreateCopyOfItemInInventoryOrGroundEx(
this,
true);
1828 if (new_item.GetQuantityMax() < split_quantity_new)
1830 split_quantity_new = new_item.GetQuantityMax();
1832 if (found && invloc.IsValid() && invloc.GetType() ==
InventoryLocationType.ATTACHMENT && split_quantity_new > 1)
1835 new_item.SetQuantity(1);
1840 new_item.SetQuantity(split_quantity_new);
1853 parent.OnAttachmentQuantityChangedEx(
this, delta);
1869 override void EEHealthLevelChanged(
int oldLevel,
int newLevel,
string zone)
1871 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
1878 EntityAI parent = GetHierarchyParent();
1879 if (parent && parent.IsFireplace())
1881 CargoBase cargo = GetInventory().GetCargo();
1884 for (
int i = 0; i < cargo.GetItemCount(); ++i)
1899 if (
m_Cleanness != 0 && oldLevel < newLevel && newLevel != 0)
1909 super.OnRightClick();
1920 EntityAI root = GetHierarchyRoot();
1927 root.GetTransform(m4);
1928 dst.SetGround(
this, m4);
1931 GetInventory().GetCurrentInventoryLocation(dst);
1935 dst.SetCargo(dst.GetParent(),
this, dst.GetIdx(), dst.GetRow(), dst.GetCol(), dst.GetFlip());
1936 if (
GetGame().
GetPlayer().GetInventory().HasInventoryReservation(
null, dst))
1940 root.GetTransform(m4);
1941 dst.SetGround(
this, m4);
1944 GetInventory().GetCurrentInventoryLocation(dst);
1948 GetGame().GetPlayer().GetInventory().AddInventoryReservationEx(
null, dst,
GameInventory.c_InventoryReservationTimeoutShortMS);
1957 dst.WriteToContext(ctx);
1962 else if (!
GetGame().IsMultiplayer())
1969 override bool CanBeCombined(
EntityAI other_item,
bool reservation_check =
true,
bool stack_max_limit =
false)
1973 if (!other_item ||
GetType() != other_item.GetType() || (
IsFullQuantity() && other_item.GetQuantity() > 0) || other_item ==
this)
1984 Magazine mag = Magazine.Cast(
this);
1987 if (mag.GetAmmoCount() >= mag.GetAmmoMax())
1990 if (stack_max_limit)
1992 Magazine other_mag = Magazine.Cast(other_item);
1995 if (mag.GetAmmoCount() + other_mag.GetAmmoCount() > mag.GetAmmoMax())
2012 if (CastTo(player, GetHierarchyRootPlayer()))
2014 if (player.GetInventory().HasAttachment(
this))
2017 if (player.IsItemsToDelete())
2021 if (reservation_check && (GetInventory().HasInventoryReservation(
this,
null) || other_item.GetInventory().HasInventoryReservation(other_item,
null)))
2026 if (GetInventory().GetCurrentAttachmentSlotInfo(slotID,
slotName) && GetHierarchyParent().GetInventory().GetSlotLock(slotID))
2039 return m_IsResultOfSplit;
2044 m_IsResultOfSplit = value;
2054 float other_item_quantity = other_item.GetQuantity();
2055 float this_free_space;
2061 if (other_item_quantity > this_free_space)
2063 return this_free_space;
2067 return other_item_quantity;
2073 if (!CanBeCombined(other_item,
false))
2076 if (!IsMagazine() && other_item)
2079 if (quantity_used != 0)
2081 float hp1 = GetHealth01(
"",
"");
2082 float hp2 = other_item.GetHealth01(
"",
"");
2083 float hpResult = ((hp1*
GetQuantity()) + (hp2*quantity_used));
2086 hpResult *= GetMaxHealth();
2087 Math.Round(hpResult);
2088 SetHealth(
"",
"Health", hpResult);
2091 other_item.AddQuantity(-quantity_used);
2094 OnCombine(other_item);
2097 void OnCombine(
ItemBase other_item)
2100 if (!GetHierarchyRootPlayer() && GetHierarchyParent())
2101 GetHierarchyParent().IncreaseLifetimeUp();
2110 PluginRecipesManager moduleRecipesManager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
2111 if (moduleRecipesManager)
2113 EntityAI itemInHands = player.GetHumanInventory().GetEntityInHands();
2114 moduleRecipesManager.GetValidRecipes(
ItemBase.Cast(
this),
ItemBase.Cast(itemInHands), recipesIds, p);
2117 for (
int i = 0;i < recipesIds.Count(); i++)
2119 int key = recipesIds.Get(i);
2120 string recipeName = moduleRecipesManager.GetRecipeName(key);
2126 override void GetDebugActions(out TSelectableActionInfoArrayEx outputList)
2128 super.GetDebugActions(outputList);
2170 super.OnAction(action_id, player, ctx);
2171 if (action_id >=
EActions.RECIPES_RANGE_START && action_id <
EActions.RECIPES_RANGE_END)
2173 PluginRecipesManager plugin_recipes_manager = PluginRecipesManager.Cast(
GetPlugin(PluginRecipesManager));
2174 int idWithoutOffset = action_id -
EActions.RECIPES_RANGE_START;
2176 if (
EActions.RECIPES_RANGE_START < 1000)
2178 float anim_length = plugin_recipes_manager.GetRecipeLengthInSecs(idWithoutOffset);
2179 float specialty_weight = plugin_recipes_manager.GetRecipeSpecialty(idWithoutOffset);
2183 else if (action_id ==
EActions.WATCH_PLAYER)
2185 PluginDeveloper.SetDeveloperItemClientEx(player);
2190 if (action_id >=
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START && action_id <
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_END)
2192 int id = action_id -
EActions.DEBUG_ITEM_WATCH_BUTTON_RANGE_START;
2193 OnDebugButtonPressServer(
id + 1);
2196 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_INJECT_START && action_id <
EActions.DEBUG_AGENTS_RANGE_INJECT_END)
2198 int agent_id = action_id -
EActions.DEBUG_AGENTS_RANGE_INJECT_START;
2202 else if (action_id >=
EActions.DEBUG_AGENTS_RANGE_REMOVE_START && action_id <
EActions.DEBUG_AGENTS_RANGE_REMOVE_END)
2204 int agent_id2 = action_id -
EActions.DEBUG_AGENTS_RANGE_REMOVE_START;
2208 else if (action_id ==
EActions.ADD_QUANTITY)
2212 Magazine mag = Magazine.Cast(
this);
2213 mag.ServerSetAmmoCount(mag.GetAmmoCount() + mag.GetAmmoMax() * 0.2);
2222 m_EM.AddEnergy(m_EM.GetEnergyMax() * 0.2);
2227 else if (action_id ==
EActions.REMOVE_QUANTITY)
2231 Magazine mag2 = Magazine.Cast(
this);
2232 mag2.ServerSetAmmoCount(mag2.GetAmmoCount() - mag2.GetAmmoMax() * 0.2);
2240 m_EM.AddEnergy(- m_EM.GetEnergyMax() * 0.2);
2245 else if (action_id ==
EActions.SET_QUANTITY_0)
2255 else if (action_id ==
EActions.SET_MAX_QUANTITY)
2261 m_EM.SetEnergy(m_EM.GetEnergyMax());
2265 else if (action_id ==
EActions.ADD_HEALTH)
2267 AddHealth(
"",
"",GetMaxHealth(
"",
"Health")/5);
2269 else if (action_id ==
EActions.REMOVE_HEALTH)
2271 AddHealth(
"",
"",-GetMaxHealth(
"",
"Health")/5);
2273 else if (action_id ==
EActions.DESTROY_HEALTH)
2275 SetHealth01(
"",
"",0);
2277 else if (action_id ==
EActions.WATCH_ITEM)
2282 SetDebugDeveloper_item(
this);
2286 else if (action_id ==
EActions.ADD_TEMPERATURE)
2292 else if (action_id ==
EActions.REMOVE_TEMPERATURE)
2298 else if (action_id ==
EActions.ADD_WETNESS)
2304 else if (action_id ==
EActions.REMOVE_WETNESS)
2310 else if (action_id ==
EActions.LIQUIDTYPE_UP)
2318 else if (action_id ==
EActions.LIQUIDTYPE_DOWN)
2324 else if (action_id ==
EActions.MAKE_SPECIAL)
2326 auto debugParams = DebugSpawnParams.WithPlayer(player);
2327 OnDebugSpawnEx(debugParams);
2330 else if (action_id ==
EActions.DELETE)
2353 bool CanExplodeInFire()
2365 override bool IsIgnoredByConstruction()
2374 string config_path =
string.Format(
"CfgVehicles %1 Food FoodStages",
GetType());
2375 return GetGame().ConfigIsExisting(config_path);
2391 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
2392 return module_repairing.CanRepair(
this, item_repair_kit);
2398 PluginRepairing module_repairing = PluginRepairing.Cast(
GetPlugin(PluginRepairing));
2399 return module_repairing.Repair(player,
this, item_repair_kit, specialty_weight);
2444 player.MessageStatus(text);
2462 player.MessageAction(text);
2480 player.MessageFriendly(text);
2498 player.MessageImportant(text);
2508 override bool KindOf(
string tag)
2511 string item_name = this.
GetType();
2513 GetGame().ConfigGetTextArray(
"cfgVehicles " + item_name +
" itemInfo", item_tag_array);
2515 int array_size = item_tag_array.Count();
2516 for (
int i = 0; i < array_size; i++)
2518 if (item_tag_array.Get(i) == tag)
2531 super.OnRPC(sender, rpc_type,ctx);
2537 case ERPCs.RPC_SOUND_LOCK_ATTACH:
2543 bool play = p.param1;
2544 string soundSet = p.param2;
2570 if (GetWrittenNoteData())
2572 GetWrittenNoteData().OnRPC(sender, rpc_type,ctx);
2594 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
2595 return plugin.GetID(
name);
2600 PluginVariables plugin = PluginVariables.Cast(
GetPlugin(PluginVariables));
2601 return plugin.GetName(
id);
2610 if (!ctx.Read(varFlags))
2675 int mask =
Math.Round(floats.Get(index));
2687 float quantity = floats.Get(index);
2695 float temperature = floats.Get(index);
2702 float wet = floats.Get(index);
2709 int liquidtype =
Math.Round(floats.Get(index));
2727 int cleanness =
Math.Round(floats.Get(index));
2779 if (version <= 108 && version!= -1)
2787 for (
int i = 0; i < numOfItems; i++)
2799 else if (version <= 116 && version!= -1)
2801 if (!ctx.Read(numOfItems))
2806 for (
int j = 0; j < numOfItems; j++)
2808 if (!ctx.Read(value))
2819 if (!ctx.Read(mask))
2824 if (!ctx.Read(value))
2839 if (!ctx.Read(value))
2846 if (!ctx.Read(value))
2853 if (!ctx.Read(intValue))
2860 if (!ctx.Read(intValue))
2864 if (!ctx.Read(value))
2868 if (!ctx.Read(value))
2872 if (!ctx.Read(value))
2880 if (!ctx.Read(intValue))
2899 ctx.Write(varFlags);
2914 if (version <= 108 && version != -1)
2935 if (!ctx.Read(varFlags))
2958 if (GetDamageSystemVersionChange() != -1 && version < GetDamageSystemVersionChange())
2963 if (!super.OnStoreLoad(ctx, version))
2971 bool hasQuickBarIndexSaved;
2973 if (!ctx.Read(hasQuickBarIndexSaved))
2979 if (hasQuickBarIndexSaved)
2984 if (!ctx.Read(itmQBIndex))
2991 if (itmQBIndex != -1 && parentPlayer)
2992 parentPlayer.SetLoadedQuickBarItemBind(
this, itmQBIndex);
3000 if (version ==
int.
MAX)
3002 if (!ctx.Read(itemQBIndex))
3008 else if (
Class.CastTo(player, GetHierarchyRootPlayer()))
3011 if (!ctx.Read(itemQBIndex))
3016 if (itemQBIndex != -1 && player)
3017 player.SetLoadedQuickBarItemBind(
this,itemQBIndex);
3039 if (!raib.OnStoreLoad(ctx,version))
3055 super.OnStoreSave(ctx);
3057 if (
PlayerBase.CastTo(player,GetHierarchyRootPlayer()))
3061 int itemQBIndex = -1;
3062 itemQBIndex = player.FindQuickBarEntityIndex(
this);
3063 ctx.Write(itemQBIndex);
3076 raib.OnStoreSave(ctx);
3081 override void AfterStoreLoad()
3083 super.AfterStoreLoad();
3097 override void EEOnAfterLoad()
3099 super.EEOnAfterLoad();
3110 bool CanBeDisinfected()
3117 override void OnVariablesSynchronized()
3121 #ifdef PLATFORM_CONSOLE
3166 super.OnVariablesSynchronized();
3172 bool SetQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false,
bool allow_client =
false,
bool clamp_to_stack_max =
true)
3182 Debug.LogError(
"No LiquidType specified, try setting 'varLiquidTypeInit' to a particular liquid type");
3189 if (value <= (min + 0.001))
3196 bool dstr = ConfigGetBool(
"varQuantityDestroyOnMin");
3204 else if (destroy_forced)
3234 bool AddQuantity(
float value,
bool destroy_config =
true,
bool destroy_forced =
false)
3254 float value_clamped =
Math.Clamp(value, 0, 1);
3256 SetQuantity(result, destroy_config, destroy_forced);
3281 GetInventory().GetCurrentInventoryLocation(il);
3283 int slot = il.GetSlot();
3299 float quantity_max = 0;
3301 if (attSlotID != -1)
3304 if (quantity_max <= 0)
3307 if (quantity_max <= 0)
3310 return quantity_max;
3343 float weightEx = GetWeightEx();
3344 float special = GetInventoryAndCargoWeight();
3345 return weightEx - special;
3359 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
3362 data1.SetCalcDetails(
"TIB1: " + GetConfigWeightModifiedDebugText() +
" * " +
GetQuantity()+
"(quantity)");
3368 else if (HasEnergyManager())
3371 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
3374 data2.SetCalcDetails(
"TIB2: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " + GetCompEM().
GetEnergy()+
"(energy) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit)");
3377 return super.GetWeightSpecialized(forceRecalc) + (GetCompEM().GetEnergy() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified());
3382 if (WeightDebug.m_VerbosityFlags & WeightDebugType.RECALC_FORCED)
3385 data3.SetCalcDetails(
"TIB3: "+super.GetWeightSpecialized(forceRecalc)+
"(contents weight) + " + GetConfigWeightModifiedDebugText() +
" + " +
GetQuantity()+
"(quantity) * " + ConfigGetFloat(
"weightPerQuantityUnit") +
"(weightPerQuantityUnit))");
3388 return super.GetWeightSpecialized(forceRecalc) + (
GetQuantity() * ConfigGetFloat(
"weightPerQuantityUnit")) + GetConfigWeightModified());
3398 if (GetInventory().GetCargo() != NULL)
3400 item_count = GetInventory().GetCargo().GetItemCount();
3403 for (
int i = 0; i < GetInventory().AttachmentCount(); i++)
3405 Class.CastTo(item,GetInventory().GetAttachmentFromIndex(i));
3407 item_count += item.GetNumberOfItems();
3417 if (include_wetness)
3421 weight = wetness * m_ConfigWeight;
3423 else if (ConfigGetFloat(
"liquidContainerType") > 0)
3455 if ((
GetGame().IsServer() || !
GetGame().IsMultiplayer()) && GetInventory())
3460 for (
int i = 0; i < items.Count(); i++)
3477 if (HasEnergyManager())
3479 energy = GetCompEM().GetEnergy();
3487 super.OnEnergyConsumed();
3494 super.OnEnergyAdded();
3502 if (
GetGame().IsServer() && HasEnergyManager() && GetCompEM().HasConversionOfEnergyToQuantity())
3506 float energy_0to1 = GetCompEM().GetEnergy0To1();
3512 override void SetTemperature(
float value,
bool allow_client =
false)
3560 return ConfigGetFloat(
"heatIsolation");
3570 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Drying %2",
GetType(), pIncrementName);
3571 if (
GetGame().ConfigIsExisting(paramPath))
3572 return GetGame().ConfigGetFloat(paramPath);
3579 string paramPath =
string.Format(
"CfgVehicles %1 EnvironmentWetnessIncrements Soaking %2",
GetType(), pIncrementName);
3580 if (
GetGame().ConfigIsExisting(paramPath))
3581 return GetGame().ConfigGetFloat(paramPath);
3586 override void SetWet(
float value,
bool allow_client =
false)
3605 override void AddWet(
float value)
3639 if (newLevel != oldLevel)
3652 return GetWetLevelInternal(
m_VarWet);
3666 Error(
"Attempting to change variable client side, variables are supposed to be changed on server only !!");
3675 if (ConfigIsExisting(
"itemModelLength"))
3677 return ConfigGetFloat(
"itemModelLength");
3684 if (ConfigIsExisting(
"itemAttachOffset"))
3686 return ConfigGetFloat(
"itemAttachOffset");
3691 void SetCleanness(
int value,
bool allow_client =
false)
3726 void SetColor(
int r,
int g,
int b,
int a)
3735 void GetColor(out
int r,out
int g,out
int b,out
int a)
3757 return MiscGameplayFunctions.GetColorString(r, g, b, a);
3773 return ConfigGetInt(
"varLiquidTypeInit");
3783 void OnInventoryEnter(Man player)
3790 nplayer.SetEnableQuickBarEntityShortcut(
this,
true);
3796 void OnInventoryExit(Man player)
3802 nplayer.SetEnableQuickBarEntityShortcut(
this,
false);
3807 player.GetHumanInventory().ClearUserReservedLocationForContainer(
this);
3810 if (HasEnergyManager())
3812 GetCompEM().UpdatePlugState();
3817 override void OnPlacementStarted(Man player)
3819 super.OnPlacementStarted(player);
3824 override void OnPlacementComplete(Man player,
vector position =
"0 0 0",
vector orientation =
"0 0 0")
3834 super.OnPlacementComplete(player, position, orientation);
3873 override void InsertAgent(
int agent,
float count = 1)
3958 if (GetInventory().GetAttachmentSlotsCount() != 0)
3960 ItemBase filter =
ItemBase.Cast(FindAttachmentBySlotName(
"GasMaskFilter"));
3962 return filter.GetProtectionLevel(type,
false, system);
3967 string subclassPath, entryName;
3972 entryName =
"biological";
3975 entryName =
"chemical";
3978 entryName =
"biological";
3982 subclassPath =
"CfgVehicles " + this.
GetType() +
" Protection ";
3984 return GetGame().ConfigGetFloat(subclassPath + entryName);
4011 override bool CanDisplayCargo()
4020 override bool CanPutInCargo(
EntityAI parent)
4027 if (!parent.IsRuined())
4034 override bool CanPutAsAttachment(
EntityAI parent)
4036 if (!super.CanPutAsAttachment(parent))
4041 if (!IsRuined() && !parent.IsRuined())
4049 override bool CanReceiveItemIntoCargo(
EntityAI item)
4055 return super.CanReceiveItemIntoCargo(item);
4058 override bool CanReceiveAttachment(
EntityAI attachment,
int slotId)
4065 if (attachmentInv && attachmentInv.GetCargo() && attachmentInv.GetCargo().GetItemCount() > 0)
4067 if (GetHierarchyParent() && !GetHierarchyParent().IsInherited(
PlayerBase))
4071 return super.CanReceiveAttachment(attachment, slotId);
4094 static void PlayFireParticles(
ItemBase weapon,
int muzzle_index,
string ammoType,
ItemBase muzzle_owner,
ItemBase suppressor,
string config_to_search)
4096 int id = muzzle_owner.GetMuzzleID();
4101 for (
int i = 0; i < WPOF_array.Count(); i++)
4103 WeaponParticlesOnFire WPOF = WPOF_array.Get(i);
4107 WPOF.OnActivate(weapon, muzzle_index, ammoType, muzzle_owner, suppressor, config_to_search);
4114 static void PlayBulletCasingEjectParticles(
ItemBase weapon,
string ammoType,
ItemBase muzzle_owner,
ItemBase suppressor,
string config_to_search)
4116 int id = muzzle_owner.GetMuzzleID();
4121 for (
int i = 0; i < WPOBE_array.Count(); i++)
4123 WeaponParticlesOnBulletCasingEject WPOBE = WPOBE_array.Get(i);
4127 WPOBE.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
4134 static void PlayOverheatingParticles(
ItemBase weapon,
string ammoType,
ItemBase muzzle_owner,
ItemBase suppressor,
string config_to_search)
4136 int id = muzzle_owner.GetMuzzleID();
4141 for (
int i = 0; i < WPOOH_array.Count(); i++)
4143 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
4147 WPOOH.OnActivate(weapon, 0, ammoType, muzzle_owner, suppressor, config_to_search);
4154 static void UpdateOverheatingParticles(
ItemBase weapon,
string ammoType,
ItemBase muzzle_owner,
ItemBase suppressor,
string config_to_search)
4156 int id = muzzle_owner.GetMuzzleID();
4161 for (
int i = 0; i < WPOOH_array.Count(); i++)
4163 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
4167 WPOOH.OnUpdate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
4174 static void StopOverheatingParticles(
ItemBase weapon,
string ammoType,
ItemBase muzzle_owner,
ItemBase suppressor,
string config_to_search)
4176 int id = muzzle_owner.GetMuzzleID();
4181 for (
int i = 0; i < WPOOH_array.Count(); i++)
4183 WeaponParticlesOnOverheating WPOOH = WPOOH_array.Get(i);
4187 WPOOH.OnDeactivate(weapon, ammoType, muzzle_owner, suppressor, config_to_search);
4245 override bool IsTakeable()
4253 string att_type =
"None";
4255 if (ConfigIsExisting(
"soundAttType"))
4257 att_type = ConfigGetString(
"soundAttType");
4291 string GetDeploySoundset();
4292 string GetPlaceSoundset();
4293 string GetLoopDeploySoundset();
4294 string GetDeployFinishSoundset();
4324 Debug.Log(
"dbgSounds | null m_DeployLoopSoundEx from sound set: " + GetLoopDeploySoundset());
4330 if (!
GetGame().IsDedicatedServer())
4345 Debug.Log(
"dbgSounds | null m_SoundDeploy from sound set: " + GetDeploySoundset());
4357 Debug.Log(
"dbgSounds | null m_SoundDeployFinish from sound set: " + GetDeployFinishSoundset());
4369 Debug.Log(
"dbgSounds | null m_SoundPlace from sound set: " + GetPlaceSoundset());
4381 if (!
GetGame().IsDedicatedServer())
4383 if (ConfigIsExisting(
"attachSoundSet"))
4385 string cfg_path =
"";
4386 string soundset =
"";
4391 ConfigGetTextArray(
"attachSoundSet",cfg_soundset_array);
4392 ConfigGetTextArray(
"attachSoundSlot",cfg_slot_array);
4394 if (cfg_soundset_array.Count() > 0 && cfg_soundset_array.Count() == cfg_slot_array.Count())
4396 for (
int i = 0; i < cfg_soundset_array.Count(); i++)
4398 if (cfg_slot_array[i] == slot_type)
4400 soundset = cfg_soundset_array[i];
4409 sound.SetAutodestroy(
true);
4422 float GetBandagingEffectivity()
4441 SetDynamicPhysicsLifeTime(0.01);
4448 GetDamageZones(zone_names);
4449 for (
int i = 0; i < zone_names.Count(); i++)
4451 SetHealthMax(zone_names.Get(i),
"Health");
4453 SetHealthMax(
"",
"Health");
4459 float global_health = GetHealth01(
"",
"Health");
4461 GetDamageZones(zones);
4463 for (
int i = 0; i < zones.Count(); i++)
4465 SetHealth01(zones.Get(i),
"Health",global_health);
4472 return IsExclusionFlagPresent(
PlayerBase.GetFaceCoverageShaveValues());
4477 if (!hasRootAsPlayer)
4485 else if ((refParentIB.GetLiquidType() != 0) && (refParentIB.GetQuantity() > 0) && (
m_VarWet <
m_VarWetMax))
4528 EntityAI parent = GetHierarchyParent();
4532 hasRootAsPlayer =
false;
4537 hasRootAsPlayer = (GetHierarchyRootPlayer() !=
null);
4538 refParentIB =
ItemBase.Cast(parent);
4542 protected void ProcessDecay(
float delta,
bool hasRootAsPlayer)
4576 bool hasParent =
false, hasRootAsPlayer =
false;
4579 bool wwtu =
g_Game.IsWorldWetTempUpdateEnabled();
4580 bool foodDecay =
g_Game.IsFoodDecayEnabled();
4582 if (wwtu || foodDecay)
4588 if (processWetness || processTemperature || processDecay)
4593 ProcessItemWetness(m_ElapsedSinceLastUpdate, hasParent, hasRootAsPlayer, refParentIB);
4595 if (processTemperature)
4599 ProcessDecay(m_ElapsedSinceLastUpdate, hasRootAsPlayer);
4606 return (item.IsKindOf(
"Cauldron") || item.IsKindOf(
"Pot") || item.IsKindOf(
"FryingPan") || item.IsKindOf(
"SmallProtectorCase") || (item.IsKindOf(
"PortableGasStove") && item.FindAttachmentBySlotName(
"CookingEquipment")));
4611 MiscGameplayFunctions.TransferItemProperties(oldItem,
this);
4654 explosive.PairRemote(trg);
4655 trg.SetControlledDevice(explosive);
4658 trg.SetPersistentPairID(persistentID);
4659 explosive.SetPersistentPairID(persistentID);
4667 override void SetDebugItem()
4669 super.SetDebugItem();
4685 bool is_item = entity.IsInherited(
ItemBase);
4686 if (is_item && full_quantity)
4689 item.SetQuantity(item.GetQuantityInit());
4694 Print(
"Cannot spawn entity: " + object_name);
4705 item.SetHealth(
"",
"", health);
4708 if (item.HasEnergyManager())
4712 item.GetCompEM().SetEnergy0To1(quantity);
4716 item.GetCompEM().SetEnergy(
Math.AbsFloat(quantity));
4719 else if (item.IsMagazine())
4721 Magazine mag = Magazine.Cast(item);
4724 mag.ServerSetAmmoCount(mag.GetAmmoMax() * quantity);
4728 mag.ServerSetAmmoCount(
Math.AbsFloat(quantity));
4736 item.SetQuantityNormalized(quantity,
false);
4740 item.SetQuantity(
Math.AbsFloat(quantity));