Serialization v3 content PR (#3491)
* serv3 in shared pt 1 * beginning of deepclone api * progress in implementing ideepclone & serv3 in content * adds target * its cant hurt you it cant hurt you * more changes to content.server * adds dataclasses * almost there * renamed & edited entry * finishes refactoring content to use serv3 * gasmixture runtimes, next: reagentunit * fucin hell that was an annoying one * adds flags * fixes some yaml errors * removes comment * fixes generic components for now * removes todo actually clones values my god paul fixes bug involving resolving custom data classes from other proj renames dataclass fixes spritecomp adds WithFormat.Constants support * adds deepclone to ResistanceSet * adds a bunch of deepclone implementations adds a deepclone analyzer (TODO) adds a deep clone fallback for classes & structs * fixes a bunch of runtimes * adds deepclone to entityuid * adds generator to sln * gets rid of warnings * fixes * argh * componentdata refactors * more deepclone impl * heck me i reworked all of content deepclone * renames custom dataclasstarget * misc * reworks prototypes * deepclone nuke * renamed customdataclass attribute * fixes everything * misc fixed * the killcommit * getting there * changed yamlfieldattribute namespace * adds back iselfserialize * renames everything to data(field/definition) * ouch * Fix most errors on content * Fix more errors in content * Fix some components * work on tests * fixes some customdataclasses * fuggin shit * yes * yeas * Remove data classes * Data field naming fixes * arg * Git resetti RobustToolbox * Merge fixes * General fixes * Fix startup serialization errors * Fix DamageContainerPrototype when supported classes or types are null * Implement construction graph step type serializer * Fix up construction serialization * Fix up construction serialization part 2 * Fix null list in technology database component * Fix body serialization * Fix entity storage serialization * Fix actions serialization * Fix AI serialization * Fix reaction serialization * Fix body serialization * Fix grid atmosphere serialization * Rename IServ3Manager to ISerializationManager * Convert every non generic serializer to the new format, general fixes * Serialization and body system fix * pushinheritance fix * Update all prototypes to have a parent and have consistent id/parent properties * Merge fixes * smh my head * cuddling slaps * Content commit for engine PR * stuff * more fixes * argh * yes even you are fixed * changelog fixes * fixes seeds * argh * Test fixes * Add writing for alert order prototype * Fix alert order writing * FIX * its been alot ok * Fix the rest of the visualizers * Fix server alerts component tests * Fix alert prototype tests not using the read value * Fix alert prototype tests initializing serialization multiple times * THIS IS AN AMERICAN CODEBASE GOD BLESS THE USA * Add ImplicitDataDefinitionForInheritors to IMechanismBehavior Fixes the behaviors not being found * Fix NRE in strap component Good night to the 1 buckle optimization * Fix clothing component slot flags serialization tag * Fix body component in all components test * Merge fixes * ffs * Make construction graph prototype use serialization hooks * human yaml linted * a * Do the thing for construction * stuff * a * monke see yaml linter * LINT HARDER * Remove redundant todo * yes * Add skip hook argument to readers and copiers * we gamin * test/datafield fixes * adds more verbose validation * moves linter to action * Improve construction graph step type serializer error message * Fix ammo box component NRE * gamin * some updates to the linter * yes * removes that test * misc fixes * array fix priority fix misc fixes * adds proper info the validation * adds alwaysrelevant usa * Make yaml linter take half as long to run (~50% less) * Make yaml linter 5 times faster (~80% less execution time) * based vera being based * fixes mapsaving * warning cleanup & moves surpressor * removes old msbuild targets * Revert "Make yaml linter 5 times faster (~80% less execution time)" This reverts commit 3e6091359a26252c3e98828199553de668031c63. * Add -nowarn to yaml linter run configuration * Improve yaml linter message feedback * Make dependencies an argument instead of a property on the serialization manager * yamllinting slaps * Clean up type serializers * Move yaml linter code to its own method * Fix yaml errors * Change yaml linter action name and remove -nowarn * yaml linter please shut * Git resetti robust toolbox Co-authored-by: Paul <ritter.paul1+git@googlemail.com> Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
This commit is contained in:
28
.github/workflows/yaml-linter.yml
vendored
Normal file
28
.github/workflows/yaml-linter.yml
vendored
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
name: YAML Linter
|
||||||
|
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Setup submodule
|
||||||
|
run: |
|
||||||
|
git submodule update --init --recursive
|
||||||
|
touch BuildChecker/DISABLE_SUBMODULE_AUTOUPDATE
|
||||||
|
- name: Pull engine updates
|
||||||
|
uses: space-wizards/submodule-dependency@v0.1.5
|
||||||
|
- name: Update Engine Submodules
|
||||||
|
run: |
|
||||||
|
cd RobustToolbox/
|
||||||
|
git submodule update --init --recursive
|
||||||
|
- name: Setup .NET Core
|
||||||
|
uses: actions/setup-dotnet@v1
|
||||||
|
with:
|
||||||
|
dotnet-version: 5.0.100
|
||||||
|
- name: Install dependencies
|
||||||
|
run: dotnet restore
|
||||||
|
- name: Build
|
||||||
|
run: dotnet build --configuration Release --no-restore /nowarn /m
|
||||||
|
- name: Run Linter
|
||||||
|
run: dotnet run --project Content.YAMLLinter/Content.YAMLLinter.csproj --no-build
|
||||||
@@ -7,8 +7,10 @@ using System.Threading.Tasks;
|
|||||||
using Robust.Shared.ContentPack;
|
using Robust.Shared.ContentPack;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
using Robust.Shared.Serialization.Manager;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
using Robust.Shared.Serialization.Markdown;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using YamlDotNet.RepresentationModel;
|
|
||||||
|
|
||||||
#nullable enable
|
#nullable enable
|
||||||
|
|
||||||
@@ -20,6 +22,7 @@ namespace Content.Client.Changelog
|
|||||||
public const string ForkId = "Wizards";
|
public const string ForkId = "Wizards";
|
||||||
|
|
||||||
[Dependency] private readonly IResourceManager _resource = default!;
|
[Dependency] private readonly IResourceManager _resource = default!;
|
||||||
|
[Dependency] private readonly ISerializationManager _serialization = default!;
|
||||||
|
|
||||||
public bool NewChangelogEntries { get; private set; }
|
public bool NewChangelogEntries { get; private set; }
|
||||||
public int LastReadId { get; private set; }
|
public int LastReadId { get; private set; }
|
||||||
@@ -78,39 +81,41 @@ namespace Content.Client.Changelog
|
|||||||
if (yamlData.Documents.Count == 0)
|
if (yamlData.Documents.Count == 0)
|
||||||
return new List<ChangelogEntry>();
|
return new List<ChangelogEntry>();
|
||||||
|
|
||||||
var serializer = YamlObjectSerializer.NewReader((YamlMappingNode) yamlData.Documents[0].RootNode);
|
var node = (MappingDataNode)yamlData.Documents[0].RootNode.ToDataNode();
|
||||||
|
return _serialization.ReadValueOrThrow<List<ChangelogEntry>>(node["Entries"]);
|
||||||
return serializer.ReadDataField<List<ChangelogEntry>>("Entries");
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[DataDefinition]
|
||||||
public sealed class ChangelogEntry : IExposeData
|
public sealed class ChangelogEntry : ISerializationHooks
|
||||||
{
|
{
|
||||||
|
[DataField("id")]
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
public string Author { get; private set; } = "";
|
|
||||||
public DateTime Time { get; private set; }
|
|
||||||
public List<ChangelogChange> Changes { get; private set; } = default!;
|
|
||||||
|
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
[field: DataField("author")]
|
||||||
|
public string Author { get; } = "";
|
||||||
|
|
||||||
|
[DataField("time")] private string _time = default!;
|
||||||
|
|
||||||
|
public DateTime Time { get; private set; }
|
||||||
|
|
||||||
|
[field: DataField("changes")]
|
||||||
|
public List<ChangelogChange> Changes { get; } = default!;
|
||||||
|
|
||||||
|
void ISerializationHooks.AfterDeserialization()
|
||||||
{
|
{
|
||||||
Id = serializer.ReadDataField<int>("id");
|
Time = DateTime.Parse(_time, null, DateTimeStyles.RoundtripKind);
|
||||||
Author = serializer.ReadDataField<string>("author");
|
|
||||||
Time = DateTime.Parse(serializer.ReadDataField<string>("time"), null, DateTimeStyles.RoundtripKind);
|
|
||||||
Changes = serializer.ReadDataField<List<ChangelogChange>>("changes");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class ChangelogChange : IExposeData
|
[DataDefinition]
|
||||||
|
public sealed class ChangelogChange : ISerializationHooks
|
||||||
{
|
{
|
||||||
|
[DataField("type")]
|
||||||
public ChangelogLineType Type { get; private set; }
|
public ChangelogLineType Type { get; private set; }
|
||||||
public string Message { get; private set; } = "";
|
|
||||||
|
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
[DataField("message")]
|
||||||
{
|
public string Message { get; private set; } = "";
|
||||||
Type = serializer.ReadDataField<ChangelogLineType>("type");
|
|
||||||
Message = serializer.ReadDataField<string>("message");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ChangelogLineType
|
public enum ChangelogLineType
|
||||||
|
|||||||
@@ -36,4 +36,5 @@
|
|||||||
|
|
||||||
<Import Project="..\RobustToolbox\MSBuild\XamlIL.targets" />
|
<Import Project="..\RobustToolbox\MSBuild\XamlIL.targets" />
|
||||||
<Import Project="..\RobustToolbox\MSBuild\Robust.Analyzers.targets" />
|
<Import Project="..\RobustToolbox\MSBuild\Robust.Analyzers.targets" />
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
|
|
||||||
@@ -10,9 +11,13 @@ namespace Content.Client.GameObjects.Components.Atmos
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class FireVisualizer : AppearanceVisualizer
|
public class FireVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
|
[DataField("fireStackAlternateState")]
|
||||||
private int _fireStackAlternateState = 3;
|
private int _fireStackAlternateState = 3;
|
||||||
|
[DataField("normalState")]
|
||||||
private string _normalState;
|
private string _normalState;
|
||||||
|
[DataField("alternateState")]
|
||||||
private string _alternateState;
|
private string _alternateState;
|
||||||
|
[DataField("sprite")]
|
||||||
private string _sprite;
|
private string _sprite;
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
@@ -25,31 +30,6 @@ namespace Content.Client.GameObjects.Components.Atmos
|
|||||||
sprite.LayerSetVisible(FireVisualLayers.Fire, false);
|
sprite.LayerSetVisible(FireVisualLayers.Fire, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
|
||||||
{
|
|
||||||
base.LoadData(node);
|
|
||||||
|
|
||||||
if (node.TryGetNode("sprite", out var sprite))
|
|
||||||
{
|
|
||||||
_sprite = sprite.AsString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node.TryGetNode("fireStackAlternateState", out var fireStack))
|
|
||||||
{
|
|
||||||
_fireStackAlternateState = fireStack.AsInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node.TryGetNode("normalState", out var normalState))
|
|
||||||
{
|
|
||||||
_normalState = normalState.AsString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node.TryGetNode("alternateState", out var alternateState))
|
|
||||||
{
|
|
||||||
_alternateState = alternateState.AsString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Shared.GameObjects.Components.Atmos;
|
using Content.Shared.GameObjects.Components.Atmos;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
|
|
||||||
@@ -9,17 +10,11 @@ namespace Content.Client.GameObjects.Components.Atmos
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class GasAnalyzerVisualizer : AppearanceVisualizer
|
public class GasAnalyzerVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
|
[DataField("state_off")]
|
||||||
private string _stateOff;
|
private string _stateOff;
|
||||||
|
[DataField("state_working")]
|
||||||
private string _stateWorking;
|
private string _stateWorking;
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
|
||||||
{
|
|
||||||
base.LoadData(node);
|
|
||||||
|
|
||||||
_stateOff = node.GetNode("state_off").AsString();
|
|
||||||
_stateWorking = node.GetNode("state_working").AsString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Shared.GameObjects.Components.Atmos;
|
using Content.Shared.GameObjects.Components.Atmos;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
|
|
||||||
@@ -8,18 +9,11 @@ namespace Content.Client.GameObjects.Components.Atmos
|
|||||||
{
|
{
|
||||||
public class GasCanisterVisualizer : AppearanceVisualizer
|
public class GasCanisterVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
|
[DataField("stateConnected")]
|
||||||
private string _stateConnected;
|
private string _stateConnected;
|
||||||
|
[DataField("pressureStates")]
|
||||||
private string[] _statePressure = new string[] {"", "", "", ""};
|
private string[] _statePressure = new string[] {"", "", "", ""};
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
|
||||||
{
|
|
||||||
base.LoadData(node);
|
|
||||||
|
|
||||||
_stateConnected = node.GetNode("stateConnected").AsString();
|
|
||||||
for (int i = 0; i < _statePressure.Length; i++)
|
|
||||||
_statePressure[i] = node.GetNode("stateO" + i).AsString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|||||||
@@ -3,22 +3,15 @@ using Content.Shared.GameObjects.Components.Atmos;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using YamlDotNet.RepresentationModel;
|
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components.Atmos
|
namespace Content.Client.GameObjects.Components.Atmos.Piping
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
|
[DataDefinition]
|
||||||
public class GasFilterVisualizer : AppearanceVisualizer
|
public class GasFilterVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
private string _filterEnabledState = default!;
|
[DataField("filterEnabledState")] private string _filterEnabledState = "gasFilterOn";
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
|
||||||
{
|
|
||||||
base.LoadData(node);
|
|
||||||
var serializer = YamlObjectSerializer.NewReader(node);
|
|
||||||
serializer.DataField(ref _filterEnabledState, "filterEnabledState", "gasFilterOn");
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,26 +9,27 @@ using Robust.Shared.GameObjects;
|
|||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components.Atmos
|
namespace Content.Client.GameObjects.Components.Atmos.Piping
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class PipeConnectorVisualizer : AppearanceVisualizer
|
public class PipeConnectorVisualizer : AppearanceVisualizer, ISerializationHooks
|
||||||
{
|
{
|
||||||
private string _baseState = string.Empty;
|
[DataField("rsi")]
|
||||||
|
private string _rsi = "Constructible/Atmos/pipe.rsi";
|
||||||
|
|
||||||
|
[DataField("baseState")]
|
||||||
|
private string _baseState = "pipeConnector";
|
||||||
|
|
||||||
private RSI? _connectorRsi;
|
private RSI? _connectorRsi;
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
void ISerializationHooks.AfterDeserialization()
|
||||||
{
|
{
|
||||||
base.LoadData(node);
|
var rsiString = SharedSpriteComponent.TextureRoot / _rsi;
|
||||||
var serializer = YamlObjectSerializer.NewReader(node);
|
|
||||||
|
|
||||||
serializer.DataField(ref _baseState, "baseState", "pipeConnector");
|
|
||||||
|
|
||||||
var rsiString = SharedSpriteComponent.TextureRoot / serializer.ReadDataField("rsi", "Constructible/Atmos/pipe.rsi");
|
|
||||||
var resourceCache = IoCManager.Resolve<IResourceCache>();
|
var resourceCache = IoCManager.Resolve<IResourceCache>();
|
||||||
|
|
||||||
if (resourceCache.TryGetResource(rsiString, out RSIResource? rsi))
|
if (resourceCache.TryGetResource(rsiString, out RSIResource? rsi))
|
||||||
_connectorRsi = rsi.RSI;
|
_connectorRsi = rsi.RSI;
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
|
using System;
|
||||||
using Content.Shared.GameObjects.Components.Atmos;
|
using Content.Shared.GameObjects.Components.Atmos;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
@@ -8,29 +9,29 @@ using Robust.Shared.GameObjects;
|
|||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
using YamlDotNet.RepresentationModel;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components.Atmos
|
namespace Content.Client.GameObjects.Components.Atmos.Piping
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the state of the sprite based on what shape of pipe it is.
|
/// Sets the state of the sprite based on what shape of pipe it is.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class PipeVisualizer : AppearanceVisualizer
|
[DataDefinition]
|
||||||
|
public class PipeVisualizer : AppearanceVisualizer, ISerializationHooks
|
||||||
{
|
{
|
||||||
|
[DataField("rsi")] private string _rsiString = "Constructible/Atmos/pipe.rsi";
|
||||||
private RSI? _pipeRSI;
|
private RSI? _pipeRSI;
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
void ISerializationHooks.AfterDeserialization()
|
||||||
{
|
{
|
||||||
base.LoadData(node);
|
var rsiPath = SharedSpriteComponent.TextureRoot / _rsiString;
|
||||||
var serializer = YamlObjectSerializer.NewReader(node);
|
|
||||||
|
|
||||||
var rsiString = SharedSpriteComponent.TextureRoot / serializer.ReadDataField("rsi", "Constructible/Atmos/pipe.rsi");
|
|
||||||
var resourceCache = IoCManager.Resolve<IResourceCache>();
|
var resourceCache = IoCManager.Resolve<IResourceCache>();
|
||||||
if (resourceCache.TryGetResource(rsiString, out RSIResource? rsi))
|
|
||||||
|
if (resourceCache.TryGetResource(rsiPath, out RSIResource? rsi))
|
||||||
|
{
|
||||||
_pipeRSI = rsi.RSI;
|
_pipeRSI = rsi.RSI;
|
||||||
else
|
}
|
||||||
Logger.Error($"{nameof(PipeVisualizer)} could not load to load RSI {rsiString}.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
|
|||||||
@@ -2,23 +2,15 @@ using Content.Shared.GameObjects.Components.Atmos;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using YamlDotNet.RepresentationModel;
|
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components.Atmos
|
namespace Content.Client.GameObjects.Components.Atmos.Piping
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
|
[DataDefinition]
|
||||||
public class PumpVisualizer : AppearanceVisualizer
|
public class PumpVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
private string _pumpEnabledState;
|
[DataField("pumpEnabledState")] private string _pumpEnabledState = "pumpPressureOn";
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
|
||||||
{
|
|
||||||
base.LoadData(node);
|
|
||||||
|
|
||||||
var serializer = YamlObjectSerializer.NewReader(node);
|
|
||||||
serializer.DataField(ref _pumpEnabledState, "pumpEnabledState", "pumpPressureOn");
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,24 +1,16 @@
|
|||||||
|
using Content.Shared.GameObjects.Components.Atmos;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Content.Shared.GameObjects.Components.Atmos;
|
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using YamlDotNet.RepresentationModel;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Serialization;
|
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components.Atmos
|
namespace Content.Client.GameObjects.Components.Atmos.Piping
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
|
[DataDefinition]
|
||||||
public class SiphonVisualizer : AppearanceVisualizer
|
public class SiphonVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
private string _siphonOnState;
|
[DataField("siphonOnState")] private string _siphonOnState = "scrubOn";
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
|
||||||
{
|
|
||||||
base.LoadData(node);
|
|
||||||
|
|
||||||
var serializer = YamlObjectSerializer.NewReader(node);
|
|
||||||
serializer.DataField(ref _siphonOnState, "siphonOnState", "scrubOn");
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,24 +1,16 @@
|
|||||||
|
using Content.Shared.GameObjects.Components.Atmos;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Content.Shared.GameObjects.Components.Atmos;
|
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using YamlDotNet.RepresentationModel;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Serialization;
|
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components.Atmos
|
namespace Content.Client.GameObjects.Components.Atmos.Piping
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
|
[DataDefinition]
|
||||||
public class VentVisualizer : AppearanceVisualizer
|
public class VentVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
private string _ventOnstate;
|
[DataField("ventOnState")] private string _ventOnState = "ventOn";
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
|
||||||
{
|
|
||||||
base.LoadData(node);
|
|
||||||
|
|
||||||
var serializer = YamlObjectSerializer.NewReader(node);
|
|
||||||
serializer.DataField(ref _ventOnstate, "ventOnState", "ventOn");
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
{
|
{
|
||||||
@@ -28,7 +20,7 @@ namespace Content.Client.GameObjects.Components.Atmos
|
|||||||
|
|
||||||
sprite.LayerMapReserveBlank(Layer.VentEnabled);
|
sprite.LayerMapReserveBlank(Layer.VentEnabled);
|
||||||
var layer = sprite.LayerMapGet(Layer.VentEnabled);
|
var layer = sprite.LayerMapGet(Layer.VentEnabled);
|
||||||
sprite.LayerSetState(layer, _ventOnstate);
|
sprite.LayerSetState(layer, _ventOnState);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
|
|||||||
@@ -4,40 +4,32 @@ using JetBrains.Annotations;
|
|||||||
using Robust.Client.Animations;
|
using Robust.Client.Animations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Serialization;
|
||||||
using YamlDotNet.RepresentationModel;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components.Atmos
|
namespace Content.Client.GameObjects.Components.Atmos
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class VaporVisualizer : AppearanceVisualizer
|
public class VaporVisualizer : AppearanceVisualizer, ISerializationHooks
|
||||||
{
|
{
|
||||||
private const string AnimationKey = "flick_animation";
|
private const string AnimationKey = "flick_animation";
|
||||||
|
|
||||||
|
[DataField("animation_time")]
|
||||||
|
private float _delay = 0.25f;
|
||||||
|
|
||||||
|
[DataField("animation_state")]
|
||||||
|
private string _state = "chempuff";
|
||||||
|
|
||||||
private Animation VaporFlick;
|
private Animation VaporFlick;
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
void ISerializationHooks.AfterDeserialization()
|
||||||
{
|
{
|
||||||
base.LoadData(node);
|
VaporFlick = new Animation {Length = TimeSpan.FromSeconds(_delay)};
|
||||||
|
|
||||||
var delay = 0.25f;
|
|
||||||
var state = "chempuff";
|
|
||||||
|
|
||||||
if (node.TryGetNode("animation_time", out var delayNode))
|
|
||||||
{
|
|
||||||
delay = delayNode.AsFloat();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node.TryGetNode("animation_state", out var stateNode))
|
|
||||||
{
|
|
||||||
state = stateNode.AsString();
|
|
||||||
}
|
|
||||||
|
|
||||||
VaporFlick = new Animation {Length = TimeSpan.FromSeconds(delay)};
|
|
||||||
{
|
{
|
||||||
var flick = new AnimationTrackSpriteFlick();
|
var flick = new AnimationTrackSpriteFlick();
|
||||||
VaporFlick.AnimationTracks.Add(flick);
|
VaporFlick.AnimationTracks.Add(flick);
|
||||||
flick.LayerKey = VaporVisualLayers.Base;
|
flick.LayerKey = VaporVisualLayers.Base;
|
||||||
flick.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame(state, 0f));
|
flick.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame(_state, 0f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace Content.Client.GameObjects.Components.Cargo
|
|||||||
base.HandleComponentState(curState, nextState);
|
base.HandleComponentState(curState, nextState);
|
||||||
if (curState is not GalacticMarketState state)
|
if (curState is not GalacticMarketState state)
|
||||||
return;
|
return;
|
||||||
_products.Clear();
|
_productIds.Clear();
|
||||||
foreach (var productId in state.Products)
|
foreach (var productId in state.Products)
|
||||||
{
|
{
|
||||||
if (!_prototypeManager.TryIndex(productId, out CargoProductPrototype product))
|
if (!_prototypeManager.TryIndex(productId, out CargoProductPrototype product))
|
||||||
|
|||||||
@@ -5,38 +5,31 @@ using JetBrains.Annotations;
|
|||||||
using Robust.Client.Animations;
|
using Robust.Client.Animations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Serialization;
|
||||||
using YamlDotNet.RepresentationModel;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components.Chemistry
|
namespace Content.Client.GameObjects.Components.Chemistry
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class FoamVisualizer : AppearanceVisualizer
|
public class FoamVisualizer : AppearanceVisualizer, ISerializationHooks
|
||||||
{
|
{
|
||||||
private const string AnimationKey = "foamdissolve_animation";
|
private const string AnimationKey = "foamdissolve_animation";
|
||||||
|
|
||||||
|
[DataField("animationTime")]
|
||||||
|
private float _delay = 0.6f;
|
||||||
|
|
||||||
|
[DataField("animationState")]
|
||||||
|
private string _state = "foam-dissolve";
|
||||||
|
|
||||||
private Animation _foamDissolve = new();
|
private Animation _foamDissolve = new();
|
||||||
public override void LoadData(YamlMappingNode node)
|
|
||||||
|
void ISerializationHooks.AfterDeserialization()
|
||||||
{
|
{
|
||||||
base.LoadData(node);
|
_foamDissolve = new Animation {Length = TimeSpan.FromSeconds(_delay)};
|
||||||
|
|
||||||
var delay = 0.6f;
|
|
||||||
var state = "foam-dissolve";
|
|
||||||
|
|
||||||
if (node.TryGetNode("animationTime", out var delayNode))
|
|
||||||
{
|
|
||||||
delay = delayNode.AsFloat();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node.TryGetNode("animationState", out var stateNode))
|
|
||||||
{
|
|
||||||
state = stateNode.AsString();
|
|
||||||
}
|
|
||||||
|
|
||||||
_foamDissolve = new Animation {Length = TimeSpan.FromSeconds(delay)};
|
|
||||||
var flick = new AnimationTrackSpriteFlick();
|
var flick = new AnimationTrackSpriteFlick();
|
||||||
_foamDissolve.AnimationTracks.Add(flick);
|
_foamDissolve.AnimationTracks.Add(flick);
|
||||||
flick.LayerKey = FoamVisualLayers.Base;
|
flick.LayerKey = FoamVisualLayers.Base;
|
||||||
flick.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame(state, 0f));
|
flick.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame(_state, 0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ using Robust.Client.Utility;
|
|||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components
|
namespace Content.Client.GameObjects.Components
|
||||||
@@ -18,14 +18,7 @@ namespace Content.Client.GameObjects.Components
|
|||||||
|
|
||||||
[Dependency] private readonly IClickMapManager _clickMapManager = default!;
|
[Dependency] private readonly IClickMapManager _clickMapManager = default!;
|
||||||
|
|
||||||
[ViewVariables] private DirBoundData _data = default!;
|
[ViewVariables] [DataField("bounds")] private DirBoundData _data = DirBoundData.Default;
|
||||||
|
|
||||||
public override void ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
base.ExposeData(serializer);
|
|
||||||
|
|
||||||
serializer.DataField(ref _data, "bounds", DirBoundData.Default);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to check whether a click worked.
|
/// Used to check whether a click worked.
|
||||||
@@ -131,24 +124,16 @@ namespace Content.Client.GameObjects.Components
|
|||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
private sealed class DirBoundData : IExposeData
|
[DataDefinition]
|
||||||
|
public sealed class DirBoundData
|
||||||
{
|
{
|
||||||
[ViewVariables] public Box2 All;
|
[ViewVariables] [DataField("all")] public Box2 All;
|
||||||
[ViewVariables] public Box2 North;
|
[ViewVariables] [DataField("north")] public Box2 North;
|
||||||
[ViewVariables] public Box2 South;
|
[ViewVariables] [DataField("south")] public Box2 South;
|
||||||
[ViewVariables] public Box2 East;
|
[ViewVariables] [DataField("east")] public Box2 East;
|
||||||
[ViewVariables] public Box2 West;
|
[ViewVariables] [DataField("west")] public Box2 West;
|
||||||
|
|
||||||
public static DirBoundData Default { get; } = new();
|
public static DirBoundData Default { get; } = new();
|
||||||
|
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
serializer.DataField(ref All, "all", default);
|
|
||||||
serializer.DataField(ref North, "north", default);
|
|
||||||
serializer.DataField(ref South, "south", default);
|
|
||||||
serializer.DataField(ref East, "east", default);
|
|
||||||
serializer.DataField(ref West, "west", default);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.Serialization;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components
|
namespace Content.Client.GameObjects.Components
|
||||||
{
|
{
|
||||||
@@ -13,15 +13,9 @@ namespace Content.Client.GameObjects.Components
|
|||||||
{
|
{
|
||||||
public override string Name => "ClientEntitySpawner";
|
public override string Name => "ClientEntitySpawner";
|
||||||
|
|
||||||
private List<string> _prototypes = default!;
|
[DataField("prototypes")] private List<string> _prototypes = new() { "HVDummyWire" };
|
||||||
|
|
||||||
private List<IEntity> _entity = new();
|
private readonly List<IEntity> _entity = new();
|
||||||
|
|
||||||
public override void ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
base.ExposeData(serializer);
|
|
||||||
serializer.DataField(ref _prototypes, "prototypes", new List<string> { "HVDummyWire" });
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ using Content.Shared.GameObjects.Components.Items;
|
|||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Shared.Containers;
|
using Robust.Shared.Containers;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components.Clothing
|
namespace Content.Client.GameObjects.Components.Clothing
|
||||||
@@ -17,13 +17,15 @@ namespace Content.Client.GameObjects.Components.Clothing
|
|||||||
[ComponentReference(typeof(IItemComponent))]
|
[ComponentReference(typeof(IItemComponent))]
|
||||||
public class ClothingComponent : ItemComponent
|
public class ClothingComponent : ItemComponent
|
||||||
{
|
{
|
||||||
private FemaleClothingMask _femaleMask;
|
[DataField("femaleMask")]
|
||||||
|
private FemaleClothingMask _femaleMask = FemaleClothingMask.UniformFull;
|
||||||
public override string Name => "Clothing";
|
public override string Name => "Clothing";
|
||||||
public override uint? NetID => ContentNetIDs.CLOTHING;
|
public override uint? NetID => ContentNetIDs.CLOTHING;
|
||||||
|
|
||||||
private string? _clothingEquippedPrefix;
|
private string? _clothingEquippedPrefix;
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
[DataField("ClothingPrefix")]
|
||||||
public string? ClothingEquippedPrefix
|
public string? ClothingEquippedPrefix
|
||||||
{
|
{
|
||||||
get => _clothingEquippedPrefix;
|
get => _clothingEquippedPrefix;
|
||||||
@@ -34,6 +36,8 @@ namespace Content.Client.GameObjects.Components.Clothing
|
|||||||
|
|
||||||
_clothingEquippedPrefix = value;
|
_clothingEquippedPrefix = value;
|
||||||
|
|
||||||
|
if(!Initialized) return;
|
||||||
|
|
||||||
if (!Owner.TryGetContainer(out IContainer? container))
|
if (!Owner.TryGetContainer(out IContainer? container))
|
||||||
return;
|
return;
|
||||||
if (!container.Owner.TryGetComponent(out ClientInventoryComponent? inventory))
|
if (!container.Owner.TryGetComponent(out ClientInventoryComponent? inventory))
|
||||||
@@ -45,6 +49,12 @@ namespace Content.Client.GameObjects.Components.Clothing
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
base.Initialize();
|
||||||
|
ClothingEquippedPrefix = ClothingEquippedPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
public FemaleClothingMask FemaleMask
|
public FemaleClothingMask FemaleMask
|
||||||
{
|
{
|
||||||
@@ -52,14 +62,6 @@ namespace Content.Client.GameObjects.Components.Clothing
|
|||||||
set => _femaleMask = value;
|
set => _femaleMask = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
base.ExposeData(serializer);
|
|
||||||
|
|
||||||
serializer.DataField(ref _femaleMask, "femaleMask", FemaleClothingMask.UniformFull);
|
|
||||||
serializer.DataField(this, p => p.ClothingEquippedPrefix, "ClothingPrefix", null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public (RSI rsi, RSI.StateId stateId)? GetEquippedStateInfo(EquipmentSlotDefines.SlotFlags slot)
|
public (RSI rsi, RSI.StateId stateId)? GetEquippedStateInfo(EquipmentSlotDefines.SlotFlags slot)
|
||||||
{
|
{
|
||||||
if (RsiPath == null)
|
if (RsiPath == null)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Shared.GameObjects.Components;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
|
|
||||||
@@ -10,37 +11,16 @@ namespace Content.Client.GameObjects.Components
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class ComputerVisualizer : AppearanceVisualizer
|
public sealed class ComputerVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
|
[DataField("key")]
|
||||||
private string KeyboardState = "generic_key";
|
private string KeyboardState = "generic_key";
|
||||||
|
[DataField("screen")]
|
||||||
private string ScreenState = "generic";
|
private string ScreenState = "generic";
|
||||||
|
[DataField("body")]
|
||||||
private string BodyState = "computer";
|
private string BodyState = "computer";
|
||||||
|
[DataField("bodyBroken")]
|
||||||
private string BodyBrokenState = "broken";
|
private string BodyBrokenState = "broken";
|
||||||
private string ScreenBroken = "computer_broken";
|
private string ScreenBroken = "computer_broken";
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
|
||||||
{
|
|
||||||
base.LoadData(node);
|
|
||||||
|
|
||||||
if (node.TryGetNode("key", out var scalar))
|
|
||||||
{
|
|
||||||
KeyboardState = scalar.AsString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node.TryGetNode("screen", out scalar))
|
|
||||||
{
|
|
||||||
ScreenState = scalar.AsString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node.TryGetNode("body", out scalar))
|
|
||||||
{
|
|
||||||
BodyState = scalar.AsString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node.TryGetNode("bodyBroken", out scalar))
|
|
||||||
{
|
|
||||||
BodyBrokenState = scalar.AsString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Shared.GameObjects.Components.Conveyor;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
|
|
||||||
@@ -11,8 +12,11 @@ namespace Content.Client.GameObjects.Components.Conveyor
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class ConveyorVisualizer : AppearanceVisualizer
|
public class ConveyorVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
|
[DataField("state_running")]
|
||||||
private string _stateRunning;
|
private string _stateRunning;
|
||||||
|
[DataField("state_stopped")]
|
||||||
private string _stateStopped;
|
private string _stateStopped;
|
||||||
|
[DataField("state_reversed")]
|
||||||
private string _stateReversed;
|
private string _stateReversed;
|
||||||
|
|
||||||
private void ChangeState(AppearanceComponent appearance)
|
private void ChangeState(AppearanceComponent appearance)
|
||||||
@@ -35,15 +39,6 @@ namespace Content.Client.GameObjects.Components.Conveyor
|
|||||||
sprite.LayerSetState(0, texture);
|
sprite.LayerSetState(0, texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
|
||||||
{
|
|
||||||
base.LoadData(node);
|
|
||||||
|
|
||||||
_stateRunning = node.GetNode("state_running").AsString();
|
|
||||||
_stateStopped = node.GetNode("state_stopped").AsString();
|
|
||||||
_stateReversed = node.GetNode("state_reversed").AsString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
|
|
||||||
@@ -10,8 +11,11 @@ namespace Content.Client.GameObjects.Components.Conveyor
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class TwoWayLeverVisualizer : AppearanceVisualizer
|
public class TwoWayLeverVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
|
[DataField("state_forward")]
|
||||||
private string _stateForward;
|
private string _stateForward;
|
||||||
|
[DataField("state_off")]
|
||||||
private string _stateOff;
|
private string _stateOff;
|
||||||
|
[DataField("state_reversed")]
|
||||||
private string _stateReversed;
|
private string _stateReversed;
|
||||||
|
|
||||||
private void ChangeState(AppearanceComponent appearance)
|
private void ChangeState(AppearanceComponent appearance)
|
||||||
@@ -34,15 +38,6 @@ namespace Content.Client.GameObjects.Components.Conveyor
|
|||||||
sprite.LayerSetState(0, texture);
|
sprite.LayerSetState(0, texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
|
||||||
{
|
|
||||||
base.LoadData(node);
|
|
||||||
|
|
||||||
_stateForward = node.GetNode("state_forward").AsString();
|
|
||||||
_stateOff = node.GetNode("state_off").AsString();
|
|
||||||
_stateReversed = node.GetNode("state_reversed").AsString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Robust.Client.UserInterface;
|
|||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
|
|||||||
@@ -3,28 +3,63 @@ using JetBrains.Annotations;
|
|||||||
using Robust.Client.Animations;
|
using Robust.Client.Animations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Serialization;
|
||||||
using YamlDotNet.RepresentationModel;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using static Content.Shared.GameObjects.Components.Disposal.SharedDisposalUnitComponent;
|
using static Content.Shared.GameObjects.Components.Disposal.SharedDisposalUnitComponent;
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components.Disposal
|
namespace Content.Client.GameObjects.Components.Disposal
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class DisposalUnitVisualizer : AppearanceVisualizer
|
public class DisposalUnitVisualizer : AppearanceVisualizer, ISerializationHooks
|
||||||
{
|
{
|
||||||
private const string AnimationKey = "disposal_unit_animation";
|
private const string AnimationKey = "disposal_unit_animation";
|
||||||
|
|
||||||
|
[DataField("state_anchored", required: true)]
|
||||||
private string _stateAnchored;
|
private string _stateAnchored;
|
||||||
|
|
||||||
|
[DataField("state_unanchored", required: true)]
|
||||||
private string _stateUnAnchored;
|
private string _stateUnAnchored;
|
||||||
|
|
||||||
|
[DataField("state_charging", required: true)]
|
||||||
private string _stateCharging;
|
private string _stateCharging;
|
||||||
|
|
||||||
|
[DataField("overlay_charging", required: true)]
|
||||||
private string _overlayCharging;
|
private string _overlayCharging;
|
||||||
|
|
||||||
|
[DataField("overlay_ready", required: true)]
|
||||||
private string _overlayReady;
|
private string _overlayReady;
|
||||||
|
|
||||||
|
[DataField("overlay_full", required: true)]
|
||||||
private string _overlayFull;
|
private string _overlayFull;
|
||||||
|
|
||||||
|
[DataField("overlay_engaged", required: true)]
|
||||||
private string _overlayEngaged;
|
private string _overlayEngaged;
|
||||||
|
|
||||||
|
[DataField("state_flush", required: true)]
|
||||||
private string _stateFlush;
|
private string _stateFlush;
|
||||||
|
|
||||||
|
[DataField("flush_sound", required: true)]
|
||||||
|
private string _flushSound;
|
||||||
|
|
||||||
|
[DataField("flush_time", required: true)]
|
||||||
|
private float _flushTime;
|
||||||
|
|
||||||
private Animation _flushAnimation;
|
private Animation _flushAnimation;
|
||||||
|
|
||||||
|
void ISerializationHooks.AfterDeserialization()
|
||||||
|
{
|
||||||
|
_flushAnimation = new Animation {Length = TimeSpan.FromSeconds(_flushTime)};
|
||||||
|
|
||||||
|
var flick = new AnimationTrackSpriteFlick();
|
||||||
|
_flushAnimation.AnimationTracks.Add(flick);
|
||||||
|
flick.LayerKey = DisposalUnitVisualLayers.Base;
|
||||||
|
flick.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame(_stateFlush, 0));
|
||||||
|
|
||||||
|
var sound = new AnimationTrackPlaySound();
|
||||||
|
_flushAnimation.AnimationTracks.Add(sound);
|
||||||
|
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(_flushSound, 0));
|
||||||
|
}
|
||||||
|
|
||||||
private void ChangeState(AppearanceComponent appearance)
|
private void ChangeState(AppearanceComponent appearance)
|
||||||
{
|
{
|
||||||
if (!appearance.TryGetData(Visuals.VisualState, out VisualState state))
|
if (!appearance.TryGetData(Visuals.VisualState, out VisualState state))
|
||||||
@@ -106,34 +141,6 @@ namespace Content.Client.GameObjects.Components.Disposal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
|
||||||
{
|
|
||||||
base.LoadData(node);
|
|
||||||
|
|
||||||
_stateAnchored = node.GetNode("state_anchored").AsString();
|
|
||||||
_stateUnAnchored = node.GetNode("state_unanchored").AsString();
|
|
||||||
_stateCharging = node.GetNode("state_charging").AsString();
|
|
||||||
_overlayCharging = node.GetNode("overlay_charging").AsString();
|
|
||||||
_overlayReady = node.GetNode("overlay_ready").AsString();
|
|
||||||
_overlayFull = node.GetNode("overlay_full").AsString();
|
|
||||||
_overlayEngaged = node.GetNode("overlay_engaged").AsString();
|
|
||||||
_stateFlush = node.GetNode("state_flush").AsString();
|
|
||||||
|
|
||||||
var flushSound = node.GetNode("flush_sound").AsString();
|
|
||||||
var flushTime = node.GetNode("flush_time").AsFloat();
|
|
||||||
|
|
||||||
_flushAnimation = new Animation {Length = TimeSpan.FromSeconds(flushTime)};
|
|
||||||
|
|
||||||
var flick = new AnimationTrackSpriteFlick();
|
|
||||||
_flushAnimation.AnimationTracks.Add(flick);
|
|
||||||
flick.LayerKey = DisposalUnitVisualLayers.Base;
|
|
||||||
flick.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame(_stateFlush, 0));
|
|
||||||
|
|
||||||
var sound = new AnimationTrackPlaySound();
|
|
||||||
_flushAnimation.AnimationTracks.Add(sound);
|
|
||||||
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(flushSound, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Shared.GameObjects.Components.Disposal;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
|
|
||||||
@@ -11,8 +12,11 @@ namespace Content.Client.GameObjects.Components.Disposal
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class DisposalVisualizer : AppearanceVisualizer
|
public class DisposalVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
|
[DataField("state_free")]
|
||||||
private string _stateFree;
|
private string _stateFree;
|
||||||
|
[DataField("state_anchored")]
|
||||||
private string _stateAnchored;
|
private string _stateAnchored;
|
||||||
|
[DataField("state_broken")]
|
||||||
private string _stateBroken;
|
private string _stateBroken;
|
||||||
|
|
||||||
private void ChangeState(AppearanceComponent appearance)
|
private void ChangeState(AppearanceComponent appearance)
|
||||||
@@ -47,15 +51,6 @@ namespace Content.Client.GameObjects.Components.Disposal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
|
||||||
{
|
|
||||||
base.LoadData(node);
|
|
||||||
|
|
||||||
_stateFree = node.GetNode("state_free").AsString();
|
|
||||||
_stateAnchored = node.GetNode("state_anchored").AsString();
|
|
||||||
_stateBroken = node.GetNode("state_broken").AsString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|||||||
@@ -7,35 +7,35 @@ using JetBrains.Annotations;
|
|||||||
using Robust.Client.Animations;
|
using Robust.Client.Animations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Serialization;
|
||||||
using YamlDotNet.RepresentationModel;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components.Doors
|
namespace Content.Client.GameObjects.Components.Doors
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class AirlockVisualizer : AppearanceVisualizer
|
public class AirlockVisualizer : AppearanceVisualizer, ISerializationHooks
|
||||||
{
|
{
|
||||||
private const string AnimationKey = "airlock_animation";
|
private const string AnimationKey = "airlock_animation";
|
||||||
|
|
||||||
|
[DataField("open_sound", required: true)]
|
||||||
|
private string _openSound = default!;
|
||||||
|
|
||||||
|
[DataField("close_sound", required: true)]
|
||||||
|
private string _closeSound = default!;
|
||||||
|
|
||||||
|
[DataField("deny_sound", required: true)]
|
||||||
|
private string _denySound = default!;
|
||||||
|
|
||||||
|
[DataField("animation_time")]
|
||||||
|
private float _delay = 0.8f;
|
||||||
|
|
||||||
private Animation CloseAnimation = default!;
|
private Animation CloseAnimation = default!;
|
||||||
private Animation OpenAnimation = default!;
|
private Animation OpenAnimation = default!;
|
||||||
private Animation DenyAnimation = default!;
|
private Animation DenyAnimation = default!;
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
void ISerializationHooks.AfterDeserialization()
|
||||||
{
|
{
|
||||||
base.LoadData(node);
|
CloseAnimation = new Animation {Length = TimeSpan.FromSeconds(_delay)};
|
||||||
|
|
||||||
var delay = 0.8f;
|
|
||||||
|
|
||||||
var openSound = node.GetNode("open_sound").AsString();
|
|
||||||
var closeSound = node.GetNode("close_sound").AsString();
|
|
||||||
var denySound = node.GetNode("deny_sound").AsString();
|
|
||||||
if (node.TryGetNode("animation_time", out var yamlNode))
|
|
||||||
{
|
|
||||||
delay = yamlNode.AsFloat();
|
|
||||||
}
|
|
||||||
|
|
||||||
CloseAnimation = new Animation {Length = TimeSpan.FromSeconds(delay)};
|
|
||||||
{
|
{
|
||||||
var flick = new AnimationTrackSpriteFlick();
|
var flick = new AnimationTrackSpriteFlick();
|
||||||
CloseAnimation.AnimationTracks.Add(flick);
|
CloseAnimation.AnimationTracks.Add(flick);
|
||||||
@@ -54,10 +54,10 @@ namespace Content.Client.GameObjects.Components.Doors
|
|||||||
|
|
||||||
var sound = new AnimationTrackPlaySound();
|
var sound = new AnimationTrackPlaySound();
|
||||||
CloseAnimation.AnimationTracks.Add(sound);
|
CloseAnimation.AnimationTracks.Add(sound);
|
||||||
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(closeSound, 0));
|
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(_closeSound, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenAnimation = new Animation {Length = TimeSpan.FromSeconds(delay)};
|
OpenAnimation = new Animation {Length = TimeSpan.FromSeconds(_delay)};
|
||||||
{
|
{
|
||||||
var flick = new AnimationTrackSpriteFlick();
|
var flick = new AnimationTrackSpriteFlick();
|
||||||
OpenAnimation.AnimationTracks.Add(flick);
|
OpenAnimation.AnimationTracks.Add(flick);
|
||||||
@@ -76,7 +76,7 @@ namespace Content.Client.GameObjects.Components.Doors
|
|||||||
|
|
||||||
var sound = new AnimationTrackPlaySound();
|
var sound = new AnimationTrackPlaySound();
|
||||||
OpenAnimation.AnimationTracks.Add(sound);
|
OpenAnimation.AnimationTracks.Add(sound);
|
||||||
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(openSound, 0));
|
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(_openSound, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
DenyAnimation = new Animation {Length = TimeSpan.FromSeconds(0.3f)};
|
DenyAnimation = new Animation {Length = TimeSpan.FromSeconds(0.3f)};
|
||||||
@@ -88,7 +88,7 @@ namespace Content.Client.GameObjects.Components.Doors
|
|||||||
|
|
||||||
var sound = new AnimationTrackPlaySound();
|
var sound = new AnimationTrackPlaySound();
|
||||||
DenyAnimation.AnimationTracks.Add(sound);
|
DenyAnimation.AnimationTracks.Add(sound);
|
||||||
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(denySound, 0, () => AudioHelpers.WithVariation(0.05f)));
|
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(_denySound, 0, () => AudioHelpers.WithVariation(0.05f)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Shared.GameObjects.Components.Explosion;
|
using Content.Shared.GameObjects.Components.Explosion;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
|
|
||||||
@@ -10,17 +11,9 @@ namespace Content.Client.GameObjects.Components.Explosion
|
|||||||
// ReSharper disable once InconsistentNaming
|
// ReSharper disable once InconsistentNaming
|
||||||
public class ClusterFlashVisualizer : AppearanceVisualizer
|
public class ClusterFlashVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
|
[DataField("state")]
|
||||||
private string _state;
|
private string _state;
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
|
||||||
{
|
|
||||||
base.LoadData(node);
|
|
||||||
if (node.TryGetNode("state", out var state))
|
|
||||||
{
|
|
||||||
_state = state.AsString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Shared.GameObjects.Components.Fluids;
|
using Content.Shared.GameObjects.Components.Fluids;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
|
|
||||||
@@ -9,24 +10,11 @@ namespace Content.Client.GameObjects.Components.Fluids
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class SprayVisualizer : AppearanceVisualizer
|
public class SprayVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
|
[DataField("safety_on_state")]
|
||||||
private string _safetyOnState;
|
private string _safetyOnState;
|
||||||
|
[DataField("safety_off_state")]
|
||||||
private string _safetyOffState;
|
private string _safetyOffState;
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
|
||||||
{
|
|
||||||
base.LoadData(node);
|
|
||||||
|
|
||||||
if (node.TryGetNode("safety_on_state", out var safetyOn))
|
|
||||||
{
|
|
||||||
_safetyOnState = safetyOn.AsString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node.TryGetNode("safety_off_state", out var safetyOff))
|
|
||||||
{
|
|
||||||
_safetyOffState = safetyOff.AsString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|||||||
@@ -6,14 +6,39 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Serialization;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components.Gravity
|
namespace Content.Client.GameObjects.Components.Gravity
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class GravityGeneratorVisualizer : AppearanceVisualizer
|
public class GravityGeneratorVisualizer : AppearanceVisualizer, ISerializationHooks
|
||||||
{
|
{
|
||||||
private readonly Dictionary<GravityGeneratorStatus, string> _spriteMap = new();
|
[DataField("spritemap")]
|
||||||
|
private Dictionary<string, string> _rawSpriteMap = new();
|
||||||
|
private Dictionary<GravityGeneratorStatus, string> _spriteMap = new();
|
||||||
|
|
||||||
|
void ISerializationHooks.BeforeSerialization()
|
||||||
|
{
|
||||||
|
_rawSpriteMap = new Dictionary<string, string>();
|
||||||
|
foreach (var (status, sprite) in _spriteMap)
|
||||||
|
{
|
||||||
|
_rawSpriteMap.Add(status.ToString().ToLower(), sprite);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ISerializationHooks.AfterDeserialization()
|
||||||
|
{
|
||||||
|
// Get Sprites for each status
|
||||||
|
foreach (var status in (GravityGeneratorStatus[]) Enum.GetValues(typeof(GravityGeneratorStatus)))
|
||||||
|
{
|
||||||
|
if (_rawSpriteMap.TryGetValue(status.ToString().ToLower(), out var sprite))
|
||||||
|
{
|
||||||
|
_spriteMap[status] = sprite;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
{
|
{
|
||||||
@@ -26,20 +51,6 @@ namespace Content.Client.GameObjects.Components.Gravity
|
|||||||
sprite.LayerMapReserveBlank(GravityGeneratorVisualLayers.Core);
|
sprite.LayerMapReserveBlank(GravityGeneratorVisualLayers.Core);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
|
||||||
{
|
|
||||||
base.LoadData(node);
|
|
||||||
|
|
||||||
// Get Sprites for each status
|
|
||||||
foreach (var status in (GravityGeneratorStatus[]) Enum.GetValues(typeof(GravityGeneratorStatus)))
|
|
||||||
{
|
|
||||||
if (node.TryGetNode(status.ToString().ToLower(), out var sprite))
|
|
||||||
{
|
|
||||||
_spriteMap[status] = sprite.AsString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
|
|||||||
|
|
||||||
[ViewVariables] public InventoryInterfaceController InterfaceController { get; private set; } = default!;
|
[ViewVariables] public InventoryInterfaceController InterfaceController { get; private set; } = default!;
|
||||||
|
|
||||||
|
[ComponentDependency]
|
||||||
private ISpriteComponent? _sprite;
|
private ISpriteComponent? _sprite;
|
||||||
|
|
||||||
private bool _playerAttached = false;
|
private bool _playerAttached = false;
|
||||||
@@ -52,7 +53,7 @@ namespace Content.Client.GameObjects.Components.HUD.Inventory
|
|||||||
InterfaceController = DynamicTypeFactory.CreateInstance<InventoryInterfaceController>(controllerType, args);
|
InterfaceController = DynamicTypeFactory.CreateInstance<InventoryInterfaceController>(controllerType, args);
|
||||||
InterfaceController.Initialize();
|
InterfaceController.Initialize();
|
||||||
|
|
||||||
if (Owner.TryGetComponent(out _sprite))
|
if (_sprite != null)
|
||||||
{
|
{
|
||||||
foreach (var mask in InventoryInstance.SlotMasks.OrderBy(s => InventoryInstance.SlotDrawingOrder(s)))
|
foreach (var mask in InventoryInstance.SlotMasks.OrderBy(s => InventoryInstance.SlotDrawingOrder(s)))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ using Robust.Client.GameObjects;
|
|||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using static Robust.Client.GameObjects.SpriteComponent;
|
using static Robust.Client.GameObjects.SpriteComponent;
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components.IconSmoothing
|
namespace Content.Client.GameObjects.Components.IconSmoothing
|
||||||
@@ -25,9 +27,12 @@ namespace Content.Client.GameObjects.Components.IconSmoothing
|
|||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class IconSmoothComponent : Component
|
public class IconSmoothComponent : Component
|
||||||
{
|
{
|
||||||
private string _smoothKey;
|
[DataField("key")]
|
||||||
private string _stateBase;
|
private string _smoothKey = default;
|
||||||
private IconSmoothingMode _mode;
|
[DataField("base")]
|
||||||
|
private string _stateBase = "";
|
||||||
|
[DataField("mode")]
|
||||||
|
private IconSmoothingMode _mode = IconSmoothingMode.Corners;
|
||||||
|
|
||||||
public override string Name => "IconSmooth";
|
public override string Name => "IconSmooth";
|
||||||
|
|
||||||
@@ -63,15 +68,6 @@ namespace Content.Client.GameObjects.Components.IconSmoothing
|
|||||||
Sprite = Owner.GetComponent<ISpriteComponent>();
|
Sprite = Owner.GetComponent<ISpriteComponent>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
base.ExposeData(serializer);
|
|
||||||
|
|
||||||
serializer.DataFieldCached(ref _stateBase, "base", "");
|
|
||||||
serializer.DataFieldCached(ref _smoothKey, "key", null);
|
|
||||||
serializer.DataFieldCached(ref _mode, "mode", IconSmoothingMode.Corners);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void Startup()
|
protected override void Startup()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ using Robust.Shared.GameObjects;
|
|||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Network;
|
using Robust.Shared.Network;
|
||||||
using Robust.Shared.Players;
|
using Robust.Shared.Players;
|
||||||
using Robust.Shared.Serialization;
|
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components.Instruments
|
namespace Content.Client.GameObjects.Components.Instruments
|
||||||
@@ -35,19 +35,24 @@ namespace Content.Client.GameObjects.Components.Instruments
|
|||||||
|
|
||||||
private InstrumentSystem _instrumentSystem = default!;
|
private InstrumentSystem _instrumentSystem = default!;
|
||||||
|
|
||||||
|
[DataField("program")]
|
||||||
private byte _instrumentProgram = 1;
|
private byte _instrumentProgram = 1;
|
||||||
|
|
||||||
|
[DataField("bank")]
|
||||||
private byte _instrumentBank;
|
private byte _instrumentBank;
|
||||||
|
|
||||||
private uint _sequenceDelay;
|
private uint _sequenceDelay;
|
||||||
|
|
||||||
private uint _sequenceStartTick;
|
private uint _sequenceStartTick;
|
||||||
|
|
||||||
|
[DataField("allowPercussion")]
|
||||||
private bool _allowPercussion;
|
private bool _allowPercussion;
|
||||||
|
|
||||||
|
[DataField("allowProgramChange")]
|
||||||
private bool _allowProgramChange;
|
private bool _allowProgramChange;
|
||||||
|
|
||||||
private bool _respectMidiLimits;
|
[DataField("respectMidiLimits")]
|
||||||
|
private bool _respectMidiLimits = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A queue of MidiEvents to be sent to the server.
|
/// A queue of MidiEvents to be sent to the server.
|
||||||
@@ -137,6 +142,7 @@ namespace Content.Client.GameObjects.Components.Instruments
|
|||||||
/// Whether this instrument is handheld or not.
|
/// Whether this instrument is handheld or not.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
|
[DataField("handheld")]
|
||||||
public bool Handheld { get; set; } // TODO: Replace this by simply checking if the entity has an ItemComponent.
|
public bool Handheld { get; set; } // TODO: Replace this by simply checking if the entity has an ItemComponent.
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -263,17 +269,6 @@ namespace Content.Client.GameObjects.Components.Instruments
|
|||||||
EndRenderer();
|
EndRenderer();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
base.ExposeData(serializer);
|
|
||||||
serializer.DataField(this, x => x.Handheld, "handheld", false);
|
|
||||||
serializer.DataField(ref _instrumentProgram, "program", (byte) 1);
|
|
||||||
serializer.DataField(ref _instrumentBank, "bank", (byte) 0);
|
|
||||||
serializer.DataField(ref _allowPercussion, "allowPercussion", false);
|
|
||||||
serializer.DataField(ref _allowProgramChange, "allowProgramChange", false);
|
|
||||||
serializer.DataField(ref _respectMidiLimits, "respectMidiLimits", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void HandleNetworkMessage(ComponentMessage message, INetChannel channel, ICommonSession? session = null)
|
public override void HandleNetworkMessage(ComponentMessage message, INetChannel channel, ICommonSession? session = null)
|
||||||
{
|
{
|
||||||
base.HandleNetworkMessage(message, channel, session);
|
base.HandleNetworkMessage(message, channel, session);
|
||||||
|
|||||||
@@ -5,7 +5,9 @@ using Content.Shared.GameObjects.Components.Interactable;
|
|||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Timing;
|
using Robust.Shared.Timing;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
@@ -15,7 +17,8 @@ namespace Content.Client.GameObjects.Components.Interactable
|
|||||||
public class MultiToolComponent : Component, IItemStatus
|
public class MultiToolComponent : Component, IItemStatus
|
||||||
{
|
{
|
||||||
private ToolQuality _behavior;
|
private ToolQuality _behavior;
|
||||||
private bool _statusShowBehavior;
|
[DataField("statusShowBehavior")]
|
||||||
|
private bool _statusShowBehavior = true;
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)] private bool _uiUpdateNeeded;
|
[ViewVariables(VVAccess.ReadWrite)] private bool _uiUpdateNeeded;
|
||||||
[ViewVariables] public bool StatusShowBehavior => _statusShowBehavior;
|
[ViewVariables] public bool StatusShowBehavior => _statusShowBehavior;
|
||||||
@@ -24,12 +27,6 @@ namespace Content.Client.GameObjects.Components.Interactable
|
|||||||
public override string Name => "MultiTool";
|
public override string Name => "MultiTool";
|
||||||
public override uint? NetID => ContentNetIDs.MULTITOOLS;
|
public override uint? NetID => ContentNetIDs.MULTITOOLS;
|
||||||
|
|
||||||
public override void ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
base.ExposeData(serializer);
|
|
||||||
serializer.DataField(ref _statusShowBehavior, "statusShowBehavior", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||||
{
|
{
|
||||||
base.HandleComponentState(curState, nextState);
|
base.HandleComponentState(curState, nextState);
|
||||||
|
|||||||
@@ -26,10 +26,6 @@ namespace Content.Client.GameObjects.Components.Interactable
|
|||||||
[ViewVariables] public bool Activated { get; private set; }
|
[ViewVariables] public bool Activated { get; private set; }
|
||||||
[ViewVariables] public override ToolQuality Qualities => _behavior;
|
[ViewVariables] public override ToolQuality Qualities => _behavior;
|
||||||
|
|
||||||
public override void ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||||
{
|
{
|
||||||
base.HandleComponentState(curState, nextState);
|
base.HandleComponentState(curState, nextState);
|
||||||
|
|||||||
@@ -8,7 +8,9 @@ using Robust.Shared.Containers;
|
|||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
@@ -23,10 +25,15 @@ namespace Content.Client.GameObjects.Components.Items
|
|||||||
public override string Name => "Item";
|
public override string Name => "Item";
|
||||||
public override uint? NetID => ContentNetIDs.ITEM;
|
public override uint? NetID => ContentNetIDs.ITEM;
|
||||||
|
|
||||||
[ViewVariables] protected ResourcePath RsiPath;
|
[ViewVariables]
|
||||||
|
[DataField("sprite")]
|
||||||
|
protected ResourcePath RsiPath;
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)] protected Color Color;
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
|
[DataField("color")]
|
||||||
|
protected Color Color = Color.White;
|
||||||
|
|
||||||
|
[DataField("HeldPrefix")]
|
||||||
private string _equippedPrefix;
|
private string _equippedPrefix;
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
@@ -60,15 +67,6 @@ namespace Content.Client.GameObjects.Components.Items
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
base.ExposeData(serializer);
|
|
||||||
|
|
||||||
serializer.DataFieldCached(ref Color, "color", Color.White);
|
|
||||||
serializer.DataFieldCached(ref RsiPath, "sprite", null);
|
|
||||||
serializer.DataFieldCached(ref _equippedPrefix, "HeldPrefix", null);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected RSI GetRSI()
|
protected RSI GetRSI()
|
||||||
{
|
{
|
||||||
return _resourceCache.GetResource<RSIResource>(SharedSpriteComponent.TextureRoot / RsiPath).RSI;
|
return _resourceCache.GetResource<RSIResource>(SharedSpriteComponent.TextureRoot / RsiPath).RSI;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using Content.Shared.GameObjects.Components.Kitchen;
|
|
||||||
using Content.Shared.Interfaces.GameObjects.Components;
|
using Content.Shared.Interfaces.GameObjects.Components;
|
||||||
|
using Content.Shared.Kitchen;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components.Kitchen
|
namespace Content.Client.GameObjects.Components.Kitchen
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ using Robust.Shared.Log;
|
|||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components
|
namespace Content.Client.GameObjects.Components
|
||||||
@@ -22,37 +23,43 @@ namespace Content.Client.GameObjects.Components
|
|||||||
/// This AnimationTrack derivative does not rely on keyframes since it often needs to have a randomized duration.
|
/// This AnimationTrack derivative does not rely on keyframes since it often needs to have a randomized duration.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public abstract class LightBehaviourAnimationTrack : AnimationTrackProperty, IExposeData
|
[ImplicitDataDefinitionForInheritors]
|
||||||
|
public abstract class LightBehaviourAnimationTrack : AnimationTrackProperty
|
||||||
{
|
{
|
||||||
[ViewVariables] public string ID { get; set; }
|
[DataField("id")] [ViewVariables] public string ID { get; set; } = string.Empty;
|
||||||
[ViewVariables] public string Property { get; protected set; }
|
|
||||||
[ViewVariables] public bool IsLooped { get; set; }
|
[DataField("property")]
|
||||||
[ViewVariables] public bool Enabled { get; set; }
|
[ViewVariables]
|
||||||
[ViewVariables] public float StartValue { get; set; }
|
public virtual string Property { get; protected set; } = "Radius";
|
||||||
[ViewVariables] public float EndValue { get; set; }
|
|
||||||
[ViewVariables] public float MinDuration { get; set; }
|
[DataField("isLooped")] [ViewVariables] public bool IsLooped { get; set; }
|
||||||
[ViewVariables] public float MaxDuration { get; set; }
|
|
||||||
[ViewVariables] public AnimationInterpolationMode InterpolateMode { get; set; }
|
[DataField("enabled")] [ViewVariables] public bool Enabled { get; set; }
|
||||||
|
|
||||||
|
[DataField("startValue")] [ViewVariables] public float StartValue { get; set; }
|
||||||
|
|
||||||
|
[DataField("endValue")]
|
||||||
|
[ViewVariables]
|
||||||
|
public float EndValue { get; set; } = 2f;
|
||||||
|
|
||||||
|
[DataField("minDuration")]
|
||||||
|
[ViewVariables]
|
||||||
|
public float MinDuration { get; set; } = -1f;
|
||||||
|
|
||||||
|
[DataField("maxDuration")]
|
||||||
|
[ViewVariables]
|
||||||
|
public float MaxDuration { get; set; } = 2f;
|
||||||
|
|
||||||
|
[DataField("interpolate")]
|
||||||
|
[ViewVariables]
|
||||||
|
public AnimationInterpolationMode InterpolateMode { get; set; } = AnimationInterpolationMode.Linear;
|
||||||
|
|
||||||
[ViewVariables] protected float MaxTime { get; set; }
|
[ViewVariables] protected float MaxTime { get; set; }
|
||||||
protected PointLightComponent Light = default;
|
protected PointLightComponent Light;
|
||||||
protected IRobustRandom RobustRandom = default;
|
protected IRobustRandom RobustRandom;
|
||||||
|
|
||||||
private float _maxTime = default;
|
private float _maxTime = default;
|
||||||
|
|
||||||
public virtual void ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
serializer.DataField(this, x => x.ID, "id", string.Empty);
|
|
||||||
serializer.DataField(this, x => x.IsLooped, "isLooped", false);
|
|
||||||
serializer.DataField(this, x => x.Enabled, "enabled", false);
|
|
||||||
serializer.DataField(this, x => x.StartValue, "startValue", 0f);
|
|
||||||
serializer.DataField(this, x => x.EndValue, "endValue", 2f);
|
|
||||||
serializer.DataField(this, x => x.MinDuration, "minDuration", -1f);
|
|
||||||
serializer.DataField(this, x => x.MaxDuration, "maxDuration", 2f);
|
|
||||||
serializer.DataField(this, x => x.Property, "property", "Radius");
|
|
||||||
serializer.DataField(this, x => x.InterpolateMode, "interpolate", AnimationInterpolationMode.Linear);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Initialize(PointLightComponent light)
|
public void Initialize(PointLightComponent light)
|
||||||
{
|
{
|
||||||
Light = light;
|
Light = light;
|
||||||
@@ -212,10 +219,10 @@ namespace Content.Client.GameObjects.Components
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class RandomizeBehaviour : LightBehaviourAnimationTrack
|
public class RandomizeBehaviour : LightBehaviourAnimationTrack
|
||||||
{
|
{
|
||||||
private object _randomValue1 = default;
|
private object _randomValue1;
|
||||||
private object _randomValue2 = default;
|
private object _randomValue2;
|
||||||
private object _randomValue3 = default;
|
private object _randomValue3;
|
||||||
private object _randomValue4 = default;
|
private object _randomValue4;
|
||||||
|
|
||||||
public override void OnInitialize()
|
public override void OnInitialize()
|
||||||
{
|
{
|
||||||
@@ -275,11 +282,16 @@ namespace Content.Client.GameObjects.Components
|
|||||||
/// A light behaviour that cycles through a list of colors.
|
/// A light behaviour that cycles through a list of colors.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class ColorCycleBehaviour : LightBehaviourAnimationTrack
|
[DataDefinition]
|
||||||
|
public class ColorCycleBehaviour : LightBehaviourAnimationTrack, ISerializationHooks
|
||||||
{
|
{
|
||||||
public List<Color> ColorsToCycle { get; set; }
|
[DataField("property")]
|
||||||
|
[ViewVariables]
|
||||||
|
public override string Property { get; protected set; } = "Color";
|
||||||
|
|
||||||
private int _colorIndex = 0;
|
[DataField("colors")] public List<Color> ColorsToCycle { get; set; } = new();
|
||||||
|
|
||||||
|
private int _colorIndex;
|
||||||
|
|
||||||
public override void OnStart()
|
public override void OnStart()
|
||||||
{
|
{
|
||||||
@@ -320,23 +332,13 @@ namespace Content.Client.GameObjects.Components
|
|||||||
return (-1, playingTime);
|
return (-1, playingTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ExposeData(ObjectSerializer serializer)
|
void ISerializationHooks.AfterDeserialization()
|
||||||
{
|
{
|
||||||
serializer.DataField(this, x => x.ID, "id", string.Empty);
|
|
||||||
serializer.DataField(this, x => x.IsLooped, "isLooped", false);
|
|
||||||
serializer.DataField(this, x => x.Enabled, "enabled", false);
|
|
||||||
serializer.DataField(this, x => x.MinDuration, "minDuration", -1f);
|
|
||||||
serializer.DataField(this, x => x.MaxDuration, "maxDuration", 2f);
|
|
||||||
serializer.DataField(this, x => x.InterpolateMode, "interpolate", AnimationInterpolationMode.Linear);
|
|
||||||
ColorsToCycle = serializer.ReadDataField("colors", new List<Color>());
|
|
||||||
Property = "Color";
|
|
||||||
|
|
||||||
if (ColorsToCycle.Count < 2)
|
if (ColorsToCycle.Count < 2)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException($"{nameof(ColorCycleBehaviour)} has less than 2 colors to cycle");
|
throw new InvalidOperationException($"{nameof(ColorCycleBehaviour)} has less than 2 colors to cycle");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -344,11 +346,11 @@ namespace Content.Client.GameObjects.Components
|
|||||||
/// A component which applies a specific behaviour to a PointLightComponent on its owner.
|
/// A component which applies a specific behaviour to a PointLightComponent on its owner.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
public class LightBehaviourComponent : SharedLightBehaviourComponent
|
public class LightBehaviourComponent : SharedLightBehaviourComponent, ISerializationHooks
|
||||||
{
|
{
|
||||||
private const string KeyPrefix = nameof(LightBehaviourComponent);
|
private const string KeyPrefix = nameof(LightBehaviourComponent);
|
||||||
|
|
||||||
private class AnimationContainer
|
public class AnimationContainer
|
||||||
{
|
{
|
||||||
public AnimationContainer(int key, Animation animation, LightBehaviourAnimationTrack track)
|
public AnimationContainer(int key, Animation animation, LightBehaviourAnimationTrack track)
|
||||||
{
|
{
|
||||||
@@ -363,16 +365,36 @@ namespace Content.Client.GameObjects.Components
|
|||||||
public LightBehaviourAnimationTrack LightBehaviour { get; set; }
|
public LightBehaviourAnimationTrack LightBehaviour { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[ViewVariables(VVAccess.ReadOnly)]
|
||||||
|
[DataField("behaviours")]
|
||||||
|
public readonly List<LightBehaviourAnimationTrack> Behaviours = new();
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadOnly)]
|
[ViewVariables(VVAccess.ReadOnly)]
|
||||||
private readonly List<AnimationContainer> _animations = new();
|
private readonly List<AnimationContainer> _animations = new();
|
||||||
|
|
||||||
private float _originalRadius = default;
|
private float _originalRadius;
|
||||||
private float _originalEnergy = default;
|
private float _originalEnergy;
|
||||||
private Angle _originalRotation = default;
|
private Angle _originalRotation;
|
||||||
private Color _originalColor = default;
|
private Color _originalColor;
|
||||||
private bool _originalEnabled = default;
|
private bool _originalEnabled;
|
||||||
private PointLightComponent _lightComponent = default;
|
private PointLightComponent _lightComponent;
|
||||||
private AnimationPlayerComponent _animationPlayer = default;
|
private AnimationPlayerComponent _animationPlayer;
|
||||||
|
|
||||||
|
void ISerializationHooks.AfterDeserialization()
|
||||||
|
{
|
||||||
|
var key = 0;
|
||||||
|
|
||||||
|
foreach (var behaviour in Behaviours)
|
||||||
|
{
|
||||||
|
var animation = new Animation()
|
||||||
|
{
|
||||||
|
AnimationTracks = { behaviour }
|
||||||
|
};
|
||||||
|
|
||||||
|
_animations.Add(new AnimationContainer(key, animation, behaviour));
|
||||||
|
key++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Startup()
|
protected override void Startup()
|
||||||
{
|
{
|
||||||
@@ -380,7 +402,7 @@ namespace Content.Client.GameObjects.Components
|
|||||||
|
|
||||||
CopyLightSettings();
|
CopyLightSettings();
|
||||||
_animationPlayer = Owner.EnsureComponent<AnimationPlayerComponent>();
|
_animationPlayer = Owner.EnsureComponent<AnimationPlayerComponent>();
|
||||||
_animationPlayer.AnimationCompleted += s => OnAnimationCompleted(s);
|
_animationPlayer.AnimationCompleted += OnAnimationCompleted;
|
||||||
|
|
||||||
foreach (var container in _animations)
|
foreach (var container in _animations)
|
||||||
{
|
{
|
||||||
@@ -516,24 +538,5 @@ namespace Content.Client.GameObjects.Components
|
|||||||
StartLightBehaviour(behaviour.ID);
|
StartLightBehaviour(behaviour.ID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
base.ExposeData(serializer);
|
|
||||||
|
|
||||||
var behaviours = serializer.ReadDataField("behaviours", new List<LightBehaviourAnimationTrack>());
|
|
||||||
var key = 0;
|
|
||||||
|
|
||||||
foreach (LightBehaviourAnimationTrack behaviour in behaviours)
|
|
||||||
{
|
|
||||||
var animation = new Animation()
|
|
||||||
{
|
|
||||||
AnimationTracks = { behaviour }
|
|
||||||
};
|
|
||||||
|
|
||||||
_animations.Add(new AnimationContainer(key, animation, behaviour));
|
|
||||||
key++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ namespace Content.Client.GameObjects.Components.Mobs
|
|||||||
private Vector2 _currentKick;
|
private Vector2 _currentKick;
|
||||||
private float _lastKickTime;
|
private float _lastKickTime;
|
||||||
|
|
||||||
[ComponentDependency] private readonly EyeComponent? _eye = null;
|
[ComponentDependency]
|
||||||
|
private readonly EyeComponent? _eye = default;
|
||||||
|
|
||||||
// Basically I needed a way to chain this effect for the attack lunge animation.
|
// Basically I needed a way to chain this effect for the attack lunge animation.
|
||||||
// Sorry!
|
// Sorry!
|
||||||
|
|||||||
@@ -1,36 +1,52 @@
|
|||||||
|
#nullable enable
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Content.Shared.GameObjects;
|
using Content.Shared.GameObjects;
|
||||||
using Content.Shared.GameObjects.Components.Mobs;
|
using Content.Shared.GameObjects.Components.Mobs;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
|
using Robust.Shared.Serialization;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components.Mobs
|
namespace Content.Client.GameObjects.Components.Mobs
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class DamageStateVisualizer : AppearanceVisualizer
|
public sealed class DamageStateVisualizer : AppearanceVisualizer, ISerializationHooks
|
||||||
{
|
{
|
||||||
private DamageState _data = DamageState.Alive;
|
private DamageState _data = DamageState.Alive;
|
||||||
private readonly Dictionary<DamageState, string> _stateMap = new();
|
private Dictionary<DamageState, string> _stateMap = new();
|
||||||
private int? _originalDrawDepth;
|
private int? _originalDrawDepth;
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
[DataField("normal")]
|
||||||
|
private string? normal;
|
||||||
|
[DataField("crit")]
|
||||||
|
private string? crit;
|
||||||
|
[DataField("dead")]
|
||||||
|
private string? dead;
|
||||||
|
|
||||||
|
void ISerializationHooks.BeforeSerialization()
|
||||||
{
|
{
|
||||||
base.LoadData(node);
|
_stateMap.TryGetValue(DamageState.Alive, out normal);
|
||||||
if (node.TryGetNode("normal", out var normal))
|
_stateMap.TryGetValue(DamageState.Critical, out crit);
|
||||||
|
_stateMap.TryGetValue(DamageState.Dead, out dead);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ISerializationHooks.AfterDeserialization()
|
||||||
|
{
|
||||||
|
if (normal != null)
|
||||||
{
|
{
|
||||||
_stateMap.Add(DamageState.Alive, normal.AsString());
|
_stateMap.Add(DamageState.Alive, normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node.TryGetNode("crit", out var crit))
|
if (crit != null)
|
||||||
{
|
{
|
||||||
_stateMap.Add(DamageState.Critical, crit.AsString());
|
_stateMap.Add(DamageState.Critical, crit);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node.TryGetNode("dead", out var dead))
|
if (dead != null)
|
||||||
{
|
{
|
||||||
_stateMap.Add(DamageState.Dead, dead.AsString());
|
_stateMap.Add(DamageState.Dead, dead);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using Content.Shared.GameObjects.Components.Morgue;
|
using Content.Shared.GameObjects.Components.Morgue;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
|
|
||||||
@@ -10,35 +11,16 @@ namespace Content.Client.GameObjects.Components.Morgue
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class CrematoriumVisualizer : AppearanceVisualizer
|
public sealed class CrematoriumVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
|
[DataField("state_open")]
|
||||||
private string _stateOpen = "";
|
private string _stateOpen = "";
|
||||||
|
[DataField("state_closed")]
|
||||||
private string _stateClosed = "";
|
private string _stateClosed = "";
|
||||||
|
|
||||||
|
[DataField("light_contents")]
|
||||||
private string _lightContents = "";
|
private string _lightContents = "";
|
||||||
|
[DataField("light_burning")]
|
||||||
private string _lightBurning = "";
|
private string _lightBurning = "";
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
|
||||||
{
|
|
||||||
base.LoadData(node);
|
|
||||||
|
|
||||||
if (node.TryGetNode("state_open", out var child))
|
|
||||||
{
|
|
||||||
_stateOpen = child.AsString();
|
|
||||||
}
|
|
||||||
if (node.TryGetNode("state_closed", out child))
|
|
||||||
{
|
|
||||||
_stateClosed = child.AsString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node.TryGetNode("light_contents", out child))
|
|
||||||
{
|
|
||||||
_lightContents = child.AsString();
|
|
||||||
}
|
|
||||||
if (node.TryGetNode("light_burning", out child))
|
|
||||||
{
|
|
||||||
_lightBurning = child.AsString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using Content.Shared.GameObjects.Components.Morgue;
|
using Content.Shared.GameObjects.Components.Morgue;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
|
|
||||||
@@ -8,40 +10,18 @@ namespace Content.Client.GameObjects.Components.Storage
|
|||||||
{
|
{
|
||||||
public sealed class MorgueVisualizer : AppearanceVisualizer
|
public sealed class MorgueVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
|
[DataField("state_open")]
|
||||||
private string _stateOpen = "";
|
private string _stateOpen = "";
|
||||||
|
[DataField("state_closed")]
|
||||||
private string _stateClosed = "";
|
private string _stateClosed = "";
|
||||||
|
|
||||||
|
[DataField("light_contents")]
|
||||||
private string _lightContents = "";
|
private string _lightContents = "";
|
||||||
|
[DataField("light_mob")]
|
||||||
private string _lightMob = "";
|
private string _lightMob = "";
|
||||||
|
[DataField("light_soul")]
|
||||||
private string _lightSoul = "";
|
private string _lightSoul = "";
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
|
||||||
{
|
|
||||||
base.LoadData(node);
|
|
||||||
|
|
||||||
if (node.TryGetNode("state_open", out var child))
|
|
||||||
{
|
|
||||||
_stateOpen = child.AsString();
|
|
||||||
}
|
|
||||||
if (node.TryGetNode("state_closed", out child))
|
|
||||||
{
|
|
||||||
_stateClosed = child.AsString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node.TryGetNode("light_contents", out child))
|
|
||||||
{
|
|
||||||
_lightContents = child.AsString();
|
|
||||||
}
|
|
||||||
if (node.TryGetNode("light_mob", out child))
|
|
||||||
{
|
|
||||||
_lightMob = child.AsString();
|
|
||||||
}
|
|
||||||
if (node.TryGetNode("light_soul", out child))
|
|
||||||
{
|
|
||||||
_lightSoul = child.AsString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using Content.Client.GameObjects.Components.Items;
|
||||||
|
using Content.Shared.GameObjects.Components.Movement;
|
||||||
using Content.Shared.GameObjects.Components.Portal;
|
using Content.Shared.GameObjects.Components.Portal;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Content.Shared.GameObjects.Components;
|
using Content.Shared.GameObjects.Components;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
|
|
||||||
@@ -9,30 +10,13 @@ namespace Content.Client.GameObjects.Components.Nutrition
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class BurnStateVisualizer : AppearanceVisualizer
|
public class BurnStateVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
|
[DataField("burntIcon")]
|
||||||
private string _burntIcon = "burnt-icon";
|
private string _burntIcon = "burnt-icon";
|
||||||
|
[DataField("litIcon")]
|
||||||
private string _litIcon = "lit-icon";
|
private string _litIcon = "lit-icon";
|
||||||
|
[DataField("unlitIcon")]
|
||||||
private string _unlitIcon = "icon";
|
private string _unlitIcon = "icon";
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
|
||||||
{
|
|
||||||
base.LoadData(node);
|
|
||||||
|
|
||||||
if (node.TryGetNode("unlitIcon", out var unlitIcon))
|
|
||||||
{
|
|
||||||
_unlitIcon = unlitIcon.AsString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node.TryGetNode("litIcon", out var litIcon))
|
|
||||||
{
|
|
||||||
_litIcon = litIcon.AsString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node.TryGetNode("burntIcon", out var burntIcon))
|
|
||||||
{
|
|
||||||
_burntIcon = burntIcon.AsString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
@@ -62,4 +46,4 @@ namespace Content.Client.GameObjects.Components.Nutrition
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
|
|
||||||
@@ -10,6 +11,7 @@ namespace Content.Client.GameObjects.Components.Nutrition
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class CreamPiedVisualizer : AppearanceVisualizer
|
public class CreamPiedVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
|
[DataField("state")]
|
||||||
private string _state;
|
private string _state;
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
@@ -23,16 +25,6 @@ namespace Content.Client.GameObjects.Components.Nutrition
|
|||||||
sprite.LayerSetVisible(CreamPiedVisualLayers.Pie, false);
|
sprite.LayerSetVisible(CreamPiedVisualLayers.Pie, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
|
||||||
{
|
|
||||||
base.LoadData(node);
|
|
||||||
|
|
||||||
if (node.TryGetNode("state", out var otherNode))
|
|
||||||
{
|
|
||||||
_state = otherNode.AsString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using Content.Shared.GameObjects.Components.Nutrition;
|
|||||||
using Content.Shared.Utility;
|
using Content.Shared.Utility;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
|
|
||||||
@@ -12,25 +13,12 @@ namespace Content.Client.GameObjects.Components.Nutrition
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class FoodContainerVisualizer : AppearanceVisualizer
|
public sealed class FoodContainerVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
|
[DataField("base_state", required: true)]
|
||||||
private string _baseState;
|
private string _baseState;
|
||||||
|
[DataField("steps", required: true)]
|
||||||
private int _steps;
|
private int _steps;
|
||||||
private FoodContainerVisualMode _mode;
|
[DataField("mode")]
|
||||||
|
private FoodContainerVisualMode _mode = FoodContainerVisualMode.Rounded;
|
||||||
public override void LoadData(YamlMappingNode node)
|
|
||||||
{
|
|
||||||
base.LoadData(node);
|
|
||||||
|
|
||||||
_baseState = node.GetNode("base_state").AsString();
|
|
||||||
_steps = node.GetNode("steps").AsInt();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_mode = node.GetNode("mode").AsEnum<FoodContainerVisualMode>();
|
|
||||||
}
|
|
||||||
catch (KeyNotFoundException)
|
|
||||||
{
|
|
||||||
_mode = FoodContainerVisualMode.Rounded;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ using Content.Shared.GameObjects.Components.Nutrition;
|
|||||||
using Content.Shared.Utility;
|
using Content.Shared.Utility;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
|
|
||||||
@@ -10,15 +11,9 @@ namespace Content.Client.GameObjects.Components.Nutrition
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class DrinkFoodVisualizer : AppearanceVisualizer
|
public sealed class DrinkFoodVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
|
[DataField("steps")]
|
||||||
private int _steps;
|
private int _steps;
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
|
||||||
{
|
|
||||||
base.LoadData(node);
|
|
||||||
|
|
||||||
_steps = node.GetNode("steps").AsInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
|
|
||||||
@@ -14,6 +15,7 @@ namespace Content.Client.GameObjects.Components.PDA
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The base PDA sprite state, eg. "pda", "pda-clown"
|
/// The base PDA sprite state, eg. "pda", "pda-clown"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[DataField("state")]
|
||||||
private string _state;
|
private string _state;
|
||||||
|
|
||||||
private enum PDAVisualLayers : byte
|
private enum PDAVisualLayers : byte
|
||||||
@@ -23,15 +25,6 @@ namespace Content.Client.GameObjects.Components.PDA
|
|||||||
IDLight
|
IDLight
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
|
||||||
{
|
|
||||||
base.LoadData(node);
|
|
||||||
if (node.TryGetNode("state", out var child))
|
|
||||||
{
|
|
||||||
_state = child.AsString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
@@ -62,7 +55,5 @@ namespace Content.Client.GameObjects.Components.PDA
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,32 +4,26 @@ using Content.Shared.GameObjects.Components;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Prototypes;
|
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
using YamlDotNet.RepresentationModel;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components
|
namespace Content.Client.GameObjects.Components
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class ParticleAcceleratorPartVisualizer : AppearanceVisualizer
|
[DataDefinition]
|
||||||
|
public class ParticleAcceleratorPartVisualizer : AppearanceVisualizer, ISerializationHooks
|
||||||
{
|
{
|
||||||
private readonly Dictionary<ParticleAcceleratorVisualState, string> _states = new();
|
[DataField("baseState", required: true)]
|
||||||
|
private string _baseState;
|
||||||
|
private Dictionary<ParticleAcceleratorVisualState, string> _states = new();
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
void ISerializationHooks.AfterDeserialization()
|
||||||
{
|
{
|
||||||
base.LoadData(node);
|
_states.Add(ParticleAcceleratorVisualState.Powered, _baseState+"p");
|
||||||
|
_states.Add(ParticleAcceleratorVisualState.Level0, _baseState+"p0");
|
||||||
var serializer = YamlObjectSerializer.NewReader(node);
|
_states.Add(ParticleAcceleratorVisualState.Level1, _baseState+"p1");
|
||||||
if (!serializer.TryReadDataField<string>("baseState", out var baseState))
|
_states.Add(ParticleAcceleratorVisualState.Level2, _baseState+"p2");
|
||||||
{
|
_states.Add(ParticleAcceleratorVisualState.Level3, _baseState+"p3");
|
||||||
throw new PrototypeLoadException("No baseState property specified for ParticleAcceleratorPartVisualizer");
|
|
||||||
}
|
|
||||||
|
|
||||||
_states.Add(ParticleAcceleratorVisualState.Powered, baseState+"p");
|
|
||||||
_states.Add(ParticleAcceleratorVisualState.Level0, baseState+"p0");
|
|
||||||
_states.Add(ParticleAcceleratorVisualState.Level1, baseState+"p1");
|
|
||||||
_states.Add(ParticleAcceleratorVisualState.Level2, baseState+"p2");
|
|
||||||
_states.Add(ParticleAcceleratorVisualState.Level3, baseState+"p3");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
|
|||||||
@@ -9,32 +9,21 @@ using Robust.Shared.GameObjects;
|
|||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using YamlDotNet.RepresentationModel;
|
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components.Power.ApcNetComponents.PowerReceiverUsers
|
namespace Content.Client.GameObjects.Components.Power.ApcNetComponents.PowerReceiverUsers
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class PoweredLightVisualizer : AppearanceVisualizer
|
public class PoweredLightVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
private float _minBlinkingTime;
|
[DataField("minBlinkingTime")] private float _minBlinkingTime = 0.5f;
|
||||||
private float _maxBlinkingTime;
|
[DataField("maxBlinkingTime")] private float _maxBlinkingTime = 2;
|
||||||
private string? _blinkingSound;
|
[DataField("blinkingSound")] private string? _blinkingSound;
|
||||||
|
|
||||||
private bool _wasBlinking;
|
private bool _wasBlinking;
|
||||||
|
|
||||||
private Action<string>? _blinkingCallback;
|
private Action<string>? _blinkingCallback;
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
|
||||||
{
|
|
||||||
base.LoadData(node);
|
|
||||||
|
|
||||||
var serializer = YamlObjectSerializer.NewReader(node);
|
|
||||||
serializer.DataField(ref _minBlinkingTime, "minBlinkingTime", 0.5f);
|
|
||||||
serializer.DataField(ref _maxBlinkingTime, "maxBlinkingTime", 2.0f);
|
|
||||||
serializer.DataField(ref _blinkingSound, "blinkingSound", null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
|
|||||||
@@ -20,10 +20,8 @@ namespace Content.Client.GameObjects.Components.Power
|
|||||||
private Animation _insertingPlasmaAnimation;
|
private Animation _insertingPlasmaAnimation;
|
||||||
private Animation _insertingPlasticAnimation;
|
private Animation _insertingPlasticAnimation;
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
public AutolatheVisualizer()
|
||||||
{
|
{
|
||||||
base.LoadData(node);
|
|
||||||
|
|
||||||
_buildingAnimation = PopulateAnimation("building", "building_unlit", 0.5f);
|
_buildingAnimation = PopulateAnimation("building", "building_unlit", 0.5f);
|
||||||
_insertingMetalAnimation = PopulateAnimation("inserting_metal", "inserting_unlit", 0.5f);
|
_insertingMetalAnimation = PopulateAnimation("inserting_metal", "inserting_unlit", 0.5f);
|
||||||
_insertingGlassAnimation = PopulateAnimation("inserting_glass", "inserting_unlit", 0.5f);
|
_insertingGlassAnimation = PopulateAnimation("inserting_glass", "inserting_unlit", 0.5f);
|
||||||
@@ -123,6 +121,7 @@ namespace Content.Client.GameObjects.Components.Power
|
|||||||
var glowingPartsVisible = !(component.TryGetData(PowerDeviceVisuals.Powered, out bool powered) && !powered);
|
var glowingPartsVisible = !(component.TryGetData(PowerDeviceVisuals.Powered, out bool powered) && !powered);
|
||||||
sprite.LayerSetVisible(AutolatheVisualLayers.BaseUnlit, glowingPartsVisible);
|
sprite.LayerSetVisible(AutolatheVisualLayers.BaseUnlit, glowingPartsVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum AutolatheVisualLayers : byte
|
public enum AutolatheVisualLayers : byte
|
||||||
{
|
{
|
||||||
Base,
|
Base,
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
|
using System.Diagnostics;
|
||||||
using Content.Shared.GameObjects.Components.Power;
|
using Content.Shared.GameObjects.Components.Power;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
|
|
||||||
@@ -10,15 +12,9 @@ namespace Content.Client.GameObjects.Components.Power
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class PowerCellVisualizer : AppearanceVisualizer
|
public class PowerCellVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
|
[DataField("prefix")]
|
||||||
private string _prefix;
|
private string _prefix;
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
|
||||||
{
|
|
||||||
base.LoadData(node);
|
|
||||||
|
|
||||||
_prefix = node.GetNode("prefix").AsString();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|||||||
@@ -20,10 +20,8 @@ namespace Content.Client.GameObjects.Components.Power
|
|||||||
private Animation _insertingPlasmaAnimation;
|
private Animation _insertingPlasmaAnimation;
|
||||||
private Animation _insertingPlasticAnimation;
|
private Animation _insertingPlasticAnimation;
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
public ProtolatheVisualizer()
|
||||||
{
|
{
|
||||||
base.LoadData(node);
|
|
||||||
|
|
||||||
_buildingAnimation = PopulateAnimation("building", "building_unlit", 0.8f);
|
_buildingAnimation = PopulateAnimation("building", "building_unlit", 0.8f);
|
||||||
_insertingMetalAnimation = PopulateAnimation("inserting_metal", "inserting_unlit", 0.8f);
|
_insertingMetalAnimation = PopulateAnimation("inserting_metal", "inserting_unlit", 0.8f);
|
||||||
_insertingGlassAnimation = PopulateAnimation("inserting_glass", "inserting_unlit", 0.8f);
|
_insertingGlassAnimation = PopulateAnimation("inserting_glass", "inserting_unlit", 0.8f);
|
||||||
@@ -123,6 +121,7 @@ namespace Content.Client.GameObjects.Components.Power
|
|||||||
var glowingPartsVisible = !(component.TryGetData(PowerDeviceVisuals.Powered, out bool powered) && !powered);
|
var glowingPartsVisible = !(component.TryGetData(PowerDeviceVisuals.Powered, out bool powered) && !powered);
|
||||||
sprite.LayerSetVisible(ProtolatheVisualLayers.BaseUnlit, glowingPartsVisible);
|
sprite.LayerSetVisible(ProtolatheVisualLayers.BaseUnlit, glowingPartsVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ProtolatheVisualLayers : byte
|
public enum ProtolatheVisualLayers : byte
|
||||||
{
|
{
|
||||||
Base,
|
Base,
|
||||||
|
|||||||
@@ -4,19 +4,19 @@ using JetBrains.Annotations;
|
|||||||
using Robust.Client.Animations;
|
using Robust.Client.Animations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using YamlDotNet.RepresentationModel;
|
using Robust.Shared.Serialization;
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components
|
namespace Content.Client.GameObjects.Components
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class RadiationCollectorVisualizer : AppearanceVisualizer
|
public class RadiationCollectorVisualizer : AppearanceVisualizer, ISerializationHooks
|
||||||
{
|
{
|
||||||
private const string AnimationKey = "radiationcollector_animation";
|
private const string AnimationKey = "radiationcollector_animation";
|
||||||
|
|
||||||
private Animation ActivateAnimation;
|
private Animation ActivateAnimation;
|
||||||
private Animation DeactiveAnimation;
|
private Animation DeactiveAnimation;
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
void ISerializationHooks.AfterDeserialization()
|
||||||
{
|
{
|
||||||
ActivateAnimation = new Animation {Length = TimeSpan.FromSeconds(0.8f)};
|
ActivateAnimation = new Animation {Length = TimeSpan.FromSeconds(0.8f)};
|
||||||
{
|
{
|
||||||
@@ -51,7 +51,6 @@ namespace Content.Client.GameObjects.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override void OnChangeData(AppearanceComponent component)
|
public override void OnChangeData(AppearanceComponent component)
|
||||||
{
|
{
|
||||||
base.OnChangeData(component);
|
base.OnChangeData(component);
|
||||||
@@ -91,7 +90,6 @@ namespace Content.Client.GameObjects.Components
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum RadiationCollectorVisualLayers : byte
|
public enum RadiationCollectorVisualLayers : byte
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
|
|
||||||
@@ -10,24 +11,11 @@ namespace Content.Client.GameObjects.Components.Recycling
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class RecyclerVisualizer : AppearanceVisualizer
|
public class RecyclerVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
|
[DataField("state_clean")]
|
||||||
private string _stateClean;
|
private string _stateClean;
|
||||||
|
[DataField("state_bloody")]
|
||||||
private string _stateBloody;
|
private string _stateBloody;
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
|
||||||
{
|
|
||||||
base.LoadData(node);
|
|
||||||
|
|
||||||
if (node.TryGetNode("state_clean", out var child))
|
|
||||||
{
|
|
||||||
_stateClean = child.AsString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node.TryGetNode("state_bloody", out child))
|
|
||||||
{
|
|
||||||
_stateBloody = child.AsString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
using Content.Client.GameObjects.Components.IconSmoothing;
|
using Content.Client.GameObjects.Components.IconSmoothing;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
using static Robust.Client.GameObjects.SpriteComponent;
|
using static Robust.Client.GameObjects.SpriteComponent;
|
||||||
|
|
||||||
@@ -13,14 +15,8 @@ namespace Content.Client.GameObjects.Components
|
|||||||
public override string Name => "ReinforcedWall";
|
public override string Name => "ReinforcedWall";
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
private string _reinforcedStateBase;
|
[DataField("reinforcedBase")]
|
||||||
|
private string _reinforcedStateBase = default;
|
||||||
public override void ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
base.ExposeData(serializer);
|
|
||||||
|
|
||||||
serializer.DataField(ref _reinforcedStateBase, "reinforcedBase", null);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Startup()
|
protected override void Startup()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ using Robust.Shared.Network;
|
|||||||
using Robust.Shared.Player;
|
using Robust.Shared.Player;
|
||||||
using Robust.Shared.Players;
|
using Robust.Shared.Players;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components.Sound
|
namespace Content.Client.GameObjects.Components.Sound
|
||||||
{
|
{
|
||||||
@@ -19,6 +19,13 @@ namespace Content.Client.GameObjects.Components.Sound
|
|||||||
|
|
||||||
private readonly Dictionary<ScheduledSound, IPlayingAudioStream> _audioStreams = new();
|
private readonly Dictionary<ScheduledSound, IPlayingAudioStream> _audioStreams = new();
|
||||||
|
|
||||||
|
[DataField("schedules", true)]
|
||||||
|
private List<ScheduledSound> _scheduledSounds
|
||||||
|
{
|
||||||
|
set => value.ForEach(AddScheduledSound);
|
||||||
|
get => new();
|
||||||
|
}
|
||||||
|
|
||||||
public override void StopAllSounds()
|
public override void StopAllSounds()
|
||||||
{
|
{
|
||||||
foreach (var kvp in _audioStreams)
|
foreach (var kvp in _audioStreams)
|
||||||
@@ -94,15 +101,5 @@ namespace Content.Client.GameObjects.Components.Sound
|
|||||||
base.Initialize();
|
base.Initialize();
|
||||||
SoundSystem.OcclusionCollisionMask = (int) CollisionGroup.Impassable;
|
SoundSystem.OcclusionCollisionMask = (int) CollisionGroup.Impassable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
base.ExposeData(serializer);
|
|
||||||
|
|
||||||
serializer.DataReadFunction(
|
|
||||||
"schedules",
|
|
||||||
new List<ScheduledSound>(),
|
|
||||||
schedules => schedules.ForEach(AddScheduledSound));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using Content.Shared.Utility;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
|
|
||||||
@@ -59,6 +60,7 @@ namespace Content.Client.GameObjects.Components
|
|||||||
/// Sprite layers used in stack visualizer. Sprites first in layer correspond to lower stack states
|
/// Sprite layers used in stack visualizer. Sprites first in layer correspond to lower stack states
|
||||||
/// e.g. <code>_spriteLayers[0]</code> is lower stack level than <code>_spriteLayers[1]</code>.
|
/// e.g. <code>_spriteLayers[0]</code> is lower stack level than <code>_spriteLayers[1]</code>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[DataField("stackLayers")]
|
||||||
private readonly List<string> _spriteLayers = new();
|
private readonly List<string> _spriteLayers = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -74,32 +76,11 @@ namespace Content.Client.GameObjects.Components
|
|||||||
/// </list>
|
/// </list>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[DataField("composite")]
|
||||||
private bool _isComposite;
|
private bool _isComposite;
|
||||||
|
[DataField("sprite")]
|
||||||
private ResourcePath? _spritePath;
|
private ResourcePath? _spritePath;
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode mapping)
|
|
||||||
{
|
|
||||||
base.LoadData(mapping);
|
|
||||||
|
|
||||||
if (mapping.TryGetNode<YamlSequenceNode>("stackLayers", out var spriteSequenceNode))
|
|
||||||
{
|
|
||||||
foreach (var yamlNode in spriteSequenceNode)
|
|
||||||
{
|
|
||||||
_spriteLayers.Add(((YamlScalarNode) yamlNode).Value!);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mapping.TryGetNode<YamlScalarNode>("composite", out var transparent))
|
|
||||||
{
|
|
||||||
_isComposite = transparent.AsBool();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mapping.TryGetNode<YamlScalarNode>("sprite", out var spritePath))
|
|
||||||
{
|
|
||||||
_spritePath = spritePath.AsResourcePath();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ using JetBrains.Annotations;
|
|||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
|
using Robust.Shared.Serialization;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
using static Robust.Shared.Utility.SpriteSpecifier;
|
using static Robust.Shared.Utility.SpriteSpecifier;
|
||||||
@@ -12,21 +14,15 @@ using static Robust.Shared.Utility.SpriteSpecifier;
|
|||||||
namespace Content.Client.GameObjects.Components.Storage
|
namespace Content.Client.GameObjects.Components.Storage
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class BagOpenCloseVisualizer : AppearanceVisualizer
|
public class BagOpenCloseVisualizer : AppearanceVisualizer, ISerializationHooks
|
||||||
{
|
{
|
||||||
private const string OpenIcon = "openIcon";
|
private const string OpenIcon = "openIcon";
|
||||||
|
[DataField(OpenIcon)]
|
||||||
private string? _openIcon;
|
private string? _openIcon;
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
void ISerializationHooks.AfterDeserialization()
|
||||||
{
|
{
|
||||||
base.LoadData(node);
|
if(_openIcon == null){
|
||||||
|
|
||||||
if (node.TryGetNode<YamlScalarNode>(OpenIcon, out var openIconNode))
|
|
||||||
{
|
|
||||||
_openIcon = openIconNode.Value;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Logger.Warning("BagOpenCloseVisualizer is useless with no `openIcon`");
|
Logger.Warning("BagOpenCloseVisualizer is useless with no `openIcon`");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
|
|
||||||
@@ -10,30 +11,13 @@ namespace Content.Client.GameObjects.Components.Storage
|
|||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class StorageVisualizer : AppearanceVisualizer
|
public sealed class StorageVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
|
[DataField("state")]
|
||||||
private string _stateBase;
|
private string _stateBase;
|
||||||
|
[DataField("state_open")]
|
||||||
private string _stateOpen;
|
private string _stateOpen;
|
||||||
|
[DataField("state_closed")]
|
||||||
private string _stateClosed;
|
private string _stateClosed;
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
|
||||||
{
|
|
||||||
base.LoadData(node);
|
|
||||||
|
|
||||||
if (node.TryGetNode("state", out var child))
|
|
||||||
{
|
|
||||||
_stateBase = child.AsString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node.TryGetNode("state_open", out child))
|
|
||||||
{
|
|
||||||
_stateOpen = child.AsString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (node.TryGetNode("state_closed", out child))
|
|
||||||
{
|
|
||||||
_stateClosed = child.AsString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
{
|
{
|
||||||
if (!entity.TryGetComponent(out ISpriteComponent sprite))
|
if (!entity.TryGetComponent(out ISpriteComponent sprite))
|
||||||
|
|||||||
@@ -4,25 +4,23 @@ using JetBrains.Annotations;
|
|||||||
using Robust.Client.Animations;
|
using Robust.Client.Animations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Serialization;
|
||||||
using YamlDotNet.RepresentationModel;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components.Trigger
|
namespace Content.Client.GameObjects.Components.Trigger
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public class TimerTriggerVisualizer : AppearanceVisualizer
|
public class TimerTriggerVisualizer : AppearanceVisualizer, ISerializationHooks
|
||||||
{
|
{
|
||||||
private const string AnimationKey = "priming_animation";
|
private const string AnimationKey = "priming_animation";
|
||||||
|
|
||||||
|
[DataField("countdown_sound", required: true)]
|
||||||
|
private string _countdownSound;
|
||||||
|
|
||||||
private Animation PrimingAnimation;
|
private Animation PrimingAnimation;
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
void ISerializationHooks.AfterDeserialization()
|
||||||
{
|
{
|
||||||
base.LoadData(node);
|
|
||||||
|
|
||||||
var countdownSound = node.GetNode("countdown_sound").AsString();
|
|
||||||
|
|
||||||
|
|
||||||
PrimingAnimation = new Animation { Length = TimeSpan.MaxValue };
|
PrimingAnimation = new Animation { Length = TimeSpan.MaxValue };
|
||||||
{
|
{
|
||||||
var flick = new AnimationTrackSpriteFlick();
|
var flick = new AnimationTrackSpriteFlick();
|
||||||
@@ -32,7 +30,7 @@ namespace Content.Client.GameObjects.Components.Trigger
|
|||||||
|
|
||||||
var sound = new AnimationTrackPlaySound();
|
var sound = new AnimationTrackPlaySound();
|
||||||
PrimingAnimation.AnimationTracks.Add(sound);
|
PrimingAnimation.AnimationTracks.Add(sound);
|
||||||
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(countdownSound, 0));
|
sound.KeyFrames.Add(new AnimationTrackPlaySound.KeyFrame(_countdownSound, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,14 +4,14 @@ using JetBrains.Annotations;
|
|||||||
using Robust.Client.Animations;
|
using Robust.Client.Animations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Serialization;
|
||||||
using YamlDotNet.RepresentationModel;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using static Content.Shared.GameObjects.Components.VendingMachines.SharedVendingMachineComponent;
|
using static Content.Shared.GameObjects.Components.VendingMachines.SharedVendingMachineComponent;
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components.VendingMachines
|
namespace Content.Client.GameObjects.Components.VendingMachines
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public sealed class VendingMachineVisualizer : AppearanceVisualizer
|
public sealed class VendingMachineVisualizer : AppearanceVisualizer, ISerializationHooks
|
||||||
{
|
{
|
||||||
// TODO: Should default to off or broken if damaged
|
// TODO: Should default to off or broken if damaged
|
||||||
//
|
//
|
||||||
@@ -37,41 +37,53 @@ namespace Content.Client.GameObjects.Components.VendingMachines
|
|||||||
{"broken", VendingMachineVisualLayers.Unlit},
|
{"broken", VendingMachineVisualLayers.Unlit},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[DataField("screen")]
|
||||||
|
private bool _screen;
|
||||||
|
|
||||||
|
[DataField("normal")]
|
||||||
|
private bool _normal;
|
||||||
|
|
||||||
|
[DataField("normalUnshaded")]
|
||||||
|
private bool _normalUnshaded;
|
||||||
|
|
||||||
|
[DataField("eject")]
|
||||||
|
private bool _eject;
|
||||||
|
|
||||||
|
[DataField("ejectUnshaded")]
|
||||||
|
private bool _ejectUnshaded;
|
||||||
|
|
||||||
|
[DataField("deny")]
|
||||||
|
private bool _deny;
|
||||||
|
|
||||||
|
[DataField("denyUnshaded")]
|
||||||
|
private bool _denyUnshaded;
|
||||||
|
|
||||||
|
[DataField("broken")]
|
||||||
|
private bool _broken;
|
||||||
|
|
||||||
|
[DataField("brokenUnshaded")]
|
||||||
|
private bool _brokenUnshaded;
|
||||||
|
|
||||||
private readonly Dictionary<string, Animation> _animations = new();
|
private readonly Dictionary<string, Animation> _animations = new();
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
void ISerializationHooks.AfterDeserialization()
|
||||||
{
|
{
|
||||||
base.LoadData(node);
|
// Used a dictionary so the yaml can adhere to the style-guide and the texture states can be clear
|
||||||
|
var states = new Dictionary<string, bool>
|
||||||
_baseStates = new Dictionary<string, bool>
|
|
||||||
{
|
{
|
||||||
{"off", true},
|
{"off", true},
|
||||||
|
{"screen", _screen},
|
||||||
|
{"normal", _normal},
|
||||||
|
{"normal-unshaded", _normalUnshaded},
|
||||||
|
{"eject", _eject},
|
||||||
|
{"eject-unshaded", _ejectUnshaded},
|
||||||
|
{"deny", _deny},
|
||||||
|
{"deny-unshaded", _denyUnshaded},
|
||||||
|
{"broken", _broken},
|
||||||
|
{"broken-unshaded", _brokenUnshaded},
|
||||||
};
|
};
|
||||||
|
|
||||||
// Used a dictionary so the yaml can adhere to the style-guide and the texture states can be clear
|
_baseStates = states;
|
||||||
var states = new Dictionary<string, string>
|
|
||||||
{
|
|
||||||
{"screen", "screen"},
|
|
||||||
{"normal", "normal"},
|
|
||||||
{"normalUnshaded", "normal-unshaded"},
|
|
||||||
{"eject", "eject"},
|
|
||||||
{"ejectUnshaded", "eject-unshaded"},
|
|
||||||
{"deny", "deny"},
|
|
||||||
{"denyUnshaded", "deny-unshaded"},
|
|
||||||
{"broken", "broken"},
|
|
||||||
{"brokenUnshaded", "broken-unshaded"},
|
|
||||||
};
|
|
||||||
|
|
||||||
foreach (var (state, textureState) in states)
|
|
||||||
{
|
|
||||||
if (!node.TryGetNode(state, out var yamlNode))
|
|
||||||
{
|
|
||||||
_baseStates[textureState] = false;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
_baseStates.Add(textureState, yamlNode.AsBool());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_baseStates["deny"])
|
if (_baseStates["deny"])
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ using Robust.Shared.GameObjects;
|
|||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Network;
|
using Robust.Shared.Network;
|
||||||
using Robust.Shared.Players;
|
using Robust.Shared.Players;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
|
namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
|
||||||
@@ -87,14 +89,7 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels
|
|||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public (int count, int max)? MagazineCount { get; private set; }
|
public (int count, int max)? MagazineCount { get; private set; }
|
||||||
|
|
||||||
[ViewVariables(VVAccess.ReadWrite)] private bool _isLmgAlarmAnimation;
|
[ViewVariables(VVAccess.ReadWrite)] [DataField("lmg_alarm_animation")] private bool _isLmgAlarmAnimation = default;
|
||||||
|
|
||||||
public override void ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
base.ExposeData(serializer);
|
|
||||||
|
|
||||||
serializer.DataField(ref _isLmgAlarmAnimation, "lmg_alarm_animation", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
public override void HandleComponentState(ComponentState curState, ComponentState nextState)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Content.Shared.Utility;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using YamlDotNet.RepresentationModel;
|
using YamlDotNet.RepresentationModel;
|
||||||
|
|
||||||
@@ -12,18 +13,13 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged.Barrels.Visualize
|
|||||||
public sealed class MagVisualizer : AppearanceVisualizer
|
public sealed class MagVisualizer : AppearanceVisualizer
|
||||||
{
|
{
|
||||||
private bool _magLoaded;
|
private bool _magLoaded;
|
||||||
|
[DataField("magState")]
|
||||||
private string _magState;
|
private string _magState;
|
||||||
|
[DataField("steps")]
|
||||||
private int _magSteps;
|
private int _magSteps;
|
||||||
|
[DataField("zeroVisible")]
|
||||||
private bool _zeroVisible;
|
private bool _zeroVisible;
|
||||||
|
|
||||||
public override void LoadData(YamlMappingNode node)
|
|
||||||
{
|
|
||||||
base.LoadData(node);
|
|
||||||
_magState = node.GetNode("magState").AsString();
|
|
||||||
_magSteps = node.GetNode("steps").AsInt();
|
|
||||||
_zeroVisible = node.GetNode("zeroVisible").AsBool();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void InitializeEntity(IEntity entity)
|
public override void InitializeEntity(IEntity entity)
|
||||||
{
|
{
|
||||||
base.InitializeEntity(entity);
|
base.InitializeEntity(entity);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using Content.Client.GameObjects.EntitySystems;
|
|||||||
using Content.Shared.GameObjects.Components;
|
using Content.Shared.GameObjects.Components;
|
||||||
using Robust.Client.GameObjects;
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using static Content.Client.GameObjects.Components.IconSmoothing.IconSmoothComponent;
|
using static Content.Client.GameObjects.Components.IconSmoothing.IconSmoothComponent;
|
||||||
|
|
||||||
namespace Content.Client.GameObjects.Components
|
namespace Content.Client.GameObjects.Components
|
||||||
@@ -12,7 +12,8 @@ namespace Content.Client.GameObjects.Components
|
|||||||
[ComponentReference(typeof(SharedWindowComponent))]
|
[ComponentReference(typeof(SharedWindowComponent))]
|
||||||
public sealed class WindowComponent : SharedWindowComponent
|
public sealed class WindowComponent : SharedWindowComponent
|
||||||
{
|
{
|
||||||
private string _stateBase;
|
[DataField("base")]
|
||||||
|
private string _stateBase = default;
|
||||||
private ISpriteComponent _sprite;
|
private ISpriteComponent _sprite;
|
||||||
private SnapGridComponent _snapGrid;
|
private SnapGridComponent _snapGrid;
|
||||||
|
|
||||||
@@ -101,13 +102,6 @@ namespace Content.Client.GameObjects.Components
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
base.ExposeData(serializer);
|
|
||||||
|
|
||||||
serializer.DataField(ref _stateBase, "base", null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ namespace Content.Client.Research
|
|||||||
foreach (var (id, amount) in Owner.Storage)
|
foreach (var (id, amount) in Owner.Storage)
|
||||||
{
|
{
|
||||||
if (!_prototypeManager.TryIndex(id, out MaterialPrototype materialPrototype)) continue;
|
if (!_prototypeManager.TryIndex(id, out MaterialPrototype materialPrototype)) continue;
|
||||||
var material = materialPrototype.Material;
|
var material = materialPrototype;
|
||||||
_materials.AddItem($"{material.Name} {amount} cm³", material.Icon.Frame0(), false);
|
_materials.AddItem($"{material.Name} {amount} cm³", material.Icon.Frame0(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ namespace Content.IntegrationTests
|
|||||||
typeof(Server.EntryPoint).Assembly,
|
typeof(Server.EntryPoint).Assembly,
|
||||||
typeof(ContentIntegrationTest).Assembly
|
typeof(ContentIntegrationTest).Assembly
|
||||||
};
|
};
|
||||||
|
|
||||||
options.BeforeStart += () =>
|
options.BeforeStart += () =>
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<IModLoader>().SetModuleBaseCallbacks(new ServerModuleTestingCallbacks
|
IoCManager.Resolve<IModLoader>().SetModuleBaseCallbacks(new ServerModuleTestingCallbacks
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Content.Server.AI.Utility;
|
using Content.Server.AI.Utility;
|
||||||
using Content.Server.AI.Utility.Actions;
|
using Content.Server.AI.Utility.Actions;
|
||||||
|
using Content.Server.AI.Utility.AiLogic;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Reflection;
|
using Robust.Shared.Reflection;
|
||||||
@@ -49,12 +50,11 @@ namespace Content.IntegrationTests.Tests.AI
|
|||||||
{
|
{
|
||||||
foreach (var entity in protoManager.EnumeratePrototypes<EntityPrototype>())
|
foreach (var entity in protoManager.EnumeratePrototypes<EntityPrototype>())
|
||||||
{
|
{
|
||||||
if (!entity.Components.TryGetValue("UtilityAI", out var npcNode)) continue;
|
if (!entity.TryGetComponent<UtilityAi>("UtilityAI", out var npcNode)) continue;
|
||||||
var sets = npcNode["behaviorSets"];
|
|
||||||
|
|
||||||
foreach (var entry in (YamlSequenceNode) sets)
|
foreach (var entry in npcNode.BehaviorSets)
|
||||||
{
|
{
|
||||||
Assert.That(behaviorSets.ContainsKey(entry.ToString()), $"BehaviorSet {entry} in entity {entity.ID} not found");
|
Assert.That(behaviorSets.ContainsKey(entry), $"BehaviorSet {entry} in entity {entity.ID} not found");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Content.Server.GameObjects.Components.Items.Storage;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
@@ -21,19 +22,20 @@ namespace Content.IntegrationTests.Tests
|
|||||||
{
|
{
|
||||||
foreach (var proto in protoManager.EnumeratePrototypes<EntityPrototype>())
|
foreach (var proto in protoManager.EnumeratePrototypes<EntityPrototype>())
|
||||||
{
|
{
|
||||||
if (!proto.Components.TryGetValue("StorageFill", out var storageNode) ||
|
if (!proto.TryGetComponent<StorageFillComponent>("StorageFill", out var storage)) continue;
|
||||||
!storageNode.TryGetNode("contents", out YamlSequenceNode? contentsNode)) continue;
|
|
||||||
|
|
||||||
foreach (var child in contentsNode)
|
foreach (var entry in storage.Contents)
|
||||||
{
|
{
|
||||||
if (child is not YamlMappingNode mapping) continue;
|
var name = entry.PrototypeName;
|
||||||
var name = mapping.GetNode("name").AsString();
|
|
||||||
Assert.That(protoManager.HasIndex<EntityPrototype>(name), $"Unable to find StorageFill prototype of {name} in prototype {proto.ID}");
|
|
||||||
|
|
||||||
if (mapping.TryGetNode("amount", out var amount))
|
if (name == null)
|
||||||
{
|
{
|
||||||
Assert.That(amount.AsInt() > 0, $"Specified invalid amount of {amount} for prototype {proto.ID}");
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Assert.That(protoManager.HasIndex<EntityPrototype>(name), $"Unable to find StorageFill prototype of {name} in prototype {proto.ID}");
|
||||||
|
Assert.That(entry.Amount > 0, $"Specified invalid amount of {entry.Amount} for prototype {proto.ID}");
|
||||||
|
Assert.That(entry.SpawnProbability > 0, $"Specified invalid probability of {entry.SpawnProbability} for prototype {proto.ID}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -15,13 +15,14 @@ using Robust.Shared.GameObjects;
|
|||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.AI.Utility.AiLogic
|
namespace Content.Server.AI.Utility.AiLogic
|
||||||
{
|
{
|
||||||
// TODO: Need to split out the IMover stuff for NPC to a generic one that can be used for hoomans as well.
|
// TODO: Need to split out the IMover stuff for NPC to a generic one that can be used for hoomans as well.
|
||||||
[RegisterComponent]
|
[RegisterComponent]
|
||||||
[ComponentReference(typeof(AiControllerComponent)), ComponentReference(typeof(IMoverComponent))]
|
[ComponentReference(typeof(AiControllerComponent)), ComponentReference(typeof(IMoverComponent))]
|
||||||
internal sealed class UtilityAi : AiControllerComponent
|
public sealed class UtilityAi : AiControllerComponent, ISerializationHooks
|
||||||
{
|
{
|
||||||
public override string Name => "UtilityAI";
|
public override string Name => "UtilityAI";
|
||||||
|
|
||||||
@@ -34,6 +35,7 @@ namespace Content.Server.AI.Utility.AiLogic
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The sum of all BehaviorSets gives us what actions the AI can take
|
/// The sum of all BehaviorSets gives us what actions the AI can take
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[field: DataField("behaviorSets")]
|
||||||
public HashSet<string> BehaviorSets { get; } = new();
|
public HashSet<string> BehaviorSets { get; } = new();
|
||||||
|
|
||||||
public List<IAiUtility> AvailableActions { get; set; } = new();
|
public List<IAiUtility> AvailableActions { get; set; } = new();
|
||||||
@@ -62,26 +64,35 @@ namespace Content.Server.AI.Utility.AiLogic
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private bool _isDead;
|
private bool _isDead;
|
||||||
|
|
||||||
public override void ExposeData(ObjectSerializer serializer)
|
/*public void AfterDeserialization()
|
||||||
{
|
{
|
||||||
base.ExposeData(serializer);
|
if (BehaviorSets.Count > 0)
|
||||||
var bSets = serializer.ReadDataField("behaviorSets", new List<string>());
|
|
||||||
|
|
||||||
if (bSets.Count > 0)
|
|
||||||
{
|
{
|
||||||
var behaviorManager = IoCManager.Resolve<INpcBehaviorManager>();
|
var behaviorManager = IoCManager.Resolve<INpcBehaviorManager>();
|
||||||
|
|
||||||
foreach (var bSet in bSets)
|
foreach (var bSet in BehaviorSets)
|
||||||
{
|
{
|
||||||
behaviorManager.AddBehaviorSet(this, bSet, false);
|
behaviorManager.AddBehaviorSet(this, bSet, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
behaviorManager.RebuildActions(this);
|
behaviorManager.RebuildActions(this);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
|
if (BehaviorSets.Count > 0)
|
||||||
|
{
|
||||||
|
var behaviorManager = IoCManager.Resolve<INpcBehaviorManager>();
|
||||||
|
|
||||||
|
foreach (var bSet in BehaviorSets)
|
||||||
|
{
|
||||||
|
behaviorManager.AddBehaviorSet(this, bSet, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
behaviorManager.RebuildActions(this);
|
||||||
|
}
|
||||||
|
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
_planCooldownRemaining = PlanCooldown;
|
_planCooldownRemaining = PlanCooldown;
|
||||||
_blackboard = new Blackboard(Owner);
|
_blackboard = new Blackboard(Owner);
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using YamlDotNet.RepresentationModel;
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
namespace Content.Server.AI.Utility
|
namespace Content.Server.AI.Utility
|
||||||
{
|
{
|
||||||
@@ -12,19 +12,18 @@ namespace Content.Server.AI.Utility
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Name of the BehaviorSet.
|
/// Name of the BehaviorSet.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ID { get; private set; } = default!;
|
[ViewVariables]
|
||||||
|
[field: DataField("id", required: true)]
|
||||||
|
public string ID { get; } = default!;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
|
[field: DataField("parent")]
|
||||||
|
public string? Parent { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Actions that this BehaviorSet grants to the entity.
|
/// Actions that this BehaviorSet grants to the entity.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IReadOnlyList<string> Actions { get; private set; } = default!;
|
[DataField("actions")]
|
||||||
|
public IReadOnlyList<string> Actions { get; private set; } = new List<string>();
|
||||||
public void LoadFrom(YamlMappingNode mapping)
|
|
||||||
{
|
|
||||||
var serializer = YamlObjectSerializer.NewReader(mapping);
|
|
||||||
|
|
||||||
serializer.DataField(this, x => x.ID, "id", string.Empty);
|
|
||||||
serializer.DataField(this, x => x.Actions, "actions", new List<string>());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
using Content.Shared.Actions;
|
using Content.Shared.Actions;
|
||||||
using Content.Shared.Utility;
|
using Content.Shared.Utility;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Actions
|
namespace Content.Server.Actions
|
||||||
{
|
{
|
||||||
@@ -10,16 +10,11 @@ namespace Content.Server.Actions
|
|||||||
/// Just shows a popup message.asd
|
/// Just shows a popup message.asd
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
|
[DataDefinition]
|
||||||
public class DebugInstant : IInstantAction, IInstantItemAction
|
public class DebugInstant : IInstantAction, IInstantItemAction
|
||||||
{
|
{
|
||||||
public string Message { get; private set; }
|
[DataField("message")] public string Message { get; [UsedImplicitly] private set; } = "Instant action used.";
|
||||||
public float Cooldown { get; private set; }
|
[DataField("cooldown")] public float Cooldown { get; [UsedImplicitly] private set; }
|
||||||
|
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
serializer.DataField(this, x => x.Message, "message", "Instant action used.");
|
|
||||||
serializer.DataField(this, x => x.Cooldown, "cooldown", 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DoInstantAction(InstantItemActionEventArgs args)
|
public void DoInstantAction(InstantItemActionEventArgs args)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,17 +1,14 @@
|
|||||||
using Content.Server.Utility;
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Actions;
|
using Content.Shared.Actions;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Actions
|
namespace Content.Server.Actions
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
|
[DataDefinition]
|
||||||
public class DebugTargetEntity : ITargetEntityAction, ITargetEntityItemAction
|
public class DebugTargetEntity : ITargetEntityAction, ITargetEntityItemAction
|
||||||
{
|
{
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DoTargetEntityAction(TargetEntityItemActionEventArgs args)
|
public void DoTargetEntityAction(TargetEntityItemActionEventArgs args)
|
||||||
{
|
{
|
||||||
args.Performer.PopupMessageEveryone(args.Item.Name + ": Clicked " +
|
args.Performer.PopupMessageEveryone(args.Item.Name + ": Clicked " +
|
||||||
|
|||||||
@@ -1,17 +1,14 @@
|
|||||||
using Content.Server.Utility;
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Actions;
|
using Content.Shared.Actions;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Actions
|
namespace Content.Server.Actions
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
|
[DataDefinition]
|
||||||
public class DebugTargetPoint : ITargetPointAction, ITargetPointItemAction
|
public class DebugTargetPoint : ITargetPointAction, ITargetPointItemAction
|
||||||
{
|
{
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DoTargetPointAction(TargetPointItemActionEventArgs args)
|
public void DoTargetPointAction(TargetPointItemActionEventArgs args)
|
||||||
{
|
{
|
||||||
args.Performer.PopupMessageEveryone(args.Item.Name + ": Clicked local position " +
|
args.Performer.PopupMessageEveryone(args.Item.Name + ": Clicked local position " +
|
||||||
|
|||||||
@@ -1,21 +1,16 @@
|
|||||||
using Content.Server.Utility;
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Actions;
|
using Content.Shared.Actions;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Actions
|
namespace Content.Server.Actions
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
|
[DataDefinition]
|
||||||
public class DebugToggle : IToggleAction, IToggleItemAction
|
public class DebugToggle : IToggleAction, IToggleItemAction
|
||||||
{
|
{
|
||||||
public string MessageOn { get; private set; }
|
[DataField("messageOn")] public string MessageOn { get; private set; } = "on!";
|
||||||
public string MessageOff { get; private set; }
|
[DataField("messageOff")] public string MessageOff { get; private set; } = "off!";
|
||||||
|
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
serializer.DataField(this, x => x.MessageOn, "messageOn", "on!");
|
|
||||||
serializer.DataField(this, x => x.MessageOff, "messageOff", "off!");
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool DoToggleAction(ToggleItemActionEventArgs args)
|
public bool DoToggleAction(ToggleItemActionEventArgs args)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,23 +18,17 @@ using Robust.Shared.IoC;
|
|||||||
using Robust.Shared.Localization;
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Actions
|
namespace Content.Server.Actions
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
|
[DataDefinition]
|
||||||
public class DisarmAction : ITargetEntityAction
|
public class DisarmAction : ITargetEntityAction
|
||||||
{
|
{
|
||||||
private float _failProb;
|
[DataField("failProb")] private float _failProb = 0.4f;
|
||||||
private float _pushProb;
|
[DataField("pushProb")] private float _pushProb = 0.4f;
|
||||||
private float _cooldown;
|
[DataField("cooldown")] private float _cooldown = 1.5f;
|
||||||
|
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
serializer.DataField(ref _failProb, "failProb", 0.4f);
|
|
||||||
serializer.DataField(ref _pushProb, "pushProb", 0.4f);
|
|
||||||
serializer.DataField(ref _cooldown, "cooldown", 1.5f);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DoTargetEntityAction(TargetEntityActionEventArgs args)
|
public void DoTargetEntityAction(TargetEntityActionEventArgs args)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ using Content.Shared.GameObjects.Components.Mobs;
|
|||||||
using Content.Shared.Utility;
|
using Content.Shared.Utility;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Actions
|
namespace Content.Server.Actions
|
||||||
{
|
{
|
||||||
@@ -13,18 +14,12 @@ namespace Content.Server.Actions
|
|||||||
/// Blink lights and scare livings
|
/// Blink lights and scare livings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
|
[DataDefinition]
|
||||||
public class GhostBoo : IInstantAction
|
public class GhostBoo : IInstantAction
|
||||||
{
|
{
|
||||||
private float _radius;
|
[DataField("radius")] private float _radius = 3;
|
||||||
private float _cooldown;
|
[DataField("cooldown")] private float _cooldown = 120;
|
||||||
private int _maxTargets;
|
[DataField("maxTargets")] private int _maxTargets = 3;
|
||||||
|
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
serializer.DataField(ref _radius, "radius", 3);
|
|
||||||
serializer.DataField(ref _cooldown, "cooldown", 120);
|
|
||||||
serializer.DataField(ref _maxTargets, "maxTargets", 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void DoInstantAction(InstantActionEventArgs args)
|
public void DoInstantAction(InstantActionEventArgs args)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
#nullable enable
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Content.Server.GameObjects.Components.Mobs;
|
using Content.Server.GameObjects.Components.Mobs;
|
||||||
using Content.Shared.Actions;
|
using Content.Shared.Actions;
|
||||||
@@ -13,35 +14,29 @@ using Robust.Shared.Audio;
|
|||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Actions
|
namespace Content.Server.Actions
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
|
[DataDefinition]
|
||||||
public class ScreamAction : IInstantAction
|
public class ScreamAction : IInstantAction
|
||||||
{
|
{
|
||||||
private const float Variation = 0.125f;
|
private const float Variation = 0.125f;
|
||||||
private const float Volume = 4f;
|
private const float Volume = 4f;
|
||||||
|
|
||||||
private List<string> _male;
|
[Dependency] private readonly IRobustRandom _random = default!;
|
||||||
private List<string> _female;
|
|
||||||
private string _wilhelm;
|
|
||||||
/// seconds
|
|
||||||
private float _cooldown;
|
|
||||||
|
|
||||||
private IRobustRandom _random;
|
[DataField("male")] private List<string>? _male;
|
||||||
|
[DataField("female")] private List<string>? _female;
|
||||||
|
[DataField("wilhelm")] private string? _wilhelm;
|
||||||
|
|
||||||
|
/// seconds
|
||||||
|
[DataField("cooldown")] private float _cooldown = 10;
|
||||||
|
|
||||||
public ScreamAction()
|
public ScreamAction()
|
||||||
{
|
{
|
||||||
_random = IoCManager.Resolve<IRobustRandom>();
|
IoCManager.InjectDependencies(this);
|
||||||
}
|
|
||||||
|
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
serializer.DataField(ref _male, "male", null);
|
|
||||||
serializer.DataField(ref _female, "female", null);
|
|
||||||
serializer.DataField(ref _wilhelm, "wilhelm", null);
|
|
||||||
serializer.DataField(ref _cooldown, "cooldown", 10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DoInstantAction(InstantActionEventArgs args)
|
public void DoInstantAction(InstantActionEventArgs args)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
using Content.Server.GameObjects.Components.ActionBlocking;
|
using Content.Server.GameObjects.Components.ActionBlocking;
|
||||||
using Content.Shared.Alert;
|
using Content.Shared.Alert;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Alert.Click
|
namespace Content.Server.Alert.Click
|
||||||
{
|
{
|
||||||
@@ -10,10 +10,9 @@ namespace Content.Server.Alert.Click
|
|||||||
/// Try to remove handcuffs from yourself
|
/// Try to remove handcuffs from yourself
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
|
[DataDefinition]
|
||||||
public class RemoveCuffs : IAlertClick
|
public class RemoveCuffs : IAlertClick
|
||||||
{
|
{
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer) {}
|
|
||||||
|
|
||||||
public void AlertClicked(ClickAlertEventArgs args)
|
public void AlertClicked(ClickAlertEventArgs args)
|
||||||
{
|
{
|
||||||
if (args.Player.TryGetComponent(out CuffableComponent? cuffableComponent))
|
if (args.Player.TryGetComponent(out CuffableComponent? cuffableComponent))
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using Content.Server.GameObjects.Components.Atmos;
|
using Content.Server.GameObjects.Components.Atmos;
|
||||||
using Content.Shared.Alert;
|
using Content.Shared.Alert;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Alert.Click
|
namespace Content.Server.Alert.Click
|
||||||
{
|
{
|
||||||
@@ -9,10 +9,9 @@ namespace Content.Server.Alert.Click
|
|||||||
/// Resist fire
|
/// Resist fire
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
|
[DataDefinition]
|
||||||
public class ResistFire : IAlertClick
|
public class ResistFire : IAlertClick
|
||||||
{
|
{
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer) { }
|
|
||||||
|
|
||||||
public void AlertClicked(ClickAlertEventArgs args)
|
public void AlertClicked(ClickAlertEventArgs args)
|
||||||
{
|
{
|
||||||
if (args.Player.TryGetComponent(out FlammableComponent flammable))
|
if (args.Player.TryGetComponent(out FlammableComponent flammable))
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using Content.Server.GameObjects.Components.Movement;
|
using Content.Server.GameObjects.Components.Movement;
|
||||||
using Content.Shared.Alert;
|
using Content.Shared.Alert;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Alert.Click
|
namespace Content.Server.Alert.Click
|
||||||
{
|
{
|
||||||
@@ -9,10 +9,9 @@ namespace Content.Server.Alert.Click
|
|||||||
/// Stop piloting shuttle
|
/// Stop piloting shuttle
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
|
[DataDefinition]
|
||||||
public class StopPiloting : IAlertClick
|
public class StopPiloting : IAlertClick
|
||||||
{
|
{
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer) { }
|
|
||||||
|
|
||||||
public void AlertClicked(ClickAlertEventArgs args)
|
public void AlertClicked(ClickAlertEventArgs args)
|
||||||
{
|
{
|
||||||
if (args.Player.TryGetComponent(out ShuttleControllerComponent controller))
|
if (args.Player.TryGetComponent(out ShuttleControllerComponent controller))
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
using Content.Shared.Alert;
|
using Content.Shared.Alert;
|
||||||
using Content.Shared.GameObjects.Components.Pulling;
|
using Content.Shared.GameObjects.Components.Pulling;
|
||||||
using Content.Shared.GameObjects.EntitySystems;
|
using Content.Shared.GameObjects.EntitySystems;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Alert.Click
|
namespace Content.Server.Alert.Click
|
||||||
{
|
{
|
||||||
@@ -11,10 +11,9 @@ namespace Content.Server.Alert.Click
|
|||||||
/// Stop pulling something
|
/// Stop pulling something
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
|
[DataDefinition]
|
||||||
public class StopPulling : IAlertClick
|
public class StopPulling : IAlertClick
|
||||||
{
|
{
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer) { }
|
|
||||||
|
|
||||||
public void AlertClicked(ClickAlertEventArgs args)
|
public void AlertClicked(ClickAlertEventArgs args)
|
||||||
{
|
{
|
||||||
EntitySystem
|
EntitySystem
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using Content.Server.GameObjects.Components.Buckle;
|
using Content.Server.GameObjects.Components.Buckle;
|
||||||
using Content.Shared.Alert;
|
using Content.Shared.Alert;
|
||||||
using Robust.Shared.Serialization;
|
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Alert.Click
|
namespace Content.Server.Alert.Click
|
||||||
{
|
{
|
||||||
@@ -9,10 +9,9 @@ namespace Content.Server.Alert.Click
|
|||||||
/// Unbuckles if player is currently buckled.
|
/// Unbuckles if player is currently buckled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
|
[DataDefinition]
|
||||||
public class Unbuckle : IAlertClick
|
public class Unbuckle : IAlertClick
|
||||||
{
|
{
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer) { }
|
|
||||||
|
|
||||||
public void AlertClicked(ClickAlertEventArgs args)
|
public void AlertClicked(ClickAlertEventArgs args)
|
||||||
{
|
{
|
||||||
if (args.Player.TryGetComponent(out BuckleComponent buckle))
|
if (args.Player.TryGetComponent(out BuckleComponent buckle))
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ using Content.Shared.Atmos;
|
|||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
namespace Content.Server.Atmos
|
namespace Content.Server.Atmos
|
||||||
@@ -18,28 +19,28 @@ namespace Content.Server.Atmos
|
|||||||
/// A general-purpose, variable volume gas mixture.
|
/// A general-purpose, variable volume gas mixture.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class GasMixture : IExposeData, IEquatable<GasMixture>, ICloneable
|
[DataDefinition]
|
||||||
|
public class GasMixture : IEquatable<GasMixture>, ICloneable, ISerializationHooks
|
||||||
{
|
{
|
||||||
private readonly AtmosphereSystem _atmosphereSystem;
|
private AtmosphereSystem? _atmosphereSystem;
|
||||||
|
|
||||||
public static GasMixture SpaceGas => new() {Volume = 2500f, Immutable = true, Temperature = Atmospherics.TCMB};
|
public static GasMixture SpaceGas => new() {Volume = 2500f, Immutable = true, Temperature = Atmospherics.TCMB};
|
||||||
|
|
||||||
// This must always have a length that is a multiple of 4 for SIMD acceleration.
|
// This must always have a length that is a multiple of 4 for SIMD acceleration.
|
||||||
[ViewVariables]
|
[DataField("moles")] [ViewVariables] private float[] _moles = new float[Atmospherics.AdjustedNumberOfGases];
|
||||||
private float[] _moles;
|
|
||||||
|
|
||||||
[ViewVariables]
|
[DataField("molesArchived")] [ViewVariables]
|
||||||
private float[] _molesArchived;
|
private float[] _molesArchived = new float[Atmospherics.AdjustedNumberOfGases];
|
||||||
|
|
||||||
[ViewVariables]
|
[DataField("temperature")] [ViewVariables]
|
||||||
private float _temperature = Atmospherics.TCMB;
|
private float _temperature = Atmospherics.TCMB;
|
||||||
|
|
||||||
public IReadOnlyList<float> Gases => _moles;
|
public IReadOnlyList<float> Gases => _moles;
|
||||||
|
|
||||||
[ViewVariables]
|
[DataField("immutable")] [ViewVariables]
|
||||||
public bool Immutable { get; private set; }
|
public bool Immutable { get; private set; }
|
||||||
|
|
||||||
[ViewVariables]
|
[DataField("lastShare")] [ViewVariables]
|
||||||
public float LastShare { get; private set; }
|
public float LastShare { get; private set; }
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
@@ -55,6 +56,7 @@ namespace Content.Server.Atmos
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
_atmosphereSystem ??= EntitySystem.Get<AtmosphereSystem>();
|
||||||
Span<float> tmp = stackalloc float[_moles.Length];
|
Span<float> tmp = stackalloc float[_moles.Length];
|
||||||
NumericsHelpers.Multiply(_moles, _atmosphereSystem.GasSpecificHeats, tmp);
|
NumericsHelpers.Multiply(_moles, _atmosphereSystem.GasSpecificHeats, tmp);
|
||||||
|
|
||||||
@@ -68,6 +70,7 @@ namespace Content.Server.Atmos
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
_atmosphereSystem ??= EntitySystem.Get<AtmosphereSystem>();
|
||||||
Span<float> tmp = stackalloc float[_moles.Length];
|
Span<float> tmp = stackalloc float[_moles.Length];
|
||||||
NumericsHelpers.Multiply(_molesArchived, _atmosphereSystem.GasSpecificHeats, tmp);
|
NumericsHelpers.Multiply(_molesArchived, _atmosphereSystem.GasSpecificHeats, tmp);
|
||||||
|
|
||||||
@@ -106,10 +109,10 @@ namespace Content.Server.Atmos
|
|||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public float ThermalEnergy => Temperature * HeatCapacity;
|
public float ThermalEnergy => Temperature * HeatCapacity;
|
||||||
|
|
||||||
[ViewVariables]
|
[DataField("temperatureArchived")] [ViewVariables]
|
||||||
public float TemperatureArchived { get; private set; }
|
public float TemperatureArchived { get; private set; }
|
||||||
|
|
||||||
[ViewVariables]
|
[DataField("volume")] [ViewVariables]
|
||||||
public float Volume { get; set; }
|
public float Volume { get; set; }
|
||||||
|
|
||||||
public GasMixture() : this(null)
|
public GasMixture() : this(null)
|
||||||
@@ -118,9 +121,7 @@ namespace Content.Server.Atmos
|
|||||||
|
|
||||||
public GasMixture(AtmosphereSystem? atmosphereSystem)
|
public GasMixture(AtmosphereSystem? atmosphereSystem)
|
||||||
{
|
{
|
||||||
_atmosphereSystem = atmosphereSystem ?? EntitySystem.Get<AtmosphereSystem>();
|
_atmosphereSystem = atmosphereSystem;
|
||||||
_moles = new float[Atmospherics.AdjustedNumberOfGases];
|
|
||||||
_molesArchived = new float[Atmospherics.AdjustedNumberOfGases];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public GasMixture(float volume, AtmosphereSystem? atmosphereSystem = null): this(atmosphereSystem)
|
public GasMixture(float volume, AtmosphereSystem? atmosphereSystem = null): this(atmosphereSystem)
|
||||||
@@ -262,6 +263,7 @@ namespace Content.Server.Atmos
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public float Share(GasMixture sharer, int atmosAdjacentTurfs)
|
public float Share(GasMixture sharer, int atmosAdjacentTurfs)
|
||||||
{
|
{
|
||||||
|
_atmosphereSystem ??= EntitySystem.Get<AtmosphereSystem>();
|
||||||
var temperatureDelta = TemperatureArchived - sharer.TemperatureArchived;
|
var temperatureDelta = TemperatureArchived - sharer.TemperatureArchived;
|
||||||
var absTemperatureDelta = Math.Abs(temperatureDelta);
|
var absTemperatureDelta = Math.Abs(temperatureDelta);
|
||||||
var oldHeatCapacity = 0f;
|
var oldHeatCapacity = 0f;
|
||||||
@@ -485,6 +487,7 @@ namespace Content.Server.Atmos
|
|||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public ReactionResult React(IGasMixtureHolder holder)
|
public ReactionResult React(IGasMixtureHolder holder)
|
||||||
{
|
{
|
||||||
|
_atmosphereSystem ??= EntitySystem.Get<AtmosphereSystem>();
|
||||||
var reaction = ReactionResult.NoReaction;
|
var reaction = ReactionResult.NoReaction;
|
||||||
var temperature = Temperature;
|
var temperature = Temperature;
|
||||||
var energy = ThermalEnergy;
|
var energy = ThermalEnergy;
|
||||||
@@ -533,16 +536,8 @@ namespace Content.Server.Atmos
|
|||||||
NumericsHelpers.Multiply(_moles, multiplier);
|
NumericsHelpers.Multiply(_moles, multiplier);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
void ISerializationHooks.AfterDeserialization()
|
||||||
{
|
{
|
||||||
serializer.DataField(this, x => x.Immutable, "immutable", false);
|
|
||||||
serializer.DataField(this, x => x.Volume, "volume", 0f);
|
|
||||||
serializer.DataField(this, x => x.LastShare, "lastShare", 0f);
|
|
||||||
serializer.DataField(this, x => x.TemperatureArchived, "temperatureArchived", 0f);
|
|
||||||
serializer.DataField(ref _moles, "moles", new float[Atmospherics.AdjustedNumberOfGases]);
|
|
||||||
serializer.DataField(ref _molesArchived, "molesArchived", new float[Atmospherics.AdjustedNumberOfGases]);
|
|
||||||
serializer.DataField(ref _temperature, "temperature", Atmospherics.TCMB);
|
|
||||||
|
|
||||||
// The arrays MUST have a specific length.
|
// The arrays MUST have a specific length.
|
||||||
Array.Resize(ref _moles, Atmospherics.AdjustedNumberOfGases);
|
Array.Resize(ref _moles, Atmospherics.AdjustedNumberOfGases);
|
||||||
Array.Resize(ref _molesArchived, Atmospherics.AdjustedNumberOfGases);
|
Array.Resize(ref _molesArchived, Atmospherics.AdjustedNumberOfGases);
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
|
#nullable enable
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Content.Server.Interfaces;
|
using Content.Server.Interfaces;
|
||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using YamlDotNet.RepresentationModel;
|
using Robust.Shared.ViewVariables;
|
||||||
|
|
||||||
namespace Content.Server.Atmos.Reactions
|
namespace Content.Server.Atmos.Reactions
|
||||||
{
|
{
|
||||||
@@ -25,45 +26,43 @@ namespace Content.Server.Atmos.Reactions
|
|||||||
[Prototype("gasReaction")]
|
[Prototype("gasReaction")]
|
||||||
public class GasReactionPrototype : IPrototype
|
public class GasReactionPrototype : IPrototype
|
||||||
{
|
{
|
||||||
public string ID { get; private set; }
|
[ViewVariables]
|
||||||
|
[field: DataField("id", required: true)]
|
||||||
|
public string ID { get; } = default!;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
|
[field: DataField("parent")]
|
||||||
|
public string? Parent { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Minimum gas amount requirements.
|
/// Minimum gas amount requirements.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float[] MinimumRequirements { get; private set; }
|
[DataField("minimumRequirements")]
|
||||||
|
public float[] MinimumRequirements { get; private set; } = new float[Atmospherics.TotalNumberOfGases];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Minimum temperature requirement.
|
/// Minimum temperature requirement.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float MinimumTemperatureRequirement { get; private set; }
|
[DataField("minimumTemperature")]
|
||||||
|
public float MinimumTemperatureRequirement { get; private set; } = Atmospherics.TCMB;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Minimum energy requirement.
|
/// Minimum energy requirement.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[DataField("minimumEnergy")]
|
||||||
public float MinimumEnergyRequirement { get; private set; }
|
public float MinimumEnergyRequirement { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Lower numbers are checked/react later than higher numbers.
|
/// Lower numbers are checked/react later than higher numbers.
|
||||||
/// If two reactions have the same priority, they may happen in either order.
|
/// If two reactions have the same priority, they may happen in either order.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[DataField("priority")]
|
||||||
public int Priority { get; private set; }
|
public int Priority { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A list of effects this will produce.
|
/// A list of effects this will produce.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private List<IGasReactionEffect> _effects;
|
[DataField("effects")] private List<IGasReactionEffect> _effects = new();
|
||||||
|
|
||||||
public void LoadFrom(YamlMappingNode mapping)
|
|
||||||
{
|
|
||||||
var serializer = YamlObjectSerializer.NewReader(mapping);
|
|
||||||
|
|
||||||
serializer.DataField(this, x => x.ID, "id", string.Empty);
|
|
||||||
serializer.DataField(this, x => x.Priority, "priority", 100);
|
|
||||||
serializer.DataField(this, x => x.MinimumRequirements, "minimumRequirements", new float[Atmospherics.TotalNumberOfGases]);
|
|
||||||
serializer.DataField(this, x => x.MinimumTemperatureRequirement, "minimumTemperature", Atmospherics.TCMB);
|
|
||||||
serializer.DataField(this, x => x.MinimumEnergyRequirement, "minimumEnergy", 0f);
|
|
||||||
serializer.DataField(ref _effects, "effects", new List<IGasReactionEffect>());
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder holder, GridTileLookupSystem gridLookup)
|
public ReactionResult React(GasMixture mixture, IGasMixtureHolder holder, GridTileLookupSystem gridLookup)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,11 +5,12 @@ using Content.Server.Utility;
|
|||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Atmos.Reactions
|
namespace Content.Server.Atmos.Reactions
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
|
[DataDefinition]
|
||||||
public class PlasmaFireReaction : IGasReactionEffect
|
public class PlasmaFireReaction : IGasReactionEffect
|
||||||
{
|
{
|
||||||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, GridTileLookupSystem gridTileLookup)
|
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, GridTileLookupSystem gridTileLookup)
|
||||||
@@ -87,9 +88,5 @@ namespace Content.Server.Atmos.Reactions
|
|||||||
|
|
||||||
return mixture.ReactionResults[GasReaction.Fire] != 0 ? ReactionResult.Reacting : ReactionResult.NoReaction;
|
return mixture.ReactionResults[GasReaction.Fire] != 0 ? ReactionResult.Reacting : ReactionResult.NoReaction;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,17 +4,14 @@ using Content.Server.Utility;
|
|||||||
using Content.Shared.Atmos;
|
using Content.Shared.Atmos;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Atmos.Reactions
|
namespace Content.Server.Atmos.Reactions
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
|
[DataDefinition]
|
||||||
public class TritiumFireReaction : IGasReactionEffect
|
public class TritiumFireReaction : IGasReactionEffect
|
||||||
{
|
{
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, GridTileLookupSystem gridTileLookup)
|
public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder, GridTileLookupSystem gridTileLookup)
|
||||||
{
|
{
|
||||||
var energyReleased = 0f;
|
var energyReleased = 0f;
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
#nullable enable
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -15,10 +16,9 @@ using Robust.Shared.Map;
|
|||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using Robust.Shared.Utility;
|
using Robust.Shared.Utility;
|
||||||
using Robust.Shared.ViewVariables;
|
using Robust.Shared.ViewVariables;
|
||||||
using YamlDotNet.RepresentationModel;
|
|
||||||
|
|
||||||
namespace Content.Server.Botany
|
namespace Content.Server.Botany
|
||||||
{
|
{
|
||||||
@@ -59,19 +59,29 @@ namespace Content.Server.Botany
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
[DataDefinition]
|
||||||
public struct SeedChemQuantity
|
public struct SeedChemQuantity
|
||||||
{
|
{
|
||||||
|
[DataField("Min")]
|
||||||
public int Min;
|
public int Min;
|
||||||
|
[DataField("Max")]
|
||||||
public int Max;
|
public int Max;
|
||||||
|
[DataField("PotencyDivisor")]
|
||||||
public int PotencyDivisor;
|
public int PotencyDivisor;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Prototype("seed")]
|
[Prototype("seed")]
|
||||||
public class Seed : IPrototype, IExposeData
|
public class Seed : IPrototype
|
||||||
{
|
{
|
||||||
private const string SeedPrototype = "SeedBase";
|
private const string SeedPrototype = "SeedBase";
|
||||||
|
|
||||||
public string ID { get; private set; }
|
[ViewVariables]
|
||||||
|
[field: DataField("id", required: true)]
|
||||||
|
public string ID { get; private init; } = default!;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
|
[field: DataField("parent")]
|
||||||
|
public string? Parent { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Unique identifier of this seed. Do NOT set this.
|
/// Unique identifier of this seed. Do NOT set this.
|
||||||
@@ -79,45 +89,84 @@ namespace Content.Server.Botany
|
|||||||
public int Uid { get; internal set; } = -1;
|
public int Uid { get; internal set; } = -1;
|
||||||
|
|
||||||
#region Tracking
|
#region Tracking
|
||||||
[ViewVariables] public string Name { get; set; }
|
|
||||||
[ViewVariables] public string SeedName { get; set; }
|
[ViewVariables] [DataField("name")] public string Name { get; set; } = string.Empty;
|
||||||
[ViewVariables] public string SeedNoun { get; set; }
|
[ViewVariables] [DataField("seedName")] public string SeedName { get; set; } = string.Empty;
|
||||||
[ViewVariables] public string DisplayName { get; set; }
|
|
||||||
[ViewVariables] public bool RoundStart { get; private set; }
|
[ViewVariables]
|
||||||
[ViewVariables] public bool Mysterious { get; set; }
|
[DataField("seedNoun")]
|
||||||
[ViewVariables] public bool Immutable { get; set; }
|
public string SeedNoun { get; set; } = "seeds";
|
||||||
|
[ViewVariables] [DataField("displayName")] public string DisplayName { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
|
[DataField("roundStart")]
|
||||||
|
public bool RoundStart { get; private set; } = true;
|
||||||
|
[ViewVariables] [DataField("mysterious")] public bool Mysterious { get; set; }
|
||||||
|
[ViewVariables] [DataField("immutable")] public bool Immutable { get; set; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Output
|
#region Output
|
||||||
[ViewVariables] public List<string> ProductPrototypes { get; set; }
|
|
||||||
[ViewVariables] public Dictionary<string, SeedChemQuantity> Chemicals { get; set; }
|
[ViewVariables]
|
||||||
[ViewVariables] public Dictionary<Gas, float> ConsumeGasses { get; set; }
|
[DataField("productPrototypes")]
|
||||||
[ViewVariables]public Dictionary<Gas, float> ExudeGasses { get; set; }
|
public List<string> ProductPrototypes { get; set; } = new();
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
|
[DataField("chemicals")]
|
||||||
|
public Dictionary<string, SeedChemQuantity> Chemicals { get; set; } = new();
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
|
[DataField("consumeGasses")]
|
||||||
|
public Dictionary<Gas, float> ConsumeGasses { get; set; } = new();
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
|
[DataField("exudeGasses")]
|
||||||
|
public Dictionary<Gas, float> ExudeGasses { get; set; } = new();
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Tolerances
|
#region Tolerances
|
||||||
[ViewVariables] public float NutrientConsumption { get; set; }
|
|
||||||
[ViewVariables] public float WaterConsumption { get; set; }
|
[ViewVariables]
|
||||||
[ViewVariables] public float IdealHeat { get; set; }
|
[DataField("nutrientConsumption")]
|
||||||
[ViewVariables] public float HeatTolerance { get; set; }
|
public float NutrientConsumption { get; set; } = 0.25f;
|
||||||
[ViewVariables] public float IdealLight { get; set; }
|
|
||||||
[ViewVariables] public float LightTolerance { get; set; }
|
[ViewVariables] [DataField("waterConsumption")] public float WaterConsumption { get; set; } = 3f;
|
||||||
[ViewVariables] public float ToxinsTolerance { get; set; }
|
[ViewVariables] [DataField("idealHeat")] public float IdealHeat { get; set; } = 293f;
|
||||||
[ViewVariables] public float LowPressureTolerance { get; set; }
|
[ViewVariables] [DataField("heatTolerance")] public float HeatTolerance { get; set; } = 20f;
|
||||||
[ViewVariables] public float HighPressureTolerance { get; set; }
|
[ViewVariables] [DataField("idealLight")] public float IdealLight { get; set; } = 7f;
|
||||||
[ViewVariables] public float PestTolerance { get; set; }
|
[ViewVariables] [DataField("lightTolerance")] public float LightTolerance { get; set; } = 5f;
|
||||||
[ViewVariables] public float WeedTolerance { get; set; }
|
[ViewVariables] [DataField("toxinsTolerance")] public float ToxinsTolerance { get; set; } = 4f;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
|
[DataField("lowPressureTolerance")]
|
||||||
|
public float LowPressureTolerance { get; set; } = 25f;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
|
[DataField("highPressureTolerance")]
|
||||||
|
public float HighPressureTolerance { get; set; } = 200f;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
|
[DataField("pestTolerance")]
|
||||||
|
public float PestTolerance { get; set; } = 5f;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
|
[DataField("weedTolerance")]
|
||||||
|
public float WeedTolerance { get; set; } = 5f;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region General traits
|
#region General traits
|
||||||
[ViewVariables] public float Endurance { get; set; }
|
|
||||||
[ViewVariables] public int Yield { get; set; }
|
[ViewVariables]
|
||||||
[ViewVariables] public float Lifespan { get; set; }
|
[DataField("endurance")]
|
||||||
[ViewVariables] public float Maturation { get; set; }
|
public float Endurance { get; set; } = 100f;
|
||||||
[ViewVariables] public float Production { get; set; }
|
[ViewVariables] [DataField("yield")] public int Yield { get; set; }
|
||||||
[ViewVariables] public int GrowthStages { get; set; }
|
[ViewVariables] [DataField("lifespan")] public float Lifespan { get; set; }
|
||||||
[ViewVariables] public HarvestType HarvestRepeat { get; set; }
|
[ViewVariables] [DataField("maturation")] public float Maturation { get; set; }
|
||||||
[ViewVariables] public float Potency { get; set; }
|
[ViewVariables] [DataField("production")] public float Production { get; set; }
|
||||||
|
[ViewVariables] [DataField("growthStages")] public int GrowthStages { get; set; } = 6;
|
||||||
|
[ViewVariables] [DataField("harvestRepeat")] public HarvestType HarvestRepeat { get; set; } = HarvestType.NoRepeat;
|
||||||
|
|
||||||
|
[ViewVariables] [DataField("potency")] public float Potency { get; set; } = 1f;
|
||||||
// No, I'm not removing these.
|
// No, I'm not removing these.
|
||||||
//public PlantSpread Spread { get; set; }
|
//public PlantSpread Spread { get; set; }
|
||||||
//public PlantMutation Mutation { get; set; }
|
//public PlantMutation Mutation { get; set; }
|
||||||
@@ -127,72 +176,36 @@ namespace Content.Server.Botany
|
|||||||
//public bool Hematophage { get; set; }
|
//public bool Hematophage { get; set; }
|
||||||
//public bool Thorny { get; set; }
|
//public bool Thorny { get; set; }
|
||||||
//public bool Stinging { get; set; }
|
//public bool Stinging { get; set; }
|
||||||
|
[DataField("ligneous")]
|
||||||
public bool Ligneous { get; set; }
|
public bool Ligneous { get; set; }
|
||||||
// public bool Teleporting { get; set; }
|
// public bool Teleporting { get; set; }
|
||||||
// public PlantJuicy Juicy { get; set; }
|
// public PlantJuicy Juicy { get; set; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Cosmetics
|
#region Cosmetics
|
||||||
[ViewVariables]public ResourcePath PlantRsi { get; set; }
|
|
||||||
[ViewVariables] public string PlantIconState { get; set; }
|
[ViewVariables]
|
||||||
[ViewVariables] public bool Bioluminescent { get; set; }
|
[DataField("plantRsi", required: true)]
|
||||||
[ViewVariables] public Color BioluminescentColor { get; set; }
|
public ResourcePath PlantRsi { get; set; } = default!;
|
||||||
[ViewVariables] public string SplatPrototype { get; set; }
|
|
||||||
|
[ViewVariables]
|
||||||
|
[DataField("plantIconState")]
|
||||||
|
public string PlantIconState { get; set; } = "produce";
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
|
[DataField("bioluminescent")]
|
||||||
|
public bool Bioluminescent { get; set; }
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
|
[DataField("bioluminescentColor")]
|
||||||
|
public Color BioluminescentColor { get; set; } = Color.White;
|
||||||
|
|
||||||
|
[ViewVariables]
|
||||||
|
[DataField("splatPrototype")]
|
||||||
|
public string? SplatPrototype { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
InternalExposeData(serializer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void InternalExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
serializer.DataField(this, x => x.ID, "id", string.Empty);
|
|
||||||
serializer.DataField(this, x => x.Name, "name", string.Empty);
|
|
||||||
serializer.DataField(this, x => x.SeedName, "seedName", string.Empty);
|
|
||||||
serializer.DataField(this, x => x.SeedNoun, "seedNoun", "seeds");
|
|
||||||
serializer.DataField(this, x => x.DisplayName, "displayName", string.Empty);
|
|
||||||
serializer.DataField(this, x => x.RoundStart, "roundStart", true);
|
|
||||||
serializer.DataField(this, x => x.Mysterious, "mysterious", false);
|
|
||||||
serializer.DataField(this, x => x.Immutable, "immutable", false);
|
|
||||||
serializer.DataField(this, x => x.ProductPrototypes, "productPrototypes", new List<string>());
|
|
||||||
serializer.DataField(this, x => x.Chemicals, "chemicals", new Dictionary<string, SeedChemQuantity>());
|
|
||||||
serializer.DataField(this, x => x.ConsumeGasses, "consumeGasses", new Dictionary<Gas, float>());
|
|
||||||
serializer.DataField(this, x => x.ExudeGasses, "exudeGasses", new Dictionary<Gas, float>());
|
|
||||||
serializer.DataField(this, x => x.NutrientConsumption, "nutrientConsumption", 0.25f);
|
|
||||||
serializer.DataField(this, x => x.WaterConsumption, "waterConsumption", 3f);
|
|
||||||
serializer.DataField(this, x => x.IdealHeat, "idealHeat", 293f);
|
|
||||||
serializer.DataField(this, x => x.HeatTolerance, "heatTolerance", 20f);
|
|
||||||
serializer.DataField(this, x => x.IdealLight, "idealLight", 7f);
|
|
||||||
serializer.DataField(this, x => x.LightTolerance, "lightTolerance", 5f);
|
|
||||||
serializer.DataField(this, x => x.ToxinsTolerance, "toxinsTolerance", 4f);
|
|
||||||
serializer.DataField(this, x => x.LowPressureTolerance, "lowPressureTolerance", 25f);
|
|
||||||
serializer.DataField(this, x => x.HighPressureTolerance, "highPressureTolerance", 200f);
|
|
||||||
serializer.DataField(this, x => x.PestTolerance, "pestTolerance", 5f);
|
|
||||||
serializer.DataField(this, x => x.WeedTolerance, "weedTolerance", 5f);
|
|
||||||
serializer.DataField(this, x => x.Endurance, "endurance", 100f);
|
|
||||||
serializer.DataField(this, x => x.Yield, "yield", 0);
|
|
||||||
serializer.DataField(this, x => x.Lifespan, "lifespan", 0f);
|
|
||||||
serializer.DataField(this, x => x.Maturation, "maturation", 0f);
|
|
||||||
serializer.DataField(this, x => x.Production, "production", 0f);
|
|
||||||
serializer.DataField(this, x => x.GrowthStages, "growthStages", 6);
|
|
||||||
serializer.DataField(this, x => x.HarvestRepeat, "harvestRepeat", HarvestType.NoRepeat);
|
|
||||||
serializer.DataField(this, x => x.Potency, "potency", 1f);
|
|
||||||
serializer.DataField(this, x => x.Ligneous, "ligneous", false);
|
|
||||||
serializer.DataField(this, x => x.PlantRsi, "plantRsi", null);
|
|
||||||
serializer.DataField(this, x => x.PlantIconState, "plantIconState", "produce");
|
|
||||||
serializer.DataField(this, x => x.Bioluminescent, "bioluminescent", false);
|
|
||||||
serializer.DataField(this, x => x.BioluminescentColor, "bioluminescentColor", Color.White);
|
|
||||||
serializer.DataField(this, x => x.SplatPrototype, "splatPrototype", string.Empty);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void LoadFrom(YamlMappingNode mapping)
|
|
||||||
{
|
|
||||||
var serializer = YamlObjectSerializer.NewReader(mapping);
|
|
||||||
InternalExposeData(serializer);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Seed Clone()
|
public Seed Clone()
|
||||||
{
|
{
|
||||||
var newSeed = new Seed()
|
var newSeed = new Seed()
|
||||||
@@ -240,7 +253,7 @@ namespace Content.Server.Botany
|
|||||||
return newSeed;
|
return newSeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEntity SpawnSeedPacket(EntityCoordinates transformCoordinates, IEntityManager entityManager = null)
|
public IEntity SpawnSeedPacket(EntityCoordinates transformCoordinates, IEntityManager? entityManager = null)
|
||||||
{
|
{
|
||||||
entityManager ??= IoCManager.Resolve<IEntityManager>();
|
entityManager ??= IoCManager.Resolve<IEntityManager>();
|
||||||
|
|
||||||
@@ -249,7 +262,7 @@ namespace Content.Server.Botany
|
|||||||
var seedComp = seed.EnsureComponent<SeedComponent>();
|
var seedComp = seed.EnsureComponent<SeedComponent>();
|
||||||
seedComp.Seed = this;
|
seedComp.Seed = this;
|
||||||
|
|
||||||
if (seed.TryGetComponent(out SpriteComponent sprite))
|
if (seed.TryGetComponent(out SpriteComponent? sprite))
|
||||||
{
|
{
|
||||||
// Seed state will always be seed. Blame the spriter if that's not the case!
|
// Seed state will always be seed. Blame the spriter if that's not the case!
|
||||||
sprite.LayerSetSprite(0, new SpriteSpecifier.Rsi(PlantRsi, "seed"));
|
sprite.LayerSetSprite(0, new SpriteSpecifier.Rsi(PlantRsi, "seed"));
|
||||||
@@ -346,7 +359,7 @@ namespace Content.Server.Botany
|
|||||||
return Clone();
|
return Clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CheckHarvest(IEntity user, IEntity held = null)
|
public bool CheckHarvest(IEntity user, IEntity? held = null)
|
||||||
{
|
{
|
||||||
return (!Ligneous || (Ligneous && held != null && held.HasTag("BotanySharp")));
|
return (!Ligneous || (Ligneous && held != null && held.HasTag("BotanySharp")));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
using Content.Shared.Chemistry;
|
using Content.Shared.Chemistry;
|
||||||
using Content.Shared.Interfaces.Chemistry;
|
using Content.Shared.Interfaces.Chemistry;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Chemistry.Metabolism
|
namespace Content.Server.Chemistry.Metabolism
|
||||||
{
|
{
|
||||||
@@ -10,21 +10,16 @@ namespace Content.Server.Chemistry.Metabolism
|
|||||||
/// Default metabolism for drink reagents. Attempts to find a ThirstComponent on the target,
|
/// Default metabolism for drink reagents. Attempts to find a ThirstComponent on the target,
|
||||||
/// and to update it's thirst values.
|
/// and to update it's thirst values.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[DataDefinition]
|
||||||
public class DefaultDrink : IMetabolizable
|
public class DefaultDrink : IMetabolizable
|
||||||
{
|
{
|
||||||
//Rate of metabolism in units / second
|
//Rate of metabolism in units / second
|
||||||
private ReagentUnit _metabolismRate;
|
[DataField("rate")]
|
||||||
public ReagentUnit MetabolismRate => _metabolismRate;
|
public ReagentUnit MetabolismRate { get; set; } = ReagentUnit.New(1);
|
||||||
|
|
||||||
//How much thirst is satiated when 1u of the reagent is metabolized
|
//How much thirst is satiated when 1u of the reagent is metabolized
|
||||||
private float _hydrationFactor;
|
[DataField("hydrationFactor")]
|
||||||
public float HydrationFactor => _hydrationFactor;
|
public float HydrationFactor { get; set; } = 30.0f;
|
||||||
|
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
serializer.DataField(ref _metabolismRate, "rate", ReagentUnit.New(1));
|
|
||||||
serializer.DataField(ref _hydrationFactor, "nutrimentFactor", 30.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Remove reagent at set rate, satiate thirst if a ThirstComponent can be found
|
//Remove reagent at set rate, satiate thirst if a ThirstComponent can be found
|
||||||
ReagentUnit IMetabolizable.Metabolize(IEntity solutionEntity, string reagentId, float tickTime)
|
ReagentUnit IMetabolizable.Metabolize(IEntity solutionEntity, string reagentId, float tickTime)
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
using Content.Shared.Chemistry;
|
using Content.Shared.Chemistry;
|
||||||
using Content.Shared.Interfaces.Chemistry;
|
using Content.Shared.Interfaces.Chemistry;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Chemistry.Metabolism
|
namespace Content.Server.Chemistry.Metabolism
|
||||||
{
|
{
|
||||||
@@ -10,21 +10,18 @@ namespace Content.Server.Chemistry.Metabolism
|
|||||||
/// Default metabolism for food reagents. Attempts to find a HungerComponent on the target,
|
/// Default metabolism for food reagents. Attempts to find a HungerComponent on the target,
|
||||||
/// and to update it's hunger values.
|
/// and to update it's hunger values.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[DataDefinition]
|
||||||
public class DefaultFood : IMetabolizable
|
public class DefaultFood : IMetabolizable
|
||||||
{
|
{
|
||||||
//Rate of metabolism in units / second
|
/// <summary>
|
||||||
private ReagentUnit _metabolismRate;
|
/// Rate of metabolism in units / second
|
||||||
public ReagentUnit MetabolismRate => _metabolismRate;
|
/// </summary>
|
||||||
|
[DataField("rate")] public ReagentUnit MetabolismRate { get; private set; } = ReagentUnit.New(1.0);
|
||||||
|
|
||||||
//How much hunger is satiated when 1u of the reagent is metabolized
|
/// <summary>
|
||||||
private float _nutritionFactor;
|
/// How much hunger is satiated when 1u of the reagent is metabolized
|
||||||
public float NutritionFactor => _nutritionFactor;
|
/// </summary>
|
||||||
|
[DataField("nutritionFactor")] public float NutritionFactor { get; set; } = 30.0f;
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
serializer.DataField(ref _metabolismRate, "rate", ReagentUnit.New(1.0));
|
|
||||||
serializer.DataField(ref _nutritionFactor, "nutrimentFactor", 30.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
//Remove reagent at set rate, satiate hunger if a HungerComponent can be found
|
//Remove reagent at set rate, satiate hunger if a HungerComponent can be found
|
||||||
ReagentUnit IMetabolizable.Metabolize(IEntity solutionEntity, string reagentId, float tickTime)
|
ReagentUnit IMetabolizable.Metabolize(IEntity solutionEntity, string reagentId, float tickTime)
|
||||||
|
|||||||
@@ -5,22 +5,17 @@ using Content.Shared.Interfaces.Chemistry;
|
|||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Chemistry.PlantMetabolism
|
namespace Content.Server.Chemistry.PlantMetabolism
|
||||||
{
|
{
|
||||||
|
[ImplicitDataDefinitionForInheritors]
|
||||||
public abstract class AdjustAttribute : IPlantMetabolizable
|
public abstract class AdjustAttribute : IPlantMetabolizable
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||||
|
|
||||||
public float Amount { get; private set; }
|
[DataField("amount")] public float Amount { get; protected set; } = 1;
|
||||||
public float Prob { get; private set; }
|
[DataField("prob")] public float Prob { get; protected set; } = 1; // = (80);
|
||||||
|
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
serializer.DataField(this, x => x.Amount, "amount", 1f);
|
|
||||||
serializer.DataField(this, x => x.Prob, "prob", 1f);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks if the plant holder can metabolize the reagent or not. Checks if it has an alive plant by default.
|
/// Checks if the plant holder can metabolize the reagent or not. Checks if it has an alive plant by default.
|
||||||
|
|||||||
@@ -6,17 +6,14 @@ using JetBrains.Annotations;
|
|||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Chemistry.PlantMetabolism
|
namespace Content.Server.Chemistry.PlantMetabolism
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
|
[DataDefinition]
|
||||||
public class Clonexadone : IPlantMetabolizable
|
public class Clonexadone : IPlantMetabolizable
|
||||||
{
|
{
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Metabolize(IEntity plantHolder, float customPlantMetabolism = 1)
|
public void Metabolize(IEntity plantHolder, float customPlantMetabolism = 1)
|
||||||
{
|
{
|
||||||
if (plantHolder.Deleted || !plantHolder.TryGetComponent(out PlantHolderComponent? plantHolderComp)
|
if (plantHolder.Deleted || !plantHolder.TryGetComponent(out PlantHolderComponent? plantHolderComp)
|
||||||
|
|||||||
@@ -6,17 +6,14 @@ using Robust.Shared.GameObjects;
|
|||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Chemistry.PlantMetabolism
|
namespace Content.Server.Chemistry.PlantMetabolism
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
|
[DataDefinition]
|
||||||
public class Diethylamine : IPlantMetabolizable
|
public class Diethylamine : IPlantMetabolizable
|
||||||
{
|
{
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Metabolize(IEntity plantHolder, float customPlantMetabolism = 1)
|
public void Metabolize(IEntity plantHolder, float customPlantMetabolism = 1)
|
||||||
{
|
{
|
||||||
if (plantHolder.Deleted || !plantHolder.TryGetComponent(out PlantHolderComponent? plantHolderComp)
|
if (plantHolder.Deleted || !plantHolder.TryGetComponent(out PlantHolderComponent? plantHolderComp)
|
||||||
|
|||||||
@@ -6,17 +6,14 @@ using Robust.Shared.GameObjects;
|
|||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
using Robust.Shared.Random;
|
using Robust.Shared.Random;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Chemistry.PlantMetabolism
|
namespace Content.Server.Chemistry.PlantMetabolism
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
|
[DataDefinition]
|
||||||
public class RobustHarvest : IPlantMetabolizable
|
public class RobustHarvest : IPlantMetabolizable
|
||||||
{
|
{
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Metabolize(IEntity plantHolder, float customPlantMetabolism = 1f)
|
public void Metabolize(IEntity plantHolder, float customPlantMetabolism = 1f)
|
||||||
{
|
{
|
||||||
if (plantHolder.Deleted || !plantHolder.TryGetComponent(out PlantHolderComponent? plantHolderComp)
|
if (plantHolder.Deleted || !plantHolder.TryGetComponent(out PlantHolderComponent? plantHolderComp)
|
||||||
|
|||||||
@@ -1,16 +1,16 @@
|
|||||||
#nullable enable
|
#nullable enable
|
||||||
using System;
|
using System;
|
||||||
using Content.Server.GameObjects.Components.Chemistry;
|
using Content.Server.GameObjects.Components.Chemistry;
|
||||||
using Content.Server.Interfaces.Chemistry;
|
|
||||||
using Content.Server.Utility;
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Audio;
|
using Content.Shared.Audio;
|
||||||
|
using Content.Shared.Interfaces.Chemistry;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Server.GameObjects;
|
using Robust.Server.GameObjects;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.IoC;
|
using Robust.Shared.IoC;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Chemistry.ReactionEffects
|
namespace Content.Server.Chemistry.ReactionEffects
|
||||||
{
|
{
|
||||||
@@ -18,6 +18,7 @@ namespace Content.Server.Chemistry.ReactionEffects
|
|||||||
/// Basically smoke and foam reactions.
|
/// Basically smoke and foam reactions.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
|
[ImplicitDataDefinitionForInheritors]
|
||||||
public abstract class AreaReactionEffect : IReactionEffect
|
public abstract class AreaReactionEffect : IReactionEffect
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||||
@@ -25,82 +26,65 @@ namespace Content.Server.Chemistry.ReactionEffects
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used for calculating the spread range of the effect based on the intensity of the reaction.
|
/// Used for calculating the spread range of the effect based on the intensity of the reaction.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private float _rangeConstant;
|
[DataField("rangeConstant")] private float _rangeConstant;
|
||||||
private float _rangeMultiplier;
|
[DataField("rangeMultiplier")] private float _rangeMultiplier = 1.1f;
|
||||||
private int _maxRange;
|
[DataField("maxRange")] private int _maxRange = 10;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If true the reagents get diluted or concentrated depending on the range of the effect
|
/// If true the reagents get diluted or concentrated depending on the range of the effect
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private bool _diluteReagents;
|
[DataField("diluteReagents")] private bool _diluteReagents;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// At what range should the reagents volume stay the same. If the effect range is higher than this then the reagents
|
/// At what range should the reagents volume stay the same. If the effect range is higher than this then the reagents
|
||||||
/// will get diluted. If the effect range is lower than this then the reagents will get concentrated.
|
/// will get diluted. If the effect range is lower than this then the reagents will get concentrated.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int _reagentDilutionStart;
|
[DataField("reagentDilutionStart")] private int _reagentDilutionStart = 4;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to calculate dilution. Increasing this makes the reagents get more diluted. This means that a lower range
|
/// Used to calculate dilution. Increasing this makes the reagents get more diluted. This means that a lower range
|
||||||
/// will be needed to make the reagents volume get closer to zero.
|
/// will be needed to make the reagents volume get closer to zero.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private float _reagentDilutionFactor;
|
[DataField("reagentDilutionFactor")] private float _reagentDilutionFactor = 1;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to calculate concentration. Reagents get linearly more concentrated as the range goes from
|
/// Used to calculate concentration. Reagents get linearly more concentrated as the range goes from
|
||||||
/// _reagentDilutionStart to zero. When the range is zero the reagents volume gets multiplied by this.
|
/// _reagentDilutionStart to zero. When the range is zero the reagents volume gets multiplied by this.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private float _reagentMaxConcentrationFactor;
|
[DataField("reagentMaxConcentrationFactor")]
|
||||||
|
private float _reagentMaxConcentrationFactor = 2;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// How many seconds will the effect stay, counting after fully spreading.
|
/// How many seconds will the effect stay, counting after fully spreading.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private float _duration;
|
[DataField("duration")] private float _duration = 10;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// How many seconds between each spread step.
|
/// How many seconds between each spread step.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private float _spreadDelay;
|
[DataField("spreadDelay")] private float _spreadDelay = 0.5f;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// How many seconds between each remove step.
|
/// How many seconds between each remove step.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private float _removeDelay;
|
[DataField("removeDelay")] private float _removeDelay = 0.5f;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The entity prototype that will be spawned as the effect. It needs a component derived from SolutionAreaEffectComponent.
|
/// The entity prototype that will be spawned as the effect. It needs a component derived from SolutionAreaEffectComponent.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private string? _prototypeId;
|
[DataField("prototypeId", required: true)]
|
||||||
|
private string _prototypeId = default!;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sound that will get played when this reaction effect occurs.
|
/// Sound that will get played when this reaction effect occurs.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private string? _sound;
|
[DataField("sound")] private string? _sound;
|
||||||
|
|
||||||
protected AreaReactionEffect()
|
protected AreaReactionEffect()
|
||||||
{
|
{
|
||||||
IoCManager.InjectDependencies(this);
|
IoCManager.InjectDependencies(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
serializer.DataField(ref _rangeConstant, "rangeConstant",0f);
|
|
||||||
serializer.DataField(ref _rangeMultiplier, "rangeMultiplier",1.1f);
|
|
||||||
serializer.DataField(ref _maxRange, "maxRange", 10);
|
|
||||||
serializer.DataField(ref _diluteReagents, "diluteReagents", false);
|
|
||||||
serializer.DataField(ref _reagentDilutionStart, "reagentDilutionStart", 4);
|
|
||||||
serializer.DataField(ref _reagentDilutionFactor, "reagentDilutionFactor", 1f);
|
|
||||||
serializer.DataField(ref _reagentMaxConcentrationFactor, "reagentMaxConcentrationFactor",2f);
|
|
||||||
serializer.DataField(ref _duration, "duration", 10f);
|
|
||||||
serializer.DataField(ref _spreadDelay, "spreadDelay", 0.5f);
|
|
||||||
serializer.DataField(ref _removeDelay, "removeDelay", 0.5f);
|
|
||||||
serializer.DataField(ref _sound, "sound", null);
|
|
||||||
serializer.DataField(ref _prototypeId, "prototypeId", null);
|
|
||||||
|
|
||||||
if (_prototypeId == null)
|
|
||||||
Logger.Error("prototypeId wasn't provided to AreaReactionEffect, check yaml");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void React(IEntity solutionEntity, double intensity)
|
public void React(IEntity solutionEntity, double intensity)
|
||||||
{
|
{
|
||||||
if (!solutionEntity.TryGetComponent(out SolutionContainerComponent? contents))
|
if (!solutionEntity.TryGetComponent(out SolutionContainerComponent? contents))
|
||||||
|
|||||||
@@ -1,43 +1,34 @@
|
|||||||
using System;
|
using System;
|
||||||
using Content.Server.Explosions;
|
using Content.Server.Explosions;
|
||||||
using Content.Server.GameObjects.Components.Chemistry;
|
using Content.Server.GameObjects.Components.Chemistry;
|
||||||
using Content.Server.Interfaces.Chemistry;
|
using Content.Shared.Interfaces.Chemistry;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Chemistry.ReactionEffects
|
namespace Content.Server.Chemistry.ReactionEffects
|
||||||
{
|
{
|
||||||
|
[DataDefinition]
|
||||||
public class ExplosionReactionEffect : IReactionEffect
|
public class ExplosionReactionEffect : IReactionEffect
|
||||||
{
|
{
|
||||||
private float _devastationRange;
|
[DataField("devastationRange")] private float _devastationRange = 1;
|
||||||
private float _heavyImpactRange;
|
[DataField("heavyImpactRange")] private float _heavyImpactRange = 2;
|
||||||
private float _lightImpactRange;
|
[DataField("lightImpactRange")] private float _lightImpactRange = 3;
|
||||||
private float _flashRange;
|
[DataField("flashRange")] private float _flashRange;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If true, then scale ranges by intensity. If not, the ranges are the same regardless of reactant amount.
|
/// If true, then scale ranges by intensity. If not, the ranges are the same regardless of reactant amount.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private bool _scaled;
|
[DataField("scaled")] private bool _scaled;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Maximum scaling on ranges. For example, if it equals 5, then it won't scaled anywhere past
|
/// Maximum scaling on ranges. For example, if it equals 5, then it won't scaled anywhere past
|
||||||
/// 5 times the minimum reactant amount.
|
/// 5 times the minimum reactant amount.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private float _maxScale;
|
[DataField("maxScale")] private float _maxScale = 1;
|
||||||
|
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
serializer.DataField(ref _devastationRange, "devastationRange", 1);
|
|
||||||
serializer.DataField(ref _heavyImpactRange, "heavyImpactRange", 2);
|
|
||||||
serializer.DataField(ref _lightImpactRange, "lightImpactRange", 3);
|
|
||||||
serializer.DataField(ref _flashRange, "flashRange", 0);
|
|
||||||
|
|
||||||
serializer.DataField(ref _scaled, "scaled", false);
|
|
||||||
serializer.DataField(ref _maxScale, "maxScale", 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void React(IEntity solutionEntity, double intensity)
|
public void React(IEntity solutionEntity, double intensity)
|
||||||
{
|
{
|
||||||
float floatIntensity = (float)intensity;
|
var floatIntensity = (float)intensity;
|
||||||
if (solutionEntity == null)
|
if (solutionEntity == null)
|
||||||
return;
|
return;
|
||||||
if(!solutionEntity.TryGetComponent(out SolutionContainerComponent solution))
|
if(!solutionEntity.TryGetComponent(out SolutionContainerComponent solution))
|
||||||
@@ -54,10 +45,10 @@ namespace Content.Server.Chemistry.ReactionEffects
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Calculate intensities
|
//Calculate intensities
|
||||||
int finalDevastationRange = (int)MathF.Round(_devastationRange * floatIntensity);
|
var finalDevastationRange = (int)MathF.Round(_devastationRange * floatIntensity);
|
||||||
int finalHeavyImpactRange = (int)MathF.Round(_heavyImpactRange * floatIntensity);
|
var finalHeavyImpactRange = (int)MathF.Round(_heavyImpactRange * floatIntensity);
|
||||||
int finalLightImpactRange = (int)MathF.Round(_lightImpactRange * floatIntensity);
|
var finalLightImpactRange = (int)MathF.Round(_lightImpactRange * floatIntensity);
|
||||||
int finalFlashRange = (int)MathF.Round(_flashRange * floatIntensity);
|
var finalFlashRange = (int)MathF.Round(_flashRange * floatIntensity);
|
||||||
solutionEntity.SpawnExplosion(finalDevastationRange,
|
solutionEntity.SpawnExplosion(finalDevastationRange,
|
||||||
finalHeavyImpactRange, finalLightImpactRange, finalFlashRange);
|
finalHeavyImpactRange, finalLightImpactRange, finalFlashRange);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,12 @@
|
|||||||
using Content.Server.GameObjects.Components.Chemistry;
|
using Content.Server.GameObjects.Components.Chemistry;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Chemistry.ReactionEffects
|
namespace Content.Server.Chemistry.ReactionEffects
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
|
[DataDefinition]
|
||||||
public class FoamAreaReactionEffect : AreaReactionEffect
|
public class FoamAreaReactionEffect : AreaReactionEffect
|
||||||
{
|
{
|
||||||
protected override SolutionAreaEffectComponent? GetAreaEffectComponent(IEntity entity)
|
protected override SolutionAreaEffectComponent? GetAreaEffectComponent(IEntity entity)
|
||||||
|
|||||||
@@ -2,10 +2,12 @@
|
|||||||
using Content.Server.GameObjects.Components.Chemistry;
|
using Content.Server.GameObjects.Components.Chemistry;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Chemistry.ReactionEffects
|
namespace Content.Server.Chemistry.ReactionEffects
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
|
[DataDefinition]
|
||||||
public class SmokeAreaReactionEffect : AreaReactionEffect
|
public class SmokeAreaReactionEffect : AreaReactionEffect
|
||||||
{
|
{
|
||||||
protected override SolutionAreaEffectComponent? GetAreaEffectComponent(IEntity entity)
|
protected override SolutionAreaEffectComponent? GetAreaEffectComponent(IEntity entity)
|
||||||
|
|||||||
@@ -1,19 +1,16 @@
|
|||||||
using Content.Server.GameObjects.Components;
|
using System.Linq;
|
||||||
|
using Content.Server.GameObjects.Components;
|
||||||
using Content.Server.Utility;
|
using Content.Server.Utility;
|
||||||
using Content.Shared.Chemistry;
|
using Content.Shared.Chemistry;
|
||||||
using Content.Shared.Interfaces.Chemistry;
|
using Content.Shared.Interfaces.Chemistry;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace Content.Server.Chemistry.TileReactions
|
namespace Content.Server.Chemistry.TileReactions
|
||||||
{
|
{
|
||||||
|
[DataDefinition]
|
||||||
public class CleanTileReaction : ITileReaction
|
public class CleanTileReaction : ITileReaction
|
||||||
{
|
{
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ReagentUnit ITileReaction.TileReact(TileRef tile, ReagentPrototype reagent, ReagentUnit reactVolume)
|
ReagentUnit ITileReaction.TileReact(TileRef tile, ReagentPrototype reagent, ReagentUnit reactVolume)
|
||||||
{
|
{
|
||||||
var entities = tile.GetEntitiesInTileFast().ToArray();
|
var entities = tile.GetEntitiesInTileFast().ToArray();
|
||||||
|
|||||||
@@ -5,19 +5,15 @@ using Content.Shared.Chemistry;
|
|||||||
using Content.Shared.Interfaces.Chemistry;
|
using Content.Shared.Interfaces.Chemistry;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Chemistry.TileReactions
|
namespace Content.Server.Chemistry.TileReactions
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
|
[DataDefinition]
|
||||||
public class ExtinguishTileReaction : ITileReaction
|
public class ExtinguishTileReaction : ITileReaction
|
||||||
{
|
{
|
||||||
private float _coolingTemperature = 2f;
|
[DataField("coolingTemperature")] private float _coolingTemperature = 2f;
|
||||||
|
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
serializer.DataField(ref _coolingTemperature, "coolingTemperature", 2f);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReagentUnit TileReact(TileRef tile, ReagentPrototype reagent, ReagentUnit reactVolume)
|
public ReagentUnit TileReact(TileRef tile, ReagentPrototype reagent, ReagentUnit reactVolume)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,19 +4,15 @@ using Content.Shared.Chemistry;
|
|||||||
using Content.Shared.Interfaces.Chemistry;
|
using Content.Shared.Interfaces.Chemistry;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Chemistry.TileReactions
|
namespace Content.Server.Chemistry.TileReactions
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
|
[DataDefinition]
|
||||||
public class FlammableTileReaction : ITileReaction
|
public class FlammableTileReaction : ITileReaction
|
||||||
{
|
{
|
||||||
private float _temperatureMultiplier = 1.25f;
|
[DataField("temperatureMultiplier")] private float _temperatureMultiplier = 1.15f;
|
||||||
|
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
serializer.DataField(ref _temperatureMultiplier, "temperatureMultiplier", 1.15f);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReagentUnit TileReact(TileRef tile, ReagentPrototype reagent, ReagentUnit reactVolume)
|
public ReagentUnit TileReact(TileRef tile, ReagentPrototype reagent, ReagentUnit reactVolume)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,17 +3,14 @@ using Content.Shared.Chemistry;
|
|||||||
using Content.Shared.Interfaces.Chemistry;
|
using Content.Shared.Interfaces.Chemistry;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Serialization;
|
using Robust.Shared.Serialization.Manager.Attributes;
|
||||||
|
|
||||||
namespace Content.Server.Chemistry.TileReactions
|
namespace Content.Server.Chemistry.TileReactions
|
||||||
{
|
{
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
|
[DataDefinition]
|
||||||
public class SpillIfPuddlePresentTileReaction : ITileReaction
|
public class SpillIfPuddlePresentTileReaction : ITileReaction
|
||||||
{
|
{
|
||||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public ReagentUnit TileReact(TileRef tile, ReagentPrototype reagent, ReagentUnit reactVolume)
|
public ReagentUnit TileReact(TileRef tile, ReagentPrototype reagent, ReagentUnit reactVolume)
|
||||||
{
|
{
|
||||||
if (reactVolume < 5 || !tile.TryGetPuddle(null, out _)) return ReagentUnit.Zero;
|
if (reactVolume < 5 || !tile.TryGetPuddle(null, out _)) return ReagentUnit.Zero;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user