Files
tbd-station-14/Content.Shared/Maps/ContentTileDefinition.cs
metalgearsloth b6ee183dc6 Add planet lighting (#32522)
* Implements a Dynamic Lighting System on maps.

* Edit: the night should be a little bit brighter and blue now.

* Major edit: everything must be done on the client side now, with certain datafield replicated.
Changes were outlined in the salvage to accommodate the new lighting system.

* Edit: The offset is now serverside, this makes the time accurate in all situations.

* Removing ununsed import

* Minor tweaks

* Tweak in time precision

* Minor tweak + Unused import removed

* Edit: apparently RealTime is better for what I'm looking for

* Fix: Now the time is calculated correctly.

* Minor tweaks

* Adds condition for when the light should be updated

* Add planet lighting

* she

* close-ish

* c

* bittersweat

* Fixes

* Revert "Merge branch '22719' into 2024-09-29-planet-lighting"

This reverts commit 9f2785bb16aee47d794aa3eed8ae15004f97fc35, reversing
changes made to 19649c07a5fb625423e08fc18d91c9cb101daa86.

* Europa and day-night

* weh

* rooves working

* Clean

* Remove Europa

* Fixes

* fix

* Update

* Fix caves

* Update for engine

* Add sun shadows (planet lighting v2)

For now mostly targeting walls and having the shadows change over time. Got the basic proof-of-concept working just needs a hell of a lot of polish.

* Documentation

* a

* Fixes

* Move blur to an overlay

* Slughands

* Fixes

* Remove v2 work

* Finalise

---------

Co-authored-by: DoutorWhite <thedoctorwhite@gmail.com>
2025-02-16 19:35:32 +11:00

131 lines
4.7 KiB
C#

using Content.Shared.Atmos;
using Content.Shared.Light.Components;
using Content.Shared.Movement.Systems;
using Content.Shared.Tools;
using Robust.Shared.Audio;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Array;
using Robust.Shared.Utility;
namespace Content.Shared.Maps
{
[Prototype("tile")]
public sealed partial class ContentTileDefinition : IPrototype, IInheritingPrototype, ITileDefinition
{
[ValidatePrototypeId<ToolQualityPrototype>]
public const string PryingToolQuality = "Prying";
public const string SpaceID = "Space";
[ParentDataFieldAttribute(typeof(AbstractPrototypeIdArraySerializer<ContentTileDefinition>))]
public string[]? Parents { get; private set; }
[NeverPushInheritance]
[AbstractDataFieldAttribute]
public bool Abstract { get; private set; }
[IdDataField] public string ID { get; } = string.Empty;
public ushort TileId { get; private set; }
[DataField("name")]
public string Name { get; private set; } = "";
[DataField("sprite")] public ResPath? Sprite { get; private set; }
[DataField("edgeSprites")] public Dictionary<Direction, ResPath> EdgeSprites { get; private set; } = new();
[DataField("edgeSpritePriority")] public int EdgeSpritePriority { get; private set; } = 0;
[DataField("isSubfloor")] public bool IsSubFloor { get; private set; }
[DataField("baseTurf")]
public string BaseTurf { get; private set; } = string.Empty;
[DataField]
public PrototypeFlags<ToolQualityPrototype> DeconstructTools { get; set; } = new();
/// <remarks>
/// Legacy AF but nice to have.
/// </remarks>
public bool CanCrowbar => DeconstructTools.Contains(PryingToolQuality);
/// <summary>
/// These play when the mob has shoes on.
/// </summary>
[DataField("footstepSounds")] public SoundSpecifier? FootstepSounds { get; private set; }
/// <summary>
/// These play when the mob has no shoes on.
/// </summary>
[DataField("barestepSounds")] public SoundSpecifier? BarestepSounds { get; private set; } = new SoundCollectionSpecifier("BarestepHard");
[DataField("friction")] public float Friction { get; set; } = 0.2f;
[DataField("variants")] public byte Variants { get; set; } = 1;
/// <summary>
/// This controls what variants the `variantize` command is allowed to use.
/// </summary>
[DataField("placementVariants")] public float[] PlacementVariants { get; set; } = { 1f };
[DataField("thermalConductivity")] public float ThermalConductivity = 0.04f;
// Heat capacity is opt-in, not opt-out.
[DataField("heatCapacity")] public float HeatCapacity = Atmospherics.MinimumHeatCapacity;
[DataField("itemDrop", customTypeSerializer:typeof(PrototypeIdSerializer<EntityPrototype>))]
public string ItemDropPrototypeName { get; private set; } = "FloorTileItemSteel";
// TODO rename data-field in yaml
/// <summary>
/// Whether or not the tile is exposed to the map's atmosphere.
/// </summary>
[DataField("isSpace")] public bool MapAtmosphere { get; private set; }
/// <summary>
/// Friction override for mob mover in <see cref="SharedMoverController"/>
/// </summary>
[DataField("mobFriction")]
public float? MobFriction { get; private set; }
/// <summary>
/// No-input friction override for mob mover in <see cref="SharedMoverController"/>
/// </summary>
[DataField("mobFrictionNoInput")]
public float? MobFrictionNoInput { get; private set; }
/// <summary>
/// Accel override for mob mover in <see cref="SharedMoverController"/>
/// </summary>
[DataField("mobAcceleration")]
public float? MobAcceleration { get; private set; }
[DataField("sturdy")] public bool Sturdy { get; private set; } = true;
/// <summary>
/// Can weather affect this tile.
/// </summary>
[DataField("weather")] public bool Weather = false;
/// <summary>
/// Is this tile immune to RCD deconstruct.
/// </summary>
[DataField("indestructible")] public bool Indestructible = false;
public void AssignTileId(ushort id)
{
TileId = id;
}
}
[Flags]
public enum TileFlag : byte
{
None = 0,
Roof = 1 << 0,
}
}