Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return to new appearances being events #2184

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions OpenDreamClient/EntryPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using OpenDreamClient.States;
using OpenDreamShared;
using OpenDreamShared.Network.Messages;
using Robust.Client;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Map;
Expand Down Expand Up @@ -85,7 +86,6 @@
IoCManager.Resolve<IDreamSoundEngine>().Initialize();

_netManager.RegisterNetMessage<MsgAllAppearances>(RxAllAppearances);
_netManager.RegisterNetMessage<MsgNewAppearance>(RxNewAppearance);

if (_configurationManager.GetCVar(CVars.DisplayCompat))
_dreamInterface.OpenAlert(
Expand Down Expand Up @@ -113,15 +113,6 @@
clientAppearanceSystem.SetAllAppearances(message.AllAppearances);
}

private void RxNewAppearance(MsgNewAppearance message) {
if (!_entitySystemManager.TryGetEntitySystem<ClientAppearanceSystem>(out var clientAppearanceSystem)) {
Logger.GetSawmill("opendream").Error("Received MsgNewAppearance before initializing entity systems");
return;
}

clientAppearanceSystem.OnNewAppearance(message);
}

// As of RobustToolbox v0.90.0.0 there's a TileEdgeOverlay that breaks our rendering
// because we don't have an ITileDefinition for each tile.
// This removes that overlay immediately after MapSystem adds it.
Expand Down
2 changes: 1 addition & 1 deletion OpenDreamClient/Interface/DummyDreamInterfaceManager.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using OpenDreamClient.Interface.Controls;
using OpenDreamClient.Interface.Descriptors;
using OpenDreamShared.Dream;
using OpenDreamShared.Network.Messages;
using Robust.Shared.Network;
Expand All @@ -20,6 +19,7 @@ public sealed class DummyDreamInterfaceManager : IDreamInterfaceManager {
public ControlMap? DefaultMap => null;
public ViewRange View => new(5);
public bool ShowPopupMenus => true;

[Dependency] private readonly IClientNetManager _netManager = default!;

public void Initialize() {
Expand Down
4 changes: 2 additions & 2 deletions OpenDreamClient/Rendering/ClientAppearanceSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using OpenDreamClient.Resources;
using OpenDreamClient.Resources.ResourceTypes;
using Robust.Shared.Timing;
using OpenDreamShared.Network.Messages;

namespace OpenDreamClient.Rendering;

Expand All @@ -25,6 +24,7 @@ internal sealed class ClientAppearanceSystem : SharedAppearanceSystem {
[Dependency] private readonly DMISpriteSystem _spriteSystem = default!;

public override void Initialize() {
SubscribeNetworkEvent<NewAppearanceEvent>(OnNewAppearance);
SubscribeNetworkEvent<RemoveAppearanceEvent>(e => _appearances.Remove(e.AppearanceId));
SubscribeNetworkEvent<AnimationEvent>(OnAnimation);
SubscribeLocalEvent<DMISpriteComponent, WorldAABBEvent>(OnWorldAABB);
Expand Down Expand Up @@ -75,7 +75,7 @@ public DreamIcon GetTurfIcon(uint turfId) {
return icon;
}

public void OnNewAppearance(MsgNewAppearance e) {
public void OnNewAppearance(NewAppearanceEvent e) {
uint appearanceId = e.Appearance.MustGetId();
_appearances[appearanceId] = e.Appearance;

Expand Down
1 change: 0 additions & 1 deletion OpenDreamRuntime/DreamManager.Connections.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ private void InitializeConnectionManager() {
_netManager.RegisterNetMessage<MsgSound>();
_netManager.RegisterNetMessage<MsgUpdateClientInfo>();
_netManager.RegisterNetMessage<MsgAllAppearances>();
_netManager.RegisterNetMessage<MsgNewAppearance>();

var topicPort = _config.GetCVar(OpenDreamCVars.TopicPort);
var worldTopicAddress = new IPEndPoint(IPAddress.Loopback, topicPort);
Expand Down
3 changes: 2 additions & 1 deletion OpenDreamRuntime/Rendering/ServerAppearanceSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ private void RegisterAppearance(ImmutableAppearance immutableAppearance) {
ProxyWeakRef proxyWeakRef = new(immutableAppearance);
_appearanceLookup.Add(proxyWeakRef);
_idToAppearance.Add(immutableAppearance.MustGetId(), proxyWeakRef);
_networkManager.ServerSendToAll(new MsgNewAppearance(immutableAppearance));

RaiseNetworkEvent(new NewAppearanceEvent(immutableAppearance));
}

public ImmutableAppearance AddAppearance(MutableAppearance appearance, bool registerAppearance = true) {
Expand Down
22 changes: 0 additions & 22 deletions OpenDreamShared/Network/Messages/MsgNewAppearance.cs

This file was deleted.

5 changes: 2 additions & 3 deletions OpenDreamShared/Rendering/SharedAppearanceSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ public abstract class SharedAppearanceSystem : EntitySystem {
public abstract void RemoveAppearance(ImmutableAppearance appearance);

[Serializable, NetSerializable]
public sealed class NewAppearanceEvent(uint appearanceId, MutableAppearance appearance) : EntityEventArgs {
public uint AppearanceId { get; } = appearanceId;
public MutableAppearance Appearance { get; } = appearance;
public sealed class NewAppearanceEvent(ImmutableAppearance appearance) : EntityEventArgs {
public ImmutableAppearance Appearance { get; } = appearance;
}

[Serializable, NetSerializable]
Expand Down
Loading