mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
Warn about invalid placement type (#3467)
This commit is contained in:
@@ -19,6 +19,7 @@ using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Reflection;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.Log;
|
||||
|
||||
namespace Robust.Client.Placement
|
||||
{
|
||||
@@ -470,14 +471,14 @@ namespace Robust.Client.Placement
|
||||
|
||||
CurrentPermission = info;
|
||||
|
||||
if (!_modeDictionary.Any(pair => pair.Key.Equals(CurrentPermission.PlacementOption)))
|
||||
if (!_modeDictionary.TryFirstOrNull(pair => pair.Key.Equals(CurrentPermission.PlacementOption), out KeyValuePair<string, Type>? placeMode))
|
||||
{
|
||||
Logger.LogS(LogLevel.Warning, nameof(PlacementManager), $"Invalid placement mode `{CurrentPermission.PlacementOption}`");
|
||||
Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
var modeType = _modeDictionary.First(pair => pair.Key.Equals(CurrentPermission.PlacementOption)).Value;
|
||||
CurrentMode = (PlacementMode) Activator.CreateInstance(modeType, this)!;
|
||||
CurrentMode = (PlacementMode) Activator.CreateInstance(placeMode.Value.Value, this)!;
|
||||
|
||||
if (hijack != null)
|
||||
{
|
||||
|
||||
@@ -92,7 +92,8 @@ namespace Robust.Shared.Prototypes
|
||||
[DataField("noSpawn")]
|
||||
public bool NoSpawn { get; private set; }
|
||||
|
||||
[DataField("placement")] private EntityPlacementProperties PlacementProperties = new();
|
||||
[DataField("placement")]
|
||||
private EntityPlacementProperties PlacementProperties = new();
|
||||
|
||||
/// <summary>
|
||||
/// The different mounting points on walls. (If any).
|
||||
|
||||
Reference in New Issue
Block a user