explicit interface go brrrr
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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>();
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user