Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Resonance] Small fixes #2745

Merged
merged 4 commits into from
Jul 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Exiled.API/Features/Doors/Door.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public bool IsClosed
/// <summary>
/// Gets the checkpoint door the door is belonging to, or null if the door doesn't belong to a checkpoint.
/// </summary>
public Door ParentCheckpointDoor { get; }
public Door ParentCheckpointDoor { get; internal set; }

/// <summary>
/// Gets a value indicating whether or not this door requires a keycard to open.
Expand Down
2 changes: 1 addition & 1 deletion Exiled.API/Features/Items/Armor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ internal Armor(ItemType type)
/// Gets or sets the Weight of the armor.
/// </summary>
[EProperty(category: nameof(Armor))]
public override float Weight
public new float Weight
{
get => Base.Weight;
set => Base._weight = value;
Expand Down
2 changes: 1 addition & 1 deletion Exiled.API/Features/Items/Firearm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ internal Firearm(ItemType type)
if (Base.HasAdvantageFlag(AttachmentDescriptiveAdvantages.Flashlight))
firearmStatusFlags.AddFlags(FirearmStatusFlags.FlashlightEnabled);

Base.Status = new(Base.AmmoManagerModule.MaxAmmo, firearmStatusFlags, Base.GetCurrentAttachmentsCode());
Base.Status = new(MaxAmmo, firearmStatusFlags, Base.GetCurrentAttachmentsCode());
}

/// <inheritdoc cref="BaseCodesValue"/>.
Expand Down
15 changes: 3 additions & 12 deletions Exiled.API/Features/Items/Item.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public class Item : GameEntity, IWrapper<ItemBase>
/// A dictionary of all <see cref="ItemBase"/>'s that have been converted into <see cref="Item"/>.
/// </summary>
internal static readonly Dictionary<ItemBase, Item> BaseToItem = new(new ComponentsEqualityComparer());
private float weight;

/// <summary>
/// Initializes a new instance of the <see cref="Item"/> class.
Expand All @@ -54,7 +53,6 @@ public Item(ItemBase itemBase)
{
Base = itemBase;
BaseToItem.Add(itemBase, this);
weight = itemBase.Weight;

if (Base.ItemSerial is 0 && itemBase.Owner != null)
{
Expand Down Expand Up @@ -130,14 +128,10 @@ public ushort Serial
public ItemTierFlags TierFlags => Base.TierFlags;

/// <summary>
/// Gets or sets the Weight of the item.
/// Gets the Weight of the item.
/// </summary>
[EProperty(category: nameof(Item))]
public virtual float Weight
{
get => weight;
set => weight = value;
}
public float Weight => Base.Weight;

/// <summary>
/// Gets a value indicating whether or not this item is ammunition.
Expand Down Expand Up @@ -294,7 +288,7 @@ public static Item Get(ItemBase itemBase)
public static Item Create(ItemType type, Player owner = null) => type switch
{
ItemType.SCP268 => new Usable(type),
ItemType.Adrenaline or ItemType.Medkit or ItemType.Painkillers or ItemType.SCP500 or ItemType.SCP207 or ItemType.SCP1853 => new Consumable(type),
ItemType.Adrenaline or ItemType.Medkit or ItemType.Painkillers or ItemType.SCP500 or ItemType.SCP207 or ItemType.AntiSCP207 or ItemType.SCP1853 => new Consumable(type),
ItemType.SCP244a or ItemType.SCP244b => new Scp244(type),
ItemType.Ammo9x19 or ItemType.Ammo12gauge or ItemType.Ammo44cal or ItemType.Ammo556x45 or ItemType.Ammo762x39 => new Ammo(type),
ItemType.Flashlight or ItemType.Lantern => new Flashlight(type),
Expand Down Expand Up @@ -394,10 +388,7 @@ internal virtual void ChangeOwner(Player oldOwner, Player newOwner)
internal virtual void ReadPickupInfo(Pickup pickup)
{
if (pickup is not null)
{
Scale = pickup.Scale;
Weight = pickup.Weight;
}
}
}
}
2 changes: 1 addition & 1 deletion Exiled.API/Features/Items/Usable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ internal Usable(ItemType type)
/// Gets or sets the weight of the item.
/// </summary>
[EProperty(category: nameof(Usable))]
public override float Weight
public new float Weight
{
get => Base._weight;
set => Base._weight = value;
Expand Down
7 changes: 2 additions & 5 deletions Exiled.API/Features/Pickups/Pickup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public class Pickup : GameEntity, IWrapper<ItemPickupBase>
/// </summary>
internal static readonly Dictionary<ItemPickupBase, Pickup> BaseToPickup = new(new ComponentsEqualityComparer());

private readonly ConstProperty<double> minPickupTime = new(0.24500000476837158, new[] { typeof(ItemPickupBase) });
private readonly ConstProperty<double> weightToTime = new(0.17499999701976776, new[] { typeof(ItemPickupBase) });
private readonly ConstProperty<double> minPickupTime = new(0.245d, new[] { typeof(ItemPickupBase) });
private readonly ConstProperty<double> weightToTime = new(0.175d, new[] { typeof(ItemPickupBase) });

/// <summary>
/// Initializes a new instance of the <see cref="Pickup"/> class.
Expand Down Expand Up @@ -611,10 +611,7 @@ public void UnSpawn()
internal virtual void ReadItemInfo(Items.Item item)
{
if (item is not null)
{
Scale = item.Scale;
Weight = item.Weight;
}
}

/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions Exiled.API/Features/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2461,6 +2461,8 @@ public bool UseItem(Item item)
usableItem.Base.Owner = referenceHub;
usableItem.Base.ServerOnUsingCompleted();

typeof(UsableItemsController).InvokeStaticEvent(nameof(UsableItemsController.ServerOnUsingCompleted), new object[] { referenceHub, usableItem.Base });

if (usableItem.Base is not null)
usableItem.Destroy();

Expand Down
2 changes: 1 addition & 1 deletion Exiled.API/Features/Round.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static class Round
/// <summary>
/// Gets a value indicating whether the round in progress or not.
/// </summary>
public static bool InProgress => ReferenceHub.LocalHub is not null && RoundSummary.RoundInProgress();
public static bool InProgress => ReferenceHub.LocalHub != null && RoundSummary.RoundInProgress();

/// <summary>
/// Gets a value indicating whether the round is ended or not.
Expand Down
Loading