mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
Alternative SpriteComponent.CopyFrom() fix (#3705)
This commit is contained in:
@@ -304,11 +304,8 @@ namespace Robust.Client.GameObjects
|
||||
|
||||
void ISerializationHooks.AfterDeserialization()
|
||||
{
|
||||
// Please somebody burn this to the ground
|
||||
// Fix prototype reload trying to update tree on deserialization dummy instances.
|
||||
if (!Owner.IsValid())
|
||||
return;
|
||||
|
||||
// Please somebody burn this to the ground. There is so much spaghetti.
|
||||
|
||||
IoCManager.InjectDependencies(this);
|
||||
|
||||
{
|
||||
@@ -1404,7 +1401,7 @@ namespace Robust.Client.GameObjects
|
||||
|
||||
private void QueueUpdateRenderTree()
|
||||
{
|
||||
if (TreeUpdateQueued || entities?.EventBus == null)
|
||||
if (TreeUpdateQueued || !Owner.IsValid())
|
||||
return;
|
||||
|
||||
// TODO whenever sprite comp gets ECS'd , just make this a direct method call.
|
||||
@@ -1414,7 +1411,7 @@ namespace Robust.Client.GameObjects
|
||||
|
||||
private void QueueUpdateIsInert()
|
||||
{
|
||||
if (_inertUpdateQueued || entities?.EventBus == null)
|
||||
if (_inertUpdateQueued || !Owner.IsValid())
|
||||
return;
|
||||
|
||||
// TODO whenever sprite comp gets ECS'd , just make this a direct method call.
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.ComponentTrees;
|
||||
@@ -21,7 +20,6 @@ namespace Robust.Client.GameObjects
|
||||
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||
[Dependency] private readonly SpriteTreeSystem _treeSystem = default!;
|
||||
[Dependency] private readonly TransformSystem _transform = default!;
|
||||
|
||||
private readonly Queue<SpriteComponent> _inertUpdateQueue = new();
|
||||
private HashSet<SpriteComponent> _manualUpdate = new();
|
||||
@@ -34,9 +32,16 @@ namespace Robust.Client.GameObjects
|
||||
|
||||
_proto.PrototypesReloaded += OnPrototypesReloaded;
|
||||
SubscribeLocalEvent<SpriteComponent, SpriteUpdateInertEvent>(QueueUpdateInert);
|
||||
SubscribeLocalEvent<SpriteComponent, ComponentInit>(OnInit);
|
||||
_cfg.OnValueChanged(CVars.RenderSpriteDirectionBias, OnBiasChanged, true);
|
||||
}
|
||||
|
||||
private void OnInit(EntityUid uid, SpriteComponent component, ComponentInit args)
|
||||
{
|
||||
// I'm not 100% this is needed, but I CBF with this ATM. Somebody kill server sprite component please.
|
||||
QueueUpdateInert(uid, component);
|
||||
}
|
||||
|
||||
public override void Shutdown()
|
||||
{
|
||||
base.Shutdown();
|
||||
@@ -50,6 +55,9 @@ namespace Robust.Client.GameObjects
|
||||
}
|
||||
|
||||
private void QueueUpdateInert(EntityUid uid, SpriteComponent sprite, ref SpriteUpdateInertEvent ev)
|
||||
=> QueueUpdateInert(uid, sprite);
|
||||
|
||||
public void QueueUpdateInert(EntityUid uid, SpriteComponent sprite)
|
||||
{
|
||||
if (sprite._inertUpdateQueued)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user