diff --git a/Content.Client/_CP14/GodRays/CP14GodRaysSystem.cs b/Content.Client/_CP14/GodRays/CP14GodRaysSystem.cs new file mode 100644 index 0000000000..85471a641d --- /dev/null +++ b/Content.Client/_CP14/GodRays/CP14GodRaysSystem.cs @@ -0,0 +1,40 @@ +using Robust.Client.GameObjects; +using Robust.Shared.Map.Components; + +namespace Content.Client._CP14.GodRays; + +public sealed partial class CP14GodRaysSystem : EntitySystem +{ + [Dependency] private readonly SpriteSystem _sprite = default!; + [Dependency] private readonly PointLightSystem _pointLight = default!; + + private EntityQuery _mapLightQuery; + + public override void Initialize() + { + base.Initialize(); + + _mapLightQuery = GetEntityQuery(); + } + + public override void Update(float frameTime) + { + base.Update(frameTime); + + var spriteSync = EntityQueryEnumerator(); + while (spriteSync.MoveNext(out var uid, out _)) + { + if (!_mapLightQuery.TryComp(Transform(uid).MapUid, out var map)) + continue; + + //We calculate target color as map color, but transparency is based on map color brightness + var targetColor = Color.ToHsv(map.AmbientLightColor); + targetColor.W = targetColor.Z / 2; + + var finalColor = Color.FromHsv(targetColor); + + _sprite.SetColor(uid, finalColor); + _pointLight.SetColor(uid, finalColor); + } + } +} diff --git a/Content.Client/_CP14/GodRays/CP14SyncColorWithMapLightComponent.cs b/Content.Client/_CP14/GodRays/CP14SyncColorWithMapLightComponent.cs new file mode 100644 index 0000000000..a1b956c709 --- /dev/null +++ b/Content.Client/_CP14/GodRays/CP14SyncColorWithMapLightComponent.cs @@ -0,0 +1,11 @@ +using Robust.Shared.GameStates; + +namespace Content.Client._CP14.GodRays; + +/// +/// Sync PointLight color and Sprite color with map light color +/// +[RegisterComponent] +public sealed partial class CP14SyncColorWithMapLightComponent : Component +{ +} diff --git a/Content.Server/Entry/IgnoredComponents.cs b/Content.Server/Entry/IgnoredComponents.cs index 723982b82b..eb6793d411 100644 --- a/Content.Server/Entry/IgnoredComponents.cs +++ b/Content.Server/Entry/IgnoredComponents.cs @@ -4,7 +4,10 @@ namespace Content.Server.Entry public static class IgnoredComponents { public static string[] List => new[] { - "CP14WaveShader", // CP14 Wave shader + //CP14 start + "CP14SyncColorWithMapLight", + "CP14WaveShader", + //CP14 rnd "ConstructionGhost", "IconSmooth", "InteractionOutline", diff --git a/Content.Server/_CP14/Procedural/CP14SpawnProceduralLocationJob.cs b/Content.Server/_CP14/Procedural/CP14SpawnProceduralLocationJob.cs index 8d49f85601..fc167483a1 100644 --- a/Content.Server/_CP14/Procedural/CP14SpawnProceduralLocationJob.cs +++ b/Content.Server/_CP14/Procedural/CP14SpawnProceduralLocationJob.cs @@ -82,6 +82,9 @@ public sealed class CP14SpawnProceduralLocationJob( map.SetPaused(mapId, false); + //Add map components + entManager.AddComponents(MapUid, locationConfig.Components); + //Spawn modified config await WaitAsyncTask(dungeon.GenerateDungeonAsync(dungeonConfig, MapUid, @@ -89,9 +92,6 @@ public sealed class CP14SpawnProceduralLocationJob( position, seed)); - //Add map components - entManager.AddComponents(MapUid, locationConfig.Components); - return true; } } diff --git a/Content.Server/_CP14/Roof/CP14RoofSystem.cs b/Content.Server/_CP14/Roof/CP14RoofSystem.cs new file mode 100644 index 0000000000..6a5b697c8f --- /dev/null +++ b/Content.Server/_CP14/Roof/CP14RoofSystem.cs @@ -0,0 +1,55 @@ +using Content.Shared.Light.Components; +using Content.Shared.Light.EntitySystems; +using Robust.Shared.Map.Components; + +namespace Content.Server._CP14.Roof; + +/// +public sealed class CP14RoofSystem : EntitySystem +{ + [Dependency] private readonly SharedMapSystem _maps = default!; + [Dependency] private readonly SharedRoofSystem _roof = default!; + + + public override void Initialize() + { + base.Initialize(); + + SubscribeLocalEvent(OnRoofStartup); + SubscribeLocalEvent(OnRoofStartup); + SubscribeLocalEvent(OnTileChanged); + } + + private void OnTileChanged(Entity ent, ref TileChangedEvent args) + { + foreach (var changed in args.Changes) + { + if (changed.OldTile.IsEmpty) + _roof.SetRoof(ent.Owner, changed.GridIndices, true); + } + } + + private void OnRoofStartup(Entity ent, ref ComponentStartup args) + { + if (!TryComp(ent.Owner, out var gridComp)) + return; + + var enumerator = _maps.GetAllTilesEnumerator(ent, gridComp); + while (enumerator.MoveNext(out var tileRef)) + { + _roof.SetRoof(ent.Owner, tileRef.Value.GridIndices, true); + } + } + + private void OnRoofStartup(Entity ent, ref ComponentStartup args) + { + if (!TryComp(ent.Owner, out var gridComp)) + return; + + var enumerator = _maps.GetAllTilesEnumerator(ent, gridComp); + while (enumerator.MoveNext(out var tileRef)) + { + _roof.SetRoof(ent.Owner, tileRef.Value.GridIndices, false); + } + } +} diff --git a/Content.Server/_CP14/Roof/CP14SetGridRoovedComponent.cs b/Content.Server/_CP14/Roof/CP14SetGridRoovedComponent.cs new file mode 100644 index 0000000000..7c40457122 --- /dev/null +++ b/Content.Server/_CP14/Roof/CP14SetGridRoovedComponent.cs @@ -0,0 +1,17 @@ +namespace Content.Server._CP14.Roof; + +/// +/// When added, marks ALL tiles on grid as rooved +/// +[RegisterComponent] +public sealed partial class CP14SetGridRoovedComponent : Component +{ +} + +/// +/// When added, marks ALL tiles on grid as unrooved +/// +[RegisterComponent] +public sealed partial class CP14SetGridUnroovedComponent : Component +{ +} diff --git a/Content.Shared/CCVar/CCVars.Localization.cs b/Content.Shared/CCVar/CCVars.Localization.cs index 7cbee2ff3d..21b85f7c3e 100644 --- a/Content.Shared/CCVar/CCVars.Localization.cs +++ b/Content.Shared/CCVar/CCVars.Localization.cs @@ -8,5 +8,5 @@ public sealed partial class CCVars /// Language used for the in-game localization. /// public static readonly CVarDef Language = - CVarDef.Create("localization.language", "en-US", CVar.SERVER | CVar.REPLICATED); + CVarDef.Create("loc.server_language", "en-US", CVar.SERVER | CVar.REPLICATED); } diff --git a/Content.Shared/_CP14/Procedural/Prototypes/CP14ProceduralModifierPrototype.cs b/Content.Shared/_CP14/Procedural/Prototypes/CP14ProceduralModifierPrototype.cs index adbde1987e..91924fba7d 100644 --- a/Content.Shared/_CP14/Procedural/Prototypes/CP14ProceduralModifierPrototype.cs +++ b/Content.Shared/_CP14/Procedural/Prototypes/CP14ProceduralModifierPrototype.cs @@ -43,7 +43,7 @@ public sealed partial class CP14ProceduralModifierPrototype : IPrototype /// Can this modifier be generated multiple times within a single location? /// [DataField] - public bool Unique = false; + public bool Unique = true; /// /// Generation layers that will be added to the location generation after the main layers. diff --git a/Resources/ConfigPresets/_CP14/Dev.toml b/Resources/ConfigPresets/_CP14/Dev.toml index d4b4edcd2f..38528fd645 100644 --- a/Resources/ConfigPresets/_CP14/Dev.toml +++ b/Resources/ConfigPresets/_CP14/Dev.toml @@ -1,8 +1,8 @@ [whitelist] enabled = true -[localization] -language = "en-US" +[loc] +server_language = "en-US" [log] path = "logs" diff --git a/Resources/Prototypes/_CP14/Entities/Effects/god_rays.yml b/Resources/Prototypes/_CP14/Entities/Effects/god_rays.yml new file mode 100644 index 0000000000..c91ff647bc --- /dev/null +++ b/Resources/Prototypes/_CP14/Entities/Effects/god_rays.yml @@ -0,0 +1,32 @@ +- type: entity + id: CP14GodRays + categories: [ ForkFiltered ] + name: god rays + components: + - type: Sprite + sprite: _CP14/Effects/god_rays.rsi + drawdepth: Mobs + noRot: true + offset: -0.25, 1.5 + layers: + - state: ray + shader: unshaded + - type: CP14SyncColorWithMapLight + - type: PointLight + enabled: true + energy: 1 + radius: 5 + netsync: true + - type: LightBehaviour + behaviours: + - !type:PulseBehaviour + interpolate: Cubic + maxDuration: 14 + startValue: 0.5 + endValue: 1.0 + property: Energy + isLooped: true + enabled: true + - type: Tag + tags: + - HideContextMenu \ No newline at end of file diff --git a/Resources/Prototypes/_CP14/Entities/Markers/roof.yml b/Resources/Prototypes/_CP14/Entities/Markers/roof.yml new file mode 100644 index 0000000000..8d6ba62f19 --- /dev/null +++ b/Resources/Prototypes/_CP14/Entities/Markers/roof.yml @@ -0,0 +1,37 @@ +- type: entity + id: CP14RoofMarker + name: Roof enable Marker + categories: [ ForkFiltered ] + parent: MarkerBase + components: + - type: SetRoof + value: true + - type: Sprite + layers: + - state: green + shader: unshaded + +- type: entity + id: CP14NoRoofMarker + name: Roof disable Marker + categories: [ ForkFiltered ] + parent: MarkerBase + components: + - type: SetRoof + value: false + - type: Sprite + layers: + - state: red + shader: unshaded + +- type: entity + parent: CP14NoRoofMarker + id: CP14NoRoofMarkerGodRays + suffix: God Rays (5%) + components: + - type: RandomSpawner + prototypes: + - CP14GodRays + chance: 0.05 + deleteSpawnerAfterSpawn: false + \ No newline at end of file diff --git a/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/cave.yml b/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/cave.yml index fd76b97a13..8c98efb5c8 100644 --- a/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/cave.yml +++ b/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/cave.yml @@ -5,7 +5,7 @@ sprite: _CP14/Interface/Misc/demiplane_locations.rsi state: caves levels: - min: 1 + min: 0 max: 2 locationConfig: CP14Caves tags: @@ -14,6 +14,12 @@ components: - type: Biome template: CP14CavesIndestructibleFill + - type: Roof + - type: CP14SetGridRooved + - type: SunShadow + - type: SunShadowCycle + - type: MapLight + ambientLightColor: "#BFEEFFFF" - type: dungeonConfig id: CP14Caves diff --git a/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/cave_ice.yml b/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/cave_ice.yml index 67124b6ad1..a7acac6463 100644 --- a/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/cave_ice.yml +++ b/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/cave_ice.yml @@ -15,6 +15,12 @@ components: - type: Biome template: CP14IceChasmFill + - type: Roof + - type: CP14SetGridRooved + - type: SunShadow + - type: SunShadowCycle + - type: MapLight + ambientLightColor: "#BFEEFFFF" - type: dungeonConfig id: CP14IceCaves diff --git a/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/cave_magma.yml b/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/cave_magma.yml index 6ca710cc6d..9869ededfb 100644 --- a/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/cave_magma.yml +++ b/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/cave_magma.yml @@ -15,6 +15,12 @@ components: - type: Biome template: CP14LavaOceanFill + - type: Roof + - type: CP14SetGridRooved + - type: SunShadow + - type: SunShadowCycle + - type: MapLight + ambientLightColor: "#BFEEFFFF" - type: dungeonConfig id: CP14MagmaCaves diff --git a/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/cave_mushroom.yml b/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/cave_mushroom.yml index cb44e99b88..d9bed924d1 100644 --- a/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/cave_mushroom.yml +++ b/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/cave_mushroom.yml @@ -15,6 +15,12 @@ components: - type: Biome template: CP14ChasmFill + - type: Roof + - type: CP14SetGridRooved + - type: SunShadow + - type: SunShadowCycle + - type: MapLight + ambientLightColor: "#BFEEFFFF" - type: dungeonConfig id: CP14MushroomCaves diff --git a/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/cave_swamp.yml b/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/cave_swamp.yml index 743d9a02c5..0499368e48 100644 --- a/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/cave_swamp.yml +++ b/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/cave_swamp.yml @@ -17,6 +17,12 @@ components: - type: Biome template: CP14CavesIndestructibleFill + - type: Roof + - type: CP14SetGridRooved + - type: SunShadow + - type: SunShadowCycle + - type: MapLight + ambientLightColor: "#BFEEFFFF" - type: dungeonConfig id: CP14SwampGeode diff --git a/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/island_grassland.yml b/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/island_grassland.yml index e787761403..2832890b2b 100644 --- a/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/island_grassland.yml +++ b/Resources/Prototypes/_CP14/Procedural/Demiplane/Locations/island_grassland.yml @@ -14,14 +14,14 @@ - CP14DemiplaneOpenSky - CP14DemiplanePeacefulAnimals components: + - type: Biome + template: CP14SandOceanFill + - type: Roof + - type: SunShadow + - type: SunShadowCycle - type: MapLight ambientLightColor: "#BFEEFFFF" - type: CP14CloudShadows - - type: Biome - template: CP14SandOceanFill - - type: SunShadow - - type: SunShadowCycle - - type: Roof - type: dungeonConfig id: CP14GrasslandIsland diff --git a/Resources/Prototypes/_CP14/Procedural/Demiplane/Modifiers/MapLight/mapLight.yml b/Resources/Prototypes/_CP14/Procedural/Demiplane/Modifiers/MapLight/mapLight.yml index 66ac4e2c39..d43be597ca 100644 --- a/Resources/Prototypes/_CP14/Procedural/Demiplane/Modifiers/MapLight/mapLight.yml +++ b/Resources/Prototypes/_CP14/Procedural/Demiplane/Modifiers/MapLight/mapLight.yml @@ -11,42 +11,6 @@ - type: MapLight ambientLightColor: "#000000" -- type: cp14LocationModifier - id: MapLightDarkRed - levels: - min: 3 - max: 10 - categories: - MapLight: 1 - name: cp14-modifier-night - components: - - type: MapLight - ambientLightColor: "#0f0104" - -- type: cp14LocationModifier - id: MapLightDarkPurple - levels: - min: 1 - max: 10 - categories: - MapLight: 1 - name: cp14-modifier-night - components: - - type: MapLight - ambientLightColor: "#09010f" - -- type: cp14LocationModifier - id: MapLightDarkGreen - levels: - min: 1 - max: 10 - categories: - MapLight: 1 - name: cp14-modifier-night - components: - - type: MapLight - ambientLightColor: "#000502" - - type: cp14LocationModifier id: MapLightDarkNight levels: @@ -69,8 +33,6 @@ categories: MapLight: 1 generationWeight: 2 - requiredTags: - - CP14DemiplaneOpenSky components: - type: LightCycle @@ -83,7 +45,6 @@ MapLight: 1 generationWeight: 2 requiredTags: - - CP14DemiplaneOpenSky - CP14DemiplaneCold components: - type: LightCycle @@ -99,7 +60,6 @@ categories: MapLight: 1 requiredTags: - - CP14DemiplaneOpenSky - CP14DemiplaneHot components: - type: LightCycle @@ -115,7 +75,6 @@ categories: MapLight: 1 requiredTags: - - CP14DemiplaneOpenSky - CP14DemiplaneHot components: - type: LightCycle @@ -123,3 +82,19 @@ - type: MapLight ambientLightColor: "#d68787" +- type: cp14LocationModifier + id: CavesRoofHoles + levels: + min: 0 + max: 10 + generationProb: 0.8 + categories: + MapLight: 0 + requiredTags: + - CP14DemiplaneUnderground + layers: + - !type:CP14OreDunGen + entity: CP14NoRoofMarkerGodRays + count: 15 + minGroupSize: 10 + maxGroupSize: 30 diff --git a/Resources/Prototypes/_CP14/Procedural/Demiplane/Modifiers/Weather/weather.yml b/Resources/Prototypes/_CP14/Procedural/Demiplane/Modifiers/Weather/weather.yml index b5d0f709f9..e09b090497 100644 --- a/Resources/Prototypes/_CP14/Procedural/Demiplane/Modifiers/Weather/weather.yml +++ b/Resources/Prototypes/_CP14/Procedural/Demiplane/Modifiers/Weather/weather.yml @@ -14,6 +14,8 @@ max: 10 categories: Weather: 1 + requiredTags: + - CP14DemiplaneOpenSky components: - type: CP14WeatherController entries: @@ -26,8 +28,6 @@ max: 10 categories: Weather: 1 - requiredTags: - - CP14DemiplaneOpenSky components: - type: CP14WeatherController entries: @@ -48,8 +48,6 @@ name: cp14-modifier-storm categories: Weather: 1 - requiredTags: - - CP14DemiplaneOpenSky components: - type: CP14WeatherController entries: @@ -124,6 +122,8 @@ - type: CP14WeatherController entries: - visuals: CP14ManaMist + requiredTags: + - CP14DemiplaneOpenSky layers: - !type:CP14RoomsDunGen count: 8 @@ -142,6 +142,8 @@ - type: CP14WeatherController entries: - visuals: CP14AntiManaMist + requiredTags: + - CP14DemiplaneOpenSky layers: - !type:CP14RoomsDunGen count: 8 @@ -156,6 +158,7 @@ max: 10 requiredTags: - CP14DemiplaneHot + - CP14DemiplaneOpenSky categories: Weather: 1 components: diff --git a/Resources/Prototypes/_CP14/Species/skin_colorations.yml b/Resources/Prototypes/_CP14/Species/skin_colorations.yml index bdd4ea56d4..9a133540ea 100644 --- a/Resources/Prototypes/_CP14/Species/skin_colorations.yml +++ b/Resources/Prototypes/_CP14/Species/skin_colorations.yml @@ -20,5 +20,5 @@ id: CP14CarcatHues strategy: !type:ClampedHsvColoration hue: [0.05, 0.10] - saturation: [0.15, 0.35] + saturation: [0.15, 0.7] value: [0.25, 0.95] \ No newline at end of file diff --git a/Resources/Textures/_CP14/Effects/god_rays.rsi/meta.json b/Resources/Textures/_CP14/Effects/god_rays.rsi/meta.json new file mode 100644 index 0000000000..a512e25f84 --- /dev/null +++ b/Resources/Textures/_CP14/Effects/god_rays.rsi/meta.json @@ -0,0 +1,95 @@ +{ + "version": 1, + "size": { + "x": 58, + "y": 100 + }, + "license": "CC-BY-SA-3.0", + "copyright": "Created by TheShuEd", + "states": [ + { + "name": "ray", + "delays": [ + [ + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 0.12, + 5.12 + ] + ] + } + ] +} \ No newline at end of file diff --git a/Resources/Textures/_CP14/Effects/god_rays.rsi/ray.png b/Resources/Textures/_CP14/Effects/god_rays.rsi/ray.png new file mode 100644 index 0000000000..b7705902a7 Binary files /dev/null and b/Resources/Textures/_CP14/Effects/god_rays.rsi/ray.png differ