Jump to content

Covering all tiles with an object based on class in a random map


Recommended Posts

This is for https://github.com/0ad-matters/community-maps-2/issues/134

This works but I think there must be a better way. It seems crude, and the object (a placement obstruction) covers most, but not all, the tiles. Any suggestions?

The usage of createArea() was already in the map script. The new code is the call to createDecoration()
 

    g_Map.log("Freezing water");
    createArea(
        new MapBoundsPlacer(),
        [
            new TerrainPainter("alpine_ice_01"),
            new TileClassPainter(clIce),
            new SmoothElevationPainter(ELEVATION_SET, heightSeaGround - 0.1, 0),
        ],
        stayClasses(clWater, 0));

    createDecoration(
        [
            [new SimpleObject("obstructors/placement", 1, 1, 0, 0)],
        ],
        [
            scaleByMapSize(600, 1800),
        ],
        stayClasses(
            clIce, 0,
        )
    );

 

screenshot0044.png

  • Like 2
Link to comment
Share on other sites

So this works, got some help from @Jammyjamjamman and @trompetin17

 

    g_Map.log("Freezing water");
    const IceArea = new createArea(
        new MapBoundsPlacer(),
        [
            new TerrainPainter("alpine_ice_01"),
            new TileClassPainter(clIce),
            new SmoothElevationPainter(ELEVATION_SET, heightSeaGround - 0.1, 0),
        ],
        stayClasses(clWater, 0));

    for (const position of IceArea.getPoints())
        g_Map.placeEntityPassable("obstructors/placement", 0, position);

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...