* Fix paper system late localization * IS THIS WHAT YOU WANT * well I guess this is happening now * fix the BUI * did that even do anything before? * again with the escapeformatting... * Dirtying * Move dirty to function * Rename PaperSystem to PaperVisualizerSystem * Fix namespace * how many namespace changes must I suffer through * SetContent is for Setting Content * minor shuffling * review --------- Co-authored-by: plykiya <plykiya@protonmail.com> Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
29 lines
826 B
C#
29 lines
826 B
C#
using Content.Shared.Paper;
|
|
using Content.Shared.StoryGen;
|
|
|
|
namespace Content.Server.Paper;
|
|
|
|
public sealed class PaperRandomStorySystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly StoryGeneratorSystem _storyGen = default!;
|
|
[Dependency] private readonly PaperSystem _paper = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<PaperRandomStoryComponent, MapInitEvent>(OnMapInit);
|
|
}
|
|
|
|
private void OnMapInit(Entity<PaperRandomStoryComponent> paperStory, ref MapInitEvent ev)
|
|
{
|
|
if (!TryComp<PaperComponent>(paperStory, out var paper))
|
|
return;
|
|
|
|
if (!_storyGen.TryGenerateStoryFromTemplate(paperStory.Comp.Template, out var story))
|
|
return;
|
|
|
|
_paper.SetContent((paperStory.Owner, paper), story);
|
|
}
|
|
}
|