mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
Revert some grid/map related changes (#4809)
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Map;
|
||||
using Robust.Client.Physics;
|
||||
using Robust.Client.ResourceManagement;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
|
||||
namespace Robust.Client.GameObjects;
|
||||
|
||||
@@ -24,4 +27,9 @@ public sealed class MapSystem : SharedMapSystem
|
||||
base.Shutdown();
|
||||
_overlayManager.RemoveOverlay<TileEdgeOverlay>();
|
||||
}
|
||||
|
||||
protected override void OnMapAdd(EntityUid uid, MapComponent component, ComponentAdd args)
|
||||
{
|
||||
EnsureComp<PhysicsMapComponent>(uid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,6 +31,11 @@ namespace Robust.Server.GameObjects
|
||||
_cfg.OnValueChanged(CVars.GameDeleteEmptyGrids, SetGridDeletion, true);
|
||||
}
|
||||
|
||||
protected override void OnMapAdd(EntityUid uid, MapComponent component, ComponentAdd args)
|
||||
{
|
||||
EnsureComp<PhysicsMapComponent>(uid);
|
||||
}
|
||||
|
||||
private void SetGridDeletion(bool value)
|
||||
{
|
||||
_deleteEmptyGrids = value;
|
||||
|
||||
@@ -117,6 +117,7 @@ public sealed partial class EntityLookupSystem : EntitySystem
|
||||
|
||||
SubscribeLocalEvent<BroadphaseComponent, EntityTerminatingEvent>(OnBroadphaseTerminating);
|
||||
SubscribeLocalEvent<BroadphaseComponent, ComponentAdd>(OnBroadphaseAdd);
|
||||
SubscribeLocalEvent<GridAddEvent>(OnGridAdd);
|
||||
SubscribeLocalEvent<MapChangedEvent>(OnMapChange);
|
||||
|
||||
_transform.OnGlobalMoveEvent += OnMove;
|
||||
@@ -195,6 +196,12 @@ public sealed partial class EntityLookupSystem : EntitySystem
|
||||
}
|
||||
}
|
||||
|
||||
private void OnGridAdd(GridAddEvent ev)
|
||||
{
|
||||
// Must be done before initialization as that's when broadphase data starts getting set.
|
||||
EnsureComp<BroadphaseComponent>(ev.EntityUid);
|
||||
}
|
||||
|
||||
private void OnBroadphaseAdd(EntityUid uid, BroadphaseComponent component, ComponentAdd args)
|
||||
{
|
||||
component.StaticSundriesTree = new DynamicTree<EntityUid>(
|
||||
|
||||
@@ -10,6 +10,7 @@ public abstract partial class SharedMapSystem
|
||||
{
|
||||
private void InitializeMap()
|
||||
{
|
||||
SubscribeLocalEvent<MapComponent, ComponentAdd>(OnMapAdd);
|
||||
SubscribeLocalEvent<MapComponent, ComponentInit>(OnMapInit);
|
||||
SubscribeLocalEvent<MapComponent, ComponentShutdown>(OnMapRemoved);
|
||||
SubscribeLocalEvent<MapComponent, ComponentHandleState>(OnMapHandleState);
|
||||
@@ -42,6 +43,8 @@ public abstract partial class SharedMapSystem
|
||||
args.State = new MapComponentState(component.MapId, component.LightingEnabled, component.MapPaused);
|
||||
}
|
||||
|
||||
protected abstract void OnMapAdd(EntityUid uid, MapComponent component, ComponentAdd args);
|
||||
|
||||
private void OnMapInit(EntityUid uid, MapComponent component, ComponentInit args)
|
||||
{
|
||||
EnsureComp<GridTreeComponent>(uid);
|
||||
|
||||
@@ -4,8 +4,6 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Physics;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
// All the obsolete warnings about GridId are probably useless here.
|
||||
@@ -161,9 +159,6 @@ internal partial class MapManager
|
||||
|
||||
var grid = EntityManager.AddComponent<MapGridComponent>(gridEnt);
|
||||
grid.ChunkSize = chunkSize;
|
||||
EntityManager.AddComponent<PhysicsComponent>(gridEnt);
|
||||
EntityManager.AddComponent<FixturesComponent>(gridEnt);
|
||||
EntityManager.AddComponent<BroadphaseComponent>(gridEnt);
|
||||
|
||||
_sawmill.Debug($"Binding new grid {gridEnt}");
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Physics.Dynamics;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Robust.Shared.Map;
|
||||
@@ -234,7 +233,6 @@ internal partial class MapManager
|
||||
|
||||
var mapComp = EntityManager.AddComponent<MapComponent>(newEnt);
|
||||
mapComp.MapId = actualId;
|
||||
EntityManager.AddComponent<PhysicsMapComponent>(newEnt);
|
||||
var meta = EntityManager.GetComponent<MetaDataComponent>(newEnt);
|
||||
EntityManager.System<MetaDataSystem>().SetEntityName(newEnt, $"map {actualId}", meta);
|
||||
EntityManager.Dirty(newEnt, mapComp, meta);
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Physics.BroadPhase;
|
||||
|
||||
namespace Robust.Shared.Physics
|
||||
@@ -7,7 +6,7 @@ namespace Robust.Shared.Physics
|
||||
/// <summary>
|
||||
/// Stores the broadphase structure for the relevant grid / map.
|
||||
/// </summary>
|
||||
[RegisterComponent, NetworkedComponent]
|
||||
[RegisterComponent]
|
||||
public sealed partial class BroadphaseComponent : Component
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace Robust.Shared.Physics.Systems
|
||||
PhysMapQuery = GetEntityQuery<PhysicsMapComponent>();
|
||||
MapQuery = GetEntityQuery<MapComponent>();
|
||||
|
||||
SubscribeLocalEvent<GridInitializeEvent>(OnGridAdd);
|
||||
SubscribeLocalEvent<GridAddEvent>(OnGridAdd);
|
||||
SubscribeLocalEvent<CollisionChangeEvent>(OnCollisionChange);
|
||||
SubscribeLocalEvent<PhysicsComponent, EntGotRemovedFromContainerMessage>(HandleContainerRemoved);
|
||||
SubscribeLocalEvent<EntParentChangedMessage>(OnParentChange);
|
||||
@@ -231,7 +231,7 @@ namespace Robust.Shared.Physics.Systems
|
||||
}
|
||||
}
|
||||
|
||||
private void OnGridAdd(GridInitializeEvent ev)
|
||||
private void OnGridAdd(GridAddEvent ev)
|
||||
{
|
||||
var guid = ev.EntityUid;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user