make the detailed examine verb predicted (#35362)
can we stop predicting things
This commit is contained in:
@@ -1,9 +0,0 @@
|
|||||||
namespace Content.Server.DetailExaminable
|
|
||||||
{
|
|
||||||
[RegisterComponent]
|
|
||||||
public sealed partial class DetailExaminableComponent : Component
|
|
||||||
{
|
|
||||||
[DataField("content", required: true)] [ViewVariables(VVAccess.ReadWrite)]
|
|
||||||
public string Content = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,44 +0,0 @@
|
|||||||
using Content.Shared.Examine;
|
|
||||||
using Content.Shared.IdentityManagement;
|
|
||||||
using Content.Shared.Verbs;
|
|
||||||
using Robust.Shared.Utility;
|
|
||||||
|
|
||||||
namespace Content.Server.DetailExaminable
|
|
||||||
{
|
|
||||||
public sealed class DetailExaminableSystem : EntitySystem
|
|
||||||
{
|
|
||||||
[Dependency] private readonly ExamineSystemShared _examineSystem = default!;
|
|
||||||
|
|
||||||
public override void Initialize()
|
|
||||||
{
|
|
||||||
base.Initialize();
|
|
||||||
|
|
||||||
SubscribeLocalEvent<DetailExaminableComponent, GetVerbsEvent<ExamineVerb>>(OnGetExamineVerbs);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnGetExamineVerbs(EntityUid uid, DetailExaminableComponent component, GetVerbsEvent<ExamineVerb> args)
|
|
||||||
{
|
|
||||||
if (Identity.Name(args.Target, EntityManager) != MetaData(args.Target).EntityName)
|
|
||||||
return;
|
|
||||||
|
|
||||||
var detailsRange = _examineSystem.IsInDetailsRange(args.User, uid);
|
|
||||||
|
|
||||||
var verb = new ExamineVerb()
|
|
||||||
{
|
|
||||||
Act = () =>
|
|
||||||
{
|
|
||||||
var markup = new FormattedMessage();
|
|
||||||
markup.AddMarkupOrThrow(component.Content);
|
|
||||||
_examineSystem.SendExamineTooltip(args.User, uid, markup, false, false);
|
|
||||||
},
|
|
||||||
Text = Loc.GetString("detail-examinable-verb-text"),
|
|
||||||
Category = VerbCategory.Examine,
|
|
||||||
Disabled = !detailsRange,
|
|
||||||
Message = detailsRange ? null : Loc.GetString("detail-examinable-verb-disabled"),
|
|
||||||
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/examine.svg.192dpi.png"))
|
|
||||||
};
|
|
||||||
|
|
||||||
args.Verbs.Add(verb);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -23,7 +23,7 @@ using System.Numerics;
|
|||||||
using Content.Shared.Movement.Pulling.Components;
|
using Content.Shared.Movement.Pulling.Components;
|
||||||
using Content.Shared.Movement.Pulling.Systems;
|
using Content.Shared.Movement.Pulling.Systems;
|
||||||
using Content.Server.IdentityManagement;
|
using Content.Server.IdentityManagement;
|
||||||
using Content.Server.DetailExaminable;
|
using Content.Shared.DetailExaminable;
|
||||||
using Content.Shared.Store.Components;
|
using Content.Shared.Store.Components;
|
||||||
using Robust.Shared.Collections;
|
using Robust.Shared.Collections;
|
||||||
using Robust.Shared.Map.Components;
|
using Robust.Shared.Map.Components;
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Content.Server.Access.Systems;
|
using Content.Server.Access.Systems;
|
||||||
using Content.Server.DetailExaminable;
|
|
||||||
using Content.Server.Humanoid;
|
using Content.Server.Humanoid;
|
||||||
using Content.Server.IdentityManagement;
|
using Content.Server.IdentityManagement;
|
||||||
using Content.Server.Mind.Commands;
|
using Content.Server.Mind.Commands;
|
||||||
@@ -9,6 +8,7 @@ using Content.Shared.Access.Components;
|
|||||||
using Content.Shared.Access.Systems;
|
using Content.Shared.Access.Systems;
|
||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
using Content.Shared.Clothing;
|
using Content.Shared.Clothing;
|
||||||
|
using Content.Shared.DetailExaminable;
|
||||||
using Content.Shared.Humanoid;
|
using Content.Shared.Humanoid;
|
||||||
using Content.Shared.Humanoid.Prototypes;
|
using Content.Shared.Humanoid.Prototypes;
|
||||||
using Content.Shared.PDA;
|
using Content.Shared.PDA;
|
||||||
|
|||||||
10
Content.Shared/DetailExaminable/DetailExaminableComponent.cs
Normal file
10
Content.Shared/DetailExaminable/DetailExaminableComponent.cs
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
using Robust.Shared.GameStates;
|
||||||
|
|
||||||
|
namespace Content.Shared.DetailExaminable;
|
||||||
|
|
||||||
|
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
|
||||||
|
public sealed partial class DetailExaminableComponent : Component
|
||||||
|
{
|
||||||
|
[DataField(required: true), AutoNetworkedField]
|
||||||
|
public string Content = string.Empty;
|
||||||
|
}
|
||||||
45
Content.Shared/DetailExaminable/DetailExaminableystem.cs
Normal file
45
Content.Shared/DetailExaminable/DetailExaminableystem.cs
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
using Content.Shared.Examine;
|
||||||
|
using Content.Shared.IdentityManagement;
|
||||||
|
using Content.Shared.Verbs;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
|
namespace Content.Shared.DetailExaminable;
|
||||||
|
|
||||||
|
public sealed class DetailExaminableSystem : EntitySystem
|
||||||
|
{
|
||||||
|
[Dependency] private readonly ExamineSystemShared _examine = default!;
|
||||||
|
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
base.Initialize();
|
||||||
|
|
||||||
|
SubscribeLocalEvent<DetailExaminableComponent, GetVerbsEvent<ExamineVerb>>(OnGetExamineVerbs);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnGetExamineVerbs(Entity<DetailExaminableComponent> ent, ref GetVerbsEvent<ExamineVerb> args)
|
||||||
|
{
|
||||||
|
if (Identity.Name(args.Target, EntityManager) != MetaData(args.Target).EntityName)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var detailsRange = _examine.IsInDetailsRange(args.User, ent);
|
||||||
|
|
||||||
|
var user = args.User;
|
||||||
|
|
||||||
|
var verb = new ExamineVerb
|
||||||
|
{
|
||||||
|
Act = () =>
|
||||||
|
{
|
||||||
|
var markup = new FormattedMessage();
|
||||||
|
markup.AddMarkupPermissive(ent.Comp.Content);
|
||||||
|
_examine.SendExamineTooltip(user, ent, markup, false, false);
|
||||||
|
},
|
||||||
|
Text = Loc.GetString("detail-examinable-verb-text"),
|
||||||
|
Category = VerbCategory.Examine,
|
||||||
|
Disabled = !detailsRange,
|
||||||
|
Message = detailsRange ? null : Loc.GetString("detail-examinable-verb-disabled"),
|
||||||
|
Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/examine.svg.192dpi.png"))
|
||||||
|
};
|
||||||
|
|
||||||
|
args.Verbs.Add(verb);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user