[Mod] sourround holes by hedges etc [detect_holes]

Post Reply
Posts: 4170
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

[Mod] sourround holes by hedges etc [detect_holes]

by Sokomine » Post

This is a funny little experiment done in order to protect mobs (and players) from falling into one of those many holes that can be found in MT's surface. The world generated is quite intresting when exploring.
Note: The algorithm doesn't *really* know about the holes as such - it just places something around the holes - it's just the start of edge detection)

Protection will not always be perfect as the height of the hedge built from leaves is not adjusted to the sourrounding terrain. Yet in many cases it works quite well and will at least alert the traveller to the problem of the hole. A typical example, close up:

The top of cliffs will also be protected:

If the ground is desert stone, desert cobble will be placed instead of leaves. In all other places, wooden fences will be used. Sometimes that works quite well:

Or, as a smaller example, here:

Fence posts covering steep hills may not be the most optimal solution. Not all places will look as good as in the screenshots. It might be worth limiting the mod to leaves and desert cobble.

If meselamps are placed, the edges become very visible to the human eye. The algorithm just isn't aware of them yet - there's no connection between detected points.

This is how it would look like if nodes would be considered as "dangerous cliffs" already if their neighbour would be just one node lower (instead of 2-3):

The whole detection is based on the heightmap provided by mapgen and is very fast. The nodes are placed using set_node. As there are not too many to be placed, it's fast enough.

Download: https://github.com/Sokomine/detect_holes/archive/master.zip
Browse code: https://github.com/Sokomine/detect_holes
Version: 1.0
Licence: GPLv3 (if you want a license; really, it's more like a code example)
Depends on: default
(133.19 KiB) Not downloaded yet
(57.87 KiB) Not downloaded yet
(216.33 KiB) Not downloaded yet
A list of my mods can be found here.

User avatar
Posts: 1752
Joined: Mon Jul 11, 2016 21:08
GitHub: tacotexmex
In-game: tacotexmex

Re: [Mod] sourround holes by hedges etc [detect_holes]

by texmex » Post

Quite interesting idea, Sokomine!
Mods | Support Mesehub: bc1qluuests9rxmlnvpjrhsnyjg9ucwy6z3r0y3srw

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 11 guests