Clean up some warnings (#6088)

* Clean up some warnings

* Remove nullable enable

Co-authored-by: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>

Co-authored-by: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
This commit is contained in:
wrexbe
2022-01-09 20:10:36 -08:00
committed by GitHub
parent 03c56bf23e
commit 5ceb2372bf
37 changed files with 126 additions and 119 deletions

View File

@@ -46,7 +46,7 @@ namespace Content.Client.Arcade.UI
_menu?.SetUsability(userMessage.IsPlayer); _menu?.SetUsability(userMessage.IsPlayer);
break; break;
case BlockGameMessages.BlockGameSetScreenMessage statusMessage: case BlockGameMessages.BlockGameSetScreenMessage statusMessage:
if (statusMessage.isStarted) _menu?.SetStarted(); if (statusMessage.IsStarted) _menu?.SetStarted();
_menu?.SetScreen(statusMessage.Screen); _menu?.SetScreen(statusMessage.Screen);
if (statusMessage is BlockGameMessages.BlockGameGameOverScreenMessage gameOverScreenMessage) if (statusMessage is BlockGameMessages.BlockGameGameOverScreenMessage gameOverScreenMessage)
_menu?.SetGameoverInfo(gameOverScreenMessage.FinalScore, gameOverScreenMessage.LocalPlacement, gameOverScreenMessage.GlobalPlacement); _menu?.SetGameoverInfo(gameOverScreenMessage.FinalScore, gameOverScreenMessage.LocalPlacement, gameOverScreenMessage.GlobalPlacement);

View File

@@ -9,16 +9,16 @@ namespace Content.Client.Computer
/// ComputerBoundUserInterface shunts all sorts of responsibilities that are in the BoundUserInterface for architectural reasons into the Window. /// ComputerBoundUserInterface shunts all sorts of responsibilities that are in the BoundUserInterface for architectural reasons into the Window.
/// NOTE: Despite the name, ComputerBoundUserInterface does not and will not care about things like power. /// NOTE: Despite the name, ComputerBoundUserInterface does not and will not care about things like power.
/// </summary> /// </summary>
public class ComputerBoundUserInterface<W, S> : ComputerBoundUserInterfaceBase where W : BaseWindow, IComputerWindow<S>, new() where S : BoundUserInterfaceState public class ComputerBoundUserInterface<TWindow, TState> : ComputerBoundUserInterfaceBase where TWindow : BaseWindow, IComputerWindow<TState>, new() where TState : BoundUserInterfaceState
{ {
[Dependency] private readonly IDynamicTypeFactory _dynamicTypeFactory = default!; [Dependency] private readonly IDynamicTypeFactory _dynamicTypeFactory = default!;
private W? _window; private TWindow? _window;
protected override void Open() protected override void Open()
{ {
base.Open(); base.Open();
_window = (W) _dynamicTypeFactory.CreateInstance(typeof(W)); _window = (TWindow) _dynamicTypeFactory.CreateInstance(typeof(TWindow));
_window.SetupComputerWindow(this); _window.SetupComputerWindow(this);
_window.OnClose += Close; _window.OnClose += Close;
_window.OpenCentered(); _window.OpenCentered();
@@ -36,7 +36,7 @@ namespace Content.Client.Computer
return; return;
} }
_window.UpdateState((S) state); _window.UpdateState((TState) state);
} }
protected override void Dispose(bool disposing) protected override void Dispose(bool disposing)
@@ -64,10 +64,10 @@ namespace Content.Client.Computer
} }
} }
public interface IComputerWindow<S> public interface IComputerWindow<TState>
{ {
void SetupComputerWindow(ComputerBoundUserInterfaceBase cb) {} void SetupComputerWindow(ComputerBoundUserInterfaceBase cb) {}
void UpdateState(S state) {} void UpdateState(TState state) {}
} }
} }

View File

@@ -4,10 +4,8 @@ using Robust.Client.Graphics;
using Robust.Client.Utility; using Robust.Client.Utility;
using Robust.Shared.Enums; using Robust.Shared.Enums;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Robust.Shared.Utility; using Robust.Shared.Utility;
using Robust.Shared.Maths;
namespace Content.Client.Decals namespace Content.Client.Decals
{ {

View File

@@ -28,7 +28,7 @@ namespace Content.Client.Inventory
{ {
base.Open(); base.Open();
_strippingMenu = new StrippingMenu($"{Loc.GetString("strippable-bound-user-interface-stripping-menu-title",("ownerName", Name: IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner.Owner).EntityName))}"); _strippingMenu = new StrippingMenu($"{Loc.GetString("strippable-bound-user-interface-stripping-menu-title",("ownerName", IoCManager.Resolve<IEntityManager>().GetComponent<MetaDataComponent>(Owner.Owner).EntityName))}");
_strippingMenu.OnClose += Close; _strippingMenu.OnClose += Close;
_strippingMenu.OpenCentered(); _strippingMenu.OpenCentered();

View File

@@ -20,9 +20,9 @@ namespace Content.Client.Lathe.Components
Clear(); Clear();
foreach (var ID in state.Recipes) foreach (var id in state.Recipes)
{ {
if (!_prototypeManager.TryIndex(ID, out LatheRecipePrototype? recipe)) continue; if (!_prototypeManager.TryIndex(id, out LatheRecipePrototype? recipe)) continue;
AddRecipe(recipe); AddRecipe(recipe);
} }
} }

View File

@@ -26,9 +26,9 @@ namespace Content.Client.Lathe.Components
Clear(); Clear();
foreach (var ID in state.Recipes) foreach (var id in state.Recipes)
{ {
if(!_prototypeManager.TryIndex(ID, out LatheRecipePrototype? recipe)) continue; if(!_prototypeManager.TryIndex(id, out LatheRecipePrototype? recipe)) continue;
AddRecipe(recipe); AddRecipe(recipe);
} }

View File

@@ -36,7 +36,7 @@ namespace Content.Client.MedicalScanner.UI
} }
else else
{ {
text.Append($"{Loc.GetString("medical-scanner-window-entity-health-text", ("entityName", Name: entities.GetComponent<MetaDataComponent>(state.Entity.Value).EntityName))}\n"); text.Append($"{Loc.GetString("medical-scanner-window-entity-health-text", ("entityName", entities.GetComponent<MetaDataComponent>(state.Entity.Value).EntityName))}\n");
var totalDamage = state.DamagePerType.Values.Sum(); var totalDamage = state.DamagePerType.Values.Sum();

View File

@@ -1,4 +1,4 @@
using Content.Client.VendingMachines.UI; using Content.Client.VendingMachines.UI;
using Content.Shared.VendingMachines; using Content.Shared.VendingMachines;
using Robust.Client.GameObjects; using Robust.Client.GameObjects;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
@@ -38,9 +38,9 @@ namespace Content.Client.VendingMachines
_menu.OpenCentered(); _menu.OpenCentered();
} }
public void Eject(string ID) public void Eject(string id)
{ {
SendMessage(new VendingMachineEjectMessage(ID)); SendMessage(new VendingMachineEjectMessage(id));
} }
protected override void ReceiveMessage(BoundUserInterfaceMessage message) protected override void ReceiveMessage(BoundUserInterfaceMessage message)

View File

@@ -64,7 +64,6 @@ namespace Content.IntegrationTests.Tests
EntityUid uniform = default; EntityUid uniform = default;
EntityUid idCard = default; EntityUid idCard = default;
EntityUid pocketItem = default; EntityUid pocketItem = default;
InventoryComponent inventory = null;
InventorySystem invSystem = default!; InventorySystem invSystem = default!;

View File

@@ -1,4 +1,4 @@
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Net; using System.Net;
using System.Reflection; using System.Reflection;
using Microsoft.EntityFrameworkCore.Storage; using Microsoft.EntityFrameworkCore.Storage;
@@ -42,26 +42,27 @@ namespace Content.Server.Database
} }
protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters parameters) protected override RelationalTypeMapping Clone(RelationalTypeMappingParameters parameters)
=> new NpgsqlInetWithMaskTypeMapping(parameters); {
return new NpgsqlInetWithMaskTypeMapping(parameters);
}
protected override string GenerateNonNullSqlLiteral(object value) protected override string GenerateNonNullSqlLiteral(object value)
{ {
var cidr = ((IPAddress Address, int Subnet)) value; var (address, subnet) = ((IPAddress, int)) value;
return $"INET '{cidr.Address}/{cidr.Subnet}'"; return $"INET '{address}/{subnet}'";
} }
public override Expression GenerateCodeLiteral(object value) public override Expression GenerateCodeLiteral(object value)
{ {
var cidr = ((IPAddress Address, int Subnet)) value; var (address, subnet) = ((IPAddress, int)) value;
return Expression.New( return Expression.New(
Constructor, Constructor,
Expression.Call(ParseMethod, Expression.Constant(cidr.Address.ToString())), Expression.Call(ParseMethod, Expression.Constant(address.ToString())),
Expression.Constant(cidr.Subnet)); Expression.Constant(subnet));
} }
static readonly MethodInfo ParseMethod = typeof(IPAddress).GetMethod("Parse", new[] {typeof(string)})!; private static readonly MethodInfo ParseMethod = typeof(IPAddress).GetMethod("Parse", new[] {typeof(string)})!;
private static readonly ConstructorInfo Constructor =
static readonly ConstructorInfo Constructor =
typeof((IPAddress, int)).GetConstructor(new[] {typeof(IPAddress), typeof(int)})!; typeof((IPAddress, int)).GetConstructor(new[] {typeof(IPAddress), typeof(int)})!;
} }
} }

View File

@@ -21,7 +21,9 @@ namespace Content.Server.Database
} }
public void ApplyServices(IServiceCollection services) public void ApplyServices(IServiceCollection services)
=> services.AddSnakeCase(); {
services.AddSnakeCase();
}
public void Validate(IDbContextOptions options) {} public void Validate(IDbContextOptions options) {}
@@ -33,7 +35,10 @@ namespace Content.Server.Database
public override string LogFragment => "Snake Case Extension"; public override string LogFragment => "Snake Case Extension";
public override int GetServiceProviderHashCode() => 0; public override int GetServiceProviderHashCode()
{
return 0;
}
public override bool ShouldUseSameServiceProvider(DbContextOptionsExtensionInfo other) public override bool ShouldUseSameServiceProvider(DbContextOptionsExtensionInfo other)
{ {
@@ -154,7 +159,9 @@ namespace Content.Server.Database
public virtual void ProcessPropertyAdded( public virtual void ProcessPropertyAdded(
IConventionPropertyBuilder propertyBuilder, IConventionPropertyBuilder propertyBuilder,
IConventionContext<IConventionPropertyBuilder> context) IConventionContext<IConventionPropertyBuilder> context)
=> RewriteColumnName(propertyBuilder); {
RewriteColumnName(propertyBuilder);
}
public void ProcessForeignKeyOwnershipChanged(IConventionForeignKeyBuilder relationshipBuilder, IConventionContext<bool?> context) public void ProcessForeignKeyOwnershipChanged(IConventionForeignKeyBuilder relationshipBuilder, IConventionContext<bool?> context)
{ {
@@ -237,7 +244,9 @@ namespace Content.Server.Database
public void ProcessForeignKeyAdded( public void ProcessForeignKeyAdded(
IConventionForeignKeyBuilder relationshipBuilder, IConventionForeignKeyBuilder relationshipBuilder,
IConventionContext<IConventionForeignKeyBuilder> context) IConventionContext<IConventionForeignKeyBuilder> context)
=> relationshipBuilder.HasConstraintName(RewriteName(relationshipBuilder.Metadata.GetDefaultName())); {
relationshipBuilder.HasConstraintName(RewriteName(relationshipBuilder.Metadata.GetDefaultName()));
}
public void ProcessKeyAdded(IConventionKeyBuilder keyBuilder, IConventionContext<IConventionKeyBuilder> context) public void ProcessKeyAdded(IConventionKeyBuilder keyBuilder, IConventionContext<IConventionKeyBuilder> context)
{ {
@@ -289,7 +298,7 @@ namespace Content.Server.Database
} }
} }
private void RewriteColumnName(IConventionPropertyBuilder propertyBuilder) private static void RewriteColumnName(IConventionPropertyBuilder propertyBuilder)
{ {
var property = propertyBuilder.Metadata; var property = propertyBuilder.Metadata;
var entityType = property.DeclaringEntityType; var entityType = property.DeclaringEntityType;

View File

@@ -81,10 +81,10 @@ namespace Content.Server.AI.Pathfinding
} }
} }
public bool InBounds(Vector2i Vector2i) public bool InBounds(Vector2i vector)
{ {
if (Vector2i.X < _indices.X || Vector2i.Y < _indices.Y) return false; if (vector.X < _indices.X || vector.Y < _indices.Y) return false;
if (Vector2i.X >= _indices.X + ChunkSize || Vector2i.Y >= _indices.Y + ChunkSize) return false; if (vector.X >= _indices.X + ChunkSize || vector.Y >= _indices.Y + ChunkSize) return false;
return true; return true;
} }

View File

@@ -83,10 +83,10 @@ namespace Content.Server.Actions.Actions
SoundSystem.Play(Filter.Pvs(args.Performer), PunchMissSound.GetSound(), args.Performer, AudioHelpers.WithVariation(0.025f)); SoundSystem.Play(Filter.Pvs(args.Performer), PunchMissSound.GetSound(), args.Performer, AudioHelpers.WithVariation(0.025f));
args.Performer.PopupMessageOtherClients(Loc.GetString("disarm-action-popup-message-other-clients", args.Performer.PopupMessageOtherClients(Loc.GetString("disarm-action-popup-message-other-clients",
("performerName", Name: entMan.GetComponent<MetaDataComponent>(args.Performer).EntityName), ("performerName", entMan.GetComponent<MetaDataComponent>(args.Performer).EntityName),
("targetName", Name: entMan.GetComponent<MetaDataComponent>(args.Target).EntityName))); ("targetName", entMan.GetComponent<MetaDataComponent>(args.Target).EntityName)));
args.Performer.PopupMessageCursor(Loc.GetString("disarm-action-popup-message-cursor", args.Performer.PopupMessageCursor(Loc.GetString("disarm-action-popup-message-cursor",
("targetName", Name: entMan.GetComponent<MetaDataComponent>(args.Target).EntityName))); ("targetName", entMan.GetComponent<MetaDataComponent>(args.Target).EntityName)));
system.SendLunge(angle, args.Performer); system.SendLunge(angle, args.Performer);
return; return;
} }

View File

@@ -1,4 +1,3 @@
#nullable enable
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
@@ -22,6 +21,7 @@ using Robust.Shared.IoC;
using Robust.Shared.Log; using Robust.Shared.Log;
using Robust.Shared.Network; using Robust.Shared.Network;
using Robust.Shared.Utility; using Robust.Shared.Utility;
using System.Text.Json.Serialization;
namespace Content.Server.Administration namespace Content.Server.Administration
{ {
@@ -94,8 +94,8 @@ namespace Content.Server.Administration
var payload = new WebhookPayload() var payload = new WebhookPayload()
{ {
username = oldMessage.username, Username = oldMessage.username,
content = oldMessage.content Content = oldMessage.content
}; };
if (oldMessage.id == string.Empty) if (oldMessage.id == string.Empty)
@@ -242,14 +242,14 @@ namespace Content.Server.Administration
private struct WebhookPayload private struct WebhookPayload
{ {
// ReSharper disable once InconsistentNaming [JsonPropertyName("username")]
public string username { get; set; } = ""; public string Username { get; set; } = "";
// ReSharper disable once InconsistentNaming [JsonPropertyName("content")]
public string content { get; set; } = ""; public string Content { get; set; } = "";
// ReSharper disable once InconsistentNaming [JsonPropertyName("allowed_mentions")]
public Dictionary<string, string[]> allowed_mentions { get; set; } = public Dictionary<string, string[]> AllowedMentions { get; set; } =
new() new()
{ {
{ "parse", Array.Empty<string>() } { "parse", Array.Empty<string>() }

View File

@@ -1,4 +1,4 @@
using System.Collections.Generic; using System.Collections.Generic;
using Content.Server.Atmos.Components; using Content.Server.Atmos.Components;
using Content.Shared.Atmos; using Content.Shared.Atmos;
using Content.Shared.Atmos.EntitySystems; using Content.Shared.Atmos.EntitySystems;
@@ -155,8 +155,8 @@ namespace Content.Server.Atmos.EntitySystems
{ {
for (var x = 0; x < LocalViewRange; x++) for (var x = 0; x < LocalViewRange; x++)
{ {
var Vector2i = new Vector2i(baseTile.X + x, baseTile.Y + y); var vector = new Vector2i(baseTile.X + x, baseTile.Y + y);
debugOverlayContent[index++] = ConvertTileToData(_atmosphereSystem.GetTileAtmosphereOrCreateSpace(grid, gam, Vector2i)); debugOverlayContent[index++] = ConvertTileToData(_atmosphereSystem.GetTileAtmosphereOrCreateSpace(grid, gam, vector));
} }
} }

View File

@@ -685,7 +685,7 @@ namespace Content.Server.Botany.Components
} }
user.PopupMessageCursor(Loc.GetString("plant-holder-component-already-seeded-message", user.PopupMessageCursor(Loc.GetString("plant-holder-component-already-seeded-message",
("name", Name: _entMan.GetComponent<MetaDataComponent>(Owner).EntityName))); ("name", _entMan.GetComponent<MetaDataComponent>(Owner).EntityName)));
return false; return false;
} }
@@ -694,9 +694,9 @@ namespace Content.Server.Botany.Components
if (WeedLevel > 0) if (WeedLevel > 0)
{ {
user.PopupMessageCursor(Loc.GetString("plant-holder-component-remove-weeds-message", user.PopupMessageCursor(Loc.GetString("plant-holder-component-remove-weeds-message",
("name", Name: _entMan.GetComponent<MetaDataComponent>(Owner).EntityName))); ("name", _entMan.GetComponent<MetaDataComponent>(Owner).EntityName)));
user.PopupMessageOtherClients(Loc.GetString("plant-holder-component-remove-weeds-others-message", user.PopupMessageOtherClients(Loc.GetString("plant-holder-component-remove-weeds-others-message",
("otherName", Name: _entMan.GetComponent<MetaDataComponent>(user).EntityName))); ("otherName", _entMan.GetComponent<MetaDataComponent>(user).EntityName)));
WeedLevel = 0; WeedLevel = 0;
UpdateSprite(); UpdateSprite();
} }
@@ -713,9 +713,9 @@ namespace Content.Server.Botany.Components
if (Seed != null) if (Seed != null)
{ {
user.PopupMessageCursor(Loc.GetString("plant-holder-component-remove-plant-message", user.PopupMessageCursor(Loc.GetString("plant-holder-component-remove-plant-message",
("name", Name: _entMan.GetComponent<MetaDataComponent>(Owner).EntityName))); ("name", _entMan.GetComponent<MetaDataComponent>(Owner).EntityName)));
user.PopupMessageOtherClients(Loc.GetString("plant-holder-component-remove-plant-others-message", user.PopupMessageOtherClients(Loc.GetString("plant-holder-component-remove-plant-others-message",
("name", Name: _entMan.GetComponent<MetaDataComponent>(user).EntityName))); ("name", _entMan.GetComponent<MetaDataComponent>(user).EntityName)));
RemovePlant(); RemovePlant();
} }
else else

View File

@@ -30,7 +30,7 @@ namespace Content.Server.Botany.Components
if (_entMan.TryGetComponent(eventArgs.Using, out ProduceComponent? produce) && produce.Seed != null) if (_entMan.TryGetComponent(eventArgs.Using, out ProduceComponent? produce) && produce.Seed != null)
{ {
eventArgs.User.PopupMessageCursor(Loc.GetString("seed-extractor-component-interact-message",("name", Name: _entMan.GetComponent<MetaDataComponent>(eventArgs.Using).EntityName))); eventArgs.User.PopupMessageCursor(Loc.GetString("seed-extractor-component-interact-message",("name", _entMan.GetComponent<MetaDataComponent>(eventArgs.Using).EntityName)));
_entMan.QueueDeleteEntity(eventArgs.Using); _entMan.QueueDeleteEntity(eventArgs.Using);

View File

@@ -196,7 +196,7 @@ namespace Content.Server.Chat.Managers
var msg = _netManager.CreateNetMessage<MsgChatMessage>(); var msg = _netManager.CreateNetMessage<MsgChatMessage>();
msg.Channel = ChatChannel.Local; msg.Channel = ChatChannel.Local;
msg.Message = message; msg.Message = message;
msg.MessageWrap = Loc.GetString("chat-manager-entity-say-wrap-message",("entityName", Name: _entManager.GetComponent<MetaDataComponent>(source).EntityName)); msg.MessageWrap = Loc.GetString("chat-manager-entity-say-wrap-message",("entityName", _entManager.GetComponent<MetaDataComponent>(source).EntityName));
msg.SenderEntity = source; msg.SenderEntity = source;
msg.HideChat = hideChat; msg.HideChat = hideChat;
_netManager.ServerSendToMany(msg, clients); _netManager.ServerSendToMany(msg, clients);
@@ -233,7 +233,7 @@ namespace Content.Server.Chat.Managers
var msg = _netManager.CreateNetMessage<MsgChatMessage>(); var msg = _netManager.CreateNetMessage<MsgChatMessage>();
msg.Channel = ChatChannel.Emotes; msg.Channel = ChatChannel.Emotes;
msg.Message = action; msg.Message = action;
msg.MessageWrap = Loc.GetString("chat-manager-entity-me-wrap-message", ("entityName",Name: _entManager.GetComponent<MetaDataComponent>(source).EntityName)); msg.MessageWrap = Loc.GetString("chat-manager-entity-me-wrap-message", ("entityName", _entManager.GetComponent<MetaDataComponent>(source).EntityName));
msg.SenderEntity = source; msg.SenderEntity = source;
_netManager.ServerSendToMany(msg, clients); _netManager.ServerSendToMany(msg, clients);
} }

View File

@@ -11,16 +11,16 @@ namespace Content.Server.Chemistry.EntitySystems
{ {
public class ChemicalReactionSystem : SharedChemicalReactionSystem public class ChemicalReactionSystem : SharedChemicalReactionSystem
{ {
protected override void OnReaction(Solution solution, ReactionPrototype reaction, ReagentPrototype randomReagent, EntityUid Owner, FixedPoint2 unitReactions) protected override void OnReaction(Solution solution, ReactionPrototype reaction, ReagentPrototype randomReagent, EntityUid owner, FixedPoint2 unitReactions)
{ {
base.OnReaction(solution, reaction, randomReagent, Owner, unitReactions); base.OnReaction(solution, reaction, randomReagent, owner, unitReactions);
var coordinates = Transform(Owner).Coordinates; var coordinates = Transform(owner).Coordinates;
_logSystem.Add(LogType.ChemicalReaction, reaction.Impact, _logSystem.Add(LogType.ChemicalReaction, reaction.Impact,
$"Chemical reaction {reaction.ID:reaction} occurred with strength {unitReactions:strength} on entity {ToPrettyString(Owner):metabolizer} at {coordinates}"); $"Chemical reaction {reaction.ID:reaction} occurred with strength {unitReactions:strength} on entity {ToPrettyString(owner):metabolizer} at {coordinates}");
SoundSystem.Play(Filter.Pvs(Owner, entityManager:EntityManager), reaction.Sound.GetSound(), Owner); SoundSystem.Play(Filter.Pvs(owner, entityManager:EntityManager), reaction.Sound.GetSound(), owner);
} }
} }
} }

View File

@@ -13,6 +13,7 @@ using Robust.Shared.IoC;
using Robust.Shared.Localization; using Robust.Shared.Localization;
using Robust.Shared.Log; using Robust.Shared.Log;
using Robust.Shared.Maths; using Robust.Shared.Maths;
using Robust.Shared.Physics;
using Robust.Shared.Serialization.Manager.Attributes; using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables; using Robust.Shared.ViewVariables;
@@ -160,7 +161,7 @@ namespace Content.Server.Climbing.Components
var result = await EntitySystem.Get<DoAfterSystem>().WaitDoAfter(doAfterEventArgs); var result = await EntitySystem.Get<DoAfterSystem>().WaitDoAfter(doAfterEventArgs);
if (result != DoAfterStatus.Cancelled && _entities.TryGetComponent(entityToMove, out PhysicsComponent? body) && body.Fixtures.Count >= 1) if (result != DoAfterStatus.Cancelled && _entities.TryGetComponent(entityToMove, out FixturesComponent? body) && body.FixtureCount >= 1)
{ {
var entityPos = _entities.GetComponent<TransformComponent>(entityToMove).WorldPosition; var entityPos = _entities.GetComponent<TransformComponent>(entityToMove).WorldPosition;

View File

@@ -38,9 +38,9 @@ namespace Content.Server.Construction.Conditions
if (airlock.BoltsDown != Value) if (airlock.BoltsDown != Value)
{ {
if (Value == true) if (Value == true)
args.PushMarkup(Loc.GetString("construction-examine-condition-airlock-bolt", ("entityName", Name: entMan.GetComponent<MetaDataComponent>(entity).EntityName)) + "\n"); args.PushMarkup(Loc.GetString("construction-examine-condition-airlock-bolt", ("entityName", entMan.GetComponent<MetaDataComponent>(entity).EntityName)) + "\n");
else else
args.PushMarkup(Loc.GetString("construction-examine-condition-airlock-unbolt", ("entityName", Name: entMan.GetComponent<MetaDataComponent>(entity).EntityName)) + "\n"); args.PushMarkup(Loc.GetString("construction-examine-condition-airlock-unbolt", ("entityName", entMan.GetComponent<MetaDataComponent>(entity).EntityName)) + "\n");
return true; return true;
} }

View File

@@ -36,9 +36,9 @@ namespace Content.Server.Construction.Conditions
if (door.IsWeldedShut != Welded) if (door.IsWeldedShut != Welded)
{ {
if (Welded == true) if (Welded == true)
args.PushMarkup(Loc.GetString("construction-examine-condition-door-weld", ("entityName", Name: entMan.GetComponent<MetaDataComponent>(entity).EntityName)) + "\n"); args.PushMarkup(Loc.GetString("construction-examine-condition-door-weld", ("entityName", entMan.GetComponent<MetaDataComponent>(entity).EntityName)) + "\n");
else else
args.PushMarkup(Loc.GetString("construction-examine-condition-door-unweld", ("entityName", Name: entMan.GetComponent<MetaDataComponent>(entity).EntityName)) + "\n"); args.PushMarkup(Loc.GetString("construction-examine-condition-door-unweld", ("entityName", entMan.GetComponent<MetaDataComponent>(entity).EntityName)) + "\n");
return true; return true;
} }

View File

@@ -36,7 +36,7 @@ namespace Content.Server.Ghost.Components
msg.Channel = ChatChannel.Radio; msg.Channel = ChatChannel.Radio;
msg.Message = message; msg.Message = message;
//Square brackets are added here to avoid issues with escaping //Square brackets are added here to avoid issues with escaping
msg.MessageWrap = Loc.GetString("chat-radio-message-wrap", ("channel", $"\\[{channel}\\]"), ("name", Name: _entMan.GetComponent<MetaDataComponent>(speaker).EntityName)); msg.MessageWrap = Loc.GetString("chat-radio-message-wrap", ("channel", $"\\[{channel}\\]"), ("name", _entMan.GetComponent<MetaDataComponent>(speaker).EntityName));
_netManager.ServerSendMessage(msg, playerChannel); _netManager.ServerSendMessage(msg, playerChannel);
} }

View File

@@ -74,13 +74,13 @@ namespace Content.Server.Hands.Components
if (ActiveHand != null && Drop(ActiveHand, false)) if (ActiveHand != null && Drop(ActiveHand, false))
{ {
source.PopupMessageOtherClients(Loc.GetString("hands-component-disarm-success-others-message", ("disarmer", Name: _entities.GetComponent<MetaDataComponent>(source).EntityName), ("disarmed", Name: _entities.GetComponent<MetaDataComponent>(target).EntityName))); source.PopupMessageOtherClients(Loc.GetString("hands-component-disarm-success-others-message", ("disarmer", _entities.GetComponent<MetaDataComponent>(source).EntityName), ("disarmed", _entities.GetComponent<MetaDataComponent>(target).EntityName)));
source.PopupMessageCursor(Loc.GetString("hands-component-disarm-success-message", ("disarmed", Name: _entities.GetComponent<MetaDataComponent>(target).EntityName))); source.PopupMessageCursor(Loc.GetString("hands-component-disarm-success-message", ("disarmed", _entities.GetComponent<MetaDataComponent>(target).EntityName)));
} }
else else
{ {
source.PopupMessageOtherClients(Loc.GetString("hands-component-shove-success-others-message", ("shover", Name: _entities.GetComponent<MetaDataComponent>(source).EntityName), ("shoved", Name: _entities.GetComponent<MetaDataComponent>(target).EntityName))); source.PopupMessageOtherClients(Loc.GetString("hands-component-shove-success-others-message", ("shover", _entities.GetComponent<MetaDataComponent>(source).EntityName), ("shoved", _entities.GetComponent<MetaDataComponent>(target).EntityName)));
source.PopupMessageCursor(Loc.GetString("hands-component-shove-success-message", ("shoved", Name: _entities.GetComponent<MetaDataComponent>(target).EntityName))); source.PopupMessageCursor(Loc.GetString("hands-component-shove-success-message", ("shoved", _entities.GetComponent<MetaDataComponent>(target).EntityName)));
} }
return true; return true;

View File

@@ -70,7 +70,7 @@ namespace Content.Server.Headset
msg.Channel = ChatChannel.Radio; msg.Channel = ChatChannel.Radio;
msg.Message = message; msg.Message = message;
//Square brackets are added here to avoid issues with escaping //Square brackets are added here to avoid issues with escaping
msg.MessageWrap = Loc.GetString("chat-radio-message-wrap", ("channel", $"\\[{channel}\\]"), ("name", Name: _entMan.GetComponent<MetaDataComponent>(source).EntityName)); msg.MessageWrap = Loc.GetString("chat-radio-message-wrap", ("channel", $"\\[{channel}\\]"), ("name", _entMan.GetComponent<MetaDataComponent>(source).EntityName));
_netManager.ServerSendMessage(msg, playerChannel); _netManager.ServerSendMessage(msg, playerChannel);
} }
} }

View File

@@ -30,13 +30,13 @@ namespace Content.Server.Light.Components
public int BurningTemperature = 1400; public int BurningTemperature = 1400;
[DataField("lightEnergy")] [DataField("lightEnergy")]
public float lightEnergy = 0.8f; public float LightEnergy = 0.8f;
[DataField("lightRadius")] [DataField("lightRadius")]
public float lightRadius = 10; public float LightRadius = 10;
[DataField("lightSoftness")] [DataField("lightSoftness")]
public float lightSoftness = 1; public float LightSoftness = 1;
[DataField("PowerUse")] [DataField("PowerUse")]
public int PowerUse = 40; public int PowerUse = 40;

View File

@@ -251,7 +251,7 @@ namespace Content.Server.Light.EntitySystems
case LightBulbState.Normal: case LightBulbState.Normal:
if (powerReceiver.Powered && light.On) if (powerReceiver.Powered && light.On)
{ {
SetLight(uid, true, lightBulb.Color, light, lightBulb.lightRadius, lightBulb.lightEnergy, lightBulb.lightSoftness); SetLight(uid, true, lightBulb.Color, light, lightBulb.LightRadius, lightBulb.LightEnergy, lightBulb.LightSoftness);
appearance?.SetData(PoweredLightVisuals.BulbState, PoweredLightState.On); appearance?.SetData(PoweredLightVisuals.BulbState, PoweredLightState.On);
var time = _gameTiming.CurTime; var time = _gameTiming.CurTime;
if (time > light.LastThunk + ThunkDelay) if (time > light.LastThunk + ThunkDelay)

View File

@@ -66,7 +66,7 @@ namespace Content.Server.Lock
args.PushText(Loc.GetString(lockComp.Locked args.PushText(Loc.GetString(lockComp.Locked
? "lock-comp-on-examined-is-locked" ? "lock-comp-on-examined-is-locked"
: "lock-comp-on-examined-is-unlocked", : "lock-comp-on-examined-is-unlocked",
("entityName", Name: EntityManager.GetComponent<MetaDataComponent>(lockComp.Owner).EntityName))); ("entityName", EntityManager.GetComponent<MetaDataComponent>(lockComp.Owner).EntityName)));
} }
public bool TryLock(EntityUid uid, EntityUid user, LockComponent? lockComp = null) public bool TryLock(EntityUid uid, EntityUid user, LockComponent? lockComp = null)
@@ -80,7 +80,7 @@ namespace Content.Server.Lock
if (!HasUserAccess(uid, user, quiet: false)) if (!HasUserAccess(uid, user, quiet: false))
return false; return false;
lockComp.Owner.PopupMessage(user, Loc.GetString("lock-comp-do-lock-success", ("entityName",Name: EntityManager.GetComponent<MetaDataComponent>(lockComp.Owner).EntityName))); lockComp.Owner.PopupMessage(user, Loc.GetString("lock-comp-do-lock-success", ("entityName", EntityManager.GetComponent<MetaDataComponent>(lockComp.Owner).EntityName)));
lockComp.Locked = true; lockComp.Locked = true;
if(lockComp.LockSound != null) if(lockComp.LockSound != null)
@@ -103,7 +103,7 @@ namespace Content.Server.Lock
if (!Resolve(uid, ref lockComp)) if (!Resolve(uid, ref lockComp))
return; return;
lockComp.Owner.PopupMessage(user, Loc.GetString("lock-comp-do-unlock-success", ("entityName", Name: EntityManager.GetComponent<MetaDataComponent>(lockComp.Owner).EntityName))); lockComp.Owner.PopupMessage(user, Loc.GetString("lock-comp-do-unlock-success", ("entityName", EntityManager.GetComponent<MetaDataComponent>(lockComp.Owner).EntityName)));
lockComp.Locked = false; lockComp.Locked = false;
if (lockComp.UnlockSound != null) if (lockComp.UnlockSound != null)

View File

@@ -263,7 +263,7 @@ namespace Content.Server.Nutrition.EntitySystems
if (!drink.Opened) if (!drink.Opened)
{ {
_popupSystem.PopupEntity(Loc.GetString("drink-component-try-use-drink-not-open", _popupSystem.PopupEntity(Loc.GetString("drink-component-try-use-drink-not-open",
("owner", Name: EntityManager.GetComponent<MetaDataComponent>(drink.Owner).EntityName)), uid, Filter.Entities(userUid)); ("owner", EntityManager.GetComponent<MetaDataComponent>(drink.Owner).EntityName)), uid, Filter.Entities(userUid));
return true; return true;
} }
@@ -274,7 +274,7 @@ namespace Content.Server.Nutrition.EntitySystems
drinkSolution.DrainAvailable <= 0) drinkSolution.DrainAvailable <= 0)
{ {
_popupSystem.PopupEntity(Loc.GetString("drink-component-try-use-drink-is-empty", _popupSystem.PopupEntity(Loc.GetString("drink-component-try-use-drink-is-empty",
("entity", Name: EntityManager.GetComponent<MetaDataComponent>(drink.Owner).EntityName)), uid, Filter.Entities(userUid)); ("entity", EntityManager.GetComponent<MetaDataComponent>(drink.Owner).EntityName)), uid, Filter.Entities(userUid));
return true; return true;
} }
@@ -345,7 +345,7 @@ namespace Content.Server.Nutrition.EntitySystems
if (!drink.Opened) if (!drink.Opened)
{ {
_popupSystem.PopupEntity(Loc.GetString("drink-component-try-use-drink-not-open", _popupSystem.PopupEntity(Loc.GetString("drink-component-try-use-drink-not-open",
("owner", Name: EntityManager.GetComponent<MetaDataComponent>(drink.Owner).EntityName)), uid, Filter.Entities(userUid)); ("owner", EntityManager.GetComponent<MetaDataComponent>(drink.Owner).EntityName)), uid, Filter.Entities(userUid));
return true; return true;
} }
@@ -353,7 +353,7 @@ namespace Content.Server.Nutrition.EntitySystems
drinkSolution.DrainAvailable <= 0) drinkSolution.DrainAvailable <= 0)
{ {
_popupSystem.PopupEntity(Loc.GetString("drink-component-try-use-drink-is-empty", _popupSystem.PopupEntity(Loc.GetString("drink-component-try-use-drink-is-empty",
("entity", Name: EntityManager.GetComponent<MetaDataComponent>(drink.Owner).EntityName)), uid, Filter.Entities(userUid)); ("entity", EntityManager.GetComponent<MetaDataComponent>(drink.Owner).EntityName)), uid, Filter.Entities(userUid));
return true; return true;
} }

View File

@@ -1,6 +1,5 @@
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using System.Collections.Generic; using System.Collections.Generic;
using Robust.Shared.GameObjects;
namespace Content.Server.Radio.Components namespace Content.Server.Radio.Components
{ {

View File

@@ -160,7 +160,7 @@ namespace Content.Server.Suspicion
continue; continue;
} }
allies.Add((role.Role!.Mind.CharacterName, Uid: role.Owner)); allies.Add((role.Role!.Mind.CharacterName, role.Owner));
} }
return new SuspicionRoleComponentState(Role?.Name, Role?.Antagonist, allies.ToArray()); return new SuspicionRoleComponentState(Role?.Name, Role?.Antagonist, allies.ToArray());

View File

@@ -25,19 +25,19 @@ namespace Content.Server.Tabletop
const float boardDistanceX = 1.25f; const float boardDistanceX = 1.25f;
const float pieceDistanceY = 0.80f; const float pieceDistanceY = 0.80f;
float getXPosition(float distanceFromSide, bool isLeftSide) float GetXPosition(float distanceFromSide, bool isLeftSide)
{ {
var pos = borderLengthX - (distanceFromSide * boardDistanceX); var pos = borderLengthX - (distanceFromSide * boardDistanceX);
return isLeftSide ? -pos : pos; return isLeftSide ? -pos : pos;
} }
float getYPosition(float positionNumber, bool isTop) float GetYPosition(float positionNumber, bool isTop)
{ {
var pos = borderLengthY - (pieceDistanceY * positionNumber); var pos = borderLengthY - (pieceDistanceY * positionNumber);
return isTop ? pos : -pos; return isTop ? pos : -pos;
} }
void addPieces( void AddPieces(
float distanceFromSide, float distanceFromSide,
int numberOfPieces, int numberOfPieces,
bool isBlackPiece, bool isBlackPiece,
@@ -46,26 +46,26 @@ namespace Content.Server.Tabletop
{ {
for (int i = 0; i < numberOfPieces; i++) for (int i = 0; i < numberOfPieces; i++)
{ {
session.Entities.Add(entityManager.SpawnEntity(isBlackPiece ? BlackPiecePrototype : WhitePiecePrototype, session.Position.Offset(getXPosition(distanceFromSide, isLeftSide), getYPosition(i, isTop)))); session.Entities.Add(entityManager.SpawnEntity(isBlackPiece ? BlackPiecePrototype : WhitePiecePrototype, session.Position.Offset(GetXPosition(distanceFromSide, isLeftSide), GetYPosition(i, isTop))));
} }
} }
// Top left // Top left
addPieces(0, 5, true, true, true); AddPieces(0, 5, true, true, true);
// top middle left // top middle left
addPieces(4, 3, false, true, true); AddPieces(4, 3, false, true, true);
// top middle right // top middle right
addPieces(5, 5, false, true, false); AddPieces(5, 5, false, true, false);
// top far right // top far right
addPieces(0, 2, true, true, false); AddPieces(0, 2, true, true, false);
// bottom left // bottom left
addPieces(0, 5, false, false, true); AddPieces(0, 5, false, false, true);
// bottom middle left // bottom middle left
addPieces(4, 3, true, false, true); AddPieces(4, 3, true, false, true);
// bottom middle right // bottom middle right
addPieces(5, 5, true, false, false); AddPieces(5, 5, true, false, false);
// bottom far right // bottom far right
addPieces(0, 2, false, false, false); AddPieces(0, 2, false, false, false);
} }
} }
} }

View File

@@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.Serialization; using Robust.Shared.Serialization;
@@ -61,11 +61,11 @@ namespace Content.Shared.Arcade
public class BlockGameSetScreenMessage : BoundUserInterfaceMessage public class BlockGameSetScreenMessage : BoundUserInterfaceMessage
{ {
public readonly BlockGameScreen Screen; public readonly BlockGameScreen Screen;
public readonly bool isStarted; public readonly bool IsStarted;
public BlockGameSetScreenMessage(BlockGameScreen screen, bool isStarted = true) public BlockGameSetScreenMessage(BlockGameScreen screen, bool isStarted = true)
{ {
Screen = screen; Screen = screen;
this.isStarted = isStarted; IsStarted = isStarted;
} }
} }

View File

@@ -359,7 +359,7 @@ namespace Content.Shared.Body.Components
var i = 0; var i = 0;
foreach (var (part, slot) in SlotParts) foreach (var (part, slot) in SlotParts)
{ {
parts[i] = (slot.Id, Owner: part.Owner); parts[i] = (slot.Id, part.Owner);
i++; i++;
} }

View File

@@ -32,9 +32,9 @@ namespace Content.Shared.Lathe
return true; return true;
} }
public bool CanProduce(string ID, int quantity = 1) public bool CanProduce(string id, int quantity = 1)
{ {
return PrototypeManager.TryIndex(ID, out LatheRecipePrototype? recipe) && CanProduce(recipe, quantity); return PrototypeManager.TryIndex(id, out LatheRecipePrototype? recipe) && CanProduce(recipe, quantity);
} }
/// <summary> /// <summary>

View File

@@ -17,13 +17,13 @@ namespace Content.Shared.Lathe
[ViewVariables] [ViewVariables]
protected virtual Dictionary<string, int> Storage { get; set; } = new(); protected virtual Dictionary<string, int> Storage { get; set; } = new();
public int this[string ID] public int this[string id]
{ {
get get
{ {
if (!Storage.ContainsKey(ID)) if (!Storage.ContainsKey(id))
return 0; return 0;
return Storage[ID]; return Storage[id];
} }
} }
@@ -31,10 +31,10 @@ namespace Content.Shared.Lathe
{ {
get get
{ {
var ID = material.ID; var id = material.ID;
if (!Storage.ContainsKey(ID)) if (!Storage.ContainsKey(id))
return 0; return 0;
return Storage[ID]; return Storage[id];
} }
} }

View File

@@ -1,4 +1,4 @@
using System.IO; using System.IO;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
@@ -22,9 +22,9 @@ namespace Content.Tools
Root = stream.Documents[0].RootNode; Root = stream.Documents[0].RootNode;
TilemapNode = (YamlMappingNode) Root["tilemap"]; TilemapNode = (YamlMappingNode) Root["tilemap"];
GridsNode = (YamlSequenceNode) Root["grids"]; GridsNode = (YamlSequenceNode) Root["grids"];
_entitiesNode = (YamlSequenceNode) Root["entities"]; EntitiesNode = (YamlSequenceNode) Root["entities"];
foreach (var entity in _entitiesNode) foreach (var entity in EntitiesNode)
{ {
var uid = uint.Parse(entity["uid"].AsString()); var uid = uint.Parse(entity["uid"].AsString());
if (uid >= NextAvailableEntityId) if (uid >= NextAvailableEntityId)
@@ -47,7 +47,7 @@ namespace Content.Tools
// Entities lookup // Entities lookup
private YamlSequenceNode _entitiesNode { get; } private YamlSequenceNode EntitiesNode { get; }
public Dictionary<uint, YamlMappingNode> Entities { get; } = new Dictionary<uint, YamlMappingNode>(); public Dictionary<uint, YamlMappingNode> Entities { get; } = new Dictionary<uint, YamlMappingNode>();
@@ -60,9 +60,9 @@ namespace Content.Tools
public void Save(string fileName) public void Save(string fileName)
{ {
// Update entities node // Update entities node
_entitiesNode.Children.Clear(); EntitiesNode.Children.Clear();
foreach (var kvp in Entities) foreach (var kvp in Entities)
_entitiesNode.Add(kvp.Value); EntitiesNode.Add(kvp.Value);
using var writer = new StreamWriter(fileName); using var writer = new StreamWriter(fileName);
var document = new YamlDocument(Root); var document = new YamlDocument(Root);