Stack examining is now ECS.
This commit is contained in:
@@ -1,8 +1,5 @@
|
|||||||
using Content.Shared.GameObjects.Components;
|
using Content.Shared.GameObjects.Components;
|
||||||
using Content.Shared.GameObjects.EntitySystems;
|
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Localization;
|
|
||||||
using Robust.Shared.Utility;
|
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components.Stack
|
namespace Content.Server.GameObjects.Components.Stack
|
||||||
@@ -10,23 +7,9 @@ namespace Content.Server.GameObjects.Components.Stack
|
|||||||
// TODO: Naming and presentation and such could use some improvement.
|
// TODO: Naming and presentation and such could use some improvement.
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
[ComponentReference(typeof(SharedStackComponent))]
|
[ComponentReference(typeof(SharedStackComponent))]
|
||||||
public class StackComponent : SharedStackComponent, IExamine
|
public class StackComponent : SharedStackComponent
|
||||||
{
|
{
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
public bool ThrowIndividually { get; set; } = false;
|
public bool ThrowIndividually { get; set; } = false;
|
||||||
|
|
||||||
void IExamine.Examine(FormattedMessage message, bool inDetailsRange)
|
|
||||||
{
|
|
||||||
if (inDetailsRange)
|
|
||||||
{
|
|
||||||
message.AddMarkup(
|
|
||||||
Loc.GetString(
|
|
||||||
"comp-stack-examine-detail-count",
|
|
||||||
("count", Count),
|
|
||||||
("markupCountColor", "lightgray")
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -237,6 +237,7 @@ namespace Content.Shared.GameObjects.EntitySystems
|
|||||||
{
|
{
|
||||||
Message = message;
|
Message = message;
|
||||||
Examiner = examiner;
|
Examiner = examiner;
|
||||||
|
IsInDetailsRange = isInDetailsRange;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Shared.GameObjects.Components;
|
using Content.Shared.GameObjects.Components;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Localization;
|
||||||
|
|
||||||
namespace Content.Shared.GameObjects.EntitySystems
|
namespace Content.Shared.GameObjects.EntitySystems
|
||||||
{
|
{
|
||||||
@@ -13,6 +14,7 @@ namespace Content.Shared.GameObjects.EntitySystems
|
|||||||
|
|
||||||
SubscribeLocalEvent<SharedStackComponent, ComponentStartup>(OnStackStarted);
|
SubscribeLocalEvent<SharedStackComponent, ComponentStartup>(OnStackStarted);
|
||||||
SubscribeLocalEvent<SharedStackComponent, StackChangeCountEvent>(OnStackCountChange);
|
SubscribeLocalEvent<SharedStackComponent, StackChangeCountEvent>(OnStackCountChange);
|
||||||
|
SubscribeLocalEvent<SharedStackComponent, ExaminedEvent>(OnStackExamined);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnStackStarted(EntityUid uid, SharedStackComponent component, ComponentStartup args)
|
private void OnStackStarted(EntityUid uid, SharedStackComponent component, ComponentStartup args)
|
||||||
@@ -56,6 +58,20 @@ namespace Content.Shared.GameObjects.EntitySystems
|
|||||||
|
|
||||||
RaiseLocalEvent(uid, new StackCountChangedEvent(old, component.Count));
|
RaiseLocalEvent(uid, new StackCountChangedEvent(old, component.Count));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnStackExamined(EntityUid uid, SharedStackComponent component, ExaminedEvent args)
|
||||||
|
{
|
||||||
|
if (!args.IsInDetailsRange)
|
||||||
|
return;
|
||||||
|
|
||||||
|
args.Message.AddText("\n");
|
||||||
|
args.Message.AddMarkup(
|
||||||
|
Loc.GetString("comp-stack-examine-detail-count",
|
||||||
|
("count", component.Count),
|
||||||
|
("markupCountColor", "lightgray")
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user