Knowledge UI (#779)

* knowledge button in HUD

* ui controller

* bugfixes

* finish

* all-knowing ghosts

* Create knowledge-ui.ftl
This commit is contained in:
Ed
2025-01-18 14:43:11 +03:00
committed by GitHub
parent 734d12cfac
commit 68ab77d4d4
17 changed files with 308 additions and 1 deletions

View File

@@ -2,6 +2,7 @@ using System.Text;
using Content.Shared._CP14.Knowledge.Components;
using Content.Shared._CP14.Knowledge.Prototypes;
using Content.Shared.DoAfter;
using Content.Shared.Ghost;
using Content.Shared.MagicMirror;
using Content.Shared.Paper;
using Robust.Shared.Prototypes;
@@ -65,6 +66,9 @@ public abstract partial class SharedCP14KnowledgeSystem : EntitySystem
ProtoId<CP14KnowledgePrototype> knowledge,
CP14KnowledgeStorageComponent? knowledgeStorage = null)
{
if (HasComp<GhostComponent>(uid)) //All-knowing ghosts
return true;
if (!Resolve(uid, ref knowledgeStorage, false))
return false;
@@ -92,3 +96,27 @@ public sealed partial class CP14KnowledgeLearnDoAfterEvent : DoAfterEvent
public ProtoId<CP14KnowledgePrototype> Knowledge;
public override DoAfterEvent Clone() => this;
}
[Serializable, NetSerializable]
public sealed class CP14KnowledgeInfoEvent : EntityEventArgs
{
public readonly NetEntity NetEntity;
public readonly HashSet<ProtoId<CP14KnowledgePrototype>> AllKnowledge;
public CP14KnowledgeInfoEvent(NetEntity netEntity, HashSet<ProtoId<CP14KnowledgePrototype>> allKnowledge)
{
NetEntity = netEntity;
AllKnowledge = allKnowledge;
}
}
[Serializable, NetSerializable]
public sealed class RequestKnowledgeInfoEvent : EntityEventArgs
{
public readonly NetEntity NetEntity;
public RequestKnowledgeInfoEvent(NetEntity netEntity)
{
NetEntity = netEntity;
}
}