Merge branch 'main' into vortechnix

This commit is contained in:
VorTechnix 2021-06-02 17:59:06 -07:00
commit 8bffeda5b5
31 changed files with 9027 additions and 4 deletions

72
.docs/.eleventy.js Normal file
View file

@ -0,0 +1,72 @@
const path = require("path");
const htmlentities = require("html-entities");
const Image = require("@11ty/eleventy-img");
var nextid = 0;
async function shortcode_image(src, alt, classes = "") {
let metadata = await Image(src, {
widths: [300, null],
formats: ["avif", "jpeg"],
outputDir: `./_site/img/`,
filenameFormat: (_id, src, width, format, _options) => {
const extension = path.extname(src);
const name = path.basename(src, extension);
return `${name}-${width}w.${format}`;
}
});
console.log(metadata);
let imageAttributes = {
class: classes,
alt: htmlentities.encode(alt),
sizes: Object.values(metadata)[0].map((el) => `${el.width}w`).join(" "),
loading: "lazy",
decoding: "async",
};
// You bet we throw an error on missing alt in `imageAttributes` (alt="" works okay)
return Image.generateHTML(metadata, imageAttributes);
}
async function shortcode_image_url(src) {
let metadata = await Image(src, {
widths: [ null ],
formats: [ "jpeg" ],
outputDir: `./_site/img/`,
filenameFormat: (_id, src, width, format, _options) => {
const extension = path.extname(src);
const name = path.basename(src, extension);
return `${name}-${width}w.${format}`;
}
});
console.log(metadata);
let data = metadata.jpeg[metadata.jpeg.length - 1];
return data.url;
}
async function shortcode_cssbox(content, src) {
let idprev = `image-${nextid}`;
nextid += 1;
let idthis = `image-${nextid}`;
let idnext = `image-${nextid + 1}`;
return `<div class="cssbox">
<a id="${idthis}" href="#${idthis}">${await shortcode_image(src, content, "cssbox_thumb", "300w")}
<span class="cssbox_full">${await shortcode_image(src, content, "", "1920w")}</span>
</a>
<a class="cssbox_close" href="#void"></a>
<a class="cssbox_prev" href="#${idprev}">&lt;</a>
<a class="cssbox_next" href="#${idnext}">&gt;</a>
</div>`;
}
module.exports = function(eleventyConfig) {
// eleventyConfig.addPassthroughCopy("images");
// eleventyConfig.addPassthroughCopy("css");
eleventyConfig.addShortcode("image", shortcode_image);
eleventyConfig.addJavaScriptFunction("image", shortcode_image);
eleventyConfig.addShortcode("image-url", shortcode_image_url);
eleventyConfig.addPairedShortcode("cssbox", shortcode_cssbox);
}

1
.docs/.eleventyignore Normal file
View file

@ -0,0 +1 @@
css/

View file

@ -0,0 +1,6 @@
{
"layout": "theme.njk",
"title": "Changelog",
"tags": "navigable",
"date": "2002-01-01"
}

1
.docs/Changelog.md Symbolic link
View file

@ -0,0 +1 @@
../CHANGELOG.md

View file

@ -0,0 +1,6 @@
{
"layout": "theme.njk",
"title": "Reference",
"tags": "navigable",
"date": "2001-01-01"
}

1
.docs/Reference.md Symbolic link
View file

@ -0,0 +1 @@
../Chat-Command-Reference.md

35
.docs/_includes/theme.njk Normal file
View file

@ -0,0 +1,35 @@
---
---
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>{{ title }} • WorldEditAdditions</title>
<link rel="stylesheet" href="/theme.css" />
</head>
<body>
<nav>
<h1>
<img src="https://starbeamrainbowlabs.com/images/placeholder/?width=64&height=64&text=%20?%20" alt="Placeholder logo" class="icon medium" />
WorldEditAdditions
</h1>
<ul>
{% for navitem in collections.navigable %}
<li {% if page.url == navitem.url %}aria-current="page"{% endif %}>
<a href="{{ navitem.url }}" class="nav">{{ navitem.data.title }}</a>
</li>
{% endfor %}
<li><a href="https://github.com/sbrl/Minetest-WorldEditAdditions/" class="nav">GitHub</a></li>
</ul>
</nav>
{{ content | safe }}
<footer>
<p>Built with ❤ by <a href="https://starbeamrainbowlabs.com/">Starbeamrainbowlabs</a></p>
<p>Tech: <a href="https://www.11ty.dev/">Eleventy</a></p>
<p>Licensed under <a href="https://www.mozilla.org/en-US/MPL/2.0/">Mozilla Public Licence 2.0</a> (<a href="https://tldrlegal.com/license/mozilla-public-license-2.0-(mpl-2)">tldr</a>)</p>
</footer>
</body>
</html>

5
.docs/css.njk Normal file
View file

@ -0,0 +1,5 @@
---
permalink: theme.css
---
{% include "css/theme.css" %}
{% include "css/CSSBox/cssbox.css" %}

1
.docs/css/CSSBox Submodule

@ -0,0 +1 @@
Subproject commit 2234546c25d51770086f972b0f330d4087e7c829

224
.docs/css/theme.css Normal file
View file

@ -0,0 +1,224 @@
/* Base CSS */
/*
* This CSS file contains (for me) logical style defaults that are easy to read.
*
* This file is quite often used as a starting point for other projects.
*
* Todo:
* <button>
* <inputs>
* <progress>
* <meter>
*/
:root {
--bg-main: #8ABEF6;
--bg-bright: #38871e;
--bg-alt: #3F57B4;
--bg-transcluscent-slight: rgba(255, 255, 255, 0.1);
--bg-transcluscent: rgba(255, 255, 255, 0.8);
--text-main: #3F57B4;
--text-bright: #efefef;
--text-alt: #38871e;
--highlight: hsl(353, 100%, 36%);
}
/* @media (prefers-color-scheme: dark) {
:root {
--bg-main: #232323;
--bg-bright: black;
--bg-transcluscent: rgba(50, 50, 50, 0.5);
--text-main: #f3f3f3;
}
} */
/* rem is relative to the html element, and em is relative to the current element. */
html { font-size: 100%; }
body
{
margin: 0;
font-family: sans-serif; /* Serif is awful :( */
background: var(--bg-main); /* Don't forget to update the @page one too for paged media */
color: var(--text-main);
}
title { string-set: page-title content(text); }
/* Special tweaks for paged media (e.g. PDFs) */
@page {
font-family: sans-serif;
background: var(--bg-main); /* Set the background colour to cover the whole page */
@top-right {
content: "By Starbeamrainbowlabs";
opacity: 0.6;
}
@bottom-right {
content: "Page " counter(page) " of " counter(pages);
opacity: 0.6;
}
}
nav {
background: var(--bg-bright);
display: flex;
align-items: baseline;
font-size: 1.1em;
margin: 0;
}
nav h1 {
background: var(--bg-alt);
margin: 0;
padding: 0.5em;
font-size: 1.2em;
color: var(--text-bright);
}
nav ul {
flex: 1;
list-style-type: none;
margin: 0; padding: 0;
display: flex;
justify-content: space-evenly;
}
nav ul li {
background: var(--bg-transcluscent-slight);
}
nav a {
display: inline-block;
padding: 1.2em 3em;
text-decoration: none;
font-weight: bold;
color: var(--text-bright);
}
/* A small tweak to things more responsive */
iframe, object, embed, img, table
{
max-width: 100%;
}
picture img { height: initial; }
/* Turn the user's cursor into a hand when over things they can click */
button, summary
{
cursor: pointer;
}
th, td
{
margin: 4px 6px;
padding: 4px 6px;
}
a { font-weight: bold; }
/* a:not(.nav) { color: hsl(208, 67%, 40%); }
a:not(.nav):hover { color: hsl(214, 67%, 50%); }
a:not(.nav):active, a:focus { color: hsl(214, 87%, 60%); } */
a:not(.nav):visited { color: hsl(240, 77%, 60%); }
pre { page-break-inside: avoid; break-inside: avoid; }
pre, code {
white-space: pre-wrap;
-moz-tab-size: 4;
tab-size: 4;
}
/* todo add the rest of the textbox like inputs here */
input[type=text], input[type=number], textarea
{
margin: 3px 5px;
padding: 5px 8px;
background: var(--bg-bright);
border: 0;
border-radius: 5px;
}
/* Utility / layout aids */
.float.left { float: left; }
.float.right { float: right; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.flex-2 { flex: 2; }
.flex-3 { flex: 3; }
.flex-4 { flex: 4; }
.flex-5 { flex: 5; }
.flex-6 { flex: 6; }
.small-spacing { margin: 0.25em 0.35em; padding: 0.25em 0.35em; }
.med-spacing { margin: 0.45em 0.65em; padding: 0.45em 0.65em; }
.high-spacing { margin: 1em 1.25em; padding: 1em 1.25em; }
.text-left { text-align: left; }
.text-centre { text-align: center; }
.text-right { text-align: right; }
.small-text { font-size: 0.8rem; }
.medium-text { font-size: 1rem; }
.large-text { font-size: 1.3rem; }
.bold-text { font-weight: bolder; }
.block { display: block; }
.inline { display: inline; }
.inline.block { display: inline-block; }
.invisilink { text-decoration: none; color: inherit; }
.invisilist { list-style-type: none; margin: 5px; padding: 5px; }
.icon { vertical-align: middle; }
.icon.tiny { max-width: 1em; max-height: 1em; }
.icon.small { max-width: 1.25em; max-height: 1.25em; }
.icon.medium { max-width: 2em; max-height: 2em; }
.icon.large { max-width: 5em; max-height: 5em; }
.img-text-middle{ vertical-align: middle; }
.bigbox {
display: flex;
flex-direction: column;
align-items: center; justify-content: center;
background: content-box linear-gradient(var(--bg-transcluscent), var(--bg-transcluscent)),
var(--bg) center / cover;
height: 80vh;
padding: 0 5em 0 5em;
box-sizing: border-box;
}
.bigbox h1 {
margin-top: 0;
font-size: 3em;
color: var(--text-alt);
}
.bigbox :last-child { margin-bottom: 7em; }
.features-large {
margin: 3em 0;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-evenly;
}
.features-large figure {
background: var(--bg-transcluscent);
margin: 0.1em;
padding: 1em;
max-width: 15em;
}
/* .features-large figure img {
max-width: 12em;
} */
.cssbox-gallery {
display: flex;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 936 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 317 KiB

BIN
.docs/images/forest.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 474 KiB

BIN
.docs/images/gallery-a.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 KiB

BIN
.docs/images/gallery-b.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

BIN
.docs/images/maze2d-alt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 KiB

BIN
.docs/images/maze2d.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 354 KiB

59
.docs/index.html Normal file
View file

@ -0,0 +1,59 @@
---
layout: theme.njk
title: Welcome
tags: navigable
date: 2000-01-01
---
<section class="bigbox" style="--bg: url({% image-url "images/banner-main.jpeg" %})">
<h1>WorldEditAdditions</h1>
<p><em>Extra tools and commands to extend <a href="https://github.com/Uberi/Minetest-WorldEdit">WorldEdit</a> for <a href="https://www.minetest.net/">Minetest</a></em></p>
<p>If you can dream of it, it probably belongs here!</p>
</section>
<section class="features-large">
<figure>
{% image "images/maze2d-alt.png", "A green 2D hedge maze, made with the //maze command" %}
<!-- <img src="/images/maze2d-alt.png" alt="A green 2D hedge maze, made with the //maze command" /> -->
<figcaption>
<p>Use <code>//maze</code> and <code>//maze3d</code> to generate customisable mazes in 2 or 3 dimensions.</p>
<p>Customise the path sizing for additional artistic control.</p>
</figcaption>
</figure>
<figure>
{% image "images/forest.png", "A forest of orange and lemon trees from the cooltrees mod, along with some bushes from Minetest Game." %}
<!-- <img src="/images/forest.png" alt="A forest of orange and lemon trees from the cooltrees mod, along with some bushes from Minetest Game." /> -->
<figcaption>
<p>Save time by creating instant forests with <code>//forest</code>.</p>
<p>Artibrary mixes of saplings are supported too as a weighted list.</p>
</figcaption>
</figure>
<figure>
{% image "images/conv-layers.png", "A small mountain smoothed with //smoothadv and topped with snow with //overlay" %}
<!-- <img src="/images/conv-layers.png" alt="A small mountain smoothed with //smoothadv and topped with snow with //overlay" /> -->
<figcaption>
<p>Unlock a continuously growing library of commands, such as <code>//smoothadv</code> for easy terrain smoothing, and <code>//overlay</code> for overlaying a node on top of terrain.</p>
<p>Many more commands are waiting to be discovered, including <code>//torus</code>, <code>//bonemeal</code>, and <code>//scale</code>.</p>
</figcaption>
</figure>
<figure>
{% image "images/torus-bonemeal.png", "A dirt torus with a grassy top, and a meadow of grass/flowers. Demonstrates //layers and //bonemeal. Doesn't have much to do with the sentences below - I just thought it looked nice as meta commands are difficult to find a good picture for." %}
<img src="/images/torus-bonemeal.png" alt="A dirt torus with a grassy top, and a meadow of grass/flowers. Demonstrates //layers and //bonemeal. Doesn't have much to do with the sentences below - I just thought it looked nice as meta commands are difficult to find a good picture for." />
<figcaption>
<p>Powerful meta commands such as <code>//multi</code> for executing multiple commands at once and <code>//subdivide</code> for running commands on areas of virtually unlimited size enable convenience and enhance flexibility.</p>
</figcaption>
</figure>
</section>
<!-- Potentially we might want some inspiration from https://codepen.io/emared/pen/gWGBLR here -->
<section class="cssbox-gallery">
{% cssbox "images/gallery-a.jpeg" %}
A scene demonstrating <code>//replacemix</code>, <code>//ellipsoid</code>, <code>//layers</code>, <code>smoothadv</code> (aka <code>convolve</code> and <code>conv</code>), and <code>//floodfill</code> - all of which are provided by WorldEditAdditions.
{% endcssbox %}
{% cssbox "images/gallery-b.jpeg" %}
The inside of a 3d maze made with <code>//maze3d</code>. Lighting was placed manually to improve screenshot quality.
{% endcssbox %}
</section>

8329
.docs/package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

25
.docs/package.json Normal file
View file

@ -0,0 +1,25 @@
{
"name": "worldeditadditions",
"version": "1.0.0",
"description": "Documentation website for WorldEditAdditions",
"main": "index.js",
"private": true,
"scripts": {
"test": "echo \"No tests have been implemented yet\""
},
"repository": {
"type": "git",
"url": "git+https://github.com/sbrl/Minetest-WorldEditAdditions.git"
},
"author": "Starbeamrainbowlabs",
"license": "MPL-2.0",
"bugs": {
"url": "https://github.com/sbrl/Minetest-WorldEditAdditions/issues"
},
"homepage": "https://github.com/sbrl/Minetest-WorldEditAdditions#readme",
"devDependencies": {
"@11ty/eleventy": "^0.12.1",
"@11ty/eleventy-img": "^0.9.0",
"html-entities": "^2.3.2"
}
}

176
.gitignore vendored
View file

@ -1,3 +1,5 @@
_site/
# Created by https://www.toptal.com/developers/gitignore/api/git
# Edit at https://www.toptal.com/developers/gitignore?templates=git
@ -58,3 +60,177 @@ luac.out
*.i*86
*.x86_64
*.hex
# Created by https://www.toptal.com/developers/gitignore/api/lua,node
# Edit at https://www.toptal.com/developers/gitignore?templates=lua,node
### Lua ###
# Compiled Lua sources
luac.out
# luarocks build files
*.src.rock
*.zip
*.tar.gz
# Object files
*.o
*.os
*.ko
*.obj
*.elf
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
*.def
*.exp
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional stylelint cache
.stylelintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
.env*.local
# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache
# Next.js build output
.next
# Nuxt.js build / generate output
.nuxt
dist
# Storybook build outputs
.out
.storybook-out
storybook-static
# rollup.js default build output
dist/
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# Temporary folders
tmp/
temp/
# End of https://www.toptal.com/developers/gitignore/api/lua,node

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule ".docs/css/CSSBox"]
path = .docs/css/CSSBox
url = https://github.com/TheLastProject/CSSBox.git

View file

@ -22,6 +22,7 @@ Note to self: See the bottom of this file for the release template text.
- `//multi`: Improve resilience by handling some edge cases
- `//layers`: Fix crash due to outdated debug code
- `//erode`/snowballs: Fix assignment to undeclared variable
- `//floodfill`: Fix error handling
## v1.11: The big data update (25th January 2021)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 MiB

After

Width:  |  Height:  |  Size: 3.5 MiB

View file

@ -27,6 +27,7 @@ function worldeditadditions.noise2d(pos1, pos2, noise_params)
local perlin_map = PerlinNoiseMap(noise_params, heightmap_size)
-- TODO: apply the perlin noise map here
local stats = { added = 0, removed = 0 }

View file

@ -83,13 +83,16 @@ end
--- Filters the items in the given table using the given function.
-- The function is executed for each item in the list. If it returns true, the
-- item is kept. If it returns false, the item is discarded.
-- Arguments passed to the function: item, i
-- ...where item is the item to filter, and i is the index in the table the item
-- is located at.
-- @param tbl table The table of values to filter.
-- @param func function<any>:bool The filter function to execute - should return a boolean value indicating whether the item provided as the first argument should be kept
-- @param func function<any, number>:bool The filter function to execute - should return a boolean value indicating whether the item provided as the first argument should be kept
-- @returns table A new table containing the values that the given function returned true for.
function worldeditadditions.table_filter(tbl, func)
local result = {}
for i,value in ipairs(tbl) do
if func(value) then
if func(value, i) then
table.insert(result, value)
end
end

View file

@ -24,8 +24,7 @@ worldedit.register_command("floodfill", {
replace_node = worldedit.normalize_nodename(replace_node)
if not replace_node then
worldedit.player_notify(name, "Error: Invalid node name.")
return false
return false, "Error: Invalid node name."
end
return true, replace_node, radius

View file

@ -0,0 +1,18 @@
-- ██████ ██████ ██████ ███████
-- ██ ██ ██ ██ ██ ██
-- ██ ██ ██ ██ ██ ███████
-- ██ ██ ██ ██ ██ ██
-- ██████ ██████ ██████ ███████
-- This directory contains support for the doc mod:
-- https://content.minetest.net/packages/Wuzzy/doc/
-- API docs: https://repo.or.cz/minetest_doc.git/blob/HEAD:/API.md
-- The strategy here is not to have duplicate content, but to pull data from
-- existing sources.
-- Long-form article descriptions: Chat-Command-Reference.md
-- Short descriptions: Undecided, but maybe worldedit.registered_commands
worldeditadditions.doc = {}
dofile(worldeditadditions_commands.modpath.."/doc/parse_reference.lua")

View file

@ -0,0 +1,45 @@
local function get_reference()
local lines = {}
for line in io.lines(worldeditadditions_commands.modpath.."/Chat-Command-Reference.md") do
table.insert(lines, line)
end
return lines
end
local function group_by_heading(lines, max_level)
local groups = {}
local acc = {}
for i,line in ipairs(lines) do
if worldeditadditions.str_starts(line, "#") then
local _, _, heading, headingtext = line:find("(#+)%s*(.*)")
if #heading <= max_level then
table.insert(groups, {
level = #heading,
heading = headingtext,
text = table.concat(acc, "\n")
})
acc = {}
end
else
table.insert(acc, line)
end
end
return groups
end
function worldeditadditions.doc.parse_reference()
local lines = get_reference()
local headings = worldeditadditions.table_filter(
group_by_heading(lines, 2),
function(item, i) return item.level ~= 2 end
)
for i,value in ipairs(headings) do
print(i, "level", level, "heading", heading, "text", text)
end
end
worldeditadditions.doc.parse_reference()

View file

@ -62,6 +62,18 @@ else
minetest.log("action", "[WorldEditAdditions] bonemeal mod not detected: //bonemeal and //forest commands not registered (if you see this message and you're using an alternative mod that provides bonemeal, please get in touch by opening an issue)")
end
-- Minetest doesn't allow you to read from files outside the mod
-- directory - even if you're part of a modpack you can't read from the main
-- modpack directory. Furthermore, symlinks don't help.
-- If you have a solution to this issue, please comment on this GitHub issue:
-- https://github.com/sbrl/Minetest-WorldEditAdditions/issues/55
-- NOTE TO SELF: When uncommenting this, also add "doc?" to depends.txt
-- if minetest.get_modpath("doc") then
-- dofile(we_c.modpath.."/doc/init.lua")
-- else
-- minetest.log("action", "[WorldEditAdditions] doc mod not detected: not registering doc category with extended help")
-- end
worldedit.alias_command("smoothadv", "convolve")
worldedit.alias_command("conv", "convolve")