explicit interface go brrrr

This commit is contained in:
Paul
2021-02-04 17:44:49 +01:00
parent 5f6d2d50ba
commit d5cd82de60
148 changed files with 285 additions and 206 deletions

View File

@@ -81,7 +81,7 @@ namespace Content.Shared.Chemistry
/// </summary>
public bool Catalyst => _catalyst;
public void ExposeData(ObjectSerializer serializer)
void IExposeData.ExposeData(ObjectSerializer serializer)
{
serializer.DataField(ref _amount, "amount", ReagentUnit.New(1));
serializer.DataField(ref _catalyst, "catalyst", false);

View File

@@ -3,6 +3,7 @@ using System.Collections;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Robust.Shared.Analyzers;
using Robust.Shared.Interfaces.Serialization;
using Robust.Shared.IoC;
using Robust.Shared.Maths;
@@ -49,7 +50,7 @@ namespace Content.Shared.Chemistry
}
/// <inheritdoc />
public void ExposeData(ObjectSerializer serializer)
void IExposeData.ExposeData(ObjectSerializer serializer)
{
serializer.DataReadWriteFunction(
"reagents",

View File

@@ -3,6 +3,7 @@ using Content.Shared.GameObjects.Components;
using Content.Shared.Maps;
using JetBrains.Annotations;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Serialization;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
@@ -12,7 +13,7 @@ namespace Content.Shared.Construction.ConstructionConditions
[UsedImplicitly]
public class LowWallInTile : IConstructionCondition
{
public void ExposeData(ObjectSerializer serializer) { }
void IExposeData.ExposeData(ObjectSerializer serializer) { }
public bool Condition(IEntity user, EntityCoordinates location, Direction direction)
{

View File

@@ -3,6 +3,7 @@ using Content.Shared.GameObjects.Components;
using Content.Shared.Maps;
using JetBrains.Annotations;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Serialization;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
@@ -12,7 +13,7 @@ namespace Content.Shared.Construction.ConstructionConditions
[UsedImplicitly]
public class NoWindowsInTile : IConstructionCondition
{
public void ExposeData(ObjectSerializer serializer) { }
void IExposeData.ExposeData(ObjectSerializer serializer) { }
public bool Condition(IEntity user, EntityCoordinates location, Direction direction)
{

View File

@@ -1,6 +1,7 @@
using Content.Shared.Maps;
using JetBrains.Annotations;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Serialization;
using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
@@ -13,7 +14,7 @@ namespace Content.Shared.Construction.ConstructionConditions
private bool _filterMobs = false;
private bool _failIfSpace = true;
public void ExposeData(ObjectSerializer serializer)
void IExposeData.ExposeData(ObjectSerializer serializer)
{
serializer.DataField(ref _filterMobs, "filterMobs", false);
serializer.DataField(ref _failIfSpace, "failIfSpace", true);

View File

@@ -5,6 +5,7 @@ using Robust.Shared.Map;
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
using System.Collections.Generic;
using Robust.Shared.Interfaces.Serialization;
namespace Content.Shared.Construction.ConstructionConditions
{
@@ -13,7 +14,8 @@ namespace Content.Shared.Construction.ConstructionConditions
{
public List<string> TargetTiles { get; private set; }
public void ExposeData(ObjectSerializer serializer)
void IExposeData.ExposeData(ObjectSerializer serializer)
{
serializer.DataField(this, x => x.TargetTiles, "targets", null);
}

View File

@@ -31,7 +31,12 @@ namespace Content.Shared.Construction
[ViewVariables]
public IReadOnlyList<ConstructionGraphStep> Steps => _steps;
public void ExposeData(ObjectSerializer serializer)
void IExposeData.ExposeData(ObjectSerializer serializer)
{
InternalExposeData(serializer);
}
private void InternalExposeData(ObjectSerializer serializer)
{
var moduleManager = IoCManager.Resolve<IModuleManager>();
@@ -44,7 +49,7 @@ namespace Content.Shared.Construction
public void LoadFrom(YamlMappingNode mapping)
{
var serializer = YamlObjectSerializer.NewReader(mapping);
ExposeData(serializer);
InternalExposeData(serializer);
if (!mapping.TryGetNode("steps", out YamlSequenceNode stepsMapping)) return;

View File

@@ -80,7 +80,7 @@ namespace Content.Shared.GameObjects.Components.Buckle
return args.Target.HasComponent<SharedStrapComponent>();
}
public bool Drop(DragDropEventArgs args)
bool IDraggable.Drop(DragDropEventArgs args)
{
return TryBuckle(args.User, args.Target);
}

View File

@@ -468,7 +468,7 @@ namespace Content.Shared.GameObjects.Components.Damage
Dirty();
}
public void RadiationAct(float frameTime, SharedRadiationPulseComponent radiation)
void IRadiationAct.RadiationAct(float frameTime, SharedRadiationPulseComponent radiation)
{
var totalDamage = Math.Max((int)(frameTime * radiation.RadsPerSecond), 1);

View File

@@ -59,7 +59,7 @@ namespace Content.Shared.GameObjects.Components.Materials
public object Key;
public string Value;
public void ExposeData(ObjectSerializer serializer)
void IExposeData.ExposeData(ObjectSerializer serializer)
{
if (serializer.Writing)
{

View File

@@ -80,7 +80,7 @@ namespace Content.Shared.GameObjects.Components.Medical
}
public bool CanDragDropOn(DragDropEventArgs eventArgs)
bool IDragDropOn.CanDragDropOn(DragDropEventArgs eventArgs)
{
return eventArgs.Dragged.HasComponent<IBody>();
}

View File

@@ -181,7 +181,7 @@ namespace Content.Shared.GameObjects.Components.Mobs
GrantOrUpdate(actionType, toggleOn: toggleOn);
}
public void EquippedHand(EquippedHandEventArgs eventArgs)
void IEquippedHand.EquippedHand(EquippedHandEventArgs eventArgs)
{
// this entity cannot be granted actions if no actions component
if (!eventArgs.User.TryGetComponent<SharedActionsComponent>(out var actionsComponent))
@@ -193,7 +193,7 @@ namespace Content.Shared.GameObjects.Components.Mobs
GrantOrUpdateAllToHolder();
}
public void Equipped(EquippedEventArgs eventArgs)
void IEquipped.Equipped(EquippedEventArgs eventArgs)
{
// this entity cannot be granted actions if no actions component
if (!eventArgs.User.TryGetComponent<SharedActionsComponent>(out var actionsComponent))
@@ -205,7 +205,7 @@ namespace Content.Shared.GameObjects.Components.Mobs
GrantOrUpdateAllToHolder();
}
public void Unequipped(UnequippedEventArgs eventArgs)
void IUnequipped.Unequipped(UnequippedEventArgs eventArgs)
{
RevokeAllFromHolder();
Holder = null;
@@ -215,7 +215,7 @@ namespace Content.Shared.GameObjects.Components.Mobs
}
public void UnequippedHand(UnequippedHandEventArgs eventArgs)
void IUnequippedHand.UnequippedHand(UnequippedHandEventArgs eventArgs)
{
RevokeAllFromHolder();
Holder = null;
@@ -236,7 +236,7 @@ namespace Content.Shared.GameObjects.Components.Mobs
/// </summary>
public bool Enabled { get; private set; }
public void ExposeData(ObjectSerializer serializer)
void IExposeData.ExposeData(ObjectSerializer serializer)
{
serializer.DataField(this, x => x.ActionType, "actionType", ItemActionType.Error);
if (ActionType == ItemActionType.Error)

View File

@@ -106,7 +106,7 @@ namespace Content.Shared.GameObjects.Components.Sound
/// </summary>
public bool Play = true;
public void ExposeData(ObjectSerializer serializer)
void IExposeData.ExposeData(ObjectSerializer serializer)
{
if (serializer.Writing)
return;

View File

@@ -25,13 +25,13 @@ namespace Content.Shared.GameObjects.Components.Storage
/// <returns>True if no longer in storage, false otherwise</returns>
public abstract bool Remove(IEntity entity);
public bool CanDrop(CanDropEventArgs args)
bool IDraggable.CanDrop(CanDropEventArgs args)
{
return args.Target.TryGetComponent(out SharedPlaceableSurfaceComponent? placeable) &&
placeable.IsPlaceable;
}
public bool Drop(DragDropEventArgs eventArgs)
bool IDraggable.Drop(DragDropEventArgs eventArgs)
{
if (!ActionBlockerSystem.CanInteract(eventArgs.User))
{

View File

@@ -33,7 +33,7 @@ namespace Content.Shared.GameObjects.Components.Strap
public sealed override uint? NetID => ContentNetIDs.STRAP;
public virtual bool CanDragDropOn(DragDropEventArgs eventArgs)
bool IDragDropOn.CanDragDropOn(DragDropEventArgs eventArgs)
{
if (!eventArgs.Dragged.TryGetComponent(out SharedBuckleComponent buckleComponent)) return false;
bool Ignored(IEntity entity) => entity == eventArgs.User || entity == eventArgs.Dragged || entity == eventArgs.Target;

View File

@@ -93,7 +93,7 @@ namespace Content.Shared.Materials
}
}
public void ExposeData(ObjectSerializer serializer)
void IExposeData.ExposeData(ObjectSerializer serializer)
{
serializer.DataField(ref _name, "name", "unobtanium", alwaysWrite: true);
serializer.DataField(ref _color, "color", Color.Gray, alwaysWrite: true);
@@ -125,7 +125,7 @@ namespace Content.Shared.Materials
var ser = YamlObjectSerializer.NewReader(mapping);
Material = new Material();
Material.ExposeData(ser);
((IExposeData) Material).ExposeData(ser);
}
}
}