XenoArch [Science Overhaul] (#12204)

* multi-node xeno artifacts

* refactor existing artifact effects

* more tweaks to generation

* more shit plus fix tests

* more generation stuff plus threat levels

* doink

* now make it build

* defer the artifact activation to not cause errors

also pricing

* some changes

* all of the yaml + ui stuff for artifact analyzer

* machine linking and starting to make the ui functional

* artifact analyzer display

* a shit ton of artifact analyzer stuff

* more changes; making destroy work properly; progress bar tweaks

* getting shit going!

ALL RIGHT

* small tweaks that didn't help much

* Komm susser todd: the end of analysis

* recipes and hints and ui, oh my!

* add some in-game sources

gotta prepare for day 1 launch

* node data + ditch random seed in place of id

* bunch of triggers

* finish off the last few triggers

* implement machine examine verb

* knock, flicker, blink, throw

* shatter, foam, shuffle, heat

* fix all the shit i broke

* *some* of these have to be good, no?

25 effects

* callin' it there for effects

* comments + reword some trigger hints

* don't mind this little commit here

* byref event

* fix brokey node entry

* fix low pressure trigger

* mirror review plus fixing 0x40's bug

also the throw artifact threw incorrectly

* randomize the event message a teeny bit
This commit is contained in:
Nemanja
2022-11-06 18:05:44 -05:00
committed by GitHub
parent 0d4a605a94
commit 273e0968e4
107 changed files with 3321 additions and 358 deletions

View File

@@ -0,0 +1,64 @@
using Content.Shared.Xenoarchaeology.Equipment;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
namespace Content.Client.Xenoarchaeology.Ui;
[UsedImplicitly]
public sealed class AnalysisConsoleBoundUserInterface : BoundUserInterface
{
private AnalysisConsoleMenu? _consoleMenu;
public AnalysisConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
{
}
protected override void Open()
{
base.Open();
_consoleMenu = new AnalysisConsoleMenu();
_consoleMenu.OnClose += Close;
_consoleMenu.OpenCentered();
_consoleMenu.OnServerSelectionButtonPressed += _ =>
{
SendMessage(new AnalysisConsoleServerSelectionMessage());
};
_consoleMenu.OnScanButtonPressed += _ =>
{
SendMessage(new AnalysisConsoleScanButtonPressedMessage());
};
_consoleMenu.OnDestroyButtonPressed += _ =>
{
SendMessage(new AnalysisConsoleDestroyButtonPressedMessage());
};
}
protected override void UpdateState(BoundUserInterfaceState state)
{
base.UpdateState(state);
switch (state)
{
case AnalysisConsoleScanUpdateState msg:
_consoleMenu?.SetDestroyButtonDisabled(msg);
_consoleMenu?.SetScanButtonDisabled(msg);
_consoleMenu?.UpdateInformationDisplay(msg);
_consoleMenu?.UpdateProgressBar(msg);
break;
}
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (!disposing)
return;
_consoleMenu?.Dispose();
}
}

View File

@@ -0,0 +1,59 @@
<controls:FancyWindow xmlns="https://spacestation14.io"
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls"
Title="{Loc 'analysis-console-menu-title'}"
MinSize="620 280"
SetSize="620 280">
<BoxContainer Orientation="Horizontal" HorizontalExpand="True" VerticalExpand="True">
<BoxContainer Margin="10 10 10 10" MinWidth="150" Orientation="Vertical" VerticalExpand="True" SizeFlagsStretchRatio="1">
<BoxContainer Orientation="Vertical" VerticalExpand="True">
<Button Name="ServerSelectionButton"
Text="{Loc 'analysis-console-server-list-button'}"></Button>
<BoxContainer MinHeight="5"></BoxContainer>
<Button Name="ScanButton"
Text="{Loc 'analysis-console-scan-button'}"
ToolTip="{Loc 'analysis-console-scan-tooltip-info'}">
</Button>
<BoxContainer MinHeight="10"></BoxContainer>
<Button Name="DestroyButton"
Text="{Loc 'analysis-console-destroy-button'}"
ToolTip="{Loc 'analysis-console-destroy-button-info'}">
</Button>
</BoxContainer>
<BoxContainer Orientation="Vertical">
<Label Name="ProgressLabel"></Label>
<ProgressBar
Name="ProgressBar"
MinValue="0"
MaxValue="1"
SetHeight="20">
</ProgressBar>
</BoxContainer>
</BoxContainer>
<customControls:VSeparator StyleClasses="LowDivider"/>
<PanelContainer Margin="10 10 10 10" HorizontalExpand="True" SizeFlagsStretchRatio="3">
<PanelContainer.PanelOverride>
<gfx:StyleBoxFlat BackgroundColor="#000000FF" />
</PanelContainer.PanelOverride>
<BoxContainer Margin="10 10 10 10" Orientation="Horizontal">
<BoxContainer Orientation="Vertical" HorizontalExpand="True" >
<BoxContainer VerticalExpand="True">
<RichTextLabel Name="Information"> </RichTextLabel>
</BoxContainer>
</BoxContainer>
<BoxContainer VerticalExpand="False" Orientation="Vertical" MaxSize="64 64">
<SpriteView
Name="ArtifactDisplay"
OverrideDirection="South"
VerticalExpand="False"
SetSize="64 64"
MaxSize="64 64"
Scale="2 2">
</SpriteView>
</BoxContainer>
<BoxContainer VerticalExpand="True"></BoxContainer>
</BoxContainer>
</PanelContainer>
</BoxContainer>
</controls:FancyWindow>

View File

@@ -0,0 +1,157 @@
using Content.Client.Stylesheets;
using Content.Client.UserInterface.Controls;
using Content.Shared.Xenoarchaeology.Equipment;
using Content.Shared.Xenoarchaeology.XenoArtifacts;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
namespace Content.Client.Xenoarchaeology.Ui;
[GenerateTypedNameReferences]
public sealed partial class AnalysisConsoleMenu : FancyWindow
{
[Dependency] private readonly IEntityManager _ent = default!;
[Dependency] private readonly IPrototypeManager _proto = default!;
public event Action<BaseButton.ButtonEventArgs>? OnServerSelectionButtonPressed;
public event Action<BaseButton.ButtonEventArgs>? OnScanButtonPressed;
public event Action<BaseButton.ButtonEventArgs>? OnDestroyButtonPressed;
public AnalysisConsoleMenu()
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
ServerSelectionButton.OnPressed += a => OnServerSelectionButtonPressed?.Invoke(a);
ScanButton.OnPressed += a => OnScanButtonPressed?.Invoke(a);
DestroyButton.OnPressed += a => OnDestroyButtonPressed?.Invoke(a);
}
public void SetScanButtonDisabled(AnalysisConsoleScanUpdateState state)
{
var disabled = !state.CanScan;
ScanButton.Disabled = disabled;
}
public void SetDestroyButtonDisabled(AnalysisConsoleScanUpdateState state)
{
var disabled = !state.ServerConnected || !state.CanScan;
DestroyButton.Disabled = disabled;
if (disabled)
{
DestroyButton.RemoveStyleClass(StyleBase.ButtonCaution);
}
else
{
DestroyButton.AddStyleClass(StyleBase.ButtonCaution);
}
}
public void UpdateArtifactIcon(EntityUid? uid)
{
if (uid == null)
{
ArtifactDisplay.Visible = false;
return;
}
ArtifactDisplay.Visible = true;
if (!_ent.TryGetComponent<SpriteComponent>(uid, out var sprite))
return;
ArtifactDisplay.Sprite = sprite;
}
public void UpdateInformationDisplay(AnalysisConsoleScanUpdateState state)
{
var message = new FormattedMessage();
if (state.Scanning)
{
message.AddMarkup(Loc.GetString("analysis-console-info-scanner"));
Information.SetMessage(message);
return;
}
//do this here
UpdateArtifactIcon(state.Artifact);
if (state.Artifact == null)//no scan present
{
if (!state.AnalyzerConnected) //no analyzer connected
message.AddMarkup(Loc.GetString("analysis-console-info-no-scanner"));
else if (!state.CanScan) //no artifact
message.AddMarkup(Loc.GetString("analysis-console-info-no-artifact"));
else if (state.Artifact == null) //ready to go
message.AddMarkup(Loc.GetString("analysis-console-info-ready"));
}
if (state.Id != null) //node id
message.AddMarkup(Loc.GetString("analysis-console-info-id", ("id", state.Id))+"\n");
if (state.Depth != null) //node depth
message.AddMarkup(Loc.GetString("analysis-console-info-depth", ("depth", state.Depth))+"\n");
if (state.Triggered != null) //whether it has been triggered
{
var activated = state.Triggered.Value
? "analysis-console-info-triggered-true"
: "analysis-console-info-triggered-false";
message.AddMarkup(Loc.GetString(activated)+"\n");
}
message.AddMarkup("\n");
var needSecondNewline = false;
if (state.TriggerProto != null && //possible triggers
_proto.TryIndex<ArtifactTriggerPrototype>(state.TriggerProto, out var trigger) &&
trigger.TriggerHint != null)
{
message.AddMarkup(Loc.GetString("analysis-console-info-trigger",
("trigger", Loc.GetString(trigger.TriggerHint))) + "\n");
needSecondNewline = true;
}
if (state.EffectProto != null && //possible effects
_proto.TryIndex<ArtifactEffectPrototype>(state.EffectProto, out var effect) &&
effect.EffectHint != null)
{
message.AddMarkup(Loc.GetString("analysis-console-info-effect",
("effect", Loc.GetString(effect.EffectHint))) + "\n");
needSecondNewline = true;
}
if (needSecondNewline)
message.AddMarkup("\n");
if (state.Edges != null) //number of edges
message.AddMarkup(Loc.GetString("analysis-console-info-edges", ("edges", state.Edges))+"\n");
if (state.Completion != null) //completion percentage
{
message.AddMarkup(Loc.GetString("analysis-console-info-completion",
("percentage", Math.Round(state.Completion.Value * 100)))+"\n");
}
Information.SetMessage(message);
}
public void UpdateProgressBar(AnalysisConsoleScanUpdateState state)
{
ProgressBar.Visible = state.Scanning;
ProgressLabel.Visible = state.Scanning;
if (!state.Scanning)
return;
ProgressLabel.Text = Loc.GetString("analysis-console-progress-text",
("seconds", (int) state.TotalTime.TotalSeconds - (int) state.TimeRemaining.TotalSeconds));
ProgressBar.Value = (float) state.TimeRemaining.Divide(state.TotalTime);
}
}