mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 11:40:52 +01:00
Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
50981ad1a1 | ||
|
|
0cbfbeffae | ||
|
|
e603153016 | ||
|
|
e7c417ca0c | ||
|
|
a3989f28eb | ||
|
|
38ace3c348 | ||
|
|
0e00170f45 | ||
|
|
261ee96cad | ||
|
|
2c851885db | ||
|
|
849be86455 | ||
|
|
ffd5c120be | ||
|
|
76b15dda70 | ||
|
|
0bf7f519ad | ||
|
|
f97f325a36 | ||
|
|
24315fa787 | ||
|
|
792179657b | ||
|
|
9b92bcf911 | ||
|
|
86e34ea27b | ||
|
|
62cf778958 | ||
|
|
5d667e44c3 | ||
|
|
6d84b8741c | ||
|
|
d08ca59b75 | ||
|
|
f06b046c1c | ||
|
|
bb412a6906 |
@@ -53,8 +53,11 @@
|
||||
DelaySign="$(DelaySign)"
|
||||
UpdateBuildIndicator="$(IntermediateOutputPath)XAML/doot"/>
|
||||
|
||||
<PropertyGroup>
|
||||
<DOTNET_HOST_PATH Condition="'$(DOTNET_HOST_PATH)' == ''">dotnet</DOTNET_HOST_PATH>
|
||||
</PropertyGroup>
|
||||
<Exec
|
||||
Condition="'$(_RobustUseExternalMSBuild)' == 'true'"
|
||||
Command="dotnet msbuild /nodereuse:false $(MSBuildProjectFile) /t:CompileRobustXaml /p:_RobustForceInternalMSBuild=true /p:Configuration=$(Configuration) /p:RuntimeIdentifier=$(RuntimeIdentifier) /p:TargetFramework=$(TargetFramework) /p:BuildProjectReferences=false"/>
|
||||
Command=""$(DOTNET_HOST_PATH)" msbuild /nodereuse:false $(MSBuildProjectFile) /t:CompileRobustXaml /p:_RobustForceInternalMSBuild=true /p:Configuration=$(Configuration) /p:RuntimeIdentifier=$(RuntimeIdentifier) /p:TargetFramework=$(TargetFramework) /p:BuildProjectReferences=false"/>
|
||||
</Target>
|
||||
</Project>
|
||||
|
||||
72
Robust.Client/Console/Commands/AddCompCommand.cs
Normal file
72
Robust.Client/Console/Commands/AddCompCommand.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.Interfaces.Console;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Robust.Client.Console.Commands
|
||||
{
|
||||
[UsedImplicitly]
|
||||
internal sealed class AddCompCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "addcompc";
|
||||
public string Description => "Adds a component to an entity on the client";
|
||||
public string Help => "addcompc <uid> <componentName>";
|
||||
|
||||
public bool Execute(IDebugConsole shell, params string[] args)
|
||||
{
|
||||
|
||||
if (args.Length != 2)
|
||||
{
|
||||
shell.AddLine("Wrong number of arguments");
|
||||
return false;
|
||||
}
|
||||
|
||||
var entityUid = EntityUid.Parse(args[0]);
|
||||
var componentName = args[1];
|
||||
|
||||
var compManager = IoCManager.Resolve<IComponentManager>();
|
||||
var compFactory = IoCManager.Resolve<IComponentFactory>();
|
||||
var entityManager = IoCManager.Resolve<IEntityManager>();
|
||||
|
||||
var entity = entityManager.GetEntity(entityUid);
|
||||
var component = (Component) compFactory.GetComponent(componentName);
|
||||
|
||||
component.Owner = entity;
|
||||
|
||||
compManager.AddComponent(entity, component);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
[UsedImplicitly]
|
||||
internal sealed class RemoveCompCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "rmcompc";
|
||||
public string Description => "Removes a component from an entity.";
|
||||
public string Help => "rmcompc <uid> <componentName>";
|
||||
|
||||
public bool Execute(IDebugConsole shell, string[] args)
|
||||
{
|
||||
if (args.Length != 2)
|
||||
{
|
||||
shell.AddLine("Wrong number of arguments");
|
||||
return false;
|
||||
}
|
||||
|
||||
var entityUid = EntityUid.Parse(args[0]);
|
||||
var componentName = args[1];
|
||||
|
||||
var compManager = IoCManager.Resolve<IComponentManager>();
|
||||
var compFactory = IoCManager.Resolve<IComponentFactory>();
|
||||
|
||||
var registration = compFactory.GetRegistration(componentName);
|
||||
|
||||
compManager.RemoveComponent(entityUid, registration.Type);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
69
Robust.Client/Console/Commands/LauncherAuthCommand.cs
Normal file
69
Robust.Client/Console/Commands/LauncherAuthCommand.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
#if !FULL_RELEASE
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using Robust.Client.Interfaces.Console;
|
||||
using Robust.Client.Utility;
|
||||
using Robust.Shared;
|
||||
using Robust.Shared.Interfaces.Configuration;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Robust.Client.Console.Commands
|
||||
{
|
||||
internal sealed class LauncherAuthCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "launchauth";
|
||||
public string Description => "Load authentication tokens from launcher data to aid in testing of live servers";
|
||||
public string Help => "launchauth [account name]";
|
||||
|
||||
public bool Execute(IDebugConsole console, params string[] args)
|
||||
{
|
||||
var wantName = args.Length > 0 ? args[0] : null;
|
||||
|
||||
var basePath = Path.GetDirectoryName(UserDataDir.GetUserDataDir())!;
|
||||
var cfgPath = Path.Combine(basePath, "launcher", "launcher_config.json");
|
||||
|
||||
var data = JsonSerializer.Deserialize<LauncherConfig>(File.ReadAllText(cfgPath))!;
|
||||
|
||||
var login = wantName != null
|
||||
? data.Logins.FirstOrDefault(p => p.Username == wantName)
|
||||
: data.Logins.FirstOrDefault();
|
||||
|
||||
if (login == null)
|
||||
{
|
||||
console.AddLine("Unable to find a matching login");
|
||||
return false;
|
||||
}
|
||||
|
||||
var token = login.Token.Token;
|
||||
var userId = login.UserId;
|
||||
|
||||
var cfg = IoCManager.Resolve<IConfigurationManagerInternal>();
|
||||
cfg.SetSecureCVar(CVars.AuthUserId, userId);
|
||||
cfg.SetSecureCVar(CVars.AuthToken, token);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private sealed class LauncherConfig
|
||||
{
|
||||
[JsonInclude] [JsonPropertyName("logins")]
|
||||
public LauncherLogin[] Logins = default!;
|
||||
}
|
||||
|
||||
private sealed class LauncherLogin
|
||||
{
|
||||
[JsonInclude] public string Username = default!;
|
||||
[JsonInclude] public string UserId = default!;
|
||||
[JsonInclude] public LauncherToken Token = default!;
|
||||
}
|
||||
|
||||
private sealed class LauncherToken
|
||||
{
|
||||
[JsonInclude] public string Token = default!;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
35
Robust.Client/Console/Commands/SetInputContextCommand.cs
Normal file
35
Robust.Client/Console/Commands/SetInputContextCommand.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.Interfaces.Console;
|
||||
using Robust.Client.Interfaces.Input;
|
||||
using Robust.Shared.IoC;
|
||||
|
||||
namespace Robust.Client.Console.Commands
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public class SetInputContextCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "setinputcontext";
|
||||
public string Description => "Sets the active input context.";
|
||||
public string Help => "setinputcontext <context>";
|
||||
|
||||
public bool Execute(IDebugConsole console, params string[] args)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
{
|
||||
console.AddLine("Invalid number of arguments!");
|
||||
return false;
|
||||
}
|
||||
|
||||
var inputMan = IoCManager.Resolve<IInputManager>();
|
||||
|
||||
if (!inputMan.Contexts.Exists(args[0]))
|
||||
{
|
||||
console.AddLine("Context not found!");
|
||||
return false;
|
||||
}
|
||||
|
||||
inputMan.Contexts.SetActiveContext(args[0]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -991,6 +991,9 @@ namespace Robust.Client.GameObjects
|
||||
var mRotation = Matrix3.CreateRotation(angle);
|
||||
Matrix3.Multiply(ref mRotation, ref mOffset, out var transform);
|
||||
|
||||
// Only apply scale if needed.
|
||||
if(!Scale.EqualsApprox(Vector2.One)) transform.Multiply(Matrix3.CreateScale(Scale));
|
||||
|
||||
transform.Multiply(worldTransform);
|
||||
|
||||
RenderInternal(drawingHandle, worldRotation, overrideDirection, transform);
|
||||
|
||||
@@ -128,7 +128,8 @@ namespace Robust.Client.GameObjects.EntitySystems
|
||||
|
||||
if (!entity.TryGetComponent(out InputComponent? inputComp))
|
||||
{
|
||||
Logger.DebugS("input.context", $"AttachedEnt has no InputComponent: entId={entity.Uid}, entProto={entity.Prototype}");
|
||||
Logger.DebugS("input.context", $"AttachedEnt has no InputComponent: entId={entity.Uid}, entProto={entity.Prototype}. Setting default \"{InputContextContainer.DefaultContextName}\" context...");
|
||||
inputMan.Contexts.SetActiveContext(InputContextContainer.DefaultContextName);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -138,7 +139,8 @@ namespace Robust.Client.GameObjects.EntitySystems
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.ErrorS("input.context", $"Unknown context: entId={entity.Uid}, entProto={entity.Prototype}, context={inputComp.ContextName}");
|
||||
Logger.ErrorS("input.context", $"Unknown context: entId={entity.Uid}, entProto={entity.Prototype}, context={inputComp.ContextName}. . Setting default \"{InputContextContainer.DefaultContextName}\" context...");
|
||||
inputMan.Contexts.SetActiveContext(InputContextContainer.DefaultContextName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["name","directions"] //'delays' is marked as optional in the spec
|
||||
"required": ["name"] //'delays' is marked as optional in the spec
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
|
||||
@@ -98,9 +98,9 @@ namespace Robust.Client.Placement
|
||||
public bool Eraser { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The texture we use to show from our placement manager to represent the entity to place
|
||||
/// The texture we use to show from our placement manager to represent the entity to place
|
||||
/// </summary>
|
||||
public IDirectionalTextureProvider? CurrentBaseSprite { get; set; }
|
||||
public List<IDirectionalTextureProvider>? CurrentTextures { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Which of the placement orientations we are trying to place with
|
||||
@@ -311,7 +311,7 @@ namespace Robust.Client.Placement
|
||||
{
|
||||
PlacementChanged?.Invoke(this, EventArgs.Empty);
|
||||
Hijack = null;
|
||||
CurrentBaseSprite = null;
|
||||
CurrentTextures = null;
|
||||
CurrentPrototype = null;
|
||||
CurrentPermission = null;
|
||||
CurrentMode = null;
|
||||
@@ -555,7 +555,7 @@ namespace Robust.Client.Placement
|
||||
{
|
||||
var prototype = _prototypeManager.Index<EntityPrototype>(templateName);
|
||||
|
||||
CurrentBaseSprite = SpriteComponent.GetPrototypeIcon(prototype, ResourceCache);
|
||||
CurrentTextures = SpriteComponent.GetPrototypeTextures(prototype, ResourceCache).ToList();
|
||||
CurrentPrototype = prototype;
|
||||
|
||||
IsActive = true;
|
||||
@@ -563,8 +563,9 @@ namespace Robust.Client.Placement
|
||||
|
||||
private void PreparePlacementTile()
|
||||
{
|
||||
CurrentBaseSprite = ResourceCache
|
||||
.GetResource<TextureResource>(new ResourcePath("/Textures/UserInterface/tilebuildoverlay.png")).Texture;
|
||||
CurrentTextures = new List<IDirectionalTextureProvider>
|
||||
{ResourceCache
|
||||
.GetResource<TextureResource>(new ResourcePath("/Textures/UserInterface/tilebuildoverlay.png")).Texture};
|
||||
|
||||
IsActive = true;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Graphics.ClientEye;
|
||||
using Robust.Client.Graphics.Drawing;
|
||||
@@ -28,9 +29,9 @@ namespace Robust.Client.Placement
|
||||
public EntityCoordinates MouseCoords { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Texture resource to draw to represent the entity we are tryign to spawn
|
||||
/// Texture resources to draw to represent the entity we are trying to spawn
|
||||
/// </summary>
|
||||
public Texture? SpriteToDraw { get; set; }
|
||||
public List<Texture>? TexturesToDraw { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Color set to the ghost entity when it has a valid spawn position
|
||||
@@ -85,12 +86,15 @@ namespace Robust.Client.Placement
|
||||
|
||||
public virtual void Render(DrawingHandleWorld handle)
|
||||
{
|
||||
if (SpriteToDraw == null)
|
||||
if (TexturesToDraw == null)
|
||||
{
|
||||
SetSprite();
|
||||
DebugTools.AssertNotNull(SpriteToDraw);
|
||||
DebugTools.AssertNotNull(TexturesToDraw);
|
||||
}
|
||||
|
||||
if (TexturesToDraw == null || TexturesToDraw.Count == 0)
|
||||
return;
|
||||
|
||||
IEnumerable<EntityCoordinates> locationcollection;
|
||||
switch (pManager.PlacementType)
|
||||
{
|
||||
@@ -108,13 +112,17 @@ namespace Robust.Client.Placement
|
||||
break;
|
||||
}
|
||||
|
||||
var size = SpriteToDraw!.Size;
|
||||
var size = TexturesToDraw[0].Size;
|
||||
foreach (var coordinate in locationcollection)
|
||||
{
|
||||
var worldPos = coordinate.ToMapPos(pManager.EntityManager);
|
||||
var pos = worldPos - (size/(float)EyeManager.PixelsPerMeter) / 2f;
|
||||
var color = IsValidPosition(coordinate) ? ValidPlaceColor : InvalidPlaceColor;
|
||||
handle.DrawTexture(SpriteToDraw, pos, color);
|
||||
|
||||
foreach (var texture in TexturesToDraw)
|
||||
{
|
||||
handle.DrawTexture(texture, pos, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,7 +196,10 @@ namespace Robust.Client.Placement
|
||||
|
||||
public void SetSprite()
|
||||
{
|
||||
SpriteToDraw = pManager.CurrentBaseSprite!.TextureFor(pManager.Direction);
|
||||
if (pManager.CurrentTextures == null)
|
||||
return;
|
||||
|
||||
TexturesToDraw = pManager.CurrentTextures.Select(o => o.TextureFor(pManager.Direction)).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -3,7 +3,6 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Interfaces.ResourceManagement;
|
||||
using Robust.Client.Utility;
|
||||
@@ -346,15 +345,25 @@ namespace Robust.Client.ResourceManagement
|
||||
foreach (var stateObject in manifestJson["states"]!.Cast<JObject>())
|
||||
{
|
||||
var stateName = stateObject["name"]!.ToObject<string>()!;
|
||||
var dirValue = stateObject["directions"]!.ToObject<int>();
|
||||
RSI.State.DirectionType directions;
|
||||
int dirValue;
|
||||
|
||||
var directions = dirValue switch
|
||||
if (stateObject.TryGetValue("directions", out var dirJToken))
|
||||
{
|
||||
1 => RSI.State.DirectionType.Dir1,
|
||||
4 => RSI.State.DirectionType.Dir4,
|
||||
8 => RSI.State.DirectionType.Dir8,
|
||||
_ => throw new RSILoadException($"Invalid direction: {dirValue}")
|
||||
};
|
||||
dirValue= dirJToken.ToObject<int>();
|
||||
directions = dirValue switch
|
||||
{
|
||||
1 => RSI.State.DirectionType.Dir1,
|
||||
4 => RSI.State.DirectionType.Dir4,
|
||||
8 => RSI.State.DirectionType.Dir8,
|
||||
_ => throw new RSILoadException($"Invalid direction: {dirValue} expected 1, 4 or 8")
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
dirValue = 1;
|
||||
directions = RSI.State.DirectionType.Dir1;
|
||||
}
|
||||
|
||||
// We can ignore selectors and flags for now,
|
||||
// because they're not used yet!
|
||||
|
||||
@@ -433,7 +433,7 @@ namespace Robust.Client.UserInterface.Controls
|
||||
if (item.Region == null)
|
||||
continue;
|
||||
|
||||
if (!item.Region.Value.Contains(args.RelativePosition))
|
||||
if (!item.Region.Value.Contains(args.RelativePixelPosition))
|
||||
continue;
|
||||
|
||||
if (item.Selectable && !item.Disabled)
|
||||
|
||||
@@ -4,7 +4,7 @@ using JetBrains.Annotations;
|
||||
|
||||
namespace Robust.Client.Utility
|
||||
{
|
||||
public static class UserDataDir
|
||||
internal static class UserDataDir
|
||||
{
|
||||
[Pure]
|
||||
public static string GetUserDataDir()
|
||||
|
||||
@@ -38,6 +38,7 @@ namespace Robust.Server.Console.Commands
|
||||
}
|
||||
}
|
||||
|
||||
[UsedImplicitly]
|
||||
internal sealed class RemoveCompCommand : IClientCommand
|
||||
{
|
||||
public string Command => "rmcomp";
|
||||
|
||||
@@ -11,6 +11,7 @@ using System.Linq;
|
||||
using Robust.Shared.Enums;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.Network;
|
||||
using Robust.Shared.Log;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Network.Messages;
|
||||
|
||||
@@ -88,6 +89,12 @@ namespace Robust.Server.Placement
|
||||
|
||||
var coordinates = msg.EntityCoordinates;
|
||||
|
||||
if (!coordinates.IsValid(_entityManager))
|
||||
{
|
||||
Logger.WarningS("placement",
|
||||
$"{session} tried to place {msg.ObjType} at invalid coordinate {coordinates}");
|
||||
return;
|
||||
}
|
||||
|
||||
/* TODO: Redesign permission system, or document what this is supposed to be doing
|
||||
var permission = GetPermission(session.attachedEntity.Uid, alignRcv);
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Mime;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Primitives;
|
||||
@@ -68,8 +69,8 @@ namespace Robust.Server.ServerStatus
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
apiContext.Respond("Internal Server Error", HttpStatusCode.InternalServerError);
|
||||
_httpSawmill.Error($"Exception in StatusHost: {e}");
|
||||
apiContext.Respond("Internal Server Error", HttpStatusCode.InternalServerError);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -234,12 +235,12 @@ namespace Robust.Server.ServerStatus
|
||||
return serializer.Deserialize<T>(jsonReader);
|
||||
}
|
||||
|
||||
public void Respond(string text, HttpStatusCode code = HttpStatusCode.OK, string contentType = "text/plain")
|
||||
public void Respond(string text, HttpStatusCode code = HttpStatusCode.OK, string contentType = MediaTypeNames.Text.Plain)
|
||||
{
|
||||
Respond(text, (int) code, contentType);
|
||||
}
|
||||
|
||||
public void Respond(string text, int code = 200, string contentType = "text/plain")
|
||||
public void Respond(string text, int code = 200, string contentType = MediaTypeNames.Text.Plain)
|
||||
{
|
||||
_context.Response.StatusCode = code;
|
||||
_context.Response.ContentType = contentType;
|
||||
@@ -263,6 +264,8 @@ namespace Robust.Server.ServerStatus
|
||||
{
|
||||
using var streamWriter = new StreamWriter(_context.Response.OutputStream, EncodingHelpers.UTF8);
|
||||
|
||||
_context.Response.ContentType = MediaTypeNames.Application.Json;
|
||||
|
||||
using var jsonWriter = new JsonTextWriter(streamWriter);
|
||||
|
||||
JsonSerializer.Serialize(jsonWriter, jsonData);
|
||||
|
||||
@@ -306,9 +306,14 @@ namespace Robust.Shared.Configuration
|
||||
|
||||
/// <inheritdoc />
|
||||
public void SetCVar(string name, object value)
|
||||
{
|
||||
SetCVarInternal(name, value);
|
||||
}
|
||||
|
||||
private void SetCVarInternal(string name, object value, bool allowSecure = false)
|
||||
{
|
||||
//TODO: Make flags work, required non-derpy net system.
|
||||
if (_configVars.TryGetValue(name, out var cVar) && cVar.Registered && (cVar.Flags & CVar.SECURE) == 0)
|
||||
if (_configVars.TryGetValue(name, out var cVar) && cVar.Registered && (allowSecure || (cVar.Flags & CVar.SECURE) == 0))
|
||||
{
|
||||
if (!Equals(cVar.OverrideValueParsed ?? cVar.Value, value))
|
||||
{
|
||||
@@ -348,6 +353,18 @@ namespace Robust.Shared.Configuration
|
||||
throw new InvalidConfigurationException($"Trying to get unregistered variable '{name}'");
|
||||
}
|
||||
|
||||
public void SetSecureCVar(string name, object value)
|
||||
{
|
||||
SetCVarInternal(name, value, allowSecure: true);
|
||||
}
|
||||
|
||||
|
||||
public void SetSecureCVar<T>(CVarDef<T> def, T value) where T : notnull
|
||||
{
|
||||
SetSecureCVar(def.Name, value);
|
||||
}
|
||||
|
||||
|
||||
public T GetCVar<T>(CVarDef<T> def) where T : notnull
|
||||
{
|
||||
return GetCVar<T>(def.Name);
|
||||
|
||||
@@ -442,6 +442,7 @@ Types:
|
||||
IsExternalInit: { All: True }
|
||||
IsReadOnlyAttribute: { All: True }
|
||||
IteratorStateMachineAttribute: { All: True }
|
||||
PreserveBaseOverridesAttribute: { All: True }
|
||||
RuntimeCompatibilityAttribute: { All: True }
|
||||
RuntimeHelpers: { All: True }
|
||||
TaskAwaiter: { All: True }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Robust.Shared.Interfaces.Physics;
|
||||
@@ -41,6 +41,7 @@ namespace Robust.Shared.GameObjects.Components
|
||||
/// </summary>
|
||||
bool Anchored { get; set; }
|
||||
|
||||
[Obsolete("Use AnchoredChangedMessage instead")]
|
||||
event Action? AnchoredChanged;
|
||||
|
||||
bool Predict { get; set; }
|
||||
@@ -344,11 +345,15 @@ namespace Robust.Shared.GameObjects.Components
|
||||
return;
|
||||
|
||||
_anchored = value;
|
||||
#pragma warning disable 618
|
||||
AnchoredChanged?.Invoke();
|
||||
#pragma warning restore 618
|
||||
SendMessage(new AnchoredChangedMessage(Anchored));
|
||||
Dirty();
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("Use AnchoredChangedMessage instead")]
|
||||
public event Action? AnchoredChanged;
|
||||
|
||||
[ViewVariables(VVAccess.ReadWrite)]
|
||||
@@ -518,4 +523,14 @@ namespace Robust.Shared.GameObjects.Components
|
||||
return !Anchored && Mass > 0;
|
||||
}
|
||||
}
|
||||
|
||||
public class AnchoredChangedMessage : ComponentMessage
|
||||
{
|
||||
public readonly bool Anchored;
|
||||
|
||||
public AnchoredChangedMessage(bool anchored)
|
||||
{
|
||||
Anchored = anchored;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,9 +55,6 @@ namespace Robust.Shared.GameObjects.Components.Timers
|
||||
/// <param name="cancellationToken"></param>
|
||||
public static void SpawnTimer(this IEntity entity, int milliseconds, Action onFired, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (entity.Deleted)
|
||||
return;
|
||||
|
||||
entity
|
||||
.EnsureComponent<TimerComponent>()
|
||||
.Spawn(milliseconds, onFired, cancellationToken);
|
||||
|
||||
@@ -583,7 +583,11 @@ namespace Robust.Shared.GameObjects.Components.Transform
|
||||
|
||||
internal void ChangeMapId(MapId newMapId)
|
||||
{
|
||||
if (newMapId == MapID)
|
||||
return;
|
||||
|
||||
var oldMapId = MapID;
|
||||
|
||||
MapID = newMapId;
|
||||
MapIdChanged(oldMapId);
|
||||
UpdateChildMapIdsRecursive(MapID, Owner.EntityManager.ComponentManager);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Robust.Shared.Configuration;
|
||||
|
||||
namespace Robust.Shared.Interfaces.Configuration
|
||||
{
|
||||
@@ -9,6 +10,10 @@ namespace Robust.Shared.Interfaces.Configuration
|
||||
void LoadCVarsFromAssembly(Assembly assembly);
|
||||
|
||||
T GetSecureCVar<T>(string name);
|
||||
|
||||
void SetSecureCVar(string name, object value);
|
||||
void SetSecureCVar<T>(CVarDef<T> def, T value) where T : notnull;
|
||||
|
||||
void Initialize(bool isServer);
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Robust.Shared.Log
|
||||
private const string LogBeforeLevel = AnsiFgDefault + "[";
|
||||
private const string LogAfterLevel = AnsiFgDefault + "] ";
|
||||
|
||||
private readonly Stream _stream = new BufferedStream(System.Console.OpenStandardOutput(), 2 * 1024 * 1024);
|
||||
private readonly Stream _stream = new BufferedStream(System.Console.OpenStandardOutput(), 128 * 1024);
|
||||
|
||||
private readonly StringBuilder _line = new(1024);
|
||||
|
||||
|
||||
@@ -663,7 +663,6 @@ namespace Robust.Shared.Network
|
||||
|
||||
try
|
||||
{
|
||||
await Task.Delay(1000);
|
||||
await _serializer.Handshake(channel);
|
||||
}
|
||||
catch (TaskCanceledException)
|
||||
|
||||
@@ -31,6 +31,8 @@ namespace Robust.Shared.Reflection
|
||||
|
||||
private readonly Dictionary<string, Type> _looseTypeCache = new();
|
||||
|
||||
private readonly Dictionary<string, Enum> _enumCache = new();
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<Type> GetAllChildren<T>(bool inclusive = false)
|
||||
{
|
||||
@@ -179,8 +181,13 @@ namespace Robust.Shared.Reflection
|
||||
}
|
||||
|
||||
reference = reference.Substring(5);
|
||||
|
||||
if (_enumCache.TryGetValue(reference, out @enum))
|
||||
return true;
|
||||
|
||||
var dotIndex = reference.LastIndexOf('.');
|
||||
var typeName = reference.Substring(0, dotIndex);
|
||||
|
||||
var value = reference.Substring(dotIndex + 1);
|
||||
|
||||
foreach (var assembly in assemblies)
|
||||
@@ -193,6 +200,7 @@ namespace Robust.Shared.Reflection
|
||||
}
|
||||
|
||||
@enum = (Enum) Enum.Parse(type, value);
|
||||
_enumCache[reference] = @enum;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,15 +52,26 @@ namespace Robust.UnitTesting
|
||||
assemblies.Add(AppDomain.CurrentDomain.GetAssemblyByName("Robust.Shared"));
|
||||
assemblies.Add(Assembly.GetExecutingAssembly());
|
||||
|
||||
var configurationManager = IoCManager.Resolve<IConfigurationManagerInternal>();
|
||||
|
||||
configurationManager.Initialize(Project == UnitTestProject.Server);
|
||||
|
||||
foreach (var assembly in assemblies)
|
||||
{
|
||||
IoCManager.Resolve<IConfigurationManagerInternal>().LoadCVarsFromAssembly(assembly);
|
||||
configurationManager.LoadCVarsFromAssembly(assembly);
|
||||
}
|
||||
|
||||
var contentAssemblies = GetContentAssemblies();
|
||||
|
||||
foreach (var assembly in contentAssemblies)
|
||||
{
|
||||
configurationManager.LoadCVarsFromAssembly(assembly);
|
||||
}
|
||||
|
||||
IoCManager.Resolve<IReflectionManager>().LoadAssemblies(assemblies);
|
||||
|
||||
var modLoader = IoCManager.Resolve<TestingModLoader>();
|
||||
modLoader.Assemblies = GetContentAssemblies();
|
||||
modLoader.Assemblies = contentAssemblies;
|
||||
modLoader.TryLoadModulesFrom(ResourcePath.Root, "");
|
||||
|
||||
// Required components for the engine to work
|
||||
|
||||
Reference in New Issue
Block a user