Gods part 6 (#1425)

* Skill scanning + bugfixes

* memory point examining

* Update base.yml

* predict skill examining

* moon beam lumera action

* balance
This commit is contained in:
Red
2025-06-15 01:50:16 +03:00
committed by GitHub
parent 71abce8db8
commit 4be22326ce
21 changed files with 213 additions and 79 deletions

View File

@@ -1,6 +1,6 @@
using Content.Shared._CP14.MagicEssence;
using Content.Shared._CP14.MagicSpell.Events;
using Content.Shared._CP14.ResearchTable;
using Content.Shared._CP14.Skill;
using Content.Shared.Armor;
using Content.Shared.Atmos;
using Content.Shared.Chat;

View File

@@ -1,78 +1,12 @@
using System.Text;
using Content.Shared._CP14.Skill;
using Content.Shared._CP14.Skill.Components;
using Content.Shared._CP14.Skill.Prototypes;
using Content.Shared.DoAfter;
using Content.Shared.Examine;
using Content.Shared.Inventory;
using Content.Shared.Verbs;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
namespace Content.Shared._CP14.ResearchTable;
public abstract class CP14SharedResearchSystem : EntitySystem
{
[Dependency] private readonly ExamineSystemShared _examine = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
[Dependency] private readonly CP14SharedSkillSystem _skill = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<CP14SkillScannerComponent, CP14SkillScanEvent>(OnSkillScan);
SubscribeLocalEvent<CP14SkillScannerComponent, InventoryRelayedEvent<CP14SkillScanEvent>>((e, c, ev) => OnSkillScan(e, c, ev.Args));
SubscribeLocalEvent<CP14SkillStorageComponent, GetVerbsEvent<ExamineVerb>>(OnExamined);
}
private void OnExamined(Entity<CP14SkillStorageComponent> ent, ref GetVerbsEvent<ExamineVerb> args)
{
var scanEvent = new CP14SkillScanEvent();
RaiseLocalEvent(args.User, scanEvent);
if (!scanEvent.CanScan)
return;
var markup = GetSkillExamine(ent);
_examine.AddDetailedExamineVerb(
args,
ent.Comp,
markup,
Loc.GetString("cp14-skill-examine"),
"/Textures/Interface/students-cap.svg.192dpi.png");
}
private FormattedMessage GetSkillExamine(Entity<CP14SkillStorageComponent> ent)
{
var msg = new FormattedMessage();
var sb = new StringBuilder();
sb.Append(Loc.GetString("cp14-skill-examine-title") + "\n");
foreach (var skill in ent.Comp.LearnedSkills)
{
if (!_proto.TryIndex(skill, out var indexedSkill))
continue;
if(!_proto.TryIndex(indexedSkill.Tree, out var indexedTree))
continue;
var skillName = _skill.GetSkillName(skill);
sb.Append($"• [color={indexedTree.Color.ToHex()}]{skillName}[/color]\n");
}
msg.AddMarkupOrThrow(sb.ToString());
return msg;
}
private void OnSkillScan(EntityUid uid, CP14SkillScannerComponent component, CP14SkillScanEvent args)
{
args.CanScan = true;
}
}
[Serializable, NetSerializable]
@@ -83,9 +17,3 @@ public sealed partial class CP14ResearchDoAfterEvent : DoAfterEvent
public override DoAfterEvent Clone() => this;
}
public sealed class CP14SkillScanEvent : EntityEventArgs, IInventoryRelayEvent
{
public bool CanScan;
public SlotFlags TargetSlots { get; } = SlotFlags.EYES;
}

View File

@@ -3,7 +3,6 @@ using System.Text;
using Content.Shared._CP14.Skill.Components;
using Content.Shared._CP14.Skill.Prototypes;
using Content.Shared.FixedPoint;
using Content.Shared.Popups;
using Robust.Shared.Prototypes;
namespace Content.Shared._CP14.Skill;
@@ -22,6 +21,7 @@ public abstract partial class CP14SharedSkillSystem : EntitySystem
InitializeAdmin();
InitializeChecks();
InitializeScanning();
}
private void OnMapInit(Entity<CP14SkillStorageComponent> ent, ref MapInitEvent args)

View File

@@ -0,0 +1,75 @@
using System.Text;
using Content.Shared._CP14.Skill.Components;
using Content.Shared.Examine;
using Content.Shared.Inventory;
using Content.Shared.Verbs;
using Robust.Shared.Utility;
namespace Content.Shared._CP14.Skill;
public abstract partial class CP14SharedSkillSystem
{
[Dependency] private readonly ExamineSystemShared _examine = default!;
private void InitializeScanning()
{
SubscribeLocalEvent<CP14SkillScannerComponent, CP14SkillScanEvent>(OnSkillScan);
SubscribeLocalEvent<CP14SkillScannerComponent, InventoryRelayedEvent<CP14SkillScanEvent>>((e, c, ev) => OnSkillScan(e, c, ev.Args));
SubscribeLocalEvent<CP14SkillStorageComponent, GetVerbsEvent<ExamineVerb>>(OnExamined);
}
private void OnExamined(Entity<CP14SkillStorageComponent> ent, ref GetVerbsEvent<ExamineVerb> args)
{
var scanEvent = new CP14SkillScanEvent();
RaiseLocalEvent(args.User, scanEvent);
if (!scanEvent.CanScan)
return;
var markup = GetSkillExamine(ent);
_examine.AddDetailedExamineVerb(
args,
ent.Comp,
markup,
Loc.GetString("cp14-skill-info-title"),
"/Textures/Interface/students-cap.svg.192dpi.png");
}
private FormattedMessage GetSkillExamine(Entity<CP14SkillStorageComponent> ent)
{
var msg = new FormattedMessage();
var sb = new StringBuilder();
sb.Append(Loc.GetString("cp14-skill-examine-title") + "\n");
foreach (var skill in ent.Comp.LearnedSkills)
{
if (!_proto.TryIndex(skill, out var indexedSkill))
continue;
if(!_proto.TryIndex(indexedSkill.Tree, out var indexedTree))
continue;
var skillName = GetSkillName(skill);
sb.Append($"• [color={indexedTree.Color.ToHex()}]{skillName}[/color]\n");
}
sb.Append($"\n{Loc.GetString("cp14-skill-menu-level")} {ent.Comp.SkillsSumExperience}/{ent.Comp.ExperienceMaxCap}\n");
msg.AddMarkupOrThrow(sb.ToString());
return msg;
}
private void OnSkillScan(EntityUid uid, CP14SkillScannerComponent component, CP14SkillScanEvent args)
{
args.CanScan = true;
}
}
public sealed class CP14SkillScanEvent : EntityEventArgs, IInventoryRelayEvent
{
public bool CanScan;
public SlotFlags TargetSlots { get; } = SlotFlags.EYES;
}