Merge remote-tracking branch 'upstream/master' into 20-11-19-sandboxing

This commit is contained in:
Pieter-Jan Briers
2020-11-22 00:21:03 +01:00
138 changed files with 1445 additions and 467 deletions

View File

@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
@@ -13,8 +12,8 @@ namespace Content.Shared.Alert
[Prototype("alertOrder")]
public class AlertOrderPrototype : IPrototype, IComparer<AlertPrototype>
{
private Dictionary<AlertType, int> _typeToIdx = new Dictionary<AlertType, int>();
private Dictionary<AlertCategory, int> _categoryToIdx = new Dictionary<AlertCategory, int>();
private readonly Dictionary<AlertType, int> _typeToIdx = new Dictionary<AlertType, int>();
private readonly Dictionary<AlertCategory, int> _categoryToIdx = new Dictionary<AlertCategory, int>();
public void LoadFrom(YamlMappingNode mapping)
{

View File

@@ -0,0 +1,40 @@
using Content.Shared.Maps;
using JetBrains.Annotations;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
using System.Collections.Generic;
namespace Content.Shared.Construction.ConstructionConditions
{
[UsedImplicitly]
public class TileType : IConstructionCondition
{
public List<string> TargetTiles { get; private set; }
public void ExposeData(ObjectSerializer serializer)
{
serializer.DataField(this, x => x.TargetTiles, "targets", null);
}
public bool Condition(IEntity user, EntityCoordinates location, Direction direction)
{
if (TargetTiles == null) return true;
var tileFound = location.GetTileRef();
if (tileFound == null)
return false;
var tile = TurfHelpers.GetContentTileDefinition(tileFound.Value.Tile);
foreach (var targetTile in TargetTiles)
{
if (tile.Name == targetTile) {
return true;
}
}
return false;
}
}
}

View File

@@ -13,7 +13,7 @@ namespace Content.Shared.Construction
public class ConstructionGraphPrototype : IPrototype, IIndexedPrototype
{
private readonly Dictionary<string, ConstructionGraphNode> _nodes = new Dictionary<string, ConstructionGraphNode>();
private Dictionary<ValueTuple<string, string>, ConstructionGraphNode[]> _paths = new Dictionary<ValueTuple<string, string>, ConstructionGraphNode[]>();
private readonly Dictionary<ValueTuple<string, string>, ConstructionGraphNode[]> _paths = new Dictionary<ValueTuple<string, string>, ConstructionGraphNode[]>();
private Dictionary<ConstructionGraphNode, ConstructionGraphNode> _pathfinding = new Dictionary<ConstructionGraphNode, ConstructionGraphNode>();
[ViewVariables]

View File

@@ -27,7 +27,7 @@ namespace Content.Shared.GameObjects.Components.Body.Part
public IReadOnlyList<string> MechanismIds => _mechanismIds;
[ViewVariables]
private HashSet<IMechanism> _mechanisms = new HashSet<IMechanism>();
private readonly HashSet<IMechanism> _mechanisms = new HashSet<IMechanism>();
[ViewVariables]
public IBody? Body

View File

@@ -14,7 +14,7 @@ namespace Content.Shared.GameObjects.Components.Research
public override string Name => "LatheDatabase";
public override uint? NetID => ContentNetIDs.LATHE_DATABASE;
private List<LatheRecipePrototype> _recipes = new List<LatheRecipePrototype>();
private readonly List<LatheRecipePrototype> _recipes = new List<LatheRecipePrototype>();
/// <summary>
/// Removes all recipes from the database if it's not static.

View File

@@ -15,7 +15,7 @@ namespace Content.Shared.GameObjects.Components.Research
public override string Name => "ProtolatheDatabase";
public sealed override uint? NetID => ContentNetIDs.PROTOLATHE_DATABASE;
private List<LatheRecipePrototype> _protolatheRecipes = new List<LatheRecipePrototype>();
private readonly List<LatheRecipePrototype> _protolatheRecipes = new List<LatheRecipePrototype>();
/// <summary>
/// A full list of recipes this protolathe can print.

View File

@@ -125,6 +125,7 @@ namespace Content.Shared.GameObjects.Components
{
Metal,
Glass,
ReinforcedGlass,
Plasteel,
Cable,
Wood,
@@ -139,6 +140,7 @@ namespace Content.Shared.GameObjects.Components
FloorTileCarpet,
FloorTileWhite,
FloorTileDark,
FloorTileWood
FloorTileWood,
MetalRod
}
}

View File

@@ -54,11 +54,13 @@ namespace Content.Shared.Maps
if (!coordinates.IsValid(entityManager))
return null;
mapManager ??= IoCManager.Resolve<IMapManager>();
if (!mapManager.TryGetGrid(coordinates.GetGridId(entityManager), out var grid))
return null;
if (!grid.TryGetTileRef(coordinates, out var tile))
return null;

View File

@@ -7,7 +7,7 @@ namespace Content.Shared.Physics
{
public abstract class FrictionController : VirtualController
{
[Dependency] private IPhysicsManager _physicsManager = default!;
[Dependency] private readonly IPhysicsManager _physicsManager = default!;
public override void UpdateAfterProcessing()
{