почти важно (#135)
* Add data field for id card microwave behaviour (#28087) * Move replacement chance from ReplacementAccentComponent to ReplacementAccentPrototype (#28049) Move replacement chance to ReplacementAccentPrototype * Resolves Bible summon message being sent to all users (#28104) * Changed PopupEntity overload used to ensure message is only sent to user * Updated uid for PopupEntity call * Updating _popupSystem.PopupEntity call in AttemptSummon * Random book story generator refactor (#28082) * Randomized book overhaul * Fix prototype names * Improved setting paper content * Praise Ratvar * Fix activatable UI popup message spam (#28123) Fixed activatable UI popup message spam * Modify battery assert to avoid floating point errors (#28007) * Update component query benchmarks (#27967) * Add more component query benchmarks. * Rename benchmark * Use non-generic `TryComp()` for metadata & transform (#28133) * sleeper agent appear later into the round and only once (#28160) --------- Co-authored-by: DrSmugleaf <10968691+DrSmugleaf@users.noreply.github.com> Co-authored-by: lzk <124214523+lzk228@users.noreply.github.com> Co-authored-by: double_b <40827162+benjamin-burges@users.noreply.github.com> Co-authored-by: Tayrtahn <tayrtahn@gmail.com> Co-authored-by: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> Co-authored-by: Killerqu00 <47712032+Killerqu00@users.noreply.github.com>
This commit is contained in:
@@ -1,14 +1,17 @@
|
||||
using Content.Shared.StoryGen;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.Paper;
|
||||
|
||||
/// <summary>
|
||||
/// Adds randomly generated stories to Paper component
|
||||
/// Adds a randomly generated story to the content of a <see cref="PaperComponent"/>
|
||||
/// </summary>
|
||||
[RegisterComponent, Access(typeof(PaperRandomStorySystem))]
|
||||
public sealed partial class PaperRandomStoryComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="StoryTemplatePrototype"/> ID to use for story generation.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public List<string>? StorySegments;
|
||||
|
||||
[DataField]
|
||||
public string StorySeparator = " ";
|
||||
public ProtoId<StoryTemplatePrototype> Template;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using Content.Server.RandomMetadata;
|
||||
using Content.Shared.StoryGen;
|
||||
|
||||
namespace Content.Server.Paper;
|
||||
|
||||
public sealed class PaperRandomStorySystem : EntitySystem
|
||||
{
|
||||
|
||||
[Dependency] private readonly RandomMetadataSystem _randomMeta = default!;
|
||||
[Dependency] private readonly StoryGeneratorSystem _storyGen = default!;
|
||||
[Dependency] private readonly PaperSystem _paper = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -19,11 +19,9 @@ public sealed class PaperRandomStorySystem : EntitySystem
|
||||
if (!TryComp<PaperComponent>(paperStory, out var paper))
|
||||
return;
|
||||
|
||||
if (paperStory.Comp.StorySegments == null)
|
||||
if (!_storyGen.TryGenerateStoryFromTemplate(paperStory.Comp.Template, out var story))
|
||||
return;
|
||||
|
||||
var story = _randomMeta.GetRandomFromSegments(paperStory.Comp.StorySegments, paperStory.Comp.StorySeparator);
|
||||
|
||||
paper.Content += $"\n{story}";
|
||||
_paper.SetContent(paperStory.Owner, story, paper);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ namespace Content.Server.Paper
|
||||
if (TryComp<AppearanceComponent>(uid, out var appearance))
|
||||
_appearance.SetData(uid, PaperVisuals.Status, PaperStatus.Written, appearance);
|
||||
|
||||
if (TryComp<MetaDataComponent>(uid, out var meta))
|
||||
if (TryComp(uid, out MetaDataComponent? meta))
|
||||
_metaSystem.SetEntityDescription(uid, "", meta);
|
||||
|
||||
_adminLogger.Add(LogType.Chat, LogImpact.Low,
|
||||
|
||||
Reference in New Issue
Block a user