Procgen biomes (#13487)
* Planetmap tiles Biomes etc etc * a * oop * Chunk-based rendering * funny * Less allocations * Fix overdraw * Content tile edge support Also updated grass to use it as a POC. * Kindly revert * Update for variant edges * fixes * Use fastnoise * Remove redundant group * a * refactor a fair bit * Prototype data instead * tweaks * a * fix maths * working * a * Slightly better empty support * a * flowers * sounds * lewd * Networking * more fixes * better * colours * Some chunk loading * Proper loading and unloading * Better loading * Fix parallax and movement sounds * Anchoring support + decal setup * Most of the way to load and unload * Decal loading kinda werkin * large trees * started diffing * a * Variant support and deserts * a * snow * agony, even * working again * todo * a * laba tiles * aeiou * a # Conflicts: # Resources/Prototypes/Entities/Tiles/planet.yml # Resources/Prototypes/Tiles/planet.yml # Resources/Textures/Tiles/Planet/Lava/lava.rsi/meta.json * laba * Add lava * Initial ignition * triggers * a * a * y * Add basalt tiles Did some unconventional things for the animation + rocks. * fixies * mergies * promotion * lava biome * Lava planet start * cleanup and more lava * laba * maccas * biome stuf * weh * bongflicts * aeaeae * More fixes * a * these too
This commit is contained in:
@@ -6,11 +6,13 @@ using Content.Shared.Administration;
|
||||
using Content.Shared.Atmos;
|
||||
using Content.Shared.Gravity;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Parallax;
|
||||
using Content.Shared.Parallax.Biomes;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Console;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.Maps;
|
||||
|
||||
@@ -22,13 +24,15 @@ public sealed class PlanetCommand : IConsoleCommand
|
||||
{
|
||||
[Dependency] private readonly IEntityManager _entManager = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly IPrototypeManager _protoManager = default!;
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
|
||||
public string Command => $"planet";
|
||||
public string Description => Loc.GetString("cmd-planet-desc");
|
||||
public string Help => Loc.GetString("cmd-planet-help", ("command", Command));
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
if (args.Length != 2)
|
||||
{
|
||||
shell.WriteError(Loc.GetString($"cmd-planet-args"));
|
||||
return;
|
||||
@@ -48,16 +52,35 @@ public sealed class PlanetCommand : IConsoleCommand
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_protoManager.HasIndex<BiomePrototype>(args[1]))
|
||||
{
|
||||
shell.WriteError(Loc.GetString("cmd-planet-map-prototype", ("prototype", args[1])));
|
||||
return;
|
||||
}
|
||||
|
||||
var mapUid = _mapManager.GetMapEntityId(mapId);
|
||||
MetaDataComponent? metadata = null;
|
||||
|
||||
var parallax = _entManager.EnsureComponent<ParallaxComponent>(mapUid);
|
||||
parallax.Parallax = "Grass";
|
||||
_entManager.Dirty(parallax, metadata);
|
||||
var biome = _entManager.EnsureComponent<BiomeComponent>(mapUid);
|
||||
biome.BiomePrototype = args[1];
|
||||
biome.Seed = _random.Next();
|
||||
_entManager.Dirty(biome);
|
||||
|
||||
var gravity = _entManager.EnsureComponent<GravityComponent>(mapUid);
|
||||
gravity.Enabled = true;
|
||||
_entManager.Dirty(gravity);
|
||||
_entManager.EnsureComponent<MapLightComponent>(mapUid);
|
||||
_entManager.Dirty(gravity, metadata);
|
||||
|
||||
// Day lighting
|
||||
// Daylight: #D8B059
|
||||
// Midday: #E6CB8B
|
||||
// Moonlight: #2b3143
|
||||
// Lava: #A34931
|
||||
|
||||
var light = _entManager.EnsureComponent<MapLightComponent>(mapUid);
|
||||
light.AmbientLightColor = Color.FromHex("#D8B059");
|
||||
_entManager.Dirty(light, metadata);
|
||||
|
||||
// Atmos
|
||||
var atmos = _entManager.EnsureComponent<MapAtmosphereComponent>(mapUid);
|
||||
|
||||
atmos.Space = false;
|
||||
@@ -71,24 +94,27 @@ public sealed class PlanetCommand : IConsoleCommand
|
||||
Moles = moles,
|
||||
};
|
||||
|
||||
var footstep = _entManager.EnsureComponent<FootstepModifierComponent>(mapUid);
|
||||
footstep.Sound = new SoundCollectionSpecifier("FootstepGrass");
|
||||
_entManager.Dirty(footstep);
|
||||
|
||||
_entManager.EnsureComponent<MapGridComponent>(mapUid);
|
||||
shell.WriteLine(Loc.GetString("cmd-planet-success", ("mapId", mapId)));
|
||||
}
|
||||
|
||||
public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
|
||||
{
|
||||
if (args.Length != 1)
|
||||
if (args.Length == 1)
|
||||
{
|
||||
return CompletionResult.Empty;
|
||||
var options = _entManager.EntityQuery<MapComponent>(true)
|
||||
.Select(o => new CompletionOption(o.WorldMap.ToString(), "MapId"));
|
||||
|
||||
return CompletionResult.FromOptions(options);
|
||||
}
|
||||
|
||||
var options = _entManager.EntityQuery<MapComponent>(true)
|
||||
.Select(o => new CompletionOption(o.WorldMap.ToString(), "MapId"));
|
||||
if (args.Length == 2)
|
||||
{
|
||||
var options = _protoManager.EnumeratePrototypes<BiomePrototype>()
|
||||
.Select(o => new CompletionOption(o.ID, "Biome"));
|
||||
return CompletionResult.FromOptions(options);
|
||||
}
|
||||
|
||||
return CompletionResult.FromOptions(options);
|
||||
return CompletionResult.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user