Improves examine for ranged weapons, magazines and ammo.
This commit is contained in:
@@ -16,11 +16,12 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
|
||||
{
|
||||
[RegisterComponent]
|
||||
public sealed class AmmoBoxComponent : Component, IInteractUsing, IUse, IInteractHand, IMapInit
|
||||
public sealed class AmmoBoxComponent : Component, IInteractUsing, IUse, IInteractHand, IMapInit, IExamine
|
||||
{
|
||||
public override string Name => "AmmoBox";
|
||||
|
||||
@@ -197,6 +198,8 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
|
||||
return TryUse(eventArgs.User);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// So if you have 200 rounds in a box and that suddenly creates 200 entities you're not having a fun time
|
||||
[Verb]
|
||||
private sealed class DumpVerb : Verb<AmmoBoxComponent>
|
||||
@@ -218,5 +221,11 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
|
||||
component.EjectContents(10);
|
||||
}
|
||||
}
|
||||
|
||||
public void Examine(FormattedMessage message, bool inDetailsRange)
|
||||
{
|
||||
message.AddMarkup(Loc.GetString("\nIt's a [color=white]{0}[/color] ammo box.", _caliber));
|
||||
message.AddMarkup(Loc.GetString("\nIt has [color=white]{0}[/color] out of [color=white]{1}[/color] ammo left.", AmmoLeft, _capacity));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -8,6 +9,7 @@ using Robust.Shared.GameObjects.Systems;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Timing;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
@@ -21,7 +23,7 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
|
||||
/// Generally used for bullets but can be used for other things like bananas
|
||||
/// </summary>
|
||||
[RegisterComponent]
|
||||
public class AmmoComponent : Component
|
||||
public class AmmoComponent : Component, IExamine
|
||||
{
|
||||
public override string Name => "Ammo";
|
||||
public BallisticCaliber Caliber => _caliber;
|
||||
@@ -152,6 +154,12 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
|
||||
};
|
||||
EntitySystem.Get<EffectSystem>().CreateParticle(message);
|
||||
}
|
||||
|
||||
public void Examine(FormattedMessage message, bool inDetailsRange)
|
||||
{
|
||||
var text = Loc.GetString("It's [color=white]{0}[/color] ammo.", Caliber);
|
||||
message.AddMarkup(text);
|
||||
}
|
||||
}
|
||||
|
||||
public enum BallisticCaliber
|
||||
|
||||
@@ -5,6 +5,7 @@ using Content.Server.GameObjects.Components.GUI;
|
||||
using Content.Server.GameObjects.Components.Items.Storage;
|
||||
using Content.Server.GameObjects.Components.Weapon.Ranged.Barrels;
|
||||
using Content.Shared.GameObjects.Components.Weapons.Ranged.Barrels;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Content.Shared.Interfaces;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
@@ -14,11 +15,12 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class RangedMagazineComponent : Component, IMapInit, IInteractUsing, IUse
|
||||
public class RangedMagazineComponent : Component, IMapInit, IInteractUsing, IUse, IExamine
|
||||
{
|
||||
public override string Name => "RangedMagazine";
|
||||
|
||||
@@ -168,5 +170,11 @@ namespace Content.Server.GameObjects.Components.Weapon.Ranged.Ammunition
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Examine(FormattedMessage message, bool inDetailsRange)
|
||||
{
|
||||
var text = Loc.GetString("It's a [color=white]{0}[/color] magazine of [color=white]{1}[/color] caliber.", MagazineType, Caliber);
|
||||
message.AddMarkup(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user