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:
@@ -1,8 +1,8 @@
|
||||
#nullable enable
|
||||
using System.Collections.Generic;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.AI
|
||||
{
|
||||
@@ -11,17 +11,15 @@ namespace Content.Server.GameObjects.Components.AI
|
||||
{
|
||||
// These are immutable so any dynamic changes aren't saved back over.
|
||||
// AiFactionSystem will just read these and then store them.
|
||||
[ViewVariables]
|
||||
[field: DataField("id", required: true)]
|
||||
public string ID { get; } = default!;
|
||||
|
||||
public string ID { get; private set; } = default!;
|
||||
[ViewVariables]
|
||||
[field: DataField("parent")]
|
||||
public string? Parent { get; }
|
||||
|
||||
public IReadOnlyList<string> Hostile { get; private set; } = default!;
|
||||
|
||||
public void LoadFrom(YamlMappingNode mapping)
|
||||
{
|
||||
var serializer = YamlObjectSerializer.NewReader(mapping);
|
||||
|
||||
serializer.DataField(this, x => x.ID, "id", string.Empty);
|
||||
serializer.DataField(this, x => x.Hostile, "hostile", new List<string>());
|
||||
}
|
||||
[DataField("hostile")]
|
||||
public IReadOnlyList<string> Hostile { get; private set; } = new List<string>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.GameObjects.EntitySystems.AI;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.AI
|
||||
{
|
||||
@@ -12,29 +10,7 @@ namespace Content.Server.GameObjects.Components.AI
|
||||
{
|
||||
public override string Name => "AiFactionTag";
|
||||
|
||||
[DataField("factions")]
|
||||
public Faction Factions { get; private set; } = Faction.None;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataReadWriteFunction(
|
||||
"factions",
|
||||
new List<Faction>(),
|
||||
factions => factions.ForEach(faction => Factions |= faction),
|
||||
() =>
|
||||
{
|
||||
var writeFactions = new List<Faction>();
|
||||
foreach (Faction fac in Enum.GetValues(typeof(Faction)))
|
||||
{
|
||||
if ((Factions & fac) != 0)
|
||||
{
|
||||
writeFactions.Add(fac);
|
||||
}
|
||||
}
|
||||
|
||||
return writeFactions;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.Interfaces;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Access
|
||||
@@ -16,25 +16,13 @@ namespace Content.Server.GameObjects.Components.Access
|
||||
{
|
||||
public override string Name => "Access";
|
||||
|
||||
[DataField("tags")]
|
||||
[ViewVariables]
|
||||
private readonly HashSet<string> _tags = new();
|
||||
|
||||
public ISet<string> Tags => _tags;
|
||||
public bool IsReadOnly => false;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataReadWriteFunction("tags", new List<string>(),
|
||||
value =>
|
||||
{
|
||||
_tags.Clear();
|
||||
_tags.UnionWith(value);
|
||||
},
|
||||
() => new List<string>(_tags));
|
||||
}
|
||||
|
||||
public void SetTags(IEnumerable<string> newTags)
|
||||
{
|
||||
_tags.Clear();
|
||||
|
||||
@@ -13,7 +13,7 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Access
|
||||
@@ -28,14 +28,15 @@ namespace Content.Server.GameObjects.Components.Access
|
||||
{
|
||||
public override string Name => "AccessReader";
|
||||
|
||||
private readonly List<ISet<string>> _accessLists = new();
|
||||
private readonly HashSet<string> _denyTags = new();
|
||||
|
||||
/// <summary>
|
||||
/// List of access lists to check allowed against. For an access check to pass
|
||||
/// there has to be an access list that is a subset of the access in the checking list.
|
||||
/// </summary>
|
||||
[ViewVariables] public IList<ISet<string>> AccessLists => _accessLists;
|
||||
[field: DataField("access")]
|
||||
[ViewVariables]
|
||||
public List<HashSet<string>> AccessLists { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// The set of tags that will automatically deny an allowed check, if any of them are present.
|
||||
@@ -69,7 +70,7 @@ namespace Content.Server.GameObjects.Components.Access
|
||||
return false;
|
||||
}
|
||||
|
||||
return _accessLists.Count == 0 || _accessLists.Any(a => a.IsSubsetOf(accessTags));
|
||||
return AccessLists.Count == 0 || AccessLists.Any(a => a.IsSubsetOf(accessTags));
|
||||
}
|
||||
|
||||
public static ICollection<string> FindAccessTags(IEntity entity)
|
||||
@@ -120,21 +121,5 @@ namespace Content.Server.GameObjects.Components.Access
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataReadWriteFunction("access", new List<List<string>>(),
|
||||
v =>
|
||||
{
|
||||
if (v.Count != 0)
|
||||
{
|
||||
_accessLists.Clear();
|
||||
_accessLists.AddRange(v.Select(a => new HashSet<string>(a)));
|
||||
}
|
||||
},
|
||||
() => _accessLists.Select(p => new List<string>(p)).ToList());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Access
|
||||
@@ -11,8 +13,10 @@ namespace Content.Server.GameObjects.Components.Access
|
||||
public override string Name => "IdCard";
|
||||
|
||||
/// See <see cref="UpdateEntityName"/>.
|
||||
[DataField("originalOwnerName")]
|
||||
private string _ownerOriginalName;
|
||||
|
||||
[DataField("fullName")]
|
||||
private string _fullName;
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public string FullName
|
||||
@@ -25,6 +29,7 @@ namespace Content.Server.GameObjects.Components.Access
|
||||
}
|
||||
}
|
||||
|
||||
[DataField("jobTitle")]
|
||||
private string _jobTitle;
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public string JobTitle
|
||||
@@ -70,14 +75,5 @@ namespace Content.Server.GameObjects.Components.Access
|
||||
_ownerOriginalName ??= Owner.Name;
|
||||
UpdateEntityName();
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _fullName, "fullName", string.Empty);
|
||||
serializer.DataField(ref _jobTitle, "jobTitle", string.Empty);
|
||||
serializer.DataField(ref _ownerOriginalName, "originalOwnerName", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Access
|
||||
{
|
||||
@@ -13,15 +14,9 @@ namespace Content.Server.GameObjects.Components.Access
|
||||
{
|
||||
public override string Name => "PresetIdCard";
|
||||
|
||||
[DataField("job")]
|
||||
private string? _jobName;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _jobName, "job", null);
|
||||
}
|
||||
|
||||
void IMapInit.MapInit()
|
||||
{
|
||||
if (_jobName == null)
|
||||
|
||||
@@ -14,7 +14,7 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.ActionBlocking
|
||||
@@ -27,60 +27,70 @@ namespace Content.Server.GameObjects.Components.ActionBlocking
|
||||
/// The time it takes to apply a <see cref="CuffedComponent"/> to an entity.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public float CuffTime { get; set; }
|
||||
[DataField("cuffTime")]
|
||||
public float CuffTime { get; set; } = 5f;
|
||||
|
||||
/// <summary>
|
||||
/// The time it takes to remove a <see cref="CuffedComponent"/> from an entity.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public float UncuffTime { get; set; }
|
||||
[DataField("uncuffTime")]
|
||||
public float UncuffTime { get; set; } = 5f;
|
||||
|
||||
/// <summary>
|
||||
/// The time it takes for a cuffed entity to remove <see cref="CuffedComponent"/> from itself.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public float BreakoutTime { get; set; }
|
||||
[DataField("breakoutTime")]
|
||||
public float BreakoutTime { get; set; } = 30f;
|
||||
|
||||
/// <summary>
|
||||
/// If an entity being cuffed is stunned, this amount of time is subtracted from the time it takes to add/remove their cuffs.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public float StunBonus { get; set; }
|
||||
[DataField("stunBonus")]
|
||||
public float StunBonus { get; set; } = 2f;
|
||||
|
||||
/// <summary>
|
||||
/// Will the cuffs break when removed?
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("breakOnRemove")]
|
||||
public bool BreakOnRemove { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The path of the RSI file used for the player cuffed overlay.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public string? CuffedRSI { get; set; }
|
||||
[DataField("cuffedRSI")]
|
||||
public string? CuffedRSI { get; set; } = "Objects/Misc/handcuffs.rsi";
|
||||
|
||||
/// <summary>
|
||||
/// The iconstate used with the RSI file for the player cuffed overlay.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
public string? OverlayIconState { get; set; }
|
||||
[DataField("bodyIconState")]
|
||||
public string? OverlayIconState { get; set; } = "body-overlay";
|
||||
|
||||
/// <summary>
|
||||
/// The iconstate used for broken handcuffs
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("brokenIconState")]
|
||||
public string? BrokenState { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The iconstate used for broken handcuffs
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("brokenName")]
|
||||
public string BrokenName { get; set; } = default!;
|
||||
|
||||
/// <summary>
|
||||
/// The iconstate used for broken handcuffs
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("brokenDesc")]
|
||||
public string BrokenDesc { get; set; } = default!;
|
||||
|
||||
[ViewVariables]
|
||||
@@ -101,12 +111,21 @@ namespace Content.Server.GameObjects.Components.ActionBlocking
|
||||
}
|
||||
}
|
||||
|
||||
public string? StartCuffSound { get; set; }
|
||||
public string? EndCuffSound { get; set; }
|
||||
public string? StartBreakoutSound { get; set; }
|
||||
public string? StartUncuffSound { get; set; }
|
||||
public string? EndUncuffSound { get; set; }
|
||||
public Color Color { get; set; }
|
||||
[DataField("startCuffSound")]
|
||||
public string StartCuffSound { get; set; } = "/Audio/Items/Handcuffs/cuff_start.ogg";
|
||||
|
||||
[DataField("endCuffSound")] public string EndCuffSound { get; set; } = "/Audio/Items/Handcuffs/cuff_end.ogg";
|
||||
|
||||
[DataField("startBreakoutSound")]
|
||||
public string StartBreakoutSound { get; set; } = "/Audio/Items/Handcuffs/cuff_breakout_start.ogg";
|
||||
|
||||
[DataField("startUncuffSound")]
|
||||
public string StartUncuffSound { get; set; } = "/Audio/Items/Handcuffs/cuff_takeoff_start.ogg";
|
||||
|
||||
[DataField("endUncuffSound")]
|
||||
public string EndUncuffSound { get; set; } = "/Audio/Items/Handcuffs/cuff_takeoff_end.ogg";
|
||||
[DataField("color")]
|
||||
public Color Color { get; set; } = Color.White;
|
||||
|
||||
// Non-exposed data fields
|
||||
private bool _isBroken = false;
|
||||
@@ -116,27 +135,6 @@ namespace Content.Server.GameObjects.Components.ActionBlocking
|
||||
/// </summary>
|
||||
private bool _cuffing;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(this, x => x.CuffTime, "cuffTime", 5.0f);
|
||||
serializer.DataField(this, x => x.BreakoutTime, "breakoutTime", 30.0f);
|
||||
serializer.DataField(this, x => x.UncuffTime, "uncuffTime", 5.0f);
|
||||
serializer.DataField(this, x => x.StunBonus, "stunBonus", 2.0f);
|
||||
serializer.DataField(this, x => x.StartCuffSound, "startCuffSound", "/Audio/Items/Handcuffs/cuff_start.ogg");
|
||||
serializer.DataField(this, x => x.EndCuffSound, "endCuffSound", "/Audio/Items/Handcuffs/cuff_end.ogg");
|
||||
serializer.DataField(this, x => x.StartUncuffSound, "startUncuffSound", "/Audio/Items/Handcuffs/cuff_takeoff_start.ogg");
|
||||
serializer.DataField(this, x => x.EndUncuffSound, "endUncuffSound", "/Audio/Items/Handcuffs/cuff_takeoff_end.ogg");
|
||||
serializer.DataField(this, x => x.StartBreakoutSound, "startBreakoutSound", "/Audio/Items/Handcuffs/cuff_breakout_start.ogg");
|
||||
serializer.DataField(this, x => x.CuffedRSI, "cuffedRSI", "Objects/Misc/handcuffs.rsi");
|
||||
serializer.DataField(this, x => x.OverlayIconState, "bodyIconState", "body-overlay");
|
||||
serializer.DataField(this, x => x.Color, "color", Color.White);
|
||||
serializer.DataField(this, x => x.BreakOnRemove, "breakOnRemove", false);
|
||||
serializer.DataField(this, x => x.BrokenState, "brokenIconState", string.Empty);
|
||||
serializer.DataField(this, x => x.BrokenName, "brokenName", string.Empty);
|
||||
serializer.DataField(this, x => x.BrokenDesc, "brokenDesc", string.Empty);
|
||||
}
|
||||
|
||||
public override ComponentState GetComponentState(ICommonSession player)
|
||||
{
|
||||
return new HandcuffedComponentState(Broken ? BrokenState : string.Empty);
|
||||
|
||||
@@ -7,7 +7,7 @@ using Content.Server.Utility;
|
||||
using Content.Shared.GameObjects.Components.Interactable;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components
|
||||
@@ -18,21 +18,16 @@ namespace Content.Server.GameObjects.Components
|
||||
public override string Name => "Anchorable";
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("tool")]
|
||||
public ToolQuality Tool { get; private set; } = ToolQuality.Anchoring;
|
||||
|
||||
[ViewVariables]
|
||||
int IInteractUsing.Priority => 1;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("snap")]
|
||||
public bool Snap { get; private set; }
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(this, x => x.Tool, "tool", ToolQuality.Anchoring);
|
||||
serializer.DataField(this, x => x.Snap, "snap", false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if a tool can change the anchored status.
|
||||
/// </summary>
|
||||
|
||||
@@ -13,8 +13,10 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Arcade
|
||||
@@ -36,33 +38,23 @@ namespace Content.Server.GameObjects.Components.Arcade
|
||||
[ViewVariables] private bool _enemyInvincibilityFlag;
|
||||
[ViewVariables] private SpaceVillainGame _game = null!;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)] private List<string> _possibleFightVerbs = null!;
|
||||
[ViewVariables(VVAccess.ReadWrite)] private List<string> _possibleFirstEnemyNames = null!;
|
||||
[ViewVariables(VVAccess.ReadWrite)] private List<string> _possibleLastEnemyNames = null!;
|
||||
[ViewVariables(VVAccess.ReadWrite)] private List<string> _possibleRewards = null!;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("possibleFightVerbs")] private List<string> _possibleFightVerbs = new List<string>()
|
||||
{"Defeat", "Annihilate", "Save", "Strike", "Stop", "Destroy", "Robust", "Romance", "Pwn", "Own"};
|
||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("possibleFirstEnemyNames")] private List<string> _possibleFirstEnemyNames = new List<string>(){
|
||||
"the Automatic", "Farmer", "Lord", "Professor", "the Cuban", "the Evil", "the Dread King",
|
||||
"the Space", "Lord", "the Great", "Duke", "General"
|
||||
};
|
||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("possibleLastEnemyNames")] private List<string> _possibleLastEnemyNames = new List<string>()
|
||||
{
|
||||
serializer.DataField(ref _possibleFightVerbs, "possibleFightVerbs", new List<string>()
|
||||
{"Defeat", "Annihilate", "Save", "Strike", "Stop", "Destroy", "Robust", "Romance", "Pwn", "Own"});
|
||||
serializer.DataField(ref _possibleFirstEnemyNames, "possibleFirstEnemyNames", new List<string>(){
|
||||
"the Automatic", "Farmer", "Lord", "Professor", "the Cuban", "the Evil", "the Dread King",
|
||||
"the Space", "Lord", "the Great", "Duke", "General"
|
||||
});
|
||||
serializer.DataField(ref _possibleLastEnemyNames, "possibleLastEnemyNames", new List<string>()
|
||||
{
|
||||
"Melonoid", "Murdertron", "Sorcerer", "Ruin", "Jeff", "Ectoplasm", "Crushulon", "Uhangoid",
|
||||
"Vhakoid", "Peteoid", "slime", "Griefer", "ERPer", "Lizard Man", "Unicorn"
|
||||
});
|
||||
serializer.DataField(ref _possibleRewards, "possibleRewards", new List<string>()
|
||||
{
|
||||
"ToyMouse", "ToyAi", "ToyNuke", "ToyAssistant", "ToyGriffin", "ToyHonk", "ToyIan",
|
||||
"ToyMarauder", "ToyMauler", "ToyGygax", "ToyOdysseus", "ToyOwlman", "ToyDeathRipley",
|
||||
"ToyPhazon", "ToyFireRipley", "ToyReticence", "ToyRipley", "ToySeraph", "ToyDurand", "ToySkeleton"
|
||||
});
|
||||
|
||||
_game = new SpaceVillainGame(this);
|
||||
}
|
||||
"Melonoid", "Murdertron", "Sorcerer", "Ruin", "Jeff", "Ectoplasm", "Crushulon", "Uhangoid",
|
||||
"Vhakoid", "Peteoid", "slime", "Griefer", "ERPer", "Lizard Man", "Unicorn"
|
||||
};
|
||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("possibleRewards")] private List<string> _possibleRewards = new List<string>()
|
||||
{
|
||||
"ToyMouse", "ToyAi", "ToyNuke", "ToyAssistant", "ToyGriffin", "ToyHonk", "ToyIan",
|
||||
"ToyMarauder", "ToyMauler", "ToyGygax", "ToyOdysseus", "ToyOwlman", "ToyDeathRipley",
|
||||
"ToyPhazon", "ToyFireRipley", "ToyReticence", "ToyRipley", "ToySeraph", "ToyDurand", "ToySkeleton"
|
||||
};
|
||||
|
||||
void IActivate.Activate(ActivateEventArgs eventArgs)
|
||||
{
|
||||
@@ -76,6 +68,8 @@ namespace Content.Server.GameObjects.Components.Arcade
|
||||
}
|
||||
if(!ActionBlockerSystem.CanInteract(actor.playerSession.AttachedEntity)) return;
|
||||
|
||||
_game ??= new SpaceVillainGame(this);
|
||||
|
||||
if (_wiresComponent?.IsPanelOpen == true)
|
||||
{
|
||||
_wiresComponent.OpenInterface(actor.playerSession);
|
||||
|
||||
@@ -5,7 +5,7 @@ using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Atmos
|
||||
@@ -18,17 +18,25 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
|
||||
public override string Name => "Airtight";
|
||||
|
||||
[DataFieldWithFlag("airBlockedDirection", typeof(AtmosDirectionFlags))]
|
||||
[ViewVariables]
|
||||
private int _initialAirBlockedDirection;
|
||||
[ViewVariables]
|
||||
private int _currentAirBlockedDirection;
|
||||
private bool _airBlocked = true;
|
||||
private bool _fixVacuum;
|
||||
private int _initialAirBlockedDirection = (int) AtmosDirection.All;
|
||||
|
||||
[ViewVariables]
|
||||
private int _currentAirBlockedDirection;
|
||||
|
||||
[DataField("airBlocked")]
|
||||
private bool _airBlocked = true;
|
||||
|
||||
[DataField("fixVacuum")]
|
||||
private bool _fixVacuum = true;
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("rotateAirBlocked")]
|
||||
private bool _rotateAirBlocked = true;
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("fixAirBlockedDirectionInitialize")]
|
||||
private bool _fixAirBlockedDirectionInitialize = true;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
@@ -58,17 +66,6 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
[ViewVariables]
|
||||
public bool FixVacuum => _fixVacuum;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _airBlocked, "airBlocked", true);
|
||||
serializer.DataField(ref _fixVacuum, "fixVacuum", true);
|
||||
serializer.DataField(ref _initialAirBlockedDirection, "airBlockedDirection", (int)AtmosDirection.All, WithFormat.Flags<AtmosDirectionFlags>());
|
||||
serializer.DataField(ref _rotateAirBlocked, "rotateAirBlocked", true);
|
||||
serializer.DataField(ref _fixAirBlockedDirectionInitialize, "fixAirBlockedDirectionInitialize", true);
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
@@ -3,7 +3,7 @@ using Content.Server.GameObjects.Components.Body.Respiratory;
|
||||
using Content.Shared.GameObjects.Components.Inventory;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Atmos
|
||||
{
|
||||
@@ -16,18 +16,13 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
/// <summary>
|
||||
/// Tool is functional only in allowed slots
|
||||
/// </summary>
|
||||
private EquipmentSlotDefines.SlotFlags _allowedSlots;
|
||||
[DataField("allowedSlots")]
|
||||
private EquipmentSlotDefines.SlotFlags _allowedSlots = EquipmentSlotDefines.SlotFlags.MASK;
|
||||
|
||||
public override string Name => "BreathMask";
|
||||
public bool IsFunctional { get; private set; }
|
||||
public IEntity? ConnectedInternalsEntity { get; private set; }
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _allowedSlots, "allowedSlots", EquipmentSlotDefines.SlotFlags.MASK);
|
||||
}
|
||||
|
||||
protected override void Shutdown()
|
||||
{
|
||||
base.Shutdown();
|
||||
|
||||
@@ -15,7 +15,7 @@ using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Atmos
|
||||
@@ -33,18 +33,13 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
public float FireStacks { get; private set; }
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("fireSpread")]
|
||||
public bool FireSpread { get; private set; } = false;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("canResistFire")]
|
||||
public bool CanResistFire { get; private set; } = false;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(this, x => x.FireSpread, "fireSpread", false);
|
||||
serializer.DataField(this, x => x.CanResistFire, "canResistFire", false);
|
||||
}
|
||||
|
||||
public void Ignite()
|
||||
{
|
||||
if (FireStacks > 0 && !OnFire)
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Content.Server.Atmos;
|
||||
using Content.Server.GameObjects.Components.Atmos.Piping;
|
||||
using Content.Server.Interfaces;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using System.Linq;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.GameObjects.Components.Atmos;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.GameObjects.Components.Atmos;
|
||||
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Atmos
|
||||
{
|
||||
@@ -37,7 +37,8 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
/// What <see cref="GasMixture"/> the canister contains.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public GasMixture Air { get; set; } = default!;
|
||||
[DataField("gasMixture")]
|
||||
public GasMixture Air { get; set; } = new (DefaultVolume);
|
||||
|
||||
[ViewVariables]
|
||||
public bool Anchored => !Owner.TryGetComponent<IPhysicsComponent>(out var physics) || physics.Anchored;
|
||||
@@ -51,7 +52,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
[ViewVariables]
|
||||
public bool ConnectedToPort => ConnectedPort != null;
|
||||
|
||||
private const float DefaultVolume = 10;
|
||||
public const float DefaultVolume = 10;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)] public float ReleasePressure { get; set; }
|
||||
|
||||
@@ -67,13 +68,6 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
|
||||
private AppearanceComponent? _appearance;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(this, x => Air, "gasMixture", new GasMixture(DefaultVolume));
|
||||
}
|
||||
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using Content.Server.Atmos;
|
||||
using Content.Server.Interfaces;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Atmos
|
||||
@@ -11,15 +13,6 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
{
|
||||
public override string Name => "GasMixtureHolder";
|
||||
|
||||
[ViewVariables] public GasMixture Air { get; set; }
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
Air = new GasMixture();
|
||||
|
||||
serializer.DataField(this, x => x.Air, "air", new GasMixture());
|
||||
}
|
||||
[ViewVariables] [DataField("air")] public GasMixture Air { get; set; } = new GasMixture();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ using Robust.Server.Player;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
@@ -33,7 +33,8 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
private const float MaxExplosionRange = 14f;
|
||||
private const float DefaultOutputPressure = Atmospherics.OneAtmosphere;
|
||||
|
||||
private float _pressureResistance;
|
||||
[DataField("pressureResistance")]
|
||||
private float _pressureResistance = Atmospherics.OneAtmosphere * 5f;
|
||||
|
||||
private int _integrity = 3;
|
||||
|
||||
@@ -41,12 +42,14 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
|
||||
[ViewVariables] private BoundUserInterface? _userInterface;
|
||||
|
||||
[ViewVariables] public GasMixture? Air { get; set; }
|
||||
[DataField("air")] [ViewVariables] public GasMixture? Air { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Distributed pressure.
|
||||
/// </summary>
|
||||
[ViewVariables] public float OutputPressure { get; private set; }
|
||||
[DataField("outputPressure")]
|
||||
[ViewVariables]
|
||||
public float OutputPressure { get; private set; } = DefaultOutputPressure;
|
||||
|
||||
/// <summary>
|
||||
/// Tank is connected to internals.
|
||||
@@ -61,21 +64,25 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
/// <summary>
|
||||
/// Pressure at which tanks start leaking.
|
||||
/// </summary>
|
||||
[DataField("tankLeakPressure")]
|
||||
public float TankLeakPressure { get; set; } = 30 * Atmospherics.OneAtmosphere;
|
||||
|
||||
/// <summary>
|
||||
/// Pressure at which tank spills all contents into atmosphere.
|
||||
/// </summary>
|
||||
[DataField("tankRupturePressure")]
|
||||
public float TankRupturePressure { get; set; } = 40 * Atmospherics.OneAtmosphere;
|
||||
|
||||
/// <summary>
|
||||
/// Base 3x3 explosion.
|
||||
/// </summary>
|
||||
[DataField("tankFragmentPressure")]
|
||||
public float TankFragmentPressure { get; set; } = 50 * Atmospherics.OneAtmosphere;
|
||||
|
||||
/// <summary>
|
||||
/// Increases explosion for each scale kPa above threshold.
|
||||
/// </summary>
|
||||
[DataField("tankFragmentScale")]
|
||||
public float TankFragmentScale { get; set; } = 10 * Atmospherics.OneAtmosphere;
|
||||
|
||||
public override void Initialize()
|
||||
@@ -94,19 +101,6 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
UpdateUserInterface(true);
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(this, x => x.Air, "air", new GasMixture());
|
||||
serializer.DataField(this, x => x.OutputPressure, "outputPressure", DefaultOutputPressure);
|
||||
serializer.DataField(this, x => x.TankLeakPressure, "tankLeakPressure", 30 * Atmospherics.OneAtmosphere);
|
||||
serializer.DataField(this, x => x.TankRupturePressure, "tankRupturePressure", 40 * Atmospherics.OneAtmosphere);
|
||||
serializer.DataField(this, x => x.TankFragmentPressure, "tankFragmentPressure", 50 * Atmospherics.OneAtmosphere);
|
||||
serializer.DataField(this, x => x.TankFragmentScale, "tankFragmentScale", 10 * Atmospherics.OneAtmosphere);
|
||||
serializer.DataField(ref _pressureResistance, "pressureResistance", Atmospherics.OneAtmosphere * 5f);
|
||||
}
|
||||
|
||||
public void Examine(FormattedMessage message, bool inDetailsRange)
|
||||
{
|
||||
message.AddMarkup(Loc.GetString("gas-tank-examine", ("pressure", Math.Round(Air?.Pressure ?? 0))));
|
||||
@@ -355,10 +349,9 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
}
|
||||
|
||||
[UsedImplicitly]
|
||||
[DataDefinition]
|
||||
public class ToggleInternalsAction : IToggleItemAction
|
||||
{
|
||||
void IExposeData.ExposeData(ObjectSerializer serializer) {}
|
||||
|
||||
public bool DoToggleAction(ToggleItemActionEventArgs args)
|
||||
{
|
||||
if (!args.Item.TryGetComponent<GasTankComponent>(out var gasTankComponent)) return false;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#nullable enable
|
||||
// ReSharper disable once RedundantUsingDirective
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -13,12 +14,15 @@ using Content.Shared.Atmos;
|
||||
using Content.Shared.Maps;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using Dependency = Robust.Shared.IoC.DependencyAttribute;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Atmos
|
||||
{
|
||||
@@ -27,11 +31,11 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
/// </summary>
|
||||
[ComponentReference(typeof(IGridAtmosphereComponent))]
|
||||
[RegisterComponent, Serializable]
|
||||
public class GridAtmosphereComponent : Component, IGridAtmosphereComponent
|
||||
public class GridAtmosphereComponent : Component, IGridAtmosphereComponent, ISerializationHooks
|
||||
{
|
||||
[Robust.Shared.IoC.Dependency] private IMapManager _mapManager = default!;
|
||||
[Robust.Shared.IoC.Dependency] private ITileDefinitionManager _tileDefinitionManager = default!;
|
||||
[Robust.Shared.IoC.Dependency] private IServerEntityManager _serverEntityManager = default!;
|
||||
[Dependency] private IMapManager _mapManager = default!;
|
||||
[Dependency] private ITileDefinitionManager _tileDefinitionManager = default!;
|
||||
[Dependency] private IServerEntityManager _serverEntityManager = default!;
|
||||
|
||||
public GridTileLookupSystem GridTileLookupSystem { get; private set; } = default!;
|
||||
internal GasTileOverlaySystem GasTileOverlaySystem { get; private set; } = default!;
|
||||
@@ -44,12 +48,12 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
|
||||
public override string Name => "GridAtmosphere";
|
||||
|
||||
private bool _paused = false;
|
||||
private float _timer = 0f;
|
||||
private bool _paused;
|
||||
private float _timer;
|
||||
private Stopwatch _stopwatch = new();
|
||||
private GridId _gridId;
|
||||
|
||||
[ComponentDependency] private IMapGridComponent? _mapGridComponent = default!;
|
||||
[ComponentDependency] private IMapGridComponent? _mapGridComponent;
|
||||
|
||||
[ViewVariables]
|
||||
public int UpdateCounter { get; private set; } = 0;
|
||||
@@ -66,6 +70,12 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
[ViewVariables]
|
||||
private double _excitedGroupLastProcess;
|
||||
|
||||
[DataField("uniqueMixes")]
|
||||
private List<GasMixture>? _uniqueMixes;
|
||||
|
||||
[DataField("tiles")]
|
||||
private Dictionary<Vector2i, int>? _tiles;
|
||||
|
||||
[ViewVariables]
|
||||
protected readonly Dictionary<Vector2i, TileAtmosphere> Tiles = new(1000);
|
||||
|
||||
@@ -138,6 +148,11 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
[ViewVariables]
|
||||
private ProcessState _state = ProcessState.TileEqualize;
|
||||
|
||||
public GridAtmosphereComponent()
|
||||
{
|
||||
_paused = false;
|
||||
}
|
||||
|
||||
private enum ProcessState
|
||||
{
|
||||
TileEqualize,
|
||||
@@ -158,9 +173,59 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
indices.PryTile(_gridId, _mapManager, _tileDefinitionManager, _serverEntityManager);
|
||||
}
|
||||
|
||||
void ISerializationHooks.BeforeSerialization()
|
||||
{
|
||||
var uniqueMixes = new List<GasMixture>();
|
||||
var uniqueMixHash = new Dictionary<GasMixture, int>();
|
||||
var tiles = new Dictionary<Vector2i, int>();
|
||||
|
||||
foreach (var (indices, tile) in Tiles)
|
||||
{
|
||||
if (tile.Air == null) continue;
|
||||
|
||||
if (uniqueMixHash.TryGetValue(tile.Air, out var index))
|
||||
{
|
||||
tiles[indices] = index;
|
||||
continue;
|
||||
}
|
||||
|
||||
uniqueMixes.Add(tile.Air);
|
||||
var newIndex = uniqueMixes.Count - 1;
|
||||
uniqueMixHash[tile.Air] = newIndex;
|
||||
tiles[indices] = newIndex;
|
||||
}
|
||||
|
||||
if (uniqueMixes.Count == 0) uniqueMixes = null;
|
||||
if (tiles.Count == 0) tiles = null;
|
||||
|
||||
_uniqueMixes = uniqueMixes;
|
||||
_tiles = tiles;
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
Tiles.Clear();
|
||||
|
||||
if (_tiles != null && Owner.TryGetComponent(out IMapGridComponent? mapGrid))
|
||||
{
|
||||
foreach (var (indices, mix) in _tiles)
|
||||
{
|
||||
try
|
||||
{
|
||||
Tiles.Add(indices, new TileAtmosphere(this, mapGrid.GridIndex, indices, (GasMixture) _uniqueMixes![mix].Clone()));
|
||||
}
|
||||
catch (ArgumentOutOfRangeException)
|
||||
{
|
||||
Logger.Error($"Error during atmos serialization! Tile at {indices} points to an unique mix ({mix}) out of range!");
|
||||
throw;
|
||||
}
|
||||
|
||||
Invalidate(indices);
|
||||
}
|
||||
}
|
||||
|
||||
GridTileLookupSystem = EntitySystem.Get<GridTileLookupSystem>();
|
||||
GasTileOverlaySystem = EntitySystem.Get<GasTileOverlaySystem>();
|
||||
AtmosphereSystem = EntitySystem.Get<AtmosphereSystem>();
|
||||
@@ -840,60 +905,6 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
if (serializer.Reading && Owner.TryGetComponent(out IMapGridComponent? mapGrid))
|
||||
{
|
||||
var gridId = mapGrid.Grid.Index;
|
||||
|
||||
if (!serializer.TryReadDataField("uniqueMixes", out List<GasMixture>? uniqueMixes) ||
|
||||
!serializer.TryReadDataField("tiles", out Dictionary<Vector2i, int>? tiles))
|
||||
return;
|
||||
|
||||
Tiles.Clear();
|
||||
|
||||
foreach (var (indices, mix) in tiles!)
|
||||
{
|
||||
try
|
||||
{
|
||||
Tiles.Add(indices, new TileAtmosphere(this, gridId, indices, (GasMixture)uniqueMixes![mix].Clone()));
|
||||
}
|
||||
catch (ArgumentOutOfRangeException)
|
||||
{
|
||||
Logger.Error($"Error during atmos serialization! Tile at {indices} points to an unique mix ({mix}) out of range!");
|
||||
throw;
|
||||
}
|
||||
|
||||
Invalidate(indices);
|
||||
}
|
||||
}
|
||||
else if (serializer.Writing)
|
||||
{
|
||||
var uniqueMixes = new List<GasMixture>();
|
||||
var uniqueMixHash = new Dictionary<GasMixture, int>();
|
||||
var tiles = new Dictionary<Vector2i, int>();
|
||||
foreach (var (indices, tile) in Tiles)
|
||||
{
|
||||
if (tile.Air == null) continue;
|
||||
|
||||
if (uniqueMixHash.TryGetValue(tile.Air, out var index))
|
||||
{
|
||||
tiles[indices] = index;
|
||||
continue;
|
||||
}
|
||||
|
||||
uniqueMixes.Add(tile.Air);
|
||||
var newIndex = uniqueMixes.Count - 1;
|
||||
uniqueMixHash[tile.Air] = newIndex;
|
||||
tiles[indices] = newIndex;
|
||||
}
|
||||
|
||||
serializer.DataField(ref uniqueMixes, "uniqueMixes", new List<GasMixture>());
|
||||
serializer.DataField(ref tiles, "tiles", new Dictionary<Vector2i, int>());
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerator<TileAtmosphere> GetEnumerator()
|
||||
{
|
||||
return Tiles.Values.GetEnumerator();
|
||||
@@ -910,4 +921,16 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
// TODO ATMOS
|
||||
}
|
||||
}
|
||||
|
||||
public struct IntermediateTileAtmosphere
|
||||
{
|
||||
public readonly Vector2i Indices;
|
||||
public readonly GasMixture GasMixture;
|
||||
|
||||
public IntermediateTileAtmosphere(Vector2i indices, GasMixture gasMixture)
|
||||
{
|
||||
Indices = indices;
|
||||
GasMixture = gasMixture;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#nullable enable
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Atmos
|
||||
@@ -12,21 +12,16 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
public override string Name => "MovedByPressure";
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("enabled")]
|
||||
public bool Enabled { get; set; } = true;
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("pressureResistance")]
|
||||
public float PressureResistance { get; set; } = 1f;
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("moveResist")]
|
||||
public float MoveResist { get; set; } = 100f;
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public int LastHighPressureMovementAirCycle { get; set; } = 0;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(this, x => x.Enabled, "enabled", true);
|
||||
serializer.DataField(this, x => PressureResistance, "pressureResistance", 1f);
|
||||
serializer.DataField(this, x => MoveResist, "moveResist", 100f);
|
||||
}
|
||||
}
|
||||
|
||||
public static class MovedByPressureExtensions
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Content.Server.Atmos;
|
||||
using Content.Server.GameObjects.Components.NodeContainer;
|
||||
using Content.Server.GameObjects.Components.NodeContainer.Nodes;
|
||||
@@ -7,12 +9,10 @@ using Content.Shared.GameObjects.Components.Atmos;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Atmos.Piping.Filters
|
||||
namespace Content.Server.GameObjects.Components.Atmos.Piping
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class GasFilterComponent : Component
|
||||
@@ -44,7 +44,8 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Filters
|
||||
UpdateAppearance();
|
||||
}
|
||||
}
|
||||
private Gas _gasToFilter;
|
||||
|
||||
[DataField("gasToFilter")] private Gas _gasToFilter = Gas.Plasma;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public int VolumeFilterRate
|
||||
@@ -52,6 +53,8 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Filters
|
||||
get => _volumeFilterRate;
|
||||
set => _volumeFilterRate = Math.Clamp(value, 0, MaxVolumeFilterRate);
|
||||
}
|
||||
|
||||
[DataField("startingVolumePumpRate")]
|
||||
private int _volumeFilterRate;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
@@ -60,22 +63,23 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Filters
|
||||
get => _maxVolumeFilterRate;
|
||||
set => Math.Max(value, 0);
|
||||
}
|
||||
private int _maxVolumeFilterRate;
|
||||
|
||||
[ViewVariables]
|
||||
private PipeDirection _initialInletDirection;
|
||||
[DataField("maxVolumePumpRate")] private int _maxVolumeFilterRate = 100;
|
||||
|
||||
[DataField("inletDirection")] [ViewVariables]
|
||||
private PipeDirection _initialInletDirection = PipeDirection.None;
|
||||
|
||||
/// <summary>
|
||||
/// The direction the filtered-out gas goes.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
private PipeDirection _initialFilterOutletDirection;
|
||||
[DataField("filterOutletDirection")] [ViewVariables]
|
||||
private PipeDirection _initialFilterOutletDirection = PipeDirection.None;
|
||||
|
||||
/// <summary>
|
||||
/// The direction the rest of the gas goes.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
private PipeDirection _initialOutletDirection;
|
||||
[DataField("outletDirection")] [ViewVariables]
|
||||
private PipeDirection _initialOutletDirection = PipeDirection.None;
|
||||
|
||||
[ViewVariables]
|
||||
private PipeNode? _inletPipe;
|
||||
@@ -89,17 +93,6 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Filters
|
||||
[ComponentDependency]
|
||||
private readonly AppearanceComponent? _appearance = default;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _volumeFilterRate, "startingVolumePumpRate", 0);
|
||||
serializer.DataField(ref _maxVolumeFilterRate, "maxVolumePumpRate", 100);
|
||||
serializer.DataField(ref _gasToFilter, "gasToFilter", Gas.Plasma);
|
||||
serializer.DataField(ref _initialInletDirection, "inletDirection", PipeDirection.None);
|
||||
serializer.DataField(ref _initialFilterOutletDirection, "filterOutletDirection", PipeDirection.None);
|
||||
serializer.DataField(ref _initialOutletDirection, "outletDirection", PipeDirection.None);
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#nullable enable
|
||||
using System.Linq;
|
||||
using Content.Server.GameObjects.Components.NodeContainer;
|
||||
using Content.Server.GameObjects.Components.NodeContainer.Nodes;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using System.Linq;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Atmos.Piping
|
||||
{
|
||||
@@ -21,26 +21,30 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
|
||||
/// <summary>
|
||||
/// If the generator is producing gas.
|
||||
/// </summary>
|
||||
[DataField("generatorEnabled")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool GeneratorEnabled { get; set; }
|
||||
public bool GeneratorEnabled { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// What gas is being generated.
|
||||
/// </summary>
|
||||
[DataField("generatedGas")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public Gas GeneratedGas { get; set; }
|
||||
public Gas GeneratedGas { get; set; } = Gas.Oxygen;
|
||||
|
||||
/// <summary>
|
||||
/// Molar rate of gas generation.
|
||||
/// </summary>
|
||||
[DataField("gasGenerationRate")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float GasGenerationRate { get; set; }
|
||||
public float GasGenerationRate { get; set; } = 10;
|
||||
|
||||
/// <summary>
|
||||
/// The pipe pressure above which the generator stops producing gas.
|
||||
/// </summary>
|
||||
[DataField("generatorPressureCap")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float GeneratorPressureCap { get; set; }
|
||||
public float GeneratorPressureCap { get; set; } = 10;
|
||||
|
||||
/// <summary>
|
||||
/// The pipe to which generated gas is added.
|
||||
@@ -48,15 +52,6 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping
|
||||
[ViewVariables]
|
||||
private PipeNode? Pipe { get; set; }
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(this, x => x.GeneratorEnabled, "generatorEnabled", true);
|
||||
serializer.DataField(this, x => x.GeneratedGas, "generatedGas", Gas.Oxygen);
|
||||
serializer.DataField(this, x => x.GasGenerationRate, "gasGenerationRate", 10);
|
||||
serializer.DataField(this, x => x.GeneratorPressureCap, "generatorPressureCap", 10);
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
@@ -8,7 +8,9 @@ using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Atmos.Piping.Pumps
|
||||
@@ -31,19 +33,23 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Pumps
|
||||
UpdateAppearance();
|
||||
}
|
||||
}
|
||||
|
||||
[DataField("pumpEnabled")]
|
||||
private bool _pumpEnabled;
|
||||
|
||||
/// <summary>
|
||||
/// Needs to be same <see cref="PipeDirection"/> as that of a <see cref="PipeNode"/> on this entity.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
private PipeDirection _initialInletDirection;
|
||||
[DataField("initialInletDirection")]
|
||||
private PipeDirection _initialInletDirection = PipeDirection.None;
|
||||
|
||||
/// <summary>
|
||||
/// Needs to be same <see cref="PipeDirection"/> as that of a <see cref="PipeNode"/> on this entity.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
private PipeDirection _initialOutletDirection;
|
||||
[DataField("initialOutletDirection")]
|
||||
private PipeDirection _initialOutletDirection = PipeDirection.None;
|
||||
|
||||
[ViewVariables]
|
||||
private PipeNode? _inletPipe;
|
||||
@@ -53,14 +59,6 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Pumps
|
||||
|
||||
private AppearanceComponent? _appearance;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _initialInletDirection, "inletDirection", PipeDirection.None);
|
||||
serializer.DataField(ref _initialOutletDirection, "outletDirection", PipeDirection.None);
|
||||
serializer.DataField(ref _pumpEnabled, "pumpEnabled", false);
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
@@ -3,7 +3,9 @@ using System;
|
||||
using Content.Server.Atmos;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Atmos.Piping.Pumps
|
||||
@@ -24,6 +26,8 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Pumps
|
||||
get => _pressurePumpTarget;
|
||||
set => _pressurePumpTarget = Math.Clamp(value, 0, MaxPressurePumpTarget);
|
||||
}
|
||||
|
||||
[DataField("startingPressurePumpTarget")]
|
||||
private int _pressurePumpTarget;
|
||||
|
||||
/// <summary>
|
||||
@@ -35,7 +39,8 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Pumps
|
||||
get => _maxPressurePumpTarget;
|
||||
set => Math.Max(value, 0);
|
||||
}
|
||||
private int _maxPressurePumpTarget;
|
||||
[DataField("maxPressurePumpTarget")]
|
||||
private int _maxPressurePumpTarget = 100;
|
||||
|
||||
/// <summary>
|
||||
/// Every update, this pump will only increase the outlet pressure by this fraction of the amount needed to reach the <see cref="PressurePumpTarget"/>.
|
||||
@@ -46,15 +51,8 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Pumps
|
||||
get => _transferRatio;
|
||||
set => _transferRatio = Math.Clamp(value, 0, 1);
|
||||
}
|
||||
private float _transferRatio;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _pressurePumpTarget, "startingPressurePumpTarget", 0);
|
||||
serializer.DataField(ref _maxPressurePumpTarget, "maxPressurePumpTarget", 100);
|
||||
serializer.DataField(ref _transferRatio, "transferRatio", 0.5f);
|
||||
}
|
||||
[DataField("transferRatio")]
|
||||
private float _transferRatio = 0.5f;
|
||||
|
||||
protected override void PumpGas(GasMixture inletGas, GasMixture outletGas)
|
||||
{
|
||||
|
||||
@@ -3,7 +3,9 @@ using System;
|
||||
using Content.Server.Atmos;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Atmos.Piping.Pumps
|
||||
@@ -19,6 +21,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Pumps
|
||||
get => _volumePumpRate;
|
||||
set => _volumePumpRate = Math.Clamp(value, 0, MaxVolumePumpRate);
|
||||
}
|
||||
[DataField("startingVolumePumpRate")]
|
||||
private int _volumePumpRate;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
@@ -27,17 +30,11 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Pumps
|
||||
get => _maxVolumePumpRate;
|
||||
set => Math.Max(value, 0);
|
||||
}
|
||||
private int _maxVolumePumpRate;
|
||||
[DataField("maxVolumePumpRate")]
|
||||
private int _maxVolumePumpRate = 100;
|
||||
|
||||
public override string Name => "VolumePump";
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _volumePumpRate, "startingVolumePumpRate", 0);
|
||||
serializer.DataField(ref _maxVolumePumpRate, "maxVolumePumpRate", 100);
|
||||
}
|
||||
|
||||
protected override void PumpGas(GasMixture inletGas, GasMixture outletGas)
|
||||
{
|
||||
var volumeRatio = Math.Clamp(VolumePumpRate / inletGas.Volume, 0, 1);
|
||||
|
||||
@@ -3,7 +3,9 @@ using System;
|
||||
using Content.Server.Atmos;
|
||||
using Content.Shared.Atmos;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Atmos.Piping.Scrubbers
|
||||
@@ -23,7 +25,8 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Scrubbers
|
||||
get => _siphonPressureTarget;
|
||||
set => _siphonPressureTarget = Math.Max(value, 0);
|
||||
}
|
||||
private float _siphonPressureTarget;
|
||||
[DataField("startingSiphonPressureTarget")]
|
||||
private float _siphonPressureTarget = Atmospherics.OneAtmosphere * 2;
|
||||
|
||||
/// <summary>
|
||||
/// Every update, this siphon will only decrease the inlet pressure by this fraction of the amount needed to reach the <see cref="SiphonPressureTarget"/>.
|
||||
@@ -34,14 +37,8 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Scrubbers
|
||||
get => _transferRatio;
|
||||
set => _transferRatio = Math.Clamp(value, 0, 1);
|
||||
}
|
||||
private float _transferRatio;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _siphonPressureTarget, "startingSiphonPressureTarget", Atmospherics.OneAtmosphere * 2);
|
||||
serializer.DataField(ref _transferRatio, "transferRatio", 0.5f);
|
||||
}
|
||||
[DataField("transferRatio")]
|
||||
private float _transferRatio = 0.5f;
|
||||
|
||||
protected override void ScrubGas(GasMixture inletGas, GasMixture outletGas)
|
||||
{
|
||||
|
||||
@@ -5,6 +5,8 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using System;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Atmos.Piping.Vents
|
||||
{
|
||||
@@ -23,7 +25,8 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Vents
|
||||
get => _ventPressureTarget;
|
||||
set => _ventPressureTarget = Math.Clamp(value, 0, MaxVentPressureTarget);
|
||||
}
|
||||
private float _ventPressureTarget;
|
||||
[DataField("startingVentPressureTarget")]
|
||||
private float _ventPressureTarget = Atmospherics.OneAtmosphere;
|
||||
|
||||
/// <summary>
|
||||
/// Max value <see cref="VentPressureTarget"/> can be set to.
|
||||
@@ -34,7 +37,8 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Vents
|
||||
get => _maxVentPressureTarget;
|
||||
set => Math.Max(value, 0);
|
||||
}
|
||||
private float _maxVentPressureTarget;
|
||||
[DataField("maxVentPressureTarget")]
|
||||
private float _maxVentPressureTarget = Atmospherics.OneAtmosphere * 2;
|
||||
|
||||
/// <summary>
|
||||
/// Every update, this vent will only increase the outlet pressure by this fraction of the amount needed to reach the <see cref="VentPressureTarget"/>.
|
||||
@@ -45,15 +49,8 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Vents
|
||||
get => _transferRatio;
|
||||
set => _transferRatio = Math.Clamp(value, 0, 1);
|
||||
}
|
||||
private float _transferRatio;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _ventPressureTarget, "startingVentPressureTarget", Atmospherics.OneAtmosphere);
|
||||
serializer.DataField(ref _maxVentPressureTarget, "maxVentPressureTarget", Atmospherics.OneAtmosphere * 2);
|
||||
serializer.DataField(ref _transferRatio, "transferRatio", 0.5f);
|
||||
}
|
||||
[DataField("transferRatio")]
|
||||
private float _transferRatio = 0.5f;
|
||||
|
||||
protected override void VentGas(GasMixture inletGas, GasMixture outletGas)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using Content.Server.Interfaces.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Atmos
|
||||
@@ -11,17 +13,11 @@ namespace Content.Server.GameObjects.Components.Atmos
|
||||
public override string Name => "PressureProtection";
|
||||
|
||||
[ViewVariables]
|
||||
public float HighPressureMultiplier { get; private set; }
|
||||
[DataField("highPressureMultiplier")]
|
||||
public float HighPressureMultiplier { get; private set; } = 1f;
|
||||
|
||||
[ViewVariables]
|
||||
public float LowPressureMultiplier { get; private set; }
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(this, x => x.HighPressureMultiplier, "highPressureMultiplier", 1f);
|
||||
serializer.DataField(this, x => x.LowPressureMultiplier, "lowPressureMultiplier", 1f);
|
||||
}
|
||||
[DataField("lowPressureMultiplier")]
|
||||
public float LowPressureMultiplier { get; private set; } = 1f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,9 @@ using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components
|
||||
@@ -10,7 +12,8 @@ namespace Content.Server.GameObjects.Components
|
||||
[RegisterComponent]
|
||||
public sealed class AtmosPlaqueComponent : Component, IMapInit
|
||||
{
|
||||
private PlaqueType _type;
|
||||
[DataField("plaqueType")]
|
||||
private PlaqueType _type = PlaqueType.Unset;
|
||||
public override string Name => "AtmosPlaque";
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
@@ -89,13 +92,6 @@ namespace Content.Server.GameObjects.Components
|
||||
}
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _type, "plaqueType", PlaqueType.Unset);
|
||||
}
|
||||
|
||||
public enum PlaqueType
|
||||
{
|
||||
Unset = 0,
|
||||
|
||||
@@ -9,6 +9,7 @@ using Robust.Shared.Log;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.BarSign
|
||||
@@ -21,6 +22,7 @@ namespace Content.Server.GameObjects.Components.BarSign
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly IRobustRandom _robustRandom = default!;
|
||||
|
||||
[DataField("current")]
|
||||
private string? _currentSign;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
@@ -98,13 +100,6 @@ namespace Content.Server.GameObjects.Components.BarSign
|
||||
UpdateSignInfo();
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _currentSign, "current", null);
|
||||
}
|
||||
|
||||
public void MapInit()
|
||||
{
|
||||
if (_currentSign != null)
|
||||
|
||||
@@ -1,40 +1,44 @@
|
||||
#nullable enable
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.BarSign
|
||||
{
|
||||
[Prototype("barSign")]
|
||||
public class BarSignPrototype : IPrototype
|
||||
{
|
||||
public string ID { get; private set; }
|
||||
public string Icon { get; private set; }
|
||||
public string Name { get; private set; }
|
||||
public string Description { get; private set; }
|
||||
public bool RenameArea { get; private set; } = true;
|
||||
public bool Hidden { get; private set; }
|
||||
private string _description = "";
|
||||
private string _name = "";
|
||||
|
||||
public void LoadFrom(YamlMappingNode mapping)
|
||||
[ViewVariables]
|
||||
[field: DataField("id", required: true)]
|
||||
public string ID { get; } = default!;
|
||||
|
||||
[ViewVariables]
|
||||
[field: DataField("parent")]
|
||||
public string? Parent { get; }
|
||||
|
||||
[DataField("icon")] public string Icon { get; private set; } = "";
|
||||
|
||||
[DataField("name")]
|
||||
public string Name
|
||||
{
|
||||
ID = mapping.GetNode("id").AsString();
|
||||
Name = Loc.GetString(mapping.GetNode("name").AsString());
|
||||
Icon = mapping.GetNode("icon").AsString();
|
||||
|
||||
if (mapping.TryGetNode("hidden", out var node))
|
||||
{
|
||||
Hidden = node.AsBool();
|
||||
}
|
||||
|
||||
if (mapping.TryGetNode("renameArea", out node))
|
||||
{
|
||||
RenameArea = node.AsBool();
|
||||
}
|
||||
|
||||
if (mapping.TryGetNode("description", out node))
|
||||
{
|
||||
Description = Loc.GetString(node.AsString());
|
||||
}
|
||||
get => _name;
|
||||
private set => _name = Loc.GetString(value);
|
||||
}
|
||||
|
||||
[DataField("description")]
|
||||
public string Description
|
||||
{
|
||||
get => _description;
|
||||
private set => _description = Loc.GetString(value);
|
||||
}
|
||||
|
||||
[DataField("renameArea")]
|
||||
public bool RenameArea { get; private set; } = true;
|
||||
[DataField("hidden")]
|
||||
public bool Hidden { get; private set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,10 @@ using System.Linq;
|
||||
using Content.Server.GameObjects.Components.Body.Circulatory;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.GameObjects.Components.Body.Networks;
|
||||
using Content.Shared.Interfaces.Chemistry;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Body.Behavior
|
||||
@@ -27,21 +28,25 @@ namespace Content.Server.GameObjects.Components.Body.Behavior
|
||||
/// <summary>
|
||||
/// Modifier for alcohol damage.
|
||||
/// </summary>
|
||||
[DataField("alcoholLethality")]
|
||||
[ViewVariables] private float _alcoholLethality = 0.005f;
|
||||
|
||||
/// <summary>
|
||||
/// Modifier for alcohol damage.
|
||||
/// </summary>
|
||||
[DataField("alcoholExponent")]
|
||||
[ViewVariables] private float _alcoholExponent = 1.6f;
|
||||
|
||||
/// <summary>
|
||||
/// Toxin volume that can be purged without damage.
|
||||
/// </summary>
|
||||
[DataField("toxinTolerance")]
|
||||
[ViewVariables] private float _toxinTolerance = 3f;
|
||||
|
||||
/// <summary>
|
||||
/// Toxin damage modifier.
|
||||
/// </summary>
|
||||
[DataField("toxinLethality")]
|
||||
[ViewVariables] private float _toxinLethality = 0.01f;
|
||||
|
||||
/// <summary>
|
||||
@@ -102,15 +107,5 @@ namespace Content.Server.GameObjects.Components.Body.Behavior
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
//Uses typical human values for defaults.
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _alcoholLethality, "alcoholLethality", 0.005f);
|
||||
serializer.DataField(ref _alcoholExponent, "alcoholExponent", 1.6f);
|
||||
serializer.DataField(ref _toxinTolerance, "toxinTolerance", 3f);
|
||||
serializer.DataField(ref _toxinLethality, "toxinLethality", 0.01f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,12 +10,13 @@ using Content.Shared.GameObjects.Components.Body;
|
||||
using Content.Shared.GameObjects.Components.Mobs.State;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Body.Behavior
|
||||
{
|
||||
[DataDefinition]
|
||||
public class LungBehavior : MechanismBehavior
|
||||
{
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
@@ -24,43 +25,27 @@ namespace Content.Server.GameObjects.Components.Body.Behavior
|
||||
|
||||
[ViewVariables] private TimeSpan _lastGaspPopupTime;
|
||||
|
||||
[ViewVariables] public GasMixture Air { get; set; } = default!;
|
||||
[DataField("air")]
|
||||
[ViewVariables]
|
||||
public GasMixture Air { get; set; } = new()
|
||||
{
|
||||
Volume = 6,
|
||||
Temperature = Atmospherics.NormalBodyTemperature
|
||||
};
|
||||
|
||||
[ViewVariables] public float Temperature => Air.Temperature;
|
||||
|
||||
[ViewVariables] public float Volume => Air.Volume;
|
||||
|
||||
[ViewVariables] public TimeSpan GaspPopupCooldown { get; private set; }
|
||||
[DataField("gaspPopupCooldown")]
|
||||
[ViewVariables]
|
||||
public TimeSpan GaspPopupCooldown { get; private set; } = TimeSpan.FromSeconds(8);
|
||||
|
||||
[ViewVariables] public LungStatus Status { get; set; }
|
||||
|
||||
[ViewVariables] public float CycleDelay { get; set; }
|
||||
[DataField("cycleDelay")]
|
||||
[ViewVariables]
|
||||
public float CycleDelay { get; set; } = 2;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
public LungBehavior()
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
Air = new GasMixture {Temperature = Atmospherics.NormalBodyTemperature};
|
||||
|
||||
serializer.DataField(this, l => l.CycleDelay, "cycleDelay", 2);
|
||||
|
||||
serializer.DataReadWriteFunction(
|
||||
"volume",
|
||||
6,
|
||||
vol => Air.Volume = vol,
|
||||
() => Air.Volume);
|
||||
|
||||
serializer.DataReadWriteFunction(
|
||||
"temperature",
|
||||
Atmospherics.NormalBodyTemperature,
|
||||
temp => Air.Temperature = temp,
|
||||
() => Air.Temperature);
|
||||
|
||||
serializer.DataReadWriteFunction(
|
||||
"gaspPopupCooldown",
|
||||
8f,
|
||||
delay => GaspPopupCooldown = TimeSpan.FromSeconds(delay),
|
||||
() => GaspPopupCooldown.TotalSeconds);
|
||||
IoCManager.InjectDependencies(this);
|
||||
}
|
||||
|
||||
protected override void OnAddedToBody(IBody body)
|
||||
|
||||
@@ -4,7 +4,6 @@ using Content.Shared.GameObjects.Components.Body.Behavior;
|
||||
using Content.Shared.GameObjects.Components.Body.Mechanism;
|
||||
using Content.Shared.GameObjects.Components.Body.Part;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Body.Behavior
|
||||
@@ -19,8 +18,6 @@ namespace Content.Server.GameObjects.Components.Body.Behavior
|
||||
|
||||
public IEntity Owner => Parent.Owner;
|
||||
|
||||
public virtual void ExposeData(ObjectSerializer serializer) { }
|
||||
|
||||
public virtual void Initialize(IMechanism parent)
|
||||
{
|
||||
Parent = parent;
|
||||
|
||||
@@ -7,7 +7,7 @@ using Content.Shared.Chemistry;
|
||||
using Content.Shared.GameObjects.Components.Body.Networks;
|
||||
using Content.Shared.GameObjects.Components.Chemistry;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Body.Behavior
|
||||
@@ -89,15 +89,16 @@ namespace Content.Server.GameObjects.Components.Body.Behavior
|
||||
/// <summary>
|
||||
/// Initial internal solution storage volume
|
||||
/// </summary>
|
||||
[DataField("maxVolume")]
|
||||
[ViewVariables]
|
||||
protected ReagentUnit InitialMaxVolume { get; private set; }
|
||||
protected ReagentUnit InitialMaxVolume { get; private set; } = ReagentUnit.New(100);
|
||||
|
||||
/// <summary>
|
||||
/// Time in seconds between reagents being ingested and them being
|
||||
/// transferred to <see cref="SharedBloodstreamComponent"/>
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
private float _digestionDelay;
|
||||
[DataField("digestionDelay")] [ViewVariables]
|
||||
private float _digestionDelay = 20;
|
||||
|
||||
/// <summary>
|
||||
/// Used to track how long each reagent has been in the stomach
|
||||
@@ -105,13 +106,6 @@ namespace Content.Server.GameObjects.Components.Body.Behavior
|
||||
[ViewVariables]
|
||||
private readonly List<ReagentDelta> _reagentDeltas = new();
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(this, s => s.InitialMaxVolume, "maxVolume", ReagentUnit.New(100));
|
||||
serializer.DataField(ref _digestionDelay, "digestionDelay", 20);
|
||||
}
|
||||
|
||||
public override void Startup()
|
||||
{
|
||||
base.Startup();
|
||||
|
||||
@@ -7,7 +7,9 @@ using Content.Shared.Atmos;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.GameObjects.Components.Body.Networks;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Body.Circulatory
|
||||
@@ -21,7 +23,8 @@ namespace Content.Server.GameObjects.Components.Body.Circulatory
|
||||
/// <summary>
|
||||
/// Max volume of internal solution storage
|
||||
/// </summary>
|
||||
[ViewVariables] private ReagentUnit _initialMaxVolume;
|
||||
[DataField("maxVolume")]
|
||||
[ViewVariables] private ReagentUnit _initialMaxVolume = ReagentUnit.New(250);
|
||||
|
||||
/// <summary>
|
||||
/// Internal solution for reagent storage
|
||||
@@ -33,7 +36,9 @@ namespace Content.Server.GameObjects.Components.Body.Circulatory
|
||||
/// </summary>
|
||||
[ViewVariables] public ReagentUnit EmptyVolume => _internalSolution.EmptyVolume;
|
||||
|
||||
[ViewVariables] public GasMixture Air { get; set; }
|
||||
[ViewVariables]
|
||||
public GasMixture Air { get; set; } = new(6)
|
||||
{Temperature = Atmospherics.NormalBodyTemperature};
|
||||
|
||||
[ViewVariables] public SolutionContainerComponent Solution => _internalSolution;
|
||||
|
||||
@@ -45,15 +50,6 @@ namespace Content.Server.GameObjects.Components.Body.Circulatory
|
||||
_internalSolution.MaxVolume = _initialMaxVolume;
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
Air = new GasMixture(6) {Temperature = Atmospherics.NormalBodyTemperature};
|
||||
|
||||
serializer.DataField(ref _initialMaxVolume, "maxVolume", ReagentUnit.New(250));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempt to transfer provided solution to internal solution.
|
||||
/// Only supports complete transfers
|
||||
|
||||
@@ -16,7 +16,9 @@ using Robust.Server.Player;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Body.Surgery
|
||||
@@ -33,13 +35,15 @@ namespace Content.Server.GameObjects.Components.Body.Surgery
|
||||
|
||||
private readonly Dictionary<int, object> _optionsCache = new();
|
||||
|
||||
private float _baseOperateTime;
|
||||
[DataField("baseOperateTime")]
|
||||
private float _baseOperateTime = 5;
|
||||
|
||||
private ISurgeon.MechanismRequestCallback? _callbackCache;
|
||||
|
||||
private int _idHash;
|
||||
|
||||
private SurgeryType _surgeryType;
|
||||
[DataField("surgeryType")]
|
||||
private SurgeryType _surgeryType = SurgeryType.Incision;
|
||||
|
||||
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(SurgeryUIKey.Key);
|
||||
|
||||
@@ -141,14 +145,6 @@ namespace Content.Server.GameObjects.Components.Body.Surgery
|
||||
}
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _surgeryType, "surgeryType", SurgeryType.Incision);
|
||||
serializer.DataField(ref _baseOperateTime, "baseOperateTime", 5);
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
@@ -28,6 +28,7 @@ using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
@@ -52,6 +53,7 @@ namespace Content.Server.GameObjects.Components.Botany
|
||||
[ViewVariables(VVAccess.ReadWrite)] private bool _updateSpriteAfterUpdate;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("drawWarnings")]
|
||||
public bool DrawWarnings { get; private set; } = false;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
@@ -124,12 +126,6 @@ namespace Content.Server.GameObjects.Components.Botany
|
||||
Owner.EnsureComponentWarn<SolutionContainerComponent>();
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(this, x => x.DrawWarnings, "drawWarnings", false);
|
||||
}
|
||||
|
||||
public void WeedInvasion()
|
||||
{
|
||||
// TODO
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Server.Botany;
|
||||
#nullable enable
|
||||
using Content.Server.Botany;
|
||||
using Content.Server.GameObjects.Components.Chemistry;
|
||||
using Content.Shared.Chemistry;
|
||||
using Robust.Server.GameObjects;
|
||||
@@ -7,39 +8,36 @@ using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Botany
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class ProduceComponent : Component
|
||||
public class ProduceComponent : Component, ISerializationHooks
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
public override string Name => "Produce";
|
||||
|
||||
[DataField("seed")]
|
||||
private string? _seedName;
|
||||
|
||||
[ViewVariables]
|
||||
public Seed Seed { get; set; } = null;
|
||||
|
||||
public float Potency => Seed.Potency;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
public Seed? Seed
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataReadFunction<string>("seed", null,
|
||||
(s) =>
|
||||
{
|
||||
if(!string.IsNullOrEmpty(s))
|
||||
Seed = _prototypeManager.Index<Seed>(s);
|
||||
});
|
||||
get => _seedName != null ? IoCManager.Resolve<IPrototypeManager>().Index<Seed>(_seedName) : null;
|
||||
set => _seedName = value?.ID;
|
||||
}
|
||||
|
||||
public float Potency => Seed?.Potency ?? 0;
|
||||
|
||||
public void Grown()
|
||||
{
|
||||
if (Seed == null)
|
||||
return;
|
||||
|
||||
if (Owner.TryGetComponent(out SpriteComponent sprite))
|
||||
if (Owner.TryGetComponent(out SpriteComponent? sprite))
|
||||
{
|
||||
sprite.LayerSetRSI(0, Seed.PlantRsi);
|
||||
sprite.LayerSetState(0, Seed.PlantIconState);
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
using Content.Server.Botany;
|
||||
#nullable enable
|
||||
using Content.Server.Botany;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
@@ -16,19 +18,15 @@ namespace Content.Server.GameObjects.Components.Botany
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
public override string Name => "Seed";
|
||||
|
||||
[DataField("seed")]
|
||||
private string? _seedName;
|
||||
|
||||
[ViewVariables]
|
||||
public Seed Seed { get; set; } = null;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
public Seed? Seed
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataReadFunction<string>("seed", null,
|
||||
(s) =>
|
||||
{
|
||||
if(!string.IsNullOrEmpty(s))
|
||||
Seed = _prototypeManager.Index<Seed>(s);
|
||||
});
|
||||
get => _seedName != null ? IoCManager.Resolve<IPrototypeManager>().Index<Seed>(_seedName) : null;
|
||||
set => _seedName = value?.ID;
|
||||
}
|
||||
|
||||
public void Examine(FormattedMessage message, bool inDetailsRange)
|
||||
|
||||
@@ -22,7 +22,7 @@ using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
@@ -42,14 +42,16 @@ namespace Content.Server.GameObjects.Components.Buckle
|
||||
[ComponentDependency] private readonly StunnableComponent? _stunnable = null;
|
||||
[ComponentDependency] private readonly MobStateComponent? _mobState = null;
|
||||
|
||||
private int _size;
|
||||
[DataField("size")]
|
||||
private int _size = 100;
|
||||
|
||||
/// <summary>
|
||||
/// The amount of time that must pass for this entity to
|
||||
/// be able to unbuckle after recently buckling.
|
||||
/// </summary>
|
||||
[DataField("delay")]
|
||||
[ViewVariables]
|
||||
private TimeSpan _unbuckleDelay;
|
||||
private TimeSpan _unbuckleDelay = TimeSpan.FromSeconds(0.25f);
|
||||
|
||||
/// <summary>
|
||||
/// The time that this entity buckled at.
|
||||
@@ -383,19 +385,6 @@ namespace Content.Server.GameObjects.Components.Buckle
|
||||
return TryBuckle(user, to);
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _size, "size", 100);
|
||||
|
||||
serializer.DataReadWriteFunction(
|
||||
"cooldown",
|
||||
0.25f,
|
||||
seconds => _unbuckleDelay = TimeSpan.FromSeconds(seconds),
|
||||
() => (float) _unbuckleDelay.TotalSeconds);
|
||||
}
|
||||
|
||||
protected override void Startup()
|
||||
{
|
||||
base.Startup();
|
||||
|
||||
@@ -14,6 +14,9 @@ using Robust.Shared.ViewVariables;
|
||||
using System.Collections.Generic;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Map;
|
||||
using System.Linq;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Cargo
|
||||
{
|
||||
@@ -55,6 +58,7 @@ namespace Content.Server.GameObjects.Components.Cargo
|
||||
}
|
||||
}
|
||||
|
||||
[DataField("requestOnly")]
|
||||
private bool _requestOnly = false;
|
||||
|
||||
private bool Powered => !Owner.TryGetComponent(out PowerReceiverComponent? receiver) || receiver.Powered;
|
||||
@@ -88,16 +92,6 @@ namespace Content.Server.GameObjects.Components.Cargo
|
||||
base.OnRemove();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads data from YAML
|
||||
/// </summary>
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _requestOnly, "requestOnly", false);
|
||||
}
|
||||
|
||||
private void UserInterfaceOnOnReceiveMessage(ServerBoundUserInterfaceMessage serverMsg)
|
||||
{
|
||||
if (!Owner.TryGetComponent(out CargoOrderDatabaseComponent? orders))
|
||||
|
||||
@@ -20,6 +20,9 @@ using Robust.Shared.Audio;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Chemistry
|
||||
|
||||
@@ -7,7 +7,7 @@ using Content.Shared.GameObjects.Components.Chemistry;
|
||||
using Content.Shared.GameObjects.Components.Inventory;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Chemistry
|
||||
{
|
||||
@@ -17,13 +17,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
||||
{
|
||||
public override string Name => "FoamSolutionAreaEffect";
|
||||
|
||||
private string? _foamedMetalPrototype;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _foamedMetalPrototype, "foamedMetalPrototype", null);
|
||||
}
|
||||
[DataField("foamedMetalPrototype")] private string? _foamedMetalPrototype;
|
||||
|
||||
protected override void UpdateVisuals()
|
||||
{
|
||||
|
||||
@@ -13,6 +13,7 @@ using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
#nullable enable
|
||||
@@ -22,19 +23,16 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
||||
[RegisterComponent]
|
||||
public sealed class HyposprayComponent : SharedHyposprayComponent, IAttack, ISolutionChange, IAfterInteract
|
||||
{
|
||||
[ViewVariables(VVAccess.ReadWrite)] public float ClumsyFailChance { get; set; }
|
||||
[ViewVariables(VVAccess.ReadWrite)] public ReagentUnit TransferAmount { get; set; }
|
||||
[DataField("ClumsyFailChance")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public float ClumsyFailChance { get; set; } = 0.5f;
|
||||
|
||||
[DataField("TransferAmount")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public ReagentUnit TransferAmount { get; set; } = ReagentUnit.New(5);
|
||||
|
||||
[ComponentDependency] private readonly SolutionContainerComponent? _solution = default!;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(this, x => x.ClumsyFailChance, "ClumsyFailChance", 0.5f);
|
||||
serializer.DataField(this, x => x.TransferAmount, "TransferAmount", ReagentUnit.New(5));
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
@@ -12,6 +12,7 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Chemistry
|
||||
@@ -28,18 +29,24 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
||||
/// Whether or not the injector is able to draw from containers or if it's a single use
|
||||
/// device that can only inject.
|
||||
/// </summary>
|
||||
[ViewVariables] private bool _injectOnly;
|
||||
[ViewVariables]
|
||||
[DataField("injectOnly")]
|
||||
private bool _injectOnly;
|
||||
|
||||
/// <summary>
|
||||
/// Amount to inject or draw on each usage. If the injector is inject only, it will
|
||||
/// attempt to inject it's entire contents upon use.
|
||||
/// </summary>
|
||||
[ViewVariables] private ReagentUnit _transferAmount;
|
||||
[ViewVariables]
|
||||
[DataField("transferAmount")]
|
||||
private ReagentUnit _transferAmount = ReagentUnit.New(5);
|
||||
|
||||
/// <summary>
|
||||
/// Initial storage volume of the injector
|
||||
/// </summary>
|
||||
[ViewVariables] private ReagentUnit _initialMaxVolume;
|
||||
[ViewVariables]
|
||||
[DataField("initialMaxVolume")]
|
||||
private ReagentUnit _initialMaxVolume = ReagentUnit.New(15);
|
||||
|
||||
private InjectorToggleMode _toggleState;
|
||||
|
||||
@@ -59,16 +66,6 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
||||
}
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _injectOnly, "injectOnly", false);
|
||||
serializer.DataField(ref _initialMaxVolume, "initialMaxVolume", ReagentUnit.New(15));
|
||||
serializer.DataField(ref _transferAmount, "transferAmount", ReagentUnit.New(5));
|
||||
serializer.DataField(ref _toggleState, "toggleState",
|
||||
_injectOnly ? InjectorToggleMode.Inject : InjectorToggleMode.Draw);
|
||||
}
|
||||
|
||||
protected override void Startup()
|
||||
{
|
||||
base.Startup();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.GameObjects.Components.Body.Behavior;
|
||||
using Content.Server.GameObjects.Components.Nutrition;
|
||||
using Content.Server.GameObjects.Components.Culinary;
|
||||
using Content.Server.GameObjects.Components.Nutrition;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.GameObjects.Components.Body;
|
||||
using Content.Shared.Interfaces;
|
||||
@@ -13,8 +13,7 @@ using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Chemistry
|
||||
@@ -27,22 +26,19 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
||||
public override string Name => "Pill";
|
||||
|
||||
[ViewVariables]
|
||||
private string _useSound;
|
||||
[DataField("useSound")]
|
||||
protected override string UseSound { get; set; } = default;
|
||||
|
||||
[ViewVariables]
|
||||
private string _trashPrototype;
|
||||
[DataField("trash")]
|
||||
protected override string TrashPrototype { get; set; } = default;
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("transferAmount")]
|
||||
protected override ReagentUnit TransferAmount { get; set; } = ReagentUnit.New(1000);
|
||||
|
||||
[ViewVariables]
|
||||
private SolutionContainerComponent _contents;
|
||||
[ViewVariables]
|
||||
private ReagentUnit _transferAmount;
|
||||
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _useSound, "useSound", null);
|
||||
serializer.DataField(ref _transferAmount, "transferAmount", ReagentUnit.New(1000));
|
||||
serializer.DataField(ref _trashPrototype, "trash", null);
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -88,7 +84,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
||||
return false;
|
||||
}
|
||||
|
||||
var transferAmount = ReagentUnit.Min(_transferAmount, _contents.CurrentVolume);
|
||||
var transferAmount = ReagentUnit.Min(TransferAmount, _contents.CurrentVolume);
|
||||
var split = _contents.SplitSolution(transferAmount);
|
||||
|
||||
var firstStomach = stomachs.FirstOrDefault(stomach => stomach.CanTransferSolution(split));
|
||||
@@ -106,10 +102,10 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
||||
|
||||
firstStomach.TryTransferSolution(split);
|
||||
|
||||
if (_useSound != null)
|
||||
if (UseSound != null)
|
||||
{
|
||||
_entitySystem.GetEntitySystem<AudioSystem>()
|
||||
.PlayFromEntity(_useSound, trueTarget, AudioParams.Default.WithVolume(-1f));
|
||||
.PlayFromEntity(UseSound, trueTarget, AudioParams.Default.WithVolume(-1f));
|
||||
}
|
||||
|
||||
trueTarget.PopupMessage(user, Loc.GetString("You swallow the pill."));
|
||||
|
||||
@@ -24,6 +24,7 @@ using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Chemistry
|
||||
@@ -44,7 +45,7 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
[ViewVariables] private ContainerSlot _beakerContainer = default!;
|
||||
[ViewVariables] private string _packPrototypeId = "";
|
||||
[ViewVariables] [DataField("pack")] private string _packPrototypeId = "";
|
||||
|
||||
[ViewVariables] private bool HasBeaker => _beakerContainer.ContainedEntity != null;
|
||||
[ViewVariables] private ReagentUnit _dispenseAmount = ReagentUnit.New(10);
|
||||
@@ -54,17 +55,6 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
||||
|
||||
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(ReagentDispenserUiKey.Key);
|
||||
|
||||
/// <summary>
|
||||
/// Shows the serializer how to save/load this components yaml prototype.
|
||||
/// </summary>
|
||||
/// <param name="serializer">Yaml serializer</param>
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _packPrototypeId, "pack", string.Empty);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called once per instance of this component. Gets references to any other components needed
|
||||
/// by this component and initializes it's UI and other data.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Content.Shared.Chemistry;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
#nullable enable
|
||||
@@ -12,19 +12,13 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
||||
{
|
||||
public override string Name => "ReagentTank";
|
||||
|
||||
[DataField("transferAmount")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public ReagentUnit TransferAmount { get; set; }
|
||||
public ReagentUnit TransferAmount { get; set; } = ReagentUnit.New(10);
|
||||
|
||||
[DataField("tankType")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public ReagentTankType TankType { get; set; }
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(this, c => c.TransferAmount, "transferAmount", ReagentUnit.New(10));
|
||||
serializer.DataField(this, c => c.TankType, "tankType", ReagentTankType.Unspecified);
|
||||
}
|
||||
public ReagentTankType TankType { get; set; } = ReagentTankType.Unspecified;
|
||||
}
|
||||
|
||||
public enum ReagentTankType : byte
|
||||
|
||||
@@ -5,7 +5,9 @@ using Content.Shared.GameObjects.EntitySystems;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Chemistry
|
||||
@@ -22,19 +24,14 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
||||
public override string Name => "Rehydratable";
|
||||
|
||||
[ViewVariables]
|
||||
private string _catalystPrototype = "";
|
||||
[DataField("catalyst")]
|
||||
private string _catalystPrototype = "chem.Water";
|
||||
[ViewVariables]
|
||||
[DataField("target")]
|
||||
private string? _targetPrototype;
|
||||
|
||||
private bool _expanding;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _catalystPrototype, "catalyst", "chem.Water");
|
||||
serializer.DataField(ref _targetPrototype, "target", null);
|
||||
}
|
||||
|
||||
ReagentUnit IReagentReaction.ReagentReactTouch(ReagentPrototype reagent, ReagentUnit volume) => Reaction(reagent, volume);
|
||||
ReagentUnit IReagentReaction.ReagentReactInjection(ReagentPrototype reagent, ReagentUnit volume) => Reaction(reagent, volume);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ using Content.Shared.Interfaces;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Chemistry
|
||||
@@ -24,47 +24,26 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
||||
|
||||
public override string Name => "SolutionTransfer";
|
||||
|
||||
private ReagentUnit _transferAmount;
|
||||
private bool _canReceive;
|
||||
private bool _canSend;
|
||||
|
||||
/// <summary>
|
||||
/// The amount of solution to be transferred from this solution when clicking on other solutions with it.
|
||||
/// </summary>
|
||||
[DataField("transferAmount")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public ReagentUnit TransferAmount
|
||||
{
|
||||
get => _transferAmount;
|
||||
set => _transferAmount = value;
|
||||
}
|
||||
public ReagentUnit TransferAmount { get; set; } = ReagentUnit.New(5);
|
||||
|
||||
/// <summary>
|
||||
/// Can this entity take reagent from reagent tanks?
|
||||
/// </summary>
|
||||
[DataField("canReceive")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool CanReceive
|
||||
{
|
||||
get => _canReceive;
|
||||
set => _canReceive = value;
|
||||
}
|
||||
public bool CanReceive { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Can this entity give reagent to other reagent containers?
|
||||
/// </summary>
|
||||
[DataField("canSend")]
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public bool CanSend
|
||||
{
|
||||
get => _canSend;
|
||||
set => _canSend = value;
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _transferAmount, "transferAmount", ReagentUnit.New(5));
|
||||
serializer.DataField(ref _canReceive, "canReceive", true);
|
||||
serializer.DataField(ref _canSend, "canSend", true);
|
||||
}
|
||||
public bool CanSend { get; set; } = true;
|
||||
|
||||
async Task<bool> IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@ using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Chemistry
|
||||
@@ -22,7 +23,8 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
[ViewVariables]
|
||||
private ReagentUnit _transferAmount;
|
||||
[DataField("transferAmount")]
|
||||
private ReagentUnit _transferAmount = ReagentUnit.New(0.5);
|
||||
|
||||
private bool _reached;
|
||||
private float _reactTimer;
|
||||
@@ -55,12 +57,6 @@ namespace Content.Server.GameObjects.Components.Chemistry
|
||||
}
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _transferAmount, "transferAmount", ReagentUnit.New(0.5));
|
||||
}
|
||||
|
||||
public void Update(float frameTime)
|
||||
{
|
||||
if (!Owner.TryGetComponent(out SolutionContainerComponent contents))
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using Content.Shared.Chemistry;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components
|
||||
@@ -10,14 +12,9 @@ namespace Content.Server.GameObjects.Components
|
||||
{
|
||||
public override string Name => "Cleanable";
|
||||
|
||||
private ReagentUnit _cleanAmount;
|
||||
[DataField("cleanAmount")]
|
||||
private ReagentUnit _cleanAmount = ReagentUnit.Zero;
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public ReagentUnit CleanAmount => _cleanAmount;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _cleanAmount, "cleanAmount", ReagentUnit.Zero);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@ using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components
|
||||
@@ -14,14 +16,9 @@ namespace Content.Server.GameObjects.Components
|
||||
public sealed class ComputerComponent : SharedComputerComponent, IMapInit
|
||||
{
|
||||
[ViewVariables]
|
||||
[DataField("board")]
|
||||
private string _boardPrototype;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _boardPrototype, "board", string.Empty);
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
@@ -1,34 +1,51 @@
|
||||
using Content.Server.GameObjects.Components.Interactable;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.GameObjects.Components.Interactable;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using Content.Shared.GameObjects.Components.Interactable;
|
||||
using Content.Shared.GameObjects.Verbs;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Server.Console;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using Robust.Server.GameObjects;
|
||||
|
||||
namespace Content.Server.GameObjects.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
[ComponentReference(typeof(SharedConfigurationComponent))]
|
||||
public class ConfigurationComponent : SharedConfigurationComponent, IInteractUsing
|
||||
public class ConfigurationComponent : SharedConfigurationComponent, IInteractUsing, ISerializationHooks
|
||||
{
|
||||
[ViewVariables] private BoundUserInterface UserInterface => Owner.GetUIOrNull(ConfigurationUiKey.Key);
|
||||
|
||||
[DataField("keys")] private List<string> _keys = new();
|
||||
|
||||
[ViewVariables]
|
||||
private readonly Dictionary<string, string> _config = new();
|
||||
|
||||
private Regex _validation;
|
||||
[DataField("validation")]
|
||||
private readonly Regex _validation = new ("^[a-zA-Z0-9 ]*$", RegexOptions.Compiled);
|
||||
|
||||
void ISerializationHooks.BeforeSerialization()
|
||||
{
|
||||
_keys = _config.Keys.ToList();
|
||||
}
|
||||
|
||||
void ISerializationHooks.AfterDeserialization()
|
||||
{
|
||||
foreach (var key in _keys)
|
||||
{
|
||||
_config.Add(key, "");
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnAdd()
|
||||
{
|
||||
@@ -48,17 +65,6 @@ namespace Content.Server.GameObjects.Components
|
||||
}
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataReadWriteFunction("keys", new List<string>(),
|
||||
(list) => FillConfiguration(list, _config, ""),
|
||||
() => _config.Keys.ToList());
|
||||
|
||||
serializer.DataReadFunction("validation", "^[a-zA-Z0-9 ]*$", value => _validation = new Regex("^[a-zA-Z0-9 ]*$", RegexOptions.Compiled));
|
||||
}
|
||||
|
||||
public string GetConfig(string name)
|
||||
{
|
||||
return _config.GetValueOrDefault(name);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Construction
|
||||
@@ -9,14 +11,8 @@ namespace Content.Server.GameObjects.Components.Construction
|
||||
{
|
||||
public override string Name => "ComputerBoard";
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(this, x => x.Prototype, "prototype", string.Empty);
|
||||
}
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("prototype")]
|
||||
public string Prototype { get; private set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ using Robust.Shared.Localization;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
@@ -33,8 +34,11 @@ namespace Content.Server.GameObjects.Components.Construction
|
||||
private bool _handling = false;
|
||||
|
||||
private TaskCompletionSource<object>? _handlingTask = null;
|
||||
[DataField("graph")]
|
||||
private string _graphIdentifier = string.Empty;
|
||||
[DataField("node")]
|
||||
private string _startingNodeIdentifier = string.Empty;
|
||||
[DataField("defaultTarget")]
|
||||
private string _startingTargetNodeIdentifier = string.Empty;
|
||||
|
||||
[ViewVariables]
|
||||
@@ -77,19 +81,9 @@ namespace Content.Server.GameObjects.Components.Construction
|
||||
public int EdgeStep { get; private set; } = 0;
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("deconstructionTarget")]
|
||||
public string DeconstructionNodeIdentifier { get; private set; } = "start";
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _graphIdentifier, "graph", string.Empty);
|
||||
serializer.DataField(ref _startingNodeIdentifier, "node", string.Empty);
|
||||
serializer.DataField(ref _startingTargetNodeIdentifier, "defaultTarget", string.Empty);
|
||||
serializer.DataField(this, x => x.DeconstructionNodeIdentifier, "deconstructionTarget", "start");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to set a new pathfinding target.
|
||||
/// </summary>
|
||||
|
||||
@@ -3,13 +3,11 @@ using System.Collections.Generic;
|
||||
using Content.Server.Construction;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Content.Shared.Stacks;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
@@ -23,17 +21,23 @@ namespace Content.Server.GameObjects.Components.Construction
|
||||
public override string Name => "MachineBoard";
|
||||
|
||||
[ViewVariables]
|
||||
private Dictionary<MachinePart, int> _requirements;
|
||||
[DataField("requirements")]
|
||||
private Dictionary<MachinePart, int> _requirements = new();
|
||||
|
||||
[ViewVariables]
|
||||
private Dictionary<string, int> _materialIdRequirements;
|
||||
[DataField("materialRequirements")]
|
||||
private Dictionary<string, int> _materialIdRequirements = new();
|
||||
|
||||
[ViewVariables]
|
||||
private Dictionary<string, ComponentPartInfo> _componentRequirements;
|
||||
[DataField("componentRequirements")]
|
||||
private Dictionary<string, ComponentPartInfo> _componentRequirements = new();
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("prototype")]
|
||||
public string Prototype { get; private set; }
|
||||
|
||||
public IReadOnlyDictionary<MachinePart, int> Requirements => _requirements;
|
||||
|
||||
public IReadOnlyDictionary<string, int> MaterialIdRequirements => _materialIdRequirements;
|
||||
|
||||
public IEnumerable<KeyValuePair<StackPrototype, int>> MaterialRequirements
|
||||
@@ -50,28 +54,6 @@ namespace Content.Server.GameObjects.Components.Construction
|
||||
|
||||
public IReadOnlyDictionary<string, ComponentPartInfo> ComponentRequirements => _componentRequirements;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(this, x => x.Prototype, "prototype", null);
|
||||
serializer.DataField(ref _requirements, "requirements", new Dictionary<MachinePart, int>());
|
||||
serializer.DataField(ref _materialIdRequirements, "materialRequirements", new Dictionary<string, int>());
|
||||
serializer.DataField(ref _componentRequirements, "componentRequirements", new Dictionary<string, ComponentPartInfo>());
|
||||
}
|
||||
|
||||
protected override void Startup()
|
||||
{
|
||||
base.Startup();
|
||||
|
||||
foreach (var material in _materialIdRequirements.Keys)
|
||||
{
|
||||
if (!_prototypeManager.HasIndex<StackPrototype>(material))
|
||||
{
|
||||
Logger.Error($"No {nameof(StackPrototype)} found with id {material}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Examine(FormattedMessage message, bool inDetailsRange)
|
||||
{
|
||||
message.AddMarkup(Loc.GetString("Requires:\n"));
|
||||
@@ -93,10 +75,14 @@ namespace Content.Server.GameObjects.Components.Construction
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
[DataDefinition]
|
||||
public struct ComponentPartInfo
|
||||
{
|
||||
[DataField("Amount")]
|
||||
public int Amount;
|
||||
[DataField("ExamineName")]
|
||||
public string ExamineName;
|
||||
[DataField("DefaultPrototype")]
|
||||
public string DefaultPrototype;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@ using Content.Server.Interfaces.GameObjects;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Construction
|
||||
{
|
||||
@@ -14,17 +16,12 @@ namespace Content.Server.GameObjects.Components.Construction
|
||||
{
|
||||
public override string Name => "Machine";
|
||||
|
||||
[DataField("board")]
|
||||
public string BoardPrototype { get; private set; }
|
||||
|
||||
private Container _boardContainer;
|
||||
private Container _partContainer;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(this, x => x.BoardPrototype, "board", null);
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
@@ -3,7 +3,9 @@ using Content.Server.Construction;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
@@ -31,19 +33,11 @@ namespace Content.Server.GameObjects.Components.Construction
|
||||
|
||||
public override string Name => "MachinePart";
|
||||
|
||||
[ViewVariables]
|
||||
public MachinePart PartType { get; private set; }
|
||||
[ViewVariables] [DataField("part")] public MachinePart PartType { get; private set; } = MachinePart.Capacitor;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public int Rating { get; private set; }
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(this, x => x.PartType, "part", MachinePart.Capacitor);
|
||||
serializer.DataField(this, x => x.Rating, "rating", 1);
|
||||
}
|
||||
[DataField("rating")]
|
||||
public int Rating { get; private set; } = 1;
|
||||
|
||||
public void Examine(FormattedMessage message, bool inDetailsRange)
|
||||
{
|
||||
|
||||
@@ -6,7 +6,9 @@ using Content.Server.GameObjects.Components.Stack;
|
||||
using Content.Shared.GameObjects.Components.Interactable;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Construction
|
||||
@@ -19,22 +21,17 @@ namespace Content.Server.GameObjects.Components.Construction
|
||||
public class WelderRefinableComponent : Component, IInteractUsing
|
||||
{
|
||||
[ViewVariables]
|
||||
private HashSet<string>? _refineResult = default;
|
||||
[DataField("refineResult")]
|
||||
private HashSet<string>? _refineResult = new() { "GlassStack" };
|
||||
[ViewVariables]
|
||||
private float _refineTime;
|
||||
[DataField("refineTime")]
|
||||
private float _refineTime = 2f;
|
||||
|
||||
private bool _beingWelded;
|
||||
|
||||
public override string Name => "WelderRefinable";
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _refineResult, "refineResult", new HashSet<string> { "GlassStack" });
|
||||
serializer.DataField(ref _refineTime, "refineTime", 2f);
|
||||
}
|
||||
|
||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
||||
public async Task<bool> InteractUsing(InteractUsingEventArgs eventArgs)
|
||||
{
|
||||
// check if object is welder
|
||||
if (!eventArgs.Using.TryGetComponent(out ToolComponent? tool))
|
||||
|
||||
@@ -9,7 +9,9 @@ using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Conveyor
|
||||
@@ -25,13 +27,15 @@ namespace Content.Server.GameObjects.Components.Conveyor
|
||||
/// The angle to move entities by in relation to the owner's rotation.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("angle")]
|
||||
private Angle _angle;
|
||||
|
||||
/// <summary>
|
||||
/// The amount of units to move the entity by per second.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
private float _speed;
|
||||
[DataField("speed")]
|
||||
private float _speed = 2f;
|
||||
|
||||
private ConveyorState _state;
|
||||
/// <summary>
|
||||
@@ -171,14 +175,6 @@ namespace Content.Server.GameObjects.Components.Conveyor
|
||||
}
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _angle, "angle", 0);
|
||||
serializer.DataField(ref _speed, "speed", 2);
|
||||
}
|
||||
|
||||
public void TriggerSignal(TwoWayLeverSignal signal)
|
||||
{
|
||||
State = signal switch
|
||||
|
||||
@@ -16,32 +16,33 @@ using Robust.Shared.Players;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class CrayonComponent : SharedCrayonComponent, IAfterInteract, IUse, IDropped
|
||||
public class CrayonComponent : SharedCrayonComponent, IAfterInteract, IUse, IDropped, ISerializationHooks
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
|
||||
//TODO: useSound
|
||||
private string? _useSound;
|
||||
[DataField("useSound")]
|
||||
private string? _useSound = string.Empty;
|
||||
|
||||
[ViewVariables]
|
||||
public Color Color { get; set; }
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public int Charges { get; set; }
|
||||
private int _capacity;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
public int Capacity { get => _capacity; set => _capacity = value; }
|
||||
[field: DataField("capacity")]
|
||||
public int Capacity { get; set; } = 30;
|
||||
|
||||
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(CrayonUiKey.Key);
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
void ISerializationHooks.AfterDeserialization()
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _useSound, "useSound", string.Empty);
|
||||
serializer.DataField(ref _color, "color", "white");
|
||||
serializer.DataField(ref _capacity, "capacity", 30);
|
||||
Color = Color.FromName(_color);
|
||||
}
|
||||
|
||||
@@ -126,7 +127,7 @@ namespace Content.Server.GameObjects.Components
|
||||
if (entity.TryGetComponent(out AppearanceComponent? appearance))
|
||||
{
|
||||
appearance.SetData(CrayonVisuals.State, SelectedState);
|
||||
appearance.SetData(CrayonVisuals.Color, Color);
|
||||
appearance.SetData(CrayonVisuals.Color, _color);
|
||||
appearance.SetData(CrayonVisuals.Rotation, eventArgs.User.Transform.LocalRotation);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
using System.Threading.Tasks;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Content.Server.GameObjects.Components.Nutrition;
|
||||
using Content.Server.GameObjects.Components.Chemistry;
|
||||
using Content.Server.GameObjects.Components.GUI;
|
||||
using Content.Server.GameObjects.Components.Items.Storage;
|
||||
using Content.Server.GameObjects.Components.Nutrition;
|
||||
using Content.Shared.Chemistry;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Culinary
|
||||
{
|
||||
@@ -24,20 +24,17 @@ namespace Content.Server.GameObjects.Components.Culinary
|
||||
|
||||
int IInteractUsing.Priority => 1; // take priority over eating with utensils
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)] private string _slice;
|
||||
private ushort _totalCount;
|
||||
[ViewVariables(VVAccess.ReadWrite)] private string _sound;
|
||||
[DataField("slice")] [ViewVariables(VVAccess.ReadWrite)]
|
||||
private string _slice = string.Empty;
|
||||
|
||||
[DataField("sound")] [ViewVariables(VVAccess.ReadWrite)]
|
||||
private string _sound = "/Audio/Items/Culinary/chop.ogg";
|
||||
|
||||
[DataField("count")] [ViewVariables(VVAccess.ReadWrite)]
|
||||
private ushort _totalCount = 5;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)] public ushort Count;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _slice, "slice", string.Empty);
|
||||
serializer.DataField(ref _sound, "sound", "/Audio/Items/Culinary/chop.ogg");
|
||||
serializer.DataField<ushort>(ref _totalCount, "count", 5);
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.GameObjects.Components.Nutrition;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
@@ -10,7 +9,7 @@ using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Culinary
|
||||
@@ -20,6 +19,7 @@ namespace Content.Server.GameObjects.Components.Culinary
|
||||
{
|
||||
public override string Name => "Utensil";
|
||||
|
||||
[DataField("types")]
|
||||
private UtensilType _types = UtensilType.None;
|
||||
|
||||
[ViewVariables]
|
||||
@@ -40,13 +40,15 @@ namespace Content.Server.GameObjects.Components.Culinary
|
||||
/// A value of 0 means that it is unbreakable.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("breakChance")]
|
||||
private float _breakChance;
|
||||
|
||||
/// <summary>
|
||||
/// The sound to be played if the utensil breaks.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
private string? _breakSound;
|
||||
[DataField("breakSound")]
|
||||
private string? _breakSound = "/Audio/Items/snap.ogg";
|
||||
|
||||
public void AddType(UtensilType type)
|
||||
{
|
||||
@@ -78,32 +80,6 @@ namespace Content.Server.GameObjects.Components.Culinary
|
||||
}
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataReadWriteFunction("types",
|
||||
new List<UtensilType>(),
|
||||
types => types.ForEach(AddType),
|
||||
() =>
|
||||
{
|
||||
var types = new List<UtensilType>();
|
||||
|
||||
foreach (UtensilType type in Enum.GetValues(typeof(UtensilType)))
|
||||
{
|
||||
if ((Types & type) != 0)
|
||||
{
|
||||
types.Add(type);
|
||||
}
|
||||
}
|
||||
|
||||
return types;
|
||||
});
|
||||
|
||||
serializer.DataField(ref _breakChance, "breakChance", 0);
|
||||
serializer.DataField(ref _breakSound, "breakSound", "/Audio/Items/snap.ogg");
|
||||
}
|
||||
|
||||
async Task<bool> IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
|
||||
{
|
||||
TryUseUtensil(eventArgs.User, eventArgs.Target);
|
||||
|
||||
@@ -6,9 +6,11 @@ using Content.Shared.GameObjects.Components.Damage;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Damage
|
||||
{
|
||||
@@ -20,32 +22,26 @@ namespace Content.Server.GameObjects.Components.Damage
|
||||
|
||||
public override string Name => "DamageOnHighSpeedImpact";
|
||||
|
||||
[DataField("damage")]
|
||||
public DamageType Damage { get; set; } = DamageType.Blunt;
|
||||
[DataField("minimumSpeed")]
|
||||
public float MinimumSpeed { get; set; } = 20f;
|
||||
[DataField("baseDamage")]
|
||||
public int BaseDamage { get; set; } = 5;
|
||||
public float Factor { get; set; } = 0.75f;
|
||||
[DataField("factor")]
|
||||
public float Factor { get; set; } = 1f;
|
||||
[DataField("soundHit")]
|
||||
public string SoundHit { get; set; } = "";
|
||||
[DataField("stunChance")]
|
||||
public float StunChance { get; set; } = 0.25f;
|
||||
[DataField("stunMinimumDamage")]
|
||||
public int StunMinimumDamage { get; set; } = 10;
|
||||
[DataField("stunSeconds")]
|
||||
public float StunSeconds { get; set; } = 1f;
|
||||
[DataField("damageCooldown")]
|
||||
public float DamageCooldown { get; set; } = 2f;
|
||||
private TimeSpan _lastHit = TimeSpan.Zero;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(this, x => x.Damage, "damage", DamageType.Blunt);
|
||||
serializer.DataField(this, x => x.MinimumSpeed, "minimumSpeed", 20f);
|
||||
serializer.DataField(this, x => x.BaseDamage, "baseDamage", 5);
|
||||
serializer.DataField(this, x => x.Factor, "factor", 1f);
|
||||
serializer.DataField(this, x => x.SoundHit, "soundHit", "");
|
||||
serializer.DataField(this, x => x.StunChance, "stunChance", 0.25f);
|
||||
serializer.DataField(this, x => x.StunSeconds, "stunSeconds", 1f);
|
||||
serializer.DataField(this, x => x.DamageCooldown, "damageCooldown", 2f);
|
||||
serializer.DataField(this, x => x.StunMinimumDamage, "stunMinimumDamage", 10);
|
||||
}
|
||||
|
||||
public void CollideWith(IEntity collidedWith)
|
||||
{
|
||||
if (!Owner.TryGetComponent(out IPhysicsComponent physics) || !Owner.TryGetComponent(out IDamageableComponent damageable)) return;
|
||||
|
||||
@@ -2,7 +2,7 @@ using Content.Shared.Damage;
|
||||
using Content.Shared.GameObjects.Components.Damage;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Damage
|
||||
{
|
||||
@@ -11,19 +11,15 @@ namespace Content.Server.GameObjects.Components.Damage
|
||||
{
|
||||
public override string Name => "DamageOnLand";
|
||||
|
||||
private DamageType _damageType;
|
||||
private int _amount;
|
||||
[DataField("damageType")]
|
||||
private DamageType _damageType = DamageType.Blunt;
|
||||
|
||||
[DataField("amount")]
|
||||
private int _amount = 1;
|
||||
|
||||
[DataField("ignoreResistances")]
|
||||
private bool _ignoreResistances;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _damageType, "damageType", DamageType.Blunt);
|
||||
serializer.DataField(ref _amount, "amount", 1);
|
||||
serializer.DataField(ref _ignoreResistances, "ignoreResistances", false);
|
||||
}
|
||||
|
||||
void ILand.Land(LandEventArgs eventArgs)
|
||||
{
|
||||
if (!Owner.TryGetComponent(out IDamageableComponent damageable)) return;
|
||||
|
||||
@@ -6,7 +6,7 @@ using Content.Shared.GameObjects.Components.Damage;
|
||||
using Content.Shared.GameObjects.Components.Interactable;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Damage
|
||||
{
|
||||
@@ -15,19 +15,12 @@ namespace Content.Server.GameObjects.Components.Damage
|
||||
{
|
||||
public override string Name => "DamageOnToolInteract";
|
||||
|
||||
/* Set in YAML */
|
||||
[DataField("damage")]
|
||||
protected int Damage;
|
||||
|
||||
[DataField("tools")]
|
||||
private List<ToolQuality> _tools = new();
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref Damage, "damage", 0);
|
||||
|
||||
serializer.DataField(ref _tools, "tools", new List<ToolQuality>());
|
||||
}
|
||||
|
||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
||||
{
|
||||
if (eventArgs.Using.TryGetComponent<ToolComponent>(out var tool))
|
||||
|
||||
@@ -2,7 +2,9 @@ using Content.Shared.Damage;
|
||||
using Content.Shared.GameObjects.Components.Damage;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Damage
|
||||
{
|
||||
@@ -11,19 +13,13 @@ namespace Content.Server.GameObjects.Components.Damage
|
||||
{
|
||||
public override string Name => "DamageOtherOnHit";
|
||||
|
||||
private DamageType _damageType;
|
||||
private int _amount;
|
||||
[DataField("damageType")]
|
||||
private DamageType _damageType = DamageType.Blunt;
|
||||
[DataField("amount")]
|
||||
private int _amount = 1;
|
||||
[DataField("ignoreResistances")]
|
||||
private bool _ignoreResistances;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _damageType, "damageType", DamageType.Blunt);
|
||||
serializer.DataField(ref _amount, "amount", 1);
|
||||
serializer.DataField(ref _ignoreResistances, "ignoreResistances", false);
|
||||
}
|
||||
|
||||
void IThrowCollide.DoHit(ThrowCollideEventArgs eventArgs)
|
||||
{
|
||||
if (!eventArgs.Target.TryGetComponent(out IDamageableComponent damageable)) return;
|
||||
|
||||
@@ -4,7 +4,7 @@ using Content.Server.GameObjects.Components.Destructible.Thresholds;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.GameObjects.Components.Damage;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Destructible
|
||||
@@ -20,17 +20,12 @@ namespace Content.Server.GameObjects.Components.Destructible
|
||||
|
||||
public override string Name => "Destructible";
|
||||
|
||||
[ViewVariables] private List<Threshold> _thresholds = new();
|
||||
[ViewVariables]
|
||||
[DataField("thresholds")]
|
||||
private List<Threshold> _thresholds = new();
|
||||
|
||||
public IReadOnlyList<Threshold> Thresholds => _thresholds;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _thresholds, "thresholds", new List<Threshold>());
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
@@ -3,20 +3,17 @@ using System;
|
||||
using Content.Server.GameObjects.Components.Construction;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behaviors
|
||||
{
|
||||
[Serializable]
|
||||
[DataDefinition]
|
||||
public class ChangeConstructionNodeBehavior : IThresholdBehavior
|
||||
{
|
||||
[DataField("node")]
|
||||
public string Node { get; private set; } = string.Empty;
|
||||
|
||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
serializer.DataField(this, x => x.Node, "node", string.Empty);
|
||||
}
|
||||
|
||||
public async void Execute(IEntity owner, DestructibleSystem system)
|
||||
{
|
||||
if (string.IsNullOrEmpty(Node) ||
|
||||
|
||||
@@ -2,33 +2,24 @@
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behaviors
|
||||
{
|
||||
[Serializable]
|
||||
[DataDefinition]
|
||||
public class DoActsBehavior : IThresholdBehavior
|
||||
{
|
||||
private int _acts;
|
||||
|
||||
/// <summary>
|
||||
/// What acts should be triggered upon activation.
|
||||
/// See <see cref="ActSystem"/>.
|
||||
/// </summary>
|
||||
public ThresholdActs Acts
|
||||
{
|
||||
get => (ThresholdActs) _acts;
|
||||
set => _acts = (int) value;
|
||||
}
|
||||
|
||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
serializer.DataField(ref _acts, "acts", 0, WithFormat.Flags<ActsFlags>());
|
||||
}
|
||||
[DataField("acts")]
|
||||
public ThresholdActs Acts { get; set; }
|
||||
|
||||
public bool HasAct(ThresholdActs act)
|
||||
{
|
||||
return (_acts & (int) act) != 0;
|
||||
return (Acts & act) != 0;
|
||||
}
|
||||
|
||||
public void Execute(IEntity owner, DestructibleSystem system)
|
||||
|
||||
@@ -2,18 +2,16 @@
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behaviors
|
||||
{
|
||||
/// <summary>
|
||||
/// Drop all items from all containers
|
||||
/// </summary>
|
||||
[DataDefinition]
|
||||
public class EmptyAllContainersBehaviour : IThresholdBehavior
|
||||
{
|
||||
void IExposeData.ExposeData(ObjectSerializer serializer) { }
|
||||
|
||||
public void Execute(IEntity owner, DestructibleSystem system)
|
||||
{
|
||||
if (owner.Deleted || !owner.TryGetComponent<ContainerManagerComponent>(out var containerManager))
|
||||
@@ -24,6 +22,5 @@ namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behavior
|
||||
container.EmptyContainer(true, owner.Transform.Coordinates);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,19 +2,15 @@ using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.GameObjects.Components.Body;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behaviors
|
||||
{
|
||||
[UsedImplicitly]
|
||||
[DataDefinition]
|
||||
public class GibBehavior : IThresholdBehavior
|
||||
{
|
||||
private bool _recursive = true;
|
||||
|
||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
serializer.DataField(ref _recursive, "recursive", true);
|
||||
}
|
||||
[DataField("recursive")] private bool _recursive = true;
|
||||
|
||||
public void Execute(IEntity owner, DestructibleSystem system)
|
||||
{
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behaviors
|
||||
{
|
||||
public interface IThresholdBehavior : IExposeData
|
||||
public interface IThresholdBehavior
|
||||
{
|
||||
/// <summary>
|
||||
/// Executes this behavior.
|
||||
|
||||
@@ -2,22 +2,18 @@
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behaviors
|
||||
{
|
||||
[Serializable]
|
||||
[DataDefinition]
|
||||
public class PlaySoundBehavior : IThresholdBehavior
|
||||
{
|
||||
/// <summary>
|
||||
/// Sound played upon destruction.
|
||||
/// </summary>
|
||||
public string Sound { get; set; }
|
||||
|
||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
serializer.DataField(this, x => x.Sound, "sound", string.Empty);
|
||||
}
|
||||
[DataField("sound")] public string Sound { get; set; } = string.Empty;
|
||||
|
||||
public void Execute(IEntity owner, DestructibleSystem system)
|
||||
{
|
||||
|
||||
@@ -2,22 +2,19 @@
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behaviors
|
||||
{
|
||||
[Serializable]
|
||||
[DataDefinition]
|
||||
public class PlaySoundCollectionBehavior : IThresholdBehavior
|
||||
{
|
||||
/// <summary>
|
||||
/// Sound collection from which to pick a random sound to play.
|
||||
/// </summary>
|
||||
private string SoundCollection { get; set; }
|
||||
|
||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
serializer.DataField(this, x => x.SoundCollection, "soundCollection", string.Empty);
|
||||
}
|
||||
[DataField("soundCollection")]
|
||||
private string SoundCollection { get; set; } = string.Empty;
|
||||
|
||||
public void Execute(IEntity owner, DestructibleSystem system)
|
||||
{
|
||||
|
||||
@@ -5,23 +5,20 @@ using Content.Server.GameObjects.Components.Stack;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.Utility;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behaviors
|
||||
{
|
||||
[Serializable]
|
||||
[DataDefinition]
|
||||
public class SpawnEntitiesBehavior : IThresholdBehavior
|
||||
{
|
||||
/// <summary>
|
||||
/// Entities spawned on reaching this threshold, from a min to a max.
|
||||
/// </summary>
|
||||
[DataField("spawn")]
|
||||
public Dictionary<string, MinMax> Spawn { get; set; } = new();
|
||||
|
||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
serializer.DataField(this, x => x.Spawn, "spawn", new Dictionary<string, MinMax>());
|
||||
}
|
||||
|
||||
public void Execute(IEntity owner, DestructibleSystem system)
|
||||
{
|
||||
foreach (var (entityId, minMax) in Spawn)
|
||||
|
||||
@@ -4,15 +4,14 @@ using Content.Server.GameObjects.Components.Fluids;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Behaviors
|
||||
{
|
||||
[UsedImplicitly]
|
||||
[DataDefinition]
|
||||
public class SpillBehavior : IThresholdBehavior
|
||||
{
|
||||
void IExposeData.ExposeData(ObjectSerializer serializer) { }
|
||||
|
||||
public void Execute(IEntity owner, DestructibleSystem system)
|
||||
{
|
||||
if (!owner.TryGetComponent(out SolutionContainerComponent? solutionContainer))
|
||||
|
||||
@@ -1,22 +1,19 @@
|
||||
using System;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds
|
||||
{
|
||||
[Serializable]
|
||||
public struct MinMax : IExposeData
|
||||
[DataDefinition]
|
||||
public struct MinMax
|
||||
{
|
||||
[ViewVariables]
|
||||
[DataField("min")]
|
||||
public int Min;
|
||||
|
||||
[ViewVariables]
|
||||
[DataField("max")]
|
||||
public int Max;
|
||||
|
||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
serializer.DataField(ref Min, "min", 0);
|
||||
serializer.DataField(ref Max, "max", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,13 +5,15 @@ using Content.Server.GameObjects.Components.Destructible.Thresholds.Triggers;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.GameObjects.Components.Damage;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds
|
||||
{
|
||||
public class Threshold : IExposeData
|
||||
[DataDefinition]
|
||||
public class Threshold
|
||||
{
|
||||
[DataField("behaviors")]
|
||||
private List<IThresholdBehavior> _behaviors = new();
|
||||
|
||||
/// <summary>
|
||||
@@ -23,7 +25,9 @@ namespace Content.Server.GameObjects.Components.Destructible.Thresholds
|
||||
/// <summary>
|
||||
/// Whether or not this threshold has already been triggered.
|
||||
/// </summary>
|
||||
[ViewVariables] public bool Triggered { get; private set; }
|
||||
[ViewVariables]
|
||||
[DataField("triggered")]
|
||||
public bool Triggered { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not this threshold only triggers once.
|
||||
@@ -31,26 +35,22 @@ namespace Content.Server.GameObjects.Components.Destructible.Thresholds
|
||||
/// and then damaged to reach this threshold once again.
|
||||
/// It will not repeatedly trigger as damage rises beyond that.
|
||||
/// </summary>
|
||||
[ViewVariables] public bool TriggersOnce { get; set; }
|
||||
[ViewVariables]
|
||||
[DataField("triggersOnce")]
|
||||
public bool TriggersOnce { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The trigger that decides if this threshold has been reached.
|
||||
/// </summary>
|
||||
[ViewVariables] public IThresholdTrigger? Trigger { get; set; }
|
||||
[ViewVariables]
|
||||
[DataField("trigger")]
|
||||
public IThresholdTrigger? Trigger { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Behaviors to activate once this threshold is triggered.
|
||||
/// </summary>
|
||||
[ViewVariables] public IReadOnlyList<IThresholdBehavior> Behaviors => _behaviors;
|
||||
|
||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
serializer.DataField(this, x => x.Triggered, "triggered", false);
|
||||
serializer.DataField(this, x => x.TriggersOnce, "triggersOnce", false);
|
||||
serializer.DataField(this, x => x.Trigger, "trigger", null);
|
||||
serializer.DataField(ref _behaviors, "behaviors", new List<IThresholdBehavior>());
|
||||
}
|
||||
|
||||
public bool Reached(IDamageableComponent damageable, DestructibleSystem system)
|
||||
{
|
||||
if (Trigger == null)
|
||||
|
||||
@@ -3,7 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.GameObjects.Components.Damage;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Triggers
|
||||
{
|
||||
@@ -11,15 +11,12 @@ namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Triggers
|
||||
/// A trigger that will activate when all of its triggers have activated.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[DataDefinition]
|
||||
public class AndTrigger : IThresholdTrigger
|
||||
{
|
||||
[DataField("triggers")]
|
||||
public List<IThresholdTrigger> Triggers { get; set; } = new();
|
||||
|
||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
serializer.DataField(this, x => x.Triggers, "triggers", new List<IThresholdTrigger>());
|
||||
}
|
||||
|
||||
public bool Reached(IDamageableComponent damageable, DestructibleSystem system)
|
||||
{
|
||||
foreach (var trigger in Triggers)
|
||||
|
||||
@@ -3,7 +3,7 @@ using System;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.GameObjects.Components.Damage;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Triggers
|
||||
{
|
||||
@@ -12,24 +12,21 @@ namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Triggers
|
||||
/// of the specified class is above the specified threshold.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[DataDefinition]
|
||||
public class DamageClassTrigger : IThresholdTrigger
|
||||
{
|
||||
/// <summary>
|
||||
/// The class to check the damage of.
|
||||
/// </summary>
|
||||
[DataField("class")]
|
||||
public DamageClass? Class { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The amount of damage at which this threshold will trigger.
|
||||
/// </summary>
|
||||
[DataField("damage")]
|
||||
public int Damage { get; set; }
|
||||
|
||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
serializer.DataField(this, x => x.Class, "class", null);
|
||||
serializer.DataField(this, x => x.Damage, "damage", 0);
|
||||
}
|
||||
|
||||
public bool Reached(IDamageableComponent damageable, DestructibleSystem system)
|
||||
{
|
||||
if (Class == null)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
using System;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.GameObjects.Components.Damage;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Triggers
|
||||
{
|
||||
@@ -11,18 +11,15 @@ namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Triggers
|
||||
/// is above the specified threshold.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[DataDefinition]
|
||||
public class DamageTrigger : IThresholdTrigger
|
||||
{
|
||||
/// <summary>
|
||||
/// The amount of damage at which this threshold will trigger.
|
||||
/// </summary>
|
||||
[DataField("damage")]
|
||||
public int Damage { get; set; }
|
||||
|
||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
serializer.DataField(this, x => x.Damage, "damage", 0);
|
||||
}
|
||||
|
||||
public bool Reached(IDamageableComponent damageable, DestructibleSystem system)
|
||||
{
|
||||
return damageable.TotalDamage >= Damage;
|
||||
|
||||
@@ -3,7 +3,7 @@ using System;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.Damage;
|
||||
using Content.Shared.GameObjects.Components.Damage;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Triggers
|
||||
{
|
||||
@@ -12,18 +12,15 @@ namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Triggers
|
||||
/// of the specified type is above the specified threshold.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[DataDefinition]
|
||||
public class DamageTypeTrigger : IThresholdTrigger
|
||||
{
|
||||
[DataField("type")]
|
||||
public DamageType? Type { get; set; }
|
||||
|
||||
[DataField("damage")]
|
||||
public int Damage { get; set; }
|
||||
|
||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
serializer.DataField(this, x => x.Type, "type", null);
|
||||
serializer.DataField(this, x => x.Damage, "damage", 0);
|
||||
}
|
||||
|
||||
public bool Reached(IDamageableComponent damageable, DestructibleSystem system)
|
||||
{
|
||||
if (Type == null)
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
#nullable enable
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.GameObjects.Components.Damage;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Triggers
|
||||
{
|
||||
public interface IThresholdTrigger : IExposeData
|
||||
public interface IThresholdTrigger
|
||||
{
|
||||
/// <summary>
|
||||
/// Checks if this trigger has been reached.
|
||||
|
||||
@@ -3,7 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.GameObjects.Components.Damage;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Triggers
|
||||
{
|
||||
@@ -11,15 +11,12 @@ namespace Content.Server.GameObjects.Components.Destructible.Thresholds.Triggers
|
||||
/// A trigger that will activate when any of its triggers have activated.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
[DataDefinition]
|
||||
public class OrTrigger : IThresholdTrigger
|
||||
{
|
||||
[field: DataField("triggers")]
|
||||
public List<IThresholdTrigger> Triggers { get; } = new();
|
||||
|
||||
void IExposeData.ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
serializer.DataField(this, x => x.Triggers, "triggers", new List<IThresholdTrigger>());
|
||||
}
|
||||
|
||||
public bool Reached(IDamageableComponent damageable, DestructibleSystem system)
|
||||
{
|
||||
foreach (var trigger in Triggers)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Disposal
|
||||
{
|
||||
@@ -8,7 +10,8 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
[ComponentReference(typeof(IDisposalTubeComponent))]
|
||||
public class DisposalBendComponent : DisposalTubeComponent
|
||||
{
|
||||
private int _sideDegrees;
|
||||
[DataField("sideDegrees")]
|
||||
private int _sideDegrees = -90;
|
||||
|
||||
public override string Name => "DisposalBend";
|
||||
|
||||
@@ -33,11 +36,5 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
var previousDirection = DirectionTo(previousTube);
|
||||
return previousDirection == directions[0] ? directions[1] : directions[0];
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _sideDegrees, "sideDegrees", -90);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,9 @@ using Content.Shared.GameObjects.Components.Body;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Disposal
|
||||
@@ -50,14 +52,9 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
[ViewVariables]
|
||||
public HashSet<string> Tags { get; set; } = new();
|
||||
|
||||
[ViewVariables] public GasMixture Air { get; set; } = default!;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(this, x => x.Air, "air", new GasMixture(Atmospherics.CellVolume));
|
||||
}
|
||||
[ViewVariables]
|
||||
[DataField("air")]
|
||||
public GasMixture Air { get; set; } = new GasMixture(Atmospherics.CellVolume);
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
|
||||
@@ -3,8 +3,10 @@ using System.Linq;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Disposal
|
||||
@@ -19,6 +21,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
/// The angles to connect to.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("degrees")]
|
||||
private List<Angle> _degrees;
|
||||
|
||||
public override string Name => "DisposalJunction";
|
||||
@@ -43,12 +46,5 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
|
||||
return next;
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _degrees, "degrees", null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using Timer = Robust.Shared.Timing.Timer;
|
||||
@@ -37,7 +37,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
[ComponentReference(typeof(SharedDisposalMailingUnitComponent))]
|
||||
[ComponentReference(typeof(IActivate))]
|
||||
[ComponentReference(typeof(IInteractUsing))]
|
||||
public class DisposalMailingUnitComponent : SharedDisposalMailingUnitComponent, IInteractHand, IActivate, IInteractUsing
|
||||
public class DisposalMailingUnitComponent : SharedDisposalMailingUnitComponent, IInteractHand, IActivate, IInteractUsing, IDragDropOn
|
||||
{
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
|
||||
@@ -61,18 +61,22 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
/// Prevents it from flushing if it is not equal to or bigger than 1.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
private float _pressure;
|
||||
[DataField("pressure")]
|
||||
private float _pressure = 1f;
|
||||
|
||||
private bool _engaged;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
private TimeSpan _automaticEngageTime;
|
||||
[DataField("autoEngageTime")]
|
||||
private readonly TimeSpan _automaticEngageTime = TimeSpan.FromSeconds(30);
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
private TimeSpan _flushDelay;
|
||||
[DataField("flushDelay")]
|
||||
private readonly TimeSpan _flushDelay = TimeSpan.FromSeconds(3);
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
private float _entryDelay;
|
||||
[DataField("entryDelay")]
|
||||
private float _entryDelay = 0.5f;
|
||||
|
||||
/// <summary>
|
||||
/// Token used to cancel the automatic engage of a disposal unit
|
||||
@@ -98,6 +102,7 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
private string? _target;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("Tag")]
|
||||
private string _tag = string.Empty;
|
||||
|
||||
[ViewVariables]
|
||||
@@ -558,33 +563,6 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
}
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataReadWriteFunction(
|
||||
"pressure",
|
||||
1.0f,
|
||||
pressure => _pressure = pressure,
|
||||
() => _pressure);
|
||||
|
||||
serializer.DataReadWriteFunction(
|
||||
"automaticEngageTime",
|
||||
30,
|
||||
seconds => _automaticEngageTime = TimeSpan.FromSeconds(seconds),
|
||||
() => (int) _automaticEngageTime.TotalSeconds);
|
||||
|
||||
serializer.DataReadWriteFunction(
|
||||
"flushDelay",
|
||||
3,
|
||||
seconds => _flushDelay = TimeSpan.FromSeconds(seconds),
|
||||
() => (int) _flushDelay.TotalSeconds);
|
||||
|
||||
serializer.DataField(ref _entryDelay, "entryDelay", 0.5f);
|
||||
|
||||
serializer.DataField(ref _tag, "Tag", "");
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
@@ -12,8 +12,10 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Disposal
|
||||
@@ -27,7 +29,8 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
|
||||
private bool _connected;
|
||||
private bool _broken;
|
||||
private string _clangSound = default!;
|
||||
[DataField("clangSound")]
|
||||
private string _clangSound = "/Audio/Effects/clang.ogg";
|
||||
|
||||
/// <summary>
|
||||
/// Container of entities that are currently inside this tube
|
||||
@@ -213,12 +216,6 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
UpdateVisualState();
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _clangSound, "clangSound", "/Audio/Effects/clang.ogg");
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
@@ -6,16 +6,16 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.Atmos;
|
||||
using Content.Server.GameObjects.Components.GUI;
|
||||
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
||||
using Content.Server.GameObjects.Components.Items.Storage;
|
||||
using Content.Server.GameObjects.Components.Power.ApcNetComponents;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.GameObjects.EntitySystems.DoAfter;
|
||||
using Content.Server.Interfaces;
|
||||
using Content.Server.Interfaces.GameObjects.Components.Items;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.GameObjects.Components.Disposal;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.GameObjects.Components.Body;
|
||||
using Content.Shared.GameObjects.Components.Disposal;
|
||||
using Content.Shared.GameObjects.Components.Mobs.State;
|
||||
using Content.Shared.GameObjects.EntitySystems.ActionBlocker;
|
||||
using Content.Shared.GameObjects.Verbs;
|
||||
@@ -29,7 +29,7 @@ using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
@@ -61,21 +61,25 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
/// Prevents it from flushing if it is not equal to or bigger than 1.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[DataField("pressure")]
|
||||
private float _pressure;
|
||||
|
||||
private bool _engaged;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
private TimeSpan _automaticEngageTime;
|
||||
[DataField("autoEngageTime")]
|
||||
private readonly TimeSpan _automaticEngageTime = TimeSpan.FromSeconds(30);
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
private TimeSpan _flushDelay;
|
||||
[DataField("flushDelay")]
|
||||
private readonly TimeSpan _flushDelay = TimeSpan.FromSeconds(3);
|
||||
|
||||
/// <summary>
|
||||
/// Delay from trying to enter disposals ourselves.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
private float _entryDelay;
|
||||
[DataField("entryDelay")]
|
||||
private float _entryDelay = 0.5f;
|
||||
|
||||
/// <summary>
|
||||
/// Delay from trying to shove someone else into disposals.
|
||||
@@ -132,7 +136,8 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
/// </summary>
|
||||
private (PressureState State, string Localized) _locState;
|
||||
|
||||
public GasMixture Air { get; set; } = default!;
|
||||
[DataField("air")]
|
||||
public GasMixture Air { get; set; } = new GasMixture(Atmospherics.CellVolume);
|
||||
|
||||
public override bool CanInsert(IEntity entity)
|
||||
{
|
||||
@@ -515,33 +520,6 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
}
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataReadWriteFunction(
|
||||
"pressure",
|
||||
1.0f,
|
||||
pressure => _pressure = pressure,
|
||||
() => _pressure);
|
||||
|
||||
serializer.DataReadWriteFunction(
|
||||
"automaticEngageTime",
|
||||
30,
|
||||
seconds => _automaticEngageTime = TimeSpan.FromSeconds(seconds),
|
||||
() => (int) _automaticEngageTime.TotalSeconds);
|
||||
|
||||
serializer.DataReadWriteFunction(
|
||||
"flushDelay",
|
||||
3,
|
||||
seconds => _flushDelay = TimeSpan.FromSeconds(seconds),
|
||||
() => (int) _flushDelay.TotalSeconds);
|
||||
|
||||
serializer.DataField(this, x => x.Air, "air", new GasMixture(Atmospherics.CellVolume));
|
||||
serializer.DataField(ref _entryDelay, "entryDelay", 1.0f);
|
||||
serializer.DataField(ref _draggedEntryDelay, "draggedEntryDelay", 3.0f);
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
@@ -25,7 +25,7 @@ using Robust.Shared.Log;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Players;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using Timer = Robust.Shared.Timing.Timer;
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace Content.Server.GameObjects.Components.Doors
|
||||
{
|
||||
[ComponentDependency]
|
||||
private readonly IDoorCheck? _doorCheck = null;
|
||||
|
||||
|
||||
public override DoorState State
|
||||
{
|
||||
get => base.State;
|
||||
@@ -79,31 +79,36 @@ namespace Content.Server.GameObjects.Components.Doors
|
||||
/// <summary>
|
||||
/// Whether the door will ever crush.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadOnly)]
|
||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("inhibitCrush")]
|
||||
private bool _inhibitCrush;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the door blocks light.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)] private bool _occludes;
|
||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("occludes")]
|
||||
private bool _occludes = true;
|
||||
public bool Occludes => _occludes;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the door will open when it is bumped into.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)] private bool _bumpOpen;
|
||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("bumpOpen")]
|
||||
private bool _bumpOpen = true;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the door starts open when it's first loaded from prototype. A door won't start open if its prototype is also welded shut.
|
||||
/// Handled in Startup().
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("startOpen")]
|
||||
private bool _startOpen;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the airlock is welded shut. Can be set by the prototype, although this will fail if the door isn't weldable.
|
||||
/// When set by prototype, handled in Startup().
|
||||
/// </summary>
|
||||
[DataField("welded")]
|
||||
private bool _isWeldedShut;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the airlock is welded shut.
|
||||
/// </summary>
|
||||
@@ -127,6 +132,7 @@ namespace Content.Server.GameObjects.Components.Doors
|
||||
/// Whether the door can ever be welded shut.
|
||||
/// </summary>
|
||||
private bool _weldable;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the door can currently be welded.
|
||||
/// </summary>
|
||||
@@ -135,19 +141,11 @@ namespace Content.Server.GameObjects.Components.Doors
|
||||
/// <summary>
|
||||
/// Whether something is currently using a welder on this so DoAfter isn't spammed.
|
||||
/// </summary>
|
||||
private bool _beingWelded = false;
|
||||
private bool _beingWelded;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _isWeldedShut, "welded", false);
|
||||
serializer.DataField(ref _startOpen, "startOpen", false);
|
||||
serializer.DataField(ref _weldable, "weldable", true);
|
||||
serializer.DataField(ref _bumpOpen, "bumpOpen", true);
|
||||
serializer.DataField(ref _occludes, "occludes", true);
|
||||
serializer.DataField(ref _inhibitCrush, "inhibitCrush", false);
|
||||
}
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
[DataField("canCrush")]
|
||||
private bool _canCrush = true;
|
||||
|
||||
protected override void Startup()
|
||||
{
|
||||
@@ -308,7 +306,7 @@ namespace Content.Server.GameObjects.Components.Doors
|
||||
{
|
||||
return _doorCheck.OpenCheck();
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -452,7 +450,7 @@ namespace Content.Server.GameObjects.Components.Doors
|
||||
|
||||
OnPartialClose();
|
||||
await Timer.Delay(CloseTimeTwo, _stateChangeCancelTokenSource.Token);
|
||||
|
||||
|
||||
if (Occludes && Owner.TryGetComponent(out OccluderComponent? occluder))
|
||||
{
|
||||
occluder.Enabled = true;
|
||||
|
||||
@@ -1,23 +1,22 @@
|
||||
#nullable enable
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Content.Server.GameObjects.Components.Explosion;
|
||||
using Robust.Shared.GameObjects;
|
||||
using System.Threading.Tasks;
|
||||
using Robust.Shared.Serialization;
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.GameObjects.Components.Trigger.TimerTrigger;
|
||||
using Content.Server.Throw;
|
||||
using Robust.Server.GameObjects;
|
||||
using Content.Shared.GameObjects.Components.Explosion;
|
||||
using Robust.Shared.Containers;
|
||||
using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Explosives
|
||||
namespace Content.Server.GameObjects.Components.Explosion
|
||||
{
|
||||
[RegisterComponent]
|
||||
public sealed class ClusterFlashComponent : Component, IInteractUsing, IUse
|
||||
@@ -29,7 +28,7 @@ namespace Content.Server.GameObjects.Components.Explosives
|
||||
/// <summary>
|
||||
/// What we fill our prototype with if we want to pre-spawn with grenades.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
[ViewVariables] [DataField("fillPrototype")]
|
||||
private string? _fillPrototype;
|
||||
|
||||
/// <summary>
|
||||
@@ -40,20 +39,20 @@ namespace Content.Server.GameObjects.Components.Explosives
|
||||
/// <summary>
|
||||
/// Maximum grenades in the container.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
private int _maxGrenades;
|
||||
[ViewVariables] [DataField("maxGrenadesCount")]
|
||||
private int _maxGrenades = 3;
|
||||
|
||||
/// <summary>
|
||||
/// How long until our grenades are shot out and armed.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
private float _delay;
|
||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("delay")]
|
||||
private float _delay = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Max distance grenades can be thrown.
|
||||
/// </summary>
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
private float _throwDistance;
|
||||
[ViewVariables(VVAccess.ReadWrite)] [DataField("distance")]
|
||||
private float _throwDistance = 3;
|
||||
|
||||
/// <summary>
|
||||
/// This is the end.
|
||||
@@ -70,15 +69,6 @@ namespace Content.Server.GameObjects.Components.Explosives
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _fillPrototype, "fillPrototype", null);
|
||||
serializer.DataField(ref _maxGrenades, "maxGrenadesCount", 3);
|
||||
serializer.DataField(ref _delay, "delay", 1.0f);
|
||||
serializer.DataField(ref _throwDistance, "distance", 3.0f);
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
|
||||
@@ -2,7 +2,9 @@ using Content.Server.Explosions;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Explosion
|
||||
{
|
||||
@@ -11,23 +13,17 @@ namespace Content.Server.GameObjects.Components.Explosion
|
||||
{
|
||||
public override string Name => "Explosive";
|
||||
|
||||
public int DevastationRange = 0;
|
||||
public int HeavyImpactRange = 0;
|
||||
public int LightImpactRange = 0;
|
||||
public int FlashRange = 0;
|
||||
[DataField("devastationRange")]
|
||||
public int DevastationRange;
|
||||
[DataField("heavyImpactRange")]
|
||||
public int HeavyImpactRange;
|
||||
[DataField("lightImpactRange")]
|
||||
public int LightImpactRange;
|
||||
[DataField("flashRange")]
|
||||
public int FlashRange;
|
||||
|
||||
public bool Exploding { get; private set; } = false;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref DevastationRange, "devastationRange", 0);
|
||||
serializer.DataField(ref HeavyImpactRange, "heavyImpactRange", 0);
|
||||
serializer.DataField(ref LightImpactRange, "lightImpactRange", 0);
|
||||
serializer.DataField(ref FlashRange, "flashRange", 0);
|
||||
}
|
||||
|
||||
public bool Explosion()
|
||||
{
|
||||
if (Exploding)
|
||||
|
||||
@@ -5,7 +5,7 @@ using Content.Shared.GameObjects.EntitySystems;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Explosion
|
||||
{
|
||||
@@ -17,22 +17,14 @@ namespace Content.Server.GameObjects.Components.Explosion
|
||||
{
|
||||
public override string Name => "FlashExplosive";
|
||||
|
||||
private float _range;
|
||||
|
||||
private float _duration;
|
||||
|
||||
private string _sound;
|
||||
private bool _deleteOnFlash;
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _range, "range", 7.0f);
|
||||
serializer.DataField(ref _duration, "duration", 8.0f);
|
||||
serializer.DataField(ref _sound, "sound", "/Audio/Effects/flash_bang.ogg");
|
||||
serializer.DataField(ref _deleteOnFlash, "deleteOnFlash", true);
|
||||
}
|
||||
[DataField("range")]
|
||||
private float _range = 7.0f;
|
||||
[DataField("duration")]
|
||||
private float _duration = 8.0f;
|
||||
[DataField("sound")]
|
||||
private string _sound = "/Audio/Effects/flash_bang.ogg";
|
||||
[DataField("deleteOnFlash")]
|
||||
private bool _deleteOnFlash = true;
|
||||
|
||||
public bool Explode()
|
||||
{
|
||||
|
||||
@@ -11,7 +11,9 @@ using Robust.Server.GameObjects;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components
|
||||
@@ -24,7 +26,8 @@ namespace Content.Server.GameObjects.Components
|
||||
public override string Name => "ExtinguisherCabinet";
|
||||
|
||||
private bool _opened = false;
|
||||
private string _doorSound;
|
||||
[DataField("doorSound")]
|
||||
private string _doorSound = "/Audio/Machines/machine_switch.ogg";
|
||||
|
||||
[ViewVariables] protected ContainerSlot ItemContainer;
|
||||
[ViewVariables] public string DoorSound => _doorSound;
|
||||
@@ -37,13 +40,6 @@ namespace Content.Server.GameObjects.Components
|
||||
ContainerHelpers.EnsureContainer<ContainerSlot>(Owner, "extinguisher_cabinet", out _);
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _doorSound, "doorSound", "/Audio/Machines/machine_switch.ogg");
|
||||
}
|
||||
|
||||
async Task<bool> IInteractUsing.InteractUsing(InteractUsingEventArgs eventArgs)
|
||||
{
|
||||
if (!_opened)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Content.Server.GameObjects.Components.Chemistry;
|
||||
@@ -11,8 +10,7 @@ using Content.Shared.Utility;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Fluids
|
||||
{
|
||||
@@ -42,13 +40,8 @@ namespace Content.Server.GameObjects.Components.Fluids
|
||||
? solution.CurrentVolume
|
||||
: ReagentUnit.Zero;
|
||||
|
||||
private string? _sound;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
serializer.DataFieldCached(ref _sound, "sound", "/Audio/Effects/Fluids/watersplash.ogg");
|
||||
}
|
||||
[DataField("sound")]
|
||||
private string? _sound = "/Audio/Effects/Fluids/watersplash.ogg";
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Initialize()
|
||||
|
||||
@@ -11,6 +11,8 @@ using System.Threading.Tasks;
|
||||
using Content.Server.GameObjects.EntitySystems.DoAfter;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Fluids
|
||||
{
|
||||
@@ -22,12 +24,10 @@ namespace Content.Server.GameObjects.Components.Fluids
|
||||
{
|
||||
public override string Name => "Mop";
|
||||
|
||||
public bool Mopping => _mopping;
|
||||
|
||||
/// <summary>
|
||||
/// Used to prevent do_after spam if we're currently mopping.
|
||||
/// </summary>
|
||||
private bool _mopping;
|
||||
public bool Mopping { get; private set; }
|
||||
|
||||
public SolutionContainerComponent? Contents => Owner.GetComponentOrNull<SolutionContainerComponent>();
|
||||
|
||||
@@ -50,25 +50,18 @@ namespace Content.Server.GameObjects.Components.Fluids
|
||||
// Picking up a puddle requires multiple clicks
|
||||
// Dumping in a bucket requires 1 click
|
||||
// Long-term you'd probably use a cooldown and start the pickup once we have some form of global cooldown
|
||||
public ReagentUnit PickupAmount => _pickupAmount;
|
||||
private ReagentUnit _pickupAmount;
|
||||
[field: DataField("pickup_amount")]
|
||||
public ReagentUnit PickupAmount { get; } = ReagentUnit.New(5);
|
||||
|
||||
private string? _pickupSound;
|
||||
[DataField("pickup_sound")]
|
||||
private string? _pickupSound = "/Audio/Effects/Fluids/slosh.ogg";
|
||||
|
||||
/// <summary>
|
||||
/// Multiplier for the do_after delay for how fast the mop works.
|
||||
/// </summary>
|
||||
[ViewVariables]
|
||||
private float _mopSpeed;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
serializer.DataFieldCached(ref _pickupSound, "pickup_sound", "/Audio/Effects/Fluids/slosh.ogg");
|
||||
// The turbo mop will pickup more
|
||||
serializer.DataFieldCached(ref _pickupAmount, "pickup_amount", ReagentUnit.New(5));
|
||||
serializer.DataField(ref _mopSpeed, "speed", 1.0f);
|
||||
}
|
||||
[DataField("speed")]
|
||||
private float _mopSpeed = 1;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -88,7 +81,7 @@ namespace Content.Server.GameObjects.Components.Fluids
|
||||
*/
|
||||
|
||||
if (!Owner.TryGetComponent(out SolutionContainerComponent? contents) ||
|
||||
_mopping ||
|
||||
Mopping ||
|
||||
!eventArgs.InRangeUnobstructed(ignoreInsideBlocker: true, popup: true))
|
||||
{
|
||||
return false;
|
||||
@@ -121,7 +114,7 @@ namespace Content.Server.GameObjects.Components.Fluids
|
||||
return false;
|
||||
}
|
||||
|
||||
_mopping = true;
|
||||
Mopping = true;
|
||||
|
||||
// So if the puddle has 20 units we mop in 2 seconds. Don't just store CurrentVolume given it can change so need to re-calc it anyway.
|
||||
var doAfterArgs = new DoAfterEventArgs(eventArgs.User, _mopSpeed * puddleVolume.Float() / 10.0f, target: eventArgs.Target)
|
||||
@@ -132,7 +125,7 @@ namespace Content.Server.GameObjects.Components.Fluids
|
||||
};
|
||||
var result = await EntitySystem.Get<DoAfterSystem>().DoAfter(doAfterArgs);
|
||||
|
||||
_mopping = false;
|
||||
Mopping = false;
|
||||
|
||||
if (result == DoAfterStatus.Cancelled ||
|
||||
Owner.Deleted ||
|
||||
|
||||
@@ -16,7 +16,9 @@ using Robust.Shared.Localization;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
@@ -45,7 +47,8 @@ namespace Content.Server.GameObjects.Components.Fluids
|
||||
public override string Name => "Puddle";
|
||||
|
||||
private CancellationTokenSource _evaporationToken;
|
||||
private ReagentUnit _evaporateThreshold; // How few <Solution Quantity> we can hold prior to self-destructing
|
||||
[DataField("evaporate_threshold")]
|
||||
private ReagentUnit _evaporateThreshold = ReagentUnit.New(20); // How few <Solution Quantity> we can hold prior to self-destructing
|
||||
public ReagentUnit EvaporateThreshold
|
||||
{
|
||||
get => _evaporateThreshold;
|
||||
@@ -61,9 +64,11 @@ namespace Content.Server.GameObjects.Components.Fluids
|
||||
/// <summary>
|
||||
/// The time that it will take this puddle to evaporate, in seconds.
|
||||
/// </summary>
|
||||
public float EvaporateTime { get; private set; }
|
||||
[DataField("evaporate_time")]
|
||||
public float EvaporateTime { get; private set; } = 5f;
|
||||
|
||||
private string _spillSound;
|
||||
[DataField("spill_sound")]
|
||||
private string _spillSound = "/Audio/Effects/Fluids/splat.ogg";
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not this puddle is currently overflowing onto its neighbors
|
||||
@@ -86,29 +91,20 @@ namespace Content.Server.GameObjects.Components.Fluids
|
||||
// Currently a random number, potentially change
|
||||
public ReagentUnit OverflowVolume => _overflowVolume;
|
||||
[ViewVariables]
|
||||
private ReagentUnit _overflowVolume;
|
||||
[DataField("overflow_volume")]
|
||||
private ReagentUnit _overflowVolume = ReagentUnit.New(20);
|
||||
private ReagentUnit OverflowLeft => CurrentVolume - OverflowVolume;
|
||||
|
||||
private SolutionContainerComponent _contents;
|
||||
public bool EmptyHolder => _contents.ReagentList.Count == 0;
|
||||
private int _spriteVariants;
|
||||
[DataField("variants")]
|
||||
private int _spriteVariants = 1;
|
||||
// Whether the underlying solution color should be used
|
||||
private bool _recolor;
|
||||
[DataField("recolor")]
|
||||
private bool _recolor = default;
|
||||
|
||||
private bool Slippery => Owner.TryGetComponent(out SlipperyComponent slippery) && slippery.Slippery;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
serializer.DataFieldCached(ref _spillSound, "spill_sound", "/Audio/Effects/Fluids/splat.ogg");
|
||||
serializer.DataField(ref _overflowVolume, "overflow_volume", ReagentUnit.New(20));
|
||||
serializer.DataField(this, x => x.EvaporateTime, "evaporate_time", 5.0f);
|
||||
// Long-term probably have this based on the underlying reagents
|
||||
serializer.DataField(ref _evaporateThreshold, "evaporate_threshold", ReagentUnit.New(20));
|
||||
serializer.DataField(ref _spriteVariants, "variants", 1);
|
||||
serializer.DataField(ref _recolor, "recolor", false);
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
@@ -14,8 +14,10 @@ using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Fluids
|
||||
@@ -28,18 +30,28 @@ namespace Content.Server.GameObjects.Components.Fluids
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
[Dependency] private readonly IServerEntityManager _serverEntityManager = default!;
|
||||
|
||||
private ReagentUnit _transferAmount;
|
||||
[DataField("transferAmount")]
|
||||
private ReagentUnit _transferAmount = ReagentUnit.New(10);
|
||||
[DataField("spraySound")]
|
||||
private string _spraySound;
|
||||
private float _sprayVelocity;
|
||||
private float _sprayAliveTime;
|
||||
[DataField("sprayVelocity")]
|
||||
private float _sprayVelocity = 1.5f;
|
||||
[DataField("sprayAliveTime")]
|
||||
private float _sprayAliveTime = 0.75f;
|
||||
private TimeSpan _lastUseTime;
|
||||
private TimeSpan _cooldownEnd;
|
||||
private float _cooldownTime;
|
||||
private string _vaporPrototype;
|
||||
private int _vaporAmount;
|
||||
private float _vaporSpread;
|
||||
[DataField("cooldownTime")]
|
||||
private float _cooldownTime = 0.5f;
|
||||
[DataField("sprayedPrototype")]
|
||||
private string _vaporPrototype = "Vapor";
|
||||
[DataField("vaporAmount")]
|
||||
private int _vaporAmount = 1;
|
||||
[DataField("vaporSpread")]
|
||||
private float _vaporSpread = 90f;
|
||||
[DataField("hasSafety")]
|
||||
private bool _hasSafety;
|
||||
private bool _safety;
|
||||
[DataField("safety")]
|
||||
private bool _safety = true;
|
||||
|
||||
/// <summary>
|
||||
/// The amount of solution to be sprayer from this solution when using it
|
||||
@@ -77,21 +89,6 @@ namespace Content.Server.GameObjects.Components.Fluids
|
||||
}
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _vaporPrototype, "sprayedPrototype", "Vapor");
|
||||
serializer.DataField(ref _vaporAmount, "vaporAmount", 1);
|
||||
serializer.DataField(ref _vaporSpread, "vaporSpread", 90f);
|
||||
serializer.DataField(ref _cooldownTime, "cooldownTime", 0.5f);
|
||||
serializer.DataField(ref _transferAmount, "transferAmount", ReagentUnit.New(10));
|
||||
serializer.DataField(ref _sprayVelocity, "sprayVelocity", 1.5f);
|
||||
serializer.DataField(ref _spraySound, "spraySound", string.Empty);
|
||||
serializer.DataField(ref _sprayAliveTime, "sprayAliveTime", 0.75f);
|
||||
serializer.DataField(ref _hasSafety, "hasSafety", false);
|
||||
serializer.DataField(ref _safety, "safety", true);
|
||||
}
|
||||
|
||||
async Task<bool> IAfterInteract.AfterInteract(AfterInteractEventArgs eventArgs)
|
||||
{
|
||||
if (!ActionBlockerSystem.CanInteract(eventArgs.User))
|
||||
|
||||
@@ -7,7 +7,10 @@ using Content.Shared.Interfaces.GameObjects.Components;
|
||||
using Robust.Server.GameObjects;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Serialization.Manager.Attributes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Gravity
|
||||
@@ -17,9 +20,11 @@ namespace Content.Server.GameObjects.Components.Gravity
|
||||
{
|
||||
[ComponentDependency] private readonly AppearanceComponent? _appearance = default!;
|
||||
|
||||
private bool _switchedOn;
|
||||
[DataField("switchedOn")]
|
||||
private bool _switchedOn = true;
|
||||
|
||||
private bool _intact;
|
||||
[DataField("intact")]
|
||||
private bool _intact = true;
|
||||
|
||||
private GravityGeneratorStatus _status;
|
||||
|
||||
@@ -70,14 +75,6 @@ namespace Content.Server.GameObjects.Components.Gravity
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
|
||||
serializer.DataField(ref _switchedOn, "switchedOn", true);
|
||||
serializer.DataField(ref _intact, "intact", true);
|
||||
}
|
||||
|
||||
bool IInteractHand.InteractHand(InteractHandEventArgs eventArgs)
|
||||
{
|
||||
if (!eventArgs.User.TryGetComponent<IActorComponent>(out var actor))
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user