diff --git a/scenes/World.cs b/scenes/World.cs index 43634af..12e6fd0 100644 --- a/scenes/World.cs +++ b/scenes/World.cs @@ -20,7 +20,7 @@ public class World : Spatial { public const int NumChunkRows = 3; public const int NumChunkColumns = NumChunkRows; - + private readonly System.Collections.Generic.Dictionary _tileTypeInfos = new(); private readonly Godot.Collections.Dictionary _cachedWorldChunks; @@ -138,7 +138,8 @@ public class World : Spatial { GD.Load("res://materials/WorldTileTypeMaterial.tres"); Color tileTypeColor = (Color)worldTileTypeShaderMaterial.GetShaderParam(tileTypeName + "Color"); - _tileTypeInfos[tileTypeColor.ToRgba32()] = new HexTile3D.TileTypeInfo(tileTypeName, tileTypeColor, tileTypeMask); + _tileTypeInfos[tileTypeColor.ToRgba32()] = + new HexTile3D.TileTypeInfo(tileTypeName, tileTypeColor, tileTypeMask); } public void InitNoiseGenerator() { @@ -274,6 +275,13 @@ public class World : Spatial { // TODO: MarkCellUnwalkable(cell); // else if (environmentRandom.NextDouble() < 0.01) + } else if (tileTypeInfo.Name == "Water" || tileTypeInfo.Name == "LightWater" || + tileTypeInfo.Name == "DeepWater") { + Spatial rockAsset = SelectAsset(textureCoord, _rockAssets, environmentRandom, 0.01); + if (rockAsset != null) { + chunk.Entities.AddChild(rockAsset); + MarkCellUnwalkable(HexGrid.GetHexAtOffset(offsetCoord)); + } // { // var chestAsset = (Chest)_chestScene.Instance(); // var assetTransform = Transform.Identity; @@ -488,10 +496,8 @@ public class World : Spatial { if ((entity.EntityMask ^ tileTypeMask) != 0) { nextHexCost = 0; } - } - else - { - GD.Print("Could not find tile type info for color " + tileTypeColor); + } else { + GD.Print("Could not find tile type info for color " + tileTypeColor); } }