[Mod] sourround holes by hedges etc [detect_holes]

Sokomine
Member
 
Posts: 3834
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine

[Mod] sourround holes by hedges etc [detect_holes]

by Sokomine » Sun Jul 08, 2018 16:04

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)
Image

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:
Image

The top of cliffs will also be protected:
Image

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:
Image

Or, as a smaller example, here:
Image

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.
Image

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):
Image

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
Attachments
detect_holes3.jpg
(133.19 KiB) Not downloaded yet
detect_holes2.jpg
(57.87 KiB) Not downloaded yet
detect_holes1.jpg
(216.33 KiB) Not downloaded yet
A list of my mods can be found here.
 

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


Return to WIP Mods



Who is online

Users browsing this forum: No registered users and 6 guests