mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-09-06 17:58:05 +02:00
Remove IMap / IMapGrid comps (#3434)
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using Robust.Shared.GameStates;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Robust.Shared.GameObjects;
|
||||
|
||||
public abstract partial class SharedMapSystem
|
||||
{
|
||||
public void SetAmbientLight(MapId mapId, Color color)
|
||||
{
|
||||
var mapComp = EnsureComp<MapLightComponent>(MapManager.GetMapEntityId(mapId));
|
||||
|
||||
if (mapComp.AmbientLightColor.Equals(color))
|
||||
return;
|
||||
|
||||
mapComp.AmbientLightColor = color;
|
||||
Dirty(mapComp);
|
||||
}
|
||||
|
||||
private void OnMapLightGetState(EntityUid uid, MapLightComponent component, ref ComponentGetState args)
|
||||
{
|
||||
args.State = new MapLightComponentState()
|
||||
{
|
||||
AmbientLightColor = component.AmbientLightColor,
|
||||
};
|
||||
}
|
||||
|
||||
private void OnMapLightHandleState(EntityUid uid, MapLightComponent component, ref ComponentHandleState args)
|
||||
{
|
||||
if (args.Current is not MapLightComponentState state)
|
||||
return;
|
||||
|
||||
component.AmbientLightColor = state.AmbientLightColor;
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
private sealed class MapLightComponentState : ComponentState
|
||||
{
|
||||
public Color AmbientLightColor;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user