#How do I make a flooring similar to sand and grass?

1 messages · Page 1 of 1 (latest)

frigid trail
#

I'm wanting to make a custom "dock" flooring that has a custom outline with water and doesn't have the grass outline.

slate rapids
#

like an auto-tile with a custom border?

frigid trail
#

Yeah!

slate rapids
#

So all you should have to do is create a custom class that extends AutoTile & then set your tile's constructed type as that type. And then to get a custom border rather than the default grass border, you'll have to override the GetAutoTileBorder method and return a texture and a color for that texture to render with

#

the texture has to have a special layout to work correctly; i can just share one of the reference images i use as an example hang on

#

here's the sheet for the default auto-tile border textures: water, grass, dirt path, and sand :)

frigid trail
#

Thank you!

slate rapids
#

here's also the default impl of GetAutoTileBorder for reference; it's a little terrible since the basegame tiles are hardcoded here rather than custom subclasses, but obviously you only have to return the information for your specific tile in your override

public virtual (TextureRegion Texture, Color Color, float Priority)? GetAutoTileBorder(TileInstance instance, TileInstance neighbor, int layer, int autoTileIndex, Func<Point, int, TileInstance> getRelatedTileFunc) {
    if (layer == 1) {
        // water border layer
        Color? color = this.BaseName == "Sand" ? this.ColorSettings.Get(this.Colors, 0) : null;
        return (TextureHandler.AutoTileTexture[new Point(autoTileIndex, 0)], color ?? ColorHelper.FromHexRgb(0x917355), color != null ? 10 : 0);
    } else {
        // other layers
        var (index, priority) = this.BaseName switch {
            "Grass" or "FlowerGrass" => (1, 10),
            "DirtPath" => (2, 1),
            "Sand" => (3, 10),
            _ => (-1, -1)
        };
        return index >= 0 ? (TextureHandler.AutoTileTexture[new Point(autoTileIndex, index)], this.ColorSettings.Get(this.Colors, 0), priority) : null;
    }
}
slate rapids
#

lmk if you have any additional questions!! & also feel free to share your final code here for anyone who may need it in the future :)