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:
@@ -17,6 +17,10 @@ using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Mech.Components;
|
||||
using Content.Shared.Parallax.Biomes;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Noise;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
|
||||
@@ -32,6 +36,7 @@ namespace Content.Shared.Movement.Systems
|
||||
[Dependency] protected readonly IGameTiming Timing = default!;
|
||||
[Dependency] private readonly IMapManager _mapManager = default!;
|
||||
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
|
||||
[Dependency] private readonly SharedBiomeSystem _biome = default!;
|
||||
[Dependency] private readonly InventorySystem _inventory = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _container = default!;
|
||||
[Dependency] private readonly EntityLookupSystem _lookup = default!;
|
||||
@@ -449,7 +454,7 @@ namespace Content.Shared.Movement.Systems
|
||||
}
|
||||
|
||||
if (_inventory.TryGetSlotEntity(mover.Owner, "shoes", out var shoes) &&
|
||||
EntityManager.TryGetComponent<FootstepModifierComponent>(shoes, out var modifier))
|
||||
TryComp<FootstepModifierComponent>(shoes, out var modifier))
|
||||
{
|
||||
sound = modifier.Sound;
|
||||
return true;
|
||||
@@ -461,10 +466,10 @@ namespace Content.Shared.Movement.Systems
|
||||
private bool TryGetFootstepSound(TransformComponent xform, bool haveShoes, [NotNullWhen(true)] out SoundSpecifier? sound)
|
||||
{
|
||||
sound = null;
|
||||
MapGridComponent? grid;
|
||||
|
||||
// Fallback to the map
|
||||
if (xform.MapUid == xform.GridUid ||
|
||||
xform.GridUid == null)
|
||||
// Fallback to the map?
|
||||
if (xform.GridUid == null)
|
||||
{
|
||||
if (TryComp<FootstepModifierComponent>(xform.MapUid, out var modifier))
|
||||
{
|
||||
@@ -475,25 +480,30 @@ namespace Content.Shared.Movement.Systems
|
||||
return false;
|
||||
}
|
||||
|
||||
var grid = _mapManager.GetGrid(xform.GridUid.Value);
|
||||
var tile = grid.GetTileRef(xform.Coordinates);
|
||||
|
||||
if (tile.IsSpace(_tileDefinitionManager))
|
||||
return false;
|
||||
grid = _mapManager.GetGrid(xform.GridUid.Value);
|
||||
var position = grid.LocalToTile(xform.Coordinates);
|
||||
|
||||
// If the coordinates have a FootstepModifier component
|
||||
// i.e. component that emit sound on footsteps emit that sound
|
||||
foreach (var maybeFootstep in grid.GetAnchoredEntities(tile.GridIndices))
|
||||
var anchored = grid.GetAnchoredEntitiesEnumerator(position);
|
||||
|
||||
while (anchored.MoveNext(out var maybeFootstep))
|
||||
{
|
||||
if (EntityManager.TryGetComponent(maybeFootstep, out FootstepModifierComponent? footstep))
|
||||
if (TryComp<FootstepModifierComponent>(maybeFootstep, out var footstep))
|
||||
{
|
||||
sound = footstep.Sound;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!grid.TryGetTileRef(position, out var tileRef))
|
||||
{
|
||||
sound = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Walking on a tile.
|
||||
var def = (ContentTileDefinition) _tileDefinitionManager[tile.Tile.TypeId];
|
||||
var def = (ContentTileDefinition) _tileDefinitionManager[tileRef.Tile.TypeId];
|
||||
sound = haveShoes ? def.FootstepSounds : def.BarestepSounds;
|
||||
return sound != null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user